Merge remote-tracking branch 'remotes/Github_private/InputStuffs' into back_to_basics2

This commit is contained in:
Christoph Oelckers 2020-09-10 23:25:43 +02:00
commit d5b9a9ee43
79 changed files with 2325 additions and 2386 deletions

View file

@ -88,7 +88,7 @@ struct GameInterface : ::GameInterface
FString GetCoordString() override; FString GetCoordString() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override; ReservedSpace GetReservedScreenSpace(int viewsize) override;
void UpdateSounds() override; void UpdateSounds() override;
void GetInput(InputPacket* gInput) override; void GetInput(InputPacket* gInput, ControlInfo* const hidInput) override;
void Ticker() override; void Ticker() override;
void DrawBackground() override; void DrawBackground() override;
void Startup() override; void Startup() override;

View file

@ -50,10 +50,9 @@ float gViewAngleAdjust;
float gViewLookAdjust; float gViewLookAdjust;
int gViewLookRecenter; int gViewLookRecenter;
void GetInputInternal(InputPacket &inputParm) void GetInputInternal(InputPacket &inputParm, ControlInfo* const hidInput)
{ {
int prevPauseState = paused; int prevPauseState = paused;
ControlInfo info;
static double lastInputTicks; static double lastInputTicks;
auto const currentHiTicks = I_msTimeF(); auto const currentHiTicks = I_msTimeF();
@ -65,9 +64,7 @@ void GetInputInternal(InputPacket &inputParm)
InputPacket input = {}; InputPacket input = {};
CONTROL_GetInput(&info); ApplyGlobalInput(inputParm, hidInput);
ApplyGlobalInput(inputParm, &info);
bool mouseaim = !(inputParm.actions & SB_AIMMODE); bool mouseaim = !(inputParm.actions & SB_AIMMODE);
if (!mouseaim) inputParm.actions |= SB_CENTERVIEW; if (!mouseaim) inputParm.actions |= SB_CENTERVIEW;
@ -145,26 +142,26 @@ void GetInputInternal(InputPacket &inputParm)
if (buttonMap.ButtonDown(gamefunc_Strafe)) if (buttonMap.ButtonDown(gamefunc_Strafe))
{ {
input.svel -= info.mousex * 32.f; input.svel -= hidInput->mousex * 32.f;
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove); input.svel -= scaleAdjustmentToInterval(hidInput->dyaw * keyMove);
} }
else else
{ {
input.q16avel += FloatToFixed(info.mousex); input.q16avel += FloatToFixed(hidInput->mousex);
input.q16avel += FloatToFixed(scaleAdjustmentToInterval(info.dyaw)); input.q16avel += FloatToFixed(scaleAdjustmentToInterval(hidInput->dyaw));
} }
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); input.svel -= scaleAdjustmentToInterval(hidInput->dx * keyMove);
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); input.fvel -= scaleAdjustmentToInterval(hidInput->dz * keyMove);
if (mouseaim) if (mouseaim)
input.q16horz += FloatToFixed(info.mousey / mlookScale); input.q16horz += FloatToFixed(hidInput->mousey / mlookScale);
else else
input.fvel -= info.mousey * 64.f; input.fvel -= hidInput->mousey * 64.f;
if (!in_mouseflip) if (!in_mouseflip)
input.q16horz = -input.q16horz; 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.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048);
inputParm.svel = clamp(inputParm.svel + input.svel, -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) if (packet)
{ {
*packet = gInput; *packet = gInput;

View file

@ -269,14 +269,4 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr,
/* End dependence on compat.o object. */ /* End dependence on compat.o object. */
////////// EDuke32-specific features //////////
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
#endif // compat_h_ #endif // compat_h_

View file

@ -1021,8 +1021,6 @@ void NetUpdate (void)
int fvel = 0; int fvel = 0;
int64_t q16avel = 0; int64_t q16avel = 0;
int64_t q16horz = 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) for (j = 0; j < ticdup; ++j)
{ {
@ -1031,16 +1029,12 @@ void NetUpdate (void)
fvel += localcmds[modp].ucmd.fvel; fvel += localcmds[modp].ucmd.fvel;
q16avel += localcmds[modp].ucmd.q16avel; q16avel += localcmds[modp].ucmd.q16avel;
q16horz += localcmds[modp].ucmd.q16horz; q16horz += localcmds[modp].ucmd.q16horz;
q16horiz += localcmds[modp].ucmd.q16horiz;
q16ang += localcmds[modp].ucmd.q16ang;
} }
svel /= ticdup; svel /= ticdup;
fvel /= ticdup; fvel /= ticdup;
q16avel /= ticdup; q16avel /= ticdup;
q16horz /= ticdup; q16horz /= ticdup;
q16horiz /= ticdup;
q16ang /= ticdup;
for (j = 0; j < ticdup; ++j) for (j = 0; j < ticdup; ++j)
{ {
@ -1049,8 +1043,6 @@ void NetUpdate (void)
localcmds[modp].ucmd.fvel = fvel; localcmds[modp].ucmd.fvel = fvel;
localcmds[modp].ucmd.q16avel = q16avel; localcmds[modp].ucmd.q16avel = q16avel;
localcmds[modp].ucmd.q16horz = q16horz; localcmds[modp].ucmd.q16horz = q16horz;
localcmds[modp].ucmd.q16horiz = q16horiz;
localcmds[modp].ucmd.q16ang = q16ang;
} }
Net_NewMakeTic (); Net_NewMakeTic ();

View file

@ -167,10 +167,6 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream
ucmd->fvel = ReadWord (stream); ucmd->fvel = ReadWord (stream);
if (flags & UCMDF_SIDEMOVE) if (flags & UCMDF_SIDEMOVE)
ucmd->svel = ReadWord (stream); ucmd->svel = ReadWord (stream);
if (flags & UCMDF_UPMOVE)
ucmd->q16horiz = ReadLong (stream);
if (flags & UCMDF_ROLL)
ucmd->q16ang = ReadLong (stream);
} }
return int(*stream - start); return int(*stream - start);
@ -217,16 +213,6 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
flags |= UCMDF_SIDEMOVE; flags |= UCMDF_SIDEMOVE;
WriteWord (ucmd->svel, stream); 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 // Write the packing bits
WriteByte (flags, &temp); WriteByte (flags, &temp);
@ -252,10 +238,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, InputPacket &cmd, Inpu
arc("actions", cmd.actions) arc("actions", cmd.actions)
("horz", cmd.q16horz) ("horz", cmd.q16horz)
("avel", cmd.q16avel) ("avel", cmd.q16avel)
("ang", cmd.q16ang)
("fvel", cmd.fvel) ("fvel", cmd.fvel)
("svwl", cmd.svel) ("svwl", cmd.svel)
("q16horiz", cmd.q16horiz)
.EndObject(); .EndObject();
} }
return arc; return arc;
@ -269,9 +253,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
ucmd->q16horz != 0 || ucmd->q16horz != 0 ||
ucmd->q16avel != 0 || ucmd->q16avel != 0 ||
ucmd->fvel != 0 || ucmd->fvel != 0 ||
ucmd->svel != 0 || ucmd->svel != 0)
ucmd->q16horiz != 0 ||
ucmd->q16ang != 0)
{ {
WriteByte (DEM_USERCMD, stream); WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1; return PackUserCmd (ucmd, basis, stream) + 1;
@ -282,9 +264,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
ucmd->q16horz != basis->q16horz || ucmd->q16horz != basis->q16horz ||
ucmd->q16avel != basis->q16avel || ucmd->q16avel != basis->q16avel ||
ucmd->fvel != basis->fvel || ucmd->fvel != basis->fvel ||
ucmd->svel != basis->svel || ucmd->svel != basis->svel)
ucmd->q16horiz != basis->q16horiz ||
ucmd->q16ang != basis->q16ang)
{ {
WriteByte (DEM_USERCMD, stream); WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1; return PackUserCmd (ucmd, basis, stream) + 1;

View file

@ -7,6 +7,7 @@ bool System_WantGuiCapture(); // During playing this tells us whether the game m
#include "engineerrors.h" #include "engineerrors.h"
#include "stats.h" #include "stats.h"
#include "packet.h" #include "packet.h"
#include "inputstate.h"
class FSerializer; class FSerializer;
@ -92,7 +93,7 @@ struct GameInterface
virtual FString GetCoordString() { return "'stat coord' not implemented"; } virtual FString GetCoordString() { return "'stat coord' not implemented"; }
virtual void ExitFromMenu() { throw CExitEvent(0); } virtual void ExitFromMenu() { throw CExitEvent(0); }
virtual ReservedSpace GetReservedScreenSpace(int viewsize) { return { 0, 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 UpdateSounds() {}
virtual void ErrorCleanup() {} virtual void ErrorCleanup() {}
virtual void Startup() {} virtual void Startup() {}

View file

@ -47,30 +47,32 @@ ESyncBits ActionsToSend = 0;
static int dpad_lock = 0; static int dpad_lock = 0;
bool sendPause; bool sendPause;
static double lastCheck;
//========================================================================== //==========================================================================
// //
// //
// //
//========================================================================== //==========================================================================
void InputState::GetMouseDelta(ControlInfo * info) void InputState::GetMouseDelta(ControlInfo * hidInput)
{ {
vec2f_t finput = g_mousePos; vec2f_t finput = g_mousePos;
g_mousePos = {}; g_mousePos = {};
info->mousex = finput.x * (16.f / 32.f) * in_mousesensitivity * in_mousescalex / 3.f; hidInput->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->mousey = finput.y * (16.f / 64.f) * in_mousesensitivity * in_mousescaley;
// todo: Use these when the mouse is used for moving instead of turning. // todo: Use these when the mouse is used for moving instead of turning.
//info->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside); //hidInput->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside);
//info->mousey = int(finput.y * (4.f) * in_mousesensitivity * in_mouseforward); //hidInput->mousey = int(finput.y * (4.f) * in_mousesensitivity * in_mouseforward);
if (in_mousebias) if (in_mousebias)
{ {
if (fabs(info->mousex) > fabs(info->mousey)) if (fabs(hidInput->mousex) > fabs(hidInput->mousey))
info->mousey /= in_mousebias; hidInput->mousey /= in_mousebias;
else 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) if (use_joystick)
{ {
@ -188,11 +190,13 @@ void CONTROL_GetInput(ControlInfo* info)
I_GetAxes(joyaxes); I_GetAxes(joyaxes);
info->dyaw += -joyaxes[JOYAXIS_Yaw] * 45.f; hidInput.dyaw += -joyaxes[JOYAXIS_Yaw] * 45.f;
info->dx += -joyaxes[JOYAXIS_Side] * 0.75f; hidInput.dx += -joyaxes[JOYAXIS_Side] * 0.75f;
info->dz += -joyaxes[JOYAXIS_Forward] * 0.75f; hidInput.dz += -joyaxes[JOYAXIS_Forward] * 0.75f;
info->dpitch += -joyaxes[JOYAXIS_Pitch] * 22.5f; 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); if (WeaponToSend != 0) input.setNewWeapon(WeaponToSend);
WeaponToSend = 0; 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. // 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; 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; 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; 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; else dpad_lock &= ~8;
// This eats the controller input for regular use // This eats the controller input for regular use
info->dx = 0; hidInput->dx = 0;
info->dz = 0; hidInput->dz = 0;
info->dyaw = 0; hidInput->dyaw = 0;
} }
else dpad_lock = 0; else dpad_lock = 0;
input.actions |= ActionsToSend; input.actions |= ActionsToSend;
ActionsToSend = 0; 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; 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; input.actions |= SB_AIM_DOWN;
if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming)) if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming))
info->dz = 0; hidInput->dz = 0;
if (buttonMap.ButtonDown(gamefunc_Jump)) if (buttonMap.ButtonDown(gamefunc_Jump))
input.actions |= SB_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;
}
}

View file

@ -48,7 +48,7 @@ public:
g_mousePos.y += y; g_mousePos.y += y;
} }
void GetMouseDelta(ControlInfo* info); void GetMouseDelta(ControlInfo* hidInput);
void ClearAllInput(); void ClearAllInput();
bool CheckAllInput() bool CheckAllInput()
@ -61,7 +61,7 @@ public:
extern InputState inputState; extern InputState inputState;
void CONTROL_GetInput(ControlInfo* info); ControlInfo CONTROL_GetInput();
int32_t handleevents(void); int32_t handleevents(void);
enum GameFunction_t enum GameFunction_t
@ -100,5 +100,6 @@ enum GameFunction_t
}; };
void SetupGameButtons(); void SetupGameButtons();
void ApplyGlobalInput(InputPacket& input, ControlInfo *info); void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput);
extern ESyncBits ActionsToSend; extern ESyncBits ActionsToSend;
double InputScale();

View file

@ -117,7 +117,7 @@ void DoLoadGame(const char* name);
void G_BuildTiccmd(ticcmd_t* cmd) void G_BuildTiccmd(ticcmd_t* cmd)
{ {
I_GetEvent(); I_GetEvent();
gi->GetInput(&cmd->ucmd); gi->GetInput(&cmd->ucmd, &CONTROL_GetInput());
cmd->consistancy = consistancy[myconnectindex][(maketic / ticdup) % BACKUPTICS]; cmd->consistancy = consistancy[myconnectindex][(maketic / ticdup) % BACKUPTICS];
} }
@ -511,7 +511,7 @@ void TryRunTics (void)
if (!cl_syncinput) if (!cl_syncinput)
{ {
I_GetEvent(); I_GetEvent();
gi->GetInput(nullptr); gi->GetInput(nullptr, &CONTROL_GetInput());
} }
return; return;
} }

View file

@ -74,8 +74,6 @@ struct InputPacket
int16_t fvel; int16_t fvel;
fixed_t q16avel; fixed_t q16avel;
fixed_t q16horz; fixed_t q16horz;
fixed_t q16horiz; // only used by SW
fixed_t q16ang; // only used by SW
ESyncBits actions; ESyncBits actions;

View file

@ -252,7 +252,7 @@ struct GameInterface : ::GameInterface
void Ticker() override; void Ticker() override;
void DrawBackground() override; void DrawBackground() override;
void Render() override; void Render() override;
void GetInput(InputPacket* packet) override; void GetInput(InputPacket* packet, ControlInfo* const hidInput) override;
void Startup() override; void Startup() override;
const char* GenericCheat(int player, int cheat) override; const char* GenericCheat(int player, int cheat) override;
void NewGame(MapRecord *map, int skill) override; void NewGame(MapRecord *map, int skill) override;

View file

@ -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; static double lastInputTicks;
auto const currentHiTicks = I_msTimeF(); auto const currentHiTicks = I_msTimeF();
double const elapsedInputTicks = currentHiTicks - lastInputTicks; double const elapsedInputTicks = currentHiTicks - lastInputTicks;
@ -121,7 +117,7 @@ void PlayerInterruptKeys(bool after)
if (!after) if (!after)
{ {
localInput = {}; localInput = {};
ApplyGlobalInput(localInput, &info); ApplyGlobalInput(localInput, hidInput);
if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN; if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN;
} }
@ -140,26 +136,26 @@ void PlayerInterruptKeys(bool after)
if (buttonMap.ButtonDown(gamefunc_Strafe)) if (buttonMap.ButtonDown(gamefunc_Strafe))
{ {
tempinput.svel -= info.mousex * 4.f; tempinput.svel -= hidInput->mousex * 4.f;
tempinput.svel -= info.dyaw * keyMove; tempinput.svel -= hidInput->dyaw * keyMove;
} }
else else
{ {
input_angle += FloatToFixed(info.mousex + scaleAdjustmentToInterval(info.dyaw)); input_angle += FloatToFixed(hidInput->mousex + scaleAdjustmentToInterval(hidInput->dyaw));
} }
bool mouseaim = !(localInput.actions & SB_AIMMODE); bool mouseaim = !(localInput.actions & SB_AIMMODE);
if (mouseaim) if (mouseaim)
tempinput.q16horz += FloatToFixed(info.mousey); tempinput.q16horz += FloatToFixed(hidInput->mousey);
else else
tempinput.fvel -= info.mousey * 8.f; tempinput.fvel -= hidInput->mousey * 8.f;
if (!in_mouseflip) tempinput.q16horz = -tempinput.q16horz; if (!in_mouseflip) tempinput.q16horz = -tempinput.q16horz;
tempinput.q16horz -= FloatToFixed(scaleAdjustmentToInterval(info.dpitch)); tempinput.q16horz -= FloatToFixed(scaleAdjustmentToInterval(hidInput->dpitch));
tempinput.svel -= info.dx * keyMove; tempinput.svel -= hidInput->dx * keyMove;
tempinput.fvel -= info.dz * keyMove; tempinput.fvel -= hidInput->dz * keyMove;
if (buttonMap.ButtonDown(gamefunc_Strafe)) 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; if (packet) *packet = localInput;
} }

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
void PlayerInterruptKeys(bool after);
void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle); 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 SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle);
void InitPlayer(); void InitPlayer();

View file

@ -50,7 +50,7 @@ struct GameInterface : public ::GameInterface
void ExitFromMenu() override; void ExitFromMenu() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override; ReservedSpace GetReservedScreenSpace(int viewsize) override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) 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 UpdateSounds() override;
void Startup() override; void Startup() override;
void DrawBackground() override; void DrawBackground() override;

View file

@ -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 (isRR() && (loc.actions & SB_CROUCH)) loc.actions &= ~SB_JUMP;
if (p->OnMotorcycle || p->OnBoat) 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); bool mouseaim = !(loc.actions & SB_AIMMODE);
@ -597,20 +597,20 @@ static void processMovement(player_struct *p, InputPacket &input, ControlInfo &i
int keymove = NORMALKEYMOVE << running; int keymove = NORMALKEYMOVE << running;
if (buttonMap.ButtonDown(gamefunc_Strafe)) 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 else
input.q16avel += FloatToFixed(info.mousex + scaleFactor * info.dyaw); input.q16avel += FloatToFixed(hidInput->mousex + scaleFactor * hidInput->dyaw);
if (mouseaim) if (mouseaim)
input.q16horz += FloatToFixed(info.mousey); input.q16horz += FloatToFixed(hidInput->mousey);
else else
input.fvel -= info.mousey * 8.f; input.fvel -= hidInput->mousey * 8.f;
if (!in_mouseflip) input.q16horz = -input.q16horz; if (!in_mouseflip) input.q16horz = -input.q16horz;
input.q16horz -= FloatToFixed(scaleFactor * (info.dpitch)); input.q16horz -= FloatToFixed(scaleFactor * (hidInput->dpitch));
input.svel -= scaleFactor * (info.dx * keymove); input.svel -= scaleFactor * (hidInput->dx * keymove);
input.fvel -= scaleFactor * (info.dz * keymove); input.fvel -= scaleFactor * (hidInput->dz * keymove);
if (buttonMap.ButtonDown(gamefunc_Strafe)) 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 turnl = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left);
int turnr = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right); 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 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) if (paused)
{ {
loc = {}; loc = {};
@ -1006,16 +998,14 @@ static void GetInputInternal(InputPacket &locInput)
setlocalplayerinput(p); setlocalplayerinput(p);
} }
double scaleAdjust = !cl_syncinput ? elapsedInputTicks * REALGAMETICSPERSEC / 1000.0 : 1; double const scaleAdjust = InputScale();
ControlInfo info;
CONTROL_GetInput(&info);
InputPacket input{}; InputPacket input{};
if (isRRRA() && (p->OnMotorcycle || p->OnBoat)) if (isRRRA() && (p->OnMotorcycle || p->OnBoat))
{ {
p->crouch_toggle = 0; p->crouch_toggle = 0;
processInputBits(p, info); processInputBits(p, hidInput);
processVehicleInput(p, info, input, scaleAdjust); processVehicleInput(p, hidInput, input, scaleAdjust);
FinalizeInput(myconnectindex, input, true); FinalizeInput(myconnectindex, input, true);
if (!cl_syncinput && sprite[p->i].extra > 0) if (!cl_syncinput && sprite[p->i].extra > 0)
@ -1025,8 +1015,8 @@ static void GetInputInternal(InputPacket &locInput)
} }
else else
{ {
processInputBits(p, info); processInputBits(p, hidInput);
processMovement(p, input, info, scaleAdjust); processMovement(p, input, hidInput, scaleAdjust);
checkCrouchToggle(p); checkCrouchToggle(p);
FinalizeInput(myconnectindex, input, false); 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) if (packet)
{ {
auto const pPlayer = &ps[myconnectindex]; auto const pPlayer = &ps[myconnectindex];

View file

@ -334,7 +334,7 @@ DoActorSectorDamage(short SpriteNum)
SECTORp sectp = &sector[sp->sectnum]; SECTORp sectp = &sector[sp->sectnum];
if (u->Health <= 0) if (u->Health <= 0)
return FALSE; return false;
if (sectu && sectu->damage) if (sectu && sectu->damage)
{ {
@ -349,7 +349,7 @@ DoActorSectorDamage(short SpriteNum)
{ {
UpdateSinglePlayKills(SpriteNum); UpdateSinglePlayKills(SpriteNum);
DoActorDie(SpriteNum, WPN_NM_LAVA); DoActorDie(SpriteNum, WPN_NM_LAVA);
return TRUE; return true;
} }
} }
} }
@ -364,7 +364,7 @@ DoActorSectorDamage(short SpriteNum)
{ {
UpdateSinglePlayKills(SpriteNum); UpdateSinglePlayKills(SpriteNum);
DoActorDie(SpriteNum, WPN_NM_LAVA); DoActorDie(SpriteNum, WPN_NM_LAVA);
return TRUE; return true;
} }
} }
} }
@ -382,14 +382,14 @@ DoActorSectorDamage(short SpriteNum)
} }
else else
{ {
ASSERT(TRUE == FALSE); ASSERT(true == false);
//DoActorDie(SpriteNum, WPN_NM_SECTOR_SQUISH); //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)) if (!move_actor(SpriteNum, nx, ny, 0L))
{ {
RESET(u->Flags, SPR_SLIDING); RESET(u->Flags, SPR_SLIDING);
return FALSE; return false;
} }
u->slide_vel -= u->slide_dec * ACTORMOVETICS; u->slide_vel -= u->slide_dec * ACTORMOVETICS;
@ -651,7 +651,7 @@ DoActorSlide(short SpriteNum)
RESET(u->Flags, SPR_SLIDING); RESET(u->Flags, SPR_SLIDING);
} }
return TRUE; return true;
} }
// !AIC - Actor jumping and falling // !AIC - Actor jumping and falling

View file

@ -40,10 +40,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
SWBOOL PlayerTakeDamage(PLAYERp, short); bool PlayerTakeDamage(PLAYERp, short);
ANIMATOR InitActorRunToward; ANIMATOR InitActorRunToward;
SWBOOL FAF_Sector(short); bool FAF_Sector(short);
SWBOOL DropAhead(short SpriteNum, short min_height); bool DropAhead(short SpriteNum, short min_height);
short FindTrackToPlayer(USERp u); short FindTrackToPlayer(USERp u);
ANIMATORp ChooseAction(DECISION decision[]); ANIMATORp ChooseAction(DECISION decision[]);
@ -114,11 +114,11 @@ void DebugMoveHit(short SpriteNum)
} }
SWBOOL ActorMoveHitReact(short SpriteNum) bool ActorMoveHitReact(short SpriteNum)
{ {
USERp u = User[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 // would cause the calling function to abort
switch (TEST(u->ret, HIT_MASK)) switch (TEST(u->ret, HIT_MASK))
@ -140,7 +140,7 @@ SWBOOL ActorMoveHitReact(short SpriteNum)
if (action) if (action)
{ {
(*action)(SpriteNum); (*action)(SpriteNum);
return TRUE; return true;
} }
} }
break; 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
@ -177,10 +177,10 @@ SWBOOL ActorFlaming(short SpriteNum)
MONO_PRINT(ds); MONO_PRINT(ds);
if (SPRITEp_SIZE_Z(fp) > size) if (SPRITEp_SIZE_Z(fp) > size)
return TRUE; return true;
} }
return FALSE; return false;
} }
void void
@ -217,7 +217,7 @@ ChooseAction(DECISION decision[])
// !JIM! Here is an opportunity for some AI, instead of randomness! // !JIM! Here is an opportunity for some AI, instead of randomness!
random_value = RANDOM_P2(1024<<5)>>5; random_value = RANDOM_P2(1024<<5)>>5;
for (i = 0; TRUE; i++) for (i = 0; true; i++)
{ {
ASSERT(i < 10); ASSERT(i < 10);
@ -240,7 +240,7 @@ ChooseActionNumber(short decision[])
random_value = RANDOM_P2(1024<<5)>>5; random_value = RANDOM_P2(1024<<5)>>5;
for (i = 0; TRUE; i++) for (i = 0; true; i++)
{ {
if (random_value <= decision[i]) if (random_value <= decision[i])
{ {
@ -308,8 +308,7 @@ DoActorNoise(ANIMATORp Action, short SpriteNum)
return 0; return 0;
} }
int bool CanSeePlayer(short SpriteNum)
CanSeePlayer(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
@ -318,12 +317,12 @@ CanSeePlayer(short SpriteNum)
int look_height = SPRITEp_TOS(sp); int look_height = SPRITEp_TOS(sp);
//if (FAF_Sector(sp->sectnum)) //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)) 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 else
return FALSE; return false;
} }
int int
@ -333,12 +332,12 @@ CanHitPlayer(short SpriteNum)
SPRITEp sp = User[SpriteNum]->SpriteP, hp; SPRITEp sp = User[SpriteNum]->SpriteP, hp;
hitdata_t hitinfo; hitdata_t hitinfo;
int xvect,yvect,zvect; int xvect,yvect,zvect;
short ang,ret=FALSE; short ang,ret=false;
// if actor can still see the player // if actor can still see the player
int zhs, zhh; int zhs, zhh;
//if (FAF_Sector(sp->sectnum)) //if (FAF_Sector(sp->sectnum))
// return(TRUE); // return(true);
zhs = sp->z - DIV2(SPRITEp_SIZE_Z(sp)); zhs = sp->z - DIV2(SPRITEp_SIZE_Z(sp));
@ -358,13 +357,13 @@ CanHitPlayer(short SpriteNum)
else if (hp->y - sp->y != 0) else if (hp->y - sp->y != 0)
zvect = yvect * ((zhh - zhs)/(hp->y - sp->y)); zvect = yvect * ((zhh - zhs)/(hp->y - sp->y));
else else
return FALSE; return false;
// so actors won't shoot straight up at you // so actors won't shoot straight up at you
// need to be a bit of a distance away // need to be a bit of a distance away
// before they have a valid shot // before they have a valid shot
// if (labs(zvect / FindDistance2D(hp->x - sp->x, hp->y - sp->y)) > 200) // 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, FAFhitscan(sp->x, sp->y, zhs, sp->sectnum,
xvect, xvect,
@ -373,15 +372,15 @@ CanHitPlayer(short SpriteNum)
&hitinfo, CLIPMASK_MISSILE); &hitinfo, CLIPMASK_MISSILE);
if (hitinfo.sect < 0) if (hitinfo.sect < 0)
return FALSE; return false;
if (hitinfo.sprite == u->tgt_sp - sprite) 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); //MONO_PRINT(ds);
return FALSE; return false;
} }
/* /*
@ -399,7 +398,7 @@ DoActorPickClosePlayer(short SpriteNum)
PLAYERp pp; PLAYERp pp;
// if actor can still see the player // if actor can still see the player
int look_height = SPRITEp_TOS(sp); int look_height = SPRITEp_TOS(sp);
SWBOOL found = FALSE; bool found = false;
int i,nexti; int i,nexti;
if (u->ID == ZOMBIE_RUN_R0 && gNet.MultiGameType == MULTI_GAME_COOPERATIVE) 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 // see if you can find someone close that you can SEE
near_dist = MAX_ACTIVE_RANGE; near_dist = MAX_ACTIVE_RANGE;
found = FALSE; found = false;
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
{ {
pp = &Player[pnum]; pp = &Player[pnum];
@ -475,12 +474,12 @@ DoActorPickClosePlayer(short SpriteNum)
DISTANCE(sp->x, sp->y, pp->posx, pp->posy, dist, a, b, c); 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)) 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; near_dist = dist;
u->tgt_sp = pp->SpriteP; u->tgt_sp = pp->SpriteP;
found = TRUE; found = true;
} }
} }
@ -553,13 +552,13 @@ int DoActorOperate(short SpriteNum)
unsigned int i; unsigned int i;
if (u->ID == HORNET_RUN_R0 || u->ID == EEL_RUN_R0 || u->ID == BUNNY_RUN_R0) 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) if (u->Rot == u->ActorActionSet->Sit || u->Rot == u->ActorActionSet->Stand)
return FALSE; return false;
if ((u->WaitTics -= ACTORMOVETICS) > 0) 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); //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); //MONO_PRINT(ds);
@ -579,7 +578,7 @@ int DoActorOperate(short SpriteNum)
#if 0 // Actors don't hit switches on a whim #if 0 // Actors don't hit switches on a whim
if (nearsprite >= 0 && nearhitdist < 1024) if (nearsprite >= 0 && nearhitdist < 1024)
{ {
if (OperateSprite(nearsprite, FALSE)) if (OperateSprite(nearsprite, false))
{ {
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
@ -592,7 +591,7 @@ int DoActorOperate(short SpriteNum)
if (nearsector >= 0 && nearhitdist < 1024) if (nearsector >= 0 && nearhitdist < 1024)
{ {
if (OperateSector(nearsector, FALSE)) if (OperateSector(nearsector, false))
{ {
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
@ -602,14 +601,14 @@ int DoActorOperate(short SpriteNum)
if (nearwall >= 0 && nearhitdist < 1024) if (nearwall >= 0 && nearhitdist < 1024)
{ {
if (OperateWall(nearwall, FALSE)) if (OperateWall(nearwall, false))
{ {
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
NewStateGroup(SpriteNum, u->ActorActionSet->Stand); NewStateGroup(SpriteNum, u->ActorActionSet->Stand);
} }
} }
return TRUE; return true;
} }
@ -639,7 +638,7 @@ DoActorActionDecide(short SpriteNum)
int dist; int dist;
ANIMATORp action; ANIMATORp action;
USERp pu=NULL; USERp pu=NULL;
SWBOOL ICanSee=FALSE; bool ICanSee=false;
// REMINDER: This function is not even called if SpriteControl doesn't let // REMINDER: This function is not even called if SpriteControl doesn't let
// it get called // it get called
@ -794,7 +793,7 @@ DoActorActionDecide(short SpriteNum)
if (!u->DidAlert && ICanSee) if (!u->DidAlert && ICanSee)
{ {
DoActorNoise(InitActorAlertNoise, SpriteNum); DoActorNoise(InitActorAlertNoise, SpriteNum);
u->DidAlert = TRUE; u->DidAlert = true;
} }
return action; return action;

View file

@ -71,12 +71,12 @@ extern ATTRIBUTE DefaultAttrib;
// AI.C functions // AI.C functions
void DebugMoveHit(short SpriteNum); void DebugMoveHit(short SpriteNum);
SWBOOL ActorMoveHitReact(short SpriteNum); bool ActorMoveHitReact(short SpriteNum);
SWBOOL ActorFlaming(short SpriteNum); bool ActorFlaming(short SpriteNum);
void DoActorSetSpeed(short SpriteNum,uint8_t speed); void DoActorSetSpeed(short SpriteNum,uint8_t speed);
short ChooseActionNumber(short decision[]); short ChooseActionNumber(short decision[]);
int DoActorNoise(ANIMATORp Action,short SpriteNum); int DoActorNoise(ANIMATORp Action,short SpriteNum);
int CanSeePlayer(short SpriteNum); bool CanSeePlayer(short SpriteNum);
int CanHitPlayer(short SpriteNum); int CanHitPlayer(short SpriteNum);
int DoActorPickClosePlayer(short SpriteNum); int DoActorPickClosePlayer(short SpriteNum);
int CloseRangeDist(SPRITEp sp1,SPRITEp sp2); int CloseRangeDist(SPRITEp sp1,SPRITEp sp2);

View file

@ -59,7 +59,7 @@ struct NODETREEstruct
{ {
short SpriteNum; // Sprite number in sprite array of goal item short SpriteNum; // Sprite number in sprite array of goal item
NODEp tree; // This is the node tree used to navigate to goal 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 // other bots cannot modify it while it's locked
}; };

View file

@ -590,11 +590,11 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
if (!break_info) if (!break_info)
{ {
return FALSE; return false;
} }
// Check to see if it should break with current weapon type // 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) 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; short SpriteNum;
SPRITEp sp; SPRITEp sp;
@ -668,7 +668,7 @@ SWBOOL UserBreakWall(WALLp wp, short)
int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN; int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN;
int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY; int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY;
int flags = block_flags|type_flags; int flags = block_flags|type_flags;
short ret = FALSE; bool ret = false;
SpriteNum = FindBreakSpriteMatch(match); SpriteNum = FindBreakSpriteMatch(match);
@ -684,13 +684,13 @@ SWBOOL UserBreakWall(WALLp wp, short)
wp->hitag = wp->lotag = 0; wp->hitag = wp->lotag = 0;
if (wp->nextwall >= 0) if (wp->nextwall >= 0)
wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0;
return TRUE; return true;
} }
sp = &sprite[SpriteNum]; sp = &sprite[SpriteNum];
if (wp->picnum == SP_TAG5(sp)) if (wp->picnum == SP_TAG5(sp))
return TRUE; return true;
// make it BROKEN // make it BROKEN
if (SP_TAG7(sp) <= 1) if (SP_TAG7(sp) <= 1)
@ -705,7 +705,7 @@ SWBOOL UserBreakWall(WALLp wp, short)
wp->hitag = wp->lotag = 0; wp->hitag = wp->lotag = 0;
if (wp->nextwall >= 0) if (wp->nextwall >= 0)
wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0;
ret = FALSE; ret = false;
} }
else if (SP_TAG8(sp) == 1) else if (SP_TAG8(sp) == 1)
{ {
@ -718,7 +718,7 @@ SWBOOL UserBreakWall(WALLp wp, short)
if (wp->nextwall >= 0) if (wp->nextwall >= 0)
wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0;
ret = TRUE; ret = true;
} }
else if (SP_TAG8(sp) == 2) else if (SP_TAG8(sp) == 2)
{ {
@ -735,7 +735,7 @@ SWBOOL UserBreakWall(WALLp wp, short)
if (wp->nextwall >= 0) if (wp->nextwall >= 0)
wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0; wall[wp->nextwall].hitag = wall[wp->nextwall].lotag = 0;
ret = FALSE; ret = false;
} }
return ret; return ret;
@ -748,7 +748,7 @@ SWBOOL UserBreakWall(WALLp wp, short)
DoSpawnSpotsForDamage(match); DoSpawnSpotsForDamage(match);
} }
return FALSE; return false;
} }
int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang) 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) if (*sectnum < 0)
{ {
*x = INT32_MAX; // don't spawn shrap, just change wall *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 // 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; short match = wp->hitag;
if (match > 0) if (match > 0)
{ {
UserBreakWall(wp, ang); UserBreakWall(wp, ang);
return TRUE; return true;
} }
//if (hit_x == INT32_MAX) //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); AutoBreakWall(wp, hit_x, hit_y, hit_z, ang, type);
return TRUE; return true;
} }
// //
@ -891,14 +891,14 @@ int UserBreakSprite(short BreakSprite)
DeleteNoSoundOwner(BreakSprite); DeleteNoSoundOwner(BreakSprite);
//change_sprite_stat(BreakSprite, STAT_SUICIDE); //change_sprite_stat(BreakSprite, STAT_SUICIDE);
KillBreakSprite(BreakSprite); KillBreakSprite(BreakSprite);
return TRUE; return true;
} }
sp = &sprite[SpriteNum]; sp = &sprite[SpriteNum];
match_extra = SP_TAG6(bp); match_extra = SP_TAG6(bp);
if (bp->picnum == SP_TAG5(sp)) if (bp->picnum == SP_TAG5(sp))
return TRUE; return true;
// make it BROKEN // make it BROKEN
if (SP_TAG7(sp) <= 1) if (SP_TAG7(sp) <= 1)
@ -921,7 +921,7 @@ int UserBreakSprite(short BreakSprite)
KillBreakSprite(BreakSprite); KillBreakSprite(BreakSprite);
//KillSprite(BreakSprite); //KillSprite(BreakSprite);
//change_sprite_stat(BreakSprite, STAT_SUICIDE); //change_sprite_stat(BreakSprite, STAT_SUICIDE);
return TRUE; return true;
} }
else if (SP_TAG8(sp) == 2) else if (SP_TAG8(sp) == 2)
// leave it // leave it
@ -946,7 +946,7 @@ int UserBreakSprite(short BreakSprite)
DoSpawnSpotsForDamage(match_extra); DoSpawnSpotsForDamage(match_extra);
} }
return FALSE; return false;
} }
int AutoBreakSprite(short BreakSprite, short type) 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); //DSPRINTF(ds,"Break Info not found - sprite %d", bp - sprite);
MONO_PRINT(ds); MONO_PRINT(ds);
return FALSE; return false;
} }
// Check to see if it should break with current weapon type // 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); RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
} }
return FALSE; return false;
} }
RESET(bp->extra, SPRX_BREAKABLE); RESET(bp->extra, SPRX_BREAKABLE);
@ -1012,7 +1012,7 @@ int AutoBreakSprite(short BreakSprite, short type)
KillBreakSprite(BreakSprite); KillBreakSprite(BreakSprite);
//change_sprite_stat(BreakSprite, STAT_SUICIDE); //change_sprite_stat(BreakSprite, STAT_SUICIDE);
//KillSprite(BreakSprite); //KillSprite(BreakSprite);
return TRUE; return true;
} }
else else
{ {
@ -1021,26 +1021,26 @@ int AutoBreakSprite(short BreakSprite, short type)
RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); 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 // a Null Actor is defined as an actor that has no real controlling programming attached
// check to see if attached to SO // check to see if attached to SO
if (TEST(u->Flags, SPR_SO_ATTACHED)) if (TEST(u->Flags, SPR_SO_ATTACHED))
return TRUE; return true;
// does not have a STATE or FUNC to control it // does not have a STATE or FUNC to control it
if (!u->State) if (!u->State)
return TRUE; return true;
// does not have a STATE or FUNC to control it // does not have a STATE or FUNC to control it
if (!u->ActorActionFunc) if (!u->ActorActionFunc)
return TRUE; return true;
return FALSE; return false;
} }
int HitBreakSprite(short BreakSprite, short type) int HitBreakSprite(short BreakSprite, short type)
@ -1051,12 +1051,12 @@ int HitBreakSprite(short BreakSprite, short type)
//SPRITEp sp; //SPRITEp sp;
// ignore as a breakable if true // ignore as a breakable if true
//if (sp->lotag == TAG_SPRITE_HIT_MATCH) //if (sp->lotag == TAG_SPRITE_HIT_MATCH)
// return(FALSE); // return(false);
if (TEST_BOOL1(bp)) if (TEST_BOOL1(bp))
{ {
if (TEST_BOOL2(bp)) if (TEST_BOOL2(bp))
return FALSE; return false;
return UserBreakSprite(BreakSprite); return UserBreakSprite(BreakSprite);
} }
@ -1069,7 +1069,7 @@ int HitBreakSprite(short BreakSprite, short type)
SpawnShrap(BreakSprite, -1); SpawnShrap(BreakSprite, -1);
RESET(bp->extra, SPRX_BREAKABLE); RESET(bp->extra, SPRX_BREAKABLE);
return FALSE; return false;
} }
return AutoBreakSprite(BreakSprite,type); return AutoBreakSprite(BreakSprite,type);

View file

@ -48,9 +48,9 @@ void SortBreakInfo(void);
BREAK_INFOp SetupWallForBreak(WALLp wallp); BREAK_INFOp SetupWallForBreak(WALLp wallp);
BREAK_INFOp SetupSpriteForBreak(SPRITEp sp); BREAK_INFOp SetupSpriteForBreak(SPRITEp sp);
short FindBreakSpriteMatch(short match); 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); 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); int WallBreakPosition(short hit_wall, short *sectnum, int *x, int *y, int *z, short *ang);
void SortBreakInfo(void); void SortBreakInfo(void);

View file

@ -832,7 +832,7 @@ PickBunnyJumpSpeed(short SpriteNum, int pix_height)
u->jump_speed = -600; u->jump_speed = -600;
u->jump_grav = 8; u->jump_grav = 8;
while (TRUE) while (true)
{ {
if (GetBunnyJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20) if (GetBunnyJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20)
break; break;
@ -855,7 +855,6 @@ DoBunnyBeginJumpAttack(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp; SPRITEp psp = User[SpriteNum]->tgt_sp;
int CanSeePlayer(short SpriteNum);
short tang; short tang;
tang = getangle(psp->x - sp->x, psp->y - sp->y); tang = getangle(psp->x - sp->x, psp->y - sp->y);
@ -931,7 +930,7 @@ DoPickCloseBunny(short SpriteNum)
// if actor can still see the player // if actor can still see the player
int look_height = SPRITEp_TOS(sp); int look_height = SPRITEp_TOS(sp);
SWBOOL ICanSee = FALSE; bool ICanSee = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti)
{ {
@ -965,7 +964,7 @@ DoBunnyQuickJump(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[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) if (!u->lo_sp && u->spal == PALETTE_PLAYER8 && MoveSkip4)
DoPickCloseBunny(SpriteNum); DoPickCloseBunny(SpriteNum);
@ -977,12 +976,12 @@ DoBunnyQuickJump(short SpriteNum)
SPRITEp tsp = u->lo_sp; SPRITEp tsp = u->lo_sp;
USERp tu = User[hit_sprite]; 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 // Not mature enough yet
if (sp->xrepeat != 64 || sp->yrepeat != 64) return FALSE; if (sp->xrepeat != 64 || sp->yrepeat != 64) return false;
if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return FALSE; if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return false;
// Kill a rival // Kill a rival
// Only males fight // Only males fight
@ -995,7 +994,7 @@ DoBunnyQuickJump(short SpriteNum)
tu->Health = 0; tu->Health = 0;
// Blood fountains // Blood fountains
InitBloodSpray(hit_sprite,TRUE,-1); InitBloodSpray(hit_sprite,true,-1);
if (SpawnShrap(hit_sprite, SpriteNum)) if (SpawnShrap(hit_sprite, SpriteNum))
{ {
@ -1007,7 +1006,7 @@ DoBunnyQuickJump(short SpriteNum)
Bunny_Count--; // Bunny died Bunny_Count--; // Bunny died
u->lo_sp = NULL; u->lo_sp = NULL;
return TRUE; return true;
} }
} }
} }
@ -1020,11 +1019,11 @@ DoBunnyQuickJump(short SpriteNum)
USERp tu = User[hit_sprite]; 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 // Not mature enough to mate yet
if (sp->xrepeat != 64 || sp->yrepeat != 64) return FALSE; if (sp->xrepeat != 64 || sp->yrepeat != 64) return false;
if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return FALSE; if (tsp->xrepeat != 64 || tsp->yrepeat != 64) return false;
if (tu->ShellNum <= 0 && tu->WaitTics <= 0 && u->WaitTics <= 0) if (tu->ShellNum <= 0 && tu->WaitTics <= 0 && u->WaitTics <= 0)
{ {
@ -1032,7 +1031,7 @@ DoBunnyQuickJump(short SpriteNum)
{ {
PLAYERp pp = NULL; 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); DoActorPickClosePlayer(SpriteNum);
@ -1041,7 +1040,7 @@ DoBunnyQuickJump(short SpriteNum)
if (tu->spal != PALETTE_PLAYER0) if (tu->spal != PALETTE_PLAYER0)
{ {
if (tu->Flag1 > 0) return FALSE; if (tu->Flag1 > 0) return false;
tu->FlagOwner = 1; // FAG! tu->FlagOwner = 1; // FAG!
tu->Flag1 = SEC(10); tu->Flag1 = SEC(10);
if (pp) if (pp)
@ -1091,12 +1090,12 @@ DoBunnyQuickJump(short SpriteNum)
SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
} }
u->WaitTics = tu->WaitTics = SEC(10); // Mate for this long 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 Bunny_Count--; // Bunny died
// Blood fountains // Blood fountains
InitBloodSpray(Weapon,TRUE,-1); InitBloodSpray(Weapon,true,-1);
if (SpawnShrap(Weapon, New)) if (SpawnShrap(Weapon, New))
{ {
@ -1394,8 +1393,8 @@ DoBunnyMove(short SpriteNum)
int int
BunnySpew(short SpriteNum) BunnySpew(short SpriteNum)
{ {
//InitBloodSpray(SpriteNum,TRUE,-1); //InitBloodSpray(SpriteNum,true,-1);
InitBloodSpray(SpriteNum,TRUE,-1); InitBloodSpray(SpriteNum,true,-1);
return 0; return 0;
} }

View file

@ -47,7 +47,7 @@ BEGIN_SW_NS
// It will save out the tile and sound number every time one caches. // It will save out the tile and sound number every time one caches.
// //
// sw -map $bullet -cacheprint > foofile // sw -map $bullet -cacheprint > foofile
extern SWBOOL PreCaching; extern bool PreCaching;
void PreCacheTable(short table[], int num); void PreCacheTable(short table[], int num);
void PreCacheGhost(void); void PreCacheGhost(void);

View file

@ -45,10 +45,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
SWBOOL CheatInputMode = FALSE; bool CheatInputMode = false;
SWBOOL EveryCheat = FALSE; bool EveryCheat = false;
SWBOOL mapcheat = false; bool mapcheat = false;
extern SWBOOL FAF_DebugView; extern bool FAF_DebugView;
const char *CheatKeyType; const char *CheatKeyType;
void KeysCheat(PLAYERp pp, const char *cheat_string); void KeysCheat(PLAYERp pp, const char *cheat_string);
@ -103,7 +103,7 @@ bool RestartCheat(cheatseq_t* c)
bool RoomCheat(cheatseq_t* c) bool RoomCheat(cheatseq_t* c)
{ {
FAF_DebugView ^= 1; FAF_DebugView = !FAF_DebugView;
return true; return true;
} }
@ -161,7 +161,7 @@ bool WarpCheat(cheatseq_t* c)
bool EveryCheatToggle(cheatseq_t* c) bool EveryCheatToggle(cheatseq_t* c)
{ {
EveryCheat ^= 1; EveryCheat = !EveryCheat;
C_DoCommand("god"); C_DoCommand("god");
C_DoCommand("give weapons"); C_DoCommand("give weapons");
C_DoCommand("give items"); C_DoCommand("give items");
@ -219,7 +219,7 @@ static void ItemCheat(int player)
{ {
auto p = &Player[player]; auto p = &Player[player];
PutStringInfo(p, GStrings("GIVING EVERYTHING!")); PutStringInfo(p, GStrings("GIVING EVERYTHING!"));
memset(p->HasKey, TRUE, sizeof(p->HasKey)); memset(p->HasKey, true, sizeof(p->HasKey));
p->WpnShotgunAuto = 50; p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5; p->WpnRocketHeat = 5;
@ -299,7 +299,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
break; break;
case GIVE_KEYS: 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")); PutStringInfo(&Player[player], GStrings("TXTS_GIVEKEY"));
break; break;

View file

@ -225,77 +225,77 @@ InitPalette(void)
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
tempbuf[i] = i; tempbuf[i] = i;
// palette for underwater // 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++) for (i = 0; i < 256; i++)
tempbuf[i] = 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++) for (i = 0; i < 256; i++)
tempbuf[i] = 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 // 1 Range changes
// //
MapColors(PALETTE_BROWN_RIPPER, BrownRipper, TRUE, tempbuf); MapColors(PALETTE_BROWN_RIPPER, BrownRipper, true, tempbuf);
lookups.makeTable(PALETTE_BROWN_RIPPER, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_BROWN_RIPPER, tempbuf, 0, 0, 0, true);
MapColors(PALETTE_SKEL_GORE, SkelGore, TRUE, tempbuf); MapColors(PALETTE_SKEL_GORE, SkelGore, true, tempbuf);
lookups.makeTable(PALETTE_SKEL_GORE, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_SKEL_GORE, tempbuf, 0, 0, 0, true);
MapColors(PALETTE_ELECTRO_GORE, ElectroGore, TRUE, tempbuf); MapColors(PALETTE_ELECTRO_GORE, ElectroGore, true, tempbuf);
lookups.makeTable(PALETTE_ELECTRO_GORE, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_ELECTRO_GORE, tempbuf, 0, 0, 0, true);
MapColors(PALETTE_MENU_HIGHLIGHT, MenuHighlight, TRUE, tempbuf); MapColors(PALETTE_MENU_HIGHLIGHT, MenuHighlight, true, tempbuf);
lookups.makeTable(PALETTE_MENU_HIGHLIGHT, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_MENU_HIGHLIGHT, tempbuf, 0, 0, 0, true);
// //
// Multiple range changes // 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++) for (i = 1; i < SIZ(NinjaBasic); i++)
MapColors(PALETTE_BASIC_NINJA, NinjaBasic[i], FALSE, tempbuf); MapColors(PALETTE_BASIC_NINJA, NinjaBasic[i], false, tempbuf);
lookups.makeTable(PALETTE_BASIC_NINJA, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(NinjaRed); i++)
MapColors(PALETTE_RED_NINJA, NinjaRed[i], FALSE, tempbuf); MapColors(PALETTE_RED_NINJA, NinjaRed[i], false, tempbuf);
lookups.makeTable(PALETTE_RED_NINJA, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(NinjaGreen); i++)
MapColors(PALETTE_GREEN_NINJA, NinjaGreen[i], FALSE, tempbuf); MapColors(PALETTE_GREEN_NINJA, NinjaGreen[i], false, tempbuf);
lookups.makeTable(PALETTE_GREEN_NINJA, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(AllToGreen); i++)
MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[i], FALSE, tempbuf); MapColors(PALETTE_GREEN_LIGHTING, AllToGreen[i], false, tempbuf);
lookups.makeTable(PALETTE_GREEN_LIGHTING, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(AllToRed); i++)
MapColors(PALETTE_RED_LIGHTING, AllToRed[i], FALSE, tempbuf); MapColors(PALETTE_RED_LIGHTING, AllToRed[i], false, tempbuf);
lookups.makeTable(PALETTE_RED_LIGHTING, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(AllToBlue); i++)
MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[i], FALSE, tempbuf); MapColors(PALETTE_BLUE_LIGHTING, AllToBlue[i], false, tempbuf);
lookups.makeTable(PALETTE_BLUE_LIGHTING, tempbuf, 0, 0, 0, TRUE); 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++) for (i = 1; i < SIZ(Illuminate); i++)
MapColors(PALETTE_ILLUMINATE, Illuminate[i], FALSE, tempbuf); MapColors(PALETTE_ILLUMINATE, Illuminate[i], false, tempbuf);
lookups.makeTable(PALETTE_ILLUMINATE, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_ILLUMINATE, tempbuf, 0, 0, 0, true);
// PLAYER COLORS - ALSO USED FOR OTHER THINGS // PLAYER COLORS - ALSO USED FOR OTHER THINGS
for (play = 0; play < PLAYER_COLOR_MAPS; play++) for (play = 0; play < PLAYER_COLOR_MAPS; play++)
{ {
MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], TRUE, tempbuf); MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], true, tempbuf);
MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], FALSE, tempbuf); MapColors(PALETTE_PLAYER0 + play, PlayerColorMap[play][0], false, tempbuf);
lookups.makeTable(PALETTE_PLAYER0 + play, tempbuf, 0, 0, 0, TRUE); lookups.makeTable(PALETTE_PLAYER0 + play, tempbuf, 0, 0, 0, true);
} }
// //
@ -307,7 +307,7 @@ InitPalette(void)
// invert the brown palette // invert the brown palette
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
tempbuf[LT_BROWN + i] = (LT_BROWN + 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);
} }

View file

@ -640,8 +640,8 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
// If blocking bits get unset, just die // If blocking bits get unset, just die
if (!TEST(sp->cstat,CSTAT_SPRITE_BLOCK) || !TEST(sp->cstat,CSTAT_SPRITE_BLOCK_HITSCAN)) 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); UpdateSinglePlayKills(SpriteNum);
SetSuicide(SpriteNum); SetSuicide(SpriteNum);
} }

View file

@ -197,7 +197,7 @@ void CopySectorMatch(short match)
// update sprites postions so they aren't in the // update sprites postions so they aren't in the
// wrong place for one frame // wrong place for one frame
GlobSpeedSO = 0; GlobSpeedSO = 0;
RefreshPoints(sop, 0, 0, TRUE); RefreshPoints(sop, 0, 0, true);
} }
} }
} }

View file

@ -202,7 +202,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
map = FindMapByLevelNum(1); map = FindMapByLevelNum(1);
if (!map) return; if (!map) return;
CameraTestMode = FALSE; CameraTestMode = false;
StopFX(); StopFX();
//InitNewGame(); //InitNewGame();

View file

@ -58,11 +58,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
static int OverlapDraw = FALSE; static int OverlapDraw = false;
extern SWBOOL QuitFlag, SpriteInfo; extern bool QuitFlag, SpriteInfo;
extern SWBOOL Voxel; extern bool Voxel;
extern char buffer[]; extern char buffer[];
SWBOOL DrawScreen; bool DrawScreen;
extern short f_c; extern short f_c;
extern ParentalStruct aVoxelArray[MAXTILES]; extern ParentalStruct aVoxelArray[MAXTILES];
@ -253,7 +253,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp)
break; break;
default: default:
ASSERT(TRUE == FALSE); ASSERT(true == false);
break; break;
} }
@ -261,7 +261,7 @@ DoShadowFindGroundPoint(tspriteptr_t sp)
} }
void void
DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror) DoShadows(tspriteptr_t tsp, int viewz, bool mirror)
{ {
tspriteptr_t New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner];
@ -560,7 +560,7 @@ void DoStarView(tspriteptr_t tsp, USERp tu, int viewz)
} }
void void
analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) analyzesprites(int viewx, int viewy, int viewz, bool mirror)
{ {
int tSpriteNum; int tSpriteNum;
short SpriteNum; short SpriteNum;
@ -708,13 +708,13 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
// if sector pal is something other than default // if sector pal is something other than default
SECT_USERp sectu = SectUser[tsp->sectnum]; SECT_USERp sectu = SectUser[tsp->sectnum];
uint8_t pal = sector[tsp->sectnum].floorpal; 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 // sprite does not take on the new pal if sector flag is set
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE)) if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
{ {
pal = PALETTE_DEFAULT; pal = PALETTE_DEFAULT;
nosectpal = TRUE; nosectpal = true;
} }
//if(tu->spal == PALETTE_DEFAULT) //if(tu->spal == PALETTE_DEFAULT)
@ -1176,7 +1176,7 @@ FString GameInterface::GetCoordString()
out.AppendFormat("POSX:%d ", pp->posx); out.AppendFormat("POSX:%d ", pp->posx);
out.AppendFormat("POSY:%d ", pp->posy); out.AppendFormat("POSY:%d ", pp->posy);
out.AppendFormat("POSZ:%d ", pp->posz); out.AppendFormat("POSZ:%d ", pp->posz);
out.AppendFormat("ANG:%d\n", FixedToInt(pp->camq16ang)); out.AppendFormat("ANG:%d\n", FixedToInt(pp->q16ang));
return out; return out;
} }
@ -1257,7 +1257,7 @@ void SpriteSortList2D(int tx, int ty)
void DrawCrosshair(PLAYERp pp) void DrawCrosshair(PLAYERp pp)
{ {
extern SWBOOL CameraTestMode; extern bool CameraTestMode;
if (!(CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) 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; int i,nexti;
short ang; short ang;
SPRITEp sp; SPRITEp sp;
SWBOOL found_camera = FALSE; bool found_camera = false;
SWBOOL player_in_camera = FALSE; bool player_in_camera = false;
SWBOOL FAFcansee_test; bool FAFcansee_test;
SWBOOL ang_test; bool ang_test;
if (pp == &Player[screenpeek]) if (pp == &Player[screenpeek])
{ {
@ -1308,7 +1308,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
case 1: case 1:
pp->last_camera_sp = sp; pp->last_camera_sp = sp;
CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100); CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100);
found_camera = TRUE; found_camera = true;
break; break;
default: default:
@ -1346,7 +1346,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
*tz = sp->z; *tz = sp->z;
*tsectnum = sp->sectnum; *tsectnum = sp->sectnum;
found_camera = TRUE; found_camera = true;
break; 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 DoPlayerDiveMeter(PLAYERp pp);
void MoveScrollMode2D(PLAYERp pp);
void void
drawscreen(PLAYERp pp, double smoothratio) drawscreen(PLAYERp pp, double smoothratio)
{ {
extern SWBOOL CameraTestMode; extern bool CameraTestMode;
int tx, ty, tz; int tx, ty, tz;
fixed_t tq16horiz, tq16ang; fixed_t tq16horiz, tq16ang;
short tsectnum; short tsectnum;
@ -1618,7 +1617,7 @@ drawscreen(PLAYERp pp, double smoothratio)
int bob_amt = 0; int bob_amt = 0;
int quake_z, quake_x, quake_y; int quake_z, quake_x, quake_y;
short quake_ang; short quake_ang;
extern SWBOOL FAF_DebugView; extern bool FAF_DebugView;
PLAYERp camerapp; // prediction player if prediction is on, else regular player PLAYERp camerapp; // prediction player if prediction is on, else regular player
// last valid stuff // last valid stuff
@ -1627,7 +1626,7 @@ drawscreen(PLAYERp pp, double smoothratio)
int const viewingRange = viewingrange; int const viewingRange = viewingrange;
DrawScreen = TRUE; DrawScreen = true;
PreDraw(); PreDraw();
PreUpdatePanel(smoothratio); PreUpdatePanel(smoothratio);
@ -1650,23 +1649,18 @@ drawscreen(PLAYERp pp, double smoothratio)
tx = camerapp->oposx + xs_CRoundToInt(fmulscale16(camerapp->posx - camerapp->oposx, smoothratio)); tx = camerapp->oposx + xs_CRoundToInt(fmulscale16(camerapp->posx - camerapp->oposx, smoothratio));
ty = camerapp->oposy + xs_CRoundToInt(fmulscale16(camerapp->posy - camerapp->oposy, smoothratio)); ty = camerapp->oposy + xs_CRoundToInt(fmulscale16(camerapp->posy - camerapp->oposy, smoothratio));
tz = camerapp->oposz + xs_CRoundToInt(fmulscale16(camerapp->posz - camerapp->oposz, 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 // Interpolate the player's angle while on a sector object, just like VoidSW.
if (cl_syncinput || (pp != Player+myconnectindex) || // This isn't needed for the turret as it was fixable, but moving sector objects are problematic.
(TEST(pp->Flags, PF_DEAD) && (loc.q16avel == 0))) 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)); 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)); 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 else
{ {
tq16ang = pp->camq16ang; tq16ang = pp->q16ang;
tq16horiz = pp->camq16horiz; tq16horiz = pp->q16horiz;
} }
tsectnum = camerapp->cursectnum; tsectnum = camerapp->cursectnum;
@ -1706,7 +1700,7 @@ drawscreen(PLAYERp pp, double smoothratio)
tx = tx + quake_x; tx = tx + quake_x;
ty = ty + quake_y; ty = ty + quake_y;
//tq16horiz = tq16horiz + IntToFixed(quake_x); //tq16horiz = tq16horiz + IntToFixed(quake_x);
tq16ang = IntToFixed(NORM_ANGLE(FixedToInt(tq16ang) + quake_ang)); tq16ang = NORM_Q16ANGLE(tq16ang + quake_ang);
if (pp->sop_remote) 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)); tz += pp->obob_z + xs_CRoundToInt(fmulscale16(pp->bob_z - pp->obob_z, smoothratio));
// recoil only when not in camera // 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 = max(tq16horiz, IntToFixed(PLAYER_HORIZ_MIN));
tq16horiz = min(tq16horiz, IntToFixed(PLAYER_HORIZ_MAX)); tq16horiz = min(tq16horiz, IntToFixed(PLAYER_HORIZ_MAX));
} }
@ -1750,9 +1744,9 @@ drawscreen(PLAYERp pp, double smoothratio)
videoSetCorrectedAspect(); videoSetCorrectedAspect();
renderSetAspect(xs_CRoundToInt(double(viewingrange)* tan(r_fov* (PI / 360.))), yxaspect); renderSetAspect(xs_CRoundToInt(double(viewingrange)* tan(r_fov* (PI / 360.))), yxaspect);
OverlapDraw = TRUE; OverlapDraw = true;
DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum); DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
OverlapDraw = FALSE; OverlapDraw = false;
if (automapMode != am_full)// && !ScreenSavePic) if (automapMode != am_full)// && !ScreenSavePic)
{ {
@ -1766,7 +1760,7 @@ drawscreen(PLAYERp pp, double smoothratio)
if (!FAF_DebugView) if (!FAF_DebugView)
FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum); FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
analyzesprites(tx, ty, tz, FALSE); analyzesprites(tx, ty, tz, false);
post_analyzesprites(); post_analyzesprites();
renderDrawMasks(); renderDrawMasks();
@ -1819,7 +1813,7 @@ drawscreen(PLAYERp pp, double smoothratio)
// if doing a screen save don't need to process the rest // if doing a screen save don't need to process the rest
if (ScreenSavePic) if (ScreenSavePic)
{ {
DrawScreen = FALSE; DrawScreen = false;
return; return;
} }
@ -1855,19 +1849,19 @@ drawscreen(PLAYERp pp, double smoothratio)
{ {
if (ReloadPrompt) if (ReloadPrompt)
{ {
ReloadPrompt = FALSE; ReloadPrompt = false;
} }
} }
PostDraw(); PostDraw();
DrawScreen = FALSE; DrawScreen = false;
} }
bool GameInterface::GenerateSavePic() bool GameInterface::GenerateSavePic()
{ {
ScreenSavePic = TRUE; ScreenSavePic = true;
drawscreen(Player + myconnectindex, 65536); drawscreen(Player + myconnectindex, 65536);
ScreenSavePic = FALSE; ScreenSavePic = false;
return true; return true;
} }
@ -1904,7 +1898,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
{ {
if (sprite[Player[p].PlayerSprite].xvel > 16) if (sprite[Player[p].PlayerSprite].xvel > 16)
pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3); pspr_ndx[myconnectindex] = ((PlayClock >> 4) & 3);
sprisplayer = TRUE; sprisplayer = true;
goto SHOWSPRITE; goto SHOWSPRITE;
} }

View file

@ -96,16 +96,16 @@ extern int sw_snd_scratch;
int GameVersion = 20; int GameVersion = 20;
SWBOOL NoMeters = false; bool NoMeters = false;
SWBOOL FinishAnim = 0; int FinishAnim = 0;
SWBOOL ReloadPrompt = false; bool ReloadPrompt = false;
SWBOOL NewGame = false; bool NewGame = false;
SWBOOL SavegameLoaded = false; bool SavegameLoaded = false;
//Miscellaneous variables //Miscellaneous variables
SWBOOL FinishedLevel = false; bool FinishedLevel = false;
short screenpeek = 0; short screenpeek = 0;
SWBOOL PreCaching = TRUE; bool PreCaching = true;
int GodMode = false; int GodMode = false;
short Skill = 2; short Skill = 2;
short TotalKillable; short TotalKillable;
@ -116,20 +116,19 @@ const GAME_SET gs_defaults =
0, // GameType 0, // GameType
0, // Monsters 0, // Monsters
false, // HurtTeammate false, // HurtTeammate
TRUE, // SpawnMarkers Markers true, // SpawnMarkers Markers
false, // TeamPlay false, // TeamPlay
0, // Kill Limit 0, // Kill Limit
0, // Time Limit 0, // Time Limit
0, // Color 0, // Color
TRUE, // nuke true, // nuke
}; };
GAME_SET gs; GAME_SET gs;
SWBOOL PlayerTrackingMode = false; bool PlayerTrackingMode = false;
SWBOOL SlowMode = false; bool SlowMode = false;
SWBOOL FrameAdvanceTics = 3;
SWBOOL DebugOperate = false; bool DebugOperate = false;
void LoadingLevelScreen(void); void LoadingLevelScreen(void);
uint8_t FakeMultiNumPlayers; uint8_t FakeMultiNumPlayers;
@ -138,14 +137,14 @@ int totalsynctics;
int OrigCommPlayers=0; int OrigCommPlayers=0;
extern uint8_t CommPlayers; extern uint8_t CommPlayers;
extern SWBOOL CommEnabled; extern bool CommEnabled;
SWBOOL CameraTestMode = false; bool CameraTestMode = false;
char ds[645]; // debug string char ds[645]; // debug string
extern short NormalVisibility; extern short NormalVisibility;
SWBOOL CommandSetup = false; bool CommandSetup = false;
char buffer[80], ch; char buffer[80], ch;
@ -175,7 +174,7 @@ void GameInterface::app_init()
for (int i = 0; i < MAX_SW_PLAYERS; i++) for (int i = 0; i < MAX_SW_PLAYERS; i++)
INITLIST(&Player[i].PanelSpriteList); INITLIST(&Player[i].PanelSpriteList);
DebugOperate = TRUE; DebugOperate = true;
enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;
if (SW_SHAREWARE) if (SW_SHAREWARE)
@ -292,7 +291,7 @@ void InitLevelGlobals2(void)
InitTimingVars(); InitTimingVars();
TotalKillable = 0; TotalKillable = 0;
Bunny_Count = 0; Bunny_Count = 0;
FinishAnim = 0; FinishAnim = false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -576,7 +575,7 @@ void GameInterface::LevelCompleted(MapRecord *map, int skill)
if (map == nullptr) if (map == nullptr)
{ {
STAT_Update(true); STAT_Update(true);
FinishAnim = 0; FinishAnim = false;
PlaySong(nullptr, ThemeSongs[0], ThemeTrack[0]); PlaySong(nullptr, ThemeSongs[0], ThemeTrack[0]);
if (SW_SHAREWARE) gameaction = ga_creditsmenu; if (SW_SHAREWARE) gameaction = ga_creditsmenu;
else gameaction = ga_mainmenu; else gameaction = ga_mainmenu;
@ -687,7 +686,7 @@ void GameInterface::ErrorCleanup()
// Make sure we do not leave the game in an unstable state // Make sure we do not leave the game in an unstable state
TerminateLevel(); TerminateLevel();
SavegameLoaded = false; SavegameLoaded = false;
FinishAnim = 0; FinishAnim = false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //

View file

@ -62,13 +62,13 @@ typedef struct
// Net Options from Menus // Net Options from Menus
uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn] uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn]
uint8_t NetMonsters; // Cycle skill levels uint8_t NetMonsters; // Cycle skill levels
SWBOOL NetHurtTeammate; // Allow friendly kills bool NetHurtTeammate; // Allow friendly kills
SWBOOL NetSpawnMarkers; // Respawn markers on/off bool NetSpawnMarkers; // Respawn markers on/off
SWBOOL NetTeamPlay; // Team play bool NetTeamPlay; // Team play
uint8_t NetKillLimit; // Number of frags at which game ends uint8_t NetKillLimit; // Number of frags at which game ends
uint8_t NetTimeLimit; // Limit time of game uint8_t NetTimeLimit; // Limit time of game
uint8_t NetColor; // Chosen color for player uint8_t NetColor; // Chosen color for player
SWBOOL NetNuke; bool NetNuke;
} GAME_SET, * GAME_SETp; } GAME_SET, * GAME_SETp;
extern const GAME_SET gs_defaults; extern const GAME_SET gs_defaults;
@ -155,7 +155,7 @@ y++
// //
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
extern SWBOOL MenuInputMode; extern bool MenuInputMode;
// //
// Defines // 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) #define SET_SPRITE_TAG14(sp,val) (*((short*)&sprite[sp].xrepeat)) = B_LITTLE16((short)val)
// OVER and UNDER water macros // OVER and UNDER water macros
#define SpriteInDiveArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? 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 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 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 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_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)) #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 extern char *DLL_path; // DLL path name
int DLL_Load(char *DLLpathname); int DLL_Load(char *DLLpathname);
SWBOOL DLL_Unload(int procHandle); bool DLL_Unload(int procHandle);
SWBOOL DLL_ExecFunc(int procHandle, char *fName); bool DLL_ExecFunc(int procHandle, char *fName);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// //
@ -803,11 +803,9 @@ enum
}; };
extern InputPacket loc;
#define PACK 1 #define PACK 1
extern SWBOOL CameraTestMode; extern bool CameraTestMode;
enum PlayerDeathTypes enum PlayerDeathTypes
{ {
@ -865,7 +863,7 @@ struct PLAYERstruct
int slide_xvect, slide_yvect; int slide_xvect, slide_yvect;
short slide_ang; short slide_ang;
int slide_dec; int slide_dec;
int drive_angvel; int drive_q16avel;
@ -879,17 +877,15 @@ struct PLAYERstruct
short camera_check_time_delay; short camera_check_time_delay;
short cursectnum,lastcursectnum; short cursectnum,lastcursectnum;
short turn180_target; // 180 degree turn fixed_t turn180_target; // 180 degree turn
// variables that do not fit into sprite structure // variables that do not fit into sprite structure
int hvel,tilt,tilt_dest; int hvel,tilt,tilt_dest;
bool centering;
fixed_t q16horiz, q16horizbase, q16horizoff, q16ang; fixed_t q16horiz, q16horizbase, q16horizoff, q16ang;
fixed_t camq16horiz, camq16ang;
short recoil_amt; short recoil_amt;
short recoil_speed; short recoil_speed;
short recoil_ndx; short recoil_ndx;
short recoil_horizoff; fixed_t recoil_horizoff;
int oldposx,oldposy,oldposz; int oldposx,oldposy,oldposz;
int RevolveX, RevolveY; int RevolveX, RevolveY;
@ -958,7 +954,7 @@ struct PLAYERstruct
short InventoryTics[MAX_INVENTORY]; short InventoryTics[MAX_INVENTORY];
short InventoryPercent[MAX_INVENTORY]; short InventoryPercent[MAX_INVENTORY];
int8_t InventoryAmount[MAX_INVENTORY]; int8_t InventoryAmount[MAX_INVENTORY];
SWBOOL InventoryActive[MAX_INVENTORY]; bool InventoryActive[MAX_INVENTORY];
short DiveTics; short DiveTics;
short DiveDamageTics; short DiveDamageTics;
@ -984,10 +980,10 @@ struct PLAYERstruct
// palette fading up and down for player hit and get items // palette fading up and down for player hit and get items
short FadeTics; // Tics between each fade cycle short FadeTics; // Tics between each fade cycle
short FadeAmt; // Current intensity of fade 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 unsigned char StartColor; // Darkest color in color range being used
//short electro[64]; //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 fta,ftq; // First time active and first time quote, for talking in multiplayer games
short NumFootPrints; // Number of foot prints left to lay down short NumFootPrints; // Number of foot prints left to lay down
unsigned char WpnUziType; // Toggle between single or double uzi's if you own 2. 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 WpnShotgunAuto; // 50-0 automatic shotgun rounds
unsigned char WpnShotgunLastShell; // Number of last shell fired unsigned char WpnShotgunLastShell; // Number of last shell fired
unsigned char WpnRailType; // Normal Rail Gun or EMP Burst Mode unsigned char WpnRailType; // Normal Rail Gun or EMP Burst Mode
SWBOOL Bloody; // Is player gooey from the slaughter? bool Bloody; // Is player gooey from the slaughter?
SWBOOL InitingNuke; bool InitingNuke;
SWBOOL TestNukeInit; bool TestNukeInit;
SWBOOL NukeInitialized; // Nuke already has counted down bool NukeInitialized; // Nuke already has counted down
short FistAng; // KungFu attack angle short FistAng; // KungFu attack angle
unsigned char WpnKungFuMove; // KungFu special moves unsigned char WpnKungFuMove; // KungFu special moves
short HitBy; // SpriteNum of whatever player was last hit by short HitBy; // SpriteNum of whatever player was last hit by
@ -1010,6 +1006,14 @@ struct PLAYERstruct
int cookieTime; int cookieTime;
char WpnReloadState; 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]; extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
@ -1021,39 +1025,41 @@ extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
enum enum
{ {
PF_DEAD = (BIT(1)), PF_DEAD = (BIT(1)),
PF_JUMPING = (BIT(2)), PF_JUMPING = (BIT(2)),
PF_FALLING = (BIT(3)), PF_FALLING = (BIT(3)),
PF_LOCK_CRAWL = (BIT(4)), PF_LOCK_CRAWL = (BIT(4)),
PF_LOCK_HORIZ = (BIT(5)), PF_LOCK_HORIZ = (BIT(5)),
PF_LOOKING = (BIT(6)), PF_LOOKING = (BIT(6)),
PF_PLAYER_MOVED = (BIT(7)), PF_PLAYER_MOVED = (BIT(7)),
PF_PLAYER_RIDING = (BIT(8)), PF_PLAYER_RIDING = (BIT(8)),
PF_AUTO_AIM = (BIT(9)), PF_AUTO_AIM = (BIT(9)),
PF_RECOIL = (BIT(10)), PF_RECOIL = (BIT(10)),
PF_FLYING = (BIT(11)), PF_FLYING = (BIT(11)),
PF_WEAPON_RETRACT = (BIT(12)), PF_WEAPON_RETRACT = (BIT(12)),
PF_PICKED_UP_AN_UZI = (BIT(13)), PF_PICKED_UP_AN_UZI = (BIT(13)),
PF_CRAWLING = (BIT(14)), PF_CRAWLING = (BIT(14)),
PF_CLIMBING = (BIT(15)), PF_CLIMBING = (BIT(15)),
PF_SWIMMING = (BIT(16)), PF_SWIMMING = (BIT(16)),
PF_DIVING = (BIT(17)), PF_DIVING = (BIT(17)),
PF_DIVING_IN_LAVA = (BIT(18)), PF_DIVING_IN_LAVA = (BIT(18)),
PF_TWO_UZI = (BIT(19)), PF_TWO_UZI = (BIT(19)),
PF_TURN_180 = (BIT(21)), PF_TURN_180 = (BIT(21)),
PF_DEAD_HEAD = (BIT(22)), // are your a dead head PF_DEAD_HEAD = (BIT(22)), // are your a dead head
PF_HEAD_CONTROL = (BIT(23)), // have control of turning when a head? PF_HEAD_CONTROL = (BIT(23)), // have control of turning when a head?
PF_CLIP_CHEAT = (BIT(24)), // cheat for wall clipping PF_CLIP_CHEAT = (BIT(24)), // cheat for wall clipping
PF_SLIDING = (BIT(25)), // cheat for wall clipping PF_SLIDING = (BIT(25)), // cheat for wall clipping
PF_VIEW_FROM_OUTSIDE = (BIT(26)), PF_VIEW_FROM_OUTSIDE = (BIT(26)),
PF_VIEW_OUTSIDE_WEAPON= (BIT(27)), PF_VIEW_OUTSIDE_WEAPON = (BIT(27)),
PF_VIEW_FROM_CAMERA = (BIT(28)), PF_VIEW_FROM_CAMERA = (BIT(28)),
PF_TANK = (BIT(29)), // Doin the tank thang PF_TANK = (BIT(29)), // Doin the tank thang
PF_MOUSE_AIMING_ON = (BIT(30)), PF_MOUSE_AIMING_ON = (BIT(30)),
PF_WEAPON_DOWN = (BIT(31)), PF_WEAPON_DOWN = (BIT(31)),
PF2_TELEPORTED = (BIT(0)), PF2_TELEPORTED = (BIT(0)),
PF2_INPUT_CAN_TURN = (BIT(1)), // Allow calling DoPlayerTurn from getinput PF2_INPUT_CAN_AIM = (BIT(1)), // Allow calling DoPlayerHorizon() from processMovement()
PF2_INPUT_CAN_AIM = (BIT(2)), // Allow calling DoPlayerHorizon from getinput 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) // Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS)
short FlagOwner; // The spritenum of the original flag short FlagOwner; // The spritenum of the original flag
short Vis; // Shading upgrade, for shooting, etc... 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 int16_t oangdiff; // Used for interpolating sprite angles
@ -1824,8 +1830,8 @@ struct SECTOR_OBJECTstruct
#define SO_OPERATE_TRACK_START 90 #define SO_OPERATE_TRACK_START 90
#define SO_TURRET_MGUN 96 // machine gun #define SO_TURRET_MGUN 96 // machine gun
#define SO_TURRET 97 #define SO_TURRET 97
#define SO_TANK 98 #define SO_VEHICLE 98
#define SO_SPEED_BOAT 99 // #define SO_SPEED_BOAT 99
#define SO_EMPTY(sop) ((sop)->xmid == INT32_MAX) #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); 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_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 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 change_sprite_stat(short, short);
void SetOwner(short, short); void SetOwner(short, short);
void SetAttach(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 ChangeState(short SpriteNum, STATEp statep);
void UpdateSectorFAF_Connect(short SpriteNum, int newz); void UpdateSectorFAF_Connect(short SpriteNum, int newz);
#if 0 #if 0
SWBOOL FAF_ConnectCeiling(short sectnum); bool FAF_ConnectCeiling(short sectnum);
SWBOOL FAF_ConnectFloor(short sectnum); bool FAF_ConnectFloor(short sectnum);
#else #else
#define FAF_PLACE_MIRROR_PIC 341 #define FAF_PLACE_MIRROR_PIC 341
#define FAF_MIRROR_PIC 2356 #define FAF_MIRROR_PIC 2356
@ -1942,14 +1948,14 @@ SWBOOL FAF_ConnectFloor(short sectnum);
//void updatesectorz(int, int, int, short *); //void updatesectorz(int, int, int, short *);
void FAF_ConnectPlayerCeiling(PLAYERp pp); void FAF_ConnectPlayerCeiling(PLAYERp pp);
void FAF_ConnectPlayerFloor(PLAYERp pp); void FAF_ConnectPlayerFloor(PLAYERp pp);
SWBOOL PlayerCeilingHit(PLAYERp pp, int zlimit); bool PlayerCeilingHit(PLAYERp pp, int zlimit);
SWBOOL PlayerFloorHit(PLAYERp pp, int zlimit); bool PlayerFloorHit(PLAYERp pp, int zlimit);
void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
int32_t xvect, int32_t yvect, int32_t zvect, int32_t xvect, int32_t yvect, int32_t zvect,
hitdata_t* hitinfo, int32_t clipmask); 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, void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
int32_t* hiz, int32_t* ceilhit, 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 uint8_t CommPlayers;
extern SWBOOL CommEnabled; extern bool CommEnabled;
extern int LastFrameTics; extern int LastFrameTics;
extern char ds[]; extern char ds[];
extern short Skill; extern short Skill;
extern int GodMode; extern int GodMode;
extern SWBOOL ReloadPrompt; extern bool ReloadPrompt;
//extern unsigned char synctics, lastsynctics; //extern unsigned char synctics, lastsynctics;
extern short snum; extern short snum;
@ -2038,7 +2044,7 @@ extern USER puser[MAX_SW_PLAYERS_REG];
/////////////////////////// ///////////////////////////
extern double smoothratio; extern double smoothratio;
extern SWBOOL MoveSkip4, MoveSkip2, MoveSkip8; extern int MoveSkip4, MoveSkip2, MoveSkip8;
#define MASTER_SWITCHING 1 #define MASTER_SWITCHING 1
@ -2059,7 +2065,7 @@ extern int16_t StatDamageList[STAT_DAMAGE_LIST_SIZE];
#define COLOR_PAIN 128 // Light red range #define COLOR_PAIN 128 // Light red range
extern void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor); extern void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor);
extern void DoPaletteFlash(PLAYERp pp); 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 DrawOverlapRoom(int tx,int ty,int tz,fixed_t tq16ang,fixed_t tq16horiz,short tsectnum); // rooms.c
void SetupMirrorTiles(void); // 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 int GetZadjustment(short sectnum,short hitag); // rooms.c
void InitSetup(void); // setup.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 void SetRotatorActive(short SpriteNum); // rotator.c
SWBOOL VatorSwitch(short match, short setting); // vator.c bool VatorSwitch(short match, short setting); // vator.c
void MoveSpritesWithSector(short sectnum,int z_amt,SWBOOL type); // vator.c void MoveSpritesWithSector(short sectnum,int z_amt,bool type); // vator.c
void SetVatorActive(short SpriteNum); // vator.c void SetVatorActive(short SpriteNum); // vator.c
short DoSpikeMatch(short match); // spike.c short DoSpikeMatch(short match); // spike.c
@ -2136,7 +2142,7 @@ void CopySectorMatch(short match); // copysect.c
int DoWallMoveMatch(short match); // wallmove.c int DoWallMoveMatch(short match); // wallmove.c
int DoWallMove(SPRITEp sp); // 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 short DoSpikeOperate(short sectnum); // spike.c
void SetSpikeActive(short SpriteNum); // spike.c void SetSpikeActive(short SpriteNum); // spike.c
@ -2166,10 +2172,10 @@ extern char PlayerGravity;
extern short wait_active_check_offset; extern short wait_active_check_offset;
//extern short Zombies; //extern short Zombies;
extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust;
extern SWBOOL left_foot; extern bool left_foot;
extern SWBOOL serpwasseen; extern bool serpwasseen;
extern SWBOOL sumowasseen; extern bool sumowasseen;
extern SWBOOL zillawasseen; extern bool zillawasseen;
extern short BossSpriteNum[3]; extern short BossSpriteNum[3];
extern int ChopTics; extern int ChopTics;
extern short Bunny_Count; extern short Bunny_Count;
@ -2202,7 +2208,7 @@ struct GameInterface : ::GameInterface
void QuitToTitle() override; void QuitToTitle() override;
void UpdateSounds() override; void UpdateSounds() override;
void ErrorCleanup() override; void ErrorCleanup() override;
void GetInput(InputPacket* input) override; void GetInput(InputPacket* input, ControlInfo* const hidInput) override;
void DrawBackground(void) override; void DrawBackground(void) override;
void Ticker(void) override; void Ticker(void) override;
void Render() override; void Render() override;

View file

@ -591,7 +591,7 @@ int DoCheckSwarm(short SpriteNum)
} }
} }
return TRUE; return true;
} }

View file

@ -34,13 +34,13 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
double elapsedInputTicks; void DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust);
double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000.0 / elapsedInputTicks); } 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); static InputPacket loc;
void DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz); static int32_t turnheldtime;
InputPacket loc;
void void
InitNetVars(void) InitNetVars(void)
@ -59,62 +59,29 @@ InitTimingVars(void)
} }
enum
static void getinput(InputPacket *loc)
{ {
int i; TURBOTURNTIME = (120 / 8),
PLAYERp pp = Player + myconnectindex; NORMALTURN = (12 + 6),
PLAYERp newpp = Player + myconnectindex; 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) // handles the input bits
#define PREAMBLETURN 3 //
#define NORMALKEYMOVE 35 //---------------------------------------------------------------------------
#define MAXVEL ((NORMALKEYMOVE*2)+10)
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
#define MAXANGVEL 100
#define MAXHORIZVEL 128
#define SET_LOC_KEY(loc, sync_num, key_test) SET(loc, ((!!(key_test)) << (sync_num)))
static int32_t turnheldtime; static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput, bool* mouseaim)
int32_t momx, momy; {
ApplyGlobalInput(loc, hidInput);
extern SWBOOL MenuButtonAutoAim; *mouseaim = !(loc.actions & SB_AIMMODE);
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);
if (!CommEnabled) if (!CommEnabled)
{ {
@ -132,142 +99,26 @@ static void getinput(InputPacket *loc)
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM); RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
} }
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) // this shares a bit with another function so cannot be in the common code.
loc->actions |= SB_CROUCH_LOCK;
if (loc->actions & SB_RUN)
{ {
if (pp->sop_control) // this shares a bit with another function so cannot be in the common code.
turnamount = RUNTURN * 3; loc.actions |= SB_CROUCH_LOCK;
else
turnamount = RUNTURN;
keymove = NORMALKEYMOVE << 1;
} }
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 next_weapon = u->WeaponNum + 1;
short start_weapon; short start_weapon;
@ -283,7 +134,7 @@ static void getinput(InputPacket *loc)
else else
{ {
next_weapon = -1; next_weapon = -1;
for (i = start_weapon; TRUE; i++) for (i = start_weapon; true; i++)
{ {
if (i >= MAX_WEAPONS_KEYS) 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]; USERp u = User[pp->PlayerSprite];
short prev_weapon = u->WeaponNum - 1; short prev_weapon = u->WeaponNum - 1;
@ -320,7 +171,7 @@ static void getinput(InputPacket *loc)
else else
{ {
prev_weapon = -1; prev_weapon = -1;
for (i = start_weapon; TRUE; i--) for (i = start_weapon; true; i--)
{ {
if (i <= -1) if (i <= -1)
i = WPN_HEART; 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]; USERp u = User[pp->PlayerSprite];
short const which_weapon = u->WeaponNum + 1; 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) 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 = 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 = {}; loc = {};
} }
} }

View file

@ -53,7 +53,7 @@ static struct so_interp
int32_t numinterpolations; int32_t numinterpolations;
int32_t tic, lasttic; int32_t tic, lasttic;
SWBOOL hasvator; bool hasvator;
} so_interpdata[MAX_SECTOR_OBJECTS]; } so_interpdata[MAX_SECTOR_OBJECTS];
static void so_setpointinterpolation(so_interp *interp, int32_t *posptr) 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]; so_interp *interp = &so_interpdata[sop - SectorObject];
interp->numinterpolations = 0; interp->numinterpolations = 0;
interp->hasvator = FALSE; interp->hasvator = false;
for (sectp = sop->sectp; *sectp; sectp++) for (sectp = sop->sectp; *sectp; sectp++)
{ {
@ -197,12 +197,13 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
so_interp *interp; so_interp *interp;
so_interp::interp_data *data; 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; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) 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; continue;
if (interp->tic < interp->lasttic) if (interp->tic < interp->lasttic)
interp->tic += synctics; interp->tic += synctics;
@ -240,7 +241,8 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
for (sop = SectorObject, interp = so_interpdata; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) 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; continue;
for (i = 0; i < interp->numinterpolations; i++) 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; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) 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; continue;
// Check if interpolation has been explicitly disabled // 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; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) 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; continue;
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) 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); int SaveSymDataInfo(MFILE_WRITE fil, void *ptr);
SWBOOL so_writeinterpolations(MFILE_WRITE fil) int so_writeinterpolations(MFILE_WRITE fil)
{ {
int32_t i; int32_t i;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
so_interp *interp; so_interp *interp;
SWBOOL saveisshot = FALSE; int saveisshot = 0;
for (sop = SectorObject, interp = so_interpdata; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
@ -362,14 +366,14 @@ SWBOOL so_writeinterpolations(MFILE_WRITE fil)
return saveisshot; return saveisshot;
} }
int LoadSymDataInfo(MFILE_READ fil, void **ptr); int LoadSymDataInfo(MFILE_READ fil, void** ptr);
SWBOOL so_readinterpolations(MFILE_READ fil) int so_readinterpolations(MFILE_READ fil)
{ {
int32_t i; int32_t i;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
so_interp *interp; so_interp *interp;
SWBOOL saveisshot = FALSE; int saveisshot = 0;
for (sop = SectorObject, interp = so_interpdata; for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++) sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)

View file

@ -41,8 +41,8 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics);
void so_updateinterpolations(void); void so_updateinterpolations(void);
void so_dointerpolations(int32_t smoothratio); void so_dointerpolations(int32_t smoothratio);
void so_restoreinterpolations(void); void so_restoreinterpolations(void);
SWBOOL so_writeinterpolations(MFILE_WRITE fil); int so_writeinterpolations(MFILE_WRITE fil);
SWBOOL so_readinterpolations(MFILE_READ fil); int so_readinterpolations(MFILE_READ fil);
END_SW_NS END_SW_NS

View file

@ -293,7 +293,7 @@ void UseInventoryCloak(PLAYERp pp)
return; return;
} }
pp->InventoryActive[pp->InventoryNum] = TRUE; pp->InventoryActive[pp->InventoryNum] = true;
AutoPickInventory(pp); AutoPickInventory(pp);
@ -313,7 +313,7 @@ void StopInventoryCloak(PLAYERp pp, short InventoryNum)
{ {
SPRITEp sp = pp->SpriteP; SPRITEp sp = pp->SpriteP;
pp->InventoryActive[InventoryNum] = FALSE; pp->InventoryActive[InventoryNum] = false;
if (pp->InventoryPercent[InventoryNum] <= 0) if (pp->InventoryPercent[InventoryNum] <= 0)
{ {
@ -350,7 +350,7 @@ DoPlayerNightVisionPalette(PLAYERp pp)
// if (pp->NightVision && pp->StartColor == 148) // if (pp->NightVision && pp->StartColor == 148)
// return; // return;
SetFadeAmt(pp,-1005,148); // Night vision green tint SetFadeAmt(pp,-1005,148); // Night vision green tint
pp->NightVision = TRUE; pp->NightVision = true;
} }
else else
{ {
@ -360,7 +360,7 @@ DoPlayerNightVisionPalette(PLAYERp pp)
pp->FadeAmt = 0; pp->FadeAmt = 0;
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
} }
pp->NightVision = FALSE; pp->NightVision = false;
} }
} }
@ -373,7 +373,7 @@ UseInventoryNightVision(PLAYERp pp)
return; return;
} }
pp->InventoryActive[pp->InventoryNum] = TRUE; pp->InventoryActive[pp->InventoryNum] = true;
// on/off // on/off
PlayerUpdateInventory(pp, pp->InventoryNum); PlayerUpdateInventory(pp, pp->InventoryNum);
@ -385,7 +385,7 @@ UseInventoryNightVision(PLAYERp pp)
void void
StopInventoryNightVision(PLAYERp pp, short InventoryNum) StopInventoryNightVision(PLAYERp pp, short InventoryNum)
{ {
pp->InventoryActive[InventoryNum] = FALSE; pp->InventoryActive[InventoryNum] = false;
if (pp->InventoryPercent[InventoryNum] <= 0) if (pp->InventoryPercent[InventoryNum] <= 0)
{ {
@ -531,7 +531,7 @@ void InventoryTimer(PLAYERp pp)
// ALL USED UP // ALL USED UP
pp->InventoryPercent[inv] = 0; pp->InventoryPercent[inv] = 0;
InventoryStop(pp, inv); InventoryStop(pp, inv);
pp->InventoryActive[inv] = FALSE; pp->InventoryActive[inv] = false;
} }
else else
{ {
@ -566,7 +566,7 @@ void InventoryTimer(PLAYERp pp)
// reset 1 sec tic clock // reset 1 sec tic clock
pp->InventoryTics[inv] = SEC(1); pp->InventoryTics[inv] = SEC(1);
// set to InActive EVERY TIME THROUGH THE LOOP! // set to InActive EVERY TIME THROUGH THE LOOP!
pp->InventoryActive[inv] = FALSE; pp->InventoryActive[inv] = false;
} }
PlayerUpdateInventory(pp, pp->InventoryNum); PlayerUpdateInventory(pp, pp->InventoryNum);

View file

@ -53,14 +53,14 @@ MIRRORTYPE mirror[MAXMIRRORS];
short mirrorcnt; //, floormirrorcnt; short mirrorcnt; //, floormirrorcnt;
//short floormirrorsector[MAXMIRRORS]; //short floormirrorsector[MAXMIRRORS];
SWBOOL mirrorinview; bool mirrorinview;
uint32_t oscilationclock; uint32_t oscilationclock;
// Voxel stuff // Voxel stuff
//SWBOOL bVoxelsOn = TRUE; // Turn voxels on by default //bool bVoxelsOn = true; // Turn voxels on by default
SWBOOL bSpinBobVoxels = FALSE; // Do twizzly stuff to voxels, but bool bSpinBobVoxels = false; // Do twizzly stuff to voxels, but
// not by default // not by default
SWBOOL bAutoSize = TRUE; // Autosizing on/off bool bAutoSize = true; // Autosizing on/off
//extern int chainnumpages; //extern int chainnumpages;
extern AMB_INFO ambarray[]; extern AMB_INFO ambarray[];
@ -288,13 +288,13 @@ void JS_InitMirrors(void)
short startwall, endwall; short startwall, endwall;
int i, j, s; int i, j, s;
short SpriteNum = 0, NextSprite; short SpriteNum = 0, NextSprite;
SWBOOL Found_Cam = FALSE; bool Found_Cam = false;
// Set all the mirror struct values to -1 // Set all the mirror struct values to -1
memset(mirror, 0xFF, sizeof(mirror)); memset(mirror, 0xFF, sizeof(mirror));
mirrorinview = FALSE; // Initially set global mirror flag mirrorinview = false; // Initially set global mirror flag
// to no mirrors seen // to no mirrors seen
// Scan wall tags for mirrors // Scan wall tags for mirrors
@ -308,7 +308,7 @@ void JS_InitMirrors(void)
mirror[i].campic = -1; mirror[i].campic = -1;
mirror[i].camsprite = -1; mirror[i].camsprite = -1;
mirror[i].camera = -1; mirror[i].camera = -1;
mirror[i].ismagic = FALSE; mirror[i].ismagic = false;
} }
for (i = 0; i < numwalls; i++) for (i = 0; i < numwalls; i++)
@ -333,13 +333,13 @@ void JS_InitMirrors(void)
mirror[mirrorcnt].mirrorwall = i; mirror[mirrorcnt].mirrorwall = i;
mirror[mirrorcnt].mirrorsector = s; mirror[mirrorcnt].mirrorsector = s;
mirror[mirrorcnt].numspawnspots = 0; mirror[mirrorcnt].numspawnspots = 0;
mirror[mirrorcnt].ismagic = FALSE; mirror[mirrorcnt].ismagic = false;
do if (wall[i].lotag == TAG_WALL_MAGIC_MIRROR) do if (wall[i].lotag == TAG_WALL_MAGIC_MIRROR)
{ {
short ii, nextii; short ii, nextii;
SPRITEp sp; SPRITEp sp;
Found_Cam = FALSE; Found_Cam = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ST1], ii, nextii) TRAVERSE_SPRITE_STAT(headspritestat[STAT_ST1], ii, nextii)
{ {
sp = &sprite[ii]; sp = &sprite[ii];
@ -350,7 +350,7 @@ void JS_InitMirrors(void)
// Set up camera varialbes // Set up camera varialbes
SP_TAG5(sp) = sp->ang; // Set current angle to SP_TAG5(sp) = sp->ang; // Set current angle to
// sprite angle // sprite angle
Found_Cam = TRUE; Found_Cam = true;
} }
} }
@ -367,7 +367,7 @@ void JS_InitMirrors(void)
// Set up camera varialbes // Set up camera varialbes
SP_TAG5(sp) = sp->ang; // Set current angle to SP_TAG5(sp) = sp->ang; // Set current angle to
// sprite angle // sprite angle
Found_Cam = TRUE; Found_Cam = true;
} }
} }
@ -378,9 +378,9 @@ void JS_InitMirrors(void)
break; break;
} }
mirror[mirrorcnt].ismagic = TRUE; mirror[mirrorcnt].ismagic = true;
Found_Cam = FALSE; Found_Cam = false;
if (TEST_BOOL1(&sprite[mirror[mirrorcnt].camera])) if (TEST_BOOL1(&sprite[mirror[mirrorcnt].camera]))
{ {
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite) 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 // JBF: commenting out this line results in the screen in $BULLET being visible
tileDelete(mirror[mirrorcnt].campic); 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) screen->RenderTextureView(canvas, [=](IntRect& rect)
{ {
renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum); renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum);
analyzesprites(daposx, daposy, daposz, FALSE); analyzesprites(daposx, daposy, daposz, false);
renderDrawMasks(); renderDrawMasks();
}); });
@ -482,7 +482,7 @@ JS_ProcessEchoSpot()
int j,dist; int j,dist;
PLAYERp pp = Player+screenpeek; PLAYERp pp = Player+screenpeek;
int16_t reverb; int16_t reverb;
SWBOOL reverb_set = FALSE; bool reverb_set = false;
// Process echo sprites // Process echo sprites
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ECHO], i, nexti) TRAVERSE_SPRITE_STAT(headspritestat[STAT_ECHO], i, nexti)
@ -503,7 +503,7 @@ JS_ProcessEchoSpot()
if (reverb < 100) reverb = 100; if (reverb < 100) reverb = 100;
COVER_SetReverb(reverb); COVER_SetReverb(reverb);
reverb_set = TRUE; reverb_set = true;
} }
} }
if (!TEST(pp->Flags, PF_DIVING) && !reverb_set && pp->Reverb <= 0) 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 tposx, tposy; // Camera
int* longptr; int* longptr;
SWBOOL bIsWallMirror = FALSE; bool bIsWallMirror = false;
int camclock = I_GetBuildTime(); int camclock = I_GetBuildTime();
camloopcnt += camclock - lastcamclock; 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))) if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
{ {
// Do not change any global state here! // Do not change any global state here!
bIsWallMirror = (TEST_GOTPIC(cnt + MIRRORLABEL)); bIsWallMirror = !!(TEST_GOTPIC(cnt + MIRRORLABEL));
dist = 0x7fffffff; dist = 0x7fffffff;
if (bIsWallMirror) 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? // 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; mirror[cnt].mstate = m_normal;
if (TEST_BOOL1(sp)) if (TEST_BOOL1(sp))
mirror[cnt].mstate = m_viewon; 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! // you are outside of it!
if (mirror[cnt].mstate == m_viewon) if (mirror[cnt].mstate == m_viewon)
{ {
SWBOOL DoCam = FALSE; bool DoCam = false;
if (mirror[cnt].campic == -1) 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 // If player is dead still then update at MoveSkip4
// rate. // rate.
if (pp->posx == pp->oposx && pp->posy == pp->oposy && pp->posz == pp->oposz) if (pp->posx == pp->oposx && pp->posy == pp->oposy && pp->posz == pp->oposz)
DoCam = TRUE; DoCam = true;
// Set up the tile for drawing // 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 // int tx, ty, tz, tpang; // Interpolate so mirror doesn't
// drift! // drift!
SWBOOL bIsWallMirror = FALSE; bool bIsWallMirror = false;
// WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong // WARNING! Assuming (MIRRORLABEL&31) = 0 and MAXMIRRORS = 64 <-- JBF: wrong
longptr = (int *)&gotpic[MIRRORLABEL >> 3]; 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) || TEST_GOTPIC(cnt + CAMSPRITE))
if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic))) if (TEST_GOTPIC(cnt + MIRRORLABEL) || ((unsigned)mirror[cnt].campic < MAXTILES && TEST_GOTPIC(mirror[cnt].campic)))
{ {
bIsWallMirror = FALSE; bIsWallMirror = false;
if (TEST_GOTPIC(cnt + MIRRORLABEL)) if (TEST_GOTPIC(cnt + MIRRORLABEL))
{ {
bIsWallMirror = TRUE; bIsWallMirror = true;
RESET_GOTPIC(cnt + MIRRORLABEL); RESET_GOTPIC(cnt + MIRRORLABEL);
} }
//else if (TEST_GOTPIC(cnt + CAMSPRITE)) //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); RESET_GOTPIC(mirror[cnt].campic);
} }
mirrorinview = TRUE; mirrorinview = true;
// tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio); // tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, 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? // 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; mirror[cnt].mstate = m_normal;
if (TEST_BOOL1(sp)) if (TEST_BOOL1(sp))
mirror[cnt].mstate = m_viewon; 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) if (mirror[cnt].campic != -1)
tileDelete(mirror[cnt].campic); tileDelete(mirror[cnt].campic);
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS); renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS);
analyzesprites(dx, dy, dz, FALSE); analyzesprites(dx, dy, dz, false);
renderDrawMasks(); 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); renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
analyzesprites(tposx, tposy, tz, TRUE); analyzesprites(tposx, tposy, tz, true);
renderDrawMasks(); renderDrawMasks();
renderCompleteMirror(); // Reverse screen x-wise in this 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; wall[mirror[cnt].mirrorwall].overpicnum = MIRRORLABEL + cnt;
} }
else else
mirrorinview = FALSE; mirrorinview = false;
} }
} }

View file

@ -53,7 +53,7 @@ typedef struct
short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill
// level for a // level for a
// max of up to 4 coolie ghosts to spawn. // 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 MIRRORSTATE mstate; // What state the mirror is currently
// in // in
int maxtics; // Tic count used to time mirror int maxtics; // Tic count used to time mirror
@ -66,7 +66,7 @@ extern MIRRORTYPE mirror[MAXMIRRORS];
extern short mirrorcnt, floormirrorcnt; extern short mirrorcnt, floormirrorcnt;
extern short floormirrorsector[MAXMIRRORS]; extern short floormirrorsector[MAXMIRRORS];
extern SWBOOL mirrorinview; extern bool mirrorinview;
extern short NormalVisibility; extern short NormalVisibility;
void JAnalyzeSprites(tspriteptr_t tspr); void JAnalyzeSprites(tspriteptr_t tspr);

View file

@ -52,7 +52,7 @@ extern STATE s_Puff[];
extern STATE s_FireballFlames[]; extern STATE s_FireballFlames[];
extern STATE s_GoreFloorSplash[]; extern STATE s_GoreFloorSplash[];
extern STATE s_GoreSplash[]; extern STATE s_GoreSplash[];
extern SWBOOL GlobalSkipZrange; extern bool GlobalSkipZrange;
#define CHEMTICS SEC(40) #define CHEMTICS SEC(40)
@ -401,7 +401,7 @@ DoBloodSpray(int16_t Weapon)
sp->z = fz; sp->z = fz;
SpawnFloorSplash(Weapon); SpawnFloorSplash(Weapon);
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -419,7 +419,7 @@ DoBloodSpray(int16_t Weapon)
{ {
case HIT_PLAX_WALL: case HIT_PLAX_WALL:
KillSprite(Weapon); KillSprite(Weapon);
return TRUE; return true;
case HIT_SPRITE: case HIT_SPRITE:
{ {
short wall_ang; short wall_ang;
@ -440,7 +440,7 @@ DoBloodSpray(int16_t Weapon)
SpawnMidSplash(Weapon); SpawnMidSplash(Weapon);
QueueWallBlood(Weapon, hsp->ang); QueueWallBlood(Weapon, hsp->ang);
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
@ -540,7 +540,7 @@ DoBloodSpray(int16_t Weapon)
u->xchange = u->ychange = 0; u->xchange = u->ychange = 0;
SpawnFloorSplash(Weapon); SpawnFloorSplash(Weapon);
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -594,7 +594,7 @@ DoBloodSpray(int16_t Weapon)
SET(nu->Flags, SPR_UNDERWATER); SET(nu->Flags, SPR_UNDERWATER);
} }
return FALSE; return false;
} }
@ -631,7 +631,7 @@ DoPhosphorus(int16_t Weapon)
{ {
case HIT_PLAX_WALL: case HIT_PLAX_WALL:
KillSprite(Weapon); KillSprite(Weapon);
return TRUE; return true;
case HIT_SPRITE: case HIT_SPRITE:
{ {
short wall_ang; short wall_ang;
@ -663,7 +663,7 @@ DoPhosphorus(int16_t Weapon)
} }
u->xchange = u->ychange = 0; u->xchange = u->ychange = 0;
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
@ -696,7 +696,7 @@ DoPhosphorus(int16_t Weapon)
case HIT_SECTOR: case HIT_SECTOR:
{ {
SWBOOL did_hit_wall; bool did_hit_wall;
if (SlopeBounce(Weapon, &did_hit_wall)) if (SlopeBounce(Weapon, &did_hit_wall))
{ {
@ -726,7 +726,7 @@ DoPhosphorus(int16_t Weapon)
u->xchange = u->ychange = 0; u->xchange = u->ychange = 0;
SpawnFireballExp(Weapon); SpawnFireballExp(Weapon);
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -763,7 +763,7 @@ DoPhosphorus(int16_t Weapon)
u->xchange = u->ychange = 0; u->xchange = u->ychange = 0;
SpawnFireballExp(Weapon); SpawnFireballExp(Weapon);
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -821,7 +821,7 @@ DoPhosphorus(int16_t Weapon)
SET(nu->Flags, SPR_UNDERWATER); SET(nu->Flags, SPR_UNDERWATER);
} }
return FALSE; return false;
} }
int int
@ -857,7 +857,7 @@ DoChemBomb(int16_t Weapon)
{ {
case HIT_PLAX_WALL: case HIT_PLAX_WALL:
KillSprite(Weapon); KillSprite(Weapon);
return TRUE; return true;
case HIT_SPRITE: case HIT_SPRITE:
{ {
short wall_ang; short wall_ang;
@ -889,7 +889,7 @@ DoChemBomb(int16_t Weapon)
u->WaitTics -= (MISSILEMOVETICS * 2); u->WaitTics -= (MISSILEMOVETICS * 2);
if (u->WaitTics <= 0) if (u->WaitTics <= 0)
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
@ -924,7 +924,7 @@ DoChemBomb(int16_t Weapon)
case HIT_SECTOR: case HIT_SECTOR:
{ {
SWBOOL did_hit_wall; bool did_hit_wall;
if (SlopeBounce(Weapon, &did_hit_wall)) if (SlopeBounce(Weapon, &did_hit_wall))
{ {
@ -965,7 +965,7 @@ DoChemBomb(int16_t Weapon)
u->WaitTics -= (MISSILEMOVETICS * 2); u->WaitTics -= (MISSILEMOVETICS * 2);
if (u->WaitTics <= 0) if (u->WaitTics <= 0)
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -1014,7 +1014,7 @@ DoChemBomb(int16_t Weapon)
u->WaitTics -= (MISSILEMOVETICS * 2); u->WaitTics -= (MISSILEMOVETICS * 2);
if (u->WaitTics <= 0) if (u->WaitTics <= 0)
KillSprite((short) Weapon); KillSprite((short) Weapon);
return TRUE; return true;
} }
} }
else else
@ -1069,7 +1069,7 @@ DoChemBomb(int16_t Weapon)
SET(nu->Flags, SPR_UNDERWATER); SET(nu->Flags, SPR_UNDERWATER);
} }
return FALSE; return false;
} }
int int
@ -1115,7 +1115,7 @@ DoCaltrops(int16_t Weapon)
{ {
case HIT_PLAX_WALL: case HIT_PLAX_WALL:
KillSprite(Weapon); KillSprite(Weapon);
return TRUE; return true;
case HIT_SPRITE: case HIT_SPRITE:
{ {
short wall_ang; short wall_ang;
@ -1170,7 +1170,7 @@ DoCaltrops(int16_t Weapon)
case HIT_SECTOR: case HIT_SECTOR:
{ {
SWBOOL did_hit_wall; bool did_hit_wall;
if (SlopeBounce(Weapon, &did_hit_wall)) if (SlopeBounce(Weapon, &did_hit_wall))
{ {
@ -1201,7 +1201,7 @@ DoCaltrops(int16_t Weapon)
SET(sp->extra, SPRX_BREAKABLE); SET(sp->extra, SPRX_BREAKABLE);
SET(sp->cstat,CSTAT_SPRITE_BREAKABLE); SET(sp->cstat,CSTAT_SPRITE_BREAKABLE);
ChangeState(Weapon, s_CaltropsStick); ChangeState(Weapon, s_CaltropsStick);
return TRUE; return true;
} }
} }
else else
@ -1239,7 +1239,7 @@ DoCaltrops(int16_t Weapon)
SET(sp->extra, SPRX_BREAKABLE); SET(sp->extra, SPRX_BREAKABLE);
SET(sp->cstat,CSTAT_SPRITE_BREAKABLE); SET(sp->cstat,CSTAT_SPRITE_BREAKABLE);
ChangeState(Weapon, s_CaltropsStick); ChangeState(Weapon, s_CaltropsStick);
return TRUE; return true;
} }
} }
else else
@ -1255,7 +1255,7 @@ DoCaltrops(int16_t Weapon)
} }
return FALSE; return false;
} }
///////////////////////////// /////////////////////////////
@ -1272,7 +1272,7 @@ SpawnRadiationCloud(short SpriteNum)
if (!MoveSkip4) if (!MoveSkip4)
return FALSE; return false;
// This basically works like a MoveSkip8, if one existed // This basically works like a MoveSkip8, if one existed
// u->Counter2 = !u->Counter2; // u->Counter2 = !u->Counter2;
@ -1281,14 +1281,14 @@ SpawnRadiationCloud(short SpriteNum)
if ((u->Counter2++) > 16) if ((u->Counter2++) > 16)
u->Counter2 = 0; u->Counter2 = 0;
if (u->Counter2) if (u->Counter2)
return FALSE; return false;
} }
else else
{ {
if ((u->Counter2++) > 2) if ((u->Counter2++) > 2)
u->Counter2 = 0; u->Counter2 = 0;
if (u->Counter2) if (u->Counter2)
return FALSE; return false;
} }
if (TEST(u->Flags, SPR_UNDERWATER)) if (TEST(u->Flags, SPR_UNDERWATER))
@ -1338,7 +1338,7 @@ SpawnRadiationCloud(short SpriteNum)
nu->Radius = 4000; nu->Radius = 4000;
} }
return FALSE; return false;
} }
int int
@ -1357,7 +1357,7 @@ DoRadiationCloud(short SpriteNum)
DoFlamesDamageTest(SpriteNum); DoFlamesDamageTest(SpriteNum);
} }
return FALSE; return false;
} }
////////////////////////////////////////////// //////////////////////////////////////////////
@ -1733,7 +1733,7 @@ SpawnFlashBombOnActor(int16_t enemy)
{ {
if (!eu) if (!eu)
{ {
ASSERT(TRUE == FALSE); ASSERT(true == false);
} }
if (eu->flame >= 0) if (eu->flame >= 0)
@ -2000,7 +2000,7 @@ InitPhosphorus(int16_t SpriteNum)
} }
int int
InitBloodSpray(int16_t SpriteNum, SWBOOL dogib, short velocity) InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
@ -2200,7 +2200,7 @@ DoCarryFlag(int16_t Weapon)
if (!TEST(u->Flags, SPR_ACTIVE)) if (!TEST(u->Flags, SPR_ACTIVE))
{ {
if ((u->WaitTics -= (MISSILEMOVETICS * 2)) > 0) if ((u->WaitTics -= (MISSILEMOVETICS * 2)) > 0)
return FALSE; return false;
// activate it // activate it
u->WaitTics = SEC(30); // You have 30 seconds to get it to 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: case FLAG_DETONATE_STATE + 1:
SpawnGrenadeExp(Weapon); SpawnGrenadeExp(Weapon);
SetSuicide(Weapon); SetSuicide(Weapon);
return FALSE; return false;
break; break;
} }
return FALSE; return false;
} }
int int
@ -2362,7 +2362,7 @@ DoCarryFlagNoDet(int16_t Weapon)
if (u->FlagOwner >= 0) if (u->FlagOwner >= 0)
fu->WaitTics = 0; // Tell it to respawn fu->WaitTics = 0; // Tell it to respawn
SetSuicide(Weapon); SetSuicide(Weapon);
return FALSE; return false;
} }
// if in score box, score. // if in score box, score.
@ -2395,7 +2395,7 @@ DoCarryFlagNoDet(int16_t Weapon)
SetSuicide(Weapon); // Kill the flag, you scored! SetSuicide(Weapon); // Kill the flag, you scored!
} }
return FALSE; return false;
} }
@ -2418,7 +2418,7 @@ SetCarryFlag(int16_t Weapon)
else else
ChangeState(Weapon, s_CarryFlag); ChangeState(Weapon, s_CarryFlag);
return FALSE; return false;
} }
int int
@ -2447,7 +2447,7 @@ DoFlag(int16_t Weapon)
} }
} }
return FALSE; return false;
} }

View file

@ -158,11 +158,11 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist)
//ang = NORM_ANGLE(ang + 1024); //ang = NORM_ANGLE(ang + 1024);
//pp->xvect += 20 * sintable[NORM_ANGLE(ang + 512)]; //pp->xvect += 20 * sintable[NORM_ANGLE(ang + 512)];
//pp->yvect += 20 * sintable[ang]; //pp->yvect += 20 * sintable[ang];
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
int testquadinsect(int *point_num, vec2_t const * q, short sectnum) 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; *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, if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum,
q[next_i].x, q[next_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->posx += (pp->xvect>>14);
pp->posy += (pp->yvect>>14); pp->posy += (pp->yvect>>14);
return TRUE; return true;
} }
if (point_num < 0) if (point_num < 0)
return FALSE; return false;
if ((point_num == 0) || (point_num == 3)) //Left side bad - strafe right 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); pp->posy += (pp->xvect>>15);
} }
return FALSE; return false;
} }
if ((point_num == 1) || (point_num == 2)) //Right side bad - strafe left 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); pp->posy -= (pp->xvect>>15);
} }
return FALSE; return false;
} }
return FALSE; return false;
} }
int testpointinquad(int x, int y, int *qx, int *qy) 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; qx[i] = xy[i].x;
qy[i] = xy[i].y; qy[i] = xy[i].y;
} }
return TRUE; return true;
} }
if (point_num < 0) if (point_num < 0)
return FALSE; return false;
return FALSE; return false;
} }
END_SW_NS END_SW_NS

View file

@ -223,7 +223,7 @@ void DoPaletteFlash(PLAYERp pp)
} }
SWBOOL MNU_ShareWareMessage() bool MNU_ShareWareMessage()
{ {
const char* extra_text; const char* extra_text;
short w, h; short w, h;
@ -244,7 +244,7 @@ SWBOOL MNU_ShareWareMessage()
MNU_DrawString(160, 160, extra_text, 1, 16, 0); MNU_DrawString(160, 160, extra_text, 1, 16, 0);
//SET(item->flags, mf_disabled); //SET(item->flags, mf_disabled);
} }
return TRUE; return true;
} }

View file

@ -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 pic_shadow_warrior 2366
#define m_defshade 2 #define m_defshade 2
extern SWBOOL SavegameLoaded; extern bool SavegameLoaded;
END_SW_NS END_SW_NS

View file

@ -22,10 +22,10 @@ void MapColors(short num,COLOR_MAP cm,short create);
void InitPalette(void); void InitPalette(void);
int32_t CONFIG_ReadSetup(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 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); 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); SPRITEp Warp(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum);
void ProcessVisOn(void); void ProcessVisOn(void);
@ -36,7 +36,7 @@ enum TriggerType { TRIGGER_TYPE_REMOTE_SO };
int ActorFollowTrack(short SpriteNum, short locktics); int ActorFollowTrack(short SpriteNum, short locktics);
void ActorLeaveTrack(short SpriteNum); 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 TrackSetup(void);
void PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy); void PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy);
void PlaceSectorObjectsOnTracks(void); 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); void PutStringInfo(PLAYERp pp, const char* string);
short DoSlidorMatch(PLAYERp pp, short match, SWBOOL); short DoSlidorMatch(PLAYERp pp, short match, bool);
SWBOOL TestSlidorMatchActive(short match); bool TestSlidorMatchActive(short match);
void InterpSectorSprites(short sectnum, SWBOOL state); void InterpSectorSprites(short sectnum, bool state);
typedef void INTERP_FUNC(int*); typedef void INTERP_FUNC(int*);
typedef INTERP_FUNC* INTERP_FUNCp; typedef INTERP_FUNC* INTERP_FUNCp;
@ -86,7 +86,7 @@ void ProcessQuakeOn(void);
void ProcessQuakeSpot(void); void ProcessQuakeSpot(void);
void QuakeViewChange(PLAYERp pp, int* z_diff, int* x_diff, int* y_diff, short* ang_diff); void QuakeViewChange(PLAYERp pp, int* z_diff, int* x_diff, int* y_diff, short* ang_diff);
void DoQuake(PLAYERp pp); 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 SetExpQuake(int16_t Weapon);
int SetGunQuake(int16_t SpriteNum); int SetGunQuake(int16_t SpriteNum);
int SetPlayerQuake(PLAYERp mpp); int SetPlayerQuake(PLAYERp mpp);

View file

@ -153,7 +153,7 @@ int DoToiletGirl(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
static short alreadythrew = 0; static short alreadythrew = 0;
DoActorPickClosePlayer(SpriteNum); DoActorPickClosePlayer(SpriteNum);
@ -1914,7 +1914,7 @@ int DoPruneGirl(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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]; USERp u = User[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
SWBOOL ICanSee = FALSE; bool ICanSee = false;
DoActorPickClosePlayer(SpriteNum); 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); 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);

View file

@ -34,7 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define OFF 0 #define OFF 0
#define ON 1 #define ON 1
typedef unsigned char SWBOOL;
/* /*
=========================== ===========================

View file

@ -54,7 +54,7 @@ gNET gNet;
//Local multiplayer variables //Local multiplayer variables
// should move this to a local scope of faketimerhandler - do it when able to test // 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; uint8_t CommPlayers = 0;
double smoothratio; double smoothratio;

View file

@ -29,12 +29,12 @@ BEGIN_SW_NS
#define SYNC_TEST 0 #define SYNC_TEST 0
#define MAXSYNCBYTES 16 #define MAXSYNCBYTES 16
extern SWBOOL PredictionOn; extern bool PredictionOn;
extern PLAYER PredictPlayer; extern PLAYER PredictPlayer;
extern PLAYERp ppp; extern PLAYERp ppp;
extern short predictangpos[]; extern short predictangpos[];
extern int predictmovefifoplc; extern int predictmovefifoplc;
extern SWBOOL Prediction; extern bool Prediction;
void InitPrediction(PLAYERp pp); void InitPrediction(PLAYERp pp);
void DoPrediction(PLAYERp ppp); void DoPrediction(PLAYERp ppp);
@ -61,12 +61,12 @@ typedef struct
int32_t TimeLimit; int32_t TimeLimit;
int32_t TimeLimitClock; int32_t TimeLimitClock;
int16_t MultiGameType; // used to be a stand alone global int16_t MultiGameType; // used to be a stand alone global
SWBOOL TeamPlay; bool TeamPlay;
SWBOOL HurtTeammate; bool HurtTeammate;
SWBOOL SpawnMarkers; bool SpawnMarkers;
SWBOOL AutoAim; bool AutoAim;
SWBOOL NoRespawn; // for commbat type games bool NoRespawn; // for commbat type games
SWBOOL Nuke; bool Nuke;
} gNET,*gNETp; } gNET,*gNETp;
extern gNET gNet; extern gNET gNet;

View file

@ -1967,7 +1967,7 @@ DoNinjaHariKari(short SpriteNum)
cnt = RANDOM_RANGE(4)+1; cnt = RANDOM_RANGE(4)+1;
for (i=0; i<=cnt; i++) for (i=0; i<=cnt; i++)
InitBloodSpray(SpriteNum,TRUE,-2); InitBloodSpray(SpriteNum,true,-2);
return 0; return 0;
} }
@ -2206,7 +2206,7 @@ PlayerLevelReset(PLAYERp pp)
//PlayerUpdateArmor(pp, 0); //PlayerUpdateArmor(pp, 0);
pp->Kills = 0; pp->Kills = 0;
pp->Killer = -1; pp->Killer = -1;
pp->NightVision = FALSE; pp->NightVision = false;
pp->StartColor = 0; pp->StartColor = 0;
pp->FadeAmt = 0; pp->FadeAmt = 0;
pp->DeathType = 0; pp->DeathType = 0;
@ -2245,10 +2245,10 @@ PlayerDeathReset(PLAYERp pp)
pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire
pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds
pp->WpnShotgunLastShell = 0; // Number of last shell fired pp->WpnShotgunLastShell = 0; // Number of last shell fired
pp->Bloody = FALSE; pp->Bloody = false;
pp->TestNukeInit = FALSE; pp->TestNukeInit = false;
pp->InitingNuke = FALSE; pp->InitingNuke = false;
pp->NukeInitialized = FALSE; pp->NukeInitialized = false;
pp->WpnReloadState = 2; pp->WpnReloadState = 2;
memset(pp->WpnAmmo,0,sizeof(pp->WpnAmmo)); memset(pp->WpnAmmo,0,sizeof(pp->WpnAmmo));
@ -2273,7 +2273,7 @@ PlayerDeathReset(PLAYERp pp)
pp->Armor = 0; pp->Armor = 0;
PlayerUpdateArmor(pp, 0); PlayerUpdateArmor(pp, 0);
pp->Killer = -1; pp->Killer = -1;
pp->NightVision = FALSE; pp->NightVision = false;
pp->StartColor = 0; pp->StartColor = 0;
pp->FadeAmt = 0; pp->FadeAmt = 0;
pp->DeathType = 0; pp->DeathType = 0;
@ -2333,10 +2333,10 @@ PlayerGameReset(PLAYERp pp)
pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire pp->WpnShotgunType = 0; // Shotgun has normal or fully automatic fire
pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds pp->WpnShotgunAuto = 0; // 50-0 automatic shotgun rounds
pp->WpnShotgunLastShell = 0; // Number of last shell fired pp->WpnShotgunLastShell = 0; // Number of last shell fired
pp->Bloody = FALSE; pp->Bloody = false;
pp->TestNukeInit = FALSE; pp->TestNukeInit = false;
pp->InitingNuke = FALSE; pp->InitingNuke = false;
pp->NukeInitialized = FALSE; pp->NukeInitialized = false;
pp->SecretsFound = 0; pp->SecretsFound = 0;
pp->WpnReloadState = 2; pp->WpnReloadState = 2;
@ -2359,7 +2359,7 @@ PlayerGameReset(PLAYERp pp)
{ {
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
} }
pp->NightVision = FALSE; pp->NightVision = false;
pp->StartColor = 0; pp->StartColor = 0;
pp->FadeAmt = 0; pp->FadeAmt = 0;
pp->DeathType = 0; pp->DeathType = 0;
@ -2393,7 +2393,7 @@ InitPlayerSprite(PLAYERp pp)
SPRITE *sp; SPRITE *sp;
USERp u; USERp u;
int pnum = pp - Player; int pnum = pp - Player;
extern SWBOOL NewGame; extern bool NewGame;
COVER_SetReverb(0); // Turn off any echoing that may have been going before COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0; pp->Reverb = 0;
@ -2458,7 +2458,7 @@ InitPlayerSprite(PLAYERp pp)
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
} }
pp->NightVision = FALSE; pp->NightVision = false;
pp->StartColor = 0; pp->StartColor = 0;
pp->FadeAmt = 0; pp->FadeAmt = 0;
pp->DeathType = 0; pp->DeathType = 0;

View file

@ -59,12 +59,12 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
if (parm->numparms >= 4) 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) 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; return CCMD_OK;

View file

@ -89,8 +89,8 @@ int DoBeginPanelJump(PANEL_SPRITEp psp);
void SpawnHeartBlood(PANEL_SPRITEp psp); void SpawnHeartBlood(PANEL_SPRITEp psp);
void SpawnUziShell(PANEL_SPRITEp psp); void SpawnUziShell(PANEL_SPRITEp psp);
SWBOOL pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); bool pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state);
SWBOOL pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state); bool pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state);
void pHotHeadOverlays(PANEL_SPRITEp psp, short mode); void pHotHeadOverlays(PANEL_SPRITEp psp, short mode);
char UziRecoilYadj = 0; char UziRecoilYadj = 0;
@ -153,10 +153,10 @@ PANEL_SPRITEp pFindMatchingSpriteID(PLAYERp pp, short id, int x, int y, short pr
return NULL; return NULL;
} }
SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id) bool pKillScreenSpiteIDs(PLAYERp pp, short id)
{ {
PANEL_SPRITEp psp=NULL, next; PANEL_SPRITEp psp=NULL, next;
SWBOOL found = FALSE; bool found = false;
// Kill ALL sprites with the correct id // Kill ALL sprites with the correct id
TRAVERSE(&pp->PanelSpriteList, psp, next) TRAVERSE(&pp->PanelSpriteList, psp, next)
@ -164,7 +164,7 @@ SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id)
if (psp->ID == id) if (psp->ID == id)
{ {
pKillSprite(psp); pKillSprite(psp);
found = TRUE; found = true;
} }
} }
@ -238,13 +238,13 @@ void PlayerUpdateHealth(PLAYERp pp, short value)
if (value < 0) if (value < 0)
{ {
SWBOOL IsChem = FALSE; bool IsChem = false;
SWBOOL NoArmor = FALSE; bool NoArmor = false;
if (value <= -2000) if (value <= -2000)
{ {
value += 2000; value += 2000;
NoArmor = TRUE; NoArmor = true;
} }
else if (value <= -1000) else if (value <= -1000)
{ {
@ -252,7 +252,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value)
MONO_PRINT(ds); MONO_PRINT(ds);
value += 1000; value += 1000;
IsChem = TRUE; IsChem = true;
} }
// TAKE SOME DAMAGE // TAKE SOME DAMAGE
@ -440,7 +440,7 @@ int WeaponOperate(PLAYERp pp)
InventoryKeys(pp); InventoryKeys(pp);
// UziType >= 3 means they are reloading // UziType >= 3 means they are reloading
if (pp->WpnUziType >= 3) return TRUE; if (pp->WpnUziType >= 3) return true;
//if (CheatInputMode) //if (CheatInputMode)
// return (0); // return (0);
@ -456,10 +456,10 @@ int WeaponOperate(PLAYERp pp)
{ {
switch (pp->sop->track) switch (pp->sop->track)
{ {
case SO_TANK: case SO_VEHICLE:
case SO_TURRET: case SO_TURRET:
case SO_TURRET_MGUN: case SO_TURRET_MGUN:
case SO_SPEED_BOAT: // case SO_SPEED_BOAT:
if (!TEST(pp->sop->flags, SOBJ_HAS_WEAPON)) if (!TEST(pp->sop->flags, SOBJ_HAS_WEAPON))
break; break;
@ -544,9 +544,9 @@ int WeaponOperate(PLAYERp pp)
if (pp->WpnRocketType == 2 && pp->WpnRocketNuke == 0) if (pp->WpnRocketType == 2 && pp->WpnRocketNuke == 0)
pp->WpnRocketType = 0; pp->WpnRocketType = 0;
if (pp->WpnRocketType == 2) if (pp->WpnRocketType == 2)
pp->TestNukeInit = TRUE; // Init the nuke pp->TestNukeInit = true; // Init the nuke
else else
pp->TestNukeInit = FALSE; pp->TestNukeInit = false;
} }
InitWeaponMicro(pp); InitWeaponMicro(pp);
break; 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. // 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]) if (pp->WpnRocketType != 2 || pp->CurWpn != pp->Wpn[WPN_MICRO])
{ {
pp->InitingNuke = FALSE; pp->InitingNuke = false;
soundEngine->StopSound(SOURCE_Player, pp, CHAN_WEAPON); soundEngine->StopSound(SOURCE_Player, pp, CHAN_WEAPON);
} }
if (pp->CurWpn != pp->Wpn[WPN_RAIL]) if (pp->CurWpn != pp->Wpn[WPN_RAIL])
@ -650,7 +650,7 @@ int WeaponOperate(PLAYERp pp)
return 0; return 0;
} }
SWBOOL bool
WeaponOK(PLAYERp pp) WeaponOK(PLAYERp pp)
{ {
USERp u; USERp u;
@ -659,16 +659,16 @@ WeaponOK(PLAYERp pp)
unsigned wpn_ndx=0; unsigned wpn_ndx=0;
if ((unsigned)pp->PlayerSprite >= MAXSPRITES) if ((unsigned)pp->PlayerSprite >= MAXSPRITES)
return(FALSE); return(false);
u = User[pp->PlayerSprite]; u = User[pp->PlayerSprite];
if (u == NULL) if (u == NULL)
return(FALSE); return(false);
// sword // sword
if (DamageData[u->WeaponNum].max_ammo == -1) if (DamageData[u->WeaponNum].max_ammo == -1)
return TRUE; return true;
WeaponNum = u->WeaponNum; WeaponNum = u->WeaponNum;
FindWeaponNum = u->WeaponNum; FindWeaponNum = u->WeaponNum;
@ -684,19 +684,19 @@ WeaponOK(PLAYERp pp)
if (WeaponNum == WPN_MICRO && pp->WpnRocketNuke) if (WeaponNum == WPN_MICRO && pp->WpnRocketNuke)
{ {
//pp->WpnRocketType = 2; // Set it to Nuke //pp->WpnRocketType = 2; // Set it to Nuke
if (!pp->NukeInitialized) pp->TestNukeInit = TRUE; if (!pp->NukeInitialized) pp->TestNukeInit = true;
u->WeaponNum = WPN_MICRO; u->WeaponNum = WPN_MICRO;
(*DamageData[u->WeaponNum].Init)(pp); (*DamageData[u->WeaponNum].Init)(pp);
return TRUE; return true;
} }
pp->KeyPressBits &= ~SB_FIRE; pp->KeyPressBits &= ~SB_FIRE;
FindWeaponNum = WPN_SHOTGUN; // Start at the top FindWeaponNum = WPN_SHOTGUN; // Start at the top
while (TRUE) while (true)
{ {
// ran out of weapons - choose SWORD // ran out of weapons - choose SWORD
if (wpn_ndx > sizeof(wpn_order)) if (wpn_ndx > sizeof(wpn_order))
@ -723,10 +723,10 @@ WeaponOK(PLAYERp pp)
(*DamageData[u->WeaponNum].Init)(pp); (*DamageData[u->WeaponNum].Init)(pp);
return FALSE; return false;
} }
return TRUE; return true;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -1208,7 +1208,7 @@ pSwordHide(PANEL_SPRITEp psp)
void void
pSwordRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_SwordHide))
return; return;
@ -1507,7 +1507,7 @@ pStarHide(PANEL_SPRITEp psp)
void void
pStarRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_StarHide))
return; return;
@ -2331,8 +2331,8 @@ pUziHide(PANEL_SPRITEp psp)
void void
pUziRest(PANEL_SPRITEp psp) pUziRest(PANEL_SPRITEp psp)
{ {
char shooting; bool shooting;
SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT);
// If you have two uzi's, but one didn't come up, spawn it // If you have two uzi's, but one didn't come up, spawn it
@ -2384,7 +2384,7 @@ void
pUziAction(PANEL_SPRITEp psp) pUziAction(PANEL_SPRITEp psp)
{ {
char shooting; char shooting;
static SWBOOL alternate = FALSE; static int alternate = 0;
shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE); 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 pShotgunRecoilUp(PANEL_SPRITEp psp);
void pShotgunRecoilDown(PANEL_SPRITEp psp); void pShotgunRecoilDown(PANEL_SPRITEp psp);
SWBOOL pShotgunReloadTest(PANEL_SPRITEp psp); bool pShotgunReloadTest(PANEL_SPRITEp psp);
extern PANEL_STATE ps_ShotgunReload[]; extern PANEL_STATE ps_ShotgunReload[];
@ -2958,7 +2958,7 @@ pShotgunBobSetup(PANEL_SPRITEp psp)
psp->bob_height_divider = 8; psp->bob_height_divider = 8;
} }
SWBOOL bool
pShotgunOverlays(PANEL_SPRITEp psp) pShotgunOverlays(PANEL_SPRITEp psp)
{ {
#define SHOTGUN_AUTO_XOFF 28 #define SHOTGUN_AUTO_XOFF 28
@ -2978,13 +2978,13 @@ pShotgunOverlays(PANEL_SPRITEp psp)
case 0: case 0:
psp->over[SHOTGUN_AUTO_NUM].pic = -1; psp->over[SHOTGUN_AUTO_NUM].pic = -1;
SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone); SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone);
return FALSE; return false;
case 1: case 1:
psp->over[SHOTGUN_AUTO_NUM].pic = SHOTGUN_AUTO; psp->over[SHOTGUN_AUTO_NUM].pic = SHOTGUN_AUTO;
SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone); SET(psp->over[SHOTGUN_AUTO_NUM].flags, psf_ShadeNone);
return FALSE; return false;
} }
return FALSE; return false;
} }
PANEL_STATE ps_ShotgunFlash[] = PANEL_STATE ps_ShotgunFlash[] =
@ -3019,7 +3019,7 @@ pShotgunHide(PANEL_SPRITEp psp)
} }
#if 1 #if 1
SWBOOL bool
pShotgunReloadTest(PANEL_SPRITEp psp) pShotgunReloadTest(PANEL_SPRITEp psp)
{ {
//short ammo = psp->PlayerP->WpnAmmo[psp->PlayerP->WeaponType]; //short ammo = psp->PlayerP->WpnAmmo[psp->PlayerP->WeaponType];
@ -3031,17 +3031,17 @@ pShotgunReloadTest(PANEL_SPRITEp psp)
// clip has run out // clip has run out
RESET(psp->flags, PANF_REST_POS); RESET(psp->flags, PANF_REST_POS);
pSetState(psp, ps_ShotgunReload); pSetState(psp, ps_ShotgunReload);
return TRUE; return true;
} }
return FALSE; return false;
} }
#endif #endif
void void
pShotgunRest(PANEL_SPRITEp psp) 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[psp->PlayerP->WeaponType];
short ammo = psp->PlayerP->WpnAmmo[WPN_SHOTGUN]; short ammo = psp->PlayerP->WpnAmmo[WPN_SHOTGUN];
char lastammo = psp->PlayerP->WpnShotgunLastShell; 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)) if (psp->PlayerP->WpnShotgunType == 1 && ammo > 0 && ((ammo % 4) != 0) && lastammo != ammo && TEST(psp->flags, PANF_REST_POS))
{ {
force = TRUE; force = true;
} }
pShotgunOverlays(psp); pShotgunOverlays(psp);
@ -3090,10 +3090,10 @@ pShotgunRest(PANEL_SPRITEp psp)
void void
pShotgunRestTest(PANEL_SPRITEp psp) 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)) if (psp->PlayerP->WpnShotgunType == 1 && !pShotgunReloadTest(psp))
force = TRUE; force = true;
if (pShotgunReloadTest(psp)) if (pShotgunReloadTest(psp))
return; return;
@ -3172,7 +3172,7 @@ void pRailRecoilDown(PANEL_SPRITEp psp);
void pRailBobSetup(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_BEAT_RATE 24
#define Rail_ACTION_RATE 3 // !JIM! Was 10 #define Rail_ACTION_RATE 3 // !JIM! Was 10
@ -3453,7 +3453,7 @@ void
pRailRest(PANEL_SPRITEp psp) pRailRest(PANEL_SPRITEp psp)
{ {
int InitLaserSight(PLAYERp pp); int InitLaserSight(PLAYERp pp);
SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT);
if (SW_SHAREWARE) return; if (SW_SHAREWARE) return;
@ -3488,7 +3488,7 @@ pRailRest(PANEL_SPRITEp psp)
void void
pRailRestTest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_RailHide))
return; return;
@ -3868,7 +3868,7 @@ pHotheadHide(PANEL_SPRITEp psp)
void void
pHotheadRest(PANEL_SPRITEp psp) pHotheadRest(PANEL_SPRITEp psp)
{ {
SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT); bool force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT);
if (SW_SHAREWARE) return; if (SW_SHAREWARE) return;
@ -4191,8 +4191,8 @@ InitWeaponMicro(PLAYERp pp)
{ {
if (pp->TestNukeInit && pp->WpnRocketType == 2 && !pp->InitingNuke && pp->WpnRocketNuke && !pp->NukeInitialized) if (pp->TestNukeInit && pp->WpnRocketType == 2 && !pp->InitingNuke && pp->WpnRocketNuke && !pp->NukeInitialized)
{ {
pp->TestNukeInit = FALSE; pp->TestNukeInit = false;
pp->InitingNuke = TRUE; pp->InitingNuke = true;
psp = pp->Wpn[WPN_MICRO]; psp = pp->Wpn[WPN_MICRO];
pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt); pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt);
} }
@ -4214,7 +4214,7 @@ InitWeaponMicro(PLAYERp pp)
pSetState(psp, psp->PresentState); pSetState(psp, psp->PresentState);
if (pp->WpnRocketType == 2 && !pp->InitingNuke && !pp->NukeInitialized) 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); PlaySound(DIGI_ROCKET_UP, pp, v3df_follow);
@ -4304,7 +4304,7 @@ pMicroPresent(PANEL_SPRITEp psp)
psp->yorig = psp->y; psp->yorig = psp->y;
if (pp->WpnRocketType == 2 && !pp->NukeInitialized) if (pp->WpnRocketType == 2 && !pp->NukeInitialized)
{ {
pp->TestNukeInit = FALSE; pp->TestNukeInit = false;
pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt); pSetState(psp, !cl_swaltnukeinit ? ps_InitNuke : ps_InitNukeAlt);
} }
else else
@ -4343,7 +4343,7 @@ pMicroHide(PANEL_SPRITEp psp)
} }
} }
SWBOOL bool
pMicroOverlays(PANEL_SPRITEp psp) pMicroOverlays(PANEL_SPRITEp psp)
{ {
#define MICRO_SIGHT_XOFF 29 #define MICRO_SIGHT_XOFF 29
@ -4376,7 +4376,7 @@ pMicroOverlays(PANEL_SPRITEp psp)
psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1; psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_1;
SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone); SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone);
psp->over[MICRO_HEAT_NUM].pic = -1; psp->over[MICRO_HEAT_NUM].pic = -1;
return FALSE; return false;
case 1: case 1:
if (psp->PlayerP->WpnRocketHeat) if (psp->PlayerP->WpnRocketHeat)
{ {
@ -4396,7 +4396,7 @@ pMicroOverlays(PANEL_SPRITEp psp)
psp->over[MICRO_HEAT_NUM].pic = -1; psp->over[MICRO_HEAT_NUM].pic = -1;
} }
return FALSE; return false;
case 2: case 2:
psp->over[MICRO_SIGHT_NUM].pic = -1; psp->over[MICRO_SIGHT_NUM].pic = -1;
psp->over[MICRO_HEAT_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; psp->over[MICRO_SHOT_NUM].pic = MICRO_SHOT_20;
SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone); SET(psp->over[MICRO_SHOT_NUM].flags, psf_ShadeNone);
SET(psp->over[MICRO_HEAT_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[] = PANEL_STATE ps_MicroHeatFlash[] =
@ -4441,7 +4441,7 @@ void
pMicroRest(PANEL_SPRITEp psp) pMicroRest(PANEL_SPRITEp psp)
{ {
PLAYERp pp = psp->PlayerP; 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)) if (pWeaponHideKeys(psp, ps_MicroHide))
return; return;
@ -4455,8 +4455,8 @@ pMicroRest(PANEL_SPRITEp psp)
{ {
int choose_voc=0; int choose_voc=0;
pp->InitingNuke = FALSE; pp->InitingNuke = false;
pp->NukeInitialized = TRUE; pp->NukeInitialized = true;
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
{ {
@ -4532,7 +4532,7 @@ pMicroFire(PANEL_SPRITEp psp)
case 2: case 2:
PlaySound(DIGI_WARNING,psp->PlayerP,v3df_dontpan|v3df_follow); PlaySound(DIGI_WARNING,psp->PlayerP,v3df_dontpan|v3df_follow);
InitNuke(psp->PlayerP); InitNuke(psp->PlayerP);
psp->PlayerP->NukeInitialized = FALSE; psp->PlayerP->NukeInitialized = false;
break; break;
} }
} }
@ -4616,7 +4616,7 @@ pMicroReady(PANEL_SPRITEp psp)
PLAYERp pp = psp->PlayerP; PLAYERp pp = psp->PlayerP;
PlaySound(DIGI_NUKEREADY, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON); PlaySound(DIGI_NUKEREADY, pp, v3df_follow|v3df_dontpan, CHAN_WEAPON);
pp->NukeInitialized = TRUE; pp->NukeInitialized = true;
pMicroAction(psp); pMicroAction(psp);
} }
@ -4783,7 +4783,7 @@ pHeartHide(PANEL_SPRITEp psp)
void void
pHeartRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_HeartHide))
return; return;
@ -5371,7 +5371,7 @@ pGrenadeHide(PANEL_SPRITEp psp)
void void
pGrenadeRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_GrenadeHide))
return; return;
@ -5620,7 +5620,7 @@ pMineHide(PANEL_SPRITEp psp)
void void
pMineRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_MineHide))
return; return;
@ -6494,7 +6494,7 @@ pFistHide(PANEL_SPRITEp psp)
void void
pFistRest(PANEL_SPRITEp psp) 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)) if (pWeaponHideKeys(psp, ps_FistHide))
return; return;
@ -6601,13 +6601,13 @@ pWeaponForceRest(PLAYERp pp)
pSetState(pp->CurWpn, pp->CurWpn->RestState); pSetState(pp->CurWpn, pp->CurWpn->RestState);
} }
SWBOOL bool
pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
{ {
// initing the other weapon will take care of this // initing the other weapon will take care of this
if (TEST(psp->flags, PANF_DEATH_HIDE)) if (TEST(psp->flags, PANF_DEATH_HIDE))
{ {
return FALSE; return false;
} }
if (TEST(psp->flags, PANF_WEAPON_HIDE)) if (TEST(psp->flags, PANF_WEAPON_HIDE))
@ -6616,10 +6616,10 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
{ {
RESET(psp->flags, PANF_WEAPON_HIDE); RESET(psp->flags, PANF_WEAPON_HIDE);
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
return FALSE; return false;
} }
if (psp->PlayerP->input.actions & SB_HOLSTER) if (psp->PlayerP->input.actions & SB_HOLSTER)
@ -6628,7 +6628,7 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
{ {
psp->PlayerP->KeyPressBits &= ~SB_HOLSTER; psp->PlayerP->KeyPressBits &= ~SB_HOLSTER;
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
} }
else else
@ -6642,28 +6642,28 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
{ {
SET(psp->flags, PANF_UNHIDE_SHOOT); SET(psp->flags, PANF_UNHIDE_SHOOT);
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
SWBOOL bool
pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state) pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
{ {
if (TEST(psp->PlayerP->Flags, PF_DEAD)) if (TEST(psp->PlayerP->Flags, PF_DEAD))
{ {
SET(psp->flags, PANF_DEATH_HIDE); SET(psp->flags, PANF_DEATH_HIDE);
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
if (TEST(psp->PlayerP->Flags, PF_WEAPON_DOWN)) if (TEST(psp->PlayerP->Flags, PF_WEAPON_DOWN))
{ {
SET(psp->flags, PANF_WEAPON_HIDE); SET(psp->flags, PANF_WEAPON_HIDE);
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
if (psp->PlayerP->input.actions & SB_HOLSTER) if (psp->PlayerP->input.actions & SB_HOLSTER)
@ -6673,7 +6673,7 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
psp->PlayerP->KeyPressBits &= ~SB_HOLSTER; psp->PlayerP->KeyPressBits &= ~SB_HOLSTER;
PutStringInfo(psp->PlayerP,"Weapon Holstered"); PutStringInfo(psp->PlayerP,"Weapon Holstered");
pSetState(psp, state); pSetState(psp, state);
return TRUE; return true;
} }
} }
else else
@ -6681,7 +6681,7 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
psp->PlayerP->KeyPressBits |= SB_HOLSTER; 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 void
pDisplaySprites(PLAYERp pp, double smoothratio) pDisplaySprites(PLAYERp pp, double smoothratio)
{ {
@ -7273,7 +7273,7 @@ void
PreUpdatePanel(double smoothratio) PreUpdatePanel(double smoothratio)
{ {
short pnum; short pnum;
DrawBeforeView = TRUE; DrawBeforeView = true;
//if (DrawBeforeView) //if (DrawBeforeView)
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
@ -7282,7 +7282,7 @@ PreUpdatePanel(double smoothratio)
pDisplaySprites(Player + pnum, smoothratio); pDisplaySprites(Player + pnum, smoothratio);
} }
DrawBeforeView = FALSE; DrawBeforeView = false;
} }
#define EnvironSuit_RATE 10 #define EnvironSuit_RATE 10

View file

@ -185,7 +185,7 @@ enum BorderTypes
PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, double x, double y); PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, double x, double y);
void pSetSuicide(PANEL_SPRITEp psp); void pSetSuicide(PANEL_SPRITEp psp);
SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id); bool pKillScreenSpiteIDs(PLAYERp pp, short id);
void PreUpdatePanel(double smoothratio); void PreUpdatePanel(double smoothratio);
void UpdatePanel(double smoothratio); void UpdatePanel(double smoothratio);
void PlayerUpdateArmor(PLAYERp pp,short value); void PlayerUpdateArmor(PLAYERp pp,short value);

File diff suppressed because it is too large Load diff

View file

@ -125,12 +125,12 @@ int SetVisHigh(void);
int SetVisNorm(void); int SetVisNorm(void);
void DoWeapon(void); void DoWeapon(void);
void HeadBobStateControl(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 DoPlayer(void);
void domovethings(void); void domovethings(void);
void InitAllPlayers(void); void InitAllPlayers(void);
void InitMultiPlayerInfo(void); void InitMultiPlayerInfo(void);
void MoveScrollMode2D(PLAYERp pp); void MoveScrollMode2D(PLAYERp pp, ControlInfo* const hidInput);
void DoPlayerDivePalette(PLAYERp pp); void DoPlayerDivePalette(PLAYERp pp);
void DoPlayerNightVisionPalette(PLAYERp pp); void DoPlayerNightVisionPalette(PLAYERp pp);
void DoPlayerStopDiveNoWarp(PLAYERp pp); void DoPlayerStopDiveNoWarp(PLAYERp pp);
@ -144,6 +144,12 @@ void PlaySOsound(short sectnum,short sound_num);
void DoSpawnTeleporterEffectPlace(SPRITEp sp); void DoSpawnTeleporterEffectPlace(SPRITEp sp);
void FindMainSector(SECTOR_OBJECTp sop); 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 END_SW_NS
#endif #endif

View file

@ -36,8 +36,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
SWBOOL PredictionOn = TRUE; bool PredictionOn = true;
SWBOOL Prediction = FALSE; bool Prediction = false;
PLAYER PredictPlayer; PLAYER PredictPlayer;
USER PredictUser; USER PredictUser;
PLAYERp ppp = &PredictPlayer; PLAYERp ppp = &PredictPlayer;
@ -102,11 +102,11 @@ DoPrediction(PLAYERp ppp)
ppp->oq16horiz = ppp->q16horiz; ppp->oq16horiz = ppp->q16horiz;
// go through the player MOVEMENT code only // go through the player MOVEMENT code only
Prediction = TRUE; Prediction = true;
DoPlayerSectorUpdatePreMove(ppp); DoPlayerSectorUpdatePreMove(ppp);
(*ppp->DoPlayerAction)(ppp); (*ppp->DoPlayerAction)(ppp);
DoPlayerSectorUpdatePostMove(ppp); DoPlayerSectorUpdatePostMove(ppp);
Prediction = FALSE; Prediction = false;
// restore things // restore things
User[ppp->PlayerSprite] = u; User[ppp->PlayerSprite] = u;

View file

@ -276,11 +276,11 @@ int SpawnQuake(short sectnum, int x, int y, int z,
return SpriteNum; return SpriteNum;
} }
SWBOOL bool
SetQuake(PLAYERp pp, short tics, short amt) SetQuake(PLAYERp pp, short tics, short amt)
{ {
SpawnQuake(pp->cursectnum, pp->posx, pp->posy, pp->posz, tics, amt, 30000); SpawnQuake(pp->cursectnum, pp->posx, pp->posy, pp->posz, tics, amt, 30000);
return FALSE; return false;
} }
int int

View file

@ -889,7 +889,7 @@ PickJumpSpeed(short SpriteNum, int pix_height)
u->jump_speed = -600; u->jump_speed = -600;
u->jump_grav = 8; u->jump_grav = 8;
while (TRUE) while (true)
{ {
if (GetJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20) if (GetJumpHeight(u->jump_speed, u->jump_grav) > pix_height + 20)
break; break;
@ -917,7 +917,7 @@ PickJumpMaxSpeed(short SpriteNum, short max_speed)
zh = SPRITEp_TOS(sp); zh = SPRITEp_TOS(sp);
while (TRUE) while (true)
{ {
if (zh - Z(GetJumpHeight(u->jump_speed, u->jump_grav)) - Z(16) > u->hiz) if (zh - Z(GetJumpHeight(u->jump_speed, u->jump_grav)) - Z(16) > u->hiz)
break; break;
@ -945,7 +945,7 @@ InitRipperHang(short SpriteNum)
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
SWBOOL Found = FALSE; bool Found = false;
short dang, tang; short dang, tang;
for (dang = 0; dang < 2048; dang += 128) for (dang = 0; dang < 2048; dang += 128)
@ -969,7 +969,7 @@ InitRipperHang(short SpriteNum)
continue; continue;
} }
Found = TRUE; Found = true;
sp->ang = tang; sp->ang = tang;
break; break;
} }
@ -1089,7 +1089,6 @@ DoRipperBeginJumpAttack(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp; SPRITEp psp = User[SpriteNum]->tgt_sp;
int CanSeePlayer(short SpriteNum);
short tang; short tang;
tang = getangle(psp->x - sp->x, psp->y - sp->y); tang = getangle(psp->x - sp->x, psp->y - sp->y);
@ -1165,11 +1164,11 @@ DoRipperQuickJump(short SpriteNum)
NewStateGroup(SpriteNum, sg_RipperJumpAttack); NewStateGroup(SpriteNum, sg_RipperJumpAttack);
// move past the first state // move past the first state
u->Tics = 30; u->Tics = 30;
return TRUE; return true;
} }
} }
return FALSE; return false;
} }

View file

@ -945,7 +945,7 @@ InitRipper2Hang(short SpriteNum)
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 }; hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
SWBOOL Found = FALSE; bool Found = false;
short dang, tang; short dang, tang;
for (dang = 0; dang < 2048; dang += 128) for (dang = 0; dang < 2048; dang += 128)
@ -968,7 +968,7 @@ InitRipper2Hang(short SpriteNum)
continue; continue;
} }
Found = TRUE; Found = true;
sp->ang = tang; sp->ang = tang;
break; break;
} }
@ -1096,7 +1096,6 @@ DoRipper2BeginJumpAttack(short SpriteNum)
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp; SPRITEp psp = User[SpriteNum]->tgt_sp;
int CanSeePlayer(short SpriteNum);
short tang; short tang;
tang = getangle(psp->x - sp->x, psp->y - sp->y); tang = getangle(psp->x - sp->x, psp->y - sp->y);
@ -1179,11 +1178,11 @@ DoRipper2QuickJump(short SpriteNum)
NewStateGroup(SpriteNum, sg_Ripper2JumpAttack); NewStateGroup(SpriteNum, sg_Ripper2JumpAttack);
// move past the first state // move past the first state
u->Tics = 30; u->Tics = 30;
return TRUE; return true;
} }
} }
return FALSE; return false;
} }

View file

@ -53,7 +53,7 @@ typedef struct
SAVE save; SAVE save;
SWBOOL FAF_DebugView = 0; bool FAF_DebugView = false;
void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector) void COVERupdatesector(int32_t x, int32_t y, int16_t* newsector)
{ {
@ -86,7 +86,7 @@ int COVERinsertsprite(short sectnum, short stat)
return spnum; return spnum;
} }
SWBOOL bool
FAF_Sector(short sectnum) FAF_Sector(short sectnum)
{ {
short SpriteNum, Next; short SpriteNum, Next;
@ -99,11 +99,11 @@ FAF_Sector(short sectnum)
if (sp->statnum == STAT_FAF && if (sp->statnum == STAT_FAF &&
(sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)) (sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6))
{ {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
void SetWallWarpHitscan(short sectnum) void SetWallWarpHitscan(short sectnum)
@ -155,7 +155,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
int loz, hiz; int loz, hiz;
short newsectnum = sectnum; short newsectnum = sectnum;
int startclipmask = 0; int startclipmask = 0;
SWBOOL plax_found = FALSE; bool plax_found = false;
if (clipmask == CLIPMASK_MISSILE) if (clipmask == CLIPMASK_MISSILE)
startclipmask = CLIPMASK_WARP_HITSCAN; 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); //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); 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)) 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); 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)) 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)) 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); 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, 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) 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; short ang;
hitdata_t hitinfo; hitdata_t hitinfo;
int dist; int dist;
SWBOOL plax_found = FALSE; bool plax_found = false;
vec3_t s = { xs, ys, zs }; vec3_t s = { xs, ys, zs };
// ASSERT(sects >= 0 && secte >= 0); // 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 // early out to regular routine
if ((sects < 0 || !FAF_Sector(sects)) && (secte < 0 || !FAF_Sector(secte))) 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 // get angle
@ -311,7 +311,7 @@ FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects,
&hitinfo, CLIPMASK_MISSILE); &hitinfo, CLIPMASK_MISSILE);
if (hitinfo.sect < 0) if (hitinfo.sect < 0)
return FALSE; return false;
// make sure it hit JUST a sector before doing a check // make sure it hit JUST a sector before doing a check
if (hitinfo.wall < 0 && hitinfo.sprite < 0) 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)) if (FAF_ConnectFloor(hitinfo.sect))
{ {
updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z + Z(12), &newsectnum); 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)) 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)) if (FAF_ConnectCeiling(hitinfo.sect))
{ {
updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z - Z(12), &newsectnum); updatesectorz(hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z - Z(12), &newsectnum);
plax_found = TRUE; plax_found = true;
} }
} }
} }
else else
{ {
return cansee(xs,ys,zs,sects,xe,ye,ze,secte); return !!cansee(xs,ys,zs,sects,xe,ye,ze,secte);
} }
if (plax_found) 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; 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; extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust;
int z_amt = 0; int z_amt = 0;
SWBOOL SkipFAFcheck = FALSE; bool SkipFAFcheck = false;
if ((int)florhit != -1) 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 // explicit z adjust overrides Connect Floor
*loz += z_amt; *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 // explicit z adjust overrides Connect Floor
*loz += z_amt; *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 foo1;
int foo2; int foo2;
SWBOOL SkipFAFcheck; bool SkipFAFcheck;
// IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// This will return invalid FAF ceiling and floor heights inside of analyzesprite // 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 foo1;
int foo2; int foo2;
SWBOOL SkipFAFcheck; bool SkipFAFcheck;
// IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// This will return invalid FAF ceiling and floor heights inside of analyzesprite // 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 // doesn't work for blank pics
SWBOOL bool
PicInView(short tile_num, SWBOOL reset) PicInView(short tile_num, bool reset)
{ {
if (TEST(gotpic[tile_num >> 3], 1 << (tile_num & 7))) if (TEST(gotpic[tile_num >> 3], 1 << (tile_num & 7)))
{ {
if (reset) if (reset)
RESET(gotpic[tile_num >> 3], 1 << (tile_num & 7)); RESET(gotpic[tile_num >> 3], 1 << (tile_num & 7));
return TRUE; return true;
} }
return FALSE; return false;
} }
void 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 // will not hurt if GlobStackSect is invalid - inside checks for this
if (inside(x, y, GlobStackSect[i]) == 1) if (inside(x, y, GlobStackSect[i]) == 1)
{ {
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[GlobStackSect[i]], SpriteNum, Next) 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->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)
&& sp->lotag == match) && 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) if (inside(x, y, (short) i) == 1)
{ {
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[i], SpriteNum, Next) 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->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)
&& sp->lotag == match) && 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) FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum)
{ {
int xoff = 0; 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) if (*sectnum < 0)
return FALSE; return false;
ASSERT(sp); ASSERT(sp);
ASSERT(sp->hitag == VIEW_THRU_FLOOR); 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) FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum)
{ {
int xoff = 0; 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) if (*sectnum < 0)
return FALSE; return false;
ASSERT(sp); ASSERT(sp);
ASSERT(sp->hitag == VIEW_THRU_CEILING); 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 short
@ -996,7 +996,7 @@ ViewSectorInScene(short cursectnum, short level)
// found a potential match // found a potential match
match = sp->lotag; match = sp->lotag;
if (!PicInView(FAF_MIRROR_PIC, TRUE)) if (!PicInView(FAF_MIRROR_PIC, true))
return -1; return -1;
return match; 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]; sector[save.sectnum[i]].floorheinum = save.slope[i];
} }
analyzesprites(tx, ty, tz, FALSE); analyzesprites(tx, ty, tz, false);
post_analyzesprites(); post_analyzesprites();
renderDrawMasks(); 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]; sector[save.sectnum[i]].ceilingheinum = save.slope[i];
} }
analyzesprites(tx, ty, tz, FALSE); analyzesprites(tx, ty, tz, false);
post_analyzesprites(); post_analyzesprites();
renderDrawMasks(); renderDrawMasks();

View file

@ -38,9 +38,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
short DoRotatorMatch(PLAYERp pp, short match, SWBOOL); short DoRotatorMatch(PLAYERp pp, short match, bool);
SWBOOL TestRotatorMatchActive(short match); bool TestRotatorMatchActive(short match);
void InterpSectorSprites(short sectnum, SWBOOL state); void InterpSectorSprites(short sectnum, bool state);
void DoMatchEverything(PLAYERp pp, short match, short state); void DoMatchEverything(PLAYERp pp, short match, short state);
void DoRotatorSetInterp(short SpriteNum); void DoRotatorSetInterp(short SpriteNum);
void DoRotatorStopInterp(short SpriteNum); void DoRotatorStopInterp(short SpriteNum);
@ -73,12 +73,12 @@ void ReverseRotator(short SpriteNum)
r->vel = -r->vel; r->vel = -r->vel;
} }
SWBOOL bool
RotatorSwitch(short match, short setting) RotatorSwitch(short match, short setting)
{ {
SPRITEp sp; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) 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) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match)
{ {
found = TRUE; found = true;
AnimateSwitch(sp, setting); AnimateSwitch(sp, setting);
} }
} }
@ -142,7 +142,7 @@ short DoRotatorOperate(PLAYERp pp, short sectnum)
if (TestRotatorMatchActive(match)) if (TestRotatorMatchActive(match))
return -1; return -1;
else else
return DoRotatorMatch(pp, match, TRUE); return DoRotatorMatch(pp, match, true);
} }
return -1; return -1;
@ -151,7 +151,7 @@ short DoRotatorOperate(PLAYERp pp, short sectnum)
// called from switches and triggers // called from switches and triggers
// returns first vator found // returns first vator found
short short
DoRotatorMatch(PLAYERp pp, short match, SWBOOL manual) DoRotatorMatch(PLAYERp pp, short match, bool manual)
{ {
USERp fu; USERp fu;
SPRITEp fsp; SPRITEp fsp;
@ -171,7 +171,7 @@ DoRotatorMatch(PLAYERp pp, short match, SWBOOL manual)
fu = User[i]; fu = User[i];
// single play only vator // 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 (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS))
{ {
if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXT_SPONLY")); 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) TestRotatorMatchActive(short match)
{ {
USERp fu; USERp fu;
@ -251,11 +251,11 @@ TestRotatorMatchActive(short match)
continue; continue;
if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) 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; int i, nexti;
vec2_t nxy; vec2_t nxy;
int dist,closest; int dist,closest;
SWBOOL kill = FALSE; bool kill = false;
r = u->rotator; r = u->rotator;
@ -386,7 +386,7 @@ int DoRotatorMove(short SpriteNum)
} }
if (TEST_BOOL2(sp)) if (TEST_BOOL2(sp))
kill = TRUE; kill = true;
} }
closest = 99999; closest = 99999;

View file

@ -70,22 +70,21 @@ extern int lastUpdate;
extern char SaveGameDescr[10][80]; extern char SaveGameDescr[10][80];
extern int PlayClock; extern int PlayClock;
extern short Bunny_Count; extern short Bunny_Count;
extern SWBOOL NewGame; extern bool NewGame;
extern int GodMode; extern int GodMode;
extern int FinishTimer; extern int FinishTimer;
extern SWBOOL FinishAnim; extern int FinishAnim;
extern int GameVersion; extern int GameVersion;
//extern short Zombies; //extern short Zombies;
extern SWBOOL serpwasseen; extern bool serpwasseen;
extern SWBOOL sumowasseen; extern bool sumowasseen;
extern SWBOOL zillawasseen; extern bool zillawasseen;
extern short BossSpriteNum[3]; extern short BossSpriteNum[3];
#define PANEL_SAVE 1 #define PANEL_SAVE 1
#define ANIM_SAVE 1 #define ANIM_SAVE 1
extern InputPacket loc;
extern STATE s_NotRestored[]; extern STATE s_NotRestored[];
OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist}; 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(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(&screenpeek,sizeof(screenpeek),1,fil);
MWRITE(&randomseed, sizeof(randomseed), 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) bool GameInterface::LoadGame(FSaveGameNode* sv)
{ {
@ -717,7 +716,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
INITLIST(&pp->PanelSpriteList); INITLIST(&pp->PanelSpriteList);
while (TRUE) while (true)
{ {
MREAD(&ndx, sizeof(ndx),1,fil); 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(&screenpeek,sizeof(screenpeek),1,fil);
MREAD(&randomseed, sizeof(randomseed), 1, fil); MREAD(&randomseed, sizeof(randomseed), 1, fil);
@ -943,7 +942,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
{ {
INITLIST(otlist[i]); INITLIST(otlist[i]);
while (TRUE) while (true)
{ {
MREAD(&ndx, sizeof(ndx),1,fil); MREAD(&ndx, sizeof(ndx),1,fil);
@ -1070,13 +1069,13 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
} }
// this is not a new game // this is not a new game
ShadowWarrior::NewGame = FALSE; ShadowWarrior::NewGame = false;
DoPlayerDivePalette(Player+myconnectindex); DoPlayerDivePalette(Player+myconnectindex);
DoPlayerNightVisionPalette(Player+myconnectindex); DoPlayerNightVisionPalette(Player+myconnectindex);
SavegameLoaded = TRUE; SavegameLoaded = true;
return true; return true;
} }

View file

@ -59,8 +59,8 @@ static char* script_p, * scriptend_p;
static char token[MAXTOKEN]; static char token[MAXTOKEN];
static int grabbed; static int grabbed;
static int scriptline; static int scriptline;
static SWBOOL endofscript; static bool endofscript;
static SWBOOL tokenready; // only TRUE if UnGetToken was just called static bool tokenready; // only true if UnGetToken was just called
/* /*
============== ==============
@ -86,8 +86,8 @@ TArray<uint8_t> LoadScriptFile(const char *filename)
{ {
scriptbuffer.Push(0); scriptbuffer.Push(0);
scriptline = 1; scriptline = 1;
endofscript = FALSE; endofscript = false;
tokenready = FALSE; tokenready = false;
} }
return scriptbuffer; return scriptbuffer;
} }
@ -101,13 +101,13 @@ TArray<uint8_t> LoadScriptFile(const char *filename)
============== ==============
*/ */
void GetToken(SWBOOL crossline) void GetToken(bool crossline)
{ {
char *token_p; char *token_p;
if (tokenready) // is a token already waiting? if (tokenready) // is a token already waiting?
{ {
tokenready = FALSE; tokenready = false;
return; return;
} }
@ -115,7 +115,7 @@ void GetToken(SWBOOL crossline)
{ {
if (!crossline) if (!crossline)
Printf("Error: Line %i is incomplete\n",scriptline); Printf("Error: Line %i is incomplete\n",scriptline);
endofscript = TRUE; endofscript = true;
return; return;
} }
@ -129,7 +129,7 @@ skipspace:
{ {
if (!crossline) if (!crossline)
Printf("Error: Line %i is incomplete\n",scriptline); Printf("Error: Line %i is incomplete\n",scriptline);
endofscript = TRUE; endofscript = true;
return; return;
} }
if (*script_p++ == '\n') if (*script_p++ == '\n')
@ -144,7 +144,7 @@ skipspace:
{ {
if (!crossline) if (!crossline)
Printf("Error: Line %i is incomplete\n", scriptline); Printf("Error: Line %i is incomplete\n", scriptline);
endofscript = TRUE; endofscript = true;
return; return;
} }
@ -155,7 +155,7 @@ return;
while (*script_p++ != '\n') while (*script_p++ != '\n')
if (script_p >= scriptend_p) if (script_p >= scriptend_p)
{ {
endofscript = TRUE; endofscript = true;
return; return;
} }
goto skipspace; goto skipspace;
@ -218,17 +218,17 @@ void LoadKVXFromScript(const char* filename)
do 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) // of a new line is permitted (and expected)
if (endofscript) if (endofscript)
break; break;
lTile = atol(token); lTile = atol(token);
GetToken(FALSE); GetToken(false);
lNumber = atol(token); lNumber = atol(token);
GetToken(FALSE); GetToken(false);
// Load the voxel file into memory // Load the voxel file into memory
if (!qloadkvx(lNumber,token)) if (!qloadkvx(lNumber,token))
@ -273,14 +273,14 @@ void LoadPLockFromScript(const char *filename)
do 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) // of a new line is permitted (and expected)
if (endofscript) if (endofscript)
break; break;
lTile = atoi(token); lTile = atoi(token);
GetToken(FALSE); GetToken(false);
lNumber = atoi(token); lNumber = atoi(token);
// Store the sprite and voxel numbers for later use // Store the sprite and voxel numbers for later use

View file

@ -57,17 +57,17 @@ void DoPlayerBeginForceJump(PLAYERp);
short FindNextSectorByTag(short sectnum, int tag); short FindNextSectorByTag(short sectnum, int tag);
short LevelSecrets; short LevelSecrets;
SWBOOL TestVatorMatchActive(short match); bool TestVatorMatchActive(short match);
SWBOOL TestSpikeMatchActive(short match); bool TestSpikeMatchActive(short match);
SWBOOL TestRotatorMatchActive(short match); bool TestRotatorMatchActive(short match);
SWBOOL TestSlidorMatchActive(short match); bool TestSlidorMatchActive(short match);
int PlayerCheckDeath(PLAYERp, short); int PlayerCheckDeath(PLAYERp, short);
short DoVatorOperate(PLAYERp, short); short DoVatorOperate(PLAYERp, short);
short DoVatorMatch(PLAYERp pp, short match); short DoVatorMatch(PLAYERp pp, short match);
short DoRotatorOperate(PLAYERp, short); short DoRotatorOperate(PLAYERp, short);
short DoRotatorMatch(PLAYERp pp, short match, SWBOOL); short DoRotatorMatch(PLAYERp pp, short match, bool);
short DoSlidorOperate(PLAYERp, short); short DoSlidorOperate(PLAYERp, short);
short DoSlidorMatch(PLAYERp pp, short match, SWBOOL); short DoSlidorMatch(PLAYERp pp, short match, bool);
void KillMatchingCrackSprites(short match); void KillMatchingCrackSprites(short match);
int DoTrapReset(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]; SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
SPRING_BOARD SpringBoard[20]; 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; short wall_num, start_wall;
@ -463,7 +463,7 @@ SectorSetup(void)
break; break;
case TAG_DOOR_SLIDING: case TAG_DOOR_SLIDING:
SetSectorWallBits(i, WALLFX_DONT_STICK, TRUE, TRUE); SetSectorWallBits(i, WALLFX_DONT_STICK, true, true);
break; break;
case TAG_SINE_WAVE_FLOOR: case TAG_SINE_WAVE_FLOOR:
@ -517,7 +517,7 @@ SectorSetup(void)
swf->ceiling_origz = sector[swf->sector].ceilingz - (range >> 2); swf->ceiling_origz = sector[swf->sector].ceilingz - (range >> 2);
// look for the rest by distance // 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, // near_sect = FindNextSectorByTag(base_sect,
// TAG_SINE_WAVE_FLOOR + swf_ndx); // 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) if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
return FALSE; return false;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti) TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
{ {
fsp = &sprite[i]; fsp = &sprite[i];
if (SectUser[fsp->sectnum] && SectUser[fsp->sectnum]->stag == SECT_LOCK_DOOR) 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)) 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)) 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)) 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: case TAG_VATOR:
DoVatorOperate(pp, sectnum); DoVatorOperate(pp, sectnum);
return TRUE; return true;
case TAG_ROTATOR: case TAG_ROTATOR:
DoRotatorOperate(pp, sectnum); DoRotatorOperate(pp, sectnum);
return TRUE; return true;
case TAG_SLIDOR: case TAG_SLIDOR:
DoSlidorOperate(pp, sectnum); DoSlidorOperate(pp, sectnum);
return TRUE; return true;
} }
return FALSE; return false;
} }
int int
@ -919,7 +919,7 @@ OperateWall(short wallnum, short player_is_operating)
} }
*/ */
return FALSE; return false;
} }
short short
@ -950,7 +950,7 @@ AnimateSwitch(SPRITEp sp, short tgt_value)
switch (sp->picnum) switch (sp->picnum)
{ {
// set to TRUE/ON // set to true/ON
case SWITCH_SKULL: case SWITCH_SKULL:
case SWITCH_LEVER: case SWITCH_LEVER:
case SWITCH_LIGHT: 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)) if (TEST(sop->flags, SOBJ_KILLABLE))
{ {
@ -1317,10 +1317,10 @@ SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop)
CollapseSectorObject(sop, sop->xmid, sop->ymid); CollapseSectorObject(sop, sop->xmid, sop->ymid);
DoSpawnSpotsForKill(sop->match_event); DoSpawnSpotsForKill(sop->match_event);
KillSectorObjectSprites(sop); KillSectorObjectSprites(sop);
return TRUE; return true;
} }
return FALSE; return false;
} }
short short
@ -1337,11 +1337,11 @@ DoSectorObjectKillMatch(short match)
return TestKillSectorObject(sop); return TestKillSectorObject(sop);
} }
return FALSE; return false;
} }
SWBOOL bool
SearchExplodeSectorMatch(short match) SearchExplodeSectorMatch(short match)
{ {
short i,nexti; short i,nexti;
@ -1355,11 +1355,11 @@ SearchExplodeSectorMatch(short match)
{ {
KillMatchingCrackSprites(match); KillMatchingCrackSprites(match);
DoExplodeSector(match); DoExplodeSector(match);
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
void void
@ -1437,13 +1437,13 @@ ShootableSwitch(short SpriteNum)
{ {
case SWITCH_SHOOTABLE_1: case SWITCH_SHOOTABLE_1:
//RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); //RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
OperateSprite(SpriteNum, FALSE); OperateSprite(SpriteNum, false);
sp->picnum = SWITCH_SHOOTABLE_1 + 1; sp->picnum = SWITCH_SHOOTABLE_1 + 1;
break; break;
case SWITCH_FUSE: case SWITCH_FUSE:
case SWITCH_FUSE + 1: case SWITCH_FUSE + 1:
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
OperateSprite(SpriteNum, FALSE); OperateSprite(SpriteNum, false);
sp->picnum = SWITCH_FUSE + 2; sp->picnum = SWITCH_FUSE + 2;
break; break;
} }
@ -1469,7 +1469,7 @@ void DoDeleteSpriteMatch(short match)
unsigned stat; unsigned stat;
short found; short found;
while (TRUE) while (true)
{ {
found = -1; found = -1;
@ -1595,10 +1595,10 @@ void DoMatchEverything(PLAYERp pp, short match, short state)
DoSpikeMatch(match); DoSpikeMatch(match);
if (!TestRotatorMatchActive(match)) if (!TestRotatorMatchActive(match))
DoRotatorMatch(pp, match, FALSE); DoRotatorMatch(pp, match, false);
if (!TestSlidorMatchActive(match)) if (!TestSlidorMatchActive(match))
DoSlidorMatch(pp, match, FALSE); DoSlidorMatch(pp, match, false);
DoSectorObjectKillMatch(match); DoSectorObjectKillMatch(match);
DoSectorObjectSetScale(match); DoSectorObjectSetScale(match);
@ -1621,11 +1621,11 @@ void DoMatchEverything(PLAYERp pp, short match, short state)
DoDeleteSpriteMatch(match); DoDeleteSpriteMatch(match);
} }
SWBOOL ComboSwitchTest(short combo_type, short match) bool ComboSwitchTest(short combo_type, short match)
{ {
short i,nexti; short i,nexti;
SPRITEp sp; SPRITEp sp;
SWBOOL state; int state;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) 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 any one is not set correctly then switch is not set
if (state != SP_TAG3(sp)) if (state != SP_TAG3(sp))
{ {
return FALSE; return false;
} }
} }
} }
return TRUE; return true;
} }
// NOTE: switches are always wall sprites // NOTE: switches are always wall sprites
@ -1662,17 +1662,17 @@ OperateSprite(short SpriteNum, short player_is_operating)
extern STATE s_Pachinko4Operate[]; extern STATE s_Pachinko4Operate[];
if (Prediction) if (Prediction)
return FALSE; return false;
if (sp->picnum == ST1) if (sp->picnum == ST1)
return FALSE; return false;
if (player_is_operating) if (player_is_operating)
{ {
pp = GlobPlayerP; 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)) 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) switch (sp->lotag)
@ -1683,7 +1683,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
case MECHANICGIRL_R0: case MECHANICGIRL_R0:
case SAILORGIRL_R0: case SAILORGIRL_R0:
case PRUNEGIRL_R0: case PRUNEGIRL_R0:
//if(RANDOM_RANGE(1000) < 500) return(TRUE); //if(RANDOM_RANGE(1000) < 500) return(true);
//if(u->FlagOwner == 0) //if(u->FlagOwner == 0)
{ {
short choose_snd; short choose_snd;
@ -1691,7 +1691,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
u->FlagOwner = 1; u->FlagOwner = 1;
u->WaitTics = SEC(4); u->WaitTics = SEC(4);
if (pp != Player+myconnectindex) return TRUE; if (pp != Player+myconnectindex) return true;
choose_snd = STD_RANDOM_RANGE(1000); choose_snd = STD_RANDOM_RANGE(1000);
if (sp->lotag == CARGIRL_R0) if (sp->lotag == CARGIRL_R0)
@ -1761,51 +1761,51 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlayerSound(DIGI_REALTITS, v3df_dontpan|v3df_follow,pp); PlayerSound(DIGI_REALTITS, v3df_dontpan|v3df_follow,pp);
} }
} }
return TRUE; return true;
case PACHINKO1: case PACHINKO1:
// Don't mess with it if it's already going // 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); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10));
ChangeState(SpriteNum,s_Pachinko1Operate); ChangeState(SpriteNum,s_Pachinko1Operate);
return TRUE; return true;
case PACHINKO2: case PACHINKO2:
// Don't mess with it if it's already going // 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); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10));
ChangeState(SpriteNum,s_Pachinko2Operate); ChangeState(SpriteNum,s_Pachinko2Operate);
return TRUE; return true;
case PACHINKO3: case PACHINKO3:
// Don't mess with it if it's already going // 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); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10));
ChangeState(SpriteNum,s_Pachinko3Operate); ChangeState(SpriteNum,s_Pachinko3Operate);
return TRUE; return true;
case PACHINKO4: case PACHINKO4:
// Don't mess with it if it's already going // 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); PlaySound(DIGI_PFLIP, sp, v3df_none);
u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10)); u->WaitTics = SEC(3) + SEC(RANDOM_RANGE(10));
ChangeState(SpriteNum,s_Pachinko4Operate); ChangeState(SpriteNum,s_Pachinko4Operate);
return TRUE; return true;
case SWITCH_LOCKED: case SWITCH_LOCKED:
key_num = sp->hitag; key_num = sp->hitag;
@ -1820,7 +1820,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
UnlockKeyLock(key_num, SpriteNum); UnlockKeyLock(key_num, SpriteNum);
} }
return TRUE; return true;
case TAG_COMBO_SWITCH_EVERYTHING: case TAG_COMBO_SWITCH_EVERYTHING:
@ -1833,7 +1833,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
DoMatchEverything(pp, sp->hitag, ON); DoMatchEverything(pp, sp->hitag, ON);
} }
return TRUE; return true;
case TAG_COMBO_SWITCH_EVERYTHING_ONCE: case TAG_COMBO_SWITCH_EVERYTHING_ONCE:
@ -1848,25 +1848,25 @@ OperateSprite(short SpriteNum, short player_is_operating)
sp->lotag = 0; sp->lotag = 0;
sp->hitag = 0; sp->hitag = 0;
return TRUE; return true;
case TAG_SWITCH_EVERYTHING: case TAG_SWITCH_EVERYTHING:
state = AnimateSwitch(sp, -1); state = AnimateSwitch(sp, -1);
DoMatchEverything(pp, sp->hitag, state); DoMatchEverything(pp, sp->hitag, state);
return TRUE; return true;
case TAG_SWITCH_EVERYTHING_ONCE: case TAG_SWITCH_EVERYTHING_ONCE:
state = AnimateSwitch(sp, -1); state = AnimateSwitch(sp, -1);
DoMatchEverything(pp, sp->hitag, state); DoMatchEverything(pp, sp->hitag, state);
sp->lotag = 0; sp->lotag = 0;
sp->hitag = 0; sp->hitag = 0;
return TRUE; return true;
case TAG_LIGHT_SWITCH: case TAG_LIGHT_SWITCH:
state = AnimateSwitch(sp, -1); state = AnimateSwitch(sp, -1);
DoLightingMatch(sp->hitag, state); DoLightingMatch(sp->hitag, state);
return TRUE; return true;
case TAG_SPRITE_SWITCH_VATOR: case TAG_SPRITE_SWITCH_VATOR:
{ {
@ -1879,12 +1879,12 @@ OperateSprite(short SpriteNum, short player_is_operating)
DoSpikeMatch(sp->hitag); DoSpikeMatch(sp->hitag);
if (!TestRotatorMatchActive(sp->hitag)) if (!TestRotatorMatchActive(sp->hitag))
DoRotatorMatch(pp, sp->hitag, FALSE); DoRotatorMatch(pp, sp->hitag, false);
if (!TestSlidorMatchActive(sp->hitag)) if (!TestSlidorMatchActive(sp->hitag))
DoSlidorMatch(pp, sp->hitag, FALSE); DoSlidorMatch(pp, sp->hitag, false);
return TRUE; return true;
} }
case TAG_LEVEL_EXIT_SWITCH: case TAG_LEVEL_EXIT_SWITCH:
@ -1900,7 +1900,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
map = FindMapByLevelNum(currentLevel->levelNumber + 1); map = FindMapByLevelNum(currentLevel->levelNumber + 1);
ChangeLevel(map, -1); ChangeLevel(map, -1);
return TRUE; return true;
} }
case TAG_SPRITE_GRATING: case TAG_SPRITE_GRATING:
@ -1916,20 +1916,20 @@ OperateSprite(short SpriteNum, short player_is_operating)
sp->lotag = 0; sp->lotag = 0;
sp->hitag /= 2; sp->hitag /= 2;
return TRUE; return true;
} }
case TAG_SO_SCALE_SWITCH: case TAG_SO_SCALE_SWITCH:
AnimateSwitch(sp, -1); AnimateSwitch(sp, -1);
DoSectorObjectSetScale(sp->hitag); DoSectorObjectSetScale(sp->hitag);
return TRUE; return true;
case TAG_SO_SCALE_ONCE_SWITCH: case TAG_SO_SCALE_ONCE_SWITCH:
AnimateSwitch(sp, -1); AnimateSwitch(sp, -1);
DoSectorObjectSetScale(sp->hitag); DoSectorObjectSetScale(sp->hitag);
sp->lotag = 0; sp->lotag = 0;
sp->hitag = 0; sp->hitag = 0;
return TRUE; return true;
case TAG_SO_EVENT_SWITCH: case TAG_SO_EVENT_SWITCH:
{ {
@ -1962,13 +1962,13 @@ OperateSprite(short SpriteNum, short player_is_operating)
PlaySound(DIGI_BIGSWITCH, sp, v3df_none); PlaySound(DIGI_BIGSWITCH, sp, v3df_none);
return TRUE; return true;
break; break;
} }
} }
return FALSE; return false;
} }
int DoTrapReset(short match) int DoTrapReset(short match)
@ -2134,9 +2134,9 @@ OperateTripTrigger(PLAYERp pp)
if (!TestSpikeMatchActive(sectp->hitag)) if (!TestSpikeMatchActive(sectp->hitag))
DoSpikeMatch(sectp->hitag); DoSpikeMatch(sectp->hitag);
if (!TestRotatorMatchActive(sectp->hitag)) if (!TestRotatorMatchActive(sectp->hitag))
DoRotatorMatch(pp, sectp->hitag, FALSE); DoRotatorMatch(pp, sectp->hitag, false);
if (!TestSlidorMatchActive(sectp->hitag)) if (!TestSlidorMatchActive(sectp->hitag))
DoSlidorMatch(pp, sectp->hitag, FALSE); DoSlidorMatch(pp, sectp->hitag, false);
break; break;
case TAG_LIGHT_TRIGGER: 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 // 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 // If player is too far away, don't grunt
#define PLAYER_SOUNDEVENT_TAG 900 #define PLAYER_SOUNDEVENT_TAG 900
SWBOOL NearThings(PLAYERp pp) bool NearThings(PLAYERp pp)
{ {
short neartagsect, neartagwall, neartagsprite; short neartagsect, neartagwall, neartagsprite;
int neartaghitdist; int neartaghitdist;
@ -2314,7 +2314,7 @@ SWBOOL NearThings(PLAYERp pp)
{ {
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
PlayerSound(sector[pp->cursectnum].lotag, v3df_follow|v3df_dontpan,pp); 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), neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, FixedToInt(pp->q16ang),
@ -2334,7 +2334,7 @@ SWBOOL NearThings(PLAYERp pp)
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
PlayerSound(sp->lotag, v3df_follow|v3df_dontpan,pp); 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) if (neartagwall >= 0)
@ -2344,9 +2344,9 @@ SWBOOL NearThings(PLAYERp pp)
{ {
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
PlayerSound(wall[neartagwall].lotag, v3df_follow|v3df_dontpan,pp); 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 // 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); &hitinfo, CLIPMASK_MISSILE);
if (hitinfo.sect < 0) if (hitinfo.sect < 0)
return FALSE; return false;
if (Distance(hitinfo.pos.x, hitinfo.pos.y, pp->posx, pp->posy) > 1500) if (Distance(hitinfo.pos.x, hitinfo.pos.y, pp->posx, pp->posy) > 1500)
return FALSE; return false;
// hit a sprite? // hit a sprite?
if (hitinfo.sprite >= 0) if (hitinfo.sprite >= 0)
return FALSE; return false;
if (neartagsect >= 0) if (neartagsect >= 0)
return TRUE; return true;
if (hitinfo.wall >= 0) if (hitinfo.wall >= 0)
{ {
@ -2387,10 +2387,10 @@ SWBOOL NearThings(PLAYERp pp)
PlayerSound(DIGI_SEARCHWALL, v3df_follow|v3df_dontpan,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]); KillSprite(StarQueue[i]);
StarQueue[i] = -1; StarQueue[i] = -1;
if (TEST(pp->WpnFlags, BIT(WPN_STAR))) if (TEST(pp->WpnFlags, BIT(WPN_STAR)))
return TRUE; return true;
SET(pp->WpnFlags, BIT(WPN_STAR)); SET(pp->WpnFlags, BIT(WPN_STAR));
InitWeaponStar(pp); InitWeaponStar(pp);
return TRUE; return true;
} }
return FALSE; return false;
} }
@ -2561,7 +2561,7 @@ int DoPlayerGrabStar(PLAYERp pp)
void void
PlayerOperateEnv(PLAYERp pp) PlayerOperateEnv(PLAYERp pp)
{ {
SWBOOL found; bool found;
if (Prediction || !pp->SpriteP) if (Prediction || !pp->SpriteP)
return; return;
@ -2592,17 +2592,17 @@ PlayerOperateEnv(PLAYERp pp)
BuildNearTagList(nti, sizeof(nti), pp, pp->posz, 2048L, NTAG_SEARCH_LO_HI, 8); BuildNearTagList(nti, sizeof(nti), pp, pp->posz, 2048L, NTAG_SEARCH_LO_HI, 8);
found = FALSE; found = false;
// try and find a sprite // try and find a sprite
for (nt_ndx = 0; nti[nt_ndx].dist >= 0; nt_ndx++) for (nt_ndx = 0; nti[nt_ndx].dist >= 0; nt_ndx++)
{ {
if (nti[nt_ndx].spritenum >= 0 && nti[nt_ndx].dist < 1024 + 768) 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; 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 (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; pp->KeyPressBits &= ~SB_OPEN;
break; break;
@ -2648,7 +2648,7 @@ PlayerOperateEnv(PLAYERp pp)
if (neartagsector >= 0 && neartaghitdist < 1024) if (neartagsector >= 0 && neartaghitdist < 1024)
{ {
if (OperateSector(neartagsector, TRUE)) if (OperateSector(neartagsector, true))
{ {
// Release the key // Release the key
pp->KeyPressBits &= ~SB_OPEN; pp->KeyPressBits &= ~SB_OPEN;
@ -2657,7 +2657,7 @@ PlayerOperateEnv(PLAYERp pp)
if (neartagwall >= 0 && neartaghitdist < 1024) if (neartagwall >= 0 && neartaghitdist < 1024)
{ {
if (OperateWall(neartagwall, TRUE)) if (OperateWall(neartagwall, true))
{ {
pp->KeyPressBits &= ~SB_OPEN; pp->KeyPressBits &= ~SB_OPEN;
} }
@ -2681,7 +2681,7 @@ PlayerOperateEnv(PLAYERp pp)
pp->KeyPressBits &= ~SB_OPEN; pp->KeyPressBits &= ~SB_OPEN;
break; break;
case TAG_DOOR_ROTATE: case TAG_DOOR_ROTATE:
if (OperateSector(pp->cursectnum, TRUE)) if (OperateSector(pp->cursectnum, true))
pp->KeyPressBits &= ~SB_OPEN; pp->KeyPressBits &= ~SB_OPEN;
break; break;
} }
@ -3255,7 +3255,7 @@ void
DoSector(void) DoSector(void)
{ {
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
SWBOOL riding; bool riding;
int sync_flag; int sync_flag;
short pnum; short pnum;
int min_dist,dist,a,b,c; int min_dist,dist,a,b,c;
@ -3269,7 +3269,7 @@ DoSector(void)
continue; continue;
riding = FALSE; riding = false;
min_dist = 999999; min_dist = 999999;
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
@ -3278,7 +3278,7 @@ DoSector(void)
if (pp->sop_riding == sop) if (pp->sop_riding == sop)
{ {
riding = TRUE; riding = true;
pp->sop_riding = NULL; pp->sop_riding = NULL;
break; break;
} }

View file

@ -67,12 +67,12 @@ extern short nti_cnt;
void DoSpawnSpotsForKill(short match); void DoSpawnSpotsForKill(short match);
void DoSpawnSpotsForDamage(short match); void DoSpawnSpotsForDamage(short match);
void DoMatchEverything(PLAYERp pp, short match, short state); 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 DoSoundSpotStopSound(short match);
void DoSector(void); void DoSector(void);
short AnimateSwitch(SPRITEp sp,short tgt_value); short AnimateSwitch(SPRITEp sp,short tgt_value);
void ShootableSwitch(short SpriteNum); void ShootableSwitch(short SpriteNum);
SWBOOL TestKillSectorObject(SECTOR_OBJECTp sop); bool TestKillSectorObject(SECTOR_OBJECTp sop);
void WeaponExplodeSectorInRange(short weapon); void WeaponExplodeSectorInRange(short weapon);
void initlava(void); void initlava(void);

View file

@ -552,7 +552,7 @@ int DoSkelTeleport(short SpriteNum)
x = sp->x; x = sp->x;
y = sp->y; y = sp->y;
while (TRUE) while (true)
{ {
sp->x = x; sp->x = x;
sp->y = y; sp->y = y;

View file

@ -39,7 +39,7 @@ int InitSpriteChemBomb(short SpriteNum);
int InitFlashBomb(short SpriteNum); int InitFlashBomb(short SpriteNum);
int InitCaltrops(short SpriteNum); int InitCaltrops(short SpriteNum);
int InitPhosphorus(int16_t SpriteNum); int InitPhosphorus(int16_t SpriteNum);
SWBOOL SpriteOverlapZ(int16_t, int16_t, int); bool SpriteOverlapZ(int16_t, int16_t, int);
////////////////////// //////////////////////
// //

View file

@ -68,12 +68,12 @@ void ReverseSlidor(short SpriteNum)
} }
SWBOOL bool
SlidorSwitch(short match, short setting) SlidorSwitch(short match, short setting)
{ {
SPRITEp sp; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) 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) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match)
{ {
found = TRUE; found = true;
AnimateSwitch(sp, setting); AnimateSwitch(sp, setting);
} }
} }
@ -138,7 +138,7 @@ short DoSlidorOperate(PLAYERp pp, short sectnum)
if (TestSlidorMatchActive(match)) if (TestSlidorMatchActive(match))
return -1; return -1;
else else
return DoSlidorMatch(pp, match, TRUE); return DoSlidorMatch(pp, match, true);
} }
return -1; return -1;
@ -147,7 +147,7 @@ short DoSlidorOperate(PLAYERp pp, short sectnum)
// called from switches and triggers // called from switches and triggers
// returns first vator found // returns first vator found
short short
DoSlidorMatch(PLAYERp pp, short match, SWBOOL manual) DoSlidorMatch(PLAYERp pp, short match, bool manual)
{ {
USERp fu; USERp fu;
SPRITEp fsp; SPRITEp fsp;
@ -167,7 +167,7 @@ DoSlidorMatch(PLAYERp pp, short match, SWBOOL manual)
fu = User[i]; fu = User[i];
// single play only vator // 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 (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS))
{ {
if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXTS_SPONLY")); 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) TestSlidorMatchActive(short match)
{ {
USERp fu; USERp fu;
@ -247,11 +247,11 @@ TestSlidorMatchActive(short match)
continue; continue;
if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics)
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
void DoSlidorInterp(short SpriteNum, INTERP_FUNCp interp_func) void DoSlidorInterp(short SpriteNum, INTERP_FUNCp interp_func)
@ -538,7 +538,7 @@ int DoSlidorMove(short SpriteNum)
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
ROTATORp r; ROTATORp r;
int old_pos; int old_pos;
SWBOOL kill = FALSE; bool kill = false;
r = u->rotator; r = u->rotator;
@ -613,7 +613,7 @@ int DoSlidorMove(short SpriteNum)
} }
if (TEST_BOOL2(sp)) if (TEST_BOOL2(sp))
kill = TRUE; kill = true;
} }
else else
{ {
@ -623,7 +623,7 @@ int DoSlidorMove(short SpriteNum)
int i,nexti; int i,nexti;
SPRITEp bsp; SPRITEp bsp;
USERp bu; USERp bu;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti)
{ {
@ -635,7 +635,7 @@ int DoSlidorMove(short SpriteNum)
// found something blocking so reverse to ON position // found something blocking so reverse to ON position
ReverseSlidor(SpriteNum); ReverseSlidor(SpriteNum);
SET_BOOL8(sp); // tell vator that something blocking door SET_BOOL8(sp); // tell vator that something blocking door
found = TRUE; found = true;
break; break;
} }
} }
@ -655,7 +655,7 @@ int DoSlidorMove(short SpriteNum)
ReverseSlidor(SpriteNum); ReverseSlidor(SpriteNum);
u->vel_rate = -u->vel_rate; u->vel_rate = -u->vel_rate;
found = TRUE; found = true;
} }
} }
} }

View file

@ -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. // Play CD audio if enabled.
if (cdaudio_track >= 0 && (mus_redbook || *song_file_name == 0)) if (cdaudio_track >= 0 && (mus_redbook || *song_file_name == 0))

View file

@ -78,7 +78,7 @@ void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags);
void DeleteNoSoundOwner(short spritenum); void DeleteNoSoundOwner(short spritenum);
void DeleteNoFollowSoundOwner(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 COVER_SetReverb(int amt);
void UnInitSound(void); void UnInitSound(void);
void InitFX(void); void InitFX(void);
@ -86,7 +86,7 @@ void StopFX(void);
void StopSound(void); void StopSound(void);
void StartAmbientSound(void); void StartAmbientSound(void);
void StopAmbientSound(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); void PlaySoundRTS(int rts_num);
// //
@ -170,8 +170,8 @@ struct VOC3Dstruct
int tics; // Tics used to count to next sound occurance int tics; // Tics used to count to next sound occurance
int maxtics; // Tics until next sound occurance int maxtics; // Tics until next sound occurance
// for intermittent sounds // for intermittent sounds
SWBOOL deleted; // Has sound been marked for deletion? bool deleted; // Has sound been marked for deletion?
SWBOOL FX_Ok; // Did this sound play ok? bool FX_Ok; // Did this sound play ok?
}; };
#endif #endif

View file

@ -36,9 +36,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
short DoSpikeMatch(short match); short DoSpikeMatch(short match);
SWBOOL TestSpikeMatchActive(short match); bool TestSpikeMatchActive(short match);
int DoVatorMove(short SpriteNum, int *lptr); int DoVatorMove(short SpriteNum, int *lptr);
void InterpSectorSprites(short sectnum, SWBOOL state); void InterpSectorSprites(short sectnum, bool state);
void ReverseSpike(short SpriteNum) void ReverseSpike(short SpriteNum)
{ {
@ -72,12 +72,12 @@ void ReverseSpike(short SpriteNum)
u->vel_rate = -u->vel_rate; u->vel_rate = -u->vel_rate;
} }
SWBOOL bool
SpikeSwitch(short match, short setting) SpikeSwitch(short match, short setting)
{ {
SPRITEp sp; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) 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) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match)
{ {
found = TRUE; found = true;
AnimateSwitch(sp, setting); AnimateSwitch(sp, setting);
} }
} }
@ -104,7 +104,7 @@ void SetSpikeActive(short SpriteNum)
else else
short_setinterpolation(&sectp->floorheinum); short_setinterpolation(&sectp->floorheinum);
InterpSectorSprites(sp->sectnum, ON); InterpSectorSprites(sp->sectnum, true);
// play activate sound // play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
@ -132,7 +132,7 @@ void SetSpikeInactive(short SpriteNum)
else else
short_stopinterpolation(&sectp->floorheinum); short_stopinterpolation(&sectp->floorheinum);
InterpSectorSprites(sp->sectnum, OFF); InterpSectorSprites(sp->sectnum, false);
// play activate sound // play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
@ -210,7 +210,7 @@ DoSpikeMatch(short match)
} }
SWBOOL bool
TestSpikeMatchActive(short match) TestSpikeMatchActive(short match)
{ {
USERp fu; USERp fu;
@ -231,11 +231,11 @@ TestSpikeMatchActive(short match)
continue; continue;
if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics)
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
int DoSpikeMove(short SpriteNum, int *lptr) int DoSpikeMove(short SpriteNum, int *lptr)
@ -397,7 +397,7 @@ int DoSpike(short SpriteNum)
int i,nexti; int i,nexti;
SPRITEp bsp; SPRITEp bsp;
USERp bu; USERp bu;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) 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)) if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY))
{ {
ReverseSpike(SpriteNum); ReverseSpike(SpriteNum);
found = TRUE; found = true;
break; break;
} }
} }
@ -425,7 +425,7 @@ int DoSpike(short SpriteNum)
pp->hi_sectp == &sector[sp->sectnum]) pp->hi_sectp == &sector[sp->sectnum])
{ {
ReverseSpike(SpriteNum); ReverseSpike(SpriteNum);
found = TRUE; found = true;
} }
} }
} }

