mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
Remove the implicit "static" from our FORCE_INLINE macro.
This will be important for C++ member functions. git-svn-id: https://svn.eduke32.com/eduke32@6076 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
77875948ba
commit
62a921c409
21 changed files with 161 additions and 161 deletions
|
@ -74,7 +74,7 @@ int32_t FX_SetPrintf(void(*function)(const char *, ...));
|
|||
extern int32_t FX_ErrorCode;
|
||||
#define FX_SetErrorCode(status) FX_ErrorCode = (status);
|
||||
|
||||
FORCE_INLINE int FX_CheckMVErr(int32_t status)
|
||||
static FORCE_INLINE int FX_CheckMVErr(int32_t status)
|
||||
{
|
||||
if (status != MV_Ok)
|
||||
{
|
||||
|
@ -85,34 +85,34 @@ FORCE_INLINE int FX_CheckMVErr(int32_t status)
|
|||
return status;
|
||||
}
|
||||
|
||||
FORCE_INLINE void FX_SetCallBack(void(*function)(uint32_t)) { MV_SetCallBack(function); }
|
||||
FORCE_INLINE void FX_SetVolume(int32_t volume) { MV_SetVolume(volume); }
|
||||
FORCE_INLINE int32_t FX_GetVolume(void) { return MV_GetVolume(); }
|
||||
FORCE_INLINE void FX_SetReverseStereo(int32_t setting) { MV_SetReverseStereo(setting); }
|
||||
FORCE_INLINE int32_t FX_GetReverseStereo(void) { return MV_GetReverseStereo(); }
|
||||
FORCE_INLINE void FX_SetReverb(int32_t reverb) { MV_SetReverb(reverb); }
|
||||
FORCE_INLINE int32_t FX_GetMaxReverbDelay(void) { return MV_GetMaxReverbDelay(); }
|
||||
FORCE_INLINE int32_t FX_GetReverbDelay(void) { return MV_GetReverbDelay(); }
|
||||
FORCE_INLINE void FX_SetReverbDelay(int32_t delay) { MV_SetReverbDelay(delay); }
|
||||
FORCE_INLINE int32_t FX_VoiceAvailable(int32_t priority) { return MV_VoiceAvailable(priority); }
|
||||
FORCE_INLINE int32_t FX_PauseVoice(int32_t handle, int32_t pause) { return FX_CheckMVErr(MV_PauseVoice(handle, pause)); }
|
||||
FORCE_INLINE int32_t FX_GetPosition(int32_t handle, int32_t *position) { return FX_CheckMVErr(MV_GetPosition(handle, position)); }
|
||||
FORCE_INLINE int32_t FX_SetPosition(int32_t handle, int32_t position) { return FX_CheckMVErr(MV_SetPosition(handle, position)); }
|
||||
FORCE_INLINE int32_t FX_EndLooping(int32_t handle) { return FX_CheckMVErr(MV_EndLooping(handle)); }
|
||||
FORCE_INLINE int32_t FX_SetPan(int32_t handle, int32_t vol, int32_t left, int32_t right)
|
||||
static FORCE_INLINE void FX_SetCallBack(void(*function)(uint32_t)) { MV_SetCallBack(function); }
|
||||
static FORCE_INLINE void FX_SetVolume(int32_t volume) { MV_SetVolume(volume); }
|
||||
static FORCE_INLINE int32_t FX_GetVolume(void) { return MV_GetVolume(); }
|
||||
static FORCE_INLINE void FX_SetReverseStereo(int32_t setting) { MV_SetReverseStereo(setting); }
|
||||
static FORCE_INLINE int32_t FX_GetReverseStereo(void) { return MV_GetReverseStereo(); }
|
||||
static FORCE_INLINE void FX_SetReverb(int32_t reverb) { MV_SetReverb(reverb); }
|
||||
static FORCE_INLINE int32_t FX_GetMaxReverbDelay(void) { return MV_GetMaxReverbDelay(); }
|
||||
static FORCE_INLINE int32_t FX_GetReverbDelay(void) { return MV_GetReverbDelay(); }
|
||||
static FORCE_INLINE void FX_SetReverbDelay(int32_t delay) { MV_SetReverbDelay(delay); }
|
||||
static FORCE_INLINE int32_t FX_VoiceAvailable(int32_t priority) { return MV_VoiceAvailable(priority); }
|
||||
static FORCE_INLINE int32_t FX_PauseVoice(int32_t handle, int32_t pause) { return FX_CheckMVErr(MV_PauseVoice(handle, pause)); }
|
||||
static FORCE_INLINE int32_t FX_GetPosition(int32_t handle, int32_t *position) { return FX_CheckMVErr(MV_GetPosition(handle, position)); }
|
||||
static FORCE_INLINE int32_t FX_SetPosition(int32_t handle, int32_t position) { return FX_CheckMVErr(MV_SetPosition(handle, position)); }
|
||||
static FORCE_INLINE int32_t FX_EndLooping(int32_t handle) { return FX_CheckMVErr(MV_EndLooping(handle)); }
|
||||
static FORCE_INLINE int32_t FX_SetPan(int32_t handle, int32_t vol, int32_t left, int32_t right)
|
||||
{
|
||||
return FX_CheckMVErr(MV_SetPan(handle, vol, left, right));
|
||||
}
|
||||
FORCE_INLINE int32_t FX_SetPitch(int32_t handle, int32_t pitchoffset) { return FX_CheckMVErr(MV_SetPitch(handle, pitchoffset)); }
|
||||
FORCE_INLINE int32_t FX_SetFrequency(int32_t handle, int32_t frequency) { return FX_CheckMVErr(MV_SetFrequency(handle, frequency)); }
|
||||
FORCE_INLINE int32_t FX_Pan3D(int32_t handle, int32_t angle, int32_t distance)
|
||||
static FORCE_INLINE int32_t FX_SetPitch(int32_t handle, int32_t pitchoffset) { return FX_CheckMVErr(MV_SetPitch(handle, pitchoffset)); }
|
||||
static FORCE_INLINE int32_t FX_SetFrequency(int32_t handle, int32_t frequency) { return FX_CheckMVErr(MV_SetFrequency(handle, frequency)); }
|
||||
static FORCE_INLINE int32_t FX_Pan3D(int32_t handle, int32_t angle, int32_t distance)
|
||||
{
|
||||
return FX_CheckMVErr(MV_Pan3D(handle, angle, distance));
|
||||
}
|
||||
FORCE_INLINE int32_t FX_SoundActive(int32_t handle) { return MV_VoicePlaying(handle); }
|
||||
FORCE_INLINE int32_t FX_SoundsPlaying(void) { return MV_VoicesPlaying(); }
|
||||
FORCE_INLINE int32_t FX_StopSound(int32_t handle) { return FX_CheckMVErr(MV_Kill(handle)); }
|
||||
FORCE_INLINE int32_t FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
|
||||
static FORCE_INLINE int32_t FX_SoundActive(int32_t handle) { return MV_VoicePlaying(handle); }
|
||||
static FORCE_INLINE int32_t FX_SoundsPlaying(void) { return MV_VoicesPlaying(); }
|
||||
static FORCE_INLINE int32_t FX_StopSound(int32_t handle) { return FX_CheckMVErr(MV_Kill(handle)); }
|
||||
static FORCE_INLINE int32_t FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -96,13 +96,13 @@ int32_t MV_ErrorCode = MV_NotInstalled;
|
|||
|
||||
static int32_t lockdepth = 0;
|
||||
|
||||
FORCE_INLINE void DisableInterrupts(void)
|
||||
static FORCE_INLINE void DisableInterrupts(void)
|
||||
{
|
||||
if (lockdepth++ <= 0)
|
||||
SoundDriver_Lock();
|
||||
}
|
||||
|
||||
FORCE_INLINE void RestoreInterrupts(void)
|
||||
static FORCE_INLINE void RestoreInterrupts(void)
|
||||
{
|
||||
if (--lockdepth <= 0)
|
||||
SoundDriver_Unlock();
|
||||
|
|
|
@ -157,12 +157,12 @@ const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=
|
|||
char bgetchar(void);
|
||||
#define bkbhit() (keyasciififoplc != keyasciififoend)
|
||||
|
||||
FORCE_INLINE int keyascfifo_isfull(void)
|
||||
static FORCE_INLINE int keyascfifo_isfull(void)
|
||||
{
|
||||
return ((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc;
|
||||
}
|
||||
|
||||
FORCE_INLINE void keyascfifo_insert(char code)
|
||||
static FORCE_INLINE void keyascfifo_insert(char code)
|
||||
{
|
||||
keyasciififo[keyasciififoend] = code;
|
||||
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));
|
||||
|
@ -186,7 +186,7 @@ int32_t inittimer(int32_t);
|
|||
void uninittimer(void);
|
||||
void sampletimer(void);
|
||||
#if defined RENDERTYPESDL && !defined LUNATIC
|
||||
FORCE_INLINE uint32_t getticks(void) { return (uint32_t)SDL_GetTicks(); }
|
||||
static FORCE_INLINE uint32_t getticks(void) { return (uint32_t)SDL_GetTicks(); }
|
||||
#else
|
||||
uint32_t getticks(void);
|
||||
#endif
|
||||
|
|
|
@ -171,7 +171,7 @@ extern int32_t r_tror_nomaskpass;
|
|||
// Moved below declarations of sector, wall, sprite.
|
||||
# else
|
||||
int16_t yax_getbunch(int16_t i, int16_t cf);
|
||||
FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
||||
static FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
||||
{
|
||||
*cb = yax_getbunch(i, YAX_CEILING);
|
||||
*fb = yax_getbunch(i, YAX_FLOOR);
|
||||
|
@ -186,7 +186,7 @@ int16_t yax_vnextsec(int16_t line, int16_t cf);
|
|||
void yax_update(int32_t resetstat);
|
||||
int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf);
|
||||
|
||||
FORCE_INLINE int32_t yax_waltosecmask(int32_t walclipmask)
|
||||
static FORCE_INLINE int32_t yax_waltosecmask(int32_t walclipmask)
|
||||
{
|
||||
// blocking: walstat&1 --> secstat&512
|
||||
// hitscan: walstat&64 --> secstat&2048
|
||||
|
@ -243,9 +243,9 @@ enum {
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
FORCE_INLINE void sector_tracker_hook(uintptr_t address);
|
||||
FORCE_INLINE void wall_tracker_hook(uintptr_t address);
|
||||
FORCE_INLINE void sprite_tracker_hook(uintptr_t address);
|
||||
static FORCE_INLINE void sector_tracker_hook(uintptr_t address);
|
||||
static FORCE_INLINE void wall_tracker_hook(uintptr_t address);
|
||||
static FORCE_INLINE void sprite_tracker_hook(uintptr_t address);
|
||||
|
||||
}
|
||||
|
||||
|
@ -549,29 +549,29 @@ EXTERN uint32_t wallchanged[MAXWALLS + M32_FIXME_WALLS];
|
|||
EXTERN uint32_t spritechanged[MAXSPRITES];
|
||||
|
||||
#ifdef NEW_MAP_FORMAT
|
||||
FORCE_INLINE int16_t yax_getbunch(int16_t i, int16_t cf)
|
||||
static FORCE_INLINE int16_t yax_getbunch(int16_t i, int16_t cf)
|
||||
{
|
||||
return cf ? sector[i].floorbunch : sector[i].ceilingbunch;
|
||||
}
|
||||
|
||||
FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
||||
static FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
||||
{
|
||||
*cb = yax_getbunch(i, YAX_CEILING);
|
||||
*fb = yax_getbunch(i, YAX_FLOOR);
|
||||
}
|
||||
|
||||
FORCE_INLINE int16_t yax_getnextwall(int16_t wal, int16_t cf)
|
||||
static FORCE_INLINE int16_t yax_getnextwall(int16_t wal, int16_t cf)
|
||||
{
|
||||
return cf ? wall[wal].dnwall : wall[wal].upwall;
|
||||
}
|
||||
|
||||
FORCE_INLINE void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall)
|
||||
static FORCE_INLINE void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall)
|
||||
{
|
||||
YAX_NEXTWALL(wal, cf) = thenextwall;
|
||||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void sector_tracker_hook(uintptr_t address)
|
||||
static FORCE_INLINE void sector_tracker_hook(uintptr_t address)
|
||||
{
|
||||
uintptr_t const usector = address - (uintptr_t)sector;
|
||||
|
||||
|
@ -582,7 +582,7 @@ FORCE_INLINE void sector_tracker_hook(uintptr_t address)
|
|||
++sectorchanged[usector / sizeof(sectortype)];
|
||||
}
|
||||
|
||||
FORCE_INLINE void wall_tracker_hook(uintptr_t address)
|
||||
static FORCE_INLINE void wall_tracker_hook(uintptr_t address)
|
||||
{
|
||||
uintptr_t const uwall = address - (uintptr_t)wall;
|
||||
|
||||
|
@ -593,7 +593,7 @@ FORCE_INLINE void wall_tracker_hook(uintptr_t address)
|
|||
++wallchanged[uwall / sizeof(walltype)];
|
||||
}
|
||||
|
||||
FORCE_INLINE void sprite_tracker_hook(uintptr_t address)
|
||||
static FORCE_INLINE void sprite_tracker_hook(uintptr_t address)
|
||||
{
|
||||
uintptr_t const usprite = address - (uintptr_t)sprite;
|
||||
|
||||
|
@ -704,7 +704,7 @@ EXTERN psky_t * multipsky;
|
|||
// Mapping of multi-sky index to base sky tile number:
|
||||
EXTERN int32_t * multipskytile;
|
||||
|
||||
FORCE_INLINE int32_t getpskyidx(int32_t picnum)
|
||||
static FORCE_INLINE int32_t getpskyidx(int32_t picnum)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
|
@ -837,7 +837,7 @@ extern const char *engineerrstr;
|
|||
|
||||
EXTERN int32_t editorzrange[2];
|
||||
|
||||
FORCE_INLINE int32_t getrendermode(void)
|
||||
static FORCE_INLINE int32_t getrendermode(void)
|
||||
{
|
||||
#ifndef USE_OPENGL
|
||||
return REND_CLASSIC;
|
||||
|
@ -1042,26 +1042,26 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,
|
|||
void Buninitart(void);
|
||||
|
||||
////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
||||
FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
static FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2);
|
||||
}
|
||||
// Don't clip at all, i.e. the whole screen real estate is available:
|
||||
FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
static FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1);
|
||||
}
|
||||
|
||||
FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
static FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t alpha)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, alpha, 0, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
|
||||
FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
static FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowxy1.x,windowxy1.y,windowxy2.x,windowxy2.y);
|
||||
|
@ -1095,7 +1095,7 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
|||
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3)));
|
||||
|
||||
#if !KRANDDEBUG && !defined LUNATIC
|
||||
FORCE_INLINE int32_t krand(void)
|
||||
static FORCE_INLINE int32_t krand(void)
|
||||
{
|
||||
randomseed = (randomseed * 1664525ul) + 221297ul;
|
||||
return ((uint32_t) randomseed)>>16;
|
||||
|
@ -1107,12 +1107,12 @@ int32_t krand(void);
|
|||
int32_t ksqrt(uint32_t num);
|
||||
int32_t LUNATIC_FASTCALL getangle(int32_t xvect, int32_t yvect);
|
||||
|
||||
FORCE_INLINE uint32_t uhypsq(int32_t dx, int32_t dy)
|
||||
static FORCE_INLINE uint32_t uhypsq(int32_t dx, int32_t dy)
|
||||
{
|
||||
return (uint32_t)dx*dx + (uint32_t)dy*dy;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t logapproach(int32_t val, int32_t targetval)
|
||||
static FORCE_INLINE int32_t logapproach(int32_t val, int32_t targetval)
|
||||
{
|
||||
int32_t dif = targetval - val;
|
||||
return (dif>>1) ? val + (dif>>1) : targetval;
|
||||
|
@ -1127,29 +1127,29 @@ int32_t getflorzofslopeptr(const usectortype *sec, int32_t dax, int32_t day) A
|
|||
void getzsofslopeptr(const usectortype *sec, int32_t dax, int32_t day,
|
||||
int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5)));
|
||||
|
||||
FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
static FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
return getceilzofslopeptr((usectortype *)§or[sectnum], dax, day);
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
static FORCE_INLINE int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
return getflorzofslopeptr((usectortype *)§or[sectnum], dax, day);
|
||||
}
|
||||
|
||||
FORCE_INLINE void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||
static FORCE_INLINE void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||
{
|
||||
getzsofslopeptr((usectortype *)§or[sectnum], dax, day, ceilz, florz);
|
||||
}
|
||||
|
||||
// Is <wal> a red wall in a safe fashion, i.e. only if consistency invariant
|
||||
// ".nextsector >= 0 iff .nextwall >= 0" holds.
|
||||
FORCE_INLINE int32_t redwallp(const uwalltype *wal)
|
||||
static FORCE_INLINE int32_t redwallp(const uwalltype *wal)
|
||||
{
|
||||
return (wal->nextwall >= 0 && wal->nextsector >= 0);
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t E_SpriteIsValid(const int32_t i)
|
||||
static FORCE_INLINE int32_t E_SpriteIsValid(const int32_t i)
|
||||
{
|
||||
return ((unsigned)i < MAXSPRITES && sprite[i].statnum != MAXSTATUS);
|
||||
}
|
||||
|
@ -1183,7 +1183,7 @@ int32_t setsprite(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2)));
|
|||
int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2)));
|
||||
|
||||
int32_t spriteheightofsptr(const uspritetype *spr, int32_t *height, int32_t alsotileyofs);
|
||||
FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs)
|
||||
static FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs)
|
||||
{
|
||||
return spriteheightofsptr((uspritetype *)&sprite[i], height, alsotileyofs);
|
||||
}
|
||||
|
@ -1321,7 +1321,7 @@ typedef struct
|
|||
EXTERN int32_t mdinited;
|
||||
EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES];
|
||||
|
||||
FORCE_INLINE int32_t md_tilehasmodel(int32_t tilenume,int32_t pal)
|
||||
static FORCE_INLINE int32_t md_tilehasmodel(int32_t tilenume,int32_t pal)
|
||||
{
|
||||
return mdinited ? tile2model[Ptile2tile(tilenume,pal)].modelid : -1;
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_
|
|||
# endif
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void push_nofog(void)
|
||||
static FORCE_INLINE void push_nofog(void)
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
if (getrendermode() >= REND_POLYMOST)
|
||||
|
@ -1364,7 +1364,7 @@ FORCE_INLINE void push_nofog(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
FORCE_INLINE void pop_nofog(void)
|
||||
static FORCE_INLINE void pop_nofog(void)
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
if (getrendermode() >= REND_POLYMOST && !nofog)
|
||||
|
|
|
@ -13,11 +13,11 @@ extern int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastok
|
|||
extern int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol);
|
||||
extern void getclosestcol_flush(void);
|
||||
|
||||
FORCE_INLINE int32_t getclosestcol(int32_t r, int32_t g, int32_t b)
|
||||
static FORCE_INLINE int32_t getclosestcol(int32_t r, int32_t g, int32_t b)
|
||||
{
|
||||
return getclosestcol_lim(r, g, b, 255);
|
||||
}
|
||||
FORCE_INLINE int32_t getclosestcol_nocache(int32_t r, int32_t g, int32_t b)
|
||||
static FORCE_INLINE int32_t getclosestcol_nocache(int32_t r, int32_t g, int32_t b)
|
||||
{
|
||||
return getclosestcol_nocache_lim(r, g, b, 255);
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@
|
|||
#endif
|
||||
|
||||
#ifndef FORCE_INLINE
|
||||
# ifdef _MSC_VER // Visual Studio
|
||||
# define FORCE_INLINE static __forceinline
|
||||
# ifdef _MSC_VER
|
||||
# define FORCE_INLINE __forceinline
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define FORCE_INLINE static inline __attribute__((always_inline))
|
||||
# define FORCE_INLINE inline __attribute__((always_inline))
|
||||
# else
|
||||
# define FORCE_INLINE static inline
|
||||
# define FORCE_INLINE inline
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
@ -515,13 +515,13 @@ typedef FILE BFILE;
|
|||
|
||||
#if defined BITNESS64 && (defined __SSE2__ || defined _MSC_VER)
|
||||
#include <emmintrin.h>
|
||||
FORCE_INLINE int32_t Blrintf(const float x)
|
||||
static FORCE_INLINE int32_t Blrintf(const float x)
|
||||
{
|
||||
__m128 xx = _mm_load_ss(&x);
|
||||
return _mm_cvtss_si32(xx);
|
||||
}
|
||||
#elif defined (_MSC_VER)
|
||||
FORCE_INLINE int32_t Blrintf(const float x)
|
||||
static FORCE_INLINE int32_t Blrintf(const float x)
|
||||
{
|
||||
int n;
|
||||
__asm fld x;
|
||||
|
@ -631,7 +631,7 @@ EDUKE32_STATIC_ASSERT(sizeof(vec3d_t) == sizeof(double) * 3);
|
|||
////////// Memory management //////////
|
||||
|
||||
#if !defined NO_ALIGNED_MALLOC
|
||||
FORCE_INLINE void *Baligned_alloc(const size_t alignment, const size_t size)
|
||||
static FORCE_INLINE void *Baligned_alloc(const size_t alignment, const size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void *ptr = _aligned_malloc(size, alignment);
|
||||
|
@ -673,10 +673,10 @@ FORCE_INLINE void *Baligned_alloc(const size_t alignment, const size_t size)
|
|||
////////// Data serialization //////////
|
||||
|
||||
#if defined B_USE_COMPAT_SWAP
|
||||
FORCE_INLINE uint16_t B_SWAP16(uint16_t s) { return (s >> 8) | (s << 8); }
|
||||
static FORCE_INLINE uint16_t B_SWAP16(uint16_t s) { return (s >> 8) | (s << 8); }
|
||||
|
||||
# if !defined NOASM && defined __i386__ && defined _MSC_VER
|
||||
FORCE_INLINE uint32_t B_SWAP32(uint32_t a)
|
||||
static FORCE_INLINE uint32_t B_SWAP32(uint32_t a)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
|
@ -685,19 +685,19 @@ FORCE_INLINE uint32_t B_SWAP32(uint32_t a)
|
|||
}
|
||||
}
|
||||
# elif !defined NOASM && defined __i386__ && defined __GNUC__
|
||||
FORCE_INLINE uint32_t B_SWAP32(uint32_t a)
|
||||
static FORCE_INLINE uint32_t B_SWAP32(uint32_t a)
|
||||
{
|
||||
__asm__ __volatile__("bswap %0" : "+r"(a) : : "cc");
|
||||
return a;
|
||||
}
|
||||
# else
|
||||
FORCE_INLINE uint32_t B_SWAP32(uint32_t l)
|
||||
static FORCE_INLINE uint32_t B_SWAP32(uint32_t l)
|
||||
{
|
||||
return ((l >> 8) & 0xff00) | ((l & 0xff00) << 8) | (l << 24) | (l >> 24);
|
||||
}
|
||||
# endif
|
||||
|
||||
FORCE_INLINE uint64_t B_SWAP64(uint64_t l)
|
||||
static FORCE_INLINE uint64_t B_SWAP64(uint64_t l)
|
||||
{
|
||||
return (l >> 56) | ((l >> 40) & 0xff00) | ((l >> 24) & 0xff0000) | ((l >> 8) & 0xff000000) |
|
||||
((l & 255) << 56) | ((l & 0xff00) << 40) | ((l & 0xff0000) << 24) | ((l & 0xff000000) << 8);
|
||||
|
@ -705,9 +705,9 @@ FORCE_INLINE uint64_t B_SWAP64(uint64_t l)
|
|||
#endif
|
||||
|
||||
// The purpose of these functions, as opposed to macros, is to prevent them from being used as lvalues.
|
||||
FORCE_INLINE uint16_t B_PASS16(uint16_t const x) { return x; }
|
||||
FORCE_INLINE uint32_t B_PASS32(uint32_t const x) { return x; }
|
||||
FORCE_INLINE uint64_t B_PASS64(uint64_t const x) { return x; }
|
||||
static FORCE_INLINE uint16_t B_PASS16(uint16_t const x) { return x; }
|
||||
static FORCE_INLINE uint32_t B_PASS32(uint32_t const x) { return x; }
|
||||
static FORCE_INLINE uint64_t B_PASS64(uint64_t const x) { return x; }
|
||||
|
||||
#if B_LITTLE_ENDIAN == 1
|
||||
# define B_LITTLE64(x) B_PASS64(x)
|
||||
|
@ -728,21 +728,21 @@ FORCE_INLINE uint64_t B_PASS64(uint64_t const x) { return x; }
|
|||
// TODO: Determine when, if ever, we should use the bit-shift-and-mask variants
|
||||
// due to alignment issues or performance gains.
|
||||
#if 1
|
||||
FORCE_INLINE void B_BUF16(void * const buf, uint16_t const x) { *(uint16_t *) buf = x; }
|
||||
FORCE_INLINE void B_BUF32(void * const buf, uint32_t const x) { *(uint32_t *) buf = x; }
|
||||
FORCE_INLINE void B_BUF64(void * const buf, uint64_t const x) { *(uint64_t *) buf = x; }
|
||||
static FORCE_INLINE void B_BUF16(void * const buf, uint16_t const x) { *(uint16_t *) buf = x; }
|
||||
static FORCE_INLINE void B_BUF32(void * const buf, uint32_t const x) { *(uint32_t *) buf = x; }
|
||||
static FORCE_INLINE void B_BUF64(void * const buf, uint64_t const x) { *(uint64_t *) buf = x; }
|
||||
|
||||
FORCE_INLINE uint16_t B_UNBUF16(void const * const buf) { return *(uint16_t const *) buf; }
|
||||
FORCE_INLINE uint32_t B_UNBUF32(void const * const buf) { return *(uint32_t const *) buf; }
|
||||
FORCE_INLINE uint64_t B_UNBUF64(void const * const buf) { return *(uint64_t const *) buf; }
|
||||
static FORCE_INLINE uint16_t B_UNBUF16(void const * const buf) { return *(uint16_t const *) buf; }
|
||||
static FORCE_INLINE uint32_t B_UNBUF32(void const * const buf) { return *(uint32_t const *) buf; }
|
||||
static FORCE_INLINE uint64_t B_UNBUF64(void const * const buf) { return *(uint64_t const *) buf; }
|
||||
#else
|
||||
FORCE_INLINE void B_BUF16(void * const vbuf, uint16_t const x)
|
||||
static FORCE_INLINE void B_BUF16(void * const vbuf, uint16_t const x)
|
||||
{
|
||||
uint8_t * const buf = (uint8_t *) vbuf;
|
||||
buf[0] = (x & 0x00FF);
|
||||
buf[1] = (x & 0xFF00) >> 8;
|
||||
}
|
||||
FORCE_INLINE void B_BUF32(void * const vbuf, uint32_t const x)
|
||||
static FORCE_INLINE void B_BUF32(void * const vbuf, uint32_t const x)
|
||||
{
|
||||
uint8_t * const buf = (uint8_t *) vbuf;
|
||||
buf[0] = (x & 0x000000FF);
|
||||
|
@ -752,7 +752,7 @@ FORCE_INLINE void B_BUF32(void * const vbuf, uint32_t const x)
|
|||
}
|
||||
# if 0
|
||||
// i686-apple-darwin11-llvm-gcc-4.2 complains "integer constant is too large for 'long' type"
|
||||
FORCE_INLINE void B_BUF64(void * const vbuf, uint64_t const x)
|
||||
static FORCE_INLINE void B_BUF64(void * const vbuf, uint64_t const x)
|
||||
{
|
||||
uint8_t * const buf = (uint8_t *) vbuf;
|
||||
buf[0] = (x & 0x00000000000000FF);
|
||||
|
@ -766,17 +766,17 @@ FORCE_INLINE void B_BUF64(void * const vbuf, uint64_t const x)
|
|||
}
|
||||
# endif
|
||||
|
||||
FORCE_INLINE uint16_t B_UNBUF16(void const * const vbuf)
|
||||
static FORCE_INLINE uint16_t B_UNBUF16(void const * const vbuf)
|
||||
{
|
||||
uint8_t const * const buf = (uint8_t const *) vbuf;
|
||||
return (buf[1] << 8) | (buf[0]);
|
||||
}
|
||||
FORCE_INLINE uint32_t B_UNBUF32(void const * const vbuf)
|
||||
static FORCE_INLINE uint32_t B_UNBUF32(void const * const vbuf)
|
||||
{
|
||||
uint8_t const * const buf = (uint8_t const *) vbuf;
|
||||
return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | (buf[0]);
|
||||
}
|
||||
FORCE_INLINE uint64_t B_UNBUF64(void const * const vbuf)
|
||||
static FORCE_INLINE uint64_t B_UNBUF64(void const * const vbuf)
|
||||
{
|
||||
uint8_t const * const buf = (uint8_t const *) vbuf;
|
||||
return ((uint64_t)buf[7] << 56) | ((uint64_t)buf[6] << 48) | ((uint64_t)buf[5] << 40) |
|
||||
|
@ -794,7 +794,7 @@ FORCE_INLINE uint64_t B_UNBUF64(void const * const vbuf)
|
|||
# define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define CLAMP_DECL FORCE_INLINE WARN_UNUSED_RESULT
|
||||
#define CLAMP_DECL static FORCE_INLINE WARN_UNUSED_RESULT
|
||||
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
|
||||
CLAMP_DECL int32_t clamp(int32_t in, int32_t min, int32_t max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
CLAMP_DECL float fclamp(float in, float min, float max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
|
@ -806,13 +806,13 @@ CLAMP_DECL float fclamp2(float in, float min, float max) { return in >= max ? ma
|
|||
////////// Utility functions //////////
|
||||
|
||||
#if RAND_MAX == 32767
|
||||
FORCE_INLINE uint16_t system_15bit_rand(void) { return (uint16_t)rand(); }
|
||||
static FORCE_INLINE uint16_t system_15bit_rand(void) { return (uint16_t)rand(); }
|
||||
#else // RAND_MAX > 32767, assumed to be of the form 2^k - 1
|
||||
FORCE_INLINE uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7fff; }
|
||||
static FORCE_INLINE uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7fff; }
|
||||
#endif
|
||||
|
||||
// Copy min(strlen(src)+1, n) characters into dst, always terminate with a NUL.
|
||||
FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n)
|
||||
static FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n)
|
||||
{
|
||||
Bstrncpy(dst, src, n);
|
||||
dst[n-1] = 0;
|
||||
|
@ -901,28 +901,28 @@ extern void xalloc_set_location(int32_t line, const char *file, const char *func
|
|||
void set_memerr_handler(void (*handlerfunc)(int32_t, const char *, const char *));
|
||||
void handle_memerr(void);
|
||||
|
||||
FORCE_INLINE char *xstrdup(const char *s)
|
||||
static FORCE_INLINE char *xstrdup(const char *s)
|
||||
{
|
||||
char *ptr = Bstrdup(s);
|
||||
if (ptr == NULL) handle_memerr();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
FORCE_INLINE void *xmalloc(const bsize_t size)
|
||||
static FORCE_INLINE void *xmalloc(const bsize_t size)
|
||||
{
|
||||
void *ptr = Bmalloc(size);
|
||||
if (ptr == NULL) handle_memerr();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
FORCE_INLINE void *xcalloc(const bsize_t nmemb, const bsize_t size)
|
||||
static FORCE_INLINE void *xcalloc(const bsize_t nmemb, const bsize_t size)
|
||||
{
|
||||
void *ptr = Bcalloc(nmemb, size);
|
||||
if (ptr == NULL) handle_memerr();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
|
||||
static FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
|
||||
{
|
||||
void *newptr = Brealloc(ptr, size);
|
||||
|
||||
|
@ -937,7 +937,7 @@ FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
|
|||
}
|
||||
|
||||
#if !defined NO_ALIGNED_MALLOC
|
||||
FORCE_INLINE void *xaligned_alloc(const bsize_t alignment, const bsize_t size)
|
||||
static FORCE_INLINE void *xaligned_alloc(const bsize_t alignment, const bsize_t size)
|
||||
{
|
||||
void *ptr = Baligned_alloc(alignment, size);
|
||||
if (ptr == NULL) handle_memerr();
|
||||
|
|
|
@ -450,9 +450,9 @@ enum SaveBoardFlags
|
|||
|
||||
#define M32_MAXPALOOKUPS (MAXPALOOKUPS-RESERVEDPALS-1)
|
||||
|
||||
FORCE_INLINE int32_t atoi_safe(const char *str) { return (int32_t)Bstrtol(str, NULL, 10); }
|
||||
static FORCE_INLINE int32_t atoi_safe(const char *str) { return (int32_t)Bstrtol(str, NULL, 10); }
|
||||
|
||||
FORCE_INLINE void inpclamp(int32_t *x, int32_t mi, int32_t ma)
|
||||
static FORCE_INLINE void inpclamp(int32_t *x, int32_t mi, int32_t ma)
|
||||
{
|
||||
if (*x > ma) *x = ma;
|
||||
if (*x < mi) *x = mi;
|
||||
|
|
|
@ -66,7 +66,7 @@ extern int16_t globalpicnum;
|
|||
extern int32_t globalpal;
|
||||
|
||||
// Compare with polymer_eligible_for_artmap()
|
||||
FORCE_INLINE int32_t eligible_for_tileshades(int32_t const picnum, int32_t const pal)
|
||||
static FORCE_INLINE int32_t eligible_for_tileshades(int32_t const picnum, int32_t const pal)
|
||||
{
|
||||
return !usehightile || !hicfindsubst(picnum, pal);
|
||||
}
|
||||
|
@ -89,29 +89,29 @@ static inline float getshadefactor(int32_t const shade)
|
|||
|
||||
#define POLYMOST_CHOOSE_FOG_PAL(fogpal, pal) \
|
||||
((fogpal) ? (fogpal) : (pal))
|
||||
FORCE_INLINE int32_t get_floor_fogpal(usectortype const * const sec)
|
||||
static FORCE_INLINE int32_t get_floor_fogpal(usectortype const * const sec)
|
||||
{
|
||||
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->floorpal);
|
||||
}
|
||||
FORCE_INLINE int32_t get_ceiling_fogpal(usectortype const * const sec)
|
||||
static FORCE_INLINE int32_t get_ceiling_fogpal(usectortype const * const sec)
|
||||
{
|
||||
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal);
|
||||
}
|
||||
FORCE_INLINE int32_t fogpal_shade(usectortype const * const sec, int32_t const shade)
|
||||
static FORCE_INLINE int32_t fogpal_shade(usectortype const * const sec, int32_t const shade)
|
||||
{
|
||||
// When fogging is due to sector[].fogpal, don't make the fog parameters
|
||||
// depend on the shade of the object.
|
||||
return sec->fogpal ? 0 : shade;
|
||||
}
|
||||
|
||||
FORCE_INLINE int check_nonpow2(int32_t const x)
|
||||
static FORCE_INLINE int check_nonpow2(int32_t const x)
|
||||
{
|
||||
return (x > 1 && (x&(x-1)));
|
||||
}
|
||||
|
||||
// Are we using the mode that uploads non-power-of-two wall textures like they
|
||||
// render in classic?
|
||||
FORCE_INLINE int polymost_is_npotmode(void)
|
||||
static FORCE_INLINE int polymost_is_npotmode(void)
|
||||
{
|
||||
// The glinfo.texnpot check is so we don't have to deal with that case in
|
||||
// gloadtile_art().
|
||||
|
@ -191,7 +191,7 @@ EDUKE32_STATIC_ASSERT(TO_DAMETH_NOTEXCOMPRESS(HICR_NOTEXCOMPRESS) == DAMETH_NOTE
|
|||
EDUKE32_STATIC_ASSERT(TO_DAMETH_ARTIMMUNITY(HICR_ARTIMMUNITY) == DAMETH_ARTIMMUNITY);
|
||||
|
||||
// Do we want a NPOT-y-as-classic texture for this <dameth> and <ysiz>?
|
||||
FORCE_INLINE int polymost_want_npotytex(int32_t dameth, int32_t ysiz)
|
||||
static FORCE_INLINE int polymost_want_npotytex(int32_t dameth, int32_t ysiz)
|
||||
{
|
||||
return getrendermode() != REND_POLYMER && // r_npotwallmode NYI in Polymer
|
||||
polymost_is_npotmode() && (dameth&DAMETH_WALL) && check_nonpow2(ysiz);
|
||||
|
|
|
@ -85,7 +85,7 @@ skip:
|
|||
return libdivide_s32_do(n, dptr);
|
||||
}
|
||||
#else
|
||||
FORCE_INLINE uint32_t divideu32(uint32_t n, uint32_t d) { return n / d; }
|
||||
static FORCE_INLINE uint32_t divideu32(uint32_t n, uint32_t d) { return n / d; }
|
||||
|
||||
static inline int32_t tabledivide64(int64_t n, int32_t d)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx)
|
|||
#endif
|
||||
|
||||
#define EDUKE32_SCALER_PRAGMA(a) \
|
||||
FORCE_INLINE int32_t divscale##a(int32_t eax, int32_t ebx) { return divscale(eax, ebx, a); }
|
||||
static FORCE_INLINE int32_t divscale##a(int32_t eax, int32_t ebx) { return divscale(eax, ebx, a); }
|
||||
EDUKE32_GENERATE_PRAGMAS EDUKE32_SCALER_PRAGMA(32)
|
||||
#undef EDUKE32_SCALER_PRAGMA
|
||||
|
||||
|
@ -123,14 +123,14 @@ static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx)
|
|||
return dw(tabledivide64(numer, ecx));
|
||||
}
|
||||
|
||||
FORCE_INLINE void swapptr(void *a, void *b)
|
||||
static FORCE_INLINE void swapptr(void *a, void *b)
|
||||
{
|
||||
intptr_t const t = *(intptr_t*) a;
|
||||
*(intptr_t*) a = *(intptr_t*) b;
|
||||
*(intptr_t*) b = t;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t sqr(int32_t a) { return a * a; }
|
||||
static FORCE_INLINE int32_t sqr(int32_t a) { return a * a; }
|
||||
|
||||
#if defined(__GNUC__) && defined(GEKKO)
|
||||
|
||||
|
@ -161,12 +161,12 @@ FORCE_INLINE int32_t sqr(int32_t a) { return a * a; }
|
|||
#ifndef pragmas_have_mulscale
|
||||
|
||||
#define EDUKE32_SCALER_PRAGMA(a) \
|
||||
FORCE_INLINE int32_t mulscale##a(int32_t eax, int32_t edx) { return dw((qw(eax) * edx) >> by(a)); } \
|
||||
FORCE_INLINE int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \
|
||||
static FORCE_INLINE int32_t mulscale##a(int32_t eax, int32_t edx) { return dw((qw(eax) * edx) >> by(a)); } \
|
||||
static FORCE_INLINE int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \
|
||||
{ \
|
||||
return dw(((qw(eax) * edx) + (qw(esi) * edi)) >> by(a)); \
|
||||
} \
|
||||
FORCE_INLINE int32_t tmulscale##a(int32_t eax, int32_t edx, int32_t ebx, int32_t ecx, int32_t esi, int32_t edi) \
|
||||
static FORCE_INLINE int32_t tmulscale##a(int32_t eax, int32_t edx, int32_t ebx, int32_t ecx, int32_t esi, int32_t edi) \
|
||||
{ \
|
||||
return dw(((qw(eax) * edx) + (qw(ebx) * ecx) + (qw(esi) * edi)) >> by(a)); \
|
||||
} \
|
||||
|
@ -178,42 +178,42 @@ EDUKE32_GENERATE_PRAGMAS EDUKE32_SCALER_PRAGMA(32)
|
|||
#endif
|
||||
|
||||
#ifndef pragmas_have_swaps
|
||||
FORCE_INLINE void swapchar(void *a, void *b)
|
||||
static FORCE_INLINE void swapchar(void *a, void *b)
|
||||
{
|
||||
char const t = *(char *)b;
|
||||
*(char *)b = *(char *)a;
|
||||
*(char *)a = t;
|
||||
}
|
||||
FORCE_INLINE void swapchar2(void *a, void *b, int32_t s)
|
||||
static FORCE_INLINE void swapchar2(void *a, void *b, int32_t s)
|
||||
{
|
||||
swapchar(a, b);
|
||||
swapchar((char *)a + 1, (char *)b + s);
|
||||
}
|
||||
FORCE_INLINE void swapshort(void *a, void *b)
|
||||
static FORCE_INLINE void swapshort(void *a, void *b)
|
||||
{
|
||||
int16_t const t = *(int16_t *)b;
|
||||
*(int16_t *)b = *(int16_t *)a;
|
||||
*(int16_t *)a = t;
|
||||
}
|
||||
FORCE_INLINE void swaplong(void *a, void *b)
|
||||
static FORCE_INLINE void swaplong(void *a, void *b)
|
||||
{
|
||||
int32_t const t = *(int32_t *)b;
|
||||
*(int32_t *)b = *(int32_t *)a;
|
||||
*(int32_t *)a = t;
|
||||
}
|
||||
FORCE_INLINE void swapfloat(void *a, void *b)
|
||||
static FORCE_INLINE void swapfloat(void *a, void *b)
|
||||
{
|
||||
float const t = *(float *)b;
|
||||
*(float *)b = *(float *)a;
|
||||
*(float *)a = t;
|
||||
}
|
||||
FORCE_INLINE void swapdouble(void *a, void *b)
|
||||
static FORCE_INLINE void swapdouble(void *a, void *b)
|
||||
{
|
||||
double const t = *(double *)b;
|
||||
*(double *)b = *(double *)a;
|
||||
*(double *)a = t;
|
||||
}
|
||||
FORCE_INLINE void swap64bit(void *a, void *b)
|
||||
static FORCE_INLINE void swap64bit(void *a, void *b)
|
||||
{
|
||||
uint64_t const t = *(uint64_t *)b;
|
||||
*(uint64_t *)b = *(uint64_t *)a;
|
||||
|
@ -221,23 +221,23 @@ FORCE_INLINE void swap64bit(void *a, void *b)
|
|||
}
|
||||
#endif
|
||||
|
||||
FORCE_INLINE char readpixel(void *s) { return *(char *)s; }
|
||||
FORCE_INLINE void drawpixel(void *s, char a) { *(char *)s = a; }
|
||||
static FORCE_INLINE char readpixel(void *s) { return *(char *)s; }
|
||||
static FORCE_INLINE void drawpixel(void *s, char a) { *(char *)s = a; }
|
||||
|
||||
#ifndef pragmas_have_klabs
|
||||
FORCE_INLINE int32_t klabs(int32_t a)
|
||||
static FORCE_INLINE int32_t klabs(int32_t a)
|
||||
{
|
||||
const uint32_t m = a >> (sizeof(uint32_t) * CHAR_BIT - 1);
|
||||
return (a ^ m) - m;
|
||||
}
|
||||
#endif
|
||||
#ifndef pragmas_have_ksgn
|
||||
FORCE_INLINE int32_t ksgn(int32_t a) { return (a > 0) - (a < 0); }
|
||||
static FORCE_INLINE int32_t ksgn(int32_t a) { return (a > 0) - (a < 0); }
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_mulscale
|
||||
FORCE_INLINE int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * edx) >> by(ecx)); }
|
||||
FORCE_INLINE int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx)
|
||||
static FORCE_INLINE int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * edx) >> by(ecx)); }
|
||||
static FORCE_INLINE int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx)
|
||||
{
|
||||
return dw(((qw(eax) * edx) + (qw(esi) * edi)) >> by(ecx));
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col)
|
|||
return 1;
|
||||
}
|
||||
|
||||
FORCE_INLINE void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
|
||||
static FORCE_INLINE void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
|
||||
{
|
||||
drawline16(halfxdim16+x1, midydim16+y1, halfxdim16+x2, midydim16+y2, col);
|
||||
}
|
||||
|
|
|
@ -739,7 +739,7 @@ static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2,
|
|||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE void clipmove_tweak_pos(const vec3_t *pos, int32_t gx, int32_t gy, int32_t x1, int32_t y1, int32_t x2,
|
||||
static FORCE_INLINE void clipmove_tweak_pos(const vec3_t *pos, int32_t gx, int32_t gy, int32_t x1, int32_t y1, int32_t x2,
|
||||
int32_t y2, int32_t *daxptr, int32_t *dayptr)
|
||||
{
|
||||
int32_t daz;
|
||||
|
|
|
@ -327,7 +327,7 @@ uint8_t yax_gotsector[MAXSECTORS>>3]; // engine internal
|
|||
int16_t yax_bunchnum[MAXSECTORS][2];
|
||||
int16_t yax_nextwall[MAXWALLS][2];
|
||||
|
||||
FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf)
|
||||
static FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf)
|
||||
{
|
||||
return !!(wall[line].cstat&(YAX_NEXTWALLBIT(cf)));
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ int16_t yax_getbunch(int16_t i, int16_t cf)
|
|||
# define YAX_BUNCHNUM(Sect, Cf) YAX_PTRBUNCHNUM(sector, Sect, Cf)
|
||||
|
||||
# if !defined NEW_MAP_FORMAT
|
||||
FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf)
|
||||
static FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf)
|
||||
{
|
||||
return (yax_getnextwall(line, cf) >= 0);
|
||||
}
|
||||
|
@ -2353,17 +2353,17 @@ static inline void wallmosts_finish(int16_t *mostbuf, int32_t z1, int32_t z2,
|
|||
typedef int64_t zint_t;
|
||||
|
||||
// For drawvox()
|
||||
FORCE_INLINE zint_t mulscale16z(int32_t a, int32_t d)
|
||||
static FORCE_INLINE zint_t mulscale16z(int32_t a, int32_t d)
|
||||
{
|
||||
return ((zint_t)a * d)>>16;
|
||||
}
|
||||
|
||||
FORCE_INLINE zint_t mulscale20z(int32_t a, int32_t d)
|
||||
static FORCE_INLINE zint_t mulscale20z(int32_t a, int32_t d)
|
||||
{
|
||||
return ((zint_t)a * d)>>20;
|
||||
}
|
||||
|
||||
FORCE_INLINE zint_t dmulscale24z(int32_t a, int32_t d, int32_t S, int32_t D)
|
||||
static FORCE_INLINE zint_t dmulscale24z(int32_t a, int32_t d, int32_t S, int32_t D)
|
||||
{
|
||||
return (((zint_t)a * d) + ((zint_t)S * D)) >> 24;
|
||||
}
|
||||
|
@ -4740,7 +4740,7 @@ static size_t falpha_to_blend(float alpha, int32_t *cstatptr, uint8_t *blendptr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t mulscale_triple30(int32_t a, int32_t b, int32_t c)
|
||||
static FORCE_INLINE int32_t mulscale_triple30(int32_t a, int32_t b, int32_t c)
|
||||
{
|
||||
return ((int64_t)a * b * c)>>30;
|
||||
}
|
||||
|
@ -8934,7 +8934,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
|
||||
//////////////////// LOADING AND SAVING ROUTINES ////////////////////
|
||||
|
||||
FORCE_INLINE int32_t have_maptext(void)
|
||||
static FORCE_INLINE int32_t have_maptext(void)
|
||||
{
|
||||
return (mapversion >= 10);
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ int32_t animateoffs(int const tilenum);
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)
|
||||
static FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)
|
||||
{
|
||||
// NOTE: tspr->owner >= MAXSPRITES (could be model) has to be handled by
|
||||
// caller.
|
||||
|
@ -280,12 +280,12 @@ FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)
|
|||
//
|
||||
// getpalookup (internal)
|
||||
//
|
||||
FORCE_INLINE int32_t getpalookup(int32_t davis, int32_t dashade)
|
||||
static FORCE_INLINE int32_t getpalookup(int32_t davis, int32_t dashade)
|
||||
{
|
||||
return min(max(dashade + (davis >> 8), 0), numshades - 1);
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(davis, globalshade) << 8; }
|
||||
static FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(davis, globalshade) << 8; }
|
||||
|
||||
void dorotspr_handle_bit2(int32_t *sx, int32_t *sy, int32_t *z, int32_t dastat,
|
||||
int32_t cx1_plus_cx2, int32_t cy1_plus_cy2,
|
||||
|
@ -303,7 +303,7 @@ extern int32_t yax_globalcf, yax_nomaskpass, yax_nomaskdidit;
|
|||
extern uint8_t haveymost[YAX_MAXBUNCHES>>3];
|
||||
extern uint8_t yax_gotsector[MAXSECTORS>>3];
|
||||
|
||||
FORCE_INLINE int32_t yax_isislandwall(int32_t line, int32_t cf) { return (yax_vnextsec(line, cf) >= 0); }
|
||||
static FORCE_INLINE int32_t yax_isislandwall(int32_t line, int32_t cf) { return (yax_vnextsec(line, cf) >= 0); }
|
||||
#endif
|
||||
|
||||
#ifdef YAX_DEBUG
|
||||
|
@ -362,7 +362,7 @@ skipit:
|
|||
|
||||
#else // __GNUC__ && __i386__
|
||||
|
||||
FORCE_INLINE void setgotpic(int32_t tilenume)
|
||||
static FORCE_INLINE void setgotpic(int32_t tilenume)
|
||||
{
|
||||
if (walock[tilenume] < 200) walock[tilenume] = 199;
|
||||
gotpic[tilenume>>3] |= pow2char[tilenume&7];
|
||||
|
@ -372,7 +372,7 @@ FORCE_INLINE void setgotpic(int32_t tilenume)
|
|||
|
||||
// Get properties of parallaxed sky to draw.
|
||||
// Returns: pointer to tile offset array. Sets-by-pointer the other three.
|
||||
FORCE_INLINE const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, int32_t *dapskybits, int32_t *dapyoffs)
|
||||
static FORCE_INLINE const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, int32_t *dapskybits, int32_t *dapyoffs)
|
||||
{
|
||||
psky_t const * const psky = &multipsky[getpskyidx(picnum)];
|
||||
|
||||
|
@ -386,7 +386,7 @@ FORCE_INLINE const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, int32_t *
|
|||
return psky->tileofs;
|
||||
}
|
||||
|
||||
FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t const z)
|
||||
static FORCE_INLINE void set_globalpos(int32_t const x, int32_t const y, int32_t const z)
|
||||
{
|
||||
globalposx = x, fglobalposx = (float)x;
|
||||
globalposy = y, fglobalposy = (float)y;
|
||||
|
|
|
@ -362,7 +362,7 @@ static inline int32_t isolid(int32_t x, int32_t y, int32_t z)
|
|||
return vbit[z>>5] & (1<<SHIFTMOD32(z));
|
||||
}
|
||||
|
||||
FORCE_INLINE int isair(int32_t i)
|
||||
static FORCE_INLINE int isair(int32_t i)
|
||||
{
|
||||
return !(vbit[i>>5] & (1<<SHIFTMOD32(i)));
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void G_ClearCameraView(DukePlayer_t *ps)
|
|||
}
|
||||
|
||||
// Manhattan distance between wall-point and sprite.
|
||||
FORCE_INLINE int32_t G_WallSpriteDist(uwalltype const * const wal, uspritetype const * const spr)
|
||||
static FORCE_INLINE int32_t G_WallSpriteDist(uwalltype const * const wal, uspritetype const * const spr)
|
||||
{
|
||||
return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
|
|||
}
|
||||
|
||||
// stupid name, but it's what the function does.
|
||||
FORCE_INLINE int G_FindExplosionInSector(int sectnum)
|
||||
static FORCE_INLINE int G_FindExplosionInSector(int sectnum)
|
||||
{
|
||||
for (bssize_t SPRITES_OF(STAT_MISC, i))
|
||||
if (PN(i) == EXPLOSION2 && sectnum == SECT(i))
|
||||
|
@ -1004,7 +1004,7 @@ FORCE_INLINE int G_FindExplosionInSector(int sectnum)
|
|||
return -1;
|
||||
}
|
||||
|
||||
FORCE_INLINE void P_Nudge(int playerNum, int spriteNum, int shiftLeft)
|
||||
static FORCE_INLINE void P_Nudge(int playerNum, int spriteNum, int shiftLeft)
|
||||
{
|
||||
g_player[playerNum].ps->vel.x += actor[spriteNum].extra * (sintable[(actor[spriteNum].ang + 512) & 2047]) << shiftLeft;
|
||||
g_player[playerNum].ps->vel.y += actor[spriteNum].extra * (sintable[actor[spriteNum].ang & 2047]) << shiftLeft;
|
||||
|
|
|
@ -347,8 +347,8 @@ void G_StopInterpolation(int32_t *const posptr);
|
|||
|
||||
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
|
||||
void Sect_ToggleInterpolation(int sectnum, int doset);
|
||||
FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
||||
FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
||||
static FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
|
||||
static FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
|
||||
|
||||
#ifdef LUNATIC
|
||||
int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset);
|
||||
|
|
|
@ -134,7 +134,7 @@ intptr_t apScriptEvents[MAXGAMEEVENTS];
|
|||
|
||||
// May recurse, e.g. through EVENT_XXX -> ... -> EVENT_KILLIT
|
||||
#ifdef LUNATIC
|
||||
FORCE_INLINE int32_t VM_EventCommon_(int eventNum, int spriteNum, int playerNum, int playerDist, int32_t returnValue)
|
||||
static FORCE_INLINE int32_t VM_EventCommon_(int eventNum, int spriteNum, int playerNum, int playerDist, int32_t returnValue)
|
||||
{
|
||||
const double t = gethiticks();
|
||||
int32_t ret = El_CallEvent(&g_ElState, eventNum, spriteNum, playerNum, playerDist, &returnValue);
|
||||
|
@ -150,7 +150,7 @@ FORCE_INLINE int32_t VM_EventCommon_(int eventNum, int spriteNum, int playerNum,
|
|||
return returnValue;
|
||||
}
|
||||
#else
|
||||
FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const spriteNum, int const playerNum,
|
||||
static FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const spriteNum, int const playerNum,
|
||||
int const playerDist, int32_t returnValue)
|
||||
{
|
||||
// this is initialized first thing because spriteNum, playerNum, lDist, etc are already right there on the stack
|
||||
|
|
|
@ -71,7 +71,7 @@ int32_t VM_OnEventWithReturn_(int nEventID, int spriteNum, int playerNum, int32_
|
|||
int32_t VM_OnEventWithDist_(int nEventID, int spriteNum, int playerNum, int nDist);
|
||||
int32_t VM_OnEvent_(int nEventID, int spriteNum, int playerNum);
|
||||
|
||||
FORCE_INLINE int VM_HaveEvent(int nEventID)
|
||||
static FORCE_INLINE int VM_HaveEvent(int nEventID)
|
||||
{
|
||||
#ifdef LUNATIC
|
||||
return L_IsInitialized(&g_ElState) && El_HaveEvent(nEventID);
|
||||
|
@ -80,22 +80,22 @@ FORCE_INLINE int VM_HaveEvent(int nEventID)
|
|||
#endif
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t VM_OnEventWithBoth(int nEventID, int spriteNum, int playerNum, int nDist, int32_t nReturn)
|
||||
static FORCE_INLINE int32_t VM_OnEventWithBoth(int nEventID, int spriteNum, int playerNum, int nDist, int32_t nReturn)
|
||||
{
|
||||
return VM_HaveEvent(nEventID) ? VM_OnEventWithBoth_(nEventID, spriteNum, playerNum, nDist, nReturn) : nReturn;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t VM_OnEventWithReturn(int nEventID, int spriteNum, int playerNum, int nReturn)
|
||||
static FORCE_INLINE int32_t VM_OnEventWithReturn(int nEventID, int spriteNum, int playerNum, int nReturn)
|
||||
{
|
||||
return VM_HaveEvent(nEventID) ? VM_OnEventWithReturn_(nEventID, spriteNum, playerNum, nReturn) : nReturn;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t VM_OnEventWithDist(int nEventID, int spriteNum, int playerNum, int nDist)
|
||||
static FORCE_INLINE int32_t VM_OnEventWithDist(int nEventID, int spriteNum, int playerNum, int nDist)
|
||||
{
|
||||
return VM_HaveEvent(nEventID) ? VM_OnEventWithDist_(nEventID, spriteNum, playerNum, nDist) : 0;
|
||||
}
|
||||
|
||||
FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNum)
|
||||
static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNum)
|
||||
{
|
||||
return VM_HaveEvent(nEventID) ? VM_OnEvent_(nEventID, spriteNum, playerNum) : 0;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ int Gv_GetVarByLabel(const char *szGameLabel,int const lDefault,int const sprite
|
|||
int32_t Gv_NewArray(const char *pszLabel,void *arrayptr,intptr_t asize,uint32_t dwFlags);
|
||||
int32_t Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags);
|
||||
|
||||
FORCE_INLINE void A_ResetVars(int const spriteNum)
|
||||
static FORCE_INLINE void A_ResetVars(int const spriteNum)
|
||||
{
|
||||
for (bssize_t i = 0; i < g_gameVarCount; ++i)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ void Gv_FinalizeWeaponDefaults(void);
|
|||
|
||||
#if !defined LUNATIC
|
||||
#define VM_GAMEVAR_OPERATOR(func, operator) \
|
||||
FORCE_INLINE void __fastcall func(int const id, int32_t const operand) \
|
||||
static FORCE_INLINE void __fastcall func(int const id, int32_t const operand) \
|
||||
{ \
|
||||
switch (aGameVars[id].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) \
|
||||
{ \
|
||||
|
@ -160,7 +160,7 @@ void Gv_FinalizeWeaponDefaults(void);
|
|||
}
|
||||
|
||||
#if defined(__arm__) || defined(LIBDIVIDE_ALWAYS)
|
||||
FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const operand)
|
||||
static FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const operand)
|
||||
{
|
||||
if (EDUKE32_PREDICT_FALSE((aGameVars[id].flags & GAMEVAR_PERPLAYER && (unsigned) vm.playerNum > MAXPLAYERS - 1) ||
|
||||
(aGameVars[id].flags & GAMEVAR_PERACTOR && (unsigned) vm.spriteNum > MAXSPRITES - 1)))
|
||||
|
|
|
@ -47,7 +47,7 @@ extern int32_t voting;
|
|||
|
||||
#define USERMAPENTRYLENGTH 25
|
||||
|
||||
FORCE_INLINE void WithSDL2_StartTextInput()
|
||||
static FORCE_INLINE void WithSDL2_StartTextInput()
|
||||
{
|
||||
#if defined EDUKE32_TOUCH_DEVICES && defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
|
||||
# if defined __ANDROID__
|
||||
|
@ -58,7 +58,7 @@ FORCE_INLINE void WithSDL2_StartTextInput()
|
|||
#endif
|
||||
}
|
||||
|
||||
FORCE_INLINE void WithSDL2_StopTextInput()
|
||||
static FORCE_INLINE void WithSDL2_StopTextInput()
|
||||
{
|
||||
#if defined EDUKE32_TOUCH_DEVICES && defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
|
||||
# if defined __ANDROID__
|
||||
|
@ -3780,7 +3780,7 @@ static void Menu_ShadePal(const MenuFont_t *font, uint8_t status, int32_t *s, in
|
|||
*p = (status & MT_Disabled) ? font->pal_disabled : font->pal;
|
||||
}
|
||||
|
||||
FORCE_INLINE void rotatesprite_ybounds(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, int32_t ydim_upper, int32_t ydim_lower)
|
||||
static FORCE_INLINE void rotatesprite_ybounds(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, int32_t ydim_upper, int32_t ydim_lower)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0, ydim_upper, xdim-1, ydim_lower);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ extern int32_t althud_numberpal;
|
|||
extern int32_t althud_numbertile;
|
||||
extern int32_t althud_shadows;
|
||||
|
||||
FORCE_INLINE int32_t sbarsc(int32_t sc)
|
||||
static FORCE_INLINE int32_t sbarsc(int32_t sc)
|
||||
{
|
||||
return scale(sc, ud.statusbarscale, 100);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue