Cube  Diff

Differences From Artifact [47ee9d00d9]:

To Artifact [2808b0e950]:


25
26
27
28
29
30
31
32
33
34



35
36
37
38
39
40
41
25
26
27
28
29
30
31



32
33
34
35
36
37
38
39
40
41







-
-
-
+
+
+








void
initEntities()
{
	ents = [[OFMutableArray alloc] init];
}

void
renderent(Entity *e, OFString *mdlname, float z, float yaw, int frame = 0,
    int numf = 1, int basetime = 0, float speed = 10.0f)
static 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,
	    OFMakeVector3D(e.x, z + S(e.x, e.y)->floor, e.y), yaw, 0, false,
	    1.0f, speed, 0, basetime);
}

void
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
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
95







-
+
















-
+
+







					continue;
				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);
				    lastmillis / 10.0f, 0,1,0,10.0f);
			} else {
				switch (e.attr2) {
				case 1:
				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));
					        (e.attr2 ? 1.0f : 10.0f),
						0, 1, 0, 10.0f);
					break;

				case 4:
					renderent(e, @"switch2", 3,
					    (float)e.attr3 * 90,
					    (!e.spawned && !triggertime) ? 1
					                                 : 0,
132
133
134
135
136
137
138
139

140
141
142
143
144




145
146
147
148
149
150
151
133
134
135
136
137
138
139

140
141




142
143
144
145
146
147
148
149
150
151
152







-
+

-
-
-
-
+
+
+
+








// these two functions are called when the server acknowledges that you really
// picked up the item (in multiplayer someone may grab it before you).

static int
radditem(int i, int v)
{
	itemstat &is = itemstats[ents[i].type - I_SHELLS];
	struct itemstat *is = &itemstats[ents[i].type - I_SHELLS];
	ents[i].spawned = false;
	v += is.add;
	if (v > is.max)
		v = is.max;
	playsoundc(is.sound);
	v += is->add;
	if (v > is->max)
		v = is->max;
	playsoundc(is->sound);
	return v;
}

void
realpickup(int n, DynamicEntity *d)
{
	switch (ents[n].type) {