summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-04-30 02:42:42 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-04-30 02:42:42 +0100
commitb5f7fcf9572651672f5ed6ff198ac83c947668a8 (patch)
tree399ef56290154abc98f3e95a8bbab2c39cb96b11
parent1a5c55eb89c22e8822ec057a3731a6d753f13859 (diff)
Don't bump the demo number if playing another demo
-rw-r--r--src/demorec.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/demorec.c b/src/demorec.c
index f8f2829..9624db9 100644
--- a/src/demorec.c
+++ b/src/demorec.c
@@ -32,7 +32,7 @@
#include "vcall.h"
#include "x86.h"
-DEF_CVAR(sst_autorecord, "Continue recording demos after server disconnects", 1,
+DEF_CVAR(sst_autorecord, "Continuously record demos even after reconnecting", 1,
CON_ARCHIVE | CON_HIDDEN)
static void *demorecorder;
@@ -48,19 +48,19 @@ typedef void (*VCALLCONV SetSignonState_func)(void *, int);
static SetSignonState_func orig_SetSignonState;
static void VCALLCONV hook_SetSignonState(void *this_, int state) {
struct CDemoRecorder *this = this_;
- // apparently NEW only *sometimes* bumps the demo num - prevent this!
+ // NEW fires once every map or save load, but only bumps number if demo file
+ // was left open (i.e. every transition). bump it unconditionally instead!
if (state == SIGNONSTATE_NEW) {
int oldnum = *demonum;
orig_SetSignonState(this, state);
- *demonum = oldnum;
+ *demonum = oldnum + 1;
return;
}
- // SPAWN always fires once every load, so use that to bump demonum instead
- if (state == SIGNONSTATE_SPAWN) ++*demonum;
- // dumb hack: game actually creates the demo file on FULL. we set demonum to
- // 0 in the record command hook so that it gets incremented to 1 on SPAWN.
- // if it's still 0 here, bump it up to 1 real quick!
- else if (state == SIGNONSTATE_FULL && *demonum == 0) *demonum = 1;
+ // dumb hack: demo file gets opened on FULL. bumping the number on NEW would
+ // make the first demo number 2 so we set the number to 0 in the record
+ // command. however if we started recording already in-map we need to bodge
+ // it back up to 1 right before the demo actually gets created
+ if (state == SIGNONSTATE_FULL && *demonum == 0) *demonum = 1;
orig_SetSignonState(this, state);
}