Cube  Diff

Differences From Artifact [6041eeb1a7]:

To Artifact [ca9306999a]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// clientgame.cpp: core game related stuff

#include "cube.h"

#import "DynamicEntity.h"
#import "Entity.h"
#import "OFString+Cube.h"

int nextmode = 0; // nextmode becomes gamemode after next map load
VAR(gamemode, 1, 0, 0);

void
mode(int n)
{
	addmsg(1, 2, SV_GAMEMODE, nextmode = n);
}
COMMAND(mode, ARG_1INT)

bool intermission = false;











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// clientgame.cpp: core game related stuff

#include "cube.h"

#import "DynamicEntity.h"
#import "Entity.h"
#import "OFString+Cube.h"

int nextmode = 0; // nextmode becomes gamemode after next map load
VAR(gamemode, 1, 0, 0);

static void
mode(int n)
{
	addmsg(1, 2, SV_GAMEMODE, nextmode = n);
}
COMMAND(mode, ARG_1INT)

bool intermission = false;
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
void
respawnself()
{
	spawnplayer(player1);
	showscores(false);
}

void
arenacount(
    DynamicEntity *d, int &alive, int &dead, OFString **lastteam, bool &oneteam)
{
	if (d.state != CS_DEAD) {
		alive++;
		if (![*lastteam isEqual:d.team])
			oneteam = false;
		*lastteam = d.team;
	} else
		dead++;
}

int arenarespawnwait = 0;
int arenadetectwait = 0;

void
arenarespawn()







|

|


|

|


|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
void
respawnself()
{
	spawnplayer(player1);
	showscores(false);
}

static void
arenacount(
    DynamicEntity *d, int *alive, int *dead, OFString **lastteam, bool *oneteam)
{
	if (d.state != CS_DEAD) {
		(*alive)++;
		if (![*lastteam isEqual:d.team])
			*oneteam = false;
		*lastteam = d.team;
	} else
		(*dead)++;
}

int arenarespawnwait = 0;
int arenadetectwait = 0;

void
arenarespawn()
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
		arenadetectwait = 0;
		int alive = 0, dead = 0;
		OFString *lastteam = nil;
		bool oneteam = true;
		for (id player in players)
			if (player != [OFNull null])
				arenacount(
				    player, alive, dead, &lastteam, oneteam);
		arenacount(player1, alive, dead, &lastteam, oneteam);
		if (dead > 0 && (alive <= 1 || (m_teammode && oneteam))) {
			conoutf(
			    @"arena round is over! next round in 5 seconds...");
			if (alive)
				conoutf(
				    @"team %s is last man standing", lastteam);
			else







|
|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
		arenadetectwait = 0;
		int alive = 0, dead = 0;
		OFString *lastteam = nil;
		bool oneteam = true;
		for (id player in players)
			if (player != [OFNull null])
				arenacount(
				    player, &alive, &dead, &lastteam, &oneteam);
		arenacount(player1, &alive, &dead, &lastteam, &oneteam);
		if (dead > 0 && (alive <= 1 || (m_teammode && oneteam))) {
			conoutf(
			    @"arena round is over! next round in 5 seconds...");
			if (alive)
				conoutf(
				    @"team %s is last man standing", lastteam);
			else
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
	spawnstate(d);
	d.state = CS_ALIVE;
}

// movement input code

#define dir(name, v, d, s, os)                                    \
	void name(bool isdown)                                    \
	{                                                         \
		player1.s = isdown;                               \
		player1.v = isdown ? d : (player1.os ? -(d) : 0); \
		player1.lastmove = lastmillis;                    \
	}

dir(backward, move, -1, k_down, k_up);







|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
	spawnstate(d);
	d.state = CS_ALIVE;
}

// movement input code

#define dir(name, v, d, s, os)                                    \
	static void name(bool isdown)                             \
	{                                                         \
		player1.s = isdown;                               \
		player1.v = isdown ? d : (player1.os ? -(d) : 0); \
		player1.lastmove = lastmillis;                    \
	}

dir(backward, move, -1, k_down, k_up);