Make consistency more accurate

This commit is contained in:
NepDisk 2026-03-08 14:02:28 -04:00
parent f62fb5361a
commit 9ca702dce8
3 changed files with 45 additions and 34 deletions

View file

@ -5705,6 +5705,9 @@ static INT16 Consistancy(consistancy_t *c)
mo = (mobj_t *)th;
if (!MobjIsNetSynced(mo))
continue;
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
{
c->mobjtype -= mo->type;
@ -5734,11 +5737,11 @@ static INT16 Consistancy(consistancy_t *c)
c->mobjstate -= mo->target->state - states;
c->mobjtics += mo->target->tics;
c->mobjsprite -= mo->target->sprite;
c->mobjframe += mo->target->frame;
//c->mobjframe += mo->target->frame;
}
else
ConsistancyXOR(c, 0x3333);
if (mo->tracer && mo->tracer->type != MT_OVERLAY)
if (mo->tracer && MobjIsNetSynced(mo->tracer))
{
c->mobjtype += mo->tracer->type;
c->position[0] -= mo->tracer->x;
@ -5754,12 +5757,12 @@ static INT16 Consistancy(consistancy_t *c)
c->mobjstate -= mo->tracer->state - states;
c->mobjtics += mo->tracer->tics;
c->mobjsprite -= mo->tracer->sprite;
c->mobjframe += mo->tracer->frame;
//c->mobjframe += mo->tracer->frame;
}
else
ConsistancyXOR(c, 0xAAAA);
// SRB2Kart: We use hnext & hprev very extensively
if (mo->hnext && mo->hnext->type != MT_OVERLAY)
if (mo->hnext && MobjIsNetSynced(mo->hnext))
{
c->mobjtype += mo->hnext->type;
c->position[0] -= mo->hnext->x;
@ -5775,11 +5778,11 @@ static INT16 Consistancy(consistancy_t *c)
c->mobjstate -= mo->hnext->state - states;
c->mobjtics += mo->hnext->tics;
c->mobjsprite -= mo->hnext->sprite;
c->mobjframe += mo->hnext->frame;
//c->mobjframe += mo->hnext->frame;
}
else
ConsistancyXOR(c, 0x5555);
if (mo->hprev && mo->hprev->type != MT_OVERLAY)
if (mo->hprev && MobjIsNetSynced(mo->hprev))
{
c->mobjtype += mo->hprev->type;
c->position[0] -= mo->hprev->x;
@ -5795,14 +5798,14 @@ static INT16 Consistancy(consistancy_t *c)
c->mobjstate -= mo->hprev->state - states;
c->mobjtics += mo->hprev->tics;
c->mobjsprite -= mo->hprev->sprite;
c->mobjframe += mo->hprev->frame;
//c->mobjframe += mo->hprev->frame;
}
else
ConsistancyXOR(c, 0xCCCC);
c->mobjstate -= mo->state - states;
c->mobjtics += mo->tics;
c->mobjsprite -= mo->sprite;
c->mobjframe += mo->frame;
//c->mobjframe += mo->frame;
}
}
}

View file

@ -2081,6 +2081,35 @@ static void DiffMobj(const mobj_t *mobj, UINT32 diff[])
DIFF(mobj->voice, MD3_VOICE);
}
boolean MobjIsNetSynced(mobj_t *mobj)
{
// Ignore stationary hoops - these will be respawned from mapthings.
if (mobj->type == MT_HOOP)
return false;
// These are NEVER saved.
if (mobj->type == MT_HOOPCOLLIDE)
return false;
// This hoop has already been collected.
if (mobj->type == MT_HOOPCENTER && mobj->threshold == 4242)
return false;
// MT_SPARK: used for debug stuff
if (mobj->type == MT_SPARK)
return false;
// MT_FOLLOWERHORN: So it turns out hornmod is fundamentally incompatible with netsync
if (mobj->type == MT_FOLLOWERHORN)
return false;
// This is a non-synched visual effect mobj
if (mobj->flags2 & MF2_DONTSYNC)
return false;
return true;
}
static thinker_t *SyncMobjThinker(savebuffer_t *save, actionf_p1 thinker, thinker_t *th, UINT8 type)
{
mobj_t *mobj = (mobj_t *)th;
@ -2089,24 +2118,7 @@ static thinker_t *SyncMobjThinker(savebuffer_t *save, actionf_p1 thinker, thinke
if (save->write)
{
// Ignore stationary hoops - these will be respawned from mapthings.
if (mobj->type == MT_HOOP)
return th;
// These are NEVER saved.
if (mobj->type == MT_HOOPCOLLIDE)
return th;
// This hoop has already been collected.
if (mobj->type == MT_HOOPCENTER && mobj->threshold == 4242)
return th;
// MT_SPARK: used for debug stuff
if (mobj->type == MT_SPARK)
return th;
// This is a non-synched visual effect mobj
if (mobj->flags2 & MF2_DONTSYNC)
if (!MobjIsNetSynced(mobj))
return th;
// Scrap all of that. If we're a hoop center, this is ALL we're saving.
@ -3822,9 +3834,7 @@ static void P_RelinkPointers(savebuffer_t *save)
mobj = (mobj_t *)currentthinker;
if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER
// MT_SPARK: used for debug stuff
|| mobj->type == MT_SPARK))
if (!MobjIsNetSynced(mobj))
continue;
RELINK(&mobj->tracer);
@ -4538,11 +4548,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
continue;
mobj = (mobj_t *)th;
if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER
// MT_SPARK: used for debug stuff
|| mobj->type == MT_SPARK
// MT_FOLLOWERHORN: So it turns out hornmod is fundamentally incompatible with netsync
|| mobj->type == MT_FOLLOWERHORN || mobj->flags2 & MF2_DONTSYNC))
if (!MobjIsNetSynced(mobj))
continue;
mobj->mobjnum = i++;
}

View file

@ -61,6 +61,8 @@ boolean P_SaveBufferFromLump(savebuffer_t *save, lumpnum_t lump);
size_t P_SaveBufferFromFile(savebuffer_t *save, char const *name);
void P_SaveBufferFree(savebuffer_t *save);
boolean MobjIsNetSynced(mobj_t *mobj);
#ifdef __cplusplus
} // extern "C"
#endif