mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-20 01:43:50 +00:00
A little more elegance.
This commit is contained in:
parent
d8723c4b7f
commit
7e880d7698
1 changed files with 24 additions and 20 deletions
|
@ -392,6 +392,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
}
|
||||
}
|
||||
|
||||
// Ignore multihits in "ouchie" mode
|
||||
if (special->flags & (MF_ENEMY | MF_BOSS) && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
player = toucher->player;
|
||||
|
||||
if (player)
|
||||
|
@ -399,33 +403,33 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (player->spectator)
|
||||
return;
|
||||
|
||||
// Ignore multihits in "ouchie" mode
|
||||
if (special->flags & (MF_ENEMY | MF_BOSS) && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
// Some hooks may assume that the toucher is a player, so we keep it in here.
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
}
|
||||
|
||||
if (special->type == MT_STEAM && (player || (toucher->flags & MF_PUSHABLE)))
|
||||
if (player || (toucher->flags & MF_PUSHABLE)) // Special area for objects that are interactable by both player AND MF_PUSHABLE.
|
||||
{
|
||||
fixed_t speed = special->info->mass; // conveniently, both fans and gas jets use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(special); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
|
||||
if (special->state != &states[S_STEAM1]) // Only when it bursts
|
||||
return;
|
||||
|
||||
toucher->eflags |= MFE_SPRUNG;
|
||||
toucher->momz = flipval * FixedMul(speed, FixedSqrt(FixedMul(special->scale, toucher->scale))); // scale the speed with both objects' scales, just like with springs!
|
||||
|
||||
if (player)
|
||||
if (special->type == MT_STEAM)
|
||||
{
|
||||
P_ResetPlayer(player);
|
||||
if (player->panim != PA_FALL)
|
||||
P_SetMobjState(toucher, S_PLAY_FALL);
|
||||
}
|
||||
fixed_t speed = special->info->mass; // conveniently, both fans and gas jets use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(special); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
|
||||
return; // Don't collect it!
|
||||
if (special->state != &states[S_STEAM1]) // Only when it bursts
|
||||
return;
|
||||
|
||||
toucher->eflags |= MFE_SPRUNG;
|
||||
toucher->momz = flipval * FixedMul(speed, FixedSqrt(FixedMul(special->scale, toucher->scale))); // scale the speed with both objects' scales, just like with springs!
|
||||
|
||||
if (player)
|
||||
{
|
||||
P_ResetPlayer(player);
|
||||
if (player->panim != PA_FALL)
|
||||
P_SetMobjState(toucher, S_PLAY_FALL);
|
||||
}
|
||||
|
||||
return; // Don't collect it!
|
||||
}
|
||||
}
|
||||
|
||||
if (!player) // Only players can touch stuff!
|
||||
|
|
Loading…
Reference in a new issue