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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// entities.cpp: map entity related functions (pickup etc.)
#include "cube.h"
vector<entity> ents;
char *entmdlnames[] = {
"shells",
"bullets",
"rockets",
"rrounds",
"health",
"boost",
"g_armour",
"y_armour",
"quad",
"teleporter",
};
int triggertime = 0;
void
renderent(entity &e, char *mdlname, float z, float yaw, int frame = 0,
int numf = 1, int basetime = 0, float speed = 10.0f)
{
rendermodel(mdlname, frame, numf, 0, 1.1f, e.x, z + S(e.x, e.y)->floor,
e.y, yaw, 0, false, 1.0f, speed, 0, basetime);
};
void
renderentities()
{
if (lastmillis > triggertime + 1000)
triggertime = 0;
loopv(ents)
{
entity &e = ents[i];
if (e.type == MAPMODEL) {
mapmodelinfo *mmi = getmminfo(e.attr2);
if (!mmi)
continue;
rendermodel(mmi->name, 0, 1, e.attr4, (float)mmi->rad,
e.x,
(float)S(e.x, e.y)->floor + mmi->zoff + e.attr3,
e.y, (float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
false, 1.0f, 10.0f, mmi->snap);
} else {
if (OUTBORD(e.x, e.y))
continue;
if (e.type != CARROT) {
if (!e.spawned && e.type != TELEPORT)
continue;
if (e.type < I_SHELLS || e.type > TELEPORT)
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
>
>
|
|
>
|
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// entities.cpp: map entity related functions (pickup etc.)
#include "cube.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)
{
rendermodel(mdlname, frame, numf, 0, 1.1f, e.x, z + S(e.x, e.y)->floor,
e.y, yaw, 0, false, 1.0f, speed, 0, basetime);
};
void
renderentities()
{
if (lastmillis > triggertime + 1000)
triggertime = 0;
loopv(ents)
{
entity &e = ents[i];
if (e.type == MAPMODEL) {
mapmodelinfo *mmi = getmminfo(e.attr2);
if (!mmi)
continue;
@autoreleasepool {
rendermodel(@(mmi->name), 0, 1, e.attr4,
(float)mmi->rad, e.x,
(float)S(e.x, e.y)->floor + mmi->zoff +
e.attr3,
e.y,
(float)((e.attr1 + 7) - (e.attr1 + 7) % 15),
0, false, 1.0f, 10.0f, mmi->snap);
}
} else {
if (OUTBORD(e.x, e.y))
continue;
if (e.type != CARROT) {
if (!e.spawned && e.type != TELEPORT)
continue;
if (e.type < I_SHELLS || e.type > TELEPORT)
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
case 3:
continue;
case 2:
case 0:
if (!e.spawned)
continue;
renderent(e, "carrot",
(float)(1 + sin(lastmillis / 100.0 +
e.x + e.y) /
20),
lastmillis /
(e.attr2 ? 1.0f : 10.0f));
break;
case 4:
renderent(e, "switch2", 3,
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 1
: 0,
(e.spawned || !triggertime) ? 1 : 2,
triggertime, 1050.0f);
break;
case 5:
renderent(e, "switch1", -0.15f,
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 30
: 0,
(e.spawned || !triggertime) ? 1
: 30,
triggertime, 35.0f);
break;
|
|
|
|
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
case 3:
continue;
case 2:
case 0:
if (!e.spawned)
continue;
renderent(e, @"carrot",
(float)(1 + sin(lastmillis / 100.0 +
e.x + e.y) /
20),
lastmillis /
(e.attr2 ? 1.0f : 10.0f));
break;
case 4:
renderent(e, @"switch2", 3,
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 1
: 0,
(e.spawned || !triggertime) ? 1 : 2,
triggertime, 1050.0f);
break;
case 5:
renderent(e, @"switch1", -0.15f,
(float)e.attr3 * 90,
(!e.spawned && !triggertime) ? 30
: 0,
(e.spawned || !triggertime) ? 1
: 30,
triggertime, 35.0f);
break;
|