mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- floatified PLAYER::z_speed.
This commit is contained in:
parent
203e2c405f
commit
29d9d02b78
4 changed files with 26 additions and 28 deletions
|
@ -617,7 +617,7 @@ struct PLAYER
|
|||
|
||||
int jump_count, jump_speed; // jumping
|
||||
int16_t down_speed, up_speed; // diving
|
||||
int z_speed; // used for diving and flying instead of down_speed, up_speed
|
||||
double z_speed; // used for diving and flying instead of down_speed, up_speed
|
||||
int climb_ndx;
|
||||
double p_ceiling_dist,p_floor_dist;
|
||||
sectortype* hi_sectp, *lo_sectp;
|
||||
|
|
|
@ -3489,7 +3489,7 @@ void DoPlayerBeginFly(PLAYER* pp)
|
|||
pp->p_ceiling_dist = PLAYER_RUN_CEILING_DIST;
|
||||
pp->DoPlayerAction = DoPlayerFly;
|
||||
|
||||
pp->z_speed = -Z(10);
|
||||
pp->z_speed = -10;
|
||||
pp->jump_speed = 0;
|
||||
pp->pbob_amt = 0;
|
||||
pp->bob_ndx = 1024;
|
||||
|
@ -3540,24 +3540,24 @@ void DoPlayerFly(PLAYER* pp)
|
|||
pp->z_speed = -PLAYER_FLY_MAX_SPEED;
|
||||
}
|
||||
|
||||
pp->z_speed = MulScale(pp->z_speed, 58000, 16);
|
||||
pp->z_speed *= FixedToFloat(58000);
|
||||
|
||||
pp->add_int_ppos_Z(pp->z_speed);
|
||||
pp->pos.Z += pp->z_speed;
|
||||
|
||||
// Make the min distance from the ceiling/floor match bobbing amount
|
||||
// so the player never goes into the ceiling/floor
|
||||
|
||||
// Only get so close to the ceiling
|
||||
if (PlayerCeilingHit(pp, pp->hiz + PLAYER_FLY_BOB_AMTF + 8))
|
||||
if (PlayerCeilingHit(pp, pp->hiz + PLAYER_FLY_BOB_AMT + 8))
|
||||
{
|
||||
pp->pos.Z = pp->hiz + PLAYER_FLY_BOB_AMTF + 8;
|
||||
pp->pos.Z = pp->hiz + PLAYER_FLY_BOB_AMT + 8;
|
||||
pp->z_speed = 0;
|
||||
}
|
||||
|
||||
// Only get so close to the floor
|
||||
if (PlayerFloorHit(pp, pp->loz - PLAYER_HEIGHTF - PLAYER_FLY_BOB_AMTF))
|
||||
if (PlayerFloorHit(pp, pp->loz - PLAYER_HEIGHTF - PLAYER_FLY_BOB_AMT))
|
||||
{
|
||||
pp->pos.Z = pp->loz - PLAYER_HEIGHTF - PLAYER_FLY_BOB_AMTF;
|
||||
pp->pos.Z = pp->loz - PLAYER_HEIGHTF - PLAYER_FLY_BOB_AMT;
|
||||
pp->z_speed = 0;
|
||||
}
|
||||
|
||||
|
@ -3724,7 +3724,7 @@ int PlayerCanDive(PLAYER* pp)
|
|||
if (PlayerInDiveArea(pp))
|
||||
{
|
||||
pp->pos.Z += 20;
|
||||
pp->z_speed = Z(20);
|
||||
pp->z_speed = 20;
|
||||
pp->jump_speed = 0;
|
||||
|
||||
if (pp->pos.Z > pp->loz - pp->WadeDepth - 2)
|
||||
|
@ -3758,7 +3758,7 @@ int PlayerCanDiveNoWarp(PLAYER* pp)
|
|||
pp->setcursector(sect);
|
||||
pp->pos.Z = sect->ceilingz + 20;
|
||||
|
||||
pp->z_speed = Z(20);
|
||||
pp->z_speed = 20;
|
||||
pp->jump_speed = 0;
|
||||
|
||||
PlaySound(DIGI_SPLASH1, pp, v3df_dontpan);
|
||||
|
@ -4341,21 +4341,21 @@ void DoPlayerDive(PLAYER* pp)
|
|||
pp->z_speed = -PLAYER_DIVE_MAX_SPEED;
|
||||
}
|
||||
|
||||
pp->z_speed = MulScale(pp->z_speed, 58000, 16);
|
||||
pp->z_speed *= FixedToFloat(58000);
|
||||
|
||||
if (labs(pp->z_speed) < 16)
|
||||
if (abs(pp->z_speed) < 1./16)
|
||||
pp->z_speed = 0;
|
||||
|
||||
pp->add_int_ppos_Z(pp->z_speed);
|
||||
pp->pos.Z += pp->z_speed;
|
||||
|
||||
if (pp->z_speed < 0 && FAF_ConnectArea(pp->cursector))
|
||||
{
|
||||
if (pp->int_ppos().Z < pp->cursector->int_ceilingz() + Z(10))
|
||||
if (pp->pos.Z < pp->cursector->ceilingz + 10)
|
||||
{
|
||||
auto sect = pp->cursector;
|
||||
|
||||
// check for sector above to see if it is an underwater sector also
|
||||
updatesectorz(pp->int_ppos().X, pp->int_ppos().Y, pp->cursector->int_ceilingz() - Z(8), §);
|
||||
updatesectorz(DVector3(pp->pos, pp->cursector->ceilingz - 8), §);
|
||||
|
||||
if (!SectorIsUnderwaterArea(sect))
|
||||
{
|
||||
|
@ -4403,7 +4403,7 @@ void DoPlayerDive(PLAYER* pp)
|
|||
// make player bob if sitting still
|
||||
if (!PLAYER_MOVING(pp) && pp->z_speed == 0 && pp->up_speed == 0)
|
||||
{
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMTF, 3);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMT, 3);
|
||||
}
|
||||
// player is moving
|
||||
else
|
||||
|
@ -4417,7 +4417,7 @@ void DoPlayerDive(PLAYER* pp)
|
|||
// else keep bobbing until its back close to 0
|
||||
else
|
||||
{
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMTF, 3);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMT, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4425,13 +4425,13 @@ void DoPlayerDive(PLAYER* pp)
|
|||
if (pp->pos.Z + pp->pbob_amt >= pp->loz - PLAYER_DIVE_HEIGHTF)
|
||||
{
|
||||
pp->bob_ndx = NORM_ANGLE(pp->bob_ndx + ((1024 + 512) - pp->bob_ndx) * 2);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMTF, 3);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMT, 3);
|
||||
}
|
||||
// Reverse bobbing when getting close to the ceiling
|
||||
if (pp->pos.Z + pp->pbob_amt < pp->hiz + pp->p_ceiling_dist)
|
||||
{
|
||||
pp->bob_ndx = NORM_ANGLE(pp->bob_ndx + ((512) - pp->bob_ndx) * 2);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMTF, 3);
|
||||
DoPlayerSpriteBob(pp, PLAYER_DIVE_HEIGHTF, PLAYER_DIVE_BOB_AMT, 3);
|
||||
}
|
||||
|
||||
DoPlayerMove(pp);
|
||||
|
|
|
@ -85,10 +85,9 @@ constexpr double PLAYER_DIVE_HEIGHTF = 26;
|
|||
// DIVE
|
||||
//
|
||||
|
||||
#define PLAYER_DIVE_MAX_SPEED (1700)
|
||||
#define PLAYER_DIVE_INC (600)
|
||||
#define PLAYER_DIVE_BOB_AMT (Z(8))
|
||||
constexpr double PLAYER_DIVE_BOB_AMTF = 8;
|
||||
constexpr double PLAYER_DIVE_MAX_SPEED = (1700 * zmaptoworld);
|
||||
constexpr double PLAYER_DIVE_INC = (600 * zmaptoworld);
|
||||
constexpr double PLAYER_DIVE_BOB_AMT = 8;
|
||||
|
||||
#define PLAYER_DIVE_TIME (12*120) // time before damage is taken
|
||||
#define PLAYER_DIVE_DAMAGE_AMOUNT (-1) // amount of damage accessed
|
||||
|
@ -98,10 +97,9 @@ constexpr double PLAYER_DIVE_BOB_AMTF = 8;
|
|||
// FLY
|
||||
//
|
||||
|
||||
#define PLAYER_FLY_MAX_SPEED (2560)
|
||||
#define PLAYER_FLY_INC (1000)
|
||||
#define PLAYER_FLY_BOB_AMT (Z(12))
|
||||
constexpr double PLAYER_FLY_BOB_AMTF = 12;
|
||||
constexpr double PLAYER_FLY_MAX_SPEED = 10;
|
||||
constexpr double PLAYER_FLY_INC = (1000 * zmaptoworld);
|
||||
constexpr double PLAYER_FLY_BOB_AMT = 12;
|
||||
// Height from which Player will actually call DoPlayerBeginFall()
|
||||
#define PLAYER_FALL_HEIGHT Z(28)
|
||||
constexpr double PLAYER_FALL_HEIGHTF = 28;
|
||||
|
|
|
@ -189,7 +189,7 @@ struct SWPlayer native
|
|||
|
||||
native int jump_count, jump_speed; // jumping
|
||||
native int16 down_speed, up_speed; // diving
|
||||
native int z_speed; // used for diving and flying instead of down_speed, up_speed
|
||||
native double z_speed; // used for diving and flying instead of down_speed, up_speed
|
||||
native int climb_ndx;
|
||||
native double hiz,loz;
|
||||
native double p_ceiling_dist,p_floor_dist;
|
||||
|
|
Loading…
Reference in a new issue