From e6cd1f1e5f376196c4233aa62c28ef3e01bcdf2f Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Thu, 20 Feb 2014 10:33:27 +0100 Subject: [PATCH] GameClient now objects say to client that they have moved! --- Code/Game/GameLogic/Level.cpp | 1 + Code/Game/GameLogic/Object.cpp | 2 -- Code/Game/GameLogic/Player.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 9febbe47..c9938dbd 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -300,6 +300,7 @@ bool Level::InitiateLevel(std::wstring levelPath) Object* dynamicGameObj = CreateGameObj(dynamicObjData, rigidBody_Dynamic); if (dynamicGameObj != NULL) { + dynamicGameObj->GetRigidBody()->SetSubscription(Level::PhysicsOnMoveLevel); this->dynamicObjects.Push((DynamicObject*)dynamicGameObj); } } diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 22273b7e..1f43263b 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -30,7 +30,6 @@ Object::Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfte this->objectID = objectID; this->extraDamageOnCollision = 0; this->rigidBody->SetCustomTag(this); - this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Move)((Game*)&Game::Instance())->onMoveFnc); } @@ -42,7 +41,6 @@ Object::Object(Oyster::Physics::ICustomBody *rigidBody , Oyster::Physics::ICusto this->objectID = objectID; this->extraDamageOnCollision = 0; this->rigidBody->SetCustomTag(this); - this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Move)((Game*)&Game::Instance())->onMoveFnc); } Object::~Object(void) diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 77953d43..848c528a 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -127,7 +127,7 @@ void Player::BeginFrame() } - if (key_forward <= 0.001 && key_backward <= 0.001 && key_strafeRight <= 0.001 && key_strafeLeft <= 0.001 && key_jump <= 0.001 ) //&& this->rigidBody->GetLambda() < 0.7f) + if (key_forward <= 0.001 && key_backward <= 0.001 && key_strafeRight <= 0.001 && key_strafeLeft <= 0.001 && key_jump <= 0.001 && this->rigidBody->GetLambda() < 0.7f) { /* Dampen when on the ground and not being moved by the player */ linearVelocity *= 0.2f;