2008-11-14 16:56:40 +00:00
|
|
|
// Holds the main init and de-init functions for arch-related program parts
|
|
|
|
|
2013-06-30 02:22:56 +00:00
|
|
|
#include <SDL.h>
|
2010-06-14 08:13:16 +00:00
|
|
|
#include "songs.h"
|
2008-11-14 16:56:40 +00:00
|
|
|
#include "key.h"
|
|
|
|
#include "digi.h"
|
|
|
|
#include "mouse.h"
|
|
|
|
#include "joy.h"
|
|
|
|
#include "gr.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2008-11-14 16:56:40 +00:00
|
|
|
#include "text.h"
|
|
|
|
#include "args.h"
|
2012-11-11 22:12:51 +00:00
|
|
|
#include "window.h"
|
2008-11-14 16:56:40 +00:00
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void arch_close(void)
|
2008-11-14 16:56:40 +00:00
|
|
|
{
|
2010-06-14 08:13:16 +00:00
|
|
|
songs_uninit();
|
2008-11-14 16:56:40 +00:00
|
|
|
|
|
|
|
gr_close();
|
|
|
|
|
|
|
|
if (!GameArg.CtlNoJoystick)
|
|
|
|
joy_close();
|
|
|
|
|
2010-07-28 17:27:35 +00:00
|
|
|
mouse_close();
|
|
|
|
|
2008-11-14 16:56:40 +00:00
|
|
|
if (!GameArg.SndNoSound)
|
|
|
|
{
|
|
|
|
digi_close();
|
|
|
|
}
|
|
|
|
|
|
|
|
key_close();
|
|
|
|
|
|
|
|
SDL_Quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void arch_init(void)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
|
|
|
Error("SDL library initialisation failed: %s.",SDL_GetError());
|
|
|
|
|
|
|
|
key_init();
|
|
|
|
|
2013-11-10 05:25:08 +00:00
|
|
|
int system = SDLAUDIO_SYSTEM;
|
|
|
|
#ifdef USE_SDLMIXER
|
|
|
|
if (!GameArg.SndDisableSdlMixer)
|
|
|
|
system = SDLMIXER_SYSTEM;
|
|
|
|
#endif
|
|
|
|
digi_select_system( system );
|
2010-06-14 08:13:16 +00:00
|
|
|
|
2008-11-14 16:56:40 +00:00
|
|
|
if (!GameArg.SndNoSound)
|
|
|
|
digi_init();
|
2010-06-14 08:13:16 +00:00
|
|
|
|
2010-07-16 11:07:42 +00:00
|
|
|
mouse_init();
|
2008-11-14 16:56:40 +00:00
|
|
|
|
|
|
|
if (!GameArg.CtlNoJoystick)
|
|
|
|
joy_init();
|
|
|
|
|
|
|
|
if ((t = gr_init(0)) != 0)
|
|
|
|
Error(TXT_CANT_INIT_GFX,t);
|
|
|
|
|
|
|
|
atexit(arch_close);
|
|
|
|
}
|
|
|
|
|