X-Git-Url: https://deadsoftware.ru/gitweb?p=netwar.git;a=blobdiff_plain;f=protocol.h;h=a20c773d16fbe0751ac5fcb6b6f9da3c4f05b233;hp=26815532050839457926e8bb89b51c21bd170a71;hb=4148d3ff0c0c4b52b0741c38a867a1502600a65f;hpb=c4b04d12861ae0eac6315b1c2170013422136f80 diff --git a/protocol.h b/protocol.h index 2681553..a20c773 100644 --- a/protocol.h +++ b/protocol.h @@ -6,7 +6,7 @@ #include #define DEFAULT_PORT 29386 -#define PROTOCOL_VERSION 0 +#define PROTOCOL_VERSION 1 #define PROTOCOL_F8FRAC (1 << 7) #define PACKED __attribute__((__packed__)) @@ -21,6 +21,7 @@ typedef enum { SV_INFO = 128, SV_KILL = 139, SV_SPLR = 130, + SV_SBUL = 131, } MessageType; typedef enum { @@ -67,6 +68,16 @@ typedef struct PACKED SvSplr { uint8_t vx, vy, vr; } SvSplr; +typedef struct PACKED SvSbul { + uint8_t type; + uint8_t id; + uint8_t owner; + uint8_t live; + uint8_t x, y; + uint8_t vx, vy; + uint8_t tick; +} SvSbul; + typedef union ClMessage { uint8_t type; ClInfo info; @@ -79,6 +90,7 @@ typedef union SvMessage { SvInfo info; SvKill kill; SvSplr splr; + SvSbul sbul; } SvMessage; typedef union ProtocolMessage { @@ -99,6 +111,7 @@ static inline int MessageTypeSize(MessageType type) { case SV_INFO: return sizeof(SvInfo); case SV_KILL: return sizeof(SvKill); case SV_SPLR: return sizeof(SvSplr); + case SV_SBUL: return sizeof(SvSbul); default: return sizeof(ProtocolMessage); } } @@ -162,6 +175,20 @@ static inline ProtocolMessage sv_splr(int clid, bool live, float x, float y, flo }; } +static inline ProtocolMessage sv_sbul(int id, int owner, bool live, float x, float y, float vx, float vy, int tick) { + return (ProtocolMessage) (SvMessage) (SvSbul) { + .type = SV_SBUL, + .id = id, + .owner = owner, + .live = live, + .x = f2b(x), + .y = f2b(y), + .vx = f2b(vx), + .vy = f2b(vy), + .tick = tick, + }; +} + #undef PACKED #endif /* PROTOCOL_H_INCLUDED */