1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// entities.cpp: map entity related functions (pickup etc.)
#include "cube.h"
#import "MapModelInfo.h"
vector<entity> ents;
static OFString *entmdlnames[] = {
@"shells",
@"bullets",
@"rockets",
@"rrounds",
@"health",
@"boost",
@"g_armour",
@"y_armour",
@"quad",
@"teleporter",
};
int triggertime = 0;
void
renderent(entity &e, OFString *mdlname, float z, float yaw, int frame = 0,
int numf = 1, int basetime = 0, float speed = 10.0f)
|
|
|
|
|
|
|
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// entities.cpp: map entity related functions (pickup etc.)
#include "cube.h"
#import "MapModelInfo.h"
vector<entity> ents;
static OFString *entmdlnames[] = {
@"shells",
@"bullets",
@"rockets",
@"rrounds",
@"health",
@"boost",
@"g_armour",
@"y_armour",
@"quad",
@"teleporter",
};
int triggertime = 0;
void
renderent(entity &e, OFString *mdlname, float z, float yaw, int frame = 0,
int numf = 1, int basetime = 0, float speed = 10.0f)
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
if (e.type < I_SHELLS || e.type > TELEPORT)
continue;
renderent(e, entmdlnames[e.type - I_SHELLS],
(float)(1 +
sin(lastmillis / 100.0 + e.x + e.y) /
20),
lastmillis / 10.0f);
} else
switch (e.attr2) {
case 1:
case 3:
continue;
case 2:
case 0:
|
|
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
if (e.type < I_SHELLS || e.type > TELEPORT)
continue;
renderent(e, entmdlnames[e.type - I_SHELLS],
(float)(1 +
sin(lastmillis / 100.0 + e.x + e.y) /
20),
lastmillis / 10.0f);
} else {
switch (e.attr2) {
case 1:
case 3:
continue;
case 2:
case 0:
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 30
: 0,
(e.spawned || !triggertime) ? 1
: 30,
triggertime, 35.0f);
break;
};
};
}
}
struct itemstat {
int add, max, sound;
} itemstats[] = {
10,
50,
S_ITEMAMMO,
20,
100,
S_ITEMAMMO,
5,
25,
S_ITEMAMMO,
5,
25,
S_ITEMAMMO,
25,
100,
S_ITEMHEALTH,
50,
200,
S_ITEMHEALTH,
100,
100,
S_ITEMARMOUR,
150,
150,
S_ITEMARMOUR,
20000,
30000,
S_ITEMPUP,
};
void
baseammo(int gun)
{
player1->ammo[gun] = itemstats[gun - 1].add * 2;
}
|
<
<
>
>
>
<
<
|
<
<
|
<
<
|
<
<
|
<
<
|
<
<
|
<
<
|
<
<
|
<
<
|
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 30
: 0,
(e.spawned || !triggertime) ? 1
: 30,
triggertime, 35.0f);
break;
}
}
}
}
}
struct itemstat {
int add, max, sound;
} itemstats[] = {
{ 10, 50, S_ITEMAMMO },
{ 20, 100, S_ITEMAMMO },
{ 5, 25, S_ITEMAMMO },
{ 5, 25, S_ITEMAMMO },
{ 25, 100, S_ITEMHEALTH },
{ 50, 200, S_ITEMHEALTH },
{ 100, 100, S_ITEMARMOUR },
{ 150, 150, S_ITEMARMOUR },
{ 20000, 30000, S_ITEMPUP },
};
void
baseammo(int gun)
{
player1->ammo[gun] = itemstats[gun - 1].add * 2;
}
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
case TELEPORT: {
static int lastteleport = 0;
if (lastmillis - lastteleport < 500)
break;
lastteleport = lastmillis;
teleport(n, d);
break;
};
case JUMPPAD: {
static int lastjumppad = 0;
if (lastmillis - lastjumppad < 300)
break;
lastjumppad = lastmillis;
OFVector3D v = OFMakeVector3D((int)(char)ents[n].attr3 / 10.0f,
|
<
>
|
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
case TELEPORT: {
static int lastteleport = 0;
if (lastmillis - lastteleport < 500)
break;
lastteleport = lastmillis;
teleport(n, d);
break;
}
case JUMPPAD: {
static int lastjumppad = 0;
if (lastmillis - lastjumppad < 300)
break;
lastjumppad = lastmillis;
OFVector3D v = OFMakeVector3D((int)(char)ents[n].attr3 / 10.0f,
|