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.
916 lines
29 KiB
Plaintext
916 lines
29 KiB
Plaintext
#include "Content\\ShellScripts\\ScriptStrings.h"
|
|
|
|
#ifndef FRAME_HIGHLIGHT_COLOR // don't use #undef, gosscript don't redefine(& undefine too) symbols
|
|
#define FRAME_HIGHLIGHT_COLOR packcolor(64,64,64,255) // jcem
|
|
#endif // FRAME_HIGHLIGHT_COLOR
|
|
|
|
s_droplistbox
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
string szPATH_FONTS1 = "Content\\ShellScripts\\Graphics\\Fonts\\"
|
|
string szPATH_GRAPHICS1 = "Content\\ShellScripts\\Graphics\\"
|
|
|
|
font3d boxFont3d = FPATH 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 = FRAME_HIGHLIGHT_COLOR // jcem - 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 = FPATH localize$(IDS_F_GEN_DROPDOWN) //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 = $$m_listBoxSize$$
|
|
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 backup = 0
|
|
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
|
|
|
|
$$m_listBoxSize$$ = 60 //This is so we go back to having 60 for lists who don't set their size
|
|
|
|
//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)
|
|
|
|
droppedflag = false
|
|
}
|
|
|
|
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)
|
|
// float spam = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslider.handleheight)-2) / (list_size-num_displayed)
|
|
o_thumbslider.step_height = ((itemHeight*num_displayed)-(arrowHeight*2)-(o_thumbslider.handleheight)-2) / (list_size-num_displayed)
|
|
if(o_thumbslider.step_height < 1 )
|
|
{
|
|
top_of_list = tmp
|
|
}
|
|
else
|
|
{
|
|
float tmp_top_of_list = tmp/o_thumbslider.step_height
|
|
top_of_list = tmp_top_of_list
|
|
// top_of_list = tmp/spam
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
|
|
}
|
|
|
|
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
|
|
{
|
|
// MSL Changed from 170 to 310 due to Added Mech's
|
|
// int help_id = 170 + lit
|
|
int help_id = 310 + 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)
|
|
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(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 // 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
|
|
}
|
|
}
|
|
}
|
|
}
|