#include "Content\\ShellScripts\\stddefs.h" #include "Content\\ShellScripts\\buttons.script" #include "Content\\ShellScripts\\mc_listboxes.script" #include "Content\\ShellScripts\\listboxes.script" #include "Content\\ShellScripts\\ErrorScreen.script" #include "Content\\ShellScripts\\ShellFunctionHeaders.hpp" #include "Content\\ShellScripts\\ScriptStrings.h" main { GUI_CREATE { // use the whole region location = 0, 0, 0 region = 0, 0 to getresx(), getresy() // columns - operation, mission, save point int max_mccb_columns = 3 // XXX jackyc - need maximum number of items int max_mccb_items = 50 object screen = o_LoadScreen object pointer = o_MousePointer pointer.showMousePointer = 1 focus(screen) } } o_LoadScreen { GUI_CREATE { // Fonts for the header Font3d gFont3d = FPATH localize$(IDS_F_DIALOG_TITLE) // load dialog image pane gFrame = GPATH "dialog_500x300m.tga" // Background image pane p_interlace = GPATH "interlace.tga" alphamode (p_interlace) = am_alpha_alphainvalpha // Initialize the Load and Cancel buttons int iloop object mbutton[2] for(iloop = 0; iloop < 2; iloop++) { mbutton[iloop] = s_multistatepane mbutton[iloop].total_states = 3 mbutton[iloop].textsize = 1 mbutton[iloop].file = WPATH "button_reg_138x23m_3state.tga" mbutton[iloop].id = iloop } mbutton[0].text = localize$(IDS_GN_LOAD) mbutton[0].location = getresx() / 2 - 220, getresy() / 2 + 95, 20 mbutton[1].text = localize$(IDS_GN_CANCEL) mbutton[1].location = getresx() / 2 + 52, getresy() / 2 + 95, 20 for (iloop = 0; iloop < 2; iloop++) { initialize(mbutton[iloop]) } // XXX jackyc - need callback to number of saved games. int obj_size string szGame[35] callback($$Shell_CallbackHandler$$, ShellCampaignGetGames, szGame[], obj_size) // Initialize the mc list box for saved games listing object o_saved_games_mclistbox = s_mc_listbox o_saved_games_mclistbox.location = getresx() / 2 - 220, getresy() / 2 - 93, 10 o_saved_games_mclistbox.itemWidth = 420 o_saved_games_mclistbox.itemHeight = 4 o_saved_games_mclistbox.itemHeight_padding = 1 o_saved_games_mclistbox.list_size = obj_size o_saved_games_mclistbox.column_header_height = 0 o_saved_games_mclistbox.max_displayed = 45 o_saved_games_mclistbox.uniform_item_height = 0 o_saved_games_mclistbox.arrowHeight = 15 o_saved_games_mclistbox.top_of_list = 0 o_saved_games_mclistbox.label = localize$(IDS_LS_SAVED) o_saved_games_mclistbox.offsetLabel = 0,-18 o_saved_games_mclistbox.buttonwidth = 16 o_saved_games_mclistbox.first_delay = 10 o_saved_games_mclistbox.second_delay = 3 o_saved_games_mclistbox.SelectedHighlightColor = packcolor (50, 120, 255, 255) // Specify number of columns o_saved_games_mclistbox.num_of_columns = 1 o_saved_games_mclistbox.column[0].location.x = 5 o_saved_games_mclistbox.column[0].fontcolor = packcolor(255,0,0,255) o_saved_games_mclistbox.column[0].fontAlignment = just_left // Now store the saved games in the list box int i for (i = 0; i < obj_size; i++) { o_saved_games_mclistbox.column[0].list_item[i] = szGame[i] o_saved_games_mclistbox.list_order[i] = i } initialize(o_saved_games_mclistbox) framerate = 30 sound btnTriggeredSound = SPATH "sfx_button5.wav" // Variable for the confirmation screen object confirmScreen // variables for fading in and out int alpha_val = 5 int fadeout = false } GUI_ACTIVATE { for(iloop = 0; iloop < 2; iloop++) { activate(mbutton[iloop]) } activate(o_saved_games_mclistbox) } GUI_MAILBOX { // Handle the Load Request if (sender == mbutton[0]) { play btnTriggeredSound,1 confirmScreen = o_ErrorScreen confirmScreen.error_message = localize$(IDS_ERROR_LS_MESSAGE) confirmScreen.error_header = localize$(IDS_LS_TITLE) confirmScreen.button_mode = TWO_BUTTON_MODE confirmScreen.buttonText[0] = localize$(IDS_GN_YES) confirmScreen.buttonText[1] = localize$(IDS_GN_NO) initialize(confirmScreen) activate(confirmScreen) } // Handle Cancel Request if (sender == mbutton[1]) { play btnTriggeredSound,1 // if load is called by the pause script, // let the pause script know that we have cancelled the load if (exists(@PauseModalCampaign@)) mail(-1, @PauseModalCampaign@screen) if (exists(@Shell@)) { if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = CAMPAIGNLOBBY) { @SHELL@currentScreen = CAMPAIGNLOBBY @SHELL@lastScreenDepth-- } else if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = INSTANT_SCREEN) { @SHELL@currentScreen = INSTANT_SCREEN @SHELL@lastScreenDepth-- } } // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 2; iloop++) { deactivate(mbutton[iloop]) } deactivate(o_saved_games_mclistbox) } // Handle confirm Screen if (sender == confirmScreen)) { if (getmessage() == 0) { string szLoadGame szLoadGame = o_saved_games_mclistbox.column[0].list_item[o_saved_games_mclistbox.nselected] callback($$Shell_CallbackHandler$$, ShellCampaignLoadGame ,szLoadGame) // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 2; iloop++) { deactivate(mbutton[iloop]) } deactivate(o_saved_games_mclistbox) // if load is called by the pause script, // let the pause script know that we have loaded the file if (exists(@PauseModalCampaign@)) mail(1, @PauseModalCampaign@screen) if (exists(@Shell@)) { if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = CAMPAIGNLOBBY) { @SHELL@currentScreen = CAMPAIGNLOBBY @SHELL@lastScreenDepth-- } else if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = INSTANT_SCREEN) { @SHELL@currentScreen = INSTANT_SCREEN @SHELL@lastScreenDepth-- } } } else { activate(this) } } } GUI_CHAR { // Check for the Escape key to resume mission int ch = getchar() if (ch == 27) { play btnTriggeredSound,1 // if load is called by the pause script, // let the pause script know that we have cancelled the load if (exists(@PauseModalCampaign@)) mail(-1, @PauseModalCampaign@screen) if (exists(@Shell@)) { if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = CAMPAIGNLOBBY) { @SHELL@currentScreen = CAMPAIGNLOBBY } else if(@SHELL@lastScreen[@SHELL@lastScreenDepth] = INSTANT_SCREEN) { @SHELL@currentScreen = INSTANT_SCREEN } } // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 2; iloop++) { deactivate(mbutton[iloop]) } deactivate(o_saved_games_mclistbox) } } GUI_DRAW { // fade in or fade out setpencolor(0, 0, 100, alpha_val) drawrect 0, 0 to getresx(), getresy() color (p_interlace) = packcolor(0, 0, 0, alpha_val) render p_interlace, 0, 0 // Redraw the frame if we are not fading out(exiting) if (fadeout == false) { color (gframe) = packcolor(255, 255, 255, alpha_val) render gframe, getresx() / 2 - 250, getresy() / 2 - 150 // Header print3d_attributes = gFont3d,0xffffffff,1,0,1,0,0,2 print3d_margins = getresx() / 2 - 250, getresy() / 2 - 155 to getresx() / 2 + 250, getresy() / 2 - 50 print3d_position = getresx() / 2 - 250, getresy() / 2 - 145 print3d localize$(IDS_LS_TITLE) } } GUI_EXECUTE { if fadeout == true { // Fading out(Exiting) if alpha_val > 0 { alpha_val = alpha_val - 5 if alpha_val <= 0 { alpha_val = 0 script_end "LoadScreen.script" } } } else { // Fading in(Entering) if alpha_val < 150 { alpha_val += 3 if alpha_val >= 150 { alpha_val = 150 } } } } } // A utility class for showing the mouse pointer o_MousePointer { GUI_CREATE { int showMousePointer = 1 pane p_pointer = GPATH "mouse_pointer.tga" alphamode(p_pointer) = am_alpha_alphainvalpha origin(p_pointer) = 0, 0 location.z = 255 } GUI_DRAW { if (showMousePointer != 0) { render p_pointer, mouse.x, mouse.y } } }