From 9e1aec42981be691d91926294223850077e0a9ff Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 17 Oct 2023 22:25:47 +0100 Subject: [PATCH] UCRP_RETURNMARKTOSENDER "when cursed with Eggmark, blow up the racer responsible" Just a simple condition. Either it happens or it doesn't. MT_SPBEXPLOSION now tracks whether it was made by KITEM_EGGMAN or KITEM_SPB, too! --- src/d_player.h | 1 + src/deh_soc.c | 3 ++- src/k_kart.c | 4 ++++ src/m_cond.c | 4 ++++ src/m_cond.h | 1 + src/objects/spb.c | 2 ++ src/p_inter.c | 12 ++++++++++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 7084542cb..cde2c9b80 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -414,6 +414,7 @@ struct roundconditions_t boolean spb_neuter; boolean landmine_dunk; boolean hit_midair; + boolean returntosender_mark; UINT8 hittrackhazard[((MAX_LAPS+1)/8) + 1]; diff --git a/src/deh_soc.c b/src/deh_soc.c index e520a73c0..61752866b 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2977,7 +2977,8 @@ static void readcondition(UINT16 set, UINT32 id, char *word2) else if ((offset=0) || fastcmp(params[0], "TRIPWIREHYUU") || (++offset && fastcmp(params[0], "SPBNEUTER")) || (++offset && fastcmp(params[0], "LANDMINEDUNK")) - || (++offset && fastcmp(params[0], "HITMIDAIR"))) + || (++offset && fastcmp(params[0], "HITMIDAIR")) + || (++offset && fastcmp(params[0], "RETURNMARKTOSENDER"))) { //PARAMCHECK(1); ty = UCRP_TRIPWIREHYUU + offset; diff --git a/src/k_kart.c b/src/k_kart.c index 1b2082e2b..ba3deb9bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8410,6 +8410,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) eggsexplode->height = 2 * player->mo->height; K_FlipFromObject(eggsexplode, player->mo); + eggsexplode->threshold = KITEM_EGGMAN; + + P_SetTarget(&eggsexplode->tracer, player->mo); + if (player->eggmanblame >= 0 && player->eggmanblame < MAXPLAYERS && playeringame[player->eggmanblame] diff --git a/src/m_cond.c b/src/m_cond.c index bd41ec9db..a7e8e3c2d 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1619,6 +1619,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) return (player->roundconditions.landmine_dunk); case UCRP_HITMIDAIR: return (player->roundconditions.hit_midair); + case UCRP_RETURNMARKTOSENDER: + return (player->roundconditions.returntosender_mark); case UCRP_TRACKHAZARD: { @@ -2387,6 +2389,8 @@ static const char *M_GetConditionString(condition_t *cn) return "dunk a Landmine on another racer's head"; case UCRP_HITMIDAIR: return "hit another racer with a projectile while you're both in the air"; + case UCRP_RETURNMARKTOSENDER: + return "when cursed with Eggmark, blow up the racer responsible"; case UCRP_TRACKHAZARD: { diff --git a/src/m_cond.h b/src/m_cond.h index 8eaf93430..5914e07f5 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -122,6 +122,7 @@ typedef enum UCRP_SPBNEUTER, // Kill an SPB with Lightning UCRP_LANDMINEDUNK, // huh? you died? that's weird. all i did was try to hug you... UCRP_HITMIDAIR, // Hit another player mid-air with a kartfielditem + UCRP_RETURNMARKTOSENDER, // Hit the player responsible for Eggman Marking you with that explosion UCRP_TRACKHAZARD, // (Don't) get hit by a track hazard (maybe specific lap) diff --git a/src/objects/spb.c b/src/objects/spb.c index 6877918d9..b90da6789 100644 --- a/src/objects/spb.c +++ b/src/objects/spb.c @@ -1025,6 +1025,8 @@ void Obj_SPBExplode(mobj_t *spb) P_SetTarget(&spbExplode->target, spb_owner(spb)); } + spbExplode->threshold = KITEM_SPB; + // Tell the explosion to use alternate knockback. spbExplode->movefactor = ((SPB_CHASETIMESCALE - spb_chasetime(spb)) * SPB_CHASETIMEMUL) / SPB_CHASETIMESCALE; diff --git a/src/p_inter.c b/src/p_inter.c index 04c87f4a1..0f75371cd 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2684,6 +2684,18 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da source->player->roundconditions.hit_midair = true; source->player->roundconditions.checkthisframe = true; } + + if (source == target + && !P_MobjWasRemoved(inflictor) + && inflictor->type == MT_SPBEXPLOSION + && inflictor->threshold == KITEM_EGGMAN + && !P_MobjWasRemoved(inflictor->tracer) + && inflictor->tracer != source + && inflictor->tracer->player) + { + inflictor->tracer->player->roundconditions.returntosender_mark = true; + inflictor->tracer->player->roundconditions.checkthisframe = true; + } } else if (!(inflictor && inflictor->player) && player->laps <= numlaps