mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Anchor Ideya logic
# Conflicts: # src/p_enemy.c # src/p_inter.c
This commit is contained in:
parent
d3a6688601
commit
ef9a03b021
2 changed files with 68 additions and 10 deletions
|
|
@ -8543,21 +8543,42 @@ void A_ToggleFlameJet(mobj_t* actor)
|
||||||
//
|
//
|
||||||
// var1 = Angle adjustment (aka orbit speed)
|
// var1 = Angle adjustment (aka orbit speed)
|
||||||
// var2:
|
// var2:
|
||||||
// Lower 16 bits: height offset
|
// Bits 1-10: height offset, max 1023
|
||||||
|
// Bits 11-16: X radius factor (max 63, default 20)
|
||||||
// Bit 17: set if object is Nightopian Helper
|
// Bit 17: set if object is Nightopian Helper
|
||||||
// Bit 18: Unused
|
// Bit 18: set to define X/Y/Z rotation factor
|
||||||
// Bit 19: set to not sync scale to player
|
// Bits 19-20: Unused
|
||||||
|
// Bits 21-26: Y radius factor (max 63, default 32)
|
||||||
|
// Bits 27-32: Z radius factor (max 63, default 32)
|
||||||
//
|
//
|
||||||
|
// If MF_GRENADEBOUNCE is flagged on mobj, use actor->threshold to define X/Y/Z radius factor, max 1023 each:
|
||||||
|
// Bits 1-10: X factor
|
||||||
|
// Bits 11-20: Y factor
|
||||||
|
// Bits 21-30: Z factor
|
||||||
void A_OrbitNights(mobj_t* actor)
|
void A_OrbitNights(mobj_t* actor)
|
||||||
{
|
{
|
||||||
INT32 ofs = (var2 & 0xFFFF);
|
INT32 ofs = (var2 & 0x3FF);
|
||||||
boolean ishelper = (var2 & 0x10000);
|
boolean ishelper = (var2 & 0x10000);
|
||||||
boolean donotrescale = (var2 & 0x40000);
|
boolean donotrescale = (var2 & 0x40000);
|
||||||
|
INT32 xfactor = 32, yfactor = 32, zfactor = 20;
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_CallAction("A_OrbitNights", actor))
|
if (LUA_CallAction("A_OrbitNights", actor))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (actor->flags & MF_GRENADEBOUNCE)
|
||||||
|
{
|
||||||
|
xfactor = (actor->threshold & 0x3FF);
|
||||||
|
yfactor = (actor->threshold & 0xFFC00) >> 10;
|
||||||
|
zfactor = (actor->threshold & 0x3FF00000) >> 20;
|
||||||
|
}
|
||||||
|
else if (var2 & 0x20000)
|
||||||
|
{
|
||||||
|
xfactor = (var2 & 0xFC00) >> 10;
|
||||||
|
yfactor = (var2 & 0x3F00000) >> 20;
|
||||||
|
zfactor = (var2 & 0xFC000000) >> 26;
|
||||||
|
}
|
||||||
|
|
||||||
if (!actor->target
|
if (!actor->target
|
||||||
|| (actor->target->player &&
|
|| (actor->target->player &&
|
||||||
// if NiGHTS special stage and not NiGHTSmode.
|
// if NiGHTS special stage and not NiGHTSmode.
|
||||||
|
|
@ -8576,9 +8597,9 @@ void A_OrbitNights(mobj_t* actor)
|
||||||
const angle_t fa = (angle_t)actor->extravalue1 >> ANGLETOFINESHIFT;
|
const angle_t fa = (angle_t)actor->extravalue1 >> ANGLETOFINESHIFT;
|
||||||
const angle_t ofa = ((angle_t)actor->extravalue1 + (ofs*ANG1)) >> ANGLETOFINESHIFT;
|
const angle_t ofa = ((angle_t)actor->extravalue1 + (ofs*ANG1)) >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
const fixed_t fc = FixedMul(FINECOSINE(fa),FixedMul(32*FRACUNIT, actor->scale));
|
const fixed_t fc = FixedMul(FINECOSINE(fa),FixedMul(xfactor*FRACUNIT, actor->scale));
|
||||||
const fixed_t fh = FixedMul(FINECOSINE(ofa),FixedMul(20*FRACUNIT, actor->scale));
|
const fixed_t fh = FixedMul(FINECOSINE(ofa),FixedMul(zfactor*FRACUNIT, actor->scale));
|
||||||
const fixed_t fs = FixedMul(FINESINE(fa),FixedMul(32*FRACUNIT, actor->scale));
|
const fixed_t fs = FixedMul(FINESINE(fa),FixedMul(yfactor*FRACUNIT, actor->scale));
|
||||||
|
|
||||||
actor->x = actor->target->x + fc;
|
actor->x = actor->target->x + fc;
|
||||||
actor->y = actor->target->y + fs;
|
actor->y = actor->target->y + fs;
|
||||||
|
|
|
||||||
|
|
@ -797,14 +797,47 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
P_NightserizePlayer(player, special->health); // Transform!
|
P_NightserizePlayer(player, special->health); // Transform!
|
||||||
if (!spec)
|
if (!spec)
|
||||||
{
|
{
|
||||||
if (toucher->tracer) // Move the ideya over to the drone!
|
if (toucher->tracer) // Move the ideya!
|
||||||
{
|
{
|
||||||
mobj_t *orbittarget = special->target ? special->target : special;
|
mobj_t *orbittarget = special->target ? special->target : special;
|
||||||
mobj_t *hnext = orbittarget->hnext;
|
mobj_t *hnext = orbittarget->hnext, *anchorpoint = NULL;
|
||||||
|
|
||||||
|
if (toucher->tracer->type == MT_GOTEMERALD
|
||||||
|
&& toucher->tracer->state-states >= S_ORBIDYA1
|
||||||
|
&& toucher->tracer->state-states <= S_ORBIDYA5)
|
||||||
|
{
|
||||||
|
mobj_t *mo2;
|
||||||
|
thinker_t *th;
|
||||||
|
UINT16 ideyanum = (toucher->tracer->state-states) - mobjinfo[MT_GOTEMERALD].missilestate;
|
||||||
|
|
||||||
|
// scan the thinkers to find the corresponding anchorpoint
|
||||||
|
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||||
|
{
|
||||||
|
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mo2 = (mobj_t *)th;
|
||||||
|
|
||||||
|
if (mo2->type == MT_IDEYAANCHOR)
|
||||||
|
{
|
||||||
|
if(mo2->health == ideyanum)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
P_SetTarget(&orbittarget->hnext, toucher->tracer);
|
P_SetTarget(&orbittarget->hnext, toucher->tracer);
|
||||||
P_SetTarget(&orbittarget->hnext->hnext, hnext); // Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
|
P_SetTarget(&orbittarget->hnext->hnext, hnext); // Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
|
||||||
P_SetTarget(&orbittarget->hnext->target, orbittarget); // goalpost
|
P_SetTarget(&orbittarget->hnext->target, anchorpoint ? anchorpoint : orbittarget); // goalpost
|
||||||
P_SetTarget(&toucher->tracer, NULL);
|
P_SetTarget(&toucher->tracer, NULL);
|
||||||
|
|
||||||
if (hnext)
|
if (hnext)
|
||||||
|
|
@ -818,7 +851,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
{
|
{
|
||||||
mobj_t *hnext = special->target ? special->target : special; // goalpost
|
mobj_t *hnext = special->target ? special->target : special; // goalpost
|
||||||
while ((hnext = hnext->hnext))
|
while ((hnext = hnext->hnext))
|
||||||
|
{
|
||||||
|
hnext->flags &= ~MF_GRENADEBOUNCE;
|
||||||
|
hnext->threshold = 0;
|
||||||
P_SetTarget(&hnext->target, toucher);
|
P_SetTarget(&hnext->target, toucher);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue