mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- SW: Hook up all vehicle turn code in processMovement()
except for DoPlayerTurnTankRect()
, which still needs considerations.
* Issue in `DoPlayerTurnTurret()` with `PlaySOsound()` calls occurring too frequently, still requires investigation on how to best handle this.
This commit is contained in:
parent
0619281a34
commit
5145bf907a
3 changed files with 92 additions and 56 deletions
|
@ -1024,39 +1024,43 @@ extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
|
|||
|
||||
enum
|
||||
{
|
||||
PF_DEAD = (BIT(1)),
|
||||
PF_JUMPING = (BIT(2)),
|
||||
PF_FALLING = (BIT(3)),
|
||||
PF_LOCK_CRAWL = (BIT(4)),
|
||||
PF_LOCK_HORIZ = (BIT(5)),
|
||||
PF_LOOKING = (BIT(6)),
|
||||
PF_PLAYER_MOVED = (BIT(7)),
|
||||
PF_PLAYER_RIDING = (BIT(8)),
|
||||
PF_AUTO_AIM = (BIT(9)),
|
||||
PF_RECOIL = (BIT(10)),
|
||||
PF_FLYING = (BIT(11)),
|
||||
PF_WEAPON_RETRACT = (BIT(12)),
|
||||
PF_PICKED_UP_AN_UZI = (BIT(13)),
|
||||
PF_CRAWLING = (BIT(14)),
|
||||
PF_CLIMBING = (BIT(15)),
|
||||
PF_SWIMMING = (BIT(16)),
|
||||
PF_DIVING = (BIT(17)),
|
||||
PF_DIVING_IN_LAVA = (BIT(18)),
|
||||
PF_TWO_UZI = (BIT(19)),
|
||||
PF_TURN_180 = (BIT(21)),
|
||||
PF_DEAD_HEAD = (BIT(22)), // are your a dead head
|
||||
PF_HEAD_CONTROL = (BIT(23)), // have control of turning when a head?
|
||||
PF_CLIP_CHEAT = (BIT(24)), // cheat for wall clipping
|
||||
PF_SLIDING = (BIT(25)), // cheat for wall clipping
|
||||
PF_VIEW_FROM_OUTSIDE = (BIT(26)),
|
||||
PF_VIEW_OUTSIDE_WEAPON= (BIT(27)),
|
||||
PF_VIEW_FROM_CAMERA = (BIT(28)),
|
||||
PF_TANK = (BIT(29)), // Doin the tank thang
|
||||
PF_MOUSE_AIMING_ON = (BIT(30)),
|
||||
PF_WEAPON_DOWN = (BIT(31)),
|
||||
PF2_TELEPORTED = (BIT(0)),
|
||||
PF2_INPUT_CAN_TURN = (BIT(1)), // Allow calling DoPlayerTurn from getinput
|
||||
PF2_INPUT_CAN_AIM = (BIT(2)), // Allow calling DoPlayerHorizon from getinput
|
||||
PF_DEAD = (BIT(1)),
|
||||
PF_JUMPING = (BIT(2)),
|
||||
PF_FALLING = (BIT(3)),
|
||||
PF_LOCK_CRAWL = (BIT(4)),
|
||||
PF_LOCK_HORIZ = (BIT(5)),
|
||||
PF_LOOKING = (BIT(6)),
|
||||
PF_PLAYER_MOVED = (BIT(7)),
|
||||
PF_PLAYER_RIDING = (BIT(8)),
|
||||
PF_AUTO_AIM = (BIT(9)),
|
||||
PF_RECOIL = (BIT(10)),
|
||||
PF_FLYING = (BIT(11)),
|
||||
PF_WEAPON_RETRACT = (BIT(12)),
|
||||
PF_PICKED_UP_AN_UZI = (BIT(13)),
|
||||
PF_CRAWLING = (BIT(14)),
|
||||
PF_CLIMBING = (BIT(15)),
|
||||
PF_SWIMMING = (BIT(16)),
|
||||
PF_DIVING = (BIT(17)),
|
||||
PF_DIVING_IN_LAVA = (BIT(18)),
|
||||
PF_TWO_UZI = (BIT(19)),
|
||||
PF_TURN_180 = (BIT(21)),
|
||||
PF_DEAD_HEAD = (BIT(22)), // are your a dead head
|
||||
PF_HEAD_CONTROL = (BIT(23)), // have control of turning when a head?
|
||||
PF_CLIP_CHEAT = (BIT(24)), // cheat for wall clipping
|
||||
PF_SLIDING = (BIT(25)), // cheat for wall clipping
|
||||
PF_VIEW_FROM_OUTSIDE = (BIT(26)),
|
||||
PF_VIEW_OUTSIDE_WEAPON = (BIT(27)),
|
||||
PF_VIEW_FROM_CAMERA = (BIT(28)),
|
||||
PF_TANK = (BIT(29)), // Doin the tank thang
|
||||
PF_MOUSE_AIMING_ON = (BIT(30)),
|
||||
PF_WEAPON_DOWN = (BIT(31)),
|
||||
PF2_TELEPORTED = (BIT(0)),
|
||||
PF2_INPUT_CAN_AIM = (BIT(1)), // Allow calling DoPlayerHorizon from getinput
|
||||
PF2_INPUT_CAN_TURN_GENERAL = (BIT(2)), // Allow calling DoPlayerTurn from getinput
|
||||
PF2_INPUT_CAN_TURN_BOAT = (BIT(3)), // Allow calling DoPlayerTurnBoat from getinput
|
||||
PF2_INPUT_CAN_TURN_TANK = (BIT(4)), // Allow calling DoPlayerTurnTank from getinput
|
||||
PF2_INPUT_CAN_TURN_TANKRECT = (BIT(5)), // Allow calling DoPlayerTurnTankRect from getinput
|
||||
PF2_INPUT_CAN_TURN_TURRET = (BIT(6)), // Allow calling DoPlayerTurnTurret from getinput
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,8 +34,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust);
|
||||
void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust);
|
||||
void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust);
|
||||
void DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel);
|
||||
void DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist);
|
||||
void DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel);
|
||||
|
||||
static InputPacket loc;
|
||||
static int32_t turnheldtime;
|
||||
|
@ -277,10 +280,20 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
|
|||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN))
|
||||
DoPlayerTurn(pp, q16avel, scaleAdjust);
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
|
||||
DoPlayerHorizon(pp, q16horz, scaleAdjust);
|
||||
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL))
|
||||
DoPlayerTurn(pp, q16avel, scaleAdjust);
|
||||
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_BOAT))
|
||||
DoPlayerTurnBoat(pp, q16avel);
|
||||
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TANK))
|
||||
DoPlayerTurnTank(pp, q16avel, pp->posz + Z(10), labs(pp->posz + Z(10) - pp->sop->floor_loz));
|
||||
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET))
|
||||
DoPlayerTurnTurret(pp, q16avel);
|
||||
}
|
||||
|
||||
loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL);
|
||||
|
|
|
@ -1628,15 +1628,14 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
|
|||
}
|
||||
|
||||
void
|
||||
DoPlayerTurnBoat(PLAYERp pp)
|
||||
DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel)
|
||||
{
|
||||
fixed_t q16avel;
|
||||
SECTOR_OBJECTp sop = pp->sop;
|
||||
|
||||
if (sop->drive_angspeed)
|
||||
{
|
||||
fixed_t drive_oq16avel = pp->drive_q16avel;
|
||||
pp->drive_q16avel = (mulscale16(pp->input.q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
|
||||
q16avel = pp->drive_q16avel;
|
||||
}
|
||||
|
@ -1653,21 +1652,20 @@ DoPlayerTurnBoat(PLAYERp pp)
|
|||
}
|
||||
|
||||
void
|
||||
DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist)
|
||||
DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist)
|
||||
{
|
||||
fixed_t q16avel;
|
||||
SECTOR_OBJECTp sop = pp->sop;
|
||||
|
||||
if (sop->drive_angspeed)
|
||||
{
|
||||
fixed_t drive_oq16avel = pp->drive_q16avel;
|
||||
pp->drive_q16avel = (mulscale16(pp->input.q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
|
||||
q16avel = pp->drive_q16avel;
|
||||
}
|
||||
else
|
||||
{
|
||||
q16avel = DIV8(pp->input.q16avel * synctics);
|
||||
q16avel = DIV8(q16avel * synctics);
|
||||
}
|
||||
|
||||
if (q16avel != 0)
|
||||
|
@ -1709,29 +1707,29 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
|
|||
}
|
||||
|
||||
void
|
||||
DoPlayerTurnTurret(PLAYERp pp)
|
||||
DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel)
|
||||
{
|
||||
fixed_t q16avel, new_ang, diff;
|
||||
fixed_t new_ang, diff;
|
||||
SECTOR_OBJECTp sop = pp->sop;
|
||||
|
||||
if (!Prediction)
|
||||
{
|
||||
if (pp->input.q16avel && !pp->lastinput.q16avel)
|
||||
if (q16avel && !pp->lastinput.q16avel)
|
||||
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
||||
else if (!pp->input.q16avel && pp->lastinput.q16avel)
|
||||
else if (!q16avel && pp->lastinput.q16avel)
|
||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||
}
|
||||
|
||||
if (sop->drive_angspeed)
|
||||
{
|
||||
fixed_t drive_oq16avel = pp->drive_q16avel;
|
||||
pp->drive_q16avel = (mulscale16(pp->input.q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide;
|
||||
|
||||
q16avel = pp->drive_q16avel;
|
||||
}
|
||||
else
|
||||
{
|
||||
q16avel = DIV4(pp->input.q16avel * synctics);
|
||||
q16avel = DIV4(q16avel * synctics);
|
||||
}
|
||||
|
||||
if (q16avel != 0)
|
||||
|
@ -2344,7 +2342,7 @@ DoPlayerMove(PLAYERp pp)
|
|||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN);
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2630,7 +2628,14 @@ DoPlayerMoveBoat(PLAYERp pp)
|
|||
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
||||
}
|
||||
|
||||
DoPlayerTurnBoat(pp);
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_BOAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoPlayerTurnBoat(pp, pp->input.q16avel);
|
||||
}
|
||||
|
||||
if (PLAYER_MOVING(pp) == 0)
|
||||
RESET(pp->Flags, PF_PLAYER_MOVED);
|
||||
|
@ -3120,7 +3125,14 @@ DoPlayerMoveTank(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
DoPlayerTurnTank(pp, z, floor_dist);
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_TANK);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoPlayerTurnTank(pp, pp->input.q16avel, z, floor_dist);
|
||||
}
|
||||
|
||||
save_cstat = pp->SpriteP->cstat;
|
||||
RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK);
|
||||
|
@ -3173,7 +3185,14 @@ DoPlayerMoveTank(PLAYERp pp)
|
|||
void
|
||||
DoPlayerMoveTurret(PLAYERp pp)
|
||||
{
|
||||
DoPlayerTurnTurret(pp);
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoPlayerTurnTurret(pp, pp->input.q16avel);
|
||||
}
|
||||
|
||||
if (PLAYER_MOVING(pp) == 0)
|
||||
RESET(pp->Flags, PF_PLAYER_MOVED);
|
||||
|
@ -6376,7 +6395,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
{
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN);
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6393,7 +6412,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
{
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN);
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL);
|
||||
}
|
||||
playerAddAngle(pp, GetDeltaQ16Angle(gethiq16angle(kp->x - pp->posx, kp->y - pp->posy), pp->q16ang) / (double)(FRACUNIT << 4));
|
||||
}
|
||||
|
@ -7447,7 +7466,7 @@ domovethings(void)
|
|||
ChopsCheck(pp);
|
||||
|
||||
// Reset flags used while tying input to framerate
|
||||
RESET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM);
|
||||
RESET(pp->Flags2, PF2_INPUT_CAN_AIM|PF2_INPUT_CAN_TURN_GENERAL|PF2_INPUT_CAN_TURN_BOAT|PF2_INPUT_CAN_TURN_TANK|PF2_INPUT_CAN_TURN_TANKRECT|PF2_INPUT_CAN_TURN_TURRET);
|
||||
resetinputhelpers(pp);
|
||||
|
||||
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);
|
||||
|
|
Loading…
Reference in a new issue