//returns number of item chosen int DoMenu() { int menu_choice[25]; newmenu_item m[25]; int num_options = 0; if ( Players[Player_num].callsign[0]==0 ) { RegisterPlayer(); return 0; } if ((Game_mode & GM_SERIAL) || (Game_mode & GM_MODEM)) { do_option(MENU_START_SERIAL); return 0; } create_main_menu(m, menu_choice, &num_options); do { keyd_time_when_last_pressed = timer_get_fixed_seconds(); // .. 20 seconds from now! if (main_menu_choice < 0 ) main_menu_choice = 0; Menu_draw_copyright = 1; main_menu_choice = newmenu_do2( "", NULL, num_options, m, autodemo_menu_check, main_menu_choice, Menu_pcx_name); if ( main_menu_choice > -1 ) do_option(menu_choice[main_menu_choice]); create_main_menu(m, menu_choice, &num_options); // may have to change, eg, maybe selected pilot and no save games. } while( Function_mode==FMODE_MENU ); // if (main_menu_choice != -2) // do_auto_demo = 0; // No more auto demos if ( Function_mode==FMODE_GAME ) gr_palette_fade_out( gr_palette, 32, 0 ); return main_menu_choice; }
//called when the player has finished a level PlayerFinishedLevel(int secret_flag) { int rval; int was_multi = 0; //credit the player for hostages Players[Player_num].hostages_rescued_total += Players[Player_num].hostages_on_board; if (!(Game_mode & GM_MULTI) && (secret_flag)) { newmenu_item m[1]; m[0].type = NM_TYPE_TEXT; m[0].text = " "; //TXT_SECRET_EXIT; newmenu_do2(NULL, TXT_SECRET_EXIT, 1, m, NULL, 0, "MENU.PCX"); } // -- mk mk mk -- used to be here -- mk mk mk -- if (Game_mode & GM_NETWORK) if (secret_flag) Players[Player_num].connected = 4; // Finished and went to secret level else Players[Player_num].connected = 2; // Finished but did not die last_drawn_cockpit = -1; if (Current_level_num == Last_level) { #ifdef NETWORK if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) { was_multi = 1; multi_endlevel_score(); rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) } else #endif { // Note link to above else! rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) DoEndLevelScoreGlitz(0); //give bonuses } } else { #ifdef NETWORK if (Game_mode & GM_MULTI) multi_endlevel_score(); else #endif // Note link!! DoEndLevelScoreGlitz(0); //give bonuses rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) } if (!was_multi && rval) { if (Current_mission_num == 0) scores_maybe_add_player(0); longjmp( LeaveGame, 0 ); // Exit out of game loop } else if (rval) longjmp( LeaveGame, 0 ); }
//returns number of item chosen int DoMenu() { int menu_choice[25]; newmenu_item m[25]; int num_options = 0; if ( Players[Player_num].callsign[0]==0 ) { RegisterPlayer(); return 0; } if ((Game_mode & GM_SERIAL) || (Game_mode & GM_MODEM)) { do_option(MENU_START_SERIAL); return 0; } create_main_menu(m, menu_choice, &num_options); do { keyd_time_when_last_pressed = timer_get_fixed_seconds(); // .. 20 seconds from now! if (main_menu_choice < 0 ) main_menu_choice = 0; Menu_draw_copyright = 1; //added on 11/19/98 by Victor Rachels to add immediate join/start if(start_net_immediately == 1){ if ( gr_palette_faded_out ) {//fix black screen with -startnetgame gr_palette_fade_in( gr_palette, 32, 0 ); } do_option(MENU_START_NETGAME); start_net_immediately = 0; } else if(start_net_immediately == 2) { do_option(MENU_JOIN_NETGAME); start_net_immediately = 0; } else { //end this section addition - VR extern int Menu_Special; Menu_Special = 1; main_menu_choice = newmenu_do2(NULL, NULL, num_options, m, autodemo_menu_check, main_menu_choice, Menu_pcx_name); if ( main_menu_choice > -1 ) do_option(menu_choice[main_menu_choice]); } create_main_menu(m, menu_choice, &num_options); // may have to change, eg, maybe selected pilot and no save games. } while( Function_mode==FMODE_MENU ); // if (main_menu_choice != -2) // do_auto_demo = 0; // No more auto demos if ( Function_mode==FMODE_GAME ) gr_palette_fade_out( gr_palette, 32, 0 ); return main_menu_choice; }
//called when the player has finished a level void PlayerFinishedLevel(int secret_flag) { int rval; int was_multi = 0; if (Game_wind) window_set_visible(Game_wind, 0); //credit the player for hostages Players[Player_num].hostages_rescued_total += Players[Player_num].hostages_on_board; #ifndef SHAREWARE if (!(Game_mode & GM_MULTI) && (secret_flag)) { newmenu_item m[1]; m[0].type = NM_TYPE_TEXT; m[0].text = " "; //TXT_SECRET_EXIT; newmenu_do2(NULL, TXT_SECRET_EXIT, 1, m, NULL, NULL, 0, Menu_pcx_name); } #endif // -- mk mk mk -- used to be here -- mk mk mk -- #ifdef NETWORK if (Game_mode & GM_NETWORK) { if (secret_flag) Players[Player_num].connected = CONNECT_FOUND_SECRET; // Finished and went to secret level else Players[Player_num].connected = CONNECT_WAITING; // Finished but did not die } #endif last_drawn_cockpit = -1; if (Current_level_num == Last_level) { #ifdef NETWORK if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) { was_multi = 1; multi_endlevel_score(); rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) } else #endif { // Note link to above else! rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) DoEndLevelScoreGlitz(0); //give bonuses } } else { #ifdef NETWORK if (Game_mode & GM_MULTI) multi_endlevel_score(); else #endif // Note link!! DoEndLevelScoreGlitz(0); //give bonuses rval = AdvanceLevel(secret_flag); //now go on to the next one (if one) } if (!was_multi && rval) { #ifndef SHAREWARE if (PLAYING_BUILTIN_MISSION) #endif scores_maybe_add_player(0); if (Game_wind) window_close(Game_wind); // Exit out of game loop } else if (rval && Game_wind) window_close(Game_wind); if (Game_wind) window_set_visible(Game_wind, 1); reset_time(); }
// ----------------------------------------------------------------------------- // Does the bonus scoring. // Call with dead_flag = 1 if player died, but deserves some portion of bonus (only skill points), anyway. void DoEndLevelScoreGlitz(int network) { int level_points, skill_points, energy_points, shield_points, hostage_points; int all_hostage_points; int endgame_points; char all_hostage_text[64]; char endgame_text[64]; #define N_GLITZITEMS 9 char m_str[N_GLITZITEMS][30]; newmenu_item m[9]; int i,c; char title[128]; int is_last_level; gr_palette_load( gr_palette ); level_points = Players[Player_num].score-Players[Player_num].last_score; if (!cheats.enabled) { if (Difficulty_level > 1) { skill_points = level_points*(Difficulty_level-1)/2; skill_points -= skill_points % 100; } else skill_points = 0; shield_points = f2i(Players[Player_num].shields) * 10 * (Difficulty_level+1); energy_points = f2i(Players[Player_num].energy) * 5 * (Difficulty_level+1); hostage_points = Players[Player_num].hostages_on_board * 500 * (Difficulty_level+1); } else { skill_points = 0; shield_points = 0; energy_points = 0; hostage_points = 0; } all_hostage_text[0] = 0; endgame_text[0] = 0; if (!cheats.enabled && (Players[Player_num].hostages_on_board == Players[Player_num].hostages_level)) { all_hostage_points = Players[Player_num].hostages_on_board * 1000 * (Difficulty_level+1); sprintf(all_hostage_text, "%s%i\n", TXT_FULL_RESCUE_BONUS, all_hostage_points); } else all_hostage_points = 0; if (!cheats.enabled && !(Game_mode & GM_MULTI) && (Players[Player_num].lives) && (Current_level_num == Last_level)) { //player has finished the game! endgame_points = Players[Player_num].lives * 10000; sprintf(endgame_text, "%s%i\n", TXT_SHIP_BONUS, endgame_points); is_last_level=1; } else endgame_points = is_last_level = 0; add_bonus_points_to_score(skill_points + energy_points + shield_points + hostage_points + all_hostage_points + endgame_points); c = 0; sprintf(m_str[c++], "%s%i", TXT_SHIELD_BONUS, shield_points); // Return at start to lower menu... sprintf(m_str[c++], "%s%i", TXT_ENERGY_BONUS, energy_points); sprintf(m_str[c++], "%s%i", TXT_HOSTAGE_BONUS, hostage_points); sprintf(m_str[c++], "%s%i", TXT_SKILL_BONUS, skill_points); sprintf(m_str[c++], "%s", all_hostage_text); if (!(Game_mode & GM_MULTI) && (Players[Player_num].lives) && (Current_level_num == Last_level)) sprintf(m_str[c++], "%s", endgame_text); sprintf(m_str[c++], "%s%i\n", TXT_TOTAL_BONUS, shield_points+energy_points+hostage_points+skill_points+all_hostage_points+endgame_points); sprintf(m_str[c++], "%s%i", TXT_TOTAL_SCORE, Players[Player_num].score); for (i=0; i<c; i++) { m[i].type = NM_TYPE_TEXT; m[i].text = m_str[i]; } // m[c].type = NM_TYPE_MENU; m[c++].text = "Ok"; if (Current_level_num < 0) sprintf(title,"%s%s %d %s\n %s %s",is_last_level?"\n\n\n":"\n",TXT_SECRET_LEVEL, -Current_level_num, TXT_COMPLETE, Current_level_name, TXT_DESTROYED); else sprintf(title,"%s%s %d %s\n%s %s",is_last_level?"\n\n\n":"\n",TXT_LEVEL, Current_level_num, TXT_COMPLETE, Current_level_name, TXT_DESTROYED); Assert(c <= N_GLITZITEMS); #ifdef NETWORK if ( network && (Game_mode & GM_NETWORK) ) newmenu_do2(NULL, title, c, m, multi_endlevel_poll1, NULL, 0, Menu_pcx_name); else #endif // Note link! newmenu_do2(NULL, title, c, m, NULL, NULL, 0, Menu_pcx_name); }