// Used by wizard fade in/out function bool Scheduler::fadeLoop() { SDL_Event event; viewer.displayCopyright(); viewer.displayWelcomeMessage(); // Start buzz Mix_Volume(viewer.fadChannel, 0); Mix_PlayChannel(viewer.fadChannel, creature.buzz, -1); while(true) { if ( keyCheck() ) { viewer.clearArea(&viewer.TXTPRI); while(SDL_PollEvent(&event)) { ; // clear event buffer } // Stop buzz Mix_HaltChannel(viewer.fadChannel); return false; // auto-play mode off == start demo game } if ( viewer.draw_fade() ) { // Stop buzz Mix_HaltChannel(viewer.fadChannel); return true; // auto-play mode on == start regular game } } }
// Initializes 3D viewer void dodGame::INIVU() { viewer.clearArea(&viewer.TXTSTS); viewer.clearArea(&viewer.TXTPRI); player.HUPDAT(); ++player.HEARTC; --player.HEARTF; --player.HBEATF; viewer.STATUS(); player.PLOOK(); }
void Scheduler::winFadeLoop() { SDL_Event event; viewer.displayWinner(); viewer.fadeVal = -2; viewer.VXSCAL = 0x80; viewer.VYSCAL = 0x80; viewer.VXSCALf = 128.0f; viewer.VYSCALf = 128.0f; viewer.delay = 0; viewer.VCTFAD = 32; viewer.done = false; while(SDL_PollEvent(&event)) { ; // clear event buffer } // Start buzz Mix_Volume(viewer.fadChannel, 0); Mix_PlayChannel(viewer.fadChannel, creature.buzz, -1); while (!viewer.done) { viewer.death_fade(viewer.W2_VLA); EscCheck(); } // Stop buzz Mix_HaltChannel(viewer.fadChannel); while(true) { viewer.death_fade(viewer.W2_VLA); if ( keyCheck() ) { viewer.clearArea(&viewer.TXTPRI); while(SDL_PollEvent(&event)) { ; // clear event buffer } return; } } while(SDL_PollEvent(&event)) { ; // clear event buffer } }
// Game initialization void dodGame::COMINI() { Uint32 ticks1, ticks2; scheduler.SYSTCB(); object.CreateAll(); player.HBEATF = 0; viewer.clearArea(&viewer.TXTSTS); viewer.clearArea(&viewer.TXTPRI); viewer.VXSCAL = 0x80; viewer.VYSCAL = 0x80; viewer.VXSCALf = 128.0f; viewer.VYSCALf = 128.0f; AUTFLG = viewer.ShowFade(Viewer::FADE_BEGIN); //AUTFLG = scheduler.fadeLoop(); //AUTFLG = false; // TAKE THIS LINE OUT !!!!!!!!!! [Prevents demo from starting] player.setInitialObjects(AUTFLG); viewer.displayPrepare(); viewer.display_mode = Viewer::MODE_TITLE; viewer.draw_game(); // Delay with "PREPARE!" on screen ticks1 = SDL_GetTicks(); do { oslink.process_events(); ticks2 = SDL_GetTicks(); } while (ticks2 < ticks1 + viewer.prepPause); creature.NEWLVL(); if (AUTFLG) { // do map viewer.display_mode = Viewer::MODE_TITLE; viewer.showSeerMap = true; --viewer.UPDATE; viewer.draw_game(); // wait 3 seconds ticks1 = SDL_GetTicks(); do { oslink.process_events(); ticks2 = SDL_GetTicks(); } while (ticks2 < ticks1 + 3000); } INIVU(); viewer.PROMPT(); }