diff --git a/Bin/DLL/NetworkAPI_x86D.pdb b/Bin/DLL/NetworkAPI_x86D.pdb deleted file mode 100644 index 39d11475..00000000 Binary files a/Bin/DLL/NetworkAPI_x86D.pdb and /dev/null differ diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 15e799bf..e804838a 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -34,28 +34,32 @@ namespace DanBias Client::GameClientState::ProtocolStruct* protocolData; switch (pType) { - case protocol_PlayerNavigation: + case protocol_Gamplay_PlayerNavigation: break; - case protocol_PlayerPosition: + case protocol_Gamplay_PlayerPosition: protocolData = new Client::GameClientState::PlayerPos; for(int i = 0; i< 3; i++) { ((Client::GameClientState::PlayerPos*)protocolData)->playerPos[i] = p[i].value.netFloat; } - gameClientState->Protocol(protocolData); + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); delete protocolData; protocolData = NULL; break; - case protocol_ObjectPosition: + case protocol_Gamplay_ObjectPosition: protocolData = new Client::GameClientState::ObjPos; for(int i = 0; i< 16; i++) { ((Client::GameClientState::ObjPos*)protocolData)->worldPos[i] = p[i].value.netFloat; } - gameClientState->Protocol(protocolData); + + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); + delete protocolData; protocolData = NULL; break; @@ -79,9 +83,9 @@ namespace DanBias } public: - Client::GameClientState* gameClientState; + //Client::GameClientState* gameClientState; InputClass* inputObj; - MyRecieverObject* r; + MyRecieverObject* recieverObj; } data; #pragma endregion @@ -110,17 +114,17 @@ namespace DanBias prevTimeStamp = 0; QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp); - m_data->r = new MyRecieverObject; - m_data->r->nwClient = new Oyster::Network::NetworkClient(); - m_data->r->nwClient->Connect(desc.port, desc.IP); - if (!m_data->r->nwClient->IsConnected()) + m_data->recieverObj = new MyRecieverObject; + m_data->recieverObj->nwClient = new Oyster::Network::NetworkClient(); + m_data->recieverObj->nwClient->Connect(desc.port, desc.IP); + if (!m_data->recieverObj->nwClient->IsConnected()) { // failed to connect return DanBiasClientReturn_Error; } // Start in lobby state - m_data->gameClientState = new Client::LobbyState(); - m_data->gameClientState->Init(m_data->r->nwClient); + m_data->recieverObj->gameClientState = new Client::LobbyState(); + m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient); return DanBiasClientReturn_Sucess; @@ -237,27 +241,27 @@ namespace DanBias m_data->inputObj->Update(); DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same; - state = m_data->gameClientState->Update(deltaTime, m_data->inputObj); + state = m_data->recieverObj->gameClientState->Update(deltaTime, m_data->inputObj); if(state != Client::GameClientState::ClientState_Same) { - m_data->gameClientState->Release(); - delete m_data->gameClientState; - m_data->gameClientState = NULL; + m_data->recieverObj->gameClientState->Release(); + delete m_data->recieverObj->gameClientState; + m_data->recieverObj->gameClientState = NULL; switch (state) { case Client::GameClientState::ClientState_Lobby: - m_data->gameClientState = new Client::LobbyState(); + m_data->recieverObj->gameClientState = new Client::LobbyState(); break; case Client::GameClientState::ClientState_Game: - m_data->gameClientState = new Client::GameState(); + m_data->recieverObj->gameClientState = new Client::GameState(); break; default: return E_FAIL; break; } - m_data->gameClientState->Init(m_data->r->nwClient); // send game client + m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient); // send game client } return S_OK; @@ -275,15 +279,18 @@ namespace DanBias swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); SetWindowText(g_hWnd, title); - m_data->gameClientState->Render(); + m_data->recieverObj->gameClientState->Render(); return S_OK; } HRESULT DanBiasGame::CleanUp() { - m_data->gameClientState->Release(); - delete m_data->gameClientState; + m_data->recieverObj->gameClientState->Release(); + delete m_data->recieverObj->gameClientState; + m_data->recieverObj->nwClient->Disconnect(); + delete m_data->recieverObj->nwClient; + delete m_data->recieverObj; delete m_data->inputObj; delete m_data; diff --git a/Code/Game/DanBiasGame/GameClientState/C_Object.h b/Code/Game/DanBiasGame/GameClientState/C_Object.h index 8bfecdb9..18859930 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_Object.h +++ b/Code/Game/DanBiasGame/GameClientState/C_Object.h @@ -20,7 +20,7 @@ private: public: virtual void Init(ModelInitData modelInit) = 0; - virtual void setPos() = 0; + virtual void setPos(Oyster::Math::Float4x4 world) = 0; virtual void Render() = 0; virtual void Release() = 0; diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp index 686bbca9..a4ae4840 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.cpp @@ -26,9 +26,9 @@ void C_DynamicObj::Init(ModelInitData modelInit) privData->model->WorldMatrix = modelInit.world; privData->model->Visible = modelInit.visible; } -void C_DynamicObj::setPos() +void C_DynamicObj::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_DynamicObj::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h index ca0f3b8c..e0ad3be3 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_DynamicObj.h @@ -14,7 +14,7 @@ public: C_DynamicObj(void); virtual ~C_DynamicObj(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp index e47d98ef..5fb06d96 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.cpp @@ -30,9 +30,9 @@ void C_Player::Init(ModelInitData modelInit) } -void C_Player::setPos() +void C_Player::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_Player::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h index 5d9c9d59..638bd856 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_Player.h @@ -15,7 +15,7 @@ public: C_Player(void); ~C_Player(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp index 54c36c2a..f96ea56d 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.cpp @@ -29,9 +29,9 @@ void C_StaticObj::Init(ModelInitData modelInit) privData->model->Visible = modelInit.visible; } -void C_StaticObj::setPos() +void C_StaticObj::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_StaticObj::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h index 768344f0..84fc0599 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_StaticObj.h @@ -14,7 +14,7 @@ public: C_StaticObj(void); virtual ~C_StaticObj(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp index b07ec6fa..5adc3962 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.cpp @@ -27,9 +27,9 @@ void C_UIobject::Init(ModelInitData modelInit) privData->model->Visible = modelInit.visible; } -void C_UIobject::setPos() +void C_UIobject::setPos(Oyster::Math::Float4x4 world) { - + privData->model->WorldMatrix = world; } void C_UIobject::Render() diff --git a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h index 203b5398..e82b702f 100644 --- a/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h +++ b/Code/Game/DanBiasGame/GameClientState/C_obj/C_UIobject.h @@ -14,7 +14,7 @@ namespace DanBias C_UIobject(void); virtual ~C_UIobject(void); void Init(ModelInitData modelInit); - void setPos(); + void setPos(Oyster::Math::Float4x4 world); void Render(); void Release(); diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 588e6ab8..dbde1e75 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -118,7 +118,8 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI { movePlayer.bStrafeRight = true; } - + //PlayerPos* posPlayer; + //Protocol(posPlayer); privData->nwClient->Send(movePlayer); @@ -169,12 +170,45 @@ void GameState::Protocol(ProtocolStruct* pos) else if((PlayerPos*)pos) PlayerPosProtocol((PlayerPos*)pos); } + +void DanBias::Client::GameState::Protocol( PlayerPos* pos ) +{ + Oyster::Math::Float4x4 world, translate; + + world = Oyster::Math::Float4x4::identity; + translate = Oyster::Math::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(pos->playerPos[0],pos->playerPos[1],pos->playerPos[2] )); + world = translate; + privData->object[0]->setPos( world ); +} + +void DanBias::Client::GameState::Protocol( ObjPos* pos ) +{ + Oyster::Math::Float4x4 world; + for(int i = 0; i<16; i++) + { + world[i] = pos->worldPos[i]; + } + privData->object[1]->setPos(world); +} + void GameState::PlayerPosProtocol(PlayerPos* pos) { + Oyster::Math::Float4x4 world, translate; + world = Oyster::Math::Float4x4::identity; + translate = Oyster::Math::Float4x4::identity; + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(pos->playerPos[0],pos->playerPos[1],pos->playerPos[2] )); + world = translate; + privData->object[0]->setPos( world ); } void GameState::ObjectPosProtocol(ObjPos* pos) { - + Oyster::Math::Float4x4 world; + for(int i = 0; i<16; i++) + { + world[i] = pos->worldPos[i]; + } + privData->object[1]->setPos(world); } //void GameState::Protocol(LightPos pos); \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.h b/Code/Game/DanBiasGame/GameClientState/GameState.h index 05f9ac3d..5e185cef 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameState.h @@ -32,6 +32,8 @@ public: bool Release()override; void Protocol(ProtocolStruct* pos)override; + void Protocol(PlayerPos* pos); + void Protocol(ObjPos* pos); void PlayerPosProtocol(PlayerPos* pos); void ObjectPosProtocol(ObjPos* pos); //void Protocol(LightPos pos); diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index 8ae0f29c..9fc5e4c9 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -29,8 +29,8 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh } // Game client starter code goes here DanBias::DanBiasGameDesc gameDesc; - gameDesc.port = 1; - gameDesc.IP = "10.1010.303"; + gameDesc.port = 15151; + gameDesc.IP = "193.11.186.101"; gameDesc.hinst = hinst; gameDesc.nCmdShow = cmdShow;