~ubuntu-branches/ubuntu/hardy/sauerbraten/hardy-backports

« back to all changes in this revision

Viewing changes to fpsgame/game.h

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert
  • Date: 2007-01-09 18:19:30 UTC
  • Revision ID: james.westby@ubuntu.com-20070109181930-zy2ulzq3ukfjhrix
Tags: upstream-0.0.20061204.dfsg
ImportĀ upstreamĀ versionĀ 0.0.20061204.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
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
 
6
 
 
7
enum                            // static entity types
 
8
{
 
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,
 
15
    I_HEALTH, I_BOOST,
 
16
    I_GREENARMOUR, I_YELLOWARMOUR,
 
17
    I_QUAD,
 
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
 
23
    BASE,
 
24
    RESPAWNPOINT,
 
25
    MAXENTTYPES
 
26
};
 
27
 
 
28
struct fpsentity : extentity
 
29
{
 
30
    // extend with additional fields if needed...
 
31
};
 
32
 
 
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
 
36
 
 
37
struct fpsent : dynent
 
38
{
 
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;
 
43
    int maxhealth;
 
44
    int lastpain;
 
45
    int gunselect, gunwait;
 
46
    int lastaction, lastattackgun;
 
47
    bool attacking;
 
48
    int ammo[NUMGUNS];
 
49
    int superdamage;
 
50
    int frags, deaths, totaldamage, totalshots;
 
51
    editinfo *edit;
 
52
 
 
53
    string name, team, info;
 
54
 
 
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); };
 
58
 
 
59
    void respawn()
 
60
    {
 
61
        reset();
 
62
        health = maxhealth;
 
63
        armour = 0;
 
64
        armourtype = A_BLUE;
 
65
        quadmillis = gunwait = lastaction = 0;
 
66
        lastattackgun = gunselect = GUN_PISTOL;
 
67
        attacking = false;
 
68
        loopi(NUMGUNS) ammo[i] = 0;
 
69
        ammo[GUN_FIST] = 1;
 
70
        superdamage = 0;
 
71
    };
 
72
};
 
73
 
 
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
 
77
 
 
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)
 
88
 
 
89
#define m_mp(mode)       (mode>=0 && mode<=12)
 
90
 
 
91
// hardcoded sounds, defined in sounds.cfg
 
92
enum
 
93
{
 
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,
 
98
    S_DIE1, S_DIE2,
 
99
    S_FLAUNCH, S_FEXPLODE,
 
100
    S_SPLASH1, S_SPLASH2,
 
101
    S_GRUNT1, S_GRUNT2, S_RUMBLE,
 
102
    S_PAINO,
 
103
    S_PAINR, S_DEATHR,
 
104
    S_PAINE, S_DEATHE,
 
105
    S_PAINS, S_DEATHS,
 
106
    S_PAINB, S_DEATHB,
 
107
    S_PAINP, S_PIGGR2,
 
108
    S_PAINH, S_DEATHH,
 
109
    S_PAIND, S_DEATHD,
 
110
    S_PIGR1, S_ICEBALL, S_SLIMEBALL,
 
111
    S_JUMPPAD, S_PISTOL,
 
112
    
 
113
    S_V_BASECAP, S_V_BASELOST,
 
114
    S_V_FIGHT,
 
115
    S_V_BOOST, S_V_BOOST10,
 
116
    S_V_QUAD, S_V_QUAD10,
 
117
    S_V_RESPAWNPOINT, 
 
118
};
 
119
 
 
120
 
 
121
// network messages codes, c2s, c2c, s2c
 
122
enum
 
123
{
 
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,
 
133
    SV_CLIENT,
 
134
};
 
135
 
 
136
#define SAUERBRATEN_SERVER_PORT 28785
 
137
#define SAUERBRATEN_SERVINFO_PORT 28786
 
138
#define PROTOCOL_VERSION 252            // bump when protocol changes
 
139
 
 
140
#define MAXNAMELEN 15
 
141
#define MAXTEAMLEN 4