GL - soleved merge errors in project files

This commit is contained in:
Linda Andersson 2013-12-10 11:50:35 +01:00
commit 465ea1bd19
12 changed files with 371 additions and 13 deletions

View File

@ -0,0 +1,45 @@
#include "AttatchmentMassDriver.h"
using namespace GameLogic;
struct AttatchmentMassDriver::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
AttatchmentMassDriver::AttatchmentMassDriver(void)
{
}
AttatchmentMassDriver::~AttatchmentMassDriver(void)
{
}
/********************************************************
* Uses the attatchment and will from here switch case the different WEAPON_FIRE's that are to be used
********************************************************/
void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
{
ForcePush(fireInput);
}
/********************************************************
* This is a specific functionallity of the weapon
********************************************************/
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
{
}

View File

@ -0,0 +1,25 @@
#ifndef ATTATCHMENTMASSDRIVER_H
#define ATTATCHMENTMASSDRIVER_H
#include "IAttatchment.h"
namespace GameLogic
{
class AttatchmentMassDriver : public IAttatchment
{
public:
AttatchmentMassDriver(void);
~AttatchmentMassDriver(void);
void UseAttatchment(const WEAPON_FIRE &fireInput);
private:
void ForcePush(const WEAPON_FIRE &fireInput);
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -0,0 +1,34 @@
#include "AttatchmentSocket.h"
#include "IAttatchment.h"
using namespace GameLogic;
struct AttatchmentSocket::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
IAttatchment *Attatchment;
}myData;
AttatchmentSocket::AttatchmentSocket(void)
{
}
AttatchmentSocket::~AttatchmentSocket(void)
{
}
IAttatchment* AttatchmentSocket::GetAttatchment()
{
return myData->Attatchment;
}

View File

@ -0,0 +1,20 @@
#ifndef ATTATCHMENTSOCKET_H
#define ATTATCHMENTSOCKET_H
#include "IAttatchment.h"
namespace GameLogic
{
class AttatchmentSocket
{
public:
AttatchmentSocket(void);
~AttatchmentSocket(void);
IAttatchment* GetAttatchment();
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -166,10 +166,13 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AttatchmentMassDriver.h" />
<ClInclude Include="AttatchmentSocket.h" />
<ClInclude Include="Camera.h" />
<ClInclude Include="CollisionManager.h" />
<ClInclude Include="DynamicObject.h" />
<ClInclude Include="GameMode.h" />
<ClInclude Include="IAttatchment.h" />
<ClInclude Include="Level.h" />
<ClInclude Include="Object.h" />
<ClInclude Include="Player.h" />
@ -178,10 +181,13 @@
<ClInclude Include="Weapon.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AttatchmentMassDriver.cpp" />
<ClCompile Include="AttatchmentSocket.cpp" />
<ClCompile Include="Camera.cpp" />
<ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="GameMode.cpp" />
<ClCompile Include="IAttatchment.cpp" />
<ClCompile Include="Level.cpp" />
<ClCompile Include="Object.cpp" />
<ClCompile Include="Player.cpp" />

View File

@ -0,0 +1,41 @@
#ifndef GAMELOGICSTATES_H
#define GAMELOGICSTATES_H
namespace GameLogic
{
enum PLAYER_STATE
{
PLAYER_STATE_JUMPING = 0,
PLAYER_STATE_WALKING = 1,
PLAYER_STATE_IDLE = 2,
};
enum PLAYER_MOVEMENT
{
PLAYER_MOVEMENT_FORWARD = 0,
PLAYER_MOVEMENT_BACKWARD = 1,
PLAYER_MOVEMENT_LEFT = 2,
PLAYER_MOVEMENT_RIGHT = 4,
PLAYER_MOVEMENT_JUMP = 8,
};
enum WEAPON_FIRE
{
WEAPON_USE_PRIMARY_PRESS = 0,
WEAPON_USE_PRIMARY_RELEASE = 1,
WEAPON_USE_SECONDARY_PRESS = 2,
WEAPON_USE_SECONDARY_RELEASE = 4,
WEAPON_USE_UTILLITY_PRESS = 8,
WEAPON_USE_UTILLITY_RELEASE = 16,
};
enum WEAPON_STATE
{
WEAPON_STATE_FIREING = 0,
WEAPON_STATE_IDLE = 1,
WEAPON_STATE_RELOADING = 2,
};
}
#endif

View File

@ -0,0 +1,29 @@
#include "IAttatchment.h"
#include "AttatchmentSocket.h"
using namespace GameLogic;
struct IAttatchment::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
IAttatchment::IAttatchment(void)
{
}
IAttatchment::~IAttatchment(void)
{
}

View File

@ -0,0 +1,25 @@
#ifndef IATTATCHMENT_H
#define IATTATCHMENT_H
#include "GameLogicStates.h"
namespace GameLogic
{
class IAttatchment
{
public:
IAttatchment(void);
~IAttatchment(void);
virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -11,7 +11,14 @@ struct Player::PrivateData
PrivateData()
{
weapon = new Weapon();
life = 100;
playerState = PLAYER_STATE_IDLE;
rigidBody->SetSubscription(CollisionManager::PlayerCollision);
}
~PrivateData()
{
if (weapon)
@ -19,10 +26,13 @@ struct Player::PrivateData
delete weapon;
}
}
int life;
Weapon *weapon;
PLAYER_STATE playerState;
ICustomBody *rigidBody;
}myData;
Player::Player()
@ -35,16 +45,81 @@ Player::~Player(void)
delete myData;
}
/********************************************************
* Updates the player(is this function needed?)
********************************************************/
void Player::Update()
{
}
void Player::Move()
/********************************************************
* Moves the player based on client input
* Uses the physics to move the player by adding a force in the chosen direction
* Uses the Jump() function if the player is to jump, this is becuase jumping requires additional logic compared to normal movement
********************************************************/
void Player::Move(const PLAYER_MOVEMENT &movement)
{
switch(movement)
{
case PLAYER_MOVEMENT_FORWARD:
break;
case PLAYER_MOVEMENT_BACKWARD:
break;
case PLAYER_MOVEMENT_LEFT:
break;
case PLAYER_MOVEMENT_RIGHT:
break;
case PLAYER_MOVEMENT_JUMP:
Jump();
break;
}
}
/********************************************************
* Uses the players weapon based on user input
********************************************************/
void Player::Shoot(const WEAPON_FIRE &fireInput)
{
myData->weapon->UseWeapon(fireInput);
}
/********************************************************
* Jumps if the player is currently not in a state of jumping
* Applies a force upwards(current upwards)
********************************************************/
void Player::Jump()
{
}
void Player::Shoot()
bool Player::IsWalking()
{
return (myData->playerState == PLAYER_STATE_WALKING);
}
bool Player::IsJumping()
{
return (myData->playerState == PLAYER_STATE_JUMPING);
}
bool Player::IsIdle()
{
return (myData->playerState == PLAYER_STATE_IDLE);
}
Oyster::Math::Float3 Player::GetPos()
{
return myData->rigidBody->GetCenter();
}
/********************************************************
* Respawns the player on a new chosen position
* This resets a set of variables such as life, ammo etcetc
********************************************************/
void Player::Respawn()
{
}

View File

@ -3,6 +3,8 @@
//////////////////////////////////////////////////
#ifndef PLAYER_H
#define PLAYER_H
#include "GameLogicStates.h"
#include "OysterMath.h"
namespace GameLogic
{
@ -13,14 +15,18 @@ namespace GameLogic
Player(void);
~Player(void);
/********************************************************
* Update the position of the rigid body
* This will be done with physics later
********************************************************/
void Update();
void Move();
void Shoot();
void Move(const PLAYER_MOVEMENT &movement);
void Shoot(const WEAPON_FIRE &fireInput);
void Jump();
bool IsWalking();
bool IsJumping();
bool IsIdle();
Oyster::Math::Float3 GetPos();
void Respawn();
private:
struct PrivateData;
PrivateData *myData;

View File

@ -1,4 +1,6 @@
#include "Weapon.h"
#include "AttatchmentSocket.h"
#include "AttatchmentMassDriver.h"
using namespace GameLogic;
@ -6,14 +8,22 @@ struct Weapon::PrivateData
{
PrivateData()
{
weaponState = WEAPON_STATE_IDLE;
SelectedAttatchment = new AttatchmentMassDriver();
}
~PrivateData()
{
delete SelectedAttatchment;
}
WEAPON_STATE weaponState;
AttatchmentSocket **attatchmentSockets;
int nrOfAttatchmentSockets;
IAttatchment *SelectedAttatchment;
}myData;
Weapon::Weapon()
@ -26,3 +36,34 @@ Weapon::~Weapon(void)
{
delete myData;
}
/********************************************************
* Uses the weapon based on the input given and the current chosen attatchment
********************************************************/
void Weapon::UseWeapon(const WEAPON_FIRE &fireInput)
{
myData->SelectedAttatchment->UseAttatchment(fireInput);
}
/********************************************************
* Specific weapon usage implementation
********************************************************/
/********************************************************
* Get functions for states
********************************************************/
bool Weapon::IsFireing()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_FIREING);
}
bool Weapon::IsIdle()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_IDLE);
}
bool Weapon::IsReloading()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_RELOADING);
}

View File

@ -3,6 +3,7 @@
//////////////////////////////////////////////////
#ifndef WEAPON_H
#define WEAPON_H
#include "GameLogicStates.h"
namespace GameLogic
{
@ -11,10 +12,20 @@ namespace GameLogic
{
public:
Weapon(void);
~Weapon(void);
private:
void UseWeapon(const WEAPON_FIRE &fireInput);
bool IsFireing();
bool IsIdle();
bool IsReloading();
private:
struct PrivateData;
PrivateData *myData;
};