Shitcan the few uses of the bool type in the VM after reading some things and dicking around on godbolt.org

git-svn-id: https://svn.eduke32.com/eduke32@8366 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/gameexec.cpp
#	source/duke3d/src/gameexec.h
This commit is contained in:
terminx 2019-12-07 23:49:56 +00:00 committed by Christoph Oelckers
parent 265e7109aa
commit cbfb675577
5 changed files with 16 additions and 14 deletions

View file

@ -891,7 +891,7 @@ void updatesectorneighbor(int32_t const x, int32_t const y, int16_t * const sect
void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4)));
int findwallbetweensectors(int sect1, int sect2);
static FORCE_INLINE bool sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; }
static FORCE_INLINE int sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; }
int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = nullptr);
extern const int16_t *chsecptr_onextwall;
int32_t checksectorpointer(int16_t i, int16_t sectnum);
@ -1147,7 +1147,7 @@ static FORCE_INLINE int32_t md_tilehasmodel(int32_t const tilenume, int32_t cons
}
#endif // defined USE_OPENGL
static FORCE_INLINE bool tilehasmodelorvoxel(int const tilenume, int pal)
static FORCE_INLINE int tilehasmodelorvoxel(int const tilenume, int pal)
{
UNREFERENCED_PARAMETER(pal);
return
@ -1189,7 +1189,7 @@ extern const int32_t engine_v8;
int32_t Mulscale(int32_t a, int32_t b, int32_t sh);
#endif
static FORCE_INLINE CONSTEXPR bool inside_p(int32_t const x, int32_t const y, int const sectnum) { return (sectnum >= 0 && inside(x, y, sectnum) == 1); }
static FORCE_INLINE CONSTEXPR int inside_p(int32_t const x, int32_t const y, int const sectnum) { return (sectnum >= 0 && inside(x, y, sectnum) == 1); }
#define SET_AND_RETURN(Lval, Rval) \
do \

View file

@ -10996,13 +10996,13 @@ int32_t lastwall(int16_t point)
* NOTE: The redundant bound checks are expected to be optimized away in the
* inlined code. */
static FORCE_INLINE CONSTEXPR bool inside_exclude_p(int32_t const x, int32_t const y, int const sectnum, const uint8_t *excludesectbitmap)
static FORCE_INLINE CONSTEXPR int inside_exclude_p(int32_t const x, int32_t const y, int const sectnum, const uint8_t *excludesectbitmap)
{
return (sectnum>=0 && !bitmap_test(excludesectbitmap, sectnum) && inside_p(x, y, sectnum));
}
/* NOTE: no bound check */
static inline bool inside_z_p(int32_t const x, int32_t const y, int32_t const z, int const sectnum)
static inline int inside_z_p(int32_t const x, int32_t const y, int32_t const z, int const sectnum)
{
int32_t cz, fz;
getzsofslope(sectnum, x, y, &cz, &fz);

View file

@ -83,7 +83,7 @@ int32_t g_structVarIDs = -1;
uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
GAMEEXEC_STATIC void VM_Execute(bool const loop = false);
GAMEEXEC_STATIC void VM_Execute(int const loop = false);
# include "gamestructures.cpp"
#endif
@ -244,7 +244,7 @@ int32_t VM_ExecuteEventWithValue(int const nEventID, int const spriteNum, int co
}
static bool VM_CheckSquished(void)
static int VM_CheckSquished(void)
{
auto const pSector = (usectorptr_t)&sector[vm.pSprite->sectnum];
@ -298,7 +298,9 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
#endif
// wow, this function sucks
bool A_Dodge(spritetype * const pSprite)
int A_Dodge(spritetype * const);
int A_Dodge(spritetype * const pSprite)
{
if (A_CheckEnemySprite(pSprite) && pSprite->extra <= 0) // hack
return 0;
@ -1175,7 +1177,7 @@ static int G_StartTrackSlotWrap(int const volumeNum, int const levelNum)
int G_StartTrack(int const levelNum) { return G_StartTrackSlot(ud.volume_number, levelNum); }
#endif
LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, int ix1, int iy1, int ix2, int iy2, bool unbiasedp)
LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, int ix1, int iy1, int ix2, int iy2, int unbiasedp)
{
int x1 = min(ix1, ix2);
int x2 = max(ix1, ix2);
@ -1305,7 +1307,7 @@ void Screen_Play(void)
} \
} while (0)
GAMEEXEC_STATIC void VM_Execute(bool const loop /*= false*/)
GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/)
{
int vm_execution_depth = loop;
#ifdef CON_USE_COMPUTED_GOTO
@ -5280,7 +5282,7 @@ badindex:
// -1 for none found
// <type> <maxdistvarid> <varid>
int const decodedInst = VM_DECODE_INST(tw);
bool const actorsOnly = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARACTOR3D);
int const actorsOnly = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARACTOR3D);
auto const dist_funcptr = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARSPRITE) ? &ldist : &dist;
int const findTile = *insptr++;
@ -5328,7 +5330,7 @@ badindex:
// that is of <type> into <getvar>
// -1 for none found
// <type> <maxdistvarid> <varid>
bool const actorsOnly = (VM_DECODE_INST(tw) == CON_FINDNEARACTORZ);
int const actorsOnly = (VM_DECODE_INST(tw) == CON_FINDNEARACTORZ);
int const findTile = *insptr++;
int maxDist = Gv_GetVar(*insptr++);

View file

@ -35,7 +35,7 @@ int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playe
int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum);
int32_t VM_ExecuteEventWithValue(int const nEventID, int const spriteNum, int const playerNum, int32_t const nReturn);
static FORCE_INLINE bool VM_HaveEvent(int const nEventID)
static FORCE_INLINE int VM_HaveEvent(int const nEventID)
{
return !!apScriptEvents[nEventID];
}

View file

@ -245,7 +245,7 @@ static FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const operan
(var.flags & GAMEVAR_PERACTOR && (unsigned) vm.spriteNum > MAXSPRITES - 1)))
return;
bool const foundInTable = (unsigned) operand < DIVTABLESIZE;
int const foundInTable = (unsigned) operand < DIVTABLESIZE;
static libdivide::libdivide_s32_t sdiv;
intptr_t *iptr = &var.global;
static int32_t lastValue;