From 3bfedf920aef03db278fd22b75dfd98351a412ca Mon Sep 17 00:00:00 2001 From: dean11 Date: Wed, 26 Feb 2014 16:10:04 +0100 Subject: [PATCH 1/5] GameServer - minor --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index 7c809af6..85ea810a 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -78,8 +78,8 @@ namespace DanBias //if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT()))) WindowShell::WINDOW_INIT_DESC winDesc; - winDesc.windowSize.x = 1920; - winDesc.windowSize.y = 1080; + winDesc.windowSize.x = 1280; + winDesc.windowSize.y = 720; winDesc.windowProcCallback = WindowCallBack; if(! data.window->CreateWin(winDesc) ) @@ -153,7 +153,7 @@ namespace DanBias Oyster::Graphics::API::Option p; p.modelPath = L"..\\Content\\Models\\"; p.texturePath = L"..\\Content\\Textures\\"; - p.Resolution = Oyster::Math::Float2( 1920.0f, 1080.0f ); + p.Resolution = Oyster::Math::Float2( 1280.0f, 720.0f ); //! @todo fix proper amb value p.AmbientValue = 1.3f; From b2897418978c9a3aca47cd051da7d34e550887e2 Mon Sep 17 00:00:00 2001 From: dean11 Date: Wed, 26 Feb 2014 16:57:32 +0100 Subject: [PATCH 2/5] Broken shit, dont take --- .../GameClient/GameClientState/GamingUI.cpp | 51 ++++++++++++++++++- .../GameClient/GameClientState/GamingUI.h | 4 +- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 42 +++++++++++---- 3 files changed, 82 insertions(+), 15 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GamingUI.cpp b/Code/Game/GameClient/GameClientState/GamingUI.cpp index 19fad94c..97748ee5 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.cpp +++ b/Code/Game/GameClient/GameClientState/GamingUI.cpp @@ -148,7 +148,7 @@ void GamingUI::ReadKeyInput() this->key_Shoot = true; } } - else + else this->key_Shoot = false; if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseMiddleBtn) ) @@ -172,7 +172,54 @@ void GamingUI::ReadKeyInput() } } - +void GamingUI::OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) +{ + switch ( key ) + { + case ::Input::Enum::SAMI_MouseLeftBtn: // shoot + { + Protocol_PlayerShot playerShot; + playerShot.primaryPressed = true; + playerShot.secondaryPressed = false; + playerShot.utilityPressed = false; + this->sharedData->network->Send( playerShot ); + } + break; + case ::Input::Enum::SAMI_MouseRightBtn: + { + Protocol_PlayerShot playerShot; + playerShot.primaryPressed = false; + playerShot.secondaryPressed = true; + playerShot.utilityPressed = false; + this->sharedData->network->Send( playerShot ); + } + break; + case ::Input::Enum::SAMI_MouseMiddleBtn: + { + Protocol_PlayerShot playerShot; + playerShot.primaryPressed = false; + playerShot.secondaryPressed = false; + playerShot.utilityPressed = true; + this->sharedData->network->Send( playerShot ); + } + break; + } +} +void GamingUI::OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) +{ + switch ( key ) + { + case ::Input::Enum::SAMI_MouseRightBtn: + { + Protocol_PlayerShot playerShot; + playerShot.primaryPressed = false; + playerShot.secondaryPressed = false; + playerShot.utilityPressed = false; + this->sharedData->network->Send( playerShot ); + } + break; + } +} void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) { //send delta mouse movement diff --git a/Code/Game/GameClient/GameClientState/GamingUI.h b/Code/Game/GameClient/GameClientState/GamingUI.h index c4e34441..d21ae0bd 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.h +++ b/Code/Game/GameClient/GameClientState/GamingUI.h @@ -28,9 +28,9 @@ namespace DanBias { namespace Client private: /* Overidden mouse methods */ void OnMouse ( const Input::Struct::MouseEventData& eventData ) override { } - void OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) override { } + void OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) override; void OnMouseDown ( Input::Enum::SAMI key, Input::Mouse* sender ) override { } - void OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) override { } + void OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) override; void OnMouseMovePixelPos ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override { } void OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, Input::Mouse* sender ) override; void OnMouseScroll ( int delta, Input::Mouse* sender ) override { } diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index 13ef8fef..dd20e8f3 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -44,9 +44,9 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, switch (usage) { case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS: - if(currentEnergy >= 90.0f) + if(currentEnergy >= 9.0f) { - currentEnergy -= 90.0f; + currentEnergy -= 9.0f; ForcePush(usage,dt); // add CD ((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_PrimaryShoot); @@ -54,13 +54,33 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, break; case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS: - if(currentEnergy >= 1.0f) + if( currentEnergy >= 1.0f ) { currentEnergy -= 1.0f; - ForcePull(usage,dt); - // add CD - ((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot); + if(!this->hasObject) + { + ForcePull(usage,dt); + // add CD + ((Game*)&Game::Instance())->onActionEventFnc(this->owner, WeaponAction::WeaponAction_SecondaryShoot); + } } + else //Energy drained, release object + { + ((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); + this->hasObject = false; + this->heldObject = NULL; + } + break; + + case WEAPON_USE_SECONDARY_RELEASE: + { + if (this->hasObject) //Dummy check + { + ((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); + this->hasObject = false; + this->heldObject = NULL; + } + } break; case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS: @@ -112,11 +132,11 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float if(hasObject) { pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force); - heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce); - ((DynamicObject*)(heldObject->GetCustomTag()))->RemoveManipulation(); - hasObject = false; - heldObject = NULL; - return; + this->heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce); + ((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); + this->hasObject = false; + this->heldObject = NULL; + return ; } Oyster::Math::Float radius = 4; From ffa6da1a2f403ec199799490a2ba650710206636 Mon Sep 17 00:00:00 2001 From: Dennis Andersen Date: Thu, 27 Feb 2014 08:19:50 +0100 Subject: [PATCH 3/5] GameLogic - Fixed drop on secondary, Modified how keys are sent --- .../GameClient/GameClientState/GamingUI.cpp | 128 ++++++++---------- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 35 +++-- Code/Game/GameLogic/CollisionManager.cpp | 2 +- Code/Game/GameProtocols/PlayerProtocols.h | 52 +++++-- .../GameServer/Implementation/GameClient.cpp | 2 - .../Implementation/GameSession_Gameplay.cpp | 18 ++- Code/Misc/Input/Source/Win32/Win32Mouse.cpp | 4 +- 7 files changed, 134 insertions(+), 107 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GamingUI.cpp b/Code/Game/GameClient/GameClientState/GamingUI.cpp index 97748ee5..821ba414 100644 --- a/Code/Game/GameClient/GameClientState/GamingUI.cpp +++ b/Code/Game/GameClient/GameClientState/GamingUI.cpp @@ -121,50 +121,50 @@ void GamingUI::ReadKeyInput() this->key_Jump = false; // shoot - if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseLeftBtn) ) - { - if( !this->key_Shoot ) - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = true; - playerShot.secondaryPressed = false; - playerShot.utilityPressed = false; - this->sharedData->network->Send( playerShot ); - this->key_Shoot = true; - } - } - else - this->key_Shoot = false; - - if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseRightBtn) ) - { - if( !this->key_Shoot ) - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = false; - playerShot.secondaryPressed = true; - playerShot.utilityPressed = false; - this->sharedData->network->Send( playerShot ); - this->key_Shoot = true; - } - } - else - this->key_Shoot = false; - - if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseMiddleBtn) ) - { - if( !this->key_Shoot ) - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = false; - playerShot.secondaryPressed = false; - playerShot.utilityPressed = true; - this->sharedData->network->Send( playerShot ); - this->key_Shoot = true; - } - } - else - this->key_Shoot = false; + //if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseLeftBtn) ) + //{ + // if( !this->key_Shoot ) + // { + // Protocol_PlayerShot playerShot; + // playerShot.primaryPressed = true; + // playerShot.secondaryPressed = false; + // playerShot.utilityPressed = false; + // this->sharedData->network->Send( playerShot ); + // this->key_Shoot = true; + // } + //} + //else + // this->key_Shoot = false; + // + //if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseRightBtn) ) + //{ + // if( !this->key_Shoot ) + // { + // Protocol_PlayerShot playerShot; + // playerShot.primaryPressed = false; + // playerShot.secondaryPressed = true; + // playerShot.utilityPressed = false; + // this->sharedData->network->Send( playerShot ); + // this->key_Shoot = true; + // } + //} + //else + // this->key_Shoot = false; + // + //if( this->sharedData->mouseDevice->IsBtnDown(::Input::Enum::SAMI_MouseMiddleBtn) ) + //{ + // if( !this->key_Shoot ) + // { + // Protocol_PlayerShot playerShot; + // playerShot.primaryPressed = false; + // playerShot.secondaryPressed = false; + // playerShot.utilityPressed = true; + // this->sharedData->network->Send( playerShot ); + // this->key_Shoot = true; + // } + //} + //else + // this->key_Shoot = false; if( this->sharedData->keyboardDevice->IsKeyDown(::Input::Enum::SAKI_Escape) ) { @@ -177,31 +177,13 @@ void GamingUI::OnMousePress ( Input::Enum::SAMI key, Input::Mouse* sender ) switch ( key ) { case ::Input::Enum::SAMI_MouseLeftBtn: // shoot - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = true; - playerShot.secondaryPressed = false; - playerShot.utilityPressed = false; - this->sharedData->network->Send( playerShot ); - } + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_PrimaryPress) ); break; case ::Input::Enum::SAMI_MouseRightBtn: - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = false; - playerShot.secondaryPressed = true; - playerShot.utilityPressed = false; - this->sharedData->network->Send( playerShot ); - } + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_SecondaryPress) ); break; - case ::Input::Enum::SAMI_MouseMiddleBtn: - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = false; - playerShot.secondaryPressed = false; - playerShot.utilityPressed = true; - this->sharedData->network->Send( playerShot ); - } + case ::Input::Enum::SAMI_MouseMiddleBtn: + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_UtilityPress) ); break; } } @@ -209,14 +191,14 @@ void GamingUI::OnMouseRelease ( Input::Enum::SAMI key, Input::Mouse* sender ) { switch ( key ) { + case ::Input::Enum::SAMI_MouseLeftBtn: // shoot + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_PrimaryRelease) ); + break; case ::Input::Enum::SAMI_MouseRightBtn: - { - Protocol_PlayerShot playerShot; - playerShot.primaryPressed = false; - playerShot.secondaryPressed = false; - playerShot.utilityPressed = false; - this->sharedData->network->Send( playerShot ); - } + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_SecondaryRelease) ); + break; + case ::Input::Enum::SAMI_MouseMiddleBtn: + this->sharedData->network->Send( Protocol_PlayerShot(Protocol_PlayerShot::ShootValue_UtilityRelease) ); break; } } diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index dd20e8f3..f4b5e2ec 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -54,7 +54,13 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, break; case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS: - if( currentEnergy >= 1.0f ) + if(this->hasObject) + { + ((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); + this->hasObject = false; + this->heldObject = NULL; + } + else if( currentEnergy >= 1.0f ) { currentEnergy -= 1.0f; if(!this->hasObject) @@ -76,9 +82,9 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, { if (this->hasObject) //Dummy check { - ((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); - this->hasObject = false; - this->heldObject = NULL; + //((DynamicObject*)(this->heldObject->GetCustomTag()))->RemoveManipulation(); + //this->hasObject = false; + //this->heldObject = NULL; } } break; @@ -185,22 +191,27 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt) Oyster::Math::Float4 pullForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (this->force * 0.2); - Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius); + Oyster::Collision3D::Cone hitCone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius); forcePushData args; args.pushForce = -pullForce; args.p = this->owner; - Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction); - - if(hitCone) delete hitCone; + Oyster::Physics::API::Instance().ApplyEffect(&hitCone,&args,ForcePushAction); } void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt) { - Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*2; - Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,10); + //DEBUG: + MessageBeep(MB_ICONINFORMATION); + Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized() * 2; - Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp); + //Do ray test first! + //Oyster::Collision3D::Ray r(pos, owner->GetLookDir()); + //Oyster::Physics::API::Instance().ApplyEffect(&r, this, AttemptPickUp); - if(hitSphere) delete hitSphere; + if(this->hasObject) return; + + Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos , 1); + Oyster::Physics::API::Instance().ApplyEffect(&hitSphere,this,AttemptPickUp); + return; } diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index c355fd04..acad935a 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -326,6 +326,7 @@ using namespace GameLogic; void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args) { if(obj->GetState().mass == 0) return; + if(!args) return; AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args); @@ -339,7 +340,6 @@ using namespace GameLogic; //check so that it is an object that you can pickup DynamicObject *dynamicObj = dynamic_cast(realObj); - if(!dynamicObj) return; if(dynamicObj->getManipulatingPlayer() != NULL) diff --git a/Code/Game/GameProtocols/PlayerProtocols.h b/Code/Game/GameProtocols/PlayerProtocols.h index eb34c07c..e3cea80c 100644 --- a/Code/Game/GameProtocols/PlayerProtocols.h +++ b/Code/Game/GameProtocols/PlayerProtocols.h @@ -157,37 +157,59 @@ namespace GameLogic struct Protocol_PlayerShot :public Oyster::Network::CustomProtocolObject { - bool primaryPressed; - bool secondaryPressed; - bool utilityPressed; + enum ShootValue + { + ShootValue_PrimaryPress, + ShootValue_PrimaryRelease, + ShootValue_SecondaryPress, + ShootValue_SecondaryRelease, + ShootValue_UtilityPress, + ShootValue_UtilityRelease, + } value; + //bool primaryPressed; + //bool secondaryPressed; + //bool utilityPressed; Protocol_PlayerShot() { this->protocol[0].value = protocol_Gameplay_PlayerShot; this->protocol[0].type = Oyster::Network::NetAttributeType_Short; - this->protocol[1].type = Oyster::Network::NetAttributeType_Bool; - this->protocol[2].type = Oyster::Network::NetAttributeType_Bool; - this->protocol[3].type = Oyster::Network::NetAttributeType_Bool; + this->protocol[1].type = Oyster::Network::NetAttributeType_Char; + + //this->protocol[1].type = Oyster::Network::NetAttributeType_Bool; + //this->protocol[2].type = Oyster::Network::NetAttributeType_Bool; + //this->protocol[3].type = Oyster::Network::NetAttributeType_Bool; + } + Protocol_PlayerShot(ShootValue val) + { + this->protocol[0].value = protocol_Gameplay_PlayerShot; + this->protocol[0].type = Oyster::Network::NetAttributeType_Short; + + this->protocol[1].type = Oyster::Network::NetAttributeType_Char; + this->value = val; } Protocol_PlayerShot(Oyster::Network::CustomNetProtocol& p) { - primaryPressed = p[1].value.netBool; - secondaryPressed = p[2].value.netBool; - utilityPressed = p[3].value.netBool; + value = (ShootValue)p[1].value.netChar; + //primaryPressed = p[1].value.netBool; + //secondaryPressed = p[2].value.netBool; + //utilityPressed = p[3].value.netBool; } const Protocol_PlayerShot& operator=(Oyster::Network::CustomNetProtocol& val) { - primaryPressed = val[1].value.netBool; - secondaryPressed = val[2].value.netBool; - utilityPressed = val[3].value.netBool; + value = (ShootValue)val[1].value.netChar; + //primaryPressed = val[1].value.netBool; + //secondaryPressed = val[2].value.netBool; + //utilityPressed = val[3].value.netBool; return *this; } Oyster::Network::CustomNetProtocol GetProtocol() override { - this->protocol[1].value = primaryPressed; - this->protocol[2].value = secondaryPressed; - this->protocol[3].value = utilityPressed; + this->protocol[1].value = value; + //this->protocol[1].value = primaryPressed; + //this->protocol[2].value = secondaryPressed; + //this->protocol[3].value = utilityPressed; return protocol; } diff --git a/Code/Game/GameServer/Implementation/GameClient.cpp b/Code/Game/GameServer/Implementation/GameClient.cpp index b993cb79..74795ce6 100644 --- a/Code/Game/GameServer/Implementation/GameClient.cpp +++ b/Code/Game/GameServer/Implementation/GameClient.cpp @@ -25,8 +25,6 @@ GameClient::GameClient(Utility::DynamicMemory::SmartPointerplayer; - this->isReady = false; this->character = L"char_orca.dan"; this->alias = L"Unknown"; diff --git a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp index ceb22431..18e2b224 100644 --- a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp @@ -257,9 +257,21 @@ using namespace DanBias; } void GameSession::Gameplay_PlayerShot ( Protocol_PlayerShot& p, DanBias::GameClient* c ) { - if(p.secondaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS); - if(p.primaryPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); - if(p.utilityPressed) c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS); + switch (p.value) + { + case Protocol_PlayerShot::ShootValue_PrimaryPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); + break; + case Protocol_PlayerShot::ShootValue_PrimaryRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_RELEASE); + break; + case Protocol_PlayerShot::ShootValue_SecondaryPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS); + break; + case Protocol_PlayerShot::ShootValue_SecondaryRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_RELEASE); + break; + case Protocol_PlayerShot::ShootValue_UtilityPress: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_PRESS); + break; + case Protocol_PlayerShot::ShootValue_UtilityRelease: c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_UTILLITY_RELEASE); + break; + } } void GameSession::Gameplay_ObjectPickup ( Protocol_ObjectPickup& p, DanBias::GameClient* c ) { diff --git a/Code/Misc/Input/Source/Win32/Win32Mouse.cpp b/Code/Misc/Input/Source/Win32/Win32Mouse.cpp index 4faeed64..79cb49a4 100644 --- a/Code/Misc/Input/Source/Win32/Win32Mouse.cpp +++ b/Code/Misc/Input/Source/Win32/Win32Mouse.cpp @@ -200,12 +200,12 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse) if(btn == SAMI_Unknown) return; - this->buttons[btn].isDown = !isUp; this->buttons[btn].makeCode = makeCode; //The btn is released. if(isUp) { + this->buttons[btn].isDown = false; InternalOnBtnRelease(btn); GetNormalizedPosition( mouseEventData.normalizedPos ); @@ -222,6 +222,7 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse) //The btn is down since last frame if(this->buttons[btn].isDown) { + this->buttons[btn].isDown = true; InternalOnBtnDown(btn); GetNormalizedPosition( mouseEventData.normalizedPos ); @@ -234,6 +235,7 @@ void Win32Mouse::ProccessMouseData (RAWMOUSE mouse) } else { + this->buttons[btn].isDown = true; InternalOnBtnPress(btn); GetNormalizedPosition( mouseEventData.normalizedPos ); From 5ad5ad6f5f2b4c6175c6cdbec7d09252991f2b7b Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Thu, 27 Feb 2014 09:11:13 +0100 Subject: [PATCH 4/5] =?UTF-8?q?Se=20till=20s=C3=A5=20att=20man=20inte=20g?= =?UTF-8?q?=C3=A5r=20=C3=B6ver=20maxenergy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index f4b5e2ec..401c40f8 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -105,6 +105,7 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, void AttatchmentMassDriver::Update(float dt) { + //update position of heldObject if there is an object being held if(hasObject) { @@ -116,12 +117,26 @@ void AttatchmentMassDriver::Update(float dt) heldObject->SetPosition(pos); heldObject->SetLinearVelocity(Oyster::Math::Float3::null); - currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object + if(currentEnergy < maxEnergy) + { + currentEnergy += rechargeRate * 0.5f; //rechargeRate is halfed if you are holding an object + } + } else { - currentEnergy += rechargeRate; + if(currentEnergy < maxEnergy) + { + currentEnergy += rechargeRate; + + if(currentEnergy == maxEnergy) + { + int trap = 0; + } + } } + + if(currentEnergy > maxEnergy) currentEnergy = maxEnergy; } From 44ec2323109a8f59e1523b756ac6cd61145b0dd5 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Thu, 27 Feb 2014 11:01:55 +0100 Subject: [PATCH 5/5] GL - correction of dmg and jumppad foce --- Code/Game/GameLogic/CollisionManager.cpp | 9 +++------ Code/Game/GameLogic/Level.cpp | 9 ++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index acad935a..928ddaac 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -167,9 +167,6 @@ using namespace GameLogic; { Player *hitPlayer = (Player*)realObj; hitPlayer->DamageLife(ExplosionSource->extraDamageOnCollision); - //hitPlayer->GetRigidBody()->ApplyImpulse(force); - - //hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision()); realObj->GetRigidBody()->ApplyImpulse(force * 5); //do shredding damage } @@ -192,11 +189,11 @@ using namespace GameLogic; Oyster::Math::Float angularFactor = deltaPos.GetNormalized().Dot( (objPrevVel - playerPrevVel).GetNormalized()); Oyster::Math::Float impactPower = deltaSpeed * angularFactor; - Oyster::Math::Float damageFactor = 0.01f; + Oyster::Math::Float damageFactor = 0.1f; - int damageDone = 0; - int forceThreashHold = 30; //FIX: balance this + Oyster::Math::Float damageDone = 0.0f; + Oyster::Math::Float forceThreashHold = 30.0f; //FIX: balance this if(impactPower > forceThreashHold) //should only take damage if the force is high enough { diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 385571af..50146ac8 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -68,8 +68,8 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody) break; case ObjectSpecialType_RedExplosiveBox: { - Oyster::Math::Float dmg = 120; - Oyster::Math::Float force = 500; + Oyster::Math::Float dmg = 50; + Oyster::Math::Float force = 800; Oyster::Math::Float radie = 3; gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter, dmg, force, radie); } @@ -90,8 +90,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody) break; case ObjectSpecialType_CrystalFormation: { - int dmg = 50; - //gameObj = new Crystal(rigidBody); + int dmg = 30; gameObj = new StaticObject(rigidBody, Object::DefaultOnCollision, (ObjectSpecialType)obj->specialTypeID, objIDCounter); } break; @@ -102,7 +101,7 @@ Object* Level::CreateGameObj(ObjectHeader* obj, ICustomBody* rigidBody) break; case ObjectSpecialType_JumpPad: { - float power = 500; //((JumpPadAttributes*)obj)->power; + float power = ((JumpPadAttributes*)obj)->power; Oyster::Math::Float3 dir = ((JumpPadAttributes*)obj)->direction; Oyster::Math::Float3 pushForce = dir * power; gameObj = new JumpPad(rigidBody, (ObjectSpecialType)obj->specialTypeID, objIDCounter , pushForce);