From b2e98f12078f456bfc53ef96c668ba955d7889e2 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 10:28:46 +0100 Subject: [PATCH] Debug hack + actual fixings --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 9 ++++-- Code/Game/GameClient/GameClient.vcxproj.user | 2 +- .../GameClient/GameClientState/Camera_FPS.cpp | 3 +- .../GameClient/GameClientState/GameState.cpp | 28 ++++++++++++++++--- .../GameClientState/NetLoadState.cpp | 5 +++- .../OysterGraphics.vcxproj.user | 2 +- 6 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index e6f95f79..b978597c 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -64,7 +64,12 @@ namespace DanBias { WindowShell::CreateConsoleWindow(); //if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT()))) - if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC())) + + WindowShell::WINDOW_INIT_DESC winDesc; + winDesc.windowSize.x = 1280; + winDesc.windowSize.y = 720; + + if(! data.window->CreateWin(winDesc) ) return DanBiasClientReturn_Error; if( FAILED( InitDirect3D() ) ) @@ -136,7 +141,7 @@ namespace DanBias Oyster::Graphics::API::Option p; p.modelPath = L"..\\Content\\Models\\"; p.texturePath = L"..\\Content\\Textures\\"; - p.Resolution = Oyster::Math::Float2( 1024, 768); + p.Resolution = Oyster::Math::Float2( 1280.0f, 720.0f ); //! @todo fix proper amb value p.AmbientValue = 1.0f; diff --git a/Code/Game/GameClient/GameClient.vcxproj.user b/Code/Game/GameClient/GameClient.vcxproj.user index 2e28d6f7..4b847ee6 100644 --- a/Code/Game/GameClient/GameClient.vcxproj.user +++ b/Code/Game/GameClient/GameClient.vcxproj.user @@ -1,7 +1,7 @@  - true + false $(OutDir) diff --git a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp index 8c87970b..56a026e3 100644 --- a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp +++ b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp @@ -112,7 +112,8 @@ void Camera_FPS::StrafeLeft( Float distance ) void Camera_FPS::PitchUp( Float radian ) { - this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); + //this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); + this->pitchUp = this->pitchUp + radian; // debug hack this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] ); } diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 2ae8ae21..f590f366 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -17,6 +17,7 @@ using namespace ::Oyster::Math3D; using namespace ::GameLogic; using namespace ::Utility::DynamicMemory; using namespace ::Utility::String; +using namespace ::Utility::Value; struct GameState::MyData { @@ -76,9 +77,24 @@ bool GameState::Init( SharedStateContent &shared ) this->privData->staticObjects = &shared.staticObjects; this->privData->dynamicObjects = &shared.dynamicObjects; - //tell server ready - this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); + Graphics::API::Option gfxOp = Graphics::API::GetOption(); + Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; + this->privData->camera.SetPerspectiveProjection( Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); + Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); + //tell server ready + //this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); + + // Debugg hack + this->InitiatePlayer( 0, "crate_generic.dan",Float3( 0,132, 10), Quaternion::identity, Float3(1), true ); + Graphics::Definitions::Pointlight light; + light.Pos = Float3( 0,132,0); + light.Color = Float3( 1.0f ); + light.Bright = 1.0f; + light.Radius = 1000.0f; + Graphics::API::AddLight( light ); + // end debug hack + return true; } @@ -98,6 +114,9 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa { this->privData->myId = id; this->privData->camera.SetPosition( this->privData->player.getPos() ); + Float3 offset = Float3( 0.0f ); + offset.y = this->privData->player.getScale().y + 0.5f; // debug hack +0.5f + this->privData->camera.SetHeadOffset( offset ); this->privData->camera.UpdateOrientation(); } } @@ -113,6 +132,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa GameClientState::ClientState GameState::Update( float deltaTime ) { + this->ReadKeyInput(); return this->privData->nextState; } @@ -219,8 +239,8 @@ void GameState::ReadKeyInput() //send delta mouse movement { - this->privData->camera.YawRight( -this->privData->input->GetYaw() ); - this->privData->camera.PitchUp( this->privData->input->GetPitch() ); + this->privData->camera.YawRight( this->privData->input->GetYaw() * 0.017f ); + this->privData->camera.PitchDown( this->privData->input->GetPitch() * 0.017f ); this->privData->camera.UpdateOrientation(); privData->nwClient->Send( Protocol_PlayerLook(this->privData->camera.GetLook(), this->privData->camera.GetRight()) ); diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index f50db40c..7443344e 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -54,8 +54,11 @@ bool NetLoadState::Init( SharedStateContent &shared ) // we may assume that nwClient is properly connected to the server // signals querry to server for loading instructions - this->privData->nwClient->Send( Protocol_QuerryGameType() ); + //this->privData->nwClient->Send( Protocol_QuerryGameType() ); + // debugg + this->LoadGame( "..//Content//Worlds//2ofAll_updated.bias"); + this->ChangeState( ClientState_Game ); return true; } diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.user b/Code/OysterGraphics/OysterGraphics.vcxproj.user index 9a0b0ae0..3f030911 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.user +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.user @@ -1,6 +1,6 @@  - true + false \ No newline at end of file