mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 01:01:43 +00:00
Add command to lower netreplay sync frequency
This makes for smaller replay files while keeping sync checks in place!
This commit is contained in:
parent
64ceb441e3
commit
29c6dae776
3 changed files with 12 additions and 3 deletions
|
@ -811,6 +811,7 @@ void D_RegisterClientCommands(void)
|
|||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||
|
||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||
CV_RegisterVar(&cv_netdemosyncquality);
|
||||
|
||||
// FIXME: not to be here.. but needs be done for config loading
|
||||
CV_RegisterVar(&cv_usegamma);
|
||||
|
|
12
src/g_game.c
12
src/g_game.c
|
@ -341,6 +341,9 @@ INT16 prevmap, nextmap;
|
|||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
consvar_t cv_recordmultiplayerdemos = {"netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t netdemosyncquality_cons_t[] = {{1, "MIN"}, {35, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_netdemosyncquality = {"netdemo_syncquality", "1", CV_SAVE, netdemosyncquality_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static UINT8 *savebuffer;
|
||||
|
||||
// Analog Control
|
||||
|
@ -5221,7 +5224,7 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
|
|||
|
||||
void G_WriteAllGhostTics(void)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, counter = leveltime;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
|
@ -5230,6 +5233,11 @@ void G_WriteAllGhostTics(void)
|
|||
if (!players[i].mo)
|
||||
continue;
|
||||
|
||||
counter++;
|
||||
|
||||
if (counter % cv_netdemosyncquality.value != 0) // Only write 1 in this many ghost datas per tic to cut down on multiplayer replay size.
|
||||
continue;
|
||||
|
||||
WRITEUINT8(demo_p, i);
|
||||
G_WriteGhostTic(players[i].mo, i);
|
||||
}
|
||||
|
@ -5264,7 +5272,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
|||
if (abs(ghost->x-oldghost[playernum].x) > MAXMOM
|
||||
|| abs(ghost->y-oldghost[playernum].y) > MAXMOM
|
||||
|| abs(ghost->z-oldghost[playernum].z) > MAXMOM
|
||||
|| (leveltime & 255) == 1) // Hack to enable slightly nicer resyncing
|
||||
|| ((UINT8)(leveltime & 255) > 0 && (UINT8)(leveltime & 255) <= (UINT8)cv_netdemosyncquality.value)) // Hack to enable slightly nicer resyncing
|
||||
{
|
||||
oldghost[playernum].x = ghost->x;
|
||||
oldghost[playernum].y = ghost->y;
|
||||
|
|
|
@ -38,7 +38,7 @@ extern boolean playeringame[MAXPLAYERS];
|
|||
// demoplaying back and demo recording
|
||||
extern boolean demoplayback, titledemo, fromtitledemo, demorecording, timingdemo, demosaved, demodefersave, demo_loadfiles, demo_ignorefiles;
|
||||
extern tic_t demosavebutton;
|
||||
extern consvar_t cv_recordmultiplayerdemos;
|
||||
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
|
|
Loading…
Reference in a new issue