Files
firestorm/Gameleap/mw4/Content/ShellScripts/gs_multi_id.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

511 lines
15 KiB
Plaintext

#include "Content\\ShellScripts\\stddefs.h"
#include "Content\\ShellScripts\\ScriptStrings.h"
#include "Content\\ShellScripts\\buttons.script"
#include "Content\\ShellScripts\\ErrorScreen.script"
#include "Content\\ShellScripts\\common_shell.script" // jcem
#define RANK_MAXLOOPS 9 // sync w/ gs_single_rank.script
#define ALPHA_MIN 0
#define ALPHA_DEC 15 // fade out deccrement down to ALPHA_MIN
#define ALPHA_INIT_VALUE 5 // should be between ALPHA_MIN < & < ALPHA_MAX
#define ALPHA_INC 15 // fade in incrementsupward ALPHA_MAX
#define ALPHA_MAX 120 //
#define MAX_STR_TYPE_LEN 16 // sync w/ MW4SHELL::CTCL_CheckCampaign(6, ...)
#define MAX_CAPS 40 // 0-9 a-z '-' ' ' BkSP Enter
#define CAPS_PER_ROW 10
#define NAME_HEIGHT 28
#define NAME_GAPY 15
#define TYPE_HEIGHT 32
#define TYPE_GAPY 15
#define CAPS_YSTART 280
#define CAPS_LMARGIN 180
#define CAPS_RMARGIN (180 - 30)
#define CAPS_TOTALX (800 - CAPS_LMARGIN - CAPS_RMARGIN)
#define CAPS_WIDTH (CAPS_TOTALX / CAPS_PER_ROW)
#define CAPS_HEIGHT 48
#define CAPS_GAPY 7
#define PM_FIX_CURCAP (-4876)
#define NAME_TIME_HEIGHT 60 // 60 pixel high
#define MAX_IDLE 15000
#define MAX_IDLE2 10000
main
{
GUI_CREATE
{
if callback($$CTCL_CheckUseJPD$$)
setpointer(0)
location = 0, 0, 10000
//Makes the connection to the string table .dll
//Requires the #include "Content\\ShellScripts\\ScriptStrings.h" in every script with localizable text
setresource("ScriptStrings.dll")
object screen = o_ID_Screen
initialize(screen)
focus(screen.o_fscreen)
mail(25, @shell@volumn_control)
}
}
o_ID_Screen
{
GUI_CREATE
{
int nTimeCutOFF
int nTime_Quit = MAX_IDLE
int nTime_Left = -1
int nTime_Cur // temp value
nTimeCutOFF = gettimex() + nTime_Quit
framerate=10
sound sndOpenPanel = SPATH "sfx_vtol_drop.wav" // sfx_turret_actuator.wav
play sndOpenPanel, 1
callback($$CTCL_SetDispStateCOOP$$, 0, 1, 1)
callback($$CTCL_SetDispStateCOOP$$, 1, 1, 0)
callback($$CTCL_SetDispStateCOOP$$, 2, 1, 7)
callback($$CTCL_SetDispStateCOOP$$, 3, 1, 1)
int MAX_ROWS = MAX_CAPS / CAPS_PER_ROW
if MAX_CAPS % CAPS_PER_ROW // if MAX_CAPS % CAPS_PER_ROW != 0
MAX_ROWS = MAX_ROWS + 1
// variables for fading in and out
int alpha_val = ALPHA_INIT_VALUE
int fadeout = false
int nRetBut = 0
int str_length
string str_typed
int uPlayerID
string aCaps[MAX_CAPS]
//callback($$CTCL_GetPlayerName$$, str_typed)
font3d font_mesg = "arial.ttf" // FPATH ""
font3d TypeFont = "arial.ttf"
font3d CapsFont = "h_keybd.ttf"
if callback($$CTCL_GetACP$$) == 949 // korean
font3d help_font = "굴림.ttf"
else
font3d help_font = "arial.ttf" // FPATH ""
int row
int col
int i_loop
for i_loop = 48; i_loop < 58; i_loop++ // '0' - '9'
{
aCaps[i_loop - 48] = chr$(i_loop)
}
for i_loop = 65; i_loop < 91; i_loop++ // 'A' - 'Z'
{
aCaps[i_loop - 65 + 10] = chr$(i_loop)
}
aCaps[10 + 26 + 0] = "-"
aCaps[10 + 26 + 1] = chr$(0xb8) // 0xb8, space
aCaps[10 + 26 + 2] = chr$(0xc1) // 0xc1, BackSpace( <- )...
aCaps[10 + 26 + 3] = chr$(0xc6) // 0xc6, Enter
int nCurCap = 10 + 26 + 2 // back space, 0
object o_fscreen = s_fscreen
o_fscreen.playHorz = 1
o_fscreen.playVert = 1
initialize(o_fscreen)
pane p_infopanel = "hsh\\coop\\infopanel.png"
color(p_infopanel) = packcolor(255, 255, 255, 255)
alphamode(p_infopanel) = am_alpha_alphainvalpha
int nDiffX = 15
int nPanelX = -getwidth(p_infopanel)
pane p_yourname = "hsh\\coop\\enteryourname.png"
color(p_yourname) = packcolor(255, 255, 255, 255)
alphamode(p_yourname) = am_alpha_alphainvalpha
}
GUI_INIT
{
}
GUI_EXECUTE
{
if (!fadeout)
{
nTime_Cur = gettimex()
if nTimeCutOFF <= nTime_Cur
{
// esc.. cancel this screen
if 0 == length$(str_typed)
{
str_typed = "nonamed"
}
fadeout = true
nRetBut = fs_but1
return
}
else
{
nTime_Cur = nTimeCutOFF - nTime_Cur
nTime_Cur = nTime_Cur + 500 // round up
nTime_Cur = nTime_Cur / 1000 // as sec
if nTime_Cur < 0
nTime_Cur = 0
if (nTime_Quit / 1000) < nTime_Cur
nTime_Cur = nTime_Quit / 1000
// display as sec...
nTime_Left = nTime_Cur
}
}
if fadeout == true
{
// Fading out(Exiting)
if ALPHA_MIN < alpha_val
{
alpha_val = alpha_val - ALPHA_DEC
if alpha_val <= ALPHA_MIN
{
alpha_val = ALPHA_MIN
unfocus
if nRetBut == fs_but1
{
if @SHELL@id_type_is_single
{
string saNames[RANK_MAXLOOPS]
int naStages[RANK_MAXLOOPS]
int naScores[RANK_MAXLOOPS]
int naKills[RANK_MAXLOOPS]
int naDeaths[RANK_MAXLOOPS]
int naTime[RANK_MAXLOOPS]
int naMech[RANK_MAXLOOPS]
int naSuccess[RANK_MAXLOOPS]
int nLastIdx = RANK_MAXLOOPS
int nScores
nScores = callback($$CTCL_CheckCampaign$$,6,nLastIdx,saNames[0], naStages[0], naScores[0], naKills[0], naDeaths[0], naTime[0], naMech[0], naSuccess[0])
if nLastIdx != -1
{
saNames[nLastIdx] = str_typed
}
callback($$CTCL_CheckCampaign$$,7,nScores,saNames[0], naStages[0], naScores[0], naKills[0], naDeaths[0], naTime[0], naMech[0], naSuccess[0])
@SHELL@currentScreen = @SHELL@lastScreen[@SHELL@lastScreenDepth]
@SHELL@lastScreenDepth--
}
else
{
#if 1
callback($$CTCL_SetPlayerName$$, str_typed, uPlayerID)
callback($$SetShellCommand$$, StartNetworkShellsCommand)
@SHELL@currentScreen = LAUNCHGAME
@SHELL@lastScreenDepth--
#else
//@SHELL@lastScreenDepth++
//@SHELL@lastScreen[@SHELL@lastScreenDepth] = MAINMENU
//@SHELL@currentScreen = // 200 // CAMPAIGNLOBBY
#endif
}
}
else
{
@SHELL@currentScreen = MAINMENU // @SHELL@lastScreen[@SHELL@lastScreenDepth]
@SHELL@lastScreen[@SHELL@lastScreenDepth] = MAINMENU
@SHELL@lastScreenDepth--
}
//script_end "gs_multi_id.script"
}
}
return
}
else
{
// Fading in(Entering)
if alpha_val < ALPHA_MAX
{
alpha_val += ALPHA_INC
if alpha_val >= ALPHA_MAX
{
alpha_val = ALPHA_MAX
}
}
}
nDiffX = nDiffX + 15
if nPanelX < 0
nPanelX = nPanelX + nDiffX
if 0 < nPanelX
nPanelX = 0
}
GUI_DRAW
{
render @shell@p_bkgnd_4coop, 0, 0, 0
setpencolor(0, 0, 40, alpha_val)
drawrect 0, 0 to getresx(), getresy()
int boxcolor
#if 0
boxcolor = packcolor(0, 0, 120, 255) // blue
setpencolor(boxcolor)
drawrect 0, 0 to getresx(), getresy()
#endif
render p_infopanel, nPanelX, 0, 0
int x
int y
y = CAPS_YSTART - (TYPE_HEIGHT + TYPE_GAPY) - (NAME_HEIGHT + NAME_GAPY)
render p_yourname, nPanelX + CAPS_LMARGIN, y, 1
int nWidth
int n_color
string text
int text_size
for i_loop = 0; i_loop < MAX_CAPS; i_loop++
{
row = i_loop / CAPS_PER_ROW
col = i_loop % CAPS_PER_ROW
x = CAPS_LMARGIN + CAPS_WIDTH * col
y = CAPS_YSTART + CAPS_HEIGHT * row
if 0 < row
y = y + CAPS_GAPY * (row - 1)
text = aCaps[i_loop]
text_size = -(1000 + CAPS_HEIGHT)
if nCurCap == i_loop
n_color = packcolor(255,255,0,255)
else
{
if (i_loop == MAX_CAPS - 1)
n_color = packcolor(255,255,255,255)
else
n_color = packcolor(240,240,240,255)
}
print3d_attributes = CapsFont, n_color, text_size,0,1,1,0,just_left,1
nWidth = getprint3dwidth(text)
x = x + (CAPS_WIDTH - nWidth) / 2
print3d_position = nPanelX + x, y
print3d text
}
boxcolor = packcolor(192, 192, 192, 200) // half-transparent editing-box
setpencolor(boxcolor)
y = CAPS_YSTART - (TYPE_HEIGHT + TYPE_GAPY)
drawrect nPanelX + CAPS_LMARGIN, y to nPanelX + getresx() - CAPS_RMARGIN, y + TYPE_HEIGHT
text_size = -(1000 + TYPE_HEIGHT)
n_color = packcolor(255,255,0,255)
print3d_attributes = TypeFont, n_color, text_size,0,1,1,0,just_left,1
print3d_position = nPanelX + CAPS_LMARGIN + 10, y
print3d str_typed
if (nPanelX == 0) && (nTime_Left != -1)
{
print3d_margins = 610, 140 to 690, 214
text = conv$(nTime_Left)
text_size = -(1000 + NAME_TIME_HEIGHT)
n_color = packcolor(255,255,255,255)
print3d_attributes = font_mesg, n_color, text_size,0,1,1,0,just_center,1
int nHeight = getprint3dheight(text)
print3d_position = 610, 214 - nHeight
print3d text
// jcem - draw help text!!!
print3d_attributes = help_font, 0xff80ff00, -(1000 + 14), 1, 1, 1, 0, just_center
print3d_margins = 140, 490 to 670, 530
print3d_position = 140, 490
if callback($$CTCL_GetACP$$) == 949 // korean
{
print3d "조이스틱의 햇(HAT)을 상하좌우로 움직여 방아쇠를 당기면 글자가 입력됩니다. 입력이 끝나면 우하단 Enter키를 선택하신 후 방아쇠를 당기십시오.\n초기 화면은 엄지(미사일) 버튼을 누르시면 됩니다."
}
else
{
print3d "Use HAT(on joystick) to move cursor. Trigger on ENTER end of typing.\nThumb button(on joythick) for MainScreen."
}
}
}
GUI_MAILBOX
{
if sender == this
{
if getmessage(0) == PM_FIX_CURCAP
{
int row_dif = getmessage(1)
int col_dif = getmessage(2)
row = nCurCap / CAPS_PER_ROW
col = nCurCap % CAPS_PER_ROW
row = row + row_dif
col = col + col_dif
if row < 0
row = MAX_ROWS - 1
if MAX_ROWS <= row
row = 0
if col < 0
col = CAPS_PER_ROW - 1
if CAPS_PER_ROW <= col
col = 0
int NewCap
NewCap = row * CAPS_PER_ROW + col
if MAX_CAPS <= NewCap
{
if row_dif
{
if row_dif < 0
NewCap = NewCap - CAPS_PER_ROW
if row_dif > 0
NewCap = NewCap % CAPS_PER_ROW
}
else
{
if col_dif < 0
NewCap = MAX_CAPS - 1
if col_dif > 0
NewCap = (MAX_CAPS / CAPS_PER_ROW) * CAPS_PER_ROW
}
}
if nCurCap != NewCap
{
nCurCap = NewCap
}
}
return
}
if sender == o_fscreen
{
nTime_Cur = gettimex()
nTime_Quit = nTimeCutOFF - nTime_Cur
nTime_Quit = nTime_Quit / 1000
nTime_Quit = nTime_Quit * 1000
if nTime_Quit < MAX_IDLE2
nTime_Quit = MAX_IDLE2
if MAX_IDLE < nTime_Quit
nTime_Quit = MAX_IDLE // possible?
nTime_Left = nTime_Quit / 1000
nTimeCutOFF = gettimex() + nTime_Quit
int kEvent = getmessage(1)
if kEvent == fs_but1
{
str_length = length$(str_typed)
if str_length < MAX_STR_TYPE_LEN
{
if nCurCap < 10
{
str_typed = str_typed chr$(48 + nCurCap)
return
}
if nCurCap < 10 + 26
{
str_typed = str_typed chr$(nCurCap - 10 + 65)
return
}
if nCurCap == 10 + 26 + 0
{
str_typed = str_typed "-"
return
}
if nCurCap == 10 + 26 + 1
{
if 0 < str_length
str_typed = str_typed " "
return
}
}
if nCurCap == 10 + 26 + 2
{
if 0 < str_length
{
str_typed = left$(str_typed, str_length - 1)
}
return
}
if nCurCap == 10 + 26 + 3 // end select...
{
//if 0 < str_length
{
if 0 == length$(str_typed)
{
str_typed = "nonamed"
}
fadeout = true
nRetBut = fs_but1
return
}
}
return
}
if kEvent == fs_but2
{ // esc.. cancel this screen
//play btnTriggeredSound,1
fadeout = true
nRetBut = fs_but2
return
}
if (kEvent & fs_left)
{
mail(PM_FIX_CURCAP, 0, -1, this)
}
if (kEvent & fs_right)
{
mail(PM_FIX_CURCAP, 0, +1, this)
}
if (kEvent & fs_up)
{
mail(PM_FIX_CURCAP, -1, 0, this)
}
if (kEvent & fs_down)
{
mail(PM_FIX_CURCAP, +1, 0, this)
}
}
}
GUI_DESTROY
{
unfocus
}
}