mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
Add A_GenericBumper, hardcoded generic version of some bumper object scripts
This commit is contained in:
parent
1cdf381aba
commit
29234d8f20
4 changed files with 68 additions and 1 deletions
|
|
@ -297,6 +297,7 @@ actionpointer_t actionpointers[] =
|
|||
{{A_MakeSSCandle}, "A_MAKESSCANDLE"},
|
||||
{{A_HologramRandomTranslucency}, "A_HOLOGRAMRANDOMTRANSLUCENCY"},
|
||||
{{A_SSChainShatter}, "A_SSCHAINSHATTER"},
|
||||
{{A_GenericBumper}, "A_GENERICBUMPER"},
|
||||
|
||||
{{NULL}, "NONE"},
|
||||
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ enum actionnum
|
|||
A_MAKESSCANDLE,
|
||||
A_HOLOGRAMRANDOMTRANSLUCENCY,
|
||||
A_SSCHAINSHATTER,
|
||||
A_GENERICBUMPER,
|
||||
NUMACTIONS
|
||||
};
|
||||
|
||||
|
|
@ -557,6 +558,7 @@ void A_BlendEyePuyoHack();
|
|||
void A_MakeSSCandle();
|
||||
void A_HologramRandomTranslucency();
|
||||
void A_SSChainShatter();
|
||||
void A_GenericBumper();
|
||||
|
||||
extern boolean actionsoverridden[NUMACTIONS];
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ void A_BlendEyePuyoHack(mobj_t *actor);
|
|||
void A_MakeSSCandle(mobj_t *actor);
|
||||
void A_HologramRandomTranslucency(mobj_t *actor);
|
||||
void A_SSChainShatter(mobj_t *actor);
|
||||
void A_GenericBumper(mobj_t *actor);
|
||||
|
||||
//for p_enemy.c
|
||||
|
||||
|
|
@ -12668,3 +12669,54 @@ void A_SSChainShatter(mobj_t* actor)
|
|||
|
||||
actor->fuse = 1;
|
||||
}
|
||||
|
||||
// var1 = If -1, triggered by collision event
|
||||
// var2 = Strength value
|
||||
//
|
||||
// mobjinfo dependencies:
|
||||
// - deathsound - bumper noise
|
||||
// - seestate - bumper flashing state
|
||||
//
|
||||
void A_GenericBumper(mobj_t* actor)
|
||||
{
|
||||
if (var1 != -1)
|
||||
return;
|
||||
|
||||
mobj_t *other = actor->target;
|
||||
|
||||
if (!other)
|
||||
return;
|
||||
|
||||
// This code was ported from Lua
|
||||
// Original was Balloon Park's bumpers?
|
||||
INT32 hang = R_PointToAngle2(
|
||||
actor->x, actor->y,
|
||||
other->x, other->y
|
||||
);
|
||||
|
||||
INT32 vang = 0;
|
||||
|
||||
if (!P_IsObjectOnGround(other))
|
||||
{
|
||||
vang = R_PointToAngle2(
|
||||
FixedHypot(actor->x, actor->y), actor->z + (actor->height / 2),
|
||||
FixedHypot(other->x, other->y), other->z + (other->height / 2)
|
||||
);
|
||||
}
|
||||
|
||||
INT32 baseStrength = abs(astate->var2);
|
||||
fixed_t strength = (baseStrength * actor->scale) / 2;
|
||||
|
||||
other->momx = FixedMul(FixedMul(strength, FCOS(hang)), abs(FCOS(vang)));
|
||||
other->momy = FixedMul(FixedMul(strength, FSIN(hang)), abs(FCOS(vang)));
|
||||
other->momz = FixedMul(strength, FSIN(vang));
|
||||
|
||||
if (other->player)
|
||||
K_SetTireGrease(other->player, max(other->player->tiregrease, 2*TICRATE));
|
||||
|
||||
if (actor->state != &states[actor->info->seestate])
|
||||
{
|
||||
S_StartSound(actor, actor->info->deathsound);
|
||||
P_SetMobjState(actor, actor->info->seestate);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
src/p_map.c
14
src/p_map.c
|
|
@ -1552,7 +1552,19 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
if (!K_PuntCollide(thing, g_tm.thing))
|
||||
{
|
||||
K_KartSolidBounce(g_tm.thing, thing);
|
||||
state_t *st = &states[thing->info->spawnstate];
|
||||
|
||||
if (st->action.acp1 == A_GenericBumper)
|
||||
{
|
||||
P_SetTarget(&thing->target, g_tm.thing);
|
||||
|
||||
var1 = -1;
|
||||
var2 = 0;
|
||||
astate = st;
|
||||
st->action.acp1(thing);
|
||||
}
|
||||
else
|
||||
K_KartSolidBounce(g_tm.thing, thing);
|
||||
}
|
||||
return BMIT_CONTINUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue