static bool ShowText(const FString exitText, const FString flat, const FString music, ClusterInfo::ExitType type) { // Use cluster background if set. if(!flat.IsEmpty()) backgroundFlat = TexMan(flat); if(!backgroundFlat) // Get default if needed backgroundFlat = TexMan(gameinfo.FinaleFlat); switch(type) { case ClusterInfo::EXIT_MESSAGE: SD_PlaySound ("misc/1up"); Message (exitText); IN_ClearKeysDown (); IN_Ack (); return false; case ClusterInfo::EXIT_LUMP: { int lumpNum = Wads.CheckNumForName(exitText, ns_global); if(lumpNum != -1) { FWadLump lump = Wads.OpenLumpNum(lumpNum); char* text = new char[Wads.LumpLength(lumpNum)]; lump.Read(text, Wads.LumpLength(lumpNum)); if(!music.IsEmpty()) StartCPMusic(music); ShowArticle(text, !!(IWad::GetGame().Flags & IWad::HELPHACK)); delete[] text; } break; } default: if(!music.IsEmpty()) StartCPMusic(music); ShowArticle(exitText, !!(IWad::GetGame().Flags & IWad::HELPHACK)); break; } IN_ClearKeysDown(); if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement return true; }
void PG13 (void) { VW_FadeOut (); VWB_Bar (0, 0, 320, 200, 0x82); // background CA_CacheGrChunk (PG13PIC); VWB_DrawPic (216, 110, PG13PIC); VW_UpdateScreen (); UNCACHEGRCHUNK (PG13PIC); VW_FadeIn (); // VBT déplacé StartCPMusic(INTROSONG); IN_UserInput (TickBase * 7); VW_FadeOut (); }
void Victory (void) { #ifndef SPEARDEMO long sec; int i,min,kr,sr,tr,x; char tempstr[8]; #define RATIOX 6 #define RATIOY 14 #define TIMEX 14 #define TIMEY 8 #ifdef SPEAR StartCPMusic (XTHEEND_MUS); CA_CacheGrChunk(BJCOLLAPSE1PIC); CA_CacheGrChunk(BJCOLLAPSE2PIC); CA_CacheGrChunk(BJCOLLAPSE3PIC); CA_CacheGrChunk(BJCOLLAPSE4PIC); VWB_Bar(0,0,320,200,VIEWCOLOR); VWB_DrawPic (124,44,BJCOLLAPSE1PIC); VW_UpdateScreen (); VW_FadeIn (); VW_WaitVBL(2*70); VWB_DrawPic (124,44,BJCOLLAPSE2PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE3PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE4PIC); VW_UpdateScreen (); VW_WaitVBL(3*70); UNCACHEGRCHUNK(BJCOLLAPSE1PIC); UNCACHEGRCHUNK(BJCOLLAPSE2PIC); UNCACHEGRCHUNK(BJCOLLAPSE3PIC); UNCACHEGRCHUNK(BJCOLLAPSE4PIC); VL_FadeOut (0,255,0,17,17,5); #endif StartCPMusic (URAHERO_MUS); ClearSplitVWB (); CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); CA_CacheGrChunk(STARTFONT); #ifndef SPEAR CA_CacheGrChunk(C_TIMECODEPIC); #endif VWB_Bar (0,0,320,200-STATUSLINES,127); #ifdef JAPAN #ifndef JAPDEMO CA_CacheGrChunk(C_ENDRATIOSPIC); VWB_DrawPic(0,0,C_ENDRATIOSPIC); UNCACHEGRCHUNK(C_ENDRATIOSPIC); #endif #else Write(18,2,STR_YOUWIN); Write(TIMEX,TIMEY-2,STR_TOTALTIME); Write(12,RATIOY-2,"averages"); #ifdef SPANISH Write(RATIOX+2, RATIOY, STR_RATKILL); Write(RATIOX+2, RATIOY+2, STR_RATSECRET); Write(RATIOX+2, RATIOY+4,STR_RATTREASURE); #else Write(RATIOX+8,RATIOY, STR_RATKILL); Write(RATIOX+4,RATIOY+2, STR_RATSECRET); Write(RATIOX, RATIOY+4,STR_RATTREASURE); #endif #endif #ifndef JAPDEMO VWB_DrawPic (8,4,L_BJWINSPIC); #endif #ifndef SPEAR for (kr = sr = tr = sec = i = 0;i < 8;i++) #else for (kr = sr = tr = sec = i = 0;i < 20;i++) #endif { sec += LevelRatios[i].time; kr += LevelRatios[i].kill; sr += LevelRatios[i].secret; tr += LevelRatios[i].treasure; } #ifndef SPEAR kr /= 8; sr /= 8; tr /= 8; #else kr /= 14; sr /= 14; tr /= 14; #endif min = sec/60; sec %= 60; if (min > 99) min = sec = 99; i = TIMEX*8+1; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min%10)); i += 2*8; Write(i/8,TIMEY,":"); i += 1*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec%10)); VW_UpdateScreen (); itoa(kr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY,tempstr); itoa(sr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+2,tempstr); itoa(tr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+4,tempstr); #ifndef SPANISH #ifndef UPLOAD #ifndef SPEAR // // TOTAL TIME VERIFICATION CODE // if (gamestate.difficulty>=gd_medium) { VWB_DrawPic (30*8,TIMEY*8,C_TIMECODEPIC); fontnumber = 0; fontcolor = READHCOLOR; PrintX = 30*8-3; PrintY = TIMEY*8+8; PrintX+=4; tempstr[0] = (((min/10)^(min%10))^0xa)+'A'; tempstr[1] = (((sec/10)^(sec%10))^0xa)+'A'; tempstr[2] = (tempstr[0]^tempstr[1])+'A'; tempstr[3] = 0; US_Print(tempstr); } #endif #endif #endif fontnumber = 1; VW_UpdateScreen (); VW_FadeIn (); IN_Ack(); #ifndef SPEAR if (Keyboard[sc_P] && MS_CheckParm("goobers")) PicturePause(); #endif VW_FadeOut (); #ifndef SPEAR UNCACHEGRCHUNK(C_TIMECODEPIC); #endif UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); #ifndef SPEAR EndText(); #else EndSpear(); #endif #endif // SPEARDEMO }
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; }
void DoJukebox(void) { int which,lastsong=-1; unsigned start; unsigned songs[]= { #ifndef SPEAR GETTHEM_MUS, SEARCHN_MUS, POW_MUS, SUSPENSE_MUS, WARMARCH_MUS, CORNER_MUS, NAZI_OMI_MUS, PREGNANT_MUS, GOINGAFT_MUS, HEADACHE_MUS, DUNGEON_MUS, ULTIMATE_MUS, INTROCW3_MUS, NAZI_RAP_MUS, TWELFTH_MUS, ZEROHOUR_MUS, ULTIMATE_MUS, PACMAN_MUS #else XFUNKIE_MUS, // 0 XDEATH_MUS, // 2 XTIPTOE_MUS, // 4 XTHEEND_MUS, // 7 XEVIL_MUS, // 17 XJAZNAZI_MUS, // 18 XPUTIT_MUS, // 21 XGETYOU_MUS, // 22 XTOWER2_MUS // 23 #endif }; IN_ClearKeysDown(); if (!AdLibPresent && !SoundBlasterPresent) return; MenuFadeOut(); #ifndef SPEAR #ifndef UPLOAD start = ((LR_GetTicks()/10)%3)*6; #else start = 0; #endif #else start = 0; #endif CA_CacheGrChunk (STARTFONT+1); #ifdef SPEAR CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END); #else CacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END); #endif CA_LoadAllSounds (); fontnumber=1; ClearMScreen (); VWB_DrawPic(112,184,C_MOUSELBACKPIC); DrawStripes (10); SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR); #ifndef SPEAR DrawWindow (CTL_X-2,CTL_Y-6,280,13*7,BKGDCOLOR); #else DrawWindow (CTL_X-2,CTL_Y-26,280,13*10,BKGDCOLOR); #endif DrawMenu (&MusicItems,&MusicMenu[start]); SETFONTCOLOR (READHCOLOR,BKGDCOLOR); PrintY = 15; WindowX = 0; WindowY = 320; US_CPrint ("Robert's Jukebox"); SETFONTCOLOR (TEXTCOLOR,BKGDCOLOR); VW_UpdateScreen(); MenuFadeIn(); do { which = HandleMenu(&MusicItems,&MusicMenu[start],NULL); if (which >= 0) { if (lastsong >= 0) MusicMenu[start+lastsong].active = 1; StartCPMusic(songs[start + which]); MusicMenu[start+which].active = 2; DrawMenu (&MusicItems,&MusicMenu[start]); VW_UpdateScreen(); lastsong = which; } } while(which >= 0); MenuFadeOut(); IN_ClearKeysDown(); #ifdef SPEAR UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END); #else UnCacheLump (CONTROLS_LUMP_START,CONTROLS_LUMP_END); #endif }
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; }
void Victory() { #ifndef SPEARDEMO long sec; int i,min,kr,sr,tr,x; char tempstr[8]; #define RATIOX 6 #define RATIOY 14 #define TIMEX 14 #define TIMEY 8 #ifdef SPEAR StartCPMusic(XTHEEND_MUS); CA_CacheGrChunk(BJCOLLAPSE1PIC); CA_CacheGrChunk(BJCOLLAPSE2PIC); CA_CacheGrChunk(BJCOLLAPSE3PIC); CA_CacheGrChunk(BJCOLLAPSE4PIC); VW_Bar(0,0,320,200,VIEWCOLOR); VWB_DrawPic (124,44,BJCOLLAPSE1PIC); VW_UpdateScreen (); VW_FadeIn (); VW_WaitVBL(2*70); VWB_DrawPic (124,44,BJCOLLAPSE2PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE3PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE4PIC); VW_UpdateScreen (); VW_WaitVBL(3*70); CA_UnCacheGrChunk(BJCOLLAPSE1PIC); CA_UnCacheGrChunk(BJCOLLAPSE2PIC); CA_UnCacheGrChunk(BJCOLLAPSE3PIC); CA_UnCacheGrChunk(BJCOLLAPSE4PIC); VL_FadeOut (0,255,0,17,17,5); #endif StartCPMusic (URAHERO_MUS); ClearSplitVWB (); CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); CA_CacheGrChunk(STARTFONT); VW_Bar (0,0,320,200-STATUSLINES,127); Write(18,2,STR_YOUWIN); Write(TIMEX,TIMEY-2,STR_TOTALTIME); Write(12,RATIOY-2,"averages"); Write(RATIOX+8,RATIOY, STR_RATKILL); Write(RATIOX+4,RATIOY+2, STR_RATSECRET); Write(RATIOX, RATIOY+4,STR_RATTREASURE); VWB_DrawPic (8,4,L_BJWINSPIC); #ifndef SPEAR for (kr = sr = tr = sec = i = 0;i < 8;i++) #else for (kr = sr = tr = sec = i = 0;i < 20;i++) #endif { sec += LevelRatios[i].time; kr += LevelRatios[i].kill; sr += LevelRatios[i].secret; tr += LevelRatios[i].treasure; } #ifndef SPEAR kr /= 8; sr /= 8; tr /= 8; #else kr /= 14; sr /= 14; tr /= 14; #endif min = sec/60; sec %= 60; if (min > 99) min = sec = 99; i = TIMEX*8+1; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min%10)); i += 2*8; Write(i/8,TIMEY,":"); i += 1*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec%10)); VW_UpdateScreen (); itoa(kr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY,tempstr); itoa(sr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+2,tempstr); itoa(tr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+4,tempstr); fontnumber = 1; VW_UpdateScreen (); VW_FadeIn (); IN_Ack(); #ifndef SPEAR if (IN_KeyDown(sc_P) && MS_CheckParm("debugmode")) PicturePause(); #endif VW_FadeOut (); UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); #ifndef SPEAR EndText(); #else EndSpear(); #endif #endif /* SPEARDEMO */ }
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 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); } } } }