#include "Content\\ShellScripts\\stddefs.h" #include "Content\\ShellScripts\\ScriptStrings.h" #define NO_BUTTON_MODE 0 #define ONE_BUTTON_MODE 1 #define TWO_BUTTON_MODE 2 #define THREE_BUTTON_MODE 3 o_ErrorScreen { GUI_CREATE { // use the whole region location = 0, 0, 500 region = 0, 0 to getresx(), getresy() Font3d gHeaderFont3d = FPATH localize$(IDS_F_GEN_SCREEN_TITLE) Font3d gFont3d = FPATH localize$(IDS_F_GEN_DESCRIPTION) int initialized = false int extended_size = 0 pane gFrame framerate = 30 sound btnTriggeredSound = SPATH "sfx_button5.wav" // These three variables below MUST BE INITIALIZED int button_mode = ONE_BUTTON_MODE string error_header = localize$(IDS_GN_ERROR) string error_message = "" string buttonText[3] int use_fadeout = true // default text message for button 0 buttonText[0] = localize$(IDS_GN_OK) // button objects object mbutton[3] // variables for fading in and out int alpha_val = 5 int fadeout = false } GUI_INIT { // set up all button objects int i for (i = 0; i < button_mode; i++) { mbutton[i] = s_multistatepane mbutton[i].file = WPATH "button_reg_138x23m_3state.tga" mbutton[i].total_states = 3 // mbutton[i].twidth = 100 mbutton[i].id = 0 mbutton[i].text = buttonText[i] } if (extended_size == 0) { gFrame = GPATH "dialog_350x250m.tga" // set up the location of button objects and then initialize switch (button_mode) { case THREE_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 150, getresy() / 2 + 105, location.z + 20 mbutton[1].location = getresx() / 2, getresy() / 2 + 105, location.z + 20 mbutton[2].location = getresx() / 2 - 25, getresy() / 2 + 55, location.z + 20 initialize(mbutton[0]) initialize(mbutton[1]) initialize(mbutton[2]) break case TWO_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 149, (getresy() / 2) + 72, location.z + 20 mbutton[1].location = getresx() / 2 + 7, (getresy() / 2) + 72, location.z + 20 initialize(mbutton[0]) initialize(mbutton[1]) break case ONE_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 71, (getresy() / 2) + 72, location.z + 20 initialize(mbutton[0]) break } } else { gFrame = GPATH "dialog_500x300m.tga" // set up the location of button objects and then initialize switch (button_mode) { case THREE_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 224, getresy() / 2 + 95, location.z + 20 mbutton[1].location = getresx() / 2 + 82, getresy() / 2 + 95, location.z + 20 mbutton[2].location = getresx() / 2 - 70, getresy() / 2 + 95, location.z + 20 initialize(mbutton[0]) initialize(mbutton[1]) initialize(mbutton[2]) break case TWO_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 189, (getresy() / 2) + 90, location.z + 20 mbutton[1].location = getresx() / 2 + 47, (getresy() / 2) + 90, location.z + 20 initialize(mbutton[0]) initialize(mbutton[1]) break case ONE_BUTTON_MODE: mbutton[0].location = getresx() / 2 - 71, (getresy() / 2) + 90, location.z + 20 initialize(mbutton[0]) break } } if use_fadeout == false { alpha_val = 150 } initialized = true } GUI_ACTIVATE { int i for (i = 0; i < button_mode; i++) { activate(mbutton[i]) } focus(mbutton[0]) } GUI_DEACTIVATE { int i for (i = 0; i < button_mode; i++) { deactivate(mbutton[i]) } } GUI_EXECUTE { if use_fadeout == true { if fadeout == true { // Fading out(Exiting) if alpha_val > 0 { alpha_val = alpha_val - 5 if alpha_val <= 0 { alpha_val = 0 deactivate(this) } } } else { // Fading in(Entering) if alpha_val < 150 { alpha_val += 5 if alpha_val >= 150 { alpha_val = 150 } } } } } GUI_DRAW { // fade in or fade out setpencolor(0, 0, 0, alpha_val) drawrect 0, 0 to getresx(), getresy() // Redraw the frame if we are not fading out(exiting) if ((initialized) && (fadeout == false)) { color (gframe) = packcolor(255, 255, 255, alpha_val) if (extended_size == 0) { render gframe, getresx() / 2 - 175, getresy() / 2 - 125 // Header print3d_attributes = gHeaderFont3d,0xffffffff,1,0,1,0,0,2 print3d_margins = getresx() / 2 - 175, (getresy() / 2) - 118 to getresx() / 2 + 175, getresy() / 2 - 50 print3d_position = getresx() / 2 - 175, (getresy() / 2) - 118 print3d error_header print3d_attributes = gFont3d,0xffffffff,1,1,1,0,0,0 print3d_margins = (getresx() / 2) - 145, getresy() / 2 - 75 to getresx() / 2 + 145, getresy() / 2 + 75 print3d_position = (getresx() / 2) - 145, getresy() / 2 - 75 print3d error_message } else { render gframe, getresx() / 2 - 250, getresy() / 2 - 150 // Header print3d_attributes = gHeaderFont3d,0xffffffff,1,0,1,0,0,2 print3d_margins = getresx() / 2 - 185, (getresy() / 2) - 140 to getresx() / 2 + 175, getresy() / 2 - 80 print3d_position = getresx() / 2 - 185, (getresy() / 2) - 140 print3d error_header print3d_attributes = gFont3d,0xffffffff,1,-1,1,0,0,0 print3d_margins = (getresx() / 2) - 225, getresy() / 2 - 100 to getresx() / 2 + 225, getresy() / 2 + 85 print3d_position = (getresx() / 2) - 225, getresy() / 2 - 100 print3d error_message } } } GUI_MAILBOX { // mail the button number to the parent and then deactivate this object int i for (i = 0; i < button_mode; i++) { if (sender == mbutton[i]) { play btnTriggeredSound,1 // Mail the button number to the parent mail(i) // Tell this script to fade out and deactivate all its objects fadeout = true int j for (j = 0; j < button_mode; j++) { deactivate(mbutton[j]) } } } } }