From 38187a1870ab893618f0aa5cb0eb9a93aca4236a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 22 Oct 2019 01:06:02 +0200 Subject: [PATCH] - simple to convert demo CVARs --- source/common/console/c_cvars.h | 3 +++ source/common/gamecvars.cpp | 48 +++++++++------------------------ source/common/gamecvars.h | 8 ++++++ source/duke3d/src/demo.cpp | 7 ----- source/duke3d/src/demo.h | 8 ------ source/rr/src/demo.cpp | 3 --- source/rr/src/demo.h | 8 ------ 7 files changed, 23 insertions(+), 62 deletions(-) diff --git a/source/common/console/c_cvars.h b/source/common/console/c_cvars.h index c5fd35132..14e205535 100644 --- a/source/common/console/c_cvars.h +++ b/source/common/console/c_cvars.h @@ -434,6 +434,9 @@ void C_ForgetCVars (void); #define CVARD(type,name,def,flags, descr) \ F##type##CVar name (#name, def, flags, nullptr, descr); +#define CVARD_NAMED(type,name,varname,def,flags, descr) \ +F##type##CVar varname (#name, def, flags, nullptr, descr); + extern FBaseCVar *CVars; #endif //__C_CVARS_H__ diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index a63b345d5..af1ccaf4d 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -37,6 +37,7 @@ CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting + bool G_CheckAutorun(bool button) { if (cl_runmode) return button || cl_autorun; @@ -44,6 +45,17 @@ bool G_CheckAutorun(bool button) } + +CVARD_NAMED(Bool, demorec_diffcompress, demorec_diffcompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for diffs") +CVARD_NAMED(Bool, demorec_synccompress, demorec_synccompress_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "Compression for input") +CVARD_NAMED(Bool, demorec_seeds, demorec_seeds_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable recording of random seed for later sync checking") +CVARD_NAMED(Bool, demorec_diffs, demorec_diffs_cvar, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable diff recording in demos") +CVARD_NAMED(Bool, demorec_force, demorec_force_cvar, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable forced demo recording") +CVARD_NAMED(Int, demorec_difftics, demorec_difftics_cvar, 60, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "sets game tic interval after which a diff is recorded") +CVARD(Bool, demoplay_diffs, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable application of diffs in demo playback") +CVARD(Bool, demoplay_showsync, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable display of sync status") + + #if 0 @@ -56,17 +68,6 @@ bool G_CheckAutorun(bool button) { "crosshairscale","changes the size of the crosshair", (void *)&ud.crosshairscale, CVAR_INT, 10, 100 }, - { "demorec_diffs","enable/disable diff recording in demos",(void *)&demorec_diffs_cvar, CVAR_BOOL, 0, 1 }, - { "demorec_force","enable/disable forced demo recording",(void *)&demorec_force_cvar, CVAR_BOOL|CVAR_NOSAVE, 0, 1 }, - { - "demorec_difftics","sets game tic interval after which a diff is recorded", - (void *)&demorec_difftics_cvar, CVAR_INT, 2, 60*REALGAMETICSPERSEC - }, - { "demorec_diffcompress","Compression method for diffs. (0: none, 1: KSLZW)",(void *)&demorec_diffcompress_cvar, CVAR_BOOL, 0, 1 }, - { "demorec_synccompress","Compression method for input. (0: none, 1: KSLZW)",(void *)&demorec_synccompress_cvar, CVAR_BOOL, 0, 1 }, - { "demorec_seeds","enable/disable recording of random seed for later sync checking",(void *)&demorec_seeds_cvar, CVAR_BOOL, 0, 1 }, - { "demoplay_diffs","enable/disable application of diffs in demo playback",(void *)&demoplay_diffs, CVAR_BOOL, 0, 1 }, - { "demoplay_showsync","enable/disable display of sync status",(void *)&demoplay_showsync, CVAR_BOOL, 0, 1 }, { "fov", "change the field of view", (void *)&ud.fov, CVAR_INT, 60, 140 }, @@ -167,18 +168,6 @@ bool G_CheckAutorun(bool button) { "crosshairscale","changes the size of the crosshair", (void *)&ud.crosshairscale, CVAR_INT, 10, 100 }, - { "demorec_diffs","enable/disable diff recording in demos",(void *)&demorec_diffs_cvar, CVAR_BOOL, 0, 1 }, - { "demorec_force","enable/disable forced demo recording",(void *)&demorec_force_cvar, CVAR_BOOL|CVAR_NOSAVE, 0, 1 }, - { - "demorec_difftics","sets game tic interval after which a diff is recorded", - (void *)&demorec_difftics_cvar, CVAR_INT, 2, 60*REALGAMETICSPERSEC - }, - { "demorec_diffcompress","Compression method for diffs. (0: none, 1: KSLZW)",(void *)&demorec_diffcompress_cvar, CVAR_INT, 0, 1 }, - { "demorec_synccompress","Compression method for input. (0: none, 1: KSLZW)",(void *)&demorec_synccompress_cvar, CVAR_INT, 0, 1 }, - { "demorec_seeds","enable/disable recording of random seed for later sync checking",(void *)&demorec_seeds_cvar, CVAR_BOOL, 0, 1 }, - { "demoplay_diffs","enable/disable application of diffs in demo playback",(void *)&demoplay_diffs, CVAR_BOOL, 0, 1 }, - { "demoplay_showsync","enable/disable display of sync status",(void *)&demoplay_showsync, CVAR_BOOL, 0, 1 }, - { "fov", "change the field of view", (void *)&ud.fov, CVAR_INT|CVAR_FUNCPTR, 75, 120 }, { "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 }, @@ -286,19 +275,6 @@ int32_t registerosdcommands(void) // { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, // // { "crosshairscale","changes the size of the crosshair", (void *)&ud.crosshairscale, CVAR_INT, 10, 100 }, -// -// { "demorec_diffs","enable/disable diff recording in demos",(void *)&demorec_diffs_cvar, CVAR_BOOL, 0, 1 }, -// { "demorec_force","enable/disable forced demo recording",(void *)&demorec_force_cvar, CVAR_BOOL|CVAR_NOSAVE, 0, 1 }, -// { -// "demorec_difftics","sets game tic interval after which a diff is recorded", -// (void *)&demorec_difftics_cvar, CVAR_INT, 2, 60*REALGAMETICSPERSEC -// }, -// { "demorec_diffcompress","Compression method for diffs. (0: none, 1: KSLZW)",(void *)&demorec_diffcompress_cvar, CVAR_INT, 0, 1 }, -// { "demorec_synccompress","Compression method for input. (0: none, 1: KSLZW)",(void *)&demorec_synccompress_cvar, CVAR_INT, 0, 1 }, -// { "demorec_seeds","enable/disable recording of random seed for later sync checking",(void *)&demorec_seeds_cvar, CVAR_BOOL, 0, 1 }, -// { "demoplay_diffs","enable/disable application of diffs in demo playback",(void *)&demoplay_diffs, CVAR_BOOL, 0, 1 }, -// { "demoplay_showsync","enable/disable display of sync status",(void *)&demoplay_showsync, CVAR_BOOL, 0, 1 }, -// // { "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 }, // { "hud_custom", "change the custom hud", (void *)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange }, // { "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 }, diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 1cbab4f46..08e2957b3 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -16,5 +16,13 @@ EXTERN_CVAR(Bool, cl_idplayers) EXTERN_CVAR(Bool, cl_showcoords) EXTERN_CVAR(Bool, cl_viewbob) EXTERN_CVAR(Bool, cl_weaponsway) +EXTERN_CVAR(Bool, demorec_diffcompress_cvar) +EXTERN_CVAR(Bool, demorec_synccompress_cvar) +EXTERN_CVAR(Bool, demorec_seeds_cvar) +EXTERN_CVAR(Bool, demoplay_diffs) +EXTERN_CVAR(Bool, demoplay_showsync) +EXTERN_CVAR(Bool, demorec_diffs_cvar) +EXTERN_CVAR(Bool, demorec_force_cvar) +EXTERN_CVAR(Int, demorec_difftics_cvar) bool G_CheckAutorun(bool button); diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index 93fbcf7eb..2a469c23d 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -49,13 +49,6 @@ static int32_t g_demo_soundToggle; static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC; int32_t demoplay_diffs=1; -int32_t demorec_diffs_cvar=1; -int32_t demorec_force_cvar=0; -int32_t demorec_difftics_cvar = 2*REALGAMETICSPERSEC; -int32_t demorec_diffcompress_cvar=1; -int32_t demorec_synccompress_cvar=1; -int32_t demorec_seeds_cvar=1; -int32_t demoplay_showsync=1; static int32_t demo_synccompress=1, demorec_seeds=1, demo_hasseeds; diff --git a/source/duke3d/src/demo.h b/source/duke3d/src/demo.h index 63699e83d..95d73570a 100644 --- a/source/duke3d/src/demo.h +++ b/source/duke3d/src/demo.h @@ -35,14 +35,6 @@ BEGIN_DUKE_NS extern buildvfs_FILE g_demo_filePtr; extern char g_firstDemoFile[BMAX_PATH]; -extern int32_t demoplay_diffs; -extern int32_t demoplay_showsync; -extern int32_t demorec_diffcompress_cvar; -extern int32_t demorec_diffs_cvar; -extern int32_t demorec_difftics_cvar; -extern int32_t demorec_force_cvar; -extern int32_t demorec_seeds_cvar; -extern int32_t demorec_synccompress_cvar; extern int32_t g_demo_cnt; extern int32_t g_demo_goalCnt; extern int32_t g_demo_paused; diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 0ed663a55..cb6792620 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -49,9 +49,6 @@ static int32_t g_demo_soundToggle; static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC; int32_t demoplay_diffs=1; -int32_t demorec_diffs_cvar=1; -int32_t demorec_force_cvar=0; -int32_t demorec_difftics_cvar = 2*REALGAMETICSPERSEC; int32_t demorec_diffcompress_cvar=1; int32_t demorec_synccompress_cvar=1; int32_t demorec_seeds_cvar=1; diff --git a/source/rr/src/demo.h b/source/rr/src/demo.h index eebee5885..fafeea1c7 100644 --- a/source/rr/src/demo.h +++ b/source/rr/src/demo.h @@ -36,14 +36,6 @@ BEGIN_RR_NS extern FILE *g_demo_filePtr; extern char g_firstDemoFile[BMAX_PATH]; -extern int32_t demoplay_diffs; -extern int32_t demoplay_showsync; -extern int32_t demorec_diffcompress_cvar; -extern int32_t demorec_diffs_cvar; -extern int32_t demorec_difftics_cvar; -extern int32_t demorec_force_cvar; -extern int32_t demorec_seeds_cvar; -extern int32_t demorec_synccompress_cvar; extern int32_t g_demo_cnt; extern int32_t g_demo_goalCnt; extern int32_t g_demo_paused;