From 3a8d53573cb07eeecf4821ece8ae08b9fd1b57ee Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 8 Jan 2016 01:33:35 +0000 Subject: [PATCH] Remove actors_inline, game_inline, and sector_inline objects, and move their code into other headers, set up to be compiled into well-fitting objects if inlining them is disabled. git-svn-id: https://svn.eduke32.com/eduke32@5529 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile | 4 - polymer/eduke32/Makefile.common | 4 - polymer/eduke32/Makefile.msvc | 3 - polymer/eduke32/eduke32.vcxproj | 6 -- polymer/eduke32/eduke32.vcxproj.filters | 18 ---- .../Apple/EDuke32.xcodeproj/project.pbxproj | 12 --- polymer/eduke32/source/actors.c | 2 + polymer/eduke32/source/actors.h | 62 +++++++++++++- polymer/eduke32/source/actors_inline.c | 83 ------------------- polymer/eduke32/source/actors_inline.h | 59 ------------- polymer/eduke32/source/game.c | 2 + polymer/eduke32/source/game.h | 24 +++++- polymer/eduke32/source/game_inline.c | 46 ---------- polymer/eduke32/source/game_inline.h | 42 ---------- polymer/eduke32/source/global.h | 22 +++++ polymer/eduke32/source/sector.c | 2 + polymer/eduke32/source/sector.h | 15 +++- polymer/eduke32/source/sector_inline.c | 43 ---------- polymer/eduke32/source/sector_inline.h | 40 --------- 19 files changed, 125 insertions(+), 364 deletions(-) delete mode 100644 polymer/eduke32/source/actors_inline.c delete mode 100644 polymer/eduke32/source/actors_inline.h delete mode 100644 polymer/eduke32/source/game_inline.c delete mode 100644 polymer/eduke32/source/game_inline.h delete mode 100644 polymer/eduke32/source/sector_inline.c delete mode 100644 polymer/eduke32/source/sector_inline.h diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index f1db3d746..a1fe5ec07 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -237,10 +237,6 @@ ifneq ($(USE_LIBVPX),0) DUKE3D_OBJS+= animvpx endif -ifneq (0,$(DISABLEINLINING)) - DUKE3D_OBJS+= game_inline actors_inline sector_inline -endif - DUKE3D_MISCDEPS= DUKE3D_EDITOR_MISCDEPS= diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index e879c5bf5..d01bd0c93 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -561,10 +561,6 @@ ifeq ($(PLATFORM),WINDOWS) endif ifneq ($(LUNATIC),0) - # FIXME: Lunatic doesn't build with inlining because of wacky include - # chains! - override DISABLEINLINING=1 - ifneq ($(CPLUSPLUS),0) # FIXME: Lunatic C++ doesn't build because otherwise it doesn't find # INT32_MIN and the like. diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 5a28d2720..476eae4db 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -191,9 +191,7 @@ MACT_OBJS=$(DUKE3D_OBJ)\file_lib.$o \ $(DUKE3D_OBJ)\scriplib.$o DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \ - $(DUKE3D_OBJ)\game_inline.$o \ $(DUKE3D_OBJ)\actors.$o \ - $(DUKE3D_OBJ)\actors_inline.$o \ $(DUKE3D_OBJ)\anim.$o \ $(DUKE3D_OBJ)\animsounds.$o \ $(DUKE3D_OBJ)\animvpx.$o \ @@ -211,7 +209,6 @@ DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \ $(DUKE3D_OBJ)\premap.$o \ $(DUKE3D_OBJ)\savegame.$o \ $(DUKE3D_OBJ)\sector.$o \ - $(DUKE3D_OBJ)\sector_inline.$o \ $(DUKE3D_OBJ)\rev.$o \ $(DUKE3D_OBJ)\rts.$o \ $(DUKE3D_OBJ)\config.$o \ diff --git a/polymer/eduke32/eduke32.vcxproj b/polymer/eduke32/eduke32.vcxproj index 432a35b56..8e8755496 100644 --- a/polymer/eduke32/eduke32.vcxproj +++ b/polymer/eduke32/eduke32.vcxproj @@ -155,7 +155,6 @@ - @@ -165,7 +164,6 @@ - @@ -181,7 +179,6 @@ - @@ -284,7 +281,6 @@ - @@ -296,7 +292,6 @@ - @@ -329,7 +324,6 @@ - diff --git a/polymer/eduke32/eduke32.vcxproj.filters b/polymer/eduke32/eduke32.vcxproj.filters index a5cfbaf53..4f102dde5 100644 --- a/polymer/eduke32/eduke32.vcxproj.filters +++ b/polymer/eduke32/eduke32.vcxproj.filters @@ -390,18 +390,9 @@ eduke32\headers - - eduke32\headers - eduke32\headers - - eduke32\headers - - - eduke32\headers - build\headers @@ -797,15 +788,6 @@ enet\source - - eduke32\source - - - eduke32\source - - - eduke32\source - eduke32\source diff --git a/polymer/eduke32/platform/Apple/EDuke32.xcodeproj/project.pbxproj b/polymer/eduke32/platform/Apple/EDuke32.xcodeproj/project.pbxproj index 17df1f412..4c1aeea8f 100644 --- a/polymer/eduke32/platform/Apple/EDuke32.xcodeproj/project.pbxproj +++ b/polymer/eduke32/platform/Apple/EDuke32.xcodeproj/project.pbxproj @@ -636,8 +636,6 @@ 0008E99919F1AD9B0091588D /* _functio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _functio.h; path = ../../source/_functio.h; sourceTree = SOURCE_ROOT; }; 0008E99A19F1AD9B0091588D /* _midi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _midi.h; path = ../../source/_midi.h; sourceTree = SOURCE_ROOT; }; 0008E99B19F1AD9B0091588D /* _rts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _rts.h; path = ../../source/_rts.h; sourceTree = SOURCE_ROOT; }; - 0008E99C19F1AD9B0091588D /* actors_inline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = actors_inline.c; path = ../../source/actors_inline.c; sourceTree = SOURCE_ROOT; }; - 0008E99D19F1AD9B0091588D /* actors_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actors_inline.h; path = ../../source/actors_inline.h; sourceTree = SOURCE_ROOT; }; 0008E99E19F1AD9B0091588D /* actors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = actors.c; path = ../../source/actors.c; sourceTree = SOURCE_ROOT; }; 0008E99F19F1AD9B0091588D /* actors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actors.h; path = ../../source/actors.h; sourceTree = SOURCE_ROOT; }; 0008E9A019F1AD9B0091588D /* anim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = anim.c; path = ../../source/anim.c; sourceTree = SOURCE_ROOT; }; @@ -650,8 +648,6 @@ 0008E9A719F1AD9B0091588D /* demo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = demo.h; path = ../../source/demo.h; sourceTree = SOURCE_ROOT; }; 0008E9A819F1AD9B0091588D /* duke3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = duke3d.h; path = ../../source/duke3d.h; sourceTree = SOURCE_ROOT; }; 0008E9A919F1AD9B0091588D /* function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = function.h; path = ../../source/function.h; sourceTree = SOURCE_ROOT; }; - 0008E9AA19F1AD9B0091588D /* game_inline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = game_inline.c; path = ../../source/game_inline.c; sourceTree = SOURCE_ROOT; }; - 0008E9AB19F1AD9B0091588D /* game_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = game_inline.h; path = ../../source/game_inline.h; sourceTree = SOURCE_ROOT; }; 0008E9AC19F1AD9B0091588D /* game.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = game.c; path = ../../source/game.c; sourceTree = SOURCE_ROOT; }; 0008E9AD19F1AD9B0091588D /* game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = game.h; path = ../../source/game.h; sourceTree = SOURCE_ROOT; }; 0008E9AE19F1AD9B0091588D /* gamedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gamedef.c; path = ../../source/gamedef.c; sourceTree = SOURCE_ROOT; }; @@ -696,8 +692,6 @@ 0008E9D519F1AD9B0091588D /* savegame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = savegame.c; path = ../../source/savegame.c; sourceTree = SOURCE_ROOT; }; 0008E9D619F1AD9B0091588D /* savegame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = savegame.h; path = ../../source/savegame.h; sourceTree = SOURCE_ROOT; }; 0008E9D719F1AD9B0091588D /* sdlmusic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sdlmusic.c; path = ../../source/sdlmusic.c; sourceTree = SOURCE_ROOT; }; - 0008E9D819F1AD9B0091588D /* sector_inline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sector_inline.c; path = ../../source/sector_inline.c; sourceTree = SOURCE_ROOT; }; - 0008E9D919F1AD9B0091588D /* sector_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sector_inline.h; path = ../../source/sector_inline.h; sourceTree = SOURCE_ROOT; }; 0008E9DA19F1AD9B0091588D /* sector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sector.c; path = ../../source/sector.c; sourceTree = SOURCE_ROOT; }; 0008E9DB19F1AD9B0091588D /* sector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sector.h; path = ../../source/sector.h; sourceTree = SOURCE_ROOT; }; 0008E9DC19F1AD9B0091588D /* soundefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = soundefs.h; path = ../../source/soundefs.h; sourceTree = SOURCE_ROOT; }; @@ -1045,8 +1039,6 @@ 0008E99919F1AD9B0091588D /* _functio.h */, 0008E99A19F1AD9B0091588D /* _midi.h */, 0008E99B19F1AD9B0091588D /* _rts.h */, - 0008E99C19F1AD9B0091588D /* actors_inline.c */, - 0008E99D19F1AD9B0091588D /* actors_inline.h */, 0008E99E19F1AD9B0091588D /* actors.c */, 0008E99F19F1AD9B0091588D /* actors.h */, 0008E9A019F1AD9B0091588D /* anim.c */, @@ -1061,8 +1053,6 @@ 0008E9A719F1AD9B0091588D /* demo.h */, 0008E9A819F1AD9B0091588D /* duke3d.h */, 0008E9A919F1AD9B0091588D /* function.h */, - 0008E9AA19F1AD9B0091588D /* game_inline.c */, - 0008E9AB19F1AD9B0091588D /* game_inline.h */, 0008E9AC19F1AD9B0091588D /* game.c */, 0008E9AD19F1AD9B0091588D /* game.h */, 0008E9AE19F1AD9B0091588D /* gamedef.c */, @@ -1107,8 +1097,6 @@ 0008E9D519F1AD9B0091588D /* savegame.c */, 0008E9D619F1AD9B0091588D /* savegame.h */, 0008E9D719F1AD9B0091588D /* sdlmusic.c */, - 0008E9D819F1AD9B0091588D /* sector_inline.c */, - 0008E9D919F1AD9B0091588D /* sector_inline.h */, 0008E9DA19F1AD9B0091588D /* sector.c */, 0008E9DB19F1AD9B0091588D /* sector.h */, 0008E9DC19F1AD9B0091588D /* soundefs.h */, diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 2e2cb63da..98fae78e6 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +#define actors_c_ + #include "duke3d.h" #include "actors.h" #include "gamedef.h" diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 4a3c45c0c..12e6d07fe 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -328,10 +328,70 @@ FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolatio int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset); #endif +#if KRANDDEBUG +# define ACTOR_INLINE __fastcall +# define ACTOR_INLINE_HEADER extern __fastcall +#else +# define ACTOR_INLINE EXTERN_INLINE +# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER +#endif + +extern int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist); +ACTOR_INLINE_HEADER int A_CheckEnemyTile(int32_t pn); +ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype); +ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype); + +EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); +EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); + +EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(const spritetype *s); + #ifdef __cplusplus } #endif -#include "actors_inline.h" +#if defined actors_c_ || !defined DISABLE_INLINING + +# if !KRANDDEBUG || (KRANDDEBUG && defined actors_c_) + +ACTOR_INLINE int A_CheckEnemyTile(int32_t pn) +{ + return ((g_tile[pn].flags & (SFLAG_HARDCODED_BADGUY | SFLAG_BADGUY)) != 0); +} + +ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) +{ + vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, + (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, + sprite[i].zvel + }; + return (A_MoveSprite(i,&davect,cliptype)==0); +} + +ACTOR_INLINE int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) +{ + return A_MoveSpriteClipdist(spritenum, change, cliptype, -1); +} + +# endif + +EXTERN_INLINE int32_t G_CheckForSpaceCeiling(int32_t sectnum) +{ + return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && + (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)); +} + +EXTERN_INLINE int32_t G_CheckForSpaceFloor(int32_t sectnum) +{ + return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && + (sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1)); +} + +EXTERN_INLINE int32_t A_CheckEnemySprite(const spritetype *s) +{ + return A_CheckEnemyTile(s->picnum); +} + +#endif #endif diff --git a/polymer/eduke32/source/actors_inline.c b/polymer/eduke32/source/actors_inline.c deleted file mode 100644 index 8cc11c2c2..000000000 --- a/polymer/eduke32/source/actors_inline.c +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef actors_inline_c_ -#define actors_inline_c_ - -#include "compat.h" -#include "build.h" -#include "global.h" -#include "duke3d.h" -#include "actors_inline.h" - -ACTOR_INLINE int A_CheckEnemyTile(int32_t pn) -{ - return ((g_tile[pn].flags & (SFLAG_HARDCODED_BADGUY | SFLAG_BADGUY)) != 0); -} - -ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) -{ - vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, - (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, - sprite[i].zvel - }; - return (A_MoveSprite(i,&davect,cliptype)==0); -} - -ACTOR_INLINE int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) -{ - return A_MoveSpriteClipdist(spritenum, change, cliptype, -1); -} - -EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings -{ - for (int i=g_numInterpolations-1; i>=0; i--) oldipos[i] = *curipos[i]; -} - -EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen -{ - int32_t i=g_numInterpolations-1; - - if (--g_interpolationLock) - return; - - for (; i>=0; i--) *curipos[i] = bakipos[i]; -} - -EXTERN_INLINE int32_t G_CheckForSpaceCeiling(int32_t sectnum) -{ - return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && - (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)); -} - -EXTERN_INLINE int32_t G_CheckForSpaceFloor(int32_t sectnum) -{ - return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && - (sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1)); -} - -EXTERN_INLINE int32_t A_CheckEnemySprite(const spritetype *s) -{ - return A_CheckEnemyTile(s->picnum); -} - -#endif diff --git a/polymer/eduke32/source/actors_inline.h b/polymer/eduke32/source/actors_inline.h deleted file mode 100644 index 52063e7cb..000000000 --- a/polymer/eduke32/source/actors_inline.h +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef actors_inline_h_ -#define actors_inline_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#if KRANDDEBUG -# define ACTOR_INLINE __fastcall -# define ACTOR_INLINE_HEADER extern __fastcall -#else -# define ACTOR_INLINE EXTERN_INLINE -# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER -#endif - -extern int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist); -ACTOR_INLINE_HEADER int A_CheckEnemyTile(int32_t pn); -ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype); -ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype); - -EXTERN_INLINE_HEADER void G_UpdateInterpolations(void); -EXTERN_INLINE_HEADER void G_RestoreInterpolations(void); - -EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); -EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); - -EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(const spritetype *s); - -#ifdef __cplusplus -} -#endif - -#ifndef DISABLE_INLINING -#include "actors_inline.c" -#endif - -#endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 2e4d3320f..39f08b3f3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +#define game_c_ + #include "duke3d.h" #include "baselayer.h" diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 8fc8685ae..eb2dbbc53 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -589,8 +589,6 @@ enum CheatCodeFunctions ) >= ((int32_t)size)-1 \ ) -#include "game_inline.h" - static inline void G_NewGame_EnterLevel(void) { G_NewGame(ud.m_volume_number, ud.m_level_number, ud.m_player_skill); @@ -640,8 +638,30 @@ void G_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p); #endif +EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc); + +EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue); + #ifdef __cplusplus } #endif +#if defined game_c_ || !defined DISABLE_INLINING + +EXTERN_INLINE void G_SetStatusBarScale(int32_t sc) +{ + ud.statusbarscale = clamp(sc, 36, 100); + G_UpdateScreenArea(); +} + +// the point of this is to prevent re-running a function or calculation passed to potentialValue +// without making a new variable under each individual circumstance +EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) +{ + if (potentialValue > *variable) + *variable = potentialValue; +} + +#endif + #endif diff --git a/polymer/eduke32/source/game_inline.c b/polymer/eduke32/source/game_inline.c deleted file mode 100644 index 65300535e..000000000 --- a/polymer/eduke32/source/game_inline.c +++ /dev/null @@ -1,46 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef game_inline_c_ -#define game_inline_c_ - -#include "compat.h" -#include "duke3d.h" -#include "premap.h" -#include "game.h" -#include "game_inline.h" - -EXTERN_INLINE void G_SetStatusBarScale(int32_t sc) -{ - ud.statusbarscale = clamp(sc, 36, 100); - G_UpdateScreenArea(); -} - -// the point of this is to prevent re-running a function or calculation passed to potentialValue -// without making a new variable under each individual circumstance -EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) -{ - if (potentialValue > *variable) - *variable = potentialValue; -} - -#endif diff --git a/polymer/eduke32/source/game_inline.h b/polymer/eduke32/source/game_inline.h deleted file mode 100644 index deef34f7b..000000000 --- a/polymer/eduke32/source/game_inline.h +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef game_inline_h_ -#define game_inline_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc); - -EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue); - -#ifdef __cplusplus -} -#endif - -#ifndef DISABLE_INLINING -#include "game_inline.c" -#endif - -#endif diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 500750590..b7cf6cb3b 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -183,8 +183,30 @@ enum // EF_HIDEFROMMP = 1<<1, }; +EXTERN_INLINE_HEADER void G_UpdateInterpolations(void); +EXTERN_INLINE_HEADER void G_RestoreInterpolations(void); + #ifdef __cplusplus } #endif +#if defined global_c_ || !defined DISABLE_INLINING + +EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings +{ + for (int i=g_numInterpolations-1; i>=0; i--) oldipos[i] = *curipos[i]; +} + +EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen +{ + int32_t i=g_numInterpolations-1; + + if (--g_interpolationLock) + return; + + for (; i>=0; i--) *curipos[i] = bakipos[i]; +} + +#endif + #endif diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 8a949efa9..5f8304984 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +#define sector_c_ + #include "duke3d.h" #include "sector.h" #include "gamedef.h" diff --git a/polymer/eduke32/source/sector.h b/polymer/eduke32/source/sector.h index 3ce541615..1dd2e8ea0 100644 --- a/polymer/eduke32/source/sector.h +++ b/polymer/eduke32/source/sector.h @@ -161,10 +161,23 @@ static inline vec3_t G_GetCameraPosition(int32_t i, int32_t smoothratio) return cam; } +EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect); + #ifdef __cplusplus } #endif -#include "sector_inline.h" +#if defined sector_c_ || !defined DISABLE_INLINING + +EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t sect) +{ + int32_t i; + for (TRAVERSE_CONNECT(i)) + if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect) + return i; + return -1; +} + +#endif #endif diff --git a/polymer/eduke32/source/sector_inline.c b/polymer/eduke32/source/sector_inline.c deleted file mode 100644 index 5c337d132..000000000 --- a/polymer/eduke32/source/sector_inline.c +++ /dev/null @@ -1,43 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef sector_inline_c_ -#define sector_inline_c_ - -#include "compat.h" -#include "build.h" -#include "global.h" -#include "duke3d.h" -#include "macros.h" -#include "player.h" -#include "sector_inline.h" - -EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t sect) -{ - int32_t i; - for (TRAVERSE_CONNECT(i)) - if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect) - return i; - return -1; -} - -#endif diff --git a/polymer/eduke32/source/sector_inline.h b/polymer/eduke32/source/sector_inline.h deleted file mode 100644 index ef447892a..000000000 --- a/polymer/eduke32/source/sector_inline.h +++ /dev/null @@ -1,40 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef sector_inline_h_ -#define sector_inline_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect); - -#ifdef __cplusplus -} -#endif - -#ifndef DISABLE_INLINING -#include "sector_inline.c" -#endif - -#endif