void DrawPlayScreen (void) { int i,j,p,m; unsigned temp; VW_FadeOut (); temp = bufferofs; CA_CacheGrChunk (STATUSBARPIC); for (i=0;i<3;i++) { bufferofs = screenloc[i]; DrawPlayBorder (); VWB_DrawPic (0,200-STATUSLINES,STATUSBARPIC); } bufferofs = temp; UNCACHEGRCHUNK (STATUSBARPIC); DrawFace (); DrawHealth (); DrawLives (); DrawLevel (); DrawAmmo (); DrawKeys (); DrawWeapon (); DrawScore (); }
void PlayDemo (int demonumber) { int length; #ifdef DEMOSEXTERN // debug: load chunk #ifndef SPEARDEMO int dems[4]={T_DEMO0,T_DEMO1,T_DEMO2,T_DEMO3}; #else int dems[1]={T_DEMO0}; #endif CA_CacheGrChunk(dems[demonumber]); demoptr = grsegs[dems[demonumber]]; MM_SetLock (&grsegs[dems[demonumber]],true); #else demoname[4] = '0'+demonumber; CA_LoadFile (demoname,&demobuffer); MM_SetLock (&demobuffer,true); demoptr = (char far *)demobuffer; #endif NewGame (1,0); gamestate.mapon = *demoptr++; gamestate.difficulty = gd_hard; length = *((unsigned far *)demoptr)++; demoptr++; lastdemoptr = demoptr-4+length; VW_FadeOut (); SETFONTCOLOR(0,15); DrawPlayScreen (); VW_FadeIn (); startgame = false; demoplayback = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); #ifdef DEMOSEXTERN UNCACHEGRCHUNK(dems[demonumber]); #else MM_FreePtr (&demobuffer); #endif demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); }
void EndScreen (int palette, int screen) { CA_CacheScreen (screen); VW_UpdateScreen (); CA_CacheGrChunk (palette); VL_FadeIn(0,255,grsegs[palette],30); UNCACHEGRCHUNK (palette); IN_ClearKeysDown (); IN_Ack (); VW_FadeOut (); }
//------------------------------------------------------------------------- // InvalidLevels() //------------------------------------------------------------------------- void InvalidLevels() { char *chunkptr; CA_CacheGrChunk(BADLEVELSTEXT); chunkptr = static_cast<char*>(grsegs[BADLEVELSTEXT]); *(strstr(chunkptr,"^XX"))=0; fprint(chunkptr); UNCACHEGRCHUNK(BADLEVELSTEXT); }
void EndScreen (int palette, int screen) { SDL_Color pal[256]; CA_CacheScreen (screen); VW_UpdateScreen (); CA_CacheGrChunk (palette); VL_ConvertPalette(grsegs[palette], pal, 256); VL_FadeIn (0, 255, pal, 30); UNCACHEGRCHUNK (palette); IN_ClearKeysDown (); IN_Ack (); VW_FadeOut (); }
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(); IN_UserInput(TickBase*7); VW_FadeOut (); }
void EndSpear(void) { EndScreen (END1PALETTE, ENDSCREEN11PIC); CA_CacheScreen (ENDSCREEN3PIC); VW_UpdateScreen (); CA_CacheGrChunk (END3PALETTE); VL_FadeIn(0,255,grsegs[END3PALETTE],30); UNCACHEGRCHUNK (END3PALETTE); fontnumber = 0; fontcolor = 0xd0; WindowX = 0; WindowW = 320; PrintX = 0; PrintY = 180; US_CPrint (STR_ENDGAME1"\n"); US_CPrint (STR_ENDGAME2); VW_UpdateScreen (); IN_StartAck (); TimeCount = 0; while (!IN_CheckAck () && TimeCount < 700); PrintX = 0; PrintY = 180; VWB_Bar(0,180,320,20,0); US_CPrint (STR_ENDGAME3"\n"); US_CPrint (STR_ENDGAME4); VW_UpdateScreen (); IN_StartAck (); TimeCount = 0; while (!IN_CheckAck () && TimeCount < 700); VW_FadeOut (); EndScreen (END4PALETTE, ENDSCREEN4PIC); EndScreen (END5PALETTE, ENDSCREEN5PIC); EndScreen (END6PALETTE, ENDSCREEN6PIC); EndScreen (END7PALETTE, ENDSCREEN7PIC); EndScreen (END8PALETTE, ENDSCREEN8PIC); EndScreen (END9PALETTE, ENDSCREEN9PIC); EndScreen (END2PALETTE, ENDSCREEN12PIC); MainMenu[savegame].active = 0; }
void EndSpear (void) { SDL_Color pal[256]; EndScreen (END1PALETTE, ENDSCREEN11PIC); CA_CacheScreen (ENDSCREEN3PIC); VW_UpdateScreen (); CA_CacheGrChunk (END3PALETTE); VL_ConvertPalette(grsegs[END3PALETTE], pal, 256); VL_FadeIn (0, 255, pal, 30); UNCACHEGRCHUNK (END3PALETTE); fontnumber = 0; fontcolor = 0xd0; WindowX = 0; WindowW = 320; PrintX = 0; PrintY = 180; US_CPrint (STR_ENDGAME1 "\n"); US_CPrint (STR_ENDGAME2); VW_UpdateScreen (); IN_UserInput(700); PrintX = 0; PrintY = 180; VWB_Bar (0, 180, 320, 20, 0); US_CPrint (STR_ENDGAME3 "\n"); US_CPrint (STR_ENDGAME4); VW_UpdateScreen (); IN_UserInput(700); VW_FadeOut (); EndScreen (END4PALETTE, ENDSCREEN4PIC); EndScreen (END5PALETTE, ENDSCREEN5PIC); EndScreen (END6PALETTE, ENDSCREEN6PIC); EndScreen (END7PALETTE, ENDSCREEN7PIC); EndScreen (END8PALETTE, ENDSCREEN8PIC); EndScreen (END9PALETTE, ENDSCREEN9PIC); EndScreen (END2PALETTE, ENDSCREEN12PIC); MainMenu[savegame].active = 0; }
void DisplayPrepingMsg( const char* text) { // Bomb out if FILE_ID.DIZ is bad!! // if (!::is_aog_sw()) { if (((gamestate.mapon != 1) || (gamestate.episode != 0)) && (gamestate.flags & GS_BAD_DIZ_FILE)) { Quit(); } } // Cache-in font // fontnumber = 1; CA_CacheGrChunk(STARTFONT + 1); BMAmsg(text); UNCACHEGRCHUNK(STARTFONT + 1); // BBi No progress bars #if 0 // Set thermometer boundaries // WindowX = 36; WindowY = 188; WindowW = 260; WindowH = 32; // Init MAP and GFX thermometer areas // VWB_Bar(WindowX, WindowY - 7, WindowW - 10, 2, BORDER_LO_COLOR); VWB_Bar(WindowX, WindowY - 7, WindowW - 11, 1, BORDER_TEXT_COLOR - 15); VWB_Bar(WindowX, WindowY, WindowW - 10, 2, BORDER_LO_COLOR); VWB_Bar(WindowX, WindowY, WindowW - 11, 1, BORDER_TEXT_COLOR - 15); #endif // Update screen and fade in // VW_UpdateScreen(); if (screenfaded) { VW_FadeIn(); } }
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 CheckKeys (void) { ScanCode scan; if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #ifdef SPEAR // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (NOBONUSSND); } else { Message ("God mode ON"); SD_PlaySound (ENDBONUS2SND); } IN_Ack (); godmode ^= 1; DrawPlayBorderSides (); IN_ClearKeysDown (); return; } #endif // // SECRET CHEAT CODE: 'MLI' // if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I]) { gamestate.health = 100; gamestate.ammo = 99; gamestate.keys = 3; gamestate.score = 0; gamestate.TimeCount += 42000L; GiveWeapon (wp_chaingun); DrawWeapon (); DrawHealth (); DrawKeys (); DrawAmmo (); DrawScore (); ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message (STR_CHEATER1 "\n" STR_CHEATER2 "\n\n" STR_CHEATER3 "\n" STR_CHEATER4 "\n" STR_CHEATER5); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); if (viewsize < 17) DrawPlayBorder (); } // // OPEN UP DEBUG KEYS // #ifdef DEBUGKEYS if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && param_debugmode) { ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message ("Debugging keys are\nnow available!"); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); DrawPlayBorderSides (); DebugOk = 1; } #endif // // TRYING THE KEEN CHEAT CODE! // if (Keyboard[sc_B] && Keyboard[sc_A] && Keyboard[sc_T]) { ClearMemory (); CA_CacheGrChunk (STARTFONT + 1); ClearSplitVWB (); Message ("Commander Keen is also\n" "available from Apogee, but\n" "then, you already know\n" "that - right, Cheatmeister?!"); UNCACHEGRCHUNK (STARTFONT + 1); IN_ClearKeysDown (); IN_Ack (); if (viewsize < 18) DrawPlayBorder (); } // // pause key weirdness can't be checked as a scan code // if(buttonstate[bt_pause]) Paused = true; if(Paused) { int lastoffs = StopMusic(); LatchDrawPic (20 - 4, 80 - 2 * 8, PAUSEDPIC); VH_UpdateScreen(); IN_Ack (); Paused = false; ContinueMusic(lastoffs); if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement lasttimecount = GetTimeCount(); return; } // // F1-F7/ESC to enter control panel // if ( #ifndef DEBCHECK scan == sc_F10 || #endif scan == sc_F9 || scan == sc_F7 || scan == sc_F8) // pop up quit dialog { short oldmapon = gamestate.mapon; short oldepisode = gamestate.episode; ClearMemory (); ClearSplitVWB (); US_ControlPanel (scan); DrawPlayBorderSides (); SETFONTCOLOR (0, 15); IN_ClearKeysDown (); return; } if ((scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape || buttonstate[bt_esc]) { int lastoffs = StopMusic (); ClearMemory (); VW_FadeOut (); US_ControlPanel (buttonstate[bt_esc] ? sc_Escape : scan); SETFONTCOLOR (0, 15); IN_ClearKeysDown (); VW_FadeOut(); if(viewsize != 21) DrawPlayScreen (); if (!startgame && !loadedgame) ContinueMusic (lastoffs); if (loadedgame) playstate = ex_abort; lasttimecount = GetTimeCount(); if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement return; } // // TAB-? debug keys // #ifdef DEBUGKEYS if (Keyboard[sc_Tab] && DebugOk) { CA_CacheGrChunk (STARTFONT); fontnumber = 0; SETFONTCOLOR (0, 15); if (DebugKeys () && viewsize < 20) DrawPlayBorder (); // dont let the blue borders flash if (MousePresent && IN_IsInputGrabbed()) IN_CenterMouse(); // Clear accumulated mouse movement lasttimecount = GetTimeCount(); return; } #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 CheckKeys (void) { int i; byte scan; unsigned temp; if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #ifdef SPEAR // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (NOBONUSSND); } else { Message ("God mode ON"); SD_PlaySound (ENDBONUS2SND); } IN_Ack(); godmode ^= 1; DrawAllPlayBorderSides (); IN_ClearKeysDown(); return; } #endif // // SECRET CHEAT CODE: 'MLI' // if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I]) { gamestate.health = 100; gamestate.ammo = 99; gamestate.keys = 3; gamestate.score = 0; gamestate.TimeCount += 42000L; GiveWeapon (wp_chaingun); DrawWeapon(); DrawHealth(); DrawKeys(); DrawAmmo(); DrawScore(); ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message(STR_CHEATER1"\n" STR_CHEATER2"\n\n" STR_CHEATER3"\n" STR_CHEATER4"\n" STR_CHEATER5); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorder (); } // // OPEN UP DEBUG KEYS // #ifndef SPEAR if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && MS_CheckParm("goobers")) #else if (Keyboard[sc_BackSpace] && Keyboard[sc_LShift] && Keyboard[sc_Alt] && MS_CheckParm("debugmode")) #endif { ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message("Debugging keys are\nnow available!"); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorderSides (); DebugOk=1; } // // TRYING THE KEEN CHEAT CODE! // if (Keyboard[sc_B] && Keyboard[sc_A] && Keyboard[sc_T]) { ClearMemory (); CA_CacheGrChunk (STARTFONT+1); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); Message("Commander Keen is also\n" "available from Apogee, but\n" "then, you already know\n" "that - right, Cheatmeister?!"); UNCACHEGRCHUNK(STARTFONT+1); PM_CheckMainMem (); IN_ClearKeysDown(); IN_Ack(); DrawAllPlayBorder (); } // // pause key weirdness can't be checked as a scan code // if (Paused) { bufferofs = displayofs; LatchDrawPic (20-4,80-2*8,PAUSEDPIC); SD_MusicOff(); IN_Ack(); IN_ClearKeysDown (); SD_MusicOn(); Paused = False; //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement return; } // // F1-F7/ESC to enter control panel // if ( #ifndef DEBCHECK scan == sc_F10 || #endif scan == sc_F9 || scan == sc_F7 || scan == sc_F8) // pop up quit dialog { ClearMemory (); ClearSplitVWB (); VW_ScreenToScreen (displayofs,bufferofs,80,160); US_ControlPanel(scan); DrawAllPlayBorderSides (); if (scan == sc_F9) StartMusic (); PM_CheckMainMem (); SETFONTCOLOR(0,15); IN_ClearKeysDown(); return; } if ( (scan >= sc_F1 && scan <= sc_F9) || scan == sc_Escape) { StopMusic (); ClearMemory (); VW_FadeOut (); US_ControlPanel(scan); SETFONTCOLOR(0,15); IN_ClearKeysDown(); DrawPlayScreen (); if (!startgame && !loadedgame) { VW_FadeIn (); StartMusic (); } if (loadedgame) playstate = ex_abort; lasttimecount = TimeCount; //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement PM_CheckMainMem (); return; } // // TAB-? debug keys // if (Keyboard[sc_Tab] && DebugOk) { CA_CacheGrChunk (STARTFONT); fontnumber=0; SETFONTCOLOR(0,15); DebugKeys(); //if (MousePresent) // PORT // Mouse(MDelta); // Clear accumulated mouse movement lasttimecount = TimeCount; return; } }
//------------------------------------------------------------------------ // 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 }
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); } } } }