Esempio n. 1
0
void	VW_Startup (void)
{
	id0_int_t i;

	// Originally used for certain ASM code loops (clears direction flag)
	//asm	cld;

	videocard = NOcard/*0*/;

	for (i = 1;i < id0_argc;i++)
		// REFKEEN - Add new /SWMOUSE argument from the 2015 port
		switch (US_CheckParm(id0_argv[i],ParmStrings))
		{
		case 0:
			videocard = EGAcard;
			break;
		case 1:
			if (refkeen_current_gamever == BE_GAMEVER_KDREAMS2015)
				BE_ST_HostGfx_SetAbsMouseCursorToggle(false);
			break;
		}
#if 0
		if (US_CheckParm(id0_argv[i],ParmStrings) == 0)
		{
			videocard = EGAcard;
			break;
		}
#endif

	if (!videocard)
		videocard = VW_VideoID ();

	if (GRMODE == EGAGR)
	{
		grmode = EGAGR;
		if (videocard != EGAcard && videocard != VGAcard)
	Quit ("Improper video card!  If you really have an EGA/VGA card that I am not \n"
		  "detecting, use the -HIDDENCARD command line parameter!");
		EGAWRITEMODE(0);
	}
	else if (GRMODE == CGAGR)
	{
		grmode = CGAGR;
		if (videocard < CGAcard || videocard > VGAcard)
	Quit ("Improper video card!  If you really have a CGA card that I am not \n"
		  "detecting, use the -HIDDENCARD command line parameter!");
		MM_GetPtr ((memptr *)&screenseg,0x10000l);	// grab 64k for floating screen
	}

	cursorvisible = 0;
}
Esempio n. 2
0
void US_Startup(void)
{
	// Initialize the random number generator (to the current time).
	US_InitRndT(true);

	// Load configuration file
	US_LoadConfig();

	// Check command line args.
	for (int i = 1; i < us_argc; ++i)
	{
		int parmIdx = US_CheckParm(us_argv[i], us_parmStrings);
		switch (parmIdx)
		{
		case 0:
			us_tedLevelNumber = atoi(us_argv[i + 1]);
			if (us_tedLevelNumber > -1)
				us_tedLevel = true;
			break;
		case 1:
			us_noWait = true;
			break;
		}
	}
	us_started = true;

}
Esempio n. 3
0
///////////////////////////////////////////////////////////////////////////
//
//      US_TextScreen() - Puts up the startup text screen
//      Note: These are the only User Manager functions that can be safely called
//              before the User Mgr has been started up
//
///////////////////////////////////////////////////////////////////////////
void
US_TextScreen(void)
{
	word    i,n;

	USL_ClearTextScreen();

	_fmemcpy(MK_FP(0xb800,0),7 + &introscn,80 * 25 * 2);

	// Check for TED launching here
	for (i = 1;i < _argc;i++)
	{
		n = US_CheckParm(_argv[i],ParmStrings);
		if (n == 0)
		{
			tedlevelnum = atoi(_argv[i + 1]);
			if (tedlevelnum >= 0)
			{
				tedlevel = true;
				return;
			}
			else
				break;
		}
		else if (n == 1)
		{
			NoWait = true;
			return;
		}
	}
}
Esempio n. 4
0
///////////////////////////////////////////////////////////////////////////
//
//      US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
{
	int     i;

	if (US_Started)
		return;

	harderr(USL_HardError); // Install the fatal error handler

	US_InitRndT(true);              // Initialize the random number generator

	USL_ReadConfig();               // Read config file

	for (i = 1;i < _argc;i++)
	{
		switch (US_CheckParm(_argv[i],ParmStrings2))
		{
		case 0:
			if (grmode == EGAGR)
				compatability = true;
			break;
		case 1:
			compatability = false;
			break;
		}
	}

	US_Started = true;
}
Esempio n. 5
0
///////////////////////////////////////////////////////////////////////////
//
//	US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
{
	int	i,n;

	if (US_Started)
		return;

	harderr(USL_HardError);	// Install the fatal error handler

	US_InitRndT(true);		// Initialize the random number generator

	for (i = 1;i < _argc;i++)
	{
		switch (US_CheckParm(_argv[i],ParmStrings2))
		{
		case 0:
			compatability = true;
			break;
		case 1:
			compatability = false;
			break;
		}
	}

	// Check for TED launching here
	for (i = 1;i < _argc;i++)
	{
		n = US_CheckParm(_argv[i],ParmStrings);
		switch(n)
		{
		 case 0:
		   tedlevelnum = atoi(_argv[i + 1]);
		   if (tedlevelnum >= 0)
		     tedlevel = true;
		   break;

		 case 1:
		   NoWait = true;
		   break;
		}
	}

	US_Started = true;
}
Esempio n. 6
0
void
jabhack(void)
{
extern void id0_far jabhack2(void);
extern id0_int_t id0_far	CheckIs386(void);

	id0_int_t	i;

	oldintaddr = getvect(MyInterrupt);

	for (i = 1;i < _argc;i++)
		if (US_CheckParm(_argv[i],JHParmStrings) == 0)
			return;

	if (CheckIs386())
	{
		jabhack2();
		setvect(MyInterrupt,intaddr);
	}
}
Esempio n. 7
0
void	VW_Startup (void)
{
	id0_int_t i;

	// Originally used for certain ASM code loops (clears direction flag)
	//asm	cld;

	videocard = NOcard/*0*/;

	for (i = 1;i < id0_argc;i++)
		if (US_CheckParm(id0_argv[i],ParmStrings) == 0)
		{
			videocard = EGAcard;
			break;
		}

	if (!videocard)
		videocard = VW_VideoID ();

#if GRMODE == EGAGR
	grmode = EGAGR;
	if (videocard != EGAcard && videocard != VGAcard)
Quit ("Improper video card!  If you really have an EGA/VGA card that I am not \n"
	  "detecting, use the -HIDDENCARD command line parameter!");
	EGAWRITEMODE(0);
#endif

#if GRMODE == CGAGR
	grmode = CGAGR;
	if (videocard < CGAcard || videocard > VGAcard)
Quit ("Improper video card!  If you really have a CGA card that I am not \n"
	  "detecting, use the -HIDDENCARD command line parameter!");
	MM_GetPtr ((memptr *)&screenseg,0x10000l);	// grab 64k for floating screen
#endif

	cursorvisible = 0;
}
Esempio n. 8
0
void	DemoLoop (void)
{
	id0_int_t	i,level;

//
// check for launch from ted
//
	if (tedlevel)
	{
		NewGame();
		gamestate.mapon = tedlevelnum;
		restartgame = gd_Normal;
		for (i = 1;i < id0_argc;i++)
		{
			if ( (level = US_CheckParm(id0_argv[i],ParmStrings)) == -1)
				continue;

			// REFKEEN - Cast for C++
			restartgame = (GameDiff)(gd_Easy+level);
			break;
		}
		GameLoop();
		TEDDeath();
	}


//
// main game cycle
//
	displayofs = bufferofs = 0;
	VW_Bar (0,0,320,200,0);

	while (1)
	{
		CA_CacheGrChunk (TITLEPIC);
		bufferofs = SCREEN2START;
		displayofs = SCREEN1START;
		VWB_DrawPic (0,0,TITLEPIC);
		MM_SetPurge (&grsegs[TITLEPIC],3);
		UNMARKGRCHUNK(TITLEPIC);
		FizzleFade (bufferofs,displayofs,320,200,true);

		if (!IN_UserInput(TickBase*3,false))
		{
			CA_CacheGrChunk (CREDITSPIC);
			VWB_DrawPic (0,0,CREDITSPIC);
			MM_SetPurge (&grsegs[CREDITSPIC],3);
			UNMARKGRCHUNK(CREDITSPIC);
			FizzleFade (bufferofs,displayofs,320,200,true);

		}

		if (!IN_UserInput(TickBase*3,false))
		{
highscores:
			DrawHighScores ();
			FizzleFade (bufferofs,displayofs,320,200,true);
			IN_UserInput(TickBase*3,false);
		}

		if (IN_IsUserInput())
		{
			US_ControlPanel ();

			if (restartgame || loadedgame)
			{
				GameLoop ();
				goto highscores;
			}
		}

	}
}
Esempio n. 9
0
// The original starting point of the game EXE
void kdreams_exe_main (void)
{
#if (!defined REFKEEN_VER_KDREAMS_CGA_ALL) || (!defined CATALOG)
	id0_boolean_t LaunchedFromShell = false;
	id0_short_t i;
#endif



#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
	BE_ST_textcolor(7);
	BE_ST_textbackground(0);

	if (BE_Cross_strcasecmp(id0_argv[1], "/VER") == 0)
	{
		BE_ST_printf("KEEN DREAMS\n");
		BE_ST_printf("CGA Version\n");
		BE_ST_printf("Copyright 1991-93 Softdisk Publishing\n");
		BE_ST_printf("Version 1.05 (rev 1)\n");
		BE_ST_HandleExit(0);
	}

	if (BE_Cross_strcasecmp(id0_argv[1], "/?") == 0)
	{
		BE_ST_printf("\nKeen Dreams CGA version 1.05\n");
		BE_ST_printf("Copyright 1991-1993 Softdisk Publishing.\n\n");
		BE_ST_printf("Commander Keen is a trademark of Id Software.\n");
		BE_ST_printf("Type KDREAMS from the DOS prompt to run.\n\n");
		BE_ST_printf("KDREAMS /COMP for SVGA compatibility mode\n");
		BE_ST_printf("KDREAMS /NODR stops program hang with the drive still on\n");
		BE_ST_printf("KDREAMS /NOAL disables AdLib and Sound Blaster detection\n");
		BE_ST_printf("KDREAMS /NOSB disables Sound Blaster detection\n");
		BE_ST_printf("KDREAMS /NOJOYS ignores joystick\n");
		BE_ST_printf("KDREAMS /NOMOUSE ignores mouse\n");
		BE_ST_printf("KDREAMS /HIDDENCARD overrides video card detection\n");
		BE_ST_printf("KDREAMS /VER  for version and compatibility information\n");
		BE_ST_printf("KDREAMS /? for this help information\n");
		BE_ST_HandleExit(0);
	}
#endif // VERSION


	// REFKEEN - The code is also in CGA v1.05 but LaunchedFromShell is ignored (while CATALOG is defined)...
#if (!defined REFKEEN_VER_KDREAMS_CGA_ALL) || (!defined CATALOG)
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
	{
		for (i = 1;i < id0_argc;i++)
		{
			switch (US_CheckParm(id0_argv[i],EntryParmStrings))
			{
			case 0:
				LaunchedFromShell = true;
				break;
			}
		}
	}
#endif



#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE193)
	{
		if (BE_Cross_strcasecmp(id0_argv[1], "/VER") == 0)
		{
			BE_ST_printf("\nKeen Dreams version 1.93  (Rev 1)\n");
			BE_ST_printf("developed for use with 100%% IBM compatibles\n");
			BE_ST_printf("that have 640K memory, DOS version 3.3 or later,\n");
			BE_ST_printf("and an EGA or VGA display adapter.\n");
			BE_ST_printf("Copyright 1991-1993 Softdisk Publishing.\n");
			BE_ST_printf("Commander Keen is a trademark of Id Software.\n");
			BE_ST_HandleExit(0);
		}

		if (BE_Cross_strcasecmp(id0_argv[1], "/?") == 0)
		{
			BE_ST_printf("\nKeen Dreams version 1.93\n");
			BE_ST_printf("Copyright 1991-1993 Softdisk Publishing.\n\n");
			BE_ST_printf("Commander Keen is a trademark of Id Software.\n");
			BE_ST_printf("Type KDREAMS from the DOS prompt to run.\n\n");
			BE_ST_printf("KDREAMS /COMP for SVGA compatibility mode\n");
			BE_ST_printf("KDREAMS /NODR stops program hang with the drive still on\n");
			BE_ST_printf("KDREAMS /NOAL disables AdLib and Sound Blaster detection\n");
			BE_ST_printf("KDREAMS /NOSB disables Sound Blaster detection\n");
			BE_ST_printf("KDREAMS /NOJOYS ignores joystick\n");
			BE_ST_printf("KDREAMS /NOMOUSE ignores mouse\n");
			BE_ST_printf("KDREAMS /HIDDENCARD overrides video card detection\n");
			BE_ST_printf("KDREAMS /VER  for version and compatibility information\n");
			BE_ST_printf("KDREAMS /? for this help information\n");
			BE_ST_HandleExit(0);
		}
	}
#endif // VERSION


#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE120)
	{
		for (i = 1;i < id0_argc;i++)
		{
			switch (US_CheckParm(id0_argv[i],EntryParmStrings))
			{
			case 0:
				LaunchedFromShell = true;
				break;
			}
			if (BE_Cross_strcasecmp(id0_argv[i], "/VER") == 0)
			{
				BE_ST_printf("\nKeen Dreams Shareware Version 1.20  (Rev 1)\n");
				BE_ST_printf("developed for use with 100%% IBM compatibles\n");
				BE_ST_printf("that have 640K memory, DOS version 3.3 or later,\n");
				BE_ST_printf("and an EGA or VGA display adapter.\n");
				BE_ST_printf("Copyright 1991-1993 Softdisk Publishing.\n");
				BE_ST_printf("Commander Keen is a trademark of Id Software.\n");
				BE_ST_HandleExit(0);
			}

			if (BE_Cross_strcasecmp(id0_argv[i], "/?") == 0)
			{
				BE_ST_printf("\nKeen Dreams Shareware Version 1.20\n");
				BE_ST_printf("Copyright 1991-1993 Softdisk Publishing.\n\n");
				BE_ST_printf("Commander Keen is a trademark of Id Software.\n");
				BE_ST_printf("Type KDREAMS from the DOS prompt to run.\n\n");
				BE_ST_printf("KDREAMS /COMP for SVGA compatibility mode\n");
				BE_ST_printf("KDREAMS /NODR stops program hang with the drive still on\n");
				BE_ST_printf("KDREAMS /NOAL disables AdLib and Sound Blaster detection\n");
				BE_ST_printf("KDREAMS /NOSB disables Sound Blaster detection\n");
				BE_ST_printf("KDREAMS /NOJOYS ignores joystick\n");
				BE_ST_printf("KDREAMS /NOMOUSE ignores mouse\n");
				BE_ST_printf("KDREAMS /HIDDENCARD overrides video card detection\n");
				BE_ST_printf("KDREAMS /VER  for version and compatibility information\n");
				BE_ST_printf("KDREAMS /? for this help information\n");
				BE_ST_HandleExit(0);
			}
		}
	}
#endif


#if (!defined REFKEEN_VER_KDREAMS_CGA_ALL) || (!defined CATALOG)
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if ((refkeen_current_gamever == BE_GAMEVER_KDREAMSE113) || (refkeen_current_gamever == BE_GAMEVER_KDREAMSE120))
#endif
	{
		// REFKEEN difference from vanilla Keen Dreams (Shareware releases):
		// Role of /DETOUR has been flipped. No need to pass it (or use START),
		// but if /DETOUR is added then you get this message.
		if (LaunchedFromShell)
		//if (!LaunchedFromShell)
		{
			BE_ST_clrscr();
			BE_ST_puts("You must type START at the DOS prompt to run KEEN DREAMS.");
			BE_ST_HandleExit(0);
		}
	}
#endif


#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever != BE_GAMEVER_KDREAMSE113)
	{
		BE_ST_textcolor(7);
		BE_ST_textbackground(0);
	}
#endif



	InitGame();

	DemoLoop();                                     // DemoLoop calls Quit when everything is done
	Quit("Demo loop exited???");
}
Esempio n. 10
0
// The original starting point of the game EXE
void apocgame_exe_main (void)
{
	id0_short_t i;

	starting_level = 0;

	for (i = 1;i < id0_argc;i++)
	{
		switch (US_CheckParm(id0_argv[i],MainParmStrings))
		{
			case 0:
				Flags |= FL_QUICK;
			break;

			case 1:
				starting_level = atoi(id0_argv[i]+1);
				if ((starting_level < 0) || (starting_level > LASTMAP-1))
					starting_level = 0;
			break;

			case 2:
				BE_ST_printf("%s\n", GAMENAME);
				BE_ST_printf("Copyright 1992-93 Softdisk Publishing\n");
				BE_ST_printf("%s %s\n",VERSION,REVISION);
				BE_ST_printf("\n");
				BE_ST_HandleExit(0);
			break;

			case 3:
				Flags |= FL_NOMEMCHECK;
			break;

			case 4:
				Flags |= (FL_HELPTEST|FL_QUICK);
			break;

		}
	}

	// REFKEEN difference from vanilla Catacomb Adventures:
	// Role of ^(a@&r` for game EXE has been flipped. No need to pass it
	// (or use start/intro EXE), but if ^(a@&r` is added then you may get some message.
	if (!BE_Cross_strcasecmp(id0_argv[1], "^(a@&r`"))
	//if (BE_Cross_strcasecmp(id0_argv[1], "^(a@&r`"))
		Quit("You must type CATAPOC to run CATACOMB APOCALYPSE\n");


#if 0
	MainHelpText.xl = 0;
	MainHelpText.yl = 0;
	MainHelpText.xh = 639;
	MainHelpText.yh = 199;
	MainHelpText.bgcolor = 7;
	MainHelpText.ltcolor = 15;
	MainHelpText.dkcolor = 8;
#endif

//	jabhack();

	BE_Cross_Brandomize();

	// REFKEEN - Alternative controllers support
	extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback;
	BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback);

	InitGame ();
