pre merge
This commit is contained in:
parent
813a97cfbf
commit
0f3c5af04a
|
@ -9,6 +9,7 @@
|
||||||
#include "GameClientState\GameClientState.h"
|
#include "GameClientState\GameClientState.h"
|
||||||
#include "GameClientState\GameState.h"
|
#include "GameClientState\GameState.h"
|
||||||
|
|
||||||
|
|
||||||
#include <Utilities.h>
|
#include <Utilities.h>
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
|
@ -101,13 +102,27 @@ namespace DanBias
|
||||||
break;
|
break;
|
||||||
case protocol_Gameplay_ObjectPosition:
|
case protocol_Gameplay_ObjectPosition:
|
||||||
{
|
{
|
||||||
|
// 0: reserved
|
||||||
|
// 1: objectID
|
||||||
|
// 2,3,4: position
|
||||||
|
// 5,6,7,8: rotation quaternion
|
||||||
|
|
||||||
|
GameLogic::Protocol_ObjectPosition data;
|
||||||
|
|
||||||
Client::GameClientState::ObjPos protocolData;
|
Client::GameClientState::ObjPos protocolData;
|
||||||
protocolData.object_ID = p[1].value.netInt;
|
protocolData.object_ID = p[1].value.netInt;
|
||||||
for(int i = 0; i< 16; i++)
|
|
||||||
|
for( int i = 0; i < 3; ++i )
|
||||||
{
|
{
|
||||||
protocolData.worldPos[i] = p[i+2].value.netFloat;
|
protocolData.position[i] = p[i+2].value.netFloat;
|
||||||
|
protocolData.rotation[i] = p[i+5].value.netFloat;
|
||||||
}
|
}
|
||||||
|
protocolData.rotation[3] = p[8].value.netFloat;
|
||||||
|
|
||||||
|
//for(int i = 0; i< 16; i++)
|
||||||
|
//{
|
||||||
|
// protocolData.worldPos[i] = p[i+2].value.netFloat;
|
||||||
|
//}
|
||||||
|
|
||||||
if(dynamic_cast<Client::GameState*>(gameClientState))
|
if(dynamic_cast<Client::GameState*>(gameClientState))
|
||||||
((Client::GameState*)gameClientState)->Protocol(&protocolData);
|
((Client::GameState*)gameClientState)->Protocol(&protocolData);
|
||||||
|
|
|
@ -5,55 +5,59 @@
|
||||||
#include "L_inputClass.h"
|
#include "L_inputClass.h"
|
||||||
#include "NetworkClient.h"
|
#include "NetworkClient.h"
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias { namespace Client
|
||||||
{
|
{
|
||||||
namespace Client
|
class GameClientState
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
class GameClientState
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct ProtocolStruct
|
struct ProtocolStruct
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
struct ObjPos :public ProtocolStruct
|
|
||||||
|
struct ObjPos : public ProtocolStruct
|
||||||
{
|
{
|
||||||
int object_ID;
|
int object_ID;
|
||||||
//float worldPos[16];
|
//float worldPos[16];
|
||||||
float position[3];
|
float position[3];
|
||||||
float angularAxis[3];
|
|
||||||
float rotation[4];
|
float rotation[4];
|
||||||
};
|
};
|
||||||
struct NewObj :public ProtocolStruct
|
|
||||||
|
struct NewObj : public ProtocolStruct
|
||||||
{
|
{
|
||||||
int object_ID;
|
int object_ID;
|
||||||
char* path;
|
char* path;
|
||||||
float worldPos[16];
|
float worldPos[16];
|
||||||
};
|
};
|
||||||
struct RemoveObj :public ProtocolStruct
|
|
||||||
|
struct RemoveObj : public ProtocolStruct
|
||||||
{
|
{
|
||||||
int object_ID;
|
int object_ID;
|
||||||
//particle effect
|
//particle effect
|
||||||
};
|
};
|
||||||
struct KeyInput :public ProtocolStruct
|
|
||||||
|
struct KeyInput : public ProtocolStruct
|
||||||
{
|
{
|
||||||
bool key[6];
|
bool key[6];
|
||||||
};
|
};
|
||||||
struct PlayerPos :public ProtocolStruct
|
|
||||||
|
struct PlayerPos : public ProtocolStruct
|
||||||
{
|
{
|
||||||
float position[3];
|
float position[3];
|
||||||
float angularAxis[3];
|
float angularAxis[3];
|
||||||
// float playerPos[3];
|
// float playerPos[3];
|
||||||
};
|
};
|
||||||
struct PlayerMove :public ProtocolStruct
|
|
||||||
|
struct PlayerMove : public ProtocolStruct
|
||||||
{
|
{
|
||||||
float playerPos[3];
|
float playerPos[3];
|
||||||
};
|
};
|
||||||
struct PlayerName :public ProtocolStruct
|
|
||||||
|
struct PlayerName : public ProtocolStruct
|
||||||
{
|
{
|
||||||
char name[255];
|
char name[255];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ClientState
|
enum ClientState
|
||||||
{
|
{
|
||||||
ClientState_Login,
|
ClientState_Login,
|
||||||
|
@ -64,7 +68,7 @@ public:
|
||||||
ClientState_Same,
|
ClientState_Same,
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameClientState(void);
|
GameClientState(void);
|
||||||
virtual ~GameClientState(void);
|
virtual ~GameClientState(void);
|
||||||
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
|
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
|
||||||
|
@ -73,7 +77,6 @@ public:
|
||||||
virtual bool Release() = 0;
|
virtual bool Release() = 0;
|
||||||
virtual void Protocol(ProtocolStruct* protocolStruct) = 0;
|
virtual void Protocol(ProtocolStruct* protocolStruct) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
} }
|
||||||
};
|
|
||||||
#endif
|
#endif
|
|
@ -566,8 +566,8 @@ void GameState::Protocol(ProtocolStruct* pos)
|
||||||
|
|
||||||
void GameState::Protocol( PlayerPos* pos )
|
void GameState::Protocol( PlayerPos* pos )
|
||||||
{
|
{
|
||||||
camera.SetPosition( pos->position );
|
//camera.SetPosition( pos->position );
|
||||||
camera.SetAngular( pos->angularAxis );
|
//camera.SetAngular( pos->angularAxis );
|
||||||
|
|
||||||
//Float4x4 world, translate;
|
//Float4x4 world, translate;
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ void GameState::Protocol( ObjPos* pos )
|
||||||
if(dynamicObjects[i]->GetId() == myId) // playerobj
|
if(dynamicObjects[i]->GetId() == myId) // playerobj
|
||||||
{
|
{
|
||||||
camera.SetPosition( pos->position );
|
camera.SetPosition( pos->position );
|
||||||
camera.SetAngular( pos->angularAxis );
|
camera.SetAngular( QuaternionToAngularAxis(Quaternion(pos->rotation, pos->rotation[3])).xyz );
|
||||||
|
|
||||||
//Float3 right = Float3(world[0], world[1], world[2]);
|
//Float3 right = Float3(world[0], world[1], world[2]);
|
||||||
//Float3 up = Float3(world[4], world[5], world[6]);
|
//Float3 up = Float3(world[4], world[5], world[6]);
|
||||||
|
|
Loading…
Reference in New Issue