/******************************************************************************************
	CRTEST PS   (c) 1999-2001 ISL

	menu.c:			Simple little menu thing
******************************************************************************************/

#include "global.h"

#include "main.h"
#include "viewer.h"
#include "platform.h"
#include "collide.h"
#include "inventory.h"
#include "enemies.h"
#include "scenics.h"
#include "charactr.h"

#include "map_view.h"
#include "map_play.h"

#include "stilts.h"
#include "station.h"
#include "catapult.h"
#include "startup.h"
#include "credits.h"
#include "fireworks.h"
#include "gametext.h"
#include "fma.h"
#include "options.h"
#include "fxtest.h"
#include "seesaw.h"
#include "dogchase.h"
#include "crate.h"
#include "engine.h"
#include "language.h"
#include "sound.h"
#include "demo.h"
#include "menu.h"
#include "card.h"

#ifdef _WINDOWS
#include <pcBackdrop.h>
#endif

int palMode = PALMODE;
int FRAMESEC = ((PALMODE)?(25):(30));

#ifdef DREAMCAST
extern int disableEggFlip;
TIM_HEADER *startupTim = NULL;
TIM_HEADER *testTim = NULL;
extern int CAT_CRICKET_X;
extern int CAT_CRICKET_Y;
extern int CON_ARROW_Y;
extern int CON_PROGRESS_YPOS;
extern int CON_BACK_YPOS;
extern int CHICK_CHICK_CLIP_YPOS;
extern int DEATH_PANEL_Y;
extern int FRAMESSEC;
extern int EL_CRICKET_X;
extern int EL_CRICKET_Y;
extern int EL_STOPWATCH_X;
extern int EL_STOPWATCH_Y;
extern int EL_ARROW_Y;
extern int EL_PANEL_X;
extern int EL_PANEL_Y;
extern int ENG_POWER_BAR_TEXTYPOS;
extern int ENG_PANEL_Y;
extern int FW_CRICKET_X;
extern int FW_CRICKET_Y;
extern int FW_CHICKENS_FREED_YPOS;
extern int FW_STOPWATCH_X;
extern int FW_STOPWATCH_Y;
extern int HELP_PANEL_X;
extern int HELP_PANEL_Y;
extern int SPLASH_MENU_Y;
extern int COUNTDOWN_YPOS;
extern int SS_PB_YPOS;
extern int SEESAW_CRICKET_X;
extern int SEESAW_CRICKET_Y;
extern int WM_BAR_POSY;
extern int WM_PROGRESS_Y;
extern int FOWLER_YPOS;

// Moved to card.c, what with the original defines being in card.h & all. RFW
/*
#if(PALMODE==YES)
	int INIT_DOGCHASE_BEST = 7500;
	int INIT_COGCHASE_BEST = 7500;
	int INIT_ACT1_BEST = (30*60*25);
	int INIT_ACT2_BEST = (90*60*25);
	int INIT_ACT3_BEST = (120*60*25);
#else
	int INIT_DOGCHASE_BEST = 9000;
	int INIT_COGCHASE_BEST = 9000;
	int INIT_ACT1_BEST = (30*60*30);
	int INIT_ACT2_BEST = (90*60*30);
	int INIT_ACT3_BEST = (120*60*30);
#endif
*/
#if PALMODE==1
int hzQuit = NO;
#else
int hzQuit = YES;
#endif
#endif

char startup_choice = 0;
unsigned long startup_colour;
unsigned long startup_colouradd;

TextureType *plank = 0;
TextureBankType *bd = 0;

int pcCheat=0;

void startupDraw();
void startupCycle();

#ifdef DREAMCAST
int titleScreen;
#endif
// RFW - I've put this in because I can't honestly see the point of the start banner screen
// (everything there's on Fowler's anyway. Note that the start banner *has* to always go to fowlers, because
// TRC says you've got to be able to access the options before the first rumble happens)

// And also because with Fowler's the way it was there was actually no way of "loading & continuing" a game.
// (coz the door on fowler's was "exit back to banner" rather than "continue"

//#define STARTUP_DIRECT_TO_FOWLERS