//	CheckMemory ();
	LoadLatchMem ();

//	if (!LoadTextFile("MAINHELP."EXT,&MainHelpText))
//		Quit("Can't load MAINHELP."EXT);

#ifdef PROFILE
	NewGame ();
	GameLoop ();
#endif

	DemoLoop();
	Quit(NULL);
}
Esempio n. 11
0
// The original starting point of the game EXE
void abysgame_exe_main (void)
{
	id0_short_t i;

	starting_level = 0;

	for (i = 1;i < id0_argc;i++)
	{
		switch (US_CheckParm(id0_argv[i],MainParmStrings))
		{
			case 0:
				Flags |= FL_QUICK;
			break;

			case 1:
				starting_level = atoi(id0_argv[i]+1);
				if ((starting_level < 0) || (starting_level > LASTMAP-1))
					starting_level = 0;
			break;

			case 2:
				if (refkeen_current_gamever == BE_GAMEVER_CATABYSS113)
				{
					BE_ST_printf("%s   %s   %s\n",GAMENAME,VERSION,REVISION);
				}
				else
				{
					BE_ST_printf("%s  %s  rev %s\n",GAMENAME,VERSION,REVISION);
				}
				BE_ST_HandleExit(0);
			break;

			case 3:
				Flags |= FL_NOMEMCHECK;
			break;
		}
	}

	if (!BE_Cross_strcasecmp(id0_argv[1], "^(a@&r`"))
			LaunchedFromShell = true;

	// REFKEEN difference from vanilla Catacomb Adventures:
	// Role of ^(a@&r` for game EXE has been flipped. No need to pass it
	// (or use start/intro EXE), but if ^(a@&r` is added then you may get some message.
	if (LaunchedFromShell)
	//if (!LaunchedFromShell)
	{
		BE_ST_clrscr();
		if (refkeen_current_gamever == BE_GAMEVER_CATABYSS113)
		{
			BE_ST_puts("You must type START at the DOS prompt to run CATACOMB ABYSS.");
		}
		else
		{
			BE_ST_puts("You must type CATABYSS at the DOS prompt to run CATACOMB ABYSS 3-D.");
		}
		BE_ST_HandleExit(0);
	}

	BE_Cross_Brandomize();

	// REFKEEN - Alternative controllers support
	extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback;
	BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback);

	InitGame ();
	LoadLatchMem ();

#ifdef PROFILE
	NewGame ();
	GameLoop ();
#endif

	DemoLoop();
	Quit(NULL);
}
Esempio n. 12
0
//------------------------------------------------------------------------
// PreDemo()
//------------------------------------------------------------------------
void PreDemo()
{
#if !SKIP_TITLE_AND_CREDITS
#if TECH_SUPPORT_VERSION

	fontnumber=4;
	SETFONTCOLOR(0,15*3);
	CenterWindow (26,7);
	US_Print(EnterBetaCode);
	VW_UpdateScreen();
	CA_LoadAllSounds();
	PM_CheckMainMem();
	SD_PlaySound(INFORMDEATH2SND);		// Nooooo!
	IN_UserInput(TickBase*20);
	ClearMemory();

#elif BETA_TEST

	boolean param=false;

	for (i=1; i<g_argc; i++)
		switch (US_CheckParm(g_argv[i],MainStrs))
		{
			case 13:
				param=true;
			break;
		}

	if (!param)
	{
		char buffer[15] = {0};

		fontnumber=4;
		CenterWindow (26,7);
		US_Print(EnterBetaCode);
		VW_UpdateScreen();
		SETFONTCOLOR(0,15*3);
		US_LineInput(24*8,92,buffer,buffer,true,14,100);
		if (_fstricmp(buffer,bc_buffer))
			Quit("Bad beta code!");
	}
#endif



#if GAME_VERSION == SHAREWARE_VERSION
#if IN_DEVELOPMENT || GEORGE_CHEAT
	if (!MS_CheckParm("nochex"))
#endif
	{
#if  (!SKIP_CHECKSUMS)
//	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM,"LEVELS");
	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM);
#endif
	}
#else
#if  (!SKIP_CHECKSUMS)
	if (ChecksumFile("FILE_ID.DIZ",0) != DIZFILE_CHECKSUM)
		gamestate.flags |= GS_BAD_DIZ_FILE;
#endif
#endif

	VL_SetPaletteIntensity(0,255,vgapal,0);

	if (!(gamestate.flags & GS_NOWAIT))
	{
#if (0)				// GAME_VERSION != SHAREWARE_VERSION
//---------------------
// Anti-piracy screen
//---------------------
	// Cache pic
	//
		CA_CacheScreen(PIRACYPIC);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(PIRACYPALETTE);
		VL_SetPalette (0,256,grsegs[PIRACYPALETTE]);
		VL_SetPaletteIntensity(0,255,grsegs[PIRACYPALETTE],0);
		VW_UpdateScreen();

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VL_FadeIn(0,255,grsegs[PIRACYPALETTE],30);

	// Wait a little
	//
		IN_UserInput(TickBase*20);

	// Free palette
	//
		UNCACHEGRCHUNK(PIRACYPALETTE);

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VW_FadeOut();

	// Cleanup screen for upcoming SetPalette call
	//
		{
		Uint16 old_bufferofs=bufferofs;

		bufferofs=displayofs;
		VL_Bar(0,0,320,200,0);
		bufferofs=old_bufferofs;
		}
#endif

//---------------------
// Apogee presents
//---------------------
        // ISG --> this fixes intro timing
        IN_UserInput(TickBase*1);
        
	// Cache pic
	//
		CA_CacheScreen(APOGEEPIC);

	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+APOGFNFM_MUS);

        ::SD_StartMusic(APOGFNFM_MUS);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(APOGEEPALETTE);
		VL_SetPalette (0,256,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]));
		VL_SetPaletteIntensity(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),0);
		VW_UpdateScreen();
    
		VL_FadeOut (0, 255, 25, 29, 53, 20);
		VL_FadeIn(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),30);

	// Wait for end of fanfare
	//
		if (MusicMode==smm_AdLib)
		{
			IN_StartAck();
			while ((!sqPlayedOnce) && (!IN_CheckAck()));
      }
		else
			IN_UserInput(TickBase*6);

		SD_MusicOff();

	// Free palette and music.  AND  Restore palette
	//
		UNCACHEGRCHUNK(APOGEEPALETTE);

        delete [] audiosegs[STARTMUSIC + APOGFNFM_MUS];
        audiosegs[STARTMUSIC + APOGFNFM_MUS] = NULL;

      // Do A Blue Flash!

      VL_FadeOut (0, 255, 25, 29, 53, 20);
      VL_FadeOut (0, 255, 0, 	0,  0,  30);

//---------------------
// JAM logo intro
//---------------------
	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
        ::SD_StartMusic(TITLE_LOOP_MUSIC);

	// Show JAM logo
	//
		if (!DoMovie(mv_intro,0))
			MAIN_ERROR(PREDEMO_NOJAM);

		if (PowerBall)
      {
      	Sint16 i;

			for (i=0;i<60 && (!DebugOk);i++)
   	   {
      		VL_WaitVBL(1);

            // BBi
            ::in_handle_events();

				if (Keyboard[sc_left_shift] && Keyboard[sc_right_shift])
		      {
					CA_LoadAllSounds();

					SD_MusicOff();

                   ::sd_play_player_sound(SHOOTDOORSND, bstone::AC_ITEM);

		         SD_WaitSoundDone();

				   ClearMemory();
		      	DebugOk = 1;

					CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
                    ::SD_StartMusic(TITLE_LOOP_MUSIC);
      		}
         }
      }

//---------------------
// PC-13
//---------------------
		VL_Bar(0,0,320,200,0x14);
		CacheDrawPic(0,64,PC13PIC);
		VW_UpdateScreen();
		VW_FadeIn();
		IN_UserInput(TickBase*2);

      // Do A Red Flash!

      VL_FadeOut (0, 255, 39, 0, 0, 20);
		VW_FadeOut();
	}
#endif // SKIP_TITLE_AND_CREDITS
}