From fc789790bb8747e053d2a12d083566c4e5fd4a39 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 14 May 2020 17:28:33 +0200 Subject: [PATCH 1/5] Create a quick P_StartQuake without epicenter/radius support and clean up the grand total of 4 earthquake uses in the code --- src/k_kart.c | 9 +++------ src/lua_baselib.c | 3 +-- src/p_inter.c | 7 ++----- src/p_spec.c | 8 ++++++++ src/p_spec.h | 4 ++++ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2610de1f5..eac5c4bad 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3157,10 +3157,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b K_PlayPainSound(player->mo); if (P_IsDisplayPlayer(player)) - { - quake.intensity = 64*FRACUNIT; - quake.time = 5; - } + P_StartQuake(64<kartstuff[k_instashield] = 15; K_DropItems(player); @@ -5244,7 +5241,7 @@ static void K_MoveHeldObjects(player_t *player) if (cur->type == MT_EGGMANITEM_SHIELD) { // Decided that this should use their "canon" color. - cur->color = SKINCOLOR_BLACK; + cur->color = SKINCOLOR_BLACK; } cur->flags &= ~MF_NOCLIPTHING; @@ -5613,7 +5610,7 @@ static void K_UpdateInvincibilitySounds(player_t *player) { if (player->kartstuff[k_invincibilitytimer] > 0) // Prioritize invincibility sfxnum = sfx_alarmi; - else if (player->kartstuff[k_growshrinktimer] > 0) + else if (player->kartstuff[k_growshrinktimer] > 0) sfxnum = sfx_alarmg; } else diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 421af0238..21342d936 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1518,8 +1518,7 @@ static int lib_pStartQuake(lua_State *L) quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT); // These things are actually used in 2.1. - quake.intensity = q_intensity; - quake.time = q_time; + P_StartQuake(q_intensity, q_time); return 0; } diff --git a/src/p_inter.c b/src/p_inter.c index 56885f56f..8286b6e3d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -638,7 +638,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetTarget(&special->tracer, toucher); toucher->flags |= MF_NOGRAVITY; toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher); - S_StartSound(toucher, sfx_s1b2); + S_StartSound(toucher, sfx_s1b2); return; // ***************************************** // @@ -3192,10 +3192,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da K_KartPainEnergyFling(player); if (P_IsDisplayPlayer(player)) - { - quake.intensity = 32*FRACUNIT; - quake.time = 5; - } + P_StartQuake(32< Date: Thu, 14 May 2020 17:55:33 +0200 Subject: [PATCH 2/5] Make explosions cause earthquakes and initiate flashpals --- src/doomstat.h | 1 + src/g_game.c | 1 + src/k_kart.c | 26 ++++++++++++++++++++++++++ src/p_tick.c | 3 +++ 4 files changed, 31 insertions(+) diff --git a/src/doomstat.h b/src/doomstat.h index 9971fdfc5..cffecce9a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -513,6 +513,7 @@ extern tic_t mapreset; extern boolean thwompsactive; extern SINT8 spbplace; +extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :) extern boolean legitimateexit; extern boolean comebackshowninfo; extern tic_t curlap, bestlap; diff --git a/src/g_game.c b/src/g_game.c index 11cc2fbe8..4eafb9103 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -288,6 +288,7 @@ boolean thwompsactive; // Thwomps activate on lap 2 SINT8 spbplace; // SPB exists, give the person behind better items // Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players) +tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures. boolean legitimateexit; // Did this client actually finish the match? boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message? tic_t curlap; // Current lap time diff --git a/src/k_kart.c b/src/k_kart.c index eac5c4bad..e8b126e43 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3321,6 +3321,8 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 } } +#define MINEQUAKEDIST 4096 + // Spawns the purely visual explosion void K_SpawnMineExplosion(mobj_t *source, UINT8 color) { @@ -3329,6 +3331,28 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) mobj_t *dust; mobj_t *truc; INT32 speed, speed2; + INT32 pnum; + player_t *p; + + // check for potential display players near the source so we can have a sick earthquake / flashpal. + for (pnum = 0; pnum < MAXPLAYERS; pnum++) + { + p = &players[pnum]; + + if (!playeringame[pnum] || !P_IsDisplayPlayer(p)) + continue; + + if (R_PointToDist2(p->mo->x, p->mo->y, source->x, source->y) < mapobjectscale*MINEQUAKEDIST) + { + P_StartQuake(55<mo, source)) + { + bombflashtimer = TICRATE*5; + P_FlashPal(p, 1, 1); + } + break; // we can break right now because quakes are global to all split players somehow. + } + } K_MatchGenericExtraFlags(smoldering, source); smoldering->tics = TICRATE*3; @@ -3399,6 +3423,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) } } +#undef MINEQUAKEDIST + static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, INT32 flags2, fixed_t speed) { mobj_t *th; diff --git a/src/p_tick.c b/src/p_tick.c index 385985c34..d57a6dc43 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -722,6 +722,9 @@ void P_Ticker(boolean run) K_CalculateBattleWanted(); } + if (bombflashtimer) + bombflashtimer--; // Bomb seizure prevention + if (quake.time) { fixed_t ir = quake.intensity>>1; From 6aa6521fb45960a92f1d109f6cbf166edbf91415 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 18 May 2020 14:52:26 -0400 Subject: [PATCH 3/5] Allow spectators through Block Players lines --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a6306bb19..fec884f66 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1941,7 +1941,7 @@ static boolean PIT_CheckLine(line_t *ld) { if (ld->flags & ML_IMPASSABLE) // block objects from moving through this linedef. return false; - if (tmthing->player && ld->flags & ML_BLOCKPLAYERS) + if (tmthing->player && !tmthing->player->spectator && ld->flags & ML_BLOCKPLAYERS) return false; // SRB2Kart: Only block players, not items } @@ -3307,7 +3307,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (li->flags & ML_IMPASSABLE) goto isblocking; - if (slidemo->player && li->flags & ML_BLOCKPLAYERS) + if (slidemo->player && !slidemo->player->spectator && li->flags & ML_BLOCKPLAYERS) goto isblocking; } From 8b0aa9e3333bffb98db4066d26144a43582aeb8a Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 20 May 2020 14:21:50 +0200 Subject: [PATCH 4/5] Change flash cooldown from 5 to 2 seconds --- 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 e8b126e43..673c66822 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3347,7 +3347,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) P_StartQuake(55<mo, source)) { - bombflashtimer = TICRATE*5; + bombflashtimer = TICRATE*2; P_FlashPal(p, 1, 1); } break; // we can break right now because quakes are global to all split players somehow. From f5b570da399d51ae251f86e515caf11147ea2899 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 23 May 2020 16:08:51 +0100 Subject: [PATCH 5/5] Set this variable after making sure the target and player exist. --- src/p_mobj.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a224d5b58..6aaf6b414 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8728,7 +8728,7 @@ void P_MobjThinker(mobj_t *mobj) fixed_t destx, desty; statenum_t curstate; statenum_t underlayst = S_NULL; - INT32 flamemax = mobj->target->player->kartstuff[k_flamelength] * flameseg; + INT32 flamemax = 0; if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->kartstuff[k_curshield] != KSHIELD_FLAME) @@ -8736,6 +8736,9 @@ void P_MobjThinker(mobj_t *mobj) P_RemoveMobj(mobj); return; } + + flamemax = mobj->target->player->kartstuff[k_flamelength] * flameseg; + P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2)); curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); @@ -8815,7 +8818,7 @@ void P_MobjThinker(mobj_t *mobj) if (curstate >= S_FLAMESHIELD1 && curstate < S_FLAMESHIELDDASH1 && ((curstate-S_FLAMESHIELD1) & 1)) viewingangle += ANGLE_180; - + destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4); desty = mobj->target->y + P_ReturnThrustY(mobj->target, viewingangle, mobj->scale>>4); }