// Called from the (post-language) memory card & startupstart
void startupContinue()
{

// RFW - I've moved the TIM load to "StartupLoad", so there's no loading between the language screen
// and the startup sceen (Which means that the music can keep going)

// RFW - And I've moved the default speed-trial times to "cardInitialGameState()"
// RFW - Same with the initial single map-piece...


/*
		ULONG *tim;

		sound_XA_PauseForLoading();	// It'll be playing the intro, followed by the daytime loop
			tim=(ULONG *)fileLoad("SHELL\\BACKDROP.TIM",0);
			uploadTimToVRAM(tim);
			FREE(tim);
		sound_XA_Resume(-1);
*/

#ifdef STARTUP_DIRECT_TO_FOWLERS
// We want to start on the *Door* of fowler's hut if we've loaded a gamestate
// If we didn't load a gamestate, we want to start either there or on the bomb.
		optionsStart(OPTIONS_DOOR_START | OPTIONS_FROM_TITLE);
#else
		startup_choice = 0;
		startup_colour = 64;
		startup_colouradd = 8;
		playing_ticker_enabled = 0;

		draw_routine = startupDraw;
		cycle_routine = startupCycle;
#endif
#ifdef DREAMCAST
		titleScreen = YES;
		ScreenFade(0,255,20);
		levinfoSetupBackground();
#endif
	cardFindMenuSfx(0);

}

/*
	LANG_UK,		// (United Kingdom)
	LANG_F,			// (France)
	LANG_D,			// (Germany)
	LANG_IT,		// (Italy)
	LANG_SP,		// (Spain)
*/
char *backdrop_names[] =
{
#ifdef USE_CUSTOM_SPLASH
	"SHELL\\CUSTOM.TIM",
	"SHELL\\CUSTOM.TIM",
	"SHELL\\CUSTOM.TIM",
	"SHELL\\CUSTOM.TIM",
	"SHELL\\CUSTOM.TIM",
#else
	"SHELL\\BACKDROP.TIM",
	"SHELL\\BACKDROP.TIM",
	"SHELL\\GERMANY.TIM",
	"SHELL\\ITALY.TIM",
	"SHELL\\SPAIN.TIM",
#endif
};

void startupLoad(void)
{
#ifndef DREAMCAST

//	bd = textureLoadBank("FRONTEND\\FRONTEND.SPT");
//	textureDownloadBank(bd);							
//	textureDestroyBank(bd);							
	bd = textureLoadInOneGo("FRONTEND\\FRONTEND.SPT");

	plank = textureFindInAllBanks("64X64PLANK2");		
	ASSERT(plank);
#endif
#ifndef STARTUP_DIRECT_TO_FOWLERS
	{
#ifdef DREAMCAST
#ifdef DEBUG
		gameSaveData.blitz_games_internal = 1;
#endif
		if(startupTim == NULL)
			dcTim_Load(&startupTim, "SHELL\\BACKDROP.TIM");
#if PALMODE == 1
		dcTim_Load(&testTim,"FRONTEND\\SPLASH\\ACT1.TIM");
#endif

#endif

#ifdef _WINDOWS
	LoadBackdrop1 ( "SHELL\\ENGLISH.BMP" );
#else
#ifndef DREAMCAST
		ULONG *tim;
		tim=(ULONG *)fileLoad(backdrop_names[gameTextLang],0);
		uploadTimToVRAM(tim);
		FREE(tim);
#endif
#endif
	}
#endif

}

// This is called from "Quit game" in the pause menu. It is NOT called from the language screen.

#ifndef OPSM_DEMO	// On the demo version, "startupstart" is a quit function (!)

void startupStart()
{
#ifdef DREAMCAST
	overlayLoadingBegin(1);
#endif

	playing_ticker_enabled = 0;

	loop_ticker2 = 0;

#if defined(_WINDOWS) && defined(_DEBUG)
	gameSaveData.blitz_games_internal = 1;
#endif

	pcCheat = 0;
	sound_XA_Stop();

	startupLoad();

	sound_XA_Start(TUNE_1_INTRO);
// With the intro vid being played, we want the intro tune to be non-looping, and then go to the vid
//	sound_XA_Queue(TUNE_5_COOPS_D);
	if(XAData.currXA)
	{
		XAData.currXA->loop = 0;
	}

	startupContinue();
#ifdef DREAMCAST
	overlayLoadingEnd();
#endif
}
#endif	// opsm_demo

