void FinishDemoRecord (void) { long length,level; demorecord = false; length = demoptr - (char far *)demobuffer; demoptr = ((char far *)demobuffer)+1; *(unsigned far *)demoptr = length; CenterWindow(24,3); PrintY+=6; US_Print(" Demo number (0-9):"); VW_UpdateScreen(); if (US_LineInput (px,py,str,NULL,true,2,0)) { level = atoi (str); if (level>=0 && level<=9) { demoname[4] = '0'+level; CA_WriteFile (demoname,(void far *)demobuffer,length); } } MM_FreePtr (&demobuffer); }
void RecordDemo (void) { int level,esc; CenterWindow(26,3); PrintY+=6; CA_CacheGrChunk(STARTFONT); fontnumber=0; US_Print(" Demo which level(1-10):"); VW_UpdateScreen(); VW_FadeIn (); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (esc) return; level = atoi (str); level--; SETFONTCOLOR(0,15); VW_FadeOut (); #ifndef SPEAR NewGame (gd_hard,level/10); gamestate.mapon = level%10; #else NewGame (gd_hard,0); gamestate.mapon = level; #endif StartDemoRecord (level); DrawPlayScreen (); VW_FadeIn (); startgame = false; demorecord = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); FinishDemoRecord (); }
int DebugKeys() { boolean esc; int level; if (IN_KeyDown(sc_C)) // C = count objects { CountObjects(); return 1; } if (IN_KeyDown(sc_E)) // E = quit level { playstate = ex_completed; // gamestate.mapon++; } if (IN_KeyDown(sc_F)) // F = facing spot { CenterWindow (14,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("\nY:"); US_PrintUnsigned (player->y); US_Print ("\nA:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } if (IN_KeyDown(sc_G)) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } if (IN_KeyDown(sc_H)) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (IN_KeyDown(sc_I)) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); GivePoints(100000); HealSelf(99); if (gamestate.bestweapon<wp_chaingun) GiveWeapon (gamestate.bestweapon+1); gamestate.ammo += 50; if (gamestate.ammo > 99) gamestate.ammo = 99; DrawAmmo (); IN_Ack (); return 1; } else if (IN_KeyDown(sc_N)) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (IN_KeyDown(sc_P)) // P = pause with no screen disruptioon { PicturePause (); return 1; } else if (IN_KeyDown(sc_Q)) // Q = fast quit Quit(NULL); else if (IN_KeyDown(sc_S)) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (IN_KeyDown(sc_T)) // T = shape test { ShapeTest(); return 1; } else if (IN_KeyDown(sc_W)) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10):"); #elif defined(SPEARDEMO) US_Print(" Warp to which level(1-2):"); #else US_Print(" Warp to which level(1-21):"); #endif VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); #ifndef SPEAR if (level>0 && level<11) #elif defined(SPEARDEMO) if (level>0 && level<2) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } DrawPlayBorder(); return 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; }
/* ================ = = DebugKeys = ================ */ id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level; #if FRILLS if (Keyboard[0x12] && ingame) // DEBUG: end + 'E' to quit level { if (tedlevel) TEDDeath(); playstate = levelcomplete; } #endif if (Keyboard[0x22] && ingame) // G = god mode { VW_FixRefreshBuffer (); US_CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } else if (Keyboard[0x17]) // I = item cheat { VW_FixRefreshBuffer (); US_CenterWindow (12,3); US_PrintCentered ("Free items!"); gamestate.boobusbombs=99; gamestate.flowerpowers=99; gamestate.keys=99; VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[0x24]) // J = jump cheat { jumpcheat^=1; VW_FixRefreshBuffer (); US_CenterWindow (18,3); if (jumpcheat) US_PrintCentered ("Jump cheat ON"); else US_PrintCentered ("Jump cheat OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #if FRILLS else if (Keyboard[0x32]) // M = memory info { DebugMemory(); return 1; } #endif else if (Keyboard[0x19]) // P = pause with no screen disruptioon { IN_Ack(); } else if (Keyboard[0x1f] && ingame) // S = slow motion { singlestep^=1; VW_FixRefreshBuffer (); US_CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #if FRILLS else if (Keyboard[0x14]) // T = sprite test { TestSprites(); return 1; } #endif else if (Keyboard[0x11] && ingame) // W = warp to level { VW_FixRefreshBuffer (); US_CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-16):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=16) { gamestate.mapon = level; playstate = warptolevel; } } return 1; } return 0; }
int DebugKeys (void) { boolean esc; int level; if (Keyboard[sc_B]) // B = border color { CenterWindow(20,3); PrintY+=6; US_Print(" Border color (0-56): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=99) { if (level<30) level += 31; else { if (level > 56) level=31; else level -= 26; } bordercol=level*4+3; if (bordercol == VIEWCOLOR) DrawStatusBorder(bordercol); DrawPlayBorder(); return 0; } } return 1; } if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = Darkone's FPS counter { CenterWindow (22,2); if (fpscounter) US_PrintCentered ("Darkone's FPS Counter OFF"); else US_PrintCentered ("Darkone's FPS Counter ON"); VW_UpdateScreen(); IN_Ack(); fpscounter ^= 1; /* if (!fpscounter) DrawPlayScreen(); */ return 1; } if (Keyboard[sc_E]) // E = quit level { if (param_tedlevel != -1) Quit (NULL); playstate = ex_completed; } if (Keyboard[sc_F]) // F = facing spot { char str[60]; CenterWindow (14,6); US_Print ("x:"); US_PrintUnsigned (player->x); US_Print (" ("); US_PrintUnsigned (player->x%65536); US_Print (")\ny:"); US_PrintUnsigned (player->y); US_Print (" ("); US_PrintUnsigned (player->y%65536); US_Print (")\nA:"); US_PrintUnsigned (player->angle); US_Print (" X:"); US_PrintUnsigned (player->tilex); US_Print (" Y:"); US_PrintUnsigned (player->tiley); US_Print ("\n1:"); US_PrintUnsigned (tilemap[player->tilex][player->tiley]); sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str); US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber); US_Print (" 2:"); US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1)); US_Print (" 3:"); if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256) US_PrintUnsigned (spotvis[player->tilex][player->tiley]); else US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags); VW_UpdateScreen(); IN_Ack(); return 1; } if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode == 0) US_PrintCentered ("God mode ON"); else if (godmode == 1) US_PrintCentered ("God (no flash)"); else if (godmode == 2) US_PrintCentered ("God mode OFF"); VW_UpdateScreen(); IN_Ack(); if (godmode != 2) godmode++; else godmode = 0; return 1; } if (Keyboard[sc_H]) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (Keyboard[sc_I]) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); GivePoints (100000); HealSelf (99); if (gamestate.bestweapon<wp_chaingun) GiveWeapon (gamestate.bestweapon+1); gamestate.ammo += 50; if (gamestate.ammo > 99) gamestate.ammo = 99; DrawAmmo (); IN_Ack (); return 1; } else if (Keyboard[sc_K]) // K = give keys { CenterWindow(16,3); PrintY+=6; US_Print(" Give Key (1-4): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,1,0); if (!esc) { level = atoi (str); if (level>0 && level<5) GiveKey(level-1); } return 1; } else if (Keyboard[sc_L]) // L = level ratios { byte x,start,end=LRpack; if (end == 8) // wolf3d { CenterWindow(17,10); start = 0; } else // sod { CenterWindow(17,12); start = 0; end = 10; } again: for(x=start;x<end;x++) { US_PrintUnsigned(x+1); US_Print(" "); US_PrintUnsigned(LevelRatios[x].time/60); US_Print(":"); if (LevelRatios[x].time%60 < 10) US_Print("0"); US_PrintUnsigned(LevelRatios[x].time%60); US_Print(" "); US_PrintUnsigned(LevelRatios[x].kill); US_Print("% "); US_PrintUnsigned(LevelRatios[x].secret); US_Print("% "); US_PrintUnsigned(LevelRatios[x].treasure); US_Print("%\n"); } VW_UpdateScreen(); IN_Ack(); if (end == 10 && gamestate.mapon > 9) { start = 10; end = 20; CenterWindow(17,12); goto again; } return 1; } else if (Keyboard[sc_N]) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[sc_O]) // O = basic overhead { BasicOverhead(); return 1; } /*else if(Keyboard[sc_P]) // P = Ripper's picture grabber { PictureGrabber(); return 1; } */ else if (Keyboard[sc_Q]) // Q = fast quit Quit (NULL); else if (Keyboard[sc_S]) // S = slow motion { CenterWindow(30,3); PrintY+=6; US_Print(" Slow Motion steps (default 14): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=50) singlestep = level; } return 1; } else if (Keyboard[sc_T]) // T = shape test { ShapeTest (); return 1; } else if (Keyboard[sc_V]) // V = extra VBLs { CenterWindow(30,3); PrintY+=6; US_Print(" Add how many extra VBLs(0-8): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,1,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } else if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10): "); #else US_Print(" Warp to which level(1-21): "); #endif VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); #ifndef SPEAR if (level>0 && level<11) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } else if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); // DEBUG: put stuff here IN_Ack (); return 1; } #ifdef USE_CLOUDSKY else if(Keyboard[sc_Z]) { char defstr[15]; CenterWindow(34,4); PrintY+=6; US_Print(" Recalculate sky with seek: "); int seekpx = px, seekpy = py; US_PrintUnsigned(curSky->seed); US_Print("\n Use color map (0-"); US_PrintUnsigned(numColorMaps - 1); US_Print("): "); int mappx = px, mappy = py; US_PrintUnsigned(curSky->colorMapIndex); VW_UpdateScreen(); sprintf(defstr, "%u", curSky->seed); esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0); if(esc) return 0; curSky->seed = (uint32_t) atoi(str); sprintf(defstr, "%u", curSky->colorMapIndex); esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0); if(esc) return 0; uint32_t newInd = (uint32_t) atoi(str); if(newInd < (uint32_t) numColorMaps) { curSky->colorMapIndex = newInd; InitSky(); } else { CenterWindow (18,3); US_PrintCentered ("Illegal color map!"); VW_UpdateScreen(); IN_Ack (); } } #endif return 0; }
id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level,i; #if 0 if (Keyboard[sc_A]) { id0_char_t levelstr[50]; id0_unsigned_t org_tile,org_mapon,msgnum; id0_boolean_t newmsg=true,newlevel=false; VW_FixRefreshBuffer (); CenterWindow (16,3); US_Print("\n"); US_CPrint("Message Test"); VW_UpdateScreen(); org_mapon = mapon; msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART; while (1) { // Get outta' here // if (Keyboard[sc_Escape]) { while (Keyboard[sc_Escape]) { BE_ST_ShortSleep(); } break; } // Move to previous message // if (Keyboard[sc_UpArrow]) { if (msgnum) { msgnum--; newmsg = true; } } // Move to next message // if (Keyboard[sc_DownArrow]) { if (msgnum < 24) { msgnum++; newmsg = true; } } // Move to previous level // if (Keyboard[sc_LeftArrow]) { if (mapon) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon--; newlevel = true; } } // Move to next level // if (Keyboard[sc_RightArrow]) { if (mapon < LASTMAP-2) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon++; newlevel = true; } } // Load new level text // if (newlevel) { CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); newmsg = true; newlevel=false; } // Display new message text // if (newmsg) { *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART; DrawText(true); strcpy(levelstr,"Level: "); itoa(mapon,levelstr+strlen(levelstr),10); strcat(levelstr," Msg: "); itoa(msgnum,levelstr+strlen(levelstr),10); DisplaySMsg(levelstr,NULL); newmsg = false; if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow]) VW_WaitVBL(6); } BE_ST_ShortSleep(); } // Restore game // MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon = org_mapon; CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile; DrawText(true); status_flag = 0; } #endif if (Keyboard[sc_T]) { VW_FixRefreshBuffer (); CenterWindow (16,4); US_Print("Tics :"); US_PrintUnsigned (tics); US_Print("\nReal Tics :"); US_PrintUnsigned(realtics); VW_UpdateScreen(); IN_Ack (); } if (Keyboard[sc_V]) { displayofs = bufferofs = screenloc[screenpage]; CenterWindow (20,5); US_CPrint(refkeen_compat_gelib_c4_debug_str_with_gamename); //US_CPrint("\n"GAMENAME); US_CPrint(VERSION); US_CPrint(REVISION); VW_UpdateScreen(); IN_Ack (); } if (Keyboard[sc_Q]) // Q = Insta-Quit! Quit("Insta-Quit!"); if (Keyboard[sc_Z]) // Z = freeze Time { if (FreezeTime) FreezeTime = 1; // Allow refresh to dec to zero.. else StopTime(); IN_Ack(); return 1; } // if (Keyboard[sc_E]) // FaceDoor((player->x>>16l)+1,(player->y>>16l)); // FaceAngle(90); #if 0 if (Keyboard[sc_B]) // B = border color { CenterWindow(24,3); PrintY+=6; US_Print(" Border color (0-15):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=15) VW_ColorBorder (level); } return 1; } #endif #if 0 if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = start / end demo record { if (DemoMode == demo_Off) StartDemoRecord (); else if (DemoMode == demo_Record) { EndDemoRecord (); playstate = ex_completed; } return 1; } #endif #if 0 if (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } #endif #if 0 if (Keyboard[sc_F]) // F = facing spot { CenterWindow (12,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("Y:"); US_PrintUnsigned (player->y); US_Print ("A:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } #endif if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } #if 0 if (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } #endif if (Keyboard[sc_I]) // I = item cheat { extern id0_boolean_t redraw_gems; CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); // if (!gamestate.keys[i]) GiveKey (i); gamestate.gems[i] = GEM_DELAY_TIME; } gamestate.gems[4] = GEM_DELAY_TIME; redraw_gems = true; for (i=0;i<8;i++) GiveScroll (i,false); IN_Ack (); return 1; } if (Keyboard[sc_M]) // M = memory info { DebugMemory(); return 1; } #if DEBUG_OVERHEAD if (Keyboard[sc_O]) // O = overhead { ViewMap(); return 1; } #endif #if 0 if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } #endif #if 0 if (Keyboard[sc_S]) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #endif #if 0 if (Keyboard[sc_V]) // V = extra VBLs { CenterWindow(30,3); PrintY+=6; US_Print(" Add how many extra VBLs(0-8):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } #endif if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-18):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=LASTMAP-1) { gamestate.mapon = level; playstate = ex_warped; lasttext = -1; } } return 1; } #if 0 if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); } IN_Ack (); return 1; } #endif if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls { GiveScroll (LastScan-sc_1,false); IN_ClearKeysDown (); } return 0; }
int DebugKeys (void) { boolean esc; int level,i; #if DEBUG_KEYS_AVAILABLE if (Keyboard[sc_R]) { CenterWindow (12,2); if (autofire) US_PrintCentered ("Rapid-Fire OFF"); else US_PrintCentered ("Rapid-Fire ON"); VW_UpdateScreen(); IN_Ack(); autofire ^= 1; return 1; } #endif #if DEBUG_KEYS_AVAILABLE if (Keyboard[sc_A]) { char levelstr[50]; unsigned org_tile,org_mapon,msgnum; boolean newmsg=true,newlevel=false; VW_FixRefreshBuffer (); CenterWindow (16,3); US_Print("\n"); US_CPrint("Message Test"); VW_UpdateScreen(); org_mapon = mapon; msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART; while (1) { // Get outta' here // if (Keyboard[sc_Escape]) { while (Keyboard[sc_Escape]); break; } // Move to previous message // if (Keyboard[sc_UpArrow]) { if (msgnum) { msgnum--; newmsg = true; } } // Move to next message // if (Keyboard[sc_DownArrow]) { if (msgnum < 24) { msgnum++; newmsg = true; } } // Move to previous level // if (Keyboard[sc_LeftArrow]) { if (mapon) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon--; newlevel = true; } } // Move to next level // if (Keyboard[sc_RightArrow]) { if (mapon < LASTMAP-1) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon++; newlevel = true; } } // Load new level text // if (newlevel) { CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); newmsg = true; newlevel=false; } // Display new message text // if (newmsg) { *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART; DrawText(true); strcpy(levelstr,"Level: "); itoa(mapon,levelstr+strlen(levelstr),10); strcat(levelstr," Msg: "); itoa(msgnum,levelstr+strlen(levelstr),10); DisplaySMsg(levelstr,NULL); newmsg = false; if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow]) VW_WaitVBL(6); } } // Restore game // MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon = org_mapon; CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile; DrawText(true); status_flag = 0; } if (Keyboard[sc_V]) { displayofs = bufferofs = screenloc[screenpage]; CenterWindow (16,4); US_CPrint("\n"GAMENAME); US_CPrint(VERSION); US_CPrint(REVISION); VW_UpdateScreen(); IN_Ack (); } #endif if (Keyboard[sc_Q]) // Q = Insta-Quit! Quit("Insta-Quit!"); #if 0 if (Keyboard[sc_Z]) // Z = freeze Time { if (FreezeTime) FreezeTime = 1; // Allow refresh to dec to zero.. else StopTime(); IN_Ack(); return 1; } #endif // if (Keyboard[sc_E]) // FaceDoor((player->x>>16l)+1,(player->y>>16l)); // FaceAngle(90); #if 0 if (Keyboard[sc_B]) // B = border color { CenterWindow(24,3); PrintY+=6; US_Print(" Border color (0-15):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=15) VW_ColorBorder (level); } return 1; } #endif #if 1//DEBUG_KEYS_AVAILABLE if (Keyboard[sc_O]) { extern unsigned objectcount,latchmemavail; unsigned unused,total; CenterWindow (30,13); US_Print ("Objects: "); US_PrintUnsigned (objectcount); US_Print("\n\nTics: "); US_PrintUnsigned (tics); US_Print(" Real Tics: "); US_PrintUnsigned(realtics); US_Print ("\n\n Total Available: "); US_PrintUnsigned (mminfo.mainmem/1024); US_Print ("k\n Mem In Use: "); unused=MM_UnusedMemory()/1024; US_PrintUnsigned (unused); US_Print ("k\n Mem After Purge: "); total=MM_TotalFree()/1024; US_PrintUnsigned (total); US_Print ("k ("); US_PrintUnsigned (total-unused); US_Print (")\n\nLatch Mem Free: "); US_PrintUnsigned (latchmemavail); US_Print ("\n"); VW_UpdateScreen(); IN_Ack(); } if (colordelay<1) { if (Keyboard[26]) { extern unsigned *groundcolor,debug_gnd; groundcolor = &debug_gnd; debug_gnd += 0x0101; if (debug_gnd == 0x1010) debug_gnd = 0; colordelay = 10; } if (Keyboard[27]) { extern unsigned *skycolor,debug_sky; skycolor = &debug_sky; debug_sky += 0x0101; if (debug_sky == 0x1010) debug_sky = 0; colordelay = 10; } } else colordelay -= realtics; #endif #if 0 if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = start / end demo record { if (DemoMode == demo_Off) StartDemoRecord (); else if (DemoMode == demo_Record) { EndDemoRecord (); playstate = ex_completed; } return 1; } #endif #if 0 if (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } #endif #if 0 if (Keyboard[sc_F]) // F = facing spot { CenterWindow (12,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("Y:"); US_PrintUnsigned (player->y); US_Print ("A:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } #endif if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } #if 0 if (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } #endif if (Keyboard[sc_I]) // I = item cheat { extern boolean redraw_gems; CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); // if (!gamestate.keys[i]) GiveKey (i); gamestate.gems[i] = GEM_DELAY_TIME; } gamestate.gems[4] = GEM_DELAY_TIME; redraw_gems = true; ///////// for (i=0;i<8;i++) ///////// GiveScroll (i,false); IN_Ack (); return 1; } #if DEBUG_OVERHEAD if (Keyboard[sc_Z]) // O is used elsewhere... { ViewMap(); return 1; } #endif #if 0 if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } #endif #if 0 if (Keyboard[sc_S]) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #endif #if 0 if (Keyboard[sc_V]) // V = extra VBLs { CenterWindow(30,3); PrintY+=6; US_Print(" Add how many extra VBLs(0-8):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } #endif if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-17):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=LASTMAP-1) { gamestate.mapon = level; playstate = ex_warped; lasttext = -1; } } return 1; } #if 0 if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); } IN_Ack (); return 1; } #endif //////// if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls //////// { //////// GiveScroll (LastScan-sc_1,false); //////// IN_ClearKeysDown (); //////// } return 0; }
//------------------------------------------------------------------------ // 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 }
id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level,i; if (Keyboard[sc_B]) // B = border color { CenterWindow(24,3); PrintY+=6; US_Print(" Border color (0-15):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=15) VW_ColorBorder (level); } return 1; } #if 0 if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = start / end demo record { if (DemoMode == demo_Off) StartDemoRecord (); else if (DemoMode == demo_Record) { EndDemoRecord (); playstate = ex_completed; } return 1; } #endif if (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } if (Keyboard[sc_F]) // F = facing spot { CenterWindow (12,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("Y:"); US_PrintUnsigned (player->y); US_Print ("A:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } if (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } else if (Keyboard[sc_I]) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); if (!gamestate.keys[i]) GiveKey (i); } for (i=0;i<8;i++) GiveScroll (i,false); IN_Ack (); return 1; } else if (Keyboard[sc_M]) // M = memory info { DebugMemory(); return 1; } else if (Keyboard[sc_O]) // O = overhead { ViewMap(); return 1; } else if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } else if (Keyboard[sc_S]) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[sc_S]) // T = shape test { ShapeTest (); return 1; } else if (Keyboard[sc_V]) // V = extra VBLs { CenterWindow(30,3); PrintY+=6; US_Print(" Add how many extra VBLs(0-8):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } else if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(1-21):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>0 && level<21) { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } else if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); } IN_Ack (); return 1; } else if (Keyboard[sc_Z]) // Z = game over { } else if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls { GiveScroll (LastScan-sc_1,false); IN_ClearKeysDown (); } return 0; }