View file

@ -90,8 +90,8 @@ int DoSlidorInstantClose(short SpriteNum);
void InitWeaponRocket(PLAYERp); void InitWeaponRocket(PLAYERp);
void InitWeaponUzi(PLAYERp); void InitWeaponUzi(PLAYERp);
SWBOOL FAF_Sector(short sectnum); bool FAF_Sector(short sectnum);
SWBOOL MoveSkip4, MoveSkip2, MoveSkip8; int MoveSkip4, MoveSkip2, MoveSkip8;
extern STATE s_CarryFlag[]; extern STATE s_CarryFlag[];
extern STATE s_CarryFlagNoDet[]; extern STATE s_CarryFlagNoDet[];
@ -99,7 +99,7 @@ extern STATE s_CarryFlagNoDet[];
static int globhiz, globloz, globhihit, globlohit; static int globhiz, globloz, globhihit, globlohit;
short wait_active_check_offset; short wait_active_check_offset;
int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust; 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); int DoActorDebris(short SpriteNum);
void ActorWarpUpdatePos(short SpriteNum,short sectnum); void ActorWarpUpdatePos(short SpriteNum,short sectnum);
void ActorWarpType(SPRITEp sp, SPRITEp sp_warp); void ActorWarpType(SPRITEp sp, SPRITEp sp_warp);
@ -1036,20 +1036,20 @@ PicAnimOff(short picnum)
RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK); RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK);
} }
SWBOOL bool
IconSpawn(SPRITEp sp) IconSpawn(SPRITEp sp)
{ {
// if multi item and not a modem game // if multi item and not a modem game
if (TEST(sp->extra, SPRX_MULTI_ITEM)) if (TEST(sp->extra, SPRX_MULTI_ITEM))
{ {
if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE) if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
return FALSE; return false;
} }
return TRUE; return true;
} }
SWBOOL bool
ActorTestSpawn(SPRITEp sp) ActorTestSpawn(SPRITEp sp)
{ {
if (sp->statnum == STAT_DEFAULT && sp->lotag == TAG_SPAWN_ACTOR) if (sp->statnum == STAT_DEFAULT && sp->lotag == TAG_SPAWN_ACTOR)
@ -1059,7 +1059,7 @@ ActorTestSpawn(SPRITEp sp)
memcpy(&sprite[New], sp, sizeof(SPRITE)); memcpy(&sprite[New], sp, sizeof(SPRITE));
change_sprite_stat(New, STAT_SPAWN_TRIGGER); change_sprite_stat(New, STAT_SPAWN_TRIGGER);
RESET(sprite[New].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sprite[New].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
return FALSE; return false;
} }
// Skill ranges from -1 (No Monsters) to 3 // 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 " 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)); "activates something\n", c, TrackerCast(sp->x), TrackerCast(sp->y), TrackerCast(sp->z));
return TRUE; return true;
} }
//always spawn girls in addons //always spawn girls in addons
if ((sp->picnum == TOILETGIRL_R0 || if ((sp->picnum == TOILETGIRL_R0 ||
@ -1092,18 +1092,18 @@ ActorTestSpawn(SPRITEp sp)
sp->picnum == MECHANICGIRL_R0 || sp->picnum == MECHANICGIRL_R0 ||
sp->picnum == CARGIRL_R0 || sp->picnum == CARGIRL_R0 ||
sp->picnum == PRUNEGIRL_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 // spawn Bouncing Betty (mine) in TD map 09 Warehouse
#if 0 // needs to be done smarter. #if 0 // needs to be done smarter.
if (sp->picnum == 817 && swGetAddon() == 2 && currentLevel->levelNumber == 9) if (sp->picnum == 817 && swGetAddon() == 2 && currentLevel->levelNumber == 9)
return TRUE; return true;
#endif #endif
return FALSE; return false;
} }
return TRUE; return true;
} }
@ -1125,10 +1125,10 @@ void PreCacheSkull(void);
void PreCacheBetty(void); void PreCacheBetty(void);
void PreCachePachinko(void); void PreCachePachinko(void);
SWBOOL bool
ActorSpawn(SPRITEp sp) ActorSpawn(SPRITEp sp)
{ {
int ret = TRUE; bool ret = true;
short SpriteNum = sp - sprite; short SpriteNum = sp - sprite;
switch (sp->picnum) switch (sp->picnum)
@ -1140,7 +1140,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1158,7 +1158,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1175,7 +1175,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1192,7 +1192,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1208,7 +1208,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1224,7 +1224,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1241,7 +1241,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1258,7 +1258,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1275,7 +1275,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1292,7 +1292,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1309,7 +1309,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1326,7 +1326,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1343,7 +1343,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1370,7 +1370,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1386,7 +1386,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1402,7 +1402,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1418,7 +1418,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1432,7 +1432,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1448,7 +1448,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1464,7 +1464,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1480,7 +1480,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1496,7 +1496,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1555,7 +1555,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);
return FALSE; return false;
} }
PicAnimOff(sp->picnum); PicAnimOff(sp->picnum);
@ -1565,7 +1565,7 @@ ActorSpawn(SPRITEp sp)
} }
default: default:
ret = FALSE; ret = false;
break; break;
} }
@ -2272,7 +2272,7 @@ SpriteSetup(void)
SET(sectu->flags, SECTFU_VATOR_BOTH); SET(sectu->flags, SECTFU_VATOR_BOTH);
} }
SET(sectp->extra, SECTFX_VATOR); 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); SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA);
// don't step on toes of other sector settings // don't step on toes of other sector settings
@ -2284,9 +2284,9 @@ SpriteSetup(void)
vel = SP_TAG5(sp); vel = SP_TAG5(sp);
time = SP_TAG9(sp); time = SP_TAG9(sp);
start_on = !!TEST_BOOL1(sp); start_on = !!TEST_BOOL1(sp);
floor_vator = TRUE; floor_vator = true;
if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
floor_vator = FALSE; floor_vator = false;
u->jump_speed = u->vel_tgt = speed; u->jump_speed = u->vel_tgt = speed;
u->vel_rate = vel; u->vel_rate = vel;
@ -2329,7 +2329,7 @@ SpriteSetup(void)
sectp->floorz += amt; sectp->floorz += amt;
u->z_tgt = u->sz; u->z_tgt = u->sz;
MoveSpritesWithSector(sp->sectnum, amt, 0); // floor MoveSpritesWithSector(sp->sectnum, amt, false); // floor
} }
// set orig z // set orig z
@ -2350,7 +2350,7 @@ SpriteSetup(void)
sectp->ceilingz += amt; sectp->ceilingz += amt;
u->z_tgt = u->sz; u->z_tgt = u->sz;
MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
} }
// set orig z // set orig z
@ -2375,7 +2375,7 @@ SpriteSetup(void)
short wallcount,startwall,endwall,w; short wallcount,startwall,endwall,w;
u = SpawnUser(SpriteNum, 0, NULL); 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 // need something for this
sectp->lotag = TAG_ROTATOR; sectp->lotag = TAG_ROTATOR;
@ -2438,7 +2438,7 @@ SpriteSetup(void)
u = SpawnUser(SpriteNum, 0, NULL); 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 // need something for this
sectp->lotag = TAG_SLIDOR; sectp->lotag = TAG_SLIDOR;
@ -2489,7 +2489,7 @@ SpriteSetup(void)
int floorz,ceilingz,trash; int floorz,ceilingz,trash;
u = SpawnUser(SpriteNum, 0, NULL); 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); SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA);
type = SP_TAG3(sp); type = SP_TAG3(sp);
@ -2497,9 +2497,9 @@ SpriteSetup(void)
vel = SP_TAG5(sp); vel = SP_TAG5(sp);
time = SP_TAG9(sp); time = SP_TAG9(sp);
start_on = !!TEST_BOOL1(sp); start_on = !!TEST_BOOL1(sp);
floor_vator = TRUE; floor_vator = true;
if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP)) if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
floor_vator = FALSE; floor_vator = false;
u->jump_speed = u->vel_tgt = speed; u->jump_speed = u->vel_tgt = speed;
u->vel_rate = vel; u->vel_rate = vel;
@ -2731,7 +2731,7 @@ SpriteSetup(void)
{ {
SECTORp sectp = &sector[sp->sectnum]; SECTORp sectp = &sector[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)) if (TEST(sectp->floorstat, FLOOR_STAT_SLOPE))
{ {
@ -2761,7 +2761,7 @@ SpriteSetup(void)
case SECT_COPY_DEST: 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); change_sprite_stat(SpriteNum, STAT_COPY_DEST);
break; 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; short i,nexti;
if (TEST_BOOL2(sip)) 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) if (sprite[i].statnum == statnum && User[i]->ID == id)
{ {
found = TRUE; found = true;
break; break;
} }
} }
@ -4649,7 +4649,7 @@ NewStateGroup(short SpriteNum, STATEp StateGroup[])
} }
SWBOOL bool
SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b) SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b)
{ {
SPRITEp spa = &sprite[spritenum_a], spb = &sprite[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; 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) if ((unsigned)Distance(spa->x, spa->y, spb->x, spb->y) > ua->Radius + ub->Radius)
{ {
return FALSE; return false;
} }
spa_tos = SPRITEp_TOS(spa); 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 the top of sprite a is below the bottom of b
if (spa_tos - overlap_z > spb_bos) 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 the top of sprite b is is below the bottom of a
if (spb_tos - overlap_z > spa_bos) 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) SpriteOverlapZ(int16_t spritenum_a, int16_t spritenum_b, int z_overlap)
{ {
SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b]; 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 the top of sprite a is below the bottom of b
if (spa_tos + z_overlap > spb_bos) 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 the top of sprite b is is below the bottom of a
if (spb_tos + z_overlap > spa_bos) 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 = &sector[NORM_SECTOR(ceilhit)]; u->hi_sectp = &sector[NORM_SECTOR(ceilhit)];
break; break;
default: default:
ASSERT(TRUE==FALSE); ASSERT(true==false);
break; break;
} }
@ -4883,7 +4883,7 @@ DoActorZrange(short SpriteNum)
u->lo_sectp = &sector[NORM_SECTOR(florhit)]; u->lo_sectp = &sector[NORM_SECTOR(florhit)];
break; break;
default: default:
ASSERT(TRUE==FALSE); ASSERT(true==false);
break; 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) ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_height)
{ {
SPRITEp sp = &sprite[SpriteNum]; 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) if (florhit < 0 || ceilhit < 0)
{ {
//SetSuicide(SpriteNum); //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) && if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_FLOOR) &&
(labs(loz - z) <= min_height)) (labs(loz - z) <= min_height))
{ {
return FALSE; return false;
} }
break; 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) if (labs(loz - z) <= min_height)
{ {
return FALSE; return false;
} }
break; break;
} }
default: default:
ASSERT(TRUE == FALSE); ASSERT(true == false);
break; break;
} }
return TRUE; return true;
} }
// Primarily used in ai.c for now - need to get rid of // Primarily used in ai.c for now - need to get rid of
SWBOOL bool
DropAhead(short SpriteNum, short min_height) DropAhead(short SpriteNum, short min_height)
{ {
@ -5002,9 +5002,9 @@ DropAhead(short SpriteNum, short min_height)
// look straight down for a drop // look straight down for a drop
if (ActorDrop(SpriteNum, dax, day, sp->z, newsector, min_height)) 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->hi_sectp = hi_sectp;
u->ret = -1; u->ret = -1;
changespritesect(SpriteNum, sectnum); changespritesect(SpriteNum, sectnum);
return FALSE; return false;
} }
if (ActorDrop(SpriteNum, sp->x, sp->y, sp->z, sp->sectnum, u->lo_step)) 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->hi_sectp = hi_sectp;
u->ret = -1; u->ret = -1;
changespritesect(SpriteNum, sectnum); 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->TargetDist -= dist;
u->Dist += dist; u->Dist += dist;
u->DistCheck += dist; u->DistCheck += dist;
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
@ -5469,38 +5469,38 @@ void ChoosePlayerGetSound(PLAYERp pp)
PlayerSound(PlayerGetItemVocs[choose_snd], v3df_follow|v3df_dontpan,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]; USERp u = User[SpriteNum];
switch (gNet.MultiGameType) switch (gNet.MultiGameType)
{ {
case MULTI_GAME_NONE: case MULTI_GAME_NONE:
return TRUE; return true;
case MULTI_GAME_COOPERATIVE: case MULTI_GAME_COOPERATIVE:
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN)) if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
return TRUE; return true;
if (TEST(pp->WpnGotOnceFlags, BIT(WPN))) if (TEST(pp->WpnGotOnceFlags, BIT(WPN)))
return FALSE; return false;
return TRUE; return true;
case MULTI_GAME_COMMBAT: case MULTI_GAME_COMMBAT:
case MULTI_GAME_AI_BOTS: case MULTI_GAME_AI_BOTS:
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN)) if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
return TRUE; return true;
// No Respawn - can't get a weapon again if you already got it // No Respawn - can't get a weapon again if you already got it
if (gNet.NoRespawn && TEST(pp->WpnGotOnceFlags, BIT(WPN))) 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] = struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL] =
@ -5528,7 +5528,7 @@ DoGet(short SpriteNum)
PLAYERp pp; PLAYERp pp;
short pnum, key_num; short pnum, key_num;
int dist, a,b,c; int dist, a,b,c;
SWBOOL can_see; bool can_see;
int cstat_bak; int cstat_bak;
// For flag stuff // For flag stuff
@ -5632,7 +5632,7 @@ KeyMain:
PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_KEYMSG + key_num)); 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 SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == Player+myconnectindex) if (pp == Player+myconnectindex)
PlaySound(DIGI_KEY, sp, v3df_dontpan); PlaySound(DIGI_KEY, sp, v3df_dontpan);
@ -5684,14 +5684,14 @@ KeyMain:
case ICON_SM_MEDKIT: case ICON_SM_MEDKIT:
if (pu->Health < 100) if (pu->Health < 100)
{ {
SWBOOL putbackmax=FALSE; bool putbackmax=false;
PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit)); PutStringInfo(Player+pnum, quoteMgr.GetQuote(QUOTE_INVENTORY + InvDecl_SmMedkit));
if (pp->MaxHealth == 200) if (pp->MaxHealth == 200)
{ {
pp->MaxHealth = 100; pp->MaxHealth = 100;
putbackmax = TRUE; putbackmax = true;
} }
PlayerUpdateHealth(pp, InventoryDecls[InvDecl_SmMedkit].amount); PlayerUpdateHealth(pp, InventoryDecls[InvDecl_SmMedkit].amount);
@ -6701,11 +6701,11 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
// ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); // ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#else #else
ASSERT(User[i]); ASSERT(User[i]);
StateControl(i); StateControl(i);
// ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); // ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#endif #endif
} }
@ -6721,11 +6721,11 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#else #else
ASSERT(User[i]); ASSERT(User[i]);
StateControl(i); StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#endif #endif
} }
} }
@ -6742,7 +6742,7 @@ SpriteControl(void)
sp = u->SpriteP; sp = u->SpriteP;
CloseToPlayer = FALSE; CloseToPlayer = false;
ProcessActiveVars(i); ProcessActiveVars(i);
@ -6757,7 +6757,7 @@ SpriteControl(void)
if (dist < u->active_range) if (dist < u->active_range)
{ {
CloseToPlayer = TRUE; CloseToPlayer = true;
} }
} }
@ -6770,12 +6770,12 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#else #else
StateControl(i); StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#endif #endif
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
} }
else else
{ {
@ -6797,11 +6797,11 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#else #else
ASSERT(User[i]); ASSERT(User[i]);
StateControl(i); StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#endif #endif
} }
} }
@ -6811,7 +6811,7 @@ SpriteControl(void)
{ {
if (User[i] && User[i]->ActorActionFunc) if (User[i] && User[i]->ActorActionFunc)
(*User[i]->ActorActionFunc)(i); (*User[i]->ActorActionFunc)(i);
ASSERT(nexti >= 0 ? sprite[nexti].statnum != MAXSTATUS : TRUE); ASSERT(nexti >= 0 ? sprite[nexti].statnum != MAXSTATUS : true);
} }
if (MoveSkip8 == 0) if (MoveSkip8 == 0)
@ -6833,11 +6833,11 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#else #else
ASSERT(User[i]); ASSERT(User[i]);
StateControl(i); StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); ASSERT(nexti >= 0 ? User[nexti] != NULL : true);
#endif #endif
} }
@ -6991,7 +6991,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist
if (dasectnum < 0) if (dasectnum < 0)
{ {
retval = HIT_WALL; retval = HIT_WALL;
//ASSERT(TRUE == FALSE); //ASSERT(true == false);
return retval; return retval;
} }

View file

@ -43,8 +43,8 @@ short SpriteCanGoForward(short SpriteNum, short range);
void SpriteFindNewDirection(short SpriteNum, short range); void SpriteFindNewDirection(short SpriteNum, short range);
int DoWalk(short SpriteNum); int DoWalk(short SpriteNum);
int DoBody(short SpriteNum); int DoBody(short SpriteNum);
SWBOOL CanMoveHere(int16_t spritenum); bool CanMoveHere(int16_t spritenum);
SWBOOL SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b); bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b);
int DoActorDie(short SpriteNum, short weapon); int DoActorDie(short SpriteNum, short weapon);
int DoGet(short SpriteNum); int DoGet(short SpriteNum);
void SpriteControl(void); void SpriteControl(void);
@ -53,11 +53,11 @@ void DoActorZrange(short SpriteNum);
void PreMapCombineFloors(void); void PreMapCombineFloors(void);
void SpriteSetupPost(void); void SpriteSetupPost(void);
int ActorCoughItem(short SpriteNum); int ActorCoughItem(short SpriteNum);
SWBOOL ActorSpawn(SPRITEp sp); bool ActorSpawn(SPRITEp sp);
int SpawnItemsMatch(short match); int SpawnItemsMatch(short match);
void PicAnimOff(short picnum); void PicAnimOff(short picnum);
int MissileWaterAdjust(short SpriteNum); 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 enum
{ {

View file

@ -41,9 +41,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
extern uint8_t playTrack; extern uint8_t playTrack;
SWBOOL serpwasseen = FALSE; bool serpwasseen = false;
SWBOOL sumowasseen = FALSE; bool sumowasseen = false;
SWBOOL zillawasseen = FALSE; bool zillawasseen = false;
short BossSpriteNum[3] = {-1,-1,-1}; short BossSpriteNum[3] = {-1,-1,-1};
@ -816,10 +816,10 @@ BossHealthMeter(void)
PLAYERp pp = Player + myconnectindex; PLAYERp pp = Player + myconnectindex;
short color=0,i=0,nexti,metertics,meterunit; short color=0,i=0,nexti,metertics,meterunit;
int y; int y;
extern SWBOOL NoMeters; extern bool NoMeters;
short health; short health;
SWBOOL bosswasseen; bool bosswasseen;
static SWBOOL triedplay = FALSE; static bool triedplay = false;
if (NoMeters) return; if (NoMeters) return;
@ -857,7 +857,7 @@ BossHealthMeter(void)
// Frank, good optimization for other levels, but it broke level 20. :( // Frank, good optimization for other levels, but it broke level 20. :(
// I kept this but had to add a fix. // 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 // Only show the meter when you can see the boss
if ((currentLevel->levelNumber == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen) if ((currentLevel->levelNumber == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen)
@ -873,7 +873,7 @@ BossHealthMeter(void)
{ {
if (i == 0 && !serpwasseen) if (i == 0 && !serpwasseen)
{ {
serpwasseen = TRUE; serpwasseen = true;
if (!SW_SHAREWARE) if (!SW_SHAREWARE)
{ {
PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true); PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true);
@ -881,7 +881,7 @@ BossHealthMeter(void)
} }
else if (i == 1 && !sumowasseen) else if (i == 1 && !sumowasseen)
{ {
sumowasseen = TRUE; sumowasseen = true;
if (!SW_SHAREWARE) if (!SW_SHAREWARE)
{ {
PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true); PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true);
@ -889,7 +889,7 @@ BossHealthMeter(void)
} }
else if (i == 2 && !zillawasseen) else if (i == 2 && !zillawasseen)
{ {
zillawasseen = TRUE; zillawasseen = true;
if (!SW_SHAREWARE) if (!SW_SHAREWARE)
{ {
PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true); PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true);

View file

@ -79,10 +79,10 @@ TrackTowardPlayer(SPRITEp sp, TRACKp t, TRACK_POINTp start_point)
if (end_dist < start_dist) 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) 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; short sp_num, next_sp_num, startwall, endwall;
int i, k, j; int i, k, j;
SPRITEp BoundSprite; SPRITEp BoundSprite;
SWBOOL FoundOutsideLoop = FALSE; bool FoundOutsideLoop = false;
SWBOOL SectorInBounds; bool SectorInBounds;
SECTORp *sectp; SECTORp *sectp;
USERp u = User[sop->sp_child - sprite]; USERp u = User[sop->sp_child - sprite];
@ -806,14 +806,14 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
startwall = sector[k].wallptr; startwall = sector[k].wallptr;
endwall = startwall + sector[k].wallnum - 1; endwall = startwall + sector[k].wallnum - 1;
SectorInBounds = TRUE; SectorInBounds = true;
for (j = startwall; j <= endwall; j++) for (j = startwall; j <= endwall; j++)
{ {
// all walls have to be in bounds to be in sector object // 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)) if (!(wall[j].x > xlow && wall[j].x < xhigh && wall[j].y > ylow && wall[j].y < yhigh))
{ {
SectorInBounds = FALSE; SectorInBounds = false;
break; break;
} }
} }
@ -850,7 +850,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// Make sure every sector object has an outer loop tagged - important // Make sure every sector object has an outer loop tagged - important
// //
FoundOutsideLoop = FALSE; FoundOutsideLoop = false;
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{ {
@ -865,7 +865,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
sop->morph_wall_point = k; sop->morph_wall_point = k;
if (wall[k].extra && TEST(wall[k].extra, WALLFX_LOOP_OUTER)) if (wall[k].extra && TEST(wall[k].extra, WALLFX_LOOP_OUTER))
FoundOutsideLoop = TRUE; FoundOutsideLoop = true;
// each wall has this set - for collision detection // each wall has this set - for collision detection
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK); 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_MGUN:
case SO_TURRET: case SO_TURRET:
case SO_TANK: case SO_VEHICLE:
sop->vel = 0; sop->vel = 0;
SET(sop->flags, SOBJ_OPERATIONAL); SET(sop->flags, SOBJ_OPERATIONAL);
break; break;
#if 0
case SO_SPEED_BOAT: case SO_SPEED_BOAT:
sop->vel = 0; sop->vel = 0;
sop->bob_amt = Z(2); sop->bob_amt = Z(2);
sop->bob_speed = 4; sop->bob_speed = 4;
SET(sop->flags, SOBJ_OPERATIONAL); SET(sop->flags, SOBJ_OPERATIONAL);
break; break;
#endif
default: default:
SET(sop->flags, SOBJ_OPERATIONAL); SET(sop->flags, SOBJ_OPERATIONAL);
break; break;
@ -1466,7 +1468,7 @@ void
PlaceSectorObjectsOnTracks(void) PlaceSectorObjectsOnTracks(void)
{ {
short i, j, k, startwall, endwall; short i, j, k, startwall, endwall;
SWBOOL found; bool found;
// place each sector object on the track // place each sector object on the track
for (i = 0; i < MAX_SECTOR_OBJECTS; i++) for (i = 0; i < MAX_SECTOR_OBJECTS; i++)
@ -1503,7 +1505,7 @@ PlaceSectorObjectsOnTracks(void)
if (sop->track >= SO_OPERATE_TRACK_START) if (sop->track >= SO_OPERATE_TRACK_START)
continue; continue;
found = FALSE; found = false;
// find the closest point on the track and put SOBJ on it // find the closest point on the track and put SOBJ on it
for (j = 0; j < Track[sop->track].NumPoints; j++) for (j = 0; j < Track[sop->track].NumPoints; j++)
{ {
@ -1515,7 +1517,7 @@ PlaceSectorObjectsOnTracks(void)
{ {
low_dist = dist; low_dist = dist;
sop->point = j; 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); ////DSPRINTF(ds,"point = %d, dist = %d, x1=%d, y1=%d",j,low_dist,(tpoint +j)->x,(tpoint+j)->y);
//MONO_PRINT(ds); //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 // New angle is formed by taking last known angle and
// adjusting by the delta angle // adjusting by the delta angle
pp->camq16ang += NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) - pp->q16ang; playerAddAngle(pp, GetDeltaQ16Angle(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng), pp->q16ang));
pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang);
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng));
UpdatePlayerSprite(pp); UpdatePlayerSprite(pp);
} }
@ -1695,17 +1695,17 @@ MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny)
WALLp wp; WALLp wp;
USERp u; USERp u;
short i, rot_ang; short i, rot_ang;
SWBOOL PlayerMove = TRUE; bool PlayerMove = true;
if (sop->xmid >= MAXSO) if (sop->xmid >= MAXSO)
PlayerMove = FALSE; PlayerMove = false;
// move along little midpoint // move along little midpoint
sop->xmid += BOUND_4PIX(nx); sop->xmid += BOUND_4PIX(nx);
sop->ymid += BOUND_4PIX(ny); sop->ymid += BOUND_4PIX(ny);
if (sop->xmid >= MAXSO) if (sop->xmid >= MAXSO)
PlayerMove = FALSE; PlayerMove = false;
// move child sprite along also // move child sprite along also
sop->sp_child->x = sop->xmid; sop->sp_child->x = sop->xmid;
@ -1783,13 +1783,13 @@ PlayerPart:
{ {
#if 0 #if 0
short nr, nextnr; short nr, nextnr;
SWBOOL skip = TRUE; bool skip = true;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_NO_RIDE], nr, nextnr) TRAVERSE_SPRITE_STAT(headspritestat[STAT_NO_RIDE], nr, nextnr)
{ {
if (sprite[nr].lotag == sop - SectorObject) if (sprite[nr].lotag == sop - SectorObject)
skip = TRUE; skip = true;
else else
skip = FALSE; skip = false;
} }
if (skip) 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; short wallcount = 0, j, k, startwall, endwall, delta_ang_from_orig;
SECTORp *sectp; SECTORp *sectp;
@ -2238,7 +2238,7 @@ void CallbackSOsink(ANIMp ap, void *data)
short dest_sector = -1; short dest_sector = -1;
short src_sector = -1; short src_sector = -1;
short i, nexti, ndx; short i, nexti, ndx;
char found = FALSE; char found = false;
int tgt_depth; int tgt_depth;
sop = (SECTOR_OBJECTp)data; 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); ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8);
AnimSetVelAdj(ndx, ap->vel_adj); AnimSetVelAdj(ndx, ap->vel_adj);
found = TRUE; found = true;
break; break;
} }
} }
@ -2311,7 +2311,7 @@ void CallbackSOsink(ANIMp ap, void *data)
// in a more precise way // in a more precise way
ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8); ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8);
AnimSetVelAdj(ndx, ap->vel_adj); AnimSetVelAdj(ndx, ap->vel_adj);
found = TRUE; found = true;
break; break;
} }
} }
@ -2360,7 +2360,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics)
if (TEST(sop->flags, SOBJ_UPDATE_ONCE)) if (TEST(sop->flags, SOBJ_UPDATE_ONCE))
{ {
RESET(sop->flags, SOBJ_UPDATE_ONCE); RESET(sop->flags, SOBJ_UPDATE_ONCE);
RefreshPoints(sop, 0, 0, FALSE); RefreshPoints(sop, 0, 0, false);
} }
return; return;
} }
@ -2412,7 +2412,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics)
if (TEST(sop->flags, SOBJ_DYNAMIC)) if (TEST(sop->flags, SOBJ_DYNAMIC))
{ {
// trick tricks // trick tricks
RefreshPoints(sop, nx, ny, TRUE); RefreshPoints(sop, nx, ny, true);
} }
else else
{ {
@ -2423,7 +2423,7 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics)
GlobSpeedSO) GlobSpeedSO)
{ {
RESET(sop->flags, SOBJ_UPDATE_ONCE); 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->spin_ang = 0;
sop->ang = newang; sop->ang = newang;
RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, false);
} }
void void
@ -2824,7 +2824,7 @@ void
PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy) PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy)
{ {
so_setinterpolationtics(sop, synctics); 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) void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator)
@ -2886,7 +2886,7 @@ KillSectorObject(SECTOR_OBJECTp sop)
sop->spin_ang = 0; sop->spin_ang = 0;
sop->ang = sop->ang_tgt; 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); 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 void
@ -3136,7 +3136,7 @@ ScanToWall
*/ */
SWBOOL bool
ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
{ {
SPRITEp sp; SPRITEp sp;
@ -3158,7 +3158,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (u->track_dir == -1) if (u->track_dir == -1)
{ {
DoActorHitTrackEndPoint(u); DoActorHitTrackEndPoint(u);
return FALSE; return false;
} }
} }
@ -3172,7 +3172,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (u->track_dir == 1) if (u->track_dir == 1)
{ {
DoActorHitTrackEndPoint(u); DoActorHitTrackEndPoint(u);
return FALSE; return false;
} }
} }
@ -3286,10 +3286,10 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
ASSERT(hitinfo.sect >= 0); ASSERT(hitinfo.sect >= 0);
if (hitinfo.sprite >= 0) if (hitinfo.sprite >= 0)
return FALSE; return false;
if (hitinfo.wall < 0) if (hitinfo.wall < 0)
return FALSE; return false;
zdiff = labs(sp->z - sector[wall[hitinfo.wall].nextsector].floorz) >> 8; zdiff = labs(sp->z - sector[wall[hitinfo.wall].nextsector].floorz) >> 8;
@ -3299,7 +3299,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
u->ActorActionFunc = DoActorMoveJump; u->ActorActionFunc = DoActorMoveJump;
return FALSE; return false;
} }
break; break;
@ -3325,7 +3325,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
u->ActorActionFunc = DoActorMoveJump; u->ActorActionFunc = DoActorMoveJump;
return FALSE; return false;
} }
break; break;
@ -3335,7 +3335,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (u->ActorActionSet->Jump) if (u->ActorActionSet->Jump)
{ {
ActorLeaveTrack(SpriteNum); ActorLeaveTrack(SpriteNum);
return FALSE; return false;
} }
break; break;
@ -3357,7 +3357,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
InitActorDuck(SpriteNum); InitActorDuck(SpriteNum);
u->ActorActionFunc = DoActorDuck; u->ActorActionFunc = DoActorDuck;
return FALSE; return false;
} }
break; break;
@ -3371,7 +3371,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
int i; int i;
if (u->Rot == u->ActorActionSet->Sit || u->Rot == u->ActorActionSet->Stand) if (u->Rot == u->ActorActionSet->Sit || u->Rot == u->ActorActionSet->Stand)
return FALSE; return false;
sp->ang = tpoint->ang; sp->ang = tpoint->ang;
@ -3392,7 +3392,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (nearsprite >= 0 && nearhitdist < 1024) if (nearsprite >= 0 && nearhitdist < 1024)
{ {
if (OperateSprite(nearsprite, FALSE)) if (OperateSprite(nearsprite, false))
{ {
if (!tpoint->tag_high) if (!tpoint->tag_high)
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
@ -3406,7 +3406,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (nearsector >= 0 && nearhitdist < 1024) if (nearsector >= 0 && nearhitdist < 1024)
{ {
if (OperateSector(nearsector, FALSE)) if (OperateSector(nearsector, false))
{ {
if (!tpoint->tag_high) if (!tpoint->tag_high)
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
@ -3419,7 +3419,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (nearwall >= 0 && nearhitdist < 1024) if (nearwall >= 0 && nearhitdist < 1024)
{ {
if (OperateWall(nearwall, FALSE)) if (OperateWall(nearwall, false))
{ {
if (!tpoint->tag_high) if (!tpoint->tag_high)
u->WaitTics = 2 * 120; u->WaitTics = 2 * 120;
@ -3603,7 +3603,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (!lsp) if (!lsp)
{ {
ActorLeaveTrack(SpriteNum); ActorLeaveTrack(SpriteNum);
return FALSE; return false;
} }
// determine where the player is supposed to be in relation to the ladder // 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) if (hit_wall < 0)
{ {
ActorLeaveTrack(SpriteNum); ActorLeaveTrack(SpriteNum);
return FALSE; return false;
} }
#if DEBUG #if DEBUG
@ -3672,7 +3672,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
break; 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 not on a track then better not go here
if (u->track == -1) if (u->track == -1)
return TRUE; return true;
// if lying in wait for player // if lying in wait for player
if (TEST(u->Flags, SPR_WAIT_FOR_PLAYER | SPR_WAIT_FOR_TRIGGER)) 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; u->tgt_sp = pp->SpriteP;
RESET(u->Flags, SPR_WAIT_FOR_PLAYER); RESET(u->Flags, SPR_WAIT_FOR_PLAYER);
return TRUE; return true;
} }
} }
} }
u->Tics = 0; u->Tics = 0;
return TRUE; return true;
} }
// if pausing the return // if pausing the return
@ -3736,7 +3736,7 @@ ActorFollowTrack(short SpriteNum, short locktics)
u->WaitTics = 0; u->WaitTics = 0;
} }
return TRUE; return true;
} }
tpoint = Track[u->track].TrackPoint + u->point; 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 ((dist = Distance(sp->x, sp->y, tpoint->x, tpoint->y)) < 200) // 64
{ {
if (!ActorTrackDecide(tpoint, SpriteNum)) if (!ActorTrackDecide(tpoint, SpriteNum))
return TRUE; return true;
// get the next point // get the next point
NextActorTrackPoint(SpriteNum); NextActorTrackPoint(SpriteNum);
@ -3825,7 +3825,7 @@ ActorFollowTrack(short SpriteNum, short locktics)
u->jump_speed = -650; u->jump_speed = -650;
DoActorBeginJump(SpriteNum); DoActorBeginJump(SpriteNum);
return TRUE; return true;
} }
} }
else else
@ -3851,7 +3851,7 @@ ActorFollowTrack(short SpriteNum, short locktics)
} }
return TRUE; return true;
} }

View file

@ -41,9 +41,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
short DoVatorMatch(PLAYERp pp, short match); short DoVatorMatch(PLAYERp pp, short match);
SWBOOL TestVatorMatchActive(short match); bool TestVatorMatchActive(short match);
void InterpSectorSprites(short sectnum, SWBOOL state); void InterpSectorSprites(short sectnum, bool state);
int InitBloodSpray(short, SWBOOL, short); int InitBloodSpray(short, bool, short);
void ReverseVator(short SpriteNum) void ReverseVator(short SpriteNum)
{ {
@ -77,12 +77,12 @@ void ReverseVator(short SpriteNum)
u->vel_rate = -u->vel_rate; u->vel_rate = -u->vel_rate;
} }
SWBOOL bool
VatorSwitch(short match, short setting) VatorSwitch(short match, short setting)
{ {
SPRITEp sp; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti) 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) if (sp->lotag == TAG_SPRITE_SWITCH_VATOR && sp->hitag == match)
{ {
found = TRUE; found = true;
AnimateSwitch(sp, setting); AnimateSwitch(sp, setting);
} }
} }
@ -109,7 +109,7 @@ void SetVatorActive(short SpriteNum)
else else
setinterpolation(&sectp->floorz); setinterpolation(&sectp->floorz);
InterpSectorSprites(sp->sectnum, ON); InterpSectorSprites(sp->sectnum, true);
// play activate sound // play activate sound
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
@ -137,7 +137,7 @@ void SetVatorInactive(short SpriteNum)
else else
stopinterpolation(&sectp->floorz); stopinterpolation(&sectp->floorz);
InterpSectorSprites(sp->sectnum, OFF); InterpSectorSprites(sp->sectnum, false);
// play inactivate sound // play inactivate sound
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE); DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
@ -161,7 +161,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum)
sectnum = fsp->sectnum; sectnum = fsp->sectnum;
// single play only vator // 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 (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."); if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp,"This only opens in single play.");
@ -198,7 +198,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum)
#endif #endif
{ {
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1)); 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; first_vator = i;
// single play only vator // 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 (TEST_BOOL4(fsp) && (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS))
{ {
if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXTS_SPONLY")); if (pp && TEST_BOOL11(fsp)) PutStringInfo(pp, GStrings("TXTS_SPONLY"));
@ -287,7 +287,7 @@ DoVatorMatch(PLAYERp pp, short match)
} }
SWBOOL bool
TestVatorMatchActive(short match) TestVatorMatchActive(short match)
{ {
USERp fu; USERp fu;
@ -308,14 +308,14 @@ TestVatorMatchActive(short match)
continue; continue;
if (TEST(fu->Flags, SPR_ACTIVE) || fu->Tics) 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; SPRITEp sp;
short i,nexti; 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; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL both = FALSE; bool both = false;
if (SectUser[sectnum]) if (SectUser[sectnum])
both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH); both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH);
@ -465,13 +465,13 @@ int DoVator(short SpriteNum)
{ {
lptr = &sectp->ceilingz; lptr = &sectp->ceilingz;
amt = DoVatorMove(SpriteNum, lptr); amt = DoVatorMove(SpriteNum, lptr);
MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
} }
else else
{ {
lptr = &sectp->floorz; lptr = &sectp->floorz;
amt = DoVatorMove(SpriteNum, lptr); amt = DoVatorMove(SpriteNum, lptr);
MoveSpritesWithSector(sp->sectnum, amt, 0); // floor MoveSpritesWithSector(sp->sectnum, amt, false); // floor
} }
// EQUAL this entry has finished // EQUAL this entry has finished
@ -538,7 +538,7 @@ int DoVator(short SpriteNum)
int i,nexti; int i,nexti;
SPRITEp bsp; SPRITEp bsp;
USERp bu; USERp bu;
SWBOOL found = FALSE; bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti) 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)) if (labs(sectp->ceilingz - sectp->floorz) < SPRITEp_SIZE_Z(bsp))
{ {
InitBloodSpray(i, TRUE, -1); InitBloodSpray(i, true, -1);
UpdateSinglePlayKills(i); UpdateSinglePlayKills(i);
KillSprite(i); KillSprite(i);
continue; continue;
@ -561,7 +561,7 @@ int DoVator(short SpriteNum)
// found something blocking so reverse to ON position // found something blocking so reverse to ON position
ReverseVator(SpriteNum); ReverseVator(SpriteNum);
SET_BOOL8(sp); // tell vator that something blocking door SET_BOOL8(sp); // tell vator that something blocking door
found = TRUE; found = true;
break; break;
} }
} }
@ -581,7 +581,7 @@ int DoVator(short SpriteNum)
ReverseVator(SpriteNum); ReverseVator(SpriteNum);
u->vel_rate = -u->vel_rate; 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)) if (labs(sectp->ceilingz - sectp->floorz) < SPRITEp_SIZE_Z(bsp))
{ {
InitBloodSpray(i, TRUE, -1); InitBloodSpray(i, true, -1);
UpdateSinglePlayKills(i); UpdateSinglePlayKills(i);
KillSprite(i); KillSprite(i);
continue; continue;
@ -626,13 +626,13 @@ int DoVatorAuto(short SpriteNum)
{ {
lptr = &sectp->ceilingz; lptr = &sectp->ceilingz;
amt = DoVatorMove(SpriteNum, lptr); amt = DoVatorMove(SpriteNum, lptr);
MoveSpritesWithSector(sp->sectnum, amt, 1); // ceiling MoveSpritesWithSector(sp->sectnum, amt, true); // ceiling
} }
else else
{ {
lptr = &sectp->floorz; lptr = &sectp->floorz;
amt = DoVatorMove(SpriteNum, lptr); amt = DoVatorMove(SpriteNum, lptr);
MoveSpritesWithSector(sp->sectnum, amt, 0); // floor MoveSpritesWithSector(sp->sectnum, amt, false); // floor
} }
// EQUAL this entry has finished // EQUAL this entry has finished

View file

@ -86,9 +86,9 @@ int DoWallMove(SPRITEp sp)
short shade1,shade2,ang,picnum1,picnum2; short shade1,shade2,ang,picnum1,picnum2;
WALLp wallp; WALLp wallp;
short prev_wall; short prev_wall;
SWBOOL found = FALSE; bool found = false;
short dang; short dang;
SWBOOL SOsprite = FALSE; bool SOsprite = false;
dist = SP_TAG13(sp); dist = SP_TAG13(sp);
ang = SP_TAG4(sp); ang = SP_TAG4(sp);
@ -108,7 +108,7 @@ int DoWallMove(SPRITEp sp)
{ {
if (wallp->x == sp->x && wallp->y == sp->y) if (wallp->x == sp->x && wallp->y == sp->y)
{ {
found = TRUE; found = true;
if (TEST(wallp->extra, WALLFX_SECTOR_OBJECT)) if (TEST(wallp->extra, WALLFX_SECTOR_OBJECT))
{ {
@ -117,7 +117,7 @@ int DoWallMove(SPRITEp sp)
ASSERT(sop); ASSERT(sop);
SOwallmove(sop, sp, wallp, dist, &nx, &ny); SOwallmove(sop, sp, wallp, dist, &nx, &ny);
SOsprite = TRUE; SOsprite = true;
} }
else else
{ {
@ -162,10 +162,10 @@ int DoWallMove(SPRITEp sp)
return found; return found;
} }
SWBOOL CanSeeWallMove(SPRITEp wp, short match) bool CanSeeWallMove(SPRITEp wp, short match)
{ {
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
SPRITEp sp; SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE_CANSEE], i, nexti) 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) 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)) if (cansee(wp->x,wp->y,wp->z,wp->sectnum,sp->x,sp->y,sp->z,sp->sectnum))
{ {
return TRUE; return true;
} }
} }
} }
if (found) if (found)
return FALSE; return false;
else else
return TRUE; return true;
} }
int DoWallMoveMatch(short match) int DoWallMoveMatch(short match)
{ {
SPRITEp sp; SPRITEp sp;
short i,nexti; short i,nexti;
SWBOOL found = FALSE; bool found = false;
// just all with the same matching tags // just all with the same matching tags
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti) TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti)
@ -202,7 +202,7 @@ int DoWallMoveMatch(short match)
if (SP_TAG2(sp) == match) if (SP_TAG2(sp) == match)
{ {
found = TRUE; found = true;
DoWallMove(sp); DoWallMove(sp);
} }
} }

