/* ATTRACT_MODE.C */ /* ---------- headers */ #include "cseries.h" #include "cseries_windows.h" #include "attract_mode.h" #include "real_math.h" #include "cache_files.h" #include "bink_playback.h" #include "ui_widget.h" #include "sound_manager.h" #include "international_strings.h" #include "files.h" #include "errors.h" #include "event_manager.h" #include "network_game_globals.h" /* ---------- constants */ enum { ATTRACT_MODE_COUNTDOWN = 75000, MUSIC_FADE_TIME = 1500 }; /* ---------- prototypes */ /* random_math.c doesn't appear to have a header? */ extern unsigned long *get_global_local_random_seed_address(void); extern short seed_random_range(unsigned long *seed, short lower_bound, short upper_bound); /* ---------- globals */ static unsigned long bss_00453ad8; static char bss_00453ae8[128]; short data_002e4c84 = NONE; /* ---------- public code */ boolean attract_mode_should_start( void) { boolean should_start = FALSE; real progress; if (cache_files_precache_in_progress() && cache_files_precache_map_status(&progress)==1) { cache_files_precache_map_end(); } if (main_menu_screen_is_active() && !cache_files_precache_in_progress() && !network_game_is_active() && !bink_playback_active()) { unsigned long time_elapsed; unsigned long current_time = system_milliseconds(); unsigned long time_since_last_event = event_manager_time_of_last_event(); time_since_last_event = MAX(bss_00453ad8, time_since_last_event); time_elapsed = current_time-time_since_last_event; if (time_elapsed>=ATTRACT_MODE_COUNTDOWN-MUSIC_FADE_TIME) { if (ui_main_menu_music_active()) { ui_stop_main_menu_music(); } } else { if (!ui_main_menu_music_active()) { ui_start_main_menu_music(); } } if (time_elapsed>=ATTRACT_MODE_COUNTDOWN) { should_start = TRUE; } } return should_start; } void attract_mode_reset_timer( void) { bss_00453ad8 = system_milliseconds(); return; } const char *attract_mode_get_localized_movie_path( short movie) { short attempted_languages = 0; short language; const char *language_suffixes[] = { "_de", "_fr", "_es", "_it", "", "", "" }; match_assert("c:\\halo\\SOURCE\\interface\\attract_mode.c", 163, movie>=0 && movie