RR: Properly scale tilt_status on vehicles with input being tied to frame-rate.

This commit is contained in:
Mitchell Richters 2020-05-10 20:55:22 +10:00 committed by Christoph Oelckers
parent da04a1d0aa
commit e7621b4e05
3 changed files with 29 additions and 20 deletions

View file

@ -68,13 +68,13 @@ const char *GetVersionString();
#define MINSAVEVER_DN3D 7
#define MINSAVEVER_BLD 6
#define MINSAVEVER_RR 6
#define MINSAVEVER_RR 7
#define MINSAVEVER_SW 6
#define MINSAVEVER_PS 6
#define SAVEVER_DN3D 7
#define SAVEVER_BLD 6
#define SAVEVER_RR 6
#define SAVEVER_RR 7
#define SAVEVER_SW 6
#define SAVEVER_PS 6

View file

@ -3681,13 +3681,13 @@ void P_GetInputMotorcycle(int playerNum)
{
if (turnLeft)
{
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status < -10)
pPlayer->tilt_status = -10;
}
else if (turnRight)
{
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status > 10)
pPlayer->tilt_status = 10;
}
@ -3697,7 +3697,7 @@ void P_GetInputMotorcycle(int playerNum)
if (turnLeft || pPlayer->moto_drink < 0)
{
turnHeldTime += elapsedTics;
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status < -10)
pPlayer->tilt_status = -10;
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
@ -3718,7 +3718,7 @@ void P_GetInputMotorcycle(int playerNum)
else if (turnRight || pPlayer->moto_drink > 0)
{
turnHeldTime += elapsedTics;
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status > 10)
pPlayer->tilt_status = 10;
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
@ -3741,12 +3741,15 @@ void P_GetInputMotorcycle(int playerNum)
turnHeldTime = 0;
if (pPlayer->tilt_status > 0)
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
else if (pPlayer->tilt_status < 0)
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
}
}
if (pPlayer->tilt_status > -0.025 && pPlayer->tilt_status < 0.025)
pPlayer->tilt_status = 0;
if (pPlayer->moto_underwater)
{
pPlayer->moto_speed = 0;
@ -3913,7 +3916,7 @@ void P_GetInputBoat(int playerNum)
turnHeldTime += elapsedTics;
if (!pPlayer->not_on_water)
{
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status < -10)
pPlayer->tilt_status = -10;
if (turnHeldTime >= TURBOTURNTIME)
@ -3932,7 +3935,7 @@ void P_GetInputBoat(int playerNum)
turnHeldTime += elapsedTics;
if (!pPlayer->not_on_water)
{
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
if (pPlayer->tilt_status > 10)
pPlayer->tilt_status = 10;
if (turnHeldTime >= TURBOTURNTIME)
@ -3951,9 +3954,9 @@ void P_GetInputBoat(int playerNum)
turnHeldTime = 0;
if (pPlayer->tilt_status > 0)
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
else if (pPlayer->tilt_status < 0)
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
}
}
else if (!pPlayer->not_on_water)
@ -3961,11 +3964,14 @@ void P_GetInputBoat(int playerNum)
turnHeldTime = 0;
if (pPlayer->tilt_status > 0)
pPlayer->tilt_status--;
pPlayer->tilt_status -= scaleAdjustmentToInterval(1);
else if (pPlayer->tilt_status < 0)
pPlayer->tilt_status++;
pPlayer->tilt_status += scaleAdjustmentToInterval(1);
}
if (pPlayer->tilt_status > -0.025 && pPlayer->tilt_status < 0.025)
pPlayer->tilt_status = 0;
input.fvel += pPlayer->moto_speed;
input.q16avel = fix16_mul(input.q16avel, avelScale);
@ -8574,9 +8580,10 @@ HORIZONLY:;
{
if (numplayers == 1)
{
int tilt_status = pPlayer->tilt_status;
vec3_t const vect = {
sintable[(pPlayer->tilt_status*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>8,
sintable[(pPlayer->tilt_status*20+fix16_to_int(pPlayer->q16ang))&2047]>>8,sprite[spriteNum].zvel
sintable[(tilt_status*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>8,
sintable[(tilt_status*20+fix16_to_int(pPlayer->q16ang))&2047]>>8,sprite[spriteNum].zvel
};
A_MoveSprite(spriteNum,&vect,CLIPMASK0);
@ -8627,9 +8634,10 @@ HORIZONLY:;
{
if (numplayers == 1)
{
int tilt_status = pPlayer->tilt_status;
vec3_t const vect = {
sintable[(pPlayer->tilt_status*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>9,
sintable[(pPlayer->tilt_status*20+fix16_to_int(pPlayer->q16ang))&2047]>>9,sprite[spriteNum].zvel
sintable[(tilt_status*20+fix16_to_int(pPlayer->q16ang)+512)&2047]>>9,
sintable[(tilt_status*20+fix16_to_int(pPlayer->q16ang))&2047]>>9,sprite[spriteNum].zvel
};
A_MoveSprite(spriteNum,&vect,CLIPMASK0);

View file

@ -210,7 +210,7 @@ typedef struct {
int16_t drink_amt, eat_amt, drink_ang, eat_ang;
int32_t drink_timer, eat_timer;
int16_t level_end_timer;
int16_t moto_speed, tilt_status, moto_drink;
int16_t moto_speed, moto_drink;
uint8_t on_motorcycle, on_boat, moto_underwater, not_on_water, moto_on_ground;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
int16_t moto_bump, moto_bump_target, moto_turb;
@ -220,11 +220,12 @@ typedef struct {
int32_t drug_timer;
int32_t sea_sick;
uint8_t hurt_delay2, nocheat;
double tilt_status;
int32_t dhat60f, dhat613, dhat617, dhat61b, dhat61f;
int8_t crouch_toggle;
int8_t padding_[3];
int8_t padding_[1];
} DukePlayer_t;
// KEEPINSYNC lunatic/_defs_game.lua