Files
firestorm/_UNUSED/GameleapCode5_03/Content/ShellScripts/Spinbox.script
T
Cyd 2b8ca921cb 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.
2026-06-24 21:28:16 -05:00

579 lines
15 KiB
Plaintext

s_spinbox
{
GUI_CREATE
{
font3d boxFont3d //MUST BE INITIALIZED
int backColor = packcolor (0,0,0,255) //CAN BE INITIALIZED
int boxTextColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int controlColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int selectedColor = packcolor (30,30,30,100) //CAN BE INITIALIZED
int SelectedHighlightColor = packcolor (200,200,200,130) //CAN BE INITIALIZED
int framehighlightColor = packcolor (255, 255, 255, 255) //CAN BE INITIALIZED
int ItemHighlightColor = packcolor (100,100,200,255) //CAN BE INITIALIZED
int boxhighlightColor = packcolor (220,220,220,255) //CAN BE INITIALIZED
int boxTextSelectedColor = packcolor (100,100,100,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 itemWidth = 0 //MUST BE INITIALIZED
int itemHeight = 0 //MUST BE INITIALIZED
int list_size = 0 //MUST BE INITIALIZED
int max_displayed = 1 //MUST BE INITIALIZED
int text_alignment
int textoffsety
int numeric_spinbox = false
int numeric_spinbox_min = 0
int numeric_spinbox_max = 100
string label = "" //CAN BE INITIALIZED
font3d labelFont3d //MUST BE INITIALIZED
position offsetLabel //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 nSelected = 0 //the current selected item from the list of items
string list_item[MAX_SPIN_ITEMS] //--------------MAX_ITEMS MUST BE SET BY YOU.
int over_me = false //am I over the list's region?
int first_delay = 30 //time delay value n/60; for the buttons
int second_delay = 5 //time delay value n/60; for the buttons
int prevent_rollover = false //flag (TRUE/FALSE) to override the limits running into each other
//CREATE CHILDREN BUTTONS--THEY MUST EXIST FOR THE DROPBOX TO WORK!!
object o_uparrow = s_arrow_spinbox
object o_downarrow = s_arrow_spinbox
o_downarrow.up = false // identifies this as the arrow down button
int id = 0
framerate = 30
}
GUI_ACTIVATE
{
activate(o_uparrow)
activate(o_downarrow)
}
GUI_DEACTIVATE
{
deactivate(o_uparrow)
deactivate(o_downarrow)
}
GUI_INIT
{
if get_itemheight == true
{
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
itemHeight = getprint3dheight("Temp")+1
}
if numeric_spinbox
{
if nSelected < numeric_spinbox_min || nSelected > numeric_spinbox_max
nSelected = numeric_spinbox_min
}
print3d_attributes = boxFont3d, boxTextColor,1,1,1,0,0
textoffsety = (itemHeight - getprint3dheight("Temp")+1)/2
arrowHeight = itemHeight/2
initialize (o_uparrow)
initialize (o_downarrow)
num_displayed = max_displayed
//make sure the child objects are in the right locations
o_uparrow.location = location.x+itemWidth+1, location.y, location.z+5
o_downarrow.location = location.x+itemWidth+1, location.y+arrowHeight, location.z+5
o_uparrow.region = 0,0 to buttonwidth,arrowHeight
o_downarrow.region = 0,0 to buttonwidth,arrowHeight
region = 0,0 to itemWidth,itemHeight
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
if mouse.x < location.x+itemWidth // ensures that you are clicking inside the list box
{
focus(this)
}
}
}
REGION_ENTERED
{
over_me = true
if exists(@infobox@)
{
mail(id, @infobox@)
}
}
REGION_EXITED
{
over_me = false
if exists(@infobox@)
{
mail(-1, @infobox@)
}
}
GUI_MAILBOX // MAILBOX IS USED TO HANDLE MESSAGES FROM THE BUTTON OBJECTS; IT DOES A LOT OF THE WORK!
{
focus(this)
//up button pressed
if (sender == o_uparrow)
{
if numeric_spinbox
{
if (nSelected < numeric_spinbox_max)
nSelected++
else
if prevent_rollover == false
nSelected = numeric_spinbox_min
}
else
{
if (nSelected < list_size-num_displayed)
nSelected++
else
if prevent_rollover == false
nSelected = 0
}
}
if (sender == o_downarrow)
{
if numeric_spinbox
{
if (nSelected > numeric_spinbox_min)
nSelected--
else
if prevent_rollover == false
nSelected = numeric_spinbox_max
}
else
{
if (nSelected > 0)
nSelected--
else
if prevent_rollover == false
nSelected = list_size-1
}
}
mail(nSelected)
}
GUI_CHAR
{
int key = getCTRLchar()
IF KEY == 38 //IF UP ARROW KEY IS PRESSED
{
if numeric_spinbox
{
if (nSelected < numeric_spinbox_max)
nSelected++
else
if prevent_rollover == false
nSelected = numeric_spinbox_min
}
else
{
if (nSelected < list_size-num_displayed)
nSelected++
else
if prevent_rollover == false
nSelected = 0
}
}
IF KEY == 40 //IF DOWN ARROW KEY IS PRESSED
{
if numeric_spinbox
{
if (nSelected > numeric_spinbox_min)
nSelected--
else
if prevent_rollover == false
nSelected = numeric_spinbox_max
}
else
{
if (nSelected > 0)
nSelected--
else
if prevent_rollover == false
nSelected = list_size-1
}
}
key = getchar()
// tab section if you have our GOS Script tab routine
// if (key == 9) //9 is the value of a tab
// {
// mail(M_TABEVENT)
// }
}
GUI_DRAW
{
// draw background box
setpencolor(backColor)
ldrawrect 0,0 to itemwidth,(itemheight)
setpencolor(borderColor)
ldrawframe 0,0 to itemwidth,(itemheight)
//Prints list itself
lprint3d_margins = 2,0 to itemWidth,itemHeight+2
print3d_attributes = boxFont3d, boxtextcolor, 1,1,1,0,0,text_alignment
lprint3d_position = 2, textoffsety //set the position for the print
if numeric_spinbox == true
{
print3d nSelected
}
else
{
if (length$(list_item[nSelected]) > 0) //checks is there is anything to print
{
print3d list_item[nSelected] //prints the next item
}
}
// draw hot border
if gotfocus(this)
{
setpencolor(framehighlightcolor)
ldrawframe 0,0 to itemwidth,itemheight
}
//Use for an optional label for the top of box
if (length$(label) > 0)
{
print3d_attributes = labelFont3D, labelTextColor,1,1,1,0,0
lprint3d_position = offsetLabel.x+1, offsetLabel.y
lprint3d_margins = offsetLabel.x, offsetLabel.y to (offsetLabel.x + getprint3dwidth(label)+50),(offsetLabel.y + getprint3dheight(label)+3)
print3d label
}
}
}
s_arrow_spinbox
{
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_arrow // if you choose to us bitmaps for the arrows
int use_bitmap = false
framerate = 10
}
GUI_INIT
{
if exists(p_arrow)
{
parent.buttonwidth = getwidth(p_arrow)
parent.arrowHeight = getheight(p_arrow)
offsety = 0
offsetx = 0
use_bitmap = true
}
else
{
offsety = ((parent.arrowHeight-6)/2)
offsetx = ((parent.buttonWidth-12)/2)+1
}
}
REGION_ENTERED
{
if exists(@infobox@)
{
mail(parent.id, @infobox@)
}
}
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_DRAW
{
// draw background
setpencolor(parent.controlColor)
drawrect location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
// draw border
setpencolor(parent.borderColor)
drawframe location.x, location.y to location.x+parent.buttonWidth, location.y+parent.arrowHeight
setpencolor(parent.backColor)
if up == true
{
if use_bitmap
{
render p_arrow, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
}
else
{
drawline location.x+5+offsetx,location.y+offsety to location.x+6+offsetx,location.y+offsety
drawline location.x+4+offsetx,location.y+1+offsety to location.x+7+offsetx,location.y+1+offsety
drawline location.x+3+offsetx,location.y+2+offsety to location.x+8+offsetx,location.y+2+offsety
drawline location.x+2+offsetx,location.y+3+offsety to location.x+9+offsetx,location.y+3+offsety
drawline location.x+1+offsetx,location.y+4+offsety to location.x+10+offsetx,location.y+4+offsety
drawline location.x+offsetx,location.y+5+offsety to location.x+11+offsetx,location.y+5+offsety
}
}
else
{
if use_bitmap
{
render p_arrow, location.x,location.y // if you decide to use a graphic for each arrow, here's where they need to be
}
else
{
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_plus_minus_int
{
GUI_CREATE
{
font3d regfont = FPATH localize$(IDS_F_GEN_SPINBOX)
int backcolor = packcolor(0, 0, 0, 255)
int highlightcolor = packcolor(255, 255, 255, 255)
int facecolor = packcolor(187, 187, 204, 255)
int shadowcolor = packcolor(119, 119, 119, 255)
int fontcolor = packcolor(255, 255, 255, 255)
int boxwidth = 50
int boxheight = 20
int controlwidth = 16
int displaywidth
int displayed_value
pane arrows = WPATH "plus_minus.tga"
alphamode(arrows) = am_Alpha_AlphaInvAlpha
origin(arrows) = (getwidth(arrows) / 2), (getheight(arrows) / 2)
int id
}
GUI_INIT
{
region = 0, 0 to boxwidth, boxheight
displaywidth = boxwidth - controlwidth
}
GUI_EXECUTE
{
if displayed_value < 0
{
displayed_value = 0
}
}
REGION_ENTERED
{
if exists(@infobox@)
{
mail(id, @infobox@)
}
}
REGION_EXITED
{
if exists(@infobox@)
{
mail(-1, @infobox@)
}
}
GUI_DRAW
{
setpencolor(backcolor)
ldrawrect 0, 0 to boxwidth, boxheight
setpencolor(facecolor)
ldrawrect boxwidth - controlwidth, 0 to boxwidth, boxheight
setpencolor(highlightcolor)
drawline location.x, location.y to location.x + boxwidth, location.y
drawline location.x, location.y to location.x, location.y + boxheight
setpencolor(shadowcolor)
drawline location.x, location.y + boxheight to location.x + boxwidth,location.y + boxheight
drawline location.x + boxwidth, location.y to location.x + boxwidth, location.y + boxheight
render arrows, (location.x + boxwidth) - (controlwidth / 2), (location.y + (boxheight / 2))
print3d_attributes = regfont, fontcolor, 1, 1, 1, 0, 0, just_right
print3d_margins = location.x + 3, location.y + 3 to location.x + displaywidth, location.y + boxheight
print3d_position = location.x + 3, location.y + 3
print3d displayed_value
}
LBUTTON_UPDATE
{
if mouse.x > location.x + displaywidth
{
if mouse.left == BUTTON_CLICKED
{
if mouse.y < location.y + (boxheight / 2)
{
mail(1)
}
if mouse.y > location.y + (boxheight / 2)
{
mail(-1)
}
}
}
}
}
s_plus_minus_float
{
GUI_CREATE
{
font3d regfont = FPATH localize$(IDS_F_GEN_SPINBOX)
int backcolor = packcolor(0, 0, 0, 255)
int highlightcolor = packcolor(255, 255, 255, 255)
int facecolor = packcolor(187, 187, 204, 255)
int shadowcolor = packcolor(119, 119, 119, 255)
int fontcolor = packcolor(255, 255, 255, 255)
int boxwidth = 50
int boxheight = 20
int controlwidth = 16
int displaywidth
float displayed_value
pane arrows = WPATH "plus_minus.tga"
alphamode(arrows) = am_Alpha_AlphaInvAlpha
origin(arrows) = (getwidth(arrows) / 2), (getheight(arrows) / 2)
int id = 0
}
GUI_INIT
{
region = 0, 0 to boxwidth, boxheight
displaywidth = boxwidth - controlwidth
}
GUI_EXECUTE
{
if displayed_value < 0
{
displayed_value = 0
}
}
REGION_ENTERED
{
if exists(@infobox@)
{
mail(id, @infobox@)
}
}
REGION_EXITED
{
if exists(@infobox@)
{
mail(-1, @infobox@)
}
}
GUI_DRAW
{
setpencolor(backcolor)
ldrawrect 0, 0 to boxwidth, boxheight
setpencolor(facecolor)
ldrawrect boxwidth - controlwidth, 0 to boxwidth, boxheight
setpencolor(highlightcolor)
drawline location.x, location.y to location.x + boxwidth, location.y
drawline location.x, location.y to location.x, location.y + boxheight
setpencolor(shadowcolor)
drawline location.x, location.y + boxheight to location.x + boxwidth,location.y + boxheight
drawline location.x + boxwidth, location.y to location.x + boxwidth, location.y + boxheight
render arrows, (location.x + boxwidth) - (controlwidth / 2), (location.y + (boxheight / 2))
print3d_attributes = regfont, fontcolor, 1, 1, 1, 0, 0, just_right
print3d_margins = location.x + 3, location.y + 3 to location.x + displaywidth, location.y + boxheight
print3d_position = location.x + 3, location.y + 3
print3d displayed_value
}
LBUTTON_UPDATE
{
if mouse.x > location.x + displaywidth
{
if mouse.left == BUTTON_CLICKED
{
if mouse.y < location.y + (boxheight / 2)
{
mail(1)
}
if mouse.y > location.y + (boxheight / 2)
{
mail(-1)
}
}
}
}
}