void startupEnd(void)
{
	playing_ticker_enabled = 1;

#ifdef DREAMCAST
	disableEggFlip = 1;
	overlayLoadingBegin(1);
	disableEggFlip = 0;
	dcTim_Unload(&startupTim);
#if PALMODE == 1
	dcTim_Unload(&testTim);
#endif
#else
	textureUnloadBank(bd);							
	bd = NULL;
#endif

#ifdef _WINDOWS
	if (startup_choice==2)
	{
		menuStart2();
		return;
	}
#endif


	switch(startup_choice)
	{
		case 0:
			optionsStart(OPTIONS_DOOR_START | OPTIONS_FROM_TITLE);	//BOMB_START);
			break;
		case 1:
			optionsStart(OPTIONS_BED_START | OPTIONS_FROM_TITLE);

			optionstate = LOAD_LOAD;	// Go direct to "load" option as if it had been selected
			cardFowlerLoadStart();
			break;

		case 2:
			startupEndLoad();
			break;
		default:
			break;
	}
}

// Called by the language->cheat mode switch
void startupFreeStart()
{
	textureUnloadBank(bd);
	bd = NULL;
}


void startupEndStart()
{

//	DB("start new game\n");
	mapplayStart("A1_HUT17", 0);

}


void startupEndLoad()
{
#ifdef GAME_SHOW_DEMO
	optionsStart(OPTIONS_BOMB_START | OPTIONS_FROM_TITLE);

#else
//	DB("load \n");
	menuStart();
#endif
}


#ifdef DREAMCAST
int		hzSelect = 0;
int		hzMode = 0;
UBYTE hzR,hzG,hzB;
int tvmodex1 = 0,tvmodex2 = 128 - 256,tvmodex3 = 256 - 256,tvmodex4 = 384 - 256;
int tvmodey1 = -110,tvmodey2 = -55,tvmodey3 = -10,tvmodey4 = 75;
void tvModeSelectDraw()
{
	char msg[2];

	switch(hzMode)
	{
		case 0:
			dcTim_Draw(0, 0, 640, 480, startupTim);

			if((padData.present[0] == 0) && (padData.present[1] == 0) && (padData.present[2] == 0) && (padData.present[3] == 0))
			{
				loop_ticker2 = 0;
				return;
			}

			fontPrintCentred(font,tvmodex1,tvmodey1, TEXTSTR(TEXTSTR_DC_TV_SETTING),128,128,128);

			hzR = 100+((rsin(loop_ticker*8000)+4096)*90)/4096;
			hzG = 100+((rcos(loop_ticker*8000)+4096)*90)/4096;
			hzB = 128;

			if(hzSelect == 0)
				fontPrintCentred(font,tvmodex2,tvmodey2, TEXTSTR(TEXTSTR_DC_TV_50HZ_SELECT),hzR,hzG,128);
			else
				fontPrintCentred(font,tvmodex2,tvmodey2, TEXTSTR(TEXTSTR_DC_TV_50HZ_SELECT),48,48,48);

			if(hzSelect == 1)
				fontPrintCentred(font,tvmodex3,tvmodey2, TEXTSTR(TEXTSTR_DC_TV_60HZ_SELECT),hzR,hzG,128);
			else
				fontPrintCentred(font,tvmodex3,tvmodey2, TEXTSTR(TEXTSTR_DC_TV_60HZ_SELECT),48,48,48);

			if(hzSelect == 2)
				fontPrintCentred(font,tvmodex4,tvmodey2,TEXTSTR(TEXTSTR_DC_TV_TEST_SELECT),hzR,hzG,128);
			else
				fontPrintCentred(font,tvmodex4,tvmodey2,TEXTSTR(TEXTSTR_DC_TV_TEST_SELECT),48,48,48);

			switch(hzSelect)
			{
				case 0:
					fontCentredMultiLine(font,0,tvmodey3,512 - 50,TEXTSTR(TEXTSTR_DC_TV_50HZ),128,128,128);
					break;
				case 1:
					fontCentredMultiLine(font,0,tvmodey3,512 - 50,TEXTSTR(TEXTSTR_DC_TV_60HZ),128,128,128);
					break;
				case 2:
					fontCentredMultiLine(font,0,tvmodey3,512 - 50,TEXTSTR(TEXTSTR_DC_TV_TEST),128,128,128);
					break;
			}

			fontPrintCentred(font,0,tvmodey4,TEXTSTR(TEXTSTR_OPTIONS_SELECT),128,128,128);

			break;

		case 1:
			dcTim_Draw(0, 0, 640, 480, testTim);

			if(loop_ticker >= (30*5))
			{
				hzMode = 0;
				kmSetDisplayMode (KM_DSPMODE_PALNI640x480EXT, KM_DSPBPP_RGB565, TRUE, FALSE);
//					displayMode = KM_DSPMODE_PALNI640x480EXT;		

				acSystemDelay(500000);
			}
			else
			{
				sprintf(msg,"%d",5 - loop_ticker/30);
				fontPrintCentred(font,0,-60,msg,128,128,128);
			}
			break;
	}
}
#endif

void startupDraw()
{
#ifdef DREAMCAST

	if((hzQuit == NO) && (vidInfo.mode == KM_DSPMODE_PALNI640x480EXT))
	{
		tvModeSelectDraw();
		if(hzQuit == NO)
			return;
	}

	dcTim_Draw(0, 0, 640, 480, startupTim);
	if(titleScreen)
	{
#if PALMODE==1
		if((pauseOn) || ((padData.present[0] == 0) && (padData.present[1] == 0) && (padData.present[2] == 0) && (padData.present[3] == 0)))
		{
			loop_ticker2 = 0;
			return;
		}
#else
		if((pauseOn) || (firstPad == -1))
		{
			loop_ticker2 = 0;
			return;
		}
#endif
		fontPrintCentred(font,0,0,TEXTSTR(TEXTSTR_PRESS_START_LEGAL),startup_colour, startup_colour, startup_colour);
		return;
	}
#endif

#ifdef _WINDOWS
	DrawBackdrop();
#else
	drawBGTim();
#endif

	if(startup_choice==0)
	{
		fontPrintCentred(font,0,-4,TEXTSTR(TEXTSTR_FRONT_START),startup_colour, startup_colour, startup_colour);

#ifndef OPSM_DEMO	// Demo version only has "start"
				fontPrintCentred(font,0,12,TEXTSTR(TEXTSTR_FRONT_LOAD),48,48,48);

		if(gameSaveData.blitz_games_internal)
		{
			#if defined (GAME_SHOW_DEMO)
				fontPrintCentred(font,0,28,"LEVEL SELECT",48,48,48);
			#else
				fontPrintCentred(font,0,28,"DEBUG MENU",48,48,48);
			#endif
		}
#endif
	}
	else if(startup_choice==1)
	{
		fontPrintCentred(font,0,-4,TEXTSTR(TEXTSTR_FRONT_START),48,48,48);
		fontPrintCentred(font,0,12,TEXTSTR(TEXTSTR_FRONT_LOAD),startup_colour,startup_colour,startup_colour);
		if(gameSaveData.blitz_games_internal)
		{
			#if defined (GAME_SHOW_DEMO)
				fontPrintCentred(font,0,28,"LEVEL SELECT",48,48,48);
			#else
				fontPrintCentred(font,0,28,"DEBUG MENU",48,48,48);
			#endif
		}
	}
	else
	{
		fontPrintCentred(font,0,-4,TEXTSTR(TEXTSTR_FRONT_START),48,48,48);
		fontPrintCentred(font,0,12,TEXTSTR(TEXTSTR_FRONT_LOAD),48,48,48);
		if(gameSaveData.blitz_games_internal)
		{
			#if defined (GAME_SHOW_DEMO)
					fontPrintCentred(font,0,28,"LEVEL SELECT",startup_colour,startup_colour,startup_colour);
			#else
					fontPrintCentred(font,0,28,"DEBUG MENU",startup_colour,startup_colour,startup_colour);
			#endif
		}
	}

}

#ifdef DREAMCAST
int hzModeTimeout = 120*30;
void tvModeSelectCycle()
{
	if(fadingOut)
		return;
	switch(hzMode)
	{
		case 0:
			if(padData.debounce[0] & PAD_RIGHT)
			{
				loop_ticker2 = 0;
				hzSelect++;
				if(hzSelect > 2)
					hzSelect = 2;
				else
					soundPlaySample(sfxFindSampleInAllBanks("clik1"),0xffff,1000);
			}
			if(padData.debounce[0] & PAD_LEFT)
			{
				loop_ticker2 = 0;
				hzSelect--;
				if(hzSelect < 0)
					hzSelect = 0;
				else
					soundPlaySample(sfxFindSampleInAllBanks("clik1"),0xffff,1000);
			}

			if((padData.debounce[0] & PAD_CROSS) || (loop_ticker2 > hzModeTimeout))
			{
				if(loop_ticker2 > hzModeTimeout)
					hzSelect = 0;
				soundPlaySample(sfxFindSampleInAllBanks("bleepselect"),0xffff,1000);
				switch(hzSelect)
				{
					// 50 Hz mode
					case 0:
						hzQuit = TRUE;
						loop_ticker = loop_ticker2 = 0;
						INIT_DOGCHASE_BEST = 7500;
						INIT_COGCHASE_BEST = 7500;
						INIT_ACT1_BEST = (30*60*25);
						INIT_ACT2_BEST = (90*60*25);
						INIT_ACT3_BEST = (120*60*25);
						CAT_CRICKET_X = -228;
						CAT_CRICKET_Y = -110;
						CON_ARROW_Y = -110;
						CON_PROGRESS_YPOS = 90;
						CON_BACK_YPOS = 36;
						CHICK_CHICK_CLIP_YPOS = -28;
						DEATH_PANEL_Y = -120;
						FRAMESSEC = 25;
						EL_CRICKET_X = -228;
						EL_CRICKET_Y = -110;
						EL_STOPWATCH_X = 164;
						EL_STOPWATCH_Y = -64;
						EL_ARROW_Y = 110;
						EL_PANEL_X = -220;
						EL_PANEL_Y = 0;
						ENG_POWER_BAR_TEXTYPOS = -100;
						ENG_PANEL_Y	= -120;
						FW_CRICKET_X = -228;
						FW_CRICKET_Y = -110;
						FW_CHICKENS_FREED_YPOS = -116;
						FW_STOPWATCH_X = 164;
						FW_STOPWATCH_Y = -68;
						FRAMESEC = 25;
						HELP_PANEL_X = -220;
						HELP_PANEL_Y = -108;
						SPLASH_MENU_Y = 70;
						COUNTDOWN_YPOS = -114;
						SS_PB_YPOS = 74;
						SEESAW_CRICKET_X = -228;
						SEESAW_CRICKET_Y = -110;
						WM_BAR_POSY = -118;
						WM_PROGRESS_Y = 60;
						FOWLER_YPOS = 190;

						if(palMode == 0)
						{
							gameSaveData.best_times[TIME_DOGCHASE] *= 25.0/30.0;
							gameSaveData.best_times[TIME_COGCHASE] *= 25.0/30.0;
							gameSaveData.best_times[TIME_ACT1] *= 25.0/30.0;
							gameSaveData.best_times[TIME_ACT2] *= 25.0/30.0;
							gameSaveData.best_times[TIME_ACT4] *= 25.0/30.0;

							gameSaveData.time_spent_playing *= 25.0/30.0;
							kmSetDisplayMode (KM_DSPMODE_PALNI640x480EXT, KM_DSPBPP_RGB565, TRUE, FALSE);
						}

						palMode = 1;

						break;

					// 60 Hz mode
					case 1:
						hzQuit = TRUE;
						loop_ticker = loop_ticker2 = 0;

						INIT_DOGCHASE_BEST = 9000;
						INIT_COGCHASE_BEST = 9000;
						INIT_ACT1_BEST = (30*60*30);
						INIT_ACT2_BEST = (90*60*30);
						INIT_ACT3_BEST = (120*60*30);
						CAT_CRICKET_X = -226;
						CAT_CRICKET_Y = -98;
						CON_ARROW_Y = -108;
						CON_PROGRESS_YPOS = 80;
						CON_BACK_YPOS = 26;
						CHICK_CHICK_CLIP_YPOS = -38;
						DEATH_PANEL_Y = -100;
						FRAMESSEC = 30;
						EL_CRICKET_X = -110;
						EL_CRICKET_Y = -18;
						EL_STOPWATCH_X = 164;
						EL_STOPWATCH_Y = -64;
						EL_ARROW_Y = 96;
						EL_PANEL_X = -220;
						EL_PANEL_Y = -20;
						ENG_POWER_BAR_TEXTYPOS = -80;
						ENG_PANEL_Y	= -100;
						FW_CRICKET_X = -226;
						FW_CRICKET_Y = -98;
						FW_CHICKENS_FREED_YPOS = -105;
						FW_STOPWATCH_X = 164;
						FW_STOPWATCH_Y = -64;
						FRAMESEC = 30;
						HELP_PANEL_X = -220;
						HELP_PANEL_Y = -100;
						SPLASH_MENU_Y = 50;
						COUNTDOWN_YPOS = -105;
						SS_PB_YPOS = 60;
						SEESAW_CRICKET_X = -228;
						SEESAW_CRICKET_Y = -100;
						WM_BAR_POSY = -106;
						WM_PROGRESS_Y = 48;
						FOWLER_YPOS = 180;
#ifdef DEBUG
						gameSaveData.blitz_games_internal = 1;
#endif
						 
						if(palMode)
						{
							gameSaveData.best_times[TIME_DOGCHASE] *= 30.0/25.0;
							gameSaveData.best_times[TIME_COGCHASE] *= 30.0/25.0;
							gameSaveData.best_times[TIME_ACT1] *= 30.0/25.0;
							gameSaveData.best_times[TIME_ACT2] *= 30.0/25.0;
							gameSaveData.best_times[TIME_ACT4] *= 30.0/25.0;

							gameSaveData.time_spent_playing *= 30.0/25.0;
						}

						palMode = 0;

						kmSetDisplayMode (KM_DSPMODE_NTSCNI640x480, KM_DSPBPP_RGB565, TRUE, FALSE);
						break;

					// Test 60 Hz mode
					case 2:
						hzMode = 1;
						loop_ticker = 0;
						loop_ticker2 = 0;
						kmSetDisplayMode (KM_DSPMODE_NTSCNI640x480, KM_DSPBPP_RGB565, TRUE, FALSE);
						break;
				}
			}
			break;
	}
}
#endif

int demoVideo = NO;
void startupCycle()
{
#ifdef DREAMCAST
	if((hzQuit == NO) && (vidInfo.mode == KM_DSPMODE_PALNI640x480EXT))
	{
		tvModeSelectCycle();
		return;
	}
#endif

	if(SwimCheatCycle())
	{
		startupEndLoad();
		return;

	}

	startup_colour+=startup_colouradd;
	if((startup_colour==160)||(startup_colour==56))
		startup_colouradd = -startup_colouradd;

#ifndef OPSM_DEMO
  #ifdef DREAMCAST
	if(titleScreen)
  #endif
	if(loop_ticker2 >= FRAMESEC * 15
// Wait for the music to finish.
// On the Euro burn (with the language screen) it plays (INTRO, DAYTIME, so we need to check the tune)
		&& (XAData.currXA == NULL || music_playing != TUNE_1_INTRO || !XAgetStatus())
		)
	{
// Free stuff? (nah, we're okay memorywise during "startup")
		memoryShow();
		sound_XA_Stop();

		main_EnsureOverlay(VIDEO_PLAYING_OVERLAY);
		demoVideo = YES;
		video_PlayVid(MOVIENO_ATTRACT, 0);
  #ifdef DREAMCAST
		overlayLoadingEnd();
		ScreenFade(0,255,20);
  #endif
		demoVideo = NO;
		loop_ticker2 = 0;
		sound_XA_Start(TUNE_1_INTRO);
		sound_XA_Queue(TUNE_5_COOPS_D);

		return;	// So that we don't pick up on the "quit the video" keypress in the next bit of code...
	}
#endif


#ifdef DREAMCAST
	if(titleScreen)
	{
		if(pReadPad->debounce[0] & PAD_START)
		{
			titleScreen = NO;
			soundPlaySample(sfxFindSampleInAllBanks("bleepselect"),0xffff,1000);
#ifndef DEBUG
			startup_choice = 0;
			startupEnd();
#endif
		}
		return;
	}
#endif

	if(pReadPad->debounce[0] & (PAD_START | PAD_CROSS))
	{
		soundPlaySample(cardmenusfx1, cardmenusfx_vol1,cardmenusfx_pitch1);	// RFW 27th Sep. Oops
		startupEnd();
	}

#ifndef OPSM_DEMO	// Demo version only has "start"
	if(digistick_debounced & PAD_UP)
	{
		soundPlaySample(cardmenusfx2, cardmenusfx_vol2,cardmenusfx_pitch2);	// RFW 27th Sep. Oops
		startup_choice--;
		loop_ticker2 = 0;
	}
	if(digistick_debounced & PAD_DOWN)
	{
		soundPlaySample(cardmenusfx2, cardmenusfx_vol2,cardmenusfx_pitch2);	// RFW 27th Sep. Oops
		startup_choice++;
		loop_ticker2 = 0;
	}
#endif
	if(gameSaveData.blitz_games_internal)
	{
		if((signed char)startup_choice<0)
			startup_choice = 2;

		if(startup_choice>2)
			startup_choice = 0;
	}
	else
	{
		if((signed char)startup_choice<0)
			startup_choice = 1;

		if(startup_choice>1)
			startup_choice = 0;
	}

}

//#if defined (DEBUG) || defined (GAME_SHOW_DEMO)
