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
This commit is contained in:
hendricks266 2016-01-08 01:33:35 +00:00
parent 28a9372a79
commit 3a8d53573c
19 changed files with 125 additions and 364 deletions

View file

@ -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=

View file

@ -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.

View file

@ -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 \

View file

@ -155,7 +155,6 @@
<ClInclude Include="platform\Android\Duke3d\jni\TouchControls\TouchJoy.h" />
<ClInclude Include="platform\Android\Duke3d\jni\TouchControls\WheelSelect.h" />
<ClInclude Include="source\actors.h" />
<ClInclude Include="source\actors_inline.h" />
<ClInclude Include="source\android.h" />
<ClInclude Include="source\android\in_android.h" />
<ClInclude Include="source\anim.h" />
@ -165,7 +164,6 @@
<ClInclude Include="source\demo.h" />
<ClInclude Include="source\events_defs.h" />
<ClInclude Include="source\game.h" />
<ClInclude Include="source\game_inline.h" />
<ClInclude Include="source\gameexec.h" />
<ClInclude Include="source\gamevars.h" />
<ClInclude Include="source\global.h" />
@ -181,7 +179,6 @@
<ClInclude Include="source\quotes.h" />
<ClInclude Include="source\savegame.h" />
<ClInclude Include="source\sector.h" />
<ClInclude Include="source\sector_inline.h" />
<ClInclude Include="source\_functio.h" />
<ClInclude Include="source\_rts.h" />
<ClInclude Include="source\config.h" />
@ -284,7 +281,6 @@
<ClCompile Include="platform\Android\Duke3d\jni\TouchControls\TouchJoy.cpp" />
<ClCompile Include="platform\Android\Duke3d\jni\TouchControls\WheelSelect.cpp" />
<ClCompile Include="source\actors.c" />
<ClCompile Include="source\actors_inline.c" />
<ClCompile Include="source\android\android-jni.cpp" />
<ClCompile Include="source\android\in_android.c" />
<ClCompile Include="source\anim.c" />
@ -296,7 +292,6 @@
<ClCompile Include="source\demo.c" />
<ClCompile Include="source\enet\src\compress.c" />
<ClCompile Include="source\game.c" />
<ClCompile Include="source\game_inline.c" />
<ClCompile Include="source\gamedef.c" />
<ClCompile Include="source\gameexec.c" />
<ClCompile Include="source\gamestructures.c" />
@ -329,7 +324,6 @@
<ClCompile Include="source\savegame.c" />
<ClCompile Include="source\sdlmusic.c" />
<ClCompile Include="source\sector.c" />
<ClCompile Include="source\sector_inline.c" />
<ClCompile Include="source\sounds.c" />
<ClCompile Include="source\sounds_mapster32.c" />
<ClCompile Include="source\soundsdyn.c" />

View file

@ -390,18 +390,9 @@
<ClInclude Include="source\animvpx.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\actors_inline.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\common_game.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\game_inline.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\sector_inline.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="build\include\winbits.h">
<Filter>build\headers</Filter>
</ClInclude>
@ -797,15 +788,6 @@
<ClCompile Include="source\enet\src\compress.c">
<Filter>enet\source</Filter>
</ClCompile>
<ClCompile Include="source\actors_inline.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\game_inline.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\sector_inline.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\common.c">
<Filter>eduke32\source</Filter>
</ClCompile>

View file

@ -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 */,

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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