GL - merge errors
This commit is contained in:
commit
057dce0aca
|
@ -4,6 +4,10 @@
|
||||||
#include <PostBox\PostBox.h>
|
#include <PostBox\PostBox.h>
|
||||||
#include "ClientObject.h"
|
#include "ClientObject.h"
|
||||||
|
|
||||||
|
#include "DynamicObject.h"
|
||||||
|
#include "CollisionManager.h"
|
||||||
|
#include "GameLogicStates.h"
|
||||||
|
|
||||||
|
|
||||||
#define ERIK
|
#define ERIK
|
||||||
|
|
||||||
|
@ -83,6 +87,8 @@ namespace DanBias
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////private:
|
////private:
|
||||||
void GameSession::Init()
|
void GameSession::Init()
|
||||||
{
|
{
|
||||||
|
@ -126,13 +132,20 @@ namespace DanBias
|
||||||
|
|
||||||
#pragma region TESTING
|
#pragma region TESTING
|
||||||
|
|
||||||
|
using namespace GameLogic;
|
||||||
|
|
||||||
|
void ConvertToMovement(ClientObject* reciever, CustomNetProtocol& inputToConvert);
|
||||||
|
|
||||||
|
|
||||||
//VARIABLES GOES HERE
|
//VARIABLES GOES HERE
|
||||||
int i = 0;
|
int i = 0;
|
||||||
GameLogic::Player erik;
|
DynamicObject* objectBox;
|
||||||
|
|
||||||
void GameSession::EricLogicInitFunc()
|
void GameSession::EricLogicInitFunc()
|
||||||
{
|
{
|
||||||
|
//CollisionManager::BoxCollision(0,0);
|
||||||
|
|
||||||
|
//objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX);
|
||||||
}
|
}
|
||||||
void GameSession::EricLogicFrameFunc()
|
void GameSession::EricLogicFrameFunc()
|
||||||
{
|
{
|
||||||
|
@ -141,6 +154,26 @@ namespace DanBias
|
||||||
void GameSession::EricsLogicTestingProtocalRecieved(ClientObject* reciever, CustomNetProtocol& protocol)
|
void GameSession::EricsLogicTestingProtocalRecieved(ClientObject* reciever, CustomNetProtocol& protocol)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
switch (protocol[protocol_ID_INDEX].value.netShort)
|
||||||
|
{
|
||||||
|
case protocol_Gameplay_PlayerNavigation:
|
||||||
|
ConvertToMovement(reciever, protocol);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ConvertToMovement(ClientObject* reciever,CustomNetProtocol& inputToConvert)
|
||||||
|
{
|
||||||
|
if (inputToConvert[1].value.netBool == true)
|
||||||
|
{
|
||||||
|
reciever->Logic_Object()->Move(PLAYER_MOVEMENT::PLAYER_MOVEMENT_FORWARD);
|
||||||
|
}
|
||||||
|
if (inputToConvert[2].value.netBool == true)
|
||||||
|
{
|
||||||
|
reciever->Logic_Object()->Move(PLAYER_MOVEMENT::PLAYER_MOVEMENT_BACKWARD);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
|
@ -6,26 +6,22 @@
|
||||||
|
|
||||||
using namespace Oyster;
|
using namespace Oyster;
|
||||||
|
|
||||||
namespace GameLogic
|
using namespace GameLogic;
|
||||||
{
|
|
||||||
|
|
||||||
namespace CollisionManager
|
|
||||||
{
|
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box);
|
void PlayerVBox(Player &player, DynamicObject &box);
|
||||||
|
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
Physics::ICustomBody::SubscriptMessage CollisionManager::PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
||||||
{
|
{
|
||||||
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
|
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
|
||||||
Object *realObj = (Object*)obj->gameObjectRef;
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType().value)
|
||||||
{
|
{
|
||||||
case OBJECT_TYPE_BOX:
|
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
||||||
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_PLAYER:
|
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -38,22 +34,24 @@ namespace GameLogic
|
||||||
player.DamageLife(20);
|
player.DamageLife(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
Physics::ICustomBody::SubscriptMessage CollisionManager::BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
||||||
{
|
{
|
||||||
|
if(rigidBodyBox == 0)
|
||||||
|
{
|
||||||
|
return Physics::ICustomBody::SubscriptMessage::SubscriptMessage_none;
|
||||||
|
}
|
||||||
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
|
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
|
||||||
Object *realObj = (Object*)obj->gameObjectRef;
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType().value)
|
||||||
{
|
{
|
||||||
case OBJECT_TYPE_BOX:
|
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_PLAYER:
|
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
||||||
//PlayerVBox(*(Player*)realObj,*box);
|
//PlayerVBox(*(Player*)realObj,*box);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,12 +7,13 @@
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace CollisionManager
|
class CollisionManager
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
//these are the main collision functions
|
//these are the main collision functions
|
||||||
//typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
//typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj);
|
static Oyster::Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj);
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
|
static Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
|
||||||
|
|
||||||
//these are the specific collision case functions
|
//these are the specific collision case functions
|
||||||
//void PlayerVBox(Player &player, DynamicObject &box);
|
//void PlayerVBox(Player &player, DynamicObject &box);
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
#ifndef DYNAMICOBJECT_H
|
#ifndef DYNAMICOBJECT_H
|
||||||
#define DYNAMICOBJECT_H
|
#define DYNAMICOBJECT_H
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
|
#include "GameLogicDef.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class DynamicObject : public Object
|
class DANBIAS_GAMELOGIC_DLL DynamicObject : public Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -174,6 +174,7 @@
|
||||||
<ClInclude Include="CollisionManager.h" />
|
<ClInclude Include="CollisionManager.h" />
|
||||||
<ClInclude Include="DynamicObject.h" />
|
<ClInclude Include="DynamicObject.h" />
|
||||||
<ClInclude Include="GameLogicDef.h" />
|
<ClInclude Include="GameLogicDef.h" />
|
||||||
|
<ClInclude Include="GameLogicStates.h" />
|
||||||
<ClInclude Include="GameMode.h" />
|
<ClInclude Include="GameMode.h" />
|
||||||
<ClInclude Include="IAttatchment.h" />
|
<ClInclude Include="IAttatchment.h" />
|
||||||
<ClInclude Include="Level.h" />
|
<ClInclude Include="Level.h" />
|
||||||
|
|
|
@ -1,23 +1,63 @@
|
||||||
#ifndef GAMELOGICSTATES_H
|
#ifndef GAMELOGICSTATES_H
|
||||||
#define GAMELOGICSTATES_H
|
#define GAMELOGICSTATES_H
|
||||||
|
|
||||||
|
#include "GameLogicDef.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
enum PLAYER_STATE
|
class DANBIAS_GAMELOGIC_DLL PLAYER_STATE
|
||||||
{
|
{
|
||||||
PLAYER_STATE_JUMPING = 0,
|
public:
|
||||||
PLAYER_STATE_WALKING = 1,
|
PLAYER_STATE()
|
||||||
PLAYER_STATE_IDLE = 2,
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
PLAYER_STATE(int value)
|
||||||
|
{
|
||||||
|
this->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int PLAYER_STATE_JUMPING = 0;
|
||||||
|
static const int PLAYER_STATE_WALKING = 1;
|
||||||
|
static const int PLAYER_STATE_IDLE = 2;
|
||||||
|
int value;
|
||||||
|
|
||||||
|
};
|
||||||
|
class DANBIAS_GAMELOGIC_DLL PLAYER_MOVEMENT
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PLAYER_MOVEMENT()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
PLAYER_MOVEMENT(int value)
|
||||||
|
{
|
||||||
|
this->value = value;
|
||||||
|
}
|
||||||
|
static const int PLAYER_MOVEMENT_FORWARD = 0;
|
||||||
|
static const int PLAYER_MOVEMENT_BACKWARD = 1;
|
||||||
|
static const int PLAYER_MOVEMENT_LEFT = 2;
|
||||||
|
static const int PLAYER_MOVEMENT_RIGHT = 4;
|
||||||
|
static const int PLAYER_MOVEMENT_JUMP = 8;
|
||||||
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PLAYER_MOVEMENT
|
class DANBIAS_GAMELOGIC_DLL OBJECT_TYPE
|
||||||
{
|
{
|
||||||
PLAYER_MOVEMENT_FORWARD = 0,
|
public:
|
||||||
PLAYER_MOVEMENT_BACKWARD = 1,
|
OBJECT_TYPE()
|
||||||
PLAYER_MOVEMENT_LEFT = 2,
|
{
|
||||||
PLAYER_MOVEMENT_RIGHT = 4,
|
|
||||||
PLAYER_MOVEMENT_JUMP = 8,
|
}
|
||||||
|
OBJECT_TYPE(int value)
|
||||||
|
{
|
||||||
|
this->value = value;
|
||||||
|
}
|
||||||
|
static const int OBJECT_TYPE_PLAYER = 0;
|
||||||
|
static const int OBJECT_TYPE_BOX = 1;
|
||||||
|
static const int OBJECT_TYPE_UNKNOWN = 2;
|
||||||
|
|
||||||
|
public: int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WEAPON_FIRE
|
enum WEAPON_FIRE
|
||||||
|
@ -37,12 +77,7 @@ namespace GameLogic
|
||||||
WEAPON_STATE_RELOADING = 2,
|
WEAPON_STATE_RELOADING = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OBJECT_TYPE
|
|
||||||
{
|
|
||||||
OBJECT_TYPE_PLAYER = 0,
|
|
||||||
OBJECT_TYPE_BOX = 1,
|
|
||||||
OBJECT_TYPE_UNKNOWN = 2,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -20,7 +20,7 @@ Object::Object()
|
||||||
rigidBody->gameObjectRef = this;
|
rigidBody->gameObjectRef = this;
|
||||||
|
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
this->type = OBJECT_TYPE_UNKNOWN;
|
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct Player::PrivateData
|
||||||
|
|
||||||
life = 100;
|
life = 100;
|
||||||
teamID = -1;
|
teamID = -1;
|
||||||
playerState = PLAYER_STATE_IDLE;
|
playerState.value = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
|
|
||||||
lookDir = Oyster::Math::Float3(1,0,0);
|
lookDir = Oyster::Math::Float3(1,0,0);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ struct Player::PrivateData
|
||||||
}myData;
|
}myData;
|
||||||
|
|
||||||
Player::Player()
|
Player::Player()
|
||||||
:Object(CollisionManager::PlayerCollision, OBJECT_TYPE_PLAYER)
|
:Object(CollisionManager::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER)
|
||||||
{
|
{
|
||||||
myData = new PrivateData();
|
myData = new PrivateData();
|
||||||
}
|
}
|
||||||
|
@ -51,23 +51,23 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 currentVelocity = rigidBody->GetRigidLinearVelocity();
|
Oyster::Math::Float3 currentVelocity = rigidBody->GetRigidLinearVelocity();
|
||||||
|
|
||||||
switch(movement)
|
switch(movement.value)
|
||||||
{
|
{
|
||||||
case PLAYER_MOVEMENT_FORWARD:
|
case PLAYER_MOVEMENT::PLAYER_MOVEMENT_FORWARD:
|
||||||
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),myData->lookDir * 100);
|
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),myData->lookDir * 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_BACKWARD:
|
case PLAYER_MOVEMENT::PLAYER_MOVEMENT_BACKWARD:
|
||||||
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-myData->lookDir * 100);
|
API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-myData->lookDir * 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_LEFT:
|
case PLAYER_MOVEMENT::PLAYER_MOVEMENT_LEFT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_RIGHT:
|
case PLAYER_MOVEMENT::PLAYER_MOVEMENT_RIGHT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLAYER_MOVEMENT_JUMP:
|
case PLAYER_MOVEMENT::PLAYER_MOVEMENT_JUMP:
|
||||||
Jump();
|
Jump();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
{
|
{
|
||||||
API::Instance().SetCenter(rigidBody,spawnPoint);
|
API::Instance().SetCenter(rigidBody,spawnPoint);
|
||||||
myData->life = 100;
|
myData->life = 100;
|
||||||
myData->playerState = PLAYER_STATE_IDLE;
|
myData->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
myData->lookDir = Oyster::Math::Float3(1,0,0);
|
myData->lookDir = Oyster::Math::Float3(1,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,20 +93,21 @@ void Player::Jump()
|
||||||
|
|
||||||
bool Player::IsWalking()
|
bool Player::IsWalking()
|
||||||
{
|
{
|
||||||
return (myData->playerState == PLAYER_STATE_WALKING);
|
return (myData->playerState.value == PLAYER_STATE::PLAYER_STATE_WALKING);
|
||||||
}
|
}
|
||||||
bool Player::IsJumping()
|
bool Player::IsJumping()
|
||||||
{
|
{
|
||||||
return (myData->playerState == PLAYER_STATE_JUMPING);
|
return (myData->playerState.value == PLAYER_STATE::PLAYER_STATE_JUMPING);
|
||||||
}
|
}
|
||||||
bool Player::IsIdle()
|
bool Player::IsIdle()
|
||||||
{
|
{
|
||||||
return (myData->playerState == PLAYER_STATE_IDLE);
|
return (myData->playerState.value == PLAYER_STATE::PLAYER_STATE_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetPos()
|
Oyster::Math::Float3 Player::GetPos()
|
||||||
{
|
{
|
||||||
return rigidBody->GetCenter();
|
return rigidBody->GetCenter();
|
||||||
|
return Oyster::Math::Float3(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetLookDir()
|
Oyster::Math::Float3 Player::GetLookDir()
|
||||||
|
|
|
@ -7,12 +7,16 @@
|
||||||
|
|
||||||
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
||||||
|
|
||||||
#define protocol_Gameplay_PlayerNavigation 0
|
|
||||||
#define protocol_Gameplay_PlayerMouseMovement 1
|
#define protocol_ID_INDEX 0
|
||||||
#define protocol_Gameplay_PlayerPosition 2
|
|
||||||
#define protocol_Gameplay_CreateObject 3
|
#define protocol_Gameplay_PlayerNavigation 300
|
||||||
#define protocol_Gameplay_RemoveObject 4
|
#define protocol_Gameplay_PlayerMouseMovement 301
|
||||||
#define protocol_Gameplay_ObjectPosition 5
|
#define protocol_Gameplay_PlayerPosition 302
|
||||||
|
#define protocol_Gameplay_CreateObject 303
|
||||||
|
#define protocol_Gameplay_RemoveObject 304
|
||||||
|
#define protocol_Gameplay_ObjectPosition 305
|
||||||
|
|
||||||
|
|
||||||
#define protocol_Status 50
|
#define protocol_Status 50
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue