more pain plus stop console spam
This commit is contained in:
1 parent
b593060266
commit
1583bf22c3
8 files changed
+46
-91
No files matched your search
+4
-2
@@ -1478,6 +1478,7 @@ badinput:
|
||||
//
|
||||
|
||||
static boolean serverloading = false;
|
||||
static boolean serverloadingstealth = false;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
@@ -1505,7 +1506,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
||||
cvar = CV_FindNetVar(netid);
|
||||
svalue = (char *)*p;
|
||||
SKIPSTRING(*p);
|
||||
stealth = READUINT8(*p);
|
||||
stealth = READUINT8(*p) || (serverloading && serverloadingstealth);
|
||||
|
||||
if (!cvar)
|
||||
{
|
||||
@@ -1559,13 +1560,14 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
|
||||
WRITEUINT16(count_p, count);
|
||||
}
|
||||
|
||||
void CV_LoadNetVars(UINT8 **p)
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT16 count;
|
||||
|
||||
// prevent "invalid command received"
|
||||
serverloading = true;
|
||||
serverloadingstealth = onlyIfChanged;
|
||||
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if (cvar->flags & CV_NETVAR)
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
void CV_LoadNetVars(UINT8 **p, boolean onlyIfChanged);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
void CV_ResetCheatNetVars(void);
|
||||
|
||||
+2
-1
@@ -54,6 +54,7 @@ static boolean con_started = false; // console has been initialised
|
||||
boolean con_startup = false; // true at game startup, screen need refreshing
|
||||
static boolean con_forcepic = true; // at startup toggle console translucency when first off
|
||||
boolean con_recalc; // set true when screen size has changed
|
||||
boolean con_muted = false;
|
||||
|
||||
static tic_t con_tick; // console ticker for anim or blinking prompt cursor
|
||||
// con_scrollup should use time (currenttime - lasttime)..
|
||||
@@ -1260,7 +1261,7 @@ static void CON_Print(char *msg)
|
||||
INT32 controlchars = 0; // for color changing
|
||||
char color = '\x80'; // keep color across lines
|
||||
|
||||
if (msg == NULL)
|
||||
if (msg == NULL || con_muted)
|
||||
return;
|
||||
|
||||
if (*msg == '\3') // chat text, makes ding sound
|
||||
|
||||
@@ -27,6 +27,9 @@ extern boolean con_recalc;
|
||||
|
||||
extern boolean con_startup;
|
||||
|
||||
// no messages will be printed while the console is muted
|
||||
extern boolean con_muted;
|
||||
|
||||
// top clip value for view render: do not draw part of view hidden by console
|
||||
extern INT32 con_clipviewtop;
|
||||
|
||||
|
||||
+14
-33
@@ -4932,7 +4932,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||
|
||||
scp = netbuffer->u.servercfg.varlengthinputs;
|
||||
CV_LoadPlayerNames(&scp);
|
||||
CV_LoadNetVars(&scp);
|
||||
CV_LoadNetVars(&scp, false);
|
||||
#ifdef JOININGAME
|
||||
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
||||
/// Shouldn't them be downloaded even at intermission time?
|
||||
@@ -6268,7 +6268,7 @@ boolean TryRunTics(tic_t realtics)
|
||||
simtic = gametic;
|
||||
// CONS_Printf("Not simulating, clearing savestates...\n");
|
||||
DEBFILE("NETPLUS: Not simulating, clearing savestates...\n");
|
||||
InvalidateSavestates();
|
||||
//InvalidateSavestates();
|
||||
}
|
||||
|
||||
// see if we have enough latency to simulate lots of sims
|
||||
@@ -6351,7 +6351,7 @@ boolean TryRunTics(tic_t realtics)
|
||||
// store the ticcmds used during this game tic for simulations
|
||||
// TODO optimize it in a way that they won't be saved when we finished chasing to server's gamestate
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
gameTicBuffer[gametic % MAXSIMULATIONS][i] = netcmds[(gametic - 1) % BACKUPTICS][i];
|
||||
gameTicBuffer[gametic % MAXSIMULATIONS][i] = netcmds[(gametic - 1) % TICQUEUE][i];
|
||||
}
|
||||
// Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
|
||||
if (!canSimulate) //do not use the vanilla netbuffer or simulations will be doubled/tripled/so on
|
||||
@@ -6381,17 +6381,17 @@ boolean TryRunTics(tic_t realtics)
|
||||
for (int j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
if (playeringame[j] && j != consoleplayer)
|
||||
netcmds[gametic % BACKUPTICS][j] = gameTicBuffer[(min(simtic + 1, gametic) + MAXSIMULATIONS) % MAXSIMULATIONS][j];
|
||||
netcmds[gametic % TICQUEUE][j] = gameTicBuffer[(min(simtic + 1, gametic) + MAXSIMULATIONS) % MAXSIMULATIONS][j];
|
||||
else
|
||||
{
|
||||
temp = netcmds[gametic % BACKUPTICS][consoleplayer];
|
||||
netcmds[gametic % BACKUPTICS][consoleplayer] = localcmds;
|
||||
temp = netcmds[gametic % TICQUEUE][consoleplayer];
|
||||
netcmds[gametic % TICQUEUE][consoleplayer] = localcmds;
|
||||
}
|
||||
}
|
||||
DEBFILE(va("============ Running SIMMISS tic %d (local %d)\n", gametic, localgametic));
|
||||
issimulation = true;
|
||||
G_Ticker(true); //tic one tic further as usual
|
||||
netcmds[gametic % BACKUPTICS][consoleplayer] = temp;
|
||||
netcmds[gametic % TICQUEUE][consoleplayer] = temp;
|
||||
issimulation = false;
|
||||
// we're gonna need more debugs...
|
||||
//MakeNetDebugString();
|
||||
@@ -6584,6 +6584,7 @@ static void RunSimulations()
|
||||
|
||||
// simulate the rest o da future
|
||||
issimulation = true;
|
||||
con_muted = true;
|
||||
|
||||
simStartTime = I_GetPrecisePrecision(); //for benchmarking
|
||||
|
||||
@@ -6597,20 +6598,20 @@ static void RunSimulations()
|
||||
if (playeringame[j] && j != consoleplayer)
|
||||
//simtic+1 это для херни со smoothedTic
|
||||
//use Memcpy or G_CopyTiccmd for that
|
||||
netcmds[gametic % BACKUPTICS][j] = gameTicBuffer[(min(simtic + 1, gametic) + MAXSIMULATIONS) % MAXSIMULATIONS][j];
|
||||
netcmds[gametic % TICQUEUE][j] = gameTicBuffer[(min(simtic + 1, gametic) + MAXSIMULATIONS) % MAXSIMULATIONS][j];
|
||||
}
|
||||
|
||||
// control the local player
|
||||
if (simtic + i < gametic) // game is smoothed, take tics from the _actual_ received state
|
||||
{
|
||||
netcmds[gametic % BACKUPTICS][consoleplayer] = gameTicBuffer[(simtic + 1) % MAXSIMULATIONS][consoleplayer];
|
||||
netcmds[gametic % TICQUEUE][consoleplayer] = gameTicBuffer[(simtic + 1) % MAXSIMULATIONS][consoleplayer];
|
||||
}
|
||||
else if (liveTic % simInaccuracy == 0)
|
||||
{
|
||||
netcmds[gametic % BACKUPTICS][consoleplayer] = localTicBuffer[(liveTic - estimatedRTT + i + 1 + MAXSIMULATIONS) % MAXSIMULATIONS];
|
||||
netcmds[gametic % TICQUEUE][consoleplayer] = localTicBuffer[(liveTic - estimatedRTT + i + 1 + MAXSIMULATIONS) % MAXSIMULATIONS];
|
||||
}
|
||||
else
|
||||
netcmds[gametic % BACKUPTICS][consoleplayer] = localcmds; //NO
|
||||
netcmds[gametic % TICQUEUE][consoleplayer] = localcmds; //NO
|
||||
|
||||
DEBFILE(va("============ Running SIM tic %d (local %d) (sim %d)\n", gametic, localgametic, simtic));
|
||||
G_Ticker(true); // tic a bunch of times lol see what happens lolol
|
||||
@@ -6630,6 +6631,7 @@ static void RunSimulations()
|
||||
}
|
||||
|
||||
issimulation = false;
|
||||
con_muted = false;
|
||||
// lastsimtic = simtic;
|
||||
|
||||
// Finalise steadyplayers
|
||||
@@ -6743,27 +6745,6 @@ static void RunSimulations()
|
||||
rendergametic = gametic;
|
||||
}
|
||||
|
||||
|
||||
void InvalidateSavestates()
|
||||
{
|
||||
if (simtic > gametic)
|
||||
DEBFILE("NETPLUS: Savestates were invalidated during a simulation\n");
|
||||
// CONS_Printf("Warning: Savestates were invalidated during a simulation!!\n");
|
||||
|
||||
for (int i = 0; i < MAXLOCALSAVESTATES; i++)
|
||||
{
|
||||
if (gameStateBufferIsValid[i] == true)
|
||||
if (&gameStateBuffer[i].buffer != NULL)
|
||||
{
|
||||
//we don't want to store old states because a client might not want to simulate
|
||||
//the game anymore or saved games are not valid anymore due to resynch
|
||||
P_GameStateFreeMemory(&gameStateBuffer[i]);
|
||||
}
|
||||
gameStateBufferIsValid[i] = false;
|
||||
}
|
||||
SavestatesClearedTic = gametic;
|
||||
}
|
||||
|
||||
int rttBuffer[20];
|
||||
int rttBufferIndex = 0;
|
||||
int rttBufferMax = 20;
|
||||
@@ -6796,7 +6777,7 @@ void DetermineNetConditions()
|
||||
if (!(gametic % 35))
|
||||
{
|
||||
int matchingLiveTic, matchingGameTic;
|
||||
if (FindMatchingTics(&matchingLiveTic, &matchingGameTic) && matchingLiveTic - matchingGameTic < BACKUPTICS - 2)
|
||||
if (FindMatchingTics(&matchingLiveTic, &matchingGameTic) && matchingLiveTic - matchingGameTic < TICQUEUE - 2)
|
||||
{
|
||||
estimatedRTT = matchingLiveTic - matchingGameTic;
|
||||
}
|
||||
|
||||
+2
-2
@@ -7789,7 +7789,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
}
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p);
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
@@ -7833,7 +7833,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
#endif
|
||||
|
||||
// net var data
|
||||
CV_LoadNetVars(&demo_p);
|
||||
CV_LoadNetVars(&demo_p, false);
|
||||
|
||||
// Sigh ... it's an empty demo.
|
||||
if (*demo_p == DEMOMARKER)
|
||||
|
||||
+20
-49
@@ -32,6 +32,7 @@
|
||||
#include "p_polyobj.h"
|
||||
#include "lua_script.h"
|
||||
#include "p_slopes.h"
|
||||
#include "console.h"
|
||||
|
||||
savedata_t savedata;
|
||||
UINT8 *save_p;
|
||||
@@ -473,13 +474,11 @@ static void P_LocalArchivePlayers(void)
|
||||
|
||||
player_t* player = &((player_t*)save_p)[-1];
|
||||
|
||||
#define RELINK(var) if (var != NULL) var = (mobj_t*)var->mobjnum
|
||||
#define RELINK(var) if (var) var = (mobj_t*)var->mobjnum
|
||||
RELINK(player->capsule);
|
||||
RELINK(player->axis1);
|
||||
RELINK(player->axis2);
|
||||
RELINK(player->awayviewmobj);
|
||||
//RELINK(player->followmobj);
|
||||
//RELINK(player->drone);
|
||||
#undef RELINK
|
||||
}
|
||||
}
|
||||
@@ -585,8 +584,9 @@ static void ResetSectors(void)
|
||||
ss->floorpic_angle = ss->spawn_flrpic_angle;
|
||||
ss->ceilingpic_angle = ss->spawn_ceilpic_angle;
|
||||
ss->tag = ms->tag; // DON'T use P_ChangeSectorTag
|
||||
ss->firsttag = ss->spawn_firsttag;
|
||||
ss->nexttag = ss->spawn_nexttag;
|
||||
|
||||
//ss->firsttag = ss->spawn_firsttag;
|
||||
//ss->nexttag = ss->spawn_nexttag;
|
||||
//ss->extra_colormap = GetNetColormapFromList(READUINT32(get));
|
||||
|
||||
ffloor_t* floor = ss->ffloors;
|
||||
@@ -635,9 +635,6 @@ static void P_LocalArchiveWorld(void)
|
||||
{
|
||||
UINT8* put;
|
||||
|
||||
// paranoia something something
|
||||
//ClearNetColormaps();
|
||||
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
|
||||
@@ -657,7 +654,7 @@ static void P_LocalUnArchiveWorld(void)
|
||||
|
||||
if (READUINT32(get) != ARCHIVEBLOCK_WORLD)
|
||||
{
|
||||
I_Error("Bad SaveState at archive block World");
|
||||
I_Error("Bad rollback savestate at archive block World");
|
||||
}
|
||||
|
||||
// preserve certain local variables
|
||||
@@ -3017,16 +3014,20 @@ static void P_LocalArchiveThinkers(void)
|
||||
size_t s;
|
||||
const thinker_t* thinker;
|
||||
mobj_t* savedMobj;
|
||||
executor_t* savedExecutor;
|
||||
UINT8* original = save_p;
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS);
|
||||
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
#define RELINK(var) if (var != NULL) var = (mobj_t*)(var->mobjnum)
|
||||
// #define RELINK(var) if (var != NULL) var = (mobj_t*)(var->mobjnum)
|
||||
//thanks to GoldenTails for pointing out some nuances
|
||||
#define RELINK(var) if (var && var->mobjnum) var = (mobj_t*)(var->mobjnum)
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
actionf_p1 acp1 = thinker->function.acp1;
|
||||
if (acp1 == (actionf_p1)P_RemoveThinkerDelayed
|
||||
|| acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
continue;
|
||||
|
||||
// find the associated special def
|
||||
for (j = 0; j < sizeof(specialDefs) / sizeof(specialDefs[0]); j++)
|
||||
@@ -3053,6 +3054,7 @@ static void P_LocalArchiveThinkers(void)
|
||||
|
||||
if (j == tc_executor)
|
||||
{
|
||||
executor_t* savedExecutor;
|
||||
savedExecutor = &((executor_t*)save_p)[-1];
|
||||
RELINK(savedExecutor->caller);
|
||||
}
|
||||
@@ -3061,7 +3063,6 @@ static void P_LocalArchiveThinkers(void)
|
||||
WRITEUINT8(save_p, 0xFF); // next list (or end)
|
||||
}
|
||||
|
||||
//RELINK(waypointcap);
|
||||
// now write the nothinkers...
|
||||
// turns out that MF_NOTHINKs aren't in thinker lists lol....
|
||||
// makes sense, but doesn't make life easier. I just wanted an object list. Ah well.
|
||||
@@ -3082,7 +3083,6 @@ static void P_LocalArchiveThinkers(void)
|
||||
RELINK(savedMobj->target);
|
||||
RELINK(savedMobj->hnext);
|
||||
RELINK(savedMobj->hprev);
|
||||
|
||||
}
|
||||
thing = thing->snext;
|
||||
}
|
||||
@@ -3092,6 +3092,7 @@ static void P_LocalArchiveThinkers(void)
|
||||
WRITEUINT8(save_p, 0xFF);
|
||||
}
|
||||
|
||||
|
||||
static void P_LocalUnArchiveThinkers()
|
||||
{
|
||||
thinker_t *thinker;
|
||||
@@ -3100,8 +3101,6 @@ static void P_LocalUnArchiveThinkers()
|
||||
UINT8 tclass;
|
||||
UINT8 restoreExecutors = false;
|
||||
int32_t i, j, list;
|
||||
//int skyviewid = 0;
|
||||
//int skycenterid = 0;
|
||||
thinker_t newthinkers[NUM_THINKERLISTS] = { 0 };
|
||||
static thinker_t* thinkersbytype[tc_end][16384];
|
||||
static uint32_t numthinkersbytype[tc_end];
|
||||
@@ -3120,18 +3119,6 @@ static void P_LocalUnArchiveThinkers()
|
||||
if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS)
|
||||
I_Error("Bad SaveState at archive block Thinkers");
|
||||
|
||||
// preserve sky box indexes
|
||||
/* Probably unused
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (skyboxmo[0] == skyboxviewpnts[i])
|
||||
skyviewid = i; // save id just in case
|
||||
if (skyboxmo[1] == skyboxcenterpnts[i])
|
||||
skycenterid = i; // save id just in case
|
||||
skyboxviewpnts[i] = NULL;
|
||||
skyboxcenterpnts[i] = NULL;
|
||||
}
|
||||
*/
|
||||
skyboxmo[0] = skyboxmo[1] = NULL;
|
||||
|
||||
// sort thinkers into maps to speed up replacement searches
|
||||
@@ -3354,12 +3341,6 @@ static void P_LocalUnArchiveThinkers()
|
||||
target->ceilingdata = newthinker;
|
||||
if (specialDefs[tclass].sectorTargets & ST_FLOORDATA)
|
||||
target->floordata = newthinker;
|
||||
/*
|
||||
if (specialDefs[tclass].sectorTargets & ST_LIGHTDATA)
|
||||
target->lightingdata = newthinker;
|
||||
if (specialDefs[tclass].sectorTargets & ST_FADEMAPDATA)
|
||||
target->fadecolormapdata = newthinker;
|
||||
*/
|
||||
}
|
||||
|
||||
// relink into the new thinker list
|
||||
@@ -3460,7 +3441,6 @@ static void P_LocalUnArchiveThinkers()
|
||||
}
|
||||
|
||||
// restore pointers
|
||||
|
||||
#define RELINK(var) if (var) { UINT32 index = (UINT32)var; var = NULL; P_SetTarget(&var, mobjByNum[index]); }
|
||||
for (thinker = thlist[THINK_MOBJ].next; thinker != &thlist[THINK_MOBJ]; thinker = thinker->next)
|
||||
{
|
||||
@@ -3907,9 +3887,7 @@ static void P_LocalArchivePolyObjects(void)
|
||||
{
|
||||
P_ArchivePolyObjects();
|
||||
/*WRITEUINT32(save_p, ARCHIVEBLOCK_POBJS);
|
||||
|
||||
WRITEINT32(save_p, numPolyObjects);
|
||||
|
||||
WRITEMEM(save_p, PolyObjects, numPolyObjects * sizeof(PolyObjects[0]));*/
|
||||
}
|
||||
|
||||
@@ -3918,13 +3896,9 @@ static void P_LocalUnArchivePolyObjects(void)
|
||||
P_UnArchivePolyObjects();
|
||||
/*if (READUINT32(save_p) != ARCHIVEBLOCK_POBJS)
|
||||
I_Error("Bad savestate at archive block polyobjects");
|
||||
|
||||
numPolyObjects = READINT32(save_p);
|
||||
|
||||
READMEM(save_p, PolyObjects, numPolyObjects * sizeof(PolyObjects[0]));
|
||||
|
||||
bmap_freelist = NULL;
|
||||
|
||||
for (int i = 0; i < numPolyObjects; i++)
|
||||
{
|
||||
PolyObjects[i].thinker = NULL;
|
||||
@@ -4470,7 +4444,7 @@ boolean P_LoadGame(INT16 mapoverride)
|
||||
|
||||
boolean P_LoadNetGame(boolean preserveLevel)
|
||||
{
|
||||
CV_LoadNetVars(&save_p);
|
||||
CV_LoadNetVars(&save_p, false);
|
||||
if (!P_NetUnArchiveMisc(preserveLevel))
|
||||
return false;
|
||||
P_NetUnArchivePlayers();
|
||||
@@ -4498,13 +4472,6 @@ boolean P_LoadNetGame(boolean preserveLevel)
|
||||
return READUINT8(save_p) == 0x1d;
|
||||
}
|
||||
|
||||
void P_GameStateFreeMemory(savestate_t* savestate)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(savestate->buffer) / sizeof(savestate->buffer[0]); i++) {
|
||||
savestate->buffer[i] = 0; // Or any other suitable value
|
||||
}
|
||||
}
|
||||
|
||||
extern UINT64 saveStateBenchmark;
|
||||
extern UINT64 loadStateBenchmark;
|
||||
|
||||
@@ -4579,7 +4546,9 @@ boolean P_LoadGameState(const savestate_t* savestate)
|
||||
return false;
|
||||
}
|
||||
|
||||
CV_LoadNetVars(&save_p);
|
||||
con_muted = true;
|
||||
CV_LoadNetVars(&save_p, true);
|
||||
con_muted = false;
|
||||
|
||||
P_NetUnArchiveMisc(true);
|
||||
P_LocalUnArchivePlayers();
|
||||
@@ -4589,7 +4558,9 @@ boolean P_LoadGameState(const savestate_t* savestate)
|
||||
P_NetUnArchiveSpecials();
|
||||
P_LocalUnArchiveCameras();
|
||||
|
||||
con_muted = true;
|
||||
LUA_UnArchive();
|
||||
con_muted = false;
|
||||
|
||||
// This is stupid and hacky _squared_, but it's in the net load code and it says it might work, so I guess it might work!
|
||||
//P_SetRandSeed(P_GetInitSeed());
|
||||
|
||||
@@ -2736,9 +2736,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
if (rendermode != render_none)
|
||||
V_SetPaletteLump("PLAYPAL");
|
||||
|
||||
// Invalidate simulation save states
|
||||
InvalidateSavestates();
|
||||
|
||||
// Initialize sector node list.
|
||||
P_Initsecnode();
|
||||
|
||||
|
||||
Reference in new issue
Block a user