diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index e772e65d9..776675dcf 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 87eb3ddb2..a54d92bba 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -50,10 +50,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(); @@ -65,9 +64,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; @@ -145,26 +142,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)); inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048); inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048); @@ -193,9 +190,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/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/core/d_net.cpp b/source/core/d_net.cpp index 7863f21f6..e94b68c45 100644 --- a/source/core/d_net.cpp +++ b/source/core/d_net.cpp @@ -1021,8 +1021,6 @@ void NetUpdate (void) int fvel = 0; int64_t q16avel = 0; int64_t q16horz = 0; - int64_t q16horiz = 0; // only used by SW - int64_t q16ang = 0; // 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/gamestruct.h b/source/core/gamestruct.h index 3f01c8c5d..67a8226d8 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; @@ -92,7 +93,7 @@ struct GameInterface virtual FString GetCoordString() { return "'stat coord' not implemented"; } virtual void ExitFromMenu() { throw CExitEvent(0); } virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 0 }; } - 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 12c8e1d7e..6eeea8c2d 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -47,30 +47,32 @@ ESyncBits ActionsToSend = 0; static int dpad_lock = 0; bool sendPause; +static double lastCheck; + //========================================================================== // // // //========================================================================== -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 +177,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 +190,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; } //--------------------------------------------------------------------------- @@ -333,40 +337,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; @@ -405,3 +409,18 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo *info) } +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 e4d5db410..61ff83fa8 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 @@ -100,5 +100,6 @@ enum GameFunction_t }; void SetupGameButtons(); -void ApplyGlobalInput(InputPacket& input, ControlInfo *info); -extern ESyncBits ActionsToSend; \ No newline at end of file +void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput); +extern ESyncBits ActionsToSend; +double InputScale(); diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 8b855b711..b4070011f 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -117,7 +117,7 @@ void DoLoadGame(const char* name); 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]; } @@ -511,7 +511,7 @@ void TryRunTics (void) if (!cl_syncinput) { I_GetEvent(); - gi->GetInput(nullptr); + gi->GetInput(nullptr, &CONTROL_GetInput()); } return; } 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/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 49589816a..cc8574e1d 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 805c5bd47..0e2af7cf3 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -98,12 +98,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; @@ -121,7 +117,7 @@ void PlayerInterruptKeys(bool after) if (!after) { localInput = {}; - ApplyGlobalInput(localInput, &info); + ApplyGlobalInput(localInput, hidInput); if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN; } @@ -140,26 +136,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)) { @@ -294,9 +290,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 cb746b163..1dbd230e8 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -50,7 +50,7 @@ struct GameInterface : public ::GameInterface void ExitFromMenu() override; ReservedSpace GetReservedScreenSpace(int viewsize) override; void DrawPlayerSprite(const DVector2& origin, bool onteam) 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 b34e775ec..c1242ae2c 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -520,9 +520,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) @@ -587,7 +587,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); @@ -597,20 +597,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)) { @@ -865,9 +865,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); @@ -983,18 +983,10 @@ 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]; - 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 = {}; @@ -1006,16 +998,14 @@ static void GetInputInternal(InputPacket &locInput) setlocalplayerinput(p); } - double scaleAdjust = !cl_syncinput ? elapsedInputTicks * REALGAMETICSPERSEC / 1000.0 : 1; - ControlInfo info; - CONTROL_GetInput(&info); + double const scaleAdjust = InputScale(); 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) @@ -1025,8 +1015,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); } @@ -1046,9 +1036,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/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..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,11 +114,11 @@ void DebugMoveHit(short SpriteNum) } -SWBOOL ActorMoveHitReact(short SpriteNum) +bool 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,11 +157,11 @@ SWBOOL ActorMoveHitReact(short SpriteNum) } } - return FALSE; + return false; } -SWBOOL ActorFlaming(short SpriteNum) +bool ActorFlaming(short SpriteNum) { USERp u = User[SpriteNum]; SPRITEp sp = User[SpriteNum]->SpriteP; @@ -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]) { @@ -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; @@ -318,12 +317,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 +332,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 +357,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 +372,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 +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) @@ -454,7 +453,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]; @@ -475,12 +474,12 @@ 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; u->tgt_sp = pp->SpriteP; - found = TRUE; + found = true; } } @@ -553,13 +552,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 +578,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 +591,7 @@ int DoActorOperate(short SpriteNum) if (nearsector >= 0 && nearhitdist < 1024) { - if (OperateSector(nearsector, FALSE)) + if (OperateSector(nearsector, false)) { u->WaitTics = 2 * 120; @@ -602,14 +601,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 +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 @@ -794,7 +793,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/ai.h b/source/sw/src/ai.h index 582a03c60..73cee9eb1 100644 --- a/source/sw/src/ai.h +++ b/source/sw/src/ai.h @@ -71,12 +71,12 @@ 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); -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/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 2fe297922..ed7f70a86 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,10 +657,10 @@ 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) +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; - short ret = FALSE; + bool 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,21 +810,21 @@ 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 -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; 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,26 +1021,26 @@ int AutoBreakSprite(short BreakSprite, short type) RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); } - return FALSE; + 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 // 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/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 a74cc3740..f3ac162a9 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; @@ -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); @@ -931,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) { @@ -965,7 +964,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 +976,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 +994,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 +1006,7 @@ DoBunnyQuickJump(short SpriteNum) Bunny_Count--; // Bunny died u->lo_sp = NULL; - return TRUE; + return true; } } } @@ -1020,11 +1019,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 +1031,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 +1040,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 +1090,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 +1214,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 +1393,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/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 a43cb1914..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); @@ -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"); @@ -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 6d1d193b1..6878b74cc 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -58,11 +58,11 @@ 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; +static int OverlapDraw = false; +extern bool QuitFlag, SpriteInfo; +extern bool Voxel; extern char buffer[]; -SWBOOL DrawScreen; +bool DrawScreen; extern short f_c; extern ParentalStruct aVoxelArray[MAXTILES]; @@ -253,7 +253,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp) break; default: - ASSERT(TRUE == FALSE); + ASSERT(true == false); break; } @@ -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,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; + 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)) { pal = PALETTE_DEFAULT; - nosectpal = TRUE; + nosectpal = true; } //if(tu->spal == PALETTE_DEFAULT) @@ -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; } @@ -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]) { @@ -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,16 +1601,15 @@ 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); +bool PicInView(short, bool); void DoPlayerDiveMeter(PLAYERp pp); -void MoveScrollMode2D(PLAYERp pp); void drawscreen(PLAYERp pp, double smoothratio) { - extern SWBOOL CameraTestMode; + extern bool CameraTestMode; int tx, ty, tz; fixed_t tq16horiz, tq16ang; short tsectnum; @@ -1618,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 @@ -1627,7 +1626,7 @@ drawscreen(PLAYERp pp, double smoothratio) int const viewingRange = viewingrange; - DrawScreen = TRUE; + DrawScreen = true; PreDraw(); PreUpdatePanel(smoothratio); @@ -1650,23 +1649,18 @@ 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) || - (TEST(pp->Flags, PF_DEAD) && (loc.q16avel == 0))) + + // 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)); } - 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; @@ -1706,7 +1700,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) { @@ -1736,7 +1730,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)); } @@ -1750,9 +1744,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) { @@ -1766,7 +1760,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(); @@ -1819,7 +1813,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; } @@ -1855,19 +1849,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; } @@ -1904,7 +1898,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..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; -SWBOOL FinishAnim = 0; -SWBOOL ReloadPrompt = false; -SWBOOL NewGame = false; -SWBOOL SavegameLoaded = false; +bool NoMeters = false; +int FinishAnim = 0; +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; @@ -116,20 +116,19 @@ 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; -SWBOOL PlayerTrackingMode = false; -SWBOOL SlowMode = false; -SWBOOL FrameAdvanceTics = 3; +bool PlayerTrackingMode = false; +bool SlowMode = false; -SWBOOL DebugOperate = false; +bool DebugOperate = false; void LoadingLevelScreen(void); uint8_t FakeMultiNumPlayers; @@ -138,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; @@ -175,7 +174,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) @@ -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 5e0be8d02..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 @@ -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)) @@ -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); /////////////////////////////////////////////////////////////////////////////////////////// // @@ -803,11 +803,9 @@ enum }; -extern InputPacket loc; - #define PACK 1 -extern SWBOOL CameraTestMode; +extern bool CameraTestMode; enum PlayerDeathTypes { @@ -865,7 +863,7 @@ struct PLAYERstruct int slide_xvect, slide_yvect; short slide_ang; int slide_dec; - int drive_angvel; + int drive_q16avel; @@ -879,17 +877,15 @@ 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; - bool centering; fixed_t q16horiz, q16horizbase, q16horizoff, q16ang; - fixed_t camq16horiz, camq16ang; short recoil_amt; short recoil_speed; short recoil_ndx; - short recoil_horizoff; + fixed_t recoil_horizoff; int oldposx,oldposy,oldposz; int RevolveX, RevolveY; @@ -958,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; @@ -984,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. @@ -995,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 @@ -1010,6 +1006,14 @@ struct PLAYERstruct int cookieTime; char WpnReloadState; + + // Input helper variables and setters. + double horizAdjust, angAdjust, pitchAdjust; + 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)); } + void sethoriz(int v) { q16horiz = IntToFixed(v); } }; extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; @@ -1021,39 +1025,41 @@ 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 processMovement() + PF2_INPUT_CAN_TURN_GENERAL = (BIT(2)), // Allow calling DoPlayerTurn() from processMovement() + PF2_INPUT_CAN_TURN_VEHICLE = (BIT(3)), // Allow calling DoPlayerTurnVehicle() from processMovement() + PF2_INPUT_CAN_TURN_TURRET = (BIT(4)), // Allow calling DoPlayerTurnTurret() from processMovement() }; /////////////////////////////////////////////////////////////////////////////////////////// @@ -1285,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 @@ -1824,8 +1830,8 @@ 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_SPEED_BOAT 99 +#define SO_VEHICLE 98 +// #define SO_SPEED_BOAT 99 #define SO_EMPTY(sop) ((sop)->xmid == INT32_MAX) @@ -1920,18 +1926,18 @@ 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); 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 @@ -1942,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, @@ -1985,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; @@ -2038,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 @@ -2059,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; @@ -2094,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 @@ -2116,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 @@ -2136,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 @@ -2166,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; @@ -2202,7 +2208,7 @@ struct GameInterface : ::GameInterface void QuitToTitle() 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/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 886429cd5..c3fb1bb47 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -34,13 +34,13 @@ 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 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 DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel); -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; +static int32_t turnheldtime; void InitNetVars(void) @@ -59,62 +59,29 @@ InitTimingVars(void) } - -static void getinput(InputPacket *loc) +enum { - int i; - PLAYERp pp = Player + myconnectindex; - PLAYERp newpp = Player + myconnectindex; + TURBOTURNTIME = (120 / 8), + NORMALTURN = (12 + 6), + RUNTURN = (28), + PREAMBLETURN = 3, + NORMALKEYMOVE = 35, + MAXFVEL = ((NORMALKEYMOVE * 2) + 10), + MAXSVEL = ((NORMALKEYMOVE * 2) + 10), + MAXANGVEL = 100, + MAXHORIZVEL = 128 +}; -#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))) +//--------------------------------------------------------------------------- +// +// handles the input bits +// +//--------------------------------------------------------------------------- - static int32_t turnheldtime; - int32_t momx, momy; - - extern SWBOOL MenuButtonAutoAim; - - if (Prediction && CommEnabled) - { - newpp = ppp; - } - - static double lastInputTicks; - - auto const currentHiTicks = I_msTimeF(); - elapsedInputTicks = currentHiTicks - lastInputTicks; - - lastInputTicks = currentHiTicks; - - ControlInfo info; - CONTROL_GetInput(&info); - - if (paused) - return; - - 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; - - ApplyGlobalInput(*loc, &info); - - bool mouseaim = !(loc->actions & SB_AIMMODE); +static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput, bool* mouseaim) +{ + ApplyGlobalInput(loc, hidInput); + *mouseaim = !(loc.actions & SB_AIMMODE); if (!CommEnabled) { @@ -132,142 +99,26 @@ static void getinput(InputPacket *loc) 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 (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) { - if (pp->sop_control) - turnamount = RUNTURN * 3; - else - turnamount = RUNTURN; - - keymove = NORMALKEYMOVE << 1; + // this shares a bit with another function so cannot be in the common code. + loc.actions |= SB_CROUCH_LOCK; } - else +} + +//--------------------------------------------------------------------------- +// +// handles movement +// +//--------------------------------------------------------------------------- + +static void processWeapon(PLAYERp const pp) +{ + USERp u = User[pp->PlayerSprite]; + int i; + + if (loc.getNewWeapon() == WeaponSel_Next) { - if (pp->sop_control) - turnamount = NORMALTURN * 3; - else - turnamount = NORMALTURN; - - keymove = NORMALKEYMOVE; - } - - int32_t svel = 0, vel = 0; - fixed_t q16horz = 0, q16angvel = 0; - - if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) - { - svel -= (info.mousex * ticrateScale) * 4.f; - svel -= info.dyaw * keymove; - } - else - { - q16angvel += FloatToFixed((info.mousex / angvelScale) + scaleAdjustmentToInterval((info.dyaw * ticrateScale) / angvelScale)); - } - - if (mouseaim) - q16horz -= FloatToFixed(info.mousey / aimvelScale); - else - vel -= (info.mousey * ticrateScale) * 8.f; - - if (in_mouseflip) - q16horz = -q16horz; - - q16horz -= FloatToFixed(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale)); - svel -= info.dx * keymove; - vel -= info.dz * keymove; - - if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) - { - if (buttonMap.ButtonDown(gamefunc_Turn_Left)) - svel -= -keymove; - if (buttonMap.ButtonDown(gamefunc_Turn_Right)) - svel -= keymove; - } - else - { - 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(scaleAdjustmentToInterval((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(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)); - } - else - { - turnheldtime = 0; - } - } - - if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop) - svel += keymove; - - if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) - svel += -keymove; - - if (buttonMap.ButtonDown(gamefunc_Move_Forward)) - { - vel += keymove; - } - - if (buttonMap.ButtonDown(gamefunc_Move_Backward)) - vel += -keymove; - - q16angvel = clamp(q16angvel, -IntToFixed(MAXANGVEL), IntToFixed(MAXANGVEL)); - q16horz = clamp(q16horz, -IntToFixed(MAXHORIZVEL), IntToFixed(MAXHORIZVEL)); - - void DoPlayerTeleportPause(PLAYERp pp); - if (cl_syncinput) - { - q16angvel = q16angvel; - q16horz = q16horz; - } - else - { - fixed_t prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz; - - if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN)) - DoPlayerTurn(pp, &pp->camq16ang, q16angvel); - if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) - DoPlayerHorizon(pp, &pp->camq16horiz, q16horz); - pp->oq16ang += pp->camq16ang - prevcamq16ang; - pp->oq16horiz += pp->camq16horiz - prevcamq16horiz; - } - - loc->fvel = clamp(loc->fvel + vel, -MAXVEL, MAXVEL); - loc->svel = clamp(loc->svel + svel, -MAXSVEL, MAXSVEL); - - 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; @@ -283,7 +134,7 @@ static void getinput(InputPacket *loc) else { next_weapon = -1; - for (i = start_weapon; TRUE; i++) + for (i = start_weapon; true; i++) { if (i >= MAX_WEAPONS_KEYS) { @@ -299,9 +150,9 @@ static void getinput(InputPacket *loc) } } - 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; @@ -320,7 +171,7 @@ static void getinput(InputPacket *loc) else { prev_weapon = -1; - for (i = start_weapon; TRUE; i--) + for (i = start_weapon; true; i--) { if (i <= -1) i = WPN_HEART; @@ -332,32 +183,186 @@ static void getinput(InputPacket *loc) } } } - 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) +//--------------------------------------------------------------------------- +// +// handles movement +// +//--------------------------------------------------------------------------- + +static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool const mouseaim) { - getinput(&loc); + 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 (loc.actions & SB_RUN) + { + turnamount = pp->sop_control ? RUNTURN * 3 : RUNTURN; + keymove = NORMALKEYMOVE << 1; + } + else + { + turnamount = pp->sop_control ? NORMALTURN * 3 : NORMALTURN; + keymove = NORMALKEYMOVE; + } + + if (strafeKey) + { + svel -= xs_CRoundToInt(hidInput->mousex * 4.); + svel -= hidInput->dyaw * keymove; + } + else + { + q16avel += FloatToFixed(hidInput->mousex + (scaleAdjust * hidInput->dyaw)); + } + + if (mouseaim) + q16horz -= FloatToFixed(hidInput->mousey); + else + fvel -= xs_CRoundToInt(hidInput->mousey * 8.); + + if (in_mouseflip) + q16horz = -q16horz; + + q16horz -= FloatToFixed(scaleAdjust * hidInput->dpitch); + svel -= hidInput->dx * keymove; + fvel -= hidInput->dz * keymove; + + if (strafeKey) + { + if (buttonMap.ButtonDown(gamefunc_Turn_Left)) + svel += keymove; + if (buttonMap.ButtonDown(gamefunc_Turn_Right)) + svel -= keymove; + } + else + { + if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && pp->sop)) + { + turnheldtime += synctics; + q16avel -= FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); + } + else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && pp->sop)) + { + turnheldtime += synctics; + q16avel += FloatToFixed(scaleAdjust * (turnheldtime >= TURBOTURNTIME ? turnamount : PREAMBLETURN)); + } + else + { + turnheldtime = 0; + } + } + + if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop) + svel += keymove; + + if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop) + svel -= keymove; + + if (buttonMap.ButtonDown(gamefunc_Move_Forward)) + fvel += keymove; + + if (buttonMap.ButtonDown(gamefunc_Move_Backward)) + fvel -= keymove; + + if (!cl_syncinput) + { + if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM)) + { + DoPlayerHorizon(pp, q16horz, scaleAdjust); + } + + if (pp->horizTarget) + { + fixed_t horizDelta = pp->horizTarget - pp->q16horiz; + pp->q16horiz += xs_CRoundToInt(scaleAdjust * horizDelta); + + if (abs(pp->q16horiz - pp->horizTarget) < FRACUNIT) + { + pp->q16horiz = pp->horizTarget; + pp->horizTarget = 0; + } + } + else if (pp->horizAdjust) + { + pp->q16horiz += FloatToFixed(scaleAdjust * pp->horizAdjust); + } + + if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) + { + DoPlayerTurn(pp, q16avel, scaleAdjust); + } + + if (pp->angTarget) + { + fixed_t angDelta = GetDeltaQ16Angle(pp->angTarget, pp->q16ang); + pp->q16ang = (pp->q16ang + xs_CRoundToInt(scaleAdjust * angDelta)); + + if (abs(pp->q16ang - pp->angTarget) < FRACUNIT) + { + 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_TURN_TURRET)) + { + DoPlayerTurnTurret(pp, q16avel); + } + } + + loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL); + loc.svel = clamp(loc.svel + svel, -MAXSVEL, MAXSVEL); + + 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) +{ + if (paused || M_Active()) + { + loc = {}; + return; + } + + PLAYERp pp = &Player[myconnectindex]; + bool mouseaim; + + processInputBits(pp, hidInput, &mouseaim); + processMovement(pp, hidInput, mouseaim); + processWeapon(pp); + if (packet) { - PLAYERp pp = &Player[myconnectindex]; + auto const ang = FixedToInt(pp->q16ang); - auto fvel = loc.fvel; - auto svel = loc.svel; - auto ang = FixedToInt(pp->q16ang); - - 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)]); + loc = {}; } } diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index b587de082..0926f7ce5 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) @@ -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++) { @@ -197,12 +197,13 @@ 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++) { - 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++) @@ -339,12 +343,12 @@ 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; so_interp *interp; - SWBOOL saveisshot = FALSE; + int saveisshot = 0; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) @@ -362,14 +366,14 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil) return saveisshot; } -int LoadSymDataInfo(MFILE_READ fil, void **ptr); +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; so_interp *interp; - SWBOOL saveisshot = FALSE; + int saveisshot = 0; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) 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/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..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,13 +288,13 @@ 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 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; + bool 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; + bool bIsWallMirror = false; int camclock = I_GetBuildTime(); camloopcnt += camclock - lastcamclock; @@ -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) @@ -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; + bool 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; + bool 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/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 e85f0d4b4..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) @@ -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; } @@ -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)) { @@ -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; } @@ -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)) { @@ -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; @@ -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)) { @@ -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) @@ -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]; @@ -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..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; @@ -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/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 a9835ff39..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 cff21d0dd..49cb8fca9 100644 --- a/source/sw/src/mytypes.h +++ b/source/sw/src/mytypes.h @@ -34,7 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define OFF 0 #define ON 1 -typedef unsigned char SWBOOL; /* =========================== diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 6e39d2570..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 cfa0a53c4..2c75f5d07 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; @@ -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; @@ -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/osdcmds.cpp b/source/sw/src/osdcmds.cpp index d3a655314..c83f51c97 100644 --- a/source/sw/src/osdcmds.cpp +++ b/source/sw/src/osdcmds.cpp @@ -59,12 +59,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/panel.cpp b/source/sw/src/panel.cpp index 022b989a2..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) @@ -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; + bool IsChem = false; + bool 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); @@ -456,10 +456,10 @@ 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: + // case SO_SPEED_BOAT: if (!TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) break; @@ -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]) @@ -650,7 +650,7 @@ int WeaponOperate(PLAYERp pp) return 0; } -SWBOOL +bool WeaponOK(PLAYERp pp) { USERp u; @@ -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; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -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 @@ -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); @@ -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 @@ -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[] = @@ -3019,7 +3019,7 @@ pShotgunHide(PANEL_SPRITEp psp) } #if 1 -SWBOOL +bool pShotgunReloadTest(PANEL_SPRITEp psp) { //short ammo = psp->PlayerP->WpnAmmo[psp->PlayerP->WeaponType]; @@ -3031,17 +3031,17 @@ 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 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; @@ -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); @@ -3090,10 +3090,10 @@ 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; + force = true; if (pShotgunReloadTest(psp)) return; @@ -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; @@ -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 @@ -4343,7 +4343,7 @@ pMicroHide(PANEL_SPRITEp psp) } } -SWBOOL +bool pMicroOverlays(PANEL_SPRITEp psp) { #define MICRO_SIGHT_XOFF 29 @@ -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[] = @@ -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; @@ -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); } @@ -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,13 +6601,13 @@ 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 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,28 +6642,28 @@ 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 +bool pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) { if (TEST(psp->PlayerP->Flags, PF_DEAD)) { 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; +bool 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/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 e385c062a..52e429a0d 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,13 +80,10 @@ extern SWBOOL NoMeters; USER puser[MAX_SW_PLAYERS_REG]; //int16_t gNet.MultiGameType = MULTI_GAME_NONE; -SWBOOL NightVision = FALSE; -extern SWBOOL FinishAnim; +bool NightVision = false; +extern int 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 @@ -121,7 +118,13 @@ extern SWBOOL FinishAnim; char PlayerGravity = PLAYER_JUMP_GRAV; #endif -extern SWBOOL DebugOperate; +extern bool DebugOperate; + +enum +{ + TURN_SHIFT = 2, + HORIZ_SPEED = 16 +}; //unsigned char synctics, lastsynctics; @@ -135,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); @@ -159,19 +162,19 @@ void DoPlayerBeginClimb(PLAYERp pp); void DoPlayerClimb(PLAYERp pp); void DoPlayerBeginDie(PLAYERp pp); void DoPlayerDie(PLAYERp pp); -void DoPlayerBeginOperateBoat(PLAYERp pp); -void DoPlayerBeginOperateTank(PLAYERp pp); +// void DoPlayerBeginOperateBoat(PLAYERp pp); +void DoPlayerBeginOperateVehicle(PLAYERp pp); void DoPlayerBeginOperate(PLAYERp pp); -void DoPlayerOperateBoat(PLAYERp pp); -void DoPlayerOperateTank(PLAYERp pp); +// void DoPlayerOperateBoat(PLAYERp pp); +void DoPlayerOperateVehicle(PLAYERp pp); 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); @@ -1172,12 +1175,12 @@ 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); 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 @@ -1306,7 +1309,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); } @@ -1338,8 +1341,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; @@ -1542,48 +1544,25 @@ 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 const q16avel, double const scaleAdjust) { -#define TURN_SHIFT 2 - - 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; - } - 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(scaleAdjustmentToInterval(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); } @@ -1596,213 +1575,170 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel) 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(scaleAdjustmentToInterval(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); } } } +#if 0 void -DoPlayerTurnBoat(PLAYERp pp) +DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel) { - int angvel; - int angslide; 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(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->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } +#endif void -DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) +DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) { - int angvel; SECTOR_OBJECTp sop = pp->sop; if (sop->drive_angspeed) { - int angslide; + fixed_t drive_oq16avel = pp->drive_q16avel; + pp->drive_q16avel = (mulscale16(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(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->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } } void -DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) +DoPlayerTurnVehicleRect(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->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel)); + pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF; sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang); } } } void -DoPlayerTurnTurret(PLAYERp pp) +DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel) { - int angvel; - short new_ang; - short diff; + fixed_t new_ang, diff; SECTOR_OBJECTp sop = pp->sop; - 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 (sop->drive_angspeed) { - int angslide; + fixed_t drive_oq16avel = pp->drive_q16avel; + pp->drive_q16avel = (mulscale16(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(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->camq16ang = pp->q16ang = IntToFixed(new_ang); + 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) @@ -1824,7 +1760,7 @@ void SlipSlope(PLAYERp pp) } void -PlayerAutoLook(PLAYERp pp) +PlayerAutoLook(PLAYERp pp, double const scaleAdjust) { int x,y,k,j; short tempsect; @@ -1834,8 +1770,9 @@ PlayerAutoLook(PLAYERp pp) 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); @@ -1851,78 +1788,41 @@ PlayerAutoLook(PLAYERp pp) // 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(scaleAdjustmentToInterval(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(scaleAdjustmentToInterval(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(scaleAdjustmentToInterval(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(scaleAdjustmentToInterval(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) +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 (!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; - } - // Fixme: This should probably be made optional. if (cl_slopetilting) - PlayerAutoLook(pp); + PlayerAutoLook(pp, scaleAdjust); if (q16horz) { @@ -1930,104 +1830,61 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) 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(scaleAdjustmentToInterval((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 = 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(scaleAdjustmentToInterval((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(scaleAdjustmentToInterval((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(scaleAdjustmentToInterval(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(scaleAdjustmentToInterval(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(scaleAdjustmentToInterval(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)); @@ -2039,16 +1896,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz) 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 @@ -2103,17 +1951,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_TURN|PF2_INPUT_CAN_AIM); pp->recoil_amt = pix_amt; pp->recoil_speed = 80; pp->recoil_ndx = 0; pp->recoil_horizoff = 0; -#endif } void @@ -2130,7 +1973,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; } @@ -2159,7 +2002,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; @@ -2427,7 +2270,7 @@ void PlayerCheckValidMove(PLAYERp pp) // if stuck here for more than 10 seconds if (count++ > 40 * 10) { - ASSERT(TRUE == FALSE); + ASSERT(true == false); } } } @@ -2470,13 +2313,20 @@ 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); SlipSlope(pp); - DoPlayerTurn(pp, &pp->q16ang, pp->input.q16avel); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL); + } + else + { + DoPlayerTurn(pp, pp->input.q16avel, 1); + } pp->oldposx = pp->posx; pp->oldposy = pp->posy; @@ -2597,7 +2447,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)) { @@ -2731,6 +2588,7 @@ void StopSOsound(short sectnum) } } +#if 0 void DoPlayerMoveBoat(PLAYERp pp) { @@ -2750,7 +2608,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); @@ -2798,8 +2663,16 @@ 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); + } } +#endif void DoTankTreads(PLAYERp pp) { @@ -2809,7 +2682,7 @@ void DoTankTreads(PLAYERp pp) SECTORp *sectp; int j; int dot; - SWBOOL reverse = FALSE; + bool reverse = false; if (Prediction) return; @@ -2817,7 +2690,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++) { @@ -3077,7 +2950,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) } void -DoPlayerMoveTank(PLAYERp pp) +DoPlayerMoveVehicle(PLAYERp pp) { int z; int floor_dist; @@ -3095,7 +2968,7 @@ DoPlayerMoveTank(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; @@ -3185,7 +3058,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); @@ -3233,7 +3106,14 @@ DoPlayerMoveTank(PLAYERp pp) } else { - DoPlayerTurnTank(pp, z, floor_dist); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE); + } + else + { + DoPlayerTurnVehicle(pp, pp->input.q16avel, z, floor_dist); + } save_cstat = pp->SpriteP->cstat; RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK); @@ -3271,7 +3151,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); } @@ -3279,16 +3166,36 @@ DoPlayerMoveTank(PLAYERp pp) void DoPlayerMoveTurret(PLAYERp pp) { - DoPlayerTurnTurret(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); + } + 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, &pp->q16horiz, pp->input.q16horz); + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_AIM); + } + else + { + DoPlayerHorizon(pp, pp->input.q16horz, 1); + } } void @@ -3300,7 +3207,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_TURN|PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_JUMP_FLOOR_DIST; pp->ceiling_dist = PLAYER_JUMP_CEILING_DIST; @@ -3330,7 +3236,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_TURN|PF2_INPUT_CAN_AIM); pp->JumpDuration = MAX_JUMP_DURATION; pp->DoPlayerAction = DoPlayerForceJump; @@ -3481,7 +3386,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_TURN|PF2_INPUT_CAN_AIM); pp->floor_dist = PLAYER_FALL_FLOOR_DIST; pp->ceiling_dist = PLAYER_FALL_CEILING_DIST; @@ -3678,7 +3582,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; @@ -3703,7 +3606,7 @@ DoPlayerClimb(PLAYERp pp) int dot; short sec,wal,spr; int dist; - SWBOOL LadderUpdate = FALSE; + bool LadderUpdate = false; if (Prediction) return; @@ -3865,18 +3768,25 @@ 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)) { 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) @@ -3911,7 +3821,7 @@ DoPlayerClimb(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle); + playerSetAngle(pp, pp->LadderAngle); } } } @@ -3926,7 +3836,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++) { @@ -3943,20 +3853,20 @@ 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) +bool PlayerFlyKey(void) { - SWBOOL key = false; + bool key = false; if (!GodMode) - return FALSE; + return false; #if 0 // Cheat or not, this simply won't do. @@ -3975,7 +3885,6 @@ 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); pp->friction = PLAYER_CRAWL_FRICTION; pp->floor_dist = PLAYER_CRAWL_FLOOR_DIST; @@ -3987,7 +3896,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) @@ -3998,15 +3907,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 @@ -4131,7 +4040,6 @@ 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); pp->friction = PLAYER_FLY_FRICTION; pp->floor_dist = PLAYER_RUN_FLOOR_DIST; @@ -4169,24 +4077,24 @@ void PlayerWarpUpdatePos(PLAYERp pp) UpdatePlayerSprite(pp); } -SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit) +bool PlayerCeilingHit(PLAYERp pp, int zlimit) { if (pp->posz < zlimit) { - return TRUE; + return true; } - return FALSE; + return false; } -SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit) +bool PlayerFloorHit(PLAYERp pp, int zlimit) { if (pp->posz > zlimit) { - return TRUE; + return true; } - return FALSE; + return false; } void @@ -4273,7 +4181,7 @@ FindNearSprite(SPRITEp sp, short stat) return near_fp; } -SWBOOL +bool PlayerOnLadder(PLAYERp pp) { short sec, wal, spr; @@ -4292,7 +4200,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, @@ -4301,10 +4209,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++) { @@ -4313,7 +4221,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)], @@ -4330,14 +4238,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; } } @@ -4345,7 +4253,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 @@ -4372,17 +4280,17 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle); + playerSetAngle(pp, pp->LadderAngle); - return TRUE; + return true; } -SWBOOL DoPlayerTestCrawl(PLAYERp pp) +bool DoPlayerTestCrawl(PLAYERp pp) { if (labs(pp->loz - pp->hiz) < PLAYER_STANDING_ROOM) - return TRUE; + return true; - return FALSE; + return false; } int @@ -4399,22 +4307,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) @@ -4430,18 +4338,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) @@ -4463,12 +4371,12 @@ PlayerCanDiveNoWarp(PLAYERp pp) PlaySound(DIGI_SPLASH1, pp, v3df_dontpan); DoPlayerBeginDiveNoWarp(pp); - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -4636,7 +4544,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) @@ -4652,13 +4560,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) @@ -4669,12 +4577,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; @@ -4713,7 +4621,7 @@ DoPlayerWarpToSurface(PLAYERp pp) short over, under; SPRITEp under_sp = NULL, over_sp = NULL; - char Found = FALSE; + bool Found = false; if (Prediction) return; @@ -4727,13 +4635,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) @@ -4744,12 +4652,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; @@ -4815,10 +4723,9 @@ 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); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -4867,7 +4774,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) { @@ -4884,7 +4791,6 @@ void DoPlayerBeginDiveNoWarp(PLAYERp pp) } SET(pp->Flags, PF_DIVING); - SET(pp->Flags2, PF2_INPUT_CAN_TURN|PF2_INPUT_CAN_AIM); DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -5197,10 +5103,10 @@ DoPlayerTestPlaxDeath(PLAYERp pp) { PlayerUpdateHealth(pp, -u->Health); PlayerCheckDeath(pp, -1); - return TRUE; + return true; } - return FALSE; + return false; } void @@ -5291,7 +5197,6 @@ 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); pp->friction = PLAYER_WADE_FRICTION; pp->floor_dist = PLAYER_WADE_FLOOR_DIST; @@ -5454,6 +5359,7 @@ DoPlayerWade(PLAYERp pp) } +#if 0 void DoPlayerBeginOperateBoat(PLAYERp pp) { @@ -5473,15 +5379,16 @@ DoPlayerBeginOperateBoat(PLAYERp pp) NewStateGroup(pp->PlayerSprite, u->ActorActionSet->Run); } +#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)) @@ -5541,7 +5448,7 @@ void FindMainSector(SECTOR_OBJECTp sop) } } -void DoPlayerOperateMatch(PLAYERp pp, SWBOOL starting) +void DoPlayerOperateMatch(PLAYERp pp, bool starting) { SPRITEp sp; short i,nexti; @@ -5612,7 +5519,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->sop = pp->sop_control = sop; sop->controller = pp->SpriteP; - pp->camq16ang = pp->q16ang = IntToFixed(sop->ang); + playerSetAngle(pp, sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5621,7 +5528,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++) @@ -5637,13 +5544,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: @@ -5654,6 +5561,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); @@ -5662,6 +5570,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateBoat(pp); break; +#endif default: return; } @@ -5697,7 +5606,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) save_sectnum = pp->cursectnum; - pp->camq16ang = pp->q16ang = IntToFixed(sop->ang); + playerSetAngle(pp, sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5706,7 +5615,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++) @@ -5725,13 +5634,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: @@ -5742,6 +5651,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); @@ -5750,6 +5660,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) pp->posz = fz - PLAYER_HEIGHT; DoPlayerBeginOperateBoat(pp); break; +#endif default: return; } @@ -5820,15 +5731,15 @@ 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) { 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 = gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy); } if (pp->sop_control) @@ -5882,6 +5793,7 @@ DoPlayerOperateTurret(PLAYERp pp) } +#if 0 void DoPlayerOperateBoat(PLAYERp pp) { @@ -5920,9 +5832,10 @@ DoPlayerOperateBoat(PLAYERp pp) PlayerRemoteReset(pp, save_sectnum); } } +#endif void -DoPlayerOperateTank(PLAYERp pp) +DoPlayerOperateVehicle(PLAYERp pp) { short save_sectnum; @@ -5951,7 +5864,7 @@ DoPlayerOperateTank(PLAYERp pp) if (pp->sop_remote) RemoteToPlayer(pp); - DoPlayerMoveTank(pp); + DoPlayerMoveVehicle(pp); if (pp->sop_remote) { @@ -6127,21 +6040,21 @@ void DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer) { int pnum; - SWBOOL SEND_OK = FALSE; + bool 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) @@ -6161,7 +6074,7 @@ DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer) void DoPlayerBeginDie(PLAYERp pp) { - extern SWBOOL ReloadPrompt; + extern bool ReloadPrompt; short bak; int choosesnd = 0; @@ -6188,10 +6101,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 @@ -6334,7 +6243,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: @@ -6349,9 +6258,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: @@ -6367,7 +6276,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; } @@ -6377,25 +6286,18 @@ 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 (pp->q16horiz <= IntToFixed(target)) - pp->q16horiz = IntToFixed(target); + if ((pp->q16horiz - IntToFixed(target)) > FRACUNIT) + { + playerAddHoriz(pp, -speed); } - if (pp->q16horiz < IntToFixed(target)) + if ((IntToFixed(target) - pp->q16horiz) > FRACUNIT) { - pp->q16horiz += IntToFixed(speed); - if (pp->q16horiz >= IntToFixed(target)) - pp->q16horiz = IntToFixed(target); + playerAddHoriz(pp, speed); } - - pp->camq16horiz = pp->q16horiz; - return pp->q16horiz == IntToFixed(target); } int @@ -6473,27 +6375,25 @@ 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); - return; + { + if (!cl_syncinput) + { + SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL); + } + else + { + DoPlayerTurn(pp, pp->input.q16avel, 1); + } } // follow what killed you if its available 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->camq16ang = pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4)); + playerAddAngle(pp, GetDeltaQ16Angle(gethiq16angle(kp->x - pp->posx, kp->y - pp->posy), pp->q16ang) / (double)(FRACUNIT << 4)); } } } @@ -6515,9 +6415,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); @@ -6550,7 +6450,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); @@ -6560,7 +6460,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp) videoFadePalette(0,0,0,0); } - pp->NightVision = FALSE; + pp->NightVision = false; pp->FadeAmt = 0; DoPlayerDivePalette(pp); DoPlayerNightVisionPalette(pp); @@ -6959,7 +6859,6 @@ 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); if (pp->WadeDepth) { @@ -7388,7 +7287,7 @@ void MultiPlayLimits(void) { short pnum; PLAYERp pp; - SWBOOL Done = FALSE; + bool Done = false; if (gNet.MultiGameType != MULTI_GAME_COMMBAT) return; @@ -7400,7 +7299,7 @@ void MultiPlayLimits(void) pp = Player + pnum; if (pp->Kills >= gNet.KillLimit) { - Done = TRUE; + Done = true; } } } @@ -7410,7 +7309,7 @@ void MultiPlayLimits(void) gNet.TimeLimitClock -= synctics; if (gNet.TimeLimitClock <= 0) - Done = TRUE; + Done = true; } if (Done) @@ -7428,7 +7327,7 @@ void MultiPlayLimits(void) void PauseMultiPlay(void) { #if 0 - static SWBOOL SavePrediction; + static bool SavePrediction; PLAYERp pp; short pnum,p; @@ -7448,7 +7347,7 @@ void PauseMultiPlay(void) if (paused) { SavePrediction = PredictionOn; - PredictionOn = FALSE; + PredictionOn = false; } else { @@ -7513,7 +7412,7 @@ domovethings(void) TRAVERSE_CONNECT(pnum) { extern short screenpeek; - extern SWBOOL PlayerTrackingMode; + extern bool PlayerTrackingMode; extern PLAYERp GlobPlayerP; pp = Player + pnum; @@ -7532,7 +7431,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)); + playerSetAngle(&Player[screenpeek], FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy))); } if (!TEST(pp->Flags, PF_DEAD)) @@ -7546,23 +7445,11 @@ 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); + 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); - // 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); - if (prevFlags2 & currFlags2 & PF2_INPUT_CAN_AIM) - DoPlayerHorizon(pp, &pp->q16horiz, 0); - pp->Flags2 = currFlags2; - } UpdatePlayerSprite(pp); pSpriteControl(pp); @@ -7602,7 +7489,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); @@ -7615,8 +7502,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; @@ -7666,7 +7553,7 @@ int SearchSpawnPosition(PLAYERp pp) SPRITEp sp; short pos_num; short pnum,spawn_sprite; - SWBOOL blocked; + bool blocked; do { @@ -7678,7 +7565,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) @@ -7689,7 +7576,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; } } @@ -7700,7 +7587,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) @@ -7748,7 +7635,7 @@ PlayerSpawnPosition(PLAYERp pp) break; } - SpawnPositionUsed[pos_num] = TRUE; + SpawnPositionUsed[pos_num] = true; if (spawn_sprite < 0) { @@ -7763,7 +7650,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); @@ -7892,6 +7779,85 @@ void CheckFootPrints(PLAYERp pp) } } +//--------------------------------------------------------------------------- +// +// Unsynchronised input helpers. +// +//--------------------------------------------------------------------------- + +void resetinputhelpers(PLAYERp pp) +{ + pp->horizAdjust = 0; + pp->angAdjust = 0; + pp->pitchAdjust = 0; +} + +void playerAddAngle(PLAYERp pp, double ang) +{ + if (!cl_syncinput) + { + pp->angAdjust += ang; + } + else + { + pp->addang(ang); + } +} + +void playerSetAngle(PLAYERp pp, double ang) +{ + if (!cl_syncinput) + { + // 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(FloatToFixed(ang), pp->q16ang); + } + else + { + pp->setang(ang); + } +} + +void playerAddHoriz(PLAYERp pp, double horiz) +{ + if (!cl_syncinput) + { + pp->horizAdjust += horiz; + } + else + { + pp->addhoriz(horiz); + } +} + +void playerSetHoriz(PLAYERp pp, double horiz) +{ + if (!cl_syncinput) + { + // 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 + { + pp->sethoriz(horiz); + } +} + //--------------------------------------------------------------------------- // // @@ -7923,11 +7889,11 @@ static saveable_code saveable_player_code[] = SAVE_CODE(DoPlayerClimb), SAVE_CODE(DoPlayerBeginDie), //SAVE_CODE(DoPlayerDie), - SAVE_CODE(DoPlayerBeginOperateBoat), - SAVE_CODE(DoPlayerBeginOperateTank), + //SAVE_CODE(DoPlayerBeginOperateBoat), + SAVE_CODE(DoPlayerBeginOperateVehicle), SAVE_CODE(DoPlayerBeginOperate), - SAVE_CODE(DoPlayerOperateBoat), - SAVE_CODE(DoPlayerOperateTank), + //SAVE_CODE(DoPlayerOperateBoat), + SAVE_CODE(DoPlayerOperateVehicle), SAVE_CODE(DoPlayerOperateTurret), SAVE_CODE(DoPlayerBeginDive), SAVE_CODE(DoPlayerDive), diff --git a/source/sw/src/player.h b/source/sw/src/player.h index b841a9644..527b50742 100644 --- a/source/sw/src/player.h +++ b/source/sw/src/player.h @@ -125,12 +125,12 @@ 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); 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); @@ -144,6 +144,12 @@ 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); +void playerSetHoriz(PLAYERp pp, double horiz); + END_SW_NS #endif diff --git a/source/sw/src/predict.cpp b/source/sw/src/predict.cpp index ab76ee167..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; @@ -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..9f4a31515 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -276,11 +276,11 @@ 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); - return FALSE; + return false; } int diff --git a/source/sw/src/ripper.cpp b/source/sw/src/ripper.cpp index a5fb09db0..0ebea3656 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; + bool 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; } @@ -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); @@ -1165,11 +1164,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..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) @@ -968,7 +968,7 @@ InitRipper2Hang(short SpriteNum) continue; } - Found = TRUE; + Found = true; sp->ang = tang; break; } @@ -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); @@ -1179,11 +1178,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..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 = 0; +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; @@ -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; + bool 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; } } } @@ -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); @@ -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 @@ -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,19 +330,19 @@ 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; } } } 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; + return false; } @@ -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) { @@ -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; } } @@ -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,18 +633,18 @@ 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))) { 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; + bool 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; + bool 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; } } @@ -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; @@ -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,10 +879,10 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum } } - return TRUE; + return true; } -SWBOOL +bool FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) { int xoff = 0; @@ -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..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) { @@ -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; @@ -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; @@ -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; + bool 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 6d416267c..966e88595 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -70,22 +70,21 @@ 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 SWBOOL FinishAnim; +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 #define ANIM_SAVE 1 -extern InputPacket loc; extern STATE s_NotRestored[]; OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist}; @@ -463,7 +462,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); @@ -642,7 +641,7 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) } -extern SWBOOL SavegameLoaded; +extern bool SavegameLoaded; bool GameInterface::LoadGame(FSaveGameNode* sv) { @@ -717,7 +716,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) INITLIST(&pp->PanelSpriteList); - while (TRUE) + while (true) { MREAD(&ndx, sizeof(ndx),1,fil); @@ -848,7 +847,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); @@ -943,7 +942,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) { INITLIST(otlist[i]); - while (TRUE) + while (true) { MREAD(&ndx, sizeof(ndx),1,fil); @@ -1070,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 8d8512402..209a13fc5 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 /* ============== @@ -86,8 +86,8 @@ TArray LoadScriptFile(const char *filename) { scriptbuffer.Push(0); scriptline = 1; - endofscript = FALSE; - tokenready = FALSE; + endofscript = false; + tokenready = false; } return scriptbuffer; } @@ -101,13 +101,13 @@ TArray LoadScriptFile(const char *filename) ============== */ -void GetToken(SWBOOL crossline) +void GetToken(bool crossline) { char *token_p; 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..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; @@ -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: @@ -1308,7 +1308,7 @@ DoStopSoundSpotMatch(short match) } -SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop) +bool TestKillSectorObject(SECTOR_OBJECTp sop) { if (TEST(sop->flags, SOBJ_KILLABLE)) { @@ -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,11 +1337,11 @@ DoSectorObjectKillMatch(short match) return TestKillSectorObject(sop); } - return FALSE; + return false; } -SWBOOL +bool SearchExplodeSectorMatch(short match) { short i,nexti; @@ -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); @@ -1621,11 +1621,11 @@ 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; - SWBOOL state; + int state; TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) { @@ -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: @@ -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; @@ -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; } @@ -2561,7 +2561,7 @@ int DoPlayerGrabStar(PLAYERp pp) void PlayerOperateEnv(PLAYERp pp) { - SWBOOL found; + bool found; if (Prediction || !pp->SpriteP) return; @@ -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; } @@ -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; @@ -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/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/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/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 8a281b4bb..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) { @@ -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; @@ -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; @@ -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; + bool 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; + bool 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/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 9cbbc1602..5adda2407 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); @@ -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 32136b7a1..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) { @@ -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); } } @@ -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); @@ -210,7 +210,7 @@ DoSpikeMatch(short match) } -SWBOOL +bool TestSpikeMatchActive(short match) { USERp fu; @@ -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; + bool 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..cf3dd6a8e 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -90,8 +90,8 @@ int DoSlidorInstantClose(short SpriteNum); void InitWeaponRocket(PLAYERp); void InitWeaponUzi(PLAYERp); -SWBOOL FAF_Sector(short sectnum); -SWBOOL MoveSkip4, MoveSkip2, MoveSkip8; +bool FAF_Sector(short sectnum); +int MoveSkip4, MoveSkip2, MoveSkip8; extern STATE s_CarryFlag[]; extern STATE s_CarryFlagNoDet[]; @@ -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,20 +1036,20 @@ PicAnimOff(short picnum) RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK); } -SWBOOL +bool IconSpawn(SPRITEp sp) { // if multi item and not a modem game if (TEST(sp->extra, SPRX_MULTI_ITEM)) { if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) - return FALSE; + return false; } - return TRUE; + return true; } -SWBOOL +bool ActorTestSpawn(SPRITEp sp) { if (sp->statnum == STAT_DEFAULT && sp->lotag == TAG_SPAWN_ACTOR) @@ -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; } @@ -1125,10 +1125,10 @@ void PreCacheSkull(void); void PreCacheBetty(void); void PreCachePachinko(void); -SWBOOL +bool ActorSpawn(SPRITEp sp) { - int ret = TRUE; + bool 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; @@ -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 @@ -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; } @@ -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)) @@ -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; } } @@ -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]; @@ -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,20 +4677,20 @@ 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; } -SWBOOL +bool SpriteOverlapZ(int16_t spritenum_a, int16_t spritenum_b, int z_overlap) { SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b]; @@ -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; } } @@ -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]; @@ -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,21 +4969,21 @@ 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 -SWBOOL +bool DropAhead(short SpriteNum, short min_height) { @@ -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; } } @@ -5469,38 +5469,38 @@ 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]; 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] = @@ -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 @@ -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; + bool 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/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 50e581fb5..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; @@ -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) @@ -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 36d387739..76e0fa8eb 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,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]; @@ -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); @@ -1390,16 +1390,18 @@ 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; +#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; @@ -1466,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++) @@ -1503,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++) { @@ -1515,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); } @@ -1676,9 +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 - 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)); + playerAddAngle(pp, GetDeltaQ16Angle(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng), pp->q16ang)); UpdatePlayerSprite(pp); } @@ -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; + bool 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; + bool 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) @@ -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; @@ -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 @@ -3136,7 +3136,7 @@ ScanToWall */ -SWBOOL +bool ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) { SPRITEp sp; @@ -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..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) { @@ -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); } } @@ -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); @@ -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."); @@ -198,7 +198,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum) #endif { PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1)); - return FALSE; + return false; } } @@ -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; @@ -308,14 +308,14 @@ 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) +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); @@ -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 @@ -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) { @@ -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; @@ -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/wallmove.cpp b/source/sw/src/wallmove.cpp index 2599edbf0..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); @@ -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 { @@ -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) @@ -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; + bool 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..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; @@ -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 @@ -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; @@ -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 e5ddf95df..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]; @@ -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; + bool 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; @@ -4366,18 +4366,18 @@ 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) - 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,15 +4465,15 @@ VehicleMoveHit(short SpriteNum) } } - return TRUE; + return true; } } - return FALSE; + return false; } -SWBOOL +bool WeaponMoveHit(short SpriteNum) { USERp u = User[SpriteNum]; @@ -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; + bool 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; + bool 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; } @@ -5320,12 +5320,12 @@ 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) { 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; + bool 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 +bool 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; } @@ -5947,7 +5947,7 @@ DoDamage(short SpriteNum, short Weapon) { switch (wu->PlayerP->sop->track) { - case SO_TANK: + case SO_VEHICLE: damage = -200; if (u->sop_parent) @@ -5984,6 +5984,7 @@ DoDamage(short SpriteNum, short Weapon) } break; +#if 0 case SO_SPEED_BOAT: damage = -100; @@ -6009,6 +6010,7 @@ DoDamage(short SpriteNum, short Weapon) SpawnBlood(SpriteNum, Weapon, 0, 0, 0, 0); break; +#endif } } @@ -6520,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; @@ -6762,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; @@ -7989,7 +7991,7 @@ DoStar(int16_t Weapon) if (sp->z > u->loz) { KillSprite(Weapon); - return TRUE; + return true; } } else @@ -8074,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)) @@ -8083,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; } @@ -8175,12 +8177,12 @@ DoStar(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8213,11 +8215,11 @@ DoCrossBolt(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8245,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++) { @@ -8292,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]; @@ -8365,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]; @@ -8453,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]; @@ -8461,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]; @@ -8525,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]; @@ -8533,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]; @@ -8650,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); } } @@ -8732,7 +8734,7 @@ DoPlasma(int16_t Weapon) if (TEST(u->Flags, SPR_SUICIDE)) { KillSprite(Weapon); - return TRUE; + return true; } else { @@ -8740,11 +8742,11 @@ DoPlasma(int16_t Weapon) ChangeState(Weapon, s_PlasmaDone); } - return TRUE; + return true; } } - return FALSE; + return false; } @@ -8771,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 @@ -8788,7 +8790,7 @@ DoEelFire(short Weapon) //DoDamageTest(Weapon); - return FALSE; + return false; } @@ -8844,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; @@ -8876,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; @@ -8911,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[]; @@ -8953,7 +8955,7 @@ DoGrenade(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -8980,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++) { @@ -8990,7 +8992,7 @@ DoGrenade(int16_t Weapon) } SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } @@ -9026,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) @@ -9052,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++) { @@ -9062,7 +9064,7 @@ DoGrenade(int16_t Weapon) } SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -9095,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++) { @@ -9106,7 +9108,7 @@ DoGrenade(int16_t Weapon) //WeaponMoveHit(Weapon); SpawnGrenadeExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } else @@ -9126,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 @@ -9162,7 +9164,7 @@ DoGrenade(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -9183,7 +9185,7 @@ DoVulcanBoulder(int16_t Weapon) { SpawnLittleExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } if (u->ret) @@ -9192,7 +9194,7 @@ DoVulcanBoulder(int16_t Weapon) { case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -9215,7 +9217,7 @@ DoVulcanBoulder(int16_t Weapon) // hit an actor SpawnLittleExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } @@ -9249,7 +9251,7 @@ DoVulcanBoulder(int16_t Weapon) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(Weapon, &did_hit_wall)) { @@ -9317,20 +9319,20 @@ DoVulcanBoulder(int16_t Weapon) } } - return FALSE; + return false; } -SWBOOL +bool 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 @@ -9344,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); @@ -9382,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; } @@ -9420,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; @@ -9545,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 @@ -9620,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)) @@ -9669,7 +9671,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } } @@ -9699,7 +9701,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } break; @@ -9722,7 +9724,7 @@ DoMine(int16_t Weapon) { SpawnMineExp(Weapon); KillSprite(Weapon); - return FALSE; + return false; } break; @@ -9732,7 +9734,7 @@ DoMine(int16_t Weapon) u->ret = 0; } - return FALSE; + return false; } int @@ -9782,7 +9784,7 @@ DoBoltThinMan(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -9790,12 +9792,12 @@ DoBoltThinMan(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -9816,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 @@ -9855,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 @@ -9913,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 @@ -9938,12 +9940,12 @@ DoTankShell(int16_t Weapon) SpawnTankShellExp(Weapon); //SetExpQuake(exp); KillSprite(Weapon); - return TRUE; + return true; } } } - return FALSE; + return false; } int @@ -9961,11 +9963,11 @@ DoTracerStart(int16_t Weapon) if (WeaponMoveHit(Weapon)) { KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -9978,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); @@ -9992,7 +9994,7 @@ DoLaser(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10022,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); @@ -10034,7 +10036,7 @@ DoLaserStart(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10051,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); @@ -10075,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 @@ -10090,7 +10092,7 @@ DoRail(int16_t Weapon) SpawnTracerExp(Weapon); SpawnShrapX(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } } @@ -10137,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); @@ -10150,7 +10152,7 @@ DoRailStart(int16_t Weapon) SpawnTracerExp(Weapon); SpawnShrapX(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10189,7 +10191,7 @@ DoRocket(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10205,7 +10207,7 @@ DoRocket(int16_t Weapon) SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } @@ -10243,7 +10245,7 @@ DoRocket(int16_t Weapon) SET(nu->Flags, SPR_UNDERWATER); } - return FALSE; + return false; } int @@ -10264,12 +10266,12 @@ DoMicroMini(int16_t Weapon) { SpawnMicroExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } } - return FALSE; + return false; } int @@ -10318,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); @@ -10369,7 +10371,7 @@ DoMicro(int16_t Weapon) sp->xrepeat = sp->yrepeat = 10; RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE); SpawnExtraMicroMini(Weapon); - return TRUE; + return true; } } @@ -10381,11 +10383,11 @@ DoMicro(int16_t Weapon) { SpawnMicroExp(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10447,7 +10449,7 @@ DoUziBullet(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } else if (u->Dist > 8000) { @@ -10456,7 +10458,7 @@ DoUziBullet(int16_t Weapon) } } - return FALSE; + return false; } @@ -10487,12 +10489,12 @@ DoBoltSeeker(int16_t Weapon) { SpawnBoltExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10532,7 +10534,7 @@ DoElectro(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10557,11 +10559,11 @@ DoElectro(int16_t Weapon) //SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10578,7 +10580,7 @@ DoLavaBoulder(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10586,11 +10588,11 @@ DoLavaBoulder(int16_t Weapon) { SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int @@ -10609,7 +10611,7 @@ DoSpear(int16_t Weapon) //DoDamageTest(Weapon); if (TEST(u->Flags, SPR_SUICIDE)) - return TRUE; + return true; if (u->ret) { @@ -10617,11 +10619,11 @@ DoSpear(int16_t Weapon) { //SpawnShrap(Weapon, -1); KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } int SpawnCoolieExp(short SpriteNum) @@ -10731,7 +10733,7 @@ SpawnFireballFlames(int16_t SpriteNum, int16_t enemy) if (!eu) { - ASSERT(TRUE == FALSE); + ASSERT(true == false); } if (eu->flame >= 0) @@ -11071,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; @@ -11394,12 +11396,12 @@ 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) { Weapon = abs(Weapon); - smallflames = TRUE; + smallflames = true; } sp = &sprite[Weapon]; @@ -11936,7 +11938,7 @@ DoFireball(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -11984,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; @@ -12001,11 +12003,11 @@ DoFireball(int16_t Weapon) KillSprite(Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12039,7 +12041,7 @@ DoFindGround(int16_t SpriteNum) // found a sprite floor u->lo_sp = hsp; u->lo_sectp = NULL; - return TRUE; + return true; } else { @@ -12051,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 @@ -12098,7 +12100,7 @@ DoFindGroundPoint(int16_t SpriteNum) // found a sprite floor u->lo_sp = hsp; u->lo_sectp = NULL; - return TRUE; + return true; } else { @@ -12110,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 @@ -12146,7 +12148,7 @@ DoNapalm(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12233,11 +12235,11 @@ DoNapalm(int16_t Weapon) { KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } #define WORM 1 @@ -12264,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); @@ -12278,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) @@ -12292,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; } @@ -12301,7 +12303,7 @@ DoBloodWorm(int16_t Weapon) SpawnZombie2(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12321,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 @@ -12360,7 +12362,7 @@ DoBloodWorm(int16_t Weapon) case HIT_PLAX_WALL: KillSprite(Weapon); - return TRUE; + return true; case HIT_SPRITE: case HIT_WALL: @@ -12392,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) @@ -12405,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; } @@ -12414,7 +12416,7 @@ DoBloodWorm(int16_t Weapon) SpawnZombie2(Weapon); KillSprite(Weapon); - return TRUE; + return true; } ang = NORM_ANGLE(sp->ang + 512); @@ -12433,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) @@ -12451,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 @@ -12519,11 +12521,11 @@ DoSerpMeteor(int16_t Weapon) KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12553,11 +12555,11 @@ DoMirvMissile(int16_t Weapon) KillSprite((short) Weapon); - return TRUE; + return true; } } - return FALSE; + return false; } @@ -12660,20 +12662,20 @@ DoMirv(int16_t Weapon) SpawnMeteorExp(Weapon); //SpawnBasicExp(Weapon); KillSprite((short) Weapon); - return TRUE; + return true; } - return FALSE; + return false; } -SWBOOL +bool MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) { SPRITEp wp = &sprite[Weapon]; USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = FALSE; + bool retval = false; // backup values oldxc = wu->xchange; @@ -12694,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 @@ -12712,14 +12714,14 @@ MissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist) return retval; } -SWBOOL +bool TestMissileSetPos(short Weapon, ANIMATORp DoWeapon, int dist, int zvel) { SPRITEp wp = &sprite[Weapon]; USERp wu = User[Weapon]; int oldvel, oldzvel; int oldxc, oldyc, oldzc; - char retval = FALSE; + bool retval = false; // backup values oldxc = wu->xchange; @@ -12740,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 @@ -12780,7 +12782,7 @@ DoRing(int16_t Weapon) { SpawnSmokePuff(Weapon); KillSprite(Weapon); - return TRUE; + return true; } } @@ -12793,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 @@ -12953,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 @@ -14282,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]; @@ -14352,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]; @@ -14480,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; @@ -14639,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; } @@ -14959,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 @@ -15191,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); } @@ -15216,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); @@ -15283,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); } @@ -15309,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); @@ -15369,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); } @@ -15503,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); } @@ -15631,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); } @@ -15736,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); } @@ -15825,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); } @@ -15859,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; @@ -16079,7 +16081,7 @@ InitSerpSlash(short SpriteNum) return 0; } -SWBOOL +bool WallSpriteInsideSprite(SPRITEp wsp, SPRITEp sp) { int x1, y1, x2, y2; @@ -16111,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); } @@ -16605,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) @@ -17481,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); @@ -17538,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); @@ -17687,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) @@ -17728,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]; @@ -17768,7 +17770,7 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall) changespritesect(SpriteNum, sectnum); #endif - return TRUE; + return true; } int @@ -17786,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); @@ -17797,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) @@ -17819,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); @@ -17995,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); @@ -18009,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 @@ -18147,7 +18149,7 @@ InitEMP(PLAYERp pp) else { KillSprite(j); - return FALSE; + return false; } } @@ -18190,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); @@ -18220,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; @@ -18228,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; @@ -18325,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, @@ -18350,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; @@ -18373,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); @@ -18397,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); @@ -18422,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; @@ -18458,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); } @@ -18480,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; @@ -18515,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); } @@ -18554,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; @@ -18646,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++) { @@ -18670,7 +18672,7 @@ InitSobjGun(PLAYERp pp) if (!first) { - first = TRUE; + first = true; if (SP_TAG6(sp)) DoSoundSpotMatch(SP_TAG6(sp), 1, SOUND_OBJECT_TYPE); } @@ -18947,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) @@ -18977,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); } @@ -19250,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); @@ -19328,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; @@ -19345,7 +19347,7 @@ InitGrenade(PLAYERp pp) wu->ychange += pp->yvect>>14; } - wu->Counter2 = TRUE; // Phosphorus Grenade + wu->Counter2 = true; // Phosphorus Grenade return 0; } @@ -19646,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); } @@ -19753,19 +19755,19 @@ InitEnemyFireball(short SpriteNum) // for hitscans or other uses /////////////////////////////////////////////////////////////////////////////// -SWBOOL +bool 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) @@ -19776,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) @@ -19793,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; @@ -19822,10 +19824,10 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z) *z = sector[under_sp->sectnum].ceilingz + Z(1); - return TRUE; + return true; } -SWBOOL +bool WarpToSurface(short *sectnum, int *x, int *y, int *z) { short i, nexti; @@ -19834,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) @@ -19849,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) @@ -19866,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; @@ -19893,24 +19895,24 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z) //MissileWaterAdjust(sp - sprite); - return TRUE; + return true; } -SWBOOL +bool SpriteWarpToUnderwater(SPRITEp sp) { USERp u = User[sp - sprite]; 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) @@ -19921,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) @@ -19938,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; @@ -19972,10 +19974,10 @@ SpriteWarpToUnderwater(SPRITEp sp) u->oy = sp->y; u->oz = sp->z; - return TRUE; + return true; } -SWBOOL +bool SpriteWarpToSurface(SPRITEp sp) { USERp u = User[sp - sprite]; @@ -19985,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) @@ -20000,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) @@ -20021,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; @@ -20055,7 +20057,7 @@ SpriteWarpToSurface(SPRITEp sp) u->oy = sp->y; u->oz = sp->z; - return TRUE; + return true; } @@ -20170,7 +20172,7 @@ SpawnUnderSplash(short SpriteNum) return 0; } -SWBOOL +bool MissileHitDiveArea(short SpriteNum) { USERp u = User[SpriteNum]; @@ -20187,7 +20189,7 @@ MissileHitDiveArea(short SpriteNum) } if (!u->ret) - return FALSE; + return false; switch (TEST(u->ret, HIT_MASK)) { @@ -20199,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); @@ -20211,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 @@ -20281,7 +20283,7 @@ DoVehicleSmoke(short SpriteNum) sp->y += u->ychange; - return FALSE; + return false; } int @@ -20291,7 +20293,7 @@ DoWaterSmoke(short SpriteNum) sp->z -= sp->zvel; - return FALSE; + return false; } int @@ -20302,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); @@ -20328,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 @@ -20363,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; } @@ -20398,7 +20400,7 @@ DoBubble(short SpriteNum) if (!SpriteWarpToSurface(sp)) { KillSprite(SpriteNum); - return TRUE; + return true; } RESET(u->Flags, SPR_UNDERWATER); @@ -20408,7 +20410,7 @@ DoBubble(short SpriteNum) else { KillSprite(SpriteNum); - return TRUE; + return true; } } @@ -20417,7 +20419,7 @@ DoBubble(short SpriteNum) if ((u->WaitTics -= MISSILEMOVETICS) <= 0) { KillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -20426,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 @@ -20497,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; @@ -20511,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) +bool 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) @@ -20716,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]; @@ -20726,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)) @@ -21159,7 +21161,7 @@ SpawnShell(short SpriteNum, short ShellNum) // -4 is Shotgun shell InitShell(SpriteNum, ShellNum); - return TRUE; + return true; } @@ -21193,7 +21195,7 @@ DoShrapVelocity(int16_t SpriteNum) { case HIT_PLAX_WALL: KillSprite(SpriteNum); - return TRUE; + return true; case HIT_SPRITE: { short wall_ang; @@ -21233,7 +21235,7 @@ DoShrapVelocity(int16_t SpriteNum) case HIT_SECTOR: { - SWBOOL did_hit_wall; + bool did_hit_wall; if (SlopeBounce(SpriteNum, &did_hit_wall)) { @@ -21263,7 +21265,7 @@ DoShrapVelocity(int16_t SpriteNum) ChangeState(SpriteNum, s_GoreFloorSplash); else ShrapKillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -21308,7 +21310,7 @@ DoShrapVelocity(int16_t SpriteNum) ChangeState(SpriteNum, s_GoreFloorSplash); else ShrapKillSprite(SpriteNum); - return TRUE; + return true; } } else @@ -21327,10 +21329,10 @@ DoShrapVelocity(int16_t SpriteNum) if (u->bounce > 10) { KillSprite(SpriteNum); - return TRUE; + return true; } - return FALSE; + return false; } @@ -21467,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); @@ -21494,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 @@ -21579,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 @@ -21592,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/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); 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; }