︙ | | | ︙ | |
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
|
{
gzput(players[i] == NULL);
gzwrite(f, players[i], sizeof(dynent));
}
}
void
savegame(char *name)
{
if (!m_classicsp) {
conoutf(@"can only save classic sp games");
return;
}
sprintf_sd(fn)("savegames/%s.csgz", name);
savestate(fn);
stop();
conoutf(@"wrote %s", fn);
}
COMMAND(savegame, ARG_1CSTR)
void
loadstate(char *fn)
{
stop();
if (multiplayer())
return;
|
|
>
|
|
|
|
|
|
|
|
|
>
|
|
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
|
{
gzput(players[i] == NULL);
gzwrite(f, players[i], sizeof(dynent));
}
}
void
savegame(OFString *name)
{
@autoreleasepool {
if (!m_classicsp) {
conoutf(@"can only save classic sp games");
return;
}
sprintf_sd(fn)("savegames/%s.csgz", name.UTF8String);
savestate(fn);
stop();
conoutf(@"wrote %s", fn);
}
}
COMMAND(savegame, ARG_1STR)
void
loadstate(char *fn)
{
stop();
if (multiplayer())
return;
|
︙ | | | ︙ | |
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
// architectures simpifies things a LOT
if (gzgeti() != SAVEGAMEVERSION || gzgeti() != sizeof(dynent))
goto out;
string mapname;
gzread(f, mapname, _MAXDEFSTR);
nextmode = gzgeti();
@autoreleasepool {
changemap(
@(mapname)); // continue below once map has been loaded and
// client & server have updated
}
return;
out:
conoutf(@"aborting: savegame/demo from a different version of cube or "
@"cpu architecture");
stop();
}
void
loadgame(char *name)
{
sprintf_sd(fn)("savegames/%s.csgz", name);
loadstate(fn);
}
COMMAND(loadgame, ARG_1CSTR)
void
loadgameout()
{
stop();
conoutf(@"loadgame incomplete: savegame from a different version of "
@"this map");
|
<
|
|
>
|
>
|
|
|
>
|
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
// architectures simpifies things a LOT
if (gzgeti() != SAVEGAMEVERSION || gzgeti() != sizeof(dynent))
goto out;
string mapname;
gzread(f, mapname, _MAXDEFSTR);
nextmode = gzgeti();
@autoreleasepool {
// continue below once map has been loaded and client & server
// have updated
changemap(@(mapname));
}
return;
out:
conoutf(@"aborting: savegame/demo from a different version of cube or "
@"cpu architecture");
stop();
}
void
loadgame(OFString *name)
{
@autoreleasepool {
sprintf_sd(fn)("savegames/%s.csgz", name.UTF8String);
loadstate(fn);
}
}
COMMAND(loadgame, ARG_1STR)
void
loadgameout()
{
stop();
conoutf(@"loadgame incomplete: savegame from a different version of "
@"this map");
|
︙ | | | ︙ | |
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
int starttime = 0;
int playbacktime = 0;
int ddamage, bdamage;
vec dorig;
void
record(char *name)
{
if (m_sp) {
conoutf(@"cannot record singleplayer games");
return;
};
int cn = getclientnum();
if (cn < 0)
return;
sprintf_sd(fn)("demos/%s.cdgz", name);
savestate(fn);
gzputi(cn);
conoutf(@"started recording demo to %s", fn);
demorecording = true;
starttime = lastmillis;
ddamage = bdamage = 0;
}
COMMAND(record, ARG_1CSTR)
void
demodamage(int damage, vec &o)
{
ddamage = damage;
dorig = o;
};
|
|
>
|
|
|
<
>
|
|
|
|
|
|
|
|
|
|
|
>
|
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
int starttime = 0;
int playbacktime = 0;
int ddamage, bdamage;
vec dorig;
void
record(OFString *name)
{
@autoreleasepool {
if (m_sp) {
conoutf(@"cannot record singleplayer games");
return;
}
int cn = getclientnum();
if (cn < 0)
return;
sprintf_sd(fn)("demos/%s.cdgz", name.UTF8String);
savestate(fn);
gzputi(cn);
conoutf(@"started recording demo to %s", fn);
demorecording = true;
starttime = lastmillis;
ddamage = bdamage = 0;
}
}
COMMAND(record, ARG_1STR)
void
demodamage(int damage, vec &o)
{
ddamage = damage;
dorig = o;
};
|
︙ | | | ︙ | |
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
}
// FIXME: add all other client state which is not send through
// the network
}
}
void
demo(char *name)
{
sprintf_sd(fn)("demos/%s.cdgz", name);
loadstate(fn);
demoloading = true;
}
COMMAND(demo, ARG_1CSTR)
void
stopreset()
{
conoutf(@"demo stopped (%d msec elapsed)", lastmillis - starttime);
stop();
loopv(players) zapdynent(players[i]);
|
|
>
|
|
|
|
>
|
|
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
}
// FIXME: add all other client state which is not send through
// the network
}
}
void
demo(OFString *name)
{
@autoreleasepool {
sprintf_sd(fn)("demos/%s.cdgz", name.UTF8String);
loadstate(fn);
demoloading = true;
}
}
COMMAND(demo, ARG_1STR)
void
stopreset()
{
conoutf(@"demo stopped (%d msec elapsed)", lastmillis - starttime);
stop();
loopv(players) zapdynent(players[i]);
|
︙ | | | ︙ | |