DreamsIntro::DreamsIntro() { mStep = 1; mTimer = TickBase * 4; VW_SetScreenMode (GRMODE); VW_ClearVideo (BLACK); US_SetLoadSaveHooks(LoadGame,SaveGame,ResetGame); restartgame = gd_Continue; //while (true) //{ loadedgame = false; mFileName1 = "TITLESCR.LBM"; if (LoadLIBShape("KDREAMS.CMP", mFileName1.c_str(), &mFileShape1)) { //Quit("Can't load TITLE SCREEN"); } //while (!restartgame && !loadedgame) VW_InitDoubleBuffer(); IN_ClearKeysDown(); VW_SetScreen(0, 0); MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&mFileShape1, 0, 0); mTimer = TickBase * 4; }
void OverheadRefresh (void) { id0_unsigned_t x,y,endx,endy,sx,sy; id0_unsigned_t tile; if (++screenpage == 3) screenpage = 0; bufferofs = screenloc[screenpage]; endx = maporgx+VIEWTILEX; endy = maporgy+VIEWTILEY; for (y=maporgy;y<endy;y++) for (x=maporgx;x<endx;x++) { sx = (x-maporgx)*2; sy = (y-maporgy)*16; switch (viewtype) { case mapview: tile = *(mapsegs[0]+farmapylookup[y]+x); break; case tilemapview: tile = tilemap[x][y]; break; case actoratview: tile = (id0_unsigned_t)actorat[x][y]; break; case visview: tile = spotvis[x][y]; break; case mapseg2: tile = *(mapsegs[2]+farmapylookup[y]+x); if (tile < 256) tile = *(mapsegs[0]+farmapylookup[y]+x); break; } if (tile<NUMTILE16) LatchDrawTile(sx,sy,tile); else { LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12)); LatchDrawChar(sx+1,sy,NUMBERCHARS+((tile&0x0f00)>>8)); LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4)); LatchDrawChar(sx+1,sy+8,NUMBERCHARS+(tile&0x000f)); } } VW_SetScreen (bufferofs,0); displayofs = bufferofs; }
void PicturePause (void) { id0_int_t y; id0_unsigned_t source; source = displayofs+panadjust; // VW_ColorBorder (15); VW_SetLineWidth (40); VW_SetScreen (0,0); if (source<0x10000l-200*64) { // // copy top line first // for (y=0;y<200;y++) VW_ScreenToScreen (source+y*64,y*40,40,1); } else { // // copy bottom line first // for (y=199;y>=0;y--) VW_ScreenToScreen (source+y*64,y*40,40,1); } IN_Shutdown (); VW_WaitVBL(70); BE_ST_BiosScanCode(0); VW_WaitVBL(70); Quit (NULL); }
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(); }
void DreamsIntro::ponder(const float deltaT) { // Ticking until input happens or user presses something if(mTimer > 0) { mTimer--; if(gInput.getPressedAnyCommand()) { gEventManager.add( new LaunchControlPanel ); mTimer = 0; } return; } if(mStep == 1) { VW_SetScreen(0, 0); MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&mFileShape1, 0, 0); mTimer = TickBase * 4; mStep++; } else if(mStep == 2) { MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&mFileShape1, 0, 0); mTimer = TickBase * 3; mStep++; } else { displayofs = 0; mTimer = TickBase * 6; mStep = 1; } }
void MM_ShowMemory (void) { mmblocktype id0_far *scan; id0_unsigned_t color,temp; id0_long_t end; VW_SetLineWidth(40); temp = bufferofs; bufferofs = 0; VW_SetScreen (0,0); scan = mmhead; end = -1; while (scan) { if (scan->attributes & PURGEBITS) color = 5; // dark purple = purgable else color = 9; // medium blue = non purgable if (scan->attributes & LOCKBIT) color = 12; // red = locked if (scan->start<=end) Quit ("MM_ShowMemory: Memory block order currupted!"); end = scan->start+scan->length-1; VW_Hlin(scan->start,(id0_unsigned_t)end,0,color); VW_Plot(scan->start,0,15); if (scan->next->start > end+1) VW_Hlin(end+1,scan->next->start,0,0); // black = free scan = scan->next; } IN_Ack(); VW_SetLineWidth(64); bufferofs = temp; }
void VW_InitDoubleBuffer (void) { #if GRMODE == EGAGR VW_SetScreen (displayofs+panadjust,0); // no pel pan #endif }
void DemoLoop (void) { //id0_char_t *s; //id0_word_t move; //id0_longword_t lasttime; const id0_char_t *FileName1; struct Shape FileShape1; #if CREDITS const id0_char_t *FileName2; struct Shape FileShape2; #endif //struct ffblk ffblk; //WindowRec mywin; id0_int_t bufsave = bufferofs; id0_int_t dissave = displayofs; #if FRILLS // // check for launch from ted // if (tedlevel) { NewGame(); gamestate.mapon = tedlevelnum; GameLoop(); TEDDeath(); } #endif // // demo loop // US_SetLoadSaveHooks(LoadGame,SaveGame,ResetGame); restartgame = gd_Continue; BE_FILE_T handle = BE_Cross_open_for_reading("KDREAMS.CMP"); //int handle = open("KDREAMS.CMP" ,O_BINARY | O_RDONLY); if (!BE_Cross_IsFileValid(handle)) //if (handle == -1) Quit("Couldn't find KDREAMS.CMP"); BE_Cross_close(handle); #if 0 if (findfirst("KDREAMS.CMP", &ffblk, 0) == -1) Quit("Couldn't find KDREAMS.CMP"); #endif while (true) { loadedgame = false; FileName1 = "TITLESCR.LBM"; if (LoadLIBShape("KDREAMS.CMP", FileName1, &FileShape1)) Quit("Can't load TITLE SCREEN"); #if CREDITS FileName2 = "CREDITS.LBM"; if (LoadLIBShape("KDREAMS.CMP", FileName2, &FileShape2)) Quit("Can't load CREDITS SCREEN"); #endif while (!restartgame && !loadedgame) { VW_InitDoubleBuffer(); IN_ClearKeysDown(); while (true) { VW_SetScreen(0, 0); MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&FileShape1, 0, 0); VW_ScreenToScreen (64*200,0,40,200); #if CREDITS if (IN_UserInput(TickBase * 8, false)) break; #else if (IN_UserInput(TickBase * 4, false)) break; #endif #if CREDITS MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&FileShape2, 0, 0); VW_ScreenToScreen (64*200,0,40,200); if (IN_UserInput(TickBase * 7, false)) break; #else MoveGfxDst(0, 200); UnpackEGAShapeToScreen(&FileShape1, 0, 0); VW_ScreenToScreen (64*200,0,40,200); if (IN_UserInput(TickBase * 3, false)) break; #endif displayofs = 0; VWB_Bar(0,0,320,200,FIRSTCOLOR); US_DisplayHighScores(-1); if (IN_UserInput(TickBase * 6, false)) break; } bufferofs = bufsave; displayofs = dissave; VW_FixRefreshBuffer(); US_ControlPanel (); } if (!loadedgame) NewGame(); FreeShape(&FileShape1); #if CREDITS FreeShape(&FileShape2); #endif GameLoop(); } }
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(); } }