// ----------------------------------------------------------------------------------------------------- //called when the player is starting a level (new game or new ship) StartLevel(int random) { Assert(!Player_is_dead); InitPlayerPosition(random); verify_console_object(); ConsoleObject->control_type = CT_FLYING; ConsoleObject->movement_type = MT_PHYSICS; disable_matcens(); clear_transient_objects(0); //0 means leave proximity bombs // create_player_appearance_effect(ConsoleObject); Do_appearance_effect = 1; #ifdef NETWORK if (Game_mode & GM_MULTI) { #ifndef SHAREWARE if (Game_mode & GM_MULTI_COOP) multi_send_score(); #endif multi_send_position(Players[Player_num].objnum); multi_send_reappear(); } if (Game_mode & GM_NETWORK) network_do_frame(1, 1); #endif ai_reset_all_paths(); ai_init_boss_for_ship(); reset_time(); reset_rear_view(); Auto_fire_fusion_cannon_time = 0; Fusion_charge = 0; Robot_firing_enabled = 1; if (VR_screen_mode == SCREEN_MENU) vr_reset_display(); }
// ----------------------------------------------------------------------------------------------------- //called when the player is starting a level (new game or new ship) void StartLevel(int random) { Assert(!Player_is_dead); InitPlayerPosition(random); verify_console_object(); ConsoleObject->control_type = CT_FLYING; ConsoleObject->movement_type = MT_PHYSICS; // create_player_appearance_effect(ConsoleObject); Do_appearance_effect = 1; if (Game_mode & GM_MULTI) { if (Game_mode & GM_MULTI_COOP) multi_send_score(); multi_send_reappear(); multi_do_protocol_frame(1, 1); } else // in Singleplayer, after we died ... { disable_matcens(); // ... disable matcens and ... clear_transient_objects(0); // ... clear all transient objects. } ai_reset_all_paths(); ai_init_boss_for_ship(); reset_rear_view(); Auto_fire_fusion_cannon_time = 0; Fusion_charge = 0; if (!(Game_mode & GM_MULTI)) // stuff for Singleplayer only { } }
start_endlevel_sequence() { int last_segnum,exit_side,tunnel_length; if (Newdemo_state == ND_STATE_RECORDING) // stop demo recording Newdemo_state = ND_STATE_PAUSED; if (Newdemo_state == ND_STATE_PLAYBACK) // don't do this if in playback mode return; if (Player_is_dead || ConsoleObject->flags&OF_SHOULD_BE_DEAD) return; //don't start if dead! Players[Player_num].homing_object_dist = -F1_0; // Turn off homing sound. reset_rear_view(); //turn off rear view if set if (!endlevel_data_loaded) { #ifdef NETWORK if (Game_mode & GM_MULTI) { multi_send_endlevel_start(0); #ifdef NETWORK network_do_frame(1, 1); #endif } #endif gr_palette_fade_out(gr_palette, 32, 0); PlayerFinishedLevel(0); //don't do special sequence return; } { int segnum,old_segnum,entry_side,i; //count segments in exit tunnel old_segnum = ConsoleObject->segnum; exit_side = find_exit_side(ConsoleObject); segnum = Segments[old_segnum].children[exit_side]; tunnel_length = 0; do { entry_side = matt_find_connect_side(segnum,old_segnum); exit_side = Side_opposite[entry_side]; old_segnum = segnum; segnum = Segments[segnum].children[exit_side]; tunnel_length++; } while (segnum >= 0); if (segnum != -2) { PlayerFinishedLevel(0); //don't do special sequence return; } last_segnum = old_segnum; //now pick transition segnum 1/3 of the way in old_segnum = ConsoleObject->segnum; exit_side = find_exit_side(ConsoleObject); segnum = Segments[old_segnum].children[exit_side]; i=tunnel_length/3; while (i--) { entry_side = matt_find_connect_side(segnum,old_segnum); exit_side = Side_opposite[entry_side]; old_segnum = segnum; segnum = Segments[segnum].children[exit_side]; } transition_segnum = segnum; } Assert(last_segnum == exit_segnum); cockpit_mode_save = Cockpit_mode; #ifdef NETWORK if (Game_mode & GM_MULTI) { multi_send_endlevel_start(0); network_do_frame(1, 1); } #endif songs_play_song( SONG_ENDLEVEL, 0 ); Endlevel_sequence = EL_FLYTHROUGH; ConsoleObject->movement_type = MT_NONE; //movement handled by flythrough ConsoleObject->control_type = CT_NONE; Game_suspended |= SUSP_ROBOTS; //robots don't move cur_fly_speed = desired_fly_speed = FLY_SPEED; start_endlevel_flythrough(0,ConsoleObject,cur_fly_speed); //initialize HUD_init_message( TXT_EXIT_SEQUENCE ); outside_mine = ext_expl_playing = 0; flash_scale = f1_0; //init_endlevel(); mine_destroyed=0; }