From 446bdd412bb104b401d58b87e763f8f61f931422 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Wed, 29 Jan 2014 14:33:21 +0100 Subject: [PATCH] GL - updated constructors to set before and after collision response functions --- Code/Game/GameLogic/CollisionManager.cpp | 14 +++- Code/Game/GameLogic/DynamicObject.cpp | 29 +++++--- Code/Game/GameLogic/DynamicObject.h | 8 ++- Code/Game/GameLogic/Game.cpp | 24 ------- Code/Game/GameLogic/Game_PlayerData.cpp | 13 ++-- Code/Game/GameLogic/Level.cpp | 8 ++- Code/Game/GameLogic/Level.h | 5 +- Code/Game/GameLogic/Object.cpp | 92 +++++++++++++----------- Code/Game/GameLogic/Object.h | 10 +-- Code/Game/GameLogic/Player.cpp | 47 +++++++----- Code/Game/GameLogic/Player.h | 7 +- Code/Game/GameLogic/StaticObject.cpp | 36 +++++----- Code/Game/GameLogic/StaticObject.h | 8 ++- 13 files changed, 173 insertions(+), 128 deletions(-) diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 495c2ac5..00830301 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -64,10 +64,18 @@ using namespace GameLogic; } } - //Oyster::Physics::ICustomBody::SubscriptMessage - void Level::LevelCollision(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj) { - //return Physics::ICustomBody::SubscriptMessage_ignore_collision_response; + return Physics::ICustomBody::SubscriptMessage_none; + } + //Oyster::Physics::ICustomBody::SubscriptMessage + Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj) + { + return Physics::ICustomBody::SubscriptMessage_ignore_collision_response; + } + Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + { + return Physics::ICustomBody::SubscriptMessage_ignore_collision_response; } void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void* args) diff --git a/Code/Game/GameLogic/DynamicObject.cpp b/Code/Game/GameLogic/DynamicObject.cpp index 1ccc12ef..437dca2c 100644 --- a/Code/Game/GameLogic/DynamicObject.cpp +++ b/Code/Game/GameLogic/DynamicObject.cpp @@ -7,21 +7,34 @@ using namespace GameLogic; DynamicObject::DynamicObject() :Object() { - -} -DynamicObject::DynamicObject(void* collisionFunc, OBJECT_TYPE type) - :Object(collisionFunc, type) +} +DynamicObject::DynamicObject(OBJECT_TYPE type) + :Object(type) +{ + +} +DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type) + :Object(rigidBody,type) { } -DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) - :Object(rigidBody, collisionFunc, type) +DynamicObject::DynamicObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :Object(collisionFuncBefore,collisionFuncAfter,type) { - -} +} +DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + +} +DynamicObject::DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) + :Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + +} DynamicObject::~DynamicObject(void) { diff --git a/Code/Game/GameLogic/DynamicObject.h b/Code/Game/GameLogic/DynamicObject.h index 8912d455..3fcdae39 100644 --- a/Code/Game/GameLogic/DynamicObject.h +++ b/Code/Game/GameLogic/DynamicObject.h @@ -14,8 +14,12 @@ namespace GameLogic public: DynamicObject(); - DynamicObject(void* collisionFunc, OBJECT_TYPE type); - DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); + DynamicObject(OBJECT_TYPE type); + DynamicObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type); + DynamicObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + DynamicObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); + ~DynamicObject(void); private: diff --git a/Code/Game/GameLogic/Game.cpp b/Code/Game/GameLogic/Game.cpp index 9f9c930c..ca666c2f 100644 --- a/Code/Game/GameLogic/Game.cpp +++ b/Code/Game/GameLogic/Game.cpp @@ -100,30 +100,6 @@ bool Game::NewFrame() API::Instance().Update(); - for (unsigned int i = 0; i < this->players.Size(); i++) - { - if(this->players[i]->player) this->players[i]->player->EndFrame(); - } - - for (unsigned int i = 0; i < this->players.Size(); i++) - { - if(this->players[i]->player) this->players[i]->player->BeginFrame(); - } - - API::Instance().Update(); - - for (unsigned int i = 0; i < this->players.Size(); i++) - { - if(this->players[i]->player) this->players[i]->player->EndFrame(); - } - - for (unsigned int i = 0; i < this->players.Size(); i++) - { - if(this->players[i]->player) this->players[i]->player->BeginFrame(); - } - - API::Instance().Update(); - for (unsigned int i = 0; i < this->players.Size(); i++) { if(this->players[i]->player) this->players[i]->player->EndFrame(); diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index 81917071..a8cd665b 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -4,16 +4,19 @@ using namespace GameLogic; Game::PlayerData::PlayerData() -{ - Oyster::Physics::API::SimpleBodyDescription sbDesc; +{ //set some stats that are appropriate to a player - + Oyster::Physics::API::SimpleBodyDescription sbDesc; + sbDesc.centerPosition = Oyster::Math::Float3(0,15,0); + sbDesc.size = Oyster::Math::Float3(4,7,4); + //create rigid body Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release(); - + //create player with this rigid body - this->player = new Player(rigidBody,Player::PlayerCollision,OBJECT_TYPE::OBJECT_TYPE_PLAYER); + this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER); this->player->GetRigidBody()->SetCustomTag(this); + } Game::PlayerData::PlayerData(int playerID,int teamID) { diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 12a09587..02fc8961 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -20,6 +20,7 @@ void Level::InitiateLevel(std::string levelPath) } void Level::InitiateLevel(float radius) { + // add level sphere API::SphericalBodyDescription sbDesc; sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1); @@ -33,8 +34,8 @@ void Level::InitiateLevel(float radius) rigidBody->GetState(state); state.SetRestitutionCoeff(0.01); rigidBody->SetState(state); - - levelObj = new StaticObject(rigidBody, LevelCollision, OBJECT_TYPE::OBJECT_TYPE_WORLD); + + levelObj = new StaticObject(rigidBody, LevelCollisionBefore, LevelCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_WORLD); rigidBody->SetCustomTag(levelObj); @@ -47,7 +48,8 @@ void Level::InitiateLevel(float radius) ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); - testBox = new DynamicObject(rigidBody_TestBox,LevelCollision,OBJECT_TYPE::OBJECT_TYPE_BOX); + + testBox = new DynamicObject(rigidBody_TestBox, OBJECT_TYPE::OBJECT_TYPE_BOX); rigidBody_TestBox->SetCustomTag(testBox); rigidBody_TestBox->GetState(state); state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,4)); diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 9180a89e..60f7a932 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -57,8 +57,9 @@ namespace GameLogic * @param rigidBodyLevel: physics object of the level * @param obj: physics object for the object that collided with the level ********************************************************/ - static void LevelCollision(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); - + static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj); + static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); + Object* GetObj( int ID ) const; static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object); diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 0ad18f85..9ec51f1e 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -16,59 +16,78 @@ const Game *Object::gameInstance = (Game*)(&Game::Instance()); Object::Object() { API::SimpleBodyDescription sbDesc; - //sbDesc.centerPosition = - - //poi - ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); - + this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); Oyster::Physics::API::Instance().AddObject(rigidBody); - //rigidBody->gameObjectRef = this; - - this->objectID = GID(); - this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN; + this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; } -Object::Object(void* collisionFunc, OBJECT_TYPE type) +Object::Object(OBJECT_TYPE type) { API::SimpleBodyDescription sbDesc; - //poi this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); - Oyster::Physics::API::Instance().AddObject(rigidBody); - - //rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc)); - - //rigidBody->gameObjectRef = this; - - this->objectID = GID(); - this->type = type; + this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; } -Object::Object(ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type) +Object::Object(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type) { Oyster::Physics::API::Instance().AddObject(rigidBody); - - //rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc)); - - this->objectID = GID(); - - this->type = type; -} - -Object::Object(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) -{ - Oyster::Physics::API::Instance().AddObject(rigidBody); - //rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc)); - this->rigidBody = rigidBody; this->type = type; this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; +} + +Object::Object(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) +{ + API::SimpleBodyDescription sbDesc; + + this->rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); + Oyster::Physics::API::Instance().AddObject(rigidBody); + this->type = type; + this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; +} + +Object::Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) +{ + Oyster::Physics::API::Instance().AddObject(rigidBody); + + this->rigidBody = rigidBody; + this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(collisionFuncBefore)); + this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter)); + + this->type = type; + this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; +} + +Object::Object(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) +{ + Oyster::Physics::API::Instance().AddObject(rigidBody); + + this->rigidBody = rigidBody; + this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_BeforeCollisionResponse)(collisionFuncBefore)); + this->rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_AfterCollisionResponse)(collisionFuncAfter)); + + + this->type = type; + this->objectID = GID(); + this->getState = this->rigidBody->GetState(); + this->setState = this->getState; } void Object::ApplyLinearImpulse(Oyster::Math::Float3 force) @@ -107,19 +126,12 @@ void Object::BeginFrame() void Object::EndFrame() { - //Oyster::Math::Float rot = (setState.GetGravityNormal().xyz).Dot(getState.GetGravityNormal().xyz); - //Oyster::Math::Float3 axis = (setState.GetGravityNormal().xyz).Cross(getState.GetGravityNormal().xyz); Oyster::Math::Float4x4 rotMatrix = setState.GetOrientation(); //Oyster::Math3D::RotationMatrix(rot, axis); //Oyster::Math3D::SnapAxisYToNormal_UsingNlerp(rotMatrix, -setState.GetGravityNormal()); //setState.SetOrientation(rotMatrix); - this->getState = this->rigidBody->GetState(); - - - this->setState = this->getState; - } Oyster::Math::Float3 Object::GetPosition() { diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index d3adbcba..24149116 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -18,9 +18,11 @@ namespace GameLogic { public: Object(); - Object(void* collisionFunc, OBJECT_TYPE type); - Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type); - Object(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); + Object(OBJECT_TYPE type); + Object(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type); + Object(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + Object(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); ~Object(void); // API overrides @@ -35,7 +37,7 @@ namespace GameLogic void BeginFrame(); void EndFrame(); - + static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj); private: OBJECT_TYPE type; int objectID; diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 54e24703..c366fb8f 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -8,20 +8,38 @@ using namespace GameLogic; using namespace Oyster::Physics; Player::Player() - :DynamicObject(Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER) + :DynamicObject() { - weapon = new Weapon(); - - life = 100; - teamID = -1; - playerState = PLAYER_STATE::PLAYER_STATE_IDLE; - lookDir = Oyster::Math::Float4(0,0,-1,0); - setState.SetCenterPosition(Oyster::Math::Float3(0,15,0)); - setState.SetReach(Oyster::Math::Float3(2,3.5,2)); + +} +Player::Player(OBJECT_TYPE type) + :DynamicObject(type) +{ + InitPlayer(); +} +Player::Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type) + :DynamicObject(rigidBody,type) +{ + InitPlayer(); } -Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) - :DynamicObject(rigidBody, collisionFunc, type) +Player::Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :DynamicObject(collisionFuncBefore,collisionFuncAfter,type) +{ + InitPlayer(); +} +Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :DynamicObject(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + InitPlayer(); +} +Player::Player(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) + :DynamicObject(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + InitPlayer(); +} + +void Player::InitPlayer() { weapon = new Weapon(2,this); @@ -29,9 +47,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oy this->teamID = -1; this->playerState = PLAYER_STATE_IDLE; lookDir = Oyster::Math::Float4(0,0,-1,0); - - setState.SetCenterPosition(Oyster::Math::Float3(0,15,0)); - setState.SetReach(Oyster::Math::Float3(2,3.5,2)); } Player::~Player(void) @@ -40,11 +55,9 @@ Player::~Player(void) { delete weapon; weapon = NULL; - } - + } } - void Player::Move(const PLAYER_MOVEMENT &movement) { switch(movement) diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h index d67a18fe..0df0d040 100644 --- a/Code/Game/GameLogic/Player.h +++ b/Code/Game/GameLogic/Player.h @@ -16,8 +16,13 @@ namespace GameLogic { public: Player(void); - Player(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); + Player(OBJECT_TYPE type); + Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type); + Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + Player(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + Player(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); ~Player(void); + void InitPlayer(); /******************************************************** * Moves the player based on input diff --git a/Code/Game/GameLogic/StaticObject.cpp b/Code/Game/GameLogic/StaticObject.cpp index b441dabe..21b339be 100644 --- a/Code/Game/GameLogic/StaticObject.cpp +++ b/Code/Game/GameLogic/StaticObject.cpp @@ -8,29 +8,33 @@ StaticObject::StaticObject() :Object() { -} - -StaticObject::StaticObject(void* collisionFunc, OBJECT_TYPE type) - :Object(collisionFunc,type) -{ - } StaticObject::StaticObject(OBJECT_TYPE type) - :Object(NULL,type) + :Object(type) { - + } -/*StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type) - :Object(rigidBody,collisionFunc,type) +StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type) + :Object(rigidBody,type) { - -}*/ -StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) - :Object(rigidBody, collisionFunc, type) -{ - + } +StaticObject::StaticObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :Object(collisionFuncBefore,collisionFuncAfter,type) +{ + +} +StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) + :Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + +} +StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type) + :Object(rigidBody, collisionFuncBefore, collisionFuncAfter, type) +{ + +} StaticObject::~StaticObject(void) { diff --git a/Code/Game/GameLogic/StaticObject.h b/Code/Game/GameLogic/StaticObject.h index 5306d43b..c51f93a1 100644 --- a/Code/Game/GameLogic/StaticObject.h +++ b/Code/Game/GameLogic/StaticObject.h @@ -16,10 +16,12 @@ namespace GameLogic public: StaticObject(); - StaticObject(void* collisionFunc, OBJECT_TYPE type); - //StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type); - StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void (*collisionFunc)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); StaticObject(OBJECT_TYPE type); + StaticObject(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type); + StaticObject(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + StaticObject(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type); + StaticObject(Oyster::Physics::ICustomBody *rigidBody ,Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncBefore)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter), Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), OBJECT_TYPE type); + ~StaticObject(void); private: