Beispiel #1
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;
			}
		}

	}
}
Beispiel #2
0
void	CheckHighScore (long score,word other)
{
	word		i,j;
	int			n;
	HighScore	myscore;
	US_CursorStruct TermCursor = {'@',0,HIGHLIGHT_TEXT_COLOR,2};


   // Check for cheaters

   if (DebugOk)
	{
   	SD_PlaySound(NOWAYSND);
      return;
   }

	strcpy(myscore.name,"");
	myscore.score = score;
	myscore.episode = gamestate.episode;
	myscore.completed = other;
	myscore.ratio = ShowStats(0,0,ss_justcalc,&gamestuff.level[gamestate.mapon].stats);

	for (i = 0,n = -1;i < MaxScores;i++)
	{
		if ((myscore.score > Scores[i].score) ||	((myscore.score == Scores[i].score)
			&& (myscore.completed > Scores[i].completed)))
		{
			for (j = MaxScores;--j > i;)
				Scores[j] = Scores[j - 1];
			Scores[i] = myscore;
			n = i;
			break;
		}
	}

	StartCPMusic (ROSTER_MUS);
	DrawHighScores ();

	VW_FadeIn ();

	if (n != -1)
	{
		//
		// got a high score
		//

		DrawInstructions(IT_ENTER_HIGHSCORE);
		SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR,TERM_BACK_COLOR);
		PrintY = 68+(SCORE_Y_SPACING * n);
		PrintX = 45;
		use_custom_cursor = true;
		allcaps = true;
		US_CustomCursor = TermCursor;
		US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);
	}
	else
	{
		IN_ClearKeysDown ();
		IN_UserInput(500);
	}

   StopMusic();
	use_custom_cursor = false;
}
static bool ShowImage(IntermissionAction *image, bool drawonly)
{
	if(!image->Music.IsEmpty())
		StartCPMusic(image->Music);

	if(!image->Palette.IsEmpty())
	{
		if(image->Palette.CompareNoCase("$GamePalette") == 0)
			VL_ReadPalette(gameinfo.GamePalette);
		else
			VL_ReadPalette(image->Palette);
	}

	static FTextureID background;
	static bool tileBackground = false;
	static IntermissionAction::BackgroundType type = IntermissionAction::NORMAL;

	// High Scores and such need special handling
	if(image->Type != IntermissionAction::UNSET)
	{
		type = image->Type;
	}
	if(type == IntermissionAction::NORMAL && image->Background.isValid())
	{
		background = image->Background;
		tileBackground = image->BackgroundTile;
	}

	intermissionMapLoaded = false;
	switch(type)
	{
		default:
			if(!tileBackground)
				CA_CacheScreen(TexMan(background));
			else
				VWB_DrawFill(TexMan(background), 0, 0, screenWidth, screenHeight);
			break;
		case IntermissionAction::HIGHSCORES:
			DrawHighScores();
			break;
		case IntermissionAction::TITLEPAGE:
			background = TexMan.CheckForTexture(gameinfo.TitlePage, FTexture::TEX_Any);
			if(!gameinfo.TitlePalette.IsEmpty())
				VL_ReadPalette(gameinfo.TitlePalette);
			CA_CacheScreen(TexMan(background));
			break;
		case IntermissionAction::LOADMAP:
			if(image->MapName.IsNotEmpty())
			{
				strncpy(gamestate.mapname, image->MapName, 8);
				StartTravel();
				SetupGameLevel();
				FinishTravel();
				// Drop weapon
				players[0].SetPSprite(NULL, player_t::ps_weapon);
				PreloadGraphics(true);
				gamestate.victoryflag = true;
			}
			intermissionMapLoaded = true;
			ThreeDRefresh();
			ClearStatusbar();
			break;
	}

	for(unsigned int i = 0;i < image->Draw.Size();++i)
	{
		VWB_DrawGraphic(TexMan(image->Draw[i].Image), image->Draw[i].X, image->Draw[i].Y);
	}

	if(!drawonly)
	{
		VW_UpdateScreen();
		return WaitIntermission(image->Time);
	}
	return false;
}
static int DemoLoop(unsigned id)
{
    static int LastDemo = 0;

    switch (id)
    {
    case JE_NONE:
        /* check for launch from ted */
        if (param_tedlevel != -1)
        {
            param_nowait = true;
            EnableEndGameMenuItem();
            NewGame(param_difficulty,0);

            gamestate.episode  = 0;
            gamestate.mapon    = param_tedlevel;
#ifndef SPEAR
            gamestate.episode  = param_tedlevel/10;
            gamestate.mapon   %= 10;
#endif
            return JE_LOOP2;
        }

        /* main game cycle */
#ifndef DEMOTEST

#ifndef UPLOAD

#ifndef GOODTIMES
#ifndef SPEAR
#ifndef JAPAN
        if (!param_nowait)
            NonShareware();
#endif
#else
#ifndef GOODTIMES
#ifndef SPEARDEMO
        extern void CopyProtection(void);
        if(!param_goodtimes)
            CopyProtection();
#endif
#endif
#endif
#endif
#endif

        StartCPMusic(INTROSONG);

#ifndef JAPAN
        if (!param_nowait)
            PG13 ();
#endif

#endif
        return JE_LOOP;
    case JE_LOOP:
        while (!param_nowait)
        {
#ifndef DEMOTEST

#ifdef SPEAR
            LR_Color pal[256];
            /* title page */
            CA_CacheGrChunk (TITLEPALETTE);
            VL_ConvertPalette(grsegs[TITLEPALETTE], pal, 256);

            CA_CacheGrChunk (TITLE1PIC);
            VWB_DrawPic (0,0,TITLE1PIC);
            UNCACHEGRCHUNK (TITLE1PIC);

            CA_CacheGrChunk (TITLE2PIC);
            VWB_DrawPic (0,80,TITLE2PIC);
            UNCACHEGRCHUNK (TITLE2PIC);
            VW_UpdateScreen ();
            VL_FadeIn(0,255,pal,30);

            UNCACHEGRCHUNK (TITLEPALETTE);
#else
            CA_CacheScreen (TITLEPIC);
            VW_UpdateScreen ();
            VW_FadeIn();
#endif
            if (IN_UserInput(TickBase*15))
                break;
            VW_FadeOut();
            /* credits page */
            CA_CacheScreen (CREDITSPIC);
            VW_UpdateScreen();
            VW_FadeIn ();
            if (IN_UserInput(TickBase*10))
                break;
            VW_FadeOut ();
            DrawHighScores ();
            VW_UpdateScreen ();
            VW_FadeIn ();

            if (IN_UserInput(TickBase*10))
                break;
#endif
            /* demo */

#ifndef SPEARDEMO
            PlayDemo (LastDemo++%4);
#else
            PlayDemo (0);
#endif

            if (playstate == EX_ABORT)
                return JE_QUIT;
            VW_FadeOut();
            if(screenHeight % 200 != 0)
                VL_ClearScreen(0);
            StartCPMusic(INTROSONG);
        }

        VW_FadeOut ();

#ifdef DEBUGKEYS
        if (Keyboard[sc_Tab] && param_debugmode)
            RecordDemo ();
        else
#endif
            US_ControlPanel (0);

        if (startgame || loadedgame)
            return JE_LOOP2;
        break;
    case JE_LOOP2:
        id = GameLoop();
        if (param_tedlevel == -1 && id == -1)
        {
            if(!param_nowait)
            {
                VW_FadeOut();
                StartCPMusic(INTROSONG);
            }
        }
        break;
    }

    return JE_LOOP2;
}
Beispiel #5
0
static void DemoLoop()
{
    int LastDemo = 0;

//
// check for launch from ted
//
    if (param_tedlevel != -1)
    {
        param_nowait = true;
        EnableEndGameMenuItem();
        NewGame(param_difficulty,0);

#ifndef SPEAR
        gamestate.episode = param_tedlevel/10;
        gamestate.mapon = param_tedlevel%10;
#else
        gamestate.episode = 0;
        gamestate.mapon = param_tedlevel;
#endif
        GameLoop();
        Quit (NULL);
    }


//
// main game cycle
//

#ifndef DEMOTEST

    #ifndef UPLOAD

        #ifndef GOODTIMES
        #ifndef SPEAR
        #ifndef JAPAN
        if (!param_nowait)
            NonShareware();
        #endif
        #else
            #ifndef GOODTIMES
            #ifndef SPEARDEMO
            extern void CopyProtection(void);
            if(!param_goodtimes)
                CopyProtection();
            #endif
            #endif
        #endif
        #endif
    #endif

    StartCPMusic(INTROSONG);

#ifndef JAPAN
    if (!param_nowait)
        PG13 ();
#endif

#endif

    while (1)
    {
        while (!param_nowait)
        {
//
// title page
//
#ifndef DEMOTEST

#ifdef SPEAR
            SDL_Color pal[256];
            CA_CacheGrChunk (TITLEPALETTE);
            VL_ConvertPalette(grsegs[TITLEPALETTE], pal, 256);

            CA_CacheGrChunk (TITLE1PIC);
            VWB_DrawPic (0,0,TITLE1PIC);
            UNCACHEGRCHUNK (TITLE1PIC);

            CA_CacheGrChunk (TITLE2PIC);
            VWB_DrawPic (0,80,TITLE2PIC);
            UNCACHEGRCHUNK (TITLE2PIC);
            VW_UpdateScreen ();
            VL_FadeIn(0,255,pal,30);

            UNCACHEGRCHUNK (TITLEPALETTE);
#else
            CA_CacheScreen (TITLEPIC);
            VW_UpdateScreen ();
            VW_FadeIn();
#endif
            if (IN_UserInput(TickBase*15))
                break;
            VW_FadeOut();
//
// credits page
//
            CA_CacheScreen (CREDITSPIC);
            VW_UpdateScreen();
            VW_FadeIn ();
            if (IN_UserInput(TickBase*10))
                break;
            VW_FadeOut ();
//
// high scores
//
            DrawHighScores ();
            VW_UpdateScreen ();
            VW_FadeIn ();

            if (IN_UserInput(TickBase*10))
                break;
#endif
//
// demo
//

            #ifndef SPEARDEMO
            PlayDemo (LastDemo++%4);
            #else
            PlayDemo (0);
            #endif

            if (playstate == ex_abort)
                break;
            VW_FadeOut();
            if(screenHeight % 200 != 0)
                VL_ClearScreen(0);
            StartCPMusic(INTROSONG);
        }

        VW_FadeOut ();

#ifdef DEBUGKEYS
        if (Keyboard[sc_Tab] && param_debugmode)
            RecordDemo ();
        else
            US_ControlPanel (0);
#else
        US_ControlPanel (0);
#endif

        if (startgame || loadedgame)
        {
            GameLoop ();
            if(!param_nowait)
            {
                VW_FadeOut();
                StartCPMusic(INTROSONG);
            }
        }
    }
}