mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-07 08:52:01 +00:00
Merge branch 'issue1195' into 'next'
Issue #1195 - Standing at a corner under steam, but far away enough to not be... See merge request STJr/SRB2!2318
This commit is contained in:
commit
dedd80a0f0
4 changed files with 74 additions and 56 deletions
|
@ -7493,12 +7493,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||||
sfx_steam1, // deathsound
|
sfx_steam1, // deathsound
|
||||||
0, // speed
|
0, // speed
|
||||||
32*FRACUNIT, // radius
|
32*FRACUNIT, // radius
|
||||||
1*FRACUNIT, // height
|
16*FRACUNIT, // height
|
||||||
0, // display offset
|
0, // display offset
|
||||||
20*FRACUNIT, // mass
|
20*FRACUNIT, // mass
|
||||||
0, // damage
|
0, // damage
|
||||||
sfx_None, // activesound
|
sfx_None, // activesound
|
||||||
MF_SOLID, // flags
|
MF_SPECIAL, // flags
|
||||||
S_NULL // raisestate
|
S_NULL // raisestate
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -5194,7 +5194,7 @@ void A_SetSolidSteam(mobj_t *actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actor->flags &= ~MF_NOCLIP;
|
actor->flags &= ~MF_NOCLIP;
|
||||||
actor->flags |= MF_SOLID;
|
actor->flags |= MF_SPECIAL;
|
||||||
if (!(actor->flags2 & MF2_AMBUSH))
|
if (!(actor->flags2 & MF2_AMBUSH))
|
||||||
{
|
{
|
||||||
if (P_RandomChance(FRACUNIT/8))
|
if (P_RandomChance(FRACUNIT/8))
|
||||||
|
@ -5224,7 +5224,7 @@ void A_UnsetSolidSteam(mobj_t *actor)
|
||||||
if (LUA_CallAction(A_UNSETSOLIDSTEAM, actor))
|
if (LUA_CallAction(A_UNSETSOLIDSTEAM, actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actor->flags &= ~MF_SOLID;
|
actor->flags &= ~MF_SPECIAL;
|
||||||
actor->flags |= MF_NOCLIP;
|
actor->flags |= MF_NOCLIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,18 +392,51 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player = toucher->player;
|
|
||||||
I_Assert(player != NULL); // Only players can touch stuff!
|
|
||||||
|
|
||||||
if (player->spectator)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Ignore multihits in "ouchie" mode
|
// Ignore multihits in "ouchie" mode
|
||||||
if (special->flags & (MF_ENEMY | MF_BOSS) && special->flags2 & MF2_FRET)
|
if (special->flags & (MF_ENEMY | MF_BOSS) && special->flags2 & MF2_FRET)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
player = toucher->player;
|
||||||
|
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
if (player->spectator)
|
||||||
|
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))
|
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player || (toucher->flags & MF_PUSHABLE)) // Special area for objects that are interactable by both player AND MF_PUSHABLE.
|
||||||
|
{
|
||||||
|
if (special->type == MT_STEAM)
|
||||||
|
{
|
||||||
|
if (player && player->mo->state == &states[player->mo->info->painstate]) // can't use gas jets when player is in pain!
|
||||||
|
return;
|
||||||
|
|
||||||
|
fixed_t speed = special->info->mass; // 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)
|
||||||
|
{
|
||||||
|
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!
|
||||||
|
return;
|
||||||
|
|
||||||
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
|
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
|
||||||
elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)
|
elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)
|
||||||
|
@ -1881,6 +1914,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
toucher->tracer->flags2 = (toucher->tracer->flags2 & ~MF2_AMBUSH) | destambush;
|
toucher->tracer->flags2 = (toucher->tracer->flags2 & ~MF2_AMBUSH) | destambush;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default: // SOC or script pickup
|
default: // SOC or script pickup
|
||||||
if (player->bot && player->bot != BOT_MPAI)
|
if (player->bot && player->bot != BOT_MPAI)
|
||||||
return;
|
return;
|
||||||
|
|
72
src/p_map.c
72
src/p_map.c
|
@ -502,72 +502,56 @@ springstate:
|
||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
static void P_DoFan(mobj_t *fan, mobj_t *object)
|
||||||
{
|
{
|
||||||
player_t *p = object->player; // will be NULL if not a player
|
player_t *p = object->player; // will be NULL if not a player
|
||||||
fixed_t zdist; // distance between bottoms
|
fixed_t zdist; // distance between bottoms
|
||||||
fixed_t speed = spring->info->mass; // conveniently, both fans and gas jets use this for the vertical thrust
|
fixed_t speed = fan->info->mass; // fans use this for the vertical thrust
|
||||||
SINT8 flipval = P_MobjFlip(spring); // virtually everything here centers around the thruster's gravity, not the object's!
|
SINT8 flipval = P_MobjFlip(fan); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||||
|
|
||||||
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
if (p && object->state == &states[object->info->painstate]) // can't use fans when player is in pain!
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// is object's top below thruster's position? if not, calculate distance between their bottoms
|
// is object's top below thruster's position? if not, calculate distance between their bottoms
|
||||||
if (spring->eflags & MFE_VERTICALFLIP)
|
if (fan->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (object->z > spring->z + spring->height)
|
if (object->z > fan->z + fan->height)
|
||||||
return;
|
return;
|
||||||
zdist = (spring->z + spring->height) - (object->z + object->height);
|
zdist = (fan->z + fan->height) - (object->z + object->height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (object->z + object->height < spring->z)
|
if (object->z + object->height < fan->z)
|
||||||
return;
|
return;
|
||||||
zdist = object->z - spring->z;
|
zdist = object->z - fan->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||||
|
|
||||||
switch (spring->type)
|
switch (fan->type)
|
||||||
{
|
{
|
||||||
case MT_FAN: // fan
|
case MT_FAN: // fan
|
||||||
if (zdist > (spring->health << FRACBITS)) // max z distance determined by health (set by map thing args[0])
|
if (zdist > (fan->health << FRACBITS)) // max z distance determined by health (set by map thing args[0])
|
||||||
break;
|
break;
|
||||||
if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother
|
if (flipval*object->momz >= FixedMul(speed, fan->scale)) // if object's already moving faster than your best, don't bother
|
||||||
break;
|
break;
|
||||||
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||||
break;
|
break;
|
||||||
|
|
||||||
object->momz += flipval*FixedMul(speed/4, spring->scale);
|
object->momz += flipval*FixedMul(speed/4, fan->scale);
|
||||||
|
|
||||||
// limit the speed if too high
|
// limit the speed if too high
|
||||||
if (flipval*object->momz > FixedMul(speed, spring->scale))
|
if (flipval*object->momz > FixedMul(speed, fan->scale))
|
||||||
object->momz = flipval*FixedMul(speed, spring->scale);
|
object->momz = flipval*FixedMul(speed, fan->scale);
|
||||||
|
|
||||||
if (p && !p->powers[pw_tailsfly] && !p->powers[pw_carry]) // doesn't reset anim for Tails' flight
|
if (p && !p->powers[pw_tailsfly] && !p->powers[pw_carry]) // doesn't reset anim for Tails' flight
|
||||||
{
|
{
|
||||||
P_ResetPlayer(p);
|
P_ResetPlayer(p);
|
||||||
P_SetMobjState(object, S_PLAY_FALL);
|
P_SetMobjState(object, S_PLAY_FALL);
|
||||||
P_SetTarget(&object->tracer, spring);
|
P_SetTarget(&object->tracer, fan);
|
||||||
p->powers[pw_carry] = CR_FAN;
|
p->powers[pw_carry] = CR_FAN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MT_STEAM: // Steam
|
|
||||||
if (zdist > FixedMul(16*FRACUNIT, spring->scale))
|
|
||||||
break;
|
|
||||||
if (spring->state != &states[S_STEAM1]) // Only when it bursts
|
|
||||||
break;
|
|
||||||
|
|
||||||
object->eflags |= MFE_SPRUNG;
|
|
||||||
object->momz = flipval*FixedMul(speed, FixedSqrt(FixedMul(spring->scale, object->scale))); // scale the speed with both objects' scales, just like with springs!
|
|
||||||
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
P_ResetPlayer(p);
|
|
||||||
if (p->panim != PA_FALL)
|
|
||||||
P_SetMobjState(object, S_PLAY_FALL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1484,13 +1468,13 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for special pickup
|
// check for special pickup
|
||||||
if (thing->flags & MF_SPECIAL && tmthing->player)
|
if (thing->flags & MF_SPECIAL)
|
||||||
{
|
{
|
||||||
P_TouchSpecialThing(thing, tmthing, true); // can remove thing
|
P_TouchSpecialThing(thing, tmthing, true); // can remove thing
|
||||||
return CHECKTHING_COLLIDE;
|
return CHECKTHING_COLLIDE;
|
||||||
}
|
}
|
||||||
// check again for special pickup
|
// check again for special pickup
|
||||||
if (tmthing->flags & MF_SPECIAL && thing->player)
|
if (tmthing->flags & MF_SPECIAL)
|
||||||
{
|
{
|
||||||
P_TouchSpecialThing(tmthing, thing, true); // can remove thing
|
P_TouchSpecialThing(tmthing, thing, true); // can remove thing
|
||||||
return CHECKTHING_COLLIDE;
|
return CHECKTHING_COLLIDE;
|
||||||
|
@ -1578,15 +1562,15 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
||||||
|
|
||||||
if (thing->flags & MF_PUSHABLE)
|
if (thing->flags & MF_PUSHABLE)
|
||||||
{
|
{
|
||||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
if (tmthing->type == MT_FAN)
|
||||||
P_DoFanAndGasJet(tmthing, thing);
|
P_DoFan(tmthing, thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmthing->flags & MF_PUSHABLE)
|
if (tmthing->flags & MF_PUSHABLE)
|
||||||
{
|
{
|
||||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
if (thing->type == MT_FAN)
|
||||||
{
|
{
|
||||||
P_DoFanAndGasJet(thing, tmthing);
|
P_DoFan(thing, tmthing);
|
||||||
return CHECKTHING_COLLIDE;
|
return CHECKTHING_COLLIDE;
|
||||||
}
|
}
|
||||||
else if (thing->flags & MF_SPRING)
|
else if (thing->flags & MF_SPRING)
|
||||||
|
@ -1679,8 +1663,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
if (tmthing->type == MT_FAN)
|
||||||
P_DoFanAndGasJet(tmthing, thing);
|
P_DoFan(tmthing, thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmthing->player) // Is the moving/interacting object the player?
|
if (tmthing->player) // Is the moving/interacting object the player?
|
||||||
|
@ -1688,8 +1672,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
||||||
if (!tmthing->health)
|
if (!tmthing->health)
|
||||||
return CHECKTHING_IGNORE;
|
return CHECKTHING_IGNORE;
|
||||||
|
|
||||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
if (thing->type == MT_FAN)
|
||||||
P_DoFanAndGasJet(thing, tmthing);
|
P_DoFan(thing, tmthing);
|
||||||
else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART)
|
else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART)
|
||||||
{
|
{
|
||||||
if ( thing->z <= tmthing->z + tmthing->height
|
if ( thing->z <= tmthing->z + tmthing->height
|
||||||
|
@ -1755,8 +1739,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
||||||
// not solid not blocked
|
// not solid not blocked
|
||||||
unsigned collide = CHECKTHING_NOCOLLIDE;
|
unsigned collide = CHECKTHING_NOCOLLIDE;
|
||||||
|
|
||||||
if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player))
|
if ((tmthing->flags & MF_SPRING || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player))
|
||||||
; // springs, gas jets and springs should never be able to step up onto a player
|
; // springs and spikes should never be able to step up onto a player
|
||||||
// z checking at last
|
// z checking at last
|
||||||
// Treat noclip things as non-solid!
|
// Treat noclip things as non-solid!
|
||||||
else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID
|
else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID
|
||||||
|
|
Loading…
Reference in a new issue