mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Engine: Add E_PostInit, called from the game after loaddefinitionsfile().
git-svn-id: https://svn.eduke32.com/eduke32@5345 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6de7ed8d72
commit
43459780af
10 changed files with 94 additions and 45 deletions
|
@ -997,6 +997,7 @@ typedef struct artheader_t {
|
|||
|
||||
int32_t preinitengine(void); // a partial setup of the engine used for launch windows
|
||||
int32_t initengine(void);
|
||||
int32_t E_PostInit(void);
|
||||
void uninitengine(void);
|
||||
void initspritelists(void);
|
||||
int32_t loadlookups(int32_t fp);
|
||||
|
|
|
@ -192,6 +192,7 @@ extern const char *ExtGetVer(void);
|
|||
extern int32_t ExtInit(void);
|
||||
extern int32_t ExtPreInit(int32_t argc,const char **argv);
|
||||
extern int32_t ExtPostStartupWindow(void);
|
||||
extern void ExtPostInit(void);
|
||||
extern void ExtUnInit(void);
|
||||
extern void ExtPreCheckKeys(void);
|
||||
extern void ExtAnalyzeSprites(int32_t, int32_t, int32_t, int32_t);
|
||||
|
|
|
@ -35,6 +35,7 @@ static const char *CallExtGetVer(void);
|
|||
static int32_t CallExtInit(void);
|
||||
static int32_t CallExtPreInit(int32_t argc,const char **argv);
|
||||
static int32_t CallExtPostStartupWindow(void);
|
||||
static void CallExtPostInit(void);
|
||||
static void CallExtUnInit(void);
|
||||
static void CallExtPreCheckKeys(void);
|
||||
static void CallExtAnalyzeSprites(int32_t, int32_t, int32_t, int32_t);
|
||||
|
@ -557,6 +558,14 @@ void M32_OnShowOSD(int32_t shown)
|
|||
AppGrabMouse((!shown) + 2);
|
||||
}
|
||||
|
||||
static void M32_FatalEngineError(void)
|
||||
{
|
||||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int32_t app_main(int32_t argc, const char **argv)
|
||||
{
|
||||
#ifdef STARTUP_SETUP_WINDOW
|
||||
|
@ -636,12 +645,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
Bstrncpy(game_executable, DefaultGameLocalExec, sizeof(game_executable));
|
||||
|
||||
if (preinitengine())
|
||||
{
|
||||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
Bexit(2);
|
||||
}
|
||||
M32_FatalEngineError();
|
||||
|
||||
if ((i = CallExtInit()) < 0) return -1;
|
||||
|
||||
|
@ -720,6 +724,11 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
|
||||
// Here used to be the 'whitecol' calculation
|
||||
|
||||
if (E_PostInit())
|
||||
M32_FatalEngineError();
|
||||
|
||||
CallExtPostInit();
|
||||
|
||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||
int k = clipmapinfo_load();
|
||||
if (k>0)
|
||||
|
@ -11089,6 +11098,10 @@ static int32_t CallExtPostStartupWindow(void)
|
|||
{
|
||||
return ExtPostStartupWindow();
|
||||
}
|
||||
static void CallExtPostInit(void)
|
||||
{
|
||||
return ExtPostInit();
|
||||
}
|
||||
static void CallExtUnInit(void)
|
||||
{
|
||||
ExtUnInit();
|
||||
|
|
|
@ -9252,6 +9252,15 @@ int32_t initengine(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// E_PostInit
|
||||
//
|
||||
|
||||
int32_t E_PostInit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// uninitengine
|
||||
//
|
||||
|
|
|
@ -9945,6 +9945,10 @@ int32_t ExtPostStartupWindow(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ExtPostInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtUnInit(void)
|
||||
{
|
||||
// int32_t i;
|
||||
|
|
|
@ -11085,6 +11085,15 @@ static void G_HandleMemErr(int32_t line, const char *file, const char *func)
|
|||
G_GameExit(msg);
|
||||
}
|
||||
|
||||
static void G_FatalEngineError(void)
|
||||
{
|
||||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
G_Cleanup();
|
||||
ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
exit(6);
|
||||
}
|
||||
|
||||
static void G_Startup(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -11098,13 +11107,7 @@ static void G_Startup(void)
|
|||
G_CompileScripts();
|
||||
|
||||
if (initengine())
|
||||
{
|
||||
wm_msgbox("Build Engine Initialization Error",
|
||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||
G_Cleanup();
|
||||
ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||
Bexit(6);
|
||||
}
|
||||
G_FatalEngineError();
|
||||
|
||||
setbasepaltable(basepaltable, BASEPALCOUNT);
|
||||
|
||||
|
@ -11701,6 +11704,9 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
Bfree(g_defModules);
|
||||
g_defModules = NULL;
|
||||
|
||||
if (E_PostInit())
|
||||
G_FatalEngineError();
|
||||
|
||||
Gv_ResetSystemDefaults(); // called here to populate our fake tilesizx and tilesizy arrays presented to CON with sizes generated by dummytiles
|
||||
|
||||
if (numplayers == 1 && boardfilename[0] != 0)
|
||||
|
|
|
@ -898,6 +898,13 @@ int nextvoxid = 0; // JBF
|
|||
|
||||
extern int startwin_run(void);
|
||||
|
||||
static void SW_FatalEngineError(void)
|
||||
{
|
||||
wm_msgbox("Build Engine Initialisation Error",
|
||||
"There was a problem initialising the Build engine: %s", engineerrstr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
InitGame(int32_t argc, const char **argv)
|
||||
{
|
||||
|
@ -908,13 +915,8 @@ InitGame(int32_t argc, const char **argv)
|
|||
DSPRINTF(ds,"InitGame...");
|
||||
MONO_PRINT(ds);
|
||||
|
||||
|
||||
if (initengine())
|
||||
{
|
||||
wm_msgbox("Build Engine Initialisation Error",
|
||||
"There was a problem initialising the Build engine: %s", engineerrstr);
|
||||
exit(1);
|
||||
}
|
||||
SW_FatalEngineError();
|
||||
|
||||
//initgroupfile(G_GrpFile()); // JBF: moving this close to start of program to detect shareware
|
||||
InitSetup();
|
||||
|
@ -1035,6 +1037,9 @@ InitGame(int32_t argc, const char **argv)
|
|||
Bfree(g_defModules);
|
||||
g_defModules = NULL;
|
||||
|
||||
if (E_PostInit())
|
||||
SW_FatalEngineError();
|
||||
|
||||
DemoModeMenuInit = TRUE;
|
||||
// precache as much stuff as you can
|
||||
if (UserMapName[0] == '\0')
|
||||
|
|
|
@ -778,6 +778,9 @@ else
|
|||
return rv;
|
||||
}
|
||||
|
||||
void ExtPostInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ExtUnInit(void)
|
||||
|
|
|
@ -156,6 +156,10 @@ int32_t ExtPostStartupWindow(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ExtPostInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtUnInit(void)
|
||||
{
|
||||
uninitgroupfile();
|
||||
|
|
|
@ -432,6 +432,23 @@ static int osdcmd_map(const osdfuncparm_t *parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static void Ken_UninitAll(void)
|
||||
{
|
||||
sendlogoff(); //Signing off
|
||||
musicoff();
|
||||
uninitmultiplayers();
|
||||
uninittimer();
|
||||
uninitinput();
|
||||
uninitengine();
|
||||
uninitsb();
|
||||
uninitgroupfile();
|
||||
}
|
||||
|
||||
static void Ken_FatalEngineError(void)
|
||||
{
|
||||
buildprintf("There was a problem initialising the engine: %s.\n", engineerrstr);
|
||||
}
|
||||
|
||||
int32_t app_main(int32_t argc, const char **argv)
|
||||
{
|
||||
#if defined STARTUP_SETUP_WINDOW
|
||||
|
@ -505,7 +522,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
initgroupfile(G_GrpFile());
|
||||
if (initengine())
|
||||
{
|
||||
buildprintf("There was a problem initialising the engine: %s.\n", engineerrstr);
|
||||
Ken_FatalEngineError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -527,14 +544,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
handleevents();
|
||||
if (quitevent)
|
||||
{
|
||||
sendlogoff(); //Signing off
|
||||
musicoff();
|
||||
uninitmultiplayers();
|
||||
uninittimer();
|
||||
uninitinput();
|
||||
uninitengine();
|
||||
uninitsb();
|
||||
uninitgroupfile();
|
||||
Ken_UninitAll();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -548,6 +558,13 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
tiletovox[BROWNMONSTER] = nextvoxid++;
|
||||
if (!loaddefinitionsfile(G_DefFile())) buildputs("Definitions file loaded.\n");
|
||||
|
||||
if (E_PostInit())
|
||||
{
|
||||
Ken_UninitAll();
|
||||
Ken_FatalEngineError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Here's an example of TRUE ornamented walls
|
||||
//The allocatepermanenttile should be called right after loadpics
|
||||
//Since it resets the tile cache for each call.
|
||||
|
@ -618,15 +635,8 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
|
||||
if (keystatus[1])
|
||||
{
|
||||
sendlogoff(); //Signing off
|
||||
musicoff();
|
||||
uninitmultiplayers();
|
||||
uninittimer();
|
||||
uninitinput();
|
||||
uninitengine();
|
||||
uninitsb();
|
||||
uninitgroupfile();
|
||||
exit(0);
|
||||
Ken_UninitAll();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
screenpeek = myconnectindex;
|
||||
|
@ -737,14 +747,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
drawscreen(screenpeek,i);
|
||||
}
|
||||
|
||||
sendlogoff(); //Signing off
|
||||
musicoff();
|
||||
uninitmultiplayers();
|
||||
uninittimer();
|
||||
uninitinput();
|
||||
uninitengine();
|
||||
uninitsb();
|
||||
uninitgroupfile();
|
||||
Ken_UninitAll();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue