diff --git a/Bin/DLL/NetworkAPI_x86.pdb b/Bin/DLL/NetworkAPI_x86.pdb deleted file mode 100644 index aacce35f..00000000 Binary files a/Bin/DLL/NetworkAPI_x86.pdb and /dev/null differ diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index bdec78cb..740f9a51 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -71,7 +71,7 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include @@ -79,24 +79,24 @@ $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include + $(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include false $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include + $(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include false $(SolutionDir)..\Bin\DLL\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) - $(SolutionDir)..\External\Include\;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include + $(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include @@ -111,7 +111,7 @@ Windows true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) + Misc\Misc_$(PlatformShortName)D.lib;WindowManager\WindowManager_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input\Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -123,13 +123,13 @@ Disabled DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) Windows true - GameProtocols_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + Misc\Misc_$(PlatformShortName)D.lib;WindowManager\WindowManager_$(PlatformShortName)D.lib;OysterGraphics_$(PlatformShortName)D.lib;Input\Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -142,15 +142,15 @@ true DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) Windows true true true - GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_x86.dll;%(DelayLoadDLLs) + Misc\Misc_$(PlatformShortName).lib;WindowManager\WindowManager_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input\Input_$(PlatformShortName).lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;%(DelayLoadDLLs) @@ -163,15 +163,15 @@ true DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)GameProtocols;$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) Windows true true true - GameProtocols_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_x86.dll;%(DelayLoadDLLs) + Misc\Misc_$(PlatformShortName).lib;WindowManager\WindowManager_$(PlatformShortName).lib;OysterGraphics_$(PlatformShortName).lib;Input\Input_$(PlatformShortName).lib;%(AdditionalDependencies) + NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;%(DelayLoadDLLs) diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 803c97c0..2aa4fdbc 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -8,16 +8,13 @@ #include "PlayerProtocols.h" #include "NetworkClient.h" +#include "../WindowManager/WindowShell.h" #include "L_inputClass.h" -//#include "vld.h" +#include "WinTimer.h" +#include "vld.h" namespace DanBias { - __int64 DanBiasGame::cntsPerSec = 0; - __int64 DanBiasGame::prevTimeStamp = 0; - float DanBiasGame::secsPerCnt = 0; - HINSTANCE DanBiasGame::g_hInst = NULL; - HWND DanBiasGame::g_hWnd = NULL; #pragma region Game Data @@ -29,14 +26,11 @@ namespace DanBias void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& p) override { - int pType = p[0].value.netInt; - //Client::GameClientState::ProtocolStruct* protocolData; switch (pType) { case protocol_Gamplay_PlayerNavigation: { - Client::GameClientState::KeyInput* protocolData = new Client::GameClientState::KeyInput; for(int i = 0; i< 6; i++) @@ -44,7 +38,8 @@ namespace DanBias protocolData->key[i] = p[i+1].value.netBool; } - ((Client::GameState*)gameClientState)->Protocol(protocolData); + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); delete protocolData; protocolData = NULL; } @@ -56,14 +51,31 @@ namespace DanBias { protocolData->playerPos[i] = p[i].value.netFloat; } - //if(dynamic_cast(gameClientState)) - gameClientState->Protocol(protocolData); + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); delete protocolData; protocolData = NULL; } break; + case protocol_Gamplay_CreateObject: + { + Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj; + protocolData->object_ID = p[1].value.netInt; + protocolData->path = p[2].value.netCharPtr; + for(int i = 0; i< 16; i++) + { + protocolData->worldPos[i] = p[i+3].value.netFloat; + } + + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); + + delete protocolData; + protocolData = NULL; + } + break; case protocol_Gamplay_ObjectPosition: { @@ -74,8 +86,8 @@ namespace DanBias protocolData->worldPos[i] = p[i+2].value.netFloat; } - - gameClientState->Protocol(protocolData); + if(dynamic_cast(gameClientState)) + ((Client::GameState*)gameClientState)->Protocol(protocolData); delete protocolData; protocolData = NULL; @@ -102,7 +114,9 @@ namespace DanBias public: //Client::GameClientState* gameClientState; + WindowShell* window; InputClass* inputObj; + Utility::WinTimer* timer; MyRecieverObject* recieverObj; } data; @@ -116,7 +130,8 @@ namespace DanBias //-------------------------------------------------------------------------------------- DanBiasClientReturn DanBiasGame::Initiate(DanBiasGameDesc& desc) { - if( FAILED( InitWindow( desc.hinst, desc.nCmdShow ) )) + + if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC())) return DanBiasClientReturn_Error; if( FAILED( InitDirect3D() ) ) @@ -125,13 +140,6 @@ namespace DanBias if( FAILED( InitInput() ) ) return DanBiasClientReturn_Error; - cntsPerSec = 0; - QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec); - secsPerCnt = 1.0f / (float)cntsPerSec; - - prevTimeStamp = 0; - QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp); - m_data->recieverObj = new MyRecieverObject; m_data->recieverObj->nwClient = new Oyster::Network::NetworkClient(m_data->recieverObj, Oyster::Network::NetworkProtocolCallbackType_Object); @@ -144,37 +152,26 @@ namespace DanBias } // Start in lobby state m_data->recieverObj->gameClientState = new Client::LobbyState(); - m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient); - + if(!m_data->recieverObj->gameClientState->Init(m_data->recieverObj->nwClient)) + return DanBiasClientReturn_Error; + m_data->timer = new Utility::WinTimer(); + m_data->timer->reset(); return DanBiasClientReturn_Sucess; } DanBiasClientReturn DanBiasGame::Run() { // Main message loop - MSG msg = {0}; - while(WM_QUIT != msg.message) + while(m_data->window->Frame()) { - if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - else - { - __int64 currTimeStamp = 0; - QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp); - float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt; + float dt = m_data->timer->getElapsedSeconds(); + m_data->timer->reset(); - //render - if(Update(dt) != S_OK) - return DanBiasClientReturn_Error; - if(Render(dt) != S_OK) - return DanBiasClientReturn_Error; - - prevTimeStamp = currTimeStamp; - } + if(Update(dt) != S_OK) + return DanBiasClientReturn_Error; + if(Render(dt) != S_OK) + return DanBiasClientReturn_Error; } return DanBiasClientReturn_Sucess; } @@ -184,60 +181,12 @@ namespace DanBias CleanUp(); } - - //-------------------------------------------------------------------------------------- - // Register class and create window - //-------------------------------------------------------------------------------------- - HRESULT DanBiasGame::InitWindow( HINSTANCE hInstance, int nCmdShow ) - { - // Register class - WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = 0; - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = NULL; - wcex.lpszClassName = L"BTH_D3D_Template"; - wcex.hIconSm = 0; - if( !RegisterClassEx(&wcex) ) - return E_FAIL; - - // Adjust and create window - g_hInst = hInstance; - RECT rc = { 0, 0, 1024, 768 }; - AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE ); - - if(!(g_hWnd = CreateWindow( - L"BTH_D3D_Template", - L"BTH - Direct3D 11.0 Template", - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - rc.right - rc.left, - rc.bottom - rc.top, - NULL, - NULL, - hInstance, - NULL))) - { - return E_FAIL; - } - ShowWindow( g_hWnd, nCmdShow ); - - return S_OK; - } - //-------------------------------------------------------------------------------------- // Create Direct3D with Oyster Graphics //-------------------------------------------------------------------------------------- HRESULT DanBiasGame::InitDirect3D() { - if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess) + if(Oyster::Graphics::API::Init(m_data->window->GetHWND(), false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess) return E_FAIL; return S_OK; } @@ -245,10 +194,10 @@ namespace DanBias //-------------------------------------------------------------------------------------- // Init the input //------------------------------------------------------------------------------------- - HRESULT DanBiasGame::InitInput() + HRESULT DanBiasGame::InitInput() { m_data->inputObj = new InputClass; - if(!m_data->inputObj->Initialize(g_hInst, g_hWnd, 1024, 768)) + if(!m_data->inputObj->Initialize(m_data->window->GetHINSTANCE(), m_data->window->GetHWND(), m_data->window->GetHeight(), m_data->window->GetWidth())) { MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK); return E_FAIL; @@ -258,6 +207,7 @@ namespace DanBias HRESULT DanBiasGame::Update(float deltaTime) { + m_data->inputObj->Update(); DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same; @@ -297,7 +247,7 @@ namespace DanBias wchar_t title[255]; swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); - SetWindowText(g_hWnd, title); + SetWindowText(m_data->window->GetHWND(), title); m_data->recieverObj->gameClientState->Render(); @@ -319,40 +269,4 @@ namespace DanBias return S_OK; } - //-------------------------------------------------------------------------------------- - // Called every time the application receives a message - //-------------------------------------------------------------------------------------- - LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) - { - PAINTSTRUCT ps; - HDC hdc; - - switch (message) - { - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - case WM_KEYDOWN: - - switch(wParam) - { - case VK_ESCAPE: - PostQuitMessage(0); - break; - } - break; - - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - - return 0; - } - } //End namespace DanBias \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameClientState.h b/Code/Game/DanBiasGame/GameClientState/GameClientState.h index e9cda411..fedf95df 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameClientState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameClientState.h @@ -22,6 +22,12 @@ public: int object_ID; float worldPos[16]; }; + struct NewObj :public ProtocolStruct + { + int object_ID; + char* path; + float worldPos[16]; + }; struct KeyInput :public ProtocolStruct { bool key[6]; diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 40f46156..89c320d0 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -1,4 +1,4 @@ -#include "GameState.h" +#include "GameState.h" #include "DllInterfaces/GFXAPI.h" #include "C_obj/C_Player.h" #include "C_obj/C_DynamicObj.h" @@ -101,7 +101,6 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI movePlayer.bTurnLeft = false; movePlayer.bTurnRight = false; - if(KeyInput->IsKeyPressed(DIK_W)) { movePlayer.bForward = true; @@ -127,6 +126,15 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI { privData->nwClient->Send(movePlayer); } + + //send delta mouse movement + if (KeyInput->IsMousePressed()) + { + GameLogic::Protocol_PlayerMouse deltaMouseMove; + deltaMouseMove.dxMouse = KeyInput->GetYaw(); + deltaMouseMove.dyMouse = KeyInput->GetPitch(); + //privData->nwClient->Send(deltaMouseMove); + } // send event data // @@ -204,6 +212,25 @@ void GameState::Protocol( ObjPos* pos ) privData->object[pos->object_ID]->setPos(world); } +void GameState::Protocol( NewObj* pos ) +{ + + Oyster::Math::Float4x4 world; + for(int i = 0; i<16; i++) + { + world[i] = pos->worldPos[i]; + } + ModelInitData modelData; + + modelData.world = world; + modelData.visible = true; + const char* path = pos->path; + modelData.modelPath = std::wstring(path, path + strlen(path)); + // load models + privData->object[pos->object_ID] = new C_Player(); + privData->object[pos->object_ID]->Init(modelData); +} + void GameState::Protocol( KeyInput* pos ) { bool key = false; diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.h b/Code/Game/DanBiasGame/GameClientState/GameState.h index 5ef9623d..1da091ea 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.h +++ b/Code/Game/DanBiasGame/GameClientState/GameState.h @@ -35,6 +35,7 @@ public: void Protocol(PlayerPos* pos); void Protocol(ObjPos* pos); void Protocol(KeyInput* pos); + void Protocol( NewObj* pos ); void PlayerPosProtocol(PlayerPos* pos); void ObjectPosProtocol(ObjPos* pos); //void Protocol(LightPos pos); diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h index f146f343..2041e6fe 100644 --- a/Code/Game/DanBiasGame/Include/DanBiasGame.h +++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h @@ -18,7 +18,6 @@ namespace DanBias { extern "C" { - enum DanBiasClientReturn { DanBiasClientReturn_Error, @@ -34,7 +33,7 @@ namespace DanBias int nCmdShow; }; - LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + class DanBiasGamePrivateData; class DANBIAS_GAME_DLL DanBiasGame { @@ -48,7 +47,6 @@ namespace DanBias private: - static HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow); static HRESULT InitDirect3D(); static HRESULT InitInput(); @@ -57,13 +55,8 @@ namespace DanBias static HRESULT CleanUp(); private: - static __int64 cntsPerSec; - static __int64 prevTimeStamp; - static float secsPerCnt; - - static HINSTANCE g_hInst; - static HWND g_hWnd; static DanBiasGamePrivateData* m_data; + }; diff --git a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj index 3650d06a..a7eed03c 100644 --- a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj +++ b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj @@ -80,7 +80,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D $(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) - $(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) false @@ -96,7 +96,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) $(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath) - $(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath) diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index a8a39eee..6b82da2a 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -5,8 +5,8 @@ #include #include -//#include "DanBiasServerAPI.h" -#include "DanBiasGame.h" +#include "DanBiasServerAPI.h" +//#include "DanBiasGame.h" int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow) @@ -29,7 +29,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh // Game client starter code goes here DanBias::DanBiasGameDesc gameDesc; gameDesc.port = 15151; - gameDesc.IP = "193.11.186.101"; + gameDesc.IP = "193.11.184.196"; gameDesc.hinst = hinst; gameDesc.nCmdShow = cmdShow; diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index dcd32bf1..c9d1e476 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -1,6 +1,7 @@ #include "Object.h" #include "OysterMath.h" #include "CollisionManager.h" +#include "GID.h" using namespace GameLogic; @@ -18,6 +19,7 @@ Object::Object() rigidBody->gameObjectRef = this; + this->objectID = GID(); this->type = OBJECT_TYPE_UNKNOWN; } @@ -34,6 +36,8 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type) rigidBody->gameObjectRef = this; + this->objectID = GID(); + this->type = type; } @@ -48,6 +52,10 @@ OBJECT_TYPE Object::GetType() { return this->type; } +int Object::GetID() +{ + return this->objectID; +} Oyster::Physics::ICustomBody* Object::GetRigidBody() { diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index 01864515..a6ba2b27 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -21,11 +21,13 @@ namespace GameLogic ~Object(void); OBJECT_TYPE GetType(); + int GetID(); Oyster::Physics::ICustomBody* GetRigidBody(); private: OBJECT_TYPE type; + int objectID; protected: Oyster::Physics::ICustomBody *rigidBody; }; diff --git a/Code/Game/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 2d2118bb..50dbf530 100644 --- a/Code/Game/GameProtocols/ObjectProtocols.h +++ b/Code/Game/GameProtocols/ObjectProtocols.h @@ -8,6 +8,69 @@ namespace GameLogic { + struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject + { + int object_ID; + char path[255]; + float worldMatrix[16]; + + + Protocol_CreateObject() + { + this->protocol[0].value = protocol_Gamplay_CreateObject; + this->protocol[0].type = Oyster::Network::NetAttributeType_Int; + + this->protocol[1].type = Oyster::Network::NetAttributeType_Int; + this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray; + + this->protocol[3].type = Oyster::Network::NetAttributeType_Float; + this->protocol[4].type = Oyster::Network::NetAttributeType_Float; + this->protocol[5].type = Oyster::Network::NetAttributeType_Float; + this->protocol[6].type = Oyster::Network::NetAttributeType_Float; + this->protocol[7].type = Oyster::Network::NetAttributeType_Float; + this->protocol[8].type = Oyster::Network::NetAttributeType_Float; + this->protocol[9].type = Oyster::Network::NetAttributeType_Float; + this->protocol[10].type = Oyster::Network::NetAttributeType_Float; + this->protocol[11].type = Oyster::Network::NetAttributeType_Float; + this->protocol[12].type = Oyster::Network::NetAttributeType_Float; + this->protocol[13].type = Oyster::Network::NetAttributeType_Float; + this->protocol[14].type = Oyster::Network::NetAttributeType_Float; + this->protocol[15].type = Oyster::Network::NetAttributeType_Float; + this->protocol[16].type = Oyster::Network::NetAttributeType_Float; + this->protocol[17].type = Oyster::Network::NetAttributeType_Float; + this->protocol[18].type = Oyster::Network::NetAttributeType_Float; + + } + Oyster::Network::CustomNetProtocol* GetProtocol() override + { + + this->protocol[1].value = object_ID; + this->protocol[2].value = path; + this->protocol[3].value = worldMatrix[1]; + this->protocol[4].value = worldMatrix[2]; + this->protocol[5].value = worldMatrix[3]; + this->protocol[6].value = worldMatrix[4]; + this->protocol[7].value = worldMatrix[5]; + this->protocol[8].value = worldMatrix[6]; + this->protocol[9].value = worldMatrix[7]; + this->protocol[10].value = worldMatrix[8]; + this->protocol[11].value = worldMatrix[9]; + this->protocol[12].value = worldMatrix[10]; + this->protocol[13].value = worldMatrix[11]; + this->protocol[14].value = worldMatrix[12]; + this->protocol[15].value = worldMatrix[13]; + this->protocol[16].value = worldMatrix[14]; + this->protocol[17].value = worldMatrix[15]; + this->protocol[18].value = worldMatrix[16]; + + return &protocol; + } + + private: + Oyster::Network::CustomNetProtocol protocol; + }; + + struct Protocol_ObjectPosition :public Oyster::Network::CustomProtocolObject { int object_ID; diff --git a/Code/Game/GameProtocols/PlayerProtocols.h b/Code/Game/GameProtocols/PlayerProtocols.h index 35e66127..159d9403 100644 --- a/Code/Game/GameProtocols/PlayerProtocols.h +++ b/Code/Game/GameProtocols/PlayerProtocols.h @@ -51,6 +51,34 @@ namespace GameLogic Oyster::Network::CustomNetProtocol protocol; }; + struct Protocol_PlayerMouse :public Oyster::Network::CustomProtocolObject + { + + float dxMouse; + float dyMouse; + + + Protocol_PlayerMouse() + { + this->protocol[0].value = protocol_Gamplay_PlayerMouseMovement; + this->protocol[0].type = Oyster::Network::NetAttributeType_Short; + + this->protocol[1].type = Oyster::Network::NetAttributeType_Float; + this->protocol[2].type = Oyster::Network::NetAttributeType_Float; + + } + Oyster::Network::CustomNetProtocol* GetProtocol() override + { + this->protocol[1].value = dxMouse; + this->protocol[2].value = dyMouse; + + return &protocol; + } + + private: + Oyster::Network::CustomNetProtocol protocol; + }; + struct Protocol_PlayerPosition :public Oyster::Network::CustomProtocolObject { diff --git a/Code/Game/GameProtocols/ProtocolIdentificationID.h b/Code/Game/GameProtocols/ProtocolIdentificationID.h index cb90fa7f..8e575502 100644 --- a/Code/Game/GameProtocols/ProtocolIdentificationID.h +++ b/Code/Game/GameProtocols/ProtocolIdentificationID.h @@ -8,8 +8,11 @@ /* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */ #define protocol_Gamplay_PlayerNavigation 0 -#define protocol_Gamplay_PlayerPosition 1 -#define protocol_Gamplay_ObjectPosition 2 +#define protocol_Gamplay_PlayerMouseMovement 1 +#define protocol_Gamplay_PlayerPosition 2 +#define protocol_Gamplay_CreateObject 3 +#define protocol_Gamplay_ObjectPosition 4 + #define protocol_Lobby_Msg 100 diff --git a/Code/WindowManager/WindowShell.h b/Code/WindowManager/WindowShell.h index 313fa967..d4004be2 100644 --- a/Code/WindowManager/WindowShell.h +++ b/Code/WindowManager/WindowShell.h @@ -1,4 +1,4 @@ -////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////// // Created 2013 // // Dennis Andersen, Linda Andersson // ////////////////////////////////////////////////////////// @@ -32,7 +32,7 @@ public: { parent = 0; hInstance = NULL; - windowName = L"MADAFACKA"; + windowName = L"おはよう"; windowSize.x = 800; windowSize.y = 600; windowPosition.x = 0;