Files
firestorm/Gameleap/mw4/Content/ShellScriptsDev/chat.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

282 lines
6.9 KiB
Plaintext

#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\NetParams.h"
#include "Content\\GameTypes.h"
#include "Content\\ShellScripts\\Multiplayer\\mc_listboxes.script"
#include "Content\\ShellScripts\\editbox.script"
main
{
GUI_CREATE
{
setresource("ScriptStrings.dll")
font3d regfont = FPATH localize$(IDS_F_ML_LABEL)
int MAX_ITEMS = 60
int MAX_MC_ITEMS = 30 //MAXIMUM NUMBER OF ITEMS LISTED
int MAX_MC_COLUMNS = 1
int MAX_MCCB_ITEMS = 30
int MAX_MCCB_COLUMNS = 2
int hosting = false
int valid_player
int sender_is_me
int locx = 10
int locy = 526
int boxwidth = 614
int boxheight = 42
object o_chat_box = s_mc_listbox
o_chat_box.location = locx,locy,1
o_chat_box.boxFont3d = FPATH localize$(IDS_F_CHAT_BOX) //MUST BE INITIALIZED
o_chat_box.itemWidth = boxwidth //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
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 = boxheight // 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.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
int greatest_x = 0
int greatest_y = 0
int k
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
int x
for x = 0;x < MAX_MCCB_ITEMS; x++
{
o_chat_box.list_order[x] = x
o_chat_box.column[0].list_item[x] = ""
}
object o_chat_entry = s_editbox
o_chat_entry.location = locx,locy + boxheight + 1,20
o_chat_entry.boxWidth = boxwidth+ 17 //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)
o_chat_entry.boxTextOffset = 3,3
o_chat_entry.Auto_Update = FALSE
o_chat_entry.keyboard_sound = TRUE
enableIME(true, o_chat_entry)
object o_chat_toggle = text_toggle
o_chat_toggle.location = 345, 511, 50
o_chat_toggle.boxwidth = 148
o_chat_toggle.boxheight = 15
o_chat_toggle.text = localize$(IDS_ML_CHAT)
o_chat_toggle.state = 1
object o_Comstar_toggle = text_toggle
o_Comstar_toggle.location = 345 + 148, 511, 50
o_Comstar_toggle.boxwidth = 148
o_Comstar_toggle.boxheight = 15
o_Comstar_toggle.text = localize$(DNL_COMSTAR_SHORT)
o_Comstar_toggle.state = 0
initialize (o_chat_box)
initialize (o_chat_entry)
initialize(o_chat_toggle)
initialize(o_Comstar_toggle)
int namemech_flag = 0
}
GUI_MAILBOX
{
if sender == 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
callback($$SendChat$$)
o_chat_entry.boxvalue = ""
initialize(o_chat_entry)
sender_is_me = true
}
if sender == o_chat_toggle
{
o_chat_toggle.state = 1
o_Comstar_toggle.state = 0
namemech_flag = 0
activate(o_chat_box)
activate(o_chat_entry)
}
if sender == o_Comstar_toggle
{
o_Comstar_toggle.state = 1
o_chat_toggle.state = 0
namemech_flag = 1
deactivate(o_chat_box)
deactivate(o_chat_entry)
if exists(@infobox@)
{
mail(-1, @infobox@)
}
}
}
GUI_CHAR
{
if namemech_flag == 1
{
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 o_chat_toggle.state == 1
{
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]
}
if (o_chat_box.o_thumbslider.thumb_pressed == false)
{
o_chat_box.reset_location = 2
o_chat_toggle.flash = 1
}
else
{
o_chat_box.reset_location = 1
}
initialize (o_chat_box)
}
}
if sender_is_me == TRUE
{
sender_is_me = FALSE
}
}
}
GUI_DRAW
{
setpencolor(255, 255, 255, 255)
drawrect 344, 511 to 641, 525
}
}
text_toggle
{
GUI_CREATE
{
int boxwidth
int boxheight
int id
int flash
int state
int textcolor = packcolor(0, 0, 0, 255)
string text
framerate = 10
}
GUI_INIT
{
region = 0, 0 to boxwidth, boxheight
}
GUI_EXECUTE
{
if state == 0
{
if flash == 1
{
textcolor = packcolor(150, 0, 0, 255)
flash = 0
}
else
{
textcolor = packcolor(0, 0, 0, 255)
}
}
if state == 1
{
textcolor = packcolor(255, 114, 0, 255)
}
}
LBUTTON_UPDATE
{
if state == 0
{
if mouse.left == BUTTON_CLICKED
{
mail(-1)
}
}
}
GUI_DRAW
{
print3d_attributes = regfont, textcolor, 1, 1, 1, 0, 0, just_center
print3d_margins = location.x, location.y to location.x + boxwidth, location.y + boxheight
print3d_position = location.x, location.y
print3d text
}
}