Skip to content
Permalink
Browse files

- consolidated the 3 atterm implementations.

Each platform had its own copy. Why?
  • Loading branch information...
coelckers committed Jun 10, 2019
1 parent 9f2fbc1 commit 2766303cfc95f224dcbde42af12b2ed7b3695f41
@@ -1298,6 +1298,7 @@ set (PCH_SOURCES
utility/nodebuilder/nodebuild_utility.cpp
utility/sc_man.cpp
utility/stats.cpp
utility/atterm.cpp
utility/cmdlib.cpp
utility/colormatcher.cpp
utility/configfile.cpp
@@ -102,6 +102,7 @@
#include "i_system.h"
#include "g_cvars.h"
#include "r_data/r_vanillatrans.h"
#include "atterm.h"

EXTERN_CVAR(Bool, hud_althud)
EXTERN_CVAR(Int, vr_mode)
@@ -50,6 +50,7 @@
#include "types.h"
#include "scriptutil.h"
#include "i_system.h"
#include "atterm.h"

// MACROS ------------------------------------------------------------------

@@ -302,6 +302,11 @@ inline float DEG2RAD(float deg)
return deg * float(M_PI / 180.0);
}

inline double DEG2RAD(double deg)
{
return deg * (M_PI / 180.0);
}

inline float RAD2DEG(float deg)
{
return deg * float(180. / M_PI);
@@ -49,6 +49,7 @@
#include "vm.h"
#include "i_system.h"
#include "utf8.h"
#include "atterm.h"

#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
enum
@@ -50,6 +50,7 @@
#include "g_levellocals.h"
#include "events.h"
#include "i_system.h"
#include "atterm.h"

static TArray<cluster_info_t> wadclusterinfos;
TArray<level_info_t> wadlevelinfos;
@@ -62,6 +62,7 @@
#include "st_start.h"
#include "m_misc.h"
#include "doomerrors.h"
#include "atterm.h"

#include "i_net.h"

@@ -66,6 +66,7 @@

#include "gameconfigfile.h"
#include "gstrings.h"
#include "atterm.h"

FGameConfigFile *GameConfig;

@@ -50,6 +50,7 @@
#include "gstrings.h"
#include "teaminfo.h"
#include "r_data/sprites.h"
#include "atterm.h"


void ClearSaveGames();
@@ -75,6 +75,7 @@
#include "i_system.h"
#include "v_video.h"
#include "fragglescript/t_script.h"
#include "atterm.h"

extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);

@@ -42,6 +42,7 @@
#include "m_joy.h"
#include "templates.h"
#include "v_text.h"
#include "atterm.h"


EXTERN_CVAR(Bool, joy_axespolling)
@@ -33,6 +33,7 @@

#include "i_common.h"
#include "s_sound.h"
#include "atterm.h"

#include <sys/sysctl.h>

@@ -64,57 +65,6 @@
namespace
{

// The maximum number of functions that can be registered with atterm.
const size_t MAX_TERMS = 64;

void (*TermFuncs[MAX_TERMS])();
const char *TermNames[MAX_TERMS];
size_t NumTerms;

} // unnamed namespace

// Expose this for i_main_except.cpp
void call_terms()
{
while (NumTerms > 0)
{
TermFuncs[--NumTerms]();
}
}


void addterm(void (*func)(), const char *name)
{
// Make sure this function wasn't already registered.

for (size_t i = 0; i < NumTerms; ++i)
{
if (TermFuncs[i] == func)
{
return;
}
}

if (NumTerms == MAX_TERMS)
{
func();
I_FatalError("Too many exit functions registered.");
}

TermNames[NumTerms] = name;
TermFuncs[NumTerms] = func;

++NumTerms;
}

void popterm()
{
if (NumTerms)
{
--NumTerms;
}
}


void Mac_I_FatalError(const char* const message)
{
@@ -36,9 +36,9 @@

#include "doomerrors.h"
#include "vm.h"
#include "atterm.h"

// Import some functions from i_main.mm
void call_terms();
void Mac_I_FatalError(const char* const message);
void OriginalMainTry(int argc, char** argv);

@@ -48,6 +48,7 @@
#include "v_text.h"
#include "x86.h"
#include "cmdlib.h"
#include "atterm.h"


EXTERN_CVAR(String, language)
@@ -54,6 +54,7 @@
#include "v_text.h"
#include "version.h"
#include "doomerrors.h"
#include "atterm.h"

#include "gl/system/gl_framebuffer.h"
#include "vulkan/system/vk_framebuffer.h"
@@ -89,10 +89,6 @@ void I_Quit (void);

void I_Tactile (int on, int off, int total);

void addterm (void (*func)(void), const char *name);
#define atterm(t) addterm (t, #t)
void popterm ();

void I_DebugPrint (const char *cp);

// Print a console string
@@ -43,6 +43,7 @@
#include "m_argv.h"
#include "doomerrors.h"
#include "swrenderer/r_swrenderer.h"
#include "atterm.h"

IVideo *Video;

@@ -56,6 +56,7 @@
#include "doomerrors.h"
#include "i_system.h"
#include "g_game.h"
#include "atterm.h"

// MACROS ------------------------------------------------------------------

@@ -89,47 +90,9 @@ FArgs *Args;

// PRIVATE DATA DEFINITIONS ------------------------------------------------

static void (*TermFuncs[MAX_TERMS]) ();
static const char *TermNames[MAX_TERMS];
static int NumTerms;

// CODE --------------------------------------------------------------------

void addterm (void (*func) (), const char *name)
{
// Make sure this function wasn't already registered.
for (int i = 0; i < NumTerms; ++i)
{
if (TermFuncs[i] == func)
{
return;
}
}
if (NumTerms == MAX_TERMS)
{
func ();
I_FatalError (
"Too many exit functions registered.\n"
"Increase MAX_TERMS in i_main.cpp");
}
TermNames[NumTerms] = name;
TermFuncs[NumTerms++] = func;
}

void popterm ()
{
if (NumTerms)
NumTerms--;
}

void call_terms ()
{
while (NumTerms > 0)
{
// printf ("term %d - %s\n", NumTerms, TermNames[NumTerms-1]);
TermFuncs[--NumTerms] ();
}
}

static void NewFailure ()
{
@@ -51,6 +51,7 @@
#include "d_net.h"
#include "g_game.h"
#include "c_dispatch.h"
#include "atterm.h"

#include "gameconfigfile.h"

@@ -42,6 +42,7 @@
#include "doomdef.h"
#include "i_system.h"
#include "c_cvars.h"
#include "atterm.h"

// MACROS ------------------------------------------------------------------

@@ -64,6 +64,7 @@
#include "actorinlines.h"
#include "g_game.h"
#include "i_system.h"
#include "atterm.h"

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

@@ -55,6 +55,7 @@
#include "templates.h"
#include "r_utility.h"
#include "r_renderer.h"
#include "atterm.h"
#include <atomic>

FDynamicColormap NormalLight;
@@ -48,6 +48,7 @@
#include "r_data/sprites.h"
#include "vm.h"
#include "i_system.h"
#include "atterm.h"

// MACROS ------------------------------------------------------------------

@@ -46,6 +46,7 @@
#include "vm.h"
#include "dobject.h"
#include "menu/menu.h"
#include "atterm.h"



@@ -83,6 +83,7 @@
#include "g_levellocals.h"
#include "vm.h"
#include "g_game.h"
#include "atterm.h"

// MACROS ------------------------------------------------------------------

0 comments on commit 2766303

Please sign in to comment.
You can’t perform that action at this time.