Exemplo n.º 1
0
void Quit (const id0_char_t *error)
{
  ShutdownId ();
  if (error && *error)
  {
	BE_ST_clrscr();
	BE_ST_puts(error);
	BE_ST_puts("\n");
#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
//      BE_ST_puts("For techinical assistance with running this software, type HELP at");
//      BE_ST_puts("    the DOS prompt or call Softdisk Publishing at 1-318-221-8311");
#else
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
	{
		BE_ST_puts("For techinical assistance with running this software, type HELP at");
		BE_ST_puts("    the DOS prompt or call Gamer's Edge at 1-318-221-8311");
	}
#endif
	// No additional lines for later versions (registered v1.93, shareware v1.20)
	BE_ST_HandleExit(1);
  }

// TODO (REFKEEN) Maybe we can define CATALOG based on version?
#if (!defined REFKEEN_VER_KDREAMS_CGA_ALL) || (!defined CATALOG)
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
	{
		id0_argc = 2;
		id0_argv[1] = "LAST.SHL";
		id0_argv[2] = "ENDSCN.SCN";
		id0_argv[3] = NULL;

		//if (execv("LOADSCN.EXE", _argv) == -1)
		//	Quit("Couldn't find executable LOADSCN.EXE.\n");
		void loadscn2_main(int argc, const char **argv);
		loadscn2_main(id0_argc+1, id0_argv);
	}
#endif

#if (defined REFKEEN_VER_KDREAMS_CGA_ALL) && (defined CATALOG)
	VW_SetScreenMode(TEXTGR);
	BE_ST_HandleExit(0);
#endif

// For all other versions (registered v1.93, shareware v1.20), just exit
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
	if (refkeen_current_gamever != BE_GAMEVER_KDREAMSE113)
	{
		BE_ST_HandleExit(0);
	}
#endif

}
Exemplo n.º 2
0
void Quit (const id0_char_t *error)
{
	void *finscreen;
	//id0_unsigned_t	finscreen;

	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		if (!error)
		{
			CA_SetAllPurge ();
			CA_CacheGrChunk (PIRACY);
			finscreen = grsegs[PIRACY];
			//finscreen = (id0_unsigned_t)grsegs[PIRACY];
		}
	}

	ShutdownId ();
	if (error && *error)
	{
	  BE_ST_puts(error);
	  BE_ST_HandleExit(1);
	}

	if (refkeen_current_gamever == BE_GAMEVER_CAT3D100)
	{
		if (!NoWait)
		{
			// REFKEEN - Alternative controllers support
			extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback;
			BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback);

			memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
			//movedata (finscreen,0,0xb800,0,4000);
			BE_ST_BiosScanCode (0);
			BE_ST_clrscr();
		}
	}

	BE_ST_HandleExit(0);
}
void InitGame()
{
    MM_Startup();

    id0_int_t i;

/*#if 0
    // Handle piracy screen...
    //
    movedata(FP_SEG(PIRACY),(id0_unsigned_t)PIRACY,0xb800,displayofs,4000);
    while (BE_ST_BiosScanCode(0) != sc_Return);
    //while ((bioskey(0)>>8) != sc_Return);
#endif*/

#if GRMODE == EGAGR
    if (mminfo.mainmem < 335l*1024)
    {
//#pragma warn    -pro
//#pragma warn    -nod
#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
        BE_ST_textcolor(7);
#endif
#ifndef REFKEEN_VER_KDREAMS_CGA_ALL
        if (refkeen_current_gamever == BE_GAMEVER_KDREAMSE113)
#endif
        {
            BE_ST_textbackground(0);
        }
//#pragma warn    +nod
//#pragma warn    +pro
        BE_ST_clrscr();                       // we can't include CONIO because of a name conflict
//#pragma warn    +nod
//#pragma warn    +pro
        BE_ST_puts ("There is not enough memory available to play the game reliably.  You can");
        BE_ST_puts ("play anyway, but an out of memory condition will eventually pop up.  The");
        BE_ST_puts ("correct solution is to unload some TSRs or rename your CONFIG.SYS and");
        BE_ST_puts ("AUTOEXEC.BAT to free up more memory.\n");
        BE_ST_puts ("Do you want to (Q)uit, or (C)ontinue?");
        //i = bioskey (0);
        //if ( (i>>8) != sc_C)
        i = BE_ST_BiosScanCode (0);
        if (i != sc_C)
            Quit ("");
    }
#endif

    US_TextScreen();

    VW_Startup ();
    RF_Startup ();
    IN_Startup ();
    SD_Startup ();
    US_Startup ();

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
    US_UpdateTextScreen();
#endif

    CA_Startup ();
    US_Setup ();

//
// load in and lock down some basic chunks
//

    CA_ClearMarks ();

    CA_MarkGrChunk(STARTFONT);
    CA_MarkGrChunk(STARTFONTM);
    CA_MarkGrChunk(STARTTILE8);
    CA_MarkGrChunk(STARTTILE8M);
    for ( id0_int_t j=KEEN_LUMP_START ; j<=KEEN_LUMP_END ; j++)
    {
        CA_MarkGrChunk(j);
    }

#ifdef REFKEEN_VER_KDREAMS_CGA_ALL
    CA_CacheMarks (NULL);
#elif defined REFKEEN_VER_KDREAMS_ANYEGA_ALL
    CA_CacheMarks (NULL, 0);
#endif

    MM_SetLock (&grsegs[STARTFONT],true);
    MM_SetLock (&grsegs[STARTFONTM],true);
    MM_SetLock (&grsegs[STARTTILE8],true);
    MM_SetLock (&grsegs[STARTTILE8M],true);
    for ( id0_int_t j=KEEN_LUMP_START ; j<=KEEN_LUMP_END ; j++)
    {
        MM_SetLock (&grsegs[j],true);
    }

    setupAudio();

    fontcolor = WHITE;

    RefKeen_FillObjStatesWithDOSPointers(); // Saved games compatibility

    US_FinishTextScreen();
}
Exemplo n.º 4
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???");
}
Exemplo n.º 5
0
static void show_command_line_help()
{
	char gameverstrbuffer[80] = "";
	char *gameverstrptr = gameverstrbuffer, *gameverstrend = gameverstrbuffer + sizeof(gameverstrbuffer);
	for (int gameVerVal = 0; gameVerVal < BE_GAMEVER_LAST; ++gameVerVal)
	{
		if (gameVerVal < BE_GAMEVER_LAST-1)
			gameverstrptr = BE_Cross_safeandfastcstringcopy_2strs(gameverstrptr, gameverstrend, refkeen_gamever_strs[gameVerVal], ", ");
		else
			gameverstrptr = BE_Cross_safeandfastcstringcopy(gameverstrptr, gameverstrend, refkeen_gamever_strs[gameVerVal]);
	}

	// HACK - For text mode emulation (and exit handler)
	BE_ST_PrepareForGameStartupWithoutAudio();

	BE_ST_puts("*** " REFKEEN_TITLE_AND_VER_STRING " - Command line arguments ***");
	BE_ST_puts("");
#ifdef REFKEEN_ENABLE_LAUNCHER
	BE_ST_puts("Launcher is started unless any command line argument is passed.");
	BE_ST_puts("");
#endif
	BE_ST_puts("List of possible command line arguments:");
	BE_ST_puts("-gamever <VER>: Select game version supported by this executable.");
#ifdef REFKEEN_VER_CATADVENTURES
	BE_ST_puts("-skipintro: Skip what is found in the original intro EXE and start game.");
#ifdef REFKEEN_VER_CATABYSS
	BE_ST_puts("-showslides: Show the electronic catalog / hint book.");
#else
	BE_ST_puts("-showslides: Show the hint book.");
#endif
#endif
	BE_ST_puts("-passorigargs <...>: Pass all following arguments to the original game port.");
	BE_ST_puts("-datadir <...>: Specify an alternative path for game data (separated by ver.).");
	BE_ST_puts("-cfgdir <...>: Specify an alternative path for new cfg files (not old CONFIG).");
#ifdef REFKEEN_ENABLE_LAUNCHER
	BE_ST_puts("-fulllauncher: Show a fullscreen launcher window.");
	BE_ST_puts("-softlauncher: Show a software-rendered launcher window (not fullscreen).");
#endif
	BE_ST_puts("");
	BE_ST_puts("Note: The path passed to -datadir or -cfgdir is assumed to exist.");
	BE_ST_puts("");
	BE_ST_puts("Supported game versions:");
	BE_ST_printf("%s\n", gameverstrbuffer);
	BE_ST_HandleExit(0);
}
Exemplo n.º 6
0
void Quit (const id0_char_t *error, ...)
{
	id0_short_t exit_code=0;
#ifndef CATALOG
	void *finscreen;
	//id0_unsigned_t	finscreen;
#endif

	va_list ap;

	va_start(ap,error);

#ifndef CATALOG
	if (!error)
	{
		CA_SetAllPurge ();
		CA_CacheGrChunk (PIRACY);
		finscreen = grsegs[PIRACY];
		//finscreen = (id0_unsigned_t)grsegs[PIRACY];
	}
#endif

	ShutdownId ();

	if (error && *error)
	{
		BE_ST_vprintf(error,ap);
		exit_code = 1;
	}
#ifndef CATALOG
	else
	if (!NoWait)
	{
		memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
		BE_ST_MarkGfxForUpdate();
		//movedata (finscreen,0,0xb800,0,4000);
		BE_ST_BiosScanCode(0);
	}
#endif

	va_end(ap);

#ifndef CATALOG
	if (!error)
	{
		id0_argc = 2;
		id0_argv[1] = "LAST.SHL";
		id0_argv[2] = "ENDSCN.SCN";
		id0_argv[3] = NULL;
#if 0
		if (execv("LOADSCN.EXE", id0_argv) == -1)
		{
			BE_ST_clrscr();
			BE_ST_puts("Couldn't find executable LOADSCN.EXE.\n");
			BE_ST_HandleExit(1);
		}
#endif
		void loadscn_exe_main(void);
		BE_Cross_Bexecv(loadscn_exe_main, id0_argv, NULL, false);
	}
#endif

	BE_ST_HandleExit(exit_code);
}
Exemplo n.º 7
0
void Quit (const id0_char_t *error, ...)
{
	id0_short_t exit_code=0;
	void *finscreen;
	//id0_unsigned_t	finscreen;

	va_list ap;

	va_start(ap,error);

	if (!error)
	{
		CA_SetAllPurge ();
		if (!refkeen_compat_c4_main_def_catalog)
		{
			CA_CacheGrChunk (PIRACY);
			finscreen = grsegs[PIRACY];
			//finscreen = (id0_unsigned_t)grsegs[PIRACY];
		}
	}
	ShutdownId ();

	if (error && *error)
	{
		BE_ST_vprintf(error,ap);
		exit_code = 1;
	}

	else if (!refkeen_compat_c4_main_def_catalog)
	{
		if ((refkeen_current_gamever == BE_GAMEVER_CATABYSS124) || !NoWait)
		{
			memcpy(BE_ST_GetTextModeMemoryPtr(), finscreen, 4000);
			BE_ST_MarkGfxForUpdate();
			//movedata (finscreen,0,0xb800,0,4000);
			if (refkeen_current_gamever == BE_GAMEVER_CATABYSS124)
			{
				if (BE_ST_KbHit())
				{
					while (BE_ST_KbHit())
						BE_ST_BiosScanCode(0);
				}
			}
			BE_ST_BiosScanCode(0);
		}
	}

	va_end(ap);

	if (!refkeen_compat_c4_main_def_catalog)
	{
		if (!error)
		{

			id0_argc = 2;
			id0_argv[1] = "LAST.SHL";
			id0_argv[2] = "ENDSCN.SCN";
			id0_argv[3] = NULL;
	#if 0
			if (execv("LOADSCN.EXE", id0_argv) == -1)
			{
				BE_ST_clrscr();
				BE_ST_puts("Couldn't find executable LOADSCN.EXE.\n");
				BE_ST_HandleExit(1);
			}
	#endif
			void loadscn_exe_main(void);
			BE_Cross_Bexecv(loadscn_exe_main, id0_argv, NULL, false);
		}
	}

	BE_ST_HandleExit(exit_code);
}
Exemplo n.º 8
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);
}