From e25a197f3ea009b57768590c94c6fd849b65669e Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 18 Apr 2019 17:25:38 +0000 Subject: [PATCH] Piddly fart bullshit changes that don't really do anything git-svn-id: https://svn.eduke32.com/eduke32@7606 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 17 +++++++---------- source/duke3d/src/gameexec.cpp | 11 +---------- source/duke3d/src/gameexec.h | 18 ++++++++++++------ source/duke3d/src/sector.h | 27 +++++++++++---------------- 4 files changed, 31 insertions(+), 42 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 852a07a1d..a7ad9c3cb 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -84,7 +84,7 @@ int32_t g_loadedMapVersion = -1; // -1: none (e.g. started new) static int32_t get_mapversion(void); // Handle nonpow2-ysize walls the old way? -static inline int32_t oldnonpow2(void) +static FORCE_INLINE int32_t oldnonpow2(void) { #if !defined CLASSIC_NONPOW2_YSIZE_WALLS return 1; @@ -1549,14 +1549,10 @@ int32_t renderAddTsprite(int16_t z, int16_t sectnum) return 0; } -static inline vec2_t get_rel_coords(int32_t const x, int32_t const y) +static FORCE_INLINE vec2_t get_rel_coords(int32_t const x, int32_t const y) { - vec2_t const p = { - dmulscale6(y,cosglobalang, -x,singlobalang), - dmulscale6(x,cosviewingrangeglobalang, y,sinviewingrangeglobalang) - }; - - return p; + return { dmulscale6(y, cosglobalang, -x, singlobalang), + dmulscale6(x, cosviewingrangeglobalang, y, sinviewingrangeglobalang) }; } // Note: the returned y coordinates are not actually screen coordinates, but @@ -1632,12 +1628,13 @@ static int get_screen_coords(const vec2_t &p1, const vec2_t &p2, return 1; } -int lastUnusedTile = MAXUSERTILES-1; static inline int findUnusedTile(void) { + static int lastUnusedTile = MAXUSERTILES-1; + for (; lastUnusedTile >= 0; --lastUnusedTile) - if (tilesiz[lastUnusedTile].x * tilesiz[lastUnusedTile].y == 0) + if ((tilesiz[lastUnusedTile].x|tilesiz[lastUnusedTile].y) == 0) return lastUnusedTile; return -1; diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index e651d4a3d..827ddbc5f 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -6973,7 +6973,7 @@ int32_t VM_CheckSquished2(int32_t i, int32_t snum) #endif // MYOS* CON commands. -LUNATIC_EXTERN void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) +void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) { orientation &= (ROTATESPRITE_MAX-1); @@ -6997,11 +6997,6 @@ void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t o VM_DrawTileGeneric(x, y, 65536, tilenum, shade, orientation, tilePal); } -void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) -{ - VM_DrawTileGeneric(x, y, 65536, tilenum, shade, orientation, p); -} - void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation) { DukePlayer_t *const pPlayer = g_player[screenpeek].ps; @@ -7010,8 +7005,4 @@ void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int3 VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, tilePal); } -void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) -{ - VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, p); -} #endif diff --git a/source/duke3d/src/gameexec.h b/source/duke3d/src/gameexec.h index 357e65ece..5c188adcb 100644 --- a/source/duke3d/src/gameexec.h +++ b/source/duke3d/src/gameexec.h @@ -65,14 +65,20 @@ int __fastcall G_GetAngleDelta(int currAngle, int newAngle); void G_RestoreMapState(); void G_SaveMapState(); -#if !defined LUNATIC -void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation); -void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p); -void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p); -void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation); -#else void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p); + +#if !defined LUNATIC +void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation); +static inline void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) +{ + VM_DrawTileGeneric(x, y, 65536, tilenum, shade, orientation, p); +} +static inline void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) +{ + VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, p); +} +void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation); #endif int32_t VM_OnEvent__(int nEventID, int spriteNum, int playerNum); diff --git a/source/duke3d/src/sector.h b/source/duke3d/src/sector.h index 3f4e412bc..44b5d29f4 100644 --- a/source/duke3d/src/sector.h +++ b/source/duke3d/src/sector.h @@ -151,29 +151,25 @@ int SetAnimation(int sectNum,int32_t *animPtr,int goalVal,int animVel); #define FORCEFIELD_CSTAT (64+16+4+1) // Returns W_FORCEFIELD if wall has a forcefield overpicnum, its overpicnum else. -static inline int G_GetForcefieldPicnum(int wallNum) +static FORCE_INLINE int G_GetForcefieldPicnum(int const wallNum) { - int tileNum = wall[wallNum].overpicnum; - if (tileNum == W_FORCEFIELD + 1) - tileNum = W_FORCEFIELD; - return tileNum; + int const tileNum = wall[wallNum].overpicnum; + return tileNum == W_FORCEFIELD + 1 ? W_FORCEFIELD : tileNum; } // Returns the interpolated position of the camera that the player is looking // through (using a viewscreen). should be the player's ->newowner member. -static inline vec3_t G_GetCameraPosition(int32_t i, int32_t smoothratio) +static inline vec3_t G_GetCameraPosition(int32_t const i, int32_t const smoothratio) { - const spritetype *const cs = &sprite[i]; + auto const cs = (uspriteptr_t)&sprite[i]; const actor_t *const ca = &actor[i]; - vec3_t cam = { ca->bpos.x + mulscale16(cs->x - ca->bpos.x, smoothratio), - ca->bpos.y + mulscale16(cs->y - ca->bpos.y, smoothratio), - ca->bpos.z + mulscale16(cs->z - ca->bpos.z, smoothratio) - }; - return cam; + return { ca->bpos.x + mulscale16(cs->x - ca->bpos.x, smoothratio), + ca->bpos.y + mulscale16(cs->y - ca->bpos.y, smoothratio), + ca->bpos.z + mulscale16(cs->z - ca->bpos.z, smoothratio) }; } -EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect); +EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t const sect); #ifdef __cplusplus } @@ -181,10 +177,9 @@ EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect); #if defined sector_c_ || !defined DISABLE_INLINING -EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t sect) +EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t const sect) { - int32_t i; - for (TRAVERSE_CONNECT(i)) + for (int TRAVERSE_CONNECT(i)) if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect) return i; return -1;