From 722537a1f0736186022941b500b1087f72d45d5a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 20:17:54 +1000 Subject: [PATCH 01/49] - InputState: Make `CONTROL_GetInput()` return an object instead of accepting a pointer and provide to games as a function parameter. * Provide read-only/const results from `CONTROL_GetInput()` so games can't change received input. * Change non-descript `info` to `hidInput` (Human Interface Device). * Remove a few unused prototypes. --- source/blood/src/blood.h | 2 +- source/blood/src/controls.cpp | 29 ++++++++--------- source/core/gamestruct.h | 3 +- source/core/inputstate.cpp | 56 +++++++++++++++++---------------- source/core/inputstate.h | 6 ++-- source/core/mainloop.cpp | 4 +-- source/exhumed/src/exhumed.h | 2 +- source/exhumed/src/input.cpp | 28 +++++++---------- source/exhumed/src/player.h | 1 - source/games/duke/src/duke3d.h | 2 +- source/games/duke/src/input.cpp | 40 +++++++++++------------ source/sw/src/draw.cpp | 1 - source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 29 ++++++++--------- source/sw/src/player.cpp | 11 +++---- source/sw/src/player.h | 2 +- 16 files changed, 102 insertions(+), 116 deletions(-) diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 5b89de332..a7fb84b7f 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -88,7 +88,7 @@ struct GameInterface : ::GameInterface FString GetCoordString() override; ReservedSpace GetReservedScreenSpace(int viewsize) override; void UpdateSounds() override; - void GetInput(InputPacket* gInput) override; + void GetInput(InputPacket* gInput, ControlInfo* const hidInput) override; void Ticker() override; void DrawBackground() override; void Startup() override; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index a783fdc74..fb082d23a 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -51,10 +51,9 @@ float gViewAngleAdjust; float gViewLookAdjust; int gViewLookRecenter; -void GetInputInternal(InputPacket &inputParm) +void GetInputInternal(InputPacket &inputParm, ControlInfo* const hidInput) { int prevPauseState = paused; - ControlInfo info; static double lastInputTicks; auto const currentHiTicks = I_msTimeF(); @@ -66,9 +65,7 @@ void GetInputInternal(InputPacket &inputParm) InputPacket input = {}; - CONTROL_GetInput(&info); - - ApplyGlobalInput(inputParm, &info); + ApplyGlobalInput(inputParm, hidInput); bool mouseaim = !(inputParm.actions & SB_AIMMODE); if (!mouseaim) inputParm.actions |= SB_CENTERVIEW; @@ -146,26 +143,26 @@ void GetInputInternal(InputPacket &inputParm) if (buttonMap.ButtonDown(gamefunc_Strafe)) { - input.svel -= info.mousex * 32.f; - input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove); + input.svel -= hidInput->mousex * 32.f; + input.svel -= scaleAdjustmentToInterval(hidInput->dyaw * keyMove); } else { - input.q16avel += FloatToFixed(info.mousex); - input.q16avel += FloatToFixed(scaleAdjustmentToInterval(info.dyaw)); + input.q16avel += FloatToFixed(hidInput->mousex); + input.q16avel += FloatToFixed(scaleAdjustmentToInterval(hidInput->dyaw)); } - input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); - input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); + input.svel -= scaleAdjustmentToInterval(hidInput->dx * keyMove); + input.fvel -= scaleAdjustmentToInterval(hidInput->dz * keyMove); if (mouseaim) - input.q16horz += FloatToFixed(info.mousey / mlookScale); + input.q16horz += FloatToFixed(hidInput->mousey / mlookScale); else - input.fvel -= info.mousey * 64.f; + input.fvel -= hidInput->mousey * 64.f; if (!in_mouseflip) input.q16horz = -input.q16horz; - input.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch / mlookScale)); + input.q16horz -= FloatToFixed(scaleAdjustmentToInterval(hidInput->dpitch / mlookScale)); if (!automapFollow && automapMode != am_off) { @@ -202,9 +199,9 @@ void GetInputInternal(InputPacket &inputParm) } } -void GameInterface::GetInput(InputPacket* packet) +void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) { - GetInputInternal(gInput); + GetInputInternal(gInput, hidInput); if (packet) { *packet = gInput; diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 49fdb5d49..fba9cd9a1 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -7,6 +7,7 @@ bool System_WantGuiCapture(); // During playing this tells us whether the game m #include "engineerrors.h" #include "stats.h" #include "packet.h" +#include "inputstate.h" class FSerializer; @@ -93,7 +94,7 @@ struct GameInterface virtual void ExitFromMenu() { throw CExitEvent(0); } virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; } virtual void ResetFollowPos(bool) {} - virtual void GetInput(InputPacket* packet) {} + virtual void GetInput(InputPacket* packet, ControlInfo* const hidInput) {} virtual void UpdateSounds() {} virtual void ErrorCleanup() {} virtual void Startup() {} diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index 2a0929f5d..1e6e6638e 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -53,24 +53,24 @@ bool sendPause; // //========================================================================== -void InputState::GetMouseDelta(ControlInfo * info) +void InputState::GetMouseDelta(ControlInfo * hidInput) { vec2f_t finput = g_mousePos; g_mousePos = {}; - info->mousex = finput.x * (16.f / 32.f) * in_mousesensitivity * in_mousescalex / 3.f; - info->mousey = finput.y * (16.f / 64.f) * in_mousesensitivity * in_mousescaley; + hidInput->mousex = finput.x * (16.f / 32.f) * in_mousesensitivity * in_mousescalex / 3.f; + hidInput->mousey = finput.y * (16.f / 64.f) * in_mousesensitivity * in_mousescaley; // todo: Use these when the mouse is used for moving instead of turning. - //info->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside); - //info->mousey = int(finput.y * (4.f) * in_mousesensitivity * in_mouseforward); + //hidInput->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside); + //hidInput->mousey = int(finput.y * (4.f) * in_mousesensitivity * in_mouseforward); if (in_mousebias) { - if (fabs(info->mousex) > fabs(info->mousey)) - info->mousey /= in_mousebias; + if (fabs(hidInput->mousex) > fabs(hidInput->mousey)) + hidInput->mousey /= in_mousebias; else - info->mousex /= in_mousebias; + hidInput->mousex /= in_mousebias; } } @@ -175,11 +175,11 @@ int32_t handleevents(void) // //========================================================================== -void CONTROL_GetInput(ControlInfo* info) +ControlInfo CONTROL_GetInput() { - memset(info, 0, sizeof(ControlInfo)); + ControlInfo hidInput {}; - inputState.GetMouseDelta(info); + inputState.GetMouseDelta(&hidInput); if (use_joystick) { @@ -188,11 +188,13 @@ void CONTROL_GetInput(ControlInfo* info) I_GetAxes(joyaxes); - info->dyaw += -joyaxes[JOYAXIS_Yaw] * 45.f; - info->dx += -joyaxes[JOYAXIS_Side] * 0.75f; - info->dz += -joyaxes[JOYAXIS_Forward] * 0.75f; - info->dpitch += -joyaxes[JOYAXIS_Pitch] * 22.5f; + hidInput.dyaw += -joyaxes[JOYAXIS_Yaw] * 45.f; + hidInput.dx += -joyaxes[JOYAXIS_Side] * 0.75f; + hidInput.dz += -joyaxes[JOYAXIS_Forward] * 0.75f; + hidInput.dpitch += -joyaxes[JOYAXIS_Pitch] * 22.5f; } + + return hidInput; } //--------------------------------------------------------------------------- @@ -328,40 +330,40 @@ CCMD(pause) -void ApplyGlobalInput(InputPacket& input, ControlInfo *info) +void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput) { if (WeaponToSend != 0) input.setNewWeapon(WeaponToSend); WeaponToSend = 0; - if (info && buttonMap.ButtonDown(gamefunc_Dpad_Select)) + if (hidInput && buttonMap.ButtonDown(gamefunc_Dpad_Select)) { // These buttons should not autorepeat. The game handlers are not really equipped for that. - if (info->dz > 0 && !(dpad_lock & 1)) { dpad_lock |= 1; input.setNewWeapon(WeaponSel_Prev); } + if (hidInput->dz > 0 && !(dpad_lock & 1)) { dpad_lock |= 1; input.setNewWeapon(WeaponSel_Prev); } else dpad_lock &= ~1; - if (info->dz < 0 && !(dpad_lock & 2)) { dpad_lock |= 2; input.setNewWeapon(WeaponSel_Next); } + if (hidInput->dz < 0 && !(dpad_lock & 2)) { dpad_lock |= 2; input.setNewWeapon(WeaponSel_Next); } else dpad_lock &= ~2; - if ((info->dx < 0 || info->dyaw < 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; } + if ((hidInput->dx < 0 || hidInput->dyaw < 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; } else dpad_lock &= ~4; - if ((info->dx > 0 || info->dyaw > 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; } + if ((hidInput->dx > 0 || hidInput->dyaw > 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; } else dpad_lock &= ~8; // This eats the controller input for regular use - info->dx = 0; - info->dz = 0; - info->dyaw = 0; + hidInput->dx = 0; + hidInput->dz = 0; + hidInput->dyaw = 0; } else dpad_lock = 0; input.actions |= ActionsToSend; ActionsToSend = 0; - if (buttonMap.ButtonDown(gamefunc_Aim_Up) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && info->dz > 0)) + if (buttonMap.ButtonDown(gamefunc_Aim_Up) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dz > 0)) input.actions |= SB_AIM_UP; - if ((buttonMap.ButtonDown(gamefunc_Aim_Down) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && info->dz < 0))) + if ((buttonMap.ButtonDown(gamefunc_Aim_Down) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dz < 0))) input.actions |= SB_AIM_DOWN; if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming)) - info->dz = 0; + hidInput->dz = 0; if (buttonMap.ButtonDown(gamefunc_Jump)) input.actions |= SB_JUMP; diff --git a/source/core/inputstate.h b/source/core/inputstate.h index aa07f9d8f..e42dbc227 100644 --- a/source/core/inputstate.h +++ b/source/core/inputstate.h @@ -48,7 +48,7 @@ public: g_mousePos.y += y; } - void GetMouseDelta(ControlInfo* info); + void GetMouseDelta(ControlInfo* hidInput); void ClearAllInput(); bool CheckAllInput() @@ -61,7 +61,7 @@ public: extern InputState inputState; -void CONTROL_GetInput(ControlInfo* info); +ControlInfo CONTROL_GetInput(); int32_t handleevents(void); enum GameFunction_t @@ -96,5 +96,5 @@ enum GameFunction_t }; void SetupGameButtons(); -void ApplyGlobalInput(InputPacket& input, ControlInfo *info); +void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput); extern ESyncBits ActionsToSend; \ No newline at end of file diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 2f1dddbd1..16bfd8f5a 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -110,7 +110,7 @@ int gametic; void G_BuildTiccmd(ticcmd_t* cmd) { I_GetEvent(); - gi->GetInput(&cmd->ucmd); + gi->GetInput(&cmd->ucmd, &CONTROL_GetInput()); cmd->consistancy = consistancy[myconnectindex][(maketic / ticdup) % BACKUPTICS]; } @@ -491,7 +491,7 @@ void TryRunTics (void) if (!cl_syncinput) { I_GetEvent(); - gi->GetInput(nullptr); + gi->GetInput(nullptr, &CONTROL_GetInput()); } return; } diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 846566d37..554b37b48 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -252,7 +252,7 @@ struct GameInterface : ::GameInterface void Ticker() override; void DrawBackground() override; void Render() override; - void GetInput(InputPacket* packet) override; + void GetInput(InputPacket* packet, ControlInfo* const hidInput) override; void Startup() override; const char* GenericCheat(int player, int cheat) override; void NewGame(MapRecord *map, int skill) override; diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index 510668ba7..26470f27d 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -100,12 +100,8 @@ void CheckKeys2() } -void PlayerInterruptKeys(bool after) +static void PlayerInterruptKeys(bool after, ControlInfo* const hidInput) { - ControlInfo info; - memset(&info, 0, sizeof(ControlInfo)); // this is done within CONTROL_GetInput() anyway - CONTROL_GetInput(&info); - static double lastInputTicks; auto const currentHiTicks = I_msTimeF(); double const elapsedInputTicks = currentHiTicks - lastInputTicks; @@ -123,7 +119,7 @@ void PlayerInterruptKeys(bool after) if (!after) { localInput = {}; - ApplyGlobalInput(localInput, &info); + ApplyGlobalInput(localInput, hidInput); if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN; } @@ -142,26 +138,26 @@ void PlayerInterruptKeys(bool after) if (buttonMap.ButtonDown(gamefunc_Strafe)) { - tempinput.svel -= info.mousex * 4.f; - tempinput.svel -= info.dyaw * keyMove; + tempinput.svel -= hidInput->mousex * 4.f; + tempinput.svel -= hidInput->dyaw * keyMove; } else { - input_angle += FloatToFixed(info.mousex + scaleAdjustmentToInterval(info.dyaw)); + input_angle += FloatToFixed(hidInput->mousex + scaleAdjustmentToInterval(hidInput->dyaw)); } bool mouseaim = !(localInput.actions & SB_AIMMODE); if (mouseaim) - tempinput.q16horz += FloatToFixed(info.mousey); + tempinput.q16horz += FloatToFixed(hidInput->mousey); else - tempinput.fvel -= info.mousey * 8.f; + tempinput.fvel -= hidInput->mousey * 8.f; if (!in_mouseflip) tempinput.q16horz = -tempinput.q16horz; - tempinput.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch)); - tempinput.svel -= info.dx * keyMove; - tempinput.fvel -= info.dz * keyMove; + tempinput.q16horz -= FloatToFixed(scaleAdjustmentToInterval(hidInput->dpitch)); + tempinput.svel -= hidInput->dx * keyMove; + tempinput.fvel -= hidInput->dz * keyMove; if (buttonMap.ButtonDown(gamefunc_Strafe)) { @@ -297,9 +293,9 @@ void PlayerInterruptKeys(bool after) } -void GameInterface::GetInput(InputPacket* packet) +void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) { - PlayerInterruptKeys(packet == nullptr); + PlayerInterruptKeys(packet == nullptr, hidInput); if (packet) *packet = localInput; } diff --git a/source/exhumed/src/player.h b/source/exhumed/src/player.h index 6ee376194..7c1989572 100644 --- a/source/exhumed/src/player.h +++ b/source/exhumed/src/player.h @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -void PlayerInterruptKeys(bool after); void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle); void SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle); void InitPlayer(); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index de249f658..28f4b858e 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -51,7 +51,7 @@ struct GameInterface : public ::GameInterface ReservedSpace GetReservedScreenSpace(int viewsize) override; void DrawPlayerSprite(const DVector2& origin, bool onteam) override; void ResetFollowPos(bool message) override; - void GetInput(InputPacket* packet) override; + void GetInput(InputPacket* packet, ControlInfo* const hidInput) override; void UpdateSounds() override; void Startup() override; void DrawBackground() override; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 9622bc311..8544ca420 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -531,9 +531,9 @@ enum // //--------------------------------------------------------------------------- -static void processInputBits(player_struct *p, ControlInfo &info) +static void processInputBits(player_struct *p, ControlInfo* const hidInput) { - ApplyGlobalInput(loc, &info); + ApplyGlobalInput(loc, hidInput); if (isRR() && (loc.actions & SB_CROUCH)) loc.actions &= ~SB_JUMP; if (p->OnMotorcycle || p->OnBoat) @@ -598,7 +598,7 @@ int getticssincelastupdate() // //--------------------------------------------------------------------------- -static void processMovement(player_struct *p, InputPacket &input, ControlInfo &info, double scaleFactor) +static void processMovement(player_struct *p, InputPacket &input, ControlInfo* const hidInput, double scaleFactor) { bool mouseaim = !(loc.actions & SB_AIMMODE); @@ -608,20 +608,20 @@ static void processMovement(player_struct *p, InputPacket &input, ControlInfo &i int keymove = NORMALKEYMOVE << running; if (buttonMap.ButtonDown(gamefunc_Strafe)) - input.svel -= info.mousex * 4.f + scaleFactor * info.dyaw * keymove; + input.svel -= hidInput->mousex * 4.f + scaleFactor * hidInput->dyaw * keymove; else - input.q16avel += FloatToFixed(info.mousex + scaleFactor * info.dyaw); + input.q16avel += FloatToFixed(hidInput->mousex + scaleFactor * hidInput->dyaw); if (mouseaim) - input.q16horz += FloatToFixed(info.mousey); + input.q16horz += FloatToFixed(hidInput->mousey); else - input.fvel -= info.mousey * 8.f; + input.fvel -= hidInput->mousey * 8.f; if (!in_mouseflip) input.q16horz = -input.q16horz; - input.q16horz -= FloatToFixed(scaleFactor * (info.dpitch)); - input.svel -= scaleFactor * (info.dx * keymove); - input.fvel -= scaleFactor * (info.dz * keymove); + input.q16horz -= FloatToFixed(scaleFactor * (hidInput->dpitch)); + input.svel -= scaleFactor * (hidInput->dx * keymove); + input.fvel -= scaleFactor * (hidInput->dz * keymove); if (buttonMap.ButtonDown(gamefunc_Strafe)) { @@ -876,9 +876,9 @@ static double boatApplyTurn(player_struct *p, int turnl, int turnr, int boat_tur // //--------------------------------------------------------------------------- -static void processVehicleInput(player_struct *p, ControlInfo& info, InputPacket& input, double scaleAdjust) +static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, InputPacket& input, double scaleAdjust) { - auto turnspeed = info.mousex + scaleAdjust * info.dyaw * (1. / 32); // originally this was 64, not 32. Why the change? + auto turnspeed = hidInput->mousex + scaleAdjust * hidInput->dyaw * (1. / 32); // originally this was 64, not 32. Why the change? int turnl = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left); int turnr = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right); @@ -999,7 +999,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle) // //--------------------------------------------------------------------------- -static void GetInputInternal(InputPacket &locInput) +static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput) { double elapsedInputTicks; auto const p = &ps[myconnectindex]; @@ -1023,15 +1023,13 @@ static void GetInputInternal(InputPacket &locInput) } double scaleAdjust = !cl_syncinput ? elapsedInputTicks * REALGAMETICSPERSEC / 1000.0 : 1; - ControlInfo info; - CONTROL_GetInput(&info); InputPacket input{}; if (isRRRA() && (p->OnMotorcycle || p->OnBoat)) { p->crouch_toggle = 0; - processInputBits(p, info); - processVehicleInput(p, info, input, scaleAdjust); + processInputBits(p, hidInput); + processVehicleInput(p, hidInput, input, scaleAdjust); FinalizeInput(myconnectindex, input, true); if (!cl_syncinput && sprite[p->i].extra > 0) @@ -1041,8 +1039,8 @@ static void GetInputInternal(InputPacket &locInput) } else { - processInputBits(p, info); - processMovement(p, input, info, scaleAdjust); + processInputBits(p, hidInput); + processMovement(p, input, hidInput, scaleAdjust); checkCrouchToggle(p); FinalizeInput(myconnectindex, input, false); } @@ -1062,9 +1060,9 @@ static void GetInputInternal(InputPacket &locInput) // //--------------------------------------------------------------------------- -void GameInterface::GetInput(InputPacket* packet) +void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) { - GetInputInternal(loc); + GetInputInternal(loc, hidInput); if (packet) { auto const pPlayer = &ps[myconnectindex]; diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index c12464e40..bdb5aac28 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1604,7 +1604,6 @@ short ScreenSavePic = FALSE; SWBOOL PicInView(short, SWBOOL); void DoPlayerDiveMeter(PLAYERp pp); -void MoveScrollMode2D(PLAYERp pp); void drawscreen(PLAYERp pp, double smoothratio) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 5a5e529d4..7a4f731cb 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2211,7 +2211,7 @@ struct GameInterface : ::GameInterface void ResetFollowPos(bool message) override; void UpdateSounds() override; void ErrorCleanup() override; - void GetInput(InputPacket* input) override; + void GetInput(InputPacket* input, ControlInfo* const hidInput) override; void DrawBackground(void) override; void Ticker(void) override; void Render() override; diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 64adcb94b..9370b468e 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -67,7 +67,7 @@ void GameInterface::ResetFollowPos(bool) Follow_posy = pp->posy; } -static void getinput(InputPacket *loc) +static void getinput(InputPacket *loc, ControlInfo* const hidInput) { int i; PLAYERp pp = Player + myconnectindex; @@ -101,9 +101,6 @@ static void getinput(InputPacket *loc) lastInputTicks = currentHiTicks; - ControlInfo info; - CONTROL_GetInput(&info); - if (paused) return; @@ -111,7 +108,7 @@ static void getinput(InputPacket *loc) // Tried calling this in domovethings, but key response it too poor, skips key presses // Note: this get called only during follow mode if (automapFollow && automapMode != am_off && pp == Player + myconnectindex && !Prediction) - MoveScrollMode2D(Player + myconnectindex); + MoveScrollMode2D(Player + myconnectindex, hidInput); // !JIM! Added M_Active() so that you don't move at all while using menus if (M_Active() || (automapFollow && automapMode != am_off)) @@ -129,7 +126,7 @@ static void getinput(InputPacket *loc) // for dividing controller input to match speed input speed of other games. float const ticrateScale = 0.75f; - ApplyGlobalInput(*loc, &info); + ApplyGlobalInput(*loc, hidInput); bool mouseaim = !(loc->actions & SB_AIMMODE); @@ -179,25 +176,25 @@ static void getinput(InputPacket *loc) if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { - svel -= (info.mousex * ticrateScale) * 4.f; - svel -= info.dyaw * keymove; + svel -= (hidInput->mousex * ticrateScale) * 4.f; + svel -= hidInput->dyaw * keymove; } else { - q16angvel += FloatToFixed((info.mousex / angvelScale) + scaleAdjustmentToInterval((info.dyaw * ticrateScale) / angvelScale)); + q16angvel += FloatToFixed((hidInput->mousex / angvelScale) + scaleAdjustmentToInterval((hidInput->dyaw * ticrateScale) / angvelScale)); } if (mouseaim) - q16horz -= FloatToFixed(info.mousey / aimvelScale); + q16horz -= FloatToFixed(hidInput->mousey / aimvelScale); else - vel -= (info.mousey * ticrateScale) * 8.f; + vel -= (hidInput->mousey * ticrateScale) * 8.f; if (in_mouseflip) q16horz = -q16horz; - q16horz -= FloatToFixed(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); - svel -= info.dx * keymove; - vel -= info.dz * keymove; + q16horz -= FloatToFixed(scaleAdjustmentToInterval((hidInput->dpitch * ticrateScale) / aimvelScale)); + svel -= hidInput->dx * keymove; + vel -= hidInput->dz * keymove; if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { @@ -359,9 +356,9 @@ static void getinput(InputPacket *loc) } } -void GameInterface::GetInput(InputPacket *packet) +void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { - getinput(&loc); + getinput(&loc, hidInput); if (packet) { PLAYERp pp = &Player[myconnectindex]; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 2869decdc..f7511418c 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -2435,7 +2435,7 @@ void PlayerCheckValidMove(PLAYERp pp) } void -MoveScrollMode2D(PLAYERp pp) +MoveScrollMode2D(PLAYERp pp, ControlInfo* const hidInput) { #define TURBOTURNTIME (120/8) #define NORMALTURN (12+6) @@ -2446,22 +2446,19 @@ MoveScrollMode2D(PLAYERp pp) #define MAXSVEL ((NORMALKEYMOVE*2)+10) #define MAXANGVEL 100 - ControlInfo scrl_input; int32_t keymove; int32_t momx, momy; static int mfvel=0, mfsvel=0; - CONTROL_GetInput(&scrl_input); - mfsvel = mfvel = 0; if (M_Active()) return; if (buttonMap.ButtonDown(gamefunc_Strafe)) - mfsvel -= scrl_input.dyaw / 4; - mfsvel -= scrl_input.dx / 4; - mfvel = -scrl_input.dz /4; + mfsvel -= hidInput->dyaw / 4; + mfsvel -= hidInput->dx / 4; + mfvel = -hidInput->dz /4; keymove = NORMALKEYMOVE; diff --git a/source/sw/src/player.h b/source/sw/src/player.h index b841a9644..f50cac9c7 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -130,7 +130,7 @@ void DoPlayer(void); void domovethings(void); void InitAllPlayers(void); void InitMultiPlayerInfo(void); -void MoveScrollMode2D(PLAYERp pp); +void MoveScrollMode2D(PLAYERp pp, ControlInfo* const hidInput); void DoPlayerDivePalette(PLAYERp pp); void DoPlayerNightVisionPalette(PLAYERp pp); void DoPlayerStopDiveNoWarp(PLAYERp pp); From 290e6158079cbfe9fcfe2219f544549d7cc237dd Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 4 Sep 2020 17:53:36 +1000 Subject: [PATCH 02/49] - Move Duke's input scaling for unsynchronised input to backend as `InputScale()`. --- source/core/inputstate.cpp | 17 +++++++++++++++++ source/core/inputstate.h | 3 ++- source/games/duke/src/input.cpp | 10 +--------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index 1e6e6638e..a1f4baf25 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -47,6 +47,8 @@ ESyncBits ActionsToSend = 0; static int dpad_lock = 0; bool sendPause; +static double lastCheck; + //========================================================================== // // @@ -402,3 +404,18 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput) } +double InputScale() +{ + if (!cl_syncinput) + { + double now = I_msTimeF(); + double elapsedInputTicks = lastCheck > 0 ? min(now - lastCheck, 1000.0 / GameTicRate) : 1; + lastCheck = now; + return elapsedInputTicks * GameTicRate / 1000.0; + } + else + { + return 1; + } +} + diff --git a/source/core/inputstate.h b/source/core/inputstate.h index e42dbc227..18d5ef9e4 100644 --- a/source/core/inputstate.h +++ b/source/core/inputstate.h @@ -97,4 +97,5 @@ enum GameFunction_t void SetupGameButtons(); void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput); -extern ESyncBits ActionsToSend; \ No newline at end of file +extern ESyncBits ActionsToSend; +double InputScale(); diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 8544ca420..588e73d6a 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -1001,16 +1001,8 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle) static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput) { - double elapsedInputTicks; auto const p = &ps[myconnectindex]; - auto now = I_msTimeF(); - // do not let this become too large - it would create overflows resulting in undefined behavior. The very first tic must not use the timer difference at all because the timer has not been set yet. - // This really needs to have the timer fixed to be robust, doing it ad-hoc here is not really safe. - if (lastCheck > 0) elapsedInputTicks = min(now - lastCheck, 1000.0 / REALGAMETICSPERSEC); - else elapsedInputTicks = 1; - lastCheck = now; - if (paused) { loc = {}; @@ -1022,7 +1014,7 @@ static void GetInputInternal(InputPacket &locInput, ControlInfo* const hidInput) setlocalplayerinput(p); } - double scaleAdjust = !cl_syncinput ? elapsedInputTicks * REALGAMETICSPERSEC / 1000.0 : 1; + double const scaleAdjust = InputScale(); InputPacket input{}; if (isRRRA() && (p->OnMotorcycle || p->OnBoat)) From 0ef9da6a0c1f99119dfde22a710b6bfa0668cd35 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 20:12:39 +1000 Subject: [PATCH 03/49] - SW: Make game's local input buffer static within input.cpp. --- source/sw/src/draw.cpp | 3 +-- source/sw/src/game.h | 2 -- source/sw/src/input.cpp | 34 +++++++++++++++++----------------- source/sw/src/save.cpp | 5 ++--- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index bdb5aac28..6b2180825 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1650,8 +1650,7 @@ drawscreen(PLAYERp pp, double smoothratio) tz = camerapp->oposz + xs_CRoundToInt(fmulscale16(camerapp->posz - camerapp->oposz, smoothratio)); // TODO: It'd be better to check pp->input.q16angvel instead, problem is that // it's been repurposed for the q16ang diff while tying input to framerate - if (cl_syncinput || (pp != Player+myconnectindex) || - (TEST(pp->Flags, PF_DEAD) && (loc.q16avel == 0))) + if (cl_syncinput || (pp != Player+myconnectindex) || TEST(pp->Flags, PF_DEAD)) { tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16ang + IntToFixed(1024) - camerapp->oq16ang) - IntToFixed(1024), smoothratio)); tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio)); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 7a4f731cb..54282ee04 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -805,8 +805,6 @@ enum }; -extern InputPacket loc; - #define PACK 1 extern SWBOOL CameraTestMode; diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 9370b468e..233a5b292 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -40,7 +40,7 @@ double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000 void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel); void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz); -InputPacket loc; +static InputPacket loc; void InitNetVars(void) @@ -67,7 +67,7 @@ void GameInterface::ResetFollowPos(bool) Follow_posy = pp->posy; } -static void getinput(InputPacket *loc, ControlInfo* const hidInput) +static void getinput(ControlInfo* const hidInput) { int i; PLAYERp pp = Player + myconnectindex; @@ -126,9 +126,9 @@ static void getinput(InputPacket *loc, ControlInfo* const hidInput) // for dividing controller input to match speed input speed of other games. float const ticrateScale = 0.75f; - ApplyGlobalInput(*loc, hidInput); + ApplyGlobalInput(loc, hidInput); - bool mouseaim = !(loc->actions & SB_AIMMODE); + bool mouseaim = !(loc.actions & SB_AIMMODE); if (!CommEnabled) { @@ -149,10 +149,10 @@ static void getinput(InputPacket *loc, ControlInfo* const hidInput) if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) // this shares a bit with another function so cannot be in the common code. - loc->actions |= SB_CROUCH_LOCK; + loc.actions |= SB_CROUCH_LOCK; - if (loc->actions & SB_RUN) + if (loc.actions & SB_RUN) { if (pp->sop_control) turnamount = RUNTURN * 3; @@ -272,14 +272,14 @@ static void getinput(InputPacket *loc, ControlInfo* const hidInput) pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; } - loc->fvel = clamp(loc->fvel + vel, -MAXVEL, MAXVEL); - loc->svel = clamp(loc->svel + svel, -MAXSVEL, MAXSVEL); + loc.fvel = clamp(loc.fvel + vel, -MAXVEL, MAXVEL); + loc.svel = clamp(loc.svel + svel, -MAXSVEL, MAXSVEL); - loc->q16avel += q16angvel; - loc->q16horz += q16horz; + loc.q16avel += q16angvel; + loc.q16horz += q16horz; - if (loc->getNewWeapon() == WeaponSel_Next) + if (loc.getNewWeapon() == WeaponSel_Next) { USERp u = User[pp->PlayerSprite]; short next_weapon = u->WeaponNum + 1; @@ -313,9 +313,9 @@ static void getinput(InputPacket *loc, ControlInfo* const hidInput) } } - loc->setNewWeapon(next_weapon + 1); + loc.setNewWeapon(next_weapon + 1); } - else if (loc->getNewWeapon() == WeaponSel_Prev) + else if (loc.getNewWeapon() == WeaponSel_Prev) { USERp u = User[pp->PlayerSprite]; short prev_weapon = u->WeaponNum - 1; @@ -346,19 +346,19 @@ static void getinput(InputPacket *loc, ControlInfo* const hidInput) } } } - loc->setNewWeapon(prev_weapon + 1); + loc.setNewWeapon(prev_weapon + 1); } - else if (loc->getNewWeapon() == WeaponSel_Alt) + else if (loc.getNewWeapon() == WeaponSel_Alt) { USERp u = User[pp->PlayerSprite]; short const which_weapon = u->WeaponNum + 1; - loc->setNewWeapon(which_weapon); + loc.setNewWeapon(which_weapon); } } void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { - getinput(&loc, hidInput); + getinput(hidInput); if (packet) { PLAYERp pp = &Player[myconnectindex]; diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 3dd664349..46f4e5757 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -85,7 +85,6 @@ extern short BossSpriteNum[3]; #define PANEL_SAVE 1 #define ANIM_SAVE 1 -extern InputPacket loc; extern STATE s_NotRestored[]; OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist}; @@ -469,7 +468,7 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) MWRITE(Track[i].TrackPoint, Track[i].NumPoints * sizeof(TRACK_POINT),1,fil); } - MWRITE(&loc,sizeof(loc),1,fil); + // MWRITE(&loc,sizeof(loc),1,fil); MWRITE(&screenpeek,sizeof(screenpeek),1,fil); MWRITE(&randomseed, sizeof(randomseed), 1, fil); @@ -860,7 +859,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) } } - MREAD(&loc,sizeof(loc),1,fil); + // MREAD(&loc,sizeof(loc),1,fil); MREAD(&screenpeek,sizeof(screenpeek),1,fil); MREAD(&randomseed, sizeof(randomseed), 1, fil); From ce160f7ac110ffbdc8546a7d09eb202ecc9bd1f5 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 20:49:05 +1000 Subject: [PATCH 04/49] - SW: Split `getinput()`'s weapon code into its own static function. --- source/sw/src/input.cpp | 173 +++++++++++++++++++++------------------- 1 file changed, 93 insertions(+), 80 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 233a5b292..e67aab5be 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -67,9 +67,96 @@ void GameInterface::ResetFollowPos(bool) Follow_posy = pp->posy; } + +//--------------------------------------------------------------------------- +// +// handles movement +// +//--------------------------------------------------------------------------- + +static void processWeapon(PLAYERp const pp) +{ + USERp u = User[pp->PlayerSprite]; + int i; + + if (loc.getNewWeapon() == WeaponSel_Next) + { + short next_weapon = u->WeaponNum + 1; + short start_weapon; + + start_weapon = u->WeaponNum + 1; + + if (u->WeaponNum == WPN_SWORD) + start_weapon = WPN_STAR; + + if (u->WeaponNum == WPN_FIST) + { + next_weapon = 14; + } + else + { + next_weapon = -1; + for (i = start_weapon; TRUE; i++) + { + if (i >= MAX_WEAPONS_KEYS) + { + next_weapon = 13; + break; + } + + if (TEST(pp->WpnFlags, BIT(i)) && pp->WpnAmmo[i]) + { + next_weapon = i; + break; + } + } + } + + loc.setNewWeapon(next_weapon + 1); + } + else if (loc.getNewWeapon() == WeaponSel_Prev) + { + USERp u = User[pp->PlayerSprite]; + short prev_weapon = u->WeaponNum - 1; + short start_weapon; + + start_weapon = u->WeaponNum - 1; + + if (u->WeaponNum == WPN_SWORD) + { + prev_weapon = 13; + } + else if (u->WeaponNum == WPN_STAR) + { + prev_weapon = 14; + } + else + { + prev_weapon = -1; + for (i = start_weapon; TRUE; i--) + { + if (i <= -1) + i = WPN_HEART; + + if (TEST(pp->WpnFlags, BIT(i)) && pp->WpnAmmo[i]) + { + prev_weapon = i; + break; + } + } + } + loc.setNewWeapon(prev_weapon + 1); + } + else if (loc.getNewWeapon() == WeaponSel_Alt) + { + USERp u = User[pp->PlayerSprite]; + short const which_weapon = u->WeaponNum + 1; + loc.setNewWeapon(which_weapon); + } +} + static void getinput(ControlInfo* const hidInput) { - int i; PLAYERp pp = Player + myconnectindex; PLAYERp newpp = Player + myconnectindex; @@ -277,92 +364,18 @@ static void getinput(ControlInfo* const hidInput) loc.q16avel += q16angvel; loc.q16horz += q16horz; - - - if (loc.getNewWeapon() == WeaponSel_Next) - { - USERp u = User[pp->PlayerSprite]; - short next_weapon = u->WeaponNum + 1; - short start_weapon; - - start_weapon = u->WeaponNum + 1; - - if (u->WeaponNum == WPN_SWORD) - start_weapon = WPN_STAR; - - if (u->WeaponNum == WPN_FIST) - { - next_weapon = 14; - } - else - { - next_weapon = -1; - for (i = start_weapon; TRUE; i++) - { - if (i >= MAX_WEAPONS_KEYS) - { - next_weapon = 13; - break; - } - - if (TEST(pp->WpnFlags, BIT(i)) && pp->WpnAmmo[i]) - { - next_weapon = i; - break; - } - } - } - - loc.setNewWeapon(next_weapon + 1); - } - else if (loc.getNewWeapon() == WeaponSel_Prev) - { - USERp u = User[pp->PlayerSprite]; - short prev_weapon = u->WeaponNum - 1; - short start_weapon; - - start_weapon = u->WeaponNum - 1; - - if (u->WeaponNum == WPN_SWORD) - { - prev_weapon = 13; - } - else if (u->WeaponNum == WPN_STAR) - { - prev_weapon = 14; - } - else - { - prev_weapon = -1; - for (i = start_weapon; TRUE; i--) - { - if (i <= -1) - i = WPN_HEART; - - if (TEST(pp->WpnFlags, BIT(i)) && pp->WpnAmmo[i]) - { - prev_weapon = i; - break; - } - } - } - loc.setNewWeapon(prev_weapon + 1); - } - else if (loc.getNewWeapon() == WeaponSel_Alt) - { - USERp u = User[pp->PlayerSprite]; - short const which_weapon = u->WeaponNum + 1; - loc.setNewWeapon(which_weapon); - } } void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { + PLAYERp pp = &Player[myconnectindex]; + getinput(hidInput); + + processWeapon(pp); + if (packet) { - PLAYERp pp = &Player[myconnectindex]; - auto fvel = loc.fvel; auto svel = loc.svel; auto ang = FixedToInt(pp->camq16ang); From dd4251da091e108b8124a4322e72ac528a996b14 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 20:52:58 +1000 Subject: [PATCH 05/49] - SW: Split `getinput()`'s input bits code into its own static function. --- source/sw/src/input.cpp | 67 ++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index e67aab5be..f5ea673a8 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -68,6 +68,40 @@ void GameInterface::ResetFollowPos(bool) } +//--------------------------------------------------------------------------- +// +// handles the input bits +// +//--------------------------------------------------------------------------- + +static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput, bool* mouseaim) +{ + ApplyGlobalInput(loc, hidInput); + *mouseaim = !(loc.actions & SB_AIMMODE); + + if (!CommEnabled) + { + // Go back to the source to set this - the old code here was catastrophically bad. + // this needs to be fixed properly - as it is this can never be compatible with demo playback. + + if (mouseaim) + SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); + else + RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); + + if (cl_autoaim) + SET(Player[myconnectindex].Flags, PF_AUTO_AIM); + else + RESET(Player[myconnectindex].Flags, PF_AUTO_AIM); + } + + if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) + { + // this shares a bit with another function so cannot be in the common code. + loc.actions |= SB_CROUCH_LOCK; + } +} + //--------------------------------------------------------------------------- // // handles movement @@ -155,7 +189,7 @@ static void processWeapon(PLAYERp const pp) } } -static void getinput(ControlInfo* const hidInput) +static void getinput(ControlInfo* const hidInput, bool const mouseaim) { PLAYERp pp = Player + myconnectindex; PLAYERp newpp = Player + myconnectindex; @@ -213,32 +247,6 @@ static void getinput(ControlInfo* const hidInput) // for dividing controller input to match speed input speed of other games. float const ticrateScale = 0.75f; - ApplyGlobalInput(loc, hidInput); - - bool mouseaim = !(loc.actions & SB_AIMMODE); - - if (!CommEnabled) - { - // Go back to the source to set this - the old code here was catastrophically bad. - // this needs to be fixed properly - as it is this can never be compatible with demo playback. - - if (mouseaim) - SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); - else - RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); - - if (cl_autoaim) - SET(Player[myconnectindex].Flags, PF_AUTO_AIM); - else - RESET(Player[myconnectindex].Flags, PF_AUTO_AIM); - } - - - - if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) // this shares a bit with another function so cannot be in the common code. - loc.actions |= SB_CROUCH_LOCK; - - if (loc.actions & SB_RUN) { if (pp->sop_control) @@ -369,8 +377,11 @@ static void getinput(ControlInfo* const hidInput) void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { PLAYERp pp = &Player[myconnectindex]; + bool mouseaim; - getinput(hidInput); + processInputBits(pp, hidInput, &mouseaim); + + getinput(hidInput, &mouseaim); processWeapon(pp); From 348be653999750f3883c9a2ad1f76ecc78d7fc40 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:03:27 +1000 Subject: [PATCH 06/49] - SW: Commence re-factoring `getinput()` into `processMovement()`, starting with top-most code. --- source/sw/src/input.cpp | 62 ++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index f5ea673a8..bc4526dad 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -41,6 +41,7 @@ void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel); void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz); static InputPacket loc; +static int32_t turnheldtime; void InitNetVars(void) @@ -68,6 +69,19 @@ void GameInterface::ResetFollowPos(bool) } +enum +{ + TURBOTURNTIME = (120 / 8), + NORMALTURN = (12 + 6), + RUNTURN = (28), + PREAMBLETURN = 3, + NORMALKEYMOVE = 35, + MAXVEL = ((NORMALKEYMOVE * 2) + 10), + MAXSVEL = ((NORMALKEYMOVE * 2) + 10), + MAXANGVEL = 100, + MAXHORIZVEL = 128 +}; + //--------------------------------------------------------------------------- // // handles the input bits @@ -189,32 +203,14 @@ static void processWeapon(PLAYERp const pp) } } -static void getinput(ControlInfo* const hidInput, bool const mouseaim) +//--------------------------------------------------------------------------- +// +// handles movement +// +//--------------------------------------------------------------------------- + +static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim) { - PLAYERp pp = Player + myconnectindex; - PLAYERp newpp = Player + myconnectindex; - -#define TURBOTURNTIME (120/8) -#define NORMALTURN (12+6) -#define RUNTURN (28) -#define PREAMBLETURN 3 -#define NORMALKEYMOVE 35 -#define MAXVEL ((NORMALKEYMOVE*2)+10) -#define MAXSVEL ((NORMALKEYMOVE*2)+10) -#define MAXANGVEL 100 -#define MAXHORIZVEL 128 -#define SET_LOC_KEY(loc, sync_num, key_test) SET(loc, ((!!(key_test)) << (sync_num))) - - static int32_t turnheldtime; - int32_t momx, momy; - - extern SWBOOL MenuButtonAutoAim; - - if (Prediction && CommEnabled) - { - newpp = ppp; - } - static double lastInputTicks; auto const currentHiTicks = I_msTimeF(); @@ -222,19 +218,12 @@ static void getinput(ControlInfo* const hidInput, bool const mouseaim) lastInputTicks = currentHiTicks; - if (paused) - return; - // If in 2D follow mode, scroll around using glob vars // Tried calling this in domovethings, but key response it too poor, skips key presses // Note: this get called only during follow mode if (automapFollow && automapMode != am_off && pp == Player + myconnectindex && !Prediction) MoveScrollMode2D(Player + myconnectindex, hidInput); - // !JIM! Added M_Active() so that you don't move at all while using menus - if (M_Active() || (automapFollow && automapMode != am_off)) - return; - int32_t turnamount; int32_t keymove; @@ -376,13 +365,16 @@ static void getinput(ControlInfo* const hidInput, bool const mouseaim) void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { + if (paused || M_Active() || (automapFollow && automapMode != am_off)) + { + return; + } + PLAYERp pp = &Player[myconnectindex]; bool mouseaim; processInputBits(pp, hidInput, &mouseaim); - - getinput(hidInput, &mouseaim); - + processMovement(pp, hidInput, mouseaim); processWeapon(pp); if (packet) From 256e23673d78ccc9107417c617b03f872d6b4bf7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:21:12 +1000 Subject: [PATCH 07/49] - SW: Clean up all the game's scaling stuff in `processMovement()`. --- source/sw/src/input.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index bc4526dad..00ac26150 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -43,6 +43,9 @@ void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz); static InputPacket loc; static int32_t turnheldtime; +// Constant used for scaling input down to match other games. May not last long after true re-factoring. +static constexpr double const inputScale = 263. / 360.; + void InitNetVars(void) { @@ -227,15 +230,6 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool int32_t turnamount; int32_t keymove; - // The function DoPlayerTurn() scales the player's q16angvel by 1.40625, so store as constant - // and use to scale back player's aim and ang values for a consistent feel between games. - float const angvelScale = 1.40625f; - float const aimvelScale = 1.203125f; - - // Shadow Warrior has a ticrate of 40, 25% more than the other games, so store below constant - // for dividing controller input to match speed input speed of other games. - float const ticrateScale = 0.75f; - if (loc.actions & SB_RUN) { if (pp->sop_control) @@ -260,23 +254,23 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { - svel -= (hidInput->mousex * ticrateScale) * 4.f; + svel -= (hidInput->mousex * inputScale) * 4.f; svel -= hidInput->dyaw * keymove; } else { - q16angvel += FloatToFixed((hidInput->mousex / angvelScale) + scaleAdjustmentToInterval((hidInput->dyaw * ticrateScale) / angvelScale)); + q16angvel += FloatToFixed((hidInput->mousex + scaleAdjustmentToInterval(hidInput->dyaw)) * inputScale); } if (mouseaim) - q16horz -= FloatToFixed(hidInput->mousey / aimvelScale); + q16horz -= FloatToFixed(hidInput->mousey * inputScale); else - vel -= (hidInput->mousey * ticrateScale) * 8.f; + vel -= (hidInput->mousey * inputScale) * 8.f; if (in_mouseflip) q16horz = -q16horz; - q16horz -= FloatToFixed(scaleAdjustmentToInterval((hidInput->dpitch * ticrateScale) / aimvelScale)); + q16horz -= FloatToFixed(scaleAdjustmentToInterval(hidInput->dpitch * inputScale)); svel -= hidInput->dx * keymove; vel -= hidInput->dz * keymove; From e94bd9da0426404dba3a90a85a642f11d2f1fc5a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:30:47 +1000 Subject: [PATCH 08/49] - SW: Replace use of `scaleAdjustmentToInterval()` in lieu of backend solution from 290e6158079cbfe9fcfe2219f544549d7cc237dd. --- source/sw/src/input.cpp | 26 ++++++++---------------- source/sw/src/player.cpp | 44 +++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 00ac26150..ef35dcd67 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -34,11 +34,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -double elapsedInputTicks; -double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000.0 / elapsedInputTicks); } - -void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel); -void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz); +void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust); +void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const scaleAdjust); static InputPacket loc; static int32_t turnheldtime; @@ -214,12 +211,7 @@ static void processWeapon(PLAYERp const pp) static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim) { - static double lastInputTicks; - - auto const currentHiTicks = I_msTimeF(); - elapsedInputTicks = currentHiTicks - lastInputTicks; - - lastInputTicks = currentHiTicks; + double const scaleAdjust = InputScale(); // If in 2D follow mode, scroll around using glob vars // Tried calling this in domovethings, but key response it too poor, skips key presses @@ -259,7 +251,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool } else { - q16angvel += FloatToFixed((hidInput->mousex + scaleAdjustmentToInterval(hidInput->dyaw)) * inputScale); + q16angvel += FloatToFixed((hidInput->mousex + (scaleAdjust * hidInput->dyaw)) * inputScale); } if (mouseaim) @@ -270,7 +262,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (in_mouseflip) q16horz = -q16horz; - q16horz -= FloatToFixed(scaleAdjustmentToInterval(hidInput->dpitch * inputScale)); + q16horz -= FloatToFixed(scaleAdjust * (hidInput->dpitch * inputScale)); svel -= hidInput->dx * keymove; vel -= hidInput->dz * keymove; @@ -294,7 +286,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool q16angvel -= IntToFixed(PREAMBLETURN); } else - q16angvel -= FloatToFixed(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)); + q16angvel -= FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); } else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && pp->sop)) { @@ -307,7 +299,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool q16angvel += IntToFixed(PREAMBLETURN); } else - q16angvel += FloatToFixed(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)); + q16angvel += FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); } else { @@ -343,9 +335,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool fixed_t prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz; if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, &pp->camq16ang, q16angvel); + DoPlayerTurn(pp, &pp->camq16ang, q16angvel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->camq16horiz, q16horz); + DoPlayerHorizon(pp, &pp->camq16horiz, q16horz, scaleAdjust); pp->oq16ang += pp->camq16ang - prevcamq16ang; pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index f7511418c..b5a6475cc 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1544,10 +1544,8 @@ DoPlayerCrawlHeight(PLAYERp pp) pp->posz = pp->posz - (DIV4(diff) + DIV8(diff)); } -double scaleAdjustmentToInterval(double x); - void -DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel) +DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust = 1.) { #define TURN_SHIFT 2 @@ -1585,7 +1583,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel) *pq16ang = NORM_Q16ANGLE(*pq16ang + IntToFixed(labs(delta_ang) >> TURN_SHIFT)); else // Add at least 1 unit to ensure the turn direction is clockwise - *pq16ang = NORM_Q16ANGLE(*pq16ang + max(FRACUNIT, FloatToFixed(scaleAdjustmentToInterval(labs(delta_ang) >> TURN_SHIFT)))); + *pq16ang = NORM_Q16ANGLE(*pq16ang + max(FRACUNIT, FloatToFixed(scaleAdjust * (labs(delta_ang) >> TURN_SHIFT)))); SET(pp->Flags, PF_TURN_180); } @@ -1604,7 +1602,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel) if (cl_syncinput) *pq16ang = IntToFixed(NORM_ANGLE(FixedToInt(*pq16ang) + (delta_ang >> TURN_SHIFT))); else - *pq16ang = NORM_Q16ANGLE(*pq16ang + FloatToFixed(scaleAdjustmentToInterval(delta_ang >> TURN_SHIFT))); + *pq16ang = NORM_Q16ANGLE(*pq16ang + FloatToFixed(scaleAdjust * (delta_ang >> TURN_SHIFT))); if (pq16ang == &pp->q16ang) { @@ -1826,7 +1824,7 @@ void SlipSlope(PLAYERp pp) } void -PlayerAutoLook(PLAYERp pp) +PlayerAutoLook(PLAYERp pp, double const scaleAdjust = 1.) { int x,y,k,j; short tempsect; @@ -1859,7 +1857,7 @@ PlayerAutoLook(PLAYERp pp) if (cl_syncinput) pp->q16horizoff += (j - k) * 160; else - pp->q16horizoff += FloatToFixed(scaleAdjustmentToInterval(mulscale16((j - k), 160))); + pp->q16horizoff += FloatToFixed(scaleAdjust * (mulscale16((j - k), 160))); } } } @@ -1873,7 +1871,7 @@ PlayerAutoLook(PLAYERp pp) if (cl_syncinput) pp->q16horizoff += IntToFixed((((100 - FixedToInt(pp->q16horizoff)) >> 3) + 1)); else - pp->q16horizoff += FloatToFixed(scaleAdjustmentToInterval(FixedToFloat(((IntToFixed(100) - pp->q16horizoff) >> 3) + FRACUNIT))); + pp->q16horizoff += FloatToFixed(scaleAdjust * (FixedToFloat(((IntToFixed(100) - pp->q16horizoff) >> 3) + FRACUNIT))); } } else @@ -1886,7 +1884,7 @@ PlayerAutoLook(PLAYERp pp) pp->q16horizoff -= IntToFixed(((FixedToInt(pp->q16horizoff) >> 3) + 1)); else { - pp->q16horizoff -= FloatToFixed(scaleAdjustmentToInterval(FixedToFloat((pp->q16horizoff >> 3) + FRACUNIT))); + pp->q16horizoff -= FloatToFixed(scaleAdjust * (FixedToFloat((pp->q16horizoff >> 3) + FRACUNIT))); pp->q16horizoff = max(pp->q16horizoff, 0); } } @@ -1896,7 +1894,7 @@ PlayerAutoLook(PLAYERp pp) pp->q16horizoff += IntToFixed((((FixedToInt(-pp->q16horizoff)) >> 3) + 1)); else { - pp->q16horizoff += FloatToFixed(scaleAdjustmentToInterval(FixedToFloat((-pp->q16horizoff >> 3) + FRACUNIT))); + pp->q16horizoff += FloatToFixed(scaleAdjust * (FixedToFloat((-pp->q16horizoff >> 3) + FRACUNIT))); pp->q16horizoff = min(pp->q16horizoff, 0); } } @@ -1905,7 +1903,7 @@ PlayerAutoLook(PLAYERp pp) extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; void -DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) +DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const scaleAdjust = 1.) { int i; #define HORIZ_SPEED (16) @@ -1924,7 +1922,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) // Fixme: This should probably be made optional. if (cl_slopetilting) - PlayerAutoLook(pp); + PlayerAutoLook(pp, scaleAdjust); if (q16horz) { @@ -1938,12 +1936,12 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) pp->q16horizbase = IntToFixed(100); else if (pp->q16horizbase > IntToFixed(100)) { - pp->q16horizbase -= FloatToFixed(scaleAdjustmentToInterval((HORIZ_SPEED*6))); + pp->q16horizbase -= FloatToFixed(scaleAdjust * ((HORIZ_SPEED*6))); pp->q16horizbase = max(pp->q16horizbase, IntToFixed(100)); } else if (pp->q16horizbase < IntToFixed(100)) { - pp->q16horizbase += FloatToFixed(scaleAdjustmentToInterval((HORIZ_SPEED*6))); + pp->q16horizbase += FloatToFixed(scaleAdjust * ((HORIZ_SPEED*6))); pp->q16horizbase = min(pp->q16horizbase, IntToFixed(100)); } pp->centering = pp->q16horizbase != IntToFixed(100); @@ -1963,7 +1961,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) if (cl_syncinput) pp->q16horizbase -= IntToFixed((HORIZ_SPEED/2)); else - pp->q16horizbase -= FloatToFixed(scaleAdjustmentToInterval((HORIZ_SPEED/2))); + pp->q16horizbase -= FloatToFixed(scaleAdjust * ((HORIZ_SPEED/2))); } // adjust *pq16horiz positive @@ -1972,7 +1970,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) if (cl_syncinput) pp->q16horizbase += IntToFixed((HORIZ_SPEED/2)); else - pp->q16horizbase += FloatToFixed(scaleAdjustmentToInterval((HORIZ_SPEED/2))); + pp->q16horizbase += FloatToFixed(scaleAdjust * ((HORIZ_SPEED/2))); } pp->centering = false; } @@ -1989,7 +1987,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) if (cl_syncinput) pp->q16horizbase -= IntToFixed(HORIZ_SPEED); else - pp->q16horizbase -= FloatToFixed(scaleAdjustmentToInterval(HORIZ_SPEED)); + pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED)); } // adjust *pq16horiz positive @@ -1998,7 +1996,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) if (cl_syncinput) pp->q16horizbase += IntToFixed(HORIZ_SPEED); else - pp->q16horizbase += FloatToFixed(scaleAdjustmentToInterval(HORIZ_SPEED)); + pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED)); } pp->centering = false; } @@ -2018,7 +2016,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) if (cl_syncinput) pp->q16horizbase += IntToFixed(25) - (pp->q16horizbase >> 2); else - pp->q16horizbase += FloatToFixed(scaleAdjustmentToInterval(FixedToFloat(IntToFixed(25) - (pp->q16horizbase >> 2)))); + pp->q16horizbase += FloatToFixed(scaleAdjust * (FixedToFloat(IntToFixed(25) - (pp->q16horizbase >> 2)))); } } else @@ -2563,7 +2561,7 @@ DoPlayerMove(PLAYERp pp) SlipSlope(pp); - DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel); + DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel, 1); pp->oldposx = pp->posx; pp->oldposy = pp->posy; @@ -6564,7 +6562,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) if ((TEST(pp->Flags, PF_DEAD_HEAD) && pp->input.q16avel != 0) || TEST(pp->Flags, PF_HEAD_CONTROL)) { - DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel); + DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel, 1); return; } @@ -7645,9 +7643,9 @@ domovethings(void) { auto currFlags2 = pp->Flags2; if (prevFlags2 & currFlags2 & PF2_INPUT_CAN_TURN) - DoPlayerTurn(pp, &pp->q16ang, 0); + DoPlayerTurn(pp, &pp->q16ang, 0, 1); if (prevFlags2 & currFlags2 & PF2_INPUT_CAN_AIM) - DoPlayerHorizon(pp, &pp->q16horiz, 0); + DoPlayerHorizon(pp, &pp->q16horiz, 0, 1); pp->Flags2 = currFlags2; } UpdatePlayerSprite(pp); From dfc3a134288d471d988fda4d16aa4843d7b385ba Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:46:18 +1000 Subject: [PATCH 09/49] - SW: Finalise cleanup from remaining code in `getinput()` to `processWeapopn()`. --- source/sw/src/input.cpp | 86 ++++++++++++----------------------------- 1 file changed, 25 insertions(+), 61 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index ef35dcd67..166cb6781 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -76,7 +76,7 @@ enum RUNTURN = (28), PREAMBLETURN = 3, NORMALKEYMOVE = 35, - MAXVEL = ((NORMALKEYMOVE * 2) + 10), + MAXFVEL = ((NORMALKEYMOVE * 2) + 10), MAXSVEL = ((NORMALKEYMOVE * 2) + 10), MAXANGVEL = 100, MAXHORIZVEL = 128 @@ -212,6 +212,10 @@ static void processWeapon(PLAYERp const pp) static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim) { double const scaleAdjust = InputScale(); + bool const strafeKey = buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop; + int32_t turnamount, keymove; + int32_t fvel = 0, svel = 0; + fixed_t q16avel = 0, q16horz = 0; // If in 2D follow mode, scroll around using glob vars // Tried calling this in domovethings, but key response it too poor, skips key presses @@ -219,57 +223,43 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (automapFollow && automapMode != am_off && pp == Player + myconnectindex && !Prediction) MoveScrollMode2D(Player + myconnectindex, hidInput); - int32_t turnamount; - int32_t keymove; - if (loc.actions & SB_RUN) { - if (pp->sop_control) - turnamount = RUNTURN * 3; - else - turnamount = RUNTURN; - + turnamount = pp->sop_control ? RUNTURN * 3 : RUNTURN; keymove = NORMALKEYMOVE << 1; } else { - if (pp->sop_control) - turnamount = NORMALTURN * 3; - else - turnamount = NORMALTURN; - + turnamount = pp->sop_control ? NORMALTURN * 3 : NORMALTURN; keymove = NORMALKEYMOVE; } - int32_t svel = 0, vel = 0; - fixed_t q16horz = 0, q16angvel = 0; - - if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) + if (strafeKey) { svel -= (hidInput->mousex * inputScale) * 4.f; svel -= hidInput->dyaw * keymove; } else { - q16angvel += FloatToFixed((hidInput->mousex + (scaleAdjust * hidInput->dyaw)) * inputScale); + q16avel += FloatToFixed((hidInput->mousex + (scaleAdjust * hidInput->dyaw)) * inputScale); } if (mouseaim) q16horz -= FloatToFixed(hidInput->mousey * inputScale); else - vel -= (hidInput->mousey * inputScale) * 8.f; + fvel -= (hidInput->mousey * inputScale) * 8.f; if (in_mouseflip) q16horz = -q16horz; q16horz -= FloatToFixed(scaleAdjust * (hidInput->dpitch * inputScale)); svel -= hidInput->dx * keymove; - vel -= hidInput->dz * keymove; + fvel -= hidInput->dz * keymove; - if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) + if (strafeKey) { if (buttonMap.ButtonDown(gamefunc_Turn_Left)) - svel -= -keymove; + svel += keymove; if (buttonMap.ButtonDown(gamefunc_Turn_Right)) svel -= keymove; } @@ -278,28 +268,12 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && pp->sop)) { turnheldtime += synctics; - if (cl_syncinput) - { - if (turnheldtime >= TURBOTURNTIME) - q16angvel -= IntToFixed(turnamount); - else - q16angvel -= IntToFixed(PREAMBLETURN); - } - else - q16angvel -= FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); + q16avel -= FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); } else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && pp->sop)) { turnheldtime += synctics; - if (cl_syncinput) - { - if (turnheldtime >= TURBOTURNTIME) - q16angvel += IntToFixed(turnamount); - else - q16angvel += IntToFixed(PREAMBLETURN); - } - else - q16angvel += FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); + q16avel += FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); } else { @@ -311,42 +285,32 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool svel += keymove; if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) - svel += -keymove; + svel -= keymove; if (buttonMap.ButtonDown(gamefunc_Move_Forward)) - { - vel += keymove; - } + fvel += keymove; if (buttonMap.ButtonDown(gamefunc_Move_Backward)) - vel += -keymove; + fvel -= keymove; - q16angvel = clamp(q16angvel, -IntToFixed(MAXANGVEL), IntToFixed(MAXANGVEL)); - q16horz = clamp(q16horz, -IntToFixed(MAXHORIZVEL), IntToFixed(MAXHORIZVEL)); - - void DoPlayerTeleportPause(PLAYERp pp); - if (cl_syncinput) + if (!cl_syncinput) { - q16angvel = q16angvel; - q16horz = q16horz; - } - else - { - fixed_t prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz; + fixed_t const prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz; if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, &pp->camq16ang, q16angvel, scaleAdjust); + DoPlayerTurn(pp, &pp->camq16ang, q16avel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) DoPlayerHorizon(pp, &pp->camq16horiz, q16horz, scaleAdjust); + pp->oq16ang += pp->camq16ang - prevcamq16ang; pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; } - loc.fvel = clamp(loc.fvel + vel, -MAXVEL, MAXVEL); + loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); loc.svel = clamp(loc.svel + svel, -MAXSVEL, MAXSVEL); - loc.q16avel += q16angvel; - loc.q16horz += q16horz; + loc.q16avel = clamp(loc.q16avel + q16avel, -IntToFixed(MAXANGVEL), IntToFixed(MAXANGVEL)); + loc.q16horz = clamp(loc.q16horz + q16horz, -IntToFixed(MAXHORIZVEL), IntToFixed(MAXHORIZVEL)); } void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) From 46a12cf58a1cf8d49a74bc06b684f38177752b8d Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:47:00 +1000 Subject: [PATCH 10/49] - SW: Clean up `gi->GetInput()` by removing some unneeded local variables. --- source/sw/src/input.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 166cb6781..4c8fc5d43 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -329,15 +329,15 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) if (packet) { - auto fvel = loc.fvel; - auto svel = loc.svel; - auto ang = FixedToInt(pp->camq16ang); + auto const ang = FixedToInt(pp->camq16ang); - loc.fvel = mulscale9(fvel, sintable[NORM_ANGLE(ang + 512)]) + mulscale9(svel, sintable[NORM_ANGLE(ang)]); - loc.svel = mulscale9(fvel, sintable[NORM_ANGLE(ang)]) + mulscale9(svel, sintable[NORM_ANGLE(ang + 1536)]); - loc.q16ang = pp->camq16ang; - loc.q16horiz = pp->camq16horiz; *packet = loc; + + packet->fvel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang + 512)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang)]); + packet->svel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang + 1536)]); + packet->q16ang = pp->camq16ang; + packet->q16horiz = pp->camq16horiz; + loc = {}; } } From 07d4c78e1f363aecb293954f8992563846dbd826 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:55:37 +1000 Subject: [PATCH 11/49] - SW: Manually remove call to `MoveScrollMode2D()` in anticipation of branch `automap` being merged. --- source/sw/src/input.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 4c8fc5d43..4cad986fc 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -217,12 +217,6 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool int32_t fvel = 0, svel = 0; fixed_t q16avel = 0, q16horz = 0; - // If in 2D follow mode, scroll around using glob vars - // Tried calling this in domovethings, but key response it too poor, skips key presses - // Note: this get called only during follow mode - if (automapFollow && automapMode != am_off && pp == Player + myconnectindex && !Prediction) - MoveScrollMode2D(Player + myconnectindex, hidInput); - if (loc.actions & SB_RUN) { turnamount = pp->sop_control ? RUNTURN * 3 : RUNTURN; From c183143ec6be1a747f3df991a910eee5ec35fad9 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 6 Sep 2020 21:57:33 +1000 Subject: [PATCH 12/49] - SW: Clear out the local input buffer while paused like Duke does. --- source/sw/src/input.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 4cad986fc..1c1f620ab 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -311,6 +311,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { if (paused || M_Active() || (automapFollow && automapMode != am_off)) { + loc = {}; return; } From cc3551dcaa64ece53c62fb2d20142a940ea3767d Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 05:19:49 +1000 Subject: [PATCH 13/49] - SW: Ensure player's fvel/svel is calculated using `q16ang`, and not `camq16ang`. Fixes #328, again. --- source/sw/src/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 1c1f620ab..68f08ac84 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -324,7 +324,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) if (packet) { - auto const ang = FixedToInt(pp->camq16ang); + auto const ang = FixedToInt(pp->q16ang); *packet = loc; From 6c091a116f9405da54eb28866374c5760c563060 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 07:56:42 +1000 Subject: [PATCH 14/49] - SW: Fix issues from fa9fa88fce172ef1da331a249ef04fbbaafff330 while merging `back_to_basics2` into working branch. --- source/sw/src/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 2dd8f8563..eb175a5a6 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -300,7 +300,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) { - if (paused || M_Active() || (automapFollow && automapMode != am_off)) + if (paused || M_Active()) { loc = {}; return; From d1d40c6982fd1e661b5d995e0d369eb1a6f652cd Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 08:07:53 +1000 Subject: [PATCH 15/49] - SW: Move SW's input scaler into `processMovement()`. Doesn't need to be available to any other function. --- source/sw/src/input.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index eb175a5a6..a51a36f5f 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -40,9 +40,6 @@ void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double con static InputPacket loc; static int32_t turnheldtime; -// Constant used for scaling input down to match other games. May not last long after true re-factoring. -static constexpr double const inputScale = 263. / 360.; - void InitNetVars(void) { @@ -208,6 +205,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool int32_t fvel = 0, svel = 0; fixed_t q16avel = 0, q16horz = 0; + // Constant used for scaling input down to match other games. May not last long after true re-factoring. + constexpr double inputScale = 263. / 360.; + if (loc.actions & SB_RUN) { turnamount = pp->sop_control ? RUNTURN * 3 : RUNTURN; From 6e6373deda764ff6c22da70a8cde815bcba0035c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 08:40:14 +1000 Subject: [PATCH 16/49] - SW: Remove `camq16*` variables from game and backend code that supported them. * `cl_syncinput 0` is very raw at the moment. --- source/core/d_net.cpp | 8 ------- source/core/d_protocol.cpp | 24 ++----------------- source/core/packet.h | 2 -- source/sw/src/draw.cpp | 11 +++------ source/sw/src/game.h | 1 - source/sw/src/input.cpp | 11 ++------- source/sw/src/osdcmds.cpp | 4 ++-- source/sw/src/player.cpp | 48 +++++++++++++++++--------------------- source/sw/src/track.cpp | 2 -- 9 files changed, 30 insertions(+), 81 deletions(-) diff --git a/source/core/d_net.cpp b/source/core/d_net.cpp index 8c1edbbb5..4b0a09626 100644 --- a/source/core/d_net.cpp +++ b/source/core/d_net.cpp @@ -1021,8 +1021,6 @@ void NetUpdate (void) int fvel; int64_t q16avel; int64_t q16horz; - int64_t q16horiz; // only used by SW - int64_t q16ang; // only used by SW for (j = 0; j < ticdup; ++j) { @@ -1031,16 +1029,12 @@ void NetUpdate (void) fvel += localcmds[modp].ucmd.fvel; q16avel += localcmds[modp].ucmd.q16avel; q16horz += localcmds[modp].ucmd.q16horz; - q16horiz += localcmds[modp].ucmd.q16horiz; - q16ang += localcmds[modp].ucmd.q16ang; } svel /= ticdup; fvel /= ticdup; q16avel /= ticdup; q16horz /= ticdup; - q16horiz /= ticdup; - q16ang /= ticdup; for (j = 0; j < ticdup; ++j) { @@ -1049,8 +1043,6 @@ void NetUpdate (void) localcmds[modp].ucmd.fvel = fvel; localcmds[modp].ucmd.q16avel = q16avel; localcmds[modp].ucmd.q16horz = q16horz; - localcmds[modp].ucmd.q16horiz = q16horiz; - localcmds[modp].ucmd.q16ang = q16ang; } Net_NewMakeTic (); diff --git a/source/core/d_protocol.cpp b/source/core/d_protocol.cpp index 063a72cf4..82c1d110c 100644 --- a/source/core/d_protocol.cpp +++ b/source/core/d_protocol.cpp @@ -167,10 +167,6 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream ucmd->fvel = ReadWord (stream); if (flags & UCMDF_SIDEMOVE) ucmd->svel = ReadWord (stream); - if (flags & UCMDF_UPMOVE) - ucmd->q16horiz = ReadLong (stream); - if (flags & UCMDF_ROLL) - ucmd->q16ang = ReadLong (stream); } return int(*stream - start); @@ -217,16 +213,6 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st flags |= UCMDF_SIDEMOVE; WriteWord (ucmd->svel, stream); } - if (ucmd->q16horiz != basis->q16horiz) - { - flags |= UCMDF_UPMOVE; - WriteLong (ucmd->q16horiz, stream); - } - if (ucmd->q16ang != basis->q16ang) - { - flags |= UCMDF_ROLL; - WriteLong (ucmd->q16ang, stream); - } // Write the packing bits WriteByte (flags, &temp); @@ -252,10 +238,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, InputPacket &cmd, Inpu arc("actions", cmd.actions) ("horz", cmd.q16horz) ("avel", cmd.q16avel) - ("ang", cmd.q16ang) ("fvel", cmd.fvel) ("svwl", cmd.svel) - ("q16horiz", cmd.q16horiz) .EndObject(); } return arc; @@ -269,9 +253,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t ** ucmd->q16horz != 0 || ucmd->q16avel != 0 || ucmd->fvel != 0 || - ucmd->svel != 0 || - ucmd->q16horiz != 0 || - ucmd->q16ang != 0) + ucmd->svel != 0) { WriteByte (DEM_USERCMD, stream); return PackUserCmd (ucmd, basis, stream) + 1; @@ -282,9 +264,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t ** ucmd->q16horz != basis->q16horz || ucmd->q16avel != basis->q16avel || ucmd->fvel != basis->fvel || - ucmd->svel != basis->svel || - ucmd->q16horiz != basis->q16horiz || - ucmd->q16ang != basis->q16ang) + ucmd->svel != basis->svel) { WriteByte (DEM_USERCMD, stream); return PackUserCmd (ucmd, basis, stream) + 1; diff --git a/source/core/packet.h b/source/core/packet.h index 61ca4636b..645f019e2 100644 --- a/source/core/packet.h +++ b/source/core/packet.h @@ -74,8 +74,6 @@ struct InputPacket int16_t fvel; fixed_t q16avel; fixed_t q16horz; - fixed_t q16horiz; // only used by SW - fixed_t q16ang; // only used by SW ESyncBits actions; diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 6aa7f39c4..0ee25028a 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1176,7 +1176,7 @@ FString GameInterface::GetCoordString() out.AppendFormat("POSX:%d ", pp->posx); out.AppendFormat("POSY:%d ", pp->posy); out.AppendFormat("POSZ:%d ", pp->posz); - out.AppendFormat("ANG:%d\n", FixedToInt(pp->camq16ang)); + out.AppendFormat("ANG:%d\n", FixedToInt(pp->q16ang)); return out; } @@ -1656,15 +1656,10 @@ drawscreen(PLAYERp pp, double smoothratio) tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16ang + IntToFixed(1024) - camerapp->oq16ang) - IntToFixed(1024), smoothratio)); tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio)); } - else if (cl_sointerpolation && !CommEnabled) - { - tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(((pp->camq16ang + IntToFixed(1024) - camerapp->oq16ang) & 0x7FFFFFF) - IntToFixed(1024), smoothratio)); - tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(pp->camq16horiz - camerapp->oq16horiz, smoothratio)); - } else { - tq16ang = pp->camq16ang; - tq16horiz = pp->camq16horiz; + tq16ang = pp->q16ang; + tq16horiz = pp->q16horiz; } tsectnum = camerapp->cursectnum; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 28534d8c9..924afff70 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -883,7 +883,6 @@ struct PLAYERstruct int hvel,tilt,tilt_dest; bool centering; fixed_t q16horiz, q16horizbase, q16horizoff, q16ang; - fixed_t camq16horiz, camq16ang; short recoil_amt; short recoil_speed; short recoil_ndx; diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index a51a36f5f..9d6ef8036 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -280,15 +280,10 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (!cl_syncinput) { - fixed_t const prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz; - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, &pp->camq16ang, q16avel, scaleAdjust); + DoPlayerTurn(pp, &pp->q16ang, q16avel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->camq16horiz, q16horz, scaleAdjust); - - pp->oq16ang += pp->camq16ang - prevcamq16ang; - pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; + DoPlayerHorizon(pp, &pp->q16horiz, q16horz, scaleAdjust); } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); @@ -321,8 +316,6 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) packet->fvel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang + 512)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang)]); packet->svel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang + 1536)]); - packet->q16ang = pp->camq16ang; - packet->q16horiz = pp->camq16horiz; loc = {}; } diff --git a/source/sw/src/osdcmds.cpp b/source/sw/src/osdcmds.cpp index 71a3d3aff..366639b53 100644 --- a/source/sw/src/osdcmds.cpp +++ b/source/sw/src/osdcmds.cpp @@ -60,12 +60,12 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm) if (parm->numparms >= 4) { - Player->oq16ang = Player->q16ang = Player->camq16ang = IntToFixed(atoi(parm->parms[3])); + Player->oq16ang = Player->q16ang = IntToFixed(atoi(parm->parms[3])); } if (parm->numparms == 5) { - Player->oq16horiz = Player->q16horiz = Player->camq16horiz = IntToFixed(atoi(parm->parms[4])); + Player->oq16horiz = Player->q16horiz = IntToFixed(atoi(parm->parms[4])); } return CCMD_OK; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 18677a843..d8dbb6566 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1339,8 +1339,7 @@ DoPlayerTeleportPause(PLAYERp pp) void DoPlayerTeleportToSprite(PLAYERp pp, SPRITEp sp) { - pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(sp->ang); - pp->camq16horiz = pp->q16horiz; // Ensure horiz is initially locked + pp->q16ang = pp->oq16ang = IntToFixed(sp->ang); pp->posx = pp->oposx = pp->oldposx = sp->x; pp->posy = pp->oposy = pp->oldposy = sp->y; @@ -1547,7 +1546,7 @@ void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust = 1.) { #define TURN_SHIFT 2 - +#if 0 if (!cl_syncinput && (pq16ang == &pp->q16ang)) { SET(pp->Flags2, PF2_INPUT_CAN_TURN); @@ -1562,7 +1561,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scale } return; } - +#endif if (!TEST(pp->Flags, PF_TURN_180)) { if (pp->input.actions & SB_TURNAROUND) @@ -1677,7 +1676,7 @@ DoPlayerTurnBoat(PLAYERp pp) if (angvel != 0) { - pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1709,7 +1708,7 @@ DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) { if (MultiClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), z, floor_dist)) { - pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1742,7 +1741,7 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) { if (RectClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), x, y, ox, oy)) { - pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1799,7 +1798,7 @@ DoPlayerTurnTurret(PLAYERp pp) } } - pp->camq16ang = pp->q16ang = IntToFixed(new_ang); + pp->q16ang = IntToFixed(new_ang); sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1909,7 +1908,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc // //DSPRINTF(ds,"FixedToInt(pp->q16horizoff), %d", FixedToInt(pp->q16horizoff)); // MONO_PRINT(ds); - +#if 0 if (!cl_syncinput && (pq16horiz == &pp->q16horiz)) { SET(pp->Flags2, PF2_INPUT_CAN_AIM); @@ -1918,7 +1917,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc pp->oq16horiz = pp->q16horiz; return; } - +#endif // Fixme: This should probably be made optional. if (cl_slopetilting) PlayerAutoLook(pp, scaleAdjust); @@ -3910,7 +3909,7 @@ DoPlayerClimb(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle); + pp->q16ang = IntToFixed(pp->LadderAngle); } } } @@ -4371,7 +4370,7 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle); + pp->q16ang = IntToFixed(pp->LadderAngle); return TRUE; } @@ -5611,7 +5610,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->sop = pp->sop_control = sop; sop->controller = pp->SpriteP; - pp->camq16ang = pp->q16ang = IntToFixed(sop->ang); + pp->q16ang = IntToFixed(sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5696,7 +5695,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) save_sectnum = pp->cursectnum; - pp->camq16ang = pp->q16ang = IntToFixed(sop->ang); + pp->q16ang = IntToFixed(sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5825,9 +5824,9 @@ DoPlayerStopOperate(PLAYERp pp) if (pp->sop_remote) { if (TEST_BOOL1(pp->remote_sprite)) - pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang); + pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang); else - pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); + pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); } if (pp->sop_control) @@ -6187,10 +6186,6 @@ DoPlayerBeginDie(PLAYERp pp) if (GodMode) return; - // Ensure these are initially locked - pp->camq16ang = pp->q16ang; - pp->camq16horiz = pp->q16horiz; - StopPlayerSound(pp); // Do the death scream @@ -6393,7 +6388,6 @@ DoPlayerDeathHoriz(PLAYERp pp, short target, short speed) pp->q16horiz = IntToFixed(target); } - pp->camq16horiz = pp->q16horiz; return pp->q16horiz == IntToFixed(target); } @@ -6492,7 +6486,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) q16ang2 = gethiq16angle(kp->x - pp->posx, kp->y - pp->posy); delta_q16ang = GetDeltaQ16Angle(q16ang2, pp->q16ang); - pp->camq16ang = pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4)); + pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4)); } } } @@ -6549,7 +6543,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) sp->yrepeat = PLAYER_NINJA_YREPEAT; //pp->tilt = 0; - pp->camq16horiz = pp->q16horiz = pp->q16horizbase = IntToFixed(100); + pp->q16horiz = pp->q16horizbase = IntToFixed(100); DoPlayerResetMovement(pp); u->ID = NINJA_RUN_R0; PlayerDeathReset(pp); @@ -7531,7 +7525,7 @@ domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - Player[screenpeek].camq16ang = Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)); + Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)); } if (!TEST(pp->Flags, PF_DEAD)) @@ -7614,8 +7608,8 @@ InitAllPlayers(void) pp->posx = pp->oposx = pfirst->posx; pp->posy = pp->oposy = pfirst->posy; pp->posz = pp->oposz = pfirst->posz; - pp->camq16ang = pp->q16ang = pp->oq16ang = pfirst->q16ang; - pp->camq16horiz = pp->q16horiz = pp->oq16horiz = pfirst->q16horiz; + pp->q16ang = pp->oq16ang = pfirst->q16ang; + pp->q16horiz = pp->oq16horiz = pfirst->q16horiz; pp->cursectnum = pfirst->cursectnum; // set like this so that player can trigger something on start of the level pp->lastcursectnum = pfirst->cursectnum+1; @@ -7762,7 +7756,7 @@ PlayerSpawnPosition(PLAYERp pp) pp->posx = pp->oposx = sp->x; pp->posy = pp->oposy = sp->y; pp->posz = pp->oposz = sp->z; - pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(sp->ang); + pp->q16ang = pp->oq16ang = IntToFixed(sp->ang); pp->cursectnum = sp->sectnum; getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 36d387739..37a15a414 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1676,8 +1676,6 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - pp->camq16ang += NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) - pp->q16ang; - pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang); pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)); UpdatePlayerSprite(pp); From e84c8379d9c2dfcfb861f0c94af261a0baac6548 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 19:23:48 +1000 Subject: [PATCH 17/49] - SW: Uplift of `DoPlayerTurn()`. * Set `PF2_INPUT_CAN_TURN` explicitly where `DoPlayerTurn()` would have been done within the original game. * Uplift the turn 180 code to full Q16.16. * Eliminate stupid input scaling so input matches that provided by the input device. * Ticrate angle adjustments outside of the player's control still to be uplifted. --- source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 4 +- source/sw/src/player.cpp | 145 +++++++++++++++------------------------ 3 files changed, 59 insertions(+), 92 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 924afff70..4e24bf84f 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -877,7 +877,7 @@ struct PLAYERstruct short camera_check_time_delay; short cursectnum,lastcursectnum; - short turn180_target; // 180 degree turn + fixed_t turn180_target; // 180 degree turn // variables that do not fit into sprite structure int hvel,tilt,tilt_dest; diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 9d6ef8036..363888e05 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -34,7 +34,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust); +void DoPlayerTurn(PLAYERp pp, fixed_t q16angvel, double const scaleAdjust); void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const scaleAdjust); static InputPacket loc; @@ -281,7 +281,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (!cl_syncinput) { if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, &pp->q16ang, q16avel, scaleAdjust); + DoPlayerTurn(pp, q16avel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) DoPlayerHorizon(pp, &pp->q16horiz, q16horz, scaleAdjust); } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index d8dbb6566..525100024 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1542,46 +1542,30 @@ DoPlayerCrawlHeight(PLAYERp pp) pp->posz = pp->posz - (DIV4(diff) + DIV8(diff)); } -void -DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust = 1.) +enum +{ + TURN_SHIFT = 2 +}; + +void +DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) { -#define TURN_SHIFT 2 -#if 0 - if (!cl_syncinput && (pq16ang == &pp->q16ang)) - { - SET(pp->Flags2, PF2_INPUT_CAN_TURN); - pp->q16ang = pp->input.q16ang; - if ((pp == &Player[myconnectindex]) || (pp == ppp)) // No coop view? - pp->oq16ang = pp->q16ang; - sprite[pp->PlayerSprite].ang = FixedToInt(*pq16ang); - if (!Prediction) - { - if (pp->PlayerUnderSprite >= 0) - sprite[pp->PlayerUnderSprite].ang = FixedToInt(*pq16ang); - } - return; - } -#endif if (!TEST(pp->Flags, PF_TURN_180)) { if (pp->input.actions & SB_TURNAROUND) { if (pp->KeyPressBits & SB_TURNAROUND) { - short delta_ang; + fixed_t delta_ang; pp->KeyPressBits &= ~SB_TURNAROUND; - pp->turn180_target = NORM_ANGLE(FixedToInt(*pq16ang) + 1024); + pp->turn180_target = pp->q16ang + IntToFixed(1024); // make the first turn in the clockwise direction // the rest will follow - delta_ang = GetDeltaAngle(pp->turn180_target, FixedToInt(*pq16ang)); - if (cl_syncinput) - *pq16ang = NORM_Q16ANGLE(*pq16ang + IntToFixed(labs(delta_ang) >> TURN_SHIFT)); - else - // Add at least 1 unit to ensure the turn direction is clockwise - *pq16ang = NORM_Q16ANGLE(*pq16ang + max(FRACUNIT, FloatToFixed(scaleAdjust * (labs(delta_ang) >> TURN_SHIFT)))); + delta_ang = labs(GetDeltaQ16Angle(pp->turn180_target, pp->q16ang)) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; SET(pp->Flags, PF_TURN_180); } @@ -1594,58 +1578,45 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scale if (TEST(pp->Flags, PF_TURN_180)) { - short delta_ang; + fixed_t delta_ang; - delta_ang = GetDeltaAngle(pp->turn180_target, FixedToInt(*pq16ang)); - if (cl_syncinput) - *pq16ang = IntToFixed(NORM_ANGLE(FixedToInt(*pq16ang) + (delta_ang >> TURN_SHIFT))); - else - *pq16ang = NORM_Q16ANGLE(*pq16ang + FloatToFixed(scaleAdjust * (delta_ang >> TURN_SHIFT))); + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; - if (pq16ang == &pp->q16ang) + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + + if (!Prediction && pp->PlayerUnderSprite >= 0) { - sprite[pp->PlayerSprite].ang = FixedToInt(*pq16ang); - if (!Prediction) - { - if (pp->PlayerUnderSprite >= 0) - sprite[pp->PlayerUnderSprite].ang = FixedToInt(*pq16ang); - } + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); } // get new delta to see how close we are - delta_ang = GetDeltaAngle(pp->turn180_target, FixedToInt(*pq16ang)); + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang); - if (labs(delta_ang) < (3<turn180_target); + pp->q16ang = pp->turn180_target; RESET(pp->Flags, PF_TURN_180); } else + { return; + } } - q16angvel *= PLAYER_TURN_SCALE; - - if (q16angvel != 0) + if (q16avel != 0) { - // running is not handled here now - q16angvel += q16angvel / 4; - - *pq16ang += (q16angvel * synctics) / 32; - *pq16ang = NORM_Q16ANGLE(*pq16ang); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; // update players sprite angle // NOTE: It's also updated in UpdatePlayerSprite, but needs to be // here to cover // all cases. - if (pq16ang == &pp->q16ang) + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + + if (!Prediction && pp->PlayerUnderSprite >= 0) { - sprite[pp->PlayerSprite].ang = FixedToInt(*pq16ang); - if (!Prediction) - { - if (pp->PlayerUnderSprite >= 0) - sprite[pp->PlayerUnderSprite].ang = FixedToInt(*pq16ang); - } + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); } } } @@ -2105,7 +2076,7 @@ DoPlayerBeginRecoil(PLAYERp pp, short pix_amt) return; #else SET(pp->Flags, PF_RECOIL); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->recoil_amt = pix_amt; pp->recoil_speed = 80; @@ -2474,7 +2445,14 @@ DoPlayerMove(PLAYERp pp) SlipSlope(pp); - DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel, 1); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN); + } + else + { + DoPlayerTurn(pp, pp->input.q16avel, 1); + } pp->oldposx = pp->posx; pp->oldposy = pp->posy; @@ -3298,7 +3276,7 @@ DoPlayerBeginJump(PLAYERp pp) RESET(pp->Flags, PF_FALLING); RESET(pp->Flags, PF_CRAWLING); RESET(pp->Flags, PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_JUMP_FLOOR_DIST; pp->ceiling_dist = PLAYER_JUMP_CEILING_DIST; @@ -3328,7 +3306,7 @@ DoPlayerBeginForceJump(PLAYERp pp) SET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_FALLING|PF_CRAWLING|PF_CLIMBING|PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->JumpDuration = MAX_JUMP_DURATION; pp->DoPlayerAction = DoPlayerForceJump; @@ -3479,7 +3457,7 @@ DoPlayerBeginFall(PLAYERp pp) RESET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_CRAWLING); RESET(pp->Flags, PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_FALL_FLOOR_DIST; pp->ceiling_dist = PLAYER_FALL_CEILING_DIST; @@ -3973,7 +3951,7 @@ DoPlayerBeginCrawl(PLAYERp pp) RESET(pp->Flags, PF_FALLING | PF_JUMPING); SET(pp->Flags, PF_CRAWLING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_CRAWL_FRICTION; pp->floor_dist = PLAYER_CRAWL_FLOOR_DIST; @@ -4129,7 +4107,7 @@ DoPlayerBeginFly(PLAYERp pp) RESET(pp->Flags, PF_FALLING | PF_JUMPING | PF_CRAWLING); SET(pp->Flags, PF_FLYING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_FLY_FRICTION; pp->floor_dist = PLAYER_RUN_FLOOR_DIST; @@ -4816,7 +4794,7 @@ DoPlayerBeginDive(PLAYERp pp) if (pp->Bloody) pp->Bloody = FALSE; // Water washes away the blood SET(pp->Flags, PF_DIVING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -4882,7 +4860,7 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp) } SET(pp->Flags, PF_DIVING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -5289,7 +5267,7 @@ DoPlayerBeginWade(PLAYERp pp) RESET(pp->Flags, PF_JUMPING | PF_FALLING); RESET(pp->Flags, PF_CRAWLING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_WADE_FRICTION; pp->floor_dist = PLAYER_WADE_FLOOR_DIST; @@ -6466,12 +6444,15 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) // allow turning if (TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL)) - SET(pp->Flags2, PF2_INPUT_CAN_TURN); - - if ((TEST(pp->Flags, PF_DEAD_HEAD) && pp->input.q16avel != 0) || TEST(pp->Flags, PF_HEAD_CONTROL)) - { - DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel, 1); - return; + { + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN); + } + else + { + DoPlayerTurn(pp, pp->input.q16avel, 1); + } } // follow what killed you if its available @@ -6952,7 +6933,7 @@ DoPlayerBeginRun(PLAYERp pp) } RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL|PF_CLIMBING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + SET(pp->Flags2, PF2_INPUT_CAN_AIM); if (pp->WadeDepth) { @@ -7539,23 +7520,9 @@ domovethings(void) ChopsCheck(pp); // Reset flags used while tying input to framerate - auto prevFlags2 = pp->Flags2; RESET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); if (pp->DoPlayerAction) pp->DoPlayerAction(pp); - // Fix a possible jitter upon player action change; - // Mostly done in order to force updates to oq16ang/oq16horiz. - // Don't do so for a dead player which may follow - // the killer if present, due to angle interpolation. - if (!cl_syncinput && !TEST(pp->Flags, PF_DEAD)) - { - auto currFlags2 = pp->Flags2; - if (prevFlags2 & currFlags2 & PF2_INPUT_CAN_TURN) - DoPlayerTurn(pp, &pp->q16ang, 0, 1); - if (prevFlags2 & currFlags2 & PF2_INPUT_CAN_AIM) - DoPlayerHorizon(pp, &pp->q16horiz, 0, 1); - pp->Flags2 = currFlags2; - } UpdatePlayerSprite(pp); pSpriteControl(pp); From 3667116274d665d1dc079778085ba3c9c7ccc70c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 20:20:41 +1000 Subject: [PATCH 18/49] - SW: Uplift of `DoPlayerHorizon()` and `PlayerAutoLook()`. * Set `PF2_INPUT_CAN_AIM` explicitly where `DoPlayerHorizon()` would have been done within the original game. * Replace original centering code and route `SB_CENTERVIEW` through the `SB_LOOK_UP`/`SB_LOOK_DOWN` code. * With this commit, first person input is now nice again. Vehicle code still to be looked at. --- source/sw/src/input.cpp | 6 +- source/sw/src/player.cpp | 229 ++++++++++++++------------------------- 2 files changed, 84 insertions(+), 151 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 363888e05..7e5d61837 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -34,8 +34,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void DoPlayerTurn(PLAYERp pp, fixed_t q16angvel, double const scaleAdjust); -void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const scaleAdjust); +void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust); +void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust); static InputPacket loc; static int32_t turnheldtime; @@ -283,7 +283,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) DoPlayerTurn(pp, q16avel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->q16horiz, q16horz, scaleAdjust); + DoPlayerHorizon(pp, q16horz, scaleAdjust); } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 525100024..fec5fdac7 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -124,6 +124,12 @@ char PlayerGravity = PLAYER_JUMP_GRAV; extern SWBOOL DebugOperate; +enum +{ + TURN_SHIFT = 2, + HORIZ_SPEED = 16 +}; + //unsigned char synctics, lastsynctics; int ChopTics; @@ -1542,11 +1548,6 @@ DoPlayerCrawlHeight(PLAYERp pp) pp->posz = pp->posz - (DIV4(diff) + DIV8(diff)); } -enum -{ - TURN_SHIFT = 2 -}; - void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) { @@ -1793,7 +1794,7 @@ void SlipSlope(PLAYERp pp) } void -PlayerAutoLook(PLAYERp pp, double const scaleAdjust = 1.) +PlayerAutoLook(PLAYERp pp, double const scaleAdjust) { int x,y,k,j; short tempsect; @@ -1803,8 +1804,9 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust = 1.) if (!TEST(pp->Flags, PF_MOUSE_AIMING_ON) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped { // Get a point, 512 units ahead of player's position - x = pp->posx + (sintable[(FixedToInt(pp->q16ang) + 512) & 2047] >> 5); - y = pp->posy + (sintable[FixedToInt(pp->q16ang) & 2047] >> 5); + auto const ang = FixedToInt(pp->q16ang); + x = pp->posx + (sintable[(ang + 512) & 2047] >> 5); + y = pp->posy + (sintable[ang & 2047] >> 5); tempsect = pp->cursectnum; COVERupdatesector(x, y, &tempsect); @@ -1820,75 +1822,38 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust = 1.) // closely (to avoid accidently looking straight out when // you're at the edge of a sector line) then adjust horizon // accordingly - if ((pp->cursectnum == tempsect) || - (klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))) + if ((pp->cursectnum == tempsect) || (klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))) { - if (cl_syncinput) - pp->q16horizoff += (j - k) * 160; - else - pp->q16horizoff += FloatToFixed(scaleAdjust * (mulscale16((j - k), 160))); + pp->q16horizoff += xs_CRoundToInt(scaleAdjust * ((j - k) * 160)); } } } } - if (TEST(pp->Flags, PF_CLIMBING)) + if (TEST(pp->Flags, PF_CLIMBING) && pp->q16horizoff < IntToFixed(100)) { - // tilt when climbing but you can't even really tell it - if (pp->q16horizoff < IntToFixed(100)) - { - if (cl_syncinput) - pp->q16horizoff += IntToFixed((((100 - FixedToInt(pp->q16horizoff)) >> 3) + 1)); - else - pp->q16horizoff += FloatToFixed(scaleAdjust * (FixedToFloat(((IntToFixed(100) - pp->q16horizoff) >> 3) + FRACUNIT))); - } + // tilt when climbing but you can't even really tell it. + pp->q16horizoff += xs_CRoundToInt(scaleAdjust * (((IntToFixed(100) - pp->q16horizoff) >> 3) + FRACUNIT)); } else { - // Make q16horizoff grow towards 0 since q16horizoff is not modified when - // you're not on a slope + // Make q16horizoff grow towards 0 since q16horizoff is not modified when you're not on a slope. if (pp->q16horizoff > 0) { - if (cl_syncinput) - pp->q16horizoff -= IntToFixed(((FixedToInt(pp->q16horizoff) >> 3) + 1)); - else - { - pp->q16horizoff -= FloatToFixed(scaleAdjust * (FixedToFloat((pp->q16horizoff >> 3) + FRACUNIT))); - pp->q16horizoff = max(pp->q16horizoff, 0); - } + pp->q16horizoff -= xs_CRoundToInt(scaleAdjust * ((pp->q16horizoff >> 3) + FRACUNIT)); + pp->q16horizoff = max(pp->q16horizoff, 0); } if (pp->q16horizoff < 0) { - if (cl_syncinput) - pp->q16horizoff += IntToFixed((((FixedToInt(-pp->q16horizoff)) >> 3) + 1)); - else - { - pp->q16horizoff += FloatToFixed(scaleAdjust * (FixedToFloat((-pp->q16horizoff >> 3) + FRACUNIT))); - pp->q16horizoff = min(pp->q16horizoff, 0); - } + pp->q16horizoff += xs_CRoundToInt(scaleAdjust * ((pp->q16horizoff >> 3) + FRACUNIT)); + pp->q16horizoff = min(pp->q16horizoff, 0); } } } -extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; void -DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const scaleAdjust = 1.) +DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust) { - int i; -#define HORIZ_SPEED (16) - -// //DSPRINTF(ds,"FixedToInt(pp->q16horizoff), %d", FixedToInt(pp->q16horizoff)); -// MONO_PRINT(ds); -#if 0 - if (!cl_syncinput && (pq16horiz == &pp->q16horiz)) - { - SET(pp->Flags2, PF2_INPUT_CAN_AIM); - pp->q16horiz = pp->input.q16horiz; - if ((pp == &Player[myconnectindex]) || (pp == ppp)) // No coop view? - pp->oq16horiz = pp->q16horiz; - return; - } -#endif // Fixme: This should probably be made optional. if (cl_slopetilting) PlayerAutoLook(pp, scaleAdjust); @@ -1899,104 +1864,61 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); } - if ((pp->input.actions & SB_CENTERVIEW) || pp->centering) - { - if (cl_syncinput) - pp->q16horizbase = IntToFixed(100); - else if (pp->q16horizbase > IntToFixed(100)) - { - pp->q16horizbase -= FloatToFixed(scaleAdjust * ((HORIZ_SPEED*6))); - pp->q16horizbase = max(pp->q16horizbase, IntToFixed(100)); - } - else if (pp->q16horizbase < IntToFixed(100)) - { - pp->q16horizbase += FloatToFixed(scaleAdjust * ((HORIZ_SPEED*6))); - pp->q16horizbase = min(pp->q16horizbase, IntToFixed(100)); - } - pp->centering = pp->q16horizbase != IntToFixed(100); - *pq16horiz = pp->q16horizbase; - pp->q16horizoff = 0; - } - // this is the locked type if (pp->input.actions & (SB_AIM_UP|SB_AIM_DOWN)) { - // set looking because player is manually looking + // set looking because player is manually looking. SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); - // adjust *pq16horiz negative + // adjust q16horiz negative if (pp->input.actions & SB_AIM_DOWN) - { - if (cl_syncinput) - pp->q16horizbase -= IntToFixed((HORIZ_SPEED/2)); - else - pp->q16horizbase -= FloatToFixed(scaleAdjust * ((HORIZ_SPEED/2))); - } + pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); - // adjust *pq16horiz positive + // adjust q16horiz positive if (pp->input.actions & SB_AIM_UP) - { - if (cl_syncinput) - pp->q16horizbase += IntToFixed((HORIZ_SPEED/2)); - else - pp->q16horizbase += FloatToFixed(scaleAdjust * ((HORIZ_SPEED/2))); - } - pp->centering = false; + pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); } // this is the unlocked type - if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN)) + if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN|SB_CENTERVIEW)) { RESET(pp->Flags, PF_LOCK_HORIZ); SET(pp->Flags, PF_LOOKING); - // adjust *pq16horiz negative + // adjust q16horiz negative if (pp->input.actions & SB_LOOK_DOWN) - { - if (cl_syncinput) - pp->q16horizbase -= IntToFixed(HORIZ_SPEED); - else - pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED)); - } + pp->q16horizbase -= FloatToFixed(scaleAdjust * HORIZ_SPEED); - // adjust *pq16horiz positive + // adjust q16horiz positive if (pp->input.actions & SB_LOOK_UP) - { - if (cl_syncinput) - pp->q16horizbase += IntToFixed(HORIZ_SPEED); - else - pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED)); - } - pp->centering = false; + pp->q16horizbase += FloatToFixed(scaleAdjust * HORIZ_SPEED); + + if (pp->input.actions & SB_CENTERVIEW) + pp->q16horizoff = 0; } if (!TEST(pp->Flags, PF_LOCK_HORIZ)) { if (!(pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN))) { - // not pressing the *pq16horiz keys + // not pressing the q16horiz keys if (pp->q16horizbase != IntToFixed(100)) { - - // move *pq16horiz back to 100 - for (i = 1; i; i--) + // move q16horiz back to 100 + for (int i = 1; i; i--) { - // this formula does not work for *pq16horiz = 101-103 - if (cl_syncinput) - pp->q16horizbase += IntToFixed(25) - (pp->q16horizbase >> 2); - else - pp->q16horizbase += FloatToFixed(scaleAdjust * (FixedToFloat(IntToFixed(25) - (pp->q16horizbase >> 2)))); + // this formula does not work for q16horiz = 101-103 + pp->q16horizbase += xs_CRoundToInt(scaleAdjust * (IntToFixed(25) - (pp->q16horizbase >> 2))); } } else { - // not looking anymore because *pq16horiz is back at 100 + // not looking anymore because q16horiz is back at 100 RESET(pp->Flags, PF_LOOKING); } } } -#if 1 // bound the base pp->q16horizbase = max(pp->q16horizbase, IntToFixed(PLAYER_HORIZ_MIN)); pp->q16horizbase = min(pp->q16horizbase, IntToFixed(PLAYER_HORIZ_MAX)); @@ -2008,16 +1930,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc pp->q16horizoff = IntToFixed(PLAYER_HORIZ_MAX) - pp->q16horizbase; // add base and offsets - *pq16horiz = pp->q16horizbase + pp->q16horizoff; -#else - if (pp->q16horizbase + pp->q16horizoff < IntToFixed(PLAYER_HORIZ_MIN)) - pp->q16horizbase += IntToFixed(HORIZ_SPEED); - else if (pp->q16horizbase + pp->q16horizoff > IntToFixed(PLAYER_HORIZ_MAX)) - pp->q16horizbase -= HORIZ_SPEED; - - *pq16horiz = pp->q16horizbase + pp->q16horizoff; -#endif - + pp->q16horiz = pp->q16horizbase + pp->q16horizoff; } void @@ -2072,17 +1985,12 @@ DoPlayerBob(PLAYERp pp) void DoPlayerBeginRecoil(PLAYERp pp, short pix_amt) { -#if 0 - return; -#else SET(pp->Flags, PF_RECOIL); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->recoil_amt = pix_amt; pp->recoil_speed = 80; pp->recoil_ndx = 0; pp->recoil_horizoff = 0; -#endif } void @@ -2573,7 +2481,14 @@ DoPlayerMove(PLAYERp pp) DoPlayerSetWadeDepth(pp); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_DYNAMIC_AREA)) { @@ -2774,7 +2689,14 @@ DoPlayerMoveBoat(PLAYERp pp) OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } } void DoTankTreads(PLAYERp pp) @@ -3247,7 +3169,14 @@ DoPlayerMoveTank(PLAYERp pp) OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } DoTankTreads(pp); } @@ -3264,7 +3193,14 @@ DoPlayerMoveTurret(PLAYERp pp) OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } } void @@ -3276,7 +3212,6 @@ DoPlayerBeginJump(PLAYERp pp) RESET(pp->Flags, PF_FALLING); RESET(pp->Flags, PF_CRAWLING); RESET(pp->Flags, PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_JUMP_FLOOR_DIST; pp->ceiling_dist = PLAYER_JUMP_CEILING_DIST; @@ -3306,7 +3241,6 @@ DoPlayerBeginForceJump(PLAYERp pp) SET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_FALLING|PF_CRAWLING|PF_CLIMBING|PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->JumpDuration = MAX_JUMP_DURATION; pp->DoPlayerAction = DoPlayerForceJump; @@ -3457,7 +3391,6 @@ DoPlayerBeginFall(PLAYERp pp) RESET(pp->Flags, PF_JUMPING); RESET(pp->Flags, PF_CRAWLING); RESET(pp->Flags, PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_FALL_FLOOR_DIST; pp->ceiling_dist = PLAYER_FALL_CEILING_DIST; @@ -3654,7 +3587,6 @@ DoPlayerBeginClimb(PLAYERp pp) RESET(pp->Flags, PF_JUMPING|PF_FALLING); RESET(pp->Flags, PF_CRAWLING); RESET(pp->Flags, PF_LOCK_CRAWL); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->DoPlayerAction = DoPlayerClimb; @@ -3841,7 +3773,14 @@ DoPlayerClimb(PLAYERp pp) sp->z = pp->posz + PLAYER_HEIGHT; changespritesect(pp->PlayerSprite, pp->cursectnum); - DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } if (FAF_ConnectArea(pp->cursectnum)) { @@ -3951,7 +3890,6 @@ DoPlayerBeginCrawl(PLAYERp pp) RESET(pp->Flags, PF_FALLING | PF_JUMPING); SET(pp->Flags, PF_CRAWLING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_CRAWL_FRICTION; pp->floor_dist = PLAYER_CRAWL_FLOOR_DIST; @@ -4107,7 +4045,6 @@ DoPlayerBeginFly(PLAYERp pp) RESET(pp->Flags, PF_FALLING | PF_JUMPING | PF_CRAWLING); SET(pp->Flags, PF_FLYING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_FLY_FRICTION; pp->floor_dist = PLAYER_RUN_FLOOR_DIST; @@ -4794,7 +4731,6 @@ DoPlayerBeginDive(PLAYERp pp) if (pp->Bloody) pp->Bloody = FALSE; // Water washes away the blood SET(pp->Flags, PF_DIVING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -4860,7 +4796,6 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp) } SET(pp->Flags, PF_DIVING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -5267,7 +5202,6 @@ DoPlayerBeginWade(PLAYERp pp) RESET(pp->Flags, PF_JUMPING | PF_FALLING); RESET(pp->Flags, PF_CRAWLING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); pp->friction = PLAYER_WADE_FRICTION; pp->floor_dist = PLAYER_WADE_FLOOR_DIST; @@ -6933,7 +6867,6 @@ DoPlayerBeginRun(PLAYERp pp) } RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL|PF_CLIMBING); - SET(pp->Flags2, PF2_INPUT_CAN_AIM); if (pp->WadeDepth) { From 40a00be20246761b6b3473926bd40d68f7973aa8 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 20:25:26 +1000 Subject: [PATCH 19/49] - SW: Remove `inputScale` const from `processMovement()`. Isn't needed anymore since input scaling in `DoPlayerTurn()` has been removed. --- source/sw/src/input.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 7e5d61837..21c898192 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -205,9 +205,6 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool int32_t fvel = 0, svel = 0; fixed_t q16avel = 0, q16horz = 0; - // Constant used for scaling input down to match other games. May not last long after true re-factoring. - constexpr double inputScale = 263. / 360.; - if (loc.actions & SB_RUN) { turnamount = pp->sop_control ? RUNTURN * 3 : RUNTURN; @@ -221,23 +218,23 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (strafeKey) { - svel -= (hidInput->mousex * inputScale) * 4.f; + svel -= xs_CRoundToInt(hidInput->mousex * 4.); svel -= hidInput->dyaw * keymove; } else { - q16avel += FloatToFixed((hidInput->mousex + (scaleAdjust * hidInput->dyaw)) * inputScale); + q16avel += FloatToFixed(hidInput->mousex + (scaleAdjust * hidInput->dyaw)); } if (mouseaim) - q16horz -= FloatToFixed(hidInput->mousey * inputScale); + q16horz -= FloatToFixed(hidInput->mousey); else - fvel -= (hidInput->mousey * inputScale) * 8.f; + fvel -= xs_CRoundToInt(hidInput->mousey * 8.); if (in_mouseflip) q16horz = -q16horz; - q16horz -= FloatToFixed(scaleAdjust * (hidInput->dpitch * inputScale)); + q16horz -= FloatToFixed(scaleAdjust * hidInput->dpitch); svel -= hidInput->dx * keymove; fvel -= hidInput->dz * keymove; From 584ec935eddf303dea43283735f7674cf69d6e69 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 20:35:35 +1000 Subject: [PATCH 20/49] - SW: Add Duke's input helpers and adjust to suit SW. * These are temporary until a backend solution is available after all games have had initial uplift. --- source/sw/src/game.h | 7 ++++++ source/sw/src/player.cpp | 54 ++++++++++++++++++++++++++++++++++++++++ source/sw/src/player.h | 5 ++++ 3 files changed, 66 insertions(+) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 4e24bf84f..78e822263 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1007,6 +1007,13 @@ struct PLAYERstruct int cookieTime; char WpnReloadState; + + // Input helper variables and setters. + double horizAdjust, angAdjust, pitchAdjust; + void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; } + void setang(int v) { q16ang = IntToFixed(v); } + void addhoriz(int v) { q16horiz += (IntToFixed(v)); } + void sethoriz(int v) { q16horiz = IntToFixed(v); } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index fec5fdac7..5c861bc85 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7785,6 +7785,60 @@ void CheckFootPrints(PLAYERp pp) } } +//--------------------------------------------------------------------------- +// +// Unsynchronised input helpers. +// +//--------------------------------------------------------------------------- + +void playerAddAngle(PLAYERp pp, int ang) +{ + if (!cl_syncinput) + { + pp->angAdjust += ang; + } + else + { + pp->addang(ang); + } +} + +void playerSetAngle(PLAYERp pp, int ang) +{ + if (!cl_syncinput) + { + pp->angAdjust += -1. * ((pp->q16ang / 65536.) - ang); + } + else + { + pp->setang(ang); + } +} + +void playerAddHoriz(PLAYERp pp, int horiz) +{ + if (!cl_syncinput) + { + pp->horizAdjust += horiz; + } + else + { + pp->addhoriz(horiz); + } +} + +void playerSetHoriz(PLAYERp pp, int horiz) +{ + if (!cl_syncinput) + { + pp->horizAdjust += -1. * ((pp->q16horiz / 65536.) - horiz); + } + else + { + pp->sethoriz(horiz); + } +} + //--------------------------------------------------------------------------- // // diff --git a/source/sw/src/player.h b/source/sw/src/player.h index f50cac9c7..608dc40ff 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -144,6 +144,11 @@ void PlaySOsound(short sectnum,short sound_num); void DoSpawnTeleporterEffectPlace(SPRITEp sp); void FindMainSector(SECTOR_OBJECTp sop); +void playerAddAngle(PLAYERp pp, int ang); +void playerSetAngle(PLAYERp pp, int ang); +void playerAddHoriz(PLAYERp pp, int horiz); +void playerSetHoriz(PLAYERp pp, int horiz); + END_SW_NS #endif From 77816bf3d3f83a401de363c96e041e272bf70c4a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:03:30 +1000 Subject: [PATCH 21/49] - SW: Promote adjustment of helpers to double since some values will be coming in with higher precision. --- source/sw/src/player.cpp | 8 ++++---- source/sw/src/player.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 5c861bc85..af64c5b97 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7791,7 +7791,7 @@ void CheckFootPrints(PLAYERp pp) // //--------------------------------------------------------------------------- -void playerAddAngle(PLAYERp pp, int ang) +void playerAddAngle(PLAYERp pp, double ang) { if (!cl_syncinput) { @@ -7803,7 +7803,7 @@ void playerAddAngle(PLAYERp pp, int ang) } } -void playerSetAngle(PLAYERp pp, int ang) +void playerSetAngle(PLAYERp pp, double ang) { if (!cl_syncinput) { @@ -7815,7 +7815,7 @@ void playerSetAngle(PLAYERp pp, int ang) } } -void playerAddHoriz(PLAYERp pp, int horiz) +void playerAddHoriz(PLAYERp pp, double horiz) { if (!cl_syncinput) { @@ -7827,7 +7827,7 @@ void playerAddHoriz(PLAYERp pp, int horiz) } } -void playerSetHoriz(PLAYERp pp, int horiz) +void playerSetHoriz(PLAYERp pp, double horiz) { if (!cl_syncinput) { diff --git a/source/sw/src/player.h b/source/sw/src/player.h index 608dc40ff..1db99ae8e 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -144,10 +144,10 @@ void PlaySOsound(short sectnum,short sound_num); void DoSpawnTeleporterEffectPlace(SPRITEp sp); void FindMainSector(SECTOR_OBJECTp sop); -void playerAddAngle(PLAYERp pp, int ang); -void playerSetAngle(PLAYERp pp, int ang); -void playerAddHoriz(PLAYERp pp, int horiz); -void playerSetHoriz(PLAYERp pp, int horiz); +void playerAddAngle(PLAYERp pp, double ang); +void playerSetAngle(PLAYERp pp, double ang); +void playerAddHoriz(PLAYERp pp, double horiz); +void playerSetHoriz(PLAYERp pp, double horiz); END_SW_NS From 1cc1c21029645dd2ea305e3401941cadabbf714a Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:15:53 +1000 Subject: [PATCH 22/49] - SW: Add `resetinputhelpers()` and hook up within game. --- source/sw/src/player.cpp | 9 +++++++++ source/sw/src/player.h | 1 + 2 files changed, 10 insertions(+) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index af64c5b97..5da89c579 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7454,6 +7454,8 @@ domovethings(void) // Reset flags used while tying input to framerate RESET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); + resetinputhelpers(pp); + if (pp->DoPlayerAction) pp->DoPlayerAction(pp); UpdatePlayerSprite(pp); @@ -7791,6 +7793,13 @@ void CheckFootPrints(PLAYERp pp) // //--------------------------------------------------------------------------- +void resetinputhelpers(PLAYERp pp) +{ + pp->horizAdjust = 0; + pp->angAdjust = 0; + pp->pitchAdjust = 0; +} + void playerAddAngle(PLAYERp pp, double ang) { if (!cl_syncinput) diff --git a/source/sw/src/player.h b/source/sw/src/player.h index 1db99ae8e..ba1f8cec8 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -144,6 +144,7 @@ void PlaySOsound(short sectnum,short sound_num); void DoSpawnTeleporterEffectPlace(SPRITEp sp); void FindMainSector(SECTOR_OBJECTp sop); +void resetinputhelpers(PLAYERp pp); void playerAddAngle(PLAYERp pp, double ang); void playerSetAngle(PLAYERp pp, double ang); void playerAddHoriz(PLAYERp pp, double horiz); From e36c9fc78ca5d39bc6d0cf7016302976f69978ab Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:30:06 +1000 Subject: [PATCH 23/49] - SW: Hook up `angAdjust` and adjust all ticrate amendments of `q16ang` via `playerAddAngle()`/`playerSetAngle()`. * Promoted some uses of `getangle()` upscaled to Q16.16 with `gethiq16angle()` for higher precision. --- source/sw/src/draw.cpp | 2 +- source/sw/src/input.cpp | 2 +- source/sw/src/player.cpp | 48 ++++++++++++++++++++++------------------ source/sw/src/track.cpp | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 0ee25028a..1e9970f70 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1699,7 +1699,7 @@ drawscreen(PLAYERp pp, double smoothratio) tx = tx + quake_x; ty = ty + quake_y; //tq16horiz = tq16horiz + IntToFixed(quake_x); - tq16ang = IntToFixed(NORM_ANGLE(FixedToInt(tq16ang) + quake_ang)); + tq16ang = NORM_Q16ANGLE(tq16ang + quake_ang); if (pp->sop_remote) { diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 21c898192..8307d96b6 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -278,7 +278,7 @@ 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); + DoPlayerTurn(pp, !TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL) ? q16avel : 0, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) DoPlayerHorizon(pp, q16horz, scaleAdjust); } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 5da89c579..9ca36b9d6 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1608,17 +1608,22 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) if (q16avel != 0) { pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; + } - // update players sprite angle - // NOTE: It's also updated in UpdatePlayerSprite, but needs to be - // here to cover - // all cases. - sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + if (!cl_syncinput && pp->angAdjust) + { + pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; + } - if (!Prediction && pp->PlayerUnderSprite >= 0) - { - sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); - } + // update players sprite angle + // NOTE: It's also updated in UpdatePlayerSprite, but needs to be + // here to cover + // all cases. + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + + if (!Prediction && pp->PlayerUnderSprite >= 0) + { + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); } } @@ -3826,7 +3831,7 @@ DoPlayerClimb(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->q16ang = IntToFixed(pp->LadderAngle); + playerSetAngle(pp, pp->LadderAngle); } } } @@ -4285,7 +4290,7 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->q16ang = IntToFixed(pp->LadderAngle); + playerSetAngle(pp, pp->LadderAngle); return TRUE; } @@ -5522,7 +5527,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->sop = pp->sop_control = sop; sop->controller = pp->SpriteP; - pp->q16ang = IntToFixed(sop->ang); + playerSetAngle(pp, sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5607,7 +5612,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) save_sectnum = pp->cursectnum; - pp->q16ang = IntToFixed(sop->ang); + playerSetAngle(pp, sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5738,7 +5743,7 @@ DoPlayerStopOperate(PLAYERp pp) if (TEST_BOOL1(pp->remote_sprite)) pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang); else - pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); + pp->q16ang = pp->oq16ang = gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy); } if (pp->sop_control) @@ -6393,15 +6398,14 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) if (pp->Killer > -1) { SPRITEp kp = &sprite[pp->Killer]; - fixed_t q16ang2, delta_q16ang; - if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, - pp->posx, pp->posy, pp->posz, pp->cursectnum)) + if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum)) { - q16ang2 = gethiq16angle(kp->x - pp->posx, kp->y - pp->posy); - - delta_q16ang = GetDeltaQ16Angle(q16ang2, pp->q16ang); - pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4)); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN); + } + playerAddAngle(pp, GetDeltaQ16Angle(gethiq16angle(kp->x - pp->posx, kp->y - pp->posy), pp->q16ang) / (double)(FRACUNIT << 4)); } } } @@ -7439,7 +7443,7 @@ domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)); + playerSetAngle(&Player[screenpeek], gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy) / (double)(FRACUNIT)); } if (!TEST(pp->Flags, PF_DEAD)) diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 37a15a414..05112c290 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1676,7 +1676,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)); + playerSetAngle(pp, (pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) / (double)(FRACUNIT)); UpdatePlayerSprite(pp); } From 2e2ca038128b7603ccdf9067bea5506106ffcff3 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:34:13 +1000 Subject: [PATCH 24/49] - SW: Promote `recoil_horizoff` to Q16.16 to avoid down-scaling only to upscale. --- source/sw/src/draw.cpp | 2 +- source/sw/src/game.h | 2 +- source/sw/src/player.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 1e9970f70..99b599c9a 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1729,7 +1729,7 @@ drawscreen(PLAYERp pp, double smoothratio) tz += pp->obob_z + xs_CRoundToInt(fmulscale16(pp->bob_z - pp->obob_z, smoothratio)); // recoil only when not in camera - tq16horiz = tq16horiz + IntToFixed(pp->recoil_horizoff); + tq16horiz = tq16horiz + pp->recoil_horizoff; tq16horiz = max(tq16horiz, IntToFixed(PLAYER_HORIZ_MIN)); tq16horiz = min(tq16horiz, IntToFixed(PLAYER_HORIZ_MAX)); } diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 78e822263..082d7cac6 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -886,7 +886,7 @@ struct PLAYERstruct short recoil_amt; short recoil_speed; short recoil_ndx; - short recoil_horizoff; + fixed_t recoil_horizoff; int oldposx,oldposy,oldposz; int RevolveX, RevolveY; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 9ca36b9d6..bdecf262d 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -2012,7 +2012,7 @@ DoPlayerRecoil(PLAYERp pp) } // move pp->q16horiz up and down - pp->recoil_horizoff = ((pp->recoil_amt * sintable[pp->recoil_ndx]) >> 14); + pp->recoil_horizoff = (pp->recoil_amt * sintable[pp->recoil_ndx]) << 2; } From 681a8ebec28f5be222b880a49d3cf33019243c01 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:47:15 +1000 Subject: [PATCH 25/49] - SW: Hook up `horizAdjust` and adjust all ticrate amendments of `q16horiz` via `playerAddHoriz()`/`playerSetHoriz()`. --- source/sw/src/input.cpp | 2 +- source/sw/src/player.cpp | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 8307d96b6..d3ecd25de 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -280,7 +280,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) DoPlayerTurn(pp, !TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL) ? q16avel : 0, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, q16horz, scaleAdjust); + DoPlayerHorizon(pp, !TEST(pp->Flags, PF_DEAD) ? q16horz : 0, scaleAdjust); } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index bdecf262d..4a83201d1 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1936,6 +1936,11 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust) // add base and offsets pp->q16horiz = pp->q16horizbase + pp->q16horizoff; + + if (!cl_syncinput) + { + pp->q16horiz += xs_CRoundToInt(scaleAdjust * pp->horizAdjust); + } } void @@ -6288,24 +6293,30 @@ DoPlayerBeginDie(PLAYERp pp) RESET(pp->Flags, PF_HEAD_CONTROL); } -int +void DoPlayerDeathHoriz(PLAYERp pp, short target, short speed) { if (pp->q16horiz > IntToFixed(target)) - { - pp->q16horiz -= IntToFixed(speed); + { + if (!cl_syncinput) + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + + playerAddHoriz(pp, -speed); + if (pp->q16horiz <= IntToFixed(target)) - pp->q16horiz = IntToFixed(target); + playerSetHoriz(pp, target); } if (pp->q16horiz < IntToFixed(target)) { - pp->q16horiz += IntToFixed(speed); - if (pp->q16horiz >= IntToFixed(target)) - pp->q16horiz = IntToFixed(target); - } + if (!cl_syncinput) + SET(pp->Flags2, PF2_INPUT_CAN_AIM); - return pp->q16horiz == IntToFixed(target); + playerAddHoriz(pp, speed); + + if (pp->q16horiz >= IntToFixed(target)) + playerSetHoriz(pp, target); + } } int From e1a5e37126a5e94ce959a805f32b2cb7d086ec0d Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 21:50:43 +1000 Subject: [PATCH 26/49] - SW: Handle `DoPlayerTurn()`/`DoPlayerHorizon()` better while dead. --- source/sw/src/input.cpp | 4 +- source/sw/src/player.cpp | 194 ++++++++++++++++++++------------------- 2 files changed, 102 insertions(+), 96 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index d3ecd25de..21c898192 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -278,9 +278,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (!cl_syncinput) { if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, !TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL) ? q16avel : 0, scaleAdjust); + DoPlayerTurn(pp, q16avel, scaleAdjust); if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, !TEST(pp->Flags, PF_DEAD) ? q16horz : 0, scaleAdjust); + DoPlayerHorizon(pp, q16horz, scaleAdjust); } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 4a83201d1..445393749 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1551,63 +1551,66 @@ DoPlayerCrawlHeight(PLAYERp pp) void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) { - if (!TEST(pp->Flags, PF_TURN_180)) + if (!TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL)) { - if (pp->input.actions & SB_TURNAROUND) + if (!TEST(pp->Flags, PF_TURN_180)) { - if (pp->KeyPressBits & SB_TURNAROUND) + if (pp->input.actions & SB_TURNAROUND) { - fixed_t delta_ang; + if (pp->KeyPressBits & SB_TURNAROUND) + { + fixed_t delta_ang; - pp->KeyPressBits &= ~SB_TURNAROUND; + pp->KeyPressBits &= ~SB_TURNAROUND; - pp->turn180_target = pp->q16ang + IntToFixed(1024); + pp->turn180_target = pp->q16ang + IntToFixed(1024); - // make the first turn in the clockwise direction - // the rest will follow - delta_ang = labs(GetDeltaQ16Angle(pp->turn180_target, pp->q16ang)) >> TURN_SHIFT; - pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; + // make the first turn in the clockwise direction + // the rest will follow + delta_ang = labs(GetDeltaQ16Angle(pp->turn180_target, pp->q16ang)) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; - SET(pp->Flags, PF_TURN_180); + SET(pp->Flags, PF_TURN_180); + } + } + else + { + pp->KeyPressBits |= SB_TURNAROUND; } } - else + + if (TEST(pp->Flags, PF_TURN_180)) { - pp->KeyPressBits |= SB_TURNAROUND; - } - } + fixed_t delta_ang; - if (TEST(pp->Flags, PF_TURN_180)) - { - fixed_t delta_ang; + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; - delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang) >> TURN_SHIFT; - pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); - sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + if (!Prediction && pp->PlayerUnderSprite >= 0) + { + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); + } - if (!Prediction && pp->PlayerUnderSprite >= 0) - { - sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); + // get new delta to see how close we are + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang); + + if (labs(delta_ang) < (IntToFixed(3) << TURN_SHIFT)) + { + pp->q16ang = pp->turn180_target; + RESET(pp->Flags, PF_TURN_180); + } + else + { + return; + } } - // get new delta to see how close we are - delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang); - - if (labs(delta_ang) < (IntToFixed(3) << TURN_SHIFT)) + if (q16avel != 0) { - pp->q16ang = pp->turn180_target; - RESET(pp->Flags, PF_TURN_180); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; } - else - { - return; - } - } - - if (q16avel != 0) - { - pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; } if (!cl_syncinput && pp->angAdjust) @@ -1859,67 +1862,70 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust) void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust) { - // Fixme: This should probably be made optional. - if (cl_slopetilting) - PlayerAutoLook(pp, scaleAdjust); - - if (q16horz) + if (!TEST(pp->Flags, PF_DEAD)) { - pp->q16horizbase += q16horz; - SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); - } + // Fixme: This should probably be made optional. + if (cl_slopetilting) + PlayerAutoLook(pp, scaleAdjust); - // this is the locked type - if (pp->input.actions & (SB_AIM_UP|SB_AIM_DOWN)) - { - // set looking because player is manually looking. - SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); - - // adjust q16horiz negative - if (pp->input.actions & SB_AIM_DOWN) - pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); - - // adjust q16horiz positive - if (pp->input.actions & SB_AIM_UP) - pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); - } - - // this is the unlocked type - if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN|SB_CENTERVIEW)) - { - RESET(pp->Flags, PF_LOCK_HORIZ); - SET(pp->Flags, PF_LOOKING); - - // adjust q16horiz negative - if (pp->input.actions & SB_LOOK_DOWN) - pp->q16horizbase -= FloatToFixed(scaleAdjust * HORIZ_SPEED); - - // adjust q16horiz positive - if (pp->input.actions & SB_LOOK_UP) - pp->q16horizbase += FloatToFixed(scaleAdjust * HORIZ_SPEED); - - if (pp->input.actions & SB_CENTERVIEW) - pp->q16horizoff = 0; - } - - if (!TEST(pp->Flags, PF_LOCK_HORIZ)) - { - if (!(pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN))) + if (q16horz) { - // not pressing the q16horiz keys - if (pp->q16horizbase != IntToFixed(100)) + pp->q16horizbase += q16horz; + SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); + } + + // this is the locked type + if (pp->input.actions & (SB_AIM_UP|SB_AIM_DOWN)) + { + // set looking because player is manually looking. + SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); + + // adjust q16horiz negative + if (pp->input.actions & SB_AIM_DOWN) + pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); + + // adjust q16horiz positive + if (pp->input.actions & SB_AIM_UP) + pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); + } + + // this is the unlocked type + if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN|SB_CENTERVIEW)) + { + RESET(pp->Flags, PF_LOCK_HORIZ); + SET(pp->Flags, PF_LOOKING); + + // adjust q16horiz negative + if (pp->input.actions & SB_LOOK_DOWN) + pp->q16horizbase -= FloatToFixed(scaleAdjust * HORIZ_SPEED); + + // adjust q16horiz positive + if (pp->input.actions & SB_LOOK_UP) + pp->q16horizbase += FloatToFixed(scaleAdjust * HORIZ_SPEED); + + if (pp->input.actions & SB_CENTERVIEW) + pp->q16horizoff = 0; + } + + if (!TEST(pp->Flags, PF_LOCK_HORIZ)) + { + if (!(pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN))) { - // move q16horiz back to 100 - for (int i = 1; i; i--) + // not pressing the q16horiz keys + if (pp->q16horizbase != IntToFixed(100)) { - // this formula does not work for q16horiz = 101-103 - pp->q16horizbase += xs_CRoundToInt(scaleAdjust * (IntToFixed(25) - (pp->q16horizbase >> 2))); + // move q16horiz back to 100 + for (int i = 1; i; i--) + { + // this formula does not work for q16horiz = 101-103 + pp->q16horizbase += xs_CRoundToInt(scaleAdjust * (IntToFixed(25) - (pp->q16horizbase >> 2))); + } + } + else + { + // not looking anymore because q16horiz is back at 100 + RESET(pp->Flags, PF_LOOKING); } - } - else - { - // not looking anymore because q16horiz is back at 100 - RESET(pp->Flags, PF_LOOKING); } } } From df0331a4c3078641b70bb0f0903f18e08caee489 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 22:36:11 +1000 Subject: [PATCH 27/49] - SW: Promote all vehicle angle code to proper Q16.16. * Input still rough with `cl_syncinput 0` for vehicles. --- source/sw/src/game.h | 5 +- source/sw/src/player.cpp | 99 +++++++++++++++------------------------- source/sw/src/track.cpp | 3 +- 3 files changed, 40 insertions(+), 67 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 082d7cac6..b4b2d9cf2 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -863,7 +863,7 @@ struct PLAYERstruct int slide_xvect, slide_yvect; short slide_ang; int slide_dec; - int drive_angvel; + int drive_q16avel; @@ -1710,13 +1710,14 @@ struct SECTOR_OBJECTstruct morph_z_max, bob_amt, // bob amount max in z coord // variables set by mappers for drivables - drive_angspeed, drive_angslide, drive_speed, drive_slide, crush_z, flags; + fixed_t drive_angspeed; + short sector[MAX_SO_SECTOR], // hold the sector numbers of the sector object sp_num[MAX_SO_SPRITE], // hold the sprite numbers of the object xorig[MAX_SO_POINTS], // save the original x & y location of each wall so it can be diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 445393749..893e77333 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -85,9 +85,6 @@ SWBOOL NightVision = FALSE; extern SWBOOL FinishAnim; -//#define PLAYER_TURN_SCALE (8) -#define PLAYER_TURN_SCALE (12) - // the smaller the number the slower the going #define PLAYER_RUN_FRICTION (50000L) //#define PLAYER_RUN_FRICTION 0xcb00 @@ -1313,7 +1310,7 @@ DoPlayerResetMovement(PLAYERp pp) pp->yvect = pp->oxvect = 0; pp->slide_xvect = 0; pp->slide_yvect = 0; - pp->drive_angvel = 0; + pp->drive_q16avel = 0; RESET(pp->Flags, PF_PLAYER_MOVED); } @@ -1633,30 +1630,24 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) void DoPlayerTurnBoat(PLAYERp pp) { - int angvel; - int angslide; + fixed_t q16avel; SECTOR_OBJECTp sop = pp->sop; if (sop->drive_angspeed) { - int drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(FixedToInt(pp->input.q16avel), 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; - angslide = sop->drive_angslide; - pp->drive_angvel = (pp->drive_angvel + (drive_oangvel*(angslide-1)))/angslide; - - angvel = pp->drive_angvel; + q16avel = pp->drive_q16avel; } else { - angvel = FixedToInt(pp->input.q16avel) * PLAYER_TURN_SCALE; - angvel += angvel - DIV4(angvel); - angvel = DIV32(angvel * synctics); + q16avel = xs_CRoundToInt(q16avel * 1.4); } - if (angvel != 0) + if (q16avel != 0) { - pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang * q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1664,31 +1655,26 @@ DoPlayerTurnBoat(PLAYERp pp) void DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) { - int angvel; + fixed_t q16avel; SECTOR_OBJECTp sop = pp->sop; if (sop->drive_angspeed) { - int angslide; + 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; - int drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(FixedToInt(pp->input.q16avel), sop->drive_angspeed); - - angslide = sop->drive_angslide; - pp->drive_angvel = (pp->drive_angvel + (drive_oangvel*(angslide-1)))/angslide; - - angvel = pp->drive_angvel; + q16avel = pp->drive_q16avel; } else { - angvel = DIV8(FixedToInt(pp->input.q16avel) * synctics); + q16avel = DIV8(pp->input.q16avel * synctics); } - if (angvel != 0) + if (q16avel != 0) { - if (MultiClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), z, floor_dist)) + if (MultiClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang + q16avel)), z, floor_dist)) { - pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1697,31 +1683,26 @@ DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) void DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) { - int angvel; + fixed_t q16avel; SECTOR_OBJECTp sop = pp->sop; if (sop->drive_angspeed) { - int angslide; + 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; - int drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(FixedToInt(pp->input.q16avel), sop->drive_angspeed); - - angslide = sop->drive_angslide; - pp->drive_angvel = (pp->drive_angvel + (drive_oangvel*(angslide-1)))/angslide; - - angvel = pp->drive_angvel; + q16avel = pp->drive_q16avel; } else { - angvel = DIV8(FixedToInt(pp->input.q16avel) * synctics); + q16avel = DIV8(pp->input.q16avel * synctics); } - if (angvel != 0) + if (q16avel != 0) { - if (RectClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), x, y, ox, oy)) + if (RectClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang + q16avel)), x, y, ox, oy)) { - pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } @@ -1730,9 +1711,7 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) void DoPlayerTurnTurret(PLAYERp pp) { - int angvel; - short new_ang; - short diff; + fixed_t q16avel, new_ang, diff; SECTOR_OBJECTp sop = pp->sop; if (!Prediction) @@ -1745,40 +1724,34 @@ DoPlayerTurnTurret(PLAYERp pp) if (sop->drive_angspeed) { - int angslide; + 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; - int drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(FixedToInt(pp->input.q16avel), sop->drive_angspeed); - - angslide = sop->drive_angslide; - pp->drive_angvel = (pp->drive_angvel + (drive_oangvel*(angslide-1)))/angslide; - - angvel = pp->drive_angvel; + q16avel = pp->drive_q16avel; } else { - angvel = DIV4(FixedToInt(pp->input.q16avel) * synctics); + q16avel = DIV4(pp->input.q16avel * synctics); } - if (angvel != 0) + if (q16avel != 0) { - new_ang = NORM_ANGLE(FixedToInt(pp->q16ang) + angvel); + new_ang = (pp->q16ang + q16avel) & 0x7FFFFFF; if (sop->limit_ang_center >= 0) { - diff = GetDeltaAngle(new_ang, sop->limit_ang_center); + diff = GetDeltaQ16Angle(new_ang, IntToFixed(sop->limit_ang_center)); - if (labs(diff) >= sop->limit_ang_delta) + if (labs(diff) >= IntToFixed(sop->limit_ang_delta)) { if (diff < 0) - new_ang = sop->limit_ang_center - sop->limit_ang_delta; + new_ang = IntToFixed(sop->limit_ang_center - sop->limit_ang_delta); else - new_ang = sop->limit_ang_center + sop->limit_ang_delta; - + new_ang = IntToFixed(sop->limit_ang_center + sop->limit_ang_delta); } } - pp->q16ang = IntToFixed(new_ang); + pp->q16ang = new_ang; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 05112c290..2d9c3e1ba 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1273,8 +1273,7 @@ SetupSectorObject(short sectnum, short tag) case SO_DRIVABLE_ATTRIB: - sop->drive_angspeed = SP_TAG2(sp); - sop->drive_angspeed <<= 5; + sop->drive_angspeed = SP_TAG2(sp) << 21; sop->drive_angslide = SP_TAG3(sp); if (sop->drive_angslide <= 0 || sop->drive_angslide == 32) sop->drive_angslide = 1; From 0619281a34c4db322fed2dbbe507ee2b6e5e24c0 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 7 Sep 2020 22:48:25 +1000 Subject: [PATCH 28/49] - SW: Remove unused `centering` bool from `PLAYERp` struct. --- source/sw/src/game.h | 1 - 1 file changed, 1 deletion(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index b4b2d9cf2..474623250 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -881,7 +881,6 @@ struct PLAYERstruct // variables that do not fit into sprite structure int hvel,tilt,tilt_dest; - bool centering; fixed_t q16horiz, q16horizbase, q16horizoff, q16ang; short recoil_amt; short recoil_speed; From 5145bf907aa62f1ced70e946ce5440fd717c70d8 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 06:22:47 +1000 Subject: [PATCH 29/49] - 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. --- source/sw/src/game.h | 70 +++++++++++++++++++++------------------- source/sw/src/input.cpp | 19 +++++++++-- source/sw/src/player.cpp | 59 +++++++++++++++++++++------------ 3 files changed, 92 insertions(+), 56 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 474623250..ed73f1705 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -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 }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 21c898192..79ed8cdf9 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -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); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 893e77333..a8e68559a 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -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); From f14405f9ccfb7b7f11311c75124dbee9f252b7f8 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 06:24:26 +1000 Subject: [PATCH 30/49] SW: `getinput` -> `processMovement()`. --- source/sw/src/game.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index ed73f1705..79b2168a9 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1055,12 +1055,12 @@ enum 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 + 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_BOAT = (BIT(3)), // Allow calling DoPlayerTurnBoat() from processMovement() + PF2_INPUT_CAN_TURN_TANK = (BIT(4)), // Allow calling DoPlayerTurnTank() from processMovement() + PF2_INPUT_CAN_TURN_TANKRECT = (BIT(5)), // Allow calling DoPlayerTurnTankRect() from processMovement() + PF2_INPUT_CAN_TURN_TURRET = (BIT(6)), // Allow calling DoPlayerTurnTurret() from processMovement() }; /////////////////////////////////////////////////////////////////////////////////////////// From 083ed3e9b724f46b638033cd46a6df9f214c7d48 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 06:50:38 +1000 Subject: [PATCH 31/49] - SW: Handle `angAdjust` and `horizAdjust` directly in `processMovement()` instead of via `DoPlayerTurn()`/`DoPlayerHorizon()`. * Eliminates issues with when to call when player is dead, etc. Handles cases like climbing a ladder which doesn't trigger `DoPlayerTurn()`. --- source/sw/src/input.cpp | 6 + source/sw/src/player.cpp | 242 +++++++++++++++++---------------------- source/sw/src/track.cpp | 2 +- 3 files changed, 115 insertions(+), 135 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 79ed8cdf9..8e0607cee 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -283,6 +283,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) DoPlayerHorizon(pp, q16horz, scaleAdjust); + if (pp->horizAdjust) + pp->q16horiz += FloatToFixed(scaleAdjust * pp->horizAdjust); + if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) DoPlayerTurn(pp, q16avel, scaleAdjust); @@ -294,6 +297,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET)) DoPlayerTurnTurret(pp, q16avel); + + if (pp->angAdjust) + pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index a8e68559a..44464df5c 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1548,82 +1548,74 @@ DoPlayerCrawlHeight(PLAYERp pp) void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) { - if (!TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL)) + if (!TEST(pp->Flags, PF_TURN_180)) { - if (!TEST(pp->Flags, PF_TURN_180)) + if (pp->input.actions & SB_TURNAROUND) { - if (pp->input.actions & SB_TURNAROUND) + if (pp->KeyPressBits & SB_TURNAROUND) { - if (pp->KeyPressBits & SB_TURNAROUND) - { - fixed_t delta_ang; + fixed_t delta_ang; - pp->KeyPressBits &= ~SB_TURNAROUND; + pp->KeyPressBits &= ~SB_TURNAROUND; - pp->turn180_target = pp->q16ang + IntToFixed(1024); + pp->turn180_target = pp->q16ang + IntToFixed(1024); - // make the first turn in the clockwise direction - // the rest will follow - delta_ang = labs(GetDeltaQ16Angle(pp->turn180_target, pp->q16ang)) >> TURN_SHIFT; - pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; + // make the first turn in the clockwise direction + // the rest will follow + delta_ang = labs(GetDeltaQ16Angle(pp->turn180_target, pp->q16ang)) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; - SET(pp->Flags, PF_TURN_180); - } - } - else - { - pp->KeyPressBits |= SB_TURNAROUND; + SET(pp->Flags, PF_TURN_180); } } - - if (TEST(pp->Flags, PF_TURN_180)) + else { - fixed_t delta_ang; - - delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang) >> TURN_SHIFT; - pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; - - sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); - - if (!Prediction && pp->PlayerUnderSprite >= 0) - { - sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); - } - - // get new delta to see how close we are - delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang); - - if (labs(delta_ang) < (IntToFixed(3) << TURN_SHIFT)) - { - pp->q16ang = pp->turn180_target; - RESET(pp->Flags, PF_TURN_180); - } - else - { - return; - } - } - - if (q16avel != 0) - { - pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; + pp->KeyPressBits |= SB_TURNAROUND; } } - if (!cl_syncinput && pp->angAdjust) + if (TEST(pp->Flags, PF_TURN_180)) { - pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; + fixed_t delta_ang; + + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang) >> TURN_SHIFT; + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * delta_ang)) & 0x7FFFFFF; + + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + + if (!Prediction && pp->PlayerUnderSprite >= 0) + { + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); + } + + // get new delta to see how close we are + delta_ang = GetDeltaQ16Angle(pp->turn180_target, pp->q16ang); + + if (labs(delta_ang) < (IntToFixed(3) << TURN_SHIFT)) + { + pp->q16ang = pp->turn180_target; + RESET(pp->Flags, PF_TURN_180); + } + else + { + return; + } } - // update players sprite angle - // NOTE: It's also updated in UpdatePlayerSprite, but needs to be - // here to cover - // all cases. - sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); - - if (!Prediction && pp->PlayerUnderSprite >= 0) + if (q16avel != 0) { - sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; + + // update players sprite angle + // NOTE: It's also updated in UpdatePlayerSprite, but needs to be + // here to cover + // all cases. + sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); + + if (!Prediction && pp->PlayerUnderSprite >= 0) + { + sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang); + } } } @@ -1833,71 +1825,68 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust) void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust) { - if (!TEST(pp->Flags, PF_DEAD)) + // Fixme: This should probably be made optional. + if (cl_slopetilting) + PlayerAutoLook(pp, scaleAdjust); + + if (q16horz) { - // Fixme: This should probably be made optional. - if (cl_slopetilting) - PlayerAutoLook(pp, scaleAdjust); + pp->q16horizbase += q16horz; + SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); + } - if (q16horz) + // this is the locked type + if (pp->input.actions & (SB_AIM_UP|SB_AIM_DOWN)) + { + // set looking because player is manually looking. + SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); + + // adjust q16horiz negative + if (pp->input.actions & SB_AIM_DOWN) + pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); + + // adjust q16horiz positive + if (pp->input.actions & SB_AIM_UP) + pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); + } + + // this is the unlocked type + if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN|SB_CENTERVIEW)) + { + RESET(pp->Flags, PF_LOCK_HORIZ); + SET(pp->Flags, PF_LOOKING); + + // adjust q16horiz negative + if (pp->input.actions & SB_LOOK_DOWN) + pp->q16horizbase -= FloatToFixed(scaleAdjust * HORIZ_SPEED); + + // adjust q16horiz positive + if (pp->input.actions & SB_LOOK_UP) + pp->q16horizbase += FloatToFixed(scaleAdjust * HORIZ_SPEED); + + if (pp->input.actions & SB_CENTERVIEW) + pp->q16horizoff = 0; + } + + if (!TEST(pp->Flags, PF_LOCK_HORIZ)) + { + if (!(pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN))) { - pp->q16horizbase += q16horz; - SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); - } - - // this is the locked type - if (pp->input.actions & (SB_AIM_UP|SB_AIM_DOWN)) - { - // set looking because player is manually looking. - SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING); - - // adjust q16horiz negative - if (pp->input.actions & SB_AIM_DOWN) - pp->q16horizbase -= FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); - - // adjust q16horiz positive - if (pp->input.actions & SB_AIM_UP) - pp->q16horizbase += FloatToFixed(scaleAdjust * (HORIZ_SPEED >> 1)); - } - - // this is the unlocked type - if (pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN|SB_CENTERVIEW)) - { - RESET(pp->Flags, PF_LOCK_HORIZ); - SET(pp->Flags, PF_LOOKING); - - // adjust q16horiz negative - if (pp->input.actions & SB_LOOK_DOWN) - pp->q16horizbase -= FloatToFixed(scaleAdjust * HORIZ_SPEED); - - // adjust q16horiz positive - if (pp->input.actions & SB_LOOK_UP) - pp->q16horizbase += FloatToFixed(scaleAdjust * HORIZ_SPEED); - - if (pp->input.actions & SB_CENTERVIEW) - pp->q16horizoff = 0; - } - - if (!TEST(pp->Flags, PF_LOCK_HORIZ)) - { - if (!(pp->input.actions & (SB_LOOK_UP|SB_LOOK_DOWN))) + // not pressing the q16horiz keys + if (pp->q16horizbase != IntToFixed(100)) { - // not pressing the q16horiz keys - if (pp->q16horizbase != IntToFixed(100)) + // move q16horiz back to 100 + for (int i = 1; i; i--) { - // move q16horiz back to 100 - for (int i = 1; i; i--) - { - // this formula does not work for q16horiz = 101-103 - pp->q16horizbase += xs_CRoundToInt(scaleAdjust * (IntToFixed(25) - (pp->q16horizbase >> 2))); - } - } - else - { - // not looking anymore because q16horiz is back at 100 - RESET(pp->Flags, PF_LOOKING); + // this formula does not work for q16horiz = 101-103 + pp->q16horizbase += xs_CRoundToInt(scaleAdjust * (IntToFixed(25) - (pp->q16horizbase >> 2))); } } + else + { + // not looking anymore because q16horiz is back at 100 + RESET(pp->Flags, PF_LOOKING); + } } } @@ -1913,11 +1902,6 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust) // add base and offsets pp->q16horiz = pp->q16horizbase + pp->q16horizoff; - - if (!cl_syncinput) - { - pp->q16horiz += xs_CRoundToInt(scaleAdjust * pp->horizAdjust); - } } void @@ -4293,7 +4277,7 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - playerSetAngle(pp, pp->LadderAngle); + playerAddAngle(pp, FixedToFloat(GetDeltaQ16Angle(IntToFixed(pp->LadderAngle), pp->q16ang))); return TRUE; } @@ -6296,9 +6280,6 @@ DoPlayerDeathHoriz(PLAYERp pp, short target, short speed) { if (pp->q16horiz > IntToFixed(target)) { - if (!cl_syncinput) - SET(pp->Flags2, PF2_INPUT_CAN_AIM); - playerAddHoriz(pp, -speed); if (pp->q16horiz <= IntToFixed(target)) @@ -6307,9 +6288,6 @@ DoPlayerDeathHoriz(PLAYERp pp, short target, short speed) if (pp->q16horiz < IntToFixed(target)) { - if (!cl_syncinput) - SET(pp->Flags2, PF2_INPUT_CAN_AIM); - playerAddHoriz(pp, speed); if (pp->q16horiz >= IntToFixed(target)) @@ -6410,10 +6388,6 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum)) { - if (!cl_syncinput) - { - 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)); } } @@ -7452,7 +7426,7 @@ domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - playerSetAngle(&Player[screenpeek], gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy) / (double)(FRACUNIT)); + playerSetAngle(&Player[screenpeek], FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy))); } if (!TEST(pp->Flags, PF_DEAD)) diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 2d9c3e1ba..cdfcfcb80 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1675,7 +1675,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - playerSetAngle(pp, (pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) / (double)(FRACUNIT)); + playerSetAngle(pp, FixedToFloat(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng))); UpdatePlayerSprite(pp); } From cda79496ce25b029e103f215a5d67cd8be00cc0f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 18:12:45 +1000 Subject: [PATCH 32/49] - SW: Fix `DoPlayerDeathHoriz()` with unsynchronised input. --- source/sw/src/draw.cpp | 2 +- source/sw/src/player.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 99b599c9a..413aae590 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1651,7 +1651,7 @@ drawscreen(PLAYERp pp, double smoothratio) tz = camerapp->oposz + xs_CRoundToInt(fmulscale16(camerapp->posz - camerapp->oposz, smoothratio)); // TODO: It'd be better to check pp->input.q16angvel instead, problem is that // it's been repurposed for the q16ang diff while tying input to framerate - if (cl_syncinput || (pp != Player+myconnectindex) || TEST(pp->Flags, PF_DEAD)) + if (cl_syncinput || pp != Player+myconnectindex) { tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16ang + IntToFixed(1024) - camerapp->oq16ang) - IntToFixed(1024), smoothratio)); tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio)); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 44464df5c..f7980ae16 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -6278,20 +6278,14 @@ DoPlayerBeginDie(PLAYERp pp) void DoPlayerDeathHoriz(PLAYERp pp, short target, short speed) { - if (pp->q16horiz > IntToFixed(target)) + if ((pp->q16horiz - IntToFixed(target)) > FRACUNIT) { playerAddHoriz(pp, -speed); - - if (pp->q16horiz <= IntToFixed(target)) - playerSetHoriz(pp, target); } - if (pp->q16horiz < IntToFixed(target)) + if ((IntToFixed(target) - pp->q16horiz) > FRACUNIT) { playerAddHoriz(pp, speed); - - if (pp->q16horiz >= IntToFixed(target)) - playerSetHoriz(pp, target); } } From c00217163ba6b31a0c8eb1b0315709942f6ec9d6 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 19:38:32 +1000 Subject: [PATCH 33/49] - SW: Fix turret sound with unsynchronised input. --- source/sw/src/player.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index f7980ae16..cbd523f6d 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1704,14 +1704,6 @@ DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel) fixed_t new_ang, diff; SECTOR_OBJECTp sop = pp->sop; - if (!Prediction) - { - if (q16avel && !pp->lastinput.q16avel) - PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); - 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; @@ -3169,6 +3161,14 @@ DoPlayerMoveTank(PLAYERp pp) void DoPlayerMoveTurret(PLAYERp 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_TURN_TURRET); From 73d0772e87a4e38bb8b98f04f91a29c0f5f3e6b2 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 19:42:22 +1000 Subject: [PATCH 34/49] - SW: Call `DoPlayerMoveTurret()` in `processMovement()` in lieu of `DoPlayerTurnTurret()` and don't interpolate sector object's sprite while `!cl_syncinput`. * Makes operating the tank silky smooth while unsynchronised. --- source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 6 ++--- source/sw/src/interpso.cpp | 12 ++++++---- source/sw/src/player.cpp | 47 ++++++++++++++++---------------------- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 79b2168a9..e354aa96b 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1060,7 +1060,7 @@ enum PF2_INPUT_CAN_TURN_BOAT = (BIT(3)), // Allow calling DoPlayerTurnBoat() from processMovement() PF2_INPUT_CAN_TURN_TANK = (BIT(4)), // Allow calling DoPlayerTurnTank() from processMovement() PF2_INPUT_CAN_TURN_TANKRECT = (BIT(5)), // Allow calling DoPlayerTurnTankRect() from processMovement() - PF2_INPUT_CAN_TURN_TURRET = (BIT(6)), // Allow calling DoPlayerTurnTurret() from processMovement() + PF2_INPUT_CAN_MOVE_TURRET = (BIT(6)), // Allow calling DoPlayerMoveTurret() from processMovement() }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 8e0607cee..5df8ea8bc 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -38,7 +38,7 @@ 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); +void DoPlayerMoveTurret(PLAYERp pp, fixed_t q16avel, fixed_t q16horz, double const scaleAdjust); static InputPacket loc; static int32_t turnheldtime; @@ -295,8 +295,8 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool 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); + if (TEST(pp->Flags2, PF2_INPUT_CAN_MOVE_TURRET)) + DoPlayerMoveTurret(pp, q16avel, q16horz, scaleAdjust); if (pp->angAdjust) pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index b587de082..ee296e90c 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -202,7 +202,8 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; if (interp->tic < interp->lasttic) interp->tic += synctics; @@ -240,7 +241,8 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; for (i = 0; i < interp->numinterpolations; i++) @@ -266,7 +268,8 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; // Check if interpolation has been explicitly disabled @@ -326,7 +329,8 @@ void so_restoreinterpolations(void) // Stick at end of drawscree for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index cbd523f6d..d3fe01ead 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -3159,24 +3159,9 @@ DoPlayerMoveTank(PLAYERp pp) } void -DoPlayerMoveTurret(PLAYERp pp) +DoPlayerMoveTurret(PLAYERp pp, fixed_t q16avel, fixed_t q16horz, double const scaleAdjust) { - 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); - } + DoPlayerTurnTurret(pp, q16avel); if (PLAYER_MOVING(pp) == 0) RESET(pp->Flags, PF_PLAYER_MOVED); @@ -3185,14 +3170,7 @@ DoPlayerMoveTurret(PLAYERp pp) OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid); - if (!cl_syncinput) - { - SET(pp->Flags2, PF2_INPUT_CAN_AIM); - } - else - { - DoPlayerHorizon(pp, pp->input.q16horz, 1); - } + DoPlayerHorizon(pp, q16horz, scaleAdjust); } void @@ -5774,7 +5752,22 @@ DoPlayerOperateTurret(PLAYERp pp) if (pp->sop_remote) RemoteToPlayer(pp); - DoPlayerMoveTurret(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); + } if (pp->sop_remote) { @@ -7434,7 +7427,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_BOAT|PF2_INPUT_CAN_TURN_TANK|PF2_INPUT_CAN_TURN_TANKRECT|PF2_INPUT_CAN_TURN_TURRET); + 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_MOVE_TURRET); resetinputhelpers(pp); if (pp->DoPlayerAction) pp->DoPlayerAction(pp); From cb7e797842df329555dd8e5f27350aa5425bab8b Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 20:48:01 +1000 Subject: [PATCH 35/49] - SW: Partially revert changes from df0331a4c3078641b70bb0f0903f18e08caee489. --- source/sw/src/game.h | 3 +-- source/sw/src/track.cpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index e354aa96b..d4b1714c7 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1713,14 +1713,13 @@ struct SECTOR_OBJECTstruct morph_z_max, bob_amt, // bob amount max in z coord // variables set by mappers for drivables + drive_angspeed, drive_angslide, drive_speed, drive_slide, crush_z, flags; - fixed_t drive_angspeed; - short sector[MAX_SO_SECTOR], // hold the sector numbers of the sector object sp_num[MAX_SO_SPRITE], // hold the sprite numbers of the object xorig[MAX_SO_POINTS], // save the original x & y location of each wall so it can be diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index cdfcfcb80..4b1570261 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1273,7 +1273,8 @@ SetupSectorObject(short sectnum, short tag) case SO_DRIVABLE_ATTRIB: - sop->drive_angspeed = SP_TAG2(sp) << 21; + sop->drive_angspeed = SP_TAG2(sp); + sop->drive_angspeed <<= 5; sop->drive_angslide = SP_TAG3(sp); if (sop->drive_angslide <= 0 || sop->drive_angslide == 32) sop->drive_angslide = 1; From 8625ac573d316fd75ac93d766e07c9a24f6af927 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 21:40:20 +1000 Subject: [PATCH 36/49] - SW: Comment out all boat code, it's actually not used within the game at all and was very confusing... --- source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 4 +++- source/sw/src/panel.cpp | 2 +- source/sw/src/player.cpp | 22 +++++++++++++++++----- source/sw/src/track.cpp | 2 ++ source/sw/src/weapon.cpp | 2 ++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index d4b1714c7..47bdd2c6d 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1832,7 +1832,7 @@ struct SECTOR_OBJECTstruct #define SO_TURRET_MGUN 96 // machine gun #define SO_TURRET 97 #define SO_TANK 98 -#define SO_SPEED_BOAT 99 +// #define SO_SPEED_BOAT 99 #define SO_EMPTY(sop) ((sop)->xmid == INT32_MAX) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 5df8ea8bc..5b282d7f6 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -36,7 +36,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 DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel); +// void DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel); void DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist); void DoPlayerMoveTurret(PLAYERp pp, fixed_t q16avel, fixed_t q16horz, double const scaleAdjust); @@ -289,8 +289,10 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) DoPlayerTurn(pp, q16avel, scaleAdjust); +#if 0 if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_BOAT)) DoPlayerTurnBoat(pp, q16avel); +#endif 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)); diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index 674b053d1..a776caf92 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -460,7 +460,7 @@ int WeaponOperate(PLAYERp pp) case SO_TANK: case SO_TURRET: case SO_TURRET_MGUN: - case SO_SPEED_BOAT: + // case SO_SPEED_BOAT: if (!TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) break; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index d3fe01ead..d40de04ac 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -163,10 +163,10 @@ void DoPlayerBeginClimb(PLAYERp pp); void DoPlayerClimb(PLAYERp pp); void DoPlayerBeginDie(PLAYERp pp); void DoPlayerDie(PLAYERp pp); -void DoPlayerBeginOperateBoat(PLAYERp pp); +// void DoPlayerBeginOperateBoat(PLAYERp pp); void DoPlayerBeginOperateTank(PLAYERp pp); void DoPlayerBeginOperate(PLAYERp pp); -void DoPlayerOperateBoat(PLAYERp pp); +// void DoPlayerOperateBoat(PLAYERp pp); void DoPlayerOperateTank(PLAYERp pp); void DoPlayerOperateTurret(PLAYERp pp); void DoPlayerBeginDive(PLAYERp pp); @@ -1619,6 +1619,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) } } +#if 0 void DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel) { @@ -1638,10 +1639,11 @@ DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel) if (q16avel != 0) { - pp->q16ang = (pp->q16ang * q16avel) & 0x7FFFFFF; + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } +#endif void DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) @@ -2585,6 +2587,7 @@ void StopSOsound(short sectnum) } } +#if 0 void DoPlayerMoveBoat(PLAYERp pp) { @@ -2668,6 +2671,7 @@ DoPlayerMoveBoat(PLAYERp pp) DoPlayerHorizon(pp, pp->input.q16horz, 1); } } +#endif void DoTankTreads(PLAYERp pp) { @@ -5334,6 +5338,7 @@ DoPlayerWade(PLAYERp pp) } +#if 0 void DoPlayerBeginOperateBoat(PLAYERp pp) { @@ -5353,6 +5358,7 @@ DoPlayerBeginOperateBoat(PLAYERp pp) NewStateGroup(pp->PlayerSprite, u->ActorActionSet->Run); } +#endif void DoPlayerBeginOperateTank(PLAYERp pp) @@ -5534,6 +5540,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateTurret(pp); break; +#if 0 case SO_SPEED_BOAT: if (pp->input.fvel|pp->input.svel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); @@ -5542,6 +5549,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateBoat(pp); break; +#endif default: return; } @@ -5622,6 +5630,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateTurret(pp); break; +#if 0 case SO_SPEED_BOAT: if (pp->input.fvel|pp->input.svel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); @@ -5630,6 +5639,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateBoat(pp); break; +#endif default: return; } @@ -5777,6 +5787,7 @@ DoPlayerOperateTurret(PLAYERp pp) } +#if 0 void DoPlayerOperateBoat(PLAYERp pp) { @@ -5815,6 +5826,7 @@ DoPlayerOperateBoat(PLAYERp pp) PlayerRemoteReset(pp, save_sectnum); } } +#endif void DoPlayerOperateTank(PLAYERp pp) @@ -7853,10 +7865,10 @@ static saveable_code saveable_player_code[] = SAVE_CODE(DoPlayerClimb), SAVE_CODE(DoPlayerBeginDie), //SAVE_CODE(DoPlayerDie), - SAVE_CODE(DoPlayerBeginOperateBoat), + //SAVE_CODE(DoPlayerBeginOperateBoat), SAVE_CODE(DoPlayerBeginOperateTank), SAVE_CODE(DoPlayerBeginOperate), - SAVE_CODE(DoPlayerOperateBoat), + //SAVE_CODE(DoPlayerOperateBoat), SAVE_CODE(DoPlayerOperateTank), SAVE_CODE(DoPlayerOperateTurret), SAVE_CODE(DoPlayerBeginDive), diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 4b1570261..f182d8b30 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1394,12 +1394,14 @@ SetupSectorObject(short sectnum, short tag) sop->vel = 0; SET(sop->flags, SOBJ_OPERATIONAL); break; +#if 0 case SO_SPEED_BOAT: sop->vel = 0; sop->bob_amt = Z(2); sop->bob_speed = 4; SET(sop->flags, SOBJ_OPERATIONAL); break; +#endif default: SET(sop->flags, SOBJ_OPERATIONAL); break; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 1250485ab..a70d881a3 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -5985,6 +5985,7 @@ DoDamage(short SpriteNum, short Weapon) } break; +#if 0 case SO_SPEED_BOAT: damage = -100; @@ -6010,6 +6011,7 @@ DoDamage(short SpriteNum, short Weapon) SpawnBlood(SpriteNum, Weapon, 0, 0, 0, 0); break; +#endif } } From 1e3199413cbf7d9ec560355e51f927d3756f5b17 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 8 Sep 2020 21:54:48 +1000 Subject: [PATCH 37/49] - SW: Rename all Tank-related function code to Vehicle. --- source/sw/src/game.h | 7 +++---- source/sw/src/input.cpp | 6 +++--- source/sw/src/panel.cpp | 2 +- source/sw/src/player.cpp | 38 +++++++++++++++++++------------------- source/sw/src/track.cpp | 2 +- source/sw/src/weapon.cpp | 2 +- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 47bdd2c6d..6952c3f9a 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1058,9 +1058,8 @@ 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_BOAT = (BIT(3)), // Allow calling DoPlayerTurnBoat() from processMovement() - PF2_INPUT_CAN_TURN_TANK = (BIT(4)), // Allow calling DoPlayerTurnTank() from processMovement() - PF2_INPUT_CAN_TURN_TANKRECT = (BIT(5)), // Allow calling DoPlayerTurnTankRect() from processMovement() - PF2_INPUT_CAN_MOVE_TURRET = (BIT(6)), // Allow calling DoPlayerMoveTurret() from processMovement() + PF2_INPUT_CAN_TURN_VEHICLE = (BIT(4)), // Allow calling DoPlayerTurnVehicle() from processMovement() + PF2_INPUT_CAN_MOVE_TURRET = (BIT(5)), // Allow calling DoPlayerMoveTurret() from processMovement() }; /////////////////////////////////////////////////////////////////////////////////////////// @@ -1831,7 +1830,7 @@ struct SECTOR_OBJECTstruct #define SO_OPERATE_TRACK_START 90 #define SO_TURRET_MGUN 96 // machine gun #define SO_TURRET 97 -#define SO_TANK 98 +#define SO_VEHICLE 98 // #define SO_SPEED_BOAT 99 #define SO_EMPTY(sop) ((sop)->xmid == INT32_MAX) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 5b282d7f6..512e078d2 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -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 DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel); -void DoPlayerTurnTank(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); static InputPacket loc; @@ -294,8 +294,8 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool DoPlayerTurnBoat(pp, q16avel); #endif - 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_VEHICLE)) + 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)) DoPlayerMoveTurret(pp, q16avel, q16horz, scaleAdjust); diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index a776caf92..4cb163594 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -457,7 +457,7 @@ int WeaponOperate(PLAYERp pp) { switch (pp->sop->track) { - case SO_TANK: + case SO_VEHICLE: case SO_TURRET: case SO_TURRET_MGUN: // case SO_SPEED_BOAT: diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index d40de04ac..110cc7cbe 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -164,10 +164,10 @@ void DoPlayerClimb(PLAYERp pp); void DoPlayerBeginDie(PLAYERp pp); void DoPlayerDie(PLAYERp pp); // void DoPlayerBeginOperateBoat(PLAYERp pp); -void DoPlayerBeginOperateTank(PLAYERp pp); +void DoPlayerBeginOperateVehicle(PLAYERp pp); void DoPlayerBeginOperate(PLAYERp pp); // void DoPlayerOperateBoat(PLAYERp pp); -void DoPlayerOperateTank(PLAYERp pp); +void DoPlayerOperateVehicle(PLAYERp pp); void DoPlayerOperateTurret(PLAYERp pp); void DoPlayerBeginDive(PLAYERp pp); void DoPlayerDive(PLAYERp pp); @@ -1646,7 +1646,7 @@ DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel) #endif void -DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) +DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) { SECTOR_OBJECTp sop = pp->sop; @@ -1673,7 +1673,7 @@ DoPlayerTurnTank(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) } void -DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) +DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) { fixed_t q16avel; SECTOR_OBJECTp sop = pp->sop; @@ -2949,7 +2949,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) } void -DoPlayerMoveTank(PLAYERp pp) +DoPlayerMoveVehicle(PLAYERp pp) { int z; int floor_dist; @@ -3057,7 +3057,7 @@ DoPlayerMoveTank(PLAYERp pp) save_cstat = pp->SpriteP->cstat; RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK); - DoPlayerTurnTankRect(pp, x, y, ox, oy); + DoPlayerTurnVehicleRect(pp, x, y, ox, oy); ret = RectClipMove(pp, x, y); DriveCrush(pp, x, y); @@ -3107,11 +3107,11 @@ DoPlayerMoveTank(PLAYERp pp) { if (!cl_syncinput) { - SET(pp->Flags2, PF2_INPUT_CAN_TURN_TANK); + SET(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE); } else { - DoPlayerTurnTank(pp, pp->input.q16avel, z, floor_dist); + DoPlayerTurnVehicle(pp, pp->input.q16avel, z, floor_dist); } save_cstat = pp->SpriteP->cstat; @@ -5361,13 +5361,13 @@ DoPlayerBeginOperateBoat(PLAYERp pp) #endif void -DoPlayerBeginOperateTank(PLAYERp pp) +DoPlayerBeginOperateVehicle(PLAYERp pp) { USERp u = User[pp->PlayerSprite]; pp->floor_dist = PLAYER_RUN_FLOOR_DIST; pp->ceiling_dist = PLAYER_RUN_CEILING_DIST; - pp->DoPlayerAction = DoPlayerOperateTank; + pp->DoPlayerAction = DoPlayerOperateVehicle; // temporary set to get weapons down if (TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) @@ -5523,13 +5523,13 @@ DoPlayerBeginOperate(PLAYERp pp) switch (sop->track) { - case SO_TANK: + case SO_VEHICLE: if (pp->input.fvel|pp->input.svel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); else PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); pp->posz = fz - PLAYER_HEIGHT; - DoPlayerBeginOperateTank(pp); + DoPlayerBeginOperateVehicle(pp); break; case SO_TURRET_MGUN: case SO_TURRET: @@ -5613,13 +5613,13 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) switch (sop->track) { - case SO_TANK: + case SO_VEHICLE: if (pp->input.fvel|pp->input.svel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); else PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); pp->posz = fz - PLAYER_HEIGHT; - DoPlayerBeginOperateTank(pp); + DoPlayerBeginOperateVehicle(pp); break; case SO_TURRET_MGUN: case SO_TURRET: @@ -5829,7 +5829,7 @@ DoPlayerOperateBoat(PLAYERp pp) #endif void -DoPlayerOperateTank(PLAYERp pp) +DoPlayerOperateVehicle(PLAYERp pp) { short save_sectnum; @@ -5858,7 +5858,7 @@ DoPlayerOperateTank(PLAYERp pp) if (pp->sop_remote) RemoteToPlayer(pp); - DoPlayerMoveTank(pp); + DoPlayerMoveVehicle(pp); if (pp->sop_remote) { @@ -7439,7 +7439,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_BOAT|PF2_INPUT_CAN_TURN_TANK|PF2_INPUT_CAN_TURN_TANKRECT|PF2_INPUT_CAN_MOVE_TURRET); + RESET(pp->Flags2, PF2_INPUT_CAN_AIM|PF2_INPUT_CAN_TURN_GENERAL|PF2_INPUT_CAN_TURN_BOAT|PF2_INPUT_CAN_TURN_VEHICLE|PF2_INPUT_CAN_MOVE_TURRET); resetinputhelpers(pp); if (pp->DoPlayerAction) pp->DoPlayerAction(pp); @@ -7866,10 +7866,10 @@ static saveable_code saveable_player_code[] = SAVE_CODE(DoPlayerBeginDie), //SAVE_CODE(DoPlayerDie), //SAVE_CODE(DoPlayerBeginOperateBoat), - SAVE_CODE(DoPlayerBeginOperateTank), + SAVE_CODE(DoPlayerBeginOperateVehicle), SAVE_CODE(DoPlayerBeginOperate), //SAVE_CODE(DoPlayerOperateBoat), - SAVE_CODE(DoPlayerOperateTank), + SAVE_CODE(DoPlayerOperateVehicle), SAVE_CODE(DoPlayerOperateTurret), SAVE_CODE(DoPlayerBeginDive), SAVE_CODE(DoPlayerDive), diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index f182d8b30..c3eea0a47 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1390,7 +1390,7 @@ SetupSectorObject(short sectnum, short tag) { case SO_TURRET_MGUN: case SO_TURRET: - case SO_TANK: + case SO_VEHICLE: sop->vel = 0; SET(sop->flags, SOBJ_OPERATIONAL); break; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index a70d881a3..c2631e32c 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -5948,7 +5948,7 @@ DoDamage(short SpriteNum, short Weapon) { switch (wu->PlayerP->sop->track) { - case SO_TANK: + case SO_VEHICLE: damage = -200; if (u->sop_parent) From 48630914b1b2dbe080743f55d2e13fde53a54706 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 9 Sep 2020 00:34:51 +1000 Subject: [PATCH 38/49] - SW: Remove boat code from new input code for cleanliness. --- source/sw/src/game.h | 5 ++--- source/sw/src/input.cpp | 10 ++-------- source/sw/src/player.cpp | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 6952c3f9a..1c8c107fa 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1057,9 +1057,8 @@ enum PF2_TELEPORTED = (BIT(0)), 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_BOAT = (BIT(3)), // Allow calling DoPlayerTurnBoat() from processMovement() - PF2_INPUT_CAN_TURN_VEHICLE = (BIT(4)), // Allow calling DoPlayerTurnVehicle() from processMovement() - PF2_INPUT_CAN_MOVE_TURRET = (BIT(5)), // Allow calling DoPlayerMoveTurret() 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() }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 512e078d2..fd4c43f82 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -36,7 +36,6 @@ 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 DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel); 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); @@ -289,19 +288,14 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) DoPlayerTurn(pp, q16avel, scaleAdjust); -#if 0 - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_BOAT)) - DoPlayerTurnBoat(pp, q16avel); -#endif + if (pp->angAdjust) + pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE)) 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)) DoPlayerMoveTurret(pp, q16avel, q16horz, scaleAdjust); - - if (pp->angAdjust) - pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 110cc7cbe..e52482ef9 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7439,7 +7439,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_BOAT|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_MOVE_TURRET); resetinputhelpers(pp); if (pp->DoPlayerAction) pp->DoPlayerAction(pp); From b832442e3125da548145e761b039cf69c717ab7f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 9 Sep 2020 21:29:03 +1000 Subject: [PATCH 39/49] - SW: New implementation of `playerSetAngle()` that works better for intended purpose. This corrects the issues with angle not being quite right when getting onto a ladder. --- source/sw/src/game.h | 1 + source/sw/src/input.cpp | 25 ++++++++++++++++++++++++- source/sw/src/player.cpp | 13 +++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 27c2c9bda..8c7ae8645 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1009,6 +1009,7 @@ struct PLAYERstruct // Input helper variables and setters. double horizAdjust, angAdjust, pitchAdjust; + fixed_t angTarget; void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; } void setang(int v) { q16ang = IntToFixed(v); } void addhoriz(int v) { q16horiz += (IntToFixed(v)); } diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index fd4c43f82..33f588a97 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -280,22 +280,45 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool if (!cl_syncinput) { if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) + { DoPlayerHorizon(pp, q16horz, scaleAdjust); + } if (pp->horizAdjust) + { pp->q16horiz += FloatToFixed(scaleAdjust * pp->horizAdjust); + } if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) + { DoPlayerTurn(pp, q16avel, scaleAdjust); + } - if (pp->angAdjust) + if (pp->angTarget) + { + fixed_t angDelta = GetDeltaQ16Angle(pp->angTarget, pp->q16ang); + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * angDelta)); + + if (pp->q16ang >= pp->angTarget) + { + pp->q16ang = pp->angTarget; + pp->angTarget = 0; + } + } + else if (pp->angAdjust) + { pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF; + } if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE)) + { 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)) + { DoPlayerMoveTurret(pp, q16avel, q16horz, scaleAdjust); + } } loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 4a25cbd93..51593e82c 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -4258,7 +4258,7 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - playerAddAngle(pp, FixedToFloat(GetDeltaQ16Angle(IntToFixed(pp->LadderAngle), pp->q16ang))); + playerSetAngle(pp, pp->LadderAngle); return TRUE; } @@ -7801,7 +7801,16 @@ void playerSetAngle(PLAYERp pp, double ang) { if (!cl_syncinput) { - pp->angAdjust += -1. * ((pp->q16ang / 65536.) - ang); + // Cancel out any angle adjustments as we're setting angle now. + pp->angAdjust = 0; + + // Add slight offset if input angle is coming in as absolute 0. + if (ang == 0) + { + ang += 0.1; + } + + pp->angTarget = pp->q16ang + GetDeltaQ16Angle(ang, pp->q16ang); } else { From e24521b1890ca324063e7b4415af0bd9198bca5d Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 9 Sep 2020 22:04:46 +1000 Subject: [PATCH 40/49] - SW: Uplift `playerSetHoriz()` similar to uplift to `playerSetAngle()` in b832442e3125da548145e761b039cf69c717ab7f. --- source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 13 ++++++++++++- source/sw/src/player.cpp | 11 ++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 8c7ae8645..6d0c38a38 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1009,7 +1009,7 @@ struct PLAYERstruct // Input helper variables and setters. double horizAdjust, angAdjust, pitchAdjust; - fixed_t angTarget; + fixed_t horizTarget, angTarget; void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; } void setang(int v) { q16ang = IntToFixed(v); } void addhoriz(int v) { q16horiz += (IntToFixed(v)); } diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 33f588a97..f1bec201e 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -284,7 +284,18 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool DoPlayerHorizon(pp, q16horz, scaleAdjust); } - if (pp->horizAdjust) + if (pp->horizTarget) + { + fixed_t horizDelta = pp->horizTarget - pp->q16horiz; + pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta); + + if (abs(pp->q16horiz) >= abs(horizDelta)) + { + pp->q16horiz = pp->horizTarget; + pp->horizTarget = 0; + } + } + else if (pp->horizAdjust) { pp->q16horiz += FloatToFixed(scaleAdjust * pp->horizAdjust); } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 51593e82c..7fe6e18fa 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7834,7 +7834,16 @@ void playerSetHoriz(PLAYERp pp, double horiz) { if (!cl_syncinput) { - pp->horizAdjust += -1. * ((pp->q16horiz / 65536.) - horiz); + // Cancel out any horizon adjustments as we're setting horizon now. + pp->horizAdjust = 0; + + // Add slight offset if input horizon is coming in as absolute 0. + if (horiz == 0) + { + horiz += 0.1; + } + + pp->horizTarget = FloatToFixed(horiz); } else { From 28a3ef131ffcc85733162d2a78d770aedfafa346 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 9 Sep 2020 22:45:21 +1000 Subject: [PATCH 41/49] - SW: Attempt at making vehicle movement work nicely while uninterpolated. --- source/sw/src/interpso.cpp | 17 +++++++++-------- source/sw/src/player.cpp | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index ee296e90c..d8dbf7d01 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -191,6 +191,11 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics) interp->lasttic = locktics; } +static inline bool so_nointerpolations(short track) +{ + return !cl_syncinput && (track >= SO_TURRET_MGUN && track <= SO_VEHICLE); +} + void so_updateinterpolations(void) // Stick at beginning of domovethings { int32_t i; @@ -202,8 +207,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - bool skip = !cl_syncinput && (sop->track == SO_TURRET); - if (SO_EMPTY(sop) || skip) + if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) continue; if (interp->tic < interp->lasttic) interp->tic += synctics; @@ -241,8 +245,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - bool skip = !cl_syncinput && (sop->track == SO_TURRET); - if (SO_EMPTY(sop) || skip) + if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) continue; for (i = 0; i < interp->numinterpolations; i++) @@ -268,8 +271,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - bool skip = !cl_syncinput && (sop->track == SO_TURRET); - if (SO_EMPTY(sop) || skip) + if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) continue; // Check if interpolation has been explicitly disabled @@ -329,8 +331,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - bool skip = !cl_syncinput && (sop->track == SO_TURRET); - if (SO_EMPTY(sop) || skip) + if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) continue; for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 7fe6e18fa..e2aa24f72 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1669,6 +1669,11 @@ DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } + + if (!cl_syncinput) + { + OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio), pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio)); + } } void @@ -3042,7 +3047,10 @@ DoPlayerMoveVehicle(PLAYERp pp) } save_sectnum = pp->cursectnum; - OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO); + if (cl_syncinput) + { + OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO); + } pp->cursectnum = pp->sop->op_main_sector; // for speed floor_dist = labs(z - pp->sop->floor_loz); @@ -3146,7 +3154,11 @@ DoPlayerMoveVehicle(PLAYERp pp) } } - OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); + if (cl_syncinput) + { + OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); + } + pp->cursectnum = save_sectnum; // for speed if (!cl_syncinput) From b2272bd37755e485ba687241b853951512f275c4 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 9 Sep 2020 23:00:43 +1000 Subject: [PATCH 42/49] SW: Partially revert 73d0772e87a4e38bb8b98f04f91a29c0f5f3e6b2 and do in a way that's more fidele to the original workflow. --- source/sw/src/game.h | 2 +- source/sw/src/input.cpp | 6 ++--- source/sw/src/player.cpp | 51 +++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 6d0c38a38..8193aaca0 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -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() }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index f1bec201e..b4e69949e 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -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); } } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index e2aa24f72..054390928 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -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); From 1a647e810421e2f0b9c8f09b36a811446e75ec3c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Sep 2020 19:52:52 +0200 Subject: [PATCH 43/49] - globally search and replaced TRUE and FALSE in SW. There were a handful of warnings afterward which were also addressed. The SWBOOL type has not been handled yet. --- source/build/include/compat.h | 10 - source/sw/src/actor.cpp | 16 +- source/sw/src/ai.cpp | 60 +- source/sw/src/break.cpp | 58 +- source/sw/src/bunny.cpp | 36 +- source/sw/src/cheats.cpp | 8 +- source/sw/src/colormap.cpp | 72 +-- source/sw/src/coolg.cpp | 4 +- source/sw/src/copysect.cpp | 2 +- source/sw/src/d_menu.cpp | 2 +- source/sw/src/draw.cpp | 38 +- source/sw/src/game.cpp | 8 +- source/sw/src/game.h | 8 +- source/sw/src/hornet.cpp | 2 +- source/sw/src/input.cpp | 4 +- source/sw/src/interpso.cpp | 6 +- source/sw/src/inv.cpp | 16 +- source/sw/src/jsector.cpp | 56 +- source/sw/src/jweapon.cpp | 64 +- source/sw/src/mclip.cpp | 26 +- source/sw/src/menus.cpp | 2 +- source/sw/src/miscactr.cpp | 24 +- source/sw/src/network.cpp | 2 +- source/sw/src/ninja.cpp | 26 +- source/sw/src/panel.cpp | 102 ++-- source/sw/src/player.cpp | 148 ++--- source/sw/src/predict.cpp | 8 +- source/sw/src/quake.cpp | 2 +- source/sw/src/ripper.cpp | 12 +- source/sw/src/ripper2.cpp | 8 +- source/sw/src/rooms.cpp | 54 +- source/sw/src/rotator.cpp | 14 +- source/sw/src/save.cpp | 8 +- source/sw/src/scrip2.cpp | 26 +- source/sw/src/sector.cpp | 156 ++--- source/sw/src/skel.cpp | 2 +- source/sw/src/slidor.cpp | 20 +- source/sw/src/spike.cpp | 14 +- source/sw/src/sprite.cpp | 184 +++--- source/sw/src/sumo.cpp | 14 +- source/sw/src/track.cpp | 98 +-- source/sw/src/vator.cpp | 22 +- source/sw/src/wallmove.cpp | 22 +- source/sw/src/warp.cpp | 10 +- source/sw/src/weapon.cpp | 1076 ++++++++++++++++----------------- source/sw/src/zombie.cpp | 12 +- 46 files changed, 1276 insertions(+), 1286 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 5507db3a1..6ef0ba94e 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -269,14 +269,4 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr, /* End dependence on compat.o object. */ -////////// EDuke32-specific features ////////// - -#ifndef TRUE -# define TRUE 1 -#endif - -#ifndef FALSE -# define FALSE 0 -#endif - #endif // compat_h_ diff --git a/source/sw/src/actor.cpp b/source/sw/src/actor.cpp index 6427a4494..2cc18abee 100644 --- a/source/sw/src/actor.cpp +++ b/source/sw/src/actor.cpp @@ -334,7 +334,7 @@ DoActorSectorDamage(short SpriteNum) SECTORp sectp = §or[sp->sectnum]; if (u->Health <= 0) - return FALSE; + return false; if (sectu && sectu->damage) { @@ -349,7 +349,7 @@ DoActorSectorDamage(short SpriteNum) { UpdateSinglePlayKills(SpriteNum); DoActorDie(SpriteNum, WPN_NM_LAVA); - return TRUE; + return true; } } } @@ -364,7 +364,7 @@ DoActorSectorDamage(short SpriteNum) { UpdateSinglePlayKills(SpriteNum); DoActorDie(SpriteNum, WPN_NM_LAVA); - return TRUE; + return true; } } } @@ -382,14 +382,14 @@ DoActorSectorDamage(short SpriteNum) } else { - ASSERT(TRUE == FALSE); + ASSERT(true == false); //DoActorDie(SpriteNum, WPN_NM_SECTOR_SQUISH); } - return TRUE; + return true; } - return FALSE; + return false; } @@ -641,7 +641,7 @@ DoActorSlide(short SpriteNum) if (!move_actor(SpriteNum, nx, ny, 0L)) { RESET(u->Flags, SPR_SLIDING); - return FALSE; + return false; } u->slide_vel -= u->slide_dec * ACTORMOVETICS; @@ -651,7 +651,7 @@ DoActorSlide(short SpriteNum) RESET(u->Flags, SPR_SLIDING); } - return TRUE; + return true; } // !AIC - Actor jumping and falling diff --git a/source/sw/src/ai.cpp b/source/sw/src/ai.cpp index a147d61b3..66697ac73 100644 --- a/source/sw/src/ai.cpp +++ b/source/sw/src/ai.cpp @@ -118,7 +118,7 @@ SWBOOL ActorMoveHitReact(short SpriteNum) { USERp u = User[SpriteNum]; - // Should only return TRUE if there is a reaction to what was hit that + // Should only return true if there is a reaction to what was hit that // would cause the calling function to abort switch (TEST(u->ret, HIT_MASK)) @@ -140,7 +140,7 @@ SWBOOL ActorMoveHitReact(short SpriteNum) if (action) { (*action)(SpriteNum); - return TRUE; + return true; } } break; @@ -157,7 +157,7 @@ SWBOOL ActorMoveHitReact(short SpriteNum) } } - return FALSE; + return false; } @@ -177,10 +177,10 @@ SWBOOL ActorFlaming(short SpriteNum) MONO_PRINT(ds); if (SPRITEp_SIZE_Z(fp) > size) - return TRUE; + return true; } - return FALSE; + return false; } void @@ -217,7 +217,7 @@ ChooseAction(DECISION decision[]) // !JIM! Here is an opportunity for some AI, instead of randomness! random_value = RANDOM_P2(1024<<5)>>5; - for (i = 0; TRUE; i++) + for (i = 0; true; i++) { ASSERT(i < 10); @@ -240,7 +240,7 @@ ChooseActionNumber(short decision[]) random_value = RANDOM_P2(1024<<5)>>5; - for (i = 0; TRUE; i++) + for (i = 0; true; i++) { if (random_value <= decision[i]) { @@ -318,12 +318,12 @@ CanSeePlayer(short SpriteNum) int look_height = SPRITEp_TOS(sp); //if (FAF_Sector(sp->sectnum)) - // return(TRUE); + // return(true); if (u->tgt_sp && FAFcansee(sp->x, sp->y, look_height, sp->sectnum, u->tgt_sp->x, u->tgt_sp->y, SPRITEp_UPPER(u->tgt_sp), u->tgt_sp->sectnum)) - return TRUE; + return true; else - return FALSE; + return false; } int @@ -333,12 +333,12 @@ CanHitPlayer(short SpriteNum) SPRITEp sp = User[SpriteNum]->SpriteP, hp; hitdata_t hitinfo; int xvect,yvect,zvect; - short ang,ret=FALSE; + short ang,ret=false; // if actor can still see the player int zhs, zhh; //if (FAF_Sector(sp->sectnum)) - // return(TRUE); + // return(true); zhs = sp->z - DIV2(SPRITEp_SIZE_Z(sp)); @@ -358,13 +358,13 @@ CanHitPlayer(short SpriteNum) else if (hp->y - sp->y != 0) zvect = yvect * ((zhh - zhs)/(hp->y - sp->y)); else - return FALSE; + return false; // so actors won't shoot straight up at you // need to be a bit of a distance away // before they have a valid shot // if (labs(zvect / FindDistance2D(hp->x - sp->x, hp->y - sp->y)) > 200) -// return(FALSE); +// return(false); FAFhitscan(sp->x, sp->y, zhs, sp->sectnum, xvect, @@ -373,15 +373,15 @@ CanHitPlayer(short SpriteNum) &hitinfo, CLIPMASK_MISSILE); if (hitinfo.sect < 0) - return FALSE; + return false; if (hitinfo.sprite == u->tgt_sp - sprite) - return TRUE; + return true; - ////DSPRINTF(ds,"CanHit %s",ret ? "TRUE" : "FALSE"); + ////DSPRINTF(ds,"CanHit %s",ret ? "true" : "false"); //MONO_PRINT(ds); - return FALSE; + return false; } /* @@ -399,7 +399,7 @@ DoActorPickClosePlayer(short SpriteNum) PLAYERp pp; // if actor can still see the player int look_height = SPRITEp_TOS(sp); - SWBOOL found = FALSE; + SWBOOL found = false; int i,nexti; if (u->ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE) @@ -454,7 +454,7 @@ DoActorPickClosePlayer(short SpriteNum) // see if you can find someone close that you can SEE near_dist = MAX_ACTIVE_RANGE; - found = FALSE; + found = false; TRAVERSE_CONNECT(pnum) { pp = &Player[pnum]; @@ -480,7 +480,7 @@ DoActorPickClosePlayer(short SpriteNum) { near_dist = dist; u->tgt_sp = pp->SpriteP; - found = TRUE; + found = true; } } @@ -553,13 +553,13 @@ int DoActorOperate(short SpriteNum) unsigned int i; if (u->ID == HORNET_RUN_R0 || u->ID == EEL_RUN_R0 || u->ID == BUNNY_RUN_R0) - return FALSE; + return false; if (u->Rot == u->ActorActionSet->Sit || u->Rot == u->ActorActionSet->Stand) - return FALSE; + return false; if ((u->WaitTics -= ACTORMOVETICS) > 0) - return FALSE; + return false; //DSPRINTF(ds,"sp->x = %ld, sp->y = %ld, sp->sector = %d, tp->x = %ld, tp->y = %ld, tp->ang = %d\n",sp->x,sp->y,sp->sectnum,tpoint->x,tpoint->y,tpoint->ang); //MONO_PRINT(ds); @@ -579,7 +579,7 @@ int DoActorOperate(short SpriteNum) #if 0 // Actors don't hit switches on a whim if (nearsprite >= 0 && nearhitdist < 1024) { - if (OperateSprite(nearsprite, FALSE)) + if (OperateSprite(nearsprite, false)) { u->WaitTics = 2 * 120; @@ -592,7 +592,7 @@ int DoActorOperate(short SpriteNum) if (nearsector >= 0 && nearhitdist < 1024) { - if (OperateSector(nearsector, FALSE)) + if (OperateSector(nearsector, false)) { u->WaitTics = 2 * 120; @@ -602,14 +602,14 @@ int DoActorOperate(short SpriteNum) if (nearwall >= 0 && nearhitdist < 1024) { - if (OperateWall(nearwall, FALSE)) + if (OperateWall(nearwall, false)) { u->WaitTics = 2 * 120; NewStateGroup(SpriteNum, u->ActorActionSet->Stand); } } - return TRUE; + return true; } @@ -639,7 +639,7 @@ DoActorActionDecide(short SpriteNum) int dist; ANIMATORp action; USERp pu=NULL; - SWBOOL ICanSee=FALSE; + SWBOOL ICanSee=false; // REMINDER: This function is not even called if SpriteControl doesn't let // it get called @@ -794,7 +794,7 @@ DoActorActionDecide(short SpriteNum) if (!u->DidAlert && ICanSee) { DoActorNoise(InitActorAlertNoise, SpriteNum); - u->DidAlert = TRUE; + u->DidAlert = true; } return action; diff --git a/source/sw/src/break.cpp b/source/sw/src/break.cpp index 2fe297922..229f035d5 100644 --- a/source/sw/src/break.cpp +++ b/source/sw/src/break.cpp @@ -590,11 +590,11 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short if (!break_info) { - return FALSE; + return false; } // Check to see if it should break with current weapon type - if (!CheckBreakToughness(break_info, type)) return FALSE; + if (!CheckBreakToughness(break_info, type)) return false; if (hit_x != INT32_MAX) { @@ -657,7 +657,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short } - return TRUE; + return true; } SWBOOL UserBreakWall(WALLp wp, short) @@ -668,7 +668,7 @@ SWBOOL UserBreakWall(WALLp wp, short) int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN; int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY; int flags = block_flags|type_flags; - short ret = FALSE; + short ret = false; SpriteNum = FindBreakSpriteMatch(match); @@ -684,13 +684,13 @@ SWBOOL UserBreakWall(WALLp wp, short) wp->hitag = wp->lotag = 0; if (wp->nextwall >= 0) wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; - return TRUE; + return true; } sp = &sprite[SpriteNum]; if (wp->picnum == SP_TAG5(sp)) - return TRUE; + return true; // make it BROKEN if (SP_TAG7(sp) <= 1) @@ -705,7 +705,7 @@ SWBOOL UserBreakWall(WALLp wp, short) wp->hitag = wp->lotag = 0; if (wp->nextwall >= 0) wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; - ret = FALSE; + ret = false; } else if (SP_TAG8(sp) == 1) { @@ -718,7 +718,7 @@ SWBOOL UserBreakWall(WALLp wp, short) if (wp->nextwall >= 0) wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; - ret = TRUE; + ret = true; } else if (SP_TAG8(sp) == 2) { @@ -735,7 +735,7 @@ SWBOOL UserBreakWall(WALLp wp, short) if (wp->nextwall >= 0) wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; - ret = FALSE; + ret = false; } return ret; @@ -748,7 +748,7 @@ SWBOOL UserBreakWall(WALLp wp, short) DoSpawnSpotsForDamage(match); } - return FALSE; + return false; } int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang) @@ -810,10 +810,10 @@ int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, sh if (*sectnum < 0) { *x = INT32_MAX; // don't spawn shrap, just change wall - return FALSE; + return false; } - return TRUE; + return true; } // If the tough parameter is not set, then it can't break tough walls and sprites @@ -824,7 +824,7 @@ SWBOOL HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short if (match > 0) { UserBreakWall(wp, ang); - return TRUE; + return true; } //if (hit_x == INT32_MAX) @@ -834,7 +834,7 @@ SWBOOL HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short } AutoBreakWall(wp, hit_x, hit_y, hit_z, ang, type); - return TRUE; + return true; } // @@ -891,14 +891,14 @@ int UserBreakSprite(short BreakSprite) DeleteNoSoundOwner(BreakSprite); //change_sprite_stat(BreakSprite, STAT_SUICIDE); KillBreakSprite(BreakSprite); - return TRUE; + return true; } sp = &sprite[SpriteNum]; match_extra = SP_TAG6(bp); if (bp->picnum == SP_TAG5(sp)) - return TRUE; + return true; // make it BROKEN if (SP_TAG7(sp) <= 1) @@ -921,7 +921,7 @@ int UserBreakSprite(short BreakSprite) KillBreakSprite(BreakSprite); //KillSprite(BreakSprite); //change_sprite_stat(BreakSprite, STAT_SUICIDE); - return TRUE; + return true; } else if (SP_TAG8(sp) == 2) // leave it @@ -946,7 +946,7 @@ int UserBreakSprite(short BreakSprite) DoSpawnSpotsForDamage(match_extra); } - return FALSE; + return false; } int AutoBreakSprite(short BreakSprite, short type) @@ -965,7 +965,7 @@ int AutoBreakSprite(short BreakSprite, short type) { //DSPRINTF(ds,"Break Info not found - sprite %d", bp - sprite); MONO_PRINT(ds); - return FALSE; + return false; } // Check to see if it should break with current weapon type @@ -988,7 +988,7 @@ int AutoBreakSprite(short BreakSprite, short type) RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } - return FALSE; + return false; } RESET(bp->extra, SPRX_BREAKABLE); @@ -1012,7 +1012,7 @@ int AutoBreakSprite(short BreakSprite, short type) KillBreakSprite(BreakSprite); //change_sprite_stat(BreakSprite, STAT_SUICIDE); //KillSprite(BreakSprite); - return TRUE; + return true; } else { @@ -1021,7 +1021,7 @@ int AutoBreakSprite(short BreakSprite, short type) RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } - return FALSE; + return false; } SWBOOL NullActor(USERp u) @@ -1030,17 +1030,17 @@ SWBOOL NullActor(USERp u) // check to see if attached to SO if (TEST(u->Flags, SPR_SO_ATTACHED)) - return TRUE; + return true; // does not have a STATE or FUNC to control it if (!u->State) - return TRUE; + return true; // does not have a STATE or FUNC to control it if (!u->ActorActionFunc) - return TRUE; + return true; - return FALSE; + return false; } int HitBreakSprite(short BreakSprite, short type) @@ -1051,12 +1051,12 @@ int HitBreakSprite(short BreakSprite, short type) //SPRITEp sp; // ignore as a breakable if true //if (sp->lotag == TAG_SPRITE_HIT_MATCH) - // return(FALSE); + // return(false); if (TEST_BOOL1(bp)) { if (TEST_BOOL2(bp)) - return FALSE; + return false; return UserBreakSprite(BreakSprite); } @@ -1069,7 +1069,7 @@ int HitBreakSprite(short BreakSprite, short type) SpawnShrap(BreakSprite, -1); RESET(bp->extra, SPRX_BREAKABLE); - return FALSE; + return false; } return AutoBreakSprite(BreakSprite,type); diff --git a/source/sw/src/bunny.cpp b/source/sw/src/bunny.cpp index a74cc3740..63af41ae4 100644 --- a/source/sw/src/bunny.cpp +++ b/source/sw/src/bunny.cpp @@ -832,7 +832,7 @@ PickBunnyJumpSpeed(short SpriteNum, int pix_height) u->jump_speed = -600; u->jump_grav = 8; - while (TRUE) + while (true) { if (GetBunnyJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20) break; @@ -931,7 +931,7 @@ DoPickCloseBunny(short SpriteNum) // if actor can still see the player int look_height = SPRITEp_TOS(sp); - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) { @@ -965,7 +965,7 @@ DoBunnyQuickJump(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - if (u->spal != PALETTE_PLAYER8) return FALSE; + if (u->spal != PALETTE_PLAYER8) return false; if (!u->lo_sp && u->spal == PALETTE_PLAYER8 && MoveSkip4) DoPickCloseBunny(SpriteNum); @@ -977,12 +977,12 @@ DoBunnyQuickJump(short SpriteNum) SPRITEp tsp = u->lo_sp; USERp tu = User[hit_sprite]; - if (!tu || tu->ID != BUNNY_RUN_R0) return FALSE; + if (!tu || tu->ID != BUNNY_RUN_R0) return false; // Not mature enough yet - if (sp->xrepeat != 64 || sp->yrepeat != 64) return FALSE; - if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return FALSE; + if (sp->xrepeat != 64 || sp->yrepeat != 64) return false; + if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return false; // Kill a rival // Only males fight @@ -995,7 +995,7 @@ DoBunnyQuickJump(short SpriteNum) tu->Health = 0; // Blood fountains - InitBloodSpray(hit_sprite,TRUE,-1); + InitBloodSpray(hit_sprite,true,-1); if (SpawnShrap(hit_sprite, SpriteNum)) { @@ -1007,7 +1007,7 @@ DoBunnyQuickJump(short SpriteNum) Bunny_Count--; // Bunny died u->lo_sp = NULL; - return TRUE; + return true; } } } @@ -1020,11 +1020,11 @@ DoBunnyQuickJump(short SpriteNum) USERp tu = User[hit_sprite]; - if (!tu || tu->ID != BUNNY_RUN_R0) return FALSE; + if (!tu || tu->ID != BUNNY_RUN_R0) return false; // Not mature enough to mate yet - if (sp->xrepeat != 64 || sp->yrepeat != 64) return FALSE; - if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return FALSE; + if (sp->xrepeat != 64 || sp->yrepeat != 64) return false; + if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return false; if (tu->ShellNum <= 0 && tu->WaitTics <= 0 && u->WaitTics <= 0) { @@ -1032,7 +1032,7 @@ DoBunnyQuickJump(short SpriteNum) { PLAYERp pp = NULL; - if (RANDOM_RANGE(1000) < 995 && tu->spal != PALETTE_PLAYER0) return FALSE; + if (RANDOM_RANGE(1000) < 995 && tu->spal != PALETTE_PLAYER0) return false; DoActorPickClosePlayer(SpriteNum); @@ -1041,7 +1041,7 @@ DoBunnyQuickJump(short SpriteNum) if (tu->spal != PALETTE_PLAYER0) { - if (tu->Flag1 > 0) return FALSE; + if (tu->Flag1 > 0) return false; tu->FlagOwner = 1; // FAG! tu->Flag1 = SEC(10); if (pp) @@ -1091,12 +1091,12 @@ DoBunnyQuickJump(short SpriteNum) SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible } u->WaitTics = tu->WaitTics = SEC(10); // Mate for this long - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -1215,7 +1215,7 @@ void BunnyHatch(short Weapon) Bunny_Count--; // Bunny died // Blood fountains - InitBloodSpray(Weapon,TRUE,-1); + InitBloodSpray(Weapon,true,-1); if (SpawnShrap(Weapon, New)) { @@ -1394,8 +1394,8 @@ DoBunnyMove(short SpriteNum) int BunnySpew(short SpriteNum) { - //InitBloodSpray(SpriteNum,TRUE,-1); - InitBloodSpray(SpriteNum,TRUE,-1); + //InitBloodSpray(SpriteNum,true,-1); + InitBloodSpray(SpriteNum,true,-1); return 0; } diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index a43cb1914..4bc0a52c7 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -45,8 +45,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -SWBOOL CheatInputMode = FALSE; -SWBOOL EveryCheat = FALSE; +SWBOOL CheatInputMode = false; +SWBOOL EveryCheat = false; SWBOOL mapcheat = false; extern SWBOOL FAF_DebugView; @@ -219,7 +219,7 @@ static void ItemCheat(int player) { auto p = &Player[player]; PutStringInfo(p, GStrings("GIVING EVERYTHING!")); - memset(p->HasKey, TRUE, sizeof(p->HasKey)); + memset(p->HasKey, true, sizeof(p->HasKey)); p->WpnShotgunAuto = 50; p->WpnRocketHeat = 5; @@ -299,7 +299,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) break; case GIVE_KEYS: - memset(Player[player].HasKey, TRUE, sizeof(Player[player].HasKey)); + memset(Player[player].HasKey, true, sizeof(Player[player].HasKey)); PutStringInfo(&Player[player], GStrings("TXTS_GIVEKEY")); break; diff --git a/source/sw/src/colormap.cpp b/source/sw/src/colormap.cpp index ea4716ece..0b648808a 100644 --- a/source/sw/src/colormap.cpp +++ b/source/sw/src/colormap.cpp @@ -225,77 +225,77 @@ InitPalette(void) for (i = 0; i < 256; i++) tempbuf[i] = i; // palette for underwater - lookups.makeTable(PALETTE_DIVE, tempbuf, 0, 0, FOG_AMT, TRUE); + lookups.makeTable(PALETTE_DIVE, tempbuf, 0, 0, FOG_AMT, true); for (i = 0; i < 256; i++) tempbuf[i] = i; - lookups.makeTable(PALETTE_FOG, tempbuf, FOG_AMT, FOG_AMT, FOG_AMT, TRUE); + lookups.makeTable(PALETTE_FOG, tempbuf, FOG_AMT, FOG_AMT, FOG_AMT, true); for (i = 0; i < 256; i++) tempbuf[i] = i; - lookups.makeTable(PALETTE_DIVE_LAVA, tempbuf, LAVA_AMT, 0, 0, TRUE); + lookups.makeTable(PALETTE_DIVE_LAVA, tempbuf, LAVA_AMT, 0, 0, true); // // 1 Range changes // - MapColors(PALETTE_BROWN_RIPPER, BrownRipper, TRUE, tempbuf); - lookups.makeTable(PALETTE_BROWN_RIPPER, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_BROWN_RIPPER, BrownRipper, true, tempbuf); + lookups.makeTable(PALETTE_BROWN_RIPPER, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_SKEL_GORE, SkelGore, TRUE, tempbuf); - lookups.makeTable(PALETTE_SKEL_GORE, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_SKEL_GORE, SkelGore, true, tempbuf); + lookups.makeTable(PALETTE_SKEL_GORE, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_ELECTRO_GORE, ElectroGore, TRUE, tempbuf); - lookups.makeTable(PALETTE_ELECTRO_GORE, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_ELECTRO_GORE, ElectroGore, true, tempbuf); + lookups.makeTable(PALETTE_ELECTRO_GORE, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_MENU_HIGHLIGHT, MenuHighlight, TRUE, tempbuf); - lookups.makeTable(PALETTE_MENU_HIGHLIGHT, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_MENU_HIGHLIGHT, MenuHighlight, true, tempbuf); + lookups.makeTable(PALETTE_MENU_HIGHLIGHT, tempbuf, 0, 0, 0, true); // // Multiple range changes // - MapColors(PALETTE_BASIC_NINJA, NinjaBasic[0], TRUE, tempbuf); + MapColors(PALETTE_BASIC_NINJA, NinjaBasic[0], true, tempbuf); for (i = 1; i < SIZ(NinjaBasic); i++) - MapColors(PALETTE_BASIC_NINJA, NinjaBasic[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_BASIC_NINJA, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_BASIC_NINJA, NinjaBasic[i], false, tempbuf); + lookups.makeTable(PALETTE_BASIC_NINJA, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_RED_NINJA, NinjaRed[0], TRUE, tempbuf); + MapColors(PALETTE_RED_NINJA, NinjaRed[0], true, tempbuf); for (i = 1; i < SIZ(NinjaRed); i++) - MapColors(PALETTE_RED_NINJA, NinjaRed[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_RED_NINJA, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_RED_NINJA, NinjaRed[i], false, tempbuf); + lookups.makeTable(PALETTE_RED_NINJA, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_GREEN_NINJA, NinjaGreen[0], TRUE, tempbuf); + MapColors(PALETTE_GREEN_NINJA, NinjaGreen[0], true, tempbuf); for (i = 1; i < SIZ(NinjaGreen); i++) - MapColors(PALETTE_GREEN_NINJA, NinjaGreen[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_GREEN_NINJA, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_GREEN_NINJA, NinjaGreen[i], false, tempbuf); + lookups.makeTable(PALETTE_GREEN_NINJA, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[0], TRUE, tempbuf); + MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[0], true, tempbuf); for (i = 1; i < SIZ(AllToGreen); i++) - MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_GREEN_LIGHTING, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[i], false, tempbuf); + lookups.makeTable(PALETTE_GREEN_LIGHTING, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_RED_LIGHTING, AllToRed[0], TRUE, tempbuf); + MapColors(PALETTE_RED_LIGHTING, AllToRed[0], true, tempbuf); for (i = 1; i < SIZ(AllToRed); i++) - MapColors(PALETTE_RED_LIGHTING, AllToRed[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_RED_LIGHTING, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_RED_LIGHTING, AllToRed[i], false, tempbuf); + lookups.makeTable(PALETTE_RED_LIGHTING, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[0], TRUE, tempbuf); + MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[0], true, tempbuf); for (i = 1; i < SIZ(AllToBlue); i++) - MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_BLUE_LIGHTING, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[i], false, tempbuf); + lookups.makeTable(PALETTE_BLUE_LIGHTING, tempbuf, 0, 0, 0, true); - MapColors(PALETTE_ILLUMINATE, Illuminate[0], TRUE, tempbuf); + MapColors(PALETTE_ILLUMINATE, Illuminate[0], true, tempbuf); for (i = 1; i < SIZ(Illuminate); i++) - MapColors(PALETTE_ILLUMINATE, Illuminate[i], FALSE, tempbuf); - lookups.makeTable(PALETTE_ILLUMINATE, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_ILLUMINATE, Illuminate[i], false, tempbuf); + lookups.makeTable(PALETTE_ILLUMINATE, tempbuf, 0, 0, 0, true); // PLAYER COLORS - ALSO USED FOR OTHER THINGS for (play = 0; play < PLAYER_COLOR_MAPS; play++) { - MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], TRUE, tempbuf); - MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], FALSE, tempbuf); - lookups.makeTable(PALETTE_PLAYER0 + play, tempbuf, 0, 0, 0, TRUE); + MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], true, tempbuf); + MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], false, tempbuf); + lookups.makeTable(PALETTE_PLAYER0 + play, tempbuf, 0, 0, 0, true); } // @@ -307,7 +307,7 @@ InitPalette(void) // invert the brown palette for (i = 0; i < 32; i++) tempbuf[LT_BROWN + i] = (LT_BROWN + 32) - i; - lookups.makeTable(PALETTE_SLUDGE, tempbuf, 0, 0, 0, TRUE); + lookups.makeTable(PALETTE_SLUDGE, tempbuf, 0, 0, 0, true); } diff --git a/source/sw/src/coolg.cpp b/source/sw/src/coolg.cpp index e5c1ba61c..5204ad10b 100644 --- a/source/sw/src/coolg.cpp +++ b/source/sw/src/coolg.cpp @@ -640,8 +640,8 @@ int DoCoolgMatchPlayerZ(short SpriteNum) // If blocking bits get unset, just die if (!TEST(sp->cstat,CSTAT_SPRITE_BLOCK) || !TEST(sp->cstat,CSTAT_SPRITE_BLOCK_HITSCAN)) { - InitBloodSpray(SpriteNum, TRUE, 105); - InitBloodSpray(SpriteNum, TRUE, 105); + InitBloodSpray(SpriteNum, true, 105); + InitBloodSpray(SpriteNum, true, 105); UpdateSinglePlayKills(SpriteNum); SetSuicide(SpriteNum); } diff --git a/source/sw/src/copysect.cpp b/source/sw/src/copysect.cpp index 90e21f39c..70e1e6e23 100644 --- a/source/sw/src/copysect.cpp +++ b/source/sw/src/copysect.cpp @@ -197,7 +197,7 @@ void CopySectorMatch(short match) // update sprites postions so they aren't in the // wrong place for one frame GlobSpeedSO = 0; - RefreshPoints(sop, 0, 0, TRUE); + RefreshPoints(sop, 0, 0, true); } } } diff --git a/source/sw/src/d_menu.cpp b/source/sw/src/d_menu.cpp index 639194bfa..8f1d31039 100644 --- a/source/sw/src/d_menu.cpp +++ b/source/sw/src/d_menu.cpp @@ -202,7 +202,7 @@ void GameInterface::StartGame(FNewGameStartup& gs) map = FindMapByLevelNum(1); if (!map) return; - CameraTestMode = FALSE; + CameraTestMode = false; StopFX(); //InitNewGame(); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 413aae590..05d818d9e 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -58,7 +58,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -static int OverlapDraw = FALSE; +static int OverlapDraw = false; extern SWBOOL QuitFlag, SpriteInfo; extern SWBOOL Voxel; extern char buffer[]; @@ -253,7 +253,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp) break; default: - ASSERT(TRUE == FALSE); + ASSERT(true == false); break; } @@ -708,13 +708,13 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) // if sector pal is something other than default SECT_USERp sectu = SectUser[tsp->sectnum]; uint8_t pal = sector[tsp->sectnum].floorpal; - SWBOOL nosectpal=FALSE; + SWBOOL nosectpal=false; // sprite does not take on the new pal if sector flag is set if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE)) { pal = PALETTE_DEFAULT; - nosectpal = TRUE; + nosectpal = true; } //if(tu->spal == PALETTE_DEFAULT) @@ -1271,8 +1271,8 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t int i,nexti; short ang; SPRITEp sp; - SWBOOL found_camera = FALSE; - SWBOOL player_in_camera = FALSE; + SWBOOL found_camera = false; + SWBOOL player_in_camera = false; SWBOOL FAFcansee_test; SWBOOL ang_test; @@ -1308,7 +1308,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t case 1: pp->last_camera_sp = sp; CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100); - found_camera = TRUE; + found_camera = true; break; default: @@ -1346,7 +1346,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t *tz = sp->z; *tsectnum = sp->sectnum; - found_camera = TRUE; + found_camera = true; break; } } @@ -1601,7 +1601,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short } } -short ScreenSavePic = FALSE; +short ScreenSavePic = false; SWBOOL PicInView(short, SWBOOL); void DoPlayerDiveMeter(PLAYERp pp); @@ -1626,7 +1626,7 @@ drawscreen(PLAYERp pp, double smoothratio) int const viewingRange = viewingrange; - DrawScreen = TRUE; + DrawScreen = true; PreDraw(); PreUpdatePanel(smoothratio); @@ -1743,9 +1743,9 @@ drawscreen(PLAYERp pp, double smoothratio) videoSetCorrectedAspect(); renderSetAspect(xs_CRoundToInt(double(viewingrange)* tan(r_fov* (PI / 360.))), yxaspect); - OverlapDraw = TRUE; + OverlapDraw = true; DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum); - OverlapDraw = FALSE; + OverlapDraw = false; if (automapMode != am_full)// && !ScreenSavePic) { @@ -1759,7 +1759,7 @@ drawscreen(PLAYERp pp, double smoothratio) if (!FAF_DebugView) FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum); - analyzesprites(tx, ty, tz, FALSE); + analyzesprites(tx, ty, tz, false); post_analyzesprites(); renderDrawMasks(); @@ -1812,7 +1812,7 @@ drawscreen(PLAYERp pp, double smoothratio) // if doing a screen save don't need to process the rest if (ScreenSavePic) { - DrawScreen = FALSE; + DrawScreen = false; return; } @@ -1848,19 +1848,19 @@ drawscreen(PLAYERp pp, double smoothratio) { if (ReloadPrompt) { - ReloadPrompt = FALSE; + ReloadPrompt = false; } } PostDraw(); - DrawScreen = FALSE; + DrawScreen = false; } bool GameInterface::GenerateSavePic() { - ScreenSavePic = TRUE; + ScreenSavePic = true; drawscreen(Player + myconnectindex, 65536); - ScreenSavePic = FALSE; + ScreenSavePic = false; return true; } @@ -1897,7 +1897,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang) { if (sprite[Player[p].PlayerSprite].xvel > 16) pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3); - sprisplayer = TRUE; + sprisplayer = true; goto SHOWSPRITE; } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 5d691b340..be3df2a05 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -105,7 +105,7 @@ SWBOOL SavegameLoaded = false; SWBOOL FinishedLevel = false; short screenpeek = 0; -SWBOOL PreCaching = TRUE; +SWBOOL PreCaching = true; int GodMode = false; short Skill = 2; short TotalKillable; @@ -116,12 +116,12 @@ const GAME_SET gs_defaults = 0, // GameType 0, // Monsters false, // HurtTeammate - TRUE, // SpawnMarkers Markers + true, // SpawnMarkers Markers false, // TeamPlay 0, // Kill Limit 0, // Time Limit 0, // Color - TRUE, // nuke + true, // nuke }; GAME_SET gs; @@ -175,7 +175,7 @@ void GameInterface::app_init() for (int i = 0; i < MAX_SW_PLAYERS; i++) INITLIST(&Player[i].PanelSpriteList); - DebugOperate = TRUE; + DebugOperate = true; enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; if (SW_SHAREWARE) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 8193aaca0..1d9d5b7e8 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -246,11 +246,11 @@ inline int32_t FIXED(int32_t msw, int32_t lsw) #define SET_SPRITE_TAG14(sp,val) (*((short*)&sprite[sp].xrepeat)) = B_LITTLE16((short)val) // OVER and UNDER water macros -#define SpriteInDiveArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? TRUE : FALSE) -#define SpriteInUnderwaterArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? TRUE : FALSE) +#define SpriteInDiveArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? true : false) +#define SpriteInUnderwaterArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? true : false) -#define SectorIsDiveArea(sect) (TEST(sector[sect].extra, SECTFX_DIVE_AREA) ? TRUE : FALSE) -#define SectorIsUnderwaterArea(sect) (TEST(sector[sect].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? TRUE : FALSE) +#define SectorIsDiveArea(sect) (TEST(sector[sect].extra, SECTFX_DIVE_AREA) ? true : false) +#define SectorIsUnderwaterArea(sect) (TEST(sector[sect].extra, SECTFX_UNDERWATER|SECTFX_UNDERWATER2) ? true : false) #define TRAVERSE_SPRITE_SECT(l, o, n) for ((o) = (l); (n) = (o) == -1 ? -1 : nextspritesect[o], (o) != -1; (o) = (n)) #define TRAVERSE_SPRITE_STAT(l, o, n) for ((o) = (l); (n) = (o) == -1 ? -1 : nextspritestat[o], (o) != -1; (o) = (n)) diff --git a/source/sw/src/hornet.cpp b/source/sw/src/hornet.cpp index aa7c340db..11bec35f1 100644 --- a/source/sw/src/hornet.cpp +++ b/source/sw/src/hornet.cpp @@ -591,7 +591,7 @@ int DoCheckSwarm(short SpriteNum) } } - return TRUE; + return true; } diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index b4e69949e..e2b09d8f7 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -134,7 +134,7 @@ static void processWeapon(PLAYERp const pp) else { next_weapon = -1; - for (i = start_weapon; TRUE; i++) + for (i = start_weapon; true; i++) { if (i >= MAX_WEAPONS_KEYS) { @@ -171,7 +171,7 @@ static void processWeapon(PLAYERp const pp) else { prev_weapon = -1; - for (i = start_weapon; TRUE; i--) + for (i = start_weapon; true; i--) { if (i <= -1) i = WPN_HEART; diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index d8dbf7d01..90078a3d9 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -118,7 +118,7 @@ void so_addinterpolation(SECTOR_OBJECTp sop) so_interp *interp = &so_interpdata[sop - SectorObject]; interp->numinterpolations = 0; - interp->hasvator = FALSE; + interp->hasvator = false; for (sectp = sop->sectp; *sectp; sectp++) { @@ -349,7 +349,7 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) int32_t i; SECTOR_OBJECTp sop; so_interp *interp; - SWBOOL saveisshot = FALSE; + SWBOOL saveisshot = false; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) @@ -374,7 +374,7 @@ SWBOOL so_readinterpolations(MFILE_READ fil) int32_t i; SECTOR_OBJECTp sop; so_interp *interp; - SWBOOL saveisshot = FALSE; + SWBOOL saveisshot = false; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) diff --git a/source/sw/src/inv.cpp b/source/sw/src/inv.cpp index b1272ac5b..f2ac14bad 100644 --- a/source/sw/src/inv.cpp +++ b/source/sw/src/inv.cpp @@ -293,7 +293,7 @@ void UseInventoryCloak(PLAYERp pp) return; } - pp->InventoryActive[pp->InventoryNum] = TRUE; + pp->InventoryActive[pp->InventoryNum] = true; AutoPickInventory(pp); @@ -313,7 +313,7 @@ void StopInventoryCloak(PLAYERp pp, short InventoryNum) { SPRITEp sp = pp->SpriteP; - pp->InventoryActive[InventoryNum] = FALSE; + pp->InventoryActive[InventoryNum] = false; if (pp->InventoryPercent[InventoryNum] <= 0) { @@ -350,7 +350,7 @@ DoPlayerNightVisionPalette(PLAYERp pp) // if (pp->NightVision && pp->StartColor == 148) // return; SetFadeAmt(pp,-1005,148); // Night vision green tint - pp->NightVision = TRUE; + pp->NightVision = true; } else { @@ -360,7 +360,7 @@ DoPlayerNightVisionPalette(PLAYERp pp) pp->FadeAmt = 0; videoFadePalette(0,0,0,0); } - pp->NightVision = FALSE; + pp->NightVision = false; } } @@ -373,7 +373,7 @@ UseInventoryNightVision(PLAYERp pp) return; } - pp->InventoryActive[pp->InventoryNum] = TRUE; + pp->InventoryActive[pp->InventoryNum] = true; // on/off PlayerUpdateInventory(pp, pp->InventoryNum); @@ -385,7 +385,7 @@ UseInventoryNightVision(PLAYERp pp) void StopInventoryNightVision(PLAYERp pp, short InventoryNum) { - pp->InventoryActive[InventoryNum] = FALSE; + pp->InventoryActive[InventoryNum] = false; if (pp->InventoryPercent[InventoryNum] <= 0) { @@ -531,7 +531,7 @@ void InventoryTimer(PLAYERp pp) // ALL USED UP pp->InventoryPercent[inv] = 0; InventoryStop(pp, inv); - pp->InventoryActive[inv] = FALSE; + pp->InventoryActive[inv] = false; } else { @@ -566,7 +566,7 @@ void InventoryTimer(PLAYERp pp) // reset 1 sec tic clock pp->InventoryTics[inv] = SEC(1); // set to InActive EVERY TIME THROUGH THE LOOP! - pp->InventoryActive[inv] = FALSE; + pp->InventoryActive[inv] = false; } PlayerUpdateInventory(pp, pp->InventoryNum); diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 9920acb08..bf4b792ea 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -57,10 +57,10 @@ SWBOOL mirrorinview; uint32_t oscilationclock; // Voxel stuff -//SWBOOL bVoxelsOn = TRUE; // Turn voxels on by default -SWBOOL bSpinBobVoxels = FALSE; // Do twizzly stuff to voxels, but +//SWBOOL bVoxelsOn = true; // Turn voxels on by default +SWBOOL bSpinBobVoxels = false; // Do twizzly stuff to voxels, but // not by default -SWBOOL bAutoSize = TRUE; // Autosizing on/off +SWBOOL bAutoSize = true; // Autosizing on/off //extern int chainnumpages; extern AMB_INFO ambarray[]; @@ -288,13 +288,13 @@ void JS_InitMirrors(void) short startwall, endwall; int i, j, s; short SpriteNum = 0, NextSprite; - SWBOOL Found_Cam = FALSE; + SWBOOL Found_Cam = false; // Set all the mirror struct values to -1 memset(mirror, 0xFF, sizeof(mirror)); - mirrorinview = FALSE; // Initially set global mirror flag + mirrorinview = false; // Initially set global mirror flag // to no mirrors seen // Scan wall tags for mirrors @@ -308,7 +308,7 @@ void JS_InitMirrors(void) mirror[i].campic = -1; mirror[i].camsprite = -1; mirror[i].camera = -1; - mirror[i].ismagic = FALSE; + mirror[i].ismagic = false; } for (i = 0; i < numwalls; i++) @@ -333,13 +333,13 @@ void JS_InitMirrors(void) mirror[mirrorcnt].mirrorwall = i; mirror[mirrorcnt].mirrorsector = s; mirror[mirrorcnt].numspawnspots = 0; - mirror[mirrorcnt].ismagic = FALSE; + mirror[mirrorcnt].ismagic = false; do if (wall[i].lotag == TAG_WALL_MAGIC_MIRROR) { short ii, nextii; SPRITEp sp; - Found_Cam = FALSE; + Found_Cam = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_ST1], ii, nextii) { sp = &sprite[ii]; @@ -350,7 +350,7 @@ void JS_InitMirrors(void) // Set up camera varialbes SP_TAG5(sp) = sp->ang; // Set current angle to // sprite angle - Found_Cam = TRUE; + Found_Cam = true; } } @@ -367,7 +367,7 @@ void JS_InitMirrors(void) // Set up camera varialbes SP_TAG5(sp) = sp->ang; // Set current angle to // sprite angle - Found_Cam = TRUE; + Found_Cam = true; } } @@ -378,9 +378,9 @@ void JS_InitMirrors(void) break; } - mirror[mirrorcnt].ismagic = TRUE; + mirror[mirrorcnt].ismagic = true; - Found_Cam = FALSE; + Found_Cam = false; if (TEST_BOOL1(&sprite[mirror[mirrorcnt].camera])) { TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite) @@ -395,7 +395,7 @@ void JS_InitMirrors(void) // JBF: commenting out this line results in the screen in $BULLET being visible tileDelete(mirror[mirrorcnt].campic); - Found_Cam = TRUE; + Found_Cam = true; } } @@ -467,7 +467,7 @@ void drawroomstotile(int daposx, int daposy, int daposz, screen->RenderTextureView(canvas, [=](IntRect& rect) { renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum); - analyzesprites(daposx, daposy, daposz, FALSE); + analyzesprites(daposx, daposy, daposz, false); renderDrawMasks(); }); @@ -482,7 +482,7 @@ JS_ProcessEchoSpot() int j,dist; PLAYERp pp = Player+screenpeek; int16_t reverb; - SWBOOL reverb_set = FALSE; + SWBOOL reverb_set = false; // Process echo sprites TRAVERSE_SPRITE_STAT(headspritestat[STAT_ECHO], i, nexti) @@ -503,7 +503,7 @@ JS_ProcessEchoSpot() if (reverb < 100) reverb = 100; COVER_SetReverb(reverb); - reverb_set = TRUE; + reverb_set = true; } } if (!TEST(pp->Flags, PF_DIVING) && !reverb_set && pp->Reverb <= 0) @@ -531,7 +531,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) int tposx, tposy; // Camera int* longptr; - SWBOOL bIsWallMirror = FALSE; + SWBOOL bIsWallMirror = false; int camclock = I_GetBuildTime(); camloopcnt += camclock - lastcamclock; @@ -624,7 +624,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) // Is it a TV cam or a teleporter that shows destination? - // TRUE = It's a TV cam + // true = It's a TV cam mirror[cnt].mstate = m_normal; if (TEST_BOOL1(sp)) mirror[cnt].mstate = m_viewon; @@ -634,7 +634,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) // you are outside of it! if (mirror[cnt].mstate == m_viewon) { - SWBOOL DoCam = FALSE; + SWBOOL DoCam = false; if (mirror[cnt].campic == -1) { @@ -696,7 +696,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) // If player is dead still then update at MoveSkip4 // rate. if (pp->posx == pp->oposx && pp->posy == pp->oposy && pp->posz == pp->oposz) - DoCam = TRUE; + DoCam = true; // Set up the tile for drawing @@ -733,7 +733,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed // int tx, ty, tz, tpang; // Interpolate so mirror doesn't // drift! - SWBOOL bIsWallMirror = FALSE; + SWBOOL bIsWallMirror = false; // WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong longptr = (int *)&gotpic[MIRRORLABEL >> 3]; @@ -743,10 +743,10 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed //if (TEST_GOTPIC(cnt + MIRRORLABEL) || TEST_GOTPIC(cnt + CAMSPRITE)) if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))) { - bIsWallMirror = FALSE; + bIsWallMirror = false; if (TEST_GOTPIC(cnt + MIRRORLABEL)) { - bIsWallMirror = TRUE; + bIsWallMirror = true; RESET_GOTPIC(cnt + MIRRORLABEL); } //else if (TEST_GOTPIC(cnt + CAMSPRITE)) @@ -756,7 +756,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed RESET_GOTPIC(mirror[cnt].campic); } - mirrorinview = TRUE; + mirrorinview = true; // tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio); // ty = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio); @@ -828,7 +828,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed // Is it a TV cam or a teleporter that shows destination? - // TRUE = It's a TV cam + // true = It's a TV cam mirror[cnt].mstate = m_normal; if (TEST_BOOL1(sp)) mirror[cnt].mstate = m_viewon; @@ -845,7 +845,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed if (mirror[cnt].campic != -1) tileDelete(mirror[cnt].campic); renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS); - analyzesprites(dx, dy, dz, FALSE); + analyzesprites(dx, dy, dz, false); renderDrawMasks(); } } @@ -863,7 +863,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS); - analyzesprites(tposx, tposy, tz, TRUE); + analyzesprites(tposx, tposy, tz, true); renderDrawMasks(); renderCompleteMirror(); // Reverse screen x-wise in this @@ -880,7 +880,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed wall[mirror[cnt].mirrorwall].overpicnum = MIRRORLABEL + cnt; } else - mirrorinview = FALSE; + mirrorinview = false; } } diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index e85f0d4b4..0a44ef1c3 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -401,7 +401,7 @@ DoBloodSpray(int16_t Weapon) sp->z = fz; SpawnFloorSplash(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -419,7 +419,7 @@ DoBloodSpray(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -440,7 +440,7 @@ DoBloodSpray(int16_t Weapon) SpawnMidSplash(Weapon); QueueWallBlood(Weapon, hsp->ang); KillSprite((short) Weapon); - return TRUE; + return true; } @@ -540,7 +540,7 @@ DoBloodSpray(int16_t Weapon) u->xchange = u->ychange = 0; SpawnFloorSplash(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -594,7 +594,7 @@ DoBloodSpray(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } @@ -631,7 +631,7 @@ DoPhosphorus(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -663,7 +663,7 @@ DoPhosphorus(int16_t Weapon) } u->xchange = u->ychange = 0; KillSprite((short) Weapon); - return TRUE; + return true; } @@ -726,7 +726,7 @@ DoPhosphorus(int16_t Weapon) u->xchange = u->ychange = 0; SpawnFireballExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -763,7 +763,7 @@ DoPhosphorus(int16_t Weapon) u->xchange = u->ychange = 0; SpawnFireballExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -821,7 +821,7 @@ DoPhosphorus(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -857,7 +857,7 @@ DoChemBomb(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -889,7 +889,7 @@ DoChemBomb(int16_t Weapon) u->WaitTics -= (MISSILEMOVETICS * 2); if (u->WaitTics <= 0) KillSprite((short) Weapon); - return TRUE; + return true; } @@ -965,7 +965,7 @@ DoChemBomb(int16_t Weapon) u->WaitTics -= (MISSILEMOVETICS * 2); if (u->WaitTics <= 0) KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -1014,7 +1014,7 @@ DoChemBomb(int16_t Weapon) u->WaitTics -= (MISSILEMOVETICS * 2); if (u->WaitTics <= 0) KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -1069,7 +1069,7 @@ DoChemBomb(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -1115,7 +1115,7 @@ DoCaltrops(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -1201,7 +1201,7 @@ DoCaltrops(int16_t Weapon) SET(sp->extra, SPRX_BREAKABLE); SET(sp->cstat,CSTAT_SPRITE_BREAKABLE); ChangeState(Weapon, s_CaltropsStick); - return TRUE; + return true; } } else @@ -1239,7 +1239,7 @@ DoCaltrops(int16_t Weapon) SET(sp->extra, SPRX_BREAKABLE); SET(sp->cstat,CSTAT_SPRITE_BREAKABLE); ChangeState(Weapon, s_CaltropsStick); - return TRUE; + return true; } } else @@ -1255,7 +1255,7 @@ DoCaltrops(int16_t Weapon) } - return FALSE; + return false; } ///////////////////////////// @@ -1272,7 +1272,7 @@ SpawnRadiationCloud(short SpriteNum) if (!MoveSkip4) - return FALSE; + return false; // This basically works like a MoveSkip8, if one existed // u->Counter2 = !u->Counter2; @@ -1281,14 +1281,14 @@ SpawnRadiationCloud(short SpriteNum) if ((u->Counter2++) > 16) u->Counter2 = 0; if (u->Counter2) - return FALSE; + return false; } else { if ((u->Counter2++) > 2) u->Counter2 = 0; if (u->Counter2) - return FALSE; + return false; } if (TEST(u->Flags, SPR_UNDERWATER)) @@ -1338,7 +1338,7 @@ SpawnRadiationCloud(short SpriteNum) nu->Radius = 4000; } - return FALSE; + return false; } int @@ -1357,7 +1357,7 @@ DoRadiationCloud(short SpriteNum) DoFlamesDamageTest(SpriteNum); } - return FALSE; + return false; } ////////////////////////////////////////////// @@ -1733,7 +1733,7 @@ SpawnFlashBombOnActor(int16_t enemy) { if (!eu) { - ASSERT(TRUE == FALSE); + ASSERT(true == false); } if (eu->flame >= 0) @@ -2200,7 +2200,7 @@ DoCarryFlag(int16_t Weapon) if (!TEST(u->Flags, SPR_ACTIVE)) { if ((u->WaitTics -= (MISSILEMOVETICS * 2)) > 0) - return FALSE; + return false; // activate it u->WaitTics = SEC(30); // You have 30 seconds to get it to @@ -2324,11 +2324,11 @@ DoCarryFlag(int16_t Weapon) case FLAG_DETONATE_STATE + 1: SpawnGrenadeExp(Weapon); SetSuicide(Weapon); - return FALSE; + return false; break; } - return FALSE; + return false; } int @@ -2362,7 +2362,7 @@ DoCarryFlagNoDet(int16_t Weapon) if (u->FlagOwner >= 0) fu->WaitTics = 0; // Tell it to respawn SetSuicide(Weapon); - return FALSE; + return false; } // if in score box, score. @@ -2395,7 +2395,7 @@ DoCarryFlagNoDet(int16_t Weapon) SetSuicide(Weapon); // Kill the flag, you scored! } - return FALSE; + return false; } @@ -2418,7 +2418,7 @@ SetCarryFlag(int16_t Weapon) else ChangeState(Weapon, s_CarryFlag); - return FALSE; + return false; } int @@ -2447,7 +2447,7 @@ DoFlag(int16_t Weapon) } } - return FALSE; + return false; } diff --git a/source/sw/src/mclip.cpp b/source/sw/src/mclip.cpp index 109845fb8..ca6a1d616 100644 --- a/source/sw/src/mclip.cpp +++ b/source/sw/src/mclip.cpp @@ -158,11 +158,11 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist) //ang = NORM_ANGLE(ang + 1024); //pp->xvect += 20 * sintable[NORM_ANGLE(ang + 512)]; //pp->yvect += 20 * sintable[ang]; - return FALSE; + return false; } } - return TRUE; + return true; } int testquadinsect(int *point_num, vec2_t const * q, short sectnum) @@ -177,7 +177,7 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum) { *point_num = i; - return FALSE; + return false; } } @@ -187,11 +187,11 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum) if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum, q[next_i].x, q[next_i].y,0x3fffffff, sectnum)) { - return FALSE; + return false; } } - return TRUE; + return true; } @@ -213,11 +213,11 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) { pp->posx += (pp->xvect>>14); pp->posy += (pp->yvect>>14); - return TRUE; + return true; } if (point_num < 0) - return FALSE; + return false; if ((point_num == 0) || (point_num == 3)) //Left side bad - strafe right { @@ -232,7 +232,7 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) pp->posy += (pp->xvect>>15); } - return FALSE; + return false; } if ((point_num == 1) || (point_num == 2)) //Right side bad - strafe left @@ -248,10 +248,10 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) pp->posy -= (pp->xvect>>15); } - return FALSE; + return false; } - return FALSE; + return false; } int testpointinquad(int x, int y, int *qx, int *qy) @@ -301,12 +301,12 @@ short RectClipTurn(PLAYERp pp, short new_ang, int *qx, int *qy, int *ox, int *oy qx[i] = xy[i].x; qy[i] = xy[i].y; } - return TRUE; + return true; } if (point_num < 0) - return FALSE; + return false; - return FALSE; + return false; } END_SW_NS diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index c223080e3..e46990daf 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -244,7 +244,7 @@ SWBOOL MNU_ShareWareMessage() MNU_DrawString(160, 160, extra_text, 1, 16, 0); //SET(item->flags, mf_disabled); } - return TRUE; + return true; } diff --git a/source/sw/src/miscactr.cpp b/source/sw/src/miscactr.cpp index a9835ff39..e8320e36f 100644 --- a/source/sw/src/miscactr.cpp +++ b/source/sw/src/miscactr.cpp @@ -153,7 +153,7 @@ int DoToiletGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -211,7 +211,7 @@ int NullToiletGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -392,7 +392,7 @@ int DoWashGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -456,7 +456,7 @@ int NullWashGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1263,7 +1263,7 @@ int DoCarGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1312,7 +1312,7 @@ int NullCarGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1482,7 +1482,7 @@ int DoMechanicGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1531,7 +1531,7 @@ int NullMechanicGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1702,7 +1702,7 @@ int DoSailorGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1755,7 +1755,7 @@ int NullSailorGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; static short alreadythrew = 0; DoActorPickClosePlayer(SpriteNum); @@ -1914,7 +1914,7 @@ int DoPruneGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1979,7 +1979,7 @@ int NullPruneGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = FALSE; + SWBOOL ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 6e39d2570..f564a1841 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -54,7 +54,7 @@ gNET gNet; //Local multiplayer variables // should move this to a local scope of faketimerhandler - do it when able to test -SWBOOL CommEnabled = FALSE; +SWBOOL CommEnabled = false; uint8_t CommPlayers = 0; double smoothratio; diff --git a/source/sw/src/ninja.cpp b/source/sw/src/ninja.cpp index cfa0a53c4..0c80f6e12 100644 --- a/source/sw/src/ninja.cpp +++ b/source/sw/src/ninja.cpp @@ -1967,7 +1967,7 @@ DoNinjaHariKari(short SpriteNum) cnt = RANDOM_RANGE(4)+1; for (i=0; i<=cnt; i++) - InitBloodSpray(SpriteNum,TRUE,-2); + InitBloodSpray(SpriteNum,true,-2); return 0; } @@ -2206,7 +2206,7 @@ PlayerLevelReset(PLAYERp pp) //PlayerUpdateArmor(pp, 0); pp->Kills = 0; pp->Killer = -1; - pp->NightVision = FALSE; + pp->NightVision = false; pp->StartColor = 0; pp->FadeAmt = 0; pp->DeathType = 0; @@ -2245,10 +2245,10 @@ PlayerDeathReset(PLAYERp pp) pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds pp->WpnShotgunLastShell = 0; // Number of last shell fired - pp->Bloody = FALSE; - pp->TestNukeInit = FALSE; - pp->InitingNuke = FALSE; - pp->NukeInitialized = FALSE; + pp->Bloody = false; + pp->TestNukeInit = false; + pp->InitingNuke = false; + pp->NukeInitialized = false; pp->WpnReloadState = 2; memset(pp->WpnAmmo,0,sizeof(pp->WpnAmmo)); @@ -2273,7 +2273,7 @@ PlayerDeathReset(PLAYERp pp) pp->Armor = 0; PlayerUpdateArmor(pp, 0); pp->Killer = -1; - pp->NightVision = FALSE; + pp->NightVision = false; pp->StartColor = 0; pp->FadeAmt = 0; pp->DeathType = 0; @@ -2333,10 +2333,10 @@ PlayerGameReset(PLAYERp pp) pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds pp->WpnShotgunLastShell = 0; // Number of last shell fired - pp->Bloody = FALSE; - pp->TestNukeInit = FALSE; - pp->InitingNuke = FALSE; - pp->NukeInitialized = FALSE; + pp->Bloody = false; + pp->TestNukeInit = false; + pp->InitingNuke = false; + pp->NukeInitialized = false; pp->SecretsFound = 0; pp->WpnReloadState = 2; @@ -2359,7 +2359,7 @@ PlayerGameReset(PLAYERp pp) { videoFadePalette(0,0,0,0); } - pp->NightVision = FALSE; + pp->NightVision = false; pp->StartColor = 0; pp->FadeAmt = 0; pp->DeathType = 0; @@ -2458,7 +2458,7 @@ InitPlayerSprite(PLAYERp pp) videoFadePalette(0,0,0,0); } - pp->NightVision = FALSE; + pp->NightVision = false; pp->StartColor = 0; pp->FadeAmt = 0; pp->DeathType = 0; diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index c96ac07ee..5eebe4e46 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -156,7 +156,7 @@ PANEL_SPRITEp pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pr SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id) { PANEL_SPRITEp psp=NULL, next; - SWBOOL found = FALSE; + SWBOOL found = false; // Kill ALL sprites with the correct id TRAVERSE(&pp->PanelSpriteList, psp, next) @@ -164,7 +164,7 @@ SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id) if (psp->ID == id) { pKillSprite(psp); - found = TRUE; + found = true; } } @@ -238,13 +238,13 @@ void PlayerUpdateHealth(PLAYERp pp, short value) if (value < 0) { - SWBOOL IsChem = FALSE; - SWBOOL NoArmor = FALSE; + SWBOOL IsChem = false; + SWBOOL NoArmor = false; if (value <= -2000) { value += 2000; - NoArmor = TRUE; + NoArmor = true; } else if (value <= -1000) { @@ -252,7 +252,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value) MONO_PRINT(ds); value += 1000; - IsChem = TRUE; + IsChem = true; } // TAKE SOME DAMAGE @@ -440,7 +440,7 @@ int WeaponOperate(PLAYERp pp) InventoryKeys(pp); // UziType >= 3 means they are reloading - if (pp->WpnUziType >= 3) return TRUE; + if (pp->WpnUziType >= 3) return true; //if (CheatInputMode) // return (0); @@ -544,9 +544,9 @@ int WeaponOperate(PLAYERp pp) if (pp->WpnRocketType == 2 && pp->WpnRocketNuke == 0) pp->WpnRocketType = 0; if (pp->WpnRocketType == 2) - pp->TestNukeInit = TRUE; // Init the nuke + pp->TestNukeInit = true; // Init the nuke else - pp->TestNukeInit = FALSE; + pp->TestNukeInit = false; } InitWeaponMicro(pp); break; @@ -639,7 +639,7 @@ int WeaponOperate(PLAYERp pp) // This really should be handled better, but since there's no usable tracking state for the sounds, the easiest way to handle them is to play on otherwise unused channels. if (pp->WpnRocketType != 2 || pp->CurWpn != pp->Wpn[WPN_MICRO]) { - pp->InitingNuke = FALSE; + pp->InitingNuke = false; soundEngine->StopSound(SOURCE_Player, pp, CHAN_WEAPON); } if (pp->CurWpn != pp->Wpn[WPN_RAIL]) @@ -659,16 +659,16 @@ WeaponOK(PLAYERp pp) unsigned wpn_ndx=0; if ((unsigned)pp->PlayerSprite >= MAXSPRITES) - return(FALSE); + return(false); u = User[pp->PlayerSprite]; if (u == NULL) - return(FALSE); + return(false); // sword if (DamageData[u->WeaponNum].max_ammo == -1) - return TRUE; + return true; WeaponNum = u->WeaponNum; FindWeaponNum = u->WeaponNum; @@ -684,19 +684,19 @@ WeaponOK(PLAYERp pp) if (WeaponNum == WPN_MICRO && pp->WpnRocketNuke) { //pp->WpnRocketType = 2; // Set it to Nuke - if (!pp->NukeInitialized) pp->TestNukeInit = TRUE; + if (!pp->NukeInitialized) pp->TestNukeInit = true; u->WeaponNum = WPN_MICRO; (*DamageData[u->WeaponNum].Init)(pp); - return TRUE; + return true; } pp->KeyPressBits &= ~SB_FIRE; FindWeaponNum = WPN_SHOTGUN; // Start at the top - while (TRUE) + while (true) { // ran out of weapons - choose SWORD if (wpn_ndx > sizeof(wpn_order)) @@ -723,10 +723,10 @@ WeaponOK(PLAYERp pp) (*DamageData[u->WeaponNum].Init)(pp); - return FALSE; + return false; } - return TRUE; + return true; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -2384,7 +2384,7 @@ void pUziAction(PANEL_SPRITEp psp) { char shooting; - static SWBOOL alternate = FALSE; + static SWBOOL alternate = false; shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE); @@ -2978,13 +2978,13 @@ pShotgunOverlays(PANEL_SPRITEp psp) case 0: psp->over[SHOTGUN_AUTO_NUM].pic = -1; SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone); - return FALSE; + return false; case 1: psp->over[SHOTGUN_AUTO_NUM].pic = SHOTGUN_AUTO; SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone); - return FALSE; + return false; } - return FALSE; + return false; } PANEL_STATE ps_ShotgunFlash[] = @@ -3031,10 +3031,10 @@ pShotgunReloadTest(PANEL_SPRITEp psp) // clip has run out RESET(psp->flags, PANF_REST_POS); pSetState(psp, ps_ShotgunReload); - return TRUE; + return true; } - return FALSE; + return false; } #endif @@ -3051,7 +3051,7 @@ pShotgunRest(PANEL_SPRITEp psp) if (psp->PlayerP->WpnShotgunType == 1 && ammo > 0 && ((ammo % 4) != 0) && lastammo != ammo && TEST(psp->flags, PANF_REST_POS)) { - force = TRUE; + force = true; } pShotgunOverlays(psp); @@ -3093,7 +3093,7 @@ pShotgunRestTest(PANEL_SPRITEp psp) SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (psp->PlayerP->WpnShotgunType == 1 && !pShotgunReloadTest(psp)) - force = TRUE; + force = true; if (pShotgunReloadTest(psp)) return; @@ -4191,8 +4191,8 @@ InitWeaponMicro(PLAYERp pp) { if (pp->TestNukeInit && pp->WpnRocketType == 2 && !pp->InitingNuke && pp->WpnRocketNuke && !pp->NukeInitialized) { - pp->TestNukeInit = FALSE; - pp->InitingNuke = TRUE; + pp->TestNukeInit = false; + pp->InitingNuke = true; psp = pp->Wpn[WPN_MICRO]; pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt); } @@ -4214,7 +4214,7 @@ InitWeaponMicro(PLAYERp pp) pSetState(psp, psp->PresentState); if (pp->WpnRocketType == 2 && !pp->InitingNuke && !pp->NukeInitialized) - pp->TestNukeInit = pp->InitingNuke = TRUE; + pp->TestNukeInit = pp->InitingNuke = true; PlaySound(DIGI_ROCKET_UP, pp, v3df_follow); @@ -4304,7 +4304,7 @@ pMicroPresent(PANEL_SPRITEp psp) psp->yorig = psp->y; if (pp->WpnRocketType == 2 && !pp->NukeInitialized) { - pp->TestNukeInit = FALSE; + pp->TestNukeInit = false; pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt); } else @@ -4376,7 +4376,7 @@ pMicroOverlays(PANEL_SPRITEp psp) psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1; SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone); psp->over[MICRO_HEAT_NUM].pic = -1; - return FALSE; + return false; case 1: if (psp->PlayerP->WpnRocketHeat) { @@ -4396,7 +4396,7 @@ pMicroOverlays(PANEL_SPRITEp psp) psp->over[MICRO_HEAT_NUM].pic = -1; } - return FALSE; + return false; case 2: psp->over[MICRO_SIGHT_NUM].pic = -1; psp->over[MICRO_HEAT_NUM].pic = -1; @@ -4404,9 +4404,9 @@ pMicroOverlays(PANEL_SPRITEp psp) psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_20; SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone); SET(psp->over[MICRO_HEAT_NUM].flags, psf_ShadeNone); - return TRUE; + return true; } - return FALSE; + return false; } PANEL_STATE ps_MicroHeatFlash[] = @@ -4455,8 +4455,8 @@ pMicroRest(PANEL_SPRITEp psp) { int choose_voc=0; - pp->InitingNuke = FALSE; - pp->NukeInitialized = TRUE; + pp->InitingNuke = false; + pp->NukeInitialized = true; if (pp == Player+myconnectindex) { @@ -4532,7 +4532,7 @@ pMicroFire(PANEL_SPRITEp psp) case 2: PlaySound(DIGI_WARNING,psp->PlayerP,v3df_dontpan|v3df_follow); InitNuke(psp->PlayerP); - psp->PlayerP->NukeInitialized = FALSE; + psp->PlayerP->NukeInitialized = false; break; } } @@ -4616,7 +4616,7 @@ pMicroReady(PANEL_SPRITEp psp) PLAYERp pp = psp->PlayerP; PlaySound(DIGI_NUKEREADY, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON); - pp->NukeInitialized = TRUE; + pp->NukeInitialized = true; pMicroAction(psp); } @@ -6607,7 +6607,7 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) // initing the other weapon will take care of this if (TEST(psp->flags, PANF_DEATH_HIDE)) { - return FALSE; + return false; } if (TEST(psp->flags, PANF_WEAPON_HIDE)) @@ -6616,10 +6616,10 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { RESET(psp->flags, PANF_WEAPON_HIDE); pSetState(psp, state); - return TRUE; + return true; } - return FALSE; + return false; } if (psp->PlayerP->input.actions & SB_HOLSTER) @@ -6628,7 +6628,7 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { psp->PlayerP->KeyPressBits &= ~SB_HOLSTER; pSetState(psp, state); - return TRUE; + return true; } } else @@ -6642,11 +6642,11 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { SET(psp->flags, PANF_UNHIDE_SHOOT); pSetState(psp, state); - return TRUE; + return true; } } - return FALSE; + return false; } SWBOOL @@ -6656,14 +6656,14 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { SET(psp->flags, PANF_DEATH_HIDE); pSetState(psp, state); - return TRUE; + return true; } if (TEST(psp->PlayerP->Flags, PF_WEAPON_DOWN)) { SET(psp->flags, PANF_WEAPON_HIDE); pSetState(psp, state); - return TRUE; + return true; } if (psp->PlayerP->input.actions & SB_HOLSTER) @@ -6673,7 +6673,7 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) psp->PlayerP->KeyPressBits &= ~SB_HOLSTER; PutStringInfo(psp->PlayerP,"Weapon Holstered"); pSetState(psp, state); - return TRUE; + return true; } } else @@ -6681,7 +6681,7 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) psp->PlayerP->KeyPressBits |= SB_HOLSTER; } - return FALSE; + return false; } @@ -6875,7 +6875,7 @@ pWeaponBob(PANEL_SPRITEp psp, short condition) // ////////////////////////////////////////////////////////////////////////////////////////// -SWBOOL DrawBeforeView = FALSE; +SWBOOL DrawBeforeView = false; void pDisplaySprites(PLAYERp pp, double smoothratio) { @@ -7273,7 +7273,7 @@ void PreUpdatePanel(double smoothratio) { short pnum; - DrawBeforeView = TRUE; + DrawBeforeView = true; //if (DrawBeforeView) TRAVERSE_CONNECT(pnum) @@ -7282,7 +7282,7 @@ PreUpdatePanel(double smoothratio) pDisplaySprites(Player + pnum, smoothratio); } - DrawBeforeView = FALSE; + DrawBeforeView = false; } #define EnvironSuit_RATE 10 diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 054390928..b5629d68e 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -80,7 +80,7 @@ extern SWBOOL NoMeters; USER puser[MAX_SW_PLAYERS_REG]; //int16_t gNet.MultiGameType = MULTI_GAME_NONE; -SWBOOL NightVision = FALSE; +SWBOOL NightVision = false; extern SWBOOL FinishAnim; @@ -2275,7 +2275,7 @@ void PlayerCheckValidMove(PLAYERp pp) // if stuck here for more than 10 seconds if (count++ > 40 * 10) { - ASSERT(TRUE == FALSE); + ASSERT(true == false); } } } @@ -2687,7 +2687,7 @@ void DoTankTreads(PLAYERp pp) SECTORp *sectp; int j; int dot; - SWBOOL reverse = FALSE; + SWBOOL reverse = false; if (Prediction) return; @@ -2695,7 +2695,7 @@ void DoTankTreads(PLAYERp pp) vel = FindDistance2D(pp->xvect>>8, pp->yvect>>8); dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]); if (dot < 0) - reverse = TRUE; + reverse = true; for (sectp = pp->sop->sectp, j = 0; *sectp; sectp++, j++) { @@ -3618,7 +3618,7 @@ DoPlayerClimb(PLAYERp pp) int dot; short sec,wal,spr; int dist; - SWBOOL LadderUpdate = FALSE; + SWBOOL LadderUpdate = false; if (Prediction) return; @@ -3792,13 +3792,13 @@ DoPlayerClimb(PLAYERp pp) if (FAF_ConnectArea(pp->cursectnum)) { updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum); - LadderUpdate = TRUE; + LadderUpdate = true; } if (WarpPlane(&pp->posx, &pp->posy, &pp->posz, &pp->cursectnum)) { PlayerWarpUpdatePos(pp); - LadderUpdate = TRUE; + LadderUpdate = true; } if (LadderUpdate) @@ -3848,7 +3848,7 @@ DoPlayerWadeSuperJump(PLAYERp pp) static short angs[3] = {0, 0, 0}; int zh = sector[pp->cursectnum].floorz - Z(pp->WadeDepth) - Z(2); - if (Prediction) return FALSE; // !JIM! 8/5/97 Teleporter FAFhitscan SuperJump bug. + if (Prediction) return false; // !JIM! 8/5/97 Teleporter FAFhitscan SuperJump bug. for (i = 0; i < SIZ(angs); i++) { @@ -3865,12 +3865,12 @@ DoPlayerWadeSuperJump(PLAYERp pp) if (hitinfo.sect >= 0 && labs(sector[hitinfo.sect].floorz - pp->posz) < Z(50)) { if (Distance(pp->posx, pp->posy, hitinfo.pos.x, hitinfo.pos.y) < ((((int)pp->SpriteP->clipdist)<<2) + 256)) - return TRUE; + return true; } } } - return FALSE; + return false; } SWBOOL PlayerFlyKey(void) @@ -3878,7 +3878,7 @@ SWBOOL PlayerFlyKey(void) SWBOOL key = false; if (!GodMode) - return FALSE; + return false; #if 0 // Cheat or not, this simply won't do. @@ -3919,15 +3919,15 @@ SWBOOL PlayerFallTest(PLAYERp pp, int player_height) TEST(pp->lo_sectp->floorstat, FLOOR_STAT_SLOPE) && pp->lo_sectp == §or[pp->lastcursectnum]) { - return FALSE; + return false; } else { - return TRUE; + return true; } } - return FALSE; + return false; } void @@ -4093,20 +4093,20 @@ SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit) { if (pp->posz < zlimit) { - return TRUE; + return true; } - return FALSE; + return false; } SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit) { if (pp->posz > zlimit) { - return TRUE; + return true; } - return FALSE; + return false; } void @@ -4221,10 +4221,10 @@ PlayerOnLadder(PLAYERp pp) dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]); if (dir < 0) - return FALSE; + return false; if (neartagwall < 0 || wall[neartagwall].lotag != TAG_WALL_CLIMB) - return FALSE; + return false; for (i = 0; i < SIZ(angles); i++) { @@ -4233,7 +4233,7 @@ PlayerOnLadder(PLAYERp pp) &dist, 600L, NTAG_SEARCH_LO_HI, NULL); if (wal < 0 || dist < 100 || wall[wal].lotag != TAG_WALL_CLIMB) - return FALSE; + return false; FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + angles[i] + 512)], @@ -4250,14 +4250,14 @@ PlayerOnLadder(PLAYERp pp) if (TEST(sprite[hitinfo.sprite].cstat, CSTAT_SPRITE_BLOCK) && !TEST(sprite[hitinfo.sprite].cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) { - return FALSE; + return false; } } else { // if you hit a wall and it is not a climb wall - forget it if (hitinfo.wall >= 0 && wall[hitinfo.wall].lotag != TAG_WALL_CLIMB) - return FALSE; + return false; } } @@ -4265,7 +4265,7 @@ PlayerOnLadder(PLAYERp pp) lsp = FindNearSprite(pp->SpriteP, STAT_CLIMB_MARKER); if (!lsp) - return FALSE; + return false; // determine where the player is supposed to be in relation to the ladder // move out in front of the ladder @@ -4294,15 +4294,15 @@ PlayerOnLadder(PLAYERp pp) playerSetAngle(pp, pp->LadderAngle); - return TRUE; + return true; } SWBOOL DoPlayerTestCrawl(PLAYERp pp) { if (labs(pp->loz - pp->hiz) < PLAYER_STANDING_ROOM) - return TRUE; + return true; - return FALSE; + return false; } int @@ -4319,22 +4319,22 @@ PlayerInDiveArea(PLAYERp pp) //sectp = pp->lo_sectp; } else - return FALSE; + return false; if (TEST(sectp->extra, SECTFX_DIVE_AREA)) { CheckFootPrints(pp); - return TRUE; + return true; } - return FALSE; + return false; } int PlayerCanDive(PLAYERp pp) { if (Prediction) - return FALSE; + return false; // Crawl - check for diving if ((pp->input.actions & SB_CROUCH) || pp->jump_speed > 0) @@ -4350,18 +4350,18 @@ PlayerCanDive(PLAYERp pp) DoPlayerBeginDive(pp); } - return TRUE; + return true; } } - return FALSE; + return false; } int PlayerCanDiveNoWarp(PLAYERp pp) { if (Prediction) - return FALSE; + return false; // check for diving if (pp->jump_speed > 1400) @@ -4383,12 +4383,12 @@ PlayerCanDiveNoWarp(PLAYERp pp) PlaySound(DIGI_SPLASH1, pp, v3df_dontpan); DoPlayerBeginDiveNoWarp(pp); - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -4556,7 +4556,7 @@ DoPlayerWarpToUnderwater(PLAYERp pp) short i, nexti; SECT_USERp sectu = SectUser[pp->cursectnum]; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + bool Found = false; short over, under; if (Prediction) @@ -4572,13 +4572,13 @@ DoPlayerWarpToUnderwater(PLAYERp pp) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - PRODUCTION_ASSERT(Found == TRUE); - Found = FALSE; + PRODUCTION_ASSERT(Found == true); + Found = false; // search for UNDERWATER "under" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti) @@ -4589,12 +4589,12 @@ DoPlayerWarpToUnderwater(PLAYERp pp) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - PRODUCTION_ASSERT(Found == TRUE); + PRODUCTION_ASSERT(Found == true); // get the offset from the sprite u->sx = over_sp->x - pp->posx; @@ -4633,7 +4633,7 @@ DoPlayerWarpToSurface(PLAYERp pp) short over, under; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + bool Found = false; if (Prediction) return; @@ -4647,13 +4647,13 @@ DoPlayerWarpToSurface(PLAYERp pp) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - PRODUCTION_ASSERT(Found == TRUE); - Found = FALSE; + PRODUCTION_ASSERT(Found == true); + Found = false; // search for DIVE_AREA "over" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti) @@ -4664,12 +4664,12 @@ DoPlayerWarpToSurface(PLAYERp pp) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - PRODUCTION_ASSERT(Found == TRUE); + PRODUCTION_ASSERT(Found == true); // get the offset from the under sprite u->sx = under_sp->x - pp->posx; @@ -4735,7 +4735,7 @@ DoPlayerBeginDive(PLAYERp pp) if (Prediction) return; - if (pp->Bloody) pp->Bloody = FALSE; // Water washes away the blood + if (pp->Bloody) pp->Bloody = false; // Water washes away the blood SET(pp->Flags, PF_DIVING); DoPlayerDivePalette(pp); @@ -4786,7 +4786,7 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp) if (pp->cursectnum < 0 || !SectorIsUnderwaterArea(pp->cursectnum)) return; - if (pp->Bloody) pp->Bloody = FALSE; // Water washes away the blood + if (pp->Bloody) pp->Bloody = false; // Water washes away the blood if (pp == Player + screenpeek) { @@ -5115,10 +5115,10 @@ DoPlayerTestPlaxDeath(PLAYERp pp) { PlayerUpdateHealth(pp, -u->Health); PlayerCheckDeath(pp, -1); - return TRUE; + return true; } - return FALSE; + return false; } void @@ -5540,7 +5540,7 @@ DoPlayerBeginOperate(PLAYERp pp) RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL); - DoPlayerOperateMatch(pp, TRUE); + DoPlayerOperateMatch(pp, true); // look for gun before trying to using it for (i = 0; sop->sp_num[i] != -1; i++) @@ -5627,7 +5627,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) RESET(pp->Flags, PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL); - DoPlayerOperateMatch(pp, TRUE); + DoPlayerOperateMatch(pp, true); // look for gun before trying to using it for (i = 0; sop->sp_num[i] != -1; i++) @@ -5743,7 +5743,7 @@ DoPlayerStopOperate(PLAYERp pp) RESET(pp->Flags, PF_WEAPON_DOWN); DoPlayerResetMovement(pp); DoTankTreads(pp); - DoPlayerOperateMatch(pp, FALSE); + DoPlayerOperateMatch(pp, false); StopSOsound(pp->sop->mid_sector); if (pp->sop_remote) @@ -6052,21 +6052,21 @@ void DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer) { int pnum; - SWBOOL SEND_OK = FALSE; + SWBOOL SEND_OK = false; killer->KilledPlayer[pp-Player]++; if (pp == killer && pp == Player + myconnectindex) { sprintf(ds,"%s %s",pp->PlayerName,SuicideNote[STD_RANDOM_RANGE(MAX_SUICIDE)]); - SEND_OK = TRUE; + SEND_OK = true; } else // I am being killed if (killer == Player + myconnectindex) { sprintf(ds,"%s",KilledPlayerMessage(pp,killer)); - SEND_OK = TRUE; + SEND_OK = true; } if (SEND_OK) @@ -6255,7 +6255,7 @@ DoPlayerBeginDie(PLAYERp pp) pp->SpriteP->xrepeat = 48; pp->SpriteP->yrepeat = 48; // Blood fountains - InitBloodSpray(pp->PlayerSprite,TRUE,105); + InitBloodSpray(pp->PlayerSprite,true,105); break; case PLAYER_DEATH_EXPLODE: @@ -6270,9 +6270,9 @@ DoPlayerBeginDie(PLAYERp pp) pp->SpriteP->xrepeat = 48; pp->SpriteP->yrepeat = 48; // Blood fountains - InitBloodSpray(pp->PlayerSprite,TRUE,-1); - InitBloodSpray(pp->PlayerSprite,TRUE,-1); - InitBloodSpray(pp->PlayerSprite,TRUE,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); break; case PLAYER_DEATH_SQUISH: @@ -6288,7 +6288,7 @@ DoPlayerBeginDie(PLAYERp pp) pp->SpriteP->xrepeat = 48; pp->SpriteP->yrepeat = 48; // Blood fountains - InitBloodSpray(pp->PlayerSprite,TRUE,105); + InitBloodSpray(pp->PlayerSprite,true,105); break; } @@ -6427,9 +6427,9 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) else { // If he's not on the floor, then gib like a mo-fo! - InitBloodSpray(pp->PlayerSprite,TRUE,-1); - InitBloodSpray(pp->PlayerSprite,TRUE,-1); - InitBloodSpray(pp->PlayerSprite,TRUE,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); + InitBloodSpray(pp->PlayerSprite,true,-1); } PlayerSpawnPosition(pp); @@ -6472,7 +6472,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) videoFadePalette(0,0,0,0); } - pp->NightVision = FALSE; + pp->NightVision = false; pp->FadeAmt = 0; DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -7299,7 +7299,7 @@ void MultiPlayLimits(void) { short pnum; PLAYERp pp; - SWBOOL Done = FALSE; + SWBOOL Done = false; if (gNet.MultiGameType != MULTI_GAME_COMMBAT) return; @@ -7311,7 +7311,7 @@ void MultiPlayLimits(void) pp = Player + pnum; if (pp->Kills >= gNet.KillLimit) { - Done = TRUE; + Done = true; } } } @@ -7321,7 +7321,7 @@ void MultiPlayLimits(void) gNet.TimeLimitClock -= synctics; if (gNet.TimeLimitClock <= 0) - Done = TRUE; + Done = true; } if (Done) @@ -7359,7 +7359,7 @@ void PauseMultiPlay(void) if (paused) { SavePrediction = PredictionOn; - PredictionOn = FALSE; + PredictionOn = false; } else { @@ -7577,7 +7577,7 @@ int SearchSpawnPosition(PLAYERp pp) sp = &sprite[spawn_sprite]; - blocked = FALSE; + blocked = false; // check to see if anyone else is blocking this spot TRAVERSE_CONNECT(pnum) @@ -7588,7 +7588,7 @@ int SearchSpawnPosition(PLAYERp pp) { if (FindDistance3D(sp->x - opp->posx, sp->y - opp->posy, sp->z - opp->posz) < 1000) { - blocked = TRUE; + blocked = true; break; } } @@ -7647,7 +7647,7 @@ PlayerSpawnPosition(PLAYERp pp) break; } - SpawnPositionUsed[pos_num] = TRUE; + SpawnPositionUsed[pos_num] = true; if (spawn_sprite < 0) { diff --git a/source/sw/src/predict.cpp b/source/sw/src/predict.cpp index ab76ee167..94864448b 100644 --- a/source/sw/src/predict.cpp +++ b/source/sw/src/predict.cpp @@ -36,8 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -SWBOOL PredictionOn = TRUE; -SWBOOL Prediction = FALSE; +SWBOOL PredictionOn = true; +SWBOOL Prediction = false; PLAYER PredictPlayer; USER PredictUser; PLAYERp ppp = &PredictPlayer; @@ -102,11 +102,11 @@ DoPrediction(PLAYERp ppp) ppp->oq16horiz = ppp->q16horiz; // go through the player MOVEMENT code only - Prediction = TRUE; + Prediction = true; DoPlayerSectorUpdatePreMove(ppp); (*ppp->DoPlayerAction)(ppp); DoPlayerSectorUpdatePostMove(ppp); - Prediction = FALSE; + Prediction = false; // restore things User[ppp->PlayerSprite] = u; diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index beff31b73..e820827a9 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -280,7 +280,7 @@ SWBOOL SetQuake(PLAYERp pp, short tics, short amt) { SpawnQuake(pp->cursectnum, pp->posx, pp->posy, pp->posz, tics, amt, 30000); - return FALSE; + return false; } int diff --git a/source/sw/src/ripper.cpp b/source/sw/src/ripper.cpp index a5fb09db0..e0233d064 100644 --- a/source/sw/src/ripper.cpp +++ b/source/sw/src/ripper.cpp @@ -889,7 +889,7 @@ PickJumpSpeed(short SpriteNum, int pix_height) u->jump_speed = -600; u->jump_grav = 8; - while (TRUE) + while (true) { if (GetJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20) break; @@ -917,7 +917,7 @@ PickJumpMaxSpeed(short SpriteNum, short max_speed) zh = SPRITEp_TOS(sp); - while (TRUE) + while (true) { if (zh - Z(GetJumpHeight(u->jump_speed, u->jump_grav)) - Z(16) > u->hiz) break; @@ -945,7 +945,7 @@ InitRipperHang(short SpriteNum) hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; - SWBOOL Found = FALSE; + SWBOOL Found = false; short dang, tang; for (dang = 0; dang < 2048; dang += 128) @@ -969,7 +969,7 @@ InitRipperHang(short SpriteNum) continue; } - Found = TRUE; + Found = true; sp->ang = tang; break; } @@ -1165,11 +1165,11 @@ DoRipperQuickJump(short SpriteNum) NewStateGroup(SpriteNum, sg_RipperJumpAttack); // move past the first state u->Tics = 30; - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/source/sw/src/ripper2.cpp b/source/sw/src/ripper2.cpp index 63c5f5127..5074aaa55 100644 --- a/source/sw/src/ripper2.cpp +++ b/source/sw/src/ripper2.cpp @@ -945,7 +945,7 @@ InitRipper2Hang(short SpriteNum) hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; - SWBOOL Found = FALSE; + SWBOOL Found = false; short dang, tang; for (dang = 0; dang < 2048; dang += 128) @@ -968,7 +968,7 @@ InitRipper2Hang(short SpriteNum) continue; } - Found = TRUE; + Found = true; sp->ang = tang; break; } @@ -1179,11 +1179,11 @@ DoRipper2QuickJump(short SpriteNum) NewStateGroup(SpriteNum, sg_Ripper2JumpAttack); // move past the first state u->Tics = 30; - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index d6a2c9dcb..3b8baef72 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -99,11 +99,11 @@ FAF_Sector(short sectnum) if (sp->statnum == STAT_FAF && (sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)) { - return TRUE; + return true; } } - return FALSE; + return false; } void SetWallWarpHitscan(short sectnum) @@ -155,7 +155,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, int loz, hiz; short newsectnum = sectnum; int startclipmask = 0; - SWBOOL plax_found = FALSE; + SWBOOL plax_found = false; if (clipmask == CLIPMASK_MISSILE) startclipmask = CLIPMASK_WARP_HITSCAN; @@ -202,7 +202,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, { //DSPRINTF(ds,"hitinfo->pos.x %d, hitinfo->pos.y %d, hitinfo->pos.z %d",hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z); MONO_PRINT(ds); - ASSERT(TRUE == FALSE); + ASSERT(true == false); } } } @@ -243,7 +243,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, if (FAF_ConnectFloor(hitinfo->sect) && !TEST(sector[hitinfo->sect].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN)) { updatesectorz(hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z + Z(12), &newsectnum); - plax_found = TRUE; + plax_found = true; } } else if (labs(hitinfo->pos.z - hiz) < Z(4)) @@ -251,7 +251,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, if (FAF_ConnectCeiling(hitinfo->sect) && !TEST(sector[hitinfo->sect].floorstat, CEILING_STAT_FAF_BLOCK_HITSCAN)) { updatesectorz(hitinfo->pos.x, hitinfo->pos.y, hitinfo->pos.z - Z(12), &newsectnum); - plax_found = TRUE; + plax_found = true; } } } @@ -274,7 +274,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, short ang; hitdata_t hitinfo; int dist; - SWBOOL plax_found = FALSE; + SWBOOL plax_found = false; vec3_t s = { xs, ys, zs }; // ASSERT(sects >= 0 && secte >= 0); @@ -311,7 +311,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, &hitinfo, CLIPMASK_MISSILE); if (hitinfo.sect < 0) - return FALSE; + return false; // make sure it hit JUST a sector before doing a check if (hitinfo.wall < 0 && hitinfo.sprite < 0) @@ -322,7 +322,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, if (FAF_ConnectFloor(hitinfo.sect)) { updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z + Z(12), &newsectnum); - plax_found = TRUE; + plax_found = true; } } else if (labs(hitinfo.pos.z - hiz) < Z(4)) @@ -330,7 +330,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, if (FAF_ConnectCeiling(hitinfo.sect)) { updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z - Z(12), &newsectnum); - plax_found = TRUE; + plax_found = true; } } } @@ -342,7 +342,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, if (plax_found) return cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,newsectnum,xe,ye,ze,secte); - return FALSE; + return false; } @@ -373,7 +373,7 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz) extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; int z_amt = 0; - SWBOOL SkipFAFcheck = FALSE; + SWBOOL SkipFAFcheck = false; if ((int)florhit != -1) { @@ -399,7 +399,7 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz) { // explicit z adjust overrides Connect Floor *loz += z_amt; - SkipFAFcheck = TRUE; + SkipFAFcheck = true; } } @@ -449,7 +449,7 @@ SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz) { // explicit z adjust overrides Connect Floor *loz += z_amt; - SkipFAFcheck = TRUE; + SkipFAFcheck = true; } } @@ -641,10 +641,10 @@ PicInView(short tile_num, SWBOOL reset) if (reset) RESET(gotpic[tile_num >> 3], 1 << (tile_num & 7)); - return TRUE; + return true; } - return FALSE; + return false; } void @@ -696,7 +696,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) // will not hurt if GlobStackSect is invalid - inside checks for this if (inside(x, y, GlobStackSect[i]) == 1) { - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_SECT(headspritesect[GlobStackSect[i]], SpriteNum, Next) { @@ -706,7 +706,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) (sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6) && sp->lotag == match) { - found = TRUE; + found = true; } } @@ -726,7 +726,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) { if (inside(x, y, (short) i) == 1) { - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_SECT(headspritesect[i], SpriteNum, Next) { @@ -736,7 +736,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) (sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6) && sp->lotag == match) { - found = TRUE; + found = true; } } @@ -844,7 +844,7 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum } if (*sectnum < 0) - return FALSE; + return false; ASSERT(sp); ASSERT(sp->hitag == VIEW_THRU_FLOOR); @@ -879,7 +879,7 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum } } - return TRUE; + return true; } SWBOOL @@ -932,7 +932,7 @@ FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) } if (*sectnum < 0) - return FALSE; + return false; ASSERT(sp); ASSERT(sp->hitag == VIEW_THRU_CEILING); @@ -969,7 +969,7 @@ FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) } } - return TRUE; + return true; } short @@ -996,7 +996,7 @@ ViewSectorInScene(short cursectnum, short level) // found a potential match match = sp->lotag; - if (!PicInView(FAF_MIRROR_PIC, TRUE)) + if (!PicInView(FAF_MIRROR_PIC, true)) return -1; return match; @@ -1034,7 +1034,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor sector[save.sectnum[i]].floorheinum = save.slope[i]; } - analyzesprites(tx, ty, tz, FALSE); + analyzesprites(tx, ty, tz, false); post_analyzesprites(); renderDrawMasks(); @@ -1060,7 +1060,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor sector[save.sectnum[i]].ceilingheinum = save.slope[i]; } - analyzesprites(tx, ty, tz, FALSE); + analyzesprites(tx, ty, tz, false); post_analyzesprites(); renderDrawMasks(); diff --git a/source/sw/src/rotator.cpp b/source/sw/src/rotator.cpp index ea637a486..03f91e1b4 100644 --- a/source/sw/src/rotator.cpp +++ b/source/sw/src/rotator.cpp @@ -78,7 +78,7 @@ RotatorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -86,7 +86,7 @@ RotatorSwitch(short match, short setting) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) { - found = TRUE; + found = true; AnimateSwitch(sp, setting); } } @@ -142,7 +142,7 @@ short DoRotatorOperate(PLAYERp pp, short sectnum) if (TestRotatorMatchActive(match)) return -1; else - return DoRotatorMatch(pp, match, TRUE); + return DoRotatorMatch(pp, match, true); } return -1; @@ -251,11 +251,11 @@ TestRotatorMatchActive(short match) continue; if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) - return TRUE; + return true; } } - return FALSE; + return false; } @@ -315,7 +315,7 @@ int DoRotatorMove(short SpriteNum) int i, nexti; vec2_t nxy; int dist,closest; - SWBOOL kill = FALSE; + SWBOOL kill = false; r = u->rotator; @@ -386,7 +386,7 @@ int DoRotatorMove(short SpriteNum) } if (TEST_BOOL2(sp)) - kill = TRUE; + kill = true; } closest = 99999; diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 453aa12b2..294ec4874 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -716,7 +716,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) INITLIST(&pp->PanelSpriteList); - while (TRUE) + while (true) { MREAD(&ndx, sizeof(ndx),1,fil); @@ -942,7 +942,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) { INITLIST(otlist[i]); - while (TRUE) + while (true) { MREAD(&ndx, sizeof(ndx),1,fil); @@ -1069,13 +1069,13 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) } // this is not a new game - ShadowWarrior::NewGame = FALSE; + ShadowWarrior::NewGame = false; DoPlayerDivePalette(Player+myconnectindex); DoPlayerNightVisionPalette(Player+myconnectindex); - SavegameLoaded = TRUE; + SavegameLoaded = true; return true; } diff --git a/source/sw/src/scrip2.cpp b/source/sw/src/scrip2.cpp index 5fc3dcd96..1776b4f78 100644 --- a/source/sw/src/scrip2.cpp +++ b/source/sw/src/scrip2.cpp @@ -60,7 +60,7 @@ static char token[MAXTOKEN]; static int grabbed; static int scriptline; static SWBOOL endofscript; -static SWBOOL tokenready; // only TRUE if UnGetToken was just called +static SWBOOL tokenready; // only true if UnGetToken was just called /* ============== @@ -86,8 +86,8 @@ TArray LoadScriptFile(const char *filename) { scriptbuffer.Push(0); scriptline = 1; - endofscript = FALSE; - tokenready = FALSE; + endofscript = false; + tokenready = false; } return scriptbuffer; } @@ -107,7 +107,7 @@ void GetToken(SWBOOL crossline) if (tokenready) // is a token already waiting? { - tokenready = FALSE; + tokenready = false; return; } @@ -115,7 +115,7 @@ void GetToken(SWBOOL crossline) { if (!crossline) Printf("Error: Line %i is incomplete\n",scriptline); - endofscript = TRUE; + endofscript = true; return; } @@ -129,7 +129,7 @@ skipspace: { if (!crossline) Printf("Error: Line %i is incomplete\n",scriptline); - endofscript = TRUE; + endofscript = true; return; } if (*script_p++ == '\n') @@ -144,7 +144,7 @@ skipspace: { if (!crossline) Printf("Error: Line %i is incomplete\n", scriptline); -endofscript = TRUE; +endofscript = true; return; } @@ -155,7 +155,7 @@ return; while (*script_p++ != '\n') if (script_p >= scriptend_p) { - endofscript = TRUE; + endofscript = true; return; } goto skipspace; @@ -218,17 +218,17 @@ void LoadKVXFromScript(const char* filename) do { - GetToken(TRUE); // Crossing a line boundary on the end of line to first token + GetToken(true); // Crossing a line boundary on the end of line to first token // of a new line is permitted (and expected) if (endofscript) break; lTile = atol(token); - GetToken(FALSE); + GetToken(false); lNumber = atol(token); - GetToken(FALSE); + GetToken(false); // Load the voxel file into memory if (!qloadkvx(lNumber,token)) @@ -273,14 +273,14 @@ void LoadPLockFromScript(const char *filename) do { - GetToken(TRUE); // Crossing a line boundary on the end of line to first token + GetToken(true); // Crossing a line boundary on the end of line to first token // of a new line is permitted (and expected) if (endofscript) break; lTile = atoi(token); - GetToken(FALSE); + GetToken(false); lNumber = atoi(token); // Store the sprite and voxel numbers for later use diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index fa1d442df..9054537d5 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -463,7 +463,7 @@ SectorSetup(void) break; case TAG_DOOR_SLIDING: - SetSectorWallBits(i, WALLFX_DONT_STICK, TRUE, TRUE); + SetSectorWallBits(i, WALLFX_DONT_STICK, true, true); break; case TAG_SINE_WAVE_FLOOR: @@ -517,7 +517,7 @@ SectorSetup(void) swf->ceiling_origz = sector[swf->sector].ceilingz - (range >> 2); // look for the rest by distance - for (swf_ndx = 1, sector_cnt = 1; TRUE; swf_ndx++) + for (swf_ndx = 1, sector_cnt = 1; true; swf_ndx++) { // near_sect = FindNextSectorByTag(base_sect, // TAG_SINE_WAVE_FLOOR + swf_ndx); @@ -867,21 +867,21 @@ OperateSector(short sectnum, short player_is_operating) if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR) - return FALSE; + return false; TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti) { fsp = &sprite[i]; if (SectUser[fsp->sectnum] && SectUser[fsp->sectnum]->stag == SECT_LOCK_DOOR) - return FALSE; + return false; if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp)) - return FALSE; + return false; if (fsp->statnum == STAT_ROTATOR && SP_TAG1(fsp) == SECT_ROTATOR && TEST_BOOL7(fsp)) - return FALSE; + return false; if (fsp->statnum == STAT_SLIDOR && SP_TAG1(fsp) == SECT_SLIDOR && TEST_BOOL7(fsp)) - return FALSE; + return false; } } @@ -894,18 +894,18 @@ OperateSector(short sectnum, short player_is_operating) case TAG_VATOR: DoVatorOperate(pp, sectnum); - return TRUE; + return true; case TAG_ROTATOR: DoRotatorOperate(pp, sectnum); - return TRUE; + return true; case TAG_SLIDOR: DoSlidorOperate(pp, sectnum); - return TRUE; + return true; } - return FALSE; + return false; } int @@ -919,7 +919,7 @@ OperateWall(short wallnum, short player_is_operating) } */ - return FALSE; + return false; } short @@ -950,7 +950,7 @@ AnimateSwitch(SPRITEp sp, short tgt_value) switch (sp->picnum) { - // set to TRUE/ON + // set to true/ON case SWITCH_SKULL: case SWITCH_LEVER: case SWITCH_LIGHT: @@ -1317,10 +1317,10 @@ SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop) CollapseSectorObject(sop, sop->xmid, sop->ymid); DoSpawnSpotsForKill(sop->match_event); KillSectorObjectSprites(sop); - return TRUE; + return true; } - return FALSE; + return false; } short @@ -1337,7 +1337,7 @@ DoSectorObjectKillMatch(short match) return TestKillSectorObject(sop); } - return FALSE; + return false; } @@ -1355,11 +1355,11 @@ SearchExplodeSectorMatch(short match) { KillMatchingCrackSprites(match); DoExplodeSector(match); - return TRUE; + return true; } } - return FALSE; + return false; } void @@ -1437,13 +1437,13 @@ ShootableSwitch(short SpriteNum) { case SWITCH_SHOOTABLE_1: //RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - OperateSprite(SpriteNum, FALSE); + OperateSprite(SpriteNum, false); sp->picnum = SWITCH_SHOOTABLE_1 + 1; break; case SWITCH_FUSE: case SWITCH_FUSE + 1: RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - OperateSprite(SpriteNum, FALSE); + OperateSprite(SpriteNum, false); sp->picnum = SWITCH_FUSE + 2; break; } @@ -1469,7 +1469,7 @@ void DoDeleteSpriteMatch(short match) unsigned stat; short found; - while (TRUE) + while (true) { found = -1; @@ -1595,10 +1595,10 @@ void DoMatchEverything(PLAYERp pp, short match, short state) DoSpikeMatch(match); if (!TestRotatorMatchActive(match)) - DoRotatorMatch(pp, match, FALSE); + DoRotatorMatch(pp, match, false); if (!TestSlidorMatchActive(match)) - DoSlidorMatch(pp, match, FALSE); + DoSlidorMatch(pp, match, false); DoSectorObjectKillMatch(match); DoSectorObjectSetScale(match); @@ -1639,12 +1639,12 @@ SWBOOL ComboSwitchTest(short combo_type, short match) // if any one is not set correctly then switch is not set if (state != SP_TAG3(sp)) { - return FALSE; + return false; } } } - return TRUE; + return true; } // NOTE: switches are always wall sprites @@ -1662,17 +1662,17 @@ OperateSprite(short SpriteNum, short player_is_operating) extern STATE s_Pachinko4Operate[]; if (Prediction) - return FALSE; + return false; if (sp->picnum == ST1) - return FALSE; + return false; if (player_is_operating) { pp = GlobPlayerP; if (!FAFcansee(pp->posx, pp->posy, pp->posz, pp->cursectnum, sp->x, sp->y, sp->z - DIV2(SPRITEp_SIZE_Z(sp)), sp->sectnum)) - return FALSE; + return false; } switch (sp->lotag) @@ -1683,7 +1683,7 @@ OperateSprite(short SpriteNum, short player_is_operating) case MECHANICGIRL_R0: case SAILORGIRL_R0: case PRUNEGIRL_R0: - //if(RANDOM_RANGE(1000) < 500) return(TRUE); + //if(RANDOM_RANGE(1000) < 500) return(true); //if(u->FlagOwner == 0) { short choose_snd; @@ -1691,7 +1691,7 @@ OperateSprite(short SpriteNum, short player_is_operating) u->FlagOwner = 1; u->WaitTics = SEC(4); - if (pp != Player+myconnectindex) return TRUE; + if (pp != Player+myconnectindex) return true; choose_snd = STD_RANDOM_RANGE(1000); if (sp->lotag == CARGIRL_R0) @@ -1761,51 +1761,51 @@ OperateSprite(short SpriteNum, short player_is_operating) PlayerSound(DIGI_REALTITS, v3df_dontpan|v3df_follow,pp); } } - return TRUE; + return true; case PACHINKO1: // Don't mess with it if it's already going - if (u->WaitTics > 0) return TRUE; + if (u->WaitTics > 0) return true; PlaySound(DIGI_PFLIP, sp, v3df_none); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); ChangeState(SpriteNum,s_Pachinko1Operate); - return TRUE; + return true; case PACHINKO2: // Don't mess with it if it's already going - if (u->WaitTics > 0) return TRUE; + if (u->WaitTics > 0) return true; PlaySound(DIGI_PFLIP, sp, v3df_none); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); ChangeState(SpriteNum,s_Pachinko2Operate); - return TRUE; + return true; case PACHINKO3: // Don't mess with it if it's already going - if (u->WaitTics > 0) return TRUE; + if (u->WaitTics > 0) return true; PlaySound(DIGI_PFLIP, sp, v3df_none); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); ChangeState(SpriteNum,s_Pachinko3Operate); - return TRUE; + return true; case PACHINKO4: // Don't mess with it if it's already going - if (u->WaitTics > 0) return TRUE; + if (u->WaitTics > 0) return true; PlaySound(DIGI_PFLIP, sp, v3df_none); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); ChangeState(SpriteNum,s_Pachinko4Operate); - return TRUE; + return true; case SWITCH_LOCKED: key_num = sp->hitag; @@ -1820,7 +1820,7 @@ OperateSprite(short SpriteNum, short player_is_operating) UnlockKeyLock(key_num, SpriteNum); } - return TRUE; + return true; case TAG_COMBO_SWITCH_EVERYTHING: @@ -1833,7 +1833,7 @@ OperateSprite(short SpriteNum, short player_is_operating) DoMatchEverything(pp, sp->hitag, ON); } - return TRUE; + return true; case TAG_COMBO_SWITCH_EVERYTHING_ONCE: @@ -1848,25 +1848,25 @@ OperateSprite(short SpriteNum, short player_is_operating) sp->lotag = 0; sp->hitag = 0; - return TRUE; + return true; case TAG_SWITCH_EVERYTHING: state = AnimateSwitch(sp, -1); DoMatchEverything(pp, sp->hitag, state); - return TRUE; + return true; case TAG_SWITCH_EVERYTHING_ONCE: state = AnimateSwitch(sp, -1); DoMatchEverything(pp, sp->hitag, state); sp->lotag = 0; sp->hitag = 0; - return TRUE; + return true; case TAG_LIGHT_SWITCH: state = AnimateSwitch(sp, -1); DoLightingMatch(sp->hitag, state); - return TRUE; + return true; case TAG_SPRITE_SWITCH_VATOR: { @@ -1879,12 +1879,12 @@ OperateSprite(short SpriteNum, short player_is_operating) DoSpikeMatch(sp->hitag); if (!TestRotatorMatchActive(sp->hitag)) - DoRotatorMatch(pp, sp->hitag, FALSE); + DoRotatorMatch(pp, sp->hitag, false); if (!TestSlidorMatchActive(sp->hitag)) - DoSlidorMatch(pp, sp->hitag, FALSE); + DoSlidorMatch(pp, sp->hitag, false); - return TRUE; + return true; } case TAG_LEVEL_EXIT_SWITCH: @@ -1900,7 +1900,7 @@ OperateSprite(short SpriteNum, short player_is_operating) map = FindMapByLevelNum(currentLevel->levelNumber + 1); ChangeLevel(map, -1); - return TRUE; + return true; } case TAG_SPRITE_GRATING: @@ -1916,20 +1916,20 @@ OperateSprite(short SpriteNum, short player_is_operating) sp->lotag = 0; sp->hitag /= 2; - return TRUE; + return true; } case TAG_SO_SCALE_SWITCH: AnimateSwitch(sp, -1); DoSectorObjectSetScale(sp->hitag); - return TRUE; + return true; case TAG_SO_SCALE_ONCE_SWITCH: AnimateSwitch(sp, -1); DoSectorObjectSetScale(sp->hitag); sp->lotag = 0; sp->hitag = 0; - return TRUE; + return true; case TAG_SO_EVENT_SWITCH: { @@ -1962,13 +1962,13 @@ OperateSprite(short SpriteNum, short player_is_operating) PlaySound(DIGI_BIGSWITCH, sp, v3df_none); - return TRUE; + return true; break; } } - return FALSE; + return false; } int DoTrapReset(short match) @@ -2134,9 +2134,9 @@ OperateTripTrigger(PLAYERp pp) if (!TestSpikeMatchActive(sectp->hitag)) DoSpikeMatch(sectp->hitag); if (!TestRotatorMatchActive(sectp->hitag)) - DoRotatorMatch(pp, sectp->hitag, FALSE); + DoRotatorMatch(pp, sectp->hitag, false); if (!TestSlidorMatchActive(sectp->hitag)) - DoSlidorMatch(pp, sectp->hitag, FALSE); + DoSlidorMatch(pp, sectp->hitag, false); break; case TAG_LIGHT_TRIGGER: @@ -2314,7 +2314,7 @@ SWBOOL NearThings(PLAYERp pp) { if (pp == Player+myconnectindex) PlayerSound(sector[pp->cursectnum].lotag, v3df_follow|v3df_dontpan,pp); - return FALSE; + return false; } neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, FixedToInt(pp->q16ang), @@ -2334,7 +2334,7 @@ SWBOOL NearThings(PLAYERp pp) if (pp == Player+myconnectindex) PlayerSound(sp->lotag, v3df_follow|v3df_dontpan,pp); } - return FALSE; // Return false so he doesn't grunt + return false; // Return false so he doesn't grunt } if (neartagwall >= 0) @@ -2344,9 +2344,9 @@ SWBOOL NearThings(PLAYERp pp) { if (pp == Player+myconnectindex) PlayerSound(wall[neartagwall].lotag, v3df_follow|v3df_dontpan,pp); - return FALSE; // We are playing a sound so don't return true + return false; // We are playing a sound so don't return true } - return TRUE; + return true; } // This only gets called if nothing else worked, check for nearness to a wall { @@ -2360,17 +2360,17 @@ SWBOOL NearThings(PLAYERp pp) &hitinfo, CLIPMASK_MISSILE); if (hitinfo.sect < 0) - return FALSE; + return false; if (Distance(hitinfo.pos.x, hitinfo.pos.y, pp->posx, pp->posy) > 1500) - return FALSE; + return false; // hit a sprite? if (hitinfo.sprite >= 0) - return FALSE; + return false; if (neartagsect >= 0) - return TRUE; + return true; if (hitinfo.wall >= 0) { @@ -2387,10 +2387,10 @@ SWBOOL NearThings(PLAYERp pp) PlayerSound(DIGI_SEARCHWALL, v3df_follow|v3df_dontpan,pp); } - return TRUE; + return true; } - return FALSE; + return false; } } @@ -2547,13 +2547,13 @@ int DoPlayerGrabStar(PLAYERp pp) KillSprite(StarQueue[i]); StarQueue[i] = -1; if (TEST(pp->WpnFlags, BIT(WPN_STAR))) - return TRUE; + return true; SET(pp->WpnFlags, BIT(WPN_STAR)); InitWeaponStar(pp); - return TRUE; + return true; } - return FALSE; + return false; } @@ -2592,17 +2592,17 @@ PlayerOperateEnv(PLAYERp pp) BuildNearTagList(nti, sizeof(nti), pp, pp->posz, 2048L, NTAG_SEARCH_LO_HI, 8); - found = FALSE; + found = false; // try and find a sprite for (nt_ndx = 0; nti[nt_ndx].dist >= 0; nt_ndx++) { if (nti[nt_ndx].spritenum >= 0 && nti[nt_ndx].dist < 1024 + 768) { - if (OperateSprite(nti[nt_ndx].spritenum, TRUE)) + if (OperateSprite(nti[nt_ndx].spritenum, true)) { pp->KeyPressBits &= ~SB_OPEN; - found = TRUE; + found = true; } } } @@ -2628,7 +2628,7 @@ PlayerOperateEnv(PLAYERp pp) { if (nti[nt_ndx].spritenum >= 0 && nti[nt_ndx].dist < 1024 + 768) { - if (OperateSprite(nti[nt_ndx].spritenum, TRUE)) + if (OperateSprite(nti[nt_ndx].spritenum, true)) { pp->KeyPressBits &= ~SB_OPEN; break; @@ -2648,7 +2648,7 @@ PlayerOperateEnv(PLAYERp pp) if (neartagsector >= 0 && neartaghitdist < 1024) { - if (OperateSector(neartagsector, TRUE)) + if (OperateSector(neartagsector, true)) { // Release the key pp->KeyPressBits &= ~SB_OPEN; @@ -2657,7 +2657,7 @@ PlayerOperateEnv(PLAYERp pp) if (neartagwall >= 0 && neartaghitdist < 1024) { - if (OperateWall(neartagwall, TRUE)) + if (OperateWall(neartagwall, true)) { pp->KeyPressBits &= ~SB_OPEN; } @@ -2681,7 +2681,7 @@ PlayerOperateEnv(PLAYERp pp) pp->KeyPressBits &= ~SB_OPEN; break; case TAG_DOOR_ROTATE: - if (OperateSector(pp->cursectnum, TRUE)) + if (OperateSector(pp->cursectnum, true)) pp->KeyPressBits &= ~SB_OPEN; break; } @@ -3269,7 +3269,7 @@ DoSector(void) continue; - riding = FALSE; + riding = false; min_dist = 999999; TRAVERSE_CONNECT(pnum) @@ -3278,7 +3278,7 @@ DoSector(void) if (pp->sop_riding == sop) { - riding = TRUE; + riding = true; pp->sop_riding = NULL; break; } diff --git a/source/sw/src/skel.cpp b/source/sw/src/skel.cpp index 902af431f..b63774966 100644 --- a/source/sw/src/skel.cpp +++ b/source/sw/src/skel.cpp @@ -552,7 +552,7 @@ int DoSkelTeleport(short SpriteNum) x = sp->x; y = sp->y; - while (TRUE) + while (true) { sp->x = x; sp->y = y; diff --git a/source/sw/src/slidor.cpp b/source/sw/src/slidor.cpp index 8a281b4bb..5c87f47ea 100644 --- a/source/sw/src/slidor.cpp +++ b/source/sw/src/slidor.cpp @@ -73,7 +73,7 @@ SlidorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -81,7 +81,7 @@ SlidorSwitch(short match, short setting) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) { - found = TRUE; + found = true; AnimateSwitch(sp, setting); } } @@ -138,7 +138,7 @@ short DoSlidorOperate(PLAYERp pp, short sectnum) if (TestSlidorMatchActive(match)) return -1; else - return DoSlidorMatch(pp, match, TRUE); + return DoSlidorMatch(pp, match, true); } return -1; @@ -247,11 +247,11 @@ TestSlidorMatchActive(short match) continue; if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) - return TRUE; + return true; } } - return FALSE; + return false; } void DoSlidorInterp(short SpriteNum, INTERP_FUNCp interp_func) @@ -538,7 +538,7 @@ int DoSlidorMove(short SpriteNum) SPRITEp sp = u->SpriteP; ROTATORp r; int old_pos; - SWBOOL kill = FALSE; + SWBOOL kill = false; r = u->rotator; @@ -613,7 +613,7 @@ int DoSlidorMove(short SpriteNum) } if (TEST_BOOL2(sp)) - kill = TRUE; + kill = true; } else { @@ -623,7 +623,7 @@ int DoSlidorMove(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { @@ -635,7 +635,7 @@ int DoSlidorMove(short SpriteNum) // found something blocking so reverse to ON position ReverseSlidor(SpriteNum); SET_BOOL8(sp); // tell vator that something blocking door - found = TRUE; + found = true; break; } } @@ -655,7 +655,7 @@ int DoSlidorMove(short SpriteNum) ReverseSlidor(SpriteNum); u->vel_rate = -u->vel_rate; - found = TRUE; + found = true; } } } diff --git a/source/sw/src/spike.cpp b/source/sw/src/spike.cpp index 32136b7a1..c6acfb589 100644 --- a/source/sw/src/spike.cpp +++ b/source/sw/src/spike.cpp @@ -77,7 +77,7 @@ SpikeSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -85,7 +85,7 @@ SpikeSwitch(short match, short setting) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) { - found = TRUE; + found = true; AnimateSwitch(sp, setting); } } @@ -231,11 +231,11 @@ TestSpikeMatchActive(short match) continue; if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) - return TRUE; + return true; } } - return FALSE; + return false; } int DoSpikeMove(short SpriteNum, int *lptr) @@ -397,7 +397,7 @@ int DoSpike(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { @@ -407,7 +407,7 @@ int DoSpike(short SpriteNum) if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY)) { ReverseSpike(SpriteNum); - found = TRUE; + found = true; break; } } @@ -425,7 +425,7 @@ int DoSpike(short SpriteNum) pp->hi_sectp == §or[sp->sectnum]) { ReverseSpike(SpriteNum); - found = TRUE; + found = true; } } } diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index af8cb4435..ef226f614 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -1043,10 +1043,10 @@ IconSpawn(SPRITEp sp) if (TEST(sp->extra, SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) - return FALSE; + return false; } - return TRUE; + return true; } SWBOOL @@ -1059,7 +1059,7 @@ ActorTestSpawn(SPRITEp sp) memcpy(&sprite[New], sp, sizeof(SPRITE)); change_sprite_stat(New, STAT_SPAWN_TRIGGER); RESET(sprite[New].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); - return FALSE; + return false; } // Skill ranges from -1 (No Monsters) to 3 @@ -1084,7 +1084,7 @@ ActorTestSpawn(SPRITEp sp) } Printf("WARNING: skill-masked %s at %d,%d,%d not being killed because it " "activates something\n", c, TrackerCast(sp->x), TrackerCast(sp->y), TrackerCast(sp->z)); - return TRUE; + return true; } //always spawn girls in addons if ((sp->picnum == TOILETGIRL_R0 || @@ -1092,18 +1092,18 @@ ActorTestSpawn(SPRITEp sp) sp->picnum == MECHANICGIRL_R0 || sp->picnum == CARGIRL_R0 || sp->picnum == PRUNEGIRL_R0 || - sp->picnum == SAILORGIRL_R0) && (g_gameType & GAMEFLAG_ADDON)) return TRUE; + sp->picnum == SAILORGIRL_R0) && (g_gameType & GAMEFLAG_ADDON)) return true; // spawn Bouncing Betty (mine) in TD map 09 Warehouse #if 0 // needs to be done smarter. if (sp->picnum == 817 && swGetAddon() == 2 && currentLevel->levelNumber == 9) - return TRUE; + return true; #endif - return FALSE; + return false; } - return TRUE; + return true; } @@ -1128,7 +1128,7 @@ void PreCachePachinko(void); SWBOOL ActorSpawn(SPRITEp sp) { - int ret = TRUE; + int ret = true; short SpriteNum = sp - sprite; switch (sp->picnum) @@ -1140,7 +1140,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1158,7 +1158,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1175,7 +1175,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1192,7 +1192,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1208,7 +1208,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1224,7 +1224,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1241,7 +1241,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1258,7 +1258,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1275,7 +1275,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1292,7 +1292,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1309,7 +1309,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1326,7 +1326,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1343,7 +1343,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1370,7 +1370,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1386,7 +1386,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1402,7 +1402,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1418,7 +1418,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1432,7 +1432,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1448,7 +1448,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1464,7 +1464,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1480,7 +1480,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1496,7 +1496,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1555,7 +1555,7 @@ ActorSpawn(SPRITEp sp) if (!ActorTestSpawn(sp)) { KillSprite(SpriteNum); - return FALSE; + return false; } PicAnimOff(sp->picnum); @@ -1565,7 +1565,7 @@ ActorSpawn(SPRITEp sp) } default: - ret = FALSE; + ret = false; break; } @@ -2272,7 +2272,7 @@ SpriteSetup(void) SET(sectu->flags, SECTFU_VATOR_BOTH); } SET(sectp->extra, SECTFX_VATOR); - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, TRUE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, true, true); SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA); // don't step on toes of other sector settings @@ -2284,9 +2284,9 @@ SpriteSetup(void) vel = SP_TAG5(sp); time = SP_TAG9(sp); start_on = !!TEST_BOOL1(sp); - floor_vator = TRUE; + floor_vator = true; if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - floor_vator = FALSE; + floor_vator = false; u->jump_speed = u->vel_tgt = speed; u->vel_rate = vel; @@ -2375,7 +2375,7 @@ SpriteSetup(void) short wallcount,startwall,endwall,w; u = SpawnUser(SpriteNum, 0, NULL); - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, TRUE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, true, true); // need something for this sectp->lotag = TAG_ROTATOR; @@ -2438,7 +2438,7 @@ SpriteSetup(void) u = SpawnUser(SpriteNum, 0, NULL); - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, TRUE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, true, true); // need something for this sectp->lotag = TAG_SLIDOR; @@ -2489,7 +2489,7 @@ SpriteSetup(void) int floorz,ceilingz,trash; u = SpawnUser(SpriteNum, 0, NULL); - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, FALSE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, false, true); SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA); type = SP_TAG3(sp); @@ -2497,9 +2497,9 @@ SpriteSetup(void) vel = SP_TAG5(sp); time = SP_TAG9(sp); start_on = !!TEST_BOOL1(sp); - floor_vator = TRUE; + floor_vator = true; if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) - floor_vator = FALSE; + floor_vator = false; u->jump_speed = u->vel_tgt = speed; u->vel_rate = vel; @@ -2731,7 +2731,7 @@ SpriteSetup(void) { SECTORp sectp = §or[sp->sectnum]; - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, FALSE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, false, true); if (TEST(sectp->floorstat, FLOOR_STAT_SLOPE)) { @@ -2761,7 +2761,7 @@ SpriteSetup(void) case SECT_COPY_DEST: { - SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, FALSE, TRUE); + SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, false, true); change_sprite_stat(SpriteNum, STAT_COPY_DEST); break; } @@ -3812,7 +3812,7 @@ NUKE_REPLACEMENT: SWBOOL ItemSpotClear(SPRITEp sip, short statnum, short id) { - SWBOOL found = FALSE; + SWBOOL found = false; short i,nexti; if (TEST_BOOL2(sip)) @@ -3821,7 +3821,7 @@ SWBOOL ItemSpotClear(SPRITEp sip, short statnum, short id) { if (sprite[i].statnum == statnum && User[i]->ID == id) { - found = TRUE; + found = true; break; } } @@ -4659,10 +4659,10 @@ SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) int spa_tos, spa_bos, spb_tos, spb_bos, overlap_z; - if (!ua || !ub) return FALSE; + if (!ua || !ub) return false; if ((unsigned)Distance(spa->x, spa->y, spb->x, spb->y) > ua->Radius + ub->Radius) { - return FALSE; + return false; } spa_tos = SPRITEp_TOS(spa); @@ -4677,16 +4677,16 @@ SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) // if the top of sprite a is below the bottom of b if (spa_tos - overlap_z > spb_bos) { - return FALSE; + return false; } // if the top of sprite b is is below the bottom of a if (spb_tos - overlap_z > spa_bos) { - return FALSE; + return false; } - return TRUE; + return true; } @@ -4707,16 +4707,16 @@ SpriteOverlapZ(int16_t spritenum_a, int16_t spritenum_b, int z_overlap) // if the top of sprite a is below the bottom of b if (spa_tos + z_overlap > spb_bos) { - return FALSE; + return false; } // if the top of sprite b is is below the bottom of a if (spb_tos + z_overlap > spa_bos) { - return FALSE; + return false; } - return TRUE; + return true; } @@ -4870,7 +4870,7 @@ DoActorZrange(short SpriteNum) u->hi_sectp = §or[NORM_SECTOR(ceilhit)]; break; default: - ASSERT(TRUE==FALSE); + ASSERT(true==false); break; } @@ -4883,7 +4883,7 @@ DoActorZrange(short SpriteNum) u->lo_sectp = §or[NORM_SECTOR(florhit)]; break; default: - ASSERT(TRUE==FALSE); + ASSERT(true==false); break; } } @@ -4942,7 +4942,7 @@ ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_heig if (florhit < 0 || ceilhit < 0) { //SetSuicide(SpriteNum); - return TRUE; + return true; } @@ -4959,7 +4959,7 @@ ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_heig if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR) && (labs(loz - z) <= min_height)) { - return FALSE; + return false; } break; @@ -4969,17 +4969,17 @@ ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_heig { if (labs(loz - z) <= min_height) { - return FALSE; + return false; } break; } default: - ASSERT(TRUE == FALSE); + ASSERT(true == false); break; } - return TRUE; + return true; } // Primarily used in ai.c for now - need to get rid of @@ -5002,9 +5002,9 @@ DropAhead(short SpriteNum, short min_height) // look straight down for a drop if (ActorDrop(SpriteNum, dax, day, sp->z, newsector, min_height)) - return TRUE; + return true; - return FALSE; + return false; } /* @@ -5075,7 +5075,7 @@ move_actor(short SpriteNum, int xchange, int ychange, int zchange) u->hi_sectp = hi_sectp; u->ret = -1; changespritesect(SpriteNum, sectnum); - return FALSE; + return false; } if (ActorDrop(SpriteNum, sp->x, sp->y, sp->z, sp->sectnum, u->lo_step)) @@ -5094,7 +5094,7 @@ move_actor(short SpriteNum, int xchange, int ychange, int zchange) u->hi_sectp = hi_sectp; u->ret = -1; changespritesect(SpriteNum, sectnum); - return FALSE; + return false; } } @@ -5107,11 +5107,11 @@ move_actor(short SpriteNum, int xchange, int ychange, int zchange) u->TargetDist -= dist; u->Dist += dist; u->DistCheck += dist; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -5476,31 +5476,31 @@ SWBOOL CanGetWeapon(PLAYERp pp, short SpriteNum, int WPN) switch (gNet.MultiGameType) { case MULTI_GAME_NONE: - return TRUE; + return true; case MULTI_GAME_COOPERATIVE: if (TEST(u->Flags2, SPR2_NEVER_RESPAWN)) - return TRUE; + return true; if (TEST(pp->WpnGotOnceFlags, BIT(WPN))) - return FALSE; + return false; - return TRUE; + return true; case MULTI_GAME_COMMBAT: case MULTI_GAME_AI_BOTS: if (TEST(u->Flags2, SPR2_NEVER_RESPAWN)) - return TRUE; + return true; // No Respawn - can't get a weapon again if you already got it if (gNet.NoRespawn && TEST(pp->WpnGotOnceFlags, BIT(WPN))) - return FALSE; + return false; - return TRUE; + return true; } - return TRUE; + return true; } struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL] = @@ -5632,7 +5632,7 @@ KeyMain: PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_KEYMSG + key_num)); - pp->HasKey[key_num] = TRUE; + pp->HasKey[key_num] = true; SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup if (pp == Player+myconnectindex) PlaySound(DIGI_KEY, sp, v3df_dontpan); @@ -5684,14 +5684,14 @@ KeyMain: case ICON_SM_MEDKIT: if (pu->Health < 100) { - SWBOOL putbackmax=FALSE; + SWBOOL putbackmax=false; PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit)); if (pp->MaxHealth == 200) { pp->MaxHealth = 100; - putbackmax = TRUE; + putbackmax = true; } PlayerUpdateHealth(pp, InventoryDecls[InvDecl_SmMedkit].amount); @@ -6701,11 +6701,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + // ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #else ASSERT(User[i]); StateControl(i); - // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + // ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #endif } @@ -6721,11 +6721,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #endif } } @@ -6742,7 +6742,7 @@ SpriteControl(void) sp = u->SpriteP; - CloseToPlayer = FALSE; + CloseToPlayer = false; ProcessActiveVars(i); @@ -6757,7 +6757,7 @@ SpriteControl(void) if (dist < u->active_range) { - CloseToPlayer = TRUE; + CloseToPlayer = true; } } @@ -6770,12 +6770,12 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #else StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #endif - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); } else { @@ -6797,11 +6797,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #endif } } @@ -6811,7 +6811,7 @@ SpriteControl(void) { if (User[i] && User[i]->ActorActionFunc) (*User[i]->ActorActionFunc)(i); - ASSERT(nexti >= 0 ? sprite[nexti].statnum != MAXSTATUS : TRUE); + ASSERT(nexti >= 0 ? sprite[nexti].statnum != MAXSTATUS : true); } if (MoveSkip8 == 0) @@ -6833,11 +6833,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + ASSERT(nexti >= 0 ? User[nexti] != NULL : true); #endif } @@ -6991,7 +6991,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist if (dasectnum < 0) { retval = HIT_WALL; - //ASSERT(TRUE == FALSE); + //ASSERT(true == false); return retval; } diff --git a/source/sw/src/sumo.cpp b/source/sw/src/sumo.cpp index 50e581fb5..5f634a287 100644 --- a/source/sw/src/sumo.cpp +++ b/source/sw/src/sumo.cpp @@ -41,9 +41,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS extern uint8_t playTrack; -SWBOOL serpwasseen = FALSE; -SWBOOL sumowasseen = FALSE; -SWBOOL zillawasseen = FALSE; +SWBOOL serpwasseen = false; +SWBOOL sumowasseen = false; +SWBOOL zillawasseen = false; short BossSpriteNum[3] = {-1,-1,-1}; @@ -819,7 +819,7 @@ BossHealthMeter(void) extern SWBOOL NoMeters; short health; SWBOOL bosswasseen; - static SWBOOL triedplay = FALSE; + static SWBOOL triedplay = false; if (NoMeters) return; @@ -873,7 +873,7 @@ BossHealthMeter(void) { if (i == 0 && !serpwasseen) { - serpwasseen = TRUE; + serpwasseen = true; if (!SW_SHAREWARE) { PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true); @@ -881,7 +881,7 @@ BossHealthMeter(void) } else if (i == 1 && !sumowasseen) { - sumowasseen = TRUE; + sumowasseen = true; if (!SW_SHAREWARE) { PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true); @@ -889,7 +889,7 @@ BossHealthMeter(void) } else if (i == 2 && !zillawasseen) { - zillawasseen = TRUE; + zillawasseen = true; if (!SW_SHAREWARE) { PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true); diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index c3eea0a47..8af6f66df 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -79,10 +79,10 @@ TrackTowardPlayer(SPRITEp sp, TRACKp t, TRACK_POINTp start_point) if (end_dist < start_dist) { - return TRUE; + return true; } - return FALSE; + return false; } @@ -109,10 +109,10 @@ TrackStartCloserThanEnd(short SpriteNum, TRACKp t, TRACK_POINTp start_point) if (start_dist < end_dist) { - return TRUE; + return true; } - return FALSE; + return false; } @@ -726,7 +726,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) short sp_num, next_sp_num, startwall, endwall; int i, k, j; SPRITEp BoundSprite; - SWBOOL FoundOutsideLoop = FALSE; + SWBOOL FoundOutsideLoop = false; SWBOOL SectorInBounds; SECTORp *sectp; USERp u = User[sop->sp_child - sprite]; @@ -806,14 +806,14 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) startwall = sector[k].wallptr; endwall = startwall + sector[k].wallnum - 1; - SectorInBounds = TRUE; + SectorInBounds = true; for (j = startwall; j <= endwall; j++) { // all walls have to be in bounds to be in sector object if (!(wall[j].x > xlow && wall[j].x < xhigh && wall[j].y > ylow && wall[j].y < yhigh)) { - SectorInBounds = FALSE; + SectorInBounds = false; break; } } @@ -850,7 +850,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) // Make sure every sector object has an outer loop tagged - important // - FoundOutsideLoop = FALSE; + FoundOutsideLoop = false; for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) { @@ -865,7 +865,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) sop->morph_wall_point = k; if (wall[k].extra && TEST(wall[k].extra, WALLFX_LOOP_OUTER)) - FoundOutsideLoop = TRUE; + FoundOutsideLoop = true; // each wall has this set - for collision detection SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK); @@ -1505,7 +1505,7 @@ PlaceSectorObjectsOnTracks(void) if (sop->track >= SO_OPERATE_TRACK_START) continue; - found = FALSE; + found = false; // find the closest point on the track and put SOBJ on it for (j = 0; j < Track[sop->track].NumPoints; j++) { @@ -1517,7 +1517,7 @@ PlaceSectorObjectsOnTracks(void) { low_dist = dist; sop->point = j; - found = TRUE; + found = true; ////DSPRINTF(ds,"point = %d, dist = %d, x1=%d, y1=%d",j,low_dist,(tpoint +j)->x,(tpoint+j)->y); //MONO_PRINT(ds); } @@ -1695,17 +1695,17 @@ MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny) WALLp wp; USERp u; short i, rot_ang; - SWBOOL PlayerMove = TRUE; + SWBOOL PlayerMove = true; if (sop->xmid >= MAXSO) - PlayerMove = FALSE; + PlayerMove = false; // move along little midpoint sop->xmid += BOUND_4PIX(nx); sop->ymid += BOUND_4PIX(ny); if (sop->xmid >= MAXSO) - PlayerMove = FALSE; + PlayerMove = false; // move child sprite along also sop->sp_child->x = sop->xmid; @@ -1783,13 +1783,13 @@ PlayerPart: { #if 0 short nr, nextnr; - SWBOOL skip = TRUE; + SWBOOL skip = true; TRAVERSE_SPRITE_STAT(headspritestat[STAT_NO_RIDE], nr, nextnr) { if (sprite[nr].lotag == sop - SectorObject) - skip = TRUE; + skip = true; else - skip = FALSE; + skip = false; } if (skip) @@ -2238,7 +2238,7 @@ void CallbackSOsink(ANIMp ap, void *data) short dest_sector = -1; short src_sector = -1; short i, nexti, ndx; - char found = FALSE; + char found = false; int tgt_depth; sop = (SECTOR_OBJECTp)data; @@ -2294,7 +2294,7 @@ void CallbackSOsink(ANIMp ap, void *data) ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8); AnimSetVelAdj(ndx, ap->vel_adj); - found = TRUE; + found = true; break; } } @@ -2311,7 +2311,7 @@ void CallbackSOsink(ANIMp ap, void *data) // in a more precise way ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8); AnimSetVelAdj(ndx, ap->vel_adj); - found = TRUE; + found = true; break; } } @@ -2360,7 +2360,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics) if (TEST(sop->flags, SOBJ_UPDATE_ONCE)) { RESET(sop->flags, SOBJ_UPDATE_ONCE); - RefreshPoints(sop, 0, 0, FALSE); + RefreshPoints(sop, 0, 0, false); } return; } @@ -2412,7 +2412,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics) if (TEST(sop->flags, SOBJ_DYNAMIC)) { // trick tricks - RefreshPoints(sop, nx, ny, TRUE); + RefreshPoints(sop, nx, ny, true); } else { @@ -2423,7 +2423,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics) GlobSpeedSO) { RESET(sop->flags, SOBJ_UPDATE_ONCE); - RefreshPoints(sop, nx, ny, FALSE); + RefreshPoints(sop, nx, ny, false); } } } @@ -2811,7 +2811,7 @@ OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int newy, sop->spin_ang = 0; sop->ang = newang; - RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); + RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, false); } void @@ -2824,7 +2824,7 @@ void PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy) { so_setinterpolationtics(sop, synctics); - RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); + RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, false); } void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator) @@ -2886,7 +2886,7 @@ KillSectorObject(SECTOR_OBJECTp sop) sop->spin_ang = 0; sop->ang = sop->ang_tgt; - RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); + RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, false); } @@ -2952,7 +2952,7 @@ DoTornadoObject(SECTOR_OBJECTp sop) } TornadoSpin(sop); - RefreshPoints(sop, pos.x - sop->xmid, pos.y - sop->ymid, TRUE); + RefreshPoints(sop, pos.x - sop->xmid, pos.y - sop->ymid, true); } void @@ -3158,7 +3158,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (u->track_dir == -1) { DoActorHitTrackEndPoint(u); - return FALSE; + return false; } } @@ -3172,7 +3172,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (u->track_dir == 1) { DoActorHitTrackEndPoint(u); - return FALSE; + return false; } } @@ -3286,10 +3286,10 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) ASSERT(hitinfo.sect >= 0); if (hitinfo.sprite >= 0) - return FALSE; + return false; if (hitinfo.wall < 0) - return FALSE; + return false; zdiff = labs(sp->z - sector[wall[hitinfo.wall].nextsector].floorz) >> 8; @@ -3299,7 +3299,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) DoActorBeginJump(SpriteNum); u->ActorActionFunc = DoActorMoveJump; - return FALSE; + return false; } break; @@ -3325,7 +3325,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) DoActorBeginJump(SpriteNum); u->ActorActionFunc = DoActorMoveJump; - return FALSE; + return false; } break; @@ -3335,7 +3335,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (u->ActorActionSet->Jump) { ActorLeaveTrack(SpriteNum); - return FALSE; + return false; } break; @@ -3357,7 +3357,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) InitActorDuck(SpriteNum); u->ActorActionFunc = DoActorDuck; - return FALSE; + return false; } break; @@ -3371,7 +3371,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) int i; if (u->Rot == u->ActorActionSet->Sit || u->Rot == u->ActorActionSet->Stand) - return FALSE; + return false; sp->ang = tpoint->ang; @@ -3392,7 +3392,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (nearsprite >= 0 && nearhitdist < 1024) { - if (OperateSprite(nearsprite, FALSE)) + if (OperateSprite(nearsprite, false)) { if (!tpoint->tag_high) u->WaitTics = 2 * 120; @@ -3406,7 +3406,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (nearsector >= 0 && nearhitdist < 1024) { - if (OperateSector(nearsector, FALSE)) + if (OperateSector(nearsector, false)) { if (!tpoint->tag_high) u->WaitTics = 2 * 120; @@ -3419,7 +3419,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (nearwall >= 0 && nearhitdist < 1024) { - if (OperateWall(nearwall, FALSE)) + if (OperateWall(nearwall, false)) { if (!tpoint->tag_high) u->WaitTics = 2 * 120; @@ -3603,7 +3603,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (!lsp) { ActorLeaveTrack(SpriteNum); - return FALSE; + return false; } // determine where the player is supposed to be in relation to the ladder @@ -3628,7 +3628,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) if (hit_wall < 0) { ActorLeaveTrack(SpriteNum); - return FALSE; + return false; } #if DEBUG @@ -3672,7 +3672,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) break; } - return TRUE; + return true; } /* @@ -3701,7 +3701,7 @@ ActorFollowTrack(short SpriteNum, short locktics) // if not on a track then better not go here if (u->track == -1) - return TRUE; + return true; // if lying in wait for player if (TEST(u->Flags, SPR_WAIT_FOR_PLAYER | SPR_WAIT_FOR_TRIGGER)) @@ -3716,13 +3716,13 @@ ActorFollowTrack(short SpriteNum, short locktics) { u->tgt_sp = pp->SpriteP; RESET(u->Flags, SPR_WAIT_FOR_PLAYER); - return TRUE; + return true; } } } u->Tics = 0; - return TRUE; + return true; } // if pausing the return @@ -3736,7 +3736,7 @@ ActorFollowTrack(short SpriteNum, short locktics) u->WaitTics = 0; } - return TRUE; + return true; } tpoint = Track[u->track].TrackPoint + u->point; @@ -3749,7 +3749,7 @@ ActorFollowTrack(short SpriteNum, short locktics) if ((dist = Distance(sp->x, sp->y, tpoint->x, tpoint->y)) < 200) // 64 { if (!ActorTrackDecide(tpoint, SpriteNum)) - return TRUE; + return true; // get the next point NextActorTrackPoint(SpriteNum); @@ -3825,7 +3825,7 @@ ActorFollowTrack(short SpriteNum, short locktics) u->jump_speed = -650; DoActorBeginJump(SpriteNum); - return TRUE; + return true; } } else @@ -3851,7 +3851,7 @@ ActorFollowTrack(short SpriteNum, short locktics) } - return TRUE; + return true; } diff --git a/source/sw/src/vator.cpp b/source/sw/src/vator.cpp index 50afe02f8..2bf0295fc 100644 --- a/source/sw/src/vator.cpp +++ b/source/sw/src/vator.cpp @@ -82,7 +82,7 @@ VatorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -90,7 +90,7 @@ VatorSwitch(short match, short setting) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match) { - found = TRUE; + found = true; AnimateSwitch(sp, setting); } } @@ -198,7 +198,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum) #endif { PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1)); - return FALSE; + return false; } } @@ -308,11 +308,11 @@ TestVatorMatchActive(short match) continue; if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) - return TRUE; + return true; } } - return FALSE; + return false; } void InterpSectorSprites(short sectnum, SWBOOL state) @@ -344,7 +344,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, SWBOOL type) { SPRITEp sp; short i,nexti; - SWBOOL both = FALSE; + SWBOOL both = false; if (SectUser[sectnum]) both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH); @@ -538,7 +538,7 @@ int DoVator(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = FALSE; + SWBOOL found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { @@ -549,7 +549,7 @@ int DoVator(short SpriteNum) { if (labs(sectp->ceilingz - sectp->floorz) < SPRITEp_SIZE_Z(bsp)) { - InitBloodSpray(i, TRUE, -1); + InitBloodSpray(i, true, -1); UpdateSinglePlayKills(i); KillSprite(i); continue; @@ -561,7 +561,7 @@ int DoVator(short SpriteNum) // found something blocking so reverse to ON position ReverseVator(SpriteNum); SET_BOOL8(sp); // tell vator that something blocking door - found = TRUE; + found = true; break; } } @@ -581,7 +581,7 @@ int DoVator(short SpriteNum) ReverseVator(SpriteNum); u->vel_rate = -u->vel_rate; - found = TRUE; + found = true; } } } @@ -599,7 +599,7 @@ int DoVator(short SpriteNum) { if (labs(sectp->ceilingz - sectp->floorz) < SPRITEp_SIZE_Z(bsp)) { - InitBloodSpray(i, TRUE, -1); + InitBloodSpray(i, true, -1); UpdateSinglePlayKills(i); KillSprite(i); continue; diff --git a/source/sw/src/wallmove.cpp b/source/sw/src/wallmove.cpp index 2599edbf0..ddff92fe0 100644 --- a/source/sw/src/wallmove.cpp +++ b/source/sw/src/wallmove.cpp @@ -86,9 +86,9 @@ int DoWallMove(SPRITEp sp) short shade1,shade2,ang,picnum1,picnum2; WALLp wallp; short prev_wall; - SWBOOL found = FALSE; + SWBOOL found = false; short dang; - SWBOOL SOsprite = FALSE; + SWBOOL SOsprite = false; dist = SP_TAG13(sp); ang = SP_TAG4(sp); @@ -108,7 +108,7 @@ int DoWallMove(SPRITEp sp) { if (wallp->x == sp->x && wallp->y == sp->y) { - found = TRUE; + found = true; if (TEST(wallp->extra, WALLFX_SECTOR_OBJECT)) { @@ -117,7 +117,7 @@ int DoWallMove(SPRITEp sp) ASSERT(sop); SOwallmove(sop, sp, wallp, dist, &nx, &ny); - SOsprite = TRUE; + SOsprite = true; } else { @@ -165,7 +165,7 @@ int DoWallMove(SPRITEp sp) SWBOOL CanSeeWallMove(SPRITEp wp, short match) { short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; SPRITEp sp; TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE_CANSEE], i, nexti) @@ -174,26 +174,26 @@ SWBOOL CanSeeWallMove(SPRITEp wp, short match) if (SP_TAG2(sp) == match) { - found = TRUE; + found = true; if (cansee(wp->x,wp->y,wp->z,wp->sectnum,sp->x,sp->y,sp->z,sp->sectnum)) { - return TRUE; + return true; } } } if (found) - return FALSE; + return false; else - return TRUE; + return true; } int DoWallMoveMatch(short match) { SPRITEp sp; short i,nexti; - SWBOOL found = FALSE; + SWBOOL found = false; // just all with the same matching tags TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti) @@ -202,7 +202,7 @@ int DoWallMoveMatch(short match) if (SP_TAG2(sp) == match) { - found = TRUE; + found = true; DoWallMove(sp); } } diff --git a/source/sw/src/warp.cpp b/source/sw/src/warp.cpp index fa76a57eb..63f2e1950 100644 --- a/source/sw/src/warp.cpp +++ b/source/sw/src/warp.cpp @@ -50,10 +50,10 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor) *sp_ceiling = NULL; if (Prediction) - return FALSE; + return false; if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR)) - return FALSE; + return false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti) { @@ -76,7 +76,7 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor) } } - return TRUE; + return true; } SPRITEp @@ -219,7 +219,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp) *sp_warp = NULL; if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR)) - return FALSE; + return false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti) { @@ -238,7 +238,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp) } } - return TRUE; + return true; } SPRITEp diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index d53eaa718..a76337cc0 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -68,7 +68,7 @@ DAMAGE_DATA DamageData[] = short ADJUST=120; FOOT_TYPE FootMode=WATER_FOOT; -SWBOOL left_foot = FALSE; +SWBOOL left_foot = false; int FinishTimer = 0; // This is how many bullet shells have been spawned since the beginning of the game. @@ -89,7 +89,7 @@ short LoWangsQueueHead=0; short LoWangsQueue[MAX_LOWANGS_QUEUE]; int SpawnBreakStaticFlames(short); -SWBOOL GlobalSkipZrange = FALSE; +SWBOOL GlobalSkipZrange = false; int WeaponIsAmmo = BIT(WPN_STAR) | BIT(WPN_SWORD) | BIT(WPN_MINE) | BIT(WPN_FIST); @@ -2660,11 +2660,11 @@ SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) if (TEST(wu->Flags2, SPR2_SO_MISSILE)) { DoMatchEverything(NULL, hsp->hitag, -1); - return TRUE; + return true; } else { - return FALSE; + return false; } } } @@ -2678,7 +2678,7 @@ SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) case WPN_NAPALM: case WPN_ROCKET: DoMatchEverything(NULL, hsp->hitag, -1); - return TRUE; + return true; } } else if (SP_TAG7(hsp) == 1) @@ -2691,7 +2691,7 @@ SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) case WPN_NAPALM: case WPN_ROCKET: DoMatchEverything(NULL, hsp->hitag, -1); - return TRUE; + return true; } } else if (SP_TAG7(hsp) == 2) @@ -2706,7 +2706,7 @@ SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) case WPN_UZI: case WPN_SHOTGUN: DoMatchEverything(NULL, hsp->hitag, -1); - return TRUE; + return true; } } else if (SP_TAG7(hsp) == 3) @@ -2724,11 +2724,11 @@ SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) case WPN_UZI: case WPN_SHOTGUN: DoMatchEverything(NULL, hsp->hitag, -1); - return TRUE; + return true; } } - return FALSE; + return false; #if 0 WPN_STAR @@ -2763,7 +2763,7 @@ int DoLavaErupt(short SpriteNum) short i,nexti,pnum; PLAYERp pp; SPRITEp tsp; - SWBOOL found = FALSE; + SWBOOL found = false; if (TEST_BOOL1(sp)) { @@ -2778,7 +2778,7 @@ int DoLavaErupt(short SpriteNum) if (tsp->statnum == STAT_TRIGGER && SP_TAG7(tsp) == 0 && SP_TAG5(tsp) == 1) { - found = TRUE; + found = true; break; } } @@ -2890,99 +2890,99 @@ SpawnShrap(short ParentNum, short Secondary) static SHRAP CoinShrap[] = { - {s_CoinShrap, COIN_SHRAP, 5, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_CoinShrap, COIN_SHRAP, 5, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP GlassShrap[] = { - {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP WoodShrap[] = { - {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP StoneShrap[] = { - {s_StoneShrapA, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_StoneShrapB, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_StoneShrapC, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_StoneShrapA, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_StoneShrapB, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_StoneShrapC, STONE_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP PaperShrap[] = { - {s_PaperShrapA, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_PaperShrapB, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_PaperShrapC, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_PaperShrapA, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_PaperShrapB, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_PaperShrapC, PAPER_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP MetalShrap[] = { - {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP MetalMix[] = { - {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP WoodMix[] = { - {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapA, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapB, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_MetalShrapC, METAL_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP PaperMix[] = { - {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_PaperShrapA, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_PaperShrapB, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_PaperShrapC, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_WoodShrapA, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapB, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_WoodShrapC, WOOD_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_PaperShrapA, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_PaperShrapB, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_PaperShrapC, PAPER_SHRAP_A, 2, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP Marbels[] = { - {s_Marbel, MARBEL, 5, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, - {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_Marbel, MARBEL, 5, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapA, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapB, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, + {s_GlassShrapC, GLASS_SHRAP_A, 1, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP BloodShrap[] = { - {s_BloodShrap, BLOOD_SHRAP, 8, Z_MID, 200, 600, 100, 500, TRUE, 2048}, + {s_BloodShrap, BLOOD_SHRAP, 8, Z_MID, 200, 600, 100, 500, true, 2048}, {NULL}, }; #endif @@ -2993,97 +2993,97 @@ SpawnShrap(short ParentNum, short Secondary) static SHRAP EMPShrap[] = { - {s_EMPShrap, EMP, 1, Z_MID, 500, 1100, 300, 600, FALSE, 128}, + {s_EMPShrap, EMP, 1, Z_MID, 500, 1100, 300, 600, false, 128}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP StdShrap[] = { - {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, TRUE, 2048}, - {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, TRUE, 2048}, - {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, TRUE, 2048}, - {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 250, 500, TRUE, 2048}, - {s_FastGoreDrip, GORE_Drip, 8, Z_BOT, 600, 800, 50, 70, FALSE, 2048}, + {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, true, 2048}, + {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, true, 2048}, + {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, true, 2048}, + {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 250, 500, true, 2048}, + {s_FastGoreDrip, GORE_Drip, 8, Z_BOT, 600, 800, 50, 70, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP HeartAttackShrap[] = // fewer gibs because of the plasma fountain sprites { - {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 1100, 300, 600, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 500, 1100, 300, 500, TRUE, 2048}, - {s_GoreArm, GORE_Arm, 2, Z_MID, 500, 1100, 350, 600, TRUE, 2048}, + {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 1100, 300, 600, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 500, 1100, 300, 500, true, 2048}, + {s_GoreArm, GORE_Arm, 2, Z_MID, 500, 1100, 350, 600, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP SkelGore[] = { - {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, TRUE, 2048}, - {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, TRUE, 2048}, - {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 100, 150, TRUE, 2048}, - {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, TRUE, 2048}, - {s_GoreLeg, GORE_Leg, 2, Z_BOT, 200, 400, 250, 500, TRUE, 2048}, - {s_GoreChunkS, GORE_ChunkS, 4, Z_BOT, 200, 400, 250, 400, TRUE, 2048}, + {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, true, 2048}, + {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, true, 2048}, + {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 100, 150, true, 2048}, + {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, true, 2048}, + {s_GoreLeg, GORE_Leg, 2, Z_BOT, 200, 400, 250, 500, true, 2048}, + {s_GoreChunkS, GORE_ChunkS, 4, Z_BOT, 200, 400, 250, 400, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP UpperGore[] = { - {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, TRUE, 2048}, - {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, TRUE, 2048}, - {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 100, 150, TRUE, 2048}, - {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, TRUE, 2048}, + {s_GoreHead, GORE_Head, 1, Z_TOP, 400, 700, 20, 40, true, 2048}, + {s_GoreLung, GORE_Lung, 2, Z_TOP, 500, 800, 100, 300, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 300, 500, 100, 150, true, 2048}, + {s_GoreSkullCap, GORE_SkullCap, 1, Z_TOP, 300, 500, 100, 150, true, 2048}, + {s_GoreArm, GORE_Arm, 1, Z_MID, 300, 500, 250, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP LowerGore[] = { - {s_GoreLeg, GORE_Leg, 4, Z_BOT, 300, 500, 100, 200, TRUE, 2048}, + {s_GoreLeg, GORE_Leg, 4, Z_BOT, 300, 500, 100, 200, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #endif static SHRAP SmallGore[] = { - {s_GoreDrip, GORE_Drip, 3, Z_TOP, 600, 800, 50, 70, FALSE, 2048}, - {s_FastGoreDrip, GORE_Drip, 3, Z_BOT, 600, 800, 70, 100, FALSE, 2048}, + {s_GoreDrip, GORE_Drip, 3, Z_TOP, 600, 800, 50, 70, false, 2048}, + {s_FastGoreDrip, GORE_Drip, 3, Z_BOT, 600, 800, 70, 100, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP FlamingGore[] = { - {s_GoreFlame, GORE_Drip, 2, Z_TOP, 600, 800, 100, 200, FALSE, 2048}, - {s_GoreFlameChunkB, GORE_Drip, 4, Z_MID, 300, 500, 100, 200, FALSE, 2048}, - {s_GoreFlame, GORE_Drip, 2, Z_BOT, 100, 200, 100, 200, FALSE, 2048}, + {s_GoreFlame, GORE_Drip, 2, Z_TOP, 600, 800, 100, 200, false, 2048}, + {s_GoreFlameChunkB, GORE_Drip, 4, Z_MID, 300, 500, 100, 200, false, 2048}, + {s_GoreFlame, GORE_Drip, 2, Z_BOT, 100, 200, 100, 200, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP BoltExpShrap[] = { - {s_GoreFlame, GORE_Drip, 4, Z_MID, 300, 700, 300, 600, TRUE, 2048}, - {s_GoreFlame, GORE_Drip, 4, Z_BOT, 300, 700, 300, 600, TRUE, 2048}, + {s_GoreFlame, GORE_Drip, 4, Z_MID, 300, 700, 300, 600, true, 2048}, + {s_GoreFlame, GORE_Drip, 4, Z_BOT, 300, 700, 300, 600, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP TracerExpShrap[] = { - {s_TracerShrap, GORE_Drip, 3, Z_MID, 300, 700, 300, 600, TRUE, 2048}, + {s_TracerShrap, GORE_Drip, 3, Z_MID, 300, 700, 300, 600, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP FireballExpShrap1[] = { - {s_GoreFlame, GORE_Drip, 1, Z_MID, 100, 300, 100, 200, TRUE, 2048}, + {s_GoreFlame, GORE_Drip, 1, Z_MID, 100, 300, 100, 200, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP FireballExpShrap2[] = { - {s_GoreFlame, GORE_Drip, 2, Z_MID, 100, 300, 100, 200, TRUE, 2048}, + {s_GoreFlame, GORE_Drip, 2, Z_MID, 100, 300, 100, 200, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; @@ -3098,7 +3098,7 @@ SpawnShrap(short ParentNum, short Secondary) // random_disperse, ang_range; static SHRAP ElectroShrap[] = { - {s_ElectroShrap, ELECTRO_SHARD, 12, Z_TOP, 200, 600, 100, 500, TRUE, 2048}, + {s_ElectroShrap, ELECTRO_SHARD, 12, Z_TOP, 200, 600, 100, 500, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; @@ -3106,13 +3106,13 @@ SpawnShrap(short ParentNum, short Secondary) // random_disperse, ang_range; static SHRAP LavaShrap1[] = { - {s_GoreFlame, GORE_Drip, 1, Z_TOP, 400, 1400, 100, 400, TRUE, 2048}, + {s_GoreFlame, GORE_Drip, 1, Z_TOP, 400, 1400, 100, 400, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP LavaShrap2[] = { - {s_GoreFlameChunkB, GORE_Drip, 1, Z_TOP, 400, 1400, 100, 400, TRUE, 2048}, + {s_GoreFlameChunkB, GORE_Drip, 1, Z_TOP, 400, 1400, 100, 400, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; @@ -3124,14 +3124,14 @@ SpawnShrap(short ParentNum, short Secondary) static SHRAP LavaBoulderShrap[] = { - {s_LavaShard, LAVA_SHARD, 16, Z_MID, 400, 900, 200, 600, TRUE, 2048}, + {s_LavaShard, LAVA_SHARD, 16, Z_MID, 400, 900, 200, 600, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP SectorSquishGore[] = { - {s_FastGoreDrip, GORE_Drip, 24, Z_MID, -400, -200, 600, 800, FALSE, 2048}, + {s_FastGoreDrip, GORE_Drip, 24, Z_MID, -400, -200, 600, 800, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; #endif @@ -3146,30 +3146,30 @@ SpawnShrap(short ParentNum, short Secondary) // random_disperse, ang_range; static SHRAP PlayerGoreFall[] = { - {s_GoreSkullCap,GORE_SkullCap, 1, Z_TOP, 200, 300, 100, 200, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 200, 300, 100, 200, TRUE, 2048}, - {s_GoreLung, GORE_Lung, 1, Z_MID, 200, 300, 100, 200, TRUE, 2048}, - {s_GoreDrip, GORE_Drip, 10, Z_MID, 200, 300, 100, 200, FALSE, 2048}, - {s_GoreArm, GORE_Arm, 1, Z_MID, 200, 300, 100, 200, TRUE, 2048}, - {s_FastGoreDrip, GORE_Drip, 10, Z_BOT, 200, 300, 100, 200, FALSE, 2048}, + {s_GoreSkullCap,GORE_SkullCap, 1, Z_TOP, 200, 300, 100, 200, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 200, 300, 100, 200, true, 2048}, + {s_GoreLung, GORE_Lung, 1, Z_MID, 200, 300, 100, 200, true, 2048}, + {s_GoreDrip, GORE_Drip, 10, Z_MID, 200, 300, 100, 200, false, 2048}, + {s_GoreArm, GORE_Arm, 1, Z_MID, 200, 300, 100, 200, true, 2048}, + {s_FastGoreDrip, GORE_Drip, 10, Z_BOT, 200, 300, 100, 200, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP PlayerGoreFly[] = { - {s_GoreSkullCap,GORE_SkullCap, 1, Z_TOP, 500, 1100, 300, 600, TRUE, 2048}, - {s_GoreTorso, GORE_Torso, 1, Z_MID, 500, 1100, 300, 500, TRUE, 2048}, - {s_GoreLiver, GORE_Liver, 1, Z_MID, 200, 300, 100, 200, TRUE, 2048}, - {s_GoreArm, GORE_Arm, 1, Z_MID, 500, 1100, 350, 600, TRUE, 2048}, - {s_FastGoreDrip, GORE_Drip, 16, Z_MID, 500, 1100, 350, 600, FALSE, 2048}, - {s_FastGoreDrip, GORE_Drip, 16, Z_BOT, 500, 1100, 350, 600, FALSE, 2048}, + {s_GoreSkullCap,GORE_SkullCap, 1, Z_TOP, 500, 1100, 300, 600, true, 2048}, + {s_GoreTorso, GORE_Torso, 1, Z_MID, 500, 1100, 300, 500, true, 2048}, + {s_GoreLiver, GORE_Liver, 1, Z_MID, 200, 300, 100, 200, true, 2048}, + {s_GoreArm, GORE_Arm, 1, Z_MID, 500, 1100, 350, 600, true, 2048}, + {s_FastGoreDrip, GORE_Drip, 16, Z_MID, 500, 1100, 350, 600, false, 2048}, + {s_FastGoreDrip, GORE_Drip, 16, Z_BOT, 500, 1100, 350, 600, false, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP PlayerDeadHead[] = { - {s_GoreDrip, GORE_Drip, 2, Z_TOP, 150, 400, 40, 80, TRUE, 2048}, - {s_GoreDrip, GORE_Drip, 2, Z_MID, 150, 400, 40, 80, TRUE, 2048}, + {s_GoreDrip, GORE_Drip, 2, Z_TOP, 150, 400, 40, 80, true, 2048}, + {s_GoreDrip, GORE_Drip, 2, Z_MID, 150, 400, 40, 80, true, 2048}, {NULL,0,0,0,0,0,0,0,0,0}, }; @@ -3177,7 +3177,7 @@ SpawnShrap(short ParentNum, short Secondary) // random_disperse, ang_range; static SHRAP PlayerHeadHurl1[] = { - {s_Vomit1, Vomit1, 1, Z_BOT, 250, 400, 100, 200, TRUE, 256}, + {s_Vomit1, Vomit1, 1, Z_BOT, 250, 400, 100, 200, true, 256}, {NULL,0,0,0,0,0,0,0,0,0}, }; @@ -3186,7 +3186,7 @@ SpawnShrap(short ParentNum, short Secondary) #if 0 static SHRAP SectorExpShrap[] = { - {NULL, WALL_FLOOR_SHRAP, 1, Z_BOT, 550, 800, 200, 400, TRUE, 512}, + {NULL, WALL_FLOOR_SHRAP, 1, Z_BOT, 550, 800, 200, 400, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; #endif @@ -3198,7 +3198,7 @@ SpawnShrap(short ParentNum, short Secondary) SHRAPp p = SmallGore; short shrap_shade = -15; short shrap_xsize = 48, shrap_ysize = 48; - short retval = TRUE; + short retval = true; short shrap_pal = PALETTE_DEFAULT; int shrap_floor_dist = Z(2); int shrap_ceiling_dist = Z(2); @@ -3206,7 +3206,7 @@ SpawnShrap(short ParentNum, short Secondary) short jump_grav = ACTOR_GRAVITY; short start_ang = 0; short shrap_owner = -1; - int shrap_bounce = FALSE; + int shrap_bounce = false; short WaitTics = 64; // for FastShrap short shrap_type; int shrap_rand_zamt = 0; @@ -3280,7 +3280,7 @@ AutoShrap: switch (shrap_type) { case SHRAP_NONE: - return FALSE; + return false; case SHRAP_GLASS: PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler); @@ -3294,7 +3294,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_GENERIC: @@ -3309,7 +3309,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 8 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_WOOD: @@ -3323,7 +3323,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_BLOOD: @@ -3334,7 +3334,7 @@ AutoShrap: PlaySound(DIGI_GIBS1,parent,v3df_dontpan|v3df_doppler); p = SmallGore; shrap_xsize = shrap_ysize = 34; - shrap_bounce = FALSE; + shrap_bounce = false; break; case SHRAP_TREE_BARK: @@ -3348,7 +3348,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_PAPER: @@ -3374,7 +3374,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; @@ -3389,7 +3389,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_METALMIX: @@ -3403,7 +3403,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_MARBELS: @@ -3437,7 +3437,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 10 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; } break; @@ -3452,7 +3452,7 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SHRAP_PAPERMIX: @@ -3466,11 +3466,11 @@ AutoShrap: } shrap_xsize = shrap_ysize = 16 + shrap_delta_size; - shrap_bounce = FALSE; + shrap_bounce = false; break; case SHRAP_SO_SMOKE: - return FALSE; + return false; case SHRAP_EXPLOSION: { @@ -3491,7 +3491,7 @@ AutoShrap: size = ep->xrepeat; ep->xrepeat = ep->yrepeat = size + shrap_delta_size; - return FALSE; + return false; } case SHRAP_LARGE_EXPLOSION: @@ -3515,12 +3515,12 @@ AutoShrap: InitPhosphorus(spnum); - return FALSE; + return false; } default: { - return FALSE; + return false; } } break; @@ -3535,54 +3535,54 @@ AutoShrap: PlaySound(DIGI_BREAKDEBRIS,parent,v3df_dontpan|v3df_doppler); p = WoodShrap; shrap_xsize = shrap_ysize = 24; - shrap_bounce = TRUE; + shrap_bounce = true; ChangeState(parent - sprite, s_BreakBarrel); break; case BREAK_LIGHT: PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler); p = GlassShrap; shrap_xsize = shrap_ysize = 24; - shrap_bounce = TRUE; + shrap_bounce = true; ChangeState(parent - sprite, s_BreakLight); break; case BREAK_PEDISTAL: PlaySound(DIGI_BREAKSTONES,parent,v3df_dontpan|v3df_doppler); p = StoneShrap; shrap_xsize = shrap_ysize = 24; - shrap_bounce = TRUE; + shrap_bounce = true; ChangeState(parent - sprite, s_BreakPedistal); break; case BREAK_BOTTLE1: PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler); p = GlassShrap; shrap_xsize = shrap_ysize = 8; - shrap_bounce = TRUE; + shrap_bounce = true; ChangeState(parent - sprite, s_BreakBottle1); break; case BREAK_BOTTLE2: PlaySound(DIGI_BREAKGLASS,parent,v3df_dontpan|v3df_doppler); p = GlassShrap; shrap_xsize = shrap_ysize = 8; - shrap_bounce = TRUE; + shrap_bounce = true; ChangeState(parent - sprite, s_BreakBottle2); break; case BREAK_MUSHROOM: PlaySound(DIGI_BREAKDEBRIS,parent,v3df_dontpan|v3df_doppler); p = StoneShrap; shrap_xsize = shrap_ysize = 4; - shrap_bounce = TRUE; + shrap_bounce = true; SetSuicide(parent - sprite); // kill next iteration break; case BOLT_EXP: - return FALSE; + return false; // p = BoltExpShrap; // break; case TANK_SHELL_EXP: - return FALSE; + return false; // p = BoltExpShrap; // break; case TRACER_EXP: - return FALSE; + return false; // p = TracerExpShrap; // shrap_xsize = shrap_ysize = 20; // WaitTics = 10; @@ -3603,18 +3603,18 @@ AutoShrap: p = LavaBoulderShrap; shrap_owner = parent->owner; shrap_xsize = shrap_ysize = 24; - shrap_bounce = TRUE; + shrap_bounce = true; break; case SECTOR_EXP: //p = SectorExpShrap; //break; - return FALSE; + return false; case GRENADE_EXP: //p = SectorExpShrap; //break; - return FALSE; + return false; case FIREBALL_EXP: - return FALSE; + return false; // p = FireballExpShrap[RANDOM_P2(2<<8)>>8]; // shrap_pal = pu->spal; break; @@ -3627,10 +3627,10 @@ AutoShrap: case COOLIE_RUN_R0: if (Secondary == WPN_NM_SECTOR_SQUISH) break; -// return (FALSE); +// return (false); break; case NINJA_DEAD: - return FALSE; + return false; break; case NINJA_Head_R0: { @@ -3644,7 +3644,7 @@ AutoShrap: { p = PlayerDeadHead; shrap_xsize = shrap_ysize = 16+8; - shrap_bounce = TRUE; + shrap_bounce = true; } break; } @@ -3688,7 +3688,7 @@ AutoShrap: break; case SERP_RUN_R0: p = StdShrap; - //return (FALSE); + //return (false); break; case SUMO_RUN_R0: p = StdShrap; @@ -3706,7 +3706,7 @@ AutoShrap: p = FlamingGore; break; case SKULL_SERP: - return FALSE; + return false; case BETTY_R0: case TRASHCAN: case PACHINKO1: @@ -3725,7 +3725,7 @@ AutoShrap: case EMP: p = EMPShrap; shrap_xsize = shrap_ysize = 8; - shrap_bounce = FALSE; + shrap_bounce = false; break; } @@ -3787,35 +3787,35 @@ AutoShrap: switch (u->ID) { case GORE_Drip: - shrap_bounce = FALSE; + shrap_bounce = false; break; case GORE_Lung: shrap_xsize = 20; shrap_ysize = 20; - shrap_bounce = FALSE; + shrap_bounce = false; break; case GORE_Liver: shrap_xsize = 20; shrap_ysize = 20; - shrap_bounce = FALSE; + shrap_bounce = false; break; case GORE_SkullCap: shrap_xsize = 24; shrap_ysize = 24; - shrap_bounce = TRUE; + shrap_bounce = true; break; case GORE_Arm: shrap_xsize = 21; shrap_ysize = 21; - shrap_bounce = FALSE; + shrap_bounce = false; break; case GORE_Head: shrap_xsize = 26; shrap_ysize = 30; - shrap_bounce = TRUE; + shrap_bounce = true; break; case Vomit1: - shrap_bounce = FALSE; + shrap_bounce = false; sp->z -= Z(4); shrap_xsize = u->sx = 12 + (RANDOM_P2(32<<8)>>8); shrap_ysize = u->sy = 12 + (RANDOM_P2(32<<8)>>8); @@ -3830,7 +3830,7 @@ AutoShrap: break; case EMP: - shrap_bounce = FALSE; + shrap_bounce = false; sp->z -= Z(4); //sp->ang = NORM_ANGLE(sp->ang + 1024); shrap_xsize = u->sx = 5 + (RANDOM_P2(4<<8)>>8); @@ -4128,53 +4128,53 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i static SHRAP UziBlood[] = { - {s_GoreDrip, GORE_Drip, 1, Z_MID, 100, 250, 10, 20, TRUE, 512}, // 70,200 vels - //{s_GoreSplash, PLASMA_Drip, 1, Z_BOT, 0, 0, 0, 0, FALSE, 512}, + {s_GoreDrip, GORE_Drip, 1, Z_MID, 100, 250, 10, 20, true, 512}, // 70,200 vels + //{s_GoreSplash, PLASMA_Drip, 1, Z_BOT, 0, 0, 0, 0, false, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP SmallBlood[] = { - {s_GoreDrip, GORE_Drip, 1, Z_TOP, 100, 250, 10, 20, TRUE, 512}, + {s_GoreDrip, GORE_Drip, 1, Z_TOP, 100, 250, 10, 20, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP PlasmaFountainBlood[] = { - {s_PlasmaDrip, PLASMA_Drip, 1, Z_TOP, 200, 500, 100, 300, TRUE, 16}, + {s_PlasmaDrip, PLASMA_Drip, 1, Z_TOP, 200, 500, 100, 300, true, 16}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP SomeBlood[] = { - {s_GoreDrip, GORE_Drip, 1, Z_TOP, 100, 250, 10, 20, TRUE, 512}, + {s_GoreDrip, GORE_Drip, 1, Z_TOP, 100, 250, 10, 20, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP MoreBlood[] = { - {s_GoreDrip, GORE_Drip, 2, Z_TOP, 100, 250, 10, 20, TRUE, 512}, + {s_GoreDrip, GORE_Drip, 2, Z_TOP, 100, 250, 10, 20, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; #endif static SHRAP ExtraBlood[] = { - {s_GoreDrip, GORE_Drip, 4, Z_TOP, 100, 250, 10, 20, TRUE, 512}, + {s_GoreDrip, GORE_Drip, 4, Z_TOP, 100, 250, 10, 20, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; static SHRAP HariKariBlood[] = { - {s_FastGoreDrip, GORE_Drip, 32, Z_TOP, 200, 650, 70, 100, TRUE, 1024}, + {s_FastGoreDrip, GORE_Drip, 32, Z_TOP, 200, 650, 70, 100, true, 1024}, {NULL,0,0,0,0,0,0,0,0,0}, }; #if 0 static SHRAP SwordPowerup[] = { - {s_ElectroShrap, ELECTRO_SHARD, 16, Z_TOP, 75, 200, 70, 150, TRUE, 512}, + {s_ElectroShrap, ELECTRO_SHARD, 16, Z_TOP, 75, 200, 70, 150, true, 512}, {NULL,0,0,0,0,0,0,0,0,0}, }; #endif @@ -4184,7 +4184,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i SHRAPp p = UziBlood; short shrap_shade = -15; short shrap_xsize = 20, shrap_ysize = 20; - short retval = TRUE; + short retval = true; short shrap_pal = PALETTE_DEFAULT; short start_ang = 0; @@ -4377,7 +4377,7 @@ VehicleMoveHit(short SpriteNum) short controller; if (!u->ret) - return FALSE; + return false; sop = u->sop_parent; @@ -4397,7 +4397,7 @@ VehicleMoveHit(short SpriteNum) // shouldn't ever really happen } - return TRUE; + return true; } case HIT_SPRITE: @@ -4408,7 +4408,7 @@ VehicleMoveHit(short SpriteNum) if (TEST(hsp->extra, SPRX_BREAKABLE)) { HitBreakSprite(hit_sprite, u->ID); - return TRUE; + return true; } if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY)) @@ -4416,7 +4416,7 @@ VehicleMoveHit(short SpriteNum) if (hit_sprite != cp->owner) { DoDamage(hit_sprite, controller); - return TRUE; + return true; } } else @@ -4424,11 +4424,11 @@ VehicleMoveHit(short SpriteNum) if (hsp->statnum == STAT_MINE_STUCK) { DoDamage(hit_sprite, SpriteNum); - return TRUE; + return true; } } - return TRUE; + return true; } case HIT_WALL: @@ -4465,11 +4465,11 @@ VehicleMoveHit(short SpriteNum) } } - return TRUE; + return true; } } - return FALSE; + return false; } @@ -4481,13 +4481,13 @@ WeaponMoveHit(short SpriteNum) if (!u->ret) - return FALSE; + return false; switch (TEST(u->ret, HIT_MASK)) { case HIT_PLAX_WALL: SetSuicide(SpriteNum); - return TRUE; + return true; case HIT_SECTOR: { @@ -4510,19 +4510,19 @@ WeaponMoveHit(short SpriteNum) if (u->lo_sp->lotag == TAG_SPRITE_HIT_MATCH) { if (MissileHitMatch(SpriteNum, -1, u->lo_sp - sprite)) - return TRUE; + return true; //DoMatchEverything(NULL, u->lo_sp->hitag, -1); - //return(TRUE); + //return(true); } - return TRUE; + return true; } if (SectUser[hit_sect] && SectUser[hit_sect]->depth > 0) { SpawnSplash(SpriteNum); //SetSuicide(SpriteNum); - return TRUE; + return true; } } @@ -4535,9 +4535,9 @@ WeaponMoveHit(short SpriteNum) if (u->hi_sp->lotag == TAG_SPRITE_HIT_MATCH) { if (MissileHitMatch(SpriteNum, -1, u->hi_sp - sprite)) - return TRUE; + return true; //DoMatchEverything(NULL, u->hi_sp->hitag, -1); - //return(TRUE); + //return(true); } } } @@ -4549,7 +4549,7 @@ WeaponMoveHit(short SpriteNum) { //if (sop->max_damage != -9999) DoDamage(sop->sp_child - sprite, SpriteNum); - return TRUE; + return true; } } @@ -4558,11 +4558,11 @@ WeaponMoveHit(short SpriteNum) if (labs(sp->z - sectp->ceilingz) < SPRITEp_SIZE_Z(sp)) { SetSuicide(SpriteNum); - return TRUE; + return true; } } - return TRUE; + return true; } case HIT_SPRITE: @@ -4586,7 +4586,7 @@ WeaponMoveHit(short SpriteNum) if (TEST(hsp->extra, SPRX_BREAKABLE)) { HitBreakSprite(hit_sprite, u->ID); - return TRUE; + return true; } if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY)) @@ -4622,7 +4622,7 @@ WeaponMoveHit(short SpriteNum) } } DoDamage(hit_sprite, SpriteNum); - return TRUE; + return true; } } else @@ -4630,16 +4630,16 @@ WeaponMoveHit(short SpriteNum) if (hsp->statnum == STAT_MINE_STUCK) { DoDamage(hit_sprite, SpriteNum); - return TRUE; + return true; } } if (hsp->lotag == TAG_SPRITE_HIT_MATCH) { if (MissileHitMatch(SpriteNum, -1, hit_sprite)) - return TRUE; + return true; //DoMatchEverything(NULL, hsp->hitag, -1); - //return(TRUE); + //return(true); } if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) @@ -4647,11 +4647,11 @@ WeaponMoveHit(short SpriteNum) if (hsp->lotag || hsp->hitag) { ShootableSwitch(hit_sprite); - return TRUE; + return true; } } - return TRUE; + return true; } case HIT_WALL: @@ -4668,7 +4668,7 @@ WeaponMoveHit(short SpriteNum) { if (sop->max_damage != -999) DoDamage(sop->sp_child - sprite, SpriteNum); - return TRUE; + return true; } } @@ -4676,7 +4676,7 @@ WeaponMoveHit(short SpriteNum) { HitBreakWall(&wall[hitinfo.wall], sp->x, sp->y, sp->z, sp->ang, u->ID); u->ret = 0; - return TRUE; + return true; } // clipmove does not correctly return the sprite for WALL sprites @@ -4690,7 +4690,7 @@ WeaponMoveHit(short SpriteNum) if (hitinfo.sect < 0) { - return FALSE; + return false; } if (hitinfo.sprite >= 0) @@ -4700,7 +4700,7 @@ WeaponMoveHit(short SpriteNum) if (hsp->lotag == TAG_SPRITE_HIT_MATCH) { if (MissileHitMatch(SpriteNum, -1, hitinfo.sprite)) - return TRUE; + return true; } if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL)) @@ -4708,16 +4708,16 @@ WeaponMoveHit(short SpriteNum) if (hsp->lotag || hsp->hitag) { ShootableSwitch(hitinfo.sprite); - return TRUE; + return true; } } } - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -4762,7 +4762,7 @@ DoFireballFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum],ap; USERp u = User[SpriteNum]; - SWBOOL jumping = FALSE; + SWBOOL jumping = false; // if no owner then stay where you are if (u->Attach >= 0) @@ -4789,13 +4789,13 @@ DoFireballFlames(short SpriteNum) if (TEST(u->Flags, SPR_JUMPING)) { DoJump(SpriteNum); - jumping = TRUE; + jumping = true; //u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS); } else if (TEST(u->Flags, SPR_FALLING)) { DoFall(SpriteNum); - jumping = TRUE; + jumping = true; //u->ret = move_missile(SpriteNum, dax, day, daz, Z(16), Z(16), CLIPMASK_MISSILE, MISSILEMOVETICS); } else @@ -4859,17 +4859,17 @@ DoBreakFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - SWBOOL jumping = FALSE; + SWBOOL jumping = false; if (TEST(u->Flags, SPR_JUMPING)) { DoJump(SpriteNum); - jumping = TRUE; + jumping = true; } else if (TEST(u->Flags, SPR_FALLING)) { DoFall(SpriteNum); - jumping = TRUE; + jumping = true; } else { @@ -5045,7 +5045,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) ASSERT(u); if (u->Health > 0) - return FALSE; + return false; UpdateSinglePlayKills(SpriteNum); @@ -5061,7 +5061,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) UpdateSinglePlayKills(SpriteNum); break; } - return FALSE; + return false; } #endif @@ -5128,7 +5128,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) { PLAYERp pp = wu->PlayerP; if (pp && !TEST(pp->Flags, PF_DIVING)) // JBF: added null test - pp->Bloody = TRUE; + pp->Bloody = true; PlaySound(DIGI_TOILETGIRLSCREAM, sp, v3df_none); } if (SpawnShrap(SpriteNum, Weapon)) @@ -5138,8 +5138,8 @@ ActorChooseDeath(short SpriteNum, short Weapon) // These are player zombies case ZOMBIE_RUN_R0: - InitBloodSpray(SpriteNum,TRUE,105); - InitBloodSpray(SpriteNum,TRUE,105); + InitBloodSpray(SpriteNum,true,105); + InitBloodSpray(SpriteNum,true,105); if (SpawnShrap(SpriteNum, Weapon)) SetSuicide(SpriteNum); break; @@ -5189,7 +5189,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) PlayerSound(DIGI_CANBEONLYONE, v3df_follow|v3df_dontpan,pp); } if (!TEST(pp->Flags, PF_DIVING)) - pp->Bloody = TRUE; + pp->Bloody = true; } if (u->WeaponNum == WPN_FIST) @@ -5207,7 +5207,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) // Gib out the ones you can't cut in half // Blood fountains - InitBloodSpray(SpriteNum,TRUE,-1); + InitBloodSpray(SpriteNum,true,-1); if (SpawnShrap(SpriteNum, Weapon)) { @@ -5284,13 +5284,13 @@ ActorChooseDeath(short SpriteNum, short Weapon) ActorCoughItem(SpriteNum); // Blood fountains - InitBloodSpray(SpriteNum,TRUE,-1); + InitBloodSpray(SpriteNum,true,-1); // Bosses do not gib if (u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) { DoActorDie(SpriteNum, Weapon); - return TRUE; + return true; } if (SpawnShrap(SpriteNum, Weapon)) @@ -5311,7 +5311,7 @@ ActorChooseDeath(short SpriteNum, short Weapon) break; } - return TRUE; + return true; } @@ -5325,7 +5325,7 @@ ActorHealth(short SpriteNum, short amt) if (u->ID == TRASHCAN && amt > -75) { u->LastDamage = 100; - return TRUE; + return true; } SET(u->Flags, SPR_ATTACKED); @@ -5338,7 +5338,7 @@ ActorHealth(short SpriteNum, short amt) { FinishAnim = ANIM_SERP; ChangeLevel(nullptr, -1); - return TRUE; + return true; } } @@ -5384,8 +5384,8 @@ ActorHealth(short SpriteNum, short amt) extern STATEp sg_NinjaGrabThroat[]; extern STATEp sg_NinjaHariKari[]; - if (TEST(u->Flags2, SPR2_DYING)) return TRUE; - if (TEST(u->Flags, SPR_FALLING | SPR_JUMPING | SPR_CLIMBING)) return TRUE; + if (TEST(u->Flags2, SPR2_DYING)) return true; + if (TEST(u->Flags, SPR_FALLING | SPR_JUMPING | SPR_CLIMBING)) return true; if (!TEST(u->Flags2, SPR2_DYING)) { @@ -5393,13 +5393,13 @@ ActorHealth(short SpriteNum, short amt) rnd = RANDOM_P2(1024<<4)>>4; if (rnd < 950) - return TRUE; + return true; SET(u->Flags2, SPR2_DYING); // Only let it check this once! u->WaitTics = SEC(1) + SEC(RANDOM_RANGE(2)); u->Health = 60; PlaySound(DIGI_NINJACHOKE, sp, v3df_follow); InitPlasmaFountain(NULL, sp); - InitBloodSpray(SpriteNum,FALSE,105); + InitBloodSpray(SpriteNum,false,105); sp->ang = NORM_ANGLE(getangle(u->tgt_sp->x - sp->x, u->tgt_sp->y - sp->y) + 1024); RESET(sp->cstat, CSTAT_SPRITE_YFLIP); if (sw_ninjahack) @@ -5414,7 +5414,7 @@ ActorHealth(short SpriteNum, short amt) } } - return TRUE; + return true; } int @@ -5425,7 +5425,7 @@ SopDamage(SECTOR_OBJECTp sop, short amt) // does not have damage if (sop->max_damage == -9999) - return FALSE; + return false; sop->max_damage += amt; @@ -5433,16 +5433,16 @@ SopDamage(SECTOR_OBJECTp sop, short amt) if (amt < 0) u->LastDamage = -amt; - return TRUE; + return true; } int SopCheckKill(SECTOR_OBJECTp sop) { - SWBOOL killed = FALSE; + SWBOOL killed = false; if (TEST(sop->flags, SOBJ_BROKEN)) - return FALSE; + return false; // does not have damage if (sop->max_damage == -9999) @@ -5482,7 +5482,7 @@ ActorPain(short SpriteNum) } if (RANDOM_RANGE(1000) < 875 || u->WaitTics > 0) - return FALSE; + return false; if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING)) { @@ -5491,11 +5491,11 @@ ActorPain(short SpriteNum) ActorLeaveTrack(SpriteNum); u->WaitTics = 60; NewStateGroup(SpriteNum, u->ActorActionSet->Pain); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -5509,7 +5509,7 @@ ActorPainPlasma(short SpriteNum) { u->WaitTics = PLASMA_FOUNTAIN_TIME; NewStateGroup(SpriteNum, u->ActorActionSet->Pain); - return TRUE; + return true; } else { @@ -5518,7 +5518,7 @@ ActorPainPlasma(short SpriteNum) } } - return FALSE; + return false; } int @@ -5562,22 +5562,22 @@ ActorDamageSlide(short SpriteNum, short damage, short ang) int slide_vel,slide_dec; if (TEST(u->Flags, SPR_CLIMBING)) - return FALSE; + return false; damage = labs(damage); if (!damage) - return FALSE; + return false; if (damage <= 10) { DoActorBeginSlide(SpriteNum, ang, 64, 5); - return TRUE; + return true; } else if (damage <= 20) { DoActorBeginSlide(SpriteNum, ang, 128, 5); - return TRUE; + return true; } else { @@ -5591,7 +5591,7 @@ ActorDamageSlide(short SpriteNum, short damage, short ang) DoActorBeginSlide(SpriteNum, ang, slide_vel, slide_dec); - return TRUE; + return true; } } @@ -5603,29 +5603,29 @@ PlayerDamageSlide(PLAYERp pp, short damage, short ang) damage = labs(damage); if (!damage) - return FALSE; + return false; if (damage <= 5) { //nudge //pp->slide_xvect = MOVEx(4, ang)<<15; //pp->slide_yvect = MOVEy(4, ang)<<15; - //return(TRUE); - return FALSE; + //return(true); + return false; } else if (damage <= 10) { //nudge pp->slide_xvect = MOVEx(16, ang)<<15; pp->slide_yvect = MOVEy(16, ang)<<15; - return TRUE; + return true; } else if (damage <= 20) { //bigger nudge pp->slide_xvect = MOVEx(64, ang)<<15; pp->slide_yvect = MOVEy(64, ang)<<15; - return TRUE; + return true; } else { @@ -5634,7 +5634,7 @@ PlayerDamageSlide(PLAYERp pp, short damage, short ang) pp->slide_xvect = MOVEx(slide_vel, ang)<<15; pp->slide_yvect = MOVEy(slide_vel, ang)<<15; - return TRUE; + return true; } } @@ -5749,7 +5749,7 @@ PlayerCheckDeath(PLAYERp pp, short Weapon) { pp->Killer = -1; DoPlayerBeginDie(pp); - return TRUE; + return true; } SPRITEp wp = &sprite[Weapon]; @@ -5764,7 +5764,7 @@ PlayerCheckDeath(PLAYERp pp, short Weapon) if (Weapon > -1 && wu->ID == NINJA_RUN_R0 && wu->PlayerP) { pp->DeathType = PLAYER_DEATH_FLIP; - wu->PlayerP->Bloody = TRUE; + wu->PlayerP->Bloody = true; } // keep track of who killed you for death purposes @@ -5786,17 +5786,17 @@ PlayerCheckDeath(PLAYERp pp, short Weapon) // for death velocity u->slide_vel = u->LastDamage * 5; - return TRUE; + return true; } - return FALSE; + return false; } SWBOOL PlayerTakeDamage(PLAYERp pp, short Weapon) { if (Weapon < 0) - return TRUE; + return true; USERp u = User[pp->PlayerSprite]; SPRITEp wp = &sprite[Weapon]; @@ -5809,53 +5809,53 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) { // if weapons owner the player if (wp->owner == pp->PlayerSprite) - return FALSE; + return false; } - return TRUE; + return true; } if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { // everything hurts you if (gNet.HurtTeammate) - return TRUE; + return true; // if weapon IS the YOURSELF take damage if (wu->PlayerP == pp) - return TRUE; + return true; // if the weapons owner is YOURSELF take damage if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) - return TRUE; + return true; // if weapon IS the player no damage if (wu->PlayerP) - return FALSE; + return false; // if the weapons owner is a player if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP) - return FALSE; + return false; } else if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.TeamPlay) { // everything hurts you if (gNet.HurtTeammate) - return TRUE; + return true; // if weapon IS the YOURSELF take damage if (wu->PlayerP == pp) - return TRUE; + return true; // if the weapons owner is YOURSELF take damage if (wp->owner >= 0 && User[wp->owner] && User[wp->owner]->PlayerP && User[wp->owner]->PlayerP == pp) - return TRUE; + return true; if (wu->PlayerP) { // if both on the same team then no damage if (wu->spal == u->spal) - return FALSE; + return false; } // if the weapons owner is a player @@ -5863,11 +5863,11 @@ PlayerTakeDamage(PLAYERp pp, short Weapon) { // if both on the same team then no damage if (User[wp->owner]->spal == u->spal) - return FALSE; + return false; } } - return TRUE; + return true; } @@ -6522,7 +6522,7 @@ DoDamage(short SpriteNum, short Weapon) break; default: if (RANDOM_RANGE(1000) > 900) - InitBloodSpray(SpriteNum,FALSE,105); + InitBloodSpray(SpriteNum,false,105); if (RANDOM_RANGE(1000) > 900) SpawnMidSplash(SpriteNum); break; @@ -6764,9 +6764,9 @@ DoDamage(short SpriteNum, short Weapon) } SpawnBunnyExp(Weapon); - //InitBloodSpray(Weapon,TRUE,-1); - //InitBloodSpray(Weapon,TRUE,-1); - //InitBloodSpray(Weapon,TRUE,-1); + //InitBloodSpray(Weapon,true,-1); + //InitBloodSpray(Weapon,true,-1); + //InitBloodSpray(Weapon,true,-1); SetSuicide(Weapon); break; @@ -7991,7 +7991,7 @@ DoStar(int16_t Weapon) if (sp->z > u->loz) { KillSprite(Weapon); - return TRUE; + return true; } } else @@ -8085,7 +8085,7 @@ DoStar(int16_t Weapon) { SpawnSplash(Weapon); KillSprite(Weapon); - return TRUE; + return true; // hit water - will be taken care of in WeaponMoveHit //break; } @@ -8177,12 +8177,12 @@ DoStar(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8215,11 +8215,11 @@ DoCrossBolt(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8247,7 +8247,7 @@ int PickEnemyTarget(SPRITEp sp, short aware_range) { TARGET_SORTp ts; - DoPickTarget(sp, aware_range, FALSE); + DoPickTarget(sp, aware_range, false); for (ts = TargetSort; ts < &TargetSort[TargetSortCount]; ts++) { @@ -8294,7 +8294,7 @@ MissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int16_t d SET(hu->Flags, SPR_ATTACKED); } } - else if ((hit_sprite = DoPickTarget(sp, aware_range, FALSE)) != -1) + else if ((hit_sprite = DoPickTarget(sp, aware_range, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8367,7 +8367,7 @@ ComboMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range/*, int1 { short hit_sprite; - if ((hit_sprite = DoPickTarget(sp, aware_range, FALSE)) != -1) + if ((hit_sprite = DoPickTarget(sp, aware_range, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8455,7 +8455,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ } else { - if ((hit_sprite = DoPickTarget(sp, aware_range1, FALSE)) != -1) + if ((hit_sprite = DoPickTarget(sp, aware_range1, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8463,7 +8463,7 @@ VectorMissileSeek(int16_t Weapon, int16_t delay_tics, int16_t turn_speed, int16_ SET(hu->Flags, SPR_TARGETED); SET(hu->Flags, SPR_ATTACKED); } - else if ((hit_sprite = DoPickTarget(sp, aware_range2, FALSE)) != -1) + else if ((hit_sprite = DoPickTarget(sp, aware_range2, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8527,7 +8527,7 @@ VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t { short hit_sprite; - if ((hit_sprite = DoPickTarget(sp, aware_range1, FALSE)) != -1) + if ((hit_sprite = DoPickTarget(sp, aware_range1, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8535,7 +8535,7 @@ VectorWormSeek(int16_t Weapon, int16_t delay_tics, int16_t aware_range1, int16_t SET(hu->Flags, SPR_TARGETED); SET(hu->Flags, SPR_ATTACKED); } - else if ((hit_sprite = DoPickTarget(sp, aware_range2, FALSE)) != -1) + else if ((hit_sprite = DoPickTarget(sp, aware_range2, false)) != -1) { USERp hu = User[hit_sprite]; @@ -8652,7 +8652,7 @@ DoPlasmaFountain(int16_t Weapon) { SpawnBlood(ap-sprite, Weapon, 0, 0, 0, 0); if (RANDOM_RANGE(1000) > 600) - InitBloodSpray(ap-sprite, FALSE, 105); + InitBloodSpray(ap-sprite, false, 105); } } @@ -8734,7 +8734,7 @@ DoPlasma(int16_t Weapon) if (TEST(u->Flags, SPR_SUICIDE)) { KillSprite(Weapon); - return TRUE; + return true; } else { @@ -8742,11 +8742,11 @@ DoPlasma(int16_t Weapon) ChangeState(Weapon, s_PlasmaDone); } - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8773,11 +8773,11 @@ DoCoolgFire(int16_t Weapon) ChangeState(Weapon, s_CoolgFireDone); if (sp->owner >= 0 && User[sp->owner] && User[sp->owner]->ID != RIPPER_RUN_R0) // JBF: added range check SpawnDemonFist(Weapon); // Just a red magic circle flash - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -8790,7 +8790,7 @@ DoEelFire(short Weapon) //DoDamageTest(Weapon); - return FALSE; + return false; } @@ -8878,13 +8878,13 @@ SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall) } if (!slope) - return FALSE; + return false; // if greater than a 45 degree angle if (labs(slope) > 4096) - *hit_wall = TRUE; + *hit_wall = true; else - *hit_wall = FALSE; + *hit_wall = false; // get angle of the first wall of the sector k = sector[hit_sector].wallptr; @@ -8913,7 +8913,7 @@ SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall) sp->ang = getangle(u->xchange, u->ychange); } - return TRUE; + return true; } extern STATE s_Phosphorus[]; @@ -8955,7 +8955,7 @@ DoGrenade(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -8982,7 +8982,7 @@ DoGrenade(int16_t Weapon) } else { - if (u->Counter2 == TRUE) // It's a phosphorus grenade! + if (u->Counter2 == 1) // It's a phosphorus grenade! { for (i=0; i<5; i++) { @@ -8992,7 +8992,7 @@ DoGrenade(int16_t Weapon) } SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } @@ -9054,7 +9054,7 @@ DoGrenade(int16_t Weapon) } else { - if (u->Counter2 == TRUE) // It's a phosphorus grenade! + if (u->Counter2 == 1) // It's a phosphorus grenade! { for (i=0; i<5; i++) { @@ -9064,7 +9064,7 @@ DoGrenade(int16_t Weapon) } SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -9097,7 +9097,7 @@ DoGrenade(int16_t Weapon) } else { - if (u->Counter2 == TRUE) // It's a phosphorus grenade! + if (u->Counter2 == 1) // It's a phosphorus grenade! { for (i=0; i<5; i++) { @@ -9108,7 +9108,7 @@ DoGrenade(int16_t Weapon) //WeaponMoveHit(Weapon); SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -9128,7 +9128,7 @@ DoGrenade(int16_t Weapon) { SpawnGrenadeExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } // if you haven't bounced or your going slow do some puffs @@ -9164,7 +9164,7 @@ DoGrenade(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -9185,7 +9185,7 @@ DoVulcanBoulder(int16_t Weapon) { SpawnLittleExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } if (u->ret) @@ -9194,7 +9194,7 @@ DoVulcanBoulder(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -9217,7 +9217,7 @@ DoVulcanBoulder(int16_t Weapon) // hit an actor SpawnLittleExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } @@ -9319,7 +9319,7 @@ DoVulcanBoulder(int16_t Weapon) } } - return FALSE; + return false; } SWBOOL @@ -9328,11 +9328,11 @@ OwnerIsPlayer(short Weapon) SPRITEp sp = &sprite[Weapon]; USERp u = User[Weapon],uo; - if (!u || !sp || (unsigned)sp->owner >= (unsigned)MAXSPRITES) return FALSE; + if (!u || !sp || (unsigned)sp->owner >= (unsigned)MAXSPRITES) return false; uo = User[sp->owner]; - if (uo && uo->PlayerP) return TRUE; + if (uo && uo->PlayerP) return true; - return FALSE; + return false; } int @@ -9346,7 +9346,7 @@ DoMineRangeTest(short Weapon, short range) unsigned stat; int dist, tx, ty; int tmin; - SWBOOL ownerisplayer = FALSE; + SWBOOL ownerisplayer = false; ownerisplayer = OwnerIsPlayer(Weapon); @@ -9384,11 +9384,11 @@ DoMineRangeTest(short Weapon, short range) if (!FAFcansee(sp->x,sp->y,SPRITEp_UPPER(sp),sp->sectnum,wp->x,wp->y,wp->z,wp->sectnum)) continue; - return TRUE; + return true; } } - return FALSE; + return false; } @@ -9422,7 +9422,7 @@ DoMineStuck(int16_t Weapon) if (!TEST(u->Flags, SPR_ACTIVE)) { if ((u->WaitTics -= (MISSILEMOVETICS*2)) > 0) - return FALSE; + return false; // activate it //u->WaitTics = 65536; @@ -9547,12 +9547,12 @@ DoMineStuck(int16_t Weapon) PlaySound(DIGI_MINEBEEP, sp, v3df_dontpan); SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } break; } - return FALSE; + return false; } int @@ -9622,7 +9622,7 @@ DoMine(int16_t Weapon) sp->z = hsp->z - DIV2(SPRITEp_SIZE_Z(hsp)); // If it's not alive, don't stick it - if (hu && hu->Health <= 0) return FALSE; // JBF: added null check + if (hu && hu->Health <= 0) return false; // JBF: added null check // check to see if sprite is player or enemy if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY)) @@ -9671,7 +9671,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } } @@ -9701,7 +9701,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } break; @@ -9724,7 +9724,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } break; @@ -9734,7 +9734,7 @@ DoMine(int16_t Weapon) u->ret = 0; } - return FALSE; + return false; } int @@ -9784,7 +9784,7 @@ DoBoltThinMan(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -9792,12 +9792,12 @@ DoBoltThinMan(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -9818,14 +9818,14 @@ DoTracer(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } } RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE); - return FALSE; + return false; } int @@ -9857,14 +9857,14 @@ DoEMP(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } } RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE); - return FALSE; + return false; } int @@ -9915,10 +9915,10 @@ DoEMPBurst(int16_t Weapon) //SpawnMineExp(Weapon); // Spawn a big radius burst of sparks here and check for final damage amount KillSprite(Weapon); - return FALSE; + return false; } - return FALSE; + return false; } int @@ -9940,12 +9940,12 @@ DoTankShell(int16_t Weapon) SpawnTankShellExp(Weapon); //SetExpQuake(exp); KillSprite(Weapon); - return TRUE; + return true; } } } - return FALSE; + return false; } int @@ -9963,11 +9963,11 @@ DoTracerStart(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -9980,9 +9980,9 @@ DoLaser(int16_t Weapon) short New; short spawn_count = 0; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify - while (TRUE) + while (true) { u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -9994,7 +9994,7 @@ DoLaser(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10024,7 +10024,7 @@ DoLaserStart(int16_t Weapon) { USERp u = User[Weapon]; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10036,7 +10036,7 @@ DoLaserStart(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10053,9 +10053,9 @@ DoRail(int16_t Weapon) short New; short spawn_count = 0; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify - while (TRUE) + while (true) { u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10077,14 +10077,14 @@ DoRail(int16_t Weapon) RESET(sprite[hit_sprite].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN|CSTAT_SPRITE_BLOCK_MISSILE); DoRail(Weapon); sprite[hit_sprite].cstat = cstat_save; - return TRUE; + return true; } else { SpawnTracerExp(Weapon); SpawnShrapX(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -10092,7 +10092,7 @@ DoRail(int16_t Weapon) SpawnTracerExp(Weapon); SpawnShrapX(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } } @@ -10139,7 +10139,7 @@ DoRailStart(int16_t Weapon) { USERp u = User[Weapon]; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10152,7 +10152,7 @@ DoRailStart(int16_t Weapon) SpawnTracerExp(Weapon); SpawnShrapX(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10191,7 +10191,7 @@ DoRocket(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10207,7 +10207,7 @@ DoRocket(int16_t Weapon) SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10245,7 +10245,7 @@ DoRocket(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -10266,12 +10266,12 @@ DoMicroMini(int16_t Weapon) { SpawnMicroExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } } - return FALSE; + return false; } int @@ -10320,7 +10320,7 @@ DoMicro(int16_t Weapon) USERp u = User[Weapon]; short New; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify u->ret = move_missile(Weapon, u->xchange, u->ychange, u->zchange, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS); @@ -10371,7 +10371,7 @@ DoMicro(int16_t Weapon) sp->xrepeat = sp->yrepeat = 10; RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE); SpawnExtraMicroMini(Weapon); - return TRUE; + return true; } } @@ -10383,11 +10383,11 @@ DoMicro(int16_t Weapon) { SpawnMicroExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10449,7 +10449,7 @@ DoUziBullet(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } else if (u->Dist > 8000) { @@ -10458,7 +10458,7 @@ DoUziBullet(int16_t Weapon) } } - return FALSE; + return false; } @@ -10489,12 +10489,12 @@ DoBoltSeeker(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10534,7 +10534,7 @@ DoElectro(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10559,11 +10559,11 @@ DoElectro(int16_t Weapon) //SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10580,7 +10580,7 @@ DoLavaBoulder(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10588,11 +10588,11 @@ DoLavaBoulder(int16_t Weapon) { SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10611,7 +10611,7 @@ DoSpear(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10619,11 +10619,11 @@ DoSpear(int16_t Weapon) { //SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int SpawnCoolieExp(short SpriteNum) @@ -10733,7 +10733,7 @@ SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) if (!eu) { - ASSERT(TRUE == FALSE); + ASSERT(true == false); } if (eu->flame >= 0) @@ -11073,9 +11073,9 @@ SpawnBunnyExp(int16_t Weapon) PlaySound(DIGI_BUNNYDIE3, sp, v3df_none); u->ID = BOLT_EXP; // Change id - InitBloodSpray(Weapon,TRUE,-1); - InitBloodSpray(Weapon,TRUE,-1); - InitBloodSpray(Weapon,TRUE,-1); + InitBloodSpray(Weapon,true,-1); + InitBloodSpray(Weapon,true,-1); + InitBloodSpray(Weapon,true,-1); DoExpDamageTest(Weapon); return 0; @@ -11396,12 +11396,12 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop) USERp eu; short explosion; unsigned sn; - SWBOOL smallflames = FALSE; + SWBOOL smallflames = false; if (Weapon < 0) { Weapon = abs(Weapon); - smallflames = TRUE; + smallflames = true; } sp = &sprite[Weapon]; @@ -11938,7 +11938,7 @@ DoFireball(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -11986,7 +11986,7 @@ DoFireball(int16_t Weapon) if (!hu) hu = SpawnUser(hsp - sprite, hsp->picnum, NULL); SpawnFireballFlames(Weapon, hsp - sprite); - hit_burn = TRUE; + hit_burn = true; } break; @@ -12003,11 +12003,11 @@ DoFireball(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12041,7 +12041,7 @@ DoFindGround(int16_t SpriteNum) // found a sprite floor u->lo_sp = hsp; u->lo_sectp = NULL; - return TRUE; + return true; } else { @@ -12053,21 +12053,21 @@ DoFindGround(int16_t SpriteNum) hsp->cstat = bak_cstat; } - return FALSE; + return false; } case HIT_SECTOR: { u->lo_sectp = §or[NORM_SECTOR(florhit)]; u->lo_sp = NULL; - return TRUE; + return true; } default: - ASSERT(TRUE == FALSE); + ASSERT(true == false); break; } - return FALSE; + return false; } int @@ -12100,7 +12100,7 @@ DoFindGroundPoint(int16_t SpriteNum) // found a sprite floor u->lo_sp = hsp; u->lo_sectp = NULL; - return TRUE; + return true; } else { @@ -12112,21 +12112,21 @@ DoFindGroundPoint(int16_t SpriteNum) hsp->cstat = bak_cstat; } - return FALSE; + return false; } case HIT_SECTOR: { u->lo_sectp = §or[NORM_SECTOR(florhit)]; u->lo_sp = NULL; - return TRUE; + return true; } default: - ASSERT(TRUE == FALSE); + ASSERT(true == false); break; } - return FALSE; + return false; } int @@ -12148,7 +12148,7 @@ DoNapalm(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12235,11 +12235,11 @@ DoNapalm(int16_t Weapon) { KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } #define WORM 1 @@ -12266,7 +12266,7 @@ DoBloodWorm(int16_t Weapon) u->ychange = -u->ychange; u->ret = 0; sp->ang = NORM_ANGLE(sp->ang + 1024); - return TRUE; + return true; } MissileHitDiveArea(Weapon); @@ -12280,9 +12280,9 @@ DoBloodWorm(int16_t Weapon) USERp tu; int i,nexti; - InitBloodSpray(Weapon, FALSE, 1); - InitBloodSpray(Weapon, FALSE, 1); - InitBloodSpray(Weapon, FALSE, 1); + InitBloodSpray(Weapon, false, 1); + InitBloodSpray(Weapon, false, 1); + InitBloodSpray(Weapon, false, 1); // Kill any old zombies you own TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) @@ -12294,8 +12294,8 @@ DoBloodWorm(int16_t Weapon) if (tu->ID == ZOMBIE_RUN_R0 && tsp->owner == sp->owner) { - InitBloodSpray(i,TRUE,105); - InitBloodSpray(i,TRUE,105); + InitBloodSpray(i,true,105); + InitBloodSpray(i,true,105); SetSuicide(i); break; } @@ -12303,7 +12303,7 @@ DoBloodWorm(int16_t Weapon) SpawnZombie2(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12323,15 +12323,15 @@ DoBloodWorm(int16_t Weapon) updatesectorz(sp->x, sp->y, sp->z, §num); if (sectnum >= 0) { - GlobalSkipZrange = TRUE; - InitBloodSpray(Weapon, FALSE, 1); - GlobalSkipZrange = FALSE; + GlobalSkipZrange = true; + InitBloodSpray(Weapon, false, 1); + GlobalSkipZrange = false; } sp->x = bx; sp->y = by; - return FALSE; + return false; } #endif @@ -12362,7 +12362,7 @@ DoBloodWorm(int16_t Weapon) case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: case HIT_WALL: @@ -12394,8 +12394,8 @@ DoBloodWorm(int16_t Weapon) USERp tu; int i,nexti; - InitBloodSpray(Weapon, FALSE, 1); - InitBloodSpray(Weapon, FALSE, 1); + InitBloodSpray(Weapon, false, 1); + InitBloodSpray(Weapon, false, 1); // Kill any old zombies you own TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) @@ -12407,8 +12407,8 @@ DoBloodWorm(int16_t Weapon) if (tu->ID == ZOMBIE_RUN_R0 && tsp->owner == sp->owner) { - InitBloodSpray(i,TRUE,105); - InitBloodSpray(i,TRUE,105); + InitBloodSpray(i,true,105); + InitBloodSpray(i,true,105); SetSuicide(i); break; } @@ -12416,7 +12416,7 @@ DoBloodWorm(int16_t Weapon) SpawnZombie2(Weapon); KillSprite(Weapon); - return TRUE; + return true; } ang = NORM_ANGLE(sp->ang + 512); @@ -12435,9 +12435,9 @@ DoBloodWorm(int16_t Weapon) updatesectorz(sp->x, sp->y, sp->z, §num); if (sectnum >= 0) { - //GlobalSkipZrange = TRUE; - InitBloodSpray(Weapon, FALSE, 1); - //GlobalSkipZrange = FALSE; + //GlobalSkipZrange = true; + InitBloodSpray(Weapon, false, 1); + //GlobalSkipZrange = false; } if (RANDOM_P2(2048) < 512) @@ -12453,23 +12453,23 @@ DoBloodWorm(int16_t Weapon) updatesectorz(sp->x, sp->y, sp->z, §num); if (sectnum >= 0) { - //GlobalSkipZrange = TRUE; - InitBloodSpray(Weapon, FALSE, 1); - //GlobalSkipZrange = FALSE; + //GlobalSkipZrange = true; + InitBloodSpray(Weapon, false, 1); + //GlobalSkipZrange = false; } } sp->x = bx; sp->y = by; - return FALSE; + return false; } #endif int DoMeteor(int16_t Weapon) { - return FALSE; + return false; } int @@ -12521,11 +12521,11 @@ DoSerpMeteor(int16_t Weapon) KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12555,11 +12555,11 @@ DoMirvMissile(int16_t Weapon) KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12662,10 +12662,10 @@ DoMirv(int16_t Weapon) SpawnMeteorExp(Weapon); //SpawnBasicExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } - return FALSE; + return false; } SWBOOL @@ -12675,7 +12675,7 @@ MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = FALSE; + char retval = false; // backup values oldxc = wu->xchange; @@ -12696,7 +12696,7 @@ MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) SET(wu->Flags, SPR_SET_POS_DONT_KILL); if ((*DoWeapon)(Weapon)) - retval = TRUE; + retval = true; RESET(wu->Flags, SPR_SET_POS_DONT_KILL); // reset values @@ -12721,7 +12721,7 @@ TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = FALSE; + char retval = false; // backup values oldxc = wu->xchange; @@ -12742,7 +12742,7 @@ TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) SET(wu->Flags, SPR_SET_POS_DONT_KILL); if ((*DoWeapon)(Weapon)) - retval = TRUE; + retval = true; RESET(wu->Flags, SPR_SET_POS_DONT_KILL); // reset values @@ -12782,7 +12782,7 @@ DoRing(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12795,13 +12795,13 @@ DoRing(int16_t Weapon) sp->z = SPRITEp_MID(so) + Z(30); // go out until its time to come back in - if (u->Counter2 == FALSE) + if (u->Counter2 == false) { u->Dist += 8 * RINGMOVETICS; if (u->Dist > RING_OUTER_DIST) { - u->Counter2 = TRUE; + u->Counter2 = true; } } else @@ -12955,12 +12955,12 @@ DoSerpRing(int16_t Weapon) sp->z = sprite[sp->owner].z - u->sz; // go out until its time to come back in - if (u->Counter2 == FALSE) + if (u->Counter2 == false) { u->Dist += 8 * RINGMOVETICS; if (u->Dist > u->TargetDist) - u->Counter2 = TRUE; + u->Counter2 = true; } // rotate the ring @@ -14641,7 +14641,7 @@ InitStar(PLAYERp pp) return 0; } - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) != -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) != -1) { zvel = wp->zvel; } @@ -14961,7 +14961,7 @@ InitShotgun(PLAYERp pp) sp = pp->SpriteP; daang = 64; - if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1) + if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1) { } else @@ -15193,7 +15193,7 @@ InitLaser(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 5); } @@ -15218,7 +15218,7 @@ InitRail(PLAYERp pp) short oclipdist; int zvel; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify DoPlayerBeginRecoil(pp, RAIL_RECOIL_AMT); @@ -15285,7 +15285,7 @@ InitRail(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 4); } @@ -15311,7 +15311,7 @@ InitZillaRail(short SpriteNum) short oclipdist; int zvel; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify PlaySound(DIGI_RAILFIRE, sp, v3df_dontpan|v3df_doppler); @@ -15371,7 +15371,7 @@ InitZillaRail(short SpriteNum) sp->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAim(sp, w, 32, FALSE) == -1) + if (WeaponAutoAim(sp, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 4); } @@ -15505,7 +15505,7 @@ InitRocket(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 5); } @@ -15633,7 +15633,7 @@ InitBunnyRocket(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 5); } @@ -15738,7 +15738,7 @@ InitNuke(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 5); } @@ -15827,7 +15827,7 @@ InitEnemyNuke(short SpriteNum) wu->Counter = 0; wp->zvel = zvel >> 1; - if (WeaponAutoAim(sp, w, 32, FALSE) == -1) + if (WeaponAutoAim(sp, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 5); } @@ -15861,7 +15861,7 @@ InitMicro(PLAYERp pp) #define MAX_MICRO 1 - DoPickTarget(pp->SpriteP, 256, FALSE); + DoPickTarget(pp->SpriteP, 256, false); if (TargetSortCount > MAX_MICRO) TargetSortCount = MAX_MICRO; @@ -16607,7 +16607,7 @@ InitEnemyRail(short SpriteNum) short pnum=0; // short oclipdist; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify // if co-op don't hurt teammate if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE && u->ID == ZOMBIE_RUN_R0) @@ -17483,7 +17483,7 @@ InitTracerUzi(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; - WeaponAutoAim(pp->SpriteP, w, 32, FALSE); + WeaponAutoAim(pp->SpriteP, w, 32, false); // a bit of randomness wp->ang = NORM_ANGLE(wp->ang + RANDOM_RANGE(30) - 15); @@ -17540,7 +17540,7 @@ InitTracerTurret(short SpriteNum, short Operator, int horiz) wp->zvel = ((100 - horiz) * (wp->xvel/8)); - WeaponAutoAim(sp, w, 32, FALSE); + WeaponAutoAim(sp, w, 32, false); // a bit of randomness wp->ang = NORM_ANGLE(wp->ang + RANDOM_RANGE(30) - 15); @@ -17689,10 +17689,10 @@ BulletHitSprite(SPRITEp sp, short hit_sprite, int hit_x, int hit_y, int hit_z, s DoHitscanDamage(New, hit_sprite); - return TRUE; + return true; } - return FALSE; + return false; } int SpawnWallHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z) @@ -17770,7 +17770,7 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall) changespritesect(SpriteNum, sectnum); #endif - return TRUE; + return true; } int @@ -17788,7 +17788,7 @@ InitUzi(PLAYERp pp) //static char alternate=0; static int uziclock=0; int clockdiff=0; - SWBOOL FireSnd = FALSE; + SWBOOL FireSnd = false; #define UZIFIRE_WAIT 20 void InitUziShell(PLAYERp); @@ -17799,14 +17799,14 @@ InitUzi(PLAYERp pp) if (uziclock > PlayClock) { uziclock = PlayClock; - FireSnd = TRUE; + FireSnd = true; } clockdiff = PlayClock - uziclock; if (clockdiff > UZIFIRE_WAIT) { uziclock = PlayClock; - FireSnd = TRUE; + FireSnd = true; } if (FireSnd) @@ -17821,7 +17821,7 @@ InitUzi(PLAYERp pp) nz = pp->posz + pp->bob_z; daz = pp->posz + pp->bob_z; daang = 32; - if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, FALSE) != -1) + if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, false) != -1) { daang += RANDOM_RANGE(24) - 12; daang = NORM_ANGLE(daang); @@ -17997,7 +17997,7 @@ InitEMP(PLAYERp pp) int daz, nz; short cstat = 0; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify PlayerUpdateAmmo(pp, u->WeaponNum, -1); @@ -18011,7 +18011,7 @@ InitEMP(PLAYERp pp) daz = nz = pp->posz + pp->bob_z; daang = 64; - if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, FALSE) != -1) + if (WeaponAutoAimHitscan(pp->SpriteP, &daz, &daang, false) != -1) { } else @@ -18149,7 +18149,7 @@ InitEMP(PLAYERp pp) else { KillSprite(j); - return FALSE; + return false; } } @@ -18192,7 +18192,7 @@ InitTankShell(short SpriteNum, PLAYERp pp) wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); - WeaponAutoAim(sp, w, 64, FALSE); + WeaponAutoAim(sp, w, 64, false); // a bit of randomness wp->ang += RANDOM_RANGE(30) - 15; wp->ang = NORM_ANGLE(wp->ang); @@ -18222,7 +18222,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) short i,ang; TARGET_SORTp ts = TargetSort; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify nx = sp->x; @@ -18230,7 +18230,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) #define MAX_TURRET_MICRO 10 - DoPickTarget(pp->SpriteP, 256, FALSE); + DoPickTarget(pp->SpriteP, 256, false); if (TargetSortCount > MAX_TURRET_MICRO) TargetSortCount = MAX_TURRET_MICRO; @@ -18327,7 +18327,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp) USERp wu; short w; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], sp->sectnum, @@ -18352,7 +18352,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp) wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); - WeaponAutoAim(sp, w, 64, FALSE); + WeaponAutoAim(sp, w, 64, false); // a bit of randomness //wp->ang += RANDOM_RANGE(30) - 15; @@ -18375,7 +18375,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp) USERp wu; short w; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify w = SpawnSprite(STAT_MISSILE, FIREBALL, s_Fireball, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, FIREBALL_VELOCITY); @@ -18399,7 +18399,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp) wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); - WeaponAutoAim(sp, w, 64, FALSE); + WeaponAutoAim(sp, w, 64, false); // a bit of randomness wp->ang += RANDOM_RANGE(30) - 15; wp->ang = NORM_ANGLE(wp->ang); @@ -18424,7 +18424,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp) int nx, ny, nz; short w; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify if (pp->cursectnum < 0) return 0; @@ -18460,7 +18460,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp) wp->clipdist = 64L>>2; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) == -1) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang); } @@ -18482,7 +18482,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp) int nx, ny, nz; short w; - if (SW_SHAREWARE) return FALSE; // JBF: verify + if (SW_SHAREWARE) return false; // JBF: verify if (pp->cursectnum < 0) return 0; @@ -18517,7 +18517,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp) SET(wp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); wp->clipdist = 64L>>2; - if (WeaponAutoAim(sp, w, 32, FALSE) == -1) + if (WeaponAutoAim(sp, w, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang); } @@ -18556,7 +18556,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp) InitTracerTurret(sp - sprite, pp->PlayerSprite, FixedToInt(pp->q16horiz)); daang = 64; - if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1) + if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1) { daz += RANDOM_RANGE(Z(30)) - Z(15); //daz += 0; @@ -18648,7 +18648,7 @@ InitSobjGun(PLAYERp pp) { short i; SPRITEp sp; - SWBOOL first = FALSE; + SWBOOL first = false; for (i = 0; pp->sop->sp_num[i] != -1; i++) { @@ -18672,7 +18672,7 @@ InitSobjGun(PLAYERp pp) if (!first) { - first = TRUE; + first = true; if (SP_TAG6(sp)) DoSoundSpotMatch(SP_TAG6(sp), 1, SOUND_OBJECT_TYPE); } @@ -18949,7 +18949,7 @@ InitTurretMgun(SECTOR_OBJECTp sop) { // only auto aim for Z daang = 512; - if ((hitinfo.sprite = WeaponAutoAimHitscan(sp, &daz, &daang, FALSE)) != -1) + if ((hitinfo.sprite = WeaponAutoAimHitscan(sp, &daz, &daang, false)) != -1) { delta = labs(GetDeltaAngle(daang, sp->ang)); if (delta > 128) @@ -18979,7 +18979,7 @@ InitTurretMgun(SECTOR_OBJECTp sop) else { daang = 64; - if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1) + if (WeaponAutoAimHitscan(sp, &daz, &daang, false) != -1) { daz += RANDOM_RANGE(Z(30)) - Z(15); } @@ -19252,7 +19252,7 @@ InitGrenade(PLAYERp pp) short w; short oclipdist; int zvel; - SWBOOL auto_aim = FALSE; + SWBOOL auto_aim = false; DoPlayerBeginRecoil(pp, GRENADE_RECOIL_AMT); @@ -19330,9 +19330,9 @@ InitGrenade(PLAYERp pp) //dist = dist - (dist/2); zvel = wp->zvel; - if (WeaponAutoAim(pp->SpriteP, w, 32, FALSE) >= 0) + if (WeaponAutoAim(pp->SpriteP, w, 32, false) >= 0) { - auto_aim = TRUE; + auto_aim = true; } wp->zvel = zvel; @@ -19347,7 +19347,7 @@ InitGrenade(PLAYERp pp) wu->ychange += pp->yvect>>14; } - wu->Counter2 = TRUE; // Phosphorus Grenade + wu->Counter2 = true; // Phosphorus Grenade return 0; } @@ -19648,7 +19648,7 @@ InitFireball(PLAYERp pp) pp->SpriteP->clipdist = oclipdist; wp->zvel = zvel >> 1; - if (WeaponAutoAimZvel(pp->SpriteP, w, &zvel, 32, FALSE) == -1) + if (WeaponAutoAimZvel(pp->SpriteP, w, &zvel, 32, false) == -1) { wp->ang = NORM_ANGLE(wp->ang - 9); } @@ -19761,13 +19761,13 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) short i, nexti; SECT_USERp sectu = SectUser[*sectnum]; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + char Found = false; short over, under; int sx, sy; // 0 not valid for water match tags if (sectu->number == 0) - return FALSE; + return false; // search for DIVE_AREA "over" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti) @@ -19778,13 +19778,13 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); - Found = FALSE; + ASSERT(Found == true); + Found = false; // search for UNDERWATER "under" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti) @@ -19795,12 +19795,12 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); + ASSERT(Found == true); // get the offset from the sprite sx = over_sp->x - *x; @@ -19824,7 +19824,7 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) *z = sector[under_sp->sectnum].ceilingz + Z(1); - return TRUE; + return true; } SWBOOL @@ -19836,11 +19836,11 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) int sx, sy; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + char Found = false; // 0 not valid for water match tags if (sectu->number == 0) - return FALSE; + return false; // search for UNDERWATER "under" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti) @@ -19851,13 +19851,13 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); - Found = FALSE; + ASSERT(Found == true); + Found = false; // search for DIVE_AREA "over" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti) @@ -19868,12 +19868,12 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); + ASSERT(Found == true); // get the offset from the under sprite sx = under_sp->x - *x; @@ -19895,7 +19895,7 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) //MissileWaterAdjust(sp - sprite); - return TRUE; + return true; } @@ -19906,13 +19906,13 @@ SpriteWarpToUnderwater(SPRITEp sp) short i, nexti; SECT_USERp sectu = SectUser[sp->sectnum]; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + char Found = false; short over, under; int sx, sy; // 0 not valid for water match tags if (sectu->number == 0) - return FALSE; + return false; // search for DIVE_AREA "over" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti) @@ -19923,13 +19923,13 @@ SpriteWarpToUnderwater(SPRITEp sp) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); - Found = FALSE; + ASSERT(Found == true); + Found = false; // search for UNDERWATER "under" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti) @@ -19940,12 +19940,12 @@ SpriteWarpToUnderwater(SPRITEp sp) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); + ASSERT(Found == true); // get the offset from the sprite sx = over_sp->x - sp->x; @@ -19974,7 +19974,7 @@ SpriteWarpToUnderwater(SPRITEp sp) u->oy = sp->y; u->oz = sp->z; - return TRUE; + return true; } SWBOOL @@ -19987,11 +19987,11 @@ SpriteWarpToSurface(SPRITEp sp) int sx, sy; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + char Found = false; // 0 not valid for water match tags if (sectu->number == 0) - return FALSE; + return false; // search for UNDERWATER "under" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti) @@ -20002,17 +20002,17 @@ SpriteWarpToSurface(SPRITEp sp) SectUser[under_sp->sectnum] && SectUser[under_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); + ASSERT(Found == true); if (under_sp->lotag == 0) - return FALSE; + return false; - Found = FALSE; + Found = false; // search for DIVE_AREA "over" sprite for reference point TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti) @@ -20023,12 +20023,12 @@ SpriteWarpToSurface(SPRITEp sp) SectUser[over_sp->sectnum] && SectUser[over_sp->sectnum]->number == sectu->number) { - Found = TRUE; + Found = true; break; } } - ASSERT(Found == TRUE); + ASSERT(Found == true); // get the offset from the under sprite sx = under_sp->x - sp->x; @@ -20057,7 +20057,7 @@ SpriteWarpToSurface(SPRITEp sp) u->oy = sp->y; u->oz = sp->z; - return TRUE; + return true; } @@ -20189,7 +20189,7 @@ MissileHitDiveArea(short SpriteNum) } if (!u->ret) - return FALSE; + return false; switch (TEST(u->ret, HIT_MASK)) { @@ -20201,11 +20201,11 @@ MissileHitDiveArea(short SpriteNum) { // make sure you are close to the floor if (sp->z < DIV2(u->hiz + u->loz)) - return FALSE; + return false; // Check added by Jim because of sprite bridge over water if (sp->z < (sector[hit_sect].floorz-Z(20))) - return FALSE; + return false; SET(u->Flags, SPR_UNDERWATER); SpawnSplash(sp - sprite); @@ -20213,29 +20213,29 @@ MissileHitDiveArea(short SpriteNum) //SpawnUnderSplash(sp - sprite); u->ret = 0; PlaySound(DIGI_PROJECTILEWATERHIT, sp, v3df_none); - return TRUE; + return true; } else if (SpriteInUnderwaterArea(sp)) { // make sure you are close to the ceiling if (sp->z > DIV2(u->hiz + u->loz)) - return FALSE; + return false; RESET(u->Flags, SPR_UNDERWATER); if (!SpriteWarpToSurface(sp)) { - return FALSE; + return false; } SpawnSplash(sp - sprite); u->ret = 0; - return TRUE; + return true; } break; } } - return FALSE; + return false; } int @@ -20283,7 +20283,7 @@ DoVehicleSmoke(short SpriteNum) sp->y += u->ychange; - return FALSE; + return false; } int @@ -20293,7 +20293,7 @@ DoWaterSmoke(short SpriteNum) sp->z -= sp->zvel; - return FALSE; + return false; } int @@ -20304,7 +20304,7 @@ SpawnVehicleSmoke(short SpriteNum) short New; if (MoveSkip2 != 0) - return FALSE; + return false; New = SpawnSprite(STAT_MISSILE, PUFF, s_VehicleSmoke, sp->sectnum, sp->x, sp->y, sp->z - RANDOM_P2(Z(8)), sp->ang, 0); @@ -20330,7 +20330,7 @@ SpawnVehicleSmoke(short SpriteNum) nu->ychange = MOVEy(np->xvel, np->ang); np->zvel = Z(4) + RANDOM_P2(Z(4)); - return FALSE; + return false; } int @@ -20365,7 +20365,7 @@ SpawnSmokePuff(short SpriteNum) //np->zvel = Z(4) + RANDOM_P2(Z(4)); np->zvel = Z(1) + RANDOM_P2(Z(2)); - return FALSE; + return false; } @@ -20400,7 +20400,7 @@ DoBubble(short SpriteNum) if (!SpriteWarpToSurface(sp)) { KillSprite(SpriteNum); - return TRUE; + return true; } RESET(u->Flags, SPR_UNDERWATER); @@ -20410,7 +20410,7 @@ DoBubble(short SpriteNum) else { KillSprite(SpriteNum); - return TRUE; + return true; } } @@ -20419,7 +20419,7 @@ DoBubble(short SpriteNum) if ((u->WaitTics -= MISSILEMOVETICS) <= 0) { KillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -20428,11 +20428,11 @@ DoBubble(short SpriteNum) if ((u->WaitTics -= MISSILEMOVETICS) <= 0) { KillSprite(SpriteNum); - return TRUE; + return true; } } - return FALSE; + return false; } // this needs to be called before killsprite @@ -20513,21 +20513,21 @@ SWBOOL TestDontStick(short SpriteNum, short hit_wall) wp = &wall[hit_wall]; if (TEST(wp->extra, WALLFX_DONT_STICK)) - return TRUE; + return true; // if blocking red wallo if (TEST(wp->cstat, CSTAT_WALL_BLOCK) && (uint16_t)wp->nextwall < MAXWALLS) - return TRUE; + return true; - return FALSE; + return false; } SWBOOL TestDontStickSector(short hit_sect) { if (TEST(sector[hit_sect].extra, SECTFX_DYNAMIC_AREA|SECTFX_SECTOR_OBJECT)) - return TRUE; + return true; - return FALSE; + return false; } int QueueStar(short SpriteNum) @@ -20718,7 +20718,7 @@ int QueueFootPrint(short hit_sprite) USERp u = User[hit_sprite]; USERp nu; short rnd_num=0; - SWBOOL Found=FALSE; + SWBOOL Found=false; SECTORp sectp = §or[hsp->sectnum]; @@ -20728,13 +20728,13 @@ int QueueFootPrint(short hit_sprite) if (u->PlayerP) { if (TEST(u->PlayerP->Flags, PF_DIVING)) - Found = TRUE; + Found = true; // Stupid masked floor stuff! Damn your weirdness! if (TEST(sector[u->PlayerP->cursectnum].ceilingstat, CEILING_STAT_PLAX)) - Found = TRUE; + Found = true; if (TEST(sector[u->PlayerP->cursectnum].floorstat, CEILING_STAT_PLAX)) - Found = TRUE; + Found = true; } if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || Found || SpriteInDiveArea(hsp)) @@ -21161,7 +21161,7 @@ SpawnShell(short SpriteNum, short ShellNum) // -4 is Shotgun shell InitShell(SpriteNum, ShellNum); - return TRUE; + return true; } @@ -21195,7 +21195,7 @@ DoShrapVelocity(int16_t SpriteNum) { case HIT_PLAX_WALL: KillSprite(SpriteNum); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -21265,7 +21265,7 @@ DoShrapVelocity(int16_t SpriteNum) ChangeState(SpriteNum, s_GoreFloorSplash); else ShrapKillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -21310,7 +21310,7 @@ DoShrapVelocity(int16_t SpriteNum) ChangeState(SpriteNum, s_GoreFloorSplash); else ShrapKillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -21329,10 +21329,10 @@ DoShrapVelocity(int16_t SpriteNum) if (u->bounce > 10) { KillSprite(SpriteNum); - return TRUE; + return true; } - return FALSE; + return false; } @@ -21496,12 +21496,12 @@ SWBOOL CheckBreakToughness(BREAK_INFOp break_info, short ID) case SKULL_SERP: case FIREBALL1: case GORO_FIREBALL: - return TRUE; // All the above stuff will break tough things + return true; // All the above stuff will break tough things } - return FALSE; // False means it won't break with current weapon + return false; // False means it won't break with current weapon } - return TRUE; // It wasn't tough, go ahead and break it + return true; // It wasn't tough, go ahead and break it } int @@ -21581,7 +21581,7 @@ DoItemFly(int16_t SpriteNum) u->Counter = 0; sp->xvel = 0; u->zchange = u->xchange = u->ychange = 0; - return FALSE; + return false; } else // hit something above @@ -21594,7 +21594,7 @@ DoItemFly(int16_t SpriteNum) } } - return TRUE; + return true; } // This is the FAST queue, it doesn't call any animator functions or states diff --git a/source/sw/src/zombie.cpp b/source/sw/src/zombie.cpp index 2638ae487..15dcc017b 100644 --- a/source/sw/src/zombie.cpp +++ b/source/sw/src/zombie.cpp @@ -886,9 +886,9 @@ DoZombieMove(short SpriteNum) if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) { - InitBloodSpray(SpriteNum,TRUE,105); - InitBloodSpray(SpriteNum,TRUE,105); - InitBloodSpray(SpriteNum,TRUE,105); + InitBloodSpray(SpriteNum,true,105); + InitBloodSpray(SpriteNum,true,105); + InitBloodSpray(SpriteNum,true,105); SetSuicide(SpriteNum); return 0; } @@ -936,9 +936,9 @@ NullZombie(short SpriteNum) if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) { - InitBloodSpray(SpriteNum,TRUE,105); - InitBloodSpray(SpriteNum,TRUE,105); - InitBloodSpray(SpriteNum,TRUE,105); + InitBloodSpray(SpriteNum,true,105); + InitBloodSpray(SpriteNum,true,105); + InitBloodSpray(SpriteNum,true,105); SetSuicide(SpriteNum); return 0; } From e044582aef178708a4fd7f62f00c3af17f1d0f7a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Sep 2020 20:28:05 +0200 Subject: [PATCH 44/49] - fixed all issues with SWBOOL as pointed out by a type-safe wrapper class. --- source/sw/src/ai.cpp | 3 +-- source/sw/src/ai.h | 2 +- source/sw/src/break.cpp | 2 +- source/sw/src/bunny.cpp | 1 - source/sw/src/cheats.cpp | 4 ++-- source/sw/src/game.cpp | 9 ++++---- source/sw/src/game.h | 4 ++-- source/sw/src/interpso.cpp | 10 ++++----- source/sw/src/jsector.cpp | 2 +- source/sw/src/mytypes.h | 42 +++++++++++++++++++++++++++++++++++++- source/sw/src/panel.cpp | 2 +- source/sw/src/player.cpp | 6 +++--- source/sw/src/player.h | 2 +- source/sw/src/ripper.cpp | 1 - source/sw/src/ripper2.cpp | 1 - source/sw/src/rooms.cpp | 8 ++++---- source/sw/src/save.cpp | 2 +- source/sw/src/sector.cpp | 2 +- source/sw/src/sounds.h | 2 +- source/sw/src/spike.cpp | 4 ++-- source/sw/src/sprite.cpp | 8 ++++---- source/sw/src/sumo.cpp | 2 +- source/sw/src/vator.cpp | 12 +++++------ source/sw/src/weapon.cpp | 8 ++++---- 24 files changed, 87 insertions(+), 52 deletions(-) diff --git a/source/sw/src/ai.cpp b/source/sw/src/ai.cpp index 66697ac73..6b1e04fc7 100644 --- a/source/sw/src/ai.cpp +++ b/source/sw/src/ai.cpp @@ -308,8 +308,7 @@ DoActorNoise(ANIMATORp Action, short SpriteNum) return 0; } -int -CanSeePlayer(short SpriteNum) +bool CanSeePlayer(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; diff --git a/source/sw/src/ai.h b/source/sw/src/ai.h index 582a03c60..2798b1779 100644 --- a/source/sw/src/ai.h +++ b/source/sw/src/ai.h @@ -76,7 +76,7 @@ SWBOOL ActorFlaming(short SpriteNum); void DoActorSetSpeed(short SpriteNum,uint8_t speed); short ChooseActionNumber(short decision[]); int DoActorNoise(ANIMATORp Action,short SpriteNum); -int CanSeePlayer(short SpriteNum); +bool CanSeePlayer(short SpriteNum); int CanHitPlayer(short SpriteNum); int DoActorPickClosePlayer(short SpriteNum); int CloseRangeDist(SPRITEp sp1,SPRITEp sp2); diff --git a/source/sw/src/break.cpp b/source/sw/src/break.cpp index 229f035d5..74f6c405b 100644 --- a/source/sw/src/break.cpp +++ b/source/sw/src/break.cpp @@ -668,7 +668,7 @@ SWBOOL UserBreakWall(WALLp wp, short) int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN; int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY; int flags = block_flags|type_flags; - short ret = false; + SWBOOL ret = false; SpriteNum = FindBreakSpriteMatch(match); diff --git a/source/sw/src/bunny.cpp b/source/sw/src/bunny.cpp index 63af41ae4..4e113b0ef 100644 --- a/source/sw/src/bunny.cpp +++ b/source/sw/src/bunny.cpp @@ -855,7 +855,6 @@ DoBunnyBeginJumpAttack(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; SPRITEp psp = User[SpriteNum]->tgt_sp; - int CanSeePlayer(short SpriteNum); short tang; tang = getangle(psp->x - sp->x, psp->y - sp->y); diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index 4bc0a52c7..3585d9668 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -103,7 +103,7 @@ bool RestartCheat(cheatseq_t* c) bool RoomCheat(cheatseq_t* c) { - FAF_DebugView ^= 1; + FAF_DebugView = !FAF_DebugView; return true; } @@ -161,7 +161,7 @@ bool WarpCheat(cheatseq_t* c) bool EveryCheatToggle(cheatseq_t* c) { - EveryCheat ^= 1; + EveryCheat = !EveryCheat; C_DoCommand("god"); C_DoCommand("give weapons"); C_DoCommand("give items"); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index be3df2a05..960fc0fd8 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -97,7 +97,7 @@ extern int sw_snd_scratch; int GameVersion = 20; SWBOOL NoMeters = false; -SWBOOL FinishAnim = 0; +int FinishAnim = 0; SWBOOL ReloadPrompt = false; SWBOOL NewGame = false; SWBOOL SavegameLoaded = false; @@ -127,7 +127,6 @@ GAME_SET gs; SWBOOL PlayerTrackingMode = false; SWBOOL SlowMode = false; -SWBOOL FrameAdvanceTics = 3; SWBOOL DebugOperate = false; void LoadingLevelScreen(void); @@ -292,7 +291,7 @@ void InitLevelGlobals2(void) InitTimingVars(); TotalKillable = 0; Bunny_Count = 0; - FinishAnim = 0; + FinishAnim = false; } //--------------------------------------------------------------------------- @@ -576,7 +575,7 @@ void GameInterface::LevelCompleted(MapRecord *map, int skill) if (map == nullptr) { STAT_Update(true); - FinishAnim = 0; + FinishAnim = false; PlaySong(nullptr, ThemeSongs[0], ThemeTrack[0]); if (SW_SHAREWARE) gameaction = ga_creditsmenu; else gameaction = ga_mainmenu; @@ -687,7 +686,7 @@ void GameInterface::ErrorCleanup() // Make sure we do not leave the game in an unstable state TerminateLevel(); SavegameLoaded = false; - FinishAnim = 0; + FinishAnim = false; } //--------------------------------------------------------------------------- // diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 1d9d5b7e8..070407fe8 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1926,7 +1926,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso void getzrangepoint(int x, int y, int z, short sectnum, int32_t* ceilz, int32_t* ceilhit, int32_t* florz, int32_t* florhit); int move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics); int move_missile(short spritenum, int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics); -int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets); +int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets); void change_sprite_stat(short, short); void SetOwner(short, short); @@ -2044,7 +2044,7 @@ extern USER puser[MAX_SW_PLAYERS_REG]; /////////////////////////// extern double smoothratio; -extern SWBOOL MoveSkip4, MoveSkip2, MoveSkip8; +extern int MoveSkip4, MoveSkip2, MoveSkip8; #define MASTER_SWITCHING 1 diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index 90078a3d9..2252ee140 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -349,7 +349,7 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) int32_t i; SECTOR_OBJECTp sop; so_interp *interp; - SWBOOL saveisshot = false; + int saveisshot = 0; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) @@ -364,17 +364,17 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) MWRITE(&data->spriteofang,sizeof(data->spriteofang),1,fil); } } - return saveisshot; + return !!saveisshot; } -int LoadSymDataInfo(MFILE_READ fil, void **ptr); +int LoadSymDataInfo(MFILE_READ fil, void** ptr); SWBOOL so_readinterpolations(MFILE_READ fil) { int32_t i; SECTOR_OBJECTp sop; so_interp *interp; - SWBOOL saveisshot = false; + int saveisshot = 0; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) @@ -393,7 +393,7 @@ SWBOOL so_readinterpolations(MFILE_READ fil) interp->tic = 0; interp->lasttic = synctics; } - return saveisshot; + return !!saveisshot; } END_SW_NS diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index bf4b792ea..0ca14e97e 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -560,7 +560,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))) { // Do not change any global state here! - bIsWallMirror = (TEST_GOTPIC(cnt + MIRRORLABEL)); + bIsWallMirror = !!(TEST_GOTPIC(cnt + MIRRORLABEL)); dist = 0x7fffffff; if (bIsWallMirror) diff --git a/source/sw/src/mytypes.h b/source/sw/src/mytypes.h index cff21d0dd..8be3fb78e 100644 --- a/source/sw/src/mytypes.h +++ b/source/sw/src/mytypes.h @@ -34,7 +34,47 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define OFF 0 #define ON 1 -typedef unsigned char SWBOOL; +class SWBOOL +{ + bool value; + +public: + SWBOOL(bool val) { value = val; } + SWBOOL() = default; + SWBOOL(unsigned char) = delete; + SWBOOL(signed char) = delete; + SWBOOL(char) = delete; + SWBOOL(unsigned short) = delete; + SWBOOL(short) = delete; + SWBOOL(unsigned int) = delete; + SWBOOL(int) = delete; + SWBOOL(double) = delete; + SWBOOL(float) = delete; + SWBOOL(const void *) = delete; + SWBOOL& operator=(bool v) { value = v; return *this; } + SWBOOL& operator=(char v) = delete; + SWBOOL& operator=(signed char v) = delete; + SWBOOL& operator=(unsigned char v) = delete; + SWBOOL& operator=(signed short v) = delete; + SWBOOL& operator=(unsigned short v) = delete; + SWBOOL& operator=(signed int v) = delete; + SWBOOL& operator=(unsigned int v) = delete; + SWBOOL& operator=(float v) = delete; + SWBOOL& operator=(double v) = delete; + SWBOOL& operator=(const void *v) = delete; + operator bool() { return value; } + SWBOOL& operator |=(bool b) { value |= b; return*this; } + SWBOOL& operator|=(char v) = delete; + SWBOOL& operator|=(signed char v) = delete; + SWBOOL& operator|=(unsigned char v) = delete; + SWBOOL& operator|=(signed short v) = delete; + SWBOOL& operator|=(unsigned short v) = delete; + SWBOOL& operator|=(signed int v) = delete; + SWBOOL& operator|=(unsigned int v) = delete; + SWBOOL& operator|=(float v) = delete; + SWBOOL& operator|=(double v) = delete; + SWBOOL& operator|=(const void* v) = delete; +}; /* =========================== diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index 5eebe4e46..4b4b881ce 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -2384,7 +2384,7 @@ void pUziAction(PANEL_SPRITEp psp) { char shooting; - static SWBOOL alternate = false; + static int alternate = 0; shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index b5629d68e..b288584f4 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -81,7 +81,7 @@ USER puser[MAX_SW_PLAYERS_REG]; //int16_t gNet.MultiGameType = MULTI_GAME_NONE; SWBOOL NightVision = false; -extern SWBOOL FinishAnim; +extern int FinishAnim; // the smaller the number the slower the going @@ -1180,7 +1180,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte); int -DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets) +DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets) { #define PICK_DIST 40000L @@ -4212,7 +4212,7 @@ PlayerOnLadder(PLAYERp pp) }; if (Prediction) - return 0; + return false; neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, FixedToInt(pp->q16ang), &neartagsector, &neartagwall, &neartagsprite, diff --git a/source/sw/src/player.h b/source/sw/src/player.h index ba1f8cec8..527b50742 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -125,7 +125,7 @@ int SetVisHigh(void); int SetVisNorm(void); void DoWeapon(void); void HeadBobStateControl(void); -int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets); +int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets); void DoPlayer(void); void domovethings(void); void InitAllPlayers(void); diff --git a/source/sw/src/ripper.cpp b/source/sw/src/ripper.cpp index e0233d064..1525d8b46 100644 --- a/source/sw/src/ripper.cpp +++ b/source/sw/src/ripper.cpp @@ -1089,7 +1089,6 @@ DoRipperBeginJumpAttack(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; SPRITEp psp = User[SpriteNum]->tgt_sp; - int CanSeePlayer(short SpriteNum); short tang; tang = getangle(psp->x - sp->x, psp->y - sp->y); diff --git a/source/sw/src/ripper2.cpp b/source/sw/src/ripper2.cpp index 5074aaa55..d5bd31a00 100644 --- a/source/sw/src/ripper2.cpp +++ b/source/sw/src/ripper2.cpp @@ -1096,7 +1096,6 @@ DoRipper2BeginJumpAttack(short SpriteNum) SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; SPRITEp psp = User[SpriteNum]->tgt_sp; - int CanSeePlayer(short SpriteNum); short tang; tang = getangle(psp->x - sp->x, psp->y - sp->y); diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index 3b8baef72..8037e3177 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -53,7 +53,7 @@ typedef struct SAVE save; -SWBOOL FAF_DebugView = 0; +SWBOOL FAF_DebugView = false; void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector) { @@ -282,7 +282,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, // early out to regular routine if ((sects < 0 || !FAF_Sector(sects)) && (secte < 0 || !FAF_Sector(secte))) { - return cansee(xs,ys,zs,sects,xe,ye,ze,secte); + return !!cansee(xs,ys,zs,sects,xe,ye,ze,secte); } // get angle @@ -336,11 +336,11 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, } else { - return cansee(xs,ys,zs,sects,xe,ye,ze,secte); + return !!cansee(xs,ys,zs,sects,xe,ye,ze,secte); } if (plax_found) - return cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,newsectnum,xe,ye,ze,secte); + return !!cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,newsectnum,xe,ye,ze,secte); return false; } diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 294ec4874..435b817db 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -73,7 +73,7 @@ extern short Bunny_Count; extern SWBOOL NewGame; extern int GodMode; extern int FinishTimer; -extern SWBOOL FinishAnim; +extern int FinishAnim; extern int GameVersion; //extern short Zombies; diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 9054537d5..05474d6e6 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -1625,7 +1625,7 @@ SWBOOL ComboSwitchTest(short combo_type, short match) { short i,nexti; SPRITEp sp; - SWBOOL state; + int state; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { diff --git a/source/sw/src/sounds.h b/source/sw/src/sounds.h index 9cbbc1602..05a0d314a 100644 --- a/source/sw/src/sounds.h +++ b/source/sw/src/sounds.h @@ -78,7 +78,7 @@ void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags); void DeleteNoSoundOwner(short spritenum); void DeleteNoFollowSoundOwner(short spritenum); -inline SWBOOL CacheSound(int num, int type) { return false; } +inline bool CacheSound(int num, int type) { return false; } void COVER_SetReverb(int amt); void UnInitSound(void); void InitFX(void); diff --git a/source/sw/src/spike.cpp b/source/sw/src/spike.cpp index c6acfb589..3f7b8c149 100644 --- a/source/sw/src/spike.cpp +++ b/source/sw/src/spike.cpp @@ -104,7 +104,7 @@ void SetSpikeActive(short SpriteNum) else short_setinterpolation(§p->floorheinum); - InterpSectorSprites(sp->sectnum, ON); + InterpSectorSprites(sp->sectnum, true); // play activate sound DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE); @@ -132,7 +132,7 @@ void SetSpikeInactive(short SpriteNum) else short_stopinterpolation(§p->floorheinum); - InterpSectorSprites(sp->sectnum, OFF); + InterpSectorSprites(sp->sectnum, false); // play activate sound DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE); diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index ef226f614..b31de4311 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -91,7 +91,7 @@ void InitWeaponRocket(PLAYERp); void InitWeaponUzi(PLAYERp); SWBOOL FAF_Sector(short sectnum); -SWBOOL MoveSkip4, MoveSkip2, MoveSkip8; +int MoveSkip4, MoveSkip2, MoveSkip8; extern STATE s_CarryFlag[]; extern STATE s_CarryFlagNoDet[]; @@ -1128,7 +1128,7 @@ void PreCachePachinko(void); SWBOOL ActorSpawn(SPRITEp sp) { - int ret = true; + bool ret = true; short SpriteNum = sp - sprite; switch (sp->picnum) @@ -2329,7 +2329,7 @@ SpriteSetup(void) sectp->floorz += amt; u->z_tgt = u->sz; - MoveSpritesWithSector(sp->sectnum, amt, 0); // floor + MoveSpritesWithSector(sp->sectnum, amt, false); // floor } // set orig z @@ -2350,7 +2350,7 @@ SpriteSetup(void) sectp->ceilingz += amt; u->z_tgt = u->sz; - MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling + MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling } // set orig z diff --git a/source/sw/src/sumo.cpp b/source/sw/src/sumo.cpp index 5f634a287..c213835f1 100644 --- a/source/sw/src/sumo.cpp +++ b/source/sw/src/sumo.cpp @@ -857,7 +857,7 @@ BossHealthMeter(void) // Frank, good optimization for other levels, but it broke level 20. :( // I kept this but had to add a fix. - bosswasseen = serpwasseen|sumowasseen|zillawasseen; + bosswasseen = serpwasseen || sumowasseen || zillawasseen; // Only show the meter when you can see the boss if ((currentLevel->levelNumber == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen) diff --git a/source/sw/src/vator.cpp b/source/sw/src/vator.cpp index 2bf0295fc..fe94d12ee 100644 --- a/source/sw/src/vator.cpp +++ b/source/sw/src/vator.cpp @@ -109,7 +109,7 @@ void SetVatorActive(short SpriteNum) else setinterpolation(§p->floorz); - InterpSectorSprites(sp->sectnum, ON); + InterpSectorSprites(sp->sectnum, true); // play activate sound DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE); @@ -137,7 +137,7 @@ void SetVatorInactive(short SpriteNum) else stopinterpolation(§p->floorz); - InterpSectorSprites(sp->sectnum, OFF); + InterpSectorSprites(sp->sectnum, false); // play inactivate sound DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE); @@ -465,13 +465,13 @@ int DoVator(short SpriteNum) { lptr = §p->ceilingz; amt = DoVatorMove(SpriteNum, lptr); - MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling + MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling } else { lptr = §p->floorz; amt = DoVatorMove(SpriteNum, lptr); - MoveSpritesWithSector(sp->sectnum, amt, 0); // floor + MoveSpritesWithSector(sp->sectnum, amt, false); // floor } // EQUAL this entry has finished @@ -626,13 +626,13 @@ int DoVatorAuto(short SpriteNum) { lptr = §p->ceilingz; amt = DoVatorMove(SpriteNum, lptr); - MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling + MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling } else { lptr = §p->floorz; amt = DoVatorMove(SpriteNum, lptr); - MoveSpritesWithSector(sp->sectnum, amt, 0); // floor + MoveSpritesWithSector(sp->sectnum, amt, false); // floor } // EQUAL this entry has finished diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index a76337cc0..a9e1491c9 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -5320,7 +5320,7 @@ ActorHealth(short SpriteNum, short amt) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - extern SWBOOL FinishAnim; + extern int FinishAnim; if (u->ID == TRASHCAN && amt > -75) { @@ -12675,7 +12675,7 @@ MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = false; + bool retval = false; // backup values oldxc = wu->xchange; @@ -12721,7 +12721,7 @@ TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = false; + bool retval = false; // backup values oldxc = wu->xchange; @@ -16113,7 +16113,7 @@ WallSpriteInsideSprite(SPRITEp wsp, SPRITEp sp) y1 -= mulscale16(day, mid_dist); y2 = y1 + mulscale16(day, xsiz); - return clipinsideboxline(sp->x, sp->y, x1, y1, x2, y2, ((int) sp->clipdist) << 2); + return !!clipinsideboxline(sp->x, sp->y, x1, y1, x2, y2, ((int) sp->clipdist) << 2); } From 2ffb6a358083ae15a127a34f41d708c0443373c7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Sep 2020 20:32:24 +0200 Subject: [PATCH 45/49] - finally got rid of SWBOOL. --- source/sw/src/ai.cpp | 16 ++++---- source/sw/src/ai.h | 4 +- source/sw/src/bots.h | 2 +- source/sw/src/break.cpp | 8 ++-- source/sw/src/break.h | 4 +- source/sw/src/bunny.cpp | 2 +- source/sw/src/cache.cpp | 2 +- source/sw/src/cheats.cpp | 8 ++-- source/sw/src/draw.cpp | 28 ++++++------- source/sw/src/game.cpp | 24 +++++------ source/sw/src/game.h | 68 +++++++++++++++--------------- source/sw/src/interpso.cpp | 12 +++--- source/sw/src/interpso.h | 4 +- source/sw/src/jsector.cpp | 18 ++++---- source/sw/src/jsector.h | 4 +- source/sw/src/jweapon.cpp | 10 ++--- source/sw/src/menus.cpp | 2 +- source/sw/src/menus.h | 2 +- source/sw/src/misc.h | 14 +++---- source/sw/src/miscactr.cpp | 24 +++++------ source/sw/src/mytypes.h | 41 ------------------- source/sw/src/network.cpp | 2 +- source/sw/src/network.h | 16 ++++---- source/sw/src/ninja.cpp | 2 +- source/sw/src/panel.cpp | 58 +++++++++++++------------- source/sw/src/panel.h | 2 +- source/sw/src/player.cpp | 58 +++++++++++++------------- source/sw/src/predict.cpp | 4 +- source/sw/src/quake.cpp | 2 +- source/sw/src/ripper.cpp | 2 +- source/sw/src/ripper2.cpp | 2 +- source/sw/src/rooms.cpp | 30 +++++++------- source/sw/src/rotator.cpp | 18 ++++---- source/sw/src/save.cpp | 10 ++--- source/sw/src/scrip2.cpp | 6 +-- source/sw/src/sector.cpp | 26 ++++++------ source/sw/src/sector.h | 4 +- source/sw/src/skull.cpp | 2 +- source/sw/src/slidor.cpp | 14 +++---- source/sw/src/sounds.cpp | 2 +- source/sw/src/sounds.h | 6 +-- source/sw/src/spike.cpp | 12 +++--- source/sw/src/sprite.cpp | 28 ++++++------- source/sw/src/sprite.h | 8 ++-- source/sw/src/sumo.cpp | 12 +++--- source/sw/src/track.cpp | 14 +++---- source/sw/src/vator.cpp | 24 +++++------ source/sw/src/wallmove.cpp | 10 ++--- source/sw/src/warp.cpp | 6 +-- source/sw/src/weapon.cpp | 84 +++++++++++++++++++------------------- source/sw/src/weapon.h | 18 ++++---- 51 files changed, 369 insertions(+), 410 deletions(-) diff --git a/source/sw/src/ai.cpp b/source/sw/src/ai.cpp index 6b1e04fc7..176bcf76a 100644 --- a/source/sw/src/ai.cpp +++ b/source/sw/src/ai.cpp @@ -40,10 +40,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -SWBOOL PlayerTakeDamage(PLAYERp, short); +bool PlayerTakeDamage(PLAYERp, short); ANIMATOR InitActorRunToward; -SWBOOL FAF_Sector(short); -SWBOOL DropAhead(short SpriteNum, short min_height); +bool FAF_Sector(short); +bool DropAhead(short SpriteNum, short min_height); short FindTrackToPlayer(USERp u); ANIMATORp ChooseAction(DECISION decision[]); @@ -114,7 +114,7 @@ void DebugMoveHit(short SpriteNum) } -SWBOOL ActorMoveHitReact(short SpriteNum) +bool ActorMoveHitReact(short SpriteNum) { USERp u = User[SpriteNum]; @@ -161,7 +161,7 @@ SWBOOL ActorMoveHitReact(short SpriteNum) } -SWBOOL ActorFlaming(short SpriteNum) +bool ActorFlaming(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; @@ -398,7 +398,7 @@ DoActorPickClosePlayer(short SpriteNum) PLAYERp pp; // if actor can still see the player int look_height = SPRITEp_TOS(sp); - SWBOOL found = false; + bool found = false; int i,nexti; if (u->ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE) @@ -474,7 +474,7 @@ DoActorPickClosePlayer(short SpriteNum) DISTANCE(sp->x, sp->y, pp->posx, pp->posy, dist, a, b, c); - //SWBOOL ICanSee = FAFcansee(sp->x, sp->y, look_height, sp->sectnum, pp->SpriteP->x, pp->SpriteP->y, SPRITEp_UPPER(pp->SpriteP), pp->SpriteP->sectnum); + //bool ICanSee = FAFcansee(sp->x, sp->y, look_height, sp->sectnum, pp->SpriteP->x, pp->SpriteP->y, SPRITEp_UPPER(pp->SpriteP), pp->SpriteP->sectnum); if (dist < near_dist && FAFcansee(sp->x, sp->y, look_height, sp->sectnum, pp->SpriteP->x, pp->SpriteP->y, SPRITEp_UPPER(pp->SpriteP), pp->SpriteP->sectnum)) { near_dist = dist; @@ -638,7 +638,7 @@ DoActorActionDecide(short SpriteNum) int dist; ANIMATORp action; USERp pu=NULL; - SWBOOL ICanSee=false; + bool ICanSee=false; // REMINDER: This function is not even called if SpriteControl doesn't let // it get called diff --git a/source/sw/src/ai.h b/source/sw/src/ai.h index 2798b1779..73cee9eb1 100644 --- a/source/sw/src/ai.h +++ b/source/sw/src/ai.h @@ -71,8 +71,8 @@ extern ATTRIBUTE DefaultAttrib; // AI.C functions void DebugMoveHit(short SpriteNum); -SWBOOL ActorMoveHitReact(short SpriteNum); -SWBOOL ActorFlaming(short SpriteNum); +bool ActorMoveHitReact(short SpriteNum); +bool ActorFlaming(short SpriteNum); void DoActorSetSpeed(short SpriteNum,uint8_t speed); short ChooseActionNumber(short decision[]); int DoActorNoise(ANIMATORp Action,short SpriteNum); diff --git a/source/sw/src/bots.h b/source/sw/src/bots.h index de079ec13..5d0776960 100644 --- a/source/sw/src/bots.h +++ b/source/sw/src/bots.h @@ -59,7 +59,7 @@ struct NODETREEstruct { short SpriteNum; // Sprite number in sprite array of goal item NODEp tree; // This is the node tree used to navigate to goal - SWBOOL Locked; // If list is locked, a bot is using/modifying it and + bool Locked; // If list is locked, a bot is using/modifying it and // other bots cannot modify it while it's locked }; diff --git a/source/sw/src/break.cpp b/source/sw/src/break.cpp index 74f6c405b..ed7f70a86 100644 --- a/source/sw/src/break.cpp +++ b/source/sw/src/break.cpp @@ -660,7 +660,7 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short return true; } -SWBOOL UserBreakWall(WALLp wp, short) +bool UserBreakWall(WALLp wp, short) { short SpriteNum; SPRITEp sp; @@ -668,7 +668,7 @@ SWBOOL UserBreakWall(WALLp wp, short) int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN; int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY; int flags = block_flags|type_flags; - SWBOOL ret = false; + bool ret = false; SpriteNum = FindBreakSpriteMatch(match); @@ -817,7 +817,7 @@ int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, sh } // If the tough parameter is not set, then it can't break tough walls and sprites -SWBOOL HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short type) +bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short type) { short match = wp->hitag; @@ -1024,7 +1024,7 @@ int AutoBreakSprite(short BreakSprite, short type) return false; } -SWBOOL NullActor(USERp u) +bool NullActor(USERp u) { // a Null Actor is defined as an actor that has no real controlling programming attached diff --git a/source/sw/src/break.h b/source/sw/src/break.h index 02f69851d..133b9f9bf 100644 --- a/source/sw/src/break.h +++ b/source/sw/src/break.h @@ -48,9 +48,9 @@ void SortBreakInfo(void); BREAK_INFOp SetupWallForBreak(WALLp wallp); BREAK_INFOp SetupSpriteForBreak(SPRITEp sp); short FindBreakSpriteMatch(short match); -SWBOOL HitBreakWall(WALLp wp, int, int, int, short ang, short type); +bool HitBreakWall(WALLp wp, int, int, int, short ang, short type); int HitBreakSprite(short BreakSprite, short type); -SWBOOL CheckBreakToughness(BREAK_INFOp break_info, short ID); +bool CheckBreakToughness(BREAK_INFOp break_info, short ID); int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang); void SortBreakInfo(void); diff --git a/source/sw/src/bunny.cpp b/source/sw/src/bunny.cpp index 4e113b0ef..f3ac162a9 100644 --- a/source/sw/src/bunny.cpp +++ b/source/sw/src/bunny.cpp @@ -930,7 +930,7 @@ DoPickCloseBunny(short SpriteNum) // if actor can still see the player int look_height = SPRITEp_TOS(sp); - SWBOOL ICanSee = false; + bool ICanSee = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) { diff --git a/source/sw/src/cache.cpp b/source/sw/src/cache.cpp index dfd62bd55..77a8a2045 100644 --- a/source/sw/src/cache.cpp +++ b/source/sw/src/cache.cpp @@ -47,7 +47,7 @@ BEGIN_SW_NS // It will save out the tile and sound number every time one caches. // // sw -map $bullet -cacheprint > foofile -extern SWBOOL PreCaching; +extern bool PreCaching; void PreCacheTable(short table[], int num); void PreCacheGhost(void); diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index 3585d9668..e0c59b4a9 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -45,10 +45,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -SWBOOL CheatInputMode = false; -SWBOOL EveryCheat = false; -SWBOOL mapcheat = false; -extern SWBOOL FAF_DebugView; +bool CheatInputMode = false; +bool EveryCheat = false; +bool mapcheat = false; +extern bool FAF_DebugView; const char *CheatKeyType; void KeysCheat(PLAYERp pp, const char *cheat_string); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 05d818d9e..6fc63412a 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -59,10 +59,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS static int OverlapDraw = false; -extern SWBOOL QuitFlag, SpriteInfo; -extern SWBOOL Voxel; +extern bool QuitFlag, SpriteInfo; +extern bool Voxel; extern char buffer[]; -SWBOOL DrawScreen; +bool DrawScreen; extern short f_c; extern ParentalStruct aVoxelArray[MAXTILES]; @@ -261,7 +261,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp) } void -DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror) +DoShadows(tspriteptr_t tsp, int viewz, bool mirror) { tspriteptr_t New = &tsprite[spritesortcnt]; USERp tu = User[tsp->owner]; @@ -560,7 +560,7 @@ void DoStarView(tspriteptr_t tsp, USERp tu, int viewz) } void -analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) +analyzesprites(int viewx, int viewy, int viewz, bool mirror) { int tSpriteNum; short SpriteNum; @@ -708,7 +708,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) // if sector pal is something other than default SECT_USERp sectu = SectUser[tsp->sectnum]; uint8_t pal = sector[tsp->sectnum].floorpal; - SWBOOL nosectpal=false; + bool nosectpal=false; // sprite does not take on the new pal if sector flag is set if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE)) @@ -1257,7 +1257,7 @@ void SpriteSortList2D(int tx, int ty) void DrawCrosshair(PLAYERp pp) { - extern SWBOOL CameraTestMode; + extern bool CameraTestMode; if (!(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { @@ -1271,10 +1271,10 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t int i,nexti; short ang; SPRITEp sp; - SWBOOL found_camera = false; - SWBOOL player_in_camera = false; - SWBOOL FAFcansee_test; - SWBOOL ang_test; + bool found_camera = false; + bool player_in_camera = false; + bool FAFcansee_test; + bool ang_test; if (pp == &Player[screenpeek]) { @@ -1603,13 +1603,13 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short short ScreenSavePic = false; -SWBOOL PicInView(short, SWBOOL); +bool PicInView(short, bool); void DoPlayerDiveMeter(PLAYERp pp); void drawscreen(PLAYERp pp, double smoothratio) { - extern SWBOOL CameraTestMode; + extern bool CameraTestMode; int tx, ty, tz; fixed_t tq16horiz, tq16ang; short tsectnum; @@ -1617,7 +1617,7 @@ drawscreen(PLAYERp pp, double smoothratio) int bob_amt = 0; int quake_z, quake_x, quake_y; short quake_ang; - extern SWBOOL FAF_DebugView; + extern bool FAF_DebugView; PLAYERp camerapp; // prediction player if prediction is on, else regular player // last valid stuff diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 960fc0fd8..a413679e2 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -96,16 +96,16 @@ extern int sw_snd_scratch; int GameVersion = 20; -SWBOOL NoMeters = false; +bool NoMeters = false; int FinishAnim = 0; -SWBOOL ReloadPrompt = false; -SWBOOL NewGame = false; -SWBOOL SavegameLoaded = false; +bool ReloadPrompt = false; +bool NewGame = false; +bool SavegameLoaded = false; //Miscellaneous variables -SWBOOL FinishedLevel = false; +bool FinishedLevel = false; short screenpeek = 0; -SWBOOL PreCaching = true; +bool PreCaching = true; int GodMode = false; short Skill = 2; short TotalKillable; @@ -125,10 +125,10 @@ const GAME_SET gs_defaults = }; GAME_SET gs; -SWBOOL PlayerTrackingMode = false; -SWBOOL SlowMode = false; +bool PlayerTrackingMode = false; +bool SlowMode = false; -SWBOOL DebugOperate = false; +bool DebugOperate = false; void LoadingLevelScreen(void); uint8_t FakeMultiNumPlayers; @@ -137,14 +137,14 @@ int totalsynctics; int OrigCommPlayers=0; extern uint8_t CommPlayers; -extern SWBOOL CommEnabled; +extern bool CommEnabled; -SWBOOL CameraTestMode = false; +bool CameraTestMode = false; char ds[645]; // debug string extern short NormalVisibility; -SWBOOL CommandSetup = false; +bool CommandSetup = false; char buffer[80], ch; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 070407fe8..4c1241e3c 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -62,13 +62,13 @@ typedef struct // Net Options from Menus uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn] uint8_t NetMonsters; // Cycle skill levels - SWBOOL NetHurtTeammate; // Allow friendly kills - SWBOOL NetSpawnMarkers; // Respawn markers on/off - SWBOOL NetTeamPlay; // Team play + bool NetHurtTeammate; // Allow friendly kills + bool NetSpawnMarkers; // Respawn markers on/off + bool NetTeamPlay; // Team play uint8_t NetKillLimit; // Number of frags at which game ends uint8_t NetTimeLimit; // Limit time of game uint8_t NetColor; // Chosen color for player - SWBOOL NetNuke; + bool NetNuke; } GAME_SET, * GAME_SETp; extern const GAME_SET gs_defaults; @@ -155,7 +155,7 @@ y++ // ////////////////////////////////////////////////////// -extern SWBOOL MenuInputMode; +extern bool MenuInputMode; // // Defines @@ -683,8 +683,8 @@ extern int DLL_Handle; // Global DLL handle extern char *DLL_path; // DLL path name int DLL_Load(char *DLLpathname); -SWBOOL DLL_Unload(int procHandle); -SWBOOL DLL_ExecFunc(int procHandle, char *fName); +bool DLL_Unload(int procHandle); +bool DLL_ExecFunc(int procHandle, char *fName); /////////////////////////////////////////////////////////////////////////////////////////// // @@ -805,7 +805,7 @@ enum #define PACK 1 -extern SWBOOL CameraTestMode; +extern bool CameraTestMode; enum PlayerDeathTypes { @@ -954,7 +954,7 @@ struct PLAYERstruct short InventoryTics[MAX_INVENTORY]; short InventoryPercent[MAX_INVENTORY]; int8_t InventoryAmount[MAX_INVENTORY]; - SWBOOL InventoryActive[MAX_INVENTORY]; + bool InventoryActive[MAX_INVENTORY]; short DiveTics; short DiveDamageTics; @@ -980,10 +980,10 @@ struct PLAYERstruct // palette fading up and down for player hit and get items short FadeTics; // Tics between each fade cycle short FadeAmt; // Current intensity of fade - SWBOOL NightVision; // Is player's night vision active? + bool NightVision; // Is player's night vision active? unsigned char StartColor; // Darkest color in color range being used //short electro[64]; - SWBOOL IsAI; // Is this and AI character? + bool IsAI; // Is this and AI character? short fta,ftq; // First time active and first time quote, for talking in multiplayer games short NumFootPrints; // Number of foot prints left to lay down unsigned char WpnUziType; // Toggle between single or double uzi's if you own 2. @@ -991,10 +991,10 @@ struct PLAYERstruct unsigned char WpnShotgunAuto; // 50-0 automatic shotgun rounds unsigned char WpnShotgunLastShell; // Number of last shell fired unsigned char WpnRailType; // Normal Rail Gun or EMP Burst Mode - SWBOOL Bloody; // Is player gooey from the slaughter? - SWBOOL InitingNuke; - SWBOOL TestNukeInit; - SWBOOL NukeInitialized; // Nuke already has counted down + bool Bloody; // Is player gooey from the slaughter? + bool InitingNuke; + bool TestNukeInit; + bool NukeInitialized; // Nuke already has counted down short FistAng; // KungFu attack angle unsigned char WpnKungFuMove; // KungFu special moves short HitBy; // SpriteNum of whatever player was last hit by @@ -1291,7 +1291,7 @@ typedef struct // Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS) short FlagOwner; // The spritenum of the original flag short Vis; // Shading upgrade, for shooting, etc... - SWBOOL DidAlert; // Has actor done his alert noise before? + bool DidAlert; // Has actor done his alert noise before? int16_t oangdiff; // Used for interpolating sprite angles @@ -1931,13 +1931,13 @@ int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets); void change_sprite_stat(short, short); void SetOwner(short, short); void SetAttach(short, short); -void analyzesprites(int,int,int,SWBOOL); +void analyzesprites(int,int,int,bool); void ChangeState(short SpriteNum, STATEp statep); void UpdateSectorFAF_Connect(short SpriteNum, int newz); #if 0 -SWBOOL FAF_ConnectCeiling(short sectnum); -SWBOOL FAF_ConnectFloor(short sectnum); +bool FAF_ConnectCeiling(short sectnum); +bool FAF_ConnectFloor(short sectnum); #else #define FAF_PLACE_MIRROR_PIC 341 #define FAF_MIRROR_PIC 2356 @@ -1948,14 +1948,14 @@ SWBOOL FAF_ConnectFloor(short sectnum); //void updatesectorz(int, int, int, short *); void FAF_ConnectPlayerCeiling(PLAYERp pp); void FAF_ConnectPlayerFloor(PLAYERp pp); -SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit); -SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit); +bool PlayerCeilingHit(PLAYERp pp, int zlimit); +bool PlayerFloorHit(PLAYERp pp, int zlimit); void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t xvect, int32_t yvect, int32_t zvect, hitdata_t* hitinfo, int32_t clipmask); -SWBOOL FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte); +bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte); void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t* hiz, int32_t* ceilhit, @@ -1991,15 +1991,15 @@ void DoSoundSpotMatch(short match, short sound_num, short sound_type); // /////////////////////////////////////////////////////////////////////////////////////////// -extern SWBOOL NewGame; +extern bool NewGame; extern uint8_t CommPlayers; -extern SWBOOL CommEnabled; +extern bool CommEnabled; extern int LastFrameTics; extern char ds[]; extern short Skill; extern int GodMode; -extern SWBOOL ReloadPrompt; +extern bool ReloadPrompt; //extern unsigned char synctics, lastsynctics; extern short snum; @@ -2065,7 +2065,7 @@ extern int16_t StatDamageList[STAT_DAMAGE_LIST_SIZE]; #define COLOR_PAIN 128 // Light red range extern void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor); extern void DoPaletteFlash(PLAYERp pp); -extern SWBOOL NightVision; +extern bool NightVision; @@ -2100,7 +2100,7 @@ void computergetinput(int snum,InputPacket *syn); // jplayer.c void DrawOverlapRoom(int tx,int ty,int tz,fixed_t tq16ang,fixed_t tq16horiz,short tsectnum); // rooms.c void SetupMirrorTiles(void); // rooms.c -SWBOOL FAF_Sector(short sectnum); // rooms.c +bool FAF_Sector(short sectnum); // rooms.c int GetZadjustment(short sectnum,short hitag); // rooms.c void InitSetup(void); // setup.c @@ -2122,8 +2122,8 @@ void LoadGameDescr(short save_num, char *descr); // save.c void SetRotatorActive(short SpriteNum); // rotator.c -SWBOOL VatorSwitch(short match, short setting); // vator.c -void MoveSpritesWithSector(short sectnum,int z_amt,SWBOOL type); // vator.c +bool VatorSwitch(short match, short setting); // vator.c +void MoveSpritesWithSector(short sectnum,int z_amt,bool type); // vator.c void SetVatorActive(short SpriteNum); // vator.c short DoSpikeMatch(short match); // spike.c @@ -2142,7 +2142,7 @@ void CopySectorMatch(short match); // copysect.c int DoWallMoveMatch(short match); // wallmove.c int DoWallMove(SPRITEp sp); // wallmove.c -SWBOOL CanSeeWallMove(SPRITEp wp,short match); // wallmove.c +bool CanSeeWallMove(SPRITEp wp,short match); // wallmove.c short DoSpikeOperate(short sectnum); // spike.c void SetSpikeActive(short SpriteNum); // spike.c @@ -2172,10 +2172,10 @@ extern char PlayerGravity; extern short wait_active_check_offset; //extern short Zombies; extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; -extern SWBOOL left_foot; -extern SWBOOL serpwasseen; -extern SWBOOL sumowasseen; -extern SWBOOL zillawasseen; +extern bool left_foot; +extern bool serpwasseen; +extern bool sumowasseen; +extern bool zillawasseen; extern short BossSpriteNum[3]; extern int ChopTics; extern short Bunny_Count; diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index 2252ee140..ecb9d9e8c 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -53,7 +53,7 @@ static struct so_interp int32_t numinterpolations; int32_t tic, lasttic; - SWBOOL hasvator; + bool hasvator; } so_interpdata[MAX_SECTOR_OBJECTS]; static void so_setpointinterpolation(so_interp *interp, int32_t *posptr) @@ -202,7 +202,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings SECTOR_OBJECTp sop; so_interp *interp; so_interp::interp_data *data; - SWBOOL interpolating = cl_sointerpolation && !CommEnabled; // If changing from menu + bool interpolating = cl_sointerpolation && !CommEnabled; // If changing from menu for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) @@ -344,7 +344,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree int SaveSymDataInfo(MFILE_WRITE fil, void *ptr); -SWBOOL so_writeinterpolations(MFILE_WRITE fil) +int so_writeinterpolations(MFILE_WRITE fil) { int32_t i; SECTOR_OBJECTp sop; @@ -364,12 +364,12 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) MWRITE(&data->spriteofang,sizeof(data->spriteofang),1,fil); } } - return !!saveisshot; + return saveisshot; } int LoadSymDataInfo(MFILE_READ fil, void** ptr); -SWBOOL so_readinterpolations(MFILE_READ fil) +int so_readinterpolations(MFILE_READ fil) { int32_t i; SECTOR_OBJECTp sop; @@ -393,7 +393,7 @@ SWBOOL so_readinterpolations(MFILE_READ fil) interp->tic = 0; interp->lasttic = synctics; } - return !!saveisshot; + return saveisshot; } END_SW_NS diff --git a/source/sw/src/interpso.h b/source/sw/src/interpso.h index cd8f8c423..512b61c9e 100644 --- a/source/sw/src/interpso.h +++ b/source/sw/src/interpso.h @@ -41,8 +41,8 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics); void so_updateinterpolations(void); void so_dointerpolations(int32_t smoothratio); void so_restoreinterpolations(void); -SWBOOL so_writeinterpolations(MFILE_WRITE fil); -SWBOOL so_readinterpolations(MFILE_READ fil); +int so_writeinterpolations(MFILE_WRITE fil); +int so_readinterpolations(MFILE_READ fil); END_SW_NS diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 0ca14e97e..eb4dcf09d 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -53,14 +53,14 @@ MIRRORTYPE mirror[MAXMIRRORS]; short mirrorcnt; //, floormirrorcnt; //short floormirrorsector[MAXMIRRORS]; -SWBOOL mirrorinview; +bool mirrorinview; uint32_t oscilationclock; // Voxel stuff -//SWBOOL bVoxelsOn = true; // Turn voxels on by default -SWBOOL bSpinBobVoxels = false; // Do twizzly stuff to voxels, but +//bool bVoxelsOn = true; // Turn voxels on by default +bool bSpinBobVoxels = false; // Do twizzly stuff to voxels, but // not by default -SWBOOL bAutoSize = true; // Autosizing on/off +bool bAutoSize = true; // Autosizing on/off //extern int chainnumpages; extern AMB_INFO ambarray[]; @@ -288,7 +288,7 @@ void JS_InitMirrors(void) short startwall, endwall; int i, j, s; short SpriteNum = 0, NextSprite; - SWBOOL Found_Cam = false; + bool Found_Cam = false; // Set all the mirror struct values to -1 @@ -482,7 +482,7 @@ JS_ProcessEchoSpot() int j,dist; PLAYERp pp = Player+screenpeek; int16_t reverb; - SWBOOL reverb_set = false; + bool reverb_set = false; // Process echo sprites TRAVERSE_SPRITE_STAT(headspritestat[STAT_ECHO], i, nexti) @@ -531,7 +531,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) int tposx, tposy; // Camera int* longptr; - SWBOOL bIsWallMirror = false; + bool bIsWallMirror = false; int camclock = I_GetBuildTime(); camloopcnt += camclock - lastcamclock; @@ -634,7 +634,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) // you are outside of it! if (mirror[cnt].mstate == m_viewon) { - SWBOOL DoCam = false; + bool DoCam = false; if (mirror[cnt].campic == -1) { @@ -733,7 +733,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed // int tx, ty, tz, tpang; // Interpolate so mirror doesn't // drift! - SWBOOL bIsWallMirror = false; + bool bIsWallMirror = false; // WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong longptr = (int *)&gotpic[MIRRORLABEL >> 3]; diff --git a/source/sw/src/jsector.h b/source/sw/src/jsector.h index 016bf1305..c7a0ec571 100644 --- a/source/sw/src/jsector.h +++ b/source/sw/src/jsector.h @@ -53,7 +53,7 @@ typedef struct short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill // level for a // max of up to 4 coolie ghosts to spawn. - SWBOOL ismagic; // Is this a magic mirror? + bool ismagic; // Is this a magic mirror? MIRRORSTATE mstate; // What state the mirror is currently // in int maxtics; // Tic count used to time mirror @@ -66,7 +66,7 @@ extern MIRRORTYPE mirror[MAXMIRRORS]; extern short mirrorcnt, floormirrorcnt; extern short floormirrorsector[MAXMIRRORS]; -extern SWBOOL mirrorinview; +extern bool mirrorinview; extern short NormalVisibility; void JAnalyzeSprites(tspriteptr_t tspr); diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index 0a44ef1c3..fe27a3364 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -52,7 +52,7 @@ extern STATE s_Puff[]; extern STATE s_FireballFlames[]; extern STATE s_GoreFloorSplash[]; extern STATE s_GoreSplash[]; -extern SWBOOL GlobalSkipZrange; +extern bool GlobalSkipZrange; #define CHEMTICS SEC(40) @@ -696,7 +696,7 @@ DoPhosphorus(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { @@ -924,7 +924,7 @@ DoChemBomb(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { @@ -1170,7 +1170,7 @@ DoCaltrops(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { @@ -2000,7 +2000,7 @@ InitPhosphorus(int16_t SpriteNum) } int -InitBloodSpray(int16_t SpriteNum, SWBOOL dogib, short velocity) +InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index e46990daf..ef66a628e 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -223,7 +223,7 @@ void DoPaletteFlash(PLAYERp pp) } -SWBOOL MNU_ShareWareMessage() +bool MNU_ShareWareMessage() { const char* extra_text; short w, h; diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index 330ea8924..35360f0cb 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -39,7 +39,7 @@ void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, i #define pic_shadow_warrior 2366 #define m_defshade 2 -extern SWBOOL SavegameLoaded; +extern bool SavegameLoaded; END_SW_NS diff --git a/source/sw/src/misc.h b/source/sw/src/misc.h index 257262ea4..1ccc3a6a2 100644 --- a/source/sw/src/misc.h +++ b/source/sw/src/misc.h @@ -22,10 +22,10 @@ void MapColors(short num,COLOR_MAP cm,short create); void InitPalette(void); int32_t CONFIG_ReadSetup(void); -SWBOOL WarpPlaneSectorInfo(short sectnum, SPRITEp* sp_ceiling, SPRITEp* sp_floor); +bool WarpPlaneSectorInfo(short sectnum, SPRITEp* sp_ceiling, SPRITEp* sp_floor); SPRITEp WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum); SPRITEp WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum); -SWBOOL WarpSectorInfo(short sectnum, SPRITEp* sp_warp); +bool WarpSectorInfo(short sectnum, SPRITEp* sp_warp); SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum); void ProcessVisOn(void); @@ -36,7 +36,7 @@ enum TriggerType { TRIGGER_TYPE_REMOTE_SO }; int ActorFollowTrack(short SpriteNum, short locktics); void ActorLeaveTrack(short SpriteNum); -void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, SWBOOL dynamic); +void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, bool dynamic); void TrackSetup(void); void PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy); void PlaceSectorObjectsOnTracks(void); @@ -56,9 +56,9 @@ inline constexpr int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TE void PutStringInfo(PLAYERp pp, const char* string); -short DoSlidorMatch(PLAYERp pp, short match, SWBOOL); -SWBOOL TestSlidorMatchActive(short match); -void InterpSectorSprites(short sectnum, SWBOOL state); +short DoSlidorMatch(PLAYERp pp, short match, bool); +bool TestSlidorMatchActive(short match); +void InterpSectorSprites(short sectnum, bool state); typedef void INTERP_FUNC(int*); typedef INTERP_FUNC* INTERP_FUNCp; @@ -86,7 +86,7 @@ void ProcessQuakeOn(void); void ProcessQuakeSpot(void); void QuakeViewChange(PLAYERp pp, int* z_diff, int* x_diff, int* y_diff, short* ang_diff); void DoQuake(PLAYERp pp); -SWBOOL SetQuake(PLAYERp pp, short tics, short amt); +bool SetQuake(PLAYERp pp, short tics, short amt); int SetExpQuake(int16_t Weapon); int SetGunQuake(int16_t SpriteNum); int SetPlayerQuake(PLAYERp mpp); diff --git a/source/sw/src/miscactr.cpp b/source/sw/src/miscactr.cpp index e8320e36f..259fd3aae 100644 --- a/source/sw/src/miscactr.cpp +++ b/source/sw/src/miscactr.cpp @@ -153,7 +153,7 @@ int DoToiletGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -211,7 +211,7 @@ int NullToiletGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -392,7 +392,7 @@ int DoWashGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -456,7 +456,7 @@ int NullWashGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1263,7 +1263,7 @@ int DoCarGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1312,7 +1312,7 @@ int NullCarGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1482,7 +1482,7 @@ int DoMechanicGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1531,7 +1531,7 @@ int NullMechanicGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); @@ -1702,7 +1702,7 @@ int DoSailorGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1755,7 +1755,7 @@ int NullSailorGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; static short alreadythrew = 0; DoActorPickClosePlayer(SpriteNum); @@ -1914,7 +1914,7 @@ int DoPruneGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,SPRITEp_MID(u->tgt_sp),u->tgt_sp->sectnum); @@ -1979,7 +1979,7 @@ int NullPruneGirl(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; - SWBOOL ICanSee = false; + bool ICanSee = false; DoActorPickClosePlayer(SpriteNum); ICanSee = FAFcansee(sp->x,sp->y,SPRITEp_MID(sp),sp->sectnum,u->tgt_sp->x,u->tgt_sp->y,u->tgt_sp->z,u->tgt_sp->sectnum); diff --git a/source/sw/src/mytypes.h b/source/sw/src/mytypes.h index 8be3fb78e..49cb8fca9 100644 --- a/source/sw/src/mytypes.h +++ b/source/sw/src/mytypes.h @@ -34,47 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define OFF 0 #define ON 1 -class SWBOOL -{ - bool value; - -public: - SWBOOL(bool val) { value = val; } - SWBOOL() = default; - SWBOOL(unsigned char) = delete; - SWBOOL(signed char) = delete; - SWBOOL(char) = delete; - SWBOOL(unsigned short) = delete; - SWBOOL(short) = delete; - SWBOOL(unsigned int) = delete; - SWBOOL(int) = delete; - SWBOOL(double) = delete; - SWBOOL(float) = delete; - SWBOOL(const void *) = delete; - SWBOOL& operator=(bool v) { value = v; return *this; } - SWBOOL& operator=(char v) = delete; - SWBOOL& operator=(signed char v) = delete; - SWBOOL& operator=(unsigned char v) = delete; - SWBOOL& operator=(signed short v) = delete; - SWBOOL& operator=(unsigned short v) = delete; - SWBOOL& operator=(signed int v) = delete; - SWBOOL& operator=(unsigned int v) = delete; - SWBOOL& operator=(float v) = delete; - SWBOOL& operator=(double v) = delete; - SWBOOL& operator=(const void *v) = delete; - operator bool() { return value; } - SWBOOL& operator |=(bool b) { value |= b; return*this; } - SWBOOL& operator|=(char v) = delete; - SWBOOL& operator|=(signed char v) = delete; - SWBOOL& operator|=(unsigned char v) = delete; - SWBOOL& operator|=(signed short v) = delete; - SWBOOL& operator|=(unsigned short v) = delete; - SWBOOL& operator|=(signed int v) = delete; - SWBOOL& operator|=(unsigned int v) = delete; - SWBOOL& operator|=(float v) = delete; - SWBOOL& operator|=(double v) = delete; - SWBOOL& operator|=(const void* v) = delete; -}; /* =========================== diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index f564a1841..3ac0f5f3c 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -54,7 +54,7 @@ gNET gNet; //Local multiplayer variables // should move this to a local scope of faketimerhandler - do it when able to test -SWBOOL CommEnabled = false; +bool CommEnabled = false; uint8_t CommPlayers = 0; double smoothratio; diff --git a/source/sw/src/network.h b/source/sw/src/network.h index 059bb90fd..c65d3aa09 100644 --- a/source/sw/src/network.h +++ b/source/sw/src/network.h @@ -29,12 +29,12 @@ BEGIN_SW_NS #define SYNC_TEST 0 #define MAXSYNCBYTES 16 -extern SWBOOL PredictionOn; +extern bool PredictionOn; extern PLAYER PredictPlayer; extern PLAYERp ppp; extern short predictangpos[]; extern int predictmovefifoplc; -extern SWBOOL Prediction; +extern bool Prediction; void InitPrediction(PLAYERp pp); void DoPrediction(PLAYERp ppp); @@ -61,12 +61,12 @@ typedef struct int32_t TimeLimit; int32_t TimeLimitClock; int16_t MultiGameType; // used to be a stand alone global - SWBOOL TeamPlay; - SWBOOL HurtTeammate; - SWBOOL SpawnMarkers; - SWBOOL AutoAim; - SWBOOL NoRespawn; // for commbat type games - SWBOOL Nuke; + bool TeamPlay; + bool HurtTeammate; + bool SpawnMarkers; + bool AutoAim; + bool NoRespawn; // for commbat type games + bool Nuke; } gNET,*gNETp; extern gNET gNet; diff --git a/source/sw/src/ninja.cpp b/source/sw/src/ninja.cpp index 0c80f6e12..2c75f5d07 100644 --- a/source/sw/src/ninja.cpp +++ b/source/sw/src/ninja.cpp @@ -2393,7 +2393,7 @@ InitPlayerSprite(PLAYERp pp) SPRITE *sp; USERp u; int pnum = pp - Player; - extern SWBOOL NewGame; + extern bool NewGame; COVER_SetReverb(0); // Turn off any echoing that may have been going before pp->Reverb = 0; diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index 4b4b881ce..c4772bd62 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -89,8 +89,8 @@ int DoBeginPanelJump(PANEL_SPRITEp psp); void SpawnHeartBlood(PANEL_SPRITEp psp); void SpawnUziShell(PANEL_SPRITEp psp); -SWBOOL pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); -SWBOOL pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); +bool pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); +bool pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); void pHotHeadOverlays(PANEL_SPRITEp psp, short mode); char UziRecoilYadj = 0; @@ -153,10 +153,10 @@ PANEL_SPRITEp pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pr return NULL; } -SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id) +bool pKillScreenSpiteIDs(PLAYERp pp, short id) { PANEL_SPRITEp psp=NULL, next; - SWBOOL found = false; + bool found = false; // Kill ALL sprites with the correct id TRAVERSE(&pp->PanelSpriteList, psp, next) @@ -238,8 +238,8 @@ void PlayerUpdateHealth(PLAYERp pp, short value) if (value < 0) { - SWBOOL IsChem = false; - SWBOOL NoArmor = false; + bool IsChem = false; + bool NoArmor = false; if (value <= -2000) { @@ -650,7 +650,7 @@ int WeaponOperate(PLAYERp pp) return 0; } -SWBOOL +bool WeaponOK(PLAYERp pp) { USERp u; @@ -1208,7 +1208,7 @@ pSwordHide(PANEL_SPRITEp psp) void pSwordRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_SwordHide)) return; @@ -1507,7 +1507,7 @@ pStarHide(PANEL_SPRITEp psp) void pStarRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_StarHide)) return; @@ -2331,8 +2331,8 @@ pUziHide(PANEL_SPRITEp psp) void pUziRest(PANEL_SPRITEp psp) { - char shooting; - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool shooting; + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); // If you have two uzi's, but one didn't come up, spawn it @@ -2666,7 +2666,7 @@ void pShotgunBobSetup(PANEL_SPRITEp psp); void pShotgunRecoilUp(PANEL_SPRITEp psp); void pShotgunRecoilDown(PANEL_SPRITEp psp); -SWBOOL pShotgunReloadTest(PANEL_SPRITEp psp); +bool pShotgunReloadTest(PANEL_SPRITEp psp); extern PANEL_STATE ps_ShotgunReload[]; @@ -2958,7 +2958,7 @@ pShotgunBobSetup(PANEL_SPRITEp psp) psp->bob_height_divider = 8; } -SWBOOL +bool pShotgunOverlays(PANEL_SPRITEp psp) { #define SHOTGUN_AUTO_XOFF 28 @@ -3019,7 +3019,7 @@ pShotgunHide(PANEL_SPRITEp psp) } #if 1 -SWBOOL +bool pShotgunReloadTest(PANEL_SPRITEp psp) { //short ammo = psp->PlayerP->WpnAmmo[psp->PlayerP->WeaponType]; @@ -3041,7 +3041,7 @@ pShotgunReloadTest(PANEL_SPRITEp psp) void pShotgunRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); //short ammo = psp->PlayerP->WpnAmmo[psp->PlayerP->WeaponType]; short ammo = psp->PlayerP->WpnAmmo[WPN_SHOTGUN]; char lastammo = psp->PlayerP->WpnShotgunLastShell; @@ -3090,7 +3090,7 @@ pShotgunRest(PANEL_SPRITEp psp) void pShotgunRestTest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (psp->PlayerP->WpnShotgunType == 1 && !pShotgunReloadTest(psp)) force = true; @@ -3172,7 +3172,7 @@ void pRailRecoilDown(PANEL_SPRITEp psp); void pRailBobSetup(PANEL_SPRITEp psp); -SWBOOL pRailReloadTest(PANEL_SPRITEp psp); +bool pRailReloadTest(PANEL_SPRITEp psp); #define Rail_BEAT_RATE 24 #define Rail_ACTION_RATE 3 // !JIM! Was 10 @@ -3453,7 +3453,7 @@ void pRailRest(PANEL_SPRITEp psp) { int InitLaserSight(PLAYERp pp); - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (SW_SHAREWARE) return; @@ -3488,7 +3488,7 @@ pRailRest(PANEL_SPRITEp psp) void pRailRestTest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_RailHide)) return; @@ -3868,7 +3868,7 @@ pHotheadHide(PANEL_SPRITEp psp) void pHotheadRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (SW_SHAREWARE) return; @@ -4343,7 +4343,7 @@ pMicroHide(PANEL_SPRITEp psp) } } -SWBOOL +bool pMicroOverlays(PANEL_SPRITEp psp) { #define MICRO_SIGHT_XOFF 29 @@ -4441,7 +4441,7 @@ void pMicroRest(PANEL_SPRITEp psp) { PLAYERp pp = psp->PlayerP; - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_MicroHide)) return; @@ -4783,7 +4783,7 @@ pHeartHide(PANEL_SPRITEp psp) void pHeartRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_HeartHide)) return; @@ -5371,7 +5371,7 @@ pGrenadeHide(PANEL_SPRITEp psp) void pGrenadeRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_GrenadeHide)) return; @@ -5620,7 +5620,7 @@ pMineHide(PANEL_SPRITEp psp) void pMineRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_MineHide)) return; @@ -6494,7 +6494,7 @@ pFistHide(PANEL_SPRITEp psp) void pFistRest(PANEL_SPRITEp psp) { - SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); + bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); if (pWeaponHideKeys(psp, ps_FistHide)) return; @@ -6601,7 +6601,7 @@ pWeaponForceRest(PLAYERp pp) pSetState(pp->CurWpn, pp->CurWpn->RestState); } -SWBOOL +bool pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { // initing the other weapon will take care of this @@ -6649,7 +6649,7 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) return false; } -SWBOOL +bool pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { if (TEST(psp->PlayerP->Flags, PF_DEAD)) @@ -6875,7 +6875,7 @@ pWeaponBob(PANEL_SPRITEp psp, short condition) // ////////////////////////////////////////////////////////////////////////////////////////// -SWBOOL DrawBeforeView = false; +bool DrawBeforeView = false; void pDisplaySprites(PLAYERp pp, double smoothratio) { diff --git a/source/sw/src/panel.h b/source/sw/src/panel.h index 0fcb98a35..ad6ad516d 100644 --- a/source/sw/src/panel.h +++ b/source/sw/src/panel.h @@ -185,7 +185,7 @@ enum BorderTypes PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, double x, double y); void pSetSuicide(PANEL_SPRITEp psp); -SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id); +bool pKillScreenSpiteIDs(PLAYERp pp, short id); void PreUpdatePanel(double smoothratio); void UpdatePanel(double smoothratio); void PlayerUpdateArmor(PLAYERp pp,short value); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index b288584f4..9ed83d99c 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -68,7 +68,7 @@ void pWeaponForceRest(PLAYERp pp); #define SO_DRIVE_SOUND 2 #define SO_IDLE_SOUND 1 -extern SWBOOL NoMeters; +extern bool NoMeters; #define TEST_UNDERWATER(pp) (TEST(sector[(pp)->cursectnum].extra, SECTFX_UNDERWATER)) @@ -80,7 +80,7 @@ extern SWBOOL NoMeters; USER puser[MAX_SW_PLAYERS_REG]; //int16_t gNet.MultiGameType = MULTI_GAME_NONE; -SWBOOL NightVision = false; +bool NightVision = false; extern int FinishAnim; @@ -118,7 +118,7 @@ extern int FinishAnim; char PlayerGravity = PLAYER_JUMP_GRAV; #endif -extern SWBOOL DebugOperate; +extern bool DebugOperate; enum { @@ -138,10 +138,10 @@ PLAYER Player[MAX_SW_PLAYERS_REG + 1]; short NormalVisibility; -int InitBloodSpray(int16_t SpriteNum, SWBOOL dogib, short velocity); +int InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity); SPRITEp FindNearSprite(SPRITEp sp, short stat); -SWBOOL PlayerOnLadder(PLAYERp pp); +bool PlayerOnLadder(PLAYERp pp); void DoPlayerSlide(PLAYERp pp); void DoPlayerBeginSwim(PLAYERp pp); void DoPlayerSwim(PLAYERp pp); @@ -171,10 +171,10 @@ void DoPlayerOperateTurret(PLAYERp pp); void DoPlayerBeginDive(PLAYERp pp); void DoPlayerDive(PLAYERp pp); void DoPlayerTeleportPause(PLAYERp pp); -SWBOOL PlayerFlyKey(void); +bool PlayerFlyKey(void); void OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy); void CheckFootPrints(PLAYERp pp); -SWBOOL DoPlayerTestCrawl(PLAYERp pp); +bool DoPlayerTestCrawl(PLAYERp pp); void DoPlayerDeathFlip(PLAYERp pp); void DoPlayerDeathCrumble(PLAYERp pp); void DoPlayerDeathExplode(PLAYERp pp); @@ -1175,7 +1175,7 @@ static int CompareTarget(void const * a, void const * b) return tgt2->weight - tgt1->weight; } -SWBOOL +bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte); @@ -2007,7 +2007,7 @@ UpdatePlayerUnderSprite(PLAYERp pp) short SpriteNum; int water_level_z, zdiff; - SWBOOL above_water, in_dive_area; + bool above_water, in_dive_area; if (Prediction) return; @@ -2318,7 +2318,7 @@ DoPlayerMove(PLAYERp pp) // turning and movement still get appropriately interpolated. // We do this from here instead of MovePlayer, covering the case // the player gets pushed by a wall (e.g., on the boat in level 5). - SWBOOL interpolate_ride = pp->sop_riding && (!cl_sointerpolation || CommEnabled); + bool interpolate_ride = pp->sop_riding && (!cl_sointerpolation || CommEnabled); void SlipSlope(PLAYERp pp); @@ -2687,7 +2687,7 @@ void DoTankTreads(PLAYERp pp) SECTORp *sectp; int j; int dot; - SWBOOL reverse = false; + bool reverse = false; if (Prediction) return; @@ -2973,7 +2973,7 @@ DoPlayerMoveVehicle(PLAYERp pp) int j,k; short startwall,endwall; - SWBOOL RectClip = !!TEST(sop->flags, SOBJ_RECT_CLIP); + bool RectClip = !!TEST(sop->flags, SOBJ_RECT_CLIP); if (Prediction) return; @@ -3618,7 +3618,7 @@ DoPlayerClimb(PLAYERp pp) int dot; short sec,wal,spr; int dist; - SWBOOL LadderUpdate = false; + bool LadderUpdate = false; if (Prediction) return; @@ -3873,9 +3873,9 @@ DoPlayerWadeSuperJump(PLAYERp pp) return false; } -SWBOOL PlayerFlyKey(void) +bool PlayerFlyKey(void) { - SWBOOL key = false; + bool key = false; if (!GodMode) return false; @@ -3908,7 +3908,7 @@ DoPlayerBeginCrawl(PLAYERp pp) NewStateGroup(pp->PlayerSprite, u->ActorActionSet->Crawl); } -SWBOOL PlayerFallTest(PLAYERp pp, int player_height) +bool PlayerFallTest(PLAYERp pp, int player_height) { // If the floor is far below you, fall hard instead of adjusting height if (labs(pp->posz - pp->loz) > player_height + PLAYER_FALL_HEIGHT) @@ -4089,7 +4089,7 @@ void PlayerWarpUpdatePos(PLAYERp pp) UpdatePlayerSprite(pp); } -SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit) +bool PlayerCeilingHit(PLAYERp pp, int zlimit) { if (pp->posz < zlimit) { @@ -4099,7 +4099,7 @@ SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit) return false; } -SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit) +bool PlayerFloorHit(PLAYERp pp, int zlimit) { if (pp->posz > zlimit) { @@ -4193,7 +4193,7 @@ FindNearSprite(SPRITEp sp, short stat) return near_fp; } -SWBOOL +bool PlayerOnLadder(PLAYERp pp) { short sec, wal, spr; @@ -4297,7 +4297,7 @@ PlayerOnLadder(PLAYERp pp) return true; } -SWBOOL DoPlayerTestCrawl(PLAYERp pp) +bool DoPlayerTestCrawl(PLAYERp pp) { if (labs(pp->loz - pp->hiz) < PLAYER_STANDING_ROOM) return true; @@ -5460,7 +5460,7 @@ void FindMainSector(SECTOR_OBJECTp sop) } } -void DoPlayerOperateMatch(PLAYERp pp, SWBOOL starting) +void DoPlayerOperateMatch(PLAYERp pp, bool starting) { SPRITEp sp; short i,nexti; @@ -6052,7 +6052,7 @@ void DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer) { int pnum; - SWBOOL SEND_OK = false; + bool SEND_OK = false; killer->KilledPlayer[pp-Player]++; @@ -6086,7 +6086,7 @@ DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer) void DoPlayerBeginDie(PLAYERp pp) { - extern SWBOOL ReloadPrompt; + extern bool ReloadPrompt; short bak; int choosesnd = 0; @@ -7299,7 +7299,7 @@ void MultiPlayLimits(void) { short pnum; PLAYERp pp; - SWBOOL Done = false; + bool Done = false; if (gNet.MultiGameType != MULTI_GAME_COMMBAT) return; @@ -7339,7 +7339,7 @@ void MultiPlayLimits(void) void PauseMultiPlay(void) { #if 0 - static SWBOOL SavePrediction; + static bool SavePrediction; PLAYERp pp; short pnum,p; @@ -7424,7 +7424,7 @@ domovethings(void) TRAVERSE_CONNECT(pnum) { extern short screenpeek; - extern SWBOOL PlayerTrackingMode; + extern bool PlayerTrackingMode; extern PLAYERp GlobPlayerP; pp = Player + pnum; @@ -7501,7 +7501,7 @@ InitAllPlayers(void) PLAYERp pp; PLAYERp pfirst = Player; int i; - extern SWBOOL NewGame; + extern bool NewGame; //int fz,cz; //getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz); @@ -7565,7 +7565,7 @@ int SearchSpawnPosition(PLAYERp pp) SPRITEp sp; short pos_num; short pnum,spawn_sprite; - SWBOOL blocked; + bool blocked; do { @@ -7599,7 +7599,7 @@ int SearchSpawnPosition(PLAYERp pp) return pos_num; } -SWBOOL SpawnPositionUsed[MAX_SW_PLAYERS_REG+1]; +bool SpawnPositionUsed[MAX_SW_PLAYERS_REG+1]; void PlayerSpawnPosition(PLAYERp pp) diff --git a/source/sw/src/predict.cpp b/source/sw/src/predict.cpp index 94864448b..991918a2c 100644 --- a/source/sw/src/predict.cpp +++ b/source/sw/src/predict.cpp @@ -36,8 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -SWBOOL PredictionOn = true; -SWBOOL Prediction = false; +bool PredictionOn = true; +bool Prediction = false; PLAYER PredictPlayer; USER PredictUser; PLAYERp ppp = &PredictPlayer; diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index e820827a9..9f4a31515 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -276,7 +276,7 @@ int SpawnQuake(short sectnum, int x, int y, int z, return SpriteNum; } -SWBOOL +bool SetQuake(PLAYERp pp, short tics, short amt) { SpawnQuake(pp->cursectnum, pp->posx, pp->posy, pp->posz, tics, amt, 30000); diff --git a/source/sw/src/ripper.cpp b/source/sw/src/ripper.cpp index 1525d8b46..0ebea3656 100644 --- a/source/sw/src/ripper.cpp +++ b/source/sw/src/ripper.cpp @@ -945,7 +945,7 @@ InitRipperHang(short SpriteNum) hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; - SWBOOL Found = false; + bool Found = false; short dang, tang; for (dang = 0; dang < 2048; dang += 128) diff --git a/source/sw/src/ripper2.cpp b/source/sw/src/ripper2.cpp index d5bd31a00..7a1297f10 100644 --- a/source/sw/src/ripper2.cpp +++ b/source/sw/src/ripper2.cpp @@ -945,7 +945,7 @@ InitRipper2Hang(short SpriteNum) hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; - SWBOOL Found = false; + bool Found = false; short dang, tang; for (dang = 0; dang < 2048; dang += 128) diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index 8037e3177..0a7f2c92f 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -53,7 +53,7 @@ typedef struct SAVE save; -SWBOOL FAF_DebugView = false; +bool FAF_DebugView = false; void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector) { @@ -86,7 +86,7 @@ int COVERinsertsprite(short sectnum, short stat) return spnum; } -SWBOOL +bool FAF_Sector(short sectnum) { short SpriteNum, Next; @@ -155,7 +155,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, int loz, hiz; short newsectnum = sectnum; int startclipmask = 0; - SWBOOL plax_found = false; + bool plax_found = false; if (clipmask == CLIPMASK_MISSILE) startclipmask = CLIPMASK_WARP_HITSCAN; @@ -264,7 +264,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, } } -SWBOOL +bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte) { @@ -274,7 +274,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, short ang; hitdata_t hitinfo; int dist; - SWBOOL plax_found = false; + bool plax_found = false; vec3_t s = { xs, ys, zs }; // ASSERT(sects >= 0 && secte >= 0); @@ -368,12 +368,12 @@ GetZadjustment(short sectnum, short hitag) return 0L; } -SWBOOL SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz) +bool SectorZadjust(int ceilhit, int32_t* hiz, short florhit, int32_t* loz) { extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; int z_amt = 0; - SWBOOL SkipFAFcheck = false; + bool SkipFAFcheck = false; if ((int)florhit != -1) { @@ -506,7 +506,7 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum, { int foo1; int foo2; - SWBOOL SkipFAFcheck; + bool SkipFAFcheck; // IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // This will return invalid FAF ceiling and floor heights inside of analyzesprite @@ -576,7 +576,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum, { int foo1; int foo2; - SWBOOL SkipFAFcheck; + bool SkipFAFcheck; // IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // This will return invalid FAF ceiling and floor heights inside of analyzesprite @@ -633,8 +633,8 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum, } // doesn't work for blank pics -SWBOOL -PicInView(short tile_num, SWBOOL reset) +bool +PicInView(short tile_num, bool reset) { if (TEST(gotpic[tile_num >> 3], 1 << (tile_num & 7))) { @@ -696,7 +696,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) // will not hurt if GlobStackSect is invalid - inside checks for this if (inside(x, y, GlobStackSect[i]) == 1) { - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_SECT(headspritesect[GlobStackSect[i]], SpriteNum, Next) { @@ -726,7 +726,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) { if (inside(x, y, (short) i) == 1) { - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_SECT(headspritesect[i], SpriteNum, Next) { @@ -795,7 +795,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower) } } -SWBOOL +bool FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) { int xoff = 0; @@ -882,7 +882,7 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum return true; } -SWBOOL +bool FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) { int xoff = 0; diff --git a/source/sw/src/rotator.cpp b/source/sw/src/rotator.cpp index 03f91e1b4..0a1257927 100644 --- a/source/sw/src/rotator.cpp +++ b/source/sw/src/rotator.cpp @@ -38,9 +38,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -short DoRotatorMatch(PLAYERp pp, short match, SWBOOL); -SWBOOL TestRotatorMatchActive(short match); -void InterpSectorSprites(short sectnum, SWBOOL state); +short DoRotatorMatch(PLAYERp pp, short match, bool); +bool TestRotatorMatchActive(short match); +void InterpSectorSprites(short sectnum, bool state); void DoMatchEverything(PLAYERp pp, short match, short state); void DoRotatorSetInterp(short SpriteNum); void DoRotatorStopInterp(short SpriteNum); @@ -73,12 +73,12 @@ void ReverseRotator(short SpriteNum) r->vel = -r->vel; } -SWBOOL +bool RotatorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -151,7 +151,7 @@ short DoRotatorOperate(PLAYERp pp, short sectnum) // called from switches and triggers // returns first vator found short -DoRotatorMatch(PLAYERp pp, short match, SWBOOL manual) +DoRotatorMatch(PLAYERp pp, short match, bool manual) { USERp fu; SPRITEp fsp; @@ -171,7 +171,7 @@ DoRotatorMatch(PLAYERp pp, short match, SWBOOL manual) fu = User[i]; // single play only vator - // SWBOOL 8 must be set for message to display + // bool 8 must be set for message to display if (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)) { if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXT_SPONLY")); @@ -230,7 +230,7 @@ DoRotatorMatch(PLAYERp pp, short match, SWBOOL manual) } -SWBOOL +bool TestRotatorMatchActive(short match) { USERp fu; @@ -315,7 +315,7 @@ int DoRotatorMove(short SpriteNum) int i, nexti; vec2_t nxy; int dist,closest; - SWBOOL kill = false; + bool kill = false; r = u->rotator; diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 435b817db..966e88595 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -70,16 +70,16 @@ extern int lastUpdate; extern char SaveGameDescr[10][80]; extern int PlayClock; extern short Bunny_Count; -extern SWBOOL NewGame; +extern bool NewGame; extern int GodMode; extern int FinishTimer; extern int FinishAnim; extern int GameVersion; //extern short Zombies; -extern SWBOOL serpwasseen; -extern SWBOOL sumowasseen; -extern SWBOOL zillawasseen; +extern bool serpwasseen; +extern bool sumowasseen; +extern bool zillawasseen; extern short BossSpriteNum[3]; #define PANEL_SAVE 1 @@ -641,7 +641,7 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) } -extern SWBOOL SavegameLoaded; +extern bool SavegameLoaded; bool GameInterface::LoadGame(FSaveGameNode* sv) { diff --git a/source/sw/src/scrip2.cpp b/source/sw/src/scrip2.cpp index 1776b4f78..924ce06c6 100644 --- a/source/sw/src/scrip2.cpp +++ b/source/sw/src/scrip2.cpp @@ -59,8 +59,8 @@ static char* script_p, * scriptend_p; static char token[MAXTOKEN]; static int grabbed; static int scriptline; -static SWBOOL endofscript; -static SWBOOL tokenready; // only true if UnGetToken was just called +static bool endofscript; +static bool tokenready; // only true if UnGetToken was just called /* ============== @@ -101,7 +101,7 @@ TArray LoadScriptFile(const char *filename) ============== */ -void GetToken(SWBOOL crossline) +void GetToken(bool crossline) { char *token_p; diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 05474d6e6..5a1603ad5 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -57,17 +57,17 @@ void DoPlayerBeginForceJump(PLAYERp); short FindNextSectorByTag(short sectnum, int tag); short LevelSecrets; -SWBOOL TestVatorMatchActive(short match); -SWBOOL TestSpikeMatchActive(short match); -SWBOOL TestRotatorMatchActive(short match); -SWBOOL TestSlidorMatchActive(short match); +bool TestVatorMatchActive(short match); +bool TestSpikeMatchActive(short match); +bool TestRotatorMatchActive(short match); +bool TestSlidorMatchActive(short match); int PlayerCheckDeath(PLAYERp, short); short DoVatorOperate(PLAYERp, short); short DoVatorMatch(PLAYERp pp, short match); short DoRotatorOperate(PLAYERp, short); -short DoRotatorMatch(PLAYERp pp, short match, SWBOOL); +short DoRotatorMatch(PLAYERp pp, short match, bool); short DoSlidorOperate(PLAYERp, short); -short DoSlidorMatch(PLAYERp pp, short match, SWBOOL); +short DoSlidorMatch(PLAYERp pp, short match, bool); void KillMatchingCrackSprites(short match); int DoTrapReset(short match); @@ -92,7 +92,7 @@ SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21]; SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; SPRING_BOARD SpringBoard[20]; -void SetSectorWallBits(short sectnum, int bit_mask, SWBOOL set_sectwall, SWBOOL set_nextwall) +void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_nextwall) { short wall_num, start_wall; @@ -1308,7 +1308,7 @@ DoStopSoundSpotMatch(short match) } -SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop) +bool TestKillSectorObject(SECTOR_OBJECTp sop) { if (TEST(sop->flags, SOBJ_KILLABLE)) { @@ -1341,7 +1341,7 @@ DoSectorObjectKillMatch(short match) } -SWBOOL +bool SearchExplodeSectorMatch(short match) { short i,nexti; @@ -1621,7 +1621,7 @@ void DoMatchEverything(PLAYERp pp, short match, short state) DoDeleteSpriteMatch(match); } -SWBOOL ComboSwitchTest(short combo_type, short match) +bool ComboSwitchTest(short combo_type, short match) { short i,nexti; SPRITEp sp; @@ -2303,7 +2303,7 @@ short PlayerTakeSectorDamage(PLAYERp pp) // Needed in order to see if Player should grunt if he can't find a wall to operate on // If player is too far away, don't grunt #define PLAYER_SOUNDEVENT_TAG 900 -SWBOOL NearThings(PLAYERp pp) +bool NearThings(PLAYERp pp) { short neartagsect, neartagwall, neartagsprite; int neartaghitdist; @@ -2561,7 +2561,7 @@ int DoPlayerGrabStar(PLAYERp pp) void PlayerOperateEnv(PLAYERp pp) { - SWBOOL found; + bool found; if (Prediction || !pp->SpriteP) return; @@ -3255,7 +3255,7 @@ void DoSector(void) { SECTOR_OBJECTp sop; - SWBOOL riding; + bool riding; int sync_flag; short pnum; int min_dist,dist,a,b,c; diff --git a/source/sw/src/sector.h b/source/sw/src/sector.h index d883924d4..8a3fc67e0 100644 --- a/source/sw/src/sector.h +++ b/source/sw/src/sector.h @@ -67,12 +67,12 @@ extern short nti_cnt; void DoSpawnSpotsForKill(short match); void DoSpawnSpotsForDamage(short match); void DoMatchEverything(PLAYERp pp, short match, short state); -SWBOOL ComboSwitchTest(short combo_type,short match); +bool ComboSwitchTest(short combo_type,short match); void DoSoundSpotStopSound(short match); void DoSector(void); short AnimateSwitch(SPRITEp sp,short tgt_value); void ShootableSwitch(short SpriteNum); -SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop); +bool TestKillSectorObject(SECTOR_OBJECTp sop); void WeaponExplodeSectorInRange(short weapon); void initlava(void); diff --git a/source/sw/src/skull.cpp b/source/sw/src/skull.cpp index 1c6209ef1..d15ecd1ca 100644 --- a/source/sw/src/skull.cpp +++ b/source/sw/src/skull.cpp @@ -39,7 +39,7 @@ int InitSpriteChemBomb(short SpriteNum); int InitFlashBomb(short SpriteNum); int InitCaltrops(short SpriteNum); int InitPhosphorus(int16_t SpriteNum); -SWBOOL SpriteOverlapZ(int16_t, int16_t, int); +bool SpriteOverlapZ(int16_t, int16_t, int); ////////////////////// // diff --git a/source/sw/src/slidor.cpp b/source/sw/src/slidor.cpp index 5c87f47ea..096ccc529 100644 --- a/source/sw/src/slidor.cpp +++ b/source/sw/src/slidor.cpp @@ -68,12 +68,12 @@ void ReverseSlidor(short SpriteNum) } -SWBOOL +bool SlidorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -147,7 +147,7 @@ short DoSlidorOperate(PLAYERp pp, short sectnum) // called from switches and triggers // returns first vator found short -DoSlidorMatch(PLAYERp pp, short match, SWBOOL manual) +DoSlidorMatch(PLAYERp pp, short match, bool manual) { USERp fu; SPRITEp fsp; @@ -167,7 +167,7 @@ DoSlidorMatch(PLAYERp pp, short match, SWBOOL manual) fu = User[i]; // single play only vator - // SWBOOL 8 must be set for message to display + // bool 8 must be set for message to display if (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)) { if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXTS_SPONLY")); @@ -226,7 +226,7 @@ DoSlidorMatch(PLAYERp pp, short match, SWBOOL manual) } -SWBOOL +bool TestSlidorMatchActive(short match) { USERp fu; @@ -538,7 +538,7 @@ int DoSlidorMove(short SpriteNum) SPRITEp sp = u->SpriteP; ROTATORp r; int old_pos; - SWBOOL kill = false; + bool kill = false; r = u->rotator; @@ -623,7 +623,7 @@ int DoSlidorMove(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 072d921e7..3837d6957 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -932,7 +932,7 @@ int PlayerYellVocs[] = // //========================================================================== -SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music. +bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music. { // Play CD audio if enabled. if (cdaudio_track >= 0 && (mus_redbook || *song_file_name == 0)) diff --git a/source/sw/src/sounds.h b/source/sw/src/sounds.h index 05a0d314a..5adda2407 100644 --- a/source/sw/src/sounds.h +++ b/source/sw/src/sounds.h @@ -86,7 +86,7 @@ void StopFX(void); void StopSound(void); void StartAmbientSound(void); void StopAmbientSound(void); -SWBOOL PlaySong(const char *mapname, const char *song_file_name, int cdaudio_track, bool isThemeTrack = false); //(nullptr, nullptr, -1, false) starts the normal level music. +bool PlaySong(const char *mapname, const char *song_file_name, int cdaudio_track, bool isThemeTrack = false); //(nullptr, nullptr, -1, false) starts the normal level music. void PlaySoundRTS(int rts_num); // @@ -170,8 +170,8 @@ struct VOC3Dstruct int tics; // Tics used to count to next sound occurance int maxtics; // Tics until next sound occurance // for intermittent sounds - SWBOOL deleted; // Has sound been marked for deletion? - SWBOOL FX_Ok; // Did this sound play ok? + bool deleted; // Has sound been marked for deletion? + bool FX_Ok; // Did this sound play ok? }; #endif diff --git a/source/sw/src/spike.cpp b/source/sw/src/spike.cpp index 3f7b8c149..700667fbd 100644 --- a/source/sw/src/spike.cpp +++ b/source/sw/src/spike.cpp @@ -36,9 +36,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS short DoSpikeMatch(short match); -SWBOOL TestSpikeMatchActive(short match); +bool TestSpikeMatchActive(short match); int DoVatorMove(short SpriteNum, int *lptr); -void InterpSectorSprites(short sectnum, SWBOOL state); +void InterpSectorSprites(short sectnum, bool state); void ReverseSpike(short SpriteNum) { @@ -72,12 +72,12 @@ void ReverseSpike(short SpriteNum) u->vel_rate = -u->vel_rate; } -SWBOOL +bool SpikeSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -210,7 +210,7 @@ DoSpikeMatch(short match) } -SWBOOL +bool TestSpikeMatchActive(short match) { USERp fu; @@ -397,7 +397,7 @@ int DoSpike(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index b31de4311..cf3dd6a8e 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -90,7 +90,7 @@ int DoSlidorInstantClose(short SpriteNum); void InitWeaponRocket(PLAYERp); void InitWeaponUzi(PLAYERp); -SWBOOL FAF_Sector(short sectnum); +bool FAF_Sector(short sectnum); int MoveSkip4, MoveSkip2, MoveSkip8; extern STATE s_CarryFlag[]; @@ -99,7 +99,7 @@ extern STATE s_CarryFlagNoDet[]; static int globhiz, globloz, globhihit, globlohit; short wait_active_check_offset; int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; -void SetSectorWallBits(short sectnum, int bit_mask, SWBOOL set_sectwall, SWBOOL set_nextwall); +void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_nextwall); int DoActorDebris(short SpriteNum); void ActorWarpUpdatePos(short SpriteNum,short sectnum); void ActorWarpType(SPRITEp sp, SPRITEp sp_warp); @@ -1036,7 +1036,7 @@ PicAnimOff(short picnum) RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK); } -SWBOOL +bool IconSpawn(SPRITEp sp) { // if multi item and not a modem game @@ -1049,7 +1049,7 @@ IconSpawn(SPRITEp sp) return true; } -SWBOOL +bool ActorTestSpawn(SPRITEp sp) { if (sp->statnum == STAT_DEFAULT && sp->lotag == TAG_SPAWN_ACTOR) @@ -1125,7 +1125,7 @@ void PreCacheSkull(void); void PreCacheBetty(void); void PreCachePachinko(void); -SWBOOL +bool ActorSpawn(SPRITEp sp) { bool ret = true; @@ -3810,9 +3810,9 @@ NUKE_REPLACEMENT: } } -SWBOOL ItemSpotClear(SPRITEp sip, short statnum, short id) +bool ItemSpotClear(SPRITEp sip, short statnum, short id) { - SWBOOL found = false; + bool found = false; short i,nexti; if (TEST_BOOL2(sip)) @@ -4649,7 +4649,7 @@ NewStateGroup(short SpriteNum, STATEp StateGroup[]) } -SWBOOL +bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) { SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b]; @@ -4690,7 +4690,7 @@ SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) } -SWBOOL +bool SpriteOverlapZ(int16_t spritenum_a, int16_t spritenum_b, int z_overlap) { SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b]; @@ -4926,7 +4926,7 @@ DoActorGlobZ(short SpriteNum) } -SWBOOL +bool ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_height) { SPRITEp sp = &sprite[SpriteNum]; @@ -4983,7 +4983,7 @@ ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_heig } // Primarily used in ai.c for now - need to get rid of -SWBOOL +bool DropAhead(short SpriteNum, short min_height) { @@ -5469,7 +5469,7 @@ void ChoosePlayerGetSound(PLAYERp pp) PlayerSound(PlayerGetItemVocs[choose_snd], v3df_follow|v3df_dontpan,pp); } -SWBOOL CanGetWeapon(PLAYERp pp, short SpriteNum, int WPN) +bool CanGetWeapon(PLAYERp pp, short SpriteNum, int WPN) { USERp u = User[SpriteNum]; @@ -5528,7 +5528,7 @@ DoGet(short SpriteNum) PLAYERp pp; short pnum, key_num; int dist, a,b,c; - SWBOOL can_see; + bool can_see; int cstat_bak; // For flag stuff @@ -5684,7 +5684,7 @@ KeyMain: case ICON_SM_MEDKIT: if (pu->Health < 100) { - SWBOOL putbackmax=false; + bool putbackmax=false; PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit)); diff --git a/source/sw/src/sprite.h b/source/sw/src/sprite.h index 4682a1226..ddb804936 100644 --- a/source/sw/src/sprite.h +++ b/source/sw/src/sprite.h @@ -43,8 +43,8 @@ short SpriteCanGoForward(short SpriteNum, short range); void SpriteFindNewDirection(short SpriteNum, short range); int DoWalk(short SpriteNum); int DoBody(short SpriteNum); -SWBOOL CanMoveHere(int16_t spritenum); -SWBOOL SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b); +bool CanMoveHere(int16_t spritenum); +bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b); int DoActorDie(short SpriteNum, short weapon); int DoGet(short SpriteNum); void SpriteControl(void); @@ -53,11 +53,11 @@ void DoActorZrange(short SpriteNum); void PreMapCombineFloors(void); void SpriteSetupPost(void); int ActorCoughItem(short SpriteNum); -SWBOOL ActorSpawn(SPRITEp sp); +bool ActorSpawn(SPRITEp sp); int SpawnItemsMatch(short match); void PicAnimOff(short picnum); int MissileWaterAdjust(short SpriteNum); -SWBOOL SpriteOverlapZ(int16_t spritenum_a,int16_t spritenum_b,int z_overlap); +bool SpriteOverlapZ(int16_t spritenum_a,int16_t spritenum_b,int z_overlap); enum { diff --git a/source/sw/src/sumo.cpp b/source/sw/src/sumo.cpp index c213835f1..0ef6e9a46 100644 --- a/source/sw/src/sumo.cpp +++ b/source/sw/src/sumo.cpp @@ -41,9 +41,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS extern uint8_t playTrack; -SWBOOL serpwasseen = false; -SWBOOL sumowasseen = false; -SWBOOL zillawasseen = false; +bool serpwasseen = false; +bool sumowasseen = false; +bool zillawasseen = false; short BossSpriteNum[3] = {-1,-1,-1}; @@ -816,10 +816,10 @@ BossHealthMeter(void) PLAYERp pp = Player + myconnectindex; short color=0,i=0,nexti,metertics,meterunit; int y; - extern SWBOOL NoMeters; + extern bool NoMeters; short health; - SWBOOL bosswasseen; - static SWBOOL triedplay = false; + bool bosswasseen; + static bool triedplay = false; if (NoMeters) return; diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 8af6f66df..934a8153b 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -726,8 +726,8 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) short sp_num, next_sp_num, startwall, endwall; int i, k, j; SPRITEp BoundSprite; - SWBOOL FoundOutsideLoop = false; - SWBOOL SectorInBounds; + bool FoundOutsideLoop = false; + bool SectorInBounds; SECTORp *sectp; USERp u = User[sop->sp_child - sprite]; @@ -1468,7 +1468,7 @@ void PlaceSectorObjectsOnTracks(void) { short i, j, k, startwall, endwall; - SWBOOL found; + bool found; // place each sector object on the track for (i = 0; i < MAX_SECTOR_OBJECTS; i++) @@ -1695,7 +1695,7 @@ MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny) WALLp wp; USERp u; short i, rot_ang; - SWBOOL PlayerMove = true; + bool PlayerMove = true; if (sop->xmid >= MAXSO) PlayerMove = false; @@ -1783,7 +1783,7 @@ PlayerPart: { #if 0 short nr, nextnr; - SWBOOL skip = true; + bool skip = true; TRAVERSE_SPRITE_STAT(headspritestat[STAT_NO_RIDE], nr, nextnr) { if (sprite[nr].lotag == sop - SectorObject) @@ -1943,7 +1943,7 @@ PlayerPart: } } -void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, SWBOOL dynamic) +void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, bool dynamic) { short wallcount = 0, j, k, startwall, endwall, delta_ang_from_orig; SECTORp *sectp; @@ -3136,7 +3136,7 @@ ScanToWall */ -SWBOOL +bool ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) { SPRITEp sp; diff --git a/source/sw/src/vator.cpp b/source/sw/src/vator.cpp index fe94d12ee..f95854637 100644 --- a/source/sw/src/vator.cpp +++ b/source/sw/src/vator.cpp @@ -41,9 +41,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS short DoVatorMatch(PLAYERp pp, short match); -SWBOOL TestVatorMatchActive(short match); -void InterpSectorSprites(short sectnum, SWBOOL state); -int InitBloodSpray(short, SWBOOL, short); +bool TestVatorMatchActive(short match); +void InterpSectorSprites(short sectnum, bool state); +int InitBloodSpray(short, bool, short); void ReverseVator(short SpriteNum) { @@ -77,12 +77,12 @@ void ReverseVator(short SpriteNum) u->vel_rate = -u->vel_rate; } -SWBOOL +bool VatorSwitch(short match, short setting) { SPRITEp sp; short i,nexti; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -161,7 +161,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum) sectnum = fsp->sectnum; // single play only vator - // SWBOOL 8 must be set for message to display + // bool 8 must be set for message to display if (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)) { if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp,"This only opens in single play."); @@ -236,7 +236,7 @@ DoVatorMatch(PLAYERp pp, short match) first_vator = i; // single play only vator - // SWBOOL 8 must be set for message to display + // bool 8 must be set for message to display if (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)) { if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXTS_SPONLY")); @@ -287,7 +287,7 @@ DoVatorMatch(PLAYERp pp, short match) } -SWBOOL +bool TestVatorMatchActive(short match) { USERp fu; @@ -315,7 +315,7 @@ TestVatorMatchActive(short match) return false; } -void InterpSectorSprites(short sectnum, SWBOOL state) +void InterpSectorSprites(short sectnum, bool state) { SPRITEp sp; short i,nexti; @@ -340,11 +340,11 @@ void InterpSectorSprites(short sectnum, SWBOOL state) } } -void MoveSpritesWithSector(short sectnum, int z_amt, SWBOOL type) +void MoveSpritesWithSector(short sectnum, int z_amt, bool type) { SPRITEp sp; short i,nexti; - SWBOOL both = false; + bool both = false; if (SectUser[sectnum]) both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH); @@ -538,7 +538,7 @@ int DoVator(short SpriteNum) int i,nexti; SPRITEp bsp; USERp bu; - SWBOOL found = false; + bool found = false; TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) { diff --git a/source/sw/src/wallmove.cpp b/source/sw/src/wallmove.cpp index ddff92fe0..7cd5d048e 100644 --- a/source/sw/src/wallmove.cpp +++ b/source/sw/src/wallmove.cpp @@ -86,9 +86,9 @@ int DoWallMove(SPRITEp sp) short shade1,shade2,ang,picnum1,picnum2; WALLp wallp; short prev_wall; - SWBOOL found = false; + bool found = false; short dang; - SWBOOL SOsprite = false; + bool SOsprite = false; dist = SP_TAG13(sp); ang = SP_TAG4(sp); @@ -162,10 +162,10 @@ int DoWallMove(SPRITEp sp) return found; } -SWBOOL CanSeeWallMove(SPRITEp wp, short match) +bool CanSeeWallMove(SPRITEp wp, short match) { short i,nexti; - SWBOOL found = false; + bool found = false; SPRITEp sp; TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE_CANSEE], i, nexti) @@ -193,7 +193,7 @@ int DoWallMoveMatch(short match) { SPRITEp sp; short i,nexti; - SWBOOL found = false; + bool found = false; // just all with the same matching tags TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti) diff --git a/source/sw/src/warp.cpp b/source/sw/src/warp.cpp index 63f2e1950..c069344b3 100644 --- a/source/sw/src/warp.cpp +++ b/source/sw/src/warp.cpp @@ -38,9 +38,9 @@ BEGIN_SW_NS // //////////////////////////////////////////////////////////////////////////////// -extern SWBOOL Prediction; +extern bool Prediction; -SWBOOL +bool WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor) { int i,nexti; @@ -210,7 +210,7 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum // //////////////////////////////////////////////////////////////////////////////// -SWBOOL +bool WarpSectorInfo(short sectnum, SPRITEp *sp_warp) { int i,nexti; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index a9e1491c9..77871091e 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -68,7 +68,7 @@ DAMAGE_DATA DamageData[] = short ADJUST=120; FOOT_TYPE FootMode=WATER_FOOT; -SWBOOL left_foot = false; +bool left_foot = false; int FinishTimer = 0; // This is how many bullet shells have been spawned since the beginning of the game. @@ -89,7 +89,7 @@ short LoWangsQueueHead=0; short LoWangsQueue[MAX_LOWANGS_QUEUE]; int SpawnBreakStaticFlames(short); -SWBOOL GlobalSkipZrange = false; +bool GlobalSkipZrange = false; int WeaponIsAmmo = BIT(WPN_STAR) | BIT(WPN_SWORD) | BIT(WPN_MINE) | BIT(WPN_FIST); @@ -103,13 +103,13 @@ ANIMATOR DoShrapJumpFall; ANIMATOR DoFastShrapJumpFall; int SpawnSmokePuff(short SpriteNum); -SWBOOL WarpToUnderwater(short *sectnum, int *x, int *y, int *z); -SWBOOL WarpToSurface(short *sectnum, int *x, int *y, int *z); +bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z); +bool WarpToSurface(short *sectnum, int *x, int *y, int *z); short ElectroFindClosestEnemy(short SpriteNum); int InitElectroJump(SPRITEp wp, SPRITEp sp); -SWBOOL TestDontStickSector(short hit_sect); +bool TestDontStickSector(short hit_sect); int SpawnShrapX(short SpriteNum); -SWBOOL WeaponMoveHit(short SpriteNum); +bool WeaponMoveHit(short SpriteNum); int HelpMissileLateral(int16_t Weapon, int dist); void SpawnMidSplash(short SpriteNum); @@ -2644,7 +2644,7 @@ STATE s_PaperShrapC[] = }; #if 1 -SWBOOL MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) +bool MissileHitMatch(short Weapon, short WeaponNum, short hit_sprite) { SPRITEp hsp = &sprite[hit_sprite]; @@ -2763,7 +2763,7 @@ int DoLavaErupt(short SpriteNum) short i,nexti,pnum; PLAYERp pp; SPRITEp tsp; - SWBOOL found = false; + bool found = false; if (TEST_BOOL1(sp)) { @@ -4366,14 +4366,14 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i } -SWBOOL +bool VehicleMoveHit(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp cp; SECTOR_OBJECTp sop; SECTOR_OBJECTp hsop; - SWBOOL TestKillSectorObject(SECTOR_OBJECTp); + bool TestKillSectorObject(SECTOR_OBJECTp); short controller; if (!u->ret) @@ -4473,7 +4473,7 @@ VehicleMoveHit(short SpriteNum) } -SWBOOL +bool WeaponMoveHit(short SpriteNum) { USERp u = User[SpriteNum]; @@ -4762,7 +4762,7 @@ DoFireballFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum],ap; USERp u = User[SpriteNum]; - SWBOOL jumping = false; + bool jumping = false; // if no owner then stay where you are if (u->Attach >= 0) @@ -4859,7 +4859,7 @@ DoBreakFlames(short SpriteNum) { SPRITEp sp = &sprite[SpriteNum]; USERp u = User[SpriteNum]; - SWBOOL jumping = false; + bool jumping = false; if (TEST(u->Flags, SPR_JUMPING)) { @@ -5439,7 +5439,7 @@ SopDamage(SECTOR_OBJECTp sop, short amt) int SopCheckKill(SECTOR_OBJECTp sop) { - SWBOOL killed = false; + bool killed = false; if (TEST(sop->flags, SOBJ_BROKEN)) return false; @@ -5792,7 +5792,7 @@ PlayerCheckDeath(PLAYERp pp, short Weapon) return false; } -SWBOOL +bool PlayerTakeDamage(PLAYERp pp, short Weapon) { if (Weapon < 0) @@ -8076,7 +8076,7 @@ DoStar(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; short hit_sect = NORM_SECTOR(u->ret); if (sp->z > DIV2(u->hiz + u->loz)) @@ -8846,7 +8846,7 @@ void WallBounce(short SpriteNum, short ang) } -SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall) +bool SlopeBounce(short SpriteNum, bool *hit_wall) { USERp u = User[SpriteNum]; SPRITEp sp = u->SpriteP; @@ -9028,7 +9028,7 @@ DoGrenade(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { if (did_hit_wall) @@ -9251,7 +9251,7 @@ DoVulcanBoulder(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { @@ -9322,7 +9322,7 @@ DoVulcanBoulder(int16_t Weapon) return false; } -SWBOOL +bool OwnerIsPlayer(short Weapon) { SPRITEp sp = &sprite[Weapon]; @@ -9346,7 +9346,7 @@ DoMineRangeTest(short Weapon, short range) unsigned stat; int dist, tx, ty; int tmin; - SWBOOL ownerisplayer = false; + bool ownerisplayer = false; ownerisplayer = OwnerIsPlayer(Weapon); @@ -11396,7 +11396,7 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop) USERp eu; short explosion; unsigned sn; - SWBOOL smallflames = false; + bool smallflames = false; if (Weapon < 0) { @@ -12668,7 +12668,7 @@ DoMirv(int16_t Weapon) return false; } -SWBOOL +bool MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) { SPRITEp wp = &sprite[Weapon]; @@ -12714,7 +12714,7 @@ MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) return retval; } -SWBOOL +bool TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) { SPRITEp wp = &sprite[Weapon]; @@ -14284,7 +14284,7 @@ InitMiniSumoClap(short SpriteNum) } int -WeaponAutoAim(SPRITEp sp, short Missile, short ang, SWBOOL test) +WeaponAutoAim(SPRITEp sp, short Missile, short ang, bool test) { USERp wu = User[Missile]; USERp u = User[sp - sprite]; @@ -14354,7 +14354,7 @@ WeaponAutoAim(SPRITEp sp, short Missile, short ang, SWBOOL test) } int -WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, SWBOOL test) +WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, bool test) { USERp wu = User[Missile]; USERp u = User[sp - sprite]; @@ -14482,7 +14482,7 @@ AimHitscanToTarget(SPRITEp sp, int *z, short *ang, int z_ratio) } int -WeaponAutoAimHitscan(SPRITEp sp, int *z, short *ang, SWBOOL test) +WeaponAutoAimHitscan(SPRITEp sp, int *z, short *ang, bool test) { USERp u = User[sp - sprite]; short hit_sprite = -1; @@ -16081,7 +16081,7 @@ InitSerpSlash(short SpriteNum) return 0; } -SWBOOL +bool WallSpriteInsideSprite(SPRITEp wsp, SPRITEp sp) { int x1, y1, x2, y2; @@ -17730,7 +17730,7 @@ int SpawnWallHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_ return SpriteNum; } -SWBOOL +bool HitscanSpriteAdjust(short SpriteNum, short hit_wall) { SPRITEp sp = &sprite[SpriteNum]; @@ -17788,7 +17788,7 @@ InitUzi(PLAYERp pp) //static char alternate=0; static int uziclock=0; int clockdiff=0; - SWBOOL FireSnd = false; + bool FireSnd = false; #define UZIFIRE_WAIT 20 void InitUziShell(PLAYERp); @@ -18648,7 +18648,7 @@ InitSobjGun(PLAYERp pp) { short i; SPRITEp sp; - SWBOOL first = false; + bool first = false; for (i = 0; pp->sop->sp_num[i] != -1; i++) { @@ -19252,7 +19252,7 @@ InitGrenade(PLAYERp pp) short w; short oclipdist; int zvel; - SWBOOL auto_aim = false; + bool auto_aim = false; DoPlayerBeginRecoil(pp, GRENADE_RECOIL_AMT); @@ -19755,7 +19755,7 @@ InitEnemyFireball(short SpriteNum) // for hitscans or other uses /////////////////////////////////////////////////////////////////////////////// -SWBOOL +bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z) { short i, nexti; @@ -19827,7 +19827,7 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) return true; } -SWBOOL +bool WarpToSurface(short *sectnum, int *x, int *y, int *z) { short i, nexti; @@ -19899,7 +19899,7 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) } -SWBOOL +bool SpriteWarpToUnderwater(SPRITEp sp) { USERp u = User[sp - sprite]; @@ -19977,7 +19977,7 @@ SpriteWarpToUnderwater(SPRITEp sp) return true; } -SWBOOL +bool SpriteWarpToSurface(SPRITEp sp) { USERp u = User[sp - sprite]; @@ -20172,7 +20172,7 @@ SpawnUnderSplash(short SpriteNum) return 0; } -SWBOOL +bool MissileHitDiveArea(short SpriteNum) { USERp u = User[SpriteNum]; @@ -20499,7 +20499,7 @@ void QueueReset(void) LoWangsQueue[i] = -1; } -SWBOOL TestDontStick(short SpriteNum, short hit_wall) +bool TestDontStick(short SpriteNum, short hit_wall) { WALLp wp; @@ -20522,7 +20522,7 @@ SWBOOL TestDontStick(short SpriteNum, short hit_wall) return false; } -SWBOOL TestDontStickSector(short hit_sect) +bool TestDontStickSector(short hit_sect) { if (TEST(sector[hit_sect].extra, SECTFX_DYNAMIC_AREA|SECTFX_SECTOR_OBJECT)) return true; @@ -20718,7 +20718,7 @@ int QueueFootPrint(short hit_sprite) USERp u = User[hit_sprite]; USERp nu; short rnd_num=0; - SWBOOL Found=false; + bool Found=false; SECTORp sectp = §or[hsp->sectnum]; @@ -21235,7 +21235,7 @@ DoShrapVelocity(int16_t SpriteNum) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(SpriteNum, &did_hit_wall)) { @@ -21469,7 +21469,7 @@ ShrapKillSprite(short SpriteNum) return 0; } -SWBOOL CheckBreakToughness(BREAK_INFOp break_info, short ID) +bool CheckBreakToughness(BREAK_INFOp break_info, short ID) { ////DSPRINTF(ds,"CheckBreakToughness called with %d",ID); //CON_Message(ds); diff --git a/source/sw/src/weapon.h b/source/sw/src/weapon.h index 968491c9c..0d096ddb6 100644 --- a/source/sw/src/weapon.h +++ b/source/sw/src/weapon.h @@ -71,8 +71,8 @@ SECTOR_OBJECTp DetectSectorObjectByWall(WALLp); void ScaleSpriteVector(short SpriteNum, int scale); int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z); int QueueWallBlood(short hit_sprite, short ang); -SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall); -SWBOOL HitscanSpriteAdjust(short SpriteNum, short hit_wall); +bool SlopeBounce(short SpriteNum, bool *hit_wall); +bool HitscanSpriteAdjust(short SpriteNum, short hit_wall); int SpawnSwordSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang); int SpawnBubble(short SpriteNum); int SpawnFireballExp(int16_t Weapon); @@ -82,7 +82,7 @@ int SpawnGrenadeExp(int16_t Weapon); int SpawnSectorExp(int16_t Weapon); int DoShrapVelocity(int16_t SpriteNum); int ShrapKillSprite(short SpriteNum); -SWBOOL MissileSetPos(short Weapon,ANIMATORp DoWeapon,int dist); +bool MissileSetPos(short Weapon,ANIMATORp DoWeapon,int dist); int ActorPain(short SpriteNum); int SpawnBreakFlames(int16_t SpriteNum); const char *DeathString(short SpriteNum); @@ -154,12 +154,12 @@ extern int WeaponIsAmmo; extern short target_ang; -SWBOOL SpriteOverlap(short, short); +bool SpriteOverlap(short, short); int SpawnShotgunSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang); int DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec); int GetOverlapSector(int x, int y, short *over, short *under); -SWBOOL MissileHitDiveArea(short SpriteNum); +bool MissileHitDiveArea(short SpriteNum); int DoDamageTest(short); @@ -178,7 +178,7 @@ void WallBounce(short SpriteNum, short ang); int PlayerInitChemBomb(PLAYERp pp); int InitChemBomb(short SpriteNum); int PlayerInitCaltrops(PLAYERp pp); -int InitBloodSpray(int16_t SpriteNum, SWBOOL dogib, short velocity); +int InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity); int SpawnBunnyExp(int16_t Weapon); int InitBunnyRocket(PLAYERp pp); @@ -221,9 +221,9 @@ int HelpMissileLateral(int16_t Weapon,int dist); int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop); void QueueReset(void); int PlayerCheckDeath(PLAYERp pp,short Weapon); -SWBOOL SpriteWarpToUnderwater(SPRITEp sp); +bool SpriteWarpToUnderwater(SPRITEp sp); int PlayerDamageSlide(PLAYERp pp,short damage,short ang); -SWBOOL VehicleMoveHit(short SpriteNum); +bool VehicleMoveHit(short SpriteNum); int SpawnSplash(short SpriteNum); int SpawnMineExp(int16_t Weapon); int SpawnLittleExp(int16_t Weapon); @@ -232,7 +232,7 @@ int SpawnNuclearExp(int16_t Weapon); int SpawnBoltExp(int16_t Weapon); int SpawnTracerExp(int16_t Weapon); int SpawnGoroFireballExp(int16_t Weapon); -SWBOOL MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite); +bool MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite); int DoItemFly(int16_t SpriteNum); int SpawnVehicleSmoke(short SpriteNum); short PrevWall(short wall_num); From be6e0d87d706d9e981f42bc8220b540e0e6aac73 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 10 Sep 2020 19:56:13 +1000 Subject: [PATCH 46/49] Revert "- SW: Attempt at making vehicle movement work nicely while uninterpolated." This reverts commit 28a3ef131ffcc85733162d2a78d770aedfafa346. I mostly added this to visualise an attempt at how I've attempted to make the vehicles work with unsynchronised input. I don't wish for this to be committed to the main branch as it's a net negative. --- source/sw/src/interpso.cpp | 17 ++++++++--------- source/sw/src/player.cpp | 16 ++-------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index ecb9d9e8c..0926f7ce5 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -191,11 +191,6 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics) interp->lasttic = locktics; } -static inline bool so_nointerpolations(short track) -{ - return !cl_syncinput && (track >= SO_TURRET_MGUN && track <= SO_VEHICLE); -} - void so_updateinterpolations(void) // Stick at beginning of domovethings { int32_t i; @@ -207,7 +202,8 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; if (interp->tic < interp->lasttic) interp->tic += synctics; @@ -245,7 +241,8 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; for (i = 0; i < interp->numinterpolations; i++) @@ -271,7 +268,8 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; // Check if interpolation has been explicitly disabled @@ -331,7 +329,8 @@ void so_restoreinterpolations(void) // Stick at end of drawscree for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) { - if (SO_EMPTY(sop) || so_nointerpolations(sop->track)) + bool skip = !cl_syncinput && (sop->track == SO_TURRET); + if (SO_EMPTY(sop) || skip) continue; for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 9ed83d99c..297967f07 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1669,11 +1669,6 @@ DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } - - if (!cl_syncinput) - { - OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio), pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio)); - } } void @@ -3049,10 +3044,7 @@ DoPlayerMoveVehicle(PLAYERp pp) } save_sectnum = pp->cursectnum; - if (cl_syncinput) - { - OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO); - } + OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO); pp->cursectnum = pp->sop->op_main_sector; // for speed floor_dist = labs(z - pp->sop->floor_loz); @@ -3156,11 +3148,7 @@ DoPlayerMoveVehicle(PLAYERp pp) } } - if (cl_syncinput) - { - OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); - } - + OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed if (!cl_syncinput) From 3df0d40312477156c5dc515f2643ae1c71d19bf1 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 10 Sep 2020 20:26:19 +1000 Subject: [PATCH 47/49] - SW: Fix stupid issue with `playerSetAngle()` and tweak how `angTarget`/`horizTarget` is determined to have been met. --- source/sw/src/input.cpp | 4 ++-- source/sw/src/player.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index e2b09d8f7..c3fb1bb47 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -289,7 +289,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool fixed_t horizDelta = pp->horizTarget - pp->q16horiz; pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta); - if (abs(pp->q16horiz) >= abs(horizDelta)) + if (abs(pp->q16horiz - pp->horizTarget) < FRACUNIT) { pp->q16horiz = pp->horizTarget; pp->horizTarget = 0; @@ -310,7 +310,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool fixed_t angDelta = GetDeltaQ16Angle(pp->angTarget, pp->q16ang); pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * angDelta)); - if (pp->q16ang >= pp->angTarget) + if (abs(pp->q16ang - pp->angTarget) < FRACUNIT) { pp->q16ang = pp->angTarget; pp->angTarget = 0; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 297967f07..52e429a0d 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7817,7 +7817,7 @@ void playerSetAngle(PLAYERp pp, double ang) ang += 0.1; } - pp->angTarget = pp->q16ang + GetDeltaQ16Angle(ang, pp->q16ang); + pp->angTarget = pp->q16ang + GetDeltaQ16Angle(FloatToFixed(ang), pp->q16ang); } else { From 19fd0331d401a4e8fd4a3425e916193c968d0297 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 10 Sep 2020 20:47:41 +1000 Subject: [PATCH 48/49] - SW: Interpolate vehicle sector objects for now, until something better can be determined. --- source/sw/src/draw.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 6fc63412a..6878b74cc 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1649,9 +1649,10 @@ drawscreen(PLAYERp pp, double smoothratio) tx = camerapp->oposx + xs_CRoundToInt(fmulscale16(camerapp->posx - camerapp->oposx, smoothratio)); ty = camerapp->oposy + xs_CRoundToInt(fmulscale16(camerapp->posy - camerapp->oposy, smoothratio)); tz = camerapp->oposz + xs_CRoundToInt(fmulscale16(camerapp->posz - camerapp->oposz, smoothratio)); - // TODO: It'd be better to check pp->input.q16angvel instead, problem is that - // it's been repurposed for the q16ang diff while tying input to framerate - if (cl_syncinput || pp != Player+myconnectindex) + + // Interpolate the player's angle while on a sector object, just like VoidSW. + // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. + if (cl_syncinput || pp != Player+myconnectindex || (!cl_syncinput && pp->sop && !TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET))) { tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16ang + IntToFixed(1024) - camerapp->oq16ang) - IntToFixed(1024), smoothratio)); tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio)); From baeea5bf3cc17c54852dd4cdaa03b2350bcb6261 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 10 Sep 2020 23:12:51 +1000 Subject: [PATCH 49/49] - SW: Fix angle speed while walking on sector objects like the bus in Seppuku Station. * `playerSetAngle()` is too rigid since it continually sets angle until target reached, causing sluggish input. We only need to add a delta here. --- source/sw/src/track.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 934a8153b..76e0fa8eb 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1678,7 +1678,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - playerSetAngle(pp, FixedToFloat(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng))); + playerAddAngle(pp, GetDeltaQ16Angle(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng), pp->q16ang)); UpdatePlayerSprite(pp); }