void DemoLoop (void) { ///////////////////////////////////////////////////////////////////////////// // main game cycle ///////////////////////////////////////////////////////////////////////////// displayofs = bufferofs = 0; VW_Bar (0,0,320,200,0); VW_SetScreen(0,0); // // Read in all the graphic images needed for the title sequence // VW_WaitVBL(1); IN_ReadControl(0,&control); // set EASYMODE // if (BE_Cross_strcasecmp(id0_argv[2], "1") == 0) EASYMODEON = true; else EASYMODEON = false; // restore game // if (BE_Cross_strcasecmp(id0_argv[3], "1") == 0) { VW_FadeOut(); bufferofs = displayofs = 0; VW_Bar(0,0,320,200,0); if (GE_LoadGame()) { loadedgame = true; playstate = ex_loadedgame; Keyboard[sc_Enter] = true; VW_Bar(0,0,320,200,0); ColoredPalette(); } VW_Bar(0,0,320,200,0); VW_FadeIn(); } // Play a game // restartgame = gd_Normal; NewGame(); GameLoop(); }
//------------------------------------------------------------------------- // PreFullDisplay() //------------------------------------------------------------------------- void PreFullDisplay() { VW_FadeOut(); VW_SetSplitScreen(200); bufferofs = displayofs = screenloc[0]; VW_Bar(0,0,320,200,0); }
void VWB_Bar (id0_int_t x, id0_int_t y, id0_int_t width, id0_int_t height, id0_int_t color) { x+=pansx; y+=pansy; if (VW_MarkUpdateBlock (x,y,x+width,y+height-1) ) VW_Bar (x,y,width,height,color); }
static void FinishSignon (void) { #ifndef SPEAR VW_Bar (0,189,300,11,VL_GetPixel(0,0)); WindowX = 0; WindowW = 320; PrintY = 190; #ifndef JAPAN SETFONTCOLOR(14,4); #ifdef SPANISH US_CPrint ("Oprima una tecla"); #else US_CPrint ("Press a key"); #endif #endif VW_UpdateScreen(); if (!param_nowait) IN_Ack (); #ifndef JAPAN VW_Bar (0,189,300,11,VL_GetPixel(0,0)); PrintY = 190; SETFONTCOLOR(10,4); #ifdef SPANISH US_CPrint ("pensando..."); #else US_CPrint ("Working..."); #endif VW_UpdateScreen(); #endif SETFONTCOLOR(0,15); #else VW_UpdateScreen(); if (!param_nowait) VW_WaitVBL(3*70); #endif }
void VWB_Bar( int x, int y, int width, int height, std::uint8_t color) { VW_Bar(x, y, width, height, color); }
void DemoLoop (void) { ///////////////////////////////////////////////////////////////////////////// // main game cycle ///////////////////////////////////////////////////////////////////////////// // displayofs = bufferofs = 0; // VW_Bar (0,0,320,200,0); // VW_SetScreen(0,0); // set EASYMODE // if (BE_Cross_strcasecmp(id0_argv[2], "1") == 0) EASYMODEON = true; else EASYMODEON = false; // restore game // if (BE_Cross_strcasecmp(id0_argv[3], "1") == 0) { VW_FadeOut(); bufferofs = displayofs = 0; VW_Bar(0,0,320,200,0); if (GE_LoadGame()) { loadedgame = true; playstate = ex_loadedgame; Keyboard[sc_Enter] = true; VW_Bar(0,0,320,200,0); ColoredPalette(); } VW_Bar(0,0,320,200,0); VW_FadeIn(); } // Play a game // restartgame = gd_Normal; NewGame(); GameLoop(); }
//------------------------------------------------------------------------- // Display640() //------------------------------------------------------------------------- void Display640(void) { // Can you believe it takes all this just to change to 640 mode!!???! // VW_ScreenToScreen(0,FREESTART-STATUSLEN,40,80); VW_SetLineWidth(80); MoveScreen(0,0); VW_Bar (0,0,640,200,0); VW_SetScreenMode(EGA640GR); VW_SetLineWidth(80); BlackPalette(); }
//------------------------------------------------------------------------- // Display320() //------------------------------------------------------------------------- void Display320(void) { // Can you believe it takes all this just to change to 320 mode!!???! // VW_ColorBorder(0); VW_FadeOut(); VW_SetLineWidth(40); MoveScreen(0,0); VW_Bar (0,0,320,200,0); VW_SetScreenMode(EGA320GR); VW_SetLineWidth(40); BlackPalette(); VW_ScreenToScreen(FREESTART-STATUSLEN,0,40,80); }
/* ==================== = = DisplayDepartment = ==================== */ void DisplayDepartment(id0_char_t *text) { id0_short_t temp; // bufferofs = 0; PrintY = 5; WindowX = 17; WindowW = 168; VW_Bar(WindowX,PrintY+1,WindowW,7,0); temp = fontcolor; fontcolor = 10; US_CPrintLine (text, NULL); fontcolor = temp; }
void T_Gate (objtype *ob) { id0_int_t spot; objtype *check; id0_unsigned_t temp; if (CheckHandAttack (ob) && !playstate) { // // warp // temp = bufferofs; bufferofs = 0; VW_Bar (26,4,232,9,STATUSCOLOR); // clear text description bufferofs = temp; IN_ClearKeysDown (); if (ob->temp1) { // // teleport inside level // for (check=player->next;check;check=check->next) if (check->obclass==gateobj && check->temp1==ob->temp1 && check != ob) { player->x = check->x; player->y = check->y; Thrust (player->angle,TILEGLOBAL/2); // move forwards Thrust (player->angle,TILEGLOBAL/2); // move forwards Thrust (player->angle,TILEGLOBAL/2); // move forwards fizzlein=true; } } else { // // teleport out of level // playstate = ex_warped; spot = *(mapsegs[0]+farmapylookup[ob->tiley]+ob->tilex)-NAMESTART; if (spot<1) gamestate.mapon++; else gamestate.mapon=spot-1; SD_PlaySound(WARPUPSND); } } }
void EndSpear() { EndScreen(END1PALETTE, ENDSCREEN11PIC); VL_CacheScreen(ENDSCREEN3PIC); VW_UpdateScreen(); CA_CacheGrChunk(END3PALETTE); VL_FadeIn(0, 255, grsegs[END3PALETTE], 30); CA_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 (); set_TimeCount(0); while ( !IN_CheckAck () && (get_TimeCount() < 700) ); PrintX = 0; PrintY = 180; VW_Bar(0,180,320,20,0); US_CPrint(STR_ENDGAME3"\n"); US_CPrint(STR_ENDGAME4); VW_UpdateScreen(); IN_StartAck (); set_TimeCount(0); while ( !IN_CheckAck () && (get_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 PG13() { VW_FadeOut(); VW_Bar(0,0,320,200,0x82); // background CA_CacheGrChunk (PG13PIC); VWB_DrawPic (216,110,PG13PIC); VW_UpdateScreen (); CA_UnCacheGrChunk (PG13PIC); VW_FadeIn(); IN_UserInput(TickBase*7); VW_FadeOut (); }
void PageLayout(boolean shownumber) { int i,oldfontcolor; signed char ch; oldfontcolor = fontcolor; fontcolor = 0; // // clear the screen // VW_Bar(0,0,320,200,BACKCOLOR); VWB_DrawPic(0,0,H_TOPWINDOWPIC); VWB_DrawPic(0,8,H_LEFTWINDOWPIC); VWB_DrawPic(312,8,H_RIGHTWINDOWPIC); VWB_DrawPic(8,176,H_BOTTOMINFOPIC); for (i=0;i<TEXTROWS;i++) { leftmargin[i] = LEFTMARGIN; rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN; } px = LEFTMARGIN; py = TOPMARGIN; rowon = 0; layoutdone = false; // // make sure we are starting layout text (^P first command) // while (*text <= 32) text++; if (*text != '^' || toupper(*++text) != 'P') Quit ("PageLayout: Text not headed with ^P"); while (*text++ != '\n') ; // // process text stream // do { ch = *text; if (ch == '^') HandleCommand (); else if (ch == 9) { px = (px+8)&0xf8; text++; } else if (ch <= 32) HandleCtrls (); else HandleWord (); } while (!layoutdone); pagenum++; if (shownumber) { strcpy (str,"pg "); itoa (pagenum,str2,10); strcat (str,str2); strcat (str," of "); py = 183; px = 213; itoa (numpages,str2,10); strcat (str,str2); fontcolor = 0x4f; //12^BACKCOLOR; VW_DrawPropString (str); } fontcolor = oldfontcolor; }
/** * * \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 PrintHelp(void) { id0_char_t oldfontcolor = fontcolor; PrintY = 1; WindowX = 135; WindowW = 640; VW_FadeOut(); bufferofs = displayofs = screenloc[0]; VW_Bar(0,0,320,200,0); Display640(); VW_Bar(0, 0, 640, 200, 7); fontcolor = (7 ^ 1); US_Print ("\n\n SUMMARY OF GAME CONTROLS\n\n"); fontcolor = (7 ^ 4); US_Print (" ACTION\n\n"); US_Print ("Arrow keys, joystick, or mouse\n"); US_Print ("TAB or V while turning\n"); US_Print ("ALT or Button 2 while turning\n"); US_Print ("CTRL or Button 1\n"); US_Print ("Z\n"); US_Print ("X or Enter\n"); US_Print ("F1\n"); US_Print ("F2\n"); US_Print ("F3\n"); US_Print ("F4\n"); US_Print ("F5\n"); US_Print ("ESC\n\n"); fontcolor = (7 ^ 0); #ifndef CATALOG US_Print (" (See complete Instructions for more info)\n"); #endif US_Print ("\n copyright (c) 1992-93 Softdisk Publishing\n"); fontcolor = (7 ^ 8); PrintX = 400; PrintY = 37; WindowX = 400; US_Print (" REACTION\n\n"); US_Print ("Move and turn\n"); US_Print ("Turn quickly (Quick Turn)\n"); US_Print ("Move sideways\n"); US_Print ("Shoot a Missile\n"); US_Print ("Shoot a Zapper\n"); US_Print ("Shoot an Xterminator\n"); US_Print ("Help (this screen)\n"); US_Print ("Sound control\n"); US_Print ("Save game position\n"); US_Print ("Restore a saved game\n"); US_Print ("Joystick control\n"); US_Print ("System options\n\n\n"); VW_UpdateScreen(); VW_FadeIn(); VW_ColorBorder(8 | 56); IN_Ack(); Display320(); fontcolor = oldfontcolor; }
/////////////////////////////////////////////////////////////////////////// // // US_ClearWindow() - Clears the current window to white and homes the // cursor // /////////////////////////////////////////////////////////////////////////// void US_ClearWindow() { VW_Bar(WindowX,WindowY,WindowW,WindowH,WHITE); PrintX = WindowX; PrintY = WindowY; }
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 */ }
void CheckKeys (void) { //extern id0_boolean_t autofire; if (screenfaded) // don't do anything with a faded screen return; #if 0 // // pause key wierdness can't be checked as a scan code // if (Paused) { CenterWindow (8,3); US_PrintCentered ("PAUSED"); VW_UpdateScreen (); // SD_MusicOff(); IN_Ack(); // SD_MusicOn(); Paused = false; // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } else if (Keyboard[sc_Enter]) // P = pause with no screen disruptioon { // SD_MusicOff(); DisplaySMsg("PAUSED",NULL); IN_Ack(); // SD_MusicOn(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } else if (Keyboard[sc_S]) { id0_char_t *Text[] = {{"Slow Mode ON"},{"Slow Mode OFF"}}; SlowMode ^= 1; extravbls = SlowMode << 3; CenterWindow (8,3); US_PrintCentered (Text[SlowMode]); VW_UpdateScreen (); // SD_MusicOff(); IN_Ack(); // SD_MusicOn(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } #endif // F2 - SOUND OPTIONS // if (Keyboard[sc_F2]) { id0_int_t height=7; id0_boolean_t ChoiceMade = false; if (AdLibPresent) height++; VW_FixRefreshBuffer(); CenterWindow(22,height); US_Print( "\n 1 ) NO SOUND \n"); US_Print( " 2 ) PC AUDIO \n"); if (AdLibPresent) US_Print(" 3 ) ADLIB AUDIO\n"); US_Print( "\n ESC) EXIT "); VW_UpdateScreen(); // REFKEEN - Alternative controllers support extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_soundoptions; g_ingame_altcontrol_mapping_soundoptions.buttons[BE_ST_CTRL_BUT_X].mapClass = AdLibPresent ? BE_ST_CTRL_MAP_KEYSCANCODE : BE_ST_CTRL_MAP_NONE; // A bit of patching BE_ST_AltControlScheme_Push(); BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_soundoptions); // Switch audio device ON/OFF & load sounds if there // was a change in the device. do { if (Keyboard[1]) // ESC - Exit ChoiceMade = true; else if (Keyboard[2]) // 1 - No Sound { SD_SetSoundMode(sdm_Off); ChoiceMade = true; } else if (Keyboard[3]) // 2 - PC Audio { SD_SetSoundMode(sdm_PC); // if (oldsoundmode != sdm_PC) CA_LoadAllSounds(); ChoiceMade = true; } else if ((Keyboard[4]) && AdLibPresent) // 3 - AdLib Audio { SD_SetSoundMode(sdm_AdLib); // if (oldsoundmode != sdm_AdLib) CA_LoadAllSounds(); ChoiceMade = true; } BE_ST_ShortSleep(); } while (!ChoiceMade); // REFKEEN - Alternative controllers support BE_ST_AltControlScheme_Pop(); tics = realtics = 1; IN_ClearKeysDown(); } // F5 - CALIBRATE JOYSTICK // if (Keyboard[sc_F5]) { CalibrateJoystick(0); tics = realtics = 1; IN_ClearKeysDown(); } deadloop:; // ESCAPE - quits game // if ((Keyboard[sc_Escape]) || (Flags & FL_DEAD)) { id0_char_t ch; DisplaySMsg("Options", NULL); status_flag = S_NONE; if (Flags & FL_DEAD) { id0_char_t choices[] = {sc_Escape,sc_R,sc_N,sc_Q,0}; ch = DisplayMsg("Restore New Quit",choices); } else { id0_char_t choices[] = {sc_Escape,sc_S,sc_R,sc_N,sc_Q,0}; ch = DisplayMsg("Save Restore New Quit",choices); } DrawText(true); switch (ch) { case sc_S: if (!(Flags & FL_DEAD)) Keyboard[sc_F3] = true; break; case sc_R: Keyboard[sc_F4] = true; break; case sc_N: DisplaySMsg("Starting anew", NULL); VW_WaitVBL(60); playstate = ex_resetgame; Flags &= ~FL_DEAD; break; case sc_Q: // REFKEEN - Alternative controllers support { extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback; BE_ST_AltControlScheme_Push(); BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback); // REFKEEN - We don't pop this since we quit... } DisplaySMsg("FARE THEE WELL!", NULL); VW_WaitVBL(120); if (!Flags & FL_QUICK) VW_FadeOut(); NormalScreen(); FreeUpMemory(); Quit(NULL); break; } tics = realtics = 1; } // F1 - DISPLAY HELP // if (Keyboard[sc_F1]) { PrintHelp(); #ifdef TEXT_PRESENTER extern PresenterInfo MainHelpText; VW_FadeOut(); FreeUpMemory(); if (!LoadPresenterScript("HELP.TXT",&MainHelpText)) { VW_FadeIn(); CenterWindow(30,5); US_CPrint("\nError loading HELP file.\n"); US_CPrint("Press any key."); IN_Ack(); VW_FadeOut(); } else { VW_SetSplitScreen(200); bufferofs = displayofs = screenloc[0]; VW_Bar(0,0,320,200,0); Display640(); Presenter(&MainHelpText); Display320(); } FreePresenterScript(&MainHelpText); #endif VW_SetSplitScreen(120); VW_SetScreen(screenloc[0],0); screenpage = 0; CacheScaleds(); bufferofs = 0; RedrawStatusWindow(); ThreeDRefresh(); VW_FadeIn(); Keyboard[sc_F1] = false; tics = realtics = 1; IN_ClearKeysDown(); } // F3 - SAVE GAME // if ((Keyboard[sc_F3]) && (!(Flags & FL_DEAD))) { PreFullDisplay(); GE_SaveGame(); PostFullDisplay(true); tics = realtics = 1; IN_ClearKeysDown(); } // F4 - LOAD GAME // if (Keyboard[sc_F4]) { PreFullDisplay(); if (GE_LoadGame()) { loadedgame = true; playstate = ex_loadedgame; Flags &= ~FL_DEAD; lasttext = -1; PostFullDisplay(false); } else if (playstate == ex_victorious) { PostFullDisplay(false); Victory(false); IN_Ack(); // gamestate.mapon++; } else PostFullDisplay(true); Keyboard[sc_F5] = false; tics = realtics = 1; IN_ClearKeysDown(); } if (Flags & FL_DEAD) goto deadloop; // // F10-? debug keys // if (Keyboard[sc_BackSpace]) { DebugKeys(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement lasttimecount = SD_GetTimeCount(); } }
void HandleCommand() { int i,margin,top,bottom; int picwidth,picheight,picmid; switch (toupper(*++text)) { case 'B': picy=ParseNumber(); picx=ParseNumber(); picwidth=ParseNumber(); picheight=ParseNumber(); VW_Bar(picx,picy,picwidth,picheight,BACKCOLOR); RipToEOL(); break; case ';': // comment RipToEOL(); break; case 'P': // ^P is start of next page, ^E is end of file case 'E': layoutdone = true; text--; // back up to the '^' break; case 'C': // ^c<hex digit> changes text color i = toupper(*++text); if (i>='0' && i<='9') fontcolor = i-'0'; else if (i>='A' && i<='F') fontcolor = i-'A'+10; fontcolor *= 16; i = toupper(*++text); if (i>='0' && i<='9') fontcolor += i-'0'; else if (i>='A' && i<='F') fontcolor += i-'A'+10; text++; break; case '>': px = 160; text++; break; case 'L': py=ParseNumber(); rowon = (py-TOPMARGIN)/FONTHEIGHT; py = TOPMARGIN+rowon*FONTHEIGHT; px=ParseNumber(); while (*text++ != '\n') // scan to end of line ; break; case 'T': // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic TimedPicCommand(); break; case 'G': // ^Gyyy,xxx,ppp draws graphic ParsePicCommand (); VWB_DrawPic (picx&~7,picy,picnum); picwidth = pictable[picnum-STARTPICS].width; picheight = pictable[picnum-STARTPICS].height; // // adjust margins // picmid = picx + picwidth/2; if (picmid > SCREENMID) margin = picx-PICMARGIN; // new right margin else margin = picx+picwidth+PICMARGIN; // new left margin top = (picy-TOPMARGIN)/FONTHEIGHT; if (top<0) top = 0; bottom = (picy+picheight-TOPMARGIN)/FONTHEIGHT; if (bottom>=TEXTROWS) bottom = TEXTROWS-1; for (i=top;i<=bottom;i++) if (picmid > SCREENMID) rightmargin[i] = margin; else leftmargin[i] = margin; // // adjust this line if needed // if (px < leftmargin[rowon]) px = leftmargin[rowon]; break; } }
void DemoLoop (void) { id0_int_t i,level; // // check for launch from ted // if (tedlevel) { NewGame(); gamestate.mapon = tedlevelnum; restartgame = gd_Normal; for (i = 1;i < id0_argc;i++) { if ( (level = US_CheckParm(id0_argv[i],ParmStrings)) == -1) continue; // REFKEEN - Cast for C++ restartgame = (GameDiff)(gd_Easy+level); break; } GameLoop(); TEDDeath(); } // // main game cycle // displayofs = bufferofs = 0; VW_Bar (0,0,320,200,0); while (1) { CA_CacheGrChunk (TITLEPIC); bufferofs = SCREEN2START; displayofs = SCREEN1START; VWB_DrawPic (0,0,TITLEPIC); MM_SetPurge (&grsegs[TITLEPIC],3); UNMARKGRCHUNK(TITLEPIC); FizzleFade (bufferofs,displayofs,320,200,true); if (!IN_UserInput(TickBase*3,false)) { CA_CacheGrChunk (CREDITSPIC); VWB_DrawPic (0,0,CREDITSPIC); MM_SetPurge (&grsegs[CREDITSPIC],3); UNMARKGRCHUNK(CREDITSPIC); FizzleFade (bufferofs,displayofs,320,200,true); } if (!IN_UserInput(TickBase*3,false)) { highscores: DrawHighScores (); FizzleFade (bufferofs,displayofs,320,200,true); IN_UserInput(TickBase*3,false); } if (IN_IsUserInput()) { US_ControlPanel (); if (restartgame || loadedgame) { GameLoop (); goto highscores; } } } }
void ShowArticle(signed char *article) { unsigned oldfontnumber; boolean newpage, firstpage; text = article; oldfontnumber = fontnumber; fontnumber = 0; CA_CacheGrChunk(STARTFONT); VW_Bar (0,0,320,200,BACKCOLOR); CacheLayoutGraphics(); newpage = true; firstpage = true; do { if (newpage) { newpage = false; PageLayout(true); VW_UpdateScreen(); if (firstpage) { VL_FadeIn(0,255,gamepal,10); firstpage = false; } } LastScan = 0; while (!LastScan) IN_CheckAck(); /* update events */ switch (LastScan) { case sc_UpArrow: case sc_PgUp: case sc_LeftArrow: if (pagenum>1) { BackPage (); BackPage (); newpage = true; } break; case sc_Enter: case sc_DownArrow: case sc_PgDn: case sc_RightArrow: // the text already points at next page if (pagenum<numpages) { newpage = true; } break; } if (IN_KeyDown(sc_Tab) && IN_KeyDown(sc_P) && MS_CheckParm("debugmode")) PicturePause(); } while (LastScan != sc_Escape); IN_ClearKeysDown (); fontnumber = oldfontnumber; }