Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

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.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,256 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
location = (getresx() / 2) - 175, 125, 5
region = -200,-200 to getresx(),getresy()
font3d regfont = FPATH localize$(IDS_F_MP_LABEL)
font3d boldfont = FPATH localize$(IDS_F_ML_DATA)
object o_incorrect = incorrect
o_incorrect.location = location.x, location.y, 10
object o_cancel = s_multistatepane
o_cancel.total_states = 3
o_cancel.textsize = 1
o_cancel.text = localize$(IDS_GN_CANCEL)
o_cancel.file = WPATH "button_reg_138x23m_3state.tga"
o_cancel.location = location.x + 177, location.y + 192, 10
initialize(o_cancel)
object o_ok = s_multistatepane
o_ok.total_states = 4
o_ok.state = 0
o_ok.textsize = 1
o_ok.text = localize$(IDS_GN_OK)
o_ok.file = WPATH "button_reg_138x23m_4state.tga"
o_ok.location = location.x + 31, location.y + 192, 10
initialize(o_ok)
//-----------------------------------------------------
object o_ipaddress = s_editbox
// o_ipaddress.relative = true
o_ipaddress.location = location.x + 33,location.y + 150,location.z+20
o_ipaddress.boxValue = "" //CAN BE INITIALIZED holds the contents of the edit box
o_ipaddress.boxWidth = 283 //MUST BE INTIALIZED width of the edit field of the box
o_ipaddress.boxHeight = 20 //MUST BE INTIALIZED height of the edit field of the box//
// IMPORTANT - 25 is the max limit for an TCPIP address on the C side
o_ipaddress.boxtextlimit = 25
// o_ipaddress.boxFont3d = FPATH localize$(IDS_F_MP_LABEL) //MUST BE INTIALIZED
o_ipaddress.boxTextOffset = 3,3 //CAN BE INITIALIZED
o_ipaddress.label = LOCALIZE$(IDS_MP_AIP_ADD) //CAN BE INITIALIZED
// o_ipaddress.labelFont3d = FPATH localize$(IDS_F_MP_LABEL) //MUST BE INTIALIZED
o_ipaddress.offset = 0,-15 //CAN BE INITIALIZED offset of text from button
initialize (o_ipaddress)
focus(o_ipaddress)
//---------------------------------------------------
// variables for fading in and out
int alpha_val = 5
int fadeout = false // variables for fading in and out
//-----------------------------------------------------
pane p_background = GPATH "dialog_350x250m.tga"
framerate = 30
}
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
}
}
}
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)
{
render p_background, location.x, location.y, 0
print3d_attributes = regfont,packcolor(255,255,255,255),1,1,1,0,0
lprint3d_margins = 33,53 to 317,150
lprint3d_position = 33,53
print3d localize$(IDS_MP_AIP_ENTER)
print3d_attributes = boldfont,packcolor(255,255,255,255),1,1,1,0,0,just_center
lprint3d_margins = 0,8 to 350,30
lprint3d_position = 0,8
print3d localize$(IDS_MP_AIP_TITLE)
}
}
GUI_MAILBOX
{
if sender == o_ok
{
//callback to use address?
int handle = callback($$BrowseIPAddress$$, o_ipaddress.boxValue)
// request update of this specific browser
callback( $$UpdateGameList$$, handle )
fadeout = true
deactivate(o_ipaddress)
deactivate(o_cancel)
deactivate(o_ok)
//script_end
}
if sender == o_cancel
{
//script_end
fadeout = true
deactivate(o_ipaddress)
deactivate(o_cancel)
deactivate(o_ok)
}
}
}
incorrect
{
GUI_CREATE
{
int TimeToStop
}
GUI_DRAW
{
if gettime() < TimeToStop
{
//set up attributes
print3d_attributes = regfont,packcolor(255,255,255,255),1,1,1,0,0,just_center
//set up print location
lprint3d_position = 0,80
//set up margins, if none provided set them to the length of the text
lprint3d_margins = 0,0 to 360,260
//draw the text
print3d localize$(IDS_MP_AIP_INCORRECT)
}
}
}
ping_enabler
{
GUI_CREATE
{
framerate = 30
}
GUI_EXECUTE
{
if o_ping_less_than.state != 2
{
o_ping.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_ping.borderColor = packcolor (100,100,255,100)
o_ping.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor(100,255,255,100) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_ping.frameHighlightColor = packcolor(0,0,255,128)
o_ping.location.z = parent.location.z+10
region = 0,0 to 220,20
if gotfocus(o_ping) == true
unfocus(o_ping)
}
else
{
o_ping.backColor = packcolor(0,0,0,128) //128 //CAN BE INITIALIZED
o_ping.borderColor = packcolor (100,100,255,255)
o_ping.boxTextColor = PACKCOLOR(200,200,200,255) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor(100,255,255,255) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor(200,200,255,255) //CAN BE INITIALIZED
o_ping.frameHighlightColor = packcolor(0,0,255,128)
o_ping.location.z = 60
region = 0,0 to 0,0
}
}
}
game_type_enabler
{
GUI_CREATE
{
framerate = 30
}
GUI_EXECUTE
{
if o_game_type.state != 2
{
o_game_type_list.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (100,100,255,100)
o_game_type_list.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor(100,255,255,100) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_game_type_list.frameHighlightColor = packcolor(0,0,255,128)
o_game_type_list.location.z = parent.location.z+10
region = 0,0 to 220,20
if gotfocus(o_game_type_list) == true
{
unfocus(o_game_type_list)
}
}
else
{
o_game_type_list.backColor = packcolor(0,0,0,128) //128 //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (100,100,255,255)
o_game_type_list.boxTextColor = PACKCOLOR(200,200,200,255) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor(100,255,255,255) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor(200,200,255,255) //CAN BE INITIALIZED
o_game_type_list.frameHighlightColor = packcolor(0,0,255,128)
o_game_type_list.location.z = 60
region = 0,0 to 0,0
}
}
}
@@ -0,0 +1,535 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\NetParams.h"
#include "Content\\ShellScripts\\ShellFunctionHeaders.hpp"
#include "Content\\ShellScripts\\MechLabHeaders.h"
#include "Content\\ShellScripts\\common_shell.script"
#define SCRIPTPATH "content\\ShellScripts\\Multiplayer\\"
#include "Content\\ShellScripts\\mc_listboxes.script"
#include "Content\\ShellScripts\\listboxes.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\c_Text.script"
#include "Content\\ShellScripts\\c_rollover.script"
#include "Content\\ShellScripts\\WeaponNames.h"
#include "Content\\ShellScripts\\ErrorScreen.script"
#define MSG_SETWEAPONSLIST 20001
main
{
GUI_CREATE
{
int i
int MAX_MC_ITEMS = 60
int MAX_MC_COLUMNS = 2
int MAX_MCCB_ITEMS = 60
int MAX_MCCB_COLUMNS = 2
int param_id
int allowed
int chassis
int num_beam
int num_ball
int num_miss
int num_comp
int BeamFirst = 1
int BallFirst = 1
int MissFirst = 1
int CompFirst = 1
int OldList = 0
object o_background = background
object o_frame = frame
o_frame.type = 1
o_frame.location = 0, 0, 100
o_frame.screen_name = localize$(IDS_MP_BR_TITLE)
initialize(o_frame)
object o_mouselines = mouselines
o_mouselines.location = 0, 0, o_frame.location.z - 1
object oRollover = s_HelpRegion
oRollover.nFontID = IDS_F_ROLLOVER_INFO
oRollover.cTextColor= 0xFFff7200
oRollover.location = 31,516,255
oRollover.nWidth = 538
oRollover.nHeight = 56
initialize(oRollover)
//Text Titles
object oChassisTitle = s_Text
oChassisTitle.location = 101 ,70,nZ_TEXT
oChassisTitle.nFontID = IDS_F_MP_LABEL
oChassisTitle.nResID = IDS_MP_BR_CHASSIS_TITLE
oChassisTitle.cTextColor= cWhite
oChassisTitle.nJustify = 0
initialize(oChassisTitle)
object oWeaponsTitle = s_Text
oWeaponsTitle.location = 376 ,70,nZ_TEXT
oWeaponsTitle.nFontID = IDS_F_MP_LABEL
oWeaponsTitle.nResID = IDS_MP_BR_WEAPONS_TITLE
oWeaponsTitle.cTextColor= cWhite
oWeaponsTitle.nJustify = 0
initialize(oWeaponsTitle)
//Buttons
object oCancel = s_multistatepane
oCancel.file = WPATH "button_reg_196x27m_3state.tga"
oCancel.text = localize$(IDS_GN_CANCEL)
oCancel.nRollover = 1
oCancel.nHelpID = IDS_HELP_MP_BR_CANCEL
oCancel.total_states = 3
oCancel.location = 580, 510, o_frame.location.z + 1 //nZ_BUTTON
initialize (oCancel)
object oReady = s_multistatepane
oReady.file = WPATH "button_main_196x41m_3state.tga"
oReady.text = localize$(IDS_GN_OK)
oReady.nRollover = 1
oReady.nHelpID = IDS_HELP_MP_BR_READY
oReady.total_states = 3
oReady.location = 580, 540, o_frame.location.z + 1 //nZ_BUTTON
initialize (oReady)
//Chassis list
int Drop_Y = 95
int Drop_C1_Off = 5
int Drop_C2_Off = 25
int Drop_H = 365
int k
string szChassis[NoMechID]
int nPrev_ChassisSelect
int greatest_x //These valus are for the calc's in the oDChassis height and wiidth
int greatest_y
MAX_MC_ITEMS = NoMechID
MAX_MCCB_ITEMS = NoMechID
object oDChassis = s_mc_listbox
oDChassis.nRollover = 1
oDChassis.nHelpID = IDS_HELP_MP_BR_CHASSIS
oDChassis.location = 100,Drop_Y,nZ_LISTBOX
oDChassis.itemWidth = 200
oDChassis.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
oDChassis.itemHeight_padding = 10
oDChassis.list_size = NoMechID
oDChassis.NUM_OF_COLUMNS = 2
oDChassis.column_header_height = 0
oDChassis.max_displayed = Drop_H // max number of itemheight's. maz_displayed*itemheight = height of listbox
oDChassis.uniform_item_height = 0
oDChassis.column[0].checked = true
oDChassis.column[0].location.x = Drop_C1_Off
oDChassis.column[1].location.x = Drop_C2_Off
oDChassis.column[1].fontcolor = cWhite
//Fills String array
for(i = FirstMechID; i < (LastMechID + 1);i++)
{
szChassis[i] = localize$(DNL_ARCTICWOLF + I)
}
for k = 0; k < oDChassis.list_size; k++
{
oDChassis.column[1].list_item[k] = szChassis[k]
oDChassis.list_order[k] = k
oDChassis.column[0].pic_file = WPATH "Checkbox_15x15_3_Build.tga"
oDChassis.column[0].checkbox_num_of_states = 3
oDChassis.column[0].fontAlignment = just_left
}
bitmap_create black = 20,20 //comment out if you don't have any images
initialize (oDChassis)
//set value for checkboxes
for k = 0; k < oDChassis.list_size; k++
{
param_id = ALLOWED_MECH_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,k)
oDChassis.column[0].o_checkbox[k].check = allowed
}
//Junk strings for weapons callbacks
int List_max = 45
int ids[List_max]
int slots[List_max]
int slot_size[List_max]
float ton[List_max]
float damage[List_max]
float range[List_max]
float heat[List_max]
float weapon_recycle[List_max]
int inventory_count[List_max]
int num_weap
//Backup Holder
int j
int holder[150]
//weapon names
object oBuildWeaponNames = build_weapon_names
//Weapon sorting list
object oWeaponSelection = s_droplistbox
oWeaponSelection.nRollover = 1
oWeaponSelection.nHelpID = IDS_HELP_MP_BR_SELECTION
oWeaponSelection.itemHeight = 20
oWeaponSelection.max_displayed = 8
oWeaponSelection.offsetLabel = 0,-15
oWeaponSelection.arrowHeight = 15
oWeaponSelection.location = 375,Drop_Y,nZ_LISTBOX
oWeaponSelection.list_size = 4
// oWeaponSelection.label = localize$(IDS_ML_WP_LIST)
// oWeaponSelection.offsetLabel = -74, 3
oWeaponSelection.itemWidth = 301
oWeaponSelection.max_displayed = 4
oWeaponSelection.list_item[0] = localize$(IDS_ML_WP_LISTBEAM)
oWeaponSelection.list_item[1] = localize$(IDS_ML_WP_LISTMISSILE)
oWeaponSelection.list_item[2] = localize$(IDS_ML_WP_LISTBALLISTIC)
oWeaponSelection.list_item[3] = localize$(IDS_MP_BR_COMPONENT)
initialize(oWeaponSelection)
//Weapons list
MAX_MCCB_ITEMS = 35
//callback($$ML_CallbackHandler$$, MLDataSetupBeamWeapons, ids[], slots[], slot_size[], ton[], damage[], range[], heat[], weapon_recycle[], inventory_count[], num_weap, 75)
num_weap = LastBeamID - FirstBeamID + 1
for(i=0;i<num_weap;i++)
{
ids[i] = i
}
object oDWeapon = s_mc_listbox
oDWeapon.nRollover = 1
oDWeapon.nHelpID = IDS_HELP_MP_BR_WEAPONS
oDWeapon.location = 375,Drop_Y + 30,nZ_LISTBOX - 20
oDWeapon.itemWidth = 300
oDWeapon.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
oDWeapon.itemHeight_padding = 10
oDWeapon.list_size = num_weap
oDWeapon.NUM_OF_COLUMNS = 2
oDWeapon.column_header_height = 0
oDWeapon.max_displayed = Drop_H - 30 // max number of itemheight's. maz_displayed*itemheight = height of listbox
oDWeapon.uniform_item_height = 0
oDWeapon.column[0].checked = true
oDWeapon.column[0].location.x = Drop_C1_Off
oDWeapon.column[1].location.x = Drop_C2_Off
oDWeapon.column[1].fontcolor = cWhite
initialize (this)
framerate = 0
}
GUI_INIT
{
// Get the original status of the weapons and store them at a safe place
if (BeamFirst)
{
for (i=FirstBeamID; i<=LastBeamID; i++)
{
param_id = ALLOWED_BEAM_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,i)
holder[i] = allowed
}
}
BeamFirst = 0
if (MissFirst)
{
for (i=FirstMissileID; i<=LastMissileID; i++)
{
param_id = ALLOWED_MISSILE_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,i)
holder[i] = allowed
}
}
MissFirst = 0
if (BallFirst)
{
for (i=FirstProjectileID; i<=LastProjectileID; i++)
{
param_id = ALLOWED_PROJECTILE_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,i)
holder[i] = allowed
}
}
BallFirst = 0
if (CompFirst)
{
for (i=FirstGenericSubsystemID; i<=LastGenericSubsystemID; i++)
{
param_id = ALLOWED_GENERIC_SUBSYSTEM_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,i)
holder[i] = allowed
}
}
CompFirst = 0
//Resize List and populate it
oDWeapon.list_size = num_weap
for k = 0; k < oDWeapon.list_size; k++
{
oDWeapon.column[1].list_item[k] = oBuildWeaponNames.weapon_names[ids[k]]
oDWeapon.list_order[k] = k
oDWeapon.column[0].pic_file = WPATH "Checkbox_15x15_3_Build.tga"
oDWeapon.column[0].checkbox_num_of_states = 3
oDWeapon.column[0].fontAlignment = just_left
}
oDWeapon.start_of_list = 0
initialize (oDWeapon)
activate(oDWeapon)
mail(-1, oDWeapon)
//Get the allowed status of the weapons
if(oWeaponSelection.nselected == 0)//Beam
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_BEAM_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,ids[i])
oDWeapon.column[0].o_checkbox[i].check = allowed
}
}
if(oWeaponSelection.nselected == 1)//Miss
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_MISSILE_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,ids[i])
oDWeapon.column[0].o_checkbox[i].check = allowed
}
}
if(oWeaponSelection.nselected == 2)//Ball
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_PROJECTILE_WEAPON_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,ids[i])
oDWeapon.column[0].o_checkbox[i].check = allowed
}
}
if(oWeaponSelection.nselected == 3)//Comp
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_GENERIC_SUBSYSTEM_PARAMETER
allowed = callback($$GetLocalNetworkMissionParamater$$,param_id,ids[i])
oDWeapon.column[0].o_checkbox[i].check = allowed
}
}
}
GUI_MAILBOX
{
switch (sender)
{
case oCancel:
{
for (i=FirstBeamID; i<=LastBeamID; i++)
{
param_id = ALLOWED_BEAM_WEAPON_PARAMETER
allowed = holder[i]
callback($$SetNetworkMissionParamater$$,param_id,i,allowed)
}
for (i=FirstProjectileID; i<=LastProjectileID; i++)
{
param_id = ALLOWED_PROJECTILE_WEAPON_PARAMETER
allowed = holder[i]
callback($$SetNetworkMissionParamater$$,param_id,i,allowed)
}
for (i=FirstMissileID; i<=LastMissileID; i++)
{
param_id = ALLOWED_MISSILE_WEAPON_PARAMETER
allowed = holder[i]
callback($$SetNetworkMissionParamater$$,param_id,i,allowed)
}
for (i=FirstGenericSubsystemID; i<=LastGenericSubsystemID; i++)
{
param_id = ALLOWED_GENERIC_SUBSYSTEM_PARAMETER
allowed = holder[i]
callback($$SetNetworkMissionParamater$$,param_id,i,allowed)
}
script_continue "HostGame1.script"
script_end
}
break
case oReady:
{
for (i=FirstMechID; i<(LastMechID - FirstMechID + 1); i++)
{
param_id = ALLOWED_MECH_PARAMETER
allowed = oDChassis.column[0].o_checkbox[i].check
callback($$SetNetworkMissionParamater$$,param_id,i,allowed)
}
mail(MSG_SETWEAPONSLIST,this)
script_continue "HostGame1.script"
// script_run scriptpath "HostGame1.script", 0x1000
@HostGame1@o_build_restrict.state = 2
initialize(@HostGame1@o_build_restrict)
@HostGame1@o_Restrict.state = 0
initialize(@HostGame1@o_Restrict)
script_end
}
break
case oWeaponSelection:
{
if oWeaponSelection.nselected == 0 //Beam
{
mail(MSG_SETWEAPONSLIST,this)
}
if oWeaponSelection.nselected == 1 //Missile
{
mail(MSG_SETWEAPONSLIST,this)
}
if oWeaponSelection.nselected == 2 //Projectile
{
mail(MSG_SETWEAPONSLIST,this)
}
if oWeaponSelection.nselected == 3 //Components
{
mail(MSG_SETWEAPONSLIST,this)
}
for i = 0; i < oDWeapon.list_size; i++
{
kill oDWeapon.list_button[i]
kill oDWeapon.column[0].o_checkbox[i]
}
if oWeaponSelection.nselected == 0 //Beam
{
num_weap = LastBeamID - FirstWeaponID + 1
for(i = 0; i < num_weap;i++)
{
ids[i] = FirstWeaponID + i
}
num_beam = num_weap
initialize (this)
OldList = 0
}
if oWeaponSelection.nselected == 1 //Missile
{
num_weap = LastMissileID - FirstMissileID + 1
for(i = 0; i < num_weap;i++)
{
ids[i] = FirstMissileID + i
}
num_miss = num_weap
initialize (this)
OldList = 1
}
if oWeaponSelection.nselected == 2 //Projectile
{
num_weap = LastWeaponID - FirstProjectileID + 1
for(i = 0; i < num_weap;i++)
{
ids[i] = FirstProjectileID + i
}
num_ball = num_weap
initialize (this)
OldList = 2
}
if oWeaponSelection.nselected == 3 //Components
{
num_weap = LastGenericSubsystemID - FirstGenericSubsystemID + 1
for(i = 0; i < num_weap;i++)
{
// Bug fix 6495 - This fix is to remove AMS
// from the restriction list.
if (FirstGenericSubsystemID + i > Sub_AMS)
{
// Bug fix 4242 - This fix is to remove light amp
// from the restriction list.
if (FirstGenericSubsystemID + i > Sub_LightAmp)
{
ids[i-2] = FirstGenericSubsystemID + i
}
else
ids[i-1] = FirstGenericSubsystemID + i
}
else
{
ids[i] = FirstGenericSubsystemID + i
}
}
num_weap--
num_weap--
num_comp = num_weap
initialize (this)
OldList = 3
}
}
break
}
switch (getmessage())
{
{
case MSG_SETWEAPONSLIST:
{
if(OldList == 0)
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_BEAM_WEAPON_PARAMETER
allowed = oDWeapon.column[0].o_checkbox[i].check
callback($$SetNetworkMissionParamater$$,param_id,ids[i],allowed)
}
}
if(OldList == 1)
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_MISSILE_WEAPON_PARAMETER
allowed = oDWeapon.column[0].o_checkbox[i].check
callback($$SetNetworkMissionParamater$$,param_id,ids[i],allowed)
}
}
if(OldList == 2)
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_PROJECTILE_WEAPON_PARAMETER
allowed = oDWeapon.column[0].o_checkbox[i].check
callback($$SetNetworkMissionParamater$$,param_id,ids[i],allowed)
}
}
if(OldList == 3)
{
for (i=0; i<num_weap; i++)
{
param_id = ALLOWED_GENERIC_SUBSYSTEM_PARAMETER
allowed = oDWeapon.column[0].o_checkbox[i].check
callback($$SetNetworkMissionParamater$$,param_id,ids[i],allowed)
}
}
}
}
}
}
}
background
{
GUI_CREATE
{
location = 0,0,-3
pane p_background = GPATH "MULTIPlayer.tga"
// pane p_frame = GPATH "frame.tga"
// pane p_pane = GPATH "\\Multiplayer\\infobox.tga"
// alphamode (p_pane) = am_alpha_alphainvalpha
}
GUI_DRAW
{
render P_background, 0,0
// Render p_frame, 0,0
// render p_pane, 33, 490
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,356 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
////////////////////////////////////////////////////////////////
// GUN Status control
// Author: Michael Moore (mdm@microsoft.com)
// Date: July 6th, 2000
//
// Description:
// Prints a status message indicating the current
// state of the GUN connection.
//
// Creator can specify the x and y location of the message,
// as well as the font to use.
//////////////////////////////////////////////////////////////
s_gunstatus
{
GUI_CREATE
{
// member variables
int xpos = 0
int ypos = 0
string statusMess = localize$(IDS_GN_OK)
int xcolor = packcolor (180,180,180,255)
font3d f_font = FPATH localize$(IDS_F_MP_LABEL)
int size = -1
int progress = -1
}
GUI_DRAW
{
//////////////////////////////
// MDM - GUN STATUS DISPLAY //
//////////////////////////////
int gunStatusX = xpos
int gunStatusY = ypos
string statusMess = localize$(IDS_MP_GUNS_UNKNOWN)
// Gray out the game list if we're not yet connected
int gunstatus = callback( $$GetZMStatus$$ , 1 )
// the following messages result from the enum values found
// in the Games_GUN.cpp GUN_STATUS enum.
switch ( gunstatus )
{
case 0:
statusMess = localize$(IDS_MP_SI_DISCONNECTED)
break
case -1:
case 1:
statusMess = localize$(IDS_MP_GUNS_INIT)
break
case -2:
case 2:
statusMess = localize$(IDS_MP_GUNS_INIT_BROWSER)
break
case -4:
case 4:
statusMess = localize$(IDS_MP_GUNS_FIND_SERVER) " '" $$ZoneServerAddress$$ localize$(IDS_MP_GUNS_FIND_SERVER1)
break
case -8:
case 8:
statusMess = localize$(IDS_MP_GUNS_FIND_GAME)
break
case -16:
case 16:
statusMess = localize$(IDS_MP_GUNS_FIND_PLAYER)
break
case -32:
case 32:
statusMess = localize$(IDS_MP_GUNS_CLOSE_CONNECT)
break
case -64:
case 64:
statusMess = localize$(IDS_MP_GUNS_CLOSED)
break
case -128:
case 128:
statusMess = localize$(IDS_MP_GUNS_CONNECTED)
break
case -4095:
default:
statusMess = localize$(IDS_MP_GUNS_UNKNOWN)
break
}
// if ( (gunstatus < 0) && (gunstatus > -4095) )
// {
// statusMess = localize$(IDS_MP_GUNS_ERROR) statusMess
// }
if ( gunstatus < 0 )
{
// error condition -- font is red
xcolor = packcolor( 255, 0, 0, 255 )
}
else
{
if ( gunstatus == 128 )
{
// connected ok -- font is green
xcolor = packcolor( 0, 255, 0, 255 )
}
else
{
// in process of connecting -- font is light yellow
xcolor = packcolor( 200, 200, 0, 255 )
}
}
if (oRollover.oText.szText == null) // prevent gunstatus to show while help is being displayed
{
lprint3d_margins = 0, 0 to 538, 27
print3d_attributes = f_font, packcolor (180,180,180,255), 1,0,1,0,0,0,1
lprint3d_position = gunStatusX, gunStatusY
print3d localize$(IDS_MP_GUNS_STATUS)
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = gunStatusX + getprint3dwidth(localize$(IDS_MP_GUNS_STATUS)) + 10, gunStatusY
if (gunstatus == 128)
{
print3d localize$(IDS_MP_GUN_CONNECTED)
}
else
if (gunstatus > 0 && gunstatus != 64) // mdm - 64 is closed.
{
print3d localize$(IDS_MP_GUN_CONNECTING)
}
else
{
print3d localize$(IDS_GUN_NOT_CONNECTED)
if ( gunstatus < 0 )
{
lprint3d_margins = 0, 0 to 538, 100
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = gunStatusX, gunStatusY+20
print3d localize$(IDS_MP_GUNS_ERROR)
lprint3d_position = gunStatusX + getprint3dwidth(localize$(IDS_MP_GUNS_ERROR)) + 10, gunStatusY+20
print3d statusMess
lprint3d_position = gunStatusX + getprint3dwidth(localize$(IDS_MP_GUNS_ERROR)) + 10, gunStatusY+20+getprint3dheight(localize$(IDS_MP_GUNS_STATUS))
print3d localize$(IDS_MP_GUNS_CHECK_URL)
}
}
}
//////////////////////////////
// MDM - END STATUS DISPLAY //
//////////////////////////////
//////////////////////////
// lastError maintenance
//////////////////////////
////////////////////////////////////////////////////
// Here, we display either:
// (a) The download status if everything is OK
// or
// (b) The last error message from GUN
////////////////////////////////////////////////////
if ( gunStatus >= 0 )
{
// display download status
int gunnetstatus = callback( $$GetZMStatus$$, 2 )
statusMess = localize$(IDS_MP_SI_UNKNOWN)"(" conv$(gunnetstatus) ")."
if ( gunnetstatus == 2 )
{
statusMess = localize$(IDS_MP_SI_DOWNPLAYERS)
}
if ( gunnetstatus == 4 )
{
size = callback($$GetGUNDownloadSize$$)
progress = callback($$GetGUNDownloadProgress$$)
if ( size > 0 && progress >= 0 )
{
statusMess = localize$(IDS_MP_SI_DGAMES) " " conv$(callback($$GetGUNDownloadProgress$$)) "/" conv$(callback($$GetGUNDownloadSize$$))
}
else
{
statusMess = localize$(IDS_MP_SI_DGAMES)
}
}
if ( gunnetstatus == 6 )
{
statusMess = localize$(IDS_MP_SI_DGNP)
}
if ( gunnetstatus != 0 )
{
xcolor = packcolor ( 0, 0, 255, 255 )
lprint3d_margins = 0, 0 to 538, 100
print3d_attributes = f_font, xcolor, 1,0,1,0,0,just_right
print3d_position = location.x, location.y+gunStatusY+(14*3)
print3d statusMess
}
}
}
} // s_gunstatus
s_gamespystatus
{
GUI_CREATE
{
// member variables
int xpos = 0
int ypos = 0
string statusMess = localize$(IDS_GN_OK)
int xcolor = packcolor (180,180,180,255)
font3d f_font = FPATH localize$(IDS_F_MP_LABEL)
}
GUI_DRAW
{
//////////////////////////////
// MDM - GUN STATUS DISPLAY //
//////////////////////////////
int gunStatusX = xpos
int gunStatusY = ypos
string statusMess = localize$(IDS_MP_GUNS_UNKNOWN)
// Gray out the game list if we're not yet connected
int gunstatus = callback( $$GetGameSpyStatus$$ , 1 )
if ( gunstatus != 0 )
{
// the following messages result from the enum values found
// in the Games_GUN.cpp GUN_STATUS enum.
switch ( gunstatus )
{
case 0:
statusMess = localize$(IDS_MP_SI_DISCONNECTED)
break
case -1:
case 1:
statusMess = localize$(IDS_MP_GUNS_INIT)
break
case -2:
case 2:
statusMess = localize$(IDS_MP_GUNS_INIT_BROWSER)
break
case -4:
case 4:
statusMess = localize$(IDS_MP_GUNS_FIND_SERVER) $$GameSpyServerAddress$$ localize$(IDS_MP_GUNS_FIND_SERVER1)
break
case -8:
case 8:
statusMess = localize$(IDS_MP_GUNS_FIND_GAME)
break
case -16:
case 16:
statusMess = localize$(IDS_MP_GUNS_FIND_PLAYER)
break
case -32:
case 32:
statusMess = localize$(IDS_MP_GUNS_CLOSE_CONNECT)
break
case -64:
case 64:
statusMess = localize$(IDS_MP_GUNS_CLOSED)
break
case -128:
case 128:
statusMess = localize$(IDS_MP_GUNS_CONNECTED)
break
case -4095:
default:
statusMess = localize$(IDS_MP_GUNS_UNKNOWN)
break
}
if ( (gunstatus < 0) && (gunstatus > -4095) )
{
statusMess = localize$(IDS_MP_GUNS_ERROR) statusMess
}
}
xcolor = packcolor (180,180,180,255)
lprint3d_margins = 0, 0 to 350, 200
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = gunStatusX, gunStatusY
print3d localize$(IDS_MP_GS_STATUS)
if ( gunstatus < 0 )
{
// error condition -- font is red
xcolor = packcolor( 255, 0, 0, 255 )
}
else
{
if ( gunstatus == 128 )
{
// connected ok -- font is green
xcolor = packcolor( 0, 255, 0, 255 )
}
else
{
// in process of connecting -- font is light yellow
xcolor = packcolor( 200, 200, 0, 255 )
}
}
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = gunStatusX + 125, gunStatusY
print3d statusMess
//////////////////////////////
// MDM - END STATUS DISPLAY //
//////////////////////////////
// display network status
int gunnetstatus = callback( $$GetGameSpyStatus$$, 2 )
statusMess = localize$(IDS_MP_SI_UNKNOWN)"(" conv$(gunnetstatus) ")."
if ( gunnetstatus == 2 )
{
statusMess = localize$(IDS_MP_SI_DOWNPLAYERS)
}
if ( gunnetstatus == 4 )
{
statusMess = localize$(IDS_MP_SI_DGAMES)
}
if ( gunnetstatus == 6 )
{
statusMess = localize$(IDS_MP_SI_DGNP)
}
if ( gunnetstatus != 0 )
{
xcolor = packcolor ( 0, 0, 255, 255 )
lprint3d_margins = 0, 0 to 350, 200
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = gunStatusX+125, gunStatusY+14
print3d statusMess
}
}
} // s_gamespystatus
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,220 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\Shellscripts\\ShellFunctionHeaders.hpp"
#include "Content\\ShellScripts\\NetParams.h"
#include "Content\\GameTypes.h"
#include "Content\\ShellScripts\\listboxes.script"
#include "Content\\ShellScripts\\mc_listboxes.script"
#include "Content\\ShellScripts\\c_pane.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\editbox.script"
main
{
GUI_CREATE
{
location = 0,0,60
// This is to read Jerry's Description
string scenario_text
string scenario_map
string scenario_path
int last_game_type = -1 //added to prevent updating/initializing listbox constantly
int scenaro_text_id = SCENARIO_INFO_PARAMATER
int scenaro_name_id = SCENARIO_NAME_PARAMETER
int MAX_ITEMS = 40
int MAX_MCCB_ITEMS = 1 //MAXIMUM NUMBER OF ITEMS LISTED
int MAX_MCCB_COLUMNS = 1
int valuedcustomer
int game_type = RULE_TYPE_PARAMETER
int map_type = MAP_ID_PARAMETER
int map_path = SCENARIO_PATH_PARAMETER
int weather = WEATHER_PARAMETER
int visibility = VISIBILITY_PARAMETER
int night_parameter = NIGHT_TIME_PARAMETER
int time_limit = GAME_LENGTH_PARAMETER
int frag_limit = KILL_LIMIT_NUMBER_PARAMETER
int num_of_lives = RESPAWN_LIMIT_NUMBER_PARAMETER
int stock_mechs = ONLY_STOCK_MECH_PARAMETER
int mission_review = REPORTSTATS_PARAMETER
int radar = 0
int light_amp = 0
int temp_num
// object o_server = genericbutton
// o_server.location = 636,55,10
// o_server.region = 0,0 to 756-636,75-55
int Map_Name = MAP_NAME_PARAMETER
object o_map_display = s_Pane
o_map_display .location = 525,85,nZ_PANE
o_map_display .nFrames = 1
o_map_display .nCurrFrame = 0
o_map_display .nMode = 0
o_map_display .fVolatile = 0
o_map_display .fRegion = 0
o_map_display .nHelpID = -1
o_map_display .nScaleX = 175
o_map_display .nScaleY = 175
deactivate(o_map_display)
object o_cover_buttons = cover_buttons
o_cover_buttons.location = 478,307,nZ_DROPDOWN+50
o_cover_buttons.region = 0,0 to 740-478, 115
//Scrooling text object
object o_description = s_mc_listbox
o_description.location = 478,307,nZ_DROPDOWN
o_description.itemWidth = 740-478 //MUST BE INITI6ALIZED
o_description.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_description.itemHeight_padding = 4
o_description.list_size = 1
o_description.NUM_OF_COLUMNS = 1
o_description.column_header_height = 0 //MUST BE INITIALIZED
o_description.max_displayed = 115 // max number of itemheight's. maz_displayed*itemheight = height of listbox
o_description.uniform_item_height = 0
o_description.label = localize$(IDS_MP_LOBBY_MAP_DESC_TITLE)
o_description.offsetLabel = 0,-18
o_description.buttonwidth = 16
o_description.first_delay = 10 //time delay value n/60; for the buttons
o_description.second_delay = 1 //time delay value n/60; for the buttons
o_description.column[0].location.x = 3
o_description.column[0].fontcolor = packcolor (200,200,255,255)
o_description.column[0].fontAlignment = just_left
o_description.list_order[0] = 0
o_description.column[0].list_item[0]= " "//$$klds06$$
o_description.arrow_scroll_fix = true
o_description.arrow_scroll_fix_height = 20
o_description.nSelected = 1
int greatest_x
int greatest_y
for int k = 0; k < o_description.list_size; k++
{
}
initialize (o_description)
initialize (this)
framerate = 10
}
GUI_EXECUTE
{
if exists(@netserver@)
{
callback($$GetLocalNetworkMissionParamater$$, Map_Name, scenario_map)
callback($$GetLocalNetworkMissionParamater$$, map_path, scenario_path)
}
else
{
callback($$GetServerNetworkMissionParamater$$, Map_Name, scenario_map)
callback($$GetServerNetworkMissionParamater$$, map_path, scenario_path)
}
int have_map = 1
if (exists(@netclient@))
{
have_map = @HostLobbyMission@o_update_mission_params.have_map
}
if ((have_map) && (!equal$(scenario_map, "")) && (!equal$(scenario_path, "")))
{
o_map_display.szBitmap = scenario_path scenario_map ".tga"
initialize(o_map_display)
activate(o_map_display)
}
else
{
deactivate(o_map_display)
}
if exists(@netserver@)
{
if callback($$GetLocalNetworkMissionParamater$$, scenaro_text_id, scenario_text) == 1
{
int temp_game = callback($$GetLocalNetworkMissionParamater$$, game_type)
if temp_game != last_game_type
{
o_description.column[0].list_item[0] = scenario_text"\n \n \n \n \n"
o_description.start_of_list = 0
initialize(o_description)
last_game_type = temp_game
}
}
else
{
int temp_game = callback($$GetLocalNetworkMissionParamater$$, game_type)
if temp_game != last_game_type
{
callback($$GetLocalNetworkMissionParamater$$, scenaro_name_id)
o_description.column[0].list_item[0] = $$m_iaMissionName$$
o_description.start_of_list = 0
initialize(o_description)
last_game_type = temp_game
}
}
}
else
{
if callback($$GetServerNetworkMissionParamater$$, scenaro_text_id, scenario_text) == 1
{
int temp_game = callback($$GetServerNetworkMissionParamater$$, game_type)
if temp_game != last_game_type
{
o_description.column[0].list_item[0] = scenario_text"\n \n \n \n \n"
o_description.start_of_list = 0
initialize(o_description)
last_game_type = temp_game
}
}
else
{
int temp_game = callback($$GetServerNetworkMissionParamater$$, game_type)
if temp_game != last_game_type
{
callback($$GetServerNetworkMissionParamater$$, scenaro_name_id)
o_description.column[0].list_item[0] = $$m_iaMissionName$$
o_description.start_of_list = 0
initialize(o_description)
last_game_type = temp_game
}
}
}
}
}
genericbutton
{
GUI_CREATE
{
location = 525,281,10
region = 0,0 to 696-525,314-281
}
LBUTTON_UPDATE
{
if mouse.left == BUTTON_CLICKED
{
mail (-1)
}
}
}
cover_buttons
{
GUI_CREATE
{
location = 509,77,300
region = 0,0 to 766-509,155-77
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,705 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\Shellscripts\\ShellFunctionHeaders.hpp"
#define scriptpath "content\\Shellscripts\\Multiplayer\\"
#include "Content\\ShellScripts\\NetParams.h"
#include "Content\\GameTypes.h"
#include "Content\\ShellScripts\\listboxes.script"
#include "Content\\ShellScripts\\mc_listboxes.script"
#define MAP_PATH "Content\\ShellScripts\\Graphics\\Multiplayer\\LobbyMaps\\"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\WeaponNames.h"
main
{
GUI_CREATE
{
location.z = 15
int hosting = exists(@netserver@)
int MAX_ITEMS = 40
int MAX_MCCB_ITEMS = 200 //MAXIMUM NUMBER OF ITEMS LISTED
int MAX_MCCB_COLUMNS = 2
int i = 0
int k = 0
// pane temp = GPATH "multiplayer\\lobbyhost.jpg"
// alphamode (temp) = am_alpha_oneone
object o_server_name = s_print_text
o_server_name.location = 484,83,20
o_server_name.text_font = FPATH localize$(IDS_F_MP_LABEL)
o_server_name.text_color = packcolor(255,255,255,255)
o_server_name.text = localize$(IDS_MP_HLS_SERVERNAME)
object o_server_name_value = s_print_text
o_server_name_value.location = 494,103,20
o_server_name_value.text_font = FPATH localize$(IDS_F_MP_LABEL)
o_server_name_value.limit_the_width = 750 - 494
o_server_name_value.text_color = packcolor(255,255,255,255)
object o_server_IP_value = s_print_text
o_server_IP_value.location = 494,126,20
o_server_IP_value.text_font = FPATH localize$(IDS_F_MP_LABEL)
o_server_IP_value.text_color = packcolor(255,255,255,255)
//---------------------------------------------------
object o_player = s_mc_listbox
o_player.location = 484,170,10
o_player.boxFont3d = FPATH localize$(IDS_F_CAMPAIGN) //MUST BE INITIALIZED
// o_player.boxFont3d = "arial.ttf"
o_player.itemWidth = 733-484 //MUST BE INITIALIZED
o_player.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_player.itemHeight_padding = 4//10
o_player.list_size = 20
o_player.NUM_OF_COLUMNS = 2
o_player.column_header_height = 20 //MUST BE INITIALIZED
o_player.max_displayed = 127//30 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED
o_player.uniform_item_height = 0
o_player.SelectedHighlightColor = packcolor(0, 0, 0, 0)
o_player.borderColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
o_player.label = localize$(IDS_MP_HLS_SERVERSET) //CAN BE INITIALIZED
o_player.labelFont3d = FPATH localize$(IDS_F_MP_LABEL) //CAN BE INITIALIZED
o_player.offsetLabel = 0,-18 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25
o_player.buttonwidth = 16 //CAN BE INITIALIZED
o_player.first_delay = 10 //time delay value n/60; for the buttons
o_player.second_delay = 1 //time delay value n/60; for the buttons
o_player.column[0].location.x = 5
o_player.column[1].location.x = 130
o_player.column[0].fontcolor = packcolor (255,255,255,255)
o_player.column[1].fontcolor = packcolor (255,255,255,255)
o_player.column[0].fontAlignment = just_left
o_player.column[1].fontAlignment = just_center
for int setup_mc = 0;setup_mc < MAX_MCCB_ITEMS; setup_mc++
{
o_player.list_order[setup_mc] = setup_mc
}
int parameter = TEAM_PARAMETER
int team = 0
int subparam = TEAM_MAX_PLAYERS
int value
o_player.column[0].list_item[0] = localize$(IDS_MP_HLS_MAXPLAYERS)
o_player.column[0].list_item[1] = localize$(IDS_MP_HLS_MOTD)
o_player.column[0].list_item[2] = localize$(IDS_MP_HLS_REPORTSTATS)
o_player.column[0].list_item[3] = localize$(IDS_MP_HLS_RECYCLE)
o_player.column[0].list_item[4] = localize$(IDS_MP_HLS_JOININP)
o_player.column[0].list_item[5] = localize$(IDS_MP_HLS_JOININPCUT)
o_player.column[0].list_item[6] = localize$(IDS_MP_HLS_JOININPT)
o_player.column[0].list_item[7] = localize$(IDS_MP_HLS_DECALX)
o_player.column[0].list_item[8] = localize$(IDS_MP_HG_DEDICATED)
o_player.column[0].list_item[9] = localize$(IDS_MP_HG_MAP_CYCLE)
o_player.column[0].list_item[10] = localize$(IDS_MP_HG_RESPAWN)
o_player.column[0].list_item[11] = localize$(IDS_MP_HLS_UNLIMAMMO)
o_player.column[0].list_item[12] = localize$(IDS_MP_HG_HEAT_MGT)
o_player.column[0].list_item[13] = localize$(IDS_MP_HG_FRIENDLY)
o_player.column[0].list_item[14] = localize$(IDS_MP_HG_SPLASH)
o_player.column[0].list_item[15] = localize$(IDS_MP_HLS_DEADTALK)
o_player.column[0].list_item[16] = localize$(IDS_MP_HLS_DEADSEE)
o_player.column[0].list_item[17] = localize$(IDS_MP_HLS_FORCEFIRST)
o_player.column[0].list_item[18] = localize$(IDS_MP_HLS_MIN_TONNAGE)
o_player.column[0].list_item[19] = localize$(IDS_MP_HLS_MAX_TONNAGE)
int greatest_x
int greatest_y
for k = 0; k < o_player.list_size; k++
{
// o_player.column[0].list_icon[k] = "assets\\graphics\\listpic" conv$(k) ".jpg",1,volatile
// alphamode(o_player.column[0].list_icon[k]) = am_alpha_alphainvalpha
if exists(o_player.column[0].list_icon[k])
{
if getwidth(o_player.column[0].list_icon[k]) > greatest_x
greatest_x = getwidth(o_player.column[0].list_icon[k])
if getheight(o_player.column[0].list_icon[k]) > greatest_y
greatest_y = getheight(o_player.column[0].list_icon[k])
}
}
if greatest_x > 0 && greatest_y > 0
bitmap_create black = greatest_x,greatest_y //comment out if you don't have any images
// if you load bitmaps into the arrows and thumslider, the listbox will atuomatically take the width and height of the arrows and use all the images automatically
// o_player.o_uparrow.p_arrow = "assets\\graphics\\commoncontrols\\DropList_arrowup.tga"
// o_player.o_downarrow.p_arrow = "assets\\graphics\\commoncontrols\\DropList_arrowdownb.tga"
// o_player.o_thumbslider.p_thumbslider = "assets\\graphics\\commoncontrols\\thumbslider.tga"
initialize (o_player)
o_player.column[0].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_player.column[1].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_player.column[0].o_header.s_text = localize$(IDS_MP_HLS_SETTING)
o_player.column[1].o_header.s_text = localize$(IDS_MP_HLS_VALUE)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------
object o_restriction = s_mc_listbox
o_restriction.location = 484,323,10
o_restriction.boxFont3d = FPATH localize$(IDS_F_CAMPAIGN) //MUST BE INITIALIZED
o_restriction.itemWidth = 733-484 //MUST BE INITIALIZED
o_restriction.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_restriction.itemHeight_padding = 4//10
o_restriction.NUM_OF_COLUMNS = 1
o_restriction.column_header_height = 20 //MUST BE INITIALIZED
o_restriction.max_displayed = 105//30 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED
o_restriction.uniform_item_height = 0
o_restriction.SelectedHighlightColor = packcolor(0, 0, 0, 0)
o_restriction.borderColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
o_restriction.label = localize$(IDS_MP_HLS_RESTRICTIONS) //CAN BE INITIALIZED
o_restriction.labelFont3d = FPATH localize$(IDS_F_MP_LABEL) //CAN BE INITIALIZED
o_restriction.offsetLabel = 0,-18 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25
o_restriction.buttonwidth = 16 //CAN BE INITIALIZED
o_restriction.first_delay = 10 //time delay value n/60; for the buttons
o_restriction.second_delay = 1 //time delay value n/60; for the buttons
o_restriction.column[0].location.x = 5
o_restriction.column[0].fontcolor = packcolor (255,255,255,255)
o_restriction.column[0].fontAlignment = just_left
for setup_mc = 0;setup_mc < MAX_MCCB_ITEMS; setup_mc++
{
o_restriction.list_order[setup_mc] = setup_mc
}
int restriction_size = 0
//set value for mechs
string szChassis[LastMechID - FirstMechID + 1]
for (i = 0; i <= LastMechID - FirstMechID; i++)
{
szChassis[i] = localize$(DNL_ARCTICWOLF + i)
}
object o_build_weapon_names = build_weapon_names
////////////////////////////////////////////////////////////////////////////////////////////////////////////
object o_cover_list = genericbutton
o_cover_list.location = 484,193,15
o_cover_list.region = 0,0 to 733-484,230
framerate = 5
Font3d gFont3d = FPATH localize$(IDS_F_MP_LABEL)
int got_restriction = false
}
GUI_DRAW
{
if (o_restriction.list_size == 0)
{
print3d_attributes = gFont3d,0xffffffff,1,0,1,1,0,just_left
print3d_margins = 550,376 to 800, 450
print3d_position = 550,376
print3d localize$(IDS_MP_HLS_NO_RESTRICTIONS)
}
}
GUI_EXECUTE
{
if (!got_restriction)
{
int param_num = 0
int param_id = ALLOWED_MECH_PARAMETER
for (k = 0; k < (LastMechID - FirstMechID + 1); k++)
{
param_num = k + FirstMechID
if hosting
value = callback($$GetLocalNetworkMissionParamater$$,param_id,param_num)
else
value = callback($$GetServerNetworkMissionParamater$$,param_id,param_num)
if value == 0
{
o_restriction.column[0].list_item[restriction_size] = szChassis[k]
restriction_size++
}
}
param_id = ALLOWED_BEAM_WEAPON_PARAMETER
for (k = 0; k < (LastBeamID - FirstBeamID + 1); k++)
{
param_num = k + FirstBeamID
if hosting
value = callback($$GetLocalNetworkMissionParamater$$,param_id,param_num)
else
value = callback($$GetServerNetworkMissionParamater$$,param_id,param_num)
if value == 0
{
o_restriction.column[0].list_item[restriction_size] = o_build_weapon_names.weapon_names[param_num]
restriction_size++
}
}
param_id = ALLOWED_MISSILE_WEAPON_PARAMETER
for (k = 0; k < (LastMissileID - FirstMissileID + 1); k++)
{
param_num = k + FirstMissileID
if hosting
value = callback($$GetLocalNetworkMissionParamater$$,param_id,param_num)
else
value = callback($$GetServerNetworkMissionParamater$$,param_id,param_num)
if value == 0
{
o_restriction.column[0].list_item[restriction_size] = o_build_weapon_names.weapon_names[param_num]
restriction_size++
}
}
param_id = ALLOWED_PROJECTILE_WEAPON_PARAMETER
for (k = 0; k < (LastProjectileID - FirstProjectileID + 1); k++)
{
param_num = k + FirstProjectileID
if hosting
value = callback($$GetLocalNetworkMissionParamater$$,param_id,param_num)
else
value = callback($$GetServerNetworkMissionParamater$$,param_id,param_num)
if value == 0
{
o_restriction.column[0].list_item[restriction_size] = o_build_weapon_names.weapon_names[param_num]
restriction_size++
}
}
param_id = ALLOWED_GENERIC_SUBSYSTEM_PARAMETER
for (k = 0; k < (LastGenericSubsystemID - FirstGenericSubsystemID + 1); k++)
{
param_num = k + FirstGenericSubsystemID
if hosting
value = callback($$GetLocalNetworkMissionParamater$$,param_id,param_num)
else
value = callback($$GetServerNetworkMissionParamater$$,param_id,param_num)
if value == 0
{
o_restriction.column[0].list_item[restriction_size] = o_build_weapon_names.weapon_names[param_num]
restriction_size++
}
}
o_restriction.list_size = restriction_size
initialize (o_restriction)
o_restriction.column[0].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_restriction.column[0].o_header.s_text = localize$(IDS_MP_HLS_RESTRICTED)
got_restriction = true
}
// display server name
parameter = SERVER_NAME_PARAMETER
if (hosting)
{
callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
callback($$GetServerNetworkMissionParamater$$, parameter)
}
o_server_name_value.text = $$m_serverName$$
// display server ip
parameter = SERVER_IP_PARAMETER
if (hosting)
{
callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
callback($$GetServerNetworkMissionParamater$$, parameter)
}
o_server_IP_value.text = $$m_serverIP$$
o_player.column[0].list_item[0] = localize$(IDS_MP_HLS_MAXPLAYERS)
parameter = MAX_PLAYERS_PARAMETER
if hosting
{
o_player.column[1].list_item[0] = conv$(callback($$GetLocalNetworkMissionParamater$$, parameter))
}
else
{
o_player.column[1].list_item[0] = conv$(callback($$GetServerNetworkMissionParamater$$, parameter))
}
// display MOTD
o_player.column[0].list_item[1] = localize$(IDS_MP_HLS_MOTD)
o_player.column[1].list_item[1] = localize$(IDS_GN_YES_LC)
// o_player.column[1].list_item[1] = conv$($$kldi05$$)
// report stats
o_player.column[0].list_item[2] = localize$(IDS_MP_HLS_REPORTSTATS)
parameter = REPORTSTATS_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[2] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[2] = localize$(IDS_GN_NO_LC)
// recycle delay
o_player.column[0].list_item[3] = localize$(IDS_MP_HLS_RECYCLE)
parameter = RECYCLE_DELAY_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[3] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[3] = localize$(IDS_GN_NO_LC)
o_player.column[0].list_item[4] = localize$(IDS_MP_HLS_JOININP)
if hosting
{
parameter = JOIN_IN_PROGRESS_PARAMETER
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
parameter = JOIN_IN_PROGRESS_PARAMETER
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
o_player.column[0].list_item[5] = localize$(IDS_MP_HLS_JOININPCUT)
o_player.column[0].list_item[6] = localize$(IDS_MP_HLS_JOININPT)
if value == 1
{
o_player.column[1].list_item[4] = localize$(IDS_GN_YES_LC)
if hosting
{
parameter = JOIN_IN_PROGRESS_CUTOFF_PARAMETER
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
parameter = JOIN_IN_PROGRESS_CUTOFF_PARAMETER
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
{
o_player.column[1].list_item[5] = localize$(IDS_GN_YES_LC)
// Join In Progress
o_player.column[0].list_item[6] = localize$(IDS_MP_HLS_JOININPT)
if hosting
{
parameter = JOIN_IN_PROGRESS_CUTOFF_TIME_PARAMETER
o_player.column[1].list_item[6] = conv$(callback($$GetLocalNetworkMissionParamater$$, parameter)) " "localize$(IDS_MP_HG_MIN)
}
else
{
parameter = JOIN_IN_PROGRESS_CUTOFF_TIME_PARAMETER
o_player.column[1].list_item[6] = conv$(callback($$GetServerNetworkMissionParamater$$, parameter)) " "localize$(IDS_MP_HG_MIN)
}
}
else
{
o_player.column[1].list_item[5] = localize$(IDS_GN_NO_LC)
o_player.column[1].list_item[6] = localize$(IDS_IA_UNLIMITED)
}
}
else
{
o_player.column[1].list_item[4] = localize$(IDS_GN_NO_LC)
o_player.column[1].list_item[5] = localize$(IDS_GN_NO_LC)
o_player.column[1].list_item[6] = "0"" "localize$(IDS_MP_HG_MIN)
}
// Allow Decal Transfer
o_player.column[0].list_item[7] = localize$(IDS_MP_HLS_DECALX)
parameter = ALLOW_DECAL_TRANSFER_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[7] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[7] = localize$(IDS_GN_NO_LC)
// Dedicated Server
o_player.column[0].list_item[8] = localize$(IDS_MP_HG_DEDICATED)
parameter = DEDICATED_SERVER_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[8] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[8] = localize$(IDS_GN_NO_LC)
// Use Map Cycle.txt
o_player.column[0].list_item[9] = localize$(IDS_MP_HG_MAP_CYCLE)
parameter = USE_MAP_CYCLE_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[9] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[9] = localize$(IDS_GN_NO_LC)
// Respawn Limit
o_player.column[0].list_item[10] = localize$(IDS_MP_HG_RESPAWN)
parameter = FORCE_RESPAWN_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[10] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[10] = localize$(IDS_GN_NO_LC)
// Unlimited Ammo
o_player.column[0].list_item[11] = localize$(IDS_MP_HLS_UNLIMAMMO)
parameter = UNLIMITED_AMMO_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[11] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[11] = localize$(IDS_GN_NO_LC)
// Heat
o_player.column[0].list_item[12] = localize$(IDS_MP_HG_HEAT_MGT)
parameter = HEAT_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[12] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[12] = localize$(IDS_GN_NO_LC)
// Friendly Fire
o_player.column[0].list_item[13] = localize$(IDS_MP_HG_FRIENDLY)
parameter = FRIENDLY_FIRE_PERCENTGE_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 100
o_player.column[1].list_item[13] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[13] = localize$(IDS_GN_NO_LC)
// Splash Damage
o_player.column[0].list_item[14] = localize$(IDS_MP_HG_SPLASH)
parameter = SPLASH_ON_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[14] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[14] = localize$(IDS_GN_NO_LC)
// Allow Dead Chat
o_player.column[0].list_item[15] = localize$(IDS_MP_HLS_DEADTALK)
parameter = ALLOW_DEAD_CHAT_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 1
o_player.column[1].list_item[15] = localize$(IDS_GN_NO_LC)
else
o_player.column[1].list_item[15] = localize$(IDS_GN_YES_LC)
// Dead Mech can't see
o_player.column[0].list_item[16] = localize$(IDS_MP_HLS_DEADSEE)
parameter = DEAD_MECH_CANT_SEE_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
if value == 0
o_player.column[1].list_item[16] = localize$(IDS_GN_NO_LC)
else
o_player.column[1].list_item[16] = localize$(IDS_GN_YES_LC)
// Allow 3rd person
o_player.column[0].list_item[17] = localize$(IDS_MP_HLS_FORCEFIRST)
parameter = ALLOW_3RD_PERSON_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
value = 1 - value
if value == 1
o_player.column[1].list_item[17] = localize$(IDS_GN_YES_LC)
else
o_player.column[1].list_item[17] = localize$(IDS_GN_NO_LC)
// minimum tonnage
o_player.column[0].list_item[18] = localize$(IDS_MP_HLS_MIN_TONNAGE)
parameter = MINIMUM_TONNAGE_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
o_player.column[1].list_item[18] = conv$(value)
// maximum tonnage
o_player.column[0].list_item[19] = localize$(IDS_MP_HLS_MAX_TONNAGE)
parameter = MAXIMUM_TONNAGE_PARAMETER
if hosting
{
value = callback($$GetLocalNetworkMissionParamater$$, parameter)
}
else
{
value = callback($$GetServerNetworkMissionParamater$$, parameter)
}
o_player.column[1].list_item[19] = conv$(value)
}
}
genericbutton
{
GUI_CREATE
{
location = 525,281,10
region = 0,0 to 696-525,314-281
}
LBUTTON_UPDATE
{
if mouse.left == BUTTON_CLICKED
{
mail (-1)
}
}
}
s_print_text
{
GUI_CREATE
{
string text
font3d text_font
int text_color
int limit_the_width = -1
int id
}
GUI_DRAW
{
print3d_attributes = text_font,Text_Color,1,0,1,0,0,0,1
lprint3d_position = 0, 0
if limit_the_width == -1
lprint3d_margins = 0,0 to getprint3dwidth(text)+2,getprint3dheight(text)+2
else
lprint3d_margins = 0,0 to limit_the_width,getprint3dheight(text)+2
if length$(text) > 0
{
print3d text
}
}
}
@@ -0,0 +1,784 @@
#include "Content\\ShellScripts\\stddefs.h"
#define SCRIPTPATH "content\\Shellscripts\\Multiplayer\\"
#include SCRIPTPATH "multicolumnlist.script"
#include SCRIPTPATH "versionstatus.script"
#include SCRIPTPATH "gunstatus.script"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "content\\Shellscripts\\mc_listboxes.script"
#include "Content\\ShellScripts\\common_shell.script"
#include "Content\\ShellScripts\\c_text.script"
#include "Content\\ShellScripts\\c_rollover.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
string DetailsGameID = ""
int GameListActive = 0
int InitialUpdateCalled = 0
int locked_val = FALSE
int password_val = FALSE
// callback($$kldc04$$) // fill the registered variables
$$ServerIPAddress$$ = $$ZoneServerAddress$$
if ( callback ($$CreateBrowsers$$) == -1 )
{
script_run scriptpath "NoBrowsers.script", 0x1000
script_run scriptpath "Multiplayerconsole.script", 0x1000
script_end
}
// mdm - start the ping service
callback( $$StartPingServer$$ )
callback( $$StartPingClient$$ )
object oRollover = s_HelpRegion
oRollover.nFontID = IDS_F_ROLLOVER_INFO
oRollover.cTextColor= 0xFFff7200
oRollover.location = 31,516,255
oRollover.nWidth = 538
oRollover.nHeight = 28
initialize(oRollover)
activate(oRollover)
// object o_interlace = interlace
// o_interlace.location = 0, 0, 10
// o_interlace.lace_color = packcolor (100, 150, 255, 175)
object o_frame = frame
o_frame.type = 1
o_frame.location = 0, 0, 100
o_frame.screen_name = LOCALIZE$(IDS_MP_LOG_BROWSER)
initialize(o_frame)
object o_mouselines = mouselines
o_mouselines.location = 0, 0, o_frame.location.z - 1
object o_background = background
pane background = GPATH "MULTIPlayer.tga"
font3d screenfont = FPATH localize$(IDS_F_MP_LABEL)
int MAX_MC_ITEMS_DISPLAYED = 30 //MAXIMUM NUMBER OF ITEMS LISTED
int MAX_MC_COLUMNS = 7
int updating = FALSE // USED TO KNOW IF LIST IS BEING UPDATED CURRENTLY
font3d gFont3d= FPATH localize$(IDS_F_MP_LABEL)
object o_versionstatus = s_versionstatus
o_versionstatus.location = 330, 20, 1001
o_versionstatus.region = 0,0 to 400,13
o_versionstatus.xRefPos = 0
o_versionstatus.yRefPos = 0
o_versionstatus.f_font = FPATH localize$(IDS_F_MP_LABEL)
// mdm - create gun status control
if ( $$BrowseGUN$$ == 1 )
{
object o_gunstatus = s_gunstatus
o_gunstatus.location = 31, 515, 1001 //31, 544, 1001
o_gunstatus.region = 0,0 to 538,650
o_gunstatus.xpos = 0
o_gunstatus.ypos = 0
o_gunstatus.f_font = FPATH localize$(IDS_F_MP_LABEL)
}
// mdm - NOTE: We assume both GUNStatus and GameSpy Status will not
// be on at the same time. This is necessary to avoid overwriting help text.
// mlyons - create gamespy status control
// mlyons - disable gamespy status
//if ( $$BrowseGUN$$ != 1 && $$BrowseGameSpy$$ == 1 )
//{
// object o_gamespystatus = s_gamespystatus
// o_gamespystatus.location = 32, 544, 1001
// o_gamespystatus.region = 0,0 to 600,650
// o_gamespystatus.xpos = 0
// o_gamespystatus.ypos = 0
// o_gamespystatus.f_font = "arial.ttf"
//}
int button_width = 230
// create & initialize the buttons
int i
int num_of_buttons = 9
object mbutton[num_of_buttons]
for(i = 0; i < num_of_buttons; i++)
{
mbutton[i] = s_multistatepane
mbutton[i].total_states = 4
mbutton[i].textsize = 1
mbutton[i].nRollover = 1
mbutton[i].gFont3d = FPATH localize$(IDS_F_MP_BUTTON)
mbutton[i].id = i
}
// ADD SERVER
mbutton[0].text = localize$(IDS_MP_LOG_ADD_SERVER)
mbutton[0].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[0].location = 38, 420, 1
mbutton[0].nHelpID = IDS_HELP_MP_CONNECT_ADD // mdm - change this back if you check in
// FILTER LIST
mbutton[1].text = localize$(IDS_MP_LOG_FILTER_LIST)
mbutton[1].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[1].location = (getresx() / 2) - (button_width / 2), 420, 1
mbutton[1].nHelpID = IDS_HELP_MP_CONNECT_FILTER
// SERVER INFO
mbutton[2].text = localize$(IDS_MP_LOG_SERVERINFO)
mbutton[2].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[2].location = (getresx() - 38) - 230, 420, 1
mbutton[2].nHelpID = IDS_HELP_MP_CONNECT_SERVER_INFO
// UPDATE LIST
mbutton[3].text = localize$(IDS_MP_LOG_UPDATE_LIST)
mbutton[3].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[3].location = 38, 450, 1
mbutton[3].nHelpID = IDS_HELP_MP_CONNECT_UPDATE
// REFRESH LIST
mbutton[4].text = localize$(IDS_MP_LOG_REFRESH_LIST)
mbutton[4].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[4].location = (getresx() / 2) - (button_width / 2), 450, 1
mbutton[4].nHelpID = IDS_HELP_MP_CONNECT_REFRESH
// OPTIONS
mbutton[5].text = localize$(IDS_GN_OPTIONS)
mbutton[5].file = WPATH "button_reg_230x27m_4state.tga"
mbutton[5].location = (getresx() - 38) - 230, 450, 1
mbutton[5].nHelpID = IDS_HELP_MP_CONNECT_OPTIONS
// BACK
mbutton[6].text = localize$(IDS_MP_LOG_BACK)
mbutton[6].file = WPATH "button_reg_196x27m_4state.tga"
mbutton[6].location = 580, 510, o_frame.location.z + 1
mbutton[6].nHelpID = IDS_HELP_MP_CONNECT_BACK
// JOIN GAME
mbutton[7].text = localize$(IDS_MP_LOG_JOIN)
mbutton[7].file = WPATH "button_main_196x41m_4state.tga"
mbutton[7].location = 580, 540, o_frame.location.z + 1
mbutton[7].nHelpID = IDS_HELP_MP_CONNECT_JOIN
if $$NumberofGames$$ < 1
{
mbutton[7].state = 3
}
// SORT VERSION
mbutton[8].text = localize$(IDS_MP_VERSION_SORT)
mbutton[8].file = WPATH "button_reg_180x23m_4state.tga"
mbutton[8].location = 330, 35, 1
mbutton[8].nHelpID = IDS_HELP_MP_CONNECT_VERSION_SORT
for(i = 0; i < num_of_buttons; i++)
{
initialize(mbutton[i])
}
//Create our STANDARD listbox///////////////////////////////////////////////////////////////////////////////////////////////////////////
object o_list_of_servers = s_mc_listbox2
o_list_of_servers.location = 40,65,1
o_list_of_servers.boxFont3d = FPATH localize$(IDS_F_MP_LABEL) //MUST BE INITIALIZED
o_list_of_servers.itemWidth = 702 //MUST BE INITIALIZED
o_list_of_servers.itemHeight = 20 //16 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_list_of_servers.itemHeight_padding = 4//10
// o_list_of_servers.list_size = 4
// $$NumberOfGames$$ = 4
o_list_of_servers.NUM_OF_COLUMNS = 7
o_list_of_servers.column_header_height = 28 //MUST BE INITIALIZED
o_list_of_servers.max_displayed = 16 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED
o_list_of_servers.uniform_item_height = 16 //1
o_list_of_servers.column_header_height = 20
o_list_of_servers.arrowheight = 20
o_list_of_servers.label = "" //CAN BE INITIALIZED
o_list_of_servers.labelFont3d = FPATH localize$(IDS_F_MP_LABEL) //CAN BE INITIALIZED
o_list_of_servers.offsetLabel = 0,-18 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25
o_list_of_servers.buttonwidth = 16 //CAN BE INITIALIZED
o_list_of_servers.first_delay = 10 //time delay value n/60; for the buttons
o_list_of_servers.second_delay = 1 //time delay value n/60; for the buttons
o_list_of_servers.column[0].location.x = 0
o_list_of_servers.column[1].location.x = 20
o_list_of_servers.column[2].location.x = 210
o_list_of_servers.column[3].location.x = 280
o_list_of_servers.column[4].location.x = 432
o_list_of_servers.column[5].location.x = 555
o_list_of_servers.column[6].location.x = 620
o_list_of_servers.column[0].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[1].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[2].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[3].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[4].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[5].fontcolor = packcolor (200,200,255,255)
o_list_of_servers.column[6].fontcolor = packcolor (200,200,255,0)
// o_list_of_servers.column[0].icondisplays = true
// o_list_of_servers.column[2].icondisplays = true
// o_list_of_servers.column[1].numeric = true
// o_list_of_servers.column[3].numeric = true
o_list_of_servers.column[0].fontAlignment = just_left
o_list_of_servers.column[1].fontAlignment = just_left
o_list_of_servers.column[2].fontAlignment = just_center
o_list_of_servers.column[3].fontAlignment = just_center
o_list_of_servers.column[4].fontAlignment = just_center
o_list_of_servers.column[5].fontAlignment = just_center
o_list_of_servers.column[6].fontAlignment = just_center
// for int kl = 0; kl < MAX_MC_ITEMS_DISPLAYED; kl++
// {
// o_list_of_servers.list_order[kl] = kl
// }
o_list_of_servers.p_connection_icon[0] = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\zone icon.tga",1
o_list_of_servers.p_connection_icon[1] = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\LAN TCP icon.tga",1
o_list_of_servers.p_connection_icon[2] = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\direct IP icon.tga",1
o_list_of_servers.p_connection_icon[3] = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\LAN IPX icon.tga",1
o_list_of_servers.p_connection_icon[4] = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\gamespy icon.tga",1
o_list_of_servers.p_dedicated_icon = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\Dedicated Server icon.tga",1
o_list_of_servers.p_statstracking_icon = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\Stats Tracking icon.tga",1
o_list_of_servers.p_pureserver_icon = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\Pure Server icon.tga",1
o_list_of_servers.p_locked_icon = "Content\\ShellScripts\\Graphics\\Multiplayer\\ServerBrowserIcons\\Locked Game icon.tga",1
int greatest_x
int greatest_y
// for int k = 0; k < o_list_of_servers.list_size; k++
// {
// o_list_of_servers.column[0].list_icon[k] = "assets\\graphics\\listpic" conv$(k) ".jpg",1,volatile
// alphamode(o_list_of_servers.column[0].list_icon[k]) = am_alpha_alphainvalpha
// o_list_of_servers.column[1].list_icon[k] = "assets\\graphics\\listpic" conv$(k) ".jpg",1,volatile
// alphamode(o_list_of_servers.column[1].list_icon[k]) = am_alpha_alphainvalpha
// o_list_of_servers.column[2].list_icon[k] = "assets\\graphics\\listpic" conv$(k) ".jpg",1,volatile
// alphamode(o_list_of_servers.column[2].list_icon[k]) = am_alpha_alphainvalpha
// o_list_of_servers.column[3].list_icon[k] = "assets\\graphics\\listpic" conv$(k) ".jpg",1,volatile
// alphamode(o_list_of_servers.column[3].list_icon[k]) = am_alpha_alphainvalpha
// if exists(o_list_of_servers.column[0].list_icon[k])
// {
// if getwidth(o_list_of_servers.column[0].list_icon[k]) > greatest_x
// greatest_x = getwidth(o_list_of_servers.column[0].list_icon[k])
// if getheight(o_list_of_servers.column[0].list_icon[k]) > greatest_y
// greatest_y = getheight(o_list_of_servers.column[0].list_icon[k])
// }
// }
if greatest_x > 0 && greatest_y > 0
bitmap_create black = greatest_x,greatest_y //comment out if you don't have any images
// if you load bitmaps into the arrows and thumslider, the listbox will atuomatically take the width and height of the arrows and use all the images automatically
// o_list_of_servers.o_uparrow.p_arrow = "assets\\graphics\\commoncontrols\\DropList_arrowup.tga"
// o_list_of_servers.o_downarrow.p_arrow = "assets\\graphics\\commoncontrols\\DropList_arrowdownb.tga"
// o_list_of_servers.o_thumbslider.p_thumbslider = "assets\\graphics\\commoncontrols\\thumbslider.tga"
initialize (o_list_of_servers)
o_list_of_servers.column[0].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[1].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[2].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[3].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[4].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[5].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[6].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_list_of_servers.column[0].o_header.s_text = ""
o_list_of_servers.column[1].o_header.s_text = localize$(IDS_MP_HG_SERVER)
o_list_of_servers.column[2].o_header.s_text = localize$(IDS_MP_LOG_PING)
o_list_of_servers.column[3].o_header.s_text = localize$(IDS_MP_LOG_GAMETYPE)
o_list_of_servers.column[4].o_header.s_text = localize$(IDS_MP_LOG_MAP)
o_list_of_servers.column[5].o_header.s_text = localize$(IDS_MP_LOG_PLAYERNUM)
o_list_of_servers.column[6].o_header.s_text = localize$(IDS_MP_LOG_STATUS)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
pane p_pane = GPATH "\\Multiplayer\\infobox.tga"
alphamode (p_pane) = am_alpha_alphainvalpha
object o_version_error
object o_pid_error
}
GUI_EXECUTE
{
callback ($$UpdateGUNGameList$$)
if ( InitialUpdateCalled == 0 )
{
if ( callback( $$GetTotalGameCount$$ ) <= 0 )
{
// kick off an update since list is empty
if ( GameListActive == 0)
{
callback($$UpdateGameList$$)
mbutton[3].text = localize$(IDS_MP_LOG_CANCEL_UPDATE)
mbutton[4].state = 3 // disables button
GameListActive = 1
}
}
else
{
// kick off a refresh only, so they don't see dead games in the list
if ( GameListActive == 0)
{
callback($$RefreshGameList$$)
mbutton[4].text = localize$(IDS_MP_LOG_CANCEL_UPDATE)
mbutton[3].state = 3
GameListActive = 1
}
}
InitialUpdateCalled = 1
}
o_list_of_servers.list_size = $$NumberOfGames$$
if ( o_list_of_servers.list_size > 0 )
{
mbutton[2].state = 0
mbutton[7].state = 0
int sel = callback( $$GetSelection$$ )
if ( sel >= 0 )
{
o_list_of_servers.nSelected = sel
callback( $$Select$$, sel )
}
else
{
o_list_of_servers.nSelected = 0;
callback( $$Select$$, 0 )
}
if ( callback ( $$GetGameData$$, o_list_of_servers.nSelected ) == 1 )
{
$$GameName$$ = $$ServerName$$
// callback ($$UpdateGUNPlayerList$$)
// for(int j = 0; j < $$NumberOfPlayers$$; j++)
// {
// if ( length$( $$ListOfClans$$[j] ) > 0 )
// {
// o_players.column[0].list_item[j] = $$ListOfPlayers$$[j] "(" $$ListOfClans$$[j] ")"
// }
// else
// {
// o_players.column[0].list_item[j] = $$ListOfPlayers$$[j]
// }
// /
// }
// for(int k = j; k < MAX_MCCB_ITEMS-1; k++)
//./ {
// o_players.column[0].list_item[k] = ""
// }
}
}
else
{
mbutton[2].state = 3
mbutton[7].state = 3
}
if ( GameListActive == 1 )
{
if callback($$IsGameListUpdating$$) == 0
{
// mdm - also ensure the refresh button is enabled
mbutton[3].text = localize$(IDS_MP_LOG_UPDATE_LIST)
mbutton[4].text = localize$(IDS_MP_LOG_REFRESH_LIST)
mbutton[3].state = 1
mbutton[4].state = 1
initialize( mbutton[3] )
initialize( mbutton[4] )
// activate(o_update);
// activate(o_refresh);
GameListActive = 0
}
}
}
GUI_MAILBOX
{
if sender == mbutton[0]
{
script_run SCRIPTPATH "AddIP.script",0x1500
}
if sender == mbutton[1]
{
script_run SCRIPTPATH "filter.script",0x1500
}
if sender == mbutton[4]
{
if ( callback($$IsGameListUpdating$$) == 0 )
{
o_list_of_servers.top_of_list = 0
mail(-1,o_list_of_servers.o_thumbslider) // puts thumbslider at top
callback($$RefreshGameList$$)
mbutton[4].text = localize$(IDS_MP_LOG_CANCEL_UPDATE)
mbutton[3].state = 3
// deactivate(o_update);
GameListActive = 1
}
else
{
callback($$CancelActivity$$)
}
}
if sender == mbutton[3]
{
if callback($$IsGameListUpdating$$) == 0
{
o_list_of_servers.top_of_list = 0
mail(-1,o_list_of_servers.o_thumbslider) // puts thumbslider at top
callback($$UpdateGameList$$)
mbutton[3].text = localize$(IDS_MP_LOG_CANCEL_UPDATE)
mbutton[4].state = 3 // disables button
// deactivate(o_refresh);
GameListActive = 1
}
else
{
callback($$CancelActivity$$)
}
}
// Added a couple registered callbacks to go along with $$UpdateGameList$$:
//$$CancelUpdateGameList$$ - call when user hits "cancel", then change the button back to "update"
//$$IsGameListUpdating$$ - call to see when the "cancel" button should return to it's normal state, "update" (when it returns 1, keep waiting, when it returns 0, go ahead).
if ( o_list_of_servers.list_size > 0 )
{
if sender == mbutton[2]
{
if ( callback ( $$GetGameData$$, o_list_of_servers.nSelected ) == 1 )
{
DetailsGameID = $$GameID$$
script_run SCRIPTPATH "Serverinfo.script",0x1400
}
}
}
if sender == mbutton[6]
{
// mdm - disconnect from network -- this implicitly shuts ping down
callback( $$Disconnect$$ )
// @SHELL@currentScreen = 2 //MAINMENU
script_run scriptpath "Multiplayerconsole.script", 0x1000
script_end
}
if sender == mbutton[5]
{
script_run "content\\Shellscripts\\Options.script",0x1000
if(exists(@Options@))
{
@Options@screen.nMPServerBrowser = 1
initialize(@Options@screen)
}
script_end
}
if (sender == mbutton[7]) or (getmessage() == -1000)
{
// mdm - only invoke this if the current selection is valid
if ( o_list_of_servers.nSelected < $$NumberOfGames$$ )
{
if (callback($$ShellValidatePIDs$$) == 0)
{
o_pid_error = o_ErrorScreen
o_pid_error.error_message = localize$(IDS_MPK_ERROR_PID_CONNECT)
initialize(o_pid_error)
activate(o_pid_error)
return
}
int cur_ver = 0
int new_ver = 1
int old_ver = 2
int ver_check = cur_ver
// Check if the selected game is visible on the list first. If not, don't join
if ((o_list_of_servers.nSelected < o_list_of_servers.top_of_list) || ((o_list_of_servers.nSelected - o_list_of_servers.top_of_list) >= o_list_of_servers.max_displayed))
{
return
}
// Check version first. Proceed only if version matches
string version = o_list_of_servers.list_button[o_list_of_servers.nSelected - o_list_of_servers.top_of_list].version
string local_version = $$LocalGameVersion$$
// check major version
int major_ver = makeint(left$(version, 2))
int local_major_ver = makeint(left$(local_version, 2))
if (major_ver > local_major_ver)
{
ver_check = new_ver
}
else
if (major_ver < local_major_ver)
{
ver_check = old_ver
}
else
{
// check milestone version
int mile_ver = makeint(mid$(version, 3, 4))
int local_mile_ver = makeint(mid$(local_version, 3, 4))
if (mile_ver > local_mile_ver)
{
ver_check = new_ver
}
else
if (mile_ver < local_mile_ver)
{
ver_check = old_ver
}
else
{
// check month version
int month_ver = makeint(mid$(version, 6, 7))
int local_month_ver = makeint(mid$(local_version, 6, 7))
if (month_ver > local_month_ver)
{
ver_check = new_ver
}
else
if (month_ver < local_month_ver)
{
ver_check = old_ver
}
else
{
// check date version
int date_ver = makeint(right$(version, 4))
int local_date_ver = makeint(right$(local_version, 4))
if (date_ver > local_date_ver)
{
ver_check = new_ver
}
else
if (date_ver < local_date_ver)
{
ver_check = old_ver
}
}
}
}
if (ver_check == new_ver)
{
// newer version
o_version_error = o_ErrorScreen
o_version_error.error_header = localize$(IDS_MP_VERSION_ERROR_TITLE)
if (major_ver == 1)
{
o_version_error.error_message = localize$(IDS_MP_NEW_VENGEANCE_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
if (major_ver == 45)
{
o_version_error.error_message = localize$(IDS_MP_NEW_BK_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
if (major_ver == 50)
{
o_version_error.error_message = localize$(IDS_MP_NEW_MERCS_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
{
// this is for any future or unknown verions.
o_version_error.error_message = localize$(IDS_MP_NEW_UNKNOWN_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
o_version_error.button_mode = ONE_BUTTON_MODE
o_version_error.buttonText[0] = localize$(IDS_GN_OK)
initialize(o_version_error)
activate(o_version_error)
return
}
else
if (ver_check == old_ver)
{
// older version
o_version_error = o_ErrorScreen
o_version_error.error_header = localize$(IDS_MP_VERSION_ERROR_TITLE)
if (major_ver == 1)
{
o_version_error.error_message = localize$(IDS_MP_OLD_VENGEANCE_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
if (major_ver == 45)
{
o_version_error.error_message = localize$(IDS_MP_OLD_BK_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
if (major_ver == 50)
{
o_version_error.error_message = localize$(IDS_MP_OLD_MERCS_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
else
{
// this is for any unknown verions.
o_version_error.error_message = localize$(IDS_MP_OLD_UNKNOWN_VERSION) "\n\n" localize$(IDS_MP_MORE_MW_INFO)
}
o_version_error.button_mode = ONE_BUTTON_MODE
o_version_error.buttonText[0] = localize$(IDS_GN_OK)
initialize(o_version_error)
activate(o_version_error)
return
}
// mdm - force default player name
callback( $$SetPlayerNameDefault$$ )
// read the password status
if password_val == TRUE && locked_val == FALSE
{
script_run SCRIPTPATH "password.script",0x1500
}
else
{
// mdm - make ABSOLUTELY certain the index we have selected matches the game
// selected inside the gamelist
callback( $$Select$$, o_list_of_servers.nSelected )
int error=callback($$JoinSelected$$)
if error==0
{
callback( $$ShutdownPing$$ )
callback($$SetShellCommand$$, EndNetworkShellsCommand)
script_end
}
}
//script_run SCRIPTPATH "..\\.script",0x1000
//script_end
}
}
if (sender == mbutton[8])
{
o_list_of_servers.user_SELECTED_header = 0
if ( o_list_of_servers.nSelected >= 0 )
{
callback( $$Select$$, o_list_of_servers.nSelected )
}
// the following field names (first argument to SortGameList callback)
// are derived from GUNGameList.cpp key definitions.
callback( $$GetSortInfo$$ )
$$SortDescending$$ = 0
string colname = "Game Version"
string sorttype = "alphabetical"
callback( $$SortGameList$$, 6, colname, sorttype, $$SortDescending$$, 1 )
o_list_of_servers.nSelected = callback( $$GetSelection$$ )
callback( $$SaveSortInfo$$ )
callback( $$GetSortInfo$$ ) // so values in registered vars are current
}
if exists(@password@)
{
if sender == @password@screen
{
// mdm - make ABSOLUTELY certain the index we have selected matches the game
// selected inside the gamelist
callback( $$Select$$, o_list_of_servers.nSelected )
int error=callback($$JoinSelected$$)
if error==0
{
callback( $$ShutdownPing$$ )
callback($$SetShellCommand$$, EndNetworkShellsCommand)
script_end
}
}
}
}
}
background
{
GUI_CREATE
{
location = 0,0,-3
pane p_background = GPATH "MULTIPlayer.tga"
font3d gFont3d= FPATH localize$(IDS_F_MP_LABEL)
string current = localize$(IDS_MP_WHITE) " - " localize$(IDS_MP_CUR_VER) " "
string newer = localize$(IDS_MP_GREEN) " - " localize$(IDS_MP_NEW_VER) " "
string older = localize$(IDS_MP_RED) " - " localize$(IDS_MP_OLD_VER) " "
int cur_pixel = 0
int new_pixel = 0
}
GUI_DRAW
{
render P_background, 0,0
print3d_attributes = gFont3d, 0xFFB9B9E4, 1,0,1,0,0,0,1
lprint3d_position = 38, 406
print3d current
cur_pixel = getprint3dwidth(current)
print3d_attributes = gFont3d, 0xFF00FF00, 1,0,1,0,0,0,1
lprint3d_position = 38 + cur_pixel, 406
print3d newer
new_pixel = getprint3dwidth(newer)
print3d_attributes = gFont3d, 0xFFFF0000, 1,0,1,0,0,0,1
lprint3d_position = 38 + cur_pixel + new_pixel, 406
print3d older
}
}
@@ -0,0 +1,288 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\common_shell.script"
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\ShellFunctionHeaders.hpp"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\c_Text.script"
#include "Content\\ShellScripts\\editbox.script"
main
{
GUI_CREATE
{
// use the whole region
location = 0, 0, 0
object screen = oReviewScreen
focus(screen)
}
}
oReviewScreen
{
GUI_CREATE
{
int sender_is_me
//BackGround Pane
object oBackground = s_Pane
oBackground.location = 0,0,0
oBackground.szBitmap = szPATH_GRAPHICS "MP_Review_BackGround.tga"
oBackground.nFrames = 1
oBackground.nMode = 0
oBackground.fVolatile = 0
oBackground.fRegion = 1
initialize(oBackground)
//Text
//Page title
object oPlayerName = s_Text
oPlayerName.location = 21 ,21,nZ_TEXT
oPlayerName.nFontID = IDS_F_CAMPAIGN
oPlayerName.cTextColor = 0xFFff7200
oPlayerName.nJustify = 0
oPlayerName.nLayoutWidth= 205
oPlayerName.nLayoutHeight= 30
//Buttons
object o_Close_button = s_multistatepane
o_Close_button.file = WPATH "button_reg_200x27m_4state.tga"
o_Close_button.text = localize$(IDS_OM_VA_CLOSE)
o_Close_button.total_states = 4
o_Close_button.location = 560,555,nZ_BUTTON
initialize (o_Close_button)
object o_play_button = s_multistatepane
o_play_button.file = szPATH_GRAPHICS "MP_R_VidPlay.tga"
o_play_button.text = " "
o_play_button.nRollover = 1
o_play_button.nHelpID = IDS_HELP_CM_PLAY
o_play_button.total_states = 3
o_play_button.location = VBButtonX + 26, VBButtonY, nZ_BUTTON
initialize (o_play_button)
object o_Stop_button = s_multistatepane
o_Stop_button.file = szPATH_GRAPHICS "MP_R_VidStop.tga"
o_Stop_button.nRollover = 1
o_Stop_button.nHelpID = IDS_HELP_CM_STOP
o_Stop_button.text = " "
o_Stop_button.total_states = 3
o_Stop_button.location = VBButtonX, VBButtonY, nZ_BUTTON
initialize (o_Stop_button)
object o_Prev_button = s_multistatepane
o_Prev_button.file = szPATH_GRAPHICS "MP_R_VidBack.tga"
o_Prev_button.text = " "
o_Prev_button.nRollover = 1
o_Prev_button.nHelpID = IDS_HELP_CM_BACK
o_Prev_button.total_states = 3
o_Prev_button.location = VBButtonX, VBButtonY + 27, nZ_BUTTON
initialize (o_Prev_button)
object o_Next_button = s_multistatepane
o_Next_button.file = szPATH_GRAPHICS "MP_R_VidForward.tga"
o_Next_button.text = " "
o_Next_button.nRollover = 1
o_Next_button.nHelpID = IDS_HELP_CM_FORWARD
o_Next_button.total_states = 3
o_Next_button.location = VBButtonX + 26, VBButtonY + 27, nZ_BUTTON
initialize (o_Next_button)
sound btnTriggeredSound = SPATH "sfx_button5.wav"
//---------------------------------------------------
object o_chat_box = s_mc_listbox
o_chat_box.location = 35,467,1
o_chat_box.boxFont3d = FPATH localize$(IDS_F_CHAT_BOX) //MUST BE INITIALIZED
o_chat_box.itemWidth = 526 - 16 //MUST BE INITIALIZED
o_chat_box.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_chat_box.itemHeight_padding = 4//10
o_chat_box.list_size = 0 //MAX_MCCB_ITEMS
o_chat_box.NUM_OF_COLUMNS = 1
o_chat_box.column_header_height = 0 //MUST BE INITIALIZED
o_chat_box.max_displayed = 529-463//30 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED
o_chat_box.uniform_item_height = 0
o_chat_box.SelectedHighlightColor = packcolor (51, 55, 115, 0) //CAN BE INITIALIZED
o_chat_box.boxhighlightColor = packcolor (0,0,0,0) //CAN BE INITIALIZED
o_chat_box.selectedColor = packcolor (255,255,255,0) //CAN BE INITIALIZED
o_chat_box.backColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
o_chat_box.itemhighlightcolor = packcolor (255,255,255,255)
o_chat_box.label = localize$(IDS_MP_LOBBY_CHAT) //CAN BE INITIALIZED
o_chat_box.labelFont3d = FPATH localize$(IDS_F_GEN_LABEL) //CAN BE INITIALIZED
o_chat_box.offsetLabel = 0,-18 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25
o_chat_box.buttonwidth = 16 //CAN BE INITIALIZED
o_chat_box.first_delay = 10 //time delay value n/60; for the buttons
o_chat_box.second_delay = 1 //time delay value n/60; for the buttons
o_chat_box.column[0].location.x = 3
o_chat_box.column[0].fontcolor = packcolor (255,255,255,255)
o_chat_box.column[0].fontAlignment = just_left
for k = 0; k < o_chat_box.list_size; k++
{
if exists(o_chat_box.column[0].list_icon[k])
{
if getwidth(o_chat_box.column[0].list_icon[k]) > greatest_x
greatest_x = getwidth(o_chat_box.column[0].list_icon[k])
if getheight(o_chat_box.column[0].list_icon[k]) > greatest_y
greatest_y = getheight(o_chat_box.column[0].list_icon[k])
}
}
if greatest_x > 0 && greatest_y > 0
bitmap_create black = greatest_x,greatest_y //comment out if you don't have any images
for x = 0;x < MAX_MCCB_ITEMS; x++
{
o_chat_box.list_order[x] = x
o_chat_box.column[0].list_item[x] = ""
}
initialize (o_chat_box)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
object o_chat_entry = s_editbox
o_chat_entry.location = 35,543,20
o_chat_entry.boxValue = "" //CAN BE INITIALIZED holds the contents of the edit box
o_chat_entry.boxWidth = 528 //MUST BE INTIALIZED width of the edit field of the box
o_chat_entry.boxHeight = 20 //MUST BE INTIALIZED height of the edit field of the box//
o_chat_entry.boxtextlimit = 100
o_chat_entry.boxFont3d = FPATH localize$(IDS_F_CHAT_ENTRY) //MUST BE INTIALIZED
o_chat_entry.boxTextOffset = 3,3 //CAN BE INITIALIZED
o_chat_entry.labelFont3d = FPATH localize$(IDS_F_GEN_LABEL) //MUST BE INTIALIZED
o_chat_entry.offset = -190,0 //CAN BE INITIALIZED offset of text from button
o_chat_entry.Auto_Update = FALSE
initialize (o_chat_entry)
}
GUI_INIT
{
}
GUI_CHAR
{
if getchar() > 0
o_chat_entry.boxValue = o_chat_entry.boxValue chr$(getchar())
focus(o_chat_entry)
o_chat_entry.highlight = false
}
GUI_EXECUTE
{
if $$m_currentChatCount$$ > 0
{
string temp_val = $$m_chatFrom$$[$$m_currentChatCount$$-1] ":> " $$m_chatArray$$[$$m_currentChatCount$$-1]
if equal$(temp_val,o_chat_box.column[0].list_item[$$m_currentChatCount$$-1])
{
}
else
{
o_chat_box.list_size = $$m_currentChatCount$$
for x = 0;x < $$m_currentChatCount$$; x++
{
o_chat_box.column[0].list_item[x] = $$m_chatFrom$$[x] ":> " $$m_chatArray$$[x]
}
initialize (o_chat_box)
// mail(-1,o_chat_box)
// mail(0,o_chat_box.o_thumbslider)
// if sender_is_me == TRUE
// {
int move_amount = 0
//move to the bottom of the list
move_amount = o_chat_box.list_button[$$m_currentChatCount$$-1].location.y+o_chat_box.list_button[$$m_currentChatCount$$-1].buttonHeight - (o_chat_box.location.y+o_chat_box.region.p2.y)
if move_amount != 0
{
o_chat_box.start_of_list = o_chat_box.start_of_list+(move_amount/o_chat_box.itemHeight)
for x = 0; x < o_chat_box.list_size; x++
{
o_chat_box.list_button[x].location.y -= move_amount
}
mail(-1,o_chat_box)
mail(0,o_chat_box.o_thumbslider)
}
// }
}
}
if sender_is_me == TRUE //&& focused == o_chat_box
{
focus(o_chat_entry)
sender_is_me = FALSE
}
}
GUI_MAILBOX
{
switch (sender)
{
case o_Close_button:
{
play btnTriggeredSound,1
unfocus
}
break
case o_play_button:
{
play btnTriggeredSound,1
unfocus
}
break
case o_Stop_button:
{
play btnTriggeredSound,1
unfocus
}
break
case o_Prev_button:
{
play btnTriggeredSound,1
unfocus
}
break
case o_Next_button:
{
play btnTriggeredSound,1
unfocus
}
break
case o_chat_entry:
{
int out_going_count = 0
for int loopit = 0; loopit < 255; loopit++
{
valid_player = callback($$IsPlayerConnectionValid$$,loopit)
if (valid_player)
{
$$m_outgiongChatToPlayer$$[out_going_count] = loopit
out_going_count++
}
}
$$m_outgoingChatToPlayerCount$$ = out_going_count
$$m_outgoingChat$$ = o_chat_entry.boxvalue
sender_is_me = true
callback($$SendChat$$)
o_chat_entry.boxvalue = ""
initialize(o_chat_entry)
sender_is_me = true
}
break
}
// switch (getmessage())
// {
// case :
// {
// }
// break
// }
}
}
@@ -0,0 +1,710 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\listboxes.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\common_shell.script"
#include "Content\\ShellScripts\\ShellFunctionHeaders.hpp"
#include "Content\\ShellScripts\\c_text.script"
#include "Content\\ShellScripts\\c_rollover.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
#define scriptpath "content\\Shellscripts\\Multiplayer\\"
main
{
GUI_CREATE
{
callback($$CancelDialup$$)
callback($$LoadMPConnectionSettings$$)
callback($$InitConnectionWizard$$)
// spew"MPConsole is rolling"
object oRollover = s_HelpRegion
oRollover.nFontID = IDS_F_ROLLOVER_INFO
oRollover.cTextColor= 0xFFff7200
oRollover.location = 31,516,255
oRollover.nWidth = 538
oRollover.nHeight = 56
initialize(oRollover)
activate(oRollover)
font3d boldfont = FPATH localize$(IDS_F_ML_DATA)
font3d regfont = FPATH localize$(IDS_F_MP_LABEL)
string destination
object o_console = console
object o_interlace = interlace
o_interlace.location = 0, 0, 10
o_interlace.lace_color = packcolor (100, 150, 255, 175)
object o_frame = frame
o_frame.type = 1
o_frame.location = 0, 0, 100
o_frame.screen_name = localize$(IDS_MP_MAIN_TITLE)
initialize(o_frame)
object o_mouselines = mouselines
o_mouselines.location = 0, 0, o_frame.location.z - 1
string connection_type[5]
connection_type[0] = localize$(IDS_MP_NC_SPEED_TYPE_MODEM)
connection_type[1] = localize$(IDS_MP_NC_SPEED_TYPE_ISDN)
connection_type[2] = localize$(IDS_MP_NC_SPEED_TYPE_XDSL)
connection_type[3] = localize$(IDS_MP_NC_SPEED_TYPE_CABLE)
connection_type[4] = localize$(IDS_MP_NC_SPEED_TYPE_LAN)
string bandwidth[10]
bandwidth[0] = localize$(IDS_MP_NC_SPEED_14)
bandwidth[1] = localize$(IDS_MP_NC_SPEED_28)
bandwidth[2] = localize$(IDS_MP_NC_SPEED_56)
bandwidth[3] = localize$(IDS_MP_NC_SPEED_64)
bandwidth[4] = localize$(IDS_MP_NC_SPEED_128)
bandwidth[5] = localize$(IDS_MP_NC_SPEED_384)
bandwidth[6] = localize$(IDS_MP_NC_SPEED_768)
bandwidth[7] = localize$(IDS_MP_NC_SPEED_1500)
bandwidth[8] = localize$(IDS_MP_NC_SPEED_10K)
bandwidth[9] = localize$(IDS_MP_NC_SPEED_100K)
// initialize the buttons
int i
object mbutton[7]
for(i = 0; i < 7; i++)
{
mbutton[i] = s_multistatepane
mbutton[i].total_states = 3
mbutton[i].textsize = 1
mbutton[i].id = i
}
mbutton[0].text = localize$(IDS_GN_NEW)
mbutton[0].file = WPATH "button_reg_138x23m_3state.tga"
mbutton[0].location = 87, 430, 10
mbutton[0].nRollover = 1
mbutton[0].nHelpID = IDS_HELP_MP_NEW_CONNECTION
mbutton[0].state = 0
initialize (mbutton[0])
mbutton[1].text = localize$(IDS_GN_EDIT)
mbutton[1].file = WPATH "button_reg_138x23m_3state.tga"
mbutton[1].location = 235, 430, 10
mbutton[1].nRollover = 1
mbutton[1].nHelpID = IDS_HELP_MP_EDIT_CONNECTION
initialize (mbutton[1])
mbutton[2].text = localize$(IDS_GN_REMOVE)
mbutton[2].file = WPATH "button_reg_138x23m_3state.tga"
mbutton[2].location = 383, 430, 10
mbutton[2].nRollover = 1
mbutton[2].nHelpID = IDS_HELP_MP_REMOVE_CONNECTION
if $$NumConnections$$ == 0
mbutton[2].state = 3
initialize (mbutton[2])
mbutton[3].text = localize$(IDS_GN_OPTIONS)
mbutton[3].file = WPATH "button_reg_180x23m_3state.tga"
mbutton[3].location = 580, 400, 10
mbutton[3].nRollover = 1
mbutton[3].nHelpID = IDS_HELP_MP_OPTIONS
initialize (mbutton[3])
mbutton[4].text = localize$(IDS_GN_MAINMENU)
mbutton[4].file = WPATH "button_reg_196x27m_3state.tga"
mbutton[4].location = 580, 510, o_frame.location.z + 1
mbutton[4].nRollover = 1
mbutton[4].nHelpID = IDS_HELP_OM_MAIN_MENU
initialize (mbutton[4])
// mbutton[5].text = localize$(IDS_MP_MAIN_QUICKJOIN)
// mbutton[5].file = WPATH "button_main_180x23m_3state.tga"
// mbutton[5].location = 580, 400, o_frame.location.z + 1
// mbutton[5].nRollover = 1
// mbutton[5].nHelpID = IDS_HELP_MP_QUICK_JOIN
// initialize (mbutton[5])
mbutton[5].text = localize$(IDS_MP_MAIN_HOST)
mbutton[5].file = WPATH "button_main_180x23m_3state.tga"
mbutton[5].location = 580, 430, 10
mbutton[5].nRollover = 1
mbutton[5].nHelpID = IDS_HELP_MP_HOST
initialize (mbutton[5])
mbutton[6].text = localize$(IDS_MP_MAIN_CONNECT)
mbutton[6].file = WPATH "button_main_196x41m_3state.tga"
mbutton[6].location = 580, 540, o_frame.location.z + 1
mbutton[6].nRollover = 1
mbutton[6].nHelpID = IDS_HELP_MP_CONNECT
initialize (mbutton[6])
for(i = 0; i < 7; i++)
{
initialize(mbutton[i])
}
object o_back = background
framerate =10
if ($$NumConnections$$ == 0)
{
activate (o_console)
script_run scriptpath "NoConnection.script",0x1300
}
else
{
deactivate(o_console)
}
object oError
if($$NumConnections$$ == 0)
{
$$m_listBoxSize$$ = 1
}
else
{
$$m_listBoxSize$$ = $$NumConnections$$
}
int MAX_ITEMS = 40
object o_connections_droplist = s_droplistbox
o_connections_droplist.location = 237, 144, 30
o_connections_droplist.label = ""
o_connections_droplist.itemWidth = 269
o_connections_droplist.max_displayed = 16
o_connections_droplist.itemHeight = 20
o_connections_droplist.arrowHeight = 15
o_connections_droplist.nselected = $$ConnectionIndex$$
o_connections_droplist.list_size = $$NumConnections$$
int nConnect = $$NumConnections$$
int iLoop
if($$NumConnections$$ < 20)
{
o_connections_droplist.list_size = $$NumConnections$$
for(iloop = 0; iloop < $$NumConnections$$ ; iloop++)
{
o_connections_droplist.list_item[iLoop] = $$ListOfConnections$$[iLoop]
}
if($$NumConnections$$ == 19 && mbutton[0].state = 3)
{
mbutton[0].state = 0
initialize (mbutton[0])
}
}
else
{
oError = o_ErrorScreen
oError.location = 0,0,70
oError.button_mode = ONE_BUTTON_MODE
oError.error_header = LOCALIZE$(IDS_ERROR_MP_NUMCONNECT_TITLE)
oError.error_message= LOCALIZE$(IDS_ERROR_MP_NUMCONNECT)
initialize(oError)
activate(oError)
mbutton[0].state = 3
initialize (mbutton[0])
}
initialize(o_connections_droplist)
object o_error
int HaveZoneMatch = callback( $$CheckZoneMatch$$ )
}
GUI_INIT
{
}
GUI_DRAW
{
setpencolor(0, 0, 0, 150) //black box
drawrect 89, 175 to 522, 424
setpencolor(255, 255, 255, 255) //highlight
drawframe 89, 175 to 522, 424
setpencolor(187, 187, 204, 255) //face
drawframe 90, 176 to 521, 423
setpencolor(119, 119, 119, 255) //shadow
drawline 89, 424 to 522, 424
drawline 522, 175 to 522, 424
print3d_attributes = regfont,packcolor(255,255,255,255),1,1,1,0,0,0,1
print3d_margins = 89, 149 to 235, 170
print3d_position = 89, 150
print3d localize$(IDS_MP_MAIN_CONNECTION)
print3d_margins = 89, 85 to 522, 149
print3d_position = 89, 85
print3d localize$(IDS_MP_MAIN_SELECTCONNECTION)
print3d_margins = 99, 185 to 512, 414
if ($$NumConnections$$ != 0)
{
print3d_position = 99, 185
print3d localize$(IDS_ML_CH_TYPE)
print3d_position = 99, 215
print3d localize$(IDS_ML_MAIN_SPEED)
print3d_position = 99, 245
print3d localize$(IDS_MP_MC_BROWSE)
print3d_margins = 240, 185 to 512, 414
print3d_position = 240, 185
if $$NetHardware$$ > -1 and $$NetHardware$$ < 5
print3d connection_type[$$NetHardware$$]
print3d_position = 240, 215
if $$bandwidth$$ > -1 and $$bandwidth$$ < 10
print3d bandwidth[$$bandwidth$$]
print3d_position = 240, 245
if $$BrowseGameSpy$$ == 1
{
print3d localize$(IDS_NC_HOW_GAMESPY) " \n"
}
if $$BrowseGUN$$ == 1
{
print3d localize$(IDS_NC_HOW_GAMEZONE) " \n"
}
if $$BrowseLAN$$ == 1
{
print3d localize$(IDS_MP_NC_SPEED_TYPE_LAN) " \n"
}
string ip_address = ""
for (int k = 0; k < $$BrowseIPAddresses$$; k++)
{
ip_address = $$klda18$$[k]
if (equal$(ip_address, "") == FALSE)
print3d LOCALIZE$(IDS_MP_MC_IPADDRESS)" " ip_address " \n"
}
}
}
GUI_MAILBOX
{
if sender == o_connections_droplist
{
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$InitConnectionWizard$$)
}
if sender == mbutton[0]
{
$$ConnectionIndex$$ = $$NumConnections$$
o_console.dialup = false
activate(o_console)
script_run scriptpath "NoConnection.script",0x1300
}
if sender == mbutton[1]
{
o_console.dialup = false
activate(o_console)
script_run scriptpath "NoConnection.script",0x1300
@NoConnection@edit_connection_flag = TRUE
}
if sender == mbutton[2]
{
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$kldc01$$)
script_run SCRIPTPATH "MultiplayerConsole.script",0x1000
script_end
}
if sender == mbutton[3]
{
script_run "content\\Shellscripts\\Options.script",0x1000
if(exists(@Options@))
{
@Options@screen.nMPConsole = 1
initialize(@Options@screen)
}
script_end
}
// if sender == mbutton[5]
// {
// $$ConnectionIndex$$ = o_connections_droplist.nselected
// callback($$kldc02$$)
// script_run SCRIPTPATH "Listofgames.script", 0x1000
// if exists(@NoConnection@)
// {
// mail (-1,@NoConnection@)
// }
// script_end
// }
if sender == mbutton[5]
{
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$PreConnect$$)
if callback($$GetDialupConnectionStatus$$) == 0
{
o_console.dialup = true
destination = "Hostgame1.script"
activate(o_console)
}
else
{
script_run SCRIPTPATH "Hostgame1.script", 0x1000
if exists(@NoConnection@)
{
mail (-1,@NoConnection@)
}
script_end
}
}
if sender == mbutton[6]
{
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$PreConnect$$)
if ( HaveZoneMatch == 0 && $$BrowseGUN$$ == 1)
{
$$BrowseGUN$$ = 0
script_run SCRIPTPATH "badzonematch.script",0x1500
}
if callback($$GetDialupConnectionStatus$$) == 0
{
o_console.dialup = true
destination = "Listofgames.script"
activate(o_console)
}
else
{
script_run SCRIPTPATH "Listofgames.script", 0x1000
if exists(@NoConnection@)
{
mail (-1,@NoConnection@)
}
script_end
}
}
if sender == o_console && getmessage() != -100
{
if callback($$GetDialupConnectionStatus$$) == 1
{
script_run SCRIPTPATH destination, 0x1000
if exists(@NoConnection@)
{
mail (-1,@NoConnection@)
}
script_end
}
}
if sender == mbutton[4] or getmessage() == -100
{
$$gConnectionType$$ = -1
callback($$SetShellCommand$$, EndNetworkShellsCommand)
script_end
}
if sender == mbutton[3]
{
}
if getmessage() == 200
{
initialize(this)
}
}
}
background
{
GUI_CREATE
{
location = 0,0,-3
pane p_background = GPATH "MULTIPlayer.tga"
framerate = 20
}
GUI_EXECUTE
{
if $$NumConnections$$ > 1
{
mbutton[2].state = 0
}
else
{
mbutton[2].state = 3
}
if $$NumConnections$$ < $$m_listBoxSize$$
{
mbutton[0].state = 0
}
else
{
mbutton[0].state = 3
}
}
GUI_DRAW
{
render P_background, 0,0
}
}
createserver
{
GUI_CREATE
{
location = 525,281,10
region = 0,0 to 696-525,314-281
// delay is frame based not time based
int delay = 30
int time_delayed = 0
}
LBUTTON_UPDATE
{
if (time_delayed == delay)
{
if mouse.left == BUTTON_CLICKED
{
mail (-1)
}
}
}
GUI_EXECUTE
{
if (time_delayed < delay)
time_delayed = time_delayed + 1
}
}
console
{
GUI_CREATE
{
object o_block_screen = block_screen
object o_display = display
// object o_connect = connect
pane connectdevice = GPATH "dialog_600x300m.tga"
location = (getresx()-getwidth(connectdevice))/2,(getresy()-getheight(connectdevice))/2, 150
object o_cancel = s_multistatepane
o_cancel.file = WPATH "button_reg_138x23m_3state.tga"
o_cancel.total_states = 3
o_cancel.text = localize$(IDS_GN_CANCEL)
o_cancel.location = 133,392,220
initialize(o_cancel)
int dialup = false
string message = localize$(IDS_MP_C_LAUNCHOS)
framerate = 30
// variables for fading in and out
int alpha_val = 5
int fadeout = false
}
GUI_DEACTIVATE
{
deactivate(o_block_screen)
deactivate(o_cancel)
// deactivate(o_options)
deactivate(o_display)
// deactivate(o_connect)
}
GUI_ACTIVATE
{
alpha_val = 5
fadeout = false
activate(o_block_screen)
activate(o_display)
activate(o_cancel)
// activate(o_options)
// activate(o_connect)
}
GUI_MAILBOX
{
if sender == o_cancel
{
if ($$NumConnections$$ < 1)
{
mail(-100)
script_end "NoConnection.script"
}
else
{
callback($$CancelDialup$$)
if (exists(@NoConnection@))
script_end "NoConnection.script"
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$InitConnectionWizard$$)
fadeout = true
//activate(parent.o_console)
}
}
if (exists(@NoConnection@))
{
if sender == @NoConnection@o_havenetwork
{
if ($$NumConnections$$ < 1)
{
mail(-100)
script_end "NoConnection.script"
}
else
{
callback($$CancelDialup$$)
script_end "NoConnection.script"
$$ConnectionIndex$$ = o_connections_droplist.nselected
callback($$InitConnectionWizard$$)
fadeout = true
}
}
}
}
GUI_EXECUTE
{
if dialup == TRUE and callback($$GetDialupConnectionStatus$$) == 1
{
mail (0)
dialup = false
}
if fadeout == true
{
deactivate(o_cancel)
// 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()
if fadeout == false && alpha_val > 0
render connectdevice,location
if dialup
{
//set up attributes
print3d_attributes = regfont,packcolor(255,255,255,255),-10,1,1,1,0,just_all
//set up print location
lprint3d_position = 0,0
//set up margins, if none provided set them to the length of the text
lprint3d_margins = 0,0 to 404,225
print3d $$DialupConnectionStatus$$
}
if fadeout == false && alpha_val > 0
{
print3d_attributes = boldfont, 0xffffffff, 1, 1, 1, 0, 0, just_center
print3d_margins = location.x, location.y to location.x + getwidth(connectdevice), location.y + 35
print3d_position = location.x, location.y + 10
print3d localize$(IDS_MP_MAIN_CONNECTIONSETUP)
}
}
}
block_screen
{
GUI_CREATE
{
location = 0,0,110
region = 0,0 to getresx(),getresy()
}
}
display
{
GUI_CREATE
{
relative = true
location = 37,40,50
region = 0,0 to 20,20
font3d Header = FPATH localize$(IDS_F_MP_LABEL)
int Headercolor = packcolor(255,200,30,255)
}
GUI_DRAW
{
//set up attributes
print3d_attributes = Header,packcolor(255,200,30,255),-12,1,1,1,0,just_center
//set up print location
lprint3d_position = 0,80
//set up margins, if none provided set them to the length of the text
lprint3d_margins = 0,0 to 404,225
//draw the text
// print3d "MODEM: Hayes 129 DL\nConnect to: The ZONE\nPhone: 1-832-031-7832"
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,376 @@
#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\\mc_listboxes.script"
main
{
GUI_CREATE
{
int MAX_MCCB_ITEMS = 16 //MAXIMUM NUMBER OF ITEMS LISTED
int MAX_MCCB_COLUMNS = 2 //MAXIMUM NUMBER OF ITEMS LISTED
// Total number of difficulties
int max_items = TOTAL_NUM_PILOT_DIFFICULTY
// use the whole region
location = 0, 0, 0
region = 0, 0 to getresx(), getresy()
object screen = s_dialog
// create display message to be drawn over list while player
// information is downloaded
object o_DisplayMessage = s_DisplayMessage
o_DisplayMessage.location = 280, 240, 15
string DisplayMessage = LOCALIZE$(IDS_MP_SI_DOWNLOADING)
int okEnabled = 0 // don't let user say ok until we've downloaded the data.
// fire off a server info query for the currenlty selected server
// so that we will download the player data
if ( callback( $$GetServerInfo$$, @listofgames@DetailsGameID ) == -1 )
{
// error in getting server info
// mdm - todo - handle this case
DisplayMessage = LOCALIZE$(IDS_MP_SI_NOTINIT)
okEnabled = 1
}
font3d f_font = FPATH localize$(IDS_F_MP_LABEL) // "arial.ttf"
int xcolor = packcolor (180,180,180,255)
}
GUI_DRAW
{
}
}
block_controls
{
GUI_CREATE
{
location = 0,0,20
region = 250, 109 to 250+291,109+271
}
}
s_DisplayMessage
{
GUI_CREATE
{
int brightness = 255
int dimming = 1
framerate = 5
int siStatus
}
GUI_EXECUTE
{
if ( okEnabled == 0 )
{
screen.o_ok.state = 3
initialize(screen.o_ok)
}
else
{
screen.o_ok.state = 0
initialize(screen.o_ok)
}
siStatus = callback( $$GetServerInfoStatus$$, @listofgames@DetailsGameID ) //@listofgames@o_list_of_servers.nSelected )
}
GUI_DRAW
{
if(! equal$(DisplayMessage,"") && (screen.fadeout == false) )
{
if ( siStatus == 2 || siStatus == 3 ) // error
{
xcolor = packcolor ( 255, 0, 0, 255 )
}
else
{
if ( dimming == 1 )
{
brightness = brightness - 5
}
else
{
brightness = brightness + 5
}
if ( brightness < 150 )
{
brightness = 150
dimming = 0
}
if ( brightness > 255 )
{
brightness = 255
dimming = 1
}
xcolor = packcolor ( brightness, brightness, 0, 255 )
}
lprint3d_margins = 0, -30 to 800, 800
print3d_attributes = f_font, xcolor,1,0,1,0,0,0,1
// print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = 0, 0
print3d DisplayMessage
}
}
}
s_dialog
{
GUI_CREATE
{
int siStatus = 0
Font3d gFont3d = szPATH_FONTS localize$(IDS_F_LOAD_TITLE)
pane gFrame = GPATH "dialog_400x400m.tga"
object o_ok = s_multistatepane
o_ok.total_states = 4
o_ok.textsize = 1
o_ok.text = localize$(IDS_RS_B_OK)
o_ok.file = WPATH "button_reg_138x23m_4state.tga"
o_ok.location = (getresx() / 2) - 71, 400, 10
initialize(o_ok)
framerate = 30
//block header buttons
object o_block_controls = block_controls
// List of Players
//Create our STANDARD listbox///////////////////////////////////////////////////////////////////////////////////////////////////////////
object o_players = s_mc_listbox
o_players.location = 250, 109,10
o_players.boxFont3d = FPATH localize$(IDS_F_MP_LABEL) //MUST BE INITIALIZED
// o_players.boxFont3d = "arial.ttf"
o_players.itemWidth = 291 //MUST BE INITIALIZED
o_players.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items
o_players.itemHeight_padding = 4//10
o_players.list_size = MAX_MCCB_ITEMS
o_players.NUM_OF_COLUMNS = 2
o_players.column_header_height = 22 //MUST BE INITIALIZED
o_players.max_displayed = 271//30 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED
o_players.uniform_item_height = 12
o_players.backColor = packcolor (0,0,0,128) //CAN BE INITIALIZED
// o_players.controlColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
// o_players.boxTextColor = packcolor (0,0,0,255) //CAN BE INITIALIZED
o_players.boxTextSelectedColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
o_players.boxhighlightColor = packcolor (0,0,100,0) //CAN BE INITIALIZED
o_players.selectedColor = packcolor (0,150,200,0) //CAN BE INITIALIZED
o_players.selectedhighlightColor = packcolor (0,0,150,0) //CAN BE INITIALIZED
o_players.labelTextColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
// o_players.borderColor = packcolor (255,255,255,255) //CAN BE INITIALIZED
// o_players.framehighlightColor = packcolor (200,255,255,255) //CAN BE INITIALIZED
// o_players.gutterColor = packcolor (100,100,120,255)
// o_players.headercolor = packcolor (255,255,255,255)
// o_players.headerbordercolor = packcolor (0,0,0,255)
// o_players.headerpressedcolor = packcolor (255,255,255,130)
// o_players.headertextcolor = packcolor (0,0,0, 255)
o_players.label = LOCALIZE$(IDS_MP_LOG_SERVERINFO) //CAN BE INITIALIZED
o_players.labelFont3d = FPATH localize$(IDS_F_ML_DATA) //CAN BE INITIALIZED
o_players.offsetLabel = 85,-42 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25
o_players.buttonwidth = 16 //CAN BE INITIALIZED
o_players.first_delay = 10 //time delay value n/60; for the buttons
o_players.second_delay = 1 //time delay value n/60; for the buttons
o_players.column[0].location.x = 3
o_players.column[1].location.x = 150
o_players.column[0].fontcolor = packcolor (255,255,255,255)
o_players.column[1].fontcolor = packcolor (255,255,255,255)
// o_players.column[0].icondisplays = true
// o_players.column[2].icondisplays = true
// o_players.column[1].numeric = true
// o_players.column[3].numeric = true
// o_players.column[0].fontAlignment = just_left
o_players.list_order[0] = 0
o_players.list_order[1] = 1
o_players.list_order[2] = 2
o_players.list_order[3] = 3
o_players.list_order[4] = 4
o_players.list_order[5] = 5
o_players.list_order[6] = 6
o_players.list_order[7] = 7
o_players.list_order[8] = 8
o_players.list_order[9] = 9
o_players.list_order[10] = 10
o_players.list_order[11] = 11
o_players.list_order[12] = 12
o_players.list_order[13] = 13
o_players.list_order[14] = 14
o_players.list_order[15] = 15
////////////////////////////////////////////////////////////////////////////////////////////////////////////
sound btnTriggeredSound = SPATH "sfx_button5.wav"
// variables for fading in and out
int alpha_val = 5
int fadeout = false
for(int k = 0; k < MAX_MCCB_ITEMS-1; k++)
{
o_players.column[0].list_item[k] = ""
o_players.column[1].list_item[k] = ""
}
initialize (o_players)
o_players.column[0].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_players.column[1].o_header.f_font = FPATH localize$(IDS_F_MP_LABEL)
o_players.column[0].o_header.s_text = LOCALIZE$(IDS_MP_SI_PLAYER)
o_players.column[1].o_header.s_text = LOCALIZE$(IDS_MP_SI_FACTION)
}
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
script_end
}
}
}
else
{
// Fading in(Entering)
if alpha_val < 150
{
alpha_val += 5
if alpha_val >= 150
{
alpha_val = 150
}
}
}
siStatus = callback( $$GetServerInfoStatus$$, @listofgames@DetailsGameID ) //@listofgames@o_list_of_servers.nSelected )
if ( siStatus == 1 )
{
callback ( $$GetPlayerList$$, -1, @listofgames@DetailsGameID )//@listofgames@o_list_of_servers.nSelected )
for(int j = 0; j < $$NumberOfPlayers$$; j++)
{
o_players.column[0].list_item[j] = $$ListOfPlayers$$[j]
if ( length$( $$ListOfClans$$[j] ) > 0 )
{
o_players.column[1].list_item[j] = $$ListOfClans$$[j]
}
else
{
o_players.column[1].list_item[j] = ""
}
}
for(int k = j; k < MAX_MCCB_ITEMS-1; k++)
{
o_players.column[0].list_item[k] = ""
o_players.column[1].list_item[k] = ""
}
okEnabled = 1
DisplayMessage = ""
}
else
{
if ( siStatus == 2 )
{
DisplayMessage = localize$(IDS_ERROR_MP_SI_DOWNLOADING)
okEnabled = 1
}
else
{
if ( siStatus == 3 )
{
DisplayMessage = localize$(IDS_ERROR_MP_SI_NOSERVER)
okEnabled = 1
}
}
}
}
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, 205,59
// Header
print3d_attributes = gFont3d,0xffffffff,1,0,1,1,0,0
print3d_position = 300, 130
// print3d localize$(IDS_RS_CREATE_TITLE)
}
}
GUI_MAILBOX
{
// Handle the OK Request
if (sender == o_ok)
{
if ( okEnabled == 1 )
{
play btnTriggeredSound,1
// Tell this script to fade out and deactivate all its objects
fadeout = true
deactivate(o_players)
deactivate(o_ok)
}
else
{
// mdm - todo - flash the button or better yet gray out button so i can
// return silently here without confusing the user
}
}
}
GUI_DESTROY
{
unfocus
}
}
@@ -0,0 +1,887 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
s_droplistbox
{
GUI_CREATE
{
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
font3d boxFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_DROPDOWN) //MUST BE INITIALIZED
int backColor = packcolor (0, 0, 0, 255)
int controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
int labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int facecolor = packcolor (187, 187, 204, 255)
int shadowcolor = packcolor (119, 119, 119, 255)
float itemWidth = 0 //MUST BE INITIALIZED
float itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed //MUST BE INITIALIZED
int top_of_list //MUST BE INITIALIZED
string label = "" //CAN BE INITIALIZED
font3d labelFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_LABEL) //MUST BE INITIALIZED
position offsetLabel = 0,-15 //CAN BE INITIALIZED
int buttonWidth = 16 //CAN BE INITIALIZED
int arrowHeight = 10 //CAN BE INITIALIZED; IT CONTROLS THE HEIGHT OF THE THUMBSLIDER ARROWS
int get_itemheight = FALSE //CAN BE INITIALIZED; FLAGS WHETHER YOU WANT TO USE THE FONTHEIGHT AS THE HEIGHT FOR EACH ITEM
//LOCAL WORK VARIABLES
int max_items = 60
int num_displayed //THE NUMBER OF ITEMS DISPLAYED INSIDE THE LIST BOX; THIS IS AFFECTED IN THE INIT
int droppedflag = false //used to toggle the list up/down
int nSelected = 0 //the current selected item from the list of items
int lit //the value of the hightlighted item (not selected)
int over_me = false //am I over the list's region?
string list_item[max_items] //--------------MAX_ITEMS MUST BE SET BY YOU.
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
position mouse_capture //used to grab the mouse position and detect whether the mouse has been moved
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_dropbutton = s_dropbutton
object o_uparrow = s_arrow
object o_downarrow = s_arrow
o_downarrow.up = false // identifies this as the arrow down button
object o_thumbslider = s_thumbslide
object o_thumbregiontop = s_thumbregion
object o_thumbregionbot = s_thumbregion
//STARTS CLOSED BY HIDING BUTTONS
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
int nRollover = 0 // A flag to set if using c_rollover
int nHelpID = -1
int id = 0
framerate = 30
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
region = 0,0 to itemwidth+buttonwidth,itemheight //region to click and drop the list (scales later)
initialize (o_dropbutton)
initialize (o_uparrow)
initialize (o_downarrow)
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight //region for arrow
// determines what size the thumslider needs to be: if it's too small, the minimum size is 15
if list_size > max_displayed
{
num_displayed = max_displayed
o_thumbslider.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2) / ((list_size)/num_displayed)
o_thumbslider.region = 0,-2 to buttonwidth,o_thumbslider.handleheight+2
o_uparrow.region = 0,0 to buttonwidth,arrowHeight
o_downarrow.region = 0,0 to buttonwidth,arrowHeight
if o_thumbslider.handleheight < 15
{
o_thumbslider.handleheight = 15
o_thumbslider.region = 0,-2 to buttonwidth,o_thumbslider.handleheight+2
}
}
else
{
num_displayed = list_size //if the number of items is less than the max size of the list, shrink the size to the number listed
o_thumbslider.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2)
o_thumbslider.region = 0,0 to 0,0
o_uparrow.region = 0,0 to 0,0
o_downarrow.region = 0,0 to 0,0
}
//make sure the child objects are in the right locations
o_dropbutton.location = location.x+itemWidth,location.y,location.z+2
o_uparrow.location = location.x+itemWidth, location.y+itemheight, location.z+5
o_downarrow.location = location.x+itemWidth, location.y+itemheight+(itemHeight*num_displayed)-arrowHeight, location.z+5
o_thumbslider.location = location.x+itemWidth, location.y+itemheight+arrowHeight+1, location.z+4
o_thumbregiontop.location = location.x+itemWidth,location.y+itemHeight+arrowHeight,location.z+3
o_thumbregionbot.location = location.x+itemWidth,(o_thumbslider.location.y+o_thumbslider.handleheight),location.z+3
}
GUI_UNFOCUS
{
//shrinks list automatically, if another object is focused (being used)
if (droppedflag)
mail(-1,this)
}
GUI_ACTIVATE
{
activate(o_dropbutton)
// activate(o_uparrow)
// activate(o_downarrow)
// activate(o_thumbslider)
// activate(o_thumbregiontop)
// activate(o_thumbregionbot)
}
GUI_DEACTIVATE
{
deactivate(o_dropbutton)
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
}
LBUTTON_UPDATE
{
if (list_size > 0)
{
if (mouse.left == BUTTON_CLICKED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
if droppedflag //if list is dropped, pass the lit item to select
{
mail(lit,this)
}
else //else drop the list
{
mail(-1,this)
}
focus(this)
}
}
}
}
REGION_ENTERED
{
if (nRollover)
{
oRollover.nHelpID = nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(id, @infobox@)
}
over_me = true
}
REGION_EXITED
{
if (nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
if exists(@infobox@)
{
mail(-1, @infobox@)
}
over_me = false
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
//toggles dropping the list to closing it!
if (sender == this || sender == o_dropbutton)
{
if (getmessage() == -1)
{
if (droppedflag)
{
region = 0,0 to itemWidth+buttonwidth,itemHeight
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight
o_dropbutton.location.z = location.z+2
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
}
else
{
if list_size > 0
{
if list_size <= max_displayed
region = 0,itemHeight to itemWidth+buttonwidth,itemHeight*(num_displayed+1)
else
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
o_dropbutton.region = 0-itemwidth-location.x,0-location.y to getresx()-o_dropbutton.location.x,getresy()-o_dropbutton.location.y
o_dropbutton.location.z = location.z-1
activate(o_uparrow)
activate(o_downarrow)
activate(o_thumbslider)
activate(o_thumbregiontop)
activate(o_thumbregionbot)
lit = top_of_list
}
}
droppedflag = !droppedflag
if (droppedflag)
{
location.z = location.z + 5
o_uparrow.location.z = o_uparrow.location.z +5
o_downarrow.location.z = o_downarrow.location.z +5
o_thumbslider.location.z = o_thumbslider.location.z +5
o_thumbregiontop.location.z = o_thumbregiontop.location.z +5
o_thumbregionbot.location.z = o_thumbregionbot.location.z +5
}
else
{
location.z = location.z - 5
o_uparrow.location.z = o_uparrow.location.z -5
o_downarrow.location.z = o_downarrow.location.z -5
o_thumbslider.location.z = o_thumbslider.location.z -5
o_thumbregiontop.location.z = o_thumbregiontop.location.z -5
o_thumbregionbot.location.z = o_thumbregionbot.location.z -5
}
}
else
{
nSelected = lit
mail(-1,this)
mail(nselected)
}
}
//up button pressed
if (sender == o_uparrow)
{
if (top_of_list > 0)
{
top_of_list--
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslider)
}
if (sender == o_downarrow)
{
if (top_of_list < list_size-num_displayed)
{
top_of_list++
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslider)
}
if (sender == o_thumbslider)
{
if getmessage() < (location.y+itemHeight+arrowHeight+1)
o_thumbslider.location.y = location.y+itemHeight+arrowHeight+1
if getmessage() > (location.y+(itemHeight*(num_displayed+1))-arrowHeight-(o_thumbslider.handleheight))-1
o_thumbslider.location.y = (location.y+(itemHeight*(num_displayed+1))-arrowHeight-1-o_thumbslider.handleheight)
//1.) find out how many pixels from the top of the thumbslider region
//2.) calc total pixels to move thumbslider/calc num of items-num being drawn (to prevent any empty spaces)
//3.) find top item by taking the total area of pixels/num of pixels for one step (or scroll)
float tmp = (o_thumbslider.location.y) - (location.y+itemHeight+arrowHeight+1)
o_thumbslider.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslider.handleheight)-2) / (list_size-num_displayed)
float tmp_top_of_list = tmp/o_thumbslider.step_height
top_of_list = tmp_top_of_list
if top_of_list > list_size-num_displayed
{
top_of_list = list_size-num_displayed
}
}
if (sender == o_thumbregiontop)
{
if (top_of_list-(num_displayed-1) >= 0)
{
top_of_list = top_of_list-(num_displayed-1)
}
else
{
top_of_list = 0
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslider)
}
if (sender == o_thumbregionbot)
{
if (top_of_list+(num_displayed-1) < list_size-num_displayed)
{
top_of_list = top_of_list+(num_displayed-1)
}
else
{
top_of_list = list_size-num_displayed
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslider)
}
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit > top_of_list
{
if lit <= (top_of_list+num_displayed-1) //if the lit box is visible to user, move;
{
lit = lit-1
mail(0,o_thumbslider)
}
else
{
lit = lit-1
top_of_list = lit-(num_displayed-1) //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslider)
}
}
else
{
if top_of_list > 0 //scrolls the list box when the lit box hits top
{
top_of_list--
lit = top_of_list
mail(0, o_thumbslider)
}
}
}
else
{
if (0 < nSelected)
{
nSelected = nSelected - 1
mail(nselected)
}
}
focus(this)
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit < (top_of_list + num_displayed-1)
{
if lit >= top_of_list //if the lit box is visible to user, move
{
lit = lit+1
mail(0,o_thumbslider)
}
else
{
lit = lit+1
top_of_list = lit //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslider)
}
}
else
{
if (top_of_list < list_size-num_displayed) //scrolls the list box when the lit box hits bottom
{
top_of_list++
lit = top_of_list + num_displayed-1
mail(0, o_thumbslider)
}
}
}
else
{
if (nSelected + 1 < list_size)
{
nSelected = nSelected + 1
mail(nselected)
}
}
focus(this)
}
key = getchar()
if key == char("\n") //enter is pressed to select the current lit item
{
mail(lit,this)
}
// tab section if you have our GOS Script tab routine
if (key == 9) //9 is the value of a tab
{
mail(M_TABEVENT,parent)
}
}
GUI_EXECUTE
{
// compute lit items the pointer is floating over
if (over_me && mouse.x < location.x+itemWidth)
{
if (mouse_capture.y != mouse.y)
{
lit = top_of_list + ((mouse.y - (location.y+itemheight)) / itemheight)
if (lit > (list_size-1))
lit = -1
}
}
//resize negative space thumbslider regions ALWAYS
o_thumbregiontop.region = 0,0 to buttonWidth, (o_thumbslider.location.y-o_thumbregiontop.location.y)
o_thumbregionbot.location.y = (o_thumbslider.location.y+o_thumbslider.handleheight)
o_thumbregionbot.region = 0,0 to buttonWidth, (o_downarrow.location.y-3)-(o_thumbslider.location.y+o_thumbslider.handleheight))
mouse_capture = mouse.x,mouse.y
if exists(@chassis@)
{
if parent == o_newmech
{
if droppedflag == true
{
int help_id = 170 + lit
mail(help_id, @infobox@)
}
}
}
}
GUI_DRAW
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,itemheight
setpencolor(borderColor)
drawline location.x, location.y to location.x + itemwidth, location.y
drawline location.x, location.y to location.x, location.y + itemheight
setpencolor(shadowcolor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x + itemwidth, location.y to location.x + itemwidth, location.y + itemheight
// draw the list
if (droppedflag)
{
// draw background box
setpencolor(backColor)
ldrawrect 0,itemheight to itemwidth,((num_displayed+1)*(itemheight))
setpencolor(borderColor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x, location.y + itemheight to location.x, location.y + ((num_displayed+1)*(itemheight))
setpencolor(shadowcolor)
drawline location.x, location.y + ((num_displayed+1)*(itemheight)) to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
drawline location.x + itemwidth, location.y + itemheight to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
//Prints list itself
lprint3d_margins = 0,0 to itemWidth+2,(itemHeight*(num_displayed+1))+2
int line= 1
for(int i=top_of_list; i < ((top_of_list)+num_displayed); i++) //line by line, print all options displayed
{
print3d_attributes = boxFont3d, boxtextcolor, 1,0,1,0,0
//prints highlighted box
if (lit == i)
{
//if you want, you may color the text
//print3d_attributes = boxFont3d, itemhighlightcolor, 1,0,1,0,0 //IF YOU WANT TO CHANGE TEXT COLOR WITH HIGHLIGHT
setpencolor(boxhighlightcolor)
ldrawrect 1, (line*itemheight) to itemwidth, ((line+1)*itemheight)
}
//changes color of text for the previous item selected
if (nSelected == i)
{
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
}
lprint3d_position = 5, (line*itemheight) + ((itemHeight/2) - (getprint3dheight("text")/2)) //set the position for the print
if (length$(list_item[i]) > 0) //checks is there is anything to print
{
print3d list_item[i] //prints the next item
}
line ++
if line > list_size // if the line number ever attempts to pass up the list_size, it exits the print loop
{
break
}
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawrect 1,1 to itemwidth-1,itemheight-1
}
//prints current item selected in the the top box
lprint3d_margins = 0,0 to itemwidth, itemheight+2
print3d_attributes = boxFont3D, boxTextColor,1,0,1,0,0
lprint3d_position = 5, (itemHeight/2) - (getprint3dheight("text")/2)
print3d list_item[nSelected]
print3d_margins = 0,0 to 800,600
//Use for an optional label for the top of box
if length$(label)
{
print3d_attributes = labelFont3D, labelTextColor,1,0,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+2),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
//INITIALIZE MUST BE CALLED
s_dropbutton
{
GUI_CREATE
{
region = 0,0 to 0,0 //MUST BE INITIALIZED
float nButtonWidth = 0
float nButtonHeight = 0
pane p_droparrow = WPATH "DropList_arrowup.tga" //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!
float offsetx = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
float offsety = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
framerate = 30
}
GUI_INIT
{
nButtonWidth = getWidth(p_droparrow) //parent.itemHeight //uses the pane's dimensions
nButtonHeight = getHeight(p_droparrow) //
offsetx = (parent.buttonWidth-nButtonWidth)/2
offsety = (parent.itemHeight-nButtonHeight)/2
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
focus(parent) //toggles list down/up
mail(-1)
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(parent.id, @infobox@)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
GUI_DRAW
{
if (parent.droppedflag) && (parent.list_size > 0)
{
setpencolor(parent.shadowcolor)
ldrawrect 0, 0 to parent.buttonwidth, parent.itemheight
}
else
{
setpencolor(parent.facecolor)
ldrawrect 0, 0 to parent.buttonwidth, parent.itemheight
}
render p_droparrow, location.x + offsetx, location.y + offsety
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonwidth, location.y
drawline location.x, location.y + 1 to location.x, (location.y + parent.itemheight) - 1
setpencolor(parent.shadowColor)
drawline location.x + parent.buttonwidth, location.y + 1 to location.x + parent.buttonwidth, location.y + parent.itemheight
drawline location.x, location.y + parent.itemheight to location.x + parent.buttonwidth, location.y + parent.itemheight
}
}
s_arrow
{
GUI_CREATE
{
int up = true //this object is used for either the up or down arrow; this is the flag so it knows
int timeToMove //created to store a delay value for button presses
float offsety //keeps arrow in center
float offsetx
// pane p_arrowup // if you choose to us bitmaps for the arrows
// pane p_arrowdown
framerate = 10
}
GUI_INIT
{
offsety = ((parent.arrowHeight-6)/2)+1
offsetx = ((parent.buttonWidth-12)/2)+1
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(parent.id, @infobox@)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25,25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_listbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 5, 5/60 of a second to wait after mouse button has been held down
}
}
}
GUI_EXECUTE
{
}
GUI_DRAW
{
// draw background
setpencolor(parent.facecolor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y to location.x, location.y + parent.arrowheight
setpencolor(parent.shadowcolor)
drawline location.x + parent.buttonWidth, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y + parent.arrowheight to location.x + parent.buttonWidth, location.y + parent.arrowheight
setpencolor(0, 0, 0, 255)
if up == true
{
//render p_arrowup, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+5+offsetx,location.y-1+offsety to location.x+6+offsetx,location.y-1+offsety
drawline location.x+4+offsetx,location.y+offsety to location.x+7+offsetx,location.y+offsety
drawline location.x+3+offsetx,location.y+1+offsety to location.x+8+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+1+offsetx,location.y+3+offsety to location.x+10+offsetx,location.y+3+offsety
drawline location.x+offsetx,location.y+4+offsety to location.x+11+offsetx,location.y+4+offsety
}
else
{
//render p_arrowdown, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+offsetx,location.y+offsety to location.x+11+offsetx,location.y+offsety
drawline location.x+1+offsetx,location.y+1+offsety to location.x+10+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+3+offsetx,location.y+3+offsety to location.x+8+offsetx,location.y+3+offsety
drawline location.x+4+offsetx,location.y+4+offsety to location.x+7+offsetx,location.y+4+offsety
drawline location.x+5+offsetx,location.y+5+offsety to location.x+6+offsetx,location.y+5+offsety
}
}
}
s_thumbslide // resizing handle
{
GUI_CREATE
{
float handleheight // this is very important for calculating behaviours
float step_height // float for the math part of thumbslider
float result // float to get the finished valuse to add to location
int thumb_pressed = false // was this slider pressed with left mouse button variable
}
GUI_MAILBOX
{
// the list top may have changed, recompute location
if sender.list_size <= sender.max_displayed //if the list doesn't go past the max_diplayed, there is no need to slide
{
location.y = (sender.location.y+sender.itemHeight+parent.arrowHeight+1)
}
else
{
if sender.top_of_list == sender.list_size-sender.num_displayed //if we are at the bottm of the list box, make sure that it's lined up against the down button correctly
{
location.y = sender.location.y+(sender.itemHeight*(sender.num_displayed+1))-parent.arrowHeight-handleheight-1
}
else //position formula = 1.) calc the size of the thumslider area/calc num of steps to slide = the pixel height of a single step 2.) calc the location of the very top of thumbslider 3.) add to the location the result of top_of_list times the step height
{
step_height = ((sender.itemHeight*sender.num_displayed)-(parent.arrowHeight*2)-(handleheight)-2) / (sender.list_size-sender.num_displayed)
location.y = sender.location.y+sender.itemheight+parent.arrowHeight+1
result = (sender.top_of_list * step_height)
location.y += result
}
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED) // this keeps a glitch from happening when using the thumbregions
{
thumb_pressed = true //now we can know that the user wanted to drag the thumbslider
}
else
if thumb_pressed
{
if (mouse.left == BUTTON_HELD) // this drags the thumbslider as long as the button is held
{
location.y = mouse.y-(handleheight/2)
mail (location.y)
always_in_region = true
}
else // if anything else but held, release the thumbslider
{
always_in_region = false
thumb_pressed = false
}
}
}
GUI_DRAW
{
setpencolor(parent.backColor)
drawrect parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.bordercolor)
drawframe parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.facecolor)
drawrect location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
setpencolor(parent.framehighlightColor)
drawline location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + 1
drawline location.x + 2, location.y + 1 to location.x + 2, location.y + handleheight - 1
setpencolor(parent.shadowcolor)
drawline location.x + 2, location.y + handleheight - 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
drawline (location.x + parent.buttonWidth) - 1, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
}
}
//script for scalable invisible regions for the thumbslider negative space
s_thumbregion
{
GUI_CREATE
{
int timeToMove //created to store a delay value for button presses
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25, 25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_droplistbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 25, 5/60 of a second to wait after mouse button has been held down
}
}
}
}
@@ -0,0 +1,64 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
////////////////////////////////////////////////////////////////
// Version status control
// Author: Michael Moore (mdm@microsoft.com)
// Date: October 20th, 2000
//
// Description:
// Prints a status message indicating the current
// version of the game and the latest version with URL pointer
// if there is a newer version of the game available
//
// Creator can specify the x and y location of the message,
// as well as the font to use.
//////////////////////////////////////////////////////////////
s_versionstatus
{
GUI_CREATE
{
// member variables
int xRefPos = 0
int yRefPos = 0
string statusMess = localize$(IDS_GN_OK)
int xcolor = packcolor (180,180,180,255)
font3d f_font = FPATH localize$(IDS_F_MP_LABEL)
}
GUI_DRAW
{
//////////////////////////////
// MDM - VERSION STATUS DISPLAY //
//////////////////////////////
int x = xRefPos
int y = yRefPos
//
// MDM - THIS IS NOT YET LOCALIZED AND IS MEANT FOR DEMONSTRATION ONLY
statusMess = localize$(IDS_MP_VERSION_YOUR_VERSION) $$LocalGameVersion$$ "."
xcolor = packcolor( 160, 160, 200, 255 ) // grayish-blue
lprint3d_margins = 0, 0 to 538, 50
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = x, y
print3d statusMess
if ( callback( $$GetReferenceVersion$$ ) == 1 )
{
// there is a reference version in the list
statusMess = localize$(IDS_MP_VERSION_UPGRADE_TO) $$ReferenceVersion$$ localize$(IDS_MP_VERSION_URL)
y = y + 18
xcolor = packcolor( 200, 200, 0, 255 ) // yellow
print3d_attributes = f_font, xcolor, 1,0,1,0,0,0,1
lprint3d_position = x, y
print3d statusMess
}
}
} // s_versionstatus
@@ -0,0 +1,19 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
object o_error = o_errorscreen
o_error.error_header = ""
o_error.error_message = localize$(IDS_MP_NC_BAD_ZONEMATCH)
initialize (o_error)
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,852 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
s_droplistbox_skins
{
GUI_CREATE
{
int dlb_type = 0 // 0 - skin, 1 - team
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
font3d boxFont3d= szPATH_FONTS1 localize$(IDS_F_GEN_DROPDOWN) //MUST BE INITIALIZED
int backColor = packcolor (0, 0, 0, 255)
int controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
int labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int facecolor = packcolor (187, 187, 204, 255)
int shadowcolor = packcolor (119, 119, 119, 255)
int arrowColor = packcolor (0, 0, 0, 255)
float itemWidth = 0 //MUST BE INITIALIZED
float itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed //MUST BE INITIALIZED
int top_of_list //MUST BE INITIALIZED
int id
string label = "" //CAN BE INITIALIZED
font3d labelFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_LABEL) //MUST BE INITIALIZED
position offsetLabel = 0,-15 //CAN BE INITIALIZED
int buttonWidth = 16 //CAN BE INITIALIZED
int arrowHeight = 10 //CAN BE INITIALIZED; IT CONTROLS THE HEIGHT OF THE THUMBSLIDER ARROWS
int get_itemheight = FALSE //CAN BE INITIALIZED; FLAGS WHETHER YOU WANT TO USE THE FONTHEIGHT AS THE HEIGHT FOR EACH ITEM
//LOCAL WORK VARIABLES
int max_items = 60
int num_displayed //THE NUMBER OF ITEMS DISPLAYED INSIDE THE LIST BOX; THIS IS AFFECTED IN THE INIT
int droppedflag = false //used to toggle the list up/down
int nSelected = 0 //the current selected item from the list of items
int lit //the value of the hightlighted item (not selected)
int over_me = false //am I over the list's region?
string list_item[max_items] //--------------MAX_ITEMS MUST BE SET BY YOU.
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
position mouse_capture //used to grab the mouse position and detect whether the mouse has been moved
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_dropbutton = s_dropbutton_skins
o_dropbutton.p_droparrowup = WPATH "Droplist_arrowup.tga"
o_dropbutton.p_droparrowdn = WPATH "Droplist_arrowdown.tga"
object o_uparrow_skins = s_arrow_skins
object o_downarrow_skins = s_arrow_skins
o_downarrow_skins.up = false // identifies this as the arrow down button
object o_thumbslide_skins = s_thumbslide_skins
object o_thumbregiontop_skins = s_thumbregion_skins
object o_thumbregionbot_skins = s_thumbregion_skins
//STARTS CLOSED BY HIDING BUTTONS
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
int nRollover = 0 // A flag to set if using c_rollover
int nHelpID = -1
framerate = 30
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
region = 0,0 to itemwidth,itemheight //region to click and drop the list (scales later)
initialize (o_dropbutton)
initialize (o_uparrow_skins)
initialize (o_downarrow_skins)
// determines what size the thumslider needs to be: if it's too small, the minimum size is 15
if list_size > max_displayed
{
num_displayed = max_displayed
o_thumbslide_skins.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2) / ((list_size)/num_displayed)
o_thumbslide_skins.region = 0,-2 to buttonwidth,o_thumbslide_skins.handleheight+2
o_uparrow_skins.region = 0,0 to buttonwidth,arrowHeight
o_downarrow_skins.region = 0,0 to buttonwidth,arrowHeight
if o_thumbslide_skins.handleheight < 15
{
o_thumbslide_skins.handleheight = 15
o_thumbslide_skins.region = 0,-2 to buttonwidth,o_thumbslide_skins.handleheight+2 // o_downarrow_skins.handleheight -> o_thumbslide_skins.handleheight
}
}
else
{
num_displayed = list_size //if the number of items is less than the max size of the list, shrink the size to the number listed
o_thumbslide_skins.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2)
o_downarrow_skins.region = 0,0 to 0,0
o_uparrow_skins.region = 0,0 to 0,0
o_downarrow_skins.region = 0,0 to 0,0
}
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight //region for arrow
//make sure the child objects are in the right locations
o_dropbutton.location = location.x+itemWidth,location.y,location.z+2
o_uparrow_skins.location = location.x+itemWidth, location.y+itemheight, location.z+5
o_downarrow_skins.location = location.x+itemWidth, location.y+itemheight+(itemHeight*num_displayed)-arrowHeight, location.z+5
o_thumbslide_skins.location = location.x+itemWidth, location.y+itemheight+arrowHeight+1, location.z+4
o_thumbregiontop_skins.location = location.x+itemWidth,location.y+itemHeight+arrowHeight,location.z+3
o_thumbregionbot_skins.location = location.x+itemWidth,(o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight),location.z+3
}
GUI_UNFOCUS
{
//shrinks list automatically, if another object is focused (being used)
if (droppedflag)
mail(-1,this)
}
GUI_ACTIVATE
{
activate(o_dropbutton)
// activate(o_uparrow_skins)
// activate(o_downarrow_skins)
// activate(o_thumbslide_skins)
// activate(o_thumbregiontop_skins)
// activate(o_thumbregionbot_skins)
// droppedflag = false
}
GUI_DEACTIVATE
{
deactivate(o_dropbutton)
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
if droppedflag //if list is dropped, pass the lit item to select
{
mail(lit,this)
}
else //else drop the list
{
mail(-1,this)
}
focus(this)
}
}
}
REGION_ENTERED
{
if (nRollover)
{
oRollover.nHelpID = nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
over_me = true
}
REGION_EXITED
{
if (nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
over_me = false
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
//toggles dropping the list to closing it!
if (sender == this || sender == o_dropbutton)
{
if (getmessage() == -1)
{
if (droppedflag)
{
region = 0,0 to itemWidth,itemHeight
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight
o_dropbutton.location.z = location.z+2
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
}
else
{
if list_size > 0
{
if list_size <= max_displayed
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
else
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
o_dropbutton.region = 0-itemwidth-location.x,0-location.y to getresx()-o_dropbutton.location.x,getresy()-o_dropbutton.location.y
o_dropbutton.location.z = location.z-1
activate(o_uparrow_skins)
activate(o_downarrow_skins)
activate(o_thumbslide_skins)
activate(o_thumbregiontop_skins)
activate(o_thumbregionbot_skins)
lit = top_of_list
}
}
droppedflag = !droppedflag
if (droppedflag)
{
location.z = location.z + 5
o_uparrow_skins.location.z = o_uparrow_skins.location.z +5
o_downarrow_skins.location.z = o_downarrow_skins.location.z +5
o_thumbslide_skins.location.z = o_thumbslide_skins.location.z +5
o_thumbregiontop_skins.location.z = o_thumbregiontop_skins.location.z +5
o_thumbregionbot_skins.location.z = o_thumbregionbot_skins.location.z +5
}
else
{
location.z = location.z - 5
o_uparrow_skins.location.z = o_uparrow_skins.location.z -5
o_downarrow_skins.location.z = o_downarrow_skins.location.z -5
o_thumbslide_skins.location.z = o_thumbslide_skins.location.z -5
o_thumbregiontop_skins.location.z = o_thumbregiontop_skins.location.z -5
o_thumbregionbot_skins.location.z = o_thumbregionbot_skins.location.z -5
}
}
else
{
nSelected = lit
mail(-1,this)
mail(nselected, @conlobby@o_skin_box[id])
}
}
//up button pressed
if (sender == o_uparrow_skins)
{
if (top_of_list > 0)
{
top_of_list--
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_skins)
}
if (sender == o_downarrow_skins)
{
if (top_of_list < list_size-num_displayed)
{
top_of_list++
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_skins)
}
if (sender == o_thumbslide_skins)
{
if getmessage() < (location.y+itemHeight+arrowHeight+1)
o_thumbslide_skins.location.y = location.y+itemHeight+arrowHeight+1
if getmessage() > (location.y+(itemHeight*(num_displayed+1))-arrowHeight-(o_thumbslide_skins.handleheight))-1
o_thumbslide_skins.location.y = (location.y+(itemHeight*(num_displayed+1))-arrowHeight-1-o_thumbslide_skins.handleheight)
//1.) find out how many pixels from the top of the thumbslider region
//2.) calc total pixels to move thumbslider/calc num of items-num being drawn (to prevent any empty spaces)
//3.) find top item by taking the total area of pixels/num of pixels for one step (or scroll)
float tmp = (o_thumbslide_skins.location.y) - (location.y+itemHeight+arrowHeight+1)
o_thumbslide_skins.step_height = 0
if (list_size-num_displayed)
o_thumbslide_skins.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslide_skins.handleheight)-2) / (list_size-num_displayed)
float tmp_top_of_list = 0
if (o_thumbslide_skins.step_height)
tmp_top_of_list = tmp/o_thumbslide_skins.step_height + 0.0001
top_of_list = tmp_top_of_list
if top_of_list > list_size-num_displayed
{
top_of_list = list_size-num_displayed
}
}
if (sender == o_thumbregiontop_skins)
{
if (top_of_list-(num_displayed-1) >= 0)
{
top_of_list = top_of_list-(num_displayed-1)
}
else
{
top_of_list = 0
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_skins)
}
if (sender == o_thumbregionbot_skins)
{
if (top_of_list+(num_displayed-1) < list_size-num_displayed)
{
top_of_list = top_of_list+(num_displayed-1)
}
else
{
top_of_list = list_size-num_displayed
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_skins)
}
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit > top_of_list
{
if lit <= (top_of_list+num_displayed-1) //if the lit box is visible to user, move;
{
lit = lit-1
mail(0,o_thumbslide_skins)
}
else
{
lit = lit-1
top_of_list = lit-(num_displayed-1) //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_skins)
}
}
else
{
if top_of_list > 0 //scrolls the list box when the lit box hits top
{
top_of_list--
lit = top_of_list
mail(0, o_thumbslide_skins)
}
}
}
else
{
if (0 < nSelected)
{
nSelected = nSelected - 1
//mail(nselected)
}
}
focus(this)
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit < (top_of_list + num_displayed-1)
{
if lit >= top_of_list //if the lit box is visible to user, move;
{
lit = lit+1
mail(0,o_thumbslide_skins)
}
else
{
lit = lit+1
top_of_list = lit //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_skins)
}
}
else
{
if (top_of_list < list_size-num_displayed) //scrolls the list box when the lit box hits bottom
{
top_of_list++
lit = top_of_list + num_displayed-1
mail(0, o_thumbslide_skins)
}
}
}
else
{
if (nSelected + 1 < list_size)
{
nSelected = nSelected + 1
//mail(nselected)
}
}
focus(this)
}
key = getchar()
if key == char("\n") //enter is pressed to select the current lit item
{
mail(lit,this)
}
// tab section if you have our GOS Script tab routine
if (key == 9) //9 is the value of a tab
{
mail(M_TABEVENT,parent)
}
}
GUI_EXECUTE
{
// compute lit items the pointer is floating over
if (over_me && mouse.x < location.x+itemWidth)
{
if (mouse_capture.y != mouse.y)
{
lit = top_of_list + ((mouse.y - (location.y+itemheight)) / itemheight)
if (lit > (list_size-1))
lit = -1
}
}
//resize negative space thumbslider regions ALWAYS
o_thumbregiontop_skins.region = 0,0 to buttonWidth, (o_thumbslide_skins.location.y-o_thumbregiontop_skins.location.y)
o_thumbregionbot_skins.location.y = (o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight)
o_thumbregionbot_skins.region = 0,0 to buttonWidth, (o_thumbslide_skins.location.y-3)-(o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight))
mouse_capture = mouse.x,mouse.y
}
GUI_DRAW
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,itemheight
setpencolor(borderColor)
drawline location.x, location.y to location.x + itemwidth, location.y
drawline location.x, location.y to location.x, location.y + itemheight
setpencolor(shadowcolor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x + itemwidth, location.y to location.x + itemwidth, location.y + itemheight
// draw the list
if (droppedflag)
{
// draw background box
setpencolor(backColor)
ldrawrect 0,itemheight to itemwidth,((num_displayed+1)*(itemheight))
setpencolor(borderColor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x, location.y + itemheight to location.x, location.y + ((num_displayed+1)*(itemheight))
setpencolor(shadowcolor)
drawline location.x, location.y + ((num_displayed+1)*(itemheight)) to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
drawline location.x + itemwidth, location.y + itemheight to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
//Prints list itself
lprint3d_margins = 0,0 to itemWidth+2,(itemHeight*(num_displayed+1))+2
int line= 1
for(int i=top_of_list; i < ((top_of_list)+num_displayed); i++) //line by line, print all options displayed
{
print3d_attributes = boxFont3d, boxtextcolor, 1,0,1,0,0
//prints highlighted box
if (lit == i)
{
//if you want, you may color the text
//print3d_attributes = boxFont3d, itemhighlightcolor, 1,0,1,0,0 //IF YOU WANT TO CHANGE TEXT COLOR WITH HIGHLIGHT
setpencolor(boxhighlightcolor)
ldrawrect 1, (line*itemheight) to itemwidth, ((line+1)*itemheight)
}
//changes color of text for the previous item selected
if (nSelected == i)
{
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
}
lprint3d_position = 5, (line*itemheight) + ((itemHeight/2) - (getprint3dheight("text")/2)) //set the position for the print
if (length$(list_item[i]) > 0) //checks is there is anything to print
{
print3d list_item[i] //prints the next item
}
line ++
if line > list_size // if the line number ever attempts to pass up the list_size, it exits the print loop
{
break
}
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawrect 1,1 to itemwidth -1,itemheight-1
}
//prints current item selected in the the top box
lprint3d_margins = 0,0 to itemwidth, itemheight+2
print3d_attributes = boxFont3D, boxTextColor,1,0,1,0,0
lprint3d_position = 5, (itemHeight/2) - (getprint3dheight("text")/2)
if nSelected > -1
print3d list_item[nSelected]
print3d_margins = 0,0 to 800,600
//Use for an optional label for the top of box
if length$(label)
{
print3d_attributes = labelFont3D, labelTextColor,1,0,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+2),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
//INITIALIZE MUST BE CALLED
s_dropbutton_skins
{
GUI_CREATE
{
region = 0,0 to 0,0 //MUST BE INITIALIZED
float nButtonWidth = 0
float nButtonHeight = 0
pane p_droparrowup //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!
pane p_droparrowdn //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!!!
float offsetx = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
float offsety = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
framerate = 30
}
GUI_INIT
{
nButtonWidth = getWidth(p_droparrowup) //parent.itemHeight //uses the pane's dimensions
nButtonHeight = getHeight(p_droparrowup) //
offsetx = (parent.buttonWidth-nButtonWidth)/2
offsety = (parent.itemHeight-nButtonHeight)/2
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
focus(parent) //toggles list down/up
mail(-1)
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
GUI_DRAW
{
// draw background
// setpencolor(parent.controlbackColor)
// drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// draw border
// setpencolor(parent.borderColor)
// drawframe location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// display arrow; two panes(images are used for the states of the list)
// if (parent.droppedflag)
// render p_droparrowup, location.x+offsetx,location.y+offsety
// else
// render p_droparrowdn, location.x+offsetx,location.y+offsety
}
}
s_arrow_skins
{
GUI_CREATE
{
int up = true //this object is used for either the up or down arrow; this is the flag so it knows
int timeToMove //created to store a delay value for button presses
float offsety //keeps arrow in center
float offsetx
// pane p_arrowup // if you choose to us bitmaps for the arrows
// pane p_arrowdown
framerate = 10
}
GUI_INIT
{
offsety = ((parent.arrowHeight-6)/2)+1
offsetx = ((parent.buttonWidth-12)/2)+1
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25,25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_listbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 5, 5/60 of a second to wait after mouse button has been held down
}
}
}
GUI_EXECUTE
{
}
GUI_DRAW
{
// draw background
setpencolor(parent.facecolor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y to location.x, location.y + parent.arrowheight
setpencolor(parent.shadowcolor)
drawline location.x + parent.buttonWidth, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y + parent.arrowheight to location.x + parent.buttonWidth, location.y + parent.arrowheight
setpencolor(0, 0, 0, 255)
if up == true
{
//render p_arrowup, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+5+offsetx,location.y-1+offsety to location.x+6+offsetx,location.y-1+offsety
drawline location.x+4+offsetx,location.y+offsety to location.x+7+offsetx,location.y+offsety
drawline location.x+3+offsetx,location.y+1+offsety to location.x+8+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+1+offsetx,location.y+3+offsety to location.x+10+offsetx,location.y+3+offsety
drawline location.x+offsetx,location.y+4+offsety to location.x+11+offsetx,location.y+4+offsety
}
else
{
//render p_arrowdown, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+offsetx,location.y+offsety to location.x+11+offsetx,location.y+offsety
drawline location.x+1+offsetx,location.y+1+offsety to location.x+10+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+3+offsetx,location.y+3+offsety to location.x+8+offsetx,location.y+3+offsety
drawline location.x+4+offsetx,location.y+4+offsety to location.x+7+offsetx,location.y+4+offsety
drawline location.x+5+offsetx,location.y+5+offsety to location.x+6+offsetx,location.y+5+offsety
}
}
}
s_thumbslide_skins // resizing handle
{
GUI_CREATE
{
float handleheight // this is very important for calculating behaviours
float step_height // float for the math part of thumbslider
float result // float to get the finished valuse to add to location
int thumb_pressed = false // was this slider pressed with left mouse button variable
}
GUI_MAILBOX
{
// the list top may have changed, recompute location
if sender.list_size <= sender.max_displayed //if the list doesn't go past the max_diplayed, there is no need to slide
{
location.y = (sender.location.y+sender.itemHeight+parent.arrowHeight+1)
}
else
{
if sender.top_of_list == sender.list_size-sender.num_displayed //if we are at the bottm of the list box, make sure that it's lined up against the down button correctly
{
location.y = sender.location.y+(sender.itemHeight*(sender.num_displayed+1))-parent.arrowHeight-handleheight-1
}
else //position formula = 1.) calc the size of the thumslider area/calc num of steps to slide = the pixel height of a single step 2.) calc the location of the very top of thumbslider 3.) add to the location the result of top_of_list times the step height
{
step_height = ((sender.itemHeight*sender.num_displayed)-(parent.arrowHeight*2)-(handleheight)-2) / (sender.list_size-sender.num_displayed)
location.y = sender.location.y+sender.itemheight+parent.arrowHeight+1
result = (sender.top_of_list * step_height)
location.y += result
}
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED) // this keeps a glitch from happening when using the thumbregions
{
thumb_pressed = true //now we can know that the user wanted to drag the thumbslider
}
else
if thumb_pressed
{
if (mouse.left == BUTTON_HELD) // this drags the thumbslider as long as the button is held
{
location.y = mouse.y-(handleheight/2)
mail (location.y)
always_in_region = true
}
else // if anything else but held, release the thumbslider
{
always_in_region = false
thumb_pressed = false
}
}
}
GUI_DRAW
{
setpencolor(parent.backColor)
drawrect parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.bordercolor)
drawframe parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.facecolor)
drawrect location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
setpencolor(parent.framehighlightColor)
drawline location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + 1
drawline location.x + 2, location.y + 1 to location.x + 2, location.y + handleheight - 1
setpencolor(parent.shadowcolor)
drawline location.x + 2, location.y + handleheight - 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
drawline (location.x + parent.buttonWidth) - 1, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
}
}
//script for scalable invisible regions for the thumbslider negative space
s_thumbregion_skins
{
GUI_CREATE
{
int timeToMove //created to store a delay value for button presses
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25, 25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_droplistbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 25, 5/60 of a second to wait after mouse button has been held down
}
}
}
}
@@ -0,0 +1,651 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\listboxes.script"
#include "Content\\ShellScripts\\editbox.script"
main
{
GUI_CREATE
{
font3d regfont = FPATH localize$(IDS_F_MP_LABEL)
font3d boldfont = FPATH localize$(IDS_F_ML_DATA)
int MAX_GAME_TYPES = 30
int custom_to_standard[MAX_GAME_TYPES]
location = (getresx() / 2) - 250, 125, 0
region = -140,-80 to getresx(),getresy()
font3d text3d = FPATH localize$(IDS_F_MP_LABEL)
//---------------------------------------------------
object o_ok = s_multistatepane
o_ok.total_states = 4
o_ok.state = 0
o_ok.textsize = 1
o_ok.text = localize$(IDS_GN_OK)
o_ok.file = WPATH "button_reg_138x23m_4state.tga"
o_ok.location = location.x + 25, location.y + 250, 10
initialize(o_ok)
object o_clear = s_multistatepane
o_clear.total_states = 4
o_clear.textsize = 1
o_clear.text = localize$(IDS_MP_FILT_CLEAR)
o_clear.file = WPATH "button_reg_138x23m_4state.tga"
o_clear.location = (getresx() / 2) - 71, location.y + 250, 10
initialize(o_clear)
object o_cancel = s_multistatepane
o_cancel.total_states = 3
o_cancel.textsize = 1
o_cancel.text = localize$(IDS_GN_CANCEL)
o_cancel.file = WPATH "button_reg_138x23m_3state.tga"
o_cancel.location = location.x + 334, location.y + 250, 10
initialize(o_cancel)
//---------------------------------------------------
object o_ping_less_than = s_checkbox
o_ping_less_than.file = WPATH "checkbox_15x15_3state.tga"
o_ping_less_than.total_states = 3
o_ping_less_than.location = location.x + 27, location.y + 155, location.z+10
o_ping_less_than.text = localize$(IDS_MP_FILT_PINGLESS)
if ( callback( $$GetFilterParam$$, "pingon" ) == 1 )
{
o_ping_less_than.state = 2
}
else
{
o_ping_less_than.state = 0
}
initialize(o_ping_less_than)
//------------------------------------------------------
// object o_ping_enabler = ping_enabler
// o_ping_enabler.location = o_ping_less_than.location.x+30,o_ping_less_than.location.y+20,50
//-----------------------------------------------------
int MAX_ITEMS = 40
object o_ping = s_droplistbox
o_ping.location = getresx() / 2, o_ping_less_than.location.y, location.z + 5
o_ping.list_size = 7
o_ping.label = localize$(IDS_MP_FILT_MILLISECONDS)
o_ping.itemWidth = 60
o_ping.max_displayed = 6
o_ping.boxFont3d = FPATH localize$(IDS_F_MP_LABEL)
o_ping.itemHeight = 20
o_ping.labelFont3d = FPATH localize$(IDS_F_MP_LABEL)
o_ping.offsetLabel = 80,3
o_ping.arrowHeight = 15
o_ping.list_item[0] = "100"
o_ping.list_item[1] = "200"
o_ping.list_item[2] = "300"
o_ping.list_item[3] = "400"
o_ping.list_item[4] = "500"
o_ping.list_item[5] = "800"
o_ping.list_item[6] = "1000"
int fping = callback( $$GetFilterParam$$, "ping" )
if ( fping <= 100 && fping > 0 )
{
o_ping.nSelected = 0
}
else
if ( fping <= 200 )
{
o_ping.nSelected = 1
}
else
if ( fping <= 300 )
{
o_ping.nSelected = 2
}
else
if ( fping <= 400 )
{
o_ping.nSelected = 3
}
else
if ( fping <= 500 )
{
o_ping.nSelected = 4
}
else
if ( fping <= 800 )
{
o_ping.nSelected = 5
}
else
if ( fping <= 1000 )
{
o_ping.nSelected = 6
}
else
{
o_ping.nSelected = 2 // default is 300 ms.
}
initialize(o_ping)
//---------------------------------------------------
object o_can_join = s_checkbox
o_can_join.file = WPATH "checkbox_15x15_3state.tga"
o_can_join.total_states = 3
o_can_join.location = location.x + 27, location.y + 215,location.z+10
o_can_join.text = localize$(IDS_MP_FILT_AVAIL)
if ( callback( $$GetFilterParam$$, "availableon") == 1 )
{
o_can_join.state = 2
}
else
{
o_can_join.state = 0
}
initialize(o_can_join)
//-----------------------------------------------------
object o_people_playing = s_checkbox
o_people_playing.file = WPATH "checkbox_15x15_3state.tga"
o_people_playing.total_states = 3
o_people_playing.location = location.x + 27, location.y + 185, location.z + 5
o_people_playing.text = localize$(IDS_MP_FILT_1ORMORE)
if ( callback( $$GetFilterParam$$, "activeon" ) == 1 )
{
o_people_playing.state = 2
}
else
{
o_people_playing.state = 0
}
initialize(o_people_playing)
//-----------------------------------------------------
object o_game_type = s_checkbox
o_game_type.file = WPATH "checkbox_15x15_3state.tga"
o_game_type.total_states = 3
o_game_type.location = location.x + 27, location.y + 125, location.z + 5
o_game_type.text = localize$(IDS_MP_FILT_GAMETYPE)
if ( callback( $$GetFilterParam$$, "gametypeon" ) == 1 )
{
o_game_type.state = 2
}
else
{
o_game_type.state = 0
}
initialize(o_game_type)
//-----------------------------------------------------
object o_game_type_list = s_droplistbox
o_game_type_list.location = getresx() / 2, o_game_type.location.y, location.z + 20
o_game_type_list.list_size = $$kldi30$$
o_game_type_list.label = ""
o_game_type_list.itemWidth = 205
o_game_type_list.max_displayed = 7
o_game_type_list.boxFont3d = FPATH localize$(IDS_F_MP_LABEL)
o_game_type_list.itemHeight = 20
o_game_type_list.labelFont3d = FPATH localize$(IDS_F_MP_LABEL)
o_game_type_list.offsetLabel = 0,-15
o_game_type_list.arrowHeight = 15
// fill in the game type list (should be programatically, but right now its hard-wired :( by the scripting guys)
int gtlsize = 0
callback( $$GetGameTypeString$$, 0, 2 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 3 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 0 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 1 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 4 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 5 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 6 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 8 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 11 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 13 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 14 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 15 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 16 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 17 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 18 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 19 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 21 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 24 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
callback( $$GetGameTypeString$$, 0, 26 )
o_game_type_list.list_item[gtlsize] = $$m_gameTypeStr$$
gtlsize++
custom_to_standard[0] = 2
custom_to_standard[1] = 3
custom_to_standard[2] = 0
custom_to_standard[3] = 1
custom_to_standard[4] = 4
custom_to_standard[5] = 5
custom_to_standard[6] = 6
custom_to_standard[7] = 8
custom_to_standard[8] = 11
custom_to_standard[9] = 13
custom_to_standard[10] = 14
custom_to_standard[11] = 15
custom_to_standard[12] = 16
custom_to_standard[13] = 17
custom_to_standard[14] = 18
custom_to_standard[15] = 19
custom_to_standard[16] = 21
custom_to_standard[17] = 24
custom_to_standard[18] = 26
for ( int csindex = 19; csindex < MAX_GAME_TYPES; csindex++)
{
custom_to_standard[csindex] = 99999 // invalid value
}
o_game_type_list.list_size = gtlsize
// select the appropriate default
callback( $$ApplyFilters$$ )
// set the default selection appropriately
o_game_type_list.nSelected = 0
callback( $$GetFilterParam$$, "gametype")
int gtindex = callback($$GetGameTypeFromString$$, $$FilterParamVal$$ )
if ( gtindex >= 0 )
{
csIndex = 0
while (csIndex < MAX_GAME_TYPES)
{
if ( custom_to_standard[csIndex] == gtindex )
{
o_game_type_list.nSelected = csIndex
}
csIndex++
}
}
initialize(o_game_type_list)
//---------------------------------------------------
mail(0,this)
//-----------------------------------------------------
// variables for fading in and out
int alpha_val = 5
int fadeout = false // variables for fading in and out
//-----------------------------------------------------
pane p_background = GPATH "dialog_500x300m.tga"
framerate = 30
}
GUI_MAILBOX
{
if o_ping_less_than.state != 2
{
o_ping.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_ping.controlbackColor = packcolor(255,255,255,128) //128 //CAN BE INITIALIZED
o_ping.borderColor = packcolor (255,255,255,100)
o_ping.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor(255,255,255,100) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_ping.facecolor = packcolor (187, 187, 204, 100)
o_ping.location.z = location.z+10
o_ping.o_dropbutton.region = 0,0 to 0,0
o_ping.region = 0,0 to 0,0
}
else
{
o_ping.backColor = packcolor (0, 0, 0, 255)
o_ping.controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
o_ping.framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
o_ping.boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
o_ping.boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.facecolor = packcolor (187, 187, 204, 255)
o_ping.shadowcolor = packcolor (119, 119, 119, 255)
o_ping.arrowColor = packcolor (0, 0, 0, 255)
o_ping.location.z = 90
initialize(o_ping)
}
if o_game_type.state != 2
{
o_game_type_list.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_game_type_list.controlbackColor = packcolor(255,255,255,128) //128 //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (255,255,255,100)
o_game_type_list.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor(255,255,255,100) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_game_type_list.facecolor = packcolor (187, 187, 204, 100)
o_game_type_list.o_dropbutton.region = 0,0 to 0,0
o_game_type_list.region = 0,0 to 0,0
if gotfocus(o_game_type_list) == true
{
unfocus(o_game_type_list)
}
}
else
{
o_game_type_list.backColor = packcolor (0, 0, 0, 255)
o_game_type_list.controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
o_game_type_list.framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
o_game_type_list.boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
o_game_type_list.boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.facecolor = packcolor (187, 187, 204, 255)
o_game_type_list.shadowcolor = packcolor (119, 119, 119, 255)
o_game_type_list.arrowColor = packcolor (0, 0, 0, 255)
o_game_type_list.location.z = 110
initialize(o_game_type_list)
}
if sender == o_OK
{
if o_ping_less_than.state == 2
callback( $$SetFilterParam$$, "pingon", 1 )
else
callback( $$SetFilterParam$$, "pingon", 0 )
if o_can_join.state == 2
callback( $$SetFilterParam$$, "availableon", 1 )
else
callback( $$SetFilterParam$$, "availableon", 0 )
if o_people_playing.state == 2
callback( $$SetFilterParam$$, "activeon", 1 )
else
callback( $$SetFilterParam$$, "activeon", 0 )
if o_game_type.state == 2
callback( $$SetFilterParam$$, "gametypeon", 1 )
else
callback( $$SetFilterParam$$, "gametypeon", 0 )
// pull values out of drop listboxes:
if ( o_ping.nSelected >= 0 )
{
callback( $$SetFilterParam$$, "ping", o_ping.list_item[ o_ping.nSelected ] )
}
else
{
callback( $$SetFilterParam$$, "ping", 0 )
}
if ( o_game_type_list.nSelected >= 0 )
{
callback( $$SetFilterParam$$, "gametype", o_game_type_list.list_item[ o_game_type_list.nSelected ] )
}
else
{
callback( $$SetFilterParam$$, "gametype", 0 )
}
callback( $$ApplyFilters$$ )
callback( $$SaveFilters$$ )
@ListofGames@o_list_of_servers.top_of_list = 0
mail(-1,@ListofGames@o_list_of_servers.o_thumbslider) // puts thumbslider at top
script_end
}
if sender == o_cancel
{
// callback( $$RevertFilters$$ )
script_end
}
if sender == o_clear
{
mail (1,o_ping_less_than)
mail (1,o_can_join)
mail (1,o_people_playing)
mail (1,o_game_type)
o_ping.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_ping.controlbackColor = packcolor(255,255,255,128) //128 //CAN BE INITIALIZED
o_ping.borderColor = packcolor (255,255,255,100)
o_ping.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor(255,255,255,100) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_ping.facecolor = packcolor (187, 187, 204, 100)
o_ping.location.z = location.z+10
o_game_type_list.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_game_type_list.controlbackColor = packcolor(255,255,255,128) //128 //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (255,255,255,100)
o_game_type_list.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor(255,255,255,100) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_game_type_list.facecolor = packcolor (187, 187, 204, 100)
o_game_type_list.o_dropbutton.region = 0,0 to 0,0
o_game_type_list.region = 0,0 to 0,0
if gotfocus(o_game_type_list) == true
{
unfocus(o_game_type_list)
}
o_ping.o_dropbutton.region = 0,0 to 0,0
o_ping.region = 0,0 to 0,0
}
}
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
}
}
}
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)
{
render p_background, location.x, location.y, 0
print3d_attributes = boldfont,packcolor(255,255,255,255),1,1,1,0,0,just_center
lprint3d_margins = 0,8 to 500,30
lprint3d_position = 0,8
print3d localize$(IDS_MP_FILT_TITLE)
print3d_attributes = regfont,packcolor(255,255,255,255),1,1,1,0,0
lprint3d_margins = 27,50 to 473,100
lprint3d_position = 27,50
print3d localize$(IDS_MP_FILT_SHOW_SERVER)
}
}
}
background
{
GUI_CREATE
{
location = parent.location
}
GUI_DRAW
{
setpencolor(0,0,0,255)
ldrawrect 0,0 to 550,360
}
}
ping_enabler
{
GUI_CREATE
{
framerate = 30
}
GUI_EXECUTE
{
if o_ping_less_than.state != 2
{
o_ping.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_ping.borderColor = packcolor (100,100,255,100)
o_ping.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor(100,255,255,100) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_ping.frameHighlightColor = packcolor(0,0,255,128)
region = 0,0 to 220,20
if gotfocus(o_ping) == true
unfocus(o_ping)
}
else
{
o_ping.backColor = packcolor (0, 0, 0, 255)
o_ping.controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
o_ping.framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
o_ping.boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
o_ping.boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
o_ping.labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_ping.facecolor = packcolor (187, 187, 204, 255)
o_ping.shadowcolor = packcolor (119, 119, 119, 255)
o_ping.arrowColor = packcolor (0, 0, 0, 255)
region = 0,0 to 0,0
}
}
}
game_type_enabler
{
GUI_CREATE
{
framerate = 30
}
GUI_EXECUTE
{
if o_game_type.state != 2
{
o_game_type_list.backColor = packcolor(0,0,0,30) //128 //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (100,100,255,100)
o_game_type_list.boxTextColor = PACKCOLOR(200,200,200,100) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor(100,255,255,100) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor(200,200,255,100) //CAN BE INITIALIZED
o_game_type_list.frameHighlightColor = packcolor(0,0,255,128)
o_game_type_list.location.z = parent.location.z+10
region = 0,0 to 220,20
if gotfocus(o_game_type_list) == true
{
unfocus(o_game_type_list)
}
}
else
{
o_game_type_list.backColor = packcolor (0, 0, 0, 255)
o_game_type_list.controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
o_game_type_list.framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
o_game_type_list.boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
o_game_type_list.boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
o_game_type_list.labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
o_game_type_list.facecolor = packcolor (187, 187, 204, 255)
o_game_type_list.shadowcolor = packcolor (119, 119, 119, 255)
o_game_type_list.arrowColor = packcolor (0, 0, 0, 255)
o_game_type_list.location.z = 110
region = 0,0 to 0,0
}
}
}
@@ -0,0 +1,910 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
s_droplistbox_lobby
{
GUI_CREATE
{
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
font3d boxFont3d= szPATH_FONTS1 localize$(IDS_F_GEN_DROPDOWN) //MUST BE INITIALIZED
int backColor = packcolor (0, 0, 0, 255)
int controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
int labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int facecolor = packcolor (187, 187, 204, 255)
int shadowcolor = packcolor (119, 119, 119, 255)
int arrowColor = packcolor (0, 0, 0, 255)
float itemWidth = 0 //MUST BE INITIALIZED
float itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed //MUST BE INITIALIZED
int top_of_list //MUST BE INITIALIZED
int id
string label = "" //CAN BE INITIALIZED
font3d labelFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_LABEL) //MUST BE INITIALIZED
position offsetLabel = 0,-15 //CAN BE INITIALIZED
int buttonWidth = 16 //CAN BE INITIALIZED
int arrowHeight = 10 //CAN BE INITIALIZED; IT CONTROLS THE HEIGHT OF THE THUMBSLIDER ARROWS
int get_itemheight = FALSE //CAN BE INITIALIZED; FLAGS WHETHER YOU WANT TO USE THE FONTHEIGHT AS THE HEIGHT FOR EACH ITEM
//LOCAL WORK VARIABLES
int max_items = 60
int num_displayed //THE NUMBER OF ITEMS DISPLAYED INSIDE THE LIST BOX; THIS IS AFFECTED IN THE INIT
int droppedflag = false //used to toggle the list up/down
int nSelected = 0 //the current selected item from the list of items
int lit //the value of the hightlighted item (not selected)
int over_me = false //am I over the list's region?
string list_item[max_items] //--------------MAX_ITEMS MUST BE SET BY YOU.
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
position mouse_capture //used to grab the mouse position and detect whether the mouse has been moved
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_dropbutton = s_dropbutton_lobby
o_dropbutton.p_droparrowup = WPATH "Droplist_arrowup.tga"
o_dropbutton.p_droparrowdn = WPATH "Droplist_arrowdown.tga"
object o_uparrow_lobby = s_arrow_lobby
object o_downarrow_lobby = s_arrow_lobby
o_downarrow_lobby.up = false // identifies this as the arrow down button
object o_thumbslide_lobby = s_thumbslide_lobby
object o_thumbregiontop_lobby = s_thumbregion_lobby
object o_thumbregionbot_lobby = s_thumbregion_lobby
//STARTS CLOSED BY HIDING BUTTONS
deactivate(o_uparrow_lobby)
deactivate(o_downarrow_lobby)
deactivate(o_thumbslide_lobby)
deactivate(o_thumbregiontop_lobby)
deactivate(o_thumbregionbot_lobby)
int nRollover = 0 // A flag to set if using c_rollover
int nHelpID = -1
framerate = 30
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
region = 0,0 to itemwidth,itemheight //region to click and drop the list (scales later)
initialize (o_dropbutton)
initialize (o_uparrow_lobby)
initialize (o_downarrow_lobby)
// determines what size the thumslider needs to be: if it's too small, the minimum size is 15
if list_size > max_displayed
{
num_displayed = max_displayed
o_thumbslide_lobby.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2) / ((list_size)/num_displayed)
o_thumbslide_lobby.region = 0,-2 to buttonwidth,o_thumbslide_lobby.handleheight+2
o_uparrow_lobby.region = 0,0 to buttonwidth,arrowHeight
o_downarrow_lobby.region = 0,0 to buttonwidth,arrowHeight
if o_thumbslide_lobby.handleheight < 15
{
o_thumbslide_lobby.handleheight = 15
o_thumbslide_lobby.region = 0,-2 to buttonwidth,o_downarrow_lobby.handleheight+2
}
}
else
{
num_displayed = list_size //if the number of items is less than the max size of the list, shrink the size to the number listed
o_thumbslide_lobby.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2)
o_downarrow_lobby.region = 0,0 to 0,0
o_uparrow_lobby.region = 0,0 to 0,0
o_downarrow_lobby.region = 0,0 to 0,0
}
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight //region for arrow
//make sure the child objects are in the right locations
o_dropbutton.location = location.x+itemWidth,location.y,location.z+2
o_uparrow_lobby.location = location.x+itemWidth, location.y+itemheight, location.z+5
o_downarrow_lobby.location = location.x+itemWidth, location.y+itemheight+(itemHeight*num_displayed)-arrowHeight, location.z+5
o_thumbslide_lobby.location = location.x+itemWidth, location.y+itemheight+arrowHeight+1, location.z+4
o_thumbregiontop_lobby.location = location.x+itemWidth,location.y+itemHeight+arrowHeight,location.z+3
o_thumbregionbot_lobby.location = location.x+itemWidth,(o_thumbslide_lobby.location.y+o_thumbslide_lobby.handleheight),location.z+3
}
GUI_UNFOCUS
{
//shrinks list automatically, if another object is focused (being used)
if (droppedflag)
mail(-1,this)
}
GUI_ACTIVATE
{
activate(o_dropbutton)
// activate(o_uparrow_lobby)
// activate(o_downarrow_lobby)
// activate(o_thumbslide_lobby)
// activate(o_thumbregiontop_lobby)
// activate(o_thumbregionbot_lobby)
// droppedflag = false
}
GUI_DEACTIVATE
{
deactivate(o_dropbutton)
deactivate(o_uparrow_lobby)
deactivate(o_downarrow_lobby)
deactivate(o_thumbslide_lobby)
deactivate(o_thumbregiontop_lobby)
deactivate(o_thumbregionbot_lobby)
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
if droppedflag //if list is dropped, pass the lit item to select
{
mail(lit,this)
}
else //else drop the list
{
mail(-1,this)
}
}
}
}
REGION_ENTERED
{
if (nRollover)
{
oRollover.nHelpID = nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
over_me = true
}
REGION_EXITED
{
if (nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
over_me = false
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
//toggles dropping the list to closing it!
if (sender == this || sender == o_dropbutton)
{
if (getmessage() == -1)
{
if (droppedflag)
{
region = 0,0 to itemWidth+buttonwidth,itemHeight
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight
o_dropbutton.location.z = location.z+2
deactivate(o_uparrow_lobby)
deactivate(o_downarrow_lobby)
deactivate(o_thumbslide_lobby)
deactivate(o_thumbregiontop_lobby)
deactivate(o_thumbregionbot_lobby)
}
else
{
if list_size > 0
{
if list_size <= max_displayed
region = 0,itemHeight to itemWidth+buttonwidth,itemHeight*(num_displayed+1)
else
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
o_dropbutton.region = 0-itemwidth-location.x,0-location.y to getresx()-o_dropbutton.location.x,getresy()-o_dropbutton.location.y
o_dropbutton.location.z = location.z-1
activate(o_uparrow_lobby)
activate(o_downarrow_lobby)
activate(o_thumbslide_lobby)
activate(o_thumbregiontop_lobby)
activate(o_thumbregionbot_lobby)
lit = top_of_list
}
}
droppedflag = !droppedflag
if (droppedflag)
{
location.z = location.z + 5
o_uparrow_lobby.location.z = o_uparrow_lobby.location.z +5
o_downarrow_lobby.location.z = o_downarrow_lobby.location.z +5
o_thumbslide_lobby.location.z = o_thumbslide_lobby.location.z +5
o_thumbregiontop_lobby.location.z = o_thumbregiontop_lobby.location.z +5
o_thumbregionbot_lobby.location.z = o_thumbregionbot_lobby.location.z +5
}
else
{
location.z = location.z - 5
o_uparrow_lobby.location.z = o_uparrow_lobby.location.z -5
o_downarrow_lobby.location.z = o_downarrow_lobby.location.z -5
o_thumbslide_lobby.location.z = o_thumbslide_lobby.location.z -5
o_thumbregiontop_lobby.location.z = o_thumbregiontop_lobby.location.z -5
o_thumbregionbot_lobby.location.z = o_thumbregionbot_lobby.location.z -5
}
}
else
{
mail(-1,this)
if @NetLobby@team_legal_to_join[lit] == TRUE or (lit == list_size-1) //new for lobby, checks if its OK to pick team
{
nselected = lit
update_team = 1
if id == player_num
{
if nselected != o_team[id].list_size-1
{
callback($$RequestTeam$$, lit)
}
else
{
int pass_a_null2 = 8
callback($$RequestTeam$$, pass_a_null2)
}
o_update_names.team_request_through = 1
callback($$SetTeamDecal$$, team_decal_full_name[o_teamdecal.sel_option])
callback($$SetPilotDecal$$, pilot_decal_full_name[o_pilotdecal.sel_option])
stock_mech_selected = o_mech_variant[id].nselected
if callback($$CTCL_CheckCOOP$$)
variant_mech_selected = 0
else
variant_mech_selected = o_mech_variant2[id].nselected
mech_selected = stock_array[stock_mech_selected] + variant_mech_selected
callback($$Shell_CallbackHandler$$, ShellSetMech, mech_selected, mech[mech_selected], o_skin.optiontext[o_skin.sel_option])
callback($$SendVehicleRequest$$)
mail(-1, o_background)
update_team = -1
}
else
{
if nSelected != o_team[id].list_size-1 // not equal to "-", which is always last of droplist
{
callback($$SetTeamBot$$, o_block_controls[id].bot_number, lit)
stock_mech_selected = o_mech_variant[id].nselected
if callback($$CTCL_CheckCOOP$$)
variant_mech_selected = 0
else
variant_mech_selected = o_mech_variant2[id].nselected
mech_selected = stock_array[stock_mech_selected] + variant_mech_selected
int return_value = callback($$SetMechBot$$, o_block_controls[id].bot_number, mech_selected, mech[mech_selected])
int accepted = callback($$GetBotVehicleAccepted$$, o_block_controls[id].bot_number)
if (return_value == true)
{
if (!accepted)
{
mail(-100, o_background)
}
o_update_names.host_bot_last_val[o_block_controls[id].bot_number] = o_mech_variant[id].nselected
if callback($$CTCL_CheckCOOP$$)
o_update_names.host_bot_last_val2[o_block_controls[id].bot_number] = 0
else
o_update_names.host_bot_last_val2[o_block_controls[id].bot_number] = o_mech_variant2[id].nselected
}
}
else
{
int pass_a_null2 = 8
callback($$SetTeamBot$$, o_block_controls[id].bot_number, pass_a_null2)
}
}
}
mail(nselected)
}
}
//up button pressed
if (sender == o_uparrow_lobby)
{
if (top_of_list > 0)
{
top_of_list--
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_lobby)
}
if (sender == o_downarrow_lobby)
{
if (top_of_list < list_size-num_displayed)
{
top_of_list++
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_lobby)
}
if (sender == o_thumbslide_lobby)
{
if getmessage() < (location.y+itemHeight+arrowHeight+1)
o_thumbslide_lobby.location.y = location.y+itemHeight+arrowHeight+1
if getmessage() > (location.y+(itemHeight*(num_displayed+1))-arrowHeight-(o_thumbslide_lobby.handleheight))-1
o_thumbslide_lobby.location.y = (location.y+(itemHeight*(num_displayed+1))-arrowHeight-1-o_thumbslide_lobby.handleheight)
//1.) find out how many pixels from the top of the thumbslider region
//2.) calc total pixels to move thumbslider/calc num of items-num being drawn (to prevent any empty spaces)
//3.) find top item by taking the total area of pixels/num of pixels for one step (or scroll)
float tmp = (o_thumbslide_lobby.location.y) - (location.y+itemHeight+arrowHeight+1)
o_thumbslide_lobby.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslide_lobby.handleheight)-2) / (list_size-num_displayed)
float tmp_top_of_list = tmp/o_thumbslide_lobby.step_height
top_of_list = tmp_top_of_list
if top_of_list > list_size-num_displayed
{
top_of_list = list_size-num_displayed
}
}
if (sender == o_thumbregiontop_lobby)
{
if (top_of_list-(num_displayed-1) >= 0)
{
top_of_list = top_of_list-(num_displayed-1)
}
else
{
top_of_list = 0
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_lobby)
}
if (sender == o_thumbregionbot_lobby)
{
if (top_of_list+(num_displayed-1) < list_size-num_displayed)
{
top_of_list = top_of_list+(num_displayed-1)
}
else
{
top_of_list = list_size-num_displayed
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_lobby)
}
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if lit > top_of_list
{
if lit <= (top_of_list+num_displayed-1) //if the lit box is visible to user, move;
{
lit = lit-1
mail(0,o_thumbslide_lobby)
}
else
{
lit = lit-1
top_of_list = lit-(num_displayed-1) //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_lobby)
}
}
else
{
if top_of_list > 0 //scrolls the list box when the lit box hits top
{
top_of_list--
lit = top_of_list
mail(0, o_thumbslide_lobby)
}
}
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if lit < (top_of_list + num_displayed-1)
{
if lit >= top_of_list //if the lit box is visible to user, move
{
lit = lit+1
mail(0,o_thumbslide_lobby)
}
else
{
lit = lit+1
top_of_list = lit //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_lobby)
}
}
else
{
if (top_of_list < list_size-num_displayed) //scrolls the list box when the lit box hits bottom
{
top_of_list++
lit = top_of_list + num_displayed-1
mail(0, o_thumbslide_lobby)
}
}
}
key = getchar()
if key == char("\n") //enter is pressed to select the current lit item
{
mail(lit,this)
}
// tab section if you have our GOS Script tab routine
// if (key == 9) //9 is the value of a tab
// {
// mail(M_TABEVENT)
// }
}
GUI_EXECUTE
{
// compute lit items the pointer is floating over
if (over_me && mouse.x < location.x+itemWidth)
{
if (mouse_capture.y != mouse.y)
{
lit = top_of_list + ((mouse.y - (location.y+itemheight)) / itemheight)
if (lit > (list_size-1))
lit = -1
}
}
//resize negative space thumbslider regions ALWAYS
o_thumbregiontop_lobby.region = 0,0 to buttonWidth, (o_thumbslide_lobby.location.y-o_thumbregiontop_lobby.location.y)
o_thumbregionbot_lobby.location.y = (o_thumbslide_lobby.location.y+o_thumbslide_lobby.handleheight)
o_thumbregionbot_lobby.region = 0,0 to buttonWidth, (o_thumbslide_lobby.location.y-3)-(o_thumbslide_lobby.location.y+o_thumbslide_lobby.handleheight))
mouse_capture = mouse.x,mouse.y
}
GUI_DRAW
{
if @netlobby@hide_this_player[id] == FALSE
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,itemheight
setpencolor(borderColor)
drawline location.x, location.y to location.x + itemwidth, location.y
drawline location.x, location.y to location.x, location.y + itemheight
setpencolor(shadowcolor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x + itemwidth, location.y to location.x + itemwidth, location.y + itemheight
// draw the list
if (droppedflag)
{
// draw background box
setpencolor(backColor)
ldrawrect 0,itemheight to itemwidth,((num_displayed+1)*(itemheight))
setpencolor(borderColor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x, location.y + itemheight to location.x, location.y + ((num_displayed+1)*(itemheight))
setpencolor(shadowcolor)
drawline location.x, location.y + ((num_displayed+1)*(itemheight)) to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
drawline location.x + itemwidth, location.y + itemheight to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
//Prints list itself
lprint3d_margins = 0,0 to itemWidth+2,(itemHeight*(num_displayed+1))+2
int line= 1
for(int i=top_of_list; i < ((top_of_list)+num_displayed); i++) //line by line, print all options displayed
{
print3d_attributes = boxFont3d, boxtextcolor, 1,0,1,0,0
//prints highlighted box
if (lit == i)
{
//if you want, you may color the text
//print3d_attributes = boxFont3d, itemhighlightcolor, 1,0,1,0,0 //IF YOU WANT TO CHANGE TEXT COLOR WITH HIGHLIGHT
setpencolor(boxhighlightcolor)
ldrawrect 1, (line*itemheight) to itemwidth, ((line+1)*itemheight)
}
//changes color of text for the previous item selected
if (nSelected == i)
{
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
}
////////////////// This is new for lobby //////////////////////////////
if @NetLobby@team_legal_to_join[i] == FALSE
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
////////////////////////////////////////////////////////////////////////
lprint3d_position = 5, (line*itemheight) + ((itemHeight/2) - (getprint3dheight("text")/2)) //set the position for the print
if (length$(list_item[i]) > 0) //checks is there is anything to print
{
print3d list_item[i] //prints the next item
}
line ++
if line > list_size // if the line number ever attempts to pass up the list_size, it exits the print loop
{
break
}
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawrect 1,1 to itemwidth -1,itemheight-1
}
//prints current item selected in the the top box
lprint3d_margins = 0,0 to itemwidth, itemheight+2
// jcem - i centered text horizontally... by changing below 2 lines
print3d_attributes = boxFont3D, boxTextColor,1,0,1,0,0,just_center
lprint3d_position = 0, (itemHeight/2) - (getprint3dheight("text")/2) // 0<-5
if nSelected > -1
print3d list_item[nSelected]
print3d_margins = 0,0 to 800,600
//Use for an optional label for the top of box
if length$(label)
{
print3d_attributes = labelFont3D, labelTextColor,1,0,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+2),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
}
//INITIALIZE MUST BE CALLED
s_dropbutton_lobby
{
GUI_CREATE
{
region = 0,0 to 0,0 //MUST BE INITIALIZED
float nButtonWidth = 0
float nButtonHeight = 0
pane p_droparrowup //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!
pane p_droparrowdn //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!!!
float offsetx = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
float offsety = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
framerate = 30
}
GUI_INIT
{
nButtonWidth = getWidth(p_droparrowup) //parent.itemHeight //uses the pane's dimensions
nButtonHeight = getHeight(p_droparrowup) //
offsetx = (parent.buttonWidth-nButtonWidth)/2
offsety = (parent.itemHeight-nButtonHeight)/2
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED) && parent.parent.o_mech_variant[parent.id].nselected != 0
{
focus(parent) //toggles list down/up
mail(-1)
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
GUI_DRAW
{
// draw background
// setpencolor(parent.controlbackColor)
// drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// draw border
// setpencolor(parent.borderColor)
// drawframe location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// display arrow; two panes(images are used for the states of the list)
// if (parent.droppedflag)
// render p_droparrowup, location.x+offsetx,location.y+offsety
// else
// render p_droparrowdn, location.x+offsetx,location.y+offsety
}
}
s_arrow_lobby
{
GUI_CREATE
{
int up = true //this object is used for either the up or down arrow; this is the flag so it knows
int timeToMove //created to store a delay value for button presses
float offsety //keeps arrow in center
float offsetx
// pane p_arrowup // if you choose to us bitmaps for the arrows
// pane p_arrowdown
framerate = 10
}
GUI_INIT
{
offsety = ((parent.arrowHeight-6)/2)+1
offsetx = ((parent.buttonWidth-12)/2)+1
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25,25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_listbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 5, 5/60 of a second to wait after mouse button has been held down
}
}
}
GUI_EXECUTE
{
}
GUI_DRAW
{
if @netlobby@hide_this_player[parent.id] == FALSE
{
// draw background
setpencolor(parent.facecolor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y to location.x, location.y + parent.arrowheight
setpencolor(parent.shadowcolor)
drawline location.x + parent.buttonWidth, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y + parent.arrowheight to location.x + parent.buttonWidth, location.y + parent.arrowheight
setpencolor(0, 0, 0, 255)
if up == true
{
//render p_arrowup, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+5+offsetx,location.y-1+offsety to location.x+6+offsetx,location.y-1+offsety
drawline location.x+4+offsetx,location.y+offsety to location.x+7+offsetx,location.y+offsety
drawline location.x+3+offsetx,location.y+1+offsety to location.x+8+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+1+offsetx,location.y+3+offsety to location.x+10+offsetx,location.y+3+offsety
drawline location.x+offsetx,location.y+4+offsety to location.x+11+offsetx,location.y+4+offsety
}
else
{
//render p_arrowdown, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+offsetx,location.y+offsety to location.x+11+offsetx,location.y+offsety
drawline location.x+1+offsetx,location.y+1+offsety to location.x+10+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+3+offsetx,location.y+3+offsety to location.x+8+offsetx,location.y+3+offsety
drawline location.x+4+offsetx,location.y+4+offsety to location.x+7+offsetx,location.y+4+offsety
drawline location.x+5+offsetx,location.y+5+offsety to location.x+6+offsetx,location.y+5+offsety
}
}
}
}
s_thumbslide_lobby // resizing handle
{
GUI_CREATE
{
float handleheight // this is very important for calculating behaviours
float step_height // float for the math part of thumbslider
float result // float to get the finished valuse to add to location
int thumb_pressed = false // was this slider pressed with left mouse button variable
}
GUI_MAILBOX
{
// the list top may have changed, recompute location
if sender.list_size <= sender.max_displayed //if the list doesn't go past the max_diplayed, there is no need to slide
{
location.y = (sender.location.y+sender.itemHeight+parent.arrowHeight+1)
}
else
{
if sender.top_of_list == sender.list_size-sender.num_displayed //if we are at the bottm of the list box, make sure that it's lined up against the down button correctly
{
location.y = sender.location.y+(sender.itemHeight*(sender.num_displayed+1))-parent.arrowHeight-handleheight-1
}
else //position formula = 1.) calc the size of the thumslider area/calc num of steps to slide = the pixel height of a single step 2.) calc the location of the very top of thumbslider 3.) add to the location the result of top_of_list times the step height
{
step_height = ((sender.itemHeight*sender.num_displayed)-(parent.arrowHeight*2)-(handleheight)-2) / (sender.list_size-sender.num_displayed)
location.y = sender.location.y+sender.itemheight+parent.arrowHeight+1
result = (sender.top_of_list * step_height)
location.y += result
}
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED) // this keeps a glitch from happening when using the thumbregions
{
thumb_pressed = true //now we can know that the user wanted to drag the thumbslider
}
else
if thumb_pressed
{
if (mouse.left == BUTTON_HELD) // this drags the thumbslider as long as the button is held
{
location.y = mouse.y-(handleheight/2)
mail (location.y)
always_in_region = true
}
else // if anything else but held, release the thumbslider
{
always_in_region = false
thumb_pressed = false
}
}
}
GUI_DRAW
{
if @netlobby@hide_this_player[parent.id] == FALSE
{
setpencolor(parent.backColor)
drawrect parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.bordercolor)
drawframe parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.facecolor)
drawrect location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
setpencolor(parent.framehighlightColor)
drawline location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + 1
drawline location.x + 2, location.y + 1 to location.x + 2, location.y + handleheight - 1
setpencolor(parent.shadowcolor)
drawline location.x + 2, location.y + handleheight - 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
drawline (location.x + parent.buttonWidth) - 1, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
}
}
}
//script for scalable invisible regions for the thumbslider negative space
s_thumbregion_lobby
{
GUI_CREATE
{
int timeToMove //created to store a delay value for button presses
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25, 25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_droplistbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 25, 5/60 of a second to wait after mouse button has been held down
}
}
}
}
@@ -0,0 +1,19 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
object o_error = o_errorscreen
o_error.error_header = localize$(IDS_GN_ERROR)
o_error.error_message = localize$(IDS_MP_LOBBY_ERROR_PICK_TEAM)
initialize (o_error)
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,908 @@
s_droplistbox_mech
{
GUI_CREATE
{
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
font3d boxFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_DROPDOWN) //MUST BE INITIALIZED
int backColor = packcolor (0, 0, 0, 255)
int controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
int labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int facecolor = packcolor (187, 187, 204, 255)
int shadowcolor = packcolor (119, 119, 119, 255)
int arrowColor = packcolor (0, 0, 0, 255)
float itemWidth = 0 //MUST BE INITIALIZED
float itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed //MUST BE INITIALIZED
int top_of_list //MUST BE INITIALIZED
string label = "" //CAN BE INITIALIZED
font3d labelFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_LABEL) //MUST BE INITIALIZED
position offsetLabel = 0,-15 //CAN BE INITIALIZED
int buttonWidth = 16 //CAN BE INITIALIZED
int arrowHeight = 10 //CAN BE INITIALIZED; IT CONTROLS THE HEIGHT OF THE THUMBSLIDER ARROWS
int get_itemheight = FALSE //CAN BE INITIALIZED; FLAGS WHETHER YOU WANT TO USE THE FONTHEIGHT AS THE HEIGHT FOR EACH ITEM
//LOCAL WORK VARIABLES
int num_displayed //THE NUMBER OF ITEMS DISPLAYED INSIDE THE LIST BOX; THIS IS AFFECTED IN THE INIT
int droppedflag = false //used to toggle the list up/down
int nSelected = 0 //the current selected item from the list of items
int lit //the value of the hightlighted item (not selected)
int over_me = false //am I over the list's region?
string list_item[max_items] //--------------MAX_ITEMS MUST BE SET BY YOU.
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
position mouse_capture //used to grab the mouse position and detect whether the mouse has been moved
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_dropbutton = s_dropbutton_mech
object o_uparrow = s_arrow_mech
object o_downarrow = s_arrow_mech
o_downarrow.up = false // identifies this as the arrow down button
object o_thumbslider = s_thumbslide_mech
object o_thumbregiontop = s_thumbregion_mech
object o_thumbregionbot = s_thumbregion_mech
//STARTS CLOSED BY HIDING BUTTONS
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
int nRollover = 0 // A flag to set if using c_rollover
int nHelpID = -1
int id = 0
framerate = 30
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
region = 0,0 to itemwidth+buttonwidth,itemheight //region to click and drop the list (scales later)
initialize (o_dropbutton)
initialize (o_uparrow)
initialize (o_downarrow)
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight //region for arrow
// determines what size the thumslider needs to be: if it's too small, the minimum size is 15
if list_size > max_displayed
{
num_displayed = max_displayed
o_thumbslider.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2) / ((list_size)/num_displayed)
o_thumbslider.region = 0,-2 to buttonwidth,o_thumbslider.handleheight+2
o_uparrow.region = 0,0 to buttonwidth,arrowHeight
o_downarrow.region = 0,0 to buttonwidth,arrowHeight
if o_thumbslider.handleheight < 15
{
o_thumbslider.handleheight = 15
o_thumbslider.region = 0,-2 to buttonwidth,o_thumbslider.handleheight+2
}
}
else
{
num_displayed = list_size //if the number of items is less than the max size of the list, shrink the size to the number listed
o_thumbslider.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2)
o_thumbslider.region = 0,0 to 0,0
o_uparrow.region = 0,0 to 0,0
o_downarrow.region = 0,0 to 0,0
}
//make sure the child objects are in the right locations
o_dropbutton.location = location.x+itemWidth,location.y,location.z+2
o_uparrow.location = location.x+itemWidth, location.y+itemheight, location.z+5
o_downarrow.location = location.x+itemWidth, location.y+itemheight+(itemHeight*num_displayed)-arrowHeight, location.z+5
o_thumbslider.location = location.x+itemWidth, location.y+itemheight+arrowHeight+1, location.z+4
o_thumbregiontop.location = location.x+itemWidth,location.y+itemHeight+arrowHeight,location.z+3
o_thumbregionbot.location = location.x+itemWidth,(o_thumbslider.location.y+o_thumbslider.handleheight),location.z+3
//adjust the top_of_list if there are going to be
//blanks at the end
if (top_of_list + num_displayed > 25)
{
top_of_list = 25 - num_displayed
}
}
GUI_UNFOCUS
{
//shrinks list automatically, if another object is focused (being used)
if (droppedflag)
mail(-1,this)
}
GUI_ACTIVATE
{
activate(o_dropbutton)
// activate(o_uparrow)
// activate(o_downarrow)
// activate(o_thumbslider)
// activate(o_thumbregiontop)
// activate(o_thumbregionbot)
}
GUI_DEACTIVATE
{
deactivate(o_dropbutton)
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
}
LBUTTON_UPDATE
{
if (list_size > 0)
{
if (mouse.left == BUTTON_RELEASED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
if droppedflag //if list is dropped, pass the lit item to select
{
mail(lit,this)
}
else //else drop the list
{
mail(-1,this)
}
focus(this)
}
}
}
}
REGION_ENTERED
{
if (nRollover)
{
oRollover.nHelpID = nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(id, @infobox@)
}
over_me = true
}
REGION_EXITED
{
if (nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
if exists(@infobox@)
{
mail(-1, @infobox@)
}
over_me = false
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
//toggles dropping the list to closing it!
if (sender == this || sender == o_dropbutton)
{
if (list_size > 0)
{
if (getmessage() == -1)
{
if (droppedflag)
{
region = 0,0 to itemWidth+buttonwidth,itemHeight
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight
o_dropbutton.location.z = location.z+2
deactivate(o_uparrow)
deactivate(o_downarrow)
deactivate(o_thumbslider)
deactivate(o_thumbregiontop)
deactivate(o_thumbregionbot)
}
else
{
if list_size > 0
{
if list_size <= max_displayed
region = 0,itemHeight to itemWidth+buttonwidth,itemHeight*(num_displayed+1)
else
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
o_dropbutton.region = 0-itemwidth-location.x,0-location.y to getresx()-o_dropbutton.location.x,getresy()-o_dropbutton.location.y
o_dropbutton.location.z = location.z-1
activate(o_uparrow)
activate(o_downarrow)
activate(o_thumbslider)
activate(o_thumbregiontop)
activate(o_thumbregionbot)
lit = top_of_list
}
}
droppedflag = !droppedflag
if (droppedflag)
{
location.z = location.z + 5
o_uparrow.location.z = o_uparrow.location.z +5
o_downarrow.location.z = o_downarrow.location.z +5
o_thumbslider.location.z = o_thumbslider.location.z +5
o_thumbregiontop.location.z = o_thumbregiontop.location.z +5
o_thumbregionbot.location.z = o_thumbregionbot.location.z +5
}
else
{
location.z = location.z - 5
o_uparrow.location.z = o_uparrow.location.z -5
o_downarrow.location.z = o_downarrow.location.z -5
o_thumbslider.location.z = o_thumbslider.location.z -5
o_thumbregiontop.location.z = o_thumbregiontop.location.z -5
o_thumbregionbot.location.z = o_thumbregionbot.location.z -5
}
}
else
{
nSelected = lit
mail(-1,this)
mail(nselected)
}
}
}
//up button pressed
if (sender == o_uparrow)
{
if (top_of_list > 0)
{
top_of_list--
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslider)
}
if (sender == o_downarrow)
{
if (top_of_list < list_size-num_displayed)
{
top_of_list++
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslider)
}
if (sender == o_thumbslider)
{
if getmessage() < (location.y+itemHeight+arrowHeight+1)
o_thumbslider.location.y = location.y+itemHeight+arrowHeight+1
if getmessage() > (location.y+(itemHeight*(num_displayed+1))-arrowHeight-(o_thumbslider.handleheight))-1
o_thumbslider.location.y = (location.y+(itemHeight*(num_displayed+1))-arrowHeight-1-o_thumbslider.handleheight)
//1.) find out how many pixels from the top of the thumbslider region
//2.) calc total pixels to move thumbslider/calc num of items-num being drawn (to prevent any empty spaces)
//3.) find top item by taking the total area of pixels/num of pixels for one step (or scroll)
float tmp = (o_thumbslider.location.y) - (location.y+itemHeight+arrowHeight+1)
o_thumbslider.step_height = 0
if (list_size-num_displayed)
o_thumbslider.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslider.handleheight)-2) / (list_size-num_displayed)
float tmp_top_of_list = 0
if (o_thumbslider.step_height)
tmp_top_of_list = tmp/o_thumbslider.step_height + 0.0001
top_of_list = tmp_top_of_list
if top_of_list > list_size-num_displayed
{
top_of_list = list_size-num_displayed
}
}
if (sender == o_thumbregiontop)
{
if (top_of_list-(num_displayed-1) >= 0)
{
top_of_list = top_of_list-(num_displayed-1)
}
else
{
top_of_list = 0
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslider)
}
if (sender == o_thumbregionbot)
{
if (top_of_list+(num_displayed-1) < list_size-num_displayed)
{
top_of_list = top_of_list+(num_displayed-1)
}
else
{
top_of_list = list_size-num_displayed
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslider)
}
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit > top_of_list
{
if lit <= (top_of_list+num_displayed-1) //if the lit box is visible to user, move;
{
lit = lit-1
mail(0,o_thumbslider)
}
else
{
lit = lit-1
top_of_list = lit-(num_displayed-1) //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslider)
}
}
else
{
if top_of_list > 0 //scrolls the list box when the lit box hits top
{
top_of_list--
lit = top_of_list
mail(0, o_thumbslider)
}
}
}
else
{
if (0 < nSelected)
{
nSelected = nSelected - 1
mail(nselected)
}
}
focus(this)
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if (droppedflag)
{
if lit < (top_of_list + num_displayed-1)
{
if lit >= top_of_list //if the lit box is visible to user, move
{
lit = lit+1
mail(0,o_thumbslider)
}
else
{
lit = lit+1
top_of_list = lit //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslider)
}
}
else
{
if (top_of_list < list_size-num_displayed) //scrolls the list box when the lit box hits bottom
{
top_of_list++
lit = top_of_list + num_displayed-1
mail(0, o_thumbslider)
}
}
}
else
{
if (nSelected + 1 < list_size)
{
nSelected = nSelected + 1
mail(nselected)
}
}
focus(this)
}
key = getchar()
if key == char("\n") //enter is pressed to select the current lit item
{
mail(lit,this)
}
// tab section if you have our GOS Script tab routine
if (key == 9) //9 is the value of a tab
{
mail(M_TABEVENT,parent)
}
}
GUI_EXECUTE
{
// compute lit items the pointer is floating over
if (over_me && mouse.x < location.x+itemWidth)
{
if (mouse_capture.y != mouse.y)
{
lit = top_of_list + ((mouse.y - (location.y+itemheight)) / itemheight)
if (lit > (list_size-1))
lit = -1
}
}
//resize negative space thumbslider regions ALWAYS
o_thumbregiontop.region = 0,0 to buttonWidth, (o_thumbslider.location.y-o_thumbregiontop.location.y)
o_thumbregionbot.location.y = (o_thumbslider.location.y+o_thumbslider.handleheight)
o_thumbregionbot.region = 0,0 to buttonWidth, (o_downarrow.location.y-3)-(o_thumbslider.location.y+o_thumbslider.handleheight))
mouse_capture = mouse.x,mouse.y
if droppedflag == true
{
if (exists(@infobox@) && exists(@MechBay_main@o_mainui.o_chassis))
{
if parent == o_newmech
{
int help_id = 170 + lit
mail(help_id, @infobox@)
}
if parent == o_armor
{
int help_id = 297 + lit
mail(help_id, @infobox@)
}
}
}
}
GUI_DRAW
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,itemheight
setpencolor(borderColor)
drawline location.x, location.y to location.x + itemwidth, location.y
drawline location.x, location.y to location.x, location.y + itemheight
setpencolor(shadowcolor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x + itemwidth, location.y to location.x + itemwidth, location.y + itemheight
// draw the list
if (droppedflag)
{
// draw background box
setpencolor(backColor)
ldrawrect 0,itemheight to itemwidth,((num_displayed+1)*(itemheight))
setpencolor(borderColor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x, location.y + itemheight to location.x, location.y + ((num_displayed+1)*(itemheight))
setpencolor(shadowcolor)
drawline location.x, location.y + ((num_displayed+1)*(itemheight)) to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
drawline location.x + itemwidth, location.y + itemheight to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
//Prints list itself
lprint3d_margins = 0,0 to itemWidth+2,(itemHeight*(num_displayed+1))+2
int line= 1
for(int i=top_of_list; i < ((top_of_list)+num_displayed); i++) //line by line, print all options displayed
{
print3d_attributes = boxFont3d, boxtextcolor, 1,0,1,0,0
//prints highlighted box
if (lit == i)
{
//if you want, you may color the text
//print3d_attributes = boxFont3d, itemhighlightcolor, 1,0,1,0,0 //IF YOU WANT TO CHANGE TEXT COLOR WITH HIGHLIGHT
setpencolor(boxhighlightcolor)
ldrawrect 1, (line*itemheight) to itemwidth, ((line+1)*itemheight)
}
//changes color of text for the previous item selected
if (nSelected == i)
{
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
}
lprint3d_position = 5, (line*itemheight) + ((itemHeight/2) - (getprint3dheight("text")/2)) //set the position for the print
if (length$(list_item[i]) > 0) //checks is there is anything to print
{
print3d list_item[i] //prints the next item
}
line ++
if line > list_size // if the line number ever attempts to pass up the list_size, it exits the print loop
{
break
}
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawrect 1,1 to itemwidth -1,itemheight-1
}
//prints current item selected in the the top box
lprint3d_margins = 0,0 to itemwidth, itemheight+2
print3d_attributes = boxFont3D, boxTextColor,1,0,1,0,0
lprint3d_position = 5, (itemHeight/2) - (getprint3dheight("text")/2)
if nSelected > -1
print3d list_item[nSelected]
print3d_margins = 0,0 to 800,600
//Use for an optional label for the top of box
if length$(label)
{
print3d_attributes = labelFont3D, labelTextColor,1,0,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+2),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
//INITIALIZE MUST BE CALLED
s_dropbutton_mech
{
GUI_CREATE
{
region = 0,0 to 0,0 //MUST BE INITIALIZED
float nButtonWidth = 0
float nButtonHeight = 0
pane p_droparrow = WPATH "DropList_arrowup.tga" //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!
float offsetx = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
float offsety = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
framerate = 30
}
GUI_INIT
{
nButtonWidth = getWidth(p_droparrow) //parent.itemHeight //uses the pane's dimensions
nButtonHeight = getHeight(p_droparrow) //
offsetx = (parent.buttonWidth-nButtonWidth)/2
offsety = (parent.itemHeight-nButtonHeight)/2
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
focus(parent) //toggles list down/up
mail(-1)
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(parent.id, @infobox@)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
GUI_DRAW
{
if (parent.droppedflag) && (parent.list_size > 0)
{
setpencolor(parent.shadowcolor)
ldrawrect 0, 0 to parent.buttonwidth, parent.itemheight
}
else
{
setpencolor(parent.facecolor)
ldrawrect 0, 0 to parent.buttonwidth, parent.itemheight
}
render p_droparrow, location.x + offsetx, location.y + offsety
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonwidth, location.y
drawline location.x, location.y + 1 to location.x, (location.y + parent.itemheight) - 1
setpencolor(parent.shadowColor)
drawline location.x + parent.buttonwidth, location.y + 1 to location.x + parent.buttonwidth, location.y + parent.itemheight
drawline location.x, location.y + parent.itemheight to location.x + parent.buttonwidth, location.y + parent.itemheight
}
}
s_arrow_mech
{
GUI_CREATE
{
int up = true //this object is used for either the up or down arrow; this is the flag so it knows
int timeToMove //created to store a delay value for button presses
float offsety //keeps arrow in center
float offsetx
// pane p_arrowup // if you choose to us bitmaps for the arrows
// pane p_arrowdown
framerate = 10
}
GUI_INIT
{
offsety = ((parent.arrowHeight-6)/2)+1
offsetx = ((parent.buttonWidth-12)/2)+1
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
if exists(@infobox@)
{
mail(parent.id, @infobox@)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25,25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_listbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 5, 5/60 of a second to wait after mouse button has been held down
}
}
}
GUI_EXECUTE
{
}
GUI_DRAW
{
// draw background
setpencolor(parent.facecolor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y to location.x, location.y + parent.arrowheight
setpencolor(parent.shadowcolor)
drawline location.x + parent.buttonWidth, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y + parent.arrowheight to location.x + parent.buttonWidth, location.y + parent.arrowheight
setpencolor(parent.arrowColor)
if up == true
{
//render p_arrowup, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+5+offsetx,location.y-1+offsety to location.x+6+offsetx,location.y-1+offsety
drawline location.x+4+offsetx,location.y+offsety to location.x+7+offsetx,location.y+offsety
drawline location.x+3+offsetx,location.y+1+offsety to location.x+8+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+1+offsetx,location.y+3+offsety to location.x+10+offsetx,location.y+3+offsety
drawline location.x+offsetx,location.y+4+offsety to location.x+11+offsetx,location.y+4+offsety
}
else
{
//render p_arrowdown, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+offsetx,location.y+offsety to location.x+11+offsetx,location.y+offsety
drawline location.x+1+offsetx,location.y+1+offsety to location.x+10+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+3+offsetx,location.y+3+offsety to location.x+8+offsetx,location.y+3+offsety
drawline location.x+4+offsetx,location.y+4+offsety to location.x+7+offsetx,location.y+4+offsety
drawline location.x+5+offsetx,location.y+5+offsety to location.x+6+offsetx,location.y+5+offsety
}
}
}
s_thumbslide_mech // resizing handle
{
GUI_CREATE
{
float handleheight // this is very important for calculating behaviours
float step_height // float for the math part of thumbslider
float result // float to get the finished valuse to add to location
int thumb_pressed = false // was this slider pressed with left mouse button variable
}
GUI_MAILBOX
{
// the list top may have changed, recompute location
if sender.list_size <= sender.max_displayed //if the list doesn't go past the max_diplayed, there is no need to slide
{
location.y = (sender.location.y+sender.itemHeight+parent.arrowHeight+1)
}
else
{
if sender.top_of_list == sender.list_size-sender.num_displayed //if we are at the bottm of the list box, make sure that it's lined up against the down button correctly
{
location.y = sender.location.y+(sender.itemHeight*(sender.num_displayed+1))-parent.arrowHeight-handleheight-1
}
else //position formula = 1.) calc the size of the thumslider area/calc num of steps to slide = the pixel height of a single step 2.) calc the location of the very top of thumbslider 3.) add to the location the result of top_of_list times the step height
{
step_height = ((sender.itemHeight*sender.num_displayed)-(parent.arrowHeight*2)-(handleheight)-2) / (sender.list_size-sender.num_displayed)
location.y = sender.location.y+sender.itemheight+parent.arrowHeight+1
result = (sender.top_of_list * step_height)
location.y += result
}
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED) // this keeps a glitch from happening when using the thumbregions
{
thumb_pressed = true //now we can know that the user wanted to drag the thumbslider
}
else
if thumb_pressed
{
if (mouse.left == BUTTON_HELD) // this drags the thumbslider as long as the button is held
{
location.y = mouse.y-(handleheight/2)
mail (location.y)
always_in_region = true
}
else // if anything else but held, release the thumbslider
{
always_in_region = false
thumb_pressed = false
}
}
}
GUI_DRAW
{
setpencolor(parent.backColor)
drawrect parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.bordercolor)
drawframe parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.facecolor)
drawrect location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
setpencolor(parent.framehighlightColor)
drawline location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + 1
drawline location.x + 2, location.y + 1 to location.x + 2, location.y + handleheight - 1
setpencolor(parent.shadowcolor)
drawline location.x + 2, location.y + handleheight - 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
drawline (location.x + parent.buttonWidth) - 1, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
}
}
//script for scalable invisible regions for the thumbslider negative space
s_thumbregion_mech
{
GUI_CREATE
{
int timeToMove //created to store a delay value for button presses
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25, 25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_droplistbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 25, 5/60 of a second to wait after mouse button has been held down
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
//////////////////////////////////////
// This is an error dialog for when the list of games screen can't load
// because no server browsers were successfully initialized.
//////////////////////////////////////
main
{
GUI_CREATE
{
object o_error = o_errorscreen
o_error.error_header = ""
o_error.error_message = localize$(IDS_MP_LOG_NOBROWSERS)
initialize (o_error)
}
}
@@ -0,0 +1,169 @@
#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"
main
{
GUI_CREATE
{
// use the whole region
location = 0, 0, 0
region = 0, 0 to getresx(), getresy()
object screen = o_CreatePilotModal
}
}
o_CreatePilotModal
{
GUI_CREATE
{
Font3d gHeaderFont3d = szPATH_FONTS localize$(IDS_F_LOAD_TITLE)
Font3d gFont3d = szPATH_FONTS localize$(IDS_F_ML_BUTTON)
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
object o_password_box = s_editbox
// o_password_box.relative = true
o_password_box.location = 250,location.y+260,location.z+20
o_password_box.boxValue = "" //CAN BE INITIALIZED holds the contents of the edit box
o_password_box.boxWidth = 285 //MUST BE INTIALIZED width of the edit field of the box
o_password_box.boxHeight = 20 //MUST BE INTIALIZED height of the edit field of the box//
o_password_box.boxtextlimit = 16
o_password_box.boxFont3d = FPATH localize$(IDS_F_GEN_EDITBOX) //MUST BE INTIALIZED
o_password_box.boxTextOffset = 3,3 //CAN BE INITIALIZED
o_password_box.label = localize$(IDS_MP_PASS_ENTER) //CAN BE INITIALIZED
o_password_box.labelFont3d = FPATH localize$(IDS_F_ML_LABEL) //MUST BE INTIALIZED
o_password_box.offset = 0,-16 //CAN BE INITIALIZED offset of text from button
initialize (o_password_box)
//---------------------------------------------------
focus(o_password_box)
sound btnTriggeredSound = SPATH "sfx_button5.wav"
// variables for fading in and out
int alpha_val = 5
int fadeout = false
}
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
script_end
}
}
}
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,1,0,just_center
print3d_margins = 150, 150 to 650, 450
print3d_position = 150, 155
print3d localize$(IDS_MP_PASS_PROTECTION)
}
}
GUI_MAILBOX
{
// Handle the OK Request
if ((sender == mbutton[0]) || ((sender == o_password_box) && (getmessage() == 1)))
{
play btnTriggeredSound,1
$$GamePassword$$ = o_password_box.boxValue // MUST SET PASSWORD VARIABLE!!
mail(0,@ListofGames@)
// Tell this script to fade out and deactivate all its objects
fadeout = true
for(iloop = 0; iloop < 2; iloop++)
{
deactivate(mbutton[iloop])
}
deactivate(o_password_box)
}
// Handle the Cancel Request
if (sender == mbutton[1])
{
play btnTriggeredSound,1
// Tell this script to fade out and deactivate all its objects
fadeout = true
for(iloop = 0; iloop < 2; iloop++)
{
deactivate(mbutton[iloop])
}
deactivate(o_password_box)
}
}
GUI_DESTROY
{
unfocus
}
}
@@ -0,0 +1,19 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
object o_error = o_errorscreen
o_error.error_header = ""
o_error.error_message = localize$(IDS_MP_BROWSE_ERROR_PASSWORD_INVALID)
initialize (o_error)
}
}
@@ -0,0 +1,844 @@
#include "Content\\ShellScripts\\ScriptStrings.h"
s_droplistbox_skins
{
GUI_CREATE
{
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
font3d boxFont3d= szPATH_FONTS1 localize$(IDS_F_GEN_DROPDOWN) //MUST BE INITIALIZED
int backColor = packcolor (0, 0, 0, 255)
int controlbackColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (120, 120, 255, 150) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (0, 0, 0, 255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (50, 120, 255, 200) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (125, 125, 125, 255) //CAN BE INITIALIZED
int labelTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int borderColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int facecolor = packcolor (187, 187, 204, 255)
int shadowcolor = packcolor (119, 119, 119, 255)
int arrowColor = packcolor (0, 0, 0, 255)
float itemWidth = 0 //MUST BE INITIALIZED
float itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed //MUST BE INITIALIZED
int top_of_list //MUST BE INITIALIZED
int id
string label = "" //CAN BE INITIALIZED
font3d labelFont3d = szPATH_FONTS1 localize$(IDS_F_GEN_LABEL) //MUST BE INITIALIZED
position offsetLabel = 0,-15 //CAN BE INITIALIZED
int buttonWidth = 16 //CAN BE INITIALIZED
int arrowHeight = 10 //CAN BE INITIALIZED; IT CONTROLS THE HEIGHT OF THE THUMBSLIDER ARROWS
int get_itemheight = FALSE //CAN BE INITIALIZED; FLAGS WHETHER YOU WANT TO USE THE FONTHEIGHT AS THE HEIGHT FOR EACH ITEM
//LOCAL WORK VARIABLES
int max_items = 60
int num_displayed //THE NUMBER OF ITEMS DISPLAYED INSIDE THE LIST BOX; THIS IS AFFECTED IN THE INIT
int droppedflag = false //used to toggle the list up/down
int nSelected = 0 //the current selected item from the list of items
int lit //the value of the hightlighted item (not selected)
int over_me = false //am I over the list's region?
string list_item[max_items] //--------------MAX_ITEMS MUST BE SET BY YOU.
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
position mouse_capture //used to grab the mouse position and detect whether the mouse has been moved
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_dropbutton = s_dropbutton_skins
o_dropbutton.p_droparrowup = WPATH "Droplist_arrowup.tga"
o_dropbutton.p_droparrowdn = WPATH "Droplist_arrowdown.tga"
object o_uparrow_skins = s_arrow_skins
object o_downarrow_skins = s_arrow_skins
o_downarrow_skins.up = false // identifies this as the arrow down button
object o_thumbslide_skins = s_thumbslide_skins
object o_thumbregiontop_skins = s_thumbregion_skins
object o_thumbregionbot_skins = s_thumbregion_skins
//STARTS CLOSED BY HIDING BUTTONS
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
int nRollover = 0 // A flag to set if using c_rollover
int nHelpID = -1
framerate = 30
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
region = 0,0 to itemwidth,itemheight //region to click and drop the list (scales later)
initialize (o_dropbutton)
initialize (o_uparrow_skins)
initialize (o_downarrow_skins)
// determines what size the thumslider needs to be: if it's too small, the minimum size is 15
if list_size > max_displayed
{
num_displayed = max_displayed
o_thumbslide_skins.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2) / ((list_size)/num_displayed)
o_thumbslide_skins.region = 0,-2 to buttonwidth,o_thumbslide_skins.handleheight+2
o_uparrow_skins.region = 0,0 to buttonwidth,arrowHeight
o_downarrow_skins.region = 0,0 to buttonwidth,arrowHeight
if o_thumbslide_skins.handleheight < 15
{
o_thumbslide_skins.handleheight = 15
o_thumbslide_skins.region = 0,-2 to buttonwidth,o_thumbslide_skins.handleheight+2 // o_downarrow_skins.handleheight -> o_thumbslide_skins.handleheight
}
}
else
{
num_displayed = list_size //if the number of items is less than the max size of the list, shrink the size to the number listed
o_thumbslide_skins.handleheight = ((itemHeight*num_displayed)-(arrowHeight*2)-2)
o_downarrow_skins.region = 0,0 to 0,0
o_uparrow_skins.region = 0,0 to 0,0
o_downarrow_skins.region = 0,0 to 0,0
}
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight //region for arrow
//make sure the child objects are in the right locations
o_dropbutton.location = location.x+itemWidth,location.y,location.z+2
o_uparrow_skins.location = location.x+itemWidth, location.y+itemheight, location.z+5
o_downarrow_skins.location = location.x+itemWidth, location.y+itemheight+(itemHeight*num_displayed)-arrowHeight, location.z+5
o_thumbslide_skins.location = location.x+itemWidth, location.y+itemheight+arrowHeight+1, location.z+4
o_thumbregiontop_skins.location = location.x+itemWidth,location.y+itemHeight+arrowHeight,location.z+3
o_thumbregionbot_skins.location = location.x+itemWidth,(o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight),location.z+3
}
GUI_UNFOCUS
{
//shrinks list automatically, if another object is focused (being used)
if (droppedflag)
mail(-1,this)
}
GUI_ACTIVATE
{
activate(o_dropbutton)
// activate(o_uparrow_skins)
// activate(o_downarrow_skins)
// activate(o_thumbslide_skins)
// activate(o_thumbregiontop_skins)
// activate(o_thumbregionbot_skins)
// droppedflag = false
}
GUI_DEACTIVATE
{
deactivate(o_dropbutton)
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
if droppedflag //if list is dropped, pass the lit item to select
{
mail(lit,this)
}
else //else drop the list
{
mail(-1,this)
}
focus(this)
}
}
}
REGION_ENTERED
{
if (nRollover)
{
oRollover.nHelpID = nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
over_me = true
}
REGION_EXITED
{
if (nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
over_me = false
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
//toggles dropping the list to closing it!
if (sender == this || sender == o_dropbutton)
{
if (getmessage() == -1)
{
if (droppedflag)
{
region = 0,0 to itemWidth,itemHeight
o_dropbutton.region = 0-itemwidth,0 to buttonWidth,itemheight
o_dropbutton.location.z = location.z+2
deactivate(o_uparrow_skins)
deactivate(o_downarrow_skins)
deactivate(o_thumbslide_skins)
deactivate(o_thumbregiontop_skins)
deactivate(o_thumbregionbot_skins)
}
else
{
if list_size > 0
{
if list_size <= max_displayed
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
else
region = 0,itemHeight to itemWidth,itemHeight*(num_displayed+1)
o_dropbutton.region = 0-itemwidth-location.x,0-location.y to getresx()-o_dropbutton.location.x,getresy()-o_dropbutton.location.y
o_dropbutton.location.z = location.z-1
activate(o_uparrow_skins)
activate(o_downarrow_skins)
activate(o_thumbslide_skins)
activate(o_thumbregiontop_skins)
activate(o_thumbregionbot_skins)
lit = top_of_list
}
}
droppedflag = !droppedflag
if (droppedflag)
{
location.z = location.z + 5
o_uparrow_skins.location.z = o_uparrow_skins.location.z +5
o_downarrow_skins.location.z = o_downarrow_skins.location.z +5
o_thumbslide_skins.location.z = o_thumbslide_skins.location.z +5
o_thumbregiontop_skins.location.z = o_thumbregiontop_skins.location.z +5
o_thumbregionbot_skins.location.z = o_thumbregionbot_skins.location.z +5
}
else
{
location.z = location.z - 5
o_uparrow_skins.location.z = o_uparrow_skins.location.z -5
o_downarrow_skins.location.z = o_downarrow_skins.location.z -5
o_thumbslide_skins.location.z = o_thumbslide_skins.location.z -5
o_thumbregiontop_skins.location.z = o_thumbregiontop_skins.location.z -5
o_thumbregionbot_skins.location.z = o_thumbregionbot_skins.location.z -5
}
}
else
{
nSelected = lit
callback($$SelectSkin$$,nSelected)
mail(-1,this)
mail(nselected)
}
}
//up button pressed
if (sender == o_uparrow_skins)
{
if (top_of_list > 0)
{
top_of_list--
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_skins)
}
if (sender == o_downarrow_skins)
{
if (top_of_list < list_size-num_displayed)
{
top_of_list++
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_skins)
}
if (sender == o_thumbslide_skins)
{
if getmessage() < (location.y+itemHeight+arrowHeight+1)
o_thumbslide_skins.location.y = location.y+itemHeight+arrowHeight+1
if getmessage() > (location.y+(itemHeight*(num_displayed+1))-arrowHeight-(o_thumbslide_skins.handleheight))-1
o_thumbslide_skins.location.y = (location.y+(itemHeight*(num_displayed+1))-arrowHeight-1-o_thumbslide_skins.handleheight)
//1.) find out how many pixels from the top of the thumbslider region
//2.) calc total pixels to move thumbslider/calc num of items-num being drawn (to prevent any empty spaces)
//3.) find top item by taking the total area of pixels/num of pixels for one step (or scroll)
float tmp = (o_thumbslide_skins.location.y) - (location.y+itemHeight+arrowHeight+1)
o_thumbslide_skins.step_height = 0
if (list_size-num_displayed)
o_thumbslide_skins.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslide_skins.handleheight)-2) / (list_size-num_displayed)
float tmp_top_of_list = 0
if (o_thumbslide_skins.step_height)
tmp_top_of_list = tmp/o_thumbslide_skins.step_height + 0.0001
top_of_list = tmp_top_of_list
if top_of_list > list_size-num_displayed
{
top_of_list = list_size-num_displayed
}
}
if (sender == o_thumbregiontop_skins)
{
if (top_of_list-(num_displayed-1) >= 0)
{
top_of_list = top_of_list-(num_displayed-1)
}
else
{
top_of_list = 0
}
// tell the thumbslider to reposition itself
mail(0, o_thumbslide_skins)
}
if (sender == o_thumbregionbot_skins)
{
if (top_of_list+(num_displayed-1) < list_size-num_displayed)
{
top_of_list = top_of_list+(num_displayed-1)
}
else
{
top_of_list = list_size-num_displayed
}
// tell the thumbslider to reposition itself
mail(0 , o_thumbslide_skins)
}
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if lit > top_of_list
{
if lit <= (top_of_list+num_displayed-1) //if the lit box is visible to user, move;
{
lit = lit-1
mail(0,o_thumbslide_skins)
}
else
{
lit = lit-1
top_of_list = lit-(num_displayed-1) //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_skins)
}
}
else
{
if top_of_list > 0 //scrolls the list box when the lit box hits top
{
top_of_list--
lit = top_of_list
mail(0, o_thumbslide_skins)
}
}
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if lit < (top_of_list + num_displayed-1)
{
if lit >= top_of_list //if the lit box is visible to user, move
{
lit = lit+1
mail(0,o_thumbslide_skins)
}
else
{
lit = lit+1
top_of_list = lit //if not, jump to it's position by changing top_of_list
mail(0,o_thumbslide_skins)
}
}
else
{
if (top_of_list < list_size-num_displayed) //scrolls the list box when the lit box hits bottom
{
top_of_list++
lit = top_of_list + num_displayed-1
mail(0, o_thumbslide_skins)
}
}
}
key = getchar()
if key == char("\n") //enter is pressed to select the current lit item
{
mail(lit,this)
}
// tab section if you have our GOS Script tab routine
// if (key == 9) //9 is the value of a tab
// {
// mail(M_TABEVENT)
// }
}
GUI_EXECUTE
{
// compute lit items the pointer is floating over
if (over_me && mouse.x < location.x+itemWidth)
{
if (mouse_capture.y != mouse.y)
{
lit = top_of_list + ((mouse.y - (location.y+itemheight)) / itemheight)
if (lit > (list_size-1))
lit = -1
}
}
//resize negative space thumbslider regions ALWAYS
o_thumbregiontop_skins.region = 0,0 to buttonWidth, (o_thumbslide_skins.location.y-o_thumbregiontop_skins.location.y)
o_thumbregionbot_skins.location.y = (o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight)
o_thumbregionbot_skins.region = 0,0 to buttonWidth, (o_thumbslide_skins.location.y-3)-(o_thumbslide_skins.location.y+o_thumbslide_skins.handleheight))
mouse_capture = mouse.x,mouse.y
}
GUI_DRAW
{
if @netlobby@hide_this_player[id] == FALSE
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,itemheight
setpencolor(borderColor)
drawline location.x, location.y to location.x + itemwidth, location.y
drawline location.x, location.y to location.x, location.y + itemheight
setpencolor(shadowcolor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x + itemwidth, location.y to location.x + itemwidth, location.y + itemheight
// draw the list
if (droppedflag)
{
// draw background box
setpencolor(backColor)
ldrawrect 0,itemheight to itemwidth,((num_displayed+1)*(itemheight))
setpencolor(borderColor)
drawline location.x, location.y + itemheight to location.x + itemwidth, location.y + itemheight
drawline location.x, location.y + itemheight to location.x, location.y + ((num_displayed+1)*(itemheight))
setpencolor(shadowcolor)
drawline location.x, location.y + ((num_displayed+1)*(itemheight)) to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
drawline location.x + itemwidth, location.y + itemheight to location.x + itemwidth, location.y + ((num_displayed+1)*(itemheight))
//Prints list itself
lprint3d_margins = 0,0 to itemWidth+2,(itemHeight*(num_displayed+1))+2
int line= 1
for(int i=top_of_list; i < ((top_of_list)+num_displayed); i++) //line by line, print all options displayed
{
print3d_attributes = boxFont3d, boxtextcolor, 1,0,1,0,0
//prints highlighted box
if (lit == i)
{
//if you want, you may color the text
//print3d_attributes = boxFont3d, itemhighlightcolor, 1,0,1,0,0 //IF YOU WANT TO CHANGE TEXT COLOR WITH HIGHLIGHT
setpencolor(boxhighlightcolor)
ldrawrect 1, (line*itemheight) to itemwidth, ((line+1)*itemheight)
}
//changes color of text for the previous item selected
if (nSelected == i)
{
print3d_attributes = boxFont3d, boxTextSelectedColor, 1,0,1,0,0
}
lprint3d_position = 5, (line*itemheight) + ((itemHeight/2) - (getprint3dheight("text")/2)) //set the position for the print
if (length$(list_item[i]) > 0) //checks is there is anything to print
{
print3d list_item[i] //prints the next item
}
line ++
if line > list_size // if the line number ever attempts to pass up the list_size, it exits the print loop
{
break
}
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawrect 1,1 to itemwidth -1,itemheight-1
}
//prints current item selected in the the top box
lprint3d_margins = 0,0 to itemwidth, itemheight+2
// jcem - i centered text horizontally... by changing below 2 lines
print3d_attributes = boxFont3D, boxTextColor,1,0,1,0,0,just_center
lprint3d_position = 0, (itemHeight/2) - (getprint3dheight("text")/2) // 0<-5
if nselected > -1
print3d list_item[nSelected]
print3d_margins = 0,0 to 800,600
//Use for an optional label for the top of box
if length$(label)
{
print3d_attributes = labelFont3D, labelTextColor,1,0,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+2),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
}
//INITIALIZE MUST BE CALLED
s_dropbutton_skins
{
GUI_CREATE
{
region = 0,0 to 0,0 //MUST BE INITIALIZED
float nButtonWidth = 0
float nButtonHeight = 0
pane p_droparrowup //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!
pane p_droparrowdn //MUST BE INITIALIZED OUTSIDE OF THIS BUTTON!!!!
float offsetx = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
float offsety = 0,0 //CAN BE INITIALIZED - shifts a little for asymmetry in image
framerate = 30
}
GUI_INIT
{
nButtonWidth = getWidth(p_droparrowup) //parent.itemHeight //uses the pane's dimensions
nButtonHeight = getHeight(p_droparrowup) //
offsetx = (parent.buttonWidth-nButtonWidth)/2
offsety = (parent.itemHeight-nButtonHeight)/2
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
focus(parent) //toggles list down/up
mail(-1)
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
GUI_DRAW
{
// draw background
// setpencolor(parent.controlbackColor)
// drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// draw border
// setpencolor(parent.borderColor)
// drawframe location.x, location.y to location.x+parent.buttonWidth, location.y+parent.itemheight
// display arrow; two panes(images are used for the states of the list)
// if (parent.droppedflag)
// render p_droparrowup, location.x+offsetx,location.y+offsety
// else
// render p_droparrowdn, location.x+offsetx,location.y+offsety
}
}
s_arrow_skins
{
GUI_CREATE
{
int up = true //this object is used for either the up or down arrow; this is the flag so it knows
int timeToMove //created to store a delay value for button presses
float offsety //keeps arrow in center
float offsetx
// pane p_arrowup // if you choose to us bitmaps for the arrows
// pane p_arrowdown
framerate = 10
}
GUI_INIT
{
offsety = ((parent.arrowHeight-6)/2)+1
offsetx = ((parent.buttonWidth-12)/2)+1
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25,25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_listbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 5, 5/60 of a second to wait after mouse button has been held down
}
}
}
GUI_EXECUTE
{
}
GUI_DRAW
{
if @netlobby@hide_this_player[parent.id] == FALSE
{
// draw background
setpencolor(parent.facecolor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawline location.x, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y to location.x, location.y + parent.arrowheight
setpencolor(parent.shadowcolor)
drawline location.x + parent.buttonWidth, location.y to location.x + parent.buttonWidth, location.y
drawline location.x, location.y + parent.arrowheight to location.x + parent.buttonWidth, location.y + parent.arrowheight
setpencolor(0, 0, 0, 255)
if up == true
{
//render p_arrowup, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+5+offsetx,location.y-1+offsety to location.x+6+offsetx,location.y-1+offsety
drawline location.x+4+offsetx,location.y+offsety to location.x+7+offsetx,location.y+offsety
drawline location.x+3+offsetx,location.y+1+offsety to location.x+8+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+1+offsetx,location.y+3+offsety to location.x+10+offsetx,location.y+3+offsety
drawline location.x+offsetx,location.y+4+offsety to location.x+11+offsetx,location.y+4+offsety
}
else
{
//render p_arrowdown, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
drawline location.x+offsetx,location.y+offsety to location.x+11+offsetx,location.y+offsety
drawline location.x+1+offsetx,location.y+1+offsety to location.x+10+offsetx,location.y+1+offsety
drawline location.x+2+offsetx,location.y+2+offsety to location.x+9+offsetx,location.y+2+offsety
drawline location.x+3+offsetx,location.y+3+offsety to location.x+8+offsetx,location.y+3+offsety
drawline location.x+4+offsetx,location.y+4+offsety to location.x+7+offsetx,location.y+4+offsety
drawline location.x+5+offsetx,location.y+5+offsety to location.x+6+offsetx,location.y+5+offsety
}
}
}
}
s_thumbslide_skins // resizing handle
{
GUI_CREATE
{
float handleheight // this is very important for calculating behaviours
float step_height // float for the math part of thumbslider
float result // float to get the finished valuse to add to location
int thumb_pressed = false // was this slider pressed with left mouse button variable
}
GUI_MAILBOX
{
// the list top may have changed, recompute location
if sender.list_size <= sender.max_displayed //if the list doesn't go past the max_diplayed, there is no need to slide
{
location.y = (sender.location.y+sender.itemHeight+parent.arrowHeight+1)
}
else
{
if sender.top_of_list == sender.list_size-sender.num_displayed //if we are at the bottm of the list box, make sure that it's lined up against the down button correctly
{
location.y = sender.location.y+(sender.itemHeight*(sender.num_displayed+1))-parent.arrowHeight-handleheight-1
}
else //position formula = 1.) calc the size of the thumslider area/calc num of steps to slide = the pixel height of a single step 2.) calc the location of the very top of thumbslider 3.) add to the location the result of top_of_list times the step height
{
step_height = ((sender.itemHeight*sender.num_displayed)-(parent.arrowHeight*2)-(handleheight)-2) / (sender.list_size-sender.num_displayed)
location.y = sender.location.y+sender.itemheight+parent.arrowHeight+1
result = (sender.top_of_list * step_height)
location.y += result
}
}
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED) // this keeps a glitch from happening when using the thumbregions
{
thumb_pressed = true //now we can know that the user wanted to drag the thumbslider
}
else
if thumb_pressed
{
if (mouse.left == BUTTON_HELD) // this drags the thumbslider as long as the button is held
{
location.y = mouse.y-(handleheight/2)
mail (location.y)
always_in_region = true
}
else // if anything else but held, release the thumbslider
{
always_in_region = false
thumb_pressed = false
}
}
}
GUI_DRAW
{
if @netlobby@hide_this_player[parent.id] == FALSE
{
setpencolor(parent.backColor)
drawrect parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.bordercolor)
drawframe parent.location.x+parent.itemWidth, parent.location.y+parent.itemHeight to parent.location.x+parent.itemWidth+parent.buttonWidth, parent.location.y+(parent.itemHeight*(parent.num_displayed+1))
setpencolor(parent.facecolor)
drawrect location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
setpencolor(parent.framehighlightColor)
drawline location.x + 2, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + 1
drawline location.x + 2, location.y + 1 to location.x + 2, location.y + handleheight - 1
setpencolor(parent.shadowcolor)
drawline location.x + 2, location.y + handleheight - 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
drawline (location.x + parent.buttonWidth) - 1, location.y + 1 to (location.x + parent.buttonWidth) - 1, location.y + handleheight - 1
}
}
}
//script for scalable invisible regions for the thumbslider negative space
s_thumbregion_skins
{
GUI_CREATE
{
int timeToMove //created to store a delay value for button presses
}
REGION_ENTERED
{
if (parent.nRollover)
{
oRollover.nHelpID = parent.nHelpID
mail (nMSG_INPUT_RESID,oRollover)
}
}
REGION_EXITED
{
if (parent.nRollover)
{
mail (nMSG_CLEARHELP,oRollover)
}
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_PRESSED)
{
timeToMove = gettime()+parent.first_delay //if delay = 25, 25/60 of a second to wait after first click; gettime() takes the current clock value
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
}
if (mouse.left == BUTTON_HELD)
{
if gettime() > timeToMove
{
// notify parent object (the one running s_droplistbox)
mail( 0 ) //sends 0 (the value is not important in this case) to parent to do what's necessary to move the thumbslider
timeToMove = gettime()+parent.second_delay //if delay = 25, 5/60 of a second to wait after mouse button has been held down
}
}
}
}
@@ -0,0 +1,63 @@
s_tab_controller
{
GUI_CREATE
{
list tab_list // this variable holds all of the names of buttons,etc.
int current_pos = -2 // helps me track
int yy // loop variable
}
GUI_MAILBOX
{
// find current position in case it has changed using the mouse ////////////////////////////
current_pos = -2
list_top(tab_list)
for yy = 1; yy <= list_length(tab_list);yy++
{
if list_getitem(tab_list) == focused() //focused() holds the current highlighted button
{
current_pos = yy
yy = list_length(tab_list)+1
}
else
list_next(tab_list)
}
/////////////////////////////////////////////////////////////////////////////////////////////
if getmessage() > -1 // tab key is hit if value is not -1
{
current_pos++
if current_pos > list_length(tab_list) // if we moved past the last button, go to first
{
list_top(tab_list)
current_pos = 1
}
else // if we are not at the end, move one down the list
{
list_next(tab_list)
}
if current_pos > -1
focus(list_getitem(tab_list)) // focuses button/list to be controlled with keyboard
}
else // shft-tab key is hit
{
current_pos--
if current_pos < 1 // if we move past the first item, go to last
{
list_bottom(tab_list)
current_pos = list_length(tab_list)
}
else
{
list_prev(tab_list) // if we are not at first, move up the list
}
if current_pos > -1
focus(list_getitem(tab_list)) // focuses button/list to be controlled with keyboard
}
}
}
@@ -0,0 +1,29 @@
#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\editbox.script"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
main
{
GUI_CREATE
{
setresource("ScriptStrings.dll")
object o_error = o_errorscreen
o_error.error_header = ""
o_error.error_message = localize$(IDS_MP_WAITMESSAGE_CONNECTION_BEING_ESTABLISHED)
o_error.button_mode = ONE_BUTTON_MODE
o_error.buttonText[0] = localize$(IDS_MP_LOBBY_CANCEL)
initialize (o_error)
}
GUI_MAILBOX
{
if sender == o_error
{
callback($$SetShellCommand$$, DisconnectCommand)
}
}
}