From 512342bf7c4f3f1362f6b44bcf6b1b3193bc2c0d Mon Sep 17 00:00:00 2001 From: SteelT Date: Thu, 9 Dec 2021 01:32:08 -0500 Subject: [PATCH 01/25] SDL: Support setting vsync at runtime Allows vid_wait to work under software without having to switch to OpenGL and then back Yeah, support on windows will require a newer version of SDL. I'm just pushing this so the code is already there. --- src/sdl/i_video.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index c04eab8bc..4ce2993e8 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -106,8 +106,10 @@ rendermode_t chosenrendermode = render_none; // set by command line arguments boolean highcolor = false; +static void Impl_SetVsync(void); + // synchronize page flipping with screen refresh -consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, NULL); +consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync); static consvar_t cv_stretch = CVAR_INIT ("stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL); static consvar_t cv_alwaysgrabmouse = CVAR_INIT ("alwaysgrabmouse", "Off", CV_SAVE, CV_OnOff, NULL); @@ -2061,3 +2063,11 @@ void I_ShutdownGraphics(void) framebuffer = SDL_FALSE; } #endif + +static void Impl_SetVsync(void) +{ +#if SDL_VERSION_ATLEAST(2,0,18) + if (renderer) + SDL_RenderSetVSync(renderer, cv_vidwait.value); +#endif +} \ No newline at end of file From e2ac69824732ddef41c0c0aa33fe529f61b36ea4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 27 May 2022 17:51:47 -0400 Subject: [PATCH 02/25] Make Ballhog more interesting - No more instant fuck you button. You charge up a meter instead by holding down attack, and let go to fire as many as you charged up. Tapping fires one out of five, holding for the entire duration shoots out all five like before, but anything inbetween is also possible. - Ballhog projectiles scale up over time (like Contra spread shot), to help make it stronger again after players started getting faster. --- src/d_player.h | 6 +- src/k_hud.c | 10 ++++ src/k_kart.c | 134 +++++++++++++++++++++++++++----------------- src/k_kart.h | 2 +- src/lua_playerlib.c | 4 ++ src/p_inter.c | 2 +- src/p_mobj.c | 3 + src/p_saveg.c | 4 ++ 8 files changed, 111 insertions(+), 54 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c6328c3ca..9b5ba4cca 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -259,6 +259,8 @@ typedef enum #define TUMBLEBOUNCES 3 +#define BALLHOGINCREMENT (7) + //} // for kickstartaccel @@ -470,9 +472,11 @@ typedef struct player_s UINT16 flamemeter; // Flame Shield dash meter left UINT8 flamelength; // Flame Shield dash meter, number of segments + UINT16 ballhogcharge; // Ballhog charge up -- the higher this value, the more projectiles + UINT16 hyudorotimer; // Duration of the Hyudoro offroad effect itself SINT8 stealingtimer; // if >0 you are stealing, if <0 you are being stolen from - mobj_t *hoverhyudoro; // First hyudoro hovering next to player + mobj_t *hoverhyudoro; // First hyudoro hovering next to player UINT16 sneakertimer; // Duration of a Sneaker Boost (from Sneakers or level boosters) UINT8 numsneakers; // Number of stacked sneaker effects diff --git a/src/k_hud.c b/src/k_hud.c index 2f0a43b24..4e9a4544f 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1204,6 +1204,16 @@ static void K_drawKartItem(void) else localpatch = kp_nodraw; } + else if (stplyr->ballhogcharge > 0) + { + itembar = stplyr->ballhogcharge; + maxl = (((stplyr->itemamount-1) * BALLHOGINCREMENT) + 1); + + if (leveltime & 1) + localpatch = kp_ballhog[offset]; + else + localpatch = kp_nodraw; + } else if (stplyr->rocketsneakertimer > 1) { itembar = stplyr->rocketsneakertimer; diff --git a/src/k_kart.c b/src/k_kart.c index 170e5a361..f2b4cb21f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -493,6 +493,10 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem) player->itemtype = KITEM_JAWZ; player->itemamount = 2; break; + case KITEM_BALLHOG: // Ballhog x5 + player->itemtype = KITEM_BALLHOG; + player->itemamount = 5; + break; default: if (getitem <= 0 || getitem >= NUMKARTRESULTS) // Sad (Fallback) { @@ -4052,7 +4056,6 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I if (source->player != NULL) { - if (source->player->itemscale == ITEMSCALE_SHRINK) { // Nerf the base item speed a bit. @@ -4165,6 +4168,11 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I S_StartSound(th, sfx_s3kbfl); S_StartSound(th, sfx_cdfm35); break; + case MT_BALLHOG: + // Contra spread shot scale up + th->destscale = th->destscale << 1; + th->scalespeed = abs(th->destscale - th->scale) / (2*TICRATE); + break; default: break; } @@ -5000,7 +5008,7 @@ static mobj_t *K_FindLastTrailMobj(player_t *player) return trail; } -mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow) +mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow, angle_t angleOffset) { mobj_t *mo; INT32 dir; @@ -5066,46 +5074,21 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, if (missile) // Shootables { - if (mapthing == MT_BALLHOG) // Messy + if (dir == -1 && mapthing != MT_SPB) { - mo = NULL; // can't return multiple projectiles - if (dir == -1) - { - // Shoot backward - K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x06000000, 0, PROJSPEED/8); - K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x03000000, 0, PROJSPEED/8); - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/8); - K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + 0x03000000, 0, PROJSPEED/8); - K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + 0x06000000, 0, PROJSPEED/8); - } - else - { - // Shoot forward - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x06000000, 0, PROJSPEED); - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x03000000, 0, PROJSPEED); - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle, 0, PROJSPEED); - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + 0x03000000, 0, PROJSPEED); - K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + 0x06000000, 0, PROJSPEED); - } + // Shoot backward + mo = K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + angleOffset, 0, PROJSPEED/8); } else { - if (dir == -1 && mapthing != MT_SPB) - { - // Shoot backward - mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/8); - } - else - { - // Shoot forward - mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle, 0, PROJSPEED); - } + // Shoot forward + mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + angleOffset, 0, PROJSPEED); + } - if (mapthing == MT_DROPTARGET && mo) - { - mo->reactiontime = TICRATE/2; - P_SetMobjState(mo, mo->info->painstate); - } + if (mapthing == MT_DROPTARGET && mo) + { + mo->reactiontime = TICRATE/2; + P_SetMobjState(mo, mo->info->painstate); } } else @@ -6067,6 +6050,10 @@ mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 newType = KITEM_JAWZ; newAmount = 2; break; + case KITEM_BALLHOG: // Ballhog x5 + newType = KITEM_BALLHOG; + newAmount = 5; + break; default: newType = i; newAmount = 1; @@ -9573,7 +9560,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (ATTACK_IS_DOWN) { - K_ThrowKartItem(player, false, MT_EGGMANITEM, -1, 0); + K_ThrowKartItem(player, false, MT_EGGMANITEM, -1, 0, 0); K_PlayAttackTaunt(player->mo); player->pflags &= ~PF_EGGMANOUT; K_UpdateHnextList(player, true); @@ -9699,7 +9686,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (ATTACK_IS_DOWN && (player->pflags & PF_ITEMOUT)) // Banana x3 thrown { - K_ThrowKartItem(player, false, MT_BANANA, -1, 0); + K_ThrowKartItem(player, false, MT_BANANA, -1, 0, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; K_UpdateHnextList(player, false); @@ -9762,7 +9749,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (ATTACK_IS_DOWN && (player->pflags & PF_ITEMOUT)) // Orbinaut x3 thrown { - K_ThrowKartItem(player, true, MT_ORBINAUT, 1, 0); + K_ThrowKartItem(player, true, MT_ORBINAUT, 1, 0, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; K_UpdateHnextList(player, false); @@ -9804,9 +9791,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if (ATTACK_IS_DOWN && HOLDING_ITEM && (player->pflags & PF_ITEMOUT)) // Jawz thrown { if (player->throwdir == 1 || player->throwdir == 0) - K_ThrowKartItem(player, true, MT_JAWZ, 1, 0); + K_ThrowKartItem(player, true, MT_JAWZ, 1, 0, 0); else if (player->throwdir == -1) // Throwing backward gives you a dud that doesn't home in - K_ThrowKartItem(player, true, MT_JAWZ_DUD, -1, 0); + K_ThrowKartItem(player, true, MT_JAWZ_DUD, -1, 0, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; K_UpdateHnextList(player, false); @@ -9832,7 +9819,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (ATTACK_IS_DOWN && (player->pflags & PF_ITEMOUT)) { - K_ThrowKartItem(player, false, MT_SSMINE, 1, 1); + K_ThrowKartItem(player, false, MT_SSMINE, 1, 1, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; player->pflags &= ~PF_ITEMOUT; @@ -9867,7 +9854,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (ATTACK_IS_DOWN && (player->pflags & PF_ITEMOUT)) { - K_ThrowKartItem(player, (player->throwdir > 0), MT_DROPTARGET, -1, 0); + K_ThrowKartItem(player, (player->throwdir > 0), MT_DROPTARGET, -1, 0, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; player->pflags &= ~PF_ITEMOUT; @@ -9875,18 +9862,63 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } break; case KITEM_BALLHOG: - if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) + if (!HOLDING_ITEM && NO_HYUDORO) { - player->itemamount--; - K_ThrowKartItem(player, true, MT_BALLHOG, 1, 0); - K_PlayAttackTaunt(player->mo); + INT32 ballhogmax = ((player->itemamount-1) * BALLHOGINCREMENT) + 1; + + if ((cmd->buttons & BT_ATTACK) && (player->pflags & PF_HOLDREADY) + && (player->ballhogcharge < ballhogmax)) + { + player->ballhogcharge++; + } + else + { + if (cmd->buttons & BT_ATTACK) + { + player->pflags &= ~PF_HOLDREADY; + } + else + { + player->pflags |= PF_HOLDREADY; + } + + if (player->ballhogcharge > 0) + { + INT32 numhogs = min((player->ballhogcharge / BALLHOGINCREMENT) + 1, player->itemamount); + + if (numhogs <= 1) + { + player->itemamount--; + K_ThrowKartItem(player, true, MT_BALLHOG, 1, 0, 0); + } + else + { + angle_t cone = 0x01800000 * (numhogs-1); + angle_t offsetAmt = (cone * 2) / (numhogs-1); + angle_t angleOffset = cone; + INT32 i; + + player->itemamount -= numhogs; + + for (i = 0; i < numhogs; i++) + { + K_ThrowKartItem(player, true, MT_BALLHOG, 1, 0, angleOffset); + angleOffset -= offsetAmt; + } + } + + player->ballhogcharge = 0; + K_PlayAttackTaunt(player->mo); + player->pflags &= ~PF_HOLDREADY; + } + } } break; case KITEM_SPB: if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { player->itemamount--; - K_ThrowKartItem(player, true, MT_SPB, 1, 0); + K_ThrowKartItem(player, true, MT_SPB, 1, 0, 0); K_PlayAttackTaunt(player->mo); } break; @@ -9987,7 +10019,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->bubbleblowup > bubbletime*2) { - K_ThrowKartItem(player, (player->throwdir > 0), MT_BUBBLESHIELDTRAP, -1, 0); + K_ThrowKartItem(player, (player->throwdir > 0), MT_BUBBLESHIELDTRAP, -1, 0, 0); K_PlayAttackTaunt(player->mo); player->bubbleblowup = 0; player->bubblecool = 0; @@ -10131,7 +10163,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (ATTACK_IS_DOWN && HOLDING_ITEM && (player->pflags & PF_ITEMOUT)) // Sink thrown { - K_ThrowKartItem(player, false, MT_SINK, 1, 2); + K_ThrowKartItem(player, false, MT_SINK, 1, 2, 0); K_PlayAttackTaunt(player->mo); player->itemamount--; player->pflags &= ~PF_ITEMOUT; diff --git a/src/k_kart.h b/src/k_kart.h index 5a6555db0..275e345fe 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -87,7 +87,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo); void K_SpawnDraftDust(mobj_t *mo); void K_DriftDustHandling(mobj_t *spawner); void K_Squish(mobj_t *mo); -mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow); +mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing, INT32 defaultDir, INT32 altthrow, angle_t angleOffset); void K_PuntMine(mobj_t *mine, mobj_t *punter); void K_DoSneaker(player_t *player, INT32 type); void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 4b2bad33d..7984b053b 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -330,6 +330,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->flamemeter); else if (fastcmp(field,"flamelength")) lua_pushinteger(L, plr->flamelength); + else if (fastcmp(field,"ballhogcharge")) + lua_pushinteger(L, plr->ballhogcharge); else if (fastcmp(field,"hyudorotimer")) lua_pushinteger(L, plr->hyudorotimer); else if (fastcmp(field,"stealingtimer")) @@ -682,6 +684,8 @@ static int player_set(lua_State *L) plr->flamemeter = luaL_checkinteger(L, 3); else if (fastcmp(field,"flamelength")) plr->flamelength = luaL_checkinteger(L, 3); + else if (fastcmp(field,"ballhogcharge")) + plr->ballhogcharge = luaL_checkinteger(L, 3); else if (fastcmp(field,"hyudorotimer")) plr->hyudorotimer = luaL_checkinteger(L, 3); else if (fastcmp(field,"stealingtimer")) diff --git a/src/p_inter.c b/src/p_inter.c index 27455872d..689b91912 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1410,7 +1410,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget // special behavior for SPB capsules if (target->threshold == KITEM_SPB) { - K_ThrowKartItem(player, true, MT_SPB, 1, 0); + K_ThrowKartItem(player, true, MT_SPB, 1, 0, 0); break; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 5219fb707..a1ec033bc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1548,7 +1548,10 @@ void P_XYMovement(mobj_t *mo) { mo->health--; if (mo->health == 0) + { + mo->scalespeed = mo->scale/12; mo->destscale = 0; + } } } //} diff --git a/src/p_saveg.c b/src/p_saveg.c index 0ae0ee72a..1eac84058 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -314,6 +314,8 @@ static void P_NetArchivePlayers(void) WRITEUINT16(save_p, players[i].flamemeter); WRITEUINT8(save_p, players[i].flamelength); + WRITEUINT16(save_p, players[i].ballhogcharge); + WRITEUINT16(save_p, players[i].hyudorotimer); WRITESINT8(save_p, players[i].stealingtimer); @@ -595,6 +597,8 @@ static void P_NetUnArchivePlayers(void) players[i].flamemeter = READUINT16(save_p); players[i].flamelength = READUINT8(save_p); + players[i].ballhogcharge = READUINT16(save_p); + players[i].hyudorotimer = READUINT16(save_p); players[i].stealingtimer = READSINT8(save_p); From 3dc2e3230d5a1170c2aef686f73608b3df9e8636 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 12:33:04 +0100 Subject: [PATCH 03/25] Manual zip-together of Ashnal's cvar suggestions and LJSonic's download speed cap raise - Lowered resynchattempts - Increased maxsend and downloadspeed - Increased max downloadspeed - Doubled nettimeout and jointimeout --- src/d_clisrv.c | 8 ++++---- src/d_netcmd.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 00207d1bb..6e08137ce 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3053,17 +3053,17 @@ consvar_t cv_discordinvites = CVAR_INIT ("discordinvites", "Everyone", CV_SAVE|C static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}}; -consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL); +consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "2", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL); consvar_t cv_blamecfail = CVAR_INIT ("blamecfail", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); // max file size to send to a player (in kilobytes) static CV_PossibleValue_t maxsend_cons_t[] = {{0, "MIN"}, {51200, "MAX"}, {0, NULL}}; -consvar_t cv_maxsend = CVAR_INIT ("maxsend", "4096", CV_SAVE|CV_NETVAR, maxsend_cons_t, NULL); +consvar_t cv_maxsend = CVAR_INIT ("maxsend", "51200", CV_SAVE|CV_NETVAR, maxsend_cons_t, NULL); consvar_t cv_noticedownload = CVAR_INIT ("noticedownload", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); // Speed of file downloading (in packets per tic) -static CV_PossibleValue_t downloadspeed_cons_t[] = {{0, "MIN"}, {32, "MAX"}, {0, NULL}}; -consvar_t cv_downloadspeed = CVAR_INIT ("downloadspeed", "16", CV_SAVE|CV_NETVAR, downloadspeed_cons_t, NULL); +static CV_PossibleValue_t downloadspeed_cons_t[] = {{0, "MIN"}, {300, "MAX"}, {0, NULL}}; +consvar_t cv_downloadspeed = CVAR_INIT ("downloadspeed", "32", CV_SAVE|CV_NETVAR, downloadspeed_cons_t, NULL); static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c90129081..b7f41e2a7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -481,9 +481,9 @@ consvar_t cv_allowexitlevel = CVAR_INIT ("allowexitlevel", "No", CV_NETVAR, CV_Y consvar_t cv_netstat = CVAR_INIT ("netstat", "Off", 0, CV_OnOff, NULL); // show bandwidth statistics static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; -consvar_t cv_nettimeout = CVAR_INIT ("nettimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange); +consvar_t cv_nettimeout = CVAR_INIT ("nettimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange); //static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}}; -consvar_t cv_jointimeout = CVAR_INIT ("jointimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange); +consvar_t cv_jointimeout = CVAR_INIT ("jointimeout", "210", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange); consvar_t cv_maxping = CVAR_INIT ("maxping", "800", CV_SAVE, CV_Unsigned, NULL); consvar_t cv_lagless = CVAR_INIT ("lagless", "Off", CV_SAVE|CV_NETVAR|CV_CALL, CV_OnOff, Lagless_OnChange); From 88802852224bf52cccf897fddaf7a1948aa45dbc Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 2 Dec 2021 23:34:28 +0100 Subject: [PATCH 04/25] Remove downloadspeed cruft # Conflicts: # src/d_clisrv.c --- src/d_clisrv.c | 2 +- src/d_netfil.c | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6e08137ce..c0ab93f4c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3062,7 +3062,7 @@ consvar_t cv_maxsend = CVAR_INIT ("maxsend", "51200", CV_SAVE|CV_NETVAR, maxsend consvar_t cv_noticedownload = CVAR_INIT ("noticedownload", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL); // Speed of file downloading (in packets per tic) -static CV_PossibleValue_t downloadspeed_cons_t[] = {{0, "MIN"}, {300, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t downloadspeed_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; consvar_t cv_downloadspeed = CVAR_INIT ("downloadspeed", "32", CV_SAVE|CV_NETVAR, downloadspeed_cons_t, NULL); static void Got_AddPlayer(UINT8 **p, INT32 playernum); diff --git a/src/d_netfil.c b/src/d_netfil.c index 84ead407a..5336d598b 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1007,7 +1007,6 @@ static void SV_EndFileSend(INT32 node) filestosend--; } -#define PACKETPERTIC net_bandwidth/(TICRATE*software_MAXPACKETLENGTH) #define FILEFRAGMENTSIZE (software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE)) /** Handles file transmission @@ -1040,14 +1039,7 @@ void FileSendTicker(void) if (!filestosend) // No file to send return; - if (cv_downloadspeed.value) // New behavior - packetsent = cv_downloadspeed.value; - else // Old behavior - { - packetsent = PACKETPERTIC; - if (!packetsent) - packetsent = 1; - } + packetsent = cv_downloadspeed.value; netbuffer->packettype = PT_FILEFRAGMENT; From 7adca2ef1990e07a130b4d438ba386a784289cc8 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 13:05:40 +0100 Subject: [PATCH 05/25] Fix papersprites being rotated incorrectly in Software when viewing them on the flipped side Rewritten version of STJr/SRB2!1770 --- src/r_things.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index cc5694dff..97e164a5b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1690,8 +1690,14 @@ static void R_ProjectSprite(mobj_t *thing) if (spriterotangle && !(splat && !(thing->renderflags & RF_NOSPLATROLLANGLE))) { - rollangle = R_GetRollAngle(vflip - ? InvAngle(spriterotangle) : spriterotangle); + if ((papersprite && ang >= ANGLE_180) != vflip) + { + rollangle = R_GetRollAngle(InvAngle(spriterotangle)); + } + else + { + rollangle = R_GetRollAngle(spriterotangle); + } rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle); if (rotsprite != NULL) From 4d52ca53e709d08660840ef47affc9324eccaf1f Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 13:24:31 +0100 Subject: [PATCH 06/25] Make P_SpawnGhostMobj ghosts properly copy spritestuff2 variables - spritexscale - spriteyscale - spritexoffset - spriteyoffset - renderflags --- src/p_user.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 215f67ffd..c95decdd9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1197,7 +1197,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->sprite2 = mobj->sprite2; ghost->frame = mobj->frame; ghost->tics = -1; - ghost->renderflags |= tr_trans50 << RF_TRANSSHIFT; + ghost->renderflags = (mobj->renderflags & ~RF_TRANSMASK)|RF_TRANS50; ghost->fuse = ghost->info->damage; ghost->skin = mobj->skin; ghost->standingslope = mobj->standingslope; @@ -1207,6 +1207,11 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->sprzoff = mobj->sprzoff; ghost->rollangle = mobj->rollangle; + ghost->spritexscale = mobj->spritexscale; + ghost->spriteyscale = mobj->spriteyscale; + ghost->spritexoffset = mobj->spritexoffset; + ghost->spriteyoffset = mobj->spriteyoffset; + if (mobj->flags2 & MF2_OBJECTFLIP) ghost->flags |= MF2_OBJECTFLIP; From 925e05a8a0537af1760e1da730a9a475bd03e836 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 13:33:40 +0100 Subject: [PATCH 07/25] Sink painstate crash fix --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 72665927e..794689a6f 100644 --- a/src/info.c +++ b/src/info.c @@ -24017,7 +24017,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_tossed, // seesound 8, // reactiontime sfx_None, // attacksound - 256*FRACUNIT, // painstate + S_NULL, // painstate 100, // painchance sfx_None, // painsound S_NULL, // meleestate From 54e03194ea9625ad29dc65c96fb4053a851c0aa4 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 13:50:26 +0100 Subject: [PATCH 08/25] Ignore client joins while loading a level, to prevent a myriad of join bugs. Slightly rewritten from Jugador's, to prevent spurious DEBFILE prints of unknown packet type --- src/d_clisrv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 00207d1bb..a3b8cf7fe 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4646,7 +4646,10 @@ static void GetPackets(void) if (netbuffer->packettype == PT_CLIENTJOIN && server) { - HandleConnect(node); + if (!levelloading) // Otherwise just ignore + { + HandleConnect(node); + } continue; } if (node == servernode && client && cl_mode != CL_SEARCHING) From f901ce0f00da722ef168cc5ae1cb2bf22ef20267 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 7 Sep 2022 14:04:22 +0100 Subject: [PATCH 09/25] Only calculate wipeout slowdown if the player's speed > 0 --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 9d92e8118..60d9ee48a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9483,7 +9483,7 @@ void K_AdjustPlayerFriction(player_t *player) } // Wipeout slowdown - if (player->spinouttimer && player->wipeoutslow) + if (player->speed > 0 && player->spinouttimer && player->wipeoutslow) { if (player->offroad) player->mo->friction -= 4912; From c878c7725cf687a133a7c1c550d021c676321773 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 10 Sep 2022 15:03:42 -0400 Subject: [PATCH 10/25] Reduce tripwire leniency from 35 to 7 tics --- src/d_player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 91989279c..2b47c89a1 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -268,7 +268,7 @@ typedef enum #define TUMBLEBOUNCES 3 #define TUMBLEGRAVITY (4*FRACUNIT) -#define TRIPWIRETIME (TICRATE) +#define TRIPWIRETIME (7) //} From 16a12de4f4e2d9546f2d701abc4e2db58607c6bb Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 16 Sep 2022 06:57:28 -0400 Subject: [PATCH 11/25] Fix hyudoro ballhog bug --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index d91e26e18..e57b01991 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9011,7 +9011,7 @@ void K_StripItems(player_t *player) player->curshield = KSHIELD_NONE; player->bananadrag = 0; - + player->ballhogcharge = 0; player->sadtimer = 0; K_UpdateHnextList(player, true); From 4d67cc6324593b1905b9e385043399360e6bb8dd Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 17 Sep 2022 06:34:11 -0700 Subject: [PATCH 12/25] Replace shitty item box pop with flying debris and dust clouds Debris flies forward and outward from the player in the direction of momentum. Debris particles bounce once then disappear when they hit the ground for the second time. Clouds spawn on and trail behind the player for a short duration. --- src/deh_tables.c | 9 ++ src/info.c | 61 +++++++++++ src/info.h | 11 ++ src/k_collide.c | 4 +- src/k_objects.h | 6 ++ src/objects/Sourcefile | 1 + src/objects/item-debris.c | 207 ++++++++++++++++++++++++++++++++++++++ src/p_enemy.c | 131 +++++++++++++++--------- src/p_mobj.c | 17 ++++ 9 files changed, 396 insertions(+), 51 deletions(-) create mode 100644 src/objects/item-debris.c diff --git a/src/deh_tables.c b/src/deh_tables.c index 5fe950e9e..37d1e0cc0 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -337,6 +337,7 @@ actionpointer_t actionpointers[] = {{A_ReaperThinker}, "A_REAPERTHINKER"}, {{A_FlameShieldPaper}, "A_FLAMESHIELDPAPER"}, {{A_InvincSparkleRotate}, "A_INVINCSPARKLEROTATE"}, + {{A_SpawnItemDebrisCloud}, "A_SPAWNITEMDEBRISCLOUD"}, {{NULL}, "NONE"}, @@ -3277,6 +3278,12 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_RANDOMITEMPOP4", //} + "S_ITEM_DEBRIS", + "S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT", + "S_ITEM_DEBRIS_CLOUD_SPAWNER1", + "S_ITEM_DEBRIS_CLOUD_SPAWNER2", + "S_ITEM_DEBRIS_CLOUD_SPAWNER3", + "S_ITEMICON", // Item capsules @@ -5297,6 +5304,8 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_BRAKEDRIFT", "MT_BRAKEDUST", "MT_DRIFTDUST", + "MT_ITEM_DEBRIS", + "MT_ITEM_DEBRIS_CLOUD_SPAWNER", "MT_DRIFTELECTRICITY", "MT_DRIFTELECTRICSPARK", "MT_JANKSPARK", diff --git a/src/info.c b/src/info.c index b0a3becef..e0df17fa6 100644 --- a/src/info.c +++ b/src/info.c @@ -530,6 +530,7 @@ char sprnames[NUMSPRITES + 1][5] = "RNDM", // Random Item Box "SBOX", // Sphere Box (for Battle) "RPOP", // Random Item Box Pop + "ITRI", // Item Box Debris "SGNS", // Signpost sparkle "FAST", // Speed boost trail "DSHR", // Speed boost dust release @@ -3867,6 +3868,12 @@ state_t states[NUMSTATES] = {SPR_RPOP, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_RANDOMITEMPOP4}, // S_RANDOMITEMPOP3 {SPR_RPOP, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL}, // S_RANDOMITEMPOP4 + {SPR_ITRI, FF_FULLBRIGHT, -1, {NULL}, 19, 1, S_NULL}, // S_ITEM_DEBRIS + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT + {SPR_NULL, 0, 1, {A_Repeat}, 4, S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_NULL}, // S_ITEM_DEBRIS_CLOUD_SPAWNER1 + {SPR_NULL, 4, 2, {A_SpawnItemDebrisCloud}, 1, 10, S_ITEM_DEBRIS_CLOUD_SPAWNER3}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2 + {SPR_NULL, 4, 5, {A_SpawnItemDebrisCloud}, 0, 2, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER3 + {SPR_NULL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMICON {SPR_ICAP, FF_ADD|0, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMCAPSULE @@ -23128,6 +23135,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_ITEM_DEBRIS + -1, // doomednum + S_ITEM_DEBRIS, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 32*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + + { // MT_ITEM_DEBRIS_CLOUD_SPAWNER + -1, // doomednum + S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 32*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP, // flags + S_NULL // raisestate + }, + { // MT_DRIFTELECTRICITY -1, // doomednum S_DRIFTELECTRICITY, // spawnstate diff --git a/src/info.h b/src/info.h index 8acf73ba8..62daffb42 100644 --- a/src/info.h +++ b/src/info.h @@ -290,6 +290,7 @@ enum actionnum A_REAPERTHINKER, A_FLAMESHIELDPAPER, A_INVINCSPARKLEROTATE, + A_SPAWNITEMDEBRISCLOUD, NUMACTIONS }; @@ -563,6 +564,7 @@ void A_ReaperThinker(); void A_MementosTPParticles(); void A_FlameShieldPaper(); void A_InvincSparkleRotate(); +void A_SpawnItemDebrisCloud(); extern boolean actionsoverridden[NUMACTIONS]; @@ -1076,6 +1078,7 @@ typedef enum sprite SPR_RNDM, // Random Item Box SPR_SBOX, // Sphere Box (for Battle) SPR_RPOP, // Random Item Box Pop + SPR_ITRI, // Item Box Debris SPR_SGNS, // Signpost sparkle SPR_FAST, // Speed boost trail SPR_DSHR, // Speed boost dust release @@ -4270,6 +4273,12 @@ typedef enum state S_RANDOMITEMPOP4, //} + S_ITEM_DEBRIS, + S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT, + S_ITEM_DEBRIS_CLOUD_SPAWNER1, + S_ITEM_DEBRIS_CLOUD_SPAWNER2, + S_ITEM_DEBRIS_CLOUD_SPAWNER3, + S_ITEMICON, // Item capsules @@ -6326,6 +6335,8 @@ typedef enum mobj_type MT_BRAKEDRIFT, MT_BRAKEDUST, MT_DRIFTDUST, + MT_ITEM_DEBRIS, + MT_ITEM_DEBRIS_CLOUD_SPAWNER, MT_DRIFTELECTRICITY, MT_DRIFTELECTRICSPARK, MT_JANKSPARK, diff --git a/src/k_collide.c b/src/k_collide.c index a23801ccc..9d582da59 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -11,6 +11,7 @@ #include "hu_stuff.h" // Sink snipe print #include "doomdef.h" // Sink snipe print #include "g_game.h" // Sink snipe print +#include "k_objects.h" angle_t K_GetCollideAngle(mobj_t *t1, mobj_t *t2) { @@ -265,8 +266,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2) } else { - mobj_t *poof = P_SpawnMobj(t1->x, t1->y, t1->z, MT_EXPLODE); - S_StartSound(poof, t1->info->deathsound); + Obj_SpawnItemDebrisEffects(t1, t2); #if 0 // Eggbox snipe! diff --git a/src/k_objects.h b/src/k_objects.h index cc80d2555..128c0f461 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -15,4 +15,10 @@ void Obj_ShrinkGunRemoved(mobj_t *gun); boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim); void Obj_CreateShrinkPohbees(player_t *owner); +/* Item Debris */ +fixed_t Obj_GetItemDebrisSpeed(mobj_t *collector, fixed_t min_speed); +void Obj_SpawnItemDebrisEffects(mobj_t *collectible, mobj_t *collector); +void Obj_ItemDebrisThink(mobj_t *debris); +fixed_t Obj_ItemDebrisBounce(mobj_t *debris, fixed_t momz); + #endif/*k_objects_H*/ diff --git a/src/objects/Sourcefile b/src/objects/Sourcefile index 94f7dd25b..d1e801471 100644 --- a/src/objects/Sourcefile +++ b/src/objects/Sourcefile @@ -1,2 +1,3 @@ hyudoro.c shrink.c +item-debris.c diff --git a/src/objects/item-debris.c b/src/objects/item-debris.c new file mode 100644 index 000000000..dcb1950d7 --- /dev/null +++ b/src/objects/item-debris.c @@ -0,0 +1,207 @@ +#include "../doomdef.h" +#include "../d_player.h" +#include "../m_random.h" +#include "../k_kart.h" +#include "../k_objects.h" +#include "../p_local.h" +#include "../s_sound.h" + +// TODO: general function +static fixed_t K_GetPlayerSpeedRatio(player_t *player) +{ + return FixedDiv(player->speed, + K_GetKartSpeed(player, false, false)); +} + +#define debris_type(o) ((o)->extravalue1) +#define debris_bouncesleft(o) ((o)->threshold) + +enum { + DEBRIS_ALPHA, + DEBRIS_BETA, + + NUM_DEBRIS_TYPES +}; + +struct debris_config { + mobj_t * origin; + angle_t angle; + fixed_t speed; + fixed_t scale; + UINT8 type; +}; + +static fixed_t +get_speed_ratio (mobj_t *thing) +{ + return thing->player ? + K_GetPlayerSpeedRatio(thing->player) : FRACUNIT; +} + +static void +spawn_debris +( const struct debris_config * config, + INT32 angle) +{ + const fixed_t height_table[NUM_DEBRIS_TYPES] = { + 50*FRACUNIT, + 35*FRACUNIT, + }; + + mobj_t *debris = P_SpawnMobjFromMobj( + config->origin, 0, 0, 0, MT_ITEM_DEBRIS); + + const state_t *st = debris->state; + + debris_type(debris) = config->type; + debris_bouncesleft(debris) = 1; + + // Start at a random frame of animation + debris->frame = (debris->frame & ~(FF_FRAMEMASK)) | + P_RandomRange((st->frame & FF_FRAMEMASK), st->var1); + + P_InstaThrust(debris, + config->angle + angle, + config->speed); + + P_SetObjectMomZ(debris, + FixedMul(config->scale, + height_table[config->type]), + false); + + debris->destscale = + FixedMul(config->scale, 3 * debris->scale); + P_SetScale(debris, debris->destscale); + + // Pass down color to dust particles + debris->color = config->origin->color; +} + +static void +spawn_cloud +( mobj_t * collectible, + mobj_t * collector) +{ + mobj_t *spawner = P_SpawnMobjFromMobj(collectible, + 0, 0, 0, MT_ITEM_DEBRIS_CLOUD_SPAWNER); + + P_SetTarget(&spawner->target, collector); + + S_StartSound(spawner, sfx_kc2e); + S_StartSound(spawner, sfx_s1c9); +} + +static void +rotate3d (mobj_t *debris) +{ + const UINT8 steps = 30; + + debris->rollangle = + M_RandomKey(steps) * (ANGLE_MAX / steps); +} + +fixed_t +Obj_GetItemDebrisSpeed +( mobj_t * collector, + fixed_t min_speed) +{ + const fixed_t base_speed = FixedMul( + 75 * mapobjectscale, + get_speed_ratio(collector)); + + return max(base_speed, min_speed); +} + +void +Obj_SpawnItemDebrisEffects +( mobj_t * collectible, + mobj_t * collector) +{ + const fixed_t min_speed = 80 * collectible->scale; + + const fixed_t speed = + Obj_GetItemDebrisSpeed(collector, min_speed); + + struct debris_config config = { + .origin = collectible, + .angle = K_MomentumAngle(collector), + .speed = speed, + .scale = FixedDiv(speed, min_speed), + }; + + config.type = DEBRIS_ALPHA; + + spawn_debris(&config, ANGLE_11hh); + spawn_debris(&config, -(ANGLE_11hh)); + + config.type = DEBRIS_BETA; + + spawn_debris(&config, 3*ANGLE_22h/2); + spawn_debris(&config, 3*ANGLE_22h/4); + spawn_debris(&config, 0); + spawn_debris(&config, -(3*ANGLE_22h/4)); + spawn_debris(&config, -(3*ANGLE_22h/2)); + + spawn_cloud(collectible, collector); +} + +void +Obj_ItemDebrisThink (mobj_t *debris) +{ + const UINT8 frame = (debris->frame & FF_FRAMEMASK); + + if (debris->momz == 0) + { + P_KillMobj(debris, NULL, NULL, DMG_NORMAL); + return; + } + + rotate3d(debris); + + if (frame % 3 == 1) + { + mobj_t *ghost = P_SpawnGhostMobj(debris); + + ghost->fuse = 3; + } + + if (debris_type(debris) == DEBRIS_ALPHA) + { + mobj_t *dust = P_SpawnMobjFromMobj( + debris, 0, 0, 0, MT_SPINDASHDUST); + + P_SetScale(dust, (dust->destscale /= 3)); + + dust->color = debris->color; + dust->colorized = true; + + dust->momx = debris->momx / 4; + dust->momy = debris->momy / 4; + dust->momz = debris->momz / 4; + } +} + +fixed_t +Obj_ItemDebrisBounce +( mobj_t * debris, + fixed_t momz) +{ + if (debris_bouncesleft(debris) <= 0) + { + P_KillMobj(debris, NULL, NULL, DMG_NORMAL); + return 0; + } + + momz = -(momz); + + if (debris_type(debris) == DEBRIS_BETA) + { + momz /= 2; + } + + debris_bouncesleft(debris)--; + + S_StartSound(debris, sfx_cdfm47); + + return momz; +} diff --git a/src/p_enemy.c b/src/p_enemy.c index d5f999624..879d01350 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -32,6 +32,7 @@ #include "k_battle.h" #include "k_respawn.h" #include "k_collide.h" +#include "k_objects.h" #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -326,6 +327,7 @@ void A_ReaperThinker(mobj_t *actor); void A_MementosTPParticles(mobj_t *actor); void A_FlameShieldPaper(mobj_t *actor); void A_InvincSparkleRotate(mobj_t *actor); +void A_SpawnItemDebrisCloud(mobj_t *actor); //for p_enemy.c @@ -13166,9 +13168,6 @@ void A_ItemPop(mobj_t *actor) { INT32 locvar1 = var1; - mobj_t *remains; - mobjtype_t explode; - if (LUA_CallAction(A_ITEMPOP, actor)) return; @@ -13185,58 +13184,13 @@ void A_ItemPop(mobj_t *actor) actor->flags |= MF_NOCLIP; P_SetThingPosition(actor); - // item explosion - explode = mobjinfo[actor->info->damage].mass; - remains = P_SpawnMobj(actor->x, actor->y, - ((actor->eflags & MFE_VERTICALFLIP) ? (actor->z + 3*(actor->height/4) - FixedMul(mobjinfo[explode].height, actor->scale)) : (actor->z + actor->height/4)), explode); - if (actor->eflags & MFE_VERTICALFLIP) - { - remains->eflags |= MFE_VERTICALFLIP; - remains->flags2 |= MF2_OBJECTFLIP; - } - remains->destscale = actor->destscale; - P_SetScale(remains, actor->scale); - - remains = P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->damage); - remains->type = actor->type; // Transfer type information - P_UnsetThingPosition(remains); - if (sector_list) - { - P_DelSeclist(sector_list); - sector_list = NULL; - } - P_SetThingPosition(remains); - remains->destscale = actor->destscale; - P_SetScale(remains, actor->scale); - remains->flags = actor->flags; // Transfer flags - remains->flags2 = actor->flags2; // Transfer flags2 - remains->fuse = actor->fuse; // Transfer respawn timer - remains->cvmem = leveltime; - remains->threshold = actor->threshold; - if (remains->threshold != 69 && remains->threshold != 70) - { - remains->threshold = 68; - } - // To insure this information doesn't have to be rediscovered every time you look at this function... - // A threshold of 0 is for a "living", ordinary random item. - // 68 means regular popped random item debris. - // 69 used to mean old Karma Item behaviour (now you can replicate this with MF2_DONTRESPAWN). - // 70 is a powered up Overtime item. - remains->skin = NULL; - remains->spawnpoint = actor->spawnpoint; - - P_SetTarget(&tmthing, remains); - - if (actor->info->deathsound) - S_StartSound(remains, actor->info->deathsound); + Obj_SpawnItemDebrisEffects(actor, actor->target); if (locvar1 == 1) P_GivePlayerSpheres(actor->target->player, actor->extravalue1); else if (locvar1 == 0) actor->target->player->itemroulette = 1; - remains->flags2 &= ~MF2_AMBUSH; - // Here at mapload in battle? if ((gametyperules & GTR_BUMPERS) && (actor->flags2 & MF2_BOSSNOTRAP)) numgotboxes++; @@ -14525,3 +14479,82 @@ void A_InvincSparkleRotate(mobj_t *actor) ghost->fuse = 4; } } + +// Function: A_SpawnItemDebrisCloud +// +// Description: Spawns a particle effect relative to the location of the actor +// +// var1 = If 1, scale size and momentum by extravalue2 / frame. +// var2 = Number of particles to spawn. +// +void +A_SpawnItemDebrisCloud (mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + + const fixed_t min_speed = 90 * actor->scale; + const INT16 spacing = (actor->radius / 2) / actor->scale; + + fixed_t fade = FRACUNIT; + fixed_t scale_fade = FRACUNIT; + + mobj_t *target = actor->target; + + fixed_t speed; + fixed_t scale; + + INT32 i; + + if (target == NULL) + { + return; + } + + if (locvar1) + { + const UINT8 frame = (actor->frame & FF_FRAMEMASK); + fixed_t frac; + + if (frame == 0) + { + return; // div by zero + } + + // extravalue2 from A_Repeat + frac = fade / frame; + fade = actor->extravalue2 * frac; + scale_fade = fade + frac; + } + + speed = Obj_GetItemDebrisSpeed(target, min_speed); + scale = 2 * FixedMul(FixedDiv(speed, min_speed), scale_fade); + + // Most of this code is from p_inter.c, MT_ITEMCAPSULE + + // dust effects + for (i = 0; i < locvar2; i++) + { + mobj_t *puff = P_SpawnMobjFromMobj( + target, + P_RandomRange(-spacing, spacing) * FRACUNIT, + P_RandomRange(-spacing, spacing) * FRACUNIT, + P_RandomRange(0, 4 * spacing) * FRACUNIT, + MT_SPINDASHDUST + ); + + puff->color = target->color; + puff->colorized = true; + + puff->destscale = FixedMul(puff->destscale, scale); + P_SetScale(puff, puff->destscale); + + puff->momz = puff->scale * P_MobjFlip(puff); + + P_Thrust(puff, R_PointToAngle2(target->x, target->y, puff->x, puff->y), 3 * puff->scale); + + puff->momx += FixedMul(target->momx, fade); + puff->momy += FixedMul(target->momy, fade); + puff->momz += FixedMul(target->momz, fade); + } +} diff --git a/src/p_mobj.c b/src/p_mobj.c index 0505d6bda..ee005d960 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1209,6 +1209,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo) case MT_KARMAFIREWORK: gravityadd /= 3; break; + case MT_ITEM_DEBRIS: + gravityadd *= 6; + break; default: break; } @@ -2339,6 +2342,15 @@ boolean P_ZMovement(mobj_t *mo) mom.z = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale); else if (mo->type == MT_SPINFIRE) // elemental shield fire is another exception here ; + else if (mo->type == MT_ITEM_DEBRIS) + { + mom.z = Obj_ItemDebrisBounce(mo, mom.z); + + if (mom.z == 0) + { + return false; + } + } else if (mo->type == MT_DRIFTCLIP) { mom.z = -mom.z/2; @@ -7845,6 +7857,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj) Obj_PohbeeThinker(mobj); break; } + case MT_ITEM_DEBRIS: + { + Obj_ItemDebrisThink(mobj); + break; + } case MT_ROCKETSNEAKER: if (!mobj->target || !mobj->target->health) { From e610c41d0f76845c2f735f33697c4765af438751 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 18 Sep 2022 04:33:03 -0400 Subject: [PATCH 13/25] Add Poh-Bee sprites --- src/deh_tables.c | 14 +++++++++++++- src/info.c | 26 ++++++++++++++++++++------ src/info.h | 18 ++++++++++++++++-- src/objects/shrink.c | 29 ++++++++++++++++++++++++++--- 4 files changed, 75 insertions(+), 12 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5fe950e9e..7bb649d2b 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3759,8 +3759,20 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_GROW_PARTICLE", // Shrink - "S_SHRINK_GUN", + "S_SHRINK_POHBEE", + "S_SHRINK_POHBEE2", + "S_SHRINK_POHBEE3", + "S_SHRINK_POHBEE4", + "S_SHRINK_POHBEE5", + "S_SHRINK_POHBEE6", + "S_SHRINK_POHBEE7", + "S_SHRINK_POHBEE8", + "S_SHRINK_CHAIN", + + "S_SHRINK_GUN", + "S_SHRINK_GUN_OVERLAY", + "S_SHRINK_LASER", "S_SHRINK_PARTICLE", diff --git a/src/info.c b/src/info.c index b0a3becef..6774050b6 100644 --- a/src/info.c +++ b/src/info.c @@ -575,7 +575,9 @@ char sprnames[NUMSPRITES + 1][5] = "HYUU", // Hyudoro "GRWP", // Grow "POHB", // Shrink Poh-Bee - "SHRG", // Shrink gun / laser + "POHC", // Shrink Poh-Bee chain + "SHRG", // Shrink gun + "SHRL", // Shrink laser "SINK", // Kitchen Sink "SITR", // Kitchen Sink Trail "KBLN", // Battle Mode Bumper @@ -4319,10 +4321,22 @@ state_t states[NUMSTATES] = {SPR_GRWP, FF_FULLBRIGHT|FF_ANIMATE, 13, {NULL}, 7, 1, S_NULL}, // S_GROW_PARTICLE + {SPR_POHB, 0, 1, {NULL}, 0, 0, S_SHRINK_POHBEE2}, // S_SHRINK_POHBEE + {SPR_POHB, 1, 1, {NULL}, 0, 0, S_SHRINK_POHBEE3}, // S_SHRINK_POHBEE2 + {SPR_POHB, 0, 1, {NULL}, 0, 0, S_SHRINK_POHBEE4}, // S_SHRINK_POHBEE3 + {SPR_POHB, 2, 1, {NULL}, 0, 0, S_SHRINK_POHBEE5}, // S_SHRINK_POHBEE4 + {SPR_POHB, 0, 1, {NULL}, 0, 0, S_SHRINK_POHBEE6}, // S_SHRINK_POHBEE5 + {SPR_POHB, 3, 1, {NULL}, 0, 0, S_SHRINK_POHBEE7}, // S_SHRINK_POHBEE6 + {SPR_POHB, 0, 1, {NULL}, 0, 0, S_SHRINK_POHBEE8}, // S_SHRINK_POHBEE7 + {SPR_POHB, 2, 1, {NULL}, 0, 0, S_SHRINK_POHBEE}, // S_SHRINK_POHBEE8 + + {SPR_POHC, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_CHAIN + {SPR_SHRG, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_GUN - {SPR_POHB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_CHAIN - {SPR_SHRG, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_LASER - {SPR_SHRG, FF_FULLBRIGHT|2, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_PARTICLE + {SPR_SHRG, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_GUN_OVERLAY + + {SPR_SHRL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_LASER + {SPR_SHRL, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_NULL}, // S_SHRINK_PARTICLE {SPR_SINK, 0, 1, {A_SmokeTrailer}, MT_SINKTRAIL, 0, S_SINK}, // S_SINK {SPR_SINK, 0|FF_TRANS80|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_SINK_SHIELD}, // S_SINK_SHIELD @@ -24075,7 +24089,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SHRINK_POHBEE -1, // doomednum - S_HYUDORO, // spawnstate + S_SHRINK_POHBEE, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -24096,7 +24110,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOCLIP|MF_NOCLIPTHING|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_NOCLIP|MF_NOCLIPTHING|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP|MF_NOSQUISH, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index 8acf73ba8..8305e1400 100644 --- a/src/info.h +++ b/src/info.h @@ -1121,7 +1121,9 @@ typedef enum sprite SPR_HYUU, // Hyudoro SPR_GRWP, // Grow SPR_POHB, // Shrink Poh-Bee - SPR_SHRG, // Shrink gun / laser + SPR_POHC, // Shrink Poh-Bee chain + SPR_SHRG, // Shrink gun + SPR_SHRL, // Shrink laser SPR_SINK, // Kitchen Sink SPR_SITR, // Kitchen Sink Trail SPR_KBLN, // Battle Mode Bumper @@ -4752,8 +4754,20 @@ typedef enum state S_GROW_PARTICLE, // Shrink - S_SHRINK_GUN, + S_SHRINK_POHBEE, + S_SHRINK_POHBEE2, + S_SHRINK_POHBEE3, + S_SHRINK_POHBEE4, + S_SHRINK_POHBEE5, + S_SHRINK_POHBEE6, + S_SHRINK_POHBEE7, + S_SHRINK_POHBEE8, + S_SHRINK_CHAIN, + + S_SHRINK_GUN, + S_SHRINK_GUN_OVERLAY, + S_SHRINK_LASER, S_SHRINK_PARTICLE, diff --git a/src/objects/shrink.c b/src/objects/shrink.c index 017c19829..10fb2aa10 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -34,7 +34,7 @@ // vertical flip // -#define POHBEE_HOVER (256 << FRACBITS) +#define POHBEE_HOVER (128 << FRACBITS) #define POHBEE_SPEED (128 << FRACBITS) #define POHBEE_TIME (30 * TICRATE) #define POHBEE_DIST (4096 << FRACBITS) @@ -68,6 +68,7 @@ enum #define gun_pohbee(o) ((o)->target) #define gun_laser(o) ((o)->tracer) #define gun_chains(o) ((o)->hprev) +#define gun_overlay(o) ((o)->itnext) #define chain_index(o) ((o)->extravalue1) @@ -314,7 +315,7 @@ static void ShrinkLaserThinker(mobj_t *pohbee, mobj_t *gun, mobj_t *laser) mobj_t *particle = NULL; laser->renderflags &= ~RF_DONTDRAW; - laser->color = gun->color; + laser->color = ShrinkLaserColor(pohbee); if (leveltime & 1) { @@ -386,6 +387,7 @@ static void DoGunChains(mobj_t *gun, mobj_t *pohbee) static void ShrinkGunThinker(mobj_t *gun) { mobj_t *pohbee = gun_pohbee(gun); + skincolornum_t gunColor = SKINCOLOR_GREY; if (pohbee == NULL || P_MobjWasRemoved(pohbee) == true) { @@ -394,7 +396,19 @@ static void ShrinkGunThinker(mobj_t *gun) } gun->angle = pohbee->angle; - gun->color = ShrinkLaserColor(pohbee); + + if (pohbee_owner(pohbee) != NULL && P_MobjWasRemoved(pohbee_owner(pohbee)) == false + && pohbee_owner(pohbee)->player != NULL) + { + gunColor = pohbee_owner(pohbee)->player->skincolor; + } + + gun->color = gunColor; + + if (gun_overlay(gun) != NULL && P_MobjWasRemoved(gun_overlay(gun)) == false) + { + gun_overlay(gun)->color = ShrinkLaserColor(pohbee); + } DoGunSwing(gun, pohbee); @@ -411,6 +425,7 @@ void Obj_PohbeeThinker(mobj_t *pohbee) mobj_t *gun = NULL; pohbee->momx = pohbee->momy = pohbee->momz = 0; + pohbee->spritexscale = pohbee->spriteyscale = 2*FRACUNIT; switch (pohbee_mode(pohbee)) { @@ -654,6 +669,7 @@ static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UI const UINT8 numSegs = segVal * (i + 1); mobj_t *gun = P_SpawnMobjFromMobj(pohbee, 0, 0, 0, MT_SHRINK_GUN); + mobj_t *overlay = NULL; mobj_t *laser = NULL; mobj_t *prevChain = NULL; @@ -663,6 +679,13 @@ static void CreatePohbee(player_t *owner, waypoint_t *start, waypoint_t *end, UI gun_numsegs(gun) = numSegs; gun_offset(gun) = P_RandomKey(GUN_SWINGTIME); + overlay = P_SpawnMobjFromMobj(gun, 0, 0, 0, MT_OVERLAY); + + P_SetTarget(&overlay->target, gun); + P_SetTarget(&gun_overlay(gun), overlay); + + P_SetMobjState(overlay, S_SHRINK_GUN_OVERLAY); + laser = P_SpawnMobjFromMobj(gun, 0, 0, 0, MT_SHRINK_LASER); P_SetTarget(&gun_laser(gun), laser); From dc350a77df4f43e73510b9d190fb9f965024f6ec Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 18 Sep 2022 04:43:58 -0400 Subject: [PATCH 14/25] Remove old powerup warning option --- src/d_netcmd.c | 2 -- src/d_netcmd.h | 1 - src/k_kart.c | 25 ++++++------------------- src/k_menudef.c | 3 --- src/objects/shrink.c | 2 +- src/sounds.c | 2 -- src/sounds.h | 2 -- 7 files changed, 7 insertions(+), 30 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1f7ef33a2..9dcc990a9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -409,8 +409,6 @@ consvar_t cv_dualjawz = CVAR_INIT ("dualjawz", "On", CV_NETVAR|CV_CHEAT, C static CV_PossibleValue_t kartminimap_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}}; consvar_t cv_kartminimap = CVAR_INIT ("kartminimap", "4", CV_SAVE, kartminimap_cons_t, NULL); consvar_t cv_kartcheck = CVAR_INIT ("kartcheck", "Yes", CV_SAVE, CV_YesNo, NULL); -static CV_PossibleValue_t kartinvinsfx_cons_t[] = {{0, "Music"}, {1, "SFX"}, {0, NULL}}; -consvar_t cv_kartinvinsfx = CVAR_INIT ("kartinvinsfx", "SFX", CV_SAVE, kartinvinsfx_cons_t, NULL); consvar_t cv_kartspeed = CVAR_INIT ("kartspeed", "Auto", CV_NETVAR|CV_CALL|CV_NOINIT, kartspeed_cons_t, KartSpeed_OnChange); static CV_PossibleValue_t kartbumpers_cons_t[] = {{1, "MIN"}, {12, "MAX"}, {0, NULL}}; consvar_t cv_kartbumpers = CVAR_INIT ("kartbumpers", "3", CV_NETVAR|CV_CHEAT, kartbumpers_cons_t, NULL); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 3a67fc458..1cc3a61d4 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -83,7 +83,6 @@ extern consvar_t cv_tripleorbinaut, cv_quadorbinaut, cv_dualjawz; extern consvar_t cv_kartminimap; extern consvar_t cv_kartcheck; -extern consvar_t cv_kartinvinsfx; extern consvar_t cv_kartspeed; extern consvar_t cv_kartbumpers; extern consvar_t cv_kartfrantic; diff --git a/src/k_kart.c b/src/k_kart.c index 03859aee6..05f2cd4cf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -241,7 +241,6 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_kartminimap); CV_RegisterVar(&cv_kartcheck); - CV_RegisterVar(&cv_kartinvinsfx); CV_RegisterVar(&cv_kartspeed); CV_RegisterVar(&cv_kartbumpers); CV_RegisterVar(&cv_kartfrantic); @@ -5796,7 +5795,7 @@ void K_DoInvincibility(player_t *player, tic_t time) } else //used to be "if (P_IsDisplayPlayer(player) == false)" { - S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc)); + S_StartSound(player->mo, sfx_alarmi); } P_RestoreMusic(player); @@ -7012,20 +7011,10 @@ static void K_UpdateInvincibilitySounds(player_t *player) if (player->mo->health > 0 && !P_IsLocalPlayer(player)) // used to be !P_IsDisplayPlayer(player) { - if (cv_kartinvinsfx.value) - { - if (player->invincibilitytimer > 0) // Prioritize invincibility - sfxnum = sfx_alarmi; - else if (player->growshrinktimer > 0) - sfxnum = sfx_alarmg; - } - else - { - if (player->invincibilitytimer > 0) - sfxnum = sfx_kinvnc; - else if (player->growshrinktimer > 0) - sfxnum = sfx_kgrow; - } + if (player->invincibilitytimer > 0) // Prioritize invincibility + sfxnum = sfx_alarmi; + else if (player->growshrinktimer > 0) + sfxnum = sfx_alarmg; } if (sfxnum != sfx_None && !S_SoundPlaying(player->mo, sfxnum)) @@ -7036,8 +7025,6 @@ static void K_UpdateInvincibilitySounds(player_t *player) S_StopSoundByID(player->mo, this); STOPTHIS(sfx_alarmi); STOPTHIS(sfx_alarmg); - STOPTHIS(sfx_kinvnc); - STOPTHIS(sfx_kgrow); #undef STOPTHIS } @@ -10076,7 +10063,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else //used to be "if (P_IsDisplayPlayer(player) == false)" { - S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); + S_StartSound(player->mo, sfx_alarmg); } P_RestoreMusic(player); diff --git a/src/k_menudef.c b/src/k_menudef.c index ed1e33c42..d97083509 100644 --- a/src/k_menudef.c +++ b/src/k_menudef.c @@ -871,9 +871,6 @@ menuitem_t OPTIONS_Sound[] = {IT_STRING | IT_CVAR, "Character Voices", "Set how often to play character voices in game.", NULL, {.cvar = &cv_kartvoices}, 0, 0}, - {IT_STRING | IT_CVAR, "Powerup Warning", "Set how to warn you from other player's powerups such as Invincibility.", - NULL, {.cvar = &cv_kartinvinsfx}, 0, 0}, - {IT_SPACE | IT_NOTHING, NULL, NULL, NULL, {NULL}, 0, 0}, diff --git a/src/objects/shrink.c b/src/objects/shrink.c index 10fb2aa10..fda826db6 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -545,7 +545,7 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim) } else //used to be "if (P_IsDisplayPlayer(victim->player) == false)" { - S_StartSound(victim, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); + S_StartSound(victim, sfx_alarmg); } P_RestoreMusic(victim->player); diff --git a/src/sounds.c b/src/sounds.c index 351e1553f..44f944dc3 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1054,8 +1054,6 @@ sfxinfo_t S_sfx[NUMSFX] = {"kpogos", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Pogo Spring use {"alarmi", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Invincibility alarm {"alarmg", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Grow alarm - {"kinvnc", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Invincibility music - {"kgrow", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Grow music {"itrol1", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Roulette spinning {"itrol2", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"itrol3", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, diff --git a/src/sounds.h b/src/sounds.h index e7248a369..874ce9896 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1118,8 +1118,6 @@ typedef enum sfx_kpogos, sfx_alarmi, sfx_alarmg, - sfx_kinvnc, - sfx_kgrow, sfx_itrol1, sfx_itrol2, sfx_itrol3, From ab8126b70678aa78e71ec08a043346759a6ca825 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 18 Sep 2022 05:06:45 -0400 Subject: [PATCH 15/25] Add Tyron's sound --- src/objects/shrink.c | 10 ++++++++++ src/sounds.c | 5 ++++- src/sounds.h | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/objects/shrink.c b/src/objects/shrink.c index fda826db6..e1e195e67 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -344,10 +344,20 @@ static void ShrinkLaserThinker(mobj_t *pohbee, mobj_t *gun, mobj_t *laser) particle->destscale = 0; //particle->momz = 2 * particle->scale * P_MobjFlip(particle); + + if (S_SoundPlaying(laser, sfx_beam01) == false) + { + S_StartSound(laser, sfx_beam01); + } } else { laser->renderflags |= RF_DONTDRAW; + + if (S_SoundPlaying(laser, sfx_beam01) == true) + { + S_StopSound(laser); + } } } diff --git a/src/sounds.c b/src/sounds.c index 44f944dc3..1cff40633 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1113,7 +1113,10 @@ sfxinfo_t S_sfx[NUMSFX] = {"ffbonc", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Shout message sound effect - {"sysmsg", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Server notification"}, + {"sysmsg", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Server notification"}, + + // Shrink laser beam + {"beam01", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SRB2Kart - Engine sounds // Engine class A diff --git a/src/sounds.h b/src/sounds.h index 874ce9896..cb9d3b671 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1180,6 +1180,9 @@ typedef enum // Shout message sound effect sfx_sysmsg, + // Shrink laser + sfx_beam01, + // Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy... // Engine class A - Low Speed, Low Weight sfx_krta00, From fe960530da17d9994afcbbb1f13f97bbb8269e15 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 18 Sep 2022 05:20:29 -0400 Subject: [PATCH 16/25] Pohbee turns around when reaching the waypoint --- src/objects/shrink.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/objects/shrink.c b/src/objects/shrink.c index e1e195e67..241164aa7 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -58,6 +58,7 @@ enum #define pohbee_waypoint_cur(o) ((o)->extravalue1) #define pohbee_waypoint_dest(o) ((o)->extravalue2) #define pohbee_height(o) ((o)->movefactor) +#define pohbee_destangle(o) ((o)->movedir) #define pohbee_owner(o) ((o)->target) #define pohbee_guns(o) ((o)->hnext) @@ -239,12 +240,13 @@ static void PohbeeSpawn(mobj_t *pohbee) } PohbeeMoveTo(pohbee, newX, newY, newZ); - pohbee->angle = K_MomentumAngle(pohbee); + pohbee_destangle(pohbee) = K_MomentumAngle(pohbee); if (finalize == true) { // Move to next state pohbee_mode(pohbee) = POHBEE_MODE_ACT; + pohbee_destangle(pohbee) += ANGLE_180; } if (pathfindsuccess == true) @@ -405,7 +407,10 @@ static void ShrinkGunThinker(mobj_t *gun) return; } - gun->angle = pohbee->angle; + if (pohbee_mode(pohbee) == POHBEE_MODE_SPAWN) + { + gun->angle = pohbee->angle; + } if (pohbee_owner(pohbee) != NULL && P_MobjWasRemoved(pohbee_owner(pohbee)) == false && pohbee_owner(pohbee)->player != NULL) @@ -457,6 +462,8 @@ void Obj_PohbeeThinker(mobj_t *pohbee) break; } + pohbee->angle += AngleDeltaSigned(pohbee_destangle(pohbee), pohbee->angle) / 8; + gun = pohbee_guns(pohbee); while (gun != NULL && P_MobjWasRemoved(gun) == false) { From 7aa29f80a9e1975e68611637e2fe5ffdb5e4d745 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 18 Sep 2022 09:13:08 -0400 Subject: [PATCH 17/25] /4 -> /3 --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 03859aee6..a879fdec7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8430,7 +8430,7 @@ INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering) // player->steering is the turning value, but with easing applied. // Keeps micro-turning from old easing, but isn't controller dependent. - const INT16 amount = KART_FULLTURN/4; + const INT16 amount = KART_FULLTURN/3; INT16 diff = destSteering - inputSteering; INT16 outputSteering = inputSteering; From c7847fa32aaf98d08855bd0a2ac634be3cd0a99c Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 19 Sep 2022 14:21:37 -0700 Subject: [PATCH 18/25] Bump trip wire leniency tics from 7 to 15 --- src/d_player.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 7b14f57c6..259a66f70 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -268,7 +268,7 @@ typedef enum #define TUMBLEBOUNCES 3 #define TUMBLEGRAVITY (4*FRACUNIT) -#define TRIPWIRETIME (7) +#define TRIPWIRETIME (15) //} From a2db1673dc0be5a70d29a1e598ae17f9b9982b6f Mon Sep 17 00:00:00 2001 From: VelocitOni Date: Mon, 19 Sep 2022 19:27:23 -0400 Subject: [PATCH 19/25] Made hitbox radius 26 instead of 16 --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 6774050b6..e80098499 100644 --- a/src/info.c +++ b/src/info.c @@ -23753,7 +23753,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_hogbom, // deathsound 80*FRACUNIT, // speed - 16*FRACUNIT, // radius + 26*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset 100, // mass From c2b2cd9a43a1252983b7311d8f0f53a36338e267 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 19 Sep 2022 23:37:29 -0700 Subject: [PATCH 20/25] Reenable item box respawning Old code was shit so I removed it (4d67cc632). Turns out none of that bullshit actually mattered to make this box respawn and it just needs to go to an invisible state! Makes use of some nifty flickering code (that was already there but effectively disabled) shortly before it actually respawns. --- src/info.c | 2 +- src/p_enemy.c | 8 ++++++-- src/p_mobj.c | 4 ---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/info.c b/src/info.c index ce37b51ad..3c868d4c0 100644 --- a/src/info.c +++ b/src/info.c @@ -3849,7 +3849,7 @@ state_t states[NUMSTATES] = {SPR_RNDM, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM11}, // S_RANDOMITEM10 {SPR_RNDM, 20|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM12}, // S_RANDOMITEM11 {SPR_RNDM, 22|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_RANDOMITEM1}, // S_RANDOMITEM12 - {SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_NULL}, // S_DEADRANDOMITEM + {SPR_NULL, 0, 0, {A_ItemPop}, 0, 0, S_RANDOMITEM1}, // S_DEADRANDOMITEM {SPR_SBOX, FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX2}, // S_SPHEREBOX1 {SPR_SBOX, 2|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, 4, {NULL}, 1, 1, S_SPHEREBOX3}, // S_SPHEREBOX2 diff --git a/src/p_enemy.c b/src/p_enemy.c index 879d01350..901c2a2b2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13184,6 +13184,12 @@ void A_ItemPop(mobj_t *actor) actor->flags |= MF_NOCLIP; P_SetThingPosition(actor); + // RF_DONTDRAW will flicker as the object's fuse gets + // closer to running out (see P_FuseThink) + actor->renderflags |= RF_DONTDRAW|RF_TRANS50; + actor->color = SKINCOLOR_GREY; + actor->colorized = true; + Obj_SpawnItemDebrisEffects(actor, actor->target); if (locvar1 == 1) @@ -13194,8 +13200,6 @@ void A_ItemPop(mobj_t *actor) // Here at mapload in battle? if ((gametyperules & GTR_BUMPERS) && (actor->flags2 & MF2_BOSSNOTRAP)) numgotboxes++; - - P_RemoveMobj(actor); } void A_JawzChase(mobj_t *actor) diff --git a/src/p_mobj.c b/src/p_mobj.c index ee005d960..1c34a1b1e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12683,10 +12683,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean P_SetThingPosition(mobj); } } - else - { - P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_EXPLODE); - } break; } case MT_ITEMCAPSULE: From f6ef29cf03bca2898824e5011cea8f7dcf487da5 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Sep 2022 05:24:48 -0700 Subject: [PATCH 21/25] Refactor item debris cloud - The "cloud" is stationary and spawned on the item box instead of the player. Still scales up with speed. - Single particles are spawned behind the player. No longer scales. Lasts longer but can end early if the player slows down. --- src/deh_tables.c | 2 - src/info.c | 10 ++--- src/info.h | 2 - src/k_objects.h | 1 - src/objects/item-debris.c | 90 +++++++++++++++++++++++++++------------ src/p_enemy.c | 69 +++++++++++++++--------------- 6 files changed, 101 insertions(+), 73 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 534b17db7..37ec83b7f 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3279,10 +3279,8 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi //} "S_ITEM_DEBRIS", - "S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT", "S_ITEM_DEBRIS_CLOUD_SPAWNER1", "S_ITEM_DEBRIS_CLOUD_SPAWNER2", - "S_ITEM_DEBRIS_CLOUD_SPAWNER3", "S_ITEMICON", diff --git a/src/info.c b/src/info.c index 3c868d4c0..84edb3900 100644 --- a/src/info.c +++ b/src/info.c @@ -3871,10 +3871,8 @@ state_t states[NUMSTATES] = {SPR_RPOP, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL}, // S_RANDOMITEMPOP4 {SPR_ITRI, FF_FULLBRIGHT, -1, {NULL}, 19, 1, S_NULL}, // S_ITEM_DEBRIS - {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT - {SPR_NULL, 0, 1, {A_Repeat}, 4, S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_NULL}, // S_ITEM_DEBRIS_CLOUD_SPAWNER1 - {SPR_NULL, 4, 2, {A_SpawnItemDebrisCloud}, 1, 10, S_ITEM_DEBRIS_CLOUD_SPAWNER3}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2 - {SPR_NULL, 4, 5, {A_SpawnItemDebrisCloud}, 0, 2, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER3 + {SPR_NULL, 0, 0, {A_Repeat}, 16, S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_NULL}, // S_ITEM_DEBRIS_CLOUD_SPAWNER1 + {SPR_NULL, 0, 7, {A_SpawnItemDebrisCloud}, 20, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2 {SPR_NULL, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_ITEMICON @@ -23178,7 +23176,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_ITEM_DEBRIS_CLOUD_SPAWNER -1, // doomednum - S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT, // spawnstate + S_ITEM_DEBRIS_CLOUD_SPAWNER1, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -23199,7 +23197,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP, // flags + MF_NOSECTOR|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index dceec967d..c5ed74daa 100644 --- a/src/info.h +++ b/src/info.h @@ -4276,10 +4276,8 @@ typedef enum state //} S_ITEM_DEBRIS, - S_ITEM_DEBRIS_CLOUD_SPAWNER_INIT, S_ITEM_DEBRIS_CLOUD_SPAWNER1, S_ITEM_DEBRIS_CLOUD_SPAWNER2, - S_ITEM_DEBRIS_CLOUD_SPAWNER3, S_ITEMICON, diff --git a/src/k_objects.h b/src/k_objects.h index 128c0f461..775710c1a 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -16,7 +16,6 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim); void Obj_CreateShrinkPohbees(player_t *owner); /* Item Debris */ -fixed_t Obj_GetItemDebrisSpeed(mobj_t *collector, fixed_t min_speed); void Obj_SpawnItemDebrisEffects(mobj_t *collectible, mobj_t *collector); void Obj_ItemDebrisThink(mobj_t *debris); fixed_t Obj_ItemDebrisBounce(mobj_t *debris, fixed_t momz); diff --git a/src/objects/item-debris.c b/src/objects/item-debris.c index dcb1950d7..841650527 100644 --- a/src/objects/item-debris.c +++ b/src/objects/item-debris.c @@ -4,6 +4,7 @@ #include "../k_kart.h" #include "../k_objects.h" #include "../p_local.h" +#include "../r_main.h" #include "../s_sound.h" // TODO: general function @@ -80,15 +81,52 @@ spawn_debris static void spawn_cloud ( mobj_t * collectible, - mobj_t * collector) + mobj_t * collector, + fixed_t base_speed) { - mobj_t *spawner = P_SpawnMobjFromMobj(collectible, - 0, 0, 0, MT_ITEM_DEBRIS_CLOUD_SPAWNER); + const fixed_t min_speed = 90 * collectible->scale; - P_SetTarget(&spawner->target, collector); + const fixed_t scale = FixedDiv( + max(base_speed, min_speed), min_speed); - S_StartSound(spawner, sfx_kc2e); - S_StartSound(spawner, sfx_s1c9); + const INT16 spacing = + (collectible->radius / 2) / collectible->scale; + + INT32 i; + + // Most of this code is from p_inter.c, MT_ITEMCAPSULE + + // dust effects + for (i = 0; i < 10; i++) + { + mobj_t *puff = P_SpawnMobjFromMobj( + collectible, + P_RandomRange(-spacing, spacing) * FRACUNIT, + P_RandomRange(-spacing, spacing) * FRACUNIT, + P_RandomRange(0, 4 * spacing) * FRACUNIT, + MT_SPINDASHDUST + ); + + puff->color = collector->color; + puff->colorized = true; + + puff->destscale = FixedMul(puff->destscale, scale); + P_SetScale(puff, puff->destscale); + + puff->momz = puff->scale * P_MobjFlip(puff); + + P_InitAngle(puff, R_PointToAngle2( + collectible->x, + collectible->y, + puff->x, + puff->y)); + + P_Thrust(puff, puff->angle, 3 * puff->scale); + + puff->momx += collector->momx; + puff->momy += collector->momy; + puff->momz += collector->momz; + } } static void @@ -100,18 +138,6 @@ rotate3d (mobj_t *debris) M_RandomKey(steps) * (ANGLE_MAX / steps); } -fixed_t -Obj_GetItemDebrisSpeed -( mobj_t * collector, - fixed_t min_speed) -{ - const fixed_t base_speed = FixedMul( - 75 * mapobjectscale, - get_speed_ratio(collector)); - - return max(base_speed, min_speed); -} - void Obj_SpawnItemDebrisEffects ( mobj_t * collectible, @@ -119,15 +145,22 @@ Obj_SpawnItemDebrisEffects { const fixed_t min_speed = 80 * collectible->scale; - const fixed_t speed = - Obj_GetItemDebrisSpeed(collector, min_speed); + fixed_t base_speed = FixedMul(75 * mapobjectscale, + get_speed_ratio(collector)); - struct debris_config config = { - .origin = collectible, - .angle = K_MomentumAngle(collector), - .speed = speed, - .scale = FixedDiv(speed, min_speed), - }; + struct debris_config config; + + // Delayed effect for puffs of smoke that stick to and + // glide off of the player + mobj_t *spawner = P_SpawnMobjFromMobj(collectible, + 0, 0, 0, MT_ITEM_DEBRIS_CLOUD_SPAWNER); + + P_SetTarget(&spawner->target, collector); + + config.origin = collectible; + config.angle = K_MomentumAngle(collector); + config.speed = max(base_speed, min_speed); + config.scale = FixedDiv(config.speed, min_speed); config.type = DEBRIS_ALPHA; @@ -142,7 +175,10 @@ Obj_SpawnItemDebrisEffects spawn_debris(&config, -(3*ANGLE_22h/4)); spawn_debris(&config, -(3*ANGLE_22h/2)); - spawn_cloud(collectible, collector); + spawn_cloud(collectible, collector, base_speed); + + S_StartSound(collectible, sfx_kc2e); + S_StartSound(collectible, sfx_s1c9); } void diff --git a/src/p_enemy.c b/src/p_enemy.c index 901c2a2b2..1a0c31c4b 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14486,59 +14486,55 @@ void A_InvincSparkleRotate(mobj_t *actor) // Function: A_SpawnItemDebrisCloud // -// Description: Spawns a particle effect relative to the location of the actor +// Description: Spawns the poofs of an exploded item box. Target is a player to spawn the particles around. // -// var1 = If 1, scale size and momentum by extravalue2 / frame. -// var2 = Number of particles to spawn. +// var1 = Copy extravalue2 / var1 fraction of target's momentum. +// var2 = unused // void A_SpawnItemDebrisCloud (mobj_t *actor) { INT32 locvar1 = var1; - INT32 locvar2 = var2; - - const fixed_t min_speed = 90 * actor->scale; - const INT16 spacing = (actor->radius / 2) / actor->scale; - - fixed_t fade = FRACUNIT; - fixed_t scale_fade = FRACUNIT; mobj_t *target = actor->target; + player_t *player; - fixed_t speed; - fixed_t scale; + fixed_t kartspeed; + fixed_t fade; - INT32 i; - - if (target == NULL) + if (target == NULL || target->player == NULL) { return; } - if (locvar1) + player = target->player; + kartspeed = K_GetKartSpeed(player, false, false); + + // Scale around >50% top speed + fade = FixedMul(locvar1, (FixedDiv(player->speed, + kartspeed) - FRACUNIT/2) * 2); + + if (fade < 1) { - const UINT8 frame = (actor->frame & FF_FRAMEMASK); - fixed_t frac; - - if (frame == 0) - { - return; // div by zero - } - - // extravalue2 from A_Repeat - frac = fade / frame; - fade = actor->extravalue2 * frac; - scale_fade = fade + frac; + fade = 1; } - speed = Obj_GetItemDebrisSpeed(target, min_speed); - scale = 2 * FixedMul(FixedDiv(speed, min_speed), scale_fade); + if (actor->extravalue2 > fade) + { + actor->extravalue2 = fade; + } + + // MT_ITEM_DEBRIS_CLOUD_SPAWNER + // extravalue2 from A_Repeat + fade = actor->extravalue2 * FRACUNIT / locvar1; // Most of this code is from p_inter.c, MT_ITEMCAPSULE // dust effects - for (i = 0; i < locvar2; i++) { + const INT16 spacing = + (target->radius / 2) / target->scale; + mobj_t *puff = P_SpawnMobjFromMobj( target, P_RandomRange(-spacing, spacing) * FRACUNIT, @@ -14550,12 +14546,15 @@ A_SpawnItemDebrisCloud (mobj_t *actor) puff->color = target->color; puff->colorized = true; - puff->destscale = FixedMul(puff->destscale, scale); - P_SetScale(puff, puff->destscale); - puff->momz = puff->scale * P_MobjFlip(puff); - P_Thrust(puff, R_PointToAngle2(target->x, target->y, puff->x, puff->y), 3 * puff->scale); + P_InitAngle(puff, R_PointToAngle2( + target->x, + target->y, + puff->x, + puff->y)); + + P_Thrust(puff, puff->angle, 3 * puff->scale); puff->momx += FixedMul(target->momx, fade); puff->momy += FixedMul(target->momy, fade); From 7d87f2e1a2fbe467a52fe0d2b90092560857d68b Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Sep 2022 05:42:11 -0700 Subject: [PATCH 22/25] Fix item debris animation WHAT WERE THEY COOKING --- src/info.c | 2 +- src/objects/item-debris.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/info.c b/src/info.c index 84edb3900..861120d23 100644 --- a/src/info.c +++ b/src/info.c @@ -3870,7 +3870,7 @@ state_t states[NUMSTATES] = {SPR_RPOP, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_RANDOMITEMPOP4}, // S_RANDOMITEMPOP3 {SPR_RPOP, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL}, // S_RANDOMITEMPOP4 - {SPR_ITRI, FF_FULLBRIGHT, -1, {NULL}, 19, 1, S_NULL}, // S_ITEM_DEBRIS + {SPR_ITRI, FF_FULLBRIGHT|FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 19, 1, S_NULL}, // S_ITEM_DEBRIS {SPR_NULL, 0, 0, {A_Repeat}, 16, S_ITEM_DEBRIS_CLOUD_SPAWNER2, S_NULL}, // S_ITEM_DEBRIS_CLOUD_SPAWNER1 {SPR_NULL, 0, 7, {A_SpawnItemDebrisCloud}, 20, 0, S_ITEM_DEBRIS_CLOUD_SPAWNER1}, // S_ITEM_DEBRIS_CLOUD_SPAWNER2 diff --git a/src/objects/item-debris.c b/src/objects/item-debris.c index 841650527..941cdc24c 100644 --- a/src/objects/item-debris.c +++ b/src/objects/item-debris.c @@ -52,15 +52,9 @@ spawn_debris mobj_t *debris = P_SpawnMobjFromMobj( config->origin, 0, 0, 0, MT_ITEM_DEBRIS); - const state_t *st = debris->state; - debris_type(debris) = config->type; debris_bouncesleft(debris) = 1; - // Start at a random frame of animation - debris->frame = (debris->frame & ~(FF_FRAMEMASK)) | - P_RandomRange((st->frame & FF_FRAMEMASK), st->var1); - P_InstaThrust(debris, config->angle + angle, config->speed); From 81eb513ef14a5e5b56b6836e9cdd64a371827a1d Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Sep 2022 06:08:00 -0700 Subject: [PATCH 23/25] Fix item pop sfx not playing for eggman boxes and playing TWICE for everything else The former is my bruh and the latter is probably not my brew. --- src/objects/item-debris.c | 4 ++-- src/p_inter.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/objects/item-debris.c b/src/objects/item-debris.c index 941cdc24c..a5ddd5842 100644 --- a/src/objects/item-debris.c +++ b/src/objects/item-debris.c @@ -171,8 +171,8 @@ Obj_SpawnItemDebrisEffects spawn_cloud(collectible, collector, base_speed); - S_StartSound(collectible, sfx_kc2e); - S_StartSound(collectible, sfx_s1c9); + S_StartSound(spawner, sfx_kc2e); + S_StartSound(spawner, sfx_s1c9); } void diff --git a/src/p_inter.c b/src/p_inter.c index 438909980..7898d0b8e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -275,7 +275,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->momx = special->momy = special->momz = 0; P_SetTarget(&special->target, toucher); P_KillMobj(special, toucher, toucher, DMG_NORMAL); - break; + return; case MT_SPHEREBOX: if (!P_CanPickupItem(player, 0)) return; @@ -283,7 +283,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->momx = special->momy = special->momz = 0; P_SetTarget(&special->target, toucher); P_KillMobj(special, toucher, toucher, DMG_NORMAL); - break; + return; case MT_ITEMCAPSULE: if ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0) return; From 7a56e5ade6bff53f2e0a2e7248c7089473c8c4ab Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Sep 2022 06:34:02 -0700 Subject: [PATCH 24/25] Move choose and chooseweighted commands to command.c Fixes disabled under dedicated and it's the appropriate place for these. Effectively cherry pick of 35b82b6dd9 --- src/command.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/console.c | 78 ------------------------------------------------- 2 files changed, 80 insertions(+), 78 deletions(-) diff --git a/src/command.c b/src/command.c index 1439463c1..0145687be 100644 --- a/src/command.c +++ b/src/command.c @@ -36,6 +36,7 @@ #include "d_netfil.h" // findfile #include "r_data.h" // Color_cons_t #include "r_skins.h" +#include "m_random.h" //======== // protos. @@ -53,6 +54,8 @@ static void COM_Wait_f(void); static void COM_Help_f(void); static void COM_Toggle_f(void); static void COM_Add_f(void); +static void COM_Choose_f(void); +static void COM_ChooseWeighted_f(void); static void CV_EnforceExecVersion(void); static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr); @@ -361,6 +364,8 @@ void COM_Init(void) COM_AddCommand("help", COM_Help_f); COM_AddCommand("toggle", COM_Toggle_f); COM_AddCommand("add", COM_Add_f); + COM_AddCommand("choose", COM_Choose_f); + COM_AddCommand("chooseweighted", COM_ChooseWeighted_f); RegisterNetXCmd(XD_NETVAR, Got_NetVar); } @@ -1075,6 +1080,81 @@ static void COM_Add_f(void) CV_AddValue(cvar, atoi(COM_Argv(2))); } +static void COM_Choose_f(void) +{ + size_t na = COM_Argc(); + + if (na < 2) + { + CONS_Printf(M_GetText("choose [] [] [...]: Picks a command at random\n")); + return; + } + + COM_BufAddText(COM_Argv(M_RandomKey(na - 1) + 1)); + COM_BufAddText("\n"); +} + +static void COM_ChooseWeighted_f(void) +{ + size_t na = COM_Argc(); + size_t i, cmd; + const char *commands[40]; + INT32 weights[40]; + INT32 totalWeight = 0; + INT32 roll; + + if (na < 3) + { + CONS_Printf(M_GetText("chooseweighted [ ] [ ] [...]: Picks a command with weighted randomization\n")); + return; + } + + memset(weights, 0, sizeof(weights)); + + i = 1; + cmd = 0; + while (i < na) + { + commands[cmd] = COM_Argv(i); + + i++; + if (i >= na) + { + break; + } + + weights[cmd] = atoi(COM_Argv(i)); + totalWeight += weights[cmd]; + + i++; + cmd++; + } + + if (cmd == 0 || totalWeight <= 0) + { + return; + } + + roll = M_RandomRange(1, totalWeight); + + for (i = 0; i < cmd; i++) + { + if (roll <= weights[i]) + { + if (commands[i] == NULL) + { + break; + } + + COM_BufAddText(commands[i]); + COM_BufAddText("\n"); + break; + } + + roll -= weights[i]; + } +} + // ========================================================================= // VARIABLE SIZE BUFFERS // ========================================================================= diff --git a/src/console.c b/src/console.c index 80174692e..7cbcb85a9 100644 --- a/src/console.c +++ b/src/console.c @@ -34,7 +34,6 @@ #include "k_menu.h" #include "filesrch.h" #include "m_misc.h" -#include "m_random.h" #ifdef _WINDOWS #include "win32/win_main.h" @@ -244,81 +243,6 @@ static void CONS_Bind_f(void) bindtable[key] = Z_StrDup(COM_Argv(2)); } -static void CONS_Choose_f(void) -{ - size_t na = COM_Argc(); - - if (na < 2) - { - CONS_Printf(M_GetText("choose [] [] [...]: Picks a command at random\n")); - return; - } - - COM_BufAddText(COM_Argv(M_RandomKey(na - 1) + 1)); - COM_BufAddText("\n"); -} - -static void CONS_ChooseWeighted_f(void) -{ - size_t na = COM_Argc(); - size_t i, cmd; - const char *commands[40]; - INT32 weights[40]; - INT32 totalWeight = 0; - INT32 roll; - - if (na < 3) - { - CONS_Printf(M_GetText("chooseweighted [ ] [ ] [...]: Picks a command with weighted randomization\n")); - return; - } - - memset(weights, 0, sizeof(weights)); - - i = 1; - cmd = 0; - while (i < na) - { - commands[cmd] = COM_Argv(i); - - i++; - if (i >= na) - { - break; - } - - weights[cmd] = atoi(COM_Argv(i)); - totalWeight += weights[cmd]; - - i++; - cmd++; - } - - if (cmd == 0 || totalWeight <= 0) - { - return; - } - - roll = M_RandomRange(1, totalWeight); - - for (i = 0; i < cmd; i++) - { - if (roll <= weights[i]) - { - if (commands[i] == NULL) - { - break; - } - - COM_BufAddText(commands[i]); - COM_BufAddText("\n"); - break; - } - - roll -= weights[i]; - } -} - //====================================================================== // CONSOLE SETUP //====================================================================== @@ -521,8 +445,6 @@ void CON_Init(void) CV_RegisterVar(&cons_backpic); CV_RegisterVar(&cons_backcolor); COM_AddCommand("bind", CONS_Bind_f); - COM_AddCommand("choose", CONS_Choose_f); - COM_AddCommand("chooseweighted", CONS_ChooseWeighted_f); } else { From e7b0e223e1862ad10edd0300c9f45ac4c98039e3 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 20 Sep 2022 10:36:32 -0700 Subject: [PATCH 25/25] Fix respawning item boxes with P_RespawnBattlesBoxes --- src/info.c | 2 +- src/p_enemy.c | 6 ++++++ src/p_inter.c | 39 +++++++++++++++++++++++---------------- src/p_mobj.c | 24 +++++------------------- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/info.c b/src/info.c index 861120d23..c1136d43d 100644 --- a/src/info.c +++ b/src/info.c @@ -22550,7 +22550,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MT_RANDOMITEMPOP, // damage sfx_None, // activesound MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags - S_NULL // raisestate + S_RANDOMITEM1 // raisestate }, { // MT_SPHEREBOX diff --git a/src/p_enemy.c b/src/p_enemy.c index 1a0c31c4b..527dcf0b6 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13199,7 +13199,13 @@ void A_ItemPop(mobj_t *actor) // Here at mapload in battle? if ((gametyperules & GTR_BUMPERS) && (actor->flags2 & MF2_BOSSNOTRAP)) + { numgotboxes++; + + // do not flicker back in just yet, handled by + // P_RespawnBattleBoxes eventually + P_SetMobjState(actor, S_INVISIBLE); + } } void A_JawzChase(mobj_t *actor) diff --git a/src/p_inter.c b/src/p_inter.c index 7898d0b8e..1edf9fcb2 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1037,27 +1037,34 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget { if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM) { - UINT8 i; - P_SetTarget(&target->target, source); - for (i = 0; i < MAXPLAYERS; i++) + if (gametyperules & GTR_BUMPERS) { - if (&players[i] == source->player) - { - continue; - } - - if (playeringame[i] && !players[i].spectator && players[i].lives != 0) - { - break; - } + target->fuse = 2; } - - if (i < MAXPLAYERS) + else { - // Respawn items in multiplayer, don't respawn them when alone - target->fuse = 2*TICRATE + 2; + UINT8 i; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (&players[i] == source->player) + { + continue; + } + + if (playeringame[i] && !players[i].spectator && players[i].lives != 0) + { + break; + } + } + + if (i < MAXPLAYERS) + { + // Respawn items in multiplayer, don't respawn them when alone + target->fuse = 2*TICRATE + 2; + } } } } diff --git a/src/p_mobj.c b/src/p_mobj.c index 1c34a1b1e..1d08d63e9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9229,7 +9229,7 @@ static boolean P_FuseThink(mobj_t *mobj) { ; } - else if ((gametyperules & GTR_BUMPERS) && (mobj->threshold != 70)) + else if ((gametyperules & GTR_BUMPERS) && (mobj->state == &states[S_INVISIBLE])) { break; } @@ -11072,7 +11072,6 @@ void P_RespawnBattleBoxes(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { mobj_t *box; - mobj_t *newmobj; if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; @@ -11081,25 +11080,12 @@ void P_RespawnBattleBoxes(void) if (box->type != MT_RANDOMITEM || (box->flags2 & MF2_DONTRESPAWN) - || box->threshold != 68 - || box->fuse - || ((tic_t)box->cvmem+1 >= leveltime)) + || box->health > 0 + || box->fuse) continue; // only popped items - // Respawn from mapthing if you have one! - if (box->spawnpoint) - { - P_SpawnMapThing(box->spawnpoint); - newmobj = box->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing - } - else - { - newmobj = P_SpawnMobj(box->x, box->y, box->z, box->type); - } - - // Transfer flags2 (strongbox, objectflip, bossnotrap) - newmobj->flags2 = box->flags2; - P_RemoveMobj(box); // make sure they disappear + box->fuse = TICRATE; // flicker back in (A_ItemPop preps this effect) + P_SetMobjState(box, box->info->raisestate); if (numgotboxes > 0) numgotboxes--; // you've restored a box, remove it from the count