From bf30ad91e4863232a2f63830f64a8e0c141e5829 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 14 May 2020 01:41:06 +0200 Subject: [PATCH 01/21] Don't save Luavars in record attack, especially not for ghosts --- src/g_game.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index bf0557d02..dc5874b68 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -6368,7 +6368,9 @@ void G_BeginRecording(void) demoflags |= DF_ENCORE; #ifdef HAVE_BLUA - demoflags |= DF_LUAVARS; + if (!modeattacking) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof! + // SERIOUSLY THOUGH WHY WOULD YOU LOAD HOSTMOD AND RECORD A GHOST WITH IT !???? + demoflags |= DF_LUAVARS; #endif // Setup header. @@ -6474,8 +6476,9 @@ void G_BeginRecording(void) WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing #ifdef HAVE_BLUA - // player lua vars, always saved even if empty - LUA_ArchiveDemo(); + // player lua vars, always saved even if empty... Unless it's record attack. + if (!modeattacking) + LUA_ArchiveDemo(); #endif memset(&oldcmd,0,sizeof(oldcmd)); @@ -7543,6 +7546,7 @@ void G_DoPlayDemo(char *defdemoname) if (!gL) // No Lua state! ...I guess we'll just start one... LUA_ClearState(); + // No modeattacking check, DF_LUAVARS won't be present here. LUA_UnArchiveDemo(); } #endif From 1f74d7533e78c203ee71095af1b641500e31acd5 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 15 May 2020 14:21:25 -0700 Subject: [PATCH 02/21] Properly bound lua displayplayers and displayplayers.iterate to splitscreen This is fixes crashes in replays because splitscreen displayplayers are initialized to INT32_MAX there. --- src/lua_playerlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index d9766513b..0ece0d2c6 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -118,7 +118,7 @@ static int lib_iterateDisplayplayers(lua_State *L) for (i++; i < MAXSPLITSCREENPLAYERS; i++) { - if (!playeringame[displayplayers[i]] || i > splitscreen) + if (i > splitscreen || !playeringame[displayplayers[i]]) return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers. if (!players[displayplayers[i]].mo) @@ -139,6 +139,8 @@ static int lib_getDisplayplayers(lua_State *L) lua_Integer i = luaL_checkinteger(L, 2); if (i < 0 || i >= MAXSPLITSCREENPLAYERS) return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1); + if (i > splitscreen) + return 0; if (!playeringame[displayplayers[i]]) return 0; if (!players[displayplayers[i]].mo) From ded8ed7177854a78401085cb2cd6a0652ff80b67 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 27 Oct 2019 16:44:41 -0400 Subject: [PATCH 03/21] Don't force SPB in 1v1 (cherry picked from commit 54516aeee97b18ee307024672fe91fc60d55fd30) --- src/k_kart.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 7ac35cd31..d096a3624 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1061,6 +1061,10 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) bestbumper = players[i].kartstuff[k_bumper]; } + // No forced SPB in 1v1s, it has to be randomly rolled + if (pingame <= 2) + dontforcespb = true; + // This makes the roulette produce the random noises. if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player) && !demo.freecam) { From c55e4424c533a011d007b5b4d4601f8d95c5131a Mon Sep 17 00:00:00 2001 From: Sryder Date: Wed, 20 May 2020 11:53:14 +0100 Subject: [PATCH 04/21] Fix a fallthrough issue that could cause thundershield to be rolled less often than intended. --- src/k_kart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.c b/src/k_kart.c index b96daa5e5..165106fab 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -898,6 +898,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp newodds = 0; else POWERITEMODDS(newodds); + break; case KITEM_HYUDORO: if ((hyubgone > 0) || COOLDOWNONSTART) newodds = 0; From ef855cfc54edca5d3ebfd4d1540c32ad0b3ea8f4 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Mon, 1 Jun 2020 21:14:17 +0300 Subject: [PATCH 05/21] Guil's encore color bugfix with some additional cleanup --- src/p_setup.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index decdc5291..c0254bf4a 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1408,7 +1408,7 @@ static void P_LoadRawSideDefs2(void *data) UINT16 i; INT32 num; size_t j; - UINT32 cr, cg, cb; + RGBA_t color; for (i = 0; i < numsides; i++) { @@ -1490,23 +1490,21 @@ static void P_LoadRawSideDefs2(void *data) // encore mode colormaps! // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. // do this for both the start and fade colormaps. - - cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); - cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); - cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); + + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); + color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); + color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); #ifdef GLENCORE if (encoremap) { - j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; + j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - cr = pLocalPalette[j].s.red; - cg = pLocalPalette[j].s.green; - cb = pLocalPalette[j].s.blue; + color = pLocalPalette[j]; } #endif - - sec->extra_colormap->rgba = cr + cg + cb; + + sec->extra_colormap->rgba = color.rgba; // alpha if (msd->toptexture[7]) @@ -1533,23 +1531,21 @@ static void P_LoadRawSideDefs2(void *data) col = msd->bottomtexture; // do the exact same thing as above here. - - cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); - cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); - cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); + + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); + color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); + color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); #ifdef GLENCORE if (encoremap) { - j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; + j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - cr = pLocalPalette[j].s.red; - cg = pLocalPalette[j].s.green; - cb = pLocalPalette[j].s.blue; + color = pLocalPalette[j]; } #endif - sec->extra_colormap->fadergba = cr + cg + cb; + sec->extra_colormap->fadergba = color.rgba; // alpha if (msd->bottomtexture[7]) From 6e7f38475ff6ac4275c95542a3fab0cc2fca9e33 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 17:07:05 +0300 Subject: [PATCH 06/21] Add missing inflateEnd to fix memory leak in W_ReadLumpHeaderPwad --- src/w_wad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/w_wad.c b/src/w_wad.c index 54ae7fb26..d68af8f20 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1314,6 +1314,7 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si if (zErr == Z_STREAM_END) { M_Memcpy(dest, decData, size); + inflateEnd(&strm); } else { From fb1dae197fa73277627b01761d5c7b82fe5bba8f Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 21:37:33 +0300 Subject: [PATCH 07/21] Cleaner version of the W_ReadLumpHeaderPwad memory leak fix --- src/w_wad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index d68af8f20..7fd7ac125 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1314,14 +1314,13 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si if (zErr == Z_STREAM_END) { M_Memcpy(dest, decData, size); - inflateEnd(&strm); } else { size = 0; zerr(zErr); - (void)inflateEnd(&strm); } + (void)inflateEnd(&strm); } else { From 137788b0c9736970c1dc6b357ce34c01ca001e05 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Jun 2020 23:34:13 +0300 Subject: [PATCH 08/21] Fix uninitialized alpha when reading colormaps --- src/p_setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_setup.c b/src/p_setup.c index c0254bf4a..37bd77b5f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1494,6 +1494,7 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + color.s.alpha = 0; #ifdef GLENCORE if (encoremap) @@ -1535,6 +1536,7 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + color.s.alpha = 0; #ifdef GLENCORE if (encoremap) From 169c3cae4399d1ec52bf88d217ce4deaffbca8d2 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sun, 14 Jun 2020 14:53:53 +0300 Subject: [PATCH 09/21] Colormap alpha handling was still wrong, hopefully it's correct now --- src/p_setup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 37bd77b5f..85243d504 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1494,17 +1494,16 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - color.s.alpha = 0; #ifdef GLENCORE if (encoremap) { j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below } #endif - + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly sec->extra_colormap->rgba = color.rgba; // alpha @@ -1536,17 +1535,16 @@ static void P_LoadRawSideDefs2(void *data) color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - color.s.alpha = 0; #ifdef GLENCORE if (encoremap) { j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below } #endif - + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly sec->extra_colormap->fadergba = color.rgba; // alpha From 6714d9b614a92ffdd6be2bdbb7fef2a401adf1e0 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 23 Jun 2020 18:39:02 -0400 Subject: [PATCH 10/21] Fix user agent for HTTP downloads being set as SRB2Kart/v1.1.2 --- src/d_netfil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 3dc9da68c..f5550c060 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1088,7 +1088,7 @@ void CURLPrepareFile(const char* url, int dfilenum) // Only allow HTTP and HTTPS curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); - curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d.%d", VERSION/100, VERSION%100, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. + curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents. // Follow a redirect request, if sent by the server. curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L); From f0fac04dfd7ee0bfc3fd30d0ebdb4f26a2af8e71 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sat, 23 May 2020 17:59:31 -0400 Subject: [PATCH 11/21] Experiemntal clientside ack fix Stops the client from using reliable packets before joining a server Clients can time out during addon loading sending reliable packets before then can cause out of order acks This causes joinbug, chatbug, and chatspam, as well as general server instability due to unnecesary packetspam --- 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 251f413ab..d5c4006e6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1270,7 +1270,7 @@ static boolean CL_AskFileList(INT32 firstfile) netbuffer->packettype = PT_TELLFILESNEEDED; netbuffer->u.filesneedednum = firstfile; - return HSendPacket(servernode, true, 0, sizeof (INT32)); + return HSendPacket(servernode, false, 0, sizeof (INT32)); } /** Sends a special packet to declare how many players in local From fb51f60e20746efa6aa24f90ac75c7a5eda1e13e Mon Sep 17 00:00:00 2001 From: Ashnal Date: Tue, 14 Jul 2020 00:21:46 -0400 Subject: [PATCH 12/21] Add clean up to K_PuntMine This cleans up hnext when a mine shield is P_RemoveMobj'ed while being punted Otherwise, hnext could point to a removed mobj and cause undefined behavior This also fixes the bug where if you have multiple mines in your slot, drag one and have it punted, all your unused mines would disappear. This should/may fix the crashes/desyncs I've observed in gameplay when a held mine is punted. --- src/k_kart.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index cc5504bb4..c1a0bef19 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3312,7 +3312,8 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter) if (!thismine || P_MobjWasRemoved(thismine)) return; - if (thismine->type == MT_SSMINE_SHIELD) // Create a new mine + //This guarantees you hit a mine being dragged + if (thismine->type == MT_SSMINE_SHIELD) // Create a new mine, and clean up the old one { mine = P_SpawnMobj(thismine->x, thismine->y, thismine->z, MT_SSMINE); P_SetTarget(&mine->target, thismine->target); @@ -3320,7 +3321,19 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter) mine->flags2 = thismine->flags2; mine->floorz = thismine->floorz; mine->ceilingz = thismine->ceilingz; + + //Since we aren't using P_KillMobj, we need to clean up the hnext reference + { + P_SetTarget(&thismine->target->hnext, NULL); //target is the player who owns the mine + thismine->target->player->kartstuff[k_bananadrag] = 0; + thismine->target->player->kartstuff[k_itemheld] = 0; + + if (--thismine->target->player->kartstuff[k_itemamount] <= 0) + thismine->target->player->kartstuff[k_itemtype] = KITEM_NONE; + } + P_RemoveMobj(thismine); + } else mine = thismine; From bb6a5662c2610726ebe7606f77fa7128ba3787d1 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Tue, 14 Jul 2020 18:45:45 -0400 Subject: [PATCH 13/21] Fixing RocketSneakers New function specifically for dropping rocketsneakers K_DropRocketSneaker Used by Eggbox touchspecial to properly dispose of shoes and clean up hnext Now also used by the shoe thinker to drop themselves Fixes angle of spent shoe launch --- src/k_kart.c | 36 ++++++++++++++++++++++++++++++++++++ src/k_kart.h | 1 + src/p_inter.c | 3 +++ src/p_mobj.c | 13 +------------ 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index cc5504bb4..5d4ffe3f9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3870,6 +3870,42 @@ void K_DropItems(player_t *player) K_StripItems(player); } +void K_DropRocketSneaker(player_t *player) +{ + mobj_t *shoe = player->mo; + fixed_t flingangle; + boolean leftshoe = true; //left shoie is first + while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe)) + { + shoe->flags2 &= ~MF2_DONTDRAW; + shoe->flags &= ~MF_NOGRAVITY; + shoe->angle += ANGLE_45; + + if (shoe->eflags & MFE_VERTICALFLIP) + shoe->z -= shoe->height; + else + shoe->z += shoe->height; + + //left shoe goes off tot eh left, right shoe off to the right + if (leftshoe) + flingangle = -(ANG60); + else + flingangle = ANG60; + + S_StartSound(shoe, shoe->info->deathsound); + P_SetObjectMomZ(shoe, 8*FRACUNIT, false); + P_InstaThrust(shoe, R_PointToAngle2(shoe->target->x, shoe->target->y, shoe->x, shoe->y)+flingangle, 16*FRACUNIT); + shoe->momx += shoe->target->momx; + shoe->momy += shoe->target->momy; + shoe->momz += shoe->target->momz; + shoe->extravalue2 = 1; + + leftshoe = false; + } + P_SetTarget(&player->mo->hnext, NULL); + player->kartstuff[k_rocketsneakertimer] = 0; +} + // When an item in the hnext chain dies. void K_RepairOrbitChain(mobj_t *orbit) { diff --git a/src/k_kart.h b/src/k_kart.h index 2ba5d1bdc..93edda8ea 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -55,6 +55,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue); INT32 K_GetKartDriftSparkValue(player_t *player); void K_KartUpdatePosition(player_t *player); void K_DropItems(player_t *player); +void K_DropRocketSneaker(player_t *player); void K_StripItems(player_t *player); void K_StripOther(player_t *player); void K_MomentumToFacing(player_t *player); diff --git a/src/p_inter.c b/src/p_inter.c index abb12811e..54fe01030 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -408,6 +408,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else { + if (player->kartstuff[k_rocketsneakertimer]) + K_DropRocketSneaker(player); + K_DropItems(player); //K_StripItems(player); //K_StripOther(player); player->kartstuff[k_itemroulette] = 1; diff --git a/src/p_mobj.c b/src/p_mobj.c index f7f2afe34..82a003a0e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8312,18 +8312,7 @@ void P_MobjThinker(mobj_t *mobj) if (!mobj->extravalue2) { - if (mobj->eflags & MFE_VERTICALFLIP) - mobj->z -= mobj->height; - else - mobj->z += mobj->height; - - S_StartSound(mobj, mobj->info->deathsound); - P_SetObjectMomZ(mobj, 8*FRACUNIT, false); - P_InstaThrust(mobj, R_PointToAngle2(mobj->target->x, mobj->target->y, mobj->x, mobj->y)+ANGLE_90, 16*FRACUNIT); - mobj->momx += mobj->target->momx; - mobj->momy += mobj->target->momy; - mobj->momz += mobj->target->momz; - mobj->extravalue2 = 1; + K_DropRocketSneaker(mobj->target->player); } else if (P_IsObjectOnGround(mobj)) { From fef23cf7799d81d7b7d44330523a88ccef294612 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Tue, 14 Jul 2020 19:45:15 -0400 Subject: [PATCH 14/21] Some safeguards for K_DropRocketSneaker usage --- src/k_kart.c | 6 ++++++ src/p_inter.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5d4ffe3f9..ea80d65c5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3872,11 +3872,17 @@ void K_DropItems(player_t *player) void K_DropRocketSneaker(player_t *player) { + if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext))) + return; + mobj_t *shoe = player->mo; fixed_t flingangle; boolean leftshoe = true; //left shoie is first while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe)) { + if (shoe->type != MT_ROCKETSNEAKER) + return; //woah, not a rocketsneaker, bail! safeguard in case this gets used when you're holding non-rocketsneakers + shoe->flags2 &= ~MF2_DONTDRAW; shoe->flags &= ~MF_NOGRAVITY; shoe->angle += ANGLE_45; diff --git a/src/p_inter.c b/src/p_inter.c index 54fe01030..2a781d0a4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -408,9 +408,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else { - if (player->kartstuff[k_rocketsneakertimer]) - K_DropRocketSneaker(player); - + K_DropRocketSneaker(player); K_DropItems(player); //K_StripItems(player); //K_StripOther(player); player->kartstuff[k_itemroulette] = 1; From f60b6c881d3a741fb745570510c6e4351dc75d63 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Tue, 14 Jul 2020 19:50:37 -0400 Subject: [PATCH 15/21] Properly handle rocket sneakers when shrinking --- src/k_kart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.c b/src/k_kart.c index ea80d65c5..5ad368ce7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3577,6 +3577,7 @@ static void K_DoShrink(player_t *user) && !players[i].kartstuff[k_hyudorotimer]) { // Start shrinking! + K_DropRocketSneaker(&players[i]); //Make sure we handle this K_DropItems(&players[i]); players[i].kartstuff[k_growshrinktimer] = -(20*TICRATE); From f4d648526dc67cc76eb75f54340186eb3e9292ab Mon Sep 17 00:00:00 2001 From: Ashnal Date: Wed, 15 Jul 2020 09:17:35 -0400 Subject: [PATCH 16/21] Moved K_DropRocketSneaker call into K_StripItems This should catch when DropHnextList misses it Should probably fix sinks too ... --- src/k_kart.c | 3 +-- src/p_inter.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5ad368ce7..5c4a00757 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3577,7 +3577,6 @@ static void K_DoShrink(player_t *user) && !players[i].kartstuff[k_hyudorotimer]) { // Start shrinking! - K_DropRocketSneaker(&players[i]); //Make sure we handle this K_DropItems(&players[i]); players[i].kartstuff[k_growshrinktimer] = -(20*TICRATE); @@ -5242,7 +5241,7 @@ void K_StripItems(player_t *player) player->kartstuff[k_itemamount] = 0; player->kartstuff[k_itemheld] = 0; - player->kartstuff[k_rocketsneakertimer] = 0; + K_DropRocketSneaker(player); if (!player->kartstuff[k_itemroulette] || player->kartstuff[k_roulettetype] != 2) { diff --git a/src/p_inter.c b/src/p_inter.c index 2a781d0a4..abb12811e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -408,7 +408,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else { - K_DropRocketSneaker(player); K_DropItems(player); //K_StripItems(player); //K_StripOther(player); player->kartstuff[k_itemroulette] = 1; From 8c5e725a8d81fb8b9ff0ead166d5838df67ae4a1 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 23 Jul 2020 20:12:35 -0400 Subject: [PATCH 17/21] Also lets do this for kitchen sinks They also ignored in K_DropHnextList --- src/k_kart.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5c4a00757..a53372330 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3877,7 +3877,7 @@ void K_DropRocketSneaker(player_t *player) mobj_t *shoe = player->mo; fixed_t flingangle; - boolean leftshoe = true; //left shoie is first + boolean leftshoe = true; //left shoe is first while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe)) { if (shoe->type != MT_ROCKETSNEAKER) @@ -3912,6 +3912,19 @@ void K_DropRocketSneaker(player_t *player) player->kartstuff[k_rocketsneakertimer] = 0; } +void K_DropKitchenSink(player_t *player) +{ + if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext))) + return; + + if (player->mo->hnext->type != MT_SINK_SHIELD) + return; //so we can just call this function regardless of what is being held + + P_KillMobj(player->mo->hnext, NULL, NULL); + + P_SetTarget(&player->mo->hnext, NULL); +} + // When an item in the hnext chain dies. void K_RepairOrbitChain(mobj_t *orbit) { @@ -5237,12 +5250,12 @@ void K_KartUpdatePosition(player_t *player) // void K_StripItems(player_t *player) { + K_DropRocketSneaker(player); + K_DropKitchenSink(player); player->kartstuff[k_itemtype] = KITEM_NONE; player->kartstuff[k_itemamount] = 0; player->kartstuff[k_itemheld] = 0; - K_DropRocketSneaker(player); - if (!player->kartstuff[k_itemroulette] || player->kartstuff[k_roulettetype] != 2) { player->kartstuff[k_itemroulette] = 0; From 96e098b451001e5a9423e85721338145d1c72ea8 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 23 Jul 2020 21:05:00 -0400 Subject: [PATCH 18/21] Appease C91 --- src/k_kart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index a53372330..01531a8b0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3872,12 +3872,13 @@ void K_DropItems(player_t *player) void K_DropRocketSneaker(player_t *player) { - if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext))) - return; - mobj_t *shoe = player->mo; fixed_t flingangle; boolean leftshoe = true; //left shoe is first + + if (!(player->mo && !P_MobjWasRemoved(player->mo) && player->mo->hnext && !P_MobjWasRemoved(player->mo->hnext))) + return; + while ((shoe = shoe->hnext) && !P_MobjWasRemoved(shoe)) { if (shoe->type != MT_ROCKETSNEAKER) From 4f1642bbced7fdcf7b0d5aa191390f6d508124d7 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Wed, 5 Aug 2020 00:40:56 -0500 Subject: [PATCH 19/21] Clarify addon-related messages --- src/d_clisrv.c | 21 +++++++++++---------- src/m_menu.c | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 79a8e8291..7f335182e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1923,11 +1923,11 @@ static boolean CL_FinishedFileList(void) CL_Reset(); D_StartTitle(); M_StartMessage(M_GetText( - "You have WAD files loaded or have\n" - "modified the game in some way, and\n" - "your file list does not match\n" - "the server's file list.\n" - "Please restart SRB2Kart before connecting.\n\n" + "You have the wrong addons loaded.\n\n" + "To play on this server, restart\n" + "the game and don't load any addons.\n" + "SRB2Kart will automatically add\n" + "everything you need when you join.\n\n" "Press ESC\n" ), NULL, MM_NOTHING); return false; @@ -1948,11 +1948,12 @@ static boolean CL_FinishedFileList(void) CL_Reset(); D_StartTitle(); M_StartMessage(M_GetText( - "You cannot connect to this server\n" - "because you cannot download the files\n" - "that you are missing from the server.\n\n" - "See the console or log file for\n" - "more details.\n\n" + "An error occured when trying to\n" + "download missing addons.\n" + "(This is almost always a problem\n" + "with the server, not your game.)\n\n" + "See the console or log file\n" + "for additional details.\n\n" "Press ESC\n" ), NULL, MM_NOTHING); return false; diff --git a/src/m_menu.c b/src/m_menu.c index e08a53c56..eb19ecef3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4833,7 +4833,7 @@ static boolean M_AddonsRefresh(void) else if (majormods && !prevmajormods) { S_StartSound(NULL, sfx_s221); - message = va("%c%s\x80\nGameplay has now been modified.\nIf you wish to play Record Attack mode, restart the game to clear existing addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); + message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); prevmajormods = majormods; } @@ -8538,7 +8538,7 @@ static void M_ConnectMenuModChecks(INT32 choice) if (modifiedgame) { - M_StartMessage(M_GetText("Addons are currently loaded.\n\nYou will only be able to join a server if\nit has the same ones loaded in the same order, which may be unlikely.\n\nIf you wish to play on other servers,\nrestart the game to clear existing addons.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER); + M_StartMessage(M_GetText("You have addons loaded.\nYou won't be able to join netgames!\n\nTo play online, restart the game\nand don't load any addons.\nSRB2Kart will automatically add\neverything you need when you join.\n\n(Press a key)\n"),M_ConnectMenu,MM_EVENTHANDLER); return; } From 2422d1c5b799833c185a8ea44c4a0ebef81c5ba6 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Thu, 6 Aug 2020 10:34:16 -0500 Subject: [PATCH 20/21] Fix indirect item cooldown never resetting --- src/p_tick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index eaa8b4628..177a0060e 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -726,7 +726,7 @@ void P_Ticker(boolean run) if (exitcountdown > 1) exitcountdown--; - if (indirectitemcooldown > 1) + if (indirectitemcooldown > 0) indirectitemcooldown--; if (hyubgone > 1) hyubgone--; From e5463afb58d91b113c539b52cef92da415037369 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Thu, 6 Aug 2020 10:51:53 -0500 Subject: [PATCH 21/21] Fix Hyudoro cooldown never resetting --- src/p_tick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index 177a0060e..4cc6c9ba4 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -728,7 +728,7 @@ void P_Ticker(boolean run) if (indirectitemcooldown > 0) indirectitemcooldown--; - if (hyubgone > 1) + if (hyubgone > 0) hyubgone--; if (G_BattleGametype())