ddnet/src/antibot/antibot_data.h

96 lines
1.6 KiB
C
Raw Normal View History

#ifndef ANTIBOT_ANTIBOT_DATA_H
#define ANTIBOT_ANTIBOT_DATA_H
2020-05-15 16:29:34 +00:00
#include <base/system.h>
#include <base/vmath.h>
enum
{
2020-07-01 12:11:37 +00:00
ANTIBOT_ABI_VERSION=3,
2020-05-15 22:39:17 +00:00
ANTIBOT_MSGFLAG_NONVITAL=1,
ANTIBOT_MSGFLAG_FLUSH=2,
ANTIBOT_MAX_CLIENTS=64,
};
struct CAntibotMapData
{
int m_Width;
int m_Height;
unsigned char *m_pTiles;
};
struct CAntibotInputData
{
int m_TargetX;
int m_TargetY;
};
// Defined by the network protocol, unlikely to change.
//enum
//{
//TEAM_SPECTATORS=-1,
//TEAM_RED=0,
//TEAM_BLUE=1,
//};
struct CAntibotCharacterData
{
char m_aName[16];
CAntibotInputData m_aLatestInputs[3];
bool m_Alive;
bool m_Pause;
int m_Team;
vec2 m_Pos;
vec2 m_Vel;
int m_Angle;
int m_HookedPlayer;
int m_SpawnTick;
int m_WeaponChangeTick;
};
2020-05-15 22:39:17 +00:00
struct CAntibotVersion
{
int m_AbiVersion;
int m_Size;
int m_SizeData;
int m_SizeCharacterData;
int m_SizeInputData;
int m_SizeMapData;
int m_SizeRoundData;
};
#define ANTIBOT_VERSION { \
ANTIBOT_ABI_VERSION, \
sizeof(CAntibotVersion), \
sizeof(CAntibotData), \
sizeof(CAntibotCharacterData), \
sizeof(CAntibotInputData), \
sizeof(CAntibotMapData), \
sizeof(CAntibotRoundData), \
}
2020-05-15 16:29:34 +00:00
struct CAntibotData
{
2020-05-15 22:39:17 +00:00
CAntibotVersion m_Version;
2020-05-15 16:29:34 +00:00
int64 m_Now;
int64 m_Freq;
void (*m_pfnLog)(const char *pMessage, void *pUser);
void (*m_pfnReport)(int ClientID, const char *pMessage, void *pUser);
void (*m_pfnSend)(int ClientID, const void *pData, int DataSize, int Flags, void *pUser);
void *m_pUser;
};
struct CAntibotRoundData
{
int m_Tick;
CAntibotCharacterData m_aCharacters[ANTIBOT_MAX_CLIENTS];
CAntibotMapData m_Map;
};
#endif // ANTIBOT_ANTIBOT_DATA_H