diff --git a/src/blua/lvm.c b/src/blua/lvm.c
index a921d443773b90a83bc741f6b0b54646f85f6a1a..b654613f422550956782923e5a348b21acf1a821 100644
--- a/src/blua/lvm.c
+++ b/src/blua/lvm.c
@@ -732,7 +732,8 @@ void luaV_execute (lua_State *L, int nexeccalls) {
           luaG_runerror(L, LUA_QL("for") " limit must be a number");
         else if (!tonumber(pstep, ra+2))
           luaG_runerror(L, LUA_QL("for") " step must be a number");
-        setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
+        if (ra && pstep)
+          setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
         dojump(L, pc, GETARG_sBx(i));
         continue;
       }
diff --git a/src/command.c b/src/command.c
index 84d777acf30c8056f6b63676296867dbf158856d..a15471c8304ee5b0b3cc084aa64aa7dc7e1f9925 100644
--- a/src/command.c
+++ b/src/command.c
@@ -966,9 +966,11 @@ void CV_RegisterVar(consvar_t *variable)
 	// check net variables
 	if (variable->flags & CV_NETVAR)
 	{
+		const consvar_t *netvar;
 		variable->netid = CV_ComputeNetid(variable->name);
-		if (CV_FindNetVar(variable->netid))
-			I_Error("Variables %s and %s have same netid\n", variable->name, CV_FindNetVar(variable->netid)->name);
+		netvar = CV_FindNetVar(variable->netid);
+		if (netvar)
+			I_Error("Variables %s and %s have same netid\n", variable->name, netvar->name);
 	}
 
 	// link the variable in
diff --git a/src/d_main.h b/src/d_main.h
index 88387a579955a4f0456a1ac789c119d35ec7bfea..6dc273b1558d8ac6329a15100946dc889095eebf 100644
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -41,7 +41,7 @@ void D_SRB2Main(void);
 // Called by IO functions when input is detected.
 void D_PostEvent(const event_t *ev);
 #ifndef DOXYGEN
-void D_PostEvent_end(void);    // delimiter for locking memory
+FUNCMATH void D_PostEvent_end(void);    // delimiter for locking memory
 #endif
 
 void D_ProcessEvents(void);
diff --git a/src/dehacked.c b/src/dehacked.c
index 199ea43ca89160879676a05f2325806d2301ab07..e798d8f1077f6f10aae5af24cfd871a1bca47175 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -6717,12 +6717,14 @@ static const char *const MOBJEFLAG_LIST[] = {
 	NULL
 };
 
+#ifdef HAVE_BLUA
 static const char *const MAPTHINGFLAG_LIST[4] = {
 	NULL,
 	"OBJECTFLIP", // Reverse gravity flag for objects.
 	"OBJECTSPECIAL", // Special flag used with certain objects.
 	"AMBUSH" // Deaf monsters/do not react to sound.
 };
+#endif
 
 static const char *const PLAYERFLAG_LIST[] = {
 	// Flip camera angle with gravity flip prefrence.
@@ -6795,6 +6797,7 @@ static const char *const PLAYERFLAG_LIST[] = {
 	NULL // stop loop here.
 };
 
+#ifdef HAVE_BLUA
 // Linedef flags
 static const char *const ML_LIST[16] = {
 	"IMPASSIBLE",
@@ -6814,6 +6817,7 @@ static const char *const ML_LIST[16] = {
 	"BOUNCY",
 	"TFERLINE"
 };
+#endif
 
 // This DOES differ from r_draw's Color_Names, unfortunately.
 // Also includes Super colors
@@ -7762,7 +7766,7 @@ fixed_t get_number(const char *word)
 #endif
 }
 
-void DEH_Check(void)
+void FUNCMATH DEH_Check(void)
 {
 #if defined(_DEBUG) || defined(PARANOIA)
 	const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
diff --git a/src/f_finale.h b/src/f_finale.h
index 8ee02bdf3d6687d774baaac7f1139b84ec999115..1f23643bec2bd52a91cd3477ded284eb2a842484 100644
--- a/src/f_finale.h
+++ b/src/f_finale.h
@@ -35,7 +35,7 @@ void F_CutsceneTicker(void);
 void F_TitleDemoTicker(void);
 
 // Called by main loop.
-void F_GameEndDrawer(void);
+FUNCMATH void F_GameEndDrawer(void);
 void F_IntroDrawer(void);
 void F_TitleScreenDrawer(void);
 
diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h
index d9620be0299ae8e133f01ecb48e50660bb608a7b..6b9f4d538860d29a61967ccd7e2c538d65fecdaa 100644
--- a/src/hardware/hw_dll.h
+++ b/src/hardware/hw_dll.h
@@ -54,7 +54,7 @@
  #endif
 #endif
 
-typedef void (*I_Error_t) (const char *error, ...);
+typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
 
 // ==========================================================================
 //                                                                      MATHS
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 35a01ffd11ed25d0d7943ddd37a95e82238fd132..ca4e000bb6f2f3d490271a2570b149b1df1a3380 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -4529,7 +4529,8 @@ static void HWR_SortVisSprites(void)
 	// Fix first and last. ds still points to the last one after the loop
 	dsfirst->prev = &unsorted;
 	unsorted.next = dsfirst;
-	ds->next = &unsorted;
+	if (ds)
+		ds->next = &unsorted;
 	unsorted.prev = ds;
 
 	// pull the vissprites out by scale
@@ -4552,10 +4553,13 @@ static void HWR_SortVisSprites(void)
 				best = ds;
 			}
 		}
-		best->next->prev = best->prev;
-		best->prev->next = best->next;
-		best->next = &gr_vsprsortedhead;
-		best->prev = gr_vsprsortedhead.prev;
+		if (best)
+		{
+			best->next->prev = best->prev;
+			best->prev->next = best->next;
+			best->next = &gr_vsprsortedhead;
+			best->prev = gr_vsprsortedhead.prev;
+		}
 		gr_vsprsortedhead.prev->next = best;
 		gr_vsprsortedhead.prev = best;
 	}
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index 1a81fe796251a5a40ef213e30bb4b01a8f3a205f..54dd9485439db543f69f846480ef3719ea32ad88 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -1836,10 +1836,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
 	}
 }
 
-// -----------------+
-// HWRAPI DrawMD2   : Draw an MD2 model with glcommands
-// -----------------+
-EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
+static inline void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
 {
 	INT32     val, count, pindex;
 	GLfloat s, t;
@@ -1931,7 +1928,7 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
 	//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
 
 	// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
-	if (color[3] < 255)
+	if (color && color[3] < 255)
 	{
 		pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
 		pglDepthMask(GL_FALSE);
@@ -2007,11 +2004,20 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
 	pglDisable(GL_CULL_FACE);
 }
 
+// -----------------+
+// HWRAPI DrawMD2   : Draw an MD2 model with glcommands
+// -----------------+
+EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
+{
+	DrawMD2Ex(gl_cmd_buffer, frame, duration, tics,  nextframe, pos, scale, flipped, color);
+}
+
 EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale)
 {
-	DrawMD2i(gl_cmd_buffer, frame, 0, 0,  NULL, pos, scale, false, NULL);
+	DrawMD2Ex(gl_cmd_buffer, frame, 0, 0,  NULL, pos, scale, false, NULL);
 }
 
+
 // -----------------+
 // SetTransform     :
 // -----------------+
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index f0dd400960251a40eed43a916db11e879ba6457c..7b22f33f189b5a602ca043862b21ca2e8cc0d678 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -87,7 +87,7 @@ void HU_Init(void);
 void HU_LoadGraphics(void);
 
 // reset heads up when consoleplayer respawns.
-void HU_Start(void);
+FUNCMATH void HU_Start(void);
 
 boolean HU_Responder(event_t *ev);
 
diff --git a/src/p_inter.c b/src/p_inter.c
index 884b22ad3973c5c4bd0f089a187e1fa2d60c9644..cf5512a185a610a20e8dab4644fb30567e8d8edc 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -3626,7 +3626,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
 	// Flag text
 	{
 		char plname[MAXPLAYERNAME+4];
-		char *flagtext;
+		const char *flagtext;
 		char flagcolor;
 
 		snprintf(plname, sizeof(plname), "%s%s%s",
diff --git a/src/p_local.h b/src/p_local.h
index c8930aeda6ce50a8ba07fbcedd8f063a1fa3eed0..972e26e799408b173d80f0e97d7211ca30952e1c 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -251,7 +251,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
 #endif
 void P_ColorTeamMissile(mobj_t *missile, player_t *source);
 SINT8 P_MobjFlip(mobj_t *mobj);
-boolean P_WeaponOrPanel(mobjtype_t type);
+FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
 
 boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled);
 
diff --git a/src/p_mobj.h b/src/p_mobj.h
index 9542ce8ba1e26fc3bad29d3970f165c88dc1aa9b..79cffae894651ef5a0d31f1583b24d748f8f8b14 100644
--- a/src/p_mobj.h
+++ b/src/p_mobj.h
@@ -441,7 +441,7 @@ boolean P_SupermanLook4Players(mobj_t *actor);
 void P_DestroyRobots(void);
 void P_SnowThinker(precipmobj_t *mobj);
 void P_RainThinker(precipmobj_t *mobj);
-void P_NullPrecipThinker(precipmobj_t *mobj);
+FUNCMATH void P_NullPrecipThinker(precipmobj_t *mobj);
 void P_RemovePrecipMobj(precipmobj_t *mobj);
 void P_SetScale(mobj_t *mobj, fixed_t newscale);
 void P_XYMovement(mobj_t *mo);
diff --git a/src/r_plane.h b/src/r_plane.h
index 8730bcefd9e530cf99bfbe83b93895fb7026de11..ec19407162a0e7bcdec3fd153aaef974ed1524b5 100644
--- a/src/r_plane.h
+++ b/src/r_plane.h
@@ -87,7 +87,7 @@ extern lighttable_t **planezlight;
 extern fixed_t *yslope;
 extern fixed_t distscale[MAXVIDWIDTH];
 
-void R_InitPlanes(void);
+FUNCMATH void R_InitPlanes(void);
 void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
 void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
 void R_ClearPlanes(void);
diff --git a/src/r_splats.h b/src/r_splats.h
index 349d8fa7a4653cbb65874ca87950451f18ac9bbb..c0ba6881c7b384126796a30b9a9c8b5526419844 100644
--- a/src/r_splats.h
+++ b/src/r_splats.h
@@ -63,7 +63,11 @@ typedef struct floorsplat_s
 fixed_t P_SegLength(seg_t *seg);
 
 // call at P_SetupLevel()
+#if !(defined (WALLSPLATS) || defined (FLOORSPLATS))
+FUNCMATH void R_ClearLevelSplats(void);
+#else
 void R_ClearLevelSplats(void);
+#endif
 
 #ifdef WALLSPLATS
 void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, fixed_t top,
diff --git a/src/r_things.c b/src/r_things.c
index eaab536137177b46388bf9ed56c51c24a8f4a00a..76251d880abfb428b54c70625767950941d9839e 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1634,7 +1634,8 @@ void R_SortVisSprites(void)
 	// Fix first and last. ds still points to the last one after the loop
 	dsfirst->prev = &unsorted;
 	unsorted.next = dsfirst;
-	ds->next = &unsorted;
+	if (ds)
+		ds->next = &unsorted;
 	unsorted.prev = ds;
 
 	// pull the vissprites out by scale
diff --git a/src/s_sound.h b/src/s_sound.h
index bcc7979a1fe8527306ffa0b38ffea70b8db0b985..39ec769a68b6aa13ac4056e26c4edec3c8af59fb 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -119,7 +119,7 @@ void S_ResumeAudio(void);
 //
 void S_UpdateSounds(void);
 
-fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
+FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
 
 void S_SetDigMusicVolume(INT32 volume);
 void S_SetMIDIMusicVolume(INT32 volume);
diff --git a/src/screen.c b/src/screen.c
index 3834f72d5cd783f66c1f4cb4fcd9fc9530b88de4..376586c5d9c509c16d897ae01bc2a6410c722a1c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -69,6 +69,13 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N
 consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
 #endif
 consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+#ifdef DIRECTFULLSCREEN
+static FUNCMATH void SCR_ChangeFullscreen (void);
+#else
+static void SCR_ChangeFullscreen (void);
+#endif
+
 consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
 
 // =========================================================================
diff --git a/src/screen.h b/src/screen.h
index bdf8e5a7d69b45a34fbddb671f642b0cabbf7989..2dff4590ed6e35f54682ea5a335063582da2ae48 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -175,9 +175,7 @@ void SCR_SetDefaultMode (void);
 
 void SCR_Startup (void);
 
-void SCR_ChangeFullscreen (void);
-
-boolean SCR_IsAspectCorrect(INT32 width, INT32 height);
+FUNCMATH boolean SCR_IsAspectCorrect(INT32 width, INT32 height);
 
 // move out to main code for consistency
 void SCR_DisplayTicRate(void);
diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c
index f3f7036677dfb1092dc23170e64bd60cd7287619..3105f512278e98536de12c9f27e02c5a884e4321 100644
--- a/src/sdl/i_cdmus.c
+++ b/src/sdl/i_cdmus.c
@@ -12,25 +12,25 @@ consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NUL
 consvar_t cdUpdate  = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
 
 
-void I_InitCD(void){}
+FUNCMATH void I_InitCD(void){}
 
-void I_StopCD(void){}
+FUNCMATH void I_StopCD(void){}
 
-void I_PauseCD(void){}
+FUNCMATH void I_PauseCD(void){}
 
-void I_ResumeCD(void){}
+FUNCMATH void I_ResumeCD(void){}
 
-void I_ShutdownCD(void){}
+FUNCMATH void I_ShutdownCD(void){}
 
-void I_UpdateCD(void){}
+FUNCMATH void I_UpdateCD(void){}
 
-void I_PlayCD(UINT8 track, UINT8 looping)
+FUNCMATH void I_PlayCD(UINT8 track, UINT8 looping)
 {
 	(void)track;
 	(void)looping;
 }
 
-boolean I_SetVolumeCD(int volume)
+FUNCMATH boolean I_SetVolumeCD(int volume)
 {
 	(void)volume;
 	return false;
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 0212e620bf3388bba03ec54bfb124823ab85973c..ea8ade8c1f5b901e800810f64c691982040ada8e 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -2049,14 +2049,14 @@ void I_StartupMouse2(void)
 //
 // I_Tactile
 //
-void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
+FUNCMATH void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
 {
 	// UNUSED.
 	(void)pFFType;
 	(void)FFEffect;
 }
 
-void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
+FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
 {
 	// UNUSED.
 	(void)pFFType;
@@ -2067,7 +2067,7 @@ void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
 */
 static ticcmd_t emptycmd;
 
-ticcmd_t *I_BaseTiccmd(void)
+FUNCMATH ticcmd_t *I_BaseTiccmd(void)
 {
 	return &emptycmd;
 }
@@ -2076,7 +2076,7 @@ ticcmd_t *I_BaseTiccmd(void)
 */
 static ticcmd_t emptycmd2;
 
-ticcmd_t *I_BaseTiccmd2(void)
+FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
 {
 	return &emptycmd2;
 }
@@ -2179,7 +2179,7 @@ tic_t I_GetTime (void)
 //
 //I_StartupTimer
 //
-void I_StartupTimer(void)
+FUNCMATH void I_StartupTimer(void)
 {
 #if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
 	// for win2k time bug
@@ -2313,11 +2313,11 @@ void I_WaitVBL(INT32 count)
 	SDL_Delay(count);
 }
 
-void I_BeginRead(void)
+FUNCMATH void I_BeginRead(void)
 {
 }
 
-void I_EndRead(void)
+FUNCMATH void I_EndRead(void)
 {
 }
 
@@ -3067,5 +3067,5 @@ const CPUInfoFlags *I_CPUInfo(void)
 }
 
 // note CPUAFFINITY code used to reside here
-void I_RegisterSysCommands(void) {}
+FUNCMATH void I_RegisterSysCommands(void) {}
 #endif
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index b5168dad57405fc95c793ac4501a3cbfe8a08ede..71baca510dabd7e21fd247721a10b050e2981f46 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -1346,7 +1346,7 @@ void I_SetPalette(RGBA_t *palette)
 }
 
 // return number of fullscreen + X11 modes
-INT32 VID_NumModes(void)
+FUNCMATH INT32 VID_NumModes(void)
 {
 	if (USE_FULLSCREEN && numVidModes != -1)
 		return numVidModes - firstEntry;
@@ -1354,7 +1354,7 @@ INT32 VID_NumModes(void)
 		return MAXWINMODES;
 }
 
-const char *VID_GetModeName(INT32 modeNum)
+FUNCMATH const char *VID_GetModeName(INT32 modeNum)
 {
 #if 0
 	if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
@@ -1384,7 +1384,7 @@ const char *VID_GetModeName(INT32 modeNum)
 	return &vidModeName[modeNum][0];
 }
 
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
+FUNCMATH INT32 VID_GetModeForSize(INT32 w, INT32 h)
 {
 	int i;
 	for (i = 0; i < MAXWINMODES; i++)
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index faebca6b467125913aca2d8262d9b49d878ea324..4a46813c111ce0e69023e08372958d6d127e7b3d 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -126,7 +126,7 @@ void I_ShutdownSound(void)
 #endif
 }
 
-void I_UpdateSound(void)
+FUNCMATH void I_UpdateSound(void)
 {
 }
 
@@ -464,7 +464,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
 }
 #endif
 
-void I_InitMusic(void)
+FUNCMATH void I_InitMusic(void)
 {
 }
 
@@ -769,7 +769,7 @@ boolean I_SetSongTrack(int track)
 // MIDI Music
 //
 
-void I_InitMIDIMusic(void)
+FUNCMATH void I_InitMIDIMusic(void)
 {
 }
 
diff --git a/src/st_stuff.h b/src/st_stuff.h
index 6fafca4040f1585c43c50f6449c485e1c1e28e3d..c11559d2b4f73853972b333d7f4d8dee1d6c9490 100644
--- a/src/st_stuff.h
+++ b/src/st_stuff.h
@@ -24,7 +24,7 @@
 //
 
 // Called by main loop.
-void ST_Ticker(void);
+FUNCMATH void ST_Ticker(void);
 
 // Called by main loop.
 void ST_Drawer(void);
diff --git a/src/tables.h b/src/tables.h
index 0e4853cb9738bb620d954621c0f8adca55ef5702..e05b81845168a5b40505bcc57792714f9735db1e 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -82,7 +82,7 @@ typedef UINT32 angle_t;
 extern angle_t tantoangle[SLOPERANGE+1];
 
 // Utility function, called by R_PointToAngle.
-unsigned SlopeDiv(unsigned num, unsigned den);
+FUNCMATH unsigned SlopeDiv(unsigned num, unsigned den);
 
 // 360 - angle_t(ANGLE_45) = ANGLE_315
 FUNCMATH FUNCINLINE static ATTRINLINE angle_t InvAngle(angle_t a)