2014-02-11 10:21:47 +01:00
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
// Created 2013 //
|
|
|
|
// Dennis Andersen, Linda Andersson //
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
2013-12-19 10:22:32 +01:00
|
|
|
#ifndef GAMELOGIC_OBJECT_PROTOCOLS_H
|
|
|
|
#define GAMELOGIC_OBJECT_PROTOCOLS_H
|
2013-12-11 12:14:00 +01:00
|
|
|
|
|
|
|
#include <CustomNetProtocol.h>
|
|
|
|
#include "ProtocolIdentificationID.h"
|
|
|
|
|
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectPickup 350
|
2014-01-21 14:32:42 +01:00
|
|
|
struct Protocol_ObjectPickup :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
2014-01-31 08:41:08 +01:00
|
|
|
short object_ID;
|
2014-01-21 14:32:42 +01:00
|
|
|
short pickup_ID;
|
|
|
|
|
|
|
|
Protocol_ObjectPickup()
|
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectPickup;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
|
2014-01-31 08:41:08 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
|
|
|
|
object_ID = -1;
|
|
|
|
pickup_ID = -1;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectPickup(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
2014-01-31 08:41:08 +01:00
|
|
|
object_ID = p[1].value.netShort;
|
|
|
|
pickup_ID = p[2].value.netShort;
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectPickup(int objectID, short pickupID)
|
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectPosition;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
|
2014-01-31 08:41:08 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
|
|
|
|
object_ID = objectID;
|
|
|
|
pickup_ID = pickupID;
|
|
|
|
|
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2014-01-21 14:32:42 +01:00
|
|
|
{
|
|
|
|
this->protocol[1].value = object_ID;
|
|
|
|
this->protocol[2].value = pickup_ID;
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectDamage 351
|
2014-01-21 14:32:42 +01:00
|
|
|
struct Protocol_ObjectDamage :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
int object_ID;
|
2014-02-11 10:21:47 +01:00
|
|
|
float healthLost; //Precentage%
|
2014-01-21 14:32:42 +01:00
|
|
|
|
|
|
|
Protocol_ObjectDamage()
|
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectDamage;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
|
|
|
|
object_ID = -1;
|
2014-02-11 10:21:47 +01:00
|
|
|
healthLost = 0.0f;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectDamage(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectDamage(int id, float hp)
|
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectDamage;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
|
|
|
|
object_ID = id;
|
2014-02-11 10:21:47 +01:00
|
|
|
healthLost = hp;
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2014-01-21 14:32:42 +01:00
|
|
|
{
|
|
|
|
this->protocol[1].value = object_ID;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[2].value = healthLost;
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectHealthStatus 352
|
|
|
|
struct Protocol_ObjectHealthStatus :public Oyster::Network::CustomProtocolObject
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
float currentHealth;
|
|
|
|
int id;
|
|
|
|
|
|
|
|
Protocol_ObjectHealthStatus()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectHealthStatus;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->id = 0;
|
|
|
|
this->currentHealth = 0.0f;
|
|
|
|
}
|
|
|
|
Protocol_ObjectHealthStatus(int id, float health)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectHealthStatus;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->id = id; this->currentHealth = health;
|
|
|
|
}
|
|
|
|
Protocol_ObjectHealthStatus(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->id = p[1].value.netInt;
|
|
|
|
this->currentHealth = p[2].value.netFloat;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->id;
|
|
|
|
this->protocol[2].value = this->currentHealth;
|
|
|
|
|
|
|
|
return protocol;
|
|
|
|
}
|
2013-12-18 12:18:01 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectPosition 353
|
|
|
|
struct Protocol_ObjectPosition :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
short object_ID;
|
|
|
|
float position[3];
|
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
Protocol_ObjectPosition()
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectPosition;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
|
2013-12-18 12:18:01 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
object_ID = 0;
|
|
|
|
memset(&position[0], 0, sizeof(float) * 3);
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectPosition(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
object_ID = p[1].value.netShort;
|
|
|
|
position[0] = p[2].value.netFloat;
|
|
|
|
position[1] = p[3].value.netFloat;
|
|
|
|
position[2] = p[4].value.netFloat;
|
2013-12-18 12:18:01 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Protocol_ObjectPosition(float v[3], int id)
|
2014-01-13 12:11:45 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectPosition;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
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-01-13 12:11:45 +01:00
|
|
|
|
|
|
|
object_ID = id;
|
2014-02-11 10:21:47 +01:00
|
|
|
memcpy(&position[0], &v[0], sizeof(float) * 3);
|
2014-01-13 12:11:45 +01:00
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2013-12-18 12:18:01 +01:00
|
|
|
{
|
|
|
|
this->protocol[1].value = object_ID;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[2].value = position[0];
|
|
|
|
this->protocol[3].value = position[1];
|
|
|
|
this->protocol[4].value = position[2];
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
2013-12-18 12:18:01 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
2014-01-21 09:52:48 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectScale 354
|
|
|
|
struct Protocol_ObjectScale :public Oyster::Network::CustomProtocolObject
|
2013-12-11 12:14:00 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
short object_ID;
|
|
|
|
float position[3];
|
|
|
|
|
|
|
|
Protocol_ObjectScale()
|
2013-12-11 12:14:00 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectScale;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
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-01-07 10:26:09 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
object_ID = 0;
|
|
|
|
memset(&position[0], 0, sizeof(float) * 3);
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Protocol_ObjectScale(Oyster::Network::CustomNetProtocol& p)
|
2014-01-29 15:01:14 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
object_ID = p[1].value.netShort;
|
|
|
|
position[0] = p[2].value.netFloat;
|
|
|
|
position[1] = p[3].value.netFloat;
|
|
|
|
position[2] = p[4].value.netFloat;
|
2013-12-11 12:14:00 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Protocol_ObjectScale(float v[3], int id)
|
2013-12-19 15:35:49 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectScale;
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
|
|
|
|
object_ID = id;
|
|
|
|
memcpy(&position[0], &v[0], sizeof(float) * 3);
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = object_ID;
|
|
|
|
this->protocol[2].value = position[0];
|
|
|
|
this->protocol[3].value = position[1];
|
|
|
|
this->protocol[4].value = position[2];
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectRotation 355
|
|
|
|
struct Protocol_ObjectRotation :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
short object_ID;
|
|
|
|
float position[3];
|
|
|
|
|
|
|
|
Protocol_ObjectRotation()
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectRotation;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
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-01-07 10:26:09 +01:00
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
object_ID = 0;
|
|
|
|
memset(&position[0], 0, sizeof(float) * 3);
|
|
|
|
}
|
|
|
|
Protocol_ObjectRotation(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
object_ID = p[1].value.netShort;
|
|
|
|
position[0] = p[2].value.netFloat;
|
|
|
|
position[1] = p[3].value.netFloat;
|
|
|
|
position[2] = p[4].value.netFloat;
|
|
|
|
}
|
|
|
|
Protocol_ObjectRotation(float v[3], int id)
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectRotation;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
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-01-07 10:26:09 +01:00
|
|
|
|
|
|
|
object_ID = id;
|
2014-02-11 10:21:47 +01:00
|
|
|
memcpy(&position[0], &v[0], sizeof(float) * 3);
|
2013-12-19 15:35:49 +01:00
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2013-12-11 12:14:00 +01:00
|
|
|
{
|
2013-12-17 10:07:46 +01:00
|
|
|
this->protocol[1].value = object_ID;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[2].value = position[0];
|
|
|
|
this->protocol[3].value = position[1];
|
|
|
|
this->protocol[4].value = position[2];
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectEnabled 356
|
|
|
|
struct Protocol_ObjectEnable :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
int objectID;
|
|
|
|
|
|
|
|
Protocol_ObjectEnable()
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectEnabled;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = -1;
|
|
|
|
}
|
|
|
|
Protocol_ObjectEnable(int objectID)
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectEnabled;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = objectID;
|
|
|
|
}
|
|
|
|
Protocol_ObjectEnable(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->objectID = p[1].value.netInt;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->objectID;
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2013-12-19 15:35:49 +01:00
|
|
|
}
|
2013-12-11 12:14:00 +01:00
|
|
|
|
|
|
|
private:
|
2013-12-13 12:02:49 +01:00
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
2013-12-11 12:14:00 +01:00
|
|
|
};
|
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectDisabled 357
|
2014-01-21 09:52:48 +01:00
|
|
|
struct Protocol_ObjectDisable :public Oyster::Network::CustomProtocolObject
|
2013-12-18 15:28:47 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
int objectID;
|
|
|
|
float seconds;
|
2013-12-18 15:28:47 +01:00
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
Protocol_ObjectDisable()
|
2013-12-18 15:28:47 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectDisabled;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2013-12-18 15:28:47 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
2014-01-21 09:52:48 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->objectID = 0;
|
|
|
|
this->seconds = 0.0f;
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
2014-02-11 10:21:47 +01:00
|
|
|
Protocol_ObjectDisable(int objctID, float seconds)
|
2014-01-21 14:32:42 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectDisabled;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 14:32:42 +01:00
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
2014-02-11 10:21:47 +01:00
|
|
|
this->objectID = objctID;
|
|
|
|
this->seconds = seconds;
|
|
|
|
}
|
|
|
|
Protocol_ObjectDisable(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->objectID = p[1].value.netInt;
|
|
|
|
this->seconds = p[2].value.netFloat;
|
2014-01-21 14:32:42 +01:00
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-02-11 10:21:47 +01:00
|
|
|
this->protocol[1].value = this->objectID;
|
|
|
|
this->protocol[2].value = this->seconds;
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2014-02-11 10:21:47 +01:00
|
|
|
//#define protocol_Gameplay_ObjectCreate 358
|
2014-01-21 14:32:42 +01:00
|
|
|
struct Protocol_ObjectCreate :public Oyster::Network::CustomProtocolObject
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-02-05 15:16:31 +01:00
|
|
|
//ObjectType type; //ie player, box or whatever
|
2014-01-21 09:52:48 +01:00
|
|
|
int object_ID;
|
2014-02-04 16:07:10 +01:00
|
|
|
std::string name;
|
2014-01-21 09:52:48 +01:00
|
|
|
float worldMatrix[16];
|
|
|
|
|
2014-01-21 14:32:42 +01:00
|
|
|
Protocol_ObjectCreate()
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectCreate;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
2014-02-04 16:07:10 +01:00
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
for (int i = 3; i <= 18; i++)
|
|
|
|
{
|
|
|
|
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
}
|
2014-01-29 15:01:14 +01:00
|
|
|
}
|
|
|
|
Protocol_ObjectCreate(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
2014-01-21 14:32:42 +01:00
|
|
|
Protocol_ObjectCreate(float m[16], int id, char *path)
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-01-30 14:15:25 +01:00
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectCreate;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
|
|
|
|
|
|
|
|
for (int i = 3; i <= 18; i++)
|
|
|
|
{
|
|
|
|
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
}
|
|
|
|
|
|
|
|
object_ID = id;
|
2014-01-21 14:32:42 +01:00
|
|
|
this->name = path;
|
2014-01-21 09:52:48 +01:00
|
|
|
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
|
2013-12-18 15:28:47 +01:00
|
|
|
}
|
2014-01-31 22:52:52 +01:00
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
2013-12-18 15:28:47 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
this->protocol[1].value = object_ID;
|
2014-02-04 16:07:10 +01:00
|
|
|
this->protocol.Set(2, name);
|
2014-01-21 09:52:48 +01:00
|
|
|
this->protocol[3].value = worldMatrix[0];
|
|
|
|
this->protocol[4].value = worldMatrix[1];
|
|
|
|
this->protocol[5].value = worldMatrix[2];
|
|
|
|
this->protocol[6].value = worldMatrix[3];
|
|
|
|
this->protocol[7].value = worldMatrix[4];
|
|
|
|
this->protocol[8].value = worldMatrix[5];
|
|
|
|
this->protocol[9].value = worldMatrix[6];
|
|
|
|
this->protocol[10].value = worldMatrix[7];
|
|
|
|
this->protocol[11].value = worldMatrix[8];
|
|
|
|
this->protocol[12].value = worldMatrix[9];
|
|
|
|
this->protocol[13].value = worldMatrix[10];
|
|
|
|
this->protocol[14].value = worldMatrix[11];
|
|
|
|
this->protocol[15].value = worldMatrix[12];
|
|
|
|
this->protocol[16].value = worldMatrix[13];
|
|
|
|
this->protocol[17].value = worldMatrix[14];
|
|
|
|
this->protocol[18].value = worldMatrix[15];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-31 22:52:52 +01:00
|
|
|
return protocol;
|
2013-12-18 15:28:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
2014-02-11 10:21:47 +01:00
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectCreatePlayer 359
|
|
|
|
struct Protocol_ObjectCreatePlayer :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
//ObjectType type; //ie player, box or whatever
|
|
|
|
int object_ID;
|
|
|
|
int teamId;
|
|
|
|
std::string name;
|
|
|
|
std::string meshName;
|
|
|
|
float position[3];
|
|
|
|
float rotation[3];
|
|
|
|
float scale[3];
|
|
|
|
|
|
|
|
Protocol_ObjectCreatePlayer()
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectCreatePlayer;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
|
|
|
|
//PLAYER_ID
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
//TEAM_ID
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
//PLAYER-NAME
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_CharArray;
|
|
|
|
//MESH-NAME
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
|
|
|
|
//POSITION
|
|
|
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
//ROTATION
|
|
|
|
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
//SCALE
|
|
|
|
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[13].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
}
|
|
|
|
Protocol_ObjectCreatePlayer(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
Protocol_ObjectCreatePlayer(float position[3], float rotation[3], float scale[3], int ObjectID, int teamID, std::string name, std::string meshName)
|
|
|
|
{
|
|
|
|
this->protocol[0].value = protocol_Gameplay_ObjectCreatePlayer;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
|
|
|
|
//PLAYER_ID
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
//TEAM_ID
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
//PLAYER-NAME
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_CharArray;
|
|
|
|
//MESH-NAME
|
|
|
|
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
|
|
|
|
//POSITION
|
|
|
|
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
//ROTATION
|
|
|
|
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
//SCALE
|
|
|
|
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[13].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
|
|
|
|
this->object_ID = ObjectID;
|
|
|
|
this->teamId = teamID;
|
|
|
|
this->name = name;
|
|
|
|
this->meshName = meshName;
|
|
|
|
memcpy(&this->position[0], &position[0], sizeof(float)*3);
|
|
|
|
memcpy(&this->rotation[0], &rotation[0], sizeof(float)*3);
|
|
|
|
memcpy(&this->scale[0], &scale[0], sizeof(float)*3);
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
|
|
|
|
this->protocol[1].value = this->object_ID;
|
|
|
|
this->protocol[2].value = this->teamId;
|
|
|
|
this->protocol.Set(3, this->name);
|
|
|
|
this->protocol.Set(4, this->meshName);
|
|
|
|
|
|
|
|
//POSITION
|
|
|
|
this->protocol[5].value = this->position[0];
|
|
|
|
this->protocol[6].value = this->position[1];
|
|
|
|
this->protocol[7].value = this->position[2];
|
|
|
|
//ROTATION
|
|
|
|
this->protocol[8].value = this->rotation[0];
|
|
|
|
this->protocol[9].value = this->rotation[1];
|
|
|
|
this->protocol[10].value = this->rotation[2];
|
|
|
|
//SCALE
|
|
|
|
this->protocol[11].value = this->scale[0];
|
|
|
|
this->protocol[12].value = this->scale[1];
|
|
|
|
this->protocol[13].value = this->scale[2];
|
|
|
|
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectJoinTeam 360
|
|
|
|
struct Protocol_ObjectJoinTeam :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
int objectID;
|
|
|
|
int teamID;
|
|
|
|
|
|
|
|
Protocol_ObjectJoinTeam()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectJoinTeam;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = 0;
|
|
|
|
this->teamID = 0;
|
|
|
|
}
|
|
|
|
Protocol_ObjectJoinTeam(int objID, int teamID)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectJoinTeam;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = objID;
|
|
|
|
this->teamID = teamID;
|
|
|
|
}
|
|
|
|
Protocol_ObjectJoinTeam(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->objectID = p[1].value.netInt;
|
|
|
|
this->teamID = p[2].value.netInt;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->objectID;
|
|
|
|
this->protocol[2].value = this->teamID;
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectLeaveTeam 361
|
|
|
|
struct Protocol_ObjectLeaveTeam :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
int objectID;
|
|
|
|
Protocol_ObjectLeaveTeam()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectLeaveTeam;
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = 0;
|
|
|
|
}
|
|
|
|
Protocol_ObjectLeaveTeam(int objectID)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectLeaveTeam;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->objectID = objectID;
|
|
|
|
}
|
|
|
|
Protocol_ObjectLeaveTeam(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->objectID = p[1].value.netInt;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->objectID;
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectWeaponCooldown 362
|
|
|
|
struct Protocol_ObjectWeaponCooldown :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
float seconds;
|
|
|
|
Protocol_ObjectWeaponCooldown()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectWeaponCooldown;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->seconds = 0.0f;
|
|
|
|
}
|
|
|
|
Protocol_ObjectWeaponCooldown(float seconds)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectWeaponCooldown;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->seconds = seconds;
|
|
|
|
}
|
|
|
|
Protocol_ObjectWeaponCooldown(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->seconds = p[1].value.netFloat;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->seconds;
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectWeaponEnergy 363
|
|
|
|
struct Protocol_ObjectWeaponEnergy :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
float energy;
|
|
|
|
Protocol_ObjectWeaponEnergy()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectWeaponEnergy;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->energy = 0.0f;
|
|
|
|
}
|
|
|
|
Protocol_ObjectWeaponEnergy(float energy)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectWeaponEnergy;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->energy = energy;
|
|
|
|
}
|
|
|
|
Protocol_ObjectWeaponEnergy(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->energy = p[1].value.netFloat;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->energy;
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectRespawn 364
|
|
|
|
struct Protocol_ObjectRespawn :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
float position[3];
|
|
|
|
|
|
|
|
Protocol_ObjectRespawn()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectRespawn;
|
|
|
|
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
memset(&this->position[0], 0, sizeof(float) * 3);
|
|
|
|
}
|
|
|
|
Protocol_ObjectRespawn(float position[3])
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectRespawn;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
|
|
|
|
memcpy(&this->position[0], &position[0], sizeof(float) * 3);
|
|
|
|
}
|
|
|
|
Protocol_ObjectRespawn(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->position[0] = p[1].value.netFloat;
|
|
|
|
this->position[1] = p[2].value.netFloat;
|
|
|
|
this->position[2] = p[3].value.netFloat;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->position[0];
|
|
|
|
this->protocol[2].value = this->position[1];
|
|
|
|
this->protocol[3].value = this->position[2];
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
//#define protocol_Gameplay_ObjectDie 365
|
|
|
|
struct Protocol_ObjectDie :public Oyster::Network::CustomProtocolObject
|
|
|
|
{
|
|
|
|
int objectID;
|
|
|
|
float seconds;
|
|
|
|
|
|
|
|
Protocol_ObjectDie()
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectDie;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->objectID = 0;
|
|
|
|
this->seconds = 0.0f;
|
|
|
|
}
|
|
|
|
Protocol_ObjectDie(int objectID, float seconds)
|
|
|
|
{
|
|
|
|
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
|
|
|
this->protocol[0].value.netShort = protocol_Gameplay_ObjectDie;
|
|
|
|
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
|
|
|
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
|
|
|
|
this->objectID = objectID;
|
|
|
|
this->seconds = seconds;
|
|
|
|
}
|
|
|
|
Protocol_ObjectDie(Oyster::Network::CustomNetProtocol& p)
|
|
|
|
{
|
|
|
|
this->objectID = p[1].value.netInt;
|
|
|
|
this->seconds = p[2].value.netFloat;
|
|
|
|
}
|
|
|
|
Oyster::Network::CustomNetProtocol GetProtocol() override
|
|
|
|
{
|
|
|
|
this->protocol[1].value = this->objectID;
|
|
|
|
this->protocol[2].value = this->seconds;
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2013-12-11 12:14:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H
|