Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
233 lines
5.4 KiB
Plaintext
233 lines
5.4 KiB
Plaintext
#include "Content\\ShellScripts\\stddefs.h"
|
|
#include "Content\\ShellScripts\\PilotCommon.h"
|
|
#include "Content\\ShellScripts\\ScriptStrings.h"
|
|
#include "Content\\ShellScripts\\buttons.script"
|
|
#include "Content\\ShellScripts\\editbox.script"
|
|
#include "Content\\ShellScripts\\listboxes.script"
|
|
#include "Content\\ShellScripts\\ErrorScreen.script"
|
|
|
|
main
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
// use the whole region
|
|
location = 0, 0, 0
|
|
region = 0, 0 to getresx(), getresy()
|
|
|
|
object screen = o_EditPilotModal
|
|
}
|
|
}
|
|
|
|
o_EditPilotModal
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
Font3d gHeaderFont3d = szPATH_FONTS localize$(IDS_F_DIALOG_TITLE)
|
|
Font3d gFont3d = szPATH_FONTS localize$(IDS_F_GEN_DESCRIPTION)
|
|
|
|
pane gFrame = GPATH "dialog_500x300m.tga"
|
|
|
|
// Initialize the OK 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_OK)
|
|
mbutton[0].location = 180, 395, 10
|
|
mbutton[1].text = localize$(IDS_GN_CANCEL)
|
|
mbutton[1].location = 480, 395, 10
|
|
|
|
for(iloop = 0; iloop < 2; iloop++)
|
|
{
|
|
initialize(mbutton[iloop])
|
|
}
|
|
framerate = 30
|
|
|
|
// Initialize and focus on the Edit Box
|
|
object mEditBox = s_editbox
|
|
mEditBox.location = 370, 280, 10
|
|
mEditBox.boxWidth = 250
|
|
mEditBox.boxHeight = 20
|
|
mEditBox.boxFont3D = szPATH_FONTS localize$(IDS_F_GEN_EDITBOX)
|
|
mEditBox.labelFont3D = szPATH_FONTS localize$(IDS_F_GEN_LABEL)
|
|
mEditBox.label = localize$(IDS_RS_L_PILOT_NAME_COLON)
|
|
mEditBox.boxTextOffset = 5, 3
|
|
mEditBox.offset = -185, 3
|
|
mEditBox.boxTextLimit = PILOT_NAME_TEXT_LIMIT
|
|
initialize(mEditBox)
|
|
|
|
// Grab the name and difficulty of the current pilot from the parent script
|
|
int nselected = @PilotEntry@screen.o_players_mclistbox.nselected
|
|
mEditBox.boxvalue = @PilotEntry@screen.o_players_mclistbox.column[0].list_item[nselected]
|
|
|
|
sound btnTriggeredSound = SPATH "sfx_button5.wav"
|
|
|
|
focus(mEditBox)
|
|
|
|
// variables for fading in and out
|
|
int alpha_val = 5
|
|
int fadeout = false
|
|
|
|
// Variable for the error screen
|
|
object errorScreen
|
|
}
|
|
|
|
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 "EditPilotModal.script"
|
|
}
|
|
}
|
|
}
|
|
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 (fadeout == false)
|
|
{
|
|
color (gframe) = packcolor(255, 255, 255, alpha_val)
|
|
render gframe, 150, 150
|
|
|
|
// Header
|
|
print3d_attributes = gHeaderFont3d,0xffffffff,1,0,1,0,0,just_center
|
|
print3d_margins = 150, 150 to 650, 450
|
|
print3d_position = 150, 155
|
|
print3d localize$(IDS_RS_EDIT_TITLE)
|
|
|
|
print3d_attributes = gFont3d,0xffffffff,1,1,1,0,0
|
|
print3d_margins = 180, 200 to 620, 400
|
|
print3d_position = 180, 200
|
|
print3d localize$(IDS_RS_S_EDIT)
|
|
}
|
|
}
|
|
|
|
GUI_MAILBOX
|
|
{
|
|
// Handle edit box finished edit
|
|
if (sender == mEditBox)
|
|
{
|
|
if(getmessage() == 1)
|
|
{
|
|
focus(mbutton[0])
|
|
}
|
|
}
|
|
|
|
// Handle the OK Request
|
|
if (sender == mbutton[0])
|
|
{
|
|
play btnTriggeredSound,1
|
|
unfocus
|
|
|
|
// Pass the data to the Pilot Screen script and let it handle the data
|
|
@PilotEntry@screen.currentPilotName = mEditBox.boxValue
|
|
mail(1, @PilotEntry@screen)
|
|
}
|
|
|
|
// Handle the Cancel Request
|
|
if (sender == mbutton[1])
|
|
{
|
|
play btnTriggeredSound,1
|
|
unfocus
|
|
|
|
// Just tell the Pilot Screen script that no changes should be made
|
|
mail(-1, @PilotEntry@screen)
|
|
@PilotEntry@screen.onEditPilot = 0
|
|
|
|
// Tell this script to fade out and deactivate all its objects
|
|
fadeout = true
|
|
for(iloop = 0; iloop < 2; iloop++)
|
|
{
|
|
deactivate(mbutton[iloop])
|
|
}
|
|
deactivate(mEditBox)
|
|
}
|
|
|
|
if (sender == @PilotEntry@screen)
|
|
{
|
|
if (getmessage() == -1)
|
|
{
|
|
errorScreen = o_ErrorScreen
|
|
errorScreen.error_message = localize$(IDS_RS_E_PILOT_EDIT_EMPTY)
|
|
initialize(errorScreen)
|
|
activate(errorScreen)
|
|
return
|
|
}
|
|
|
|
if (getmessage() == -2)
|
|
{
|
|
errorScreen = o_ErrorScreen
|
|
errorScreen.error_message = localize$(IDS_RS_E_PILOT_EDIT_SPACE)
|
|
initialize(errorScreen)
|
|
activate(errorScreen)
|
|
return
|
|
}
|
|
|
|
if (getmessage() == -3)
|
|
{
|
|
errorScreen = o_ErrorScreen
|
|
errorScreen.error_message = localize$(IDS_RS_E_PILOT_EDIT_SAME)
|
|
initialize(errorScreen)
|
|
activate(errorScreen)
|
|
return
|
|
}
|
|
|
|
if (getmessage() == -4)
|
|
{
|
|
errorScreen = o_ErrorScreen
|
|
errorScreen.error_message = localize$(IDS_RS_E_PILOT_EDIT_INVALID)
|
|
initialize(errorScreen)
|
|
activate(errorScreen)
|
|
return
|
|
}
|
|
|
|
if (getmessage() == 1)
|
|
{
|
|
@PilotEntry@screen.onEditPilot = 0
|
|
|
|
// Tell this script to fade out and deactivate all its objects
|
|
fadeout = true
|
|
for(iloop = 0; iloop < 2; iloop++)
|
|
{
|
|
deactivate(mbutton[iloop])
|
|
}
|
|
deactivate(mEditBox)
|
|
}
|
|
}
|
|
|
|
if (sender == errorScreen)
|
|
{
|
|
focus(mEditBox)
|
|
}
|
|
}
|
|
} |