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_TURN_GENERAL = (BIT(2)), // Allow calling DoPlayerTurn() 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 DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust);
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 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));
}
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;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid);
}
void SlipSlope(PLAYERp pp)
@ -3174,18 +3176,38 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
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)
RESET(pp->Flags, PF_PLAYER_MOVED);
else
SET(pp->Flags, PF_PLAYER_MOVED);
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid);
DoPlayerHorizon(pp, q16horz, scaleAdjust);
if (!cl_syncinput)
{
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
}
else
{
DoPlayerHorizon(pp, pp->input.q16horz, 1);
}
}
void
@ -5773,22 +5795,7 @@ DoPlayerOperateTurret(PLAYERp pp)
if (pp->sop_remote)
RemoteToPlayer(pp);
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_MOVE_TURRET);
}
else
{
DoPlayerMoveTurret(pp, pp->input.q16avel, pp->input.q16horz, 1);
}
DoPlayerMoveTurret(pp);
if (pp->sop_remote)
{
@ -7450,7 +7457,7 @@ domovethings(void)
ChopsCheck(pp);
// 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);
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);