View file

@ -38,9 +38,9 @@ BEGIN_SW_NS
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
extern SWBOOL Prediction; extern bool Prediction;
SWBOOL bool
WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor) WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
{ {
int i,nexti; int i,nexti;
@ -50,10 +50,10 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
*sp_ceiling = NULL; *sp_ceiling = NULL;
if (Prediction) if (Prediction)
return FALSE; return false;
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR)) if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
return FALSE; return false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti) 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 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) WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
{ {
int i,nexti; int i,nexti;
@ -219,7 +219,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
*sp_warp = NULL; *sp_warp = NULL;
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR)) if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
return FALSE; return false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti) TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti)
{ {
@ -238,7 +238,7 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
} }
} }
return TRUE; return true;
} }
SPRITEp SPRITEp

File diff suppressed because it is too large Load diff

View file

@ -71,8 +71,8 @@ SECTOR_OBJECTp DetectSectorObjectByWall(WALLp);
void ScaleSpriteVector(short SpriteNum, int scale); void ScaleSpriteVector(short SpriteNum, int scale);
int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z); int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z);
int QueueWallBlood(short hit_sprite, short ang); int QueueWallBlood(short hit_sprite, short ang);
SWBOOL SlopeBounce(short SpriteNum, SWBOOL *hit_wall); bool SlopeBounce(short SpriteNum, bool *hit_wall);
SWBOOL HitscanSpriteAdjust(short SpriteNum, short 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 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 SpawnBubble(short SpriteNum);
int SpawnFireballExp(int16_t Weapon); int SpawnFireballExp(int16_t Weapon);
@ -82,7 +82,7 @@ int SpawnGrenadeExp(int16_t Weapon);
int SpawnSectorExp(int16_t Weapon); int SpawnSectorExp(int16_t Weapon);
int DoShrapVelocity(int16_t SpriteNum); int DoShrapVelocity(int16_t SpriteNum);
int ShrapKillSprite(short 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 ActorPain(short SpriteNum);
int SpawnBreakFlames(int16_t SpriteNum); int SpawnBreakFlames(int16_t SpriteNum);
const char *DeathString(short SpriteNum); const char *DeathString(short SpriteNum);
@ -154,12 +154,12 @@ extern int WeaponIsAmmo;
extern short target_ang; 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 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 DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec);
int GetOverlapSector(int x, int y, short *over, short *under); int GetOverlapSector(int x, int y, short *over, short *under);
SWBOOL MissileHitDiveArea(short SpriteNum); bool MissileHitDiveArea(short SpriteNum);
int DoDamageTest(short); int DoDamageTest(short);
@ -178,7 +178,7 @@ void WallBounce(short SpriteNum, short ang);
int PlayerInitChemBomb(PLAYERp pp); int PlayerInitChemBomb(PLAYERp pp);
int InitChemBomb(short SpriteNum); int InitChemBomb(short SpriteNum);
int PlayerInitCaltrops(PLAYERp pp); 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 SpawnBunnyExp(int16_t Weapon);
int InitBunnyRocket(PLAYERp pp); int InitBunnyRocket(PLAYERp pp);
@ -221,9 +221,9 @@ int HelpMissileLateral(int16_t Weapon,int dist);
int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop); int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop);
void QueueReset(void); void QueueReset(void);
int PlayerCheckDeath(PLAYERp pp,short Weapon); int PlayerCheckDeath(PLAYERp pp,short Weapon);
SWBOOL SpriteWarpToUnderwater(SPRITEp sp); bool SpriteWarpToUnderwater(SPRITEp sp);
int PlayerDamageSlide(PLAYERp pp,short damage,short ang); int PlayerDamageSlide(PLAYERp pp,short damage,short ang);
SWBOOL VehicleMoveHit(short SpriteNum); bool VehicleMoveHit(short SpriteNum);
int SpawnSplash(short SpriteNum); int SpawnSplash(short SpriteNum);
int SpawnMineExp(int16_t Weapon); int SpawnMineExp(int16_t Weapon);
int SpawnLittleExp(int16_t Weapon); int SpawnLittleExp(int16_t Weapon);
@ -232,7 +232,7 @@ int SpawnNuclearExp(int16_t Weapon);
int SpawnBoltExp(int16_t Weapon); int SpawnBoltExp(int16_t Weapon);
int SpawnTracerExp(int16_t Weapon); int SpawnTracerExp(int16_t Weapon);
int SpawnGoroFireballExp(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 DoItemFly(int16_t SpriteNum);
int SpawnVehicleSmoke(short SpriteNum); int SpawnVehicleSmoke(short SpriteNum);
short PrevWall(short wall_num); short PrevWall(short wall_num);

View file

@ -886,9 +886,9 @@ DoZombieMove(short SpriteNum)
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) 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); SetSuicide(SpriteNum);
return 0; return 0;
} }
@ -936,9 +936,9 @@ NullZombie(short SpriteNum)
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) 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); SetSuicide(SpriteNum);
return 0; return 0;
} }