Exemplo n.º 1
0
void Usage()
	{
	Credits();
	fprintf(stderr,
"\n"
"Usage:\n"
"    pals -target <fastafile> -query <fastafile>\n"
"    pals -self <fastafile>\n"
"\n"
"Options:\n"
"    -out <outfile>       (default standard output)\n"
"    -fwdonly             don't align reverse strand\n"
"    -filterout <file>    save filter hits to file\n"
"\n"
"Alignment parameters can be specified in three ways:\n"
"    (1) Defaults         -length 400 -pctid 94\n"
"    (2) Specify -length <minhitlength> -pctid <minhitid>\n"
"    (3) Specify all filter and d.p. parameters:\n"
"           -wordsize     Filter word size\n"
"           -seedlength   Seed hit length\n"
"           -seeddiffs    Max #diffs in seed hit\n"
"           -length       Min length of final hit\n"
"           -pctid        Min %%id of final hit\n"
"           -tubeoffset   (Optional)\n"
"\n"
"For further information, please see the User Guide.\n");
	}
Exemplo n.º 2
0
//Processes Main Menu
void MainMenu()
{
    u8 Done=_FALSE;

    DrawBG(7);
    if (DBUG==_FALSE)
    {
        echo_wait_sfx(SFX_09);  //"Ultra Air Hockey!"
        echo_wait_sfx(SFX_08);  //Siren
    }

    Trig=PTRUE;
    //Loop until Done is PTRUE
    while (Done==_FALSE)
    {

        echo_play_bgm(BGM_02);              //Play HockeyFever (Loop)
        InitMenu(1,0,0,4,PTRUE);            //Init menu to 3 items
        JOY_setEventHandler(&BtnHMenu);   //Set appropriate button handler

        //While nothing is selected
        while (SItem==0)
        {
            VDP_waitVSync();
            //If a dir key was pressed, update the background to reflect highlighted choice
            if (Trig==PTRUE)
            {
                DrawBG(10+HItem);
            }
        }

        //Process the selected item
        switch (SItem)
        {
            //Play
            case 1:
                VDP_fadeOutAll(100,_FALSE);
                ChrselMenu();   //Do Char selection menu
                Done=PTRUE;
                break;

            //Options
            case 2:
                echo_wait_sfx(SFX_11);      //"Options"
                VDP_fadeOutAll(100,_FALSE);
                OptionsMenu();
                Trig=PTRUE;
                break;

            //Credits
            case 3:
                echo_wait_sfx(SFX_12);      //"Credits"
                VDP_fadeOutAll(100,_FALSE);
                Credits();
                Trig=PTRUE;
                break;
        }
    }
    JOY_setEventHandler( &BtnNada );    //Remove button handler
}
Exemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Maximize the window
    showMaximized();

    //Show welcome message
    ui->statusBar->showMessage("Bienvenue sur BOMBERMAN.", 15000);

    // Linking buttons to action triggered
    connect(ui->actionDemarrerPartieSolo,SIGNAL(triggered()),this,SLOT(BeginPartySolo()));
    connect(ui->actionDemarrerPartieMulti,SIGNAL(triggered()),this,SLOT(BeginPartyMulti()));
    connect(ui->actionChargerPartieSolo,SIGNAL(triggered()),this,SLOT(LoadPartySolo()));
    connect(ui->actionChargerPartieMulti,SIGNAL(triggered()),this,SLOT(LoadPartyMulti()));
    connect(ui->actionSauvegarderPartieSolo,SIGNAL(triggered()),this,SLOT(SavePartySolo()));
    connect(ui->actionQuitter,SIGNAL(triggered()),this,SLOT(Quit()));
    connect(ui->actionCommandes_de_jeu,SIGNAL(triggered()),this,SLOT(GameControls()));
    connect(ui->actionAffichage,SIGNAL(triggered()),this,SLOT(DisplaySetting()));
    connect(ui->actionAudio,SIGNAL(triggered()),this,SLOT(AudioSetting()));
    connect(ui->actionAide,SIGNAL(triggered()),this,SLOT(Help()));
    connect(ui->actionA_propos,SIGNAL(triggered()),this,SLOT(Credits()));
    connect(ui->actionAffichageStatistics,SIGNAL(triggered()),this,SLOT(Statistics()));
}
Exemplo n.º 4
0
/*
   the main program
*/
int main( int argc, char *argv[])
{
   Credits( stdout);
   argv++;
   argc--;
   /* read command line options */
   ParseCommandLineOptions( argc, argv);

   /* load the Wad files */
   OpenMainWad( MainWad);
   if (PatchWads)
      while (PatchWads[ 0])
      {
	 OpenPatchWad( PatchWads[ 0]);
	 PatchWads++;
      }
   /* sanity check */
   CloseUnusedWadFiles();

   /* all systems go! */
   MainLoop();
   /* that's all, folks! */
   CloseWadFiles();
   exit( 0);
}
Exemplo n.º 5
0
void Livininabox(){
   double time;
   time = getTimeInterval();
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   if(time >  0.0   && time < 16.17)     KnockKnock(time);
   if(time > 16.04  && time < 27.07)     drawExplosion(time - 16.04);
   if(time > 16.17  && time < 27.07)     JumpOut(time - 16.17);
   if(time > 27.07  && time < 52.23)     RunForLife(time - 27.07);
   if(time > 52.23  && time < 66.50)     Credits(time);
   if(time > 66.50  && time < 118.06)    Greetings(time - 66.50);
   if(time > 118.06 && time < 134.00)    ProceduralScenes(time - 118.06);
   if(time > 134.00 && time < 162.94)    FractalMe(time - 134.00);
   if(time > 162.94 && time < 196.94)    CubeTunnel(time - 162.94);
   if(time > 196.94 && time < 221.26)    Trap(time - 196.94);
   if(time > 221.26 && time < 226.86)    HangingFruite(time - 221.26);
   if(time > 226.86 && time < 248.49)    WatchOutForTheLetters(time - 226.86);
   if(time > 248.49 && time < 271.87)    OpenTheDoor(time - 248.49);
   if(time > 271.87 && time < 276.85)    Headbreak(time);
   if(time > 276.85 && time < 283.33)    Matatas(time);
   if(time > 283.33 && time < 300.00)    Cube(time - 283.33);
   if(time > 300.00 && time < 307.00)    End();

   if(time > 307.00) cg_isrunning = 0;
}
Exemplo n.º 6
0
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				if(optWhichIntro == OPT_3DO){
					Drumall ();
				}
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			FadeMusic (NORMAL_VOLUME, 0);
			if(!optSkipIntro){
				Introduction ();
			}
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] = COMPUTER_CONTROL | AWESOME_RATING;

	return (TRUE);
}
Exemplo n.º 7
0
//Program waits for the user to press one of the following keys
void MainMenuKey()
{
	while (true)
	{
		if (_kbhit())
		{
			char mainMenuKey = _getch();
			switch (mainMenuKey)
			{
				case NEW_GAME_CHAR:
					PicksDwarfProperties();
					break;
				case LOAD_CHAR:
					LoadGame();
					break;
				case OPTIONS_CHAR:
					Options();
					break;
				case FAME_CHAR:
					HallOfFame();
					break;
				case CREDITS_CONTINUE_CHAR:
					Credits();
					break;
				case INSTRUCTIONS_CHAR:
					Instructions();
					break;
				case QUIT_CHAR:
					quit = true;
					break;
				default:
					toBreak = false;
			}
			if (toBreak)
			{
				break;
			}
			else
			{
				toBreak = true;
			}
		}
	}
}
Exemplo n.º 8
0
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			Introduction ();
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] =  COMPUTER_CONTROL | AWESOME_RATING;
	SetPlayerInput ();

	return (TRUE);
}
Exemplo n.º 9
0
static BOOLEAN
RestartMenu (MENU_STATE *pMS)
{
	TimeCount TimeOut;

	ReinitQueue (&race_q[0]);
	ReinitQueue (&race_q[1]);

	SetContext (ScreenContext);

	GLOBAL (CurrentActivity) |= CHECK_ABORT;
	if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0
			&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
			&& !GET_GAME_STATE (UTWIG_BOMB))
	{	// player blew himself up with Utwig bomb
		SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);

		SleepThreadUntil (FadeScreen (FadeAllToWhite, ONE_SECOND / 8)
				+ ONE_SECOND / 60);
		SetContextBackGroundColor (
				BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
		ClearDrawable ();
		FlushColorXForms ();

		TimeOut = ONE_SECOND / 8;
	}
	else
	{
		TimeOut = ONE_SECOND / 2;

		if (LOBYTE (LastActivity) == WON_LAST_BATTLE)
		{
			GLOBAL (CurrentActivity) = WON_LAST_BATTLE;
			Victory ();
			Credits (TRUE);

			FreeGameData ();
			
			GLOBAL (CurrentActivity) = CHECK_ABORT;
		}
	}

	LastActivity = 0;
	NextActivity = 0;

	// TODO: This fade is not always necessary, especially after a splash
	//   screen. It only makes a user wait.
	SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut));
	if (TimeOut == ONE_SECOND / 8)
		SleepThread (ONE_SECOND * 3);

	pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));

	DrawRestartMenuGraphic (pMS);
	GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
	SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
	SetDefaultMenuRepeatDelay ();
	DoInput (pMS, TRUE);
	
	StopMusic ();
	if (pMS->hMusic)
	{
		DestroyMusic (pMS->hMusic);
		pMS->hMusic = 0;
	}

	Flash_terminate (pMS->flashContext);
	pMS->flashContext = 0;
	DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
	pMS->CurFrame = 0;

	if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
		return (FALSE); // timed out

	if (GLOBAL (CurrentActivity) & CHECK_ABORT)
		return (FALSE); // quit

	TimeOut = FadeScreen (FadeAllToBlack, ONE_SECOND / 2);
	
	SleepThreadUntil (TimeOut);
	FlushColorXForms ();

	SeedRandomNumbers ();

	return (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE);
}
Exemplo n.º 10
0
void
mainmenu (int selectedMenu)
{
	int quit = 0;
	int ret;

	// disable game-specific menu items if a ROM isn't loaded
	if ( ARAM_ROMSIZE == 0 )
    	menuitems[3][0] = '\0';
	else
		sprintf (menuitems[3], "Game Menu");

	VIDEO_WaitVSync ();

	while (quit == 0)
	{
		if(selectedMenu >= 0)
		{
			ret = selectedMenu;
			selectedMenu = -1; // default back to main menu
		}
		else
		{
			ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
		}

		switch (ret)
		{
			case 0:
				// Load ROM Menu
				quit = LoadManager ();
				break;

			case 1:
				// Configure Controllers
				ConfigureControllers ();
				break;

			case 2:
				// Preferences
				PreferencesMenu ();
				break;

			case 3:
				// Game Options
				quit = GameMenu ();
				break;

			case 4:
				// Credits
				Credits ();
				WaitButtonA ();
                break;

			case 5:
				// Reset the Gamecube/Wii
			    Reboot();
                break;

			case 6:
				// Exit to Loader
				#ifdef HW_RVL
					#ifdef WII_DVD
					DI_Close();
					#endif
					exit(0);
				#else	// gamecube
					if (psoid[0] == PSOSDLOADID)
						PSOReload ();
				#endif
				break;

			case -1: // Button B
				// Return to Game
				quit = 1;
				break;
		}
	}

	/*** Remove any still held buttons ***/
	#ifdef HW_RVL
		while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) )
		    VIDEO_WaitVSync();
	#else
		while( PAD_ButtonsHeld(0) )
		    VIDEO_WaitVSync();
	#endif
}
Exemplo n.º 11
0
void
MainMenu (int selectedMenu)
{
	tb_t start,end;
	mftb(&start);

	int quit = 0;
	int ret;

	#ifdef HW_RVL
	// don't show dvd motor off on the wii
	menuitems[5][0] = 0;
	// rename reset/exit items
	sprintf (menuitems[6], "Return to Wii Menu");
	sprintf (menuitems[7], "Return to Homebrew Channel");
	#endif

	// disable game-specific menu items if a ROM isn't loaded
	if (!ROMLoaded)
    	menuitems[3][0] = '\0';
	else
		sprintf (menuitems[3], "Game Menu");

	VIDEO_WaitVSync ();

	while (quit == 0)
	{
		if(selectedMenu >= 0)
		{
			ret = selectedMenu;
			selectedMenu = -1; // default back to main menu
		}
		else
		{
			ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
		}

		switch (ret)
		{
			case 0:
				// Load ROM Menu
				quit = LoadManager ();
				break;

			case 1:
				// Configure Controllers
				ConfigureControllers ();
				break;

			case 2:
				// Preferences
				PreferencesMenu ();
				break;

			case 3:
				// Game Options
				quit = GameMenu ();
				break;

			case 4:
				// Credits
				Credits ();
				WaitButtonA ();
                break;

			case 5:
				// turn the dvd motor off (GC only)
				#ifdef HW_DOL
				dvd_motor_off ();
				#endif

			case 6:
				// Reset the Gamecube/Wii
			    Reboot();
                break;

			case 7:
				ExitToLoader();
				break;

			case -1: // Button B
				// Return to Game
				if(ROMLoaded)
					quit = 1;
				break;
		}
	}

	// Wait for buttons to be released
	int count = 0; // how long we've been waiting for the user to release the button
	while(count < 50 && (
		PAD_ButtonsHeld(0)
		#ifdef HW_RVL
		|| WPAD_ButtonsHeld(0)
		#endif
	))
	{
		VIDEO_WaitVSync();
		count++;
	}

	mftb(&end);
	loadtimeradjust += tb_diff_msec(&end, &start);
}
Exemplo n.º 12
0
static BOOLEAN
RestartMenu (PMENU_STATE pMS)
{
	DWORD TimeOut;
	BYTE black_buf[1];

	ReinitQueue (&race_q[0]);
	ReinitQueue (&race_q[1]);

	black_buf[0] = FadeAllToBlack;

	SetContext (ScreenContext);

	GLOBAL (CurrentActivity) |= CHECK_ABORT;
	if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0
			&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
			&& !GET_GAME_STATE (UTWIG_BOMB))
	{	// player blew himself up with Utwig bomb
		BYTE white_buf[] = {FadeAllToWhite};

		SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);

		SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf,
				ONE_SECOND / 8) + ONE_SECOND / 60);
		SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
		ClearDrawable ();
		FlushColorXForms ();

		TimeOut = ONE_SECOND / 8;
	}
	else
	{
		TimeOut = ONE_SECOND / 2;

		if (LOBYTE (LastActivity) == WON_LAST_BATTLE)
		{
			GLOBAL (CurrentActivity) = WON_LAST_BATTLE;
			Victory ();
			Credits (TRUE);

			FreeGameData ();
			
			TimeOut = ONE_SECOND / 2;
			GLOBAL (CurrentActivity) = CHECK_ABORT;
		}
	}

	LastActivity = NextActivity = 0;

	SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut));
	if (TimeOut == ONE_SECOND / 8)
		SleepThread (ONE_SECOND * 3);
	DrawRestartMenuGraphic (pMS);
	FlushInput ();
	GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
	SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
	DoInput (pMS, TRUE);
	
	StopMusic ();
	if (pMS->hMusic)
	{
		DestroyMusic (pMS->hMusic);
		pMS->hMusic = 0;
	}

	LockMutex (GraphicsLock);
	SetFlashRect (NULL_PTR, (FRAME)0);
	UnlockMutex (GraphicsLock);
	DestroyDrawable (ReleaseDrawable (pMS->CurFrame));

	if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
		return (FALSE); // timed out

	if (GLOBAL (CurrentActivity) & CHECK_ABORT)
		return (FALSE); // quit

	TimeOut = XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2);
	
	SleepThreadUntil (TimeOut);
	FlushColorXForms ();

	SeedRandomNumbers ();

	return (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE);
}
Exemplo n.º 13
0
/*
   the main program menu loop
*/
void MainLoop()
{
   WadPtr wad;
   FILE *file;
   char input[ 120];
   char *com, *out;
   BCINT episode, mission;

   for (;;)
   {
      /* get the input */
      printf( "\n[? for help]> ");
      gets( input);
		if(feof(stdin)) strcpy(input, "QUIT");
      printf( "\n");

      /* eat the white space and get the first command word */
      com = strtok( input, " ");
      strupr( com);

      /* user just hit return */
      if (com == NULL)
	 printf( "[Please enter a command or ? for help.]\n");

      /* user inputting for help */
      else if (!strcmp( com, "?") || !strcmp( com, "HELP") || !strcmp( com, "H"))
      {
	 printf( "? or H[elp]                       -- to display this text\n");
	 printf( "A[nalyze] episode mission         -- to analyze a game level's statistics\n");
	 printf( "D[ump] <DirEntry> [outfile]       -- to dump a directory entry in hex\n");
	 printf( "F[lags] { <+-><24ABDEFGLMNPSTUZ>} -- to display/set the print flags\n");
	 printf( "L[ist] <WadFile> [outfile]        -- to list the directory of a WAD file\n");
	 printf( "M[aster] [outfile]                -- to list the master directory\n");
	 printf( "N[ame] [name or '']               -- to display/set the user level name\n");
	 printf( "P[rint] episode mission <PSfile>  -- to print a game level to a PostScript file\n");
	 printf( "Q[uit]                            -- to quit\n");
	 printf( "R[ead] <WadFile>                  -- to read a new WAD patch file\n");
	 printf( "W[ads]                            -- to display the open WAD files\n");
	 printf( "X[tract] <DirEntry> <RawFile>     -- to save (extract) one object to a raw file\n");
      }

      /* user asked for list of open WAD files */
      else if (!strcmp( com, "WADS") || !strcmp( com, "W"))
      {
	 printf( "%-20s  IWAD  (Main ", WadFileList->filename);
	 switch (GameVersion % 16)
	 {
	    case 0: printf( "Shareware"); break;
	    case 1: printf( "Registered"); break;
	    case 2: printf( "Commercial"); break;
	    case 4: printf( "Ultimate"); break;
	 }
	 printf( " WAD file)\n");

	 for (wad = WadFileList->next; wad; wad = wad->next)
	 {
	    if (GameVersion == 2 && wad->directory[ 0].name[ 0] == 'M' &&
		 		    wad->directory[ 0].name[ 1] == 'A' &&
				    wad->directory[ 0].name[ 2] == 'P')
	       printf( "%-20s  PWAD  (Patch WAD file for level %c%c)\n",
			wad->filename, wad->directory[ 0].name[ 3], wad->directory[ 0].name[ 4]);
	    else if (GameVersion != 2 && wad->directory[ 0].name[ 0] == 'E' &&
					 wad->directory[ 0].name[ 2] == 'M')
	       printf( "%-20s  PWAD  (Patch WAD file for episode %c mission %c)\n",
			wad->filename, wad->directory[ 0].name[ 1], wad->directory[ 0].name[ 3]);
	    else
	    {
	       /* kludge */
	       strncpy( input, wad->directory[ 0].name, 8);
	       input[ 8] = '\0';
	       printf( "%-20s  PWAD  (Patch WAD file for %s)\n", wad->filename, input);
	    }
	 }
      }

      /* user asked to quit */
      else if (!strcmp( com, "QUIT") || !strcmp( com, "Q"))
      {
	 if (GameVersion == 0)
	    printf("Remember to register your copy of DOOM!\n");
	 else if (GameVersion == 16)
	    printf("Remember to register your copy of Heretic!\n");
	 printf( "Goodbye...\n");
	 break;
      }

      /* user asked to display/set the print flags */
      else if (!strcmp( com, "FLAGS") || !strcmp( com, "F"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	    DisplayFlags();
	 else
	    while (com != NULL)
	    {
	       strupr( com);
	       if (com[ 0] != '+' && com[ 0] != '-')
		  printf( "[Flag must start with '+' or '-'.]\n");
	       else if (!strchr( "24ABDEFGLMNPSTUZ", com[ 1]))
		  printf( "[Flag must be one of '24ABDEFGLMNPSTUZ'.]\n");
	       else if (com[ 2] != ' ' && com[ 2] != '\0')
		  printf( "[Flag must be one character.]\n");
	       else
		  SetFlag( com[ 1], com[ 0]);
	       com = strtok( NULL, " ");
	    }
      }

      /* user asked to display/set the user level name */
      else if (!strcmp( com, "NAME") || !strcmp( com, "N"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	    if (UserLvlNm != NULL)
	       printf( "User level name : %s\n", UserLvlNm);
	    else
	       printf( "[User level name is not set.]\n");
	 else
	    if (! strcmp( com, "''"))
	    {
	       /* reset user level name */
	       FreeMemory( UserLvlNm);
	       UserLvlNm = NULL;
	       printf( "User level name reset\n");
	    }
	    else
	    {
	       /* set user level name */
	       UserLvlNm = (char *) GetMemory( (strlen( com) + 1) * sizeof( char));
	       strcpy( UserLvlNm, com);
	       while ((com = strtok( NULL, " ")) != NULL)
	       {
		  UserLvlNm = (char *) ResizeMemory( UserLvlNm, (strlen( UserLvlNm) + 1 +
								 strlen( com)) * sizeof( char));
		  strcat( UserLvlNm, " ");
		  strcat( UserLvlNm, com);
	       }
	       printf( "User level name set : %s\n", UserLvlNm);
	    }
      }

      /* user asked to print a level */
      else if (!strcmp( com, "PRINT") || !strcmp( com, "P"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Episode number argument missing.]\n");
	    continue;
	 }
	 episode = atoi( com);
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Mission number argument missing.]\n");
	    continue;
	 }
	 mission = atoi( com);

	 if (GameVersion == 2)
	 {
	    if (episode != 0)
	    {
	       printf( "[Invalid game episode number (%d).]\n", episode);
	       continue;
	    }
	    if (mission < 1 || mission > 32)
	    {
	       printf( "[Invalid game mission number (%d).]\n", mission);
	       continue;
	    }
	 }
	 else /* GameVersion != 2 */
	    if (!(GameVersion == 17 && episode == 4 && mission == 1)) /* Heretic E4M1 */
	    {
	       if (episode < 1 || episode > (GameVersion == 4 ? 4 : (GameVersion & 1 ? 3 : 1)))
	       {
		  printf( "[Invalid game episode number (%d).]\n", episode);
		  continue;
	       }
	       if (mission < 1 || mission > 9)
	       {
		  printf( "[Invalid game mission number (%d).]\n", mission);
		  continue;
	       }
	    }

	 out = strtok( NULL, " ");
	 if (! out)
	 {
	    printf( "[PostScript file name argument missing.]\n");
	    continue;
	 }
	 if (GameVersion == 2)
	    printf( "Outputting PostScript map of level MAP%02d to \"%s\".\n",
		     mission, out);
	 else
	    printf( "Outputting PostScript map of level E%dM%d to \"%s\".\n",
		     episode, mission, out);
	 if ((PSFile = fopen( out, "wt")) == NULL)
	    ProgError( "error opening output file \"%s\"", out);
	 fprintf( PSFile, "%%! DMPSMU: DooM PostScript Maps Utility, ver %s\n",
			   DMPS_VERSION);
	 PrintLevel( episode, mission);
	 fprintf( PSFile, "\n%%%% End of file.\n");
	 fclose( PSFile);
      }

      /* user asked to analyze a level */
      else if (!strcmp( com, "ANALYZE") || !strcmp( com, "A"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Episode number argument missing.]\n");
	    continue;
	 }
	 episode = atoi( com);
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Mission number argument missing.]\n");
	    continue;
	 }
	 mission = atoi( com);

	 if (GameVersion == 2)
	 {
	    if (episode != 0)
	    {
	       printf( "[Invalid game episode number (%d).]\n", episode);
	       continue;
	    }
	    if (mission < 1 || mission > 32)
	    {
	       printf( "[Invalid game mission number (%d).]\n", mission);
	       continue;
	    }
	 }
	 else /* GameVersion != 2 */
	    if (!(GameVersion == 17 && episode == 4 && mission == 1)) /* Heretic E4M1 */
	    {
	       if (episode < 1 || episode > (GameVersion == 4 ? 4 : (GameVersion & 1 ? 3 : 1)))
	       {
		  printf( "[Invalid game episode number (%d).]\n", episode);
		  continue;
	       }
	       if (mission < 1 || mission > 9)
	       {
		  printf( "[Invalid game mission number (%d).]\n", mission);
		  continue;
	       }
	    }

	 AnalyzeLevel( episode, mission);
      }

      /* user ask for a listing of a WAD file */
      else if (!strcmp( com, "LIST") || !strcmp( com, "L"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Wad file name argument missing.]\n");
	    continue;
	 }
	 for (wad = WadFileList; wad; wad = wad->next)
	    if (!strcmp( com, wad->filename))
	       break;
	 if (! wad)
	 {
	    printf( "[Wad file \"%s\" is not open.]\n", com);
	    continue;
	 }
	 out = strtok( NULL, " ");
	 if (out)
	 {
	    printf( "Outputting directory of \"%s\" to \"%s\".\n", wad->filename, out);
	    if ((file = fopen( out, "wt")) == NULL)
	       ProgError( "error opening output file \"%s\"", out);
	    Credits( file);
	    ListFileDirectory( file, wad);
	    fprintf( file, "\nEnd of file.\n");
	    fclose( file);
	 }
	 else
	    ListFileDirectory( stdout, wad);
      }

      /* user asked for the list of the master directory */
      else if (!strcmp( com, "MASTER") || !strcmp( com, "M"))
      {
	 out = strtok( NULL, " ");
	 if (out)
	 {
	    printf( "Outputting master directory to \"%s\".\n", out);
	    if ((file = fopen( out, "wt")) == NULL)
	       ProgError( "error opening output file \"%s\"", out);
	    Credits( file);
	    ListMasterDirectory( file);
	    fprintf( file, "\nEnd of file.\n");
	    fclose( file);
	 }
	 else
	    ListMasterDirectory( stdout);
      }

      /* user asked to read a new patch WAD file */
      else if (!strcmp( com, "READ") || !strcmp( com, "R"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Wad file name argument missing.]\n");
	    continue;
	 }
	 out = strtok( NULL, " ");
	 if (out)
	    *out = '\0';
	 out = (char *) GetMemory( (strlen( com) + 1) * sizeof( char));
	 strcpy( out, com);
	 OpenPatchWad( out);
	 CloseUnusedWadFiles();
      }

      /* user asked to dump the contents of a WAD file entry */
      else if (!strcmp( com, "DUMP") || !strcmp( com, "D"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Object name argument missing.]\n");
	    continue;
	 }
	 strupr( com);
	 out = strtok( NULL, " ");
	 if (out)
	 {
	    printf( "Outputting directory entry data to \"%s\".\n", out);
	    if ((file = fopen( out, "wt")) == NULL)
	       ProgError( "error opening output file \"%s\"", out);
	    Credits( file);
	    DumpDirectoryEntry( file, com);
	    fprintf( file, "\nEnd of file.\n");
	    fclose( file);
	 }
	 else
	    DumpDirectoryEntry( stdout, com);
      }

      /* user asked to extract an object to a raw binary file */
      else if (!strcmp( com, "XTRACT") || !strcmp( com, "X") || !strcmp( com, "EXTRACT"))
      {
	 com = strtok( NULL, " ");
	 if (com == NULL)
	 {
	    printf( "[Object name argument missing.]\n");
	    continue;
	 }
	 if (strlen( com) > 8 || strchr( com, '.'))
	 {
	    printf( "[Invalid object name.]\n");
	    continue;
	 }
	 strupr( com);
	 out = strtok( NULL, " ");
	 if (! out)
	 {
	    printf( "[Raw file name argument missing.]\n");
	    continue;
	 }
	 for (wad = WadFileList; wad; wad = wad->next)
	    if (!strcmp( out, wad->filename))
	       break;
	 if (wad)
	 {
	    printf( "[You may not overwrite an opened Wad file with raw data.]\n");
	    continue;
	 }
	 printf( "Saving directory entry data to \"%s\".\n", out);
	 if ((file = fopen( out, "wb")) == NULL)
	    ProgError( "error opening output file \"%s\"", out);
	 SaveEntryToRawFile( file, com);
	 fclose( file);
      }

      /* unknown command */
      else
	 printf( "[Unknown command \"%s\"!]\n", com);
   }
}
Exemplo n.º 14
0
byte LunaticRun(int *lastTime)
{
	numRunsToMakeUp = 0;
	if (*lastTime > TIME_PER_FRAME * 30)
		*lastTime = TIME_PER_FRAME * 30;

	while (*lastTime >= TIME_PER_FRAME)
	{
		if (!gamemgl->Process())
		{
			mapToGoTo = 255;
			return LEVEL_ABORT;
		}

		if (gameMode == GAMEMODE_PLAY)
		{
			// update everything here
			if (!windingDown)
			{
				if (windingUp)
				{
					curMap->Update(UPDATE_FADEIN, &curWorld);
					EditorUpdateGuys(curMap);
					windingUp--;
				}
				else
				{
					curMap->Update(UPDATE_GAME, &curWorld);
					UpdateGuys(curMap, &curWorld);
					UpdateBullets(curMap, &curWorld);
					SpecialAnytimeCheck(curMap);
				}
			}
			else
			{
				curMap->Update(UPDATE_FADE, &curWorld);
				EditorUpdateGuys(curMap);
			}
			UpdateParticles(curMap);
			UpdateMessage();

			if (curMap->flags & MAP_SNOWING)
				MakeItSnow(curMap);

			if (windingDown)
			{
				windingDown--;
				if (!windingDown)
					return windDownReason;
			}
		}
		else if (gameMode == GAMEMODE_MENU)
		{
			switch (UpdatePauseMenu(gamemgl)) {
				case 0:
					lastKey = 0;
					gameMode = GAMEMODE_PLAY;
					break;
				case 1:
					break;
				case 2:
					if (mapNum)
						mapToGoTo = 0;
					else
						mapToGoTo = 255;
					lastKey = 0;
					return LEVEL_ABORT;
					break;
				case 3:
					mapToGoTo = 255;
					lastKey = 0;
					return WORLD_QUITGAME; // dump out altogether
					break;
			}
		}
		else if (gameMode == GAMEMODE_PIC) // gamemode_pic
		{
			if (GetTaps()&(CONTROL_B1 | CONTROL_B2))
			{
				gameMode = GAMEMODE_PLAY;
				// restore the palette
				gamemgl->LoadBMP("graphics\\title.bmp");
			}
		}
		else // gamemode_rage
		{
			UpdateRage(gamemgl);
			if (player.rageClock)
				player.rageClock--;
			else
			{
				gameMode = GAMEMODE_PLAY;
				StartRaging();
			}
			if (goodguy)
				goodguy->facing = (goodguy->facing + 1)&7;
		}

		if (msgFromOtherModules == MSG_NEWFEATURE)
		{
			NewMessage("** NEW FEATURE ADDED!! **", 120, 1);
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_GOTOMAP)
		{
			mapToGoTo = msgContent;
			windingDown = 30;
			windDownReason = LEVEL_ABORT;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_WINLEVEL)
		{
			mapToGoTo = msgContent;
			windingDown = 40;
			windDownReason = LEVEL_WIN;
			msgFromOtherModules = MSG_NONE;
			if (player.worldNum == 4 && player.levelNum == 6)
			{

				ShowVictoryAnim(4); // you killed him.
				SendMessageToGame(MSG_WINGAME, 0);
			}
			player.boredom = 0;
		}
		else if (msgFromOtherModules == MSG_RESET)
		{
			if (opt.youSuck)
				NewBigMessage("You Suck", 30);
			else
				NewBigMessage("Try Again!", 30);
			windingDown = 30;
			windDownReason = LEVEL_RESET;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_LOADGAME)
		{
			NewBigMessage("Loading Game", 30);
			windingDown = 30;
			windDownReason = LEVEL_LOADING;
			msgFromOtherModules = MSG_NONE;
		}
		else if (msgFromOtherModules == MSG_WINGAME)
		{
			dword CDtime;

			mapToGoTo = 0;
			windingDown = 1;
			windDownReason = LEVEL_WIN;
			msgFromOtherModules = MSG_NONE;
			CDtime = timeGetTime();
			VictoryText(gamemgl);
			Credits(gamemgl);
			garbageTime += timeGetTime() - CDtime;
			player.boredom = 0;
		}
		*lastTime -= TIME_PER_FRAME;
		numRunsToMakeUp++;
		updFrameCount++;
	}
	HandleCDMusic();
	garbageTime = 0;
	JamulSoundUpdate();

	return LEVEL_PLAYING;
}
Exemplo n.º 15
0
void DisplayEnd()
{
    Credits();
    EndCurses();
}