void DoCountdownFrame () { fix oldTime; int fc, h, div_scale; static fix cdtFrameTime; if (!gameData.reactor.bDestroyed) { cdtFrameTime = 0; return; } cdtFrameTime += gameData.time.xRealFrame; if (gameStates.limitFPS.bCountDown && !gameStates.app.tick40fps.bTick) return; if (!IS_D2_OEM && !IS_MAC_SHARE && !IS_SHAREWARE) { // get countdown in OEM and SHAREWARE only // On last level, we don't want a countdown. if ((gameData.missions.nCurrentMission == gameData.missions.nBuiltinMission) && (gameData.missions.nCurrentLevel == gameData.missions.nLastLevel)) { if (!(gameData.app.nGameMode & GM_MULTI)) return; if (gameData.app.nGameMode & GM_MULTI_ROBOTS) return; } } // Control center destroyed, rock the tPlayer's ship. fc = gameData.reactor.countdown.nSecsLeft; if (fc > 16) fc = 16; // At Trainee, decrease rocking of ship by 4x. div_scale = 1; if (gameStates.app.nDifficultyLevel == 0) div_scale = 4; h = 3 * F1_0 / 16 + (F1_0 * (16 - fc)) / 32; gameData.objs.console->mType.physInfo.rotVel.p.x += (FixMul (d_rand () - 16384, h)) / div_scale; gameData.objs.console->mType.physInfo.rotVel.p.z += (FixMul (d_rand () - 16384, h)) / div_scale; // Hook in the rumble sound effect here. oldTime = gameData.reactor.countdown.nTimer; if (!TimeStopped ()) gameData.reactor.countdown.nTimer -= cdtFrameTime; cdtFrameTime = 0; gameData.reactor.countdown.nSecsLeft = f2i (gameData.reactor.countdown.nTimer + F1_0 * 7 / 8); if ((oldTime > COUNTDOWN_VOICE_TIME) && (gameData.reactor.countdown.nTimer <= COUNTDOWN_VOICE_TIME)) { DigiPlaySample (SOUND_COUNTDOWN_13_SECS, F3_0); } if (f2i (oldTime + F1_0*7/8) != gameData.reactor.countdown.nSecsLeft) { if ((gameData.reactor.countdown.nSecsLeft >= 0) && (gameData.reactor.countdown.nSecsLeft < 10)) DigiPlaySample ((short) (SOUND_COUNTDOWN_0_SECS + gameData.reactor.countdown.nSecsLeft), F3_0); if (gameData.reactor.countdown.nSecsLeft == gameData.reactor.countdown.nTotalTime - 1) DigiPlaySample (SOUND_COUNTDOWN_29_SECS, F3_0); } if (gameData.reactor.countdown.nTimer > 0) { fix size,old_size; size = (i2f (gameData.reactor.countdown.nTotalTime) - gameData.reactor.countdown.nTimer) / fl2f (0.65); old_size = (i2f (gameData.reactor.countdown.nTotalTime) - oldTime) / fl2f (0.65); if (size != old_size && (gameData.reactor.countdown.nSecsLeft < (gameData.reactor.countdown.nTotalTime-5))) // Every 2 seconds! DigiPlaySample (SOUND_CONTROL_CENTER_WARNING_SIREN, F3_0); } else { int flashValue = f2i (-gameData.reactor.countdown.nTimer * (64 / 4)); // 4 seconds to total whiteness if (oldTime > 0) DigiPlaySample (SOUND_MINE_BLEW_UP, F1_0); PALETTE_FLASH_SET (flashValue, flashValue, flashValue); if (gameStates.ogl.palAdd.blue > 64) { WINDOS ( DDGrSetCurrentCanvas (NULL), GrSetCurrentCanvas (NULL) ); WINDOS ( dd_gr_clear_canvas (RGBA_PAL2 (31,31,31)), GrClearCanvas (RGBA_PAL2 (31,31,31)) ); //make screen all white to match palette effect ResetCockpit (); //force cockpit redraw next time ResetPaletteAdd (); //restore palette for death message //controlcen->MaxCapacity = gameData.matCens.xFuelMaxAmount; //gauge_message ("Control Center Reset"); DoPlayerDead (); //kill_player (); } } }
void do_countdown_frame() { fix old_time; int fc, div_scale; if (!Control_center_destroyed) return; #if !defined(D2_OEM) && !defined(SHAREWARE) // get countdown in OEM and SHAREWARE only // On last level, we don't want a countdown. if ((Current_mission_num == 0) && (Current_level_num == Last_level)) { if (!(Game_mode & GM_MULTI)) return; if (Game_mode & GM_MULTI_ROBOTS) return; } #endif // Control center destroyed, rock the player's ship. fc = Countdown_seconds_left; if (fc > 16) fc = 16; // At Trainee, decrease rocking of ship by 4x. div_scale = 1; if (Difficulty_level == 0) div_scale = 4; ConsoleObject->mtype.phys_info.rotvel.x += (fixmul(rand() - 16384, 3*F1_0/16 + (F1_0*(16-fc))/32))/div_scale; ConsoleObject->mtype.phys_info.rotvel.z += (fixmul(rand() - 16384, 3*F1_0/16 + (F1_0*(16-fc))/32))/div_scale; // Hook in the rumble sound effect here. old_time = Countdown_timer; Countdown_timer -= RealFrameTime; Countdown_seconds_left = f2i(Countdown_timer + F1_0*7/8); if ( (old_time > COUNTDOWN_VOICE_TIME ) && (Countdown_timer <= COUNTDOWN_VOICE_TIME) ) { digi_play_sample( SOUND_COUNTDOWN_13_SECS, F3_0 ); } if ( f2i(old_time + F1_0*7/8) != Countdown_seconds_left ) { if ( (Countdown_seconds_left>=0) && (Countdown_seconds_left<10) ) digi_play_sample( SOUND_COUNTDOWN_0_SECS+Countdown_seconds_left, F3_0 ); if ( Countdown_seconds_left==Total_countdown_time-1) digi_play_sample( SOUND_COUNTDOWN_29_SECS, F3_0 ); } if (Countdown_timer > 0) { fix size,old_size; size = (i2f(Total_countdown_time)-Countdown_timer) / fl2f(0.65); old_size = (i2f(Total_countdown_time)-old_time) / fl2f(0.65); if (size != old_size && (Countdown_seconds_left < (Total_countdown_time-5) )) { // Every 2 seconds! //@@if (Dead_controlcen_object_num != -1) { //@@ vms_vector vp; //,v,c; //@@ compute_segment_center(&vp, &Segments[Objects[Dead_controlcen_object_num].segnum]); //@@ object_create_explosion( Objects[Dead_controlcen_object_num].segnum, &vp, size*10, VCLIP_SMALL_EXPLOSION); //@@} digi_play_sample( SOUND_CONTROL_CENTER_WARNING_SIREN, F3_0 ); } } else { int flash_value; if (old_time > 0) digi_play_sample( SOUND_MINE_BLEW_UP, F1_0 ); flash_value = f2i(-Countdown_timer * (64 / 4)); // 4 seconds to total whiteness PALETTE_FLASH_SET(flash_value,flash_value,flash_value); if (PaletteBlueAdd > 64 ) { WINDOS( dd_gr_set_current_canvas(NULL), gr_set_current_canvas( NULL ) ); WINDOS( dd_gr_clear_canvas(BM_XRGB(31,31,31)), gr_clear_canvas(BM_XRGB(31,31,31)) ); //make screen all white to match palette effect reset_cockpit(); //force cockpit redraw next time reset_palette_add(); //restore palette for death message //controlcen->MaxCapacity = Fuelcen_max_amount; //gauge_message( "Control Center Reset" ); DoPlayerDead(); //kill_player(); } } }