From bec3a6884c24a52a6f51633fdfa246ed08b2d985 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 13 Aug 2018 02:19:53 -0400 Subject: [PATCH] Make anchoring non-specific to Ideya states (now anchor anything!) # Conflicts: # src/p_inter.c --- src/p_inter.c | 42 ++++++++++++++++++------------------------ src/p_mobj.c | 1 + src/p_user.c | 2 ++ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 9639ff078..2b00a7987 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -811,38 +811,32 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { mobj_t *orbittarget = special->target ? special->target : special; mobj_t *hnext = orbittarget->hnext, *anchorpoint = NULL; + mobj_t *mo2; + thinker_t *th; + UINT16 ideyanum = toucher->tracer->health; - if (toucher->tracer->type == MT_GOTEMERALD - && toucher->tracer->state-states >= S_ORBIDYA1 - && toucher->tracer->state-states <= S_ORBIDYA5) + // scan the thinkers to find the corresponding anchorpoint + for (th = thinkercap.next; th != &thinkercap; th = th->next) { - mobj_t *mo2; - thinker_t *th; - UINT16 ideyanum = (toucher->tracer->state-states) - mobjinfo[MT_GOTEMERALD].missilestate; + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; - // scan the thinkers to find the corresponding anchorpoint - for (th = thinkercap.next; th != &thinkercap; th = th->next) + mo2 = (mobj_t *)th; + + if (mo2->type == MT_IDEYAANCHOR) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type == MT_IDEYAANCHOR) + if(mo2->health == ideyanum) { - if(mo2->health == ideyanum) - { - anchorpoint = mo2; - break; - } + anchorpoint = mo2; + break; } } + } - if (anchorpoint) - { - toucher->tracer->flags |= MF_GRENADEBOUNCE; // custom radius factors - toucher->tracer->threshold = 8 << 20; // X factor 0, Y factor 0, Z factor 8 - } + if (anchorpoint) + { + toucher->tracer->flags |= MF_GRENADEBOUNCE; // custom radius factors + toucher->tracer->threshold = 8 << 20; // X factor 0, Y factor 0, Z factor 8 } P_SetTarget(&orbittarget->hnext, toucher->tracer); diff --git a/src/p_mobj.c b/src/p_mobj.c index 235779770..5b142cc6e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9610,6 +9610,7 @@ void P_SpawnPlayer(INT32 playernum) if (p == players) // this is totally the wrong place to do this aaargh. { mobj_t *idya = P_SpawnMobjFromMobj(mobj, 0, 0, mobj->height, MT_GOTEMERALD); + idya->health = 0; // for identification P_SetTarget(&idya->target, mobj); P_SetMobjState(idya, mobjinfo[MT_GOTEMERALD].missilestate); P_SetTarget(&mobj->tracer, idya); diff --git a/src/p_user.c b/src/p_user.c index 8c50b5095..27e26e2c2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6055,6 +6055,7 @@ static void P_DoNiGHTSCapsule(player_t *player) UINT8 em = P_GetNextEmerald(); // Only give it to ONE person, and THAT player has to get to the goal! mobj_t *emmo = P_SpawnMobjFromMobj(player->mo, 0, 0, player->mo->height, MT_GOTEMERALD); + emmo->health = em; // for identification P_SetTarget(&emmo->target, player->mo); P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); P_SetTarget(&player->mo->tracer, emmo); @@ -6081,6 +6082,7 @@ static void P_DoNiGHTSCapsule(player_t *player) }*/ mobj_t *idya = P_SpawnMobjFromMobj(player->mo, 0, 0, player->mo->height, MT_GOTEMERALD); idya->extravalue2 = player->mare/5; + idya->health = player->mare + 1; // for identification P_SetTarget(&idya->target, player->mo); P_SetMobjState(idya, mobjinfo[MT_GOTEMERALD].missilestate + ((player->mare + 1) % 5)); P_SetTarget(&player->mo->tracer, idya);