From 07c02f075b85d8414ba4adedda1fef84b59e7d8f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 17 Oct 2019 18:22:06 +0100 Subject: [PATCH 1/6] Fix sprite-related console errors that occur in netgames whenever the game attempts to synch the player's state. Turns out the code was using P_SetMobjStateNF to "fix" the player's state ...which got things all wrong, lol. --- src/d_clisrv.c | 15 ++++++++++++++- src/d_clisrv.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3234bc756..e70bafbce 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -621,6 +621,10 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->friction = LONG(players[i].mo->friction); rsp->movefactor = LONG(players[i].mo->movefactor); + rsp->sprite = (spritenum_t)LONG(players[i].mo->sprite); + rsp->frame = LONG(players[i].mo->frame); + rsp->sprite2 = players[i].mo->sprite2; + rsp->anim_duration = SHORT(players[i].mo->anim_duration); rsp->tics = LONG(players[i].mo->tics); rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :( rsp->eflags = (UINT16)SHORT(players[i].mo->eflags); @@ -767,8 +771,17 @@ static void resynch_read_player(resynch_pak *rsp) players[i].mo->momy = LONG(rsp->momy); players[i].mo->momz = LONG(rsp->momz); players[i].mo->movefactor = LONG(rsp->movefactor); + + // Don't use P_SetMobjStateNF to restore state, write/read all the values manually! + // This should stop those stupid console errors, hopefully. + // -- Monster Iestyn + players[i].mo->sprite = (spritenum_t)LONG(rsp->sprite); + players[i].mo->frame = LONG(rsp->frame); + players[i].mo->sprite2 = rsp->sprite2; + players[i].mo->anim_duration = SHORT(rsp->anim_duration); players[i].mo->tics = LONG(rsp->tics); - P_SetMobjStateNF(players[i].mo, LONG(rsp->statenum)); + players[i].mo->state = states[LONG(rsp->statenum)]; + players[i].mo->x = LONG(rsp->x); players[i].mo->y = LONG(rsp->y); players[i].mo->z = LONG(rsp->z); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index d09d2aa48..52ca1701d 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -265,6 +265,10 @@ typedef struct fixed_t friction; fixed_t movefactor; + spritenum_t sprite; + UINT32 frame; + UINT8 sprite2; + UINT16 anim_duration; INT32 tics; statenum_t statenum; UINT32 flags; From 246a6489e9338684e099cd6cee7a27063c1cdc11 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 18 Oct 2019 13:37:42 +0100 Subject: [PATCH 2/6] Fix missing & which I totally forgot about in writing this fix (yes this is the "compile error" everyone was talking about) --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e70bafbce..a4416b1dc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -780,7 +780,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].mo->sprite2 = rsp->sprite2; players[i].mo->anim_duration = SHORT(rsp->anim_duration); players[i].mo->tics = LONG(rsp->tics); - players[i].mo->state = states[LONG(rsp->statenum)]; + players[i].mo->state = &states[LONG(rsp->statenum)]; players[i].mo->x = LONG(rsp->x); players[i].mo->y = LONG(rsp->y); From c7fd22f98a8d26c179469e66192a5d513bee8b36 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 19 Oct 2019 12:08:15 +0200 Subject: [PATCH 3/6] Fixed a netgame crash that was caused by a closing brace being in the wrong place :v --- src/p_saveg.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 69c942236..ff9f3bf06 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3612,21 +3612,21 @@ static void P_NetUnArchiveThinkers(void) } CONS_Debug(DBG_NETPLAY, "%u thinkers loaded in list %d\n", numloaded, i); - } - if (restoreNum) - { - executor_t *delay = NULL; - UINT32 mobjnum; - for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; - currentthinker = currentthinker->next) + if (restoreNum) { - if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay) - continue; - delay = (void *)currentthinker; - if (!(mobjnum = (UINT32)(size_t)delay->caller)) - continue; - delay->caller = P_FindNewPosition(mobjnum); + executor_t *delay = NULL; + UINT32 mobjnum; + for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; + currentthinker = currentthinker->next) + { + if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay) + continue; + delay = (void *)currentthinker; + if (!(mobjnum = (UINT32)(size_t)delay->caller)) + continue; + delay->caller = P_FindNewPosition(mobjnum); + } } } } From 73c39990f96730fc12b13aa8238e260068294381 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 19 Oct 2019 14:51:24 +0200 Subject: [PATCH 4/6] Fix restoration of delayed linedef executors in P_NetUnArchiveThinkers for real --- src/p_saveg.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index ff9f3bf06..fb2365bf0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3612,21 +3612,21 @@ static void P_NetUnArchiveThinkers(void) } CONS_Debug(DBG_NETPLAY, "%u thinkers loaded in list %d\n", numloaded, i); + } - if (restoreNum) + if (restoreNum) + { + executor_t *delay = NULL; + UINT32 mobjnum; + for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; + currentthinker = currentthinker->next) { - executor_t *delay = NULL; - UINT32 mobjnum; - for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; - currentthinker = currentthinker->next) - { - if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay) - continue; - delay = (void *)currentthinker; - if (!(mobjnum = (UINT32)(size_t)delay->caller)) - continue; - delay->caller = P_FindNewPosition(mobjnum); - } + if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay) + continue; + delay = (void *)currentthinker; + if (!(mobjnum = (UINT32)(size_t)delay->caller)) + continue; + delay->caller = P_FindNewPosition(mobjnum); } } } From 920736ac8bd94a5d8918a7e0b96a2d44e13a72fe Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Oct 2019 15:57:01 +0100 Subject: [PATCH 5/6] Grouped ports from object_tweaks. * Make the Amy Cameo only spawn in SP, Record Attack, or Co-op unless it's the Clone Mode. * Add the diagonal spring flag options Red and Yellow Diagonal Springs have to the Blue Diagonal Spring as well. * Put diagonal blue spring in config. --- extras/conf/SRB2-22.cfg | 9 +++++++++ src/p_mobj.c | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index d936721b6..99d2fa492 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -4218,6 +4218,15 @@ thingtypes flags4text = "[4] Ignore gravity"; flags8text = "[8] Rotate 22.5° CCW"; } + 557 + { + arrow = 1; + title = "Diagonal Blue Spring"; + sprite = "BSPRD2"; + width = 16; + flags4text = "[4] Ignore gravity"; + flags8text = "[8] Rotate 22.5° CCW"; + } 558 { arrow = 1; diff --git a/src/p_mobj.c b/src/p_mobj.c index 7fa51111d..f1dc5d760 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11558,7 +11558,9 @@ You should think about modifying the deathmatch starts to take full advantage of if (i == MT_ROSY) { - if (mariomode) + if (!(gametype == GT_COOP || (mthing->options & MTF_EXTRA))) + return; // she doesn't hang out here + else if (mariomode) i = MT_TOAD; // don't remove on penalty of death else if (!(netgame || multiplayer) && players[consoleplayer].skin == 5) return; // no doubles @@ -12682,7 +12684,7 @@ ML_EFFECT5 : Don't stop thinking when too far away { if (mthing->options & MTF_AMBUSH) { - if (i == MT_YELLOWDIAG || i == MT_REDDIAG) + if (i == MT_YELLOWDIAG || i == MT_REDDIAG || i == MT_BLUEDIAG) mobj->angle += ANGLE_22h; if (i == MT_YELLOWHORIZ || i == MT_REDHORIZ || i == MT_BLUEHORIZ) @@ -12721,7 +12723,7 @@ ML_EFFECT5 : Don't stop thinking when too far away if (mthing->options & MTF_OBJECTSPECIAL) { - if (i == MT_YELLOWDIAG || i == MT_REDDIAG) + if (i == MT_YELLOWDIAG || i == MT_REDDIAG || i == MT_BLUEDIAG) mobj->flags |= MF_NOGRAVITY; if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) From 7e04cbbc1652dbe921cded08a2b1ed8e3b9d5064 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Oct 2019 16:01:04 +0100 Subject: [PATCH 6/6] Fix mixed declaration and code error in A_RolloutRock (object_tweaks division 2) --- src/p_enemy.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 314e97606..f67d7d194 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14214,18 +14214,17 @@ void A_RolloutRock(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; - -#ifdef HAVE_BLUA - if (LUA_CallAction("A_RolloutRock", actor)) - return; -#endif - UINT8 maxframes = actor->info->reactiontime; // number of frames the mobj cycles through fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); // used to calculate when to change frame fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); +#ifdef HAVE_BLUA + if (LUA_CallAction("A_RolloutRock", actor)) + return; +#endif + actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves if (actor->threshold)