Merge
This commit is contained in:
commit
934aa6e45a
|
@ -6,6 +6,8 @@
|
||||||
#include "GameClientState\GameState.h"
|
#include "GameClientState\GameState.h"
|
||||||
#include "GameClientState\LobbyState.h"
|
#include "GameClientState\LobbyState.h"
|
||||||
#include "PlayerProtocols.h"
|
#include "PlayerProtocols.h"
|
||||||
|
#include "ControlProtocols.h"
|
||||||
|
#include "GameProtocols.h"
|
||||||
#include "NetworkClient.h"
|
#include "NetworkClient.h"
|
||||||
|
|
||||||
#include "../WindowManager/WindowShell.h"
|
#include "../WindowManager/WindowShell.h"
|
||||||
|
@ -29,9 +31,15 @@ namespace DanBias
|
||||||
int pType = p[0].value.netInt;
|
int pType = p[0].value.netInt;
|
||||||
switch (pType)
|
switch (pType)
|
||||||
{
|
{
|
||||||
case protocol_Gamplay_PlayerNavigation:
|
case protocol_Status:
|
||||||
|
{
|
||||||
|
GameLogic::Protocol_Status::States state;
|
||||||
|
state = (GameLogic::Protocol_Status::States)p[1].value.netShort;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case protocol_Gameplay_PlayerNavigation:
|
||||||
{
|
{
|
||||||
|
|
||||||
Client::GameClientState::KeyInput* protocolData = new Client::GameClientState::KeyInput;
|
Client::GameClientState::KeyInput* protocolData = new Client::GameClientState::KeyInput;
|
||||||
for(int i = 0; i< 6; i++)
|
for(int i = 0; i< 6; i++)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +52,7 @@ namespace DanBias
|
||||||
protocolData = NULL;
|
protocolData = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case protocol_Gamplay_PlayerPosition:
|
case protocol_Gameplay_PlayerPosition:
|
||||||
{
|
{
|
||||||
Client::GameClientState::PlayerPos* protocolData = new Client::GameClientState::PlayerPos;
|
Client::GameClientState::PlayerPos* protocolData = new Client::GameClientState::PlayerPos;
|
||||||
for(int i = 0; i< 3; i++)
|
for(int i = 0; i< 3; i++)
|
||||||
|
@ -58,7 +66,7 @@ namespace DanBias
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case protocol_Gamplay_CreateObject:
|
case protocol_Gameplay_CreateObject:
|
||||||
{
|
{
|
||||||
|
|
||||||
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
|
Client::GameClientState::NewObj* protocolData = new Client::GameClientState::NewObj;
|
||||||
|
@ -76,7 +84,19 @@ namespace DanBias
|
||||||
protocolData = NULL;
|
protocolData = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case protocol_Gamplay_ObjectPosition:
|
case protocol_Gameplay_RemoveObject:
|
||||||
|
{
|
||||||
|
Client::GameClientState::RemoveObj* protocolData = new Client::GameClientState::RemoveObj;
|
||||||
|
protocolData->object_ID = p[1].value.netInt;
|
||||||
|
|
||||||
|
if(dynamic_cast<Client::GameState*>(gameClientState))
|
||||||
|
((Client::GameState*)gameClientState)->Protocol(protocolData);
|
||||||
|
|
||||||
|
delete protocolData;
|
||||||
|
protocolData = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case protocol_Gameplay_ObjectPosition:
|
||||||
{
|
{
|
||||||
|
|
||||||
Client::GameClientState::ObjPos* protocolData = new Client::GameClientState::ObjPos;
|
Client::GameClientState::ObjPos* protocolData = new Client::GameClientState::ObjPos;
|
||||||
|
@ -113,7 +133,6 @@ namespace DanBias
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//Client::GameClientState* gameClientState;
|
|
||||||
WindowShell* window;
|
WindowShell* window;
|
||||||
InputClass* inputObj;
|
InputClass* inputObj;
|
||||||
Utility::WinTimer* timer;
|
Utility::WinTimer* timer;
|
||||||
|
|
|
@ -28,6 +28,11 @@ public:
|
||||||
char* path;
|
char* path;
|
||||||
float worldPos[16];
|
float worldPos[16];
|
||||||
};
|
};
|
||||||
|
struct RemoveObj :public ProtocolStruct
|
||||||
|
{
|
||||||
|
int object_ID;
|
||||||
|
//particle effect
|
||||||
|
};
|
||||||
struct KeyInput :public ProtocolStruct
|
struct KeyInput :public ProtocolStruct
|
||||||
{
|
{
|
||||||
bool key[6];
|
bool key[6];
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
#include "DllInterfaces/GFXAPI.h"
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
#include "C_obj/C_Player.h"
|
#include "C_obj/C_Player.h"
|
||||||
#include "C_obj/C_DynamicObj.h"
|
#include "C_obj/C_DynamicObj.h"
|
||||||
#include "NetworkClient.h"
|
|
||||||
#include "PlayerProtocols.h"
|
#include "PlayerProtocols.h"
|
||||||
|
#include "ControlProtocols.h"
|
||||||
|
#include "GameProtocols.h"
|
||||||
|
#include "NetworkClient.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace DanBias::Client;
|
using namespace DanBias::Client;
|
||||||
|
|
||||||
|
@ -83,10 +86,15 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
|
||||||
switch (privData->state)
|
switch (privData->state)
|
||||||
{
|
{
|
||||||
case gameStateState_loading:
|
case gameStateState_loading:
|
||||||
// load map
|
{
|
||||||
// wait for all players
|
// load map
|
||||||
LoadGame();
|
// wait for all players
|
||||||
privData->state = gameStateState_playing;
|
LoadGame();
|
||||||
|
GameLogic::Protocol_Status gameStatus;
|
||||||
|
gameStatus.status = GameLogic::Protocol_Status::States_ready;
|
||||||
|
privData->nwClient->Send(gameStatus);
|
||||||
|
privData->state = gameStateState_playing;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case gameStateState_playing:
|
case gameStateState_playing:
|
||||||
// read server data
|
// read server data
|
||||||
|
@ -180,15 +188,7 @@ bool GameState::Release()
|
||||||
|
|
||||||
void GameState::Protocol(ProtocolStruct* pos)
|
void GameState::Protocol(ProtocolStruct* pos)
|
||||||
{
|
{
|
||||||
// move message
|
|
||||||
/*
|
|
||||||
if ((KeyInput*)pos)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
if((ObjPos*)pos)
|
|
||||||
ObjectPosProtocol((ObjPos*)pos);
|
|
||||||
else if((PlayerPos*)pos)
|
|
||||||
PlayerPosProtocol((PlayerPos*)pos);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::Protocol( PlayerPos* pos )
|
void GameState::Protocol( PlayerPos* pos )
|
||||||
|
@ -224,6 +224,7 @@ void GameState::Protocol( NewObj* pos )
|
||||||
|
|
||||||
modelData.world = world;
|
modelData.world = world;
|
||||||
modelData.visible = true;
|
modelData.visible = true;
|
||||||
|
//not sure if this is good parsing rom char* to wstring
|
||||||
const char* path = pos->path;
|
const char* path = pos->path;
|
||||||
modelData.modelPath = std::wstring(path, path + strlen(path));
|
modelData.modelPath = std::wstring(path, path + strlen(path));
|
||||||
// load models
|
// load models
|
||||||
|
@ -240,6 +241,11 @@ void GameState::Protocol( KeyInput* pos )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DanBias::Client::GameState::Protocol( RemoveObj* obj )
|
||||||
|
{
|
||||||
|
privData->object[obj->object_ID]->Release( );
|
||||||
|
}
|
||||||
|
|
||||||
void GameState::PlayerPosProtocol(PlayerPos* pos)
|
void GameState::PlayerPosProtocol(PlayerPos* pos)
|
||||||
{
|
{
|
||||||
Oyster::Math::Float4x4 world, translate;
|
Oyster::Math::Float4x4 world, translate;
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
void Protocol(ObjPos* pos);
|
void Protocol(ObjPos* pos);
|
||||||
void Protocol(KeyInput* pos);
|
void Protocol(KeyInput* pos);
|
||||||
void Protocol( NewObj* pos );
|
void Protocol( NewObj* pos );
|
||||||
|
void Protocol(RemoveObj* obj);
|
||||||
void PlayerPosProtocol(PlayerPos* pos);
|
void PlayerPosProtocol(PlayerPos* pos);
|
||||||
void ObjectPosProtocol(ObjPos* pos);
|
void ObjectPosProtocol(ObjPos* pos);
|
||||||
//void Protocol(LightPos pos);
|
//void Protocol(LightPos pos);
|
||||||
|
|
|
@ -6,51 +6,52 @@
|
||||||
|
|
||||||
using namespace Oyster;
|
using namespace Oyster;
|
||||||
|
|
||||||
namespace GameLogic
|
using namespace GameLogic;
|
||||||
{
|
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box);
|
void PlayerVBox(Player &player, DynamicObject &box);
|
||||||
|
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage CollisionManager::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));
|
||||||
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
|
switch (realObj->GetType().value)
|
||||||
{
|
{
|
||||||
Player *player = ((Player*)(rigidBodyPlayer->gameObjectRef));
|
case OBJECT_TYPE::OBJECT_TYPE_BOX:
|
||||||
Object *realObj = (Object*)obj->gameObjectRef;
|
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
||||||
|
break;
|
||||||
|
case OBJECT_TYPE::OBJECT_TYPE_PLAYER:
|
||||||
|
|
||||||
switch (realObj->GetType())
|
break;
|
||||||
{
|
|
||||||
case OBJECT_TYPE_BOX:
|
|
||||||
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
|
||||||
break;
|
|
||||||
case OBJECT_TYPE_PLAYER:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box)
|
|
||||||
{
|
|
||||||
player.DamageLife(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
Physics::ICustomBody::SubscriptMessage CollisionManager::BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
|
||||||
{
|
|
||||||
DynamicObject *box = (DynamicObject*)rigidBodyBox->gameObjectRef;
|
|
||||||
Object *realObj = (Object*)obj->gameObjectRef;
|
|
||||||
|
|
||||||
switch (realObj->GetType())
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
{
|
}
|
||||||
case OBJECT_TYPE_BOX:
|
|
||||||
|
void PlayerVBox(Player &player, DynamicObject &box)
|
||||||
|
{
|
||||||
|
player.DamageLife(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
Object *realObj = (Object*)obj->gameObjectRef;
|
||||||
|
|
||||||
|
switch (realObj->GetType().value)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef GAMELOGIC_CONTROL_PROTOCOLS_H
|
||||||
|
#define GAMELOGIC_CONTROL_PROTOCOLS_H
|
||||||
|
|
||||||
|
#include <CustomNetProtocol.h>
|
||||||
|
#include "ProtocolIdentificationID.h"
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
struct Protocol_Status :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
enum States
|
||||||
|
{
|
||||||
|
States_ready,
|
||||||
|
States_idle,
|
||||||
|
States_bussy,
|
||||||
|
States_disconected,
|
||||||
|
};
|
||||||
|
States status;
|
||||||
|
|
||||||
|
Protocol_Status()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_Status;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
|
{
|
||||||
|
this->protocol[1].value = status;
|
||||||
|
|
||||||
|
return &protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif //!GAMELOGIC_CONTROL_PROTOCOLS_H
|
|
@ -4,6 +4,7 @@
|
||||||
#include "ObjectProtocols.h"
|
#include "ObjectProtocols.h"
|
||||||
#include "PlayerProtocols.h"
|
#include "PlayerProtocols.h"
|
||||||
#include "LobbyProtocols.h"
|
#include "LobbyProtocols.h"
|
||||||
|
#include "ControlProtocols.h"
|
||||||
|
|
||||||
#include "TEST_PROTOCOLS.h"
|
#include "TEST_PROTOCOLS.h"
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="ControlProtocols.h" />
|
||||||
<ClInclude Include="GameProtocols.h" />
|
<ClInclude Include="GameProtocols.h" />
|
||||||
<ClInclude Include="LobbyProtocols.h" />
|
<ClInclude Include="LobbyProtocols.h" />
|
||||||
<ClInclude Include="ObjectProtocols.h" />
|
<ClInclude Include="ObjectProtocols.h" />
|
||||||
|
|
|
@ -11,14 +11,14 @@ namespace GameLogic
|
||||||
struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject
|
struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject
|
||||||
{
|
{
|
||||||
int object_ID;
|
int object_ID;
|
||||||
char path[255];
|
char *path;
|
||||||
float worldMatrix[16];
|
float worldMatrix[16];
|
||||||
|
|
||||||
|
|
||||||
Protocol_CreateObject()
|
Protocol_CreateObject()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gamplay_CreateObject;
|
this->protocol[0].value = protocol_Gameplay_CreateObject;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||||
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
|
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
|
||||||
|
@ -79,7 +79,7 @@ namespace GameLogic
|
||||||
|
|
||||||
Protocol_ObjectPosition()
|
Protocol_ObjectPosition()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gamplay_ObjectPosition;
|
this->protocol[0].value = protocol_Gameplay_ObjectPosition;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
@ -129,6 +129,27 @@ namespace GameLogic
|
||||||
Oyster::Network::CustomNetProtocol protocol;
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Protocol_RemoveObject :public Oyster::Network::CustomProtocolObject
|
||||||
|
{
|
||||||
|
int object_ID;
|
||||||
|
|
||||||
|
Protocol_RemoveObject()
|
||||||
|
{
|
||||||
|
this->protocol[0].value = protocol_Gameplay_RemoveObject;
|
||||||
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||||
|
}
|
||||||
|
Oyster::Network::CustomNetProtocol* GetProtocol() override
|
||||||
|
{
|
||||||
|
|
||||||
|
this->protocol[1].value = object_ID;
|
||||||
|
return &protocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Oyster::Network::CustomNetProtocol protocol;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
@ -25,7 +25,7 @@ namespace GameLogic
|
||||||
|
|
||||||
Protocol_PlayerMovement()
|
Protocol_PlayerMovement()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gamplay_PlayerNavigation;
|
this->protocol[0].value = protocol_Gameplay_PlayerNavigation;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
||||||
|
@ -60,7 +60,7 @@ namespace GameLogic
|
||||||
|
|
||||||
Protocol_PlayerMouse()
|
Protocol_PlayerMouse()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gamplay_PlayerMouseMovement;
|
this->protocol[0].value = protocol_Gameplay_PlayerMouseMovement;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
@ -87,7 +87,7 @@ namespace GameLogic
|
||||||
|
|
||||||
Protocol_PlayerPosition()
|
Protocol_PlayerPosition()
|
||||||
{
|
{
|
||||||
this->protocol[0].value = protocol_Gamplay_PlayerPosition;
|
this->protocol[0].value = protocol_Gameplay_PlayerPosition;
|
||||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||||
|
|
||||||
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
||||||
|
|
|
@ -8,6 +8,17 @@
|
||||||
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
|
||||||
|
|
||||||
|
|
||||||
|
#define protocol_ID_INDEX 0
|
||||||
|
|
||||||
|
#define protocol_Gameplay_PlayerNavigation 300
|
||||||
|
#define protocol_Gameplay_PlayerMouseMovement 301
|
||||||
|
#define protocol_Gameplay_PlayerPosition 302
|
||||||
|
#define protocol_Gameplay_CreateObject 303
|
||||||
|
#define protocol_Gameplay_RemoveObject 304
|
||||||
|
#define protocol_Gameplay_ObjectPosition 305
|
||||||
|
|
||||||
|
|
||||||
|
#define protocol_Status 50
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
/********* RESERVERD PROTOCOLS *****/
|
/********* RESERVERD PROTOCOLS *****/
|
||||||
|
|
|
@ -232,10 +232,12 @@ namespace Oyster
|
||||||
protected:
|
protected:
|
||||||
virtual ~API() {}
|
virtual ~API() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//! The root interface for all physical representations processable by the engine.
|
//! The root interface for all physical representations processable by the engine.
|
||||||
class PHYSICS_DLL_USAGE ICustomBody
|
class PHYSICS_DLL_USAGE ICustomBody
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum SubscriptMessage
|
enum SubscriptMessage
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue