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 (); }
/////////////////////////////////////////////////////////////// // Draw Level /////////////////////////////////////////////////////////////// void DrawDemoLevel(void) { DrawCurrentLevel(); DrawConv(); DrawKeys(); DrawSwitches(); DrawExit(); DrawTPlate(); DrawAirBG(); DoHRobo(); DoVRobo(); DoSpecialRobo(); DrawExit(); DrawAir(); FontPrint(0,18," "); FontPrint(0,19," "); FontPrint(0,20," "); FontPrint(0,21," "); FontPrint(0,22," "); FontPrint(0,23," "); PrintScore(); PrintHighScore(); DrawLives(); }
/////////////////////////////////////////////////////////////// // Do Demo /////////////////////////////////////////////////////////////// void RunDemo(void) { int speed,i; cWILLYx=0; cWILLYy=128; SwapPage2(); NEXTBIT=FrCt+SPEED; RemoveSPG(); RemoveSky(); RemoveKong(); RemoveVRobo(); RemoveHRobo(); RemoveEugene(); DrawKeys(); DrawConv(); DrawSwitches(); DoHRobo(); DoVRobo(); DoSpecialRobo(); DrawExit(); DrawAir(); DrawLives(); DEMOp++; if(DEMOp>60) { DEMOm=2; LevelDoneExtra(); SwapPage(); LevelDoneExtra(); for(i=0;i<8;i++) { PaletteSet(PALwhite); WaitVR(); PaletteSet(PALmain); WaitVR(); } } if(AnyKeyx()==1) { MODE=0; TITLEm=0; MIDASstopModule(modon); modon=0; } }
// Render void _InventoryScreen::Render(double BlendFactor) { if(!Element->Active) return; Element->Render(); if(InventoryElement->Active) { EquipmentElement->Render(); InventoryElement->Render(); DrawBag(BagType::EQUIPMENT); DrawBag(BagType::INVENTORY); } else if(KeysElement->Active) { KeysElement->Render(); DrawKeys(); } }
void CKeyControl::OnPaint() { CPaintDC dc(this); // device context for painting // Clear the background ClearMemDC(); // Draw the time bar DrawTimeBar(); // Draw the contents DrawKeys(); // Blit the memory DC dc.BitBlt(0, 0, m_cx, m_cy, m_pMemDC, 0, 0, SRCCOPY); }
void CKeyControl::Redraw(CLinkListNode<KEY> *pSelectNode) { CDC *pDC = GetDC(); // Clear the background ClearMemDC(); // Draw the time bar DrawTimeBar(); // Draw the contents DrawKeys(pSelectNode); // Blit the memory DC pDC->BitBlt(0, 0, m_cx, m_cy, m_pMemDC, 0, 0, SRCCOPY); ReleaseDC(pDC); }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); DrawFrags(CPlayer, 5, hudheight-70); } DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); DrawLatency(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = Tics2Seconds(level.totaltime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = Tics2Seconds(level.time); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= Tics2Seconds(level.maptime); mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }
/* =================== = = GameLoop = =================== This function controls the flow between states of the game. It loads previous saved games, setup levels states, controls the flow between levels, including when player loses or when completes the game, and checks if the result of the current game is a highscore. The "real" game loop (player actions in like moving, killing, etc.) is in the PlayLoop function. */ void GameLoop (void) { int i,xl,yl,xh,yh; char num[20]; boolean died; #ifdef MYPROFILE /* clock_t type variables may register times, start and and times could be used to measure the speed of the graphics system. Speed is measured in fps- frames per second. */ clock_t start,end; #endif restartgame: ClearMemory (); SETFONTCOLOR(0,15); DrawPlayScreen (); died = false; restart: do { if (!loadedgame) gamestate.score = gamestate.oldscore; DrawScore(); startgame = false; if (loadedgame) loadedgame = false; else SetupGameLevel (); #ifdef SPEAR if (gamestate.mapon == 20) // give them the key allways { gamestate.keys |= 1; DrawKeys (); } #endif ingame = true; StartMusic (); PM_CheckMainMem (); if (!died) PreloadGraphics (); else died = false; fizzlein = true; DrawLevel (); startplayloop: PlayLoop (); #ifdef SPEAR if (spearflag) { SD_StopSound(); SD_PlaySound(GETSPEARSND); if (DigiMode != sds_Off) { long lasttimecount = TimeCount; while(TimeCount < lasttimecount+150) //while(DigiPlaying!=false) SD_Poll(); } else SD_WaitSoundDone(); ClearMemory (); gamestate.oldscore = gamestate.score; gamestate.mapon = 20; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); player->x = spearx; player->y = speary; player->angle = spearangle; spearflag = false; Thrust (0,0); goto startplayloop; } #endif StopMusic (); ingame = false; if (demorecord && playstate != ex_warped) FinishDemoRecord (); if (startgame || loadedgame) goto restartgame; switch (playstate) { case ex_completed: case ex_secretlevel: gamestate.keys = 0; DrawKeys (); VW_FadeOut (); ClearMemory (); LevelCompleted (); // do the intermission #ifdef SPEARDEMO if (gamestate.mapon == 1) { died = true; // don't "get psyched!" VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; } #endif #ifdef JAPDEMO if (gamestate.mapon == 3) { died = true; // don't "get psyched!" VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; } #endif gamestate.oldscore = gamestate.score; #ifndef SPEAR // // COMING BACK FROM SECRET LEVEL // if (gamestate.mapon == 9) gamestate.mapon = ElevatorBackTo[gamestate.episode]; // back from secret else // // GOING TO SECRET LEVEL // if (playstate == ex_secretlevel) gamestate.mapon = 9; #else #define FROMSECRET1 3 #define FROMSECRET2 11 // // GOING TO SECRET LEVEL // if (playstate == ex_secretlevel) switch(gamestate.mapon) { case FROMSECRET1: gamestate.mapon = 18; break; case FROMSECRET2: gamestate.mapon = 19; break; } else // // COMING BACK FROM SECRET LEVEL // if (gamestate.mapon == 18 || gamestate.mapon == 19) switch(gamestate.mapon) { case 18: gamestate.mapon = FROMSECRET1+1; break; case 19: gamestate.mapon = FROMSECRET2+1; break; } #endif else // // GOING TO NEXT LEVEL // gamestate.mapon++; break; case ex_died: Died (); died = true; // don't "get psyched!" if (gamestate.lives > -1) break; // more lives left VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; case ex_victorious: #ifndef SPEAR VW_FadeOut (); #else VL_FadeOut (0,255,0,17,17,300); #endif ClearMemory (); Victory (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; default: ClearMemory (); break; } } while (1); }
/** * * \name Died() * * Died * This function perfoms the process of animation the character's death and restart the level * if you still have lives. * */ void Died (void) { float fangle; long dx,dy; int iangle,curangle,clockwise,counter,change; /* -1 means the player has no weapon */ gamestate.weapon = -1; // take away weapon /* We need another way to play sounds */ SD_PlaySound (PLAYERDEATHSND); // // swing around to face attacker // /* could be a function for this animation like: died_animation() or died_rotated_animation() */ dx = killerobj->x - player->x; dy = player->y - killerobj->y; fangle = atan2(dy,dx); // returns -pi to pi if (fangle<0) fangle = M_PI*2+fangle; iangle = fangle/(M_PI*2)*ANGLES; if (player->angle > iangle) { counter = player->angle - iangle; clockwise = ANGLES-player->angle + iangle; } else { clockwise = iangle - player->angle; counter = player->angle + ANGLES-iangle; } curangle = player->angle; if (clockwise<counter) { // // rotate clockwise // if (curangle>iangle) curangle -= ANGLES; do { change = tics*DEATHROTATE; if (curangle + change > iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle >= ANGLES) player->angle -= ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } else { // // rotate counterclockwise // if (curangle<iangle) curangle += ANGLES; do { change = -tics*DEATHROTATE; if (curangle + change < iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle < 0) player->angle += ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } /* FINISH of rotation animation */ // // fade to red // FinishPaletteShifts (); bufferofs += screenofs; VW_Bar (0,0,viewwidth,viewheight,4); IN_ClearKeysDown (); FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,false); bufferofs -= screenofs; IN_UserInput(100); SD_WaitSoundDone (); if (tedlevel == false) // SO'S YA DON'T GET KILLED WHILE LAUNCHING! gamestate.lives--; if (gamestate.lives > -1) //if the character has lives, set a new level { gamestate.health = 100; gamestate.weapon = gamestate.bestweapon = gamestate.chosenweapon = wp_pistol; gamestate.ammo = STARTAMMO; gamestate.keys = 0; gamestate.attackframe = gamestate.attackcount = gamestate.weaponframe = 0; /* We need to change those Draw function to Draw3D functions. */ DrawKeys (); DrawWeapon (); DrawAmmo (); DrawHealth (); DrawFace (); DrawLives (); } }
void Died (void) { float fangle; long dx,dy; int iangle,curangle,clockwise,counter,change; gamestate.weapon = (weapontype)-1; // take away weapon SD_PlaySound (PLAYERDEATHSND); // // swing around to face attacker // dx = killerobj->x - player->x; dy = player->y - killerobj->y; fangle = atan2((float)dy,(float)dx); // returns -pi to pi // PORT add float cast if (fangle<0) fangle = M_PI*2+fangle; iangle = fangle/(M_PI*2)*ANGLES; if (player->angle > iangle) { counter = player->angle - iangle; clockwise = ANGLES-player->angle + iangle; } else { clockwise = iangle - player->angle; counter = player->angle + ANGLES-iangle; } curangle = player->angle; if (clockwise<counter) { // // rotate clockwise // if (curangle>iangle) curangle -= ANGLES; do { change = tics*DEATHROTATE; if (curangle + change > iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle >= ANGLES) player->angle -= ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } else { // // rotate counterclockwise // if (curangle<iangle) curangle += ANGLES; do { change = -tics*DEATHROTATE; if (curangle + change < iangle) change = iangle-curangle; curangle += change; player->angle += change; if (player->angle < 0) player->angle += ANGLES; ThreeDRefresh (); CalcTics (); } while (curangle != iangle); } // // fade to red // FinishPaletteShifts (); bufferofs += screenofs; VW_Bar (0,0,viewwidth,viewheight,4); IN_ClearKeysDown (); FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,False); bufferofs -= screenofs; IN_UserInput(100); SD_WaitSoundDone (); if (tedlevel == False) // SO'S YA DON'T GET KILLED WHILE LAUNCHING! gamestate.lives--; if (gamestate.lives > -1) { gamestate.health = 100; gamestate.weapon = gamestate.bestweapon = gamestate.chosenweapon = wp_pistol; gamestate.ammo = STARTAMMO; gamestate.keys = 0; gamestate.attackframe = gamestate.attackcount = gamestate.weaponframe = 0; DrawKeys (); DrawWeapon (); DrawAmmo (); DrawHealth (); DrawFace (); DrawLives (); } }
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 }
void DrawHUD() { player_t * CPlayer = StatusBar->CPlayer; // [BB] The player may not have a body while connecting. if ( CPlayer->mo == NULL ) return; players[consoleplayer].inventorytics = 0; if (hud_althudscale && SCREENWIDTH>640) { hudwidth=SCREENWIDTH/2; if (hud_althudscale == 2) { // Optionally just double the pixels to reduce scaling artifacts. hudheight=SCREENHEIGHT/2; } else { if (WidescreenRatio == 4) { hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode } else { hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]); } } } else { hudwidth=SCREENWIDTH; hudheight=SCREENHEIGHT; } if (!automapactive) { int i; // No HUD in the title level! if (gamestate == GS_TITLELEVEL || !CPlayer) return; if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50); else { DrawStatus(CPlayer, 5, hudheight-75); // [TP] Only draw frags if not playing in teams if (( GAMEMODE_GetCurrentFlags() & GMF_PLAYERSONTEAMS ) == 0 ) DrawFrags(CPlayer, 5, hudheight-70); } // [TP] Only draw health and armor if we are allowed to know those stats. Also don't // draw spectator's health/armor stats. if ( ShouldDrawHealth( CPlayer )) { DrawHealth(CPlayer, 5, hudheight-45); DrawArmor(CPlayer->mo->FindInventory<ABasicArmor>(), CPlayer->mo->FindInventory<AHexenArmor>(), 5, hudheight-20); } // [TP] Draw team stuff. DrawTeamScores( 10, hudheight - 90 ); i=DrawKeys(CPlayer, hudwidth-4, hudheight-10); i=DrawAmmo(CPlayer, hudwidth-5, i); DrawWeapons(CPlayer, hudwidth-5, i); DrawInventory(CPlayer, 144, hudheight-28); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); } if (idmypos) DrawCoordinates(CPlayer); DrawTime(); } else { FString mapname; char printstr[256]; int seconds; int length=8*SmallFont->GetCharWidth('0'); int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; if (am_showtotaltime) { seconds = level.totaltime / TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } if (am_showtime) { if (level.clusterflags&CLUSTER_HUB) { seconds = level.time /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } // Single level time for hubs seconds= level.maptime /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } ST_FormatMapName(mapname); screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); DrawCoordinates(CPlayer); } }
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; } }
void CheckKeys (void) { boolean one_eighty=false; Uint8 scan; static boolean Plus_KeyReleased; static boolean Minus_KeyReleased; static boolean I_KeyReleased; static boolean S_KeyReleased; #if IN_DEVELOPMENT || BETA_TEST // if (DebugOk && (Keyboard[sc_p] || PP_step)) // PicturePause (); #endif if (screenfaded || demoplayback) // don't do anything with a faded screen return; scan = LastScan; #if IN_DEVELOPMENT #ifdef ACTIVATE_TERMINAL if (Keyboard[sc_9] && Keyboard[sc_0]) ActivateTerminal(true); #endif #endif // // SECRET CHEAT CODE: 'JAM' // #if GAME_VERSION != SHAREWARE_VERSION if (Keyboard[sc_j] || Keyboard[sc_a] || Keyboard[sc_m]) { if (jam_buff[sizeof(jam_buff_cmp)-1] != LastScan) { memcpy(jam_buff,jam_buff+1,sizeof(jam_buff_cmp)-1); jam_buff[sizeof(jam_buff_cmp)-1] = LastScan; } } #endif CheckMusicToggle(); if (gamestate.rpower) { if (in_is_binding_pressed(e_bi_radar_magnify)) { if (Plus_KeyReleased && gamestate.rzoom<2) { UpdateRadarGuage(); gamestate.rzoom++; Plus_KeyReleased=false; } } else Plus_KeyReleased=true; if (in_is_binding_pressed(e_bi_radar_minify)) { if (Minus_KeyReleased && gamestate.rzoom) { UpdateRadarGuage(); gamestate.rzoom--; Minus_KeyReleased=false; } } else Minus_KeyReleased=true; } if (in_is_binding_pressed(e_bi_sfx)) { if (S_KeyReleased) { if ((SoundMode != sdm_Off) || (DigiMode!=sds_Off)) { if (SoundMode != sdm_Off) { SD_WaitSoundDone(); SD_SetSoundMode(sdm_Off); } if (DigiMode!=sds_Off) SD_SetDigiDevice(sds_Off); memcpy((char *)&SoundOn[55],"OFF.",4); } else { ClearMemory(); if (SoundBlasterPresent || AdLibPresent) SD_SetSoundMode(sdm_AdLib); else SD_SetSoundMode(sdm_Off); if (SoundBlasterPresent) SD_SetDigiDevice(sds_SoundBlaster); else if (SoundSourcePresent) SD_SetDigiDevice(sds_SoundSource); else SD_SetDigiDevice(sds_Off); CA_LoadAllSounds(); memcpy((char *)&SoundOn[55],"ON. ",4); } DISPLAY_TIMED_MSG(SoundOn,MP_BONUS,MT_GENERAL); S_KeyReleased=false; } } else S_KeyReleased=true; if (Keyboard[sc_return]) { #if (GAME_VERSION != SHAREWARE_VERSION) || GEORGE_CHEAT char loop; if ((!memcmp(jam_buff,jam_buff_cmp,sizeof(jam_buff_cmp)))) { jam_buff[0]=0; for (loop=0; loop<NUMKEYS; loop++) if (gamestate.numkeys[static_cast<int>(loop)] < MAXKEYS) gamestate.numkeys[static_cast<int>(loop)]=1; gamestate.health = 100; gamestate.ammo = MAX_AMMO; gamestate.rpower = MAX_RADAR_ENERGY; if (!DebugOk) { gamestate.score = 0; gamestate.nextextra = EXTRAPOINTS; } gamestate.TimeCount += 42000L; for (loop=0; loop<NUMWEAPONS-1; loop++) GiveWeapon(loop); DrawWeapon(); DrawHealth(); DrawKeys(); DrawScore(); DISPLAY_TIMED_MSG("\r\r YOU CHEATER!",MP_INTERROGATE,MT_GENERAL); ForceUpdateStatusBar(); ClearMemory (); ClearSplitVWB (); VW_ScreenToScreen (static_cast<Uint16>(displayofs),static_cast<Uint16>(bufferofs),80,160); Message("\n NOW you're jammin'!! \n"); IN_ClearKeysDown(); IN_Ack(); CleanDrawPlayBorder(); } else if (!in_use_modern_bindings) #endif one_eighty=true; } // Handle quick turning! // if (!gamestate.turn_around) { // 90 degrees left // if (in_is_binding_pressed(e_bi_quick_left)) { gamestate.turn_around = -90; gamestate.turn_angle = player->angle + 90; if (gamestate.turn_angle > 359) gamestate.turn_angle -= ANGLES; } // 180 degrees right // if (in_is_binding_pressed(e_bi_turn_around) || one_eighty) { gamestate.turn_around = 180; gamestate.turn_angle = player->angle + 180; if (gamestate.turn_angle > 359) gamestate.turn_angle -= ANGLES; } // 90 degrees right // if (in_is_binding_pressed(e_bi_quick_right)) { gamestate.turn_around = 90; gamestate.turn_angle = player->angle - 90; if (gamestate.turn_angle < 0) gamestate.turn_angle += ANGLES; } } // // pause key weirdness can't be checked as a scan code // if (in_is_binding_pressed(e_bi_pause)) { SD_MusicOff(); fontnumber = 4; BMAmsg(PAUSED_MSG); IN_Ack(); IN_ClearKeysDown(); fontnumber = 2; RedrawStatusAreas(); SD_MusicOn(); Paused = false; ::in_clear_mouse_deltas(); return; } #if IN_DEVELOPMENT if (TestQuickSave) { // TestQuickSave--; scan = sc_f8; } if (TestAutoMapper) PopupAutoMap(); #endif scan = sc_none; if (Keyboard[sc_escape]) scan = sc_escape; else if (in_is_binding_pressed(e_bi_help)) scan = sc_f1; if (in_is_binding_pressed(e_bi_save)) scan = sc_f2; else if (in_is_binding_pressed(e_bi_load)) scan = sc_f3; else if (in_is_binding_pressed(e_bi_sound)) scan = sc_f4; else if (in_is_binding_pressed(e_bi_controls)) scan = sc_f6; else if (in_is_binding_pressed(e_bi_end_game)) scan = sc_f7; else if (in_is_binding_pressed(e_bi_quick_save)) scan = sc_f8; else if (in_is_binding_pressed(e_bi_quick_load)) scan = sc_f9; else if (in_is_binding_pressed(e_bi_quick_exit)) scan = sc_f10; switch (scan) { case sc_f7: // END GAME case sc_f10: // QUIT TO DOS FinishPaletteShifts(); ClearMemory(); US_ControlPanel(scan); CleanDrawPlayBorder(); return; case sc_f2: // SAVE MISSION case sc_f8: // QUICK SAVE // Make sure there's room to save... // ClearMemory(); FinishPaletteShifts(); if (!CheckDiskSpace(DISK_SPACE_NEEDED, CANT_SAVE_GAME_TXT, cds_id_print)) { CleanDrawPlayBorder(); break; } case sc_f1: // HELP case sc_f3: // LOAD MISSION case sc_f4: // SOUND MENU case sc_f5: // RESIZE VIEW case sc_f6: // CONTROLS MENU case sc_f9: // QUICK LOAD case sc_escape: // MAIN MENU refresh_screen = true; if (scan < sc_f8) VW_FadeOut(); StopMusic(); ClearMemory(); ClearSplitVWB(); US_ControlPanel(scan); if (refresh_screen) { boolean old = loadedgame; loadedgame = false; DrawPlayScreen(false); loadedgame = old; } ClearMemory(); if (!sqActive || !loadedgame) StartMusic(false); IN_ClearKeysDown(); if (loadedgame) { PreloadGraphics(); loadedgame = false; DrawPlayScreen(false); } else if (!refresh_screen) CleanDrawPlayBorder(); if (!sqActive) StartMusic(false); return; } scan = sc_none; if (in_is_binding_pressed(e_bi_stats)) PopupAutoMap(); if (Keyboard[sc_back_quote]) { Keyboard[sc_back_quote] = 0; TryDropPlasmaDetonator(); } if ((DebugOk || gamestate.flags & GS_MUSIC_TEST) && (Keyboard[sc_backspace])) { Uint8 old_num=music_num; if (gamestate.flags & GS_MUSIC_TEST) { if (Keyboard[sc_left_arrow]) { if (music_num) music_num--; Keyboard[sc_left_arrow]=false; } else if (Keyboard[sc_right_arrow]) { if (music_num < LASTMUSIC-1) music_num++; Keyboard[sc_right_arrow]=false; } if (old_num != music_num) { ClearMemory(); delete [] audiosegs[STARTMUSIC + old_num]; audiosegs[STARTMUSIC + old_num] = NULL; StartMusic(false); DrawScore(); } } if (old_num == music_num) { fontnumber=4; SETFONTCOLOR(0,15); if (DebugKeys()) { CleanDrawPlayBorder(); } ::in_clear_mouse_deltas(); lasttimecount = TimeCount; return; } } if (in_is_binding_pressed(e_bi_attack_info)) { if (I_KeyReleased) { gamestate.flags ^= GS_ATTACK_INFOAREA; if (gamestate.flags & GS_ATTACK_INFOAREA) DISPLAY_TIMED_MSG(attacker_info_enabled,MP_ATTACK_INFO,MT_GENERAL); else DISPLAY_TIMED_MSG(attacker_info_disabled,MP_ATTACK_INFO,MT_GENERAL); I_KeyReleased = false; } } else I_KeyReleased = true; #ifdef CEILING_FLOOR_COLORS if (in_is_binding_pressed(e_bi_ceiling)) { gamestate.flags ^= GS_DRAW_CEILING; in_reset_binding_state(e_bi_ceiling); } if (in_is_binding_pressed(e_bi_flooring)) { ThreeDRefresh(); ThreeDRefresh(); gamestate.flags ^= GS_DRAW_FLOOR; in_reset_binding_state(e_bi_flooring); #if DUAL_SWAP_FILES ChangeSwapFiles(true); #endif } #endif if (in_is_binding_pressed(e_bi_lightning)) { in_reset_binding_state(e_bi_lightning); gamestate.flags ^= GS_LIGHTING; } }