mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-01 09:42:27 +00:00
- Remove concept of InputOptions
, its messy and unnecessary.
This commit is contained in:
parent
366423a09b
commit
1147030bca
5 changed files with 10 additions and 16 deletions
|
@ -113,11 +113,9 @@ void resetTurnHeldAmt()
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const InputOptions& inputOpts)
|
void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const int drink_amt, const bool allowstrafe, const double turnscale)
|
||||||
{
|
{
|
||||||
// set up variables.
|
// set up variables.
|
||||||
const bool allowstrafe = isDukeEngine() ? true : inputOpts.first;
|
|
||||||
const double turnscale = inputOpts.second;
|
|
||||||
const int keymove = 1 << int(!!(inputBuffer->actions & SB_RUN));
|
const int keymove = 1 << int(!!(inputBuffer->actions & SB_RUN));
|
||||||
const float hidspeed = float(getTicrateScale(YAW_TURNSPEEDS[2]) * turnscale);
|
const float hidspeed = float(getTicrateScale(YAW_TURNSPEEDS[2]) * turnscale);
|
||||||
const float scaleAdjustf = float(scaleAdjust);
|
const float scaleAdjustf = float(scaleAdjust);
|
||||||
|
@ -151,8 +149,8 @@ void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, I
|
||||||
currInput->svel += strafing * keymove * allowstrafe;
|
currInput->svel += strafing * keymove * allowstrafe;
|
||||||
|
|
||||||
// process RR's drunk state.
|
// process RR's drunk state.
|
||||||
if (isRR() && inputOpts.first)
|
if (isRR() && drink_amt >= 66 && drink_amt <= 87)
|
||||||
currInput->svel += inputOpts.first & 1 ? -currInput->fvel : currInput->fvel;
|
currInput->svel += drink_amt & 1 ? -currInput->fvel : currInput->fvel;
|
||||||
|
|
||||||
// add collected input to game's local input accumulation packet.
|
// add collected input to game's local input accumulation packet.
|
||||||
inputBuffer->fvel = clamp(inputBuffer->fvel + currInput->fvel, -(float)keymove, (float)keymove);
|
inputBuffer->fvel = clamp(inputBuffer->fvel + currInput->fvel, -(float)keymove, (float)keymove);
|
||||||
|
@ -181,12 +179,11 @@ void getInput(const double scaleAdjust, PlayerAngles* const plrAngles, InputPack
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto inputOpts = gi->GetInputOptions();
|
|
||||||
InputPacket input{};
|
InputPacket input{};
|
||||||
HIDInput hidInput{};
|
HIDInput hidInput{};
|
||||||
getHidInput(&hidInput);
|
getHidInput(&hidInput);
|
||||||
ApplyGlobalInput(&hidInput, &inputBuffer);
|
ApplyGlobalInput(&hidInput, &inputBuffer);
|
||||||
gi->GetInput(&hidInput, &inputBuffer, &input, !SyncInput() ? scaleAdjust : 1., inputOpts);
|
gi->GetInput(&hidInput, &inputBuffer, &input, !SyncInput() ? scaleAdjust : 1.);
|
||||||
|
|
||||||
// Directly update the camera angles if we're unsynchronised.
|
// Directly update the camera angles if we're unsynchronised.
|
||||||
if (!SyncInput())
|
if (!SyncInput())
|
||||||
|
|
|
@ -19,8 +19,7 @@ class DCoreActor;
|
||||||
struct MapRecord;
|
struct MapRecord;
|
||||||
struct PlayerAngles;
|
struct PlayerAngles;
|
||||||
|
|
||||||
using InputOptions = std::pair<int, double>;
|
void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const int drink_amt = 0, const bool allowstrafe = true, const double turnscale = 1.);
|
||||||
void processMovement(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const InputOptions& inputOpts);
|
|
||||||
|
|
||||||
struct GameStats
|
struct GameStats
|
||||||
{
|
{
|
||||||
|
@ -91,8 +90,7 @@ struct GameInterface
|
||||||
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
|
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
|
||||||
virtual void SetAmbience(bool on) {}
|
virtual void SetAmbience(bool on) {}
|
||||||
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
virtual void ExitFromMenu() { throw CExitEvent(0); }
|
||||||
virtual void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const InputOptions& inputOpts) { processMovement(hidInput, inputBuffer, currInput, scaleAdjust, inputOpts); }
|
virtual void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust) { processMovement(hidInput, inputBuffer, currInput, scaleAdjust); }
|
||||||
virtual InputOptions GetInputOptions() { return std::make_pair(true, 1.); }
|
|
||||||
virtual void UpdateSounds() {}
|
virtual void UpdateSounds() {}
|
||||||
virtual void ErrorCleanup() {}
|
virtual void ErrorCleanup() {}
|
||||||
virtual void Startup() {}
|
virtual void Startup() {}
|
||||||
|
|
|
@ -39,8 +39,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void SerializeGameState(FSerializer& arc) override;
|
void SerializeGameState(FSerializer& arc) override;
|
||||||
void ExitFromMenu() override;
|
void ExitFromMenu() override;
|
||||||
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
|
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
|
||||||
void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const InputOptions& inputOpts) override;
|
void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust) override;
|
||||||
InputOptions GetInputOptions() override { return std::make_pair(ps[myconnectindex].drink_amt >= 66 && ps[myconnectindex].drink_amt <= 87, 1.); }
|
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
void Startup() override;
|
void Startup() override;
|
||||||
void DrawBackground() override;
|
void DrawBackground() override;
|
||||||
|
|
|
@ -745,7 +745,7 @@ static void processVehicleInput(player_struct *p, HIDInput* const hidInput, Inpu
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameInterface::GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust, const InputOptions& inputOpts)
|
void GameInterface::GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust)
|
||||||
{
|
{
|
||||||
auto const p = &ps[myconnectindex];
|
auto const p = &ps[myconnectindex];
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ void GameInterface::GetInput(HIDInput* const hidInput, InputPacket* const inputB
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
processMovement(hidInput, inputBuffer, currInput, scaleAdjust, inputOpts);
|
processMovement(hidInput, inputBuffer, currInput, scaleAdjust, p->drink_amt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1866,7 +1866,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
void ErrorCleanup() override;
|
void ErrorCleanup() override;
|
||||||
InputOptions GetInputOptions() override { return std::make_pair(!Player[myconnectindex].sop, Player[myconnectindex].sop_control ? 3. / 1.40625 : 1.); }
|
void GetInput(HIDInput* const hidInput, InputPacket* const inputBuffer, InputPacket* const currInput, const double scaleAdjust) override { processMovement(hidInput, inputBuffer, currInput, scaleAdjust, 0, Player[myconnectindex].sop, Player[myconnectindex].sop_control ? 3. / 1.40625 : 1.); }
|
||||||
void DrawBackground(void) override;
|
void DrawBackground(void) override;
|
||||||
void Ticker(void) override;
|
void Ticker(void) override;
|
||||||
void Render() override;
|
void Render() override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue