2013-12-12 09:33:59 +01:00
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
// Created 2013 //
|
|
|
|
// Dennis Andersen, Linda Andersson //
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
2013-12-09 11:57:34 +01:00
|
|
|
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
|
|
#define GAMELOGIC_PLAYER_PROTOCOLS_H
|
|
|
|
|
2013-12-12 09:33:59 +01:00
|
|
|
#include <CustomNetProtocol.h>
|
2013-12-09 11:57:34 +01:00
|
|
|
#include "ProtocolIdentificationID.h"
|
|
|
|
|
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
struct Protocol_PlayerMovementRight :public Oyster::Network::CustomProtocolObject
|
2013-12-09 11:57:34 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
Protocol_PlayerMovementRight()
|
2013-12-09 11:57:34 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerMovementRight;
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{ return protocol; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
struct Protocol_PlayerMovementLeft :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
Protocol_PlayerMovementLeft()
|
2014-01-29 15:01:14 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerMovementLeft;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2013-12-09 11:57:34 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override { return protocol; }
|
2013-12-20 09:42:02 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
struct Protocol_PlayerMovementForward :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
Protocol_PlayerMovementForward()
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerMovementForward;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2013-12-20 09:42:02 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override { return protocol; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
struct Protocol_PlayerMovementBackward :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
Protocol_PlayerMovementBackward()
|
2013-12-09 11:57:34 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerMovementBackward;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override { return protocol; }
|
2013-12-09 11:57:34 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Protocol_PlayerJump :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
Protocol_PlayerJump()
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerJump;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2013-12-09 11:57:34 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override { return protocol; }
|
2013-12-09 11:57:34 +01:00
|
|
|
|
|
|
|
private:
|
2013-12-12 10:36:55 +01:00
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
2013-12-09 11:57:34 +01:00
|
|
|
};
|
2013-12-11 12:14:00 +01:00
|
|
|
|
2014-02-19 13:42:43 +01:00
|
|
|
//protocol_Gameplay_PlayerLeftTurn
|
|
|
|
struct Protocol_PlayerLeftTurn : public ::Oyster::Network::CustomProtocolObject
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
2014-02-19 13:42:43 +01:00
|
|
|
public:
|
|
|
|
float deltaRadian;
|
2014-02-21 11:10:47 +01:00
|
|
|
float lookdir[3];
|
2014-02-19 13:42:43 +01:00
|
|
|
|
|
|
|
Protocol_PlayerLeftTurn()
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
2014-02-19 13:42:43 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn;
|
|
|
|
this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short;
|
|
|
|
// deltaRadian
|
|
|
|
this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float;
|
2014-02-21 11:10:47 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
deltaRadian = 0.0f;
|
|
|
|
memset(&lookdir[0], 0, sizeof(float) * 3);
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
2014-02-12 13:11:35 +01:00
|
|
|
|
2014-02-19 13:42:43 +01:00
|
|
|
Protocol_PlayerLeftTurn( const ::Oyster::Network::CustomNetProtocol &p )
|
2013-12-20 09:42:02 +01:00
|
|
|
{
|
2014-02-19 13:42:43 +01:00
|
|
|
this->deltaRadian = p[1].value.netFloat;
|
2014-02-21 11:10:47 +01:00
|
|
|
lookdir[0] = p[2].value.netFloat;
|
|
|
|
lookdir[1] = p[3].value.netFloat;
|
|
|
|
lookdir[2] = p[4].value.netFloat;
|
2014-02-19 13:42:43 +01:00
|
|
|
}
|
2014-02-12 13:11:35 +01:00
|
|
|
|
2014-02-21 11:10:47 +01:00
|
|
|
Protocol_PlayerLeftTurn( float deltaRadian,float v[3] )
|
2014-02-19 13:42:43 +01:00
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn;
|
|
|
|
this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short;
|
2014-02-20 11:12:08 +01:00
|
|
|
this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float;
|
2014-02-21 11:10:47 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
|
2014-02-19 13:42:43 +01:00
|
|
|
this->deltaRadian = deltaRadian;
|
2014-02-21 11:10:47 +01:00
|
|
|
memcpy(&lookdir[0], &v[0], sizeof(float) * 3);
|
|
|
|
|
2013-12-20 09:42:02 +01:00
|
|
|
}
|
2014-02-12 13:11:35 +01:00
|
|
|
|
2014-02-19 13:42:43 +01:00
|
|
|
::Oyster::Network::CustomNetProtocol GetProtocol() override
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
2014-02-19 13:42:43 +01:00
|
|
|
this->protocol[1].value = this->deltaRadian;
|
2014-02-21 11:10:47 +01:00
|
|
|
this->protocol[2].value = this->lookdir[0];
|
|
|
|
this->protocol[3].value = this->lookdir[1];
|
|
|
|
this->protocol[4].value = this->lookdir[2];
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2013-12-18 12:18:01 +01:00
|
|
|
}
|
|
|
|
|
2014-02-19 13:42:43 +01:00
|
|
|
private:
|
|
|
|
::Oyster::Network::CustomNetProtocol protocol;
|
2013-12-18 12:18:01 +01:00
|
|
|
};
|
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
struct Protocol_PlayerChangeWeapon :public Oyster::Network::CustomProtocolObject
|
2013-12-11 12:14:00 +01:00
|
|
|
{
|
2013-12-17 10:07:46 +01:00
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
int ID;
|
2013-12-11 12:14:00 +01:00
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
Protocol_PlayerChangeWeapon()
|
2013-12-11 12:14:00 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerChangeWeapon;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_PlayerChangeWeapon(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
|
2013-12-11 12:14:00 +01:00
|
|
|
}
|
2014-01-21 09:52:48 +01:00
|
|
|
const Protocol_PlayerChangeWeapon& operator=(Oyster::Network::CustomNetProtocol& val)
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2014-01-27 13:56:31 +01:00
|
|
|
struct Protocol_PlayerShot :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
2014-02-05 11:46:04 +01:00
|
|
|
bool primaryPressed;
|
|
|
|
bool secondaryPressed;
|
|
|
|
bool utilityPressed;
|
2014-01-27 13:56:31 +01:00
|
|
|
|
|
|
|
Protocol_PlayerShot()
|
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_PlayerShot;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-27 13:56:31 +01:00
|
|
|
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
|
2014-02-05 11:46:04 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Bool;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_PlayerShot(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
2014-02-05 11:46:04 +01:00
|
|
|
primaryPressed = p[1].value.netBool;
|
|
|
|
secondaryPressed = p[2].value.netBool;
|
|
|
|
utilityPressed = p[3].value.netBool;
|
2014-01-27 13:56:31 +01:00
|
|
|
}
|
|
|
|
const Protocol_PlayerShot& operator=(Oyster::Network::CustomNetProtocol& val)
|
|
|
|
{
|
2014-02-05 11:46:04 +01:00
|
|
|
primaryPressed = val[1].value.netBool;
|
|
|
|
secondaryPressed = val[2].value.netBool;
|
|
|
|
utilityPressed = val[3].value.netBool;
|
2014-01-27 13:56:31 +01:00
|
|
|
return *this;
|
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2014-01-27 13:56:31 +01:00
|
|
|
{
|
2014-02-05 11:46:04 +01:00
|
|
|
this->protocol[1].value = primaryPressed;
|
|
|
|
this->protocol[2].value = secondaryPressed;
|
|
|
|
this->protocol[3].value = utilityPressed;
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-27 13:56:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2013-12-09 11:57:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|