From 91955b1383227886eed5404f885225a28b41667a Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 23 Sep 2023 06:22:47 -0400 Subject: [PATCH] Broly screen shake is done on the source object Screen shake was being done from the Broly vfx, which does scaling shenanigans so it caused Proximity Mine explosions to make the camera go apeshit. I'm also pretty sure the hitlag calcs Proximity Mine did for the broly effect was wrong, not sure though? I'm trying something else and I think it's better. --- src/k_collide.cpp | 14 ++++++-------- src/k_kart.c | 7 +++++++ src/objects/broly.c | 2 ++ src/p_enemy.c | 3 +-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/k_collide.cpp b/src/k_collide.cpp index b897873a8..0d1d46348 100644 --- a/src/k_collide.cpp +++ b/src/k_collide.cpp @@ -305,7 +305,7 @@ static inline BlockItReturn_t PIT_SSMineExplode(mobj_t *thing) lagadded = (thing->hitlag - oldhitlag); - if (lagadded > 0) + if (lagadded > minehitlag) { minehitlag = lagadded; } @@ -337,19 +337,17 @@ tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin) // Set this flag to ensure that the inital action won't be triggered twice. actor->flags2 |= MF2_DEBRIS; + if (minehitlag == 0) + { + minehitlag = actor->hitlag; + } + // Set this flag to ensure the hitbox timer doesn't get extended with every player hit actor->flags |= MF_NOHITLAGFORME; actor->hitlag = 0; // same deal if (!spin) { - if (minehitlag == 0) - { - minehitlag = actor->hitlag; - } - - Obj_SpawnBrolyKi(actor, minehitlag); - return minehitlag; } diff --git a/src/k_kart.c b/src/k_kart.c index c4c48c630..4afe202ff 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4499,6 +4499,11 @@ void K_MineFlashScreen(mobj_t *source) INT32 pnum; player_t *p; + if (P_MobjWasRemoved(source)) + { + return; + } + S_StartSound(source, sfx_s3k4e); P_StartQuakeFromMobj(12, 55 * source->scale, MINEQUAKEDIST * source->scale, source); @@ -4608,6 +4613,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color, tic_t delay) truc->hitlag += delay; truc->renderflags |= RF_DONTDRAW; } + + Obj_SpawnBrolyKi(source, delay); } #undef MINEQUAKEDIST diff --git a/src/objects/broly.c b/src/objects/broly.c index d8e2c8ffd..f67847ad1 100644 --- a/src/objects/broly.c +++ b/src/objects/broly.c @@ -37,6 +37,8 @@ Obj_SpawnBrolyKi x = P_SpawnMobjFromMobj( source, 0, 0, 0, MT_BROLY); + P_SetTarget(&x->target, source); + // Shrink into center of source object. x->z = (source->z + source->height / 2); diff --git a/src/p_enemy.c b/src/p_enemy.c index b8bedfc5e..31f43f371 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13063,12 +13063,11 @@ void A_SSMineExplode(mobj_t *actor) void A_SSMineFlash(mobj_t *actor) { - K_MineFlashScreen(actor); + K_MineFlashScreen(actor->target); } void A_LandMineExplode(mobj_t *actor) { - mobj_t *expl; INT32 colour = SKINCOLOR_KETCHUP; // we spell words properly here INT32 i;