2
// network quantization scale
3
#define DMF 16.0f // for world locations
4
#define DNF 100.0f // for normalized vectors
5
#define DVELF 1.0f // for playerspeed based velocity vectors
7
enum // static entity types
9
NOTUSED = ET_EMPTY, // entity slot not in use in map
10
LIGHT = ET_LIGHT, // lightsource, attr1 = radius, attr2 = intensity
11
MAPMODEL = ET_MAPMODEL, // attr1 = angle, attr2 = idx
12
PLAYERSTART, // attr1 = angle
13
ENVMAP = ET_ENVMAP, // attr1 = radius
14
I_SHELLS, I_BULLETS, I_ROCKETS, I_ROUNDS, I_GRENADES, I_CARTRIDGES,
16
I_GREENARMOUR, I_YELLOWARMOUR,
18
TELEPORT, // attr1 = idx
19
TELEDEST, // attr1 = angle, attr2 = idx
20
MONSTER, // attr1 = angle, attr2 = monstertype
21
CARROT, // attr1 = tag, attr2 = type
22
JUMPPAD, // attr1 = zpush, attr2 = ypush, attr3 = xpush
28
struct fpsentity : extentity
30
// extend with additional fields if needed...
33
enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, GUN_FIREBALL, GUN_ICEBALL, GUN_SLIMEBALL, GUN_BITE, NUMGUNS };
34
enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off
35
enum { M_NONE = 0, M_SEARCH, M_HOME, M_ATTACKING, M_PAIN, M_SLEEP, M_AIMING }; // monster states
37
struct fpsent : dynent
39
int weight; // affects the effectiveness of hitpush
40
int clientnum, lastupdate, plag, ping;
41
int lifesequence; // sequence id for each respawn, used in damage test
42
int health, armour, armourtype, quadmillis;
45
int gunselect, gunwait;
46
int lastaction, lastattackgun;
50
int frags, deaths, totaldamage, totalshots;
53
string name, team, info;
55
fpsent() : weight(100), clientnum(-1), lastupdate(0), plag(0), ping(0), lifesequence(0), maxhealth(100), lastpain(0), frags(0), deaths(0), totaldamage(0), totalshots(0), edit(NULL)
56
{ name[0] = team[0] = info[0] = 0; respawn(); };
57
~fpsent() { freeeditinfo(edit); };
65
quadmillis = gunwait = lastaction = 0;
66
lastattackgun = gunselect = GUN_PISTOL;
68
loopi(NUMGUNS) ammo[i] = 0;
74
extern int gamemode, nextmode;
75
extern vector<fpsent *> players; // all the other clients (in multiplayer)
76
extern fpsent *player1; // special client ent that receives input
78
#define m_noitems (gamemode>=4 && gamemode<12)
79
#define m_noitemsrail ((gamemode>=4 && gamemode<=5) || (gamemode>=8 && gamemode<=9))
80
#define m_arena (gamemode>=8 && gamemode<12)
81
#define m_tarena (gamemode>=10 && gamemode<12)
82
#define m_capture (gamemode==12)
83
#define m_teammode ((gamemode&1 && gamemode>2) || m_capture)
84
#define m_sp (gamemode<0)
85
#define m_dmsp (gamemode==-1)
86
#define m_classicsp (gamemode==-2)
87
#define isteam(a,b) (m_teammode && strcmp(a, b)==0)
89
#define m_mp(mode) (mode>=0 && mode<=12)
91
// hardcoded sounds, defined in sounds.cfg
94
S_JUMP = 0, S_LAND, S_RIFLE, S_PUNCH1, S_SG, S_CG,
95
S_RLFIRE, S_RLHIT, S_WEAPLOAD, S_ITEMAMMO, S_ITEMHEALTH,
96
S_ITEMARMOUR, S_ITEMPUP, S_ITEMSPAWN, S_TELEPORT, S_NOAMMO, S_PUPOUT,
97
S_PAIN1, S_PAIN2, S_PAIN3, S_PAIN4, S_PAIN5, S_PAIN6,
99
S_FLAUNCH, S_FEXPLODE,
100
S_SPLASH1, S_SPLASH2,
101
S_GRUNT1, S_GRUNT2, S_RUMBLE,
110
S_PIGR1, S_ICEBALL, S_SLIMEBALL,
113
S_V_BASECAP, S_V_BASELOST,
115
S_V_BOOST, S_V_BOOST10,
116
S_V_QUAD, S_V_QUAD10,
121
// network messages codes, c2s, c2c, s2c
124
SV_INITS2C = 0, SV_INITC2S, SV_POS, SV_TEXT, SV_SOUND, SV_CDIS,
125
SV_DIED, SV_DAMAGE, SV_SHOT, SV_FRAGS, SV_GUNSELECT,
126
SV_MAPCHANGE, SV_MAPVOTE, SV_ITEMSPAWN, SV_ITEMPICKUP, SV_DENIED,
127
SV_PING, SV_PONG, SV_CLIENTPING,
128
SV_TIMEUP, SV_MAPRELOAD, SV_ITEMACC,
129
SV_SERVMSG, SV_ITEMLIST, SV_RESUME,
130
SV_EDITENT, SV_EDITF, SV_EDITT, SV_EDITM, SV_FLIP, SV_COPY, SV_PASTE, SV_ROTATE, SV_REPLACE, SV_DELCUBE, SV_NEWMAP, SV_GETMAP,
131
SV_MASTERMODE, SV_KICK, SV_CURRENTMASTER, SV_SPECTATOR, SV_SETMASTER, SV_SETTEAM,
132
SV_BASES, SV_BASEINFO, SV_TEAMSCORE, SV_REPAMMO, SV_FORCEINTERMISSION, SV_ANNOUNCE,
136
#define SAUERBRATEN_SERVER_PORT 28785
137
#define SAUERBRATEN_SERVINFO_PORT 28786
138
#define PROTOCOL_VERSION 252 // bump when protocol changes
140
#define MAXNAMELEN 15