Merge fixes

Warning! Possibility that code were lost during this merge.
Please oh please do check what branch you are in before you edit files.
This commit is contained in:
Dander7BD 2014-02-27 10:46:30 +01:00
parent e43996bdc8
commit f1e6a1c897
6 changed files with 10 additions and 40 deletions

View File

@ -182,7 +182,7 @@ void Game::SetDeadSubscription(GameEvent::ObjectDeadFunction functionPointer)
} }
void Game::SetActionSubscription(GameEvent::AnimationEventFunction functionPointer) void Game::SetActionSubscription(GameEvent::AnimationEventFunction functionPointer)
{ {
this->onPlayerActionEventFnc = functionPointer; this->onActionEventFnc = functionPointer;
} }
void Game::SetPickupSubscription(GameEvent::PickupEventFunction functionPointer) void Game::SetPickupSubscription(GameEvent::PickupEventFunction functionPointer)
{ {

View File

@ -107,7 +107,7 @@ namespace GameLogic
GameEvent::ObjectHpFunction onDamageTakenFnc; GameEvent::ObjectHpFunction onDamageTakenFnc;
GameEvent::ObjectRespawnedFunction onRespawnFnc; GameEvent::ObjectRespawnedFunction onRespawnFnc;
GameEvent::ObjectDeadFunction onDeadFnc; GameEvent::ObjectDeadFunction onDeadFnc;
GameEvent::AnimationEventFunction onPlayerActionEventFnc; GameEvent::AnimationEventFunction onActionEventFnc;
GameEvent::PickupEventFunction onPickupEventFnc; GameEvent::PickupEventFunction onPickupEventFnc;
GameEvent::CollisionEventFunction onCollisionEventFnc; GameEvent::CollisionEventFunction onCollisionEventFnc;
}; };

View File

@ -30,7 +30,7 @@ namespace GameLogic
typedef void(*ObjectEnabledFunction)(IObjectData* object); // Callback method that recieves and object typedef void(*ObjectEnabledFunction)(IObjectData* object); // Callback method that recieves and object
typedef void(*ObjectHpFunction)(IObjectData* object, float hp); // Callback method that sends obj HP typedef void(*ObjectHpFunction)(IObjectData* object, float hp); // Callback method that sends obj HP
typedef void(*ObjectRespawnedFunction)(IObjectData* object, Oyster::Math::Float3 spawnPos ); // Callback method that sends spawnPos typedef void(*ObjectRespawnedFunction)(IObjectData* object, Oyster::Math::Float3 spawnPos ); // Callback method that sends spawnPos
typedef void(*ObjectDeadFunction)(IObjectData* object, float seconds); // Callback method that sends death timer typedef void(*ObjectDeadFunction)(IObjectData* object, IObjectData* killer, float seconds); // Callback method that sends death timer
typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer
typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer
typedef void(*CollisionEventFunction)(IObjectData*object, int collisionID); typedef void(*CollisionEventFunction)(IObjectData*object, int collisionID);

View File

@ -12,7 +12,6 @@ Player::Player()
:DynamicObject() :DynamicObject()
{ {
Player::initPlayerData(); Player::initPlayerData();
AffectedObjects.Reserve(15);
this->weapon = NULL; this->weapon = NULL;
this->teamID = -1; this->teamID = -1;
this->playerScore.killScore = 0; this->playerScore.killScore = 0;
@ -24,7 +23,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)
{ {
this->weapon = new Weapon(2,this); this->weapon = new Weapon(2,this);
Player::initPlayerData(); Player::initPlayerData();
AffectedObjects.Reserve(15);
this->teamID = teamID; this->teamID = teamID;
this->playerScore.killScore = 0; this->playerScore.killScore = 0;
this->playerScore.deathScore = 0; this->playerScore.deathScore = 0;
@ -35,7 +33,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustom
{ {
this->weapon = new Weapon(2,this); this->weapon = new Weapon(2,this);
Player::initPlayerData(); Player::initPlayerData();
AffectedObjects.Reserve(15);
this->teamID = teamID; this->teamID = teamID;
this->playerScore.killScore = 0; this->playerScore.killScore = 0;
this->playerScore.deathScore = 0; this->playerScore.deathScore = 0;
@ -61,7 +58,6 @@ void Player::initPlayerData()
this->key_strafeRight = 0; this->key_strafeRight = 0;
this->key_strafeLeft = 0; this->key_strafeLeft = 0;
this->key_jump = 0; this->key_jump = 0;
this->invincibleCooldown = 0;
this->deathTimer = 0; this->deathTimer = 0;
this->rotationUp = 0; this->rotationUp = 0;
@ -142,7 +138,7 @@ void Player::BeginFrame()
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING) if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
{ {
if(this->playerState != PLAYER_STATE::PLAYER_STATE_IDLE) if(this->playerState != PLAYER_STATE::PLAYER_STATE_IDLE)
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Idle); this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Idle);
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE; this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
} }
} }
@ -178,7 +174,7 @@ void Player::BeginFrame()
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING) if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
{ {
if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING) if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING)
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Walk); this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Walk);
this->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; this->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
} }
} }
@ -200,7 +196,7 @@ void Player::BeginFrame()
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20); this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20);
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING) if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Jump); this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Jump);
this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING; this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING;
} }
} }
@ -208,26 +204,14 @@ void Player::BeginFrame()
{ {
if(this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING) if(this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING)
{ {
this->gameInstance->onPlayerActionEventFnc( this, PlayerAction::PlayerAction_Idle); this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Idle);
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE; this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
} }
} }
} }
} }
void Player::EndFrame() void Player::EndFrame() { /* do nothing .. for now */ }
{
//check if there are any objects that can be removed from the AffectedObjects list
for(int i = 0; i < this->AffectedObjects.Size(); i++)
{
if(this->AffectedObjects[i] && (this->AffectedObjects[i]->GetRigidBody()->GetState().previousVelocity).GetMagnitude() <= 0.1f)
{
this->AffectedObjects[i]->RemoveAffectedBy();
this->AffectedObjects.Remove(i);
}
}
}
void Player::Move(const PLAYER_MOVEMENT &movement) void Player::Move(const PLAYER_MOVEMENT &movement)
{ {
@ -363,20 +347,6 @@ void Player::DamageLife(int damage)
} }
void Player::AddAffectedObject(DynamicObject &AffectedObject)
{
//check if object already exists in the list, if so then do not add
for(int i = 0; i < AffectedObjects.Size(); i++)
{
if(AffectedObjects[i]->GetID() == AffectedObject.GetID())
{
//object already exists, exit function
return;
}
}
//else you add the object to the stack
AffectedObjects.Push(&AffectedObject);
}
bool Player::deathTimerTick(float dt) bool Player::deathTimerTick(float dt)
{ {
this->deathTimer -= dt; this->deathTimer -= dt;

View File

@ -102,7 +102,7 @@ namespace DanBias
static void ObjectEnabled ( GameLogic::IObjectData* movedObject ); static void ObjectEnabled ( GameLogic::IObjectData* movedObject );
static void ObjectDamaged ( GameLogic::IObjectData* movedObject, float hp ); static void ObjectDamaged ( GameLogic::IObjectData* movedObject, float hp );
static void ObjectRespawned ( GameLogic::IObjectData* movedObject, Oyster::Math::Float3 spawnPos ); static void ObjectRespawned ( GameLogic::IObjectData* movedObject, Oyster::Math::Float3 spawnPos );
static void ObjectDead ( GameLogic::IObjectData* movedObject, float seconds ); static void ObjectDead ( GameLogic::IObjectData* movedObject, GameLogic::IObjectData* killer, float seconds );
static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID ); static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID );
static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID ); static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID );
static void CollisionEvent ( GameLogic::IObjectData* Object , int collisionID ); static void CollisionEvent ( GameLogic::IObjectData* Object , int collisionID );

View File

@ -162,7 +162,7 @@ using namespace DanBias;
{ {
GameSession::gameSession->Send(Protocol_ObjectRespawn(movedObject->GetID(), spawnPos).GetProtocol()); GameSession::gameSession->Send(Protocol_ObjectRespawn(movedObject->GetID(), spawnPos).GetProtocol());
} }
void GameSession::ObjectDead( GameLogic::IObjectData* movedObject, float seconds ) void GameSession::ObjectDead( GameLogic::IObjectData* movedObject, GameLogic::IObjectData* killer, float seconds )
{ {
GameSession::gameSession->Send(Protocol_ObjectDie(movedObject->GetID(), seconds).GetProtocol()); GameSession::gameSession->Send(Protocol_ObjectDie(movedObject->GetID(), seconds).GetProtocol());
} }