mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 12:31:32 +00:00
Change gas jets to work w/o P_DoFanAndGasJet. (and rename it to P_DoFan)
This commit is contained in:
parent
9a242818a7
commit
14c305f55a
2 changed files with 32 additions and 54 deletions
|
@ -3108,9 +3108,9 @@ state_t states[NUMSTATES] =
|
|||
|
||||
// Steam Riser
|
||||
{SPR_STEM, 0, 2, {A_SetSolidSteam}, 0, 0, S_STEAM2}, // S_STEAM1
|
||||
{SPR_STEM, 1, 2, {A_UnsetSolidSteam}, 0, 0, S_STEAM3}, // S_STEAM2
|
||||
{SPR_STEM, 1, 2, {NULL}, 0, 0, S_STEAM3}, // S_STEAM2
|
||||
{SPR_STEM, 2, 2, {NULL}, 0, 0, S_STEAM4}, // S_STEAM3
|
||||
{SPR_STEM, 3, 2, {NULL}, 0, 0, S_STEAM5}, // S_STEAM4
|
||||
{SPR_STEM, 3, 2, {A_UnsetSolidSteam}, 0, 0, S_STEAM5}, // S_STEAM4
|
||||
{SPR_STEM, 4, 2, {NULL}, 0, 0, S_STEAM6}, // S_STEAM5
|
||||
{SPR_STEM, 5, 2, {NULL}, 0, 0, S_STEAM7}, // S_STEAM6
|
||||
{SPR_STEM, 6, 2, {NULL}, 0, 0, S_STEAM8}, // S_STEAM7
|
||||
|
@ -7403,12 +7403,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
sfx_steam1, // deathsound
|
||||
0, // speed
|
||||
32*FRACUNIT, // radius
|
||||
1*FRACUNIT, // height
|
||||
20*FRACUNIT, // height
|
||||
0, // display offset
|
||||
20*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID, // flags
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
50
src/p_map.c
50
src/p_map.c
|
@ -459,14 +459,14 @@ springstate:
|
|||
return final;
|
||||
}
|
||||
|
||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
static void P_DoFan(mobj_t *spring, mobj_t *object)
|
||||
{
|
||||
player_t *p = object->player; // will be NULL if not a player
|
||||
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 = spring->info->mass; // used for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(spring); // 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;
|
||||
|
||||
// is object's top below thruster's position? if not, calculate distance between their bottoms
|
||||
|
@ -485,15 +485,12 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
|||
|
||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||
|
||||
switch (spring->type)
|
||||
{
|
||||
case MT_FAN: // fan
|
||||
if (zdist > (spring->health << FRACBITS)) // max z distance determined by health (set by map thing angle)
|
||||
break;
|
||||
return;
|
||||
if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother
|
||||
break;
|
||||
return;
|
||||
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||
break;
|
||||
return;
|
||||
|
||||
object->momz += flipval*FixedMul(speed/4, spring->scale);
|
||||
|
||||
|
@ -507,25 +504,6 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
|||
if (p->panim != PA_FALL)
|
||||
P_SetPlayerMobjState(object, S_PLAY_FALL);
|
||||
}
|
||||
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->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_SetPlayerMobjState(object, S_PLAY_FALL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera)
|
||||
|
@ -1542,15 +1520,15 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
if (thing->flags & MF_PUSHABLE)
|
||||
{
|
||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(tmthing, thing);
|
||||
if (tmthing->type == MT_FAN)
|
||||
P_DoFan(tmthing, thing);
|
||||
}
|
||||
|
||||
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 true;
|
||||
}
|
||||
else if (thing->flags & MF_SPRING)
|
||||
|
@ -1643,8 +1621,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
}
|
||||
}
|
||||
|
||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(tmthing, thing);
|
||||
if (tmthing->type == MT_FAN)
|
||||
P_DoFan(tmthing, thing);
|
||||
}
|
||||
|
||||
if (tmthing->player) // Is the moving/interacting object the player?
|
||||
|
@ -1652,8 +1630,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (!tmthing->health)
|
||||
return true;
|
||||
|
||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(thing, tmthing);
|
||||
if (thing->type == MT_FAN)
|
||||
P_DoFan(thing, tmthing);
|
||||
else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART)
|
||||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
|
|
Loading…
Reference in a new issue