SW: Partially revert 73d0772e87 and do in a way that's more fidele to the original workflow.

This commit is contained in:
Mitchell Richters 2020-09-09 23:00:43 +10:00
parent 28a3ef131f
commit b2272bd377
3 changed files with 33 additions and 26 deletions

View File

@ -1059,7 +1059,7 @@ enum
PF2_INPUT_CAN_AIM = (BIT(1)), // Allow calling DoPlayerHorizon() from processMovement() PF2_INPUT_CAN_AIM = (BIT(1)), // Allow calling DoPlayerHorizon() from processMovement()
PF2_INPUT_CAN_TURN_GENERAL = (BIT(2)), // Allow calling DoPlayerTurn() from processMovement() PF2_INPUT_CAN_TURN_GENERAL = (BIT(2)), // Allow calling DoPlayerTurn() from processMovement()
PF2_INPUT_CAN_TURN_VEHICLE = (BIT(3)), // Allow calling DoPlayerTurnVehicle() from processMovement() PF2_INPUT_CAN_TURN_VEHICLE = (BIT(3)), // Allow calling DoPlayerTurnVehicle() from processMovement()
PF2_INPUT_CAN_MOVE_TURRET = (BIT(4)), // Allow calling DoPlayerMoveTurret() from processMovement() PF2_INPUT_CAN_TURN_TURRET = (BIT(4)), // Allow calling DoPlayerTurnTurret() from processMovement()
}; };
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -37,7 +37,7 @@ BEGIN_SW_NS
void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, 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 DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust);
void DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist); void DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist);
void DoPlayerMoveTurret(PLAYERp pp, fixed_t q16avel, fixed_t q16horz, double const scaleAdjust); void DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel);
static InputPacket loc; static InputPacket loc;
static int32_t turnheldtime; static int32_t turnheldtime;
@ -326,9 +326,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
DoPlayerTurnVehicle(pp, q16avel, pp->posz + Z(10), labs(pp->posz + Z(10) - pp->sop->floor_loz)); DoPlayerTurnVehicle(pp, q16avel, pp->posz + Z(10), labs(pp->posz + Z(10) - pp->sop->floor_loz));
} }
if (TEST(pp->Flags2, PF2_INPUT_CAN_MOVE_TURRET)) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET))
{ {
DoPlayerMoveTurret(pp, q16avel, q16horz, scaleAdjust); DoPlayerTurnTurret(pp, q16avel);
} }
} }

View File

@ -1742,6 +1742,8 @@ DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel)
pp->q16ang = new_ang; pp->q16ang = new_ang;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
} }
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid);
} }
void SlipSlope(PLAYERp pp) void SlipSlope(PLAYERp pp)
@ -3174,18 +3176,38 @@ DoPlayerMoveVehicle(PLAYERp pp)
} }
void void
DoPlayerMoveTurret(PLAYERp pp, fixed_t q16avel, fixed_t q16horz, double const scaleAdjust) DoPlayerMoveTurret(PLAYERp pp)
{ {
DoPlayerTurnTurret(pp, q16avel); if (!Prediction)
{
if (pp->input.q16avel && !pp->lastinput.q16avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else if (!pp->input.q16avel && pp->lastinput.q16avel)
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
}
if (!cl_syncinput)
{
SET(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET);
}
else
{
DoPlayerTurnTurret(pp, pp->input.q16avel);
}
if (PLAYER_MOVING(pp) == 0) if (PLAYER_MOVING(pp) == 0)
RESET(pp->Flags, PF_PLAYER_MOVED); RESET(pp->Flags, PF_PLAYER_MOVED);
else else
SET(pp->Flags, PF_PLAYER_MOVED); SET(pp->Flags, PF_PLAYER_MOVED);
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid); if (!cl_syncinput)
{
DoPlayerHorizon(pp, q16horz, scaleAdjust); SET(pp->Flags2, PF2_INPUT_CAN_AIM);
}
else
{
DoPlayerHorizon(pp, pp->input.q16horz, 1);
}
} }
void void
@ -5773,22 +5795,7 @@ DoPlayerOperateTurret(PLAYERp pp)
if (pp->sop_remote) if (pp->sop_remote)
RemoteToPlayer(pp); RemoteToPlayer(pp);
if (!Prediction) DoPlayerMoveTurret(pp);
{
if (pp->input.q16avel && !pp->lastinput.q16avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else if (!pp->input.q16avel && pp->lastinput.q16avel)
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
}
if (!cl_syncinput)
{
SET(pp->Flags2, PF2_INPUT_CAN_MOVE_TURRET);
}
else
{
DoPlayerMoveTurret(pp, pp->input.q16avel, pp->input.q16horz, 1);
}
if (pp->sop_remote) if (pp->sop_remote)
{ {
@ -7450,7 +7457,7 @@ domovethings(void)
ChopsCheck(pp); ChopsCheck(pp);
// Reset flags used while tying input to framerate // Reset flags used while tying input to framerate
RESET(pp->Flags2, PF2_INPUT_CAN_AIM|PF2_INPUT_CAN_TURN_GENERAL|PF2_INPUT_CAN_TURN_VEHICLE|PF2_INPUT_CAN_MOVE_TURRET); RESET(pp->Flags2, PF2_INPUT_CAN_AIM|PF2_INPUT_CAN_TURN_GENERAL|PF2_INPUT_CAN_TURN_VEHICLE|PF2_INPUT_CAN_TURN_TURRET);
resetinputhelpers(pp); resetinputhelpers(pp);
if (pp->DoPlayerAction) pp->DoPlayerAction(pp); if (pp->DoPlayerAction) pp->DoPlayerAction(pp);