o_PauseScreen { GUI_CREATE { // Initialize all 5 buttons int iloop object mbutton[5] for(iloop = 0; iloop < 5; iloop++) { mbutton[iloop] = s_textbutton mbutton[iloop].textcolor = 0xffffffff mbutton[iloop].textsize = 1 mbutton[iloop].id = iloop } mbutton[0].text = localize$(IDS_PS_B_RESUME) mbutton[1].text = localize$(IDS_PS_B_OPTIONS) mbutton[2].text = localize$(IDS_PS_B_EXIT_MISSION) mbutton[3].text = localize$(IDS_PS_B_DISCONNECT) mbutton[4].text = localize$(IDS_PS_B_QUIT) for(iloop = 0; iloop < 5; iloop++) { initialize(mbutton[iloop]) } framerate = 30 sound btnTriggeredSound = SPATH "sfx_button5.wav" // variables for fading in and out int alpha_val = 5 int fadeout = false object exitScreen object disconnectScreen } GUI_INIT { mbutton[0].location = (getresx() / 2) - (getprint3dwidth(localize$(IDS_PS_B_RESUME)) / 2), getresy() / 2 - 150, 5 mbutton[1].location = (getresx() / 2) - (getprint3dwidth(localize$(IDS_PS_B_OPTIONS)) / 2), getresy() / 2 - 90, 5 mbutton[2].location = (getresx() / 2) - (getprint3dwidth(localize$(IDS_PS_B_EXIT_MISSION)) / 2), getresy() / 2 - 30, 5 mbutton[3].location = (getresx() / 2) - (getprint3dwidth(localize$(IDS_PS_B_DISCONNECT)) / 2), getresy() / 2 + 30, 5 mbutton[4].location = (getresx() / 2) - (getprint3dwidth(localize$(IDS_PS_B_QUIT)) / 2), getresy() / 2 + 130, 5 int i for i = 0; i < 5; i++ { initialize(mbutton[i]) } } GUI_ACTIVATE { for(iloop = 0; iloop < 5; iloop++) { activate(mbutton[iloop]) } } GUI_DEACTIVATE { for(iloop = 0; iloop < 5; iloop++) { deactivate(mbutton[iloop]) } } GUI_EXECUTE { if fadeout == true { // Fading out(Exiting) if alpha_val > 0 { alpha_val = alpha_val - 5 if alpha_val <= 0 { alpha_val = 0 unfocus } } } else { // Fading in(Entering) if alpha_val < 150 { alpha_val += 3 if alpha_val >= 150 { alpha_val = 150 } } } } GUI_DRAW { setpencolor(0, 0, 100, alpha_val) drawrect 0, 0 to getresx(), getresy() } GUI_MAILBOX { // Handle the Resume Request if (sender == mbutton[0]) { play btnTriggeredSound,1 callback($$SetShellCommand$$, ResumeMissionCommand) // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 5; iloop++) { deactivate(mbutton[iloop]) } } // Handle Options Request if (sender == mbutton[1]) { play btnTriggeredSound,1 callback($$SetShellCommand$$, SetPauseOptionResCommand) deactivate(this) } // Handle Exit Mission Request if (sender == mbutton[2]) { exitScreen = o_ErrorScreen exitScreen.error_header = localize$(IDS_PS_B_EXIT_MISSION) exitScreen.error_message = exit_mission exitScreen.button_mode = TWO_BUTTON_MODE exitScreen.buttonText[0] = localize$(IDS_GN_YES) exitScreen.buttonText[1] = localize$(IDS_GN_NO) initialize(exitScreen) activate(exitScreen) return } if ((sender == exitScreen) && (getmessage() == 0)) { play btnTriggeredSound,1 callback($$SetShellCommand$$, ExitMissionCommand) // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 5; iloop++) { deactivate(mbutton[iloop]) } } // Handle Disconnect Request if (sender == mbutton[3]) { disconnectScreen = o_ErrorScreen disconnectScreen.error_header = localize$(IDS_PS_B_DISCONNECT) disconnectScreen.error_message = localize$(IDS_PS_Q_DISCONNECT) disconnectScreen.button_mode = TWO_BUTTON_MODE disconnectScreen.buttonText[0] = localize$(IDS_GN_YES) disconnectScreen.buttonText[1] = localize$(IDS_GN_NO) initialize(disconnectScreen) activate(disconnectScreen) return } if ((sender == disconnectScreen) && (getmessage() == 0)) { play btnTriggeredSound,1 callback($$SetShellCommand$$, DisconnectCommand) // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 5; iloop++) { deactivate(mbutton[iloop]) } } // Handle Quit to Desktop Request if (sender == mbutton[4]) { play btnTriggeredSound,1 terminate // Tell this script to fade out and deactivate all its objects fadeout = true for(iloop = 0; iloop < 5; iloop++) { deactivate(mbutton[iloop]) } } } GUI_DESTROY { unfocus } } // A utility class for showing the mouse pointer when the pause menu is active 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 = 900 } GUI_DRAW { if (showMousePointer != 0) { render p_pointer, mouse.x, mouse.y } } }