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,228 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
s_simpledropbox
{
GUI_CREATE
{
font3d dropboxFont = "arial.ttf"
int textsize = 1
int textcolor = 0xffffffff
int backcolor = 0
int bordercolor = 0xffffffff
int droppedflag = 0
int selected = 0
int itemwidth = 128
int itemheight = 16
int total_items = 0
string Name
object o_dropbutton
object o_dropitem[16]
}
GUI_UNFOCUS
{
if (droppedflag)
{
int i
for(i = 0; i < total_items; i++)
{
deactivate(o_dropitem[i])
}
}
droppedflag = false
}
GUI_INIT
{
int i
for(i = 0; i < total_items; i++)
{
o_dropitem[i].location = location.x,location.y+((itemheight)*(i+1)),location.z
deactivate(o_dropitem[i])
o_dropitem[i].id = i
}
region = 0,0 to itemwidth,itemheight
o_dropbutton = s_dropbutton
o_dropbutton.location.z = location.z
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if (mouse.left == BUTTON_CLICKED)
{
if (droppedflag)
{
int i
for(i = 0; i < total_items; i++)
{
deactivate(o_dropitem[i])
}
}
else
{
focus(this)
int i
for(i = 0; i < total_items; i++)
{
activate(o_dropitem[i])
}
}
droppedflag = !droppedflag
}
}
}
GUI_MAILBOX
{
if (sender == o_dropbutton)
{
droppedflag = !droppedflag
if (droppedflag)
{
focus(this)
int i
for(i = 0; i < total_items; i++)
{
activate(o_dropitem[i])
}
}
else
{
int i
for(i = 0; i < total_items; i++)
{
deactivate(o_dropitem[i])
}
}
}
else
{
selected = getmessage()
int i
for(i = 0; i < total_items; i++)
{
deactivate(o_dropitem[i])
}
droppedflag = false
}
}
GUI_DRAW
{
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, -8,0,1,1,0
print3d Name
// draw background
setpencolor(backcolor)
drawrect location.x,location.y to location.x+itemwidth,location.y+16
// draw border
setpencolor(bordercolor)
drawframe location.x,location.y to location.x+itemwidth,location.y+itemheight
print3d_margins = location.x+8, location.y to location.x+itemwidth-8, location.y+itemheight
print3d_attributes = dropboxFont, textcolor,-8,1,1,0,0,1 // Ignore embedded codes!
print3d_position = location.x+8, location.y+3
print3d o_dropitem[selected].text
print3d_margins = 0,0 to 1024,768
}
}
s_dropbutton
{
GUI_CREATE
{
region = 0,0 to 16,16
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if (mouse.left == BUTTON_CLICKED)
{
mail(-1)
}
}
}
GUI_DRAW
{
// draw background
setpencolor(parent.backcolor)
location.x = parent.location.x+parent.itemwidth
location.y = parent.location.y
drawrect location.x, location.y to location.x+16, location.y+parent.itemheight
// draw border
setpencolor(parent.bordercolor)
drawframe location.x, location.y to location.x+16, location.y+parent.itemheight
// display arrow
drawline location.x+8, location.y+4 to location.x+8, location.y+13
if (parent.droppedflag)
{
drawline location.x+8, location.y+4 to location.x+4,location.y+8
drawline location.x+9, location.y+4 to location.x+13,location.y+8
}
else
{
drawline location.x+8, location.y+11 to location.x+4,location.y+7
drawline location.x+8, location.y+11 to location.x+13,location.y+7
}
}
}
s_dropitem
{
GUI_CREATE
{
string text
region = 0,0 to parent.itemwidth, parent.itemheight
int id
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if (mouse.left == BUTTON_CLICKED)
{
mail(id)
}
}
}
GUI_DRAW
{
// draw background
if (parent.selected == id)
{
setpencolor(parent.bordercolor)
drawrect location.x,location.y to location.x+parent.itemwidth+1,location.y+parent.itemheight
print3d_margins = location.x+8, location.y to location.x+parent.itemwidth-8, location.y+parent.itemheight
print3d_attributes = parent.dropboxFont, 0xff000000,-8,1,1,1,1,0,1
}
else
{
setpencolor(parent.backcolor)
drawrect location.x,location.y to location.x+parent.itemwidth,location.y+parent.itemheight
setpencolor(parent.bordercolor)
drawframe location.x,location.y to location.x+parent.itemwidth,location.y+parent.itemheight
print3d_margins = location.x+8, location.y to location.x+parent.itemwidth-8, location.y+parent.itemheight
print3d_attributes = parent.dropboxFont, parent.bordercolor,-8,1,1,0,0,0,1
}
print3d_position = location.x+8, location.y+3
print3d text
print3d_margins = 0,0 to 1024,768
}
}
@@ -0,0 +1,166 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
#DEFINE GRFPATH "Assets\\Graphics\\"
#DEFINE SNDPATH "Assets\\Sounds\\"
#DEFINE SCRIPTPATH "Assets\\Scripts\\"
#DEFINE CANCEL_ID 5
#DEFINE PROVIDER_COUNT 5
main
{
GUI_CREATE
{
object o_button[PROVIDER_COUNT + 1]=s_button
object i_cursor=s_cursor
sound press = SNDPATH "sfx_button5.wav"
assign 0, press
sound typing = SNDPATH "fx_button.wav"
assign 1, typing
font3d gFont3d= "arial.ttf"
string text[PROVIDER_COUNT + 1]
text[0] = "TCP/IP"
text[1] = "IPX"
text[2] = "SERIAL"
text[3] = "MODEM"
text[4] = "GUNTech"
text[5] = "CANCEL"
string which[PROVIDER_COUNT]
which[0] = SCRIPTPATH "NetworkTCPIP.script"
which[1] = SCRIPTPATH "NetworkIPX.script"
which[2] = SCRIPTPATH "NetworkSerial.script"
which[3] = SCRIPTPATH "NetworkModem.script"
which[4] = SCRIPTPATH "NetworkGunTech.script"
// construct service provider buttons
for(int i=0; i < PROVIDER_COUNT; i++)
{
$$CheckThisConnection$$ = i+1
callback($$IsConnectionAvailable$$)
if ($$Available$$==0)
{
o_button[i].greyed = 1
}
o_button[i].location=getresx()/2-20,getresy()/3+i*20,1
o_button[i].id = i
initialize(o_button[i])
}
// construct cancel button
o_button[PROVIDER_COUNT].location=getresx()/2-20,getresy()/3+7*20,1
o_button[PROVIDER_COUNT].id = PROVIDER_COUNT
initialize(o_button[PROVIDER_COUNT])
}
GUI_DRAW
{
setpencolor(0xff000000)
drawrect 0,0 to getresx(),getresy()
print3d_margins = 0,0 to getresx(), getresy();
print3d_attributes = gFont3d, 0xffffffff, 2,0,1,0,0
print3d_position = getresx()/2 - (getprint3dwidth("Generic Networking GUI"))/2,getresy()/5
print3d "Generic Networking GUI"
}
}
s_button
{
GUI_CREATE
{
int button_state = 0
int greyed = 0
int bcolor
int id= 1
region=0,0 to 64,16
framerate=1
}
GUI_INIT
{
if (!greyed)
bcolor = 0xff0000ff
else
bcolor = 0xff000040
}
REGION_ENTERED
{
if (!greyed)
bcolor = 0xff8080ff
}
REGION_EXITED
{
if (!greyed)
bcolor = 0xff0000ff
}
LBUTTON_UPDATE
{
if (!greyed)
{
if (mouse.left == BUTTON_PRESSED)
bcolor = 0xffa0a0ff
if (mouse.left == BUTTON_CLICKED)
{
play 0
// check if provider button or cancel button
if id==PROVIDER_COUNT
{
$$gConnectionType$$ = -1
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
$$gConnectionType$$ = id
script_run which[id], 0x1000
script_end
}
}
}
}
GUI_DRAW
{
setpencolor(bcolor)
ldrawrect region
print3d_margins = 0,0 to getresx(), getresy();
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
print3d_position =location.x+8, location.y+2
print3d text[id]
}
}
s_cursor
{
GUI_CREATE
{
pane_create pic=16,32,1,volatile
alphamode(pic)=am_alpha_alphainvalpha
bitmap bm=GRFPATH "mouse_pointer.tga"
blit bm,0,0 on pic
update(pic)
location=0,0,2
}
GUI_DRAW
{
render pic, mouse.x, mouse.y, 2
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,825 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
#DEFINE GRFPATH "Assets\\Graphics\\"
#DEFINE SNDPATH "Assets\\Sounds\\"
#DEFINE SCRIPTPATH "Assets\\Scripts\\"
#DEFINE FLASH_PLAYER 1
#DEFINE FLASH_GAME 2
#DEFINE FLASH_GAMELIST 3
#DEFINE FLASH_ADDRESS 4
#DEFINE FLASH_PASSWORD 5
#DEFINE WAIT_SELECTGAME 0
#DEFINE WAIT_PLAYERS 1
main
{
GUI_CREATE
{
callback ($$ConnectIPX$$)
if !$$Available$$
{
script_run SCRIPTPATH "Network.script",0x1000
script_end
return
}
else
{
int selected = 0
int flasharea = 0
int flashtimer = 0
int WaitStart = 0
$$GameName$$=""
object o_cursor=s_cursor
object o_gamelist=s_gamelist
object o_playerlist=s_playerlist
object o_playername=s_playername
object o_password=s_password
object o_gamename=s_gamename
font3d gFont3d= "arial.ttf"
object o_go=s_GoCancelButton
o_go.location=getresx()/2-128,getresy()-50,1
o_go.id = 0
object o_cancel=s_GoCancelButton
o_cancel.location=getresx()/2+64,getresy()-50,1
o_cancel.id = 1
object o_join=s_JoinCreateButton
o_join.location=getresx()/2-20,getresy()-105,1
o_join.id = 2
initialize(o_join)
object o_create=s_JoinCreateButton
o_create.location=getresx()/2-20,getresy()-80,1
o_create.id = 3
o_create.button_state = 1
initialize(o_create)
framerate=4
focus( o_playername )
}
}
GUI_DRAW
{
setpencolor(0xff000000)
drawrect 0,0 to 640,480
print3d_attributes = gFont3d, 0xffffffff, 2,0,1,0,0
print3d_position =200,100
if WaitStart==0
print3d "Create or Join an IPX Game"
if WaitStart==1
print3d " Wait for other players"
if WaitStart==2
print3d " Wait for game to start"
}
GUI_EXECUTE
{
if flasharea
{
if flashtimer++>3
flasharea=0
}
if WaitStart==2
{
if callback($$HasGameBegun$$)
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
}
}
}
s_gamelist
{
GUI_CREATE
{
region= 0,0 to 412,128
location = getresx()-448,getresy()/2-64,1
framerate=1
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
int yloc = mouse.y - location.y;
yloc -= 4
yloc /= 12
if yloc >= $$NumberOfGames$$
{
$$GameName$$ = ""
}
else
{
$$GameName$$ = $$ListOfGames$$[yloc]
}
}
}
}
GUI_DRAW
{
//
// Update the list of games
//
callback ($$UpdateGameList$$)
//
// Flahsing the game area to show no game selected?
//
if flasharea==FLASH_GAMELIST && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 128
ldrawrect 128, 0 to 320, 128
ldrawrect 320, 0 to 364, 128
ldrawrect 364, 0 to 380, 128
ldrawrect 380, 0 to 396, 128
ldrawrect 396, 0 to 412, 128
}
//
// Display the titles above the boxes
//
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
lprint3d_position = 4, -14
print3d "Available Games"
lprint3d_position = 134, -14
print3d "Description"
lprint3d_position = 322, -14
print3d "Players"
lprint3d_position = 369, -14
print3d "P"
lprint3d_position = 385, -14
print3d "L"
lprint3d_position = 400, -14
print3d "S"
//
// Draw box around names
//
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 128
//
// Draw game Info box
//
ldrawframe 128, 0 to 320, 128
//
// Draw box for players ( n/n )
//
ldrawframe 320, 0 to 364, 128
//
// Draw box for password
//
ldrawframe 364, 0 to 380, 128
//
// Draw box for locked
//
ldrawframe 380, 0 to 396, 128
//
// Draw box for encrypted
//
ldrawframe 396, 0 to 412, 128
//
// Display game information
//
lprint3d_margins = 0, 0 to 122, 126
if $$NumberOfGames$$
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1
for(int j = 0; j < $$NumberOfGames$$; j++)
{
if equal$( $$GameName$$, $$ListOfGames$$[j] ) // Current selected game?
{
setpencolor(0xff0000c0)
ldrawrect 4, 4+(j*12)-1 to 124, 4+(j*12)+12
ldrawrect 128+4, 4+(j*12)-1 to 320-3, 4+(j*12)+12
ldrawrect 320+2, 4+(j*12)-1 to 364-2, 4+(j*12)+12
ldrawrect 364+2, 4+(j*12)-1 to 380-2, 4+(j*12)+12
ldrawrect 380+2, 4+(j*12)-1 to 396-2, 4+(j*12)+12
ldrawrect 396+2, 4+(j*12)-1 to 412-2, 4+(j*12)+12
setpencolor(0xffffffff)
}
//
// Game Name
//
lprint3d_position = 8,4+(j*12)
print3d $$ListOfGames$$[j]
//
// Game description
//
lprint3d_position = 136,4+(j*12)
print3d $$ListOfDescriptions$$[j]
//
// Players and max players
//
lprint3d_position = 330,4+(j*12)
print3d $$ListOfNumPlayers$$[j]
//
// Passworded?
//
lprint3d_position = 370,4+(j*12)
print3d $$ListOfPassworded$$[j]
//
// Locked?
//
lprint3d_position = 386,4+(j*12)
print3d $$ListOfLocked$$[j]
//
// Secure?
//
lprint3d_position = 402,4+(j*12)
print3d $$ListOfSecure$$[j]
}
}
}
}
s_playerlist
{
GUI_CREATE
{
region = 0,0 to 128,128
location = 32,getresy()/2-64,1
framerate=1
}
GUI_DRAW
{
callback ($$UpdatePlayerList$$)
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
lprint3d_position = 4, -14
print3d "Players In Game"
lprint3d_margins = 0,0 to 122, 126
if !equal$( $$GameName$$ , "" )
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
for(int j = 0; j < $$NumberOfPlayers$$; j++)
{
lprint3d_position = 8,+4+(j*12)
print3d $$ListOfPlayers$$[j]
}
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 128
print3d_margins = 0,0 to getresx(),getresy()
}
}
//
//
// Mouse pointer
//
//
s_cursor
{
GUI_CREATE
{
pane_create pic=16,32,1,volatile
alphamode(pic)=am_alpha_alphainvalpha
bitmap bm=GRFPATH "mouse_pointer.tga"
blit bm,0,0 on pic
update(pic)
location=0,0,2
}
GUI_DRAW
{
render pic, mouse.x, mouse.y
}
}
//
//
// GO / START and CANCEL buttons
//
//
s_GoCancelButton
{
GUI_CREATE
{
int button_state = 0
int id
int bcolor = 0xff0000ff
region=0,0 to 64,16
}
REGION_ENTERED
{
bcolor = 0xff8080ff
}
REGION_EXITED
{
button_state = 0
bcolor = 0xff0000ff
}
LBUTTON_UPDATE
{
if mouse.left==BUTTON_PRESSED
{
//
// Pressed GO button?
//
if id==0
{
if 0==length$($$PlayerName$$)
button_state = 0
else
{
if o_create.button_state == 1 && 0==length$($$GameName$$)
{
button_state = 0
}
else
{
button_state = 1
}
}
}
else
button_state = 1
button_state = 0
bcolor = 0xffa0a0ff
}
if mouse.left==BUTTON_CLICKED
{
if id==0
{
play 0
//
// Clicked on the GO button when JOIN is active
//
if o_join.button_state==1
{
int error = callback($$JoinSelected$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
flasharea=FLASH_GAMELIST
if error==2
flasharea=FLASH_PLAYER
if error==5
flasharea=FLASH_PASSWORD
flashtimer=6
}
}
else
//
// Clicked on the GO button when CREATE is active
//
{
int error = callback($$CreateSession$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
flasharea=FLASH_GAME
if error==2
flasharea=FLASH_PLAYER
flashtimer=6
}
}
}
if id == 1
{
play 0
script_run SCRIPTPATH "Network.script",0x1000
callback($$Disconnect$$)
script_end
}
}
}
GUI_DRAW
{
if id==0
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,2
print3d "Start"
}
if id==1
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 14,2
print3d "Cancel"
}
}
}
s_JoinCreateButton
{
GUI_CREATE
{
int button_state = 0
pane_create pbutton=80,16,volatile
bitmap up_pic = GRFPATH "radio_up.bmp"
bitmap down_pic = GRFPATH "radio_down.bmp"
int id
region=up_pic
blit up_pic, 0,0 on pbutton
update(pbutton)
}
GUI_INIT
{
if button_state == 0
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
LBUTTON_UPDATE
{
if 0==WaitStart
{
if mouse.left==BUTTON_CLICKED
{
focus( o_playername )
if button_state == 0
{
button_state = 1
if id==2
{
play 0
o_create.button_state = 0
initialize(o_create)
if gotfocus(o_gamename)
{
focus( o_playername )
}
}
else if id==3
{
play 0
o_join.button_state = 0
initialize(o_join)
}
}
}
if button_state == 0
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
}
GUI_DRAW
{
if 0==WaitStart
{
render pbutton, location
if id==2
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,4
print3d "Join"
}
if id==3
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,4
print3d "Create"
}
}
}
}
s_playername
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if 0==WaitStart
{
if mouse.left==BUTTON_CLICKED
{
focus (this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09 && o_create.button_state == 1
{
focus( o_gamename )
}
else
{
if key == 0x08)
{
if length$($$PlayerName$$)
{
play 1
$$PlayerName$$ = left$($$PlayerName$$, length$($$PlayerName$$)-1)
}
}
else
{
if length$($$PlayerName$$) < 19
{
play 1
$$PlayerName$$ = $$PlayerName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PLAYER && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$PlayerName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,3
else
lprint3d_position = 6,3
print3d $$PlayerName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Your Name"
}
}
s_password
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-80,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_playername )
}
else
{
if key == 0x08
{
if length$($$Password$$)
{
play 1
$$Password$$ = left$($$Password$$, length$($$Password$$)-1)
}
}
else
{
if length$($$Password$$) < 19
{
play 1
$$Password$$ = $$Password$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PASSWORD && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$Password$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$Password$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Password"
}
}
s_gamename
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if o_create.button_state == 1
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$GameName$$)
{
play 1
$$GameName$$ = left$($$GameName$$, length$($$GameName$$)-1)
}
}
else
{
if length$($$GameName$$) < 19
{
play 1
$$GameName$$ = $$GameName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state == 1 && flasharea==FLASH_GAME && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
int col
if o_create.button_state == 1
col=0xffffffff
else
col=0xff404040
setpencolor(col)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$GameName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$GameName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, col, 1,0,1,1,0
print3d "Game Name"
}
}
@@ -0,0 +1,879 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
#DEFINE GRFPATH "Assets\\Graphics\\"
#DEFINE SNDPATH "Assets\\Sounds\\"
#DEFINE SCRIPTPATH "Assets\\Scripts\\"
#DEFINE FLASH_PLAYER 1
#DEFINE FLASH_GAME 2
#DEFINE FLASH_NUMBER 3
#DEFINE FLASH_ADDRESS 4
#DEFINE FLASH_PASSWORD 5
#DEFINE WAIT_SELECTGAME 0
#DEFINE WAIT_PLAYERS 1
#DEFINE WAIT_FINDGAME 3
#DEFINE WAIT_DIALING 4
#include SCRIPTPATH "Dropboxes.script"
main
{
GUI_CREATE
{
callback ($$UpdateModemList$$)
font3d gFont3d= "arial.ttf"
int flasharea = 0
int flashtimer = 0
int connecting = 0
int WaitStart = WAIT_SELECTGAME
object o_cursor=s_cursor
object o_playername=s_PlayerName
object o_password=s_password
object o_gamename=s_GameName
object o_phonenumber=s_phonenumber
object o_go=s_GoCancelButton
o_go.location=getresx()/2-128,getresy()-50,1
o_go.id = 0
object o_cancel=s_GoCancelButton
o_cancel.location=getresx()/2+64,getresy()-50,1
o_cancel.id = 1
object o_join=s_JoinCreateButton
o_join.location=getresx()/2-20,getresy()-105,1
o_join.id = 2
initialize(o_join)
object o_create=s_JoinCreateButton
o_create.location=getresx()/2-20,getresy()-80,1
o_create.id = 3
o_create.button_state = 1
initialize(o_create)
framerate=4
object o_dropbox = s_simpledropbox
o_dropbox.Name = "Modem"
o_dropbox.location = getresx()/2-68,getresy()/2-48,1
o_dropbox.total_items = $$NumberOfModems$$
o_dropbox.selected = $$CurrentModem$$
for( int t0=0; t0<$$NumberOfModems$$; t0++ )
{
o_dropbox.o_dropitem[t0] = s_dropitem
o_dropbox.o_dropitem[t0].text = $$ListOfModems$$[t0]
}
initialize(o_dropbox)
focus( o_playername )
}
GUI_EXECUTE
{
if flasharea
{
flashtimer--
if( flashtimer<0 )
flasharea=0
}
if WaitStart==WAIT_DIALING
{
int error = callback($$JoinSelected$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
callback($$Disconnect$$)
if error==2
{
flasharea=FLASH_PLAYER // Duplicate player name
flashtimer=6
}
if error==3
{
WaitStart=WAIT_SELECTGAME // Error
}
if error==4
{
WaitStart=WAIT_SELECTGAME // No dial tone
}
}
}
if WaitStart==WAIT_FINDGAME
{
int error = callback($$CreateSession$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
callback($$Disconnect$$)
if error==1
{
flasharea=FLASH_GAME
flashtimer=6
}
if error==2
{
flasharea=FLASH_PLAYER
flashtimer=6
}
if error==3
{
WaitStart=WAIT_SELECTGAME
}
if error==4
{
WaitStart=WAIT_SELECTGAME // No dial tone
}
}
}
}
GUI_DRAW
{
setpencolor(0xff000000)
drawrect 0,0 to getresx(),getresy()
print3d_attributes = gFont3d, 0xffffffff, 2,0,1,0,0
print3d_position =getresx()/2 - getprint3dwidth("Create or Join a MODEM Game")/2,100
if WaitStart==0
print3d "Create or Join a MODEM Game"
if WaitStart==WAIT_PLAYERS
print3d " Waiting for other players"
if WaitStart==WAIT_FINDGAME
print3d " Waiting for call"
if WaitStart==WAIT_DIALING
print3d " Dialing and Connecting"
}
}
//
// The mouse cursor
//
s_cursor
{
GUI_CREATE
{
pane_create pic=16,32,1,volatile
alphamode(pic)=am_alpha_alphainvalpha
bitmap bm=GRFPATH "mouse_pointer.tga"
blit bm,0,0 on pic
update(pic)
location=0,0,2
}
GUI_DRAW
{
render pic, mouse.x, mouse.y
}
}
//
//
// The Go and Cancel buttons
//
//
s_GoCancelButton
{
GUI_CREATE
{
int button_state = 0
int id
int bcolor = 0xff0000ff
region=0,0 to 64,16
}
REGION_ENTERED
{
bcolor = 0xff8080ff
}
REGION_EXITED
{
button_state = 0
bcolor = 0xff0000ff
}
LBUTTON_UPDATE
{
if mouse.left == BUTTON_PRESSED
{
//
// Pressed GO button?
//
if id == 0
{
if 0==length$($$PlayerName$$)
button_state = 0
else
{
if o_create.button_state == 1 && 0==length$($$GameName$$)
{
button_state = 0
}
else
{
button_state = 1
}
}
}
else
button_state = 1
button_state = 0
bcolor = 0xffa0a0ff
}
if mouse.left == BUTTON_CLICKED
{
unfocus
if id == 0 && WaitStart!=WAIT_DIALING
{
play 0
//
// Clicked on the GO button when JOIN is active
//
if o_join.button_state==1
{
if 0==length$($$PhoneNumber$$)
{
flasharea=FLASH_NUMBER
flashtimer=6
}
else
{
$$CurrentModem$$=o_dropbox.selected
int error = callback($$JoinModemGame$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
if error==1
{
WaitStart=WAIT_DIALING
}
else
{
callback($$Disconnect$$)
flasharea=FLASH_PLAYER
flashtimer=6
}
}
}
}
else
//
// Clicked on the GO button when CREATE is active
//
{
$$CurrentModem$$=o_dropbox.selected
int error = callback($$HostModemGame$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
if error==4
{
WaitStart=WAIT_FINDGAME
}
else
{
if error==1
flasharea=FLASH_GAME
if error==2
flasharea=FLASH_PLAYER
if error==5
flasharea=FLASH_PASSWORD
flashtimer=6
callback($$Disconnect$$)
}
}
}
}
if id == 1
{
play 0
if WaitStart==WAIT_FINDGAME || WaitStart==WAIT_DIALING
{
callback($$Disconnect$$)
WaitStart=WAIT_SELECTGAME
}
else
{
script_run SCRIPTPATH "Network.script",0x1000
callback($$Disconnect$$)
script_end
}
}
}
}
GUI_DRAW
{
if id==0 && WaitStart!=WAIT_DIALING
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,2
print3d "Start"
}
if id == 1
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 14,2
print3d "Cancel"
}
}
}
//
//
// The Join and Create radio buttons
//
//
s_JoinCreateButton
{
GUI_CREATE
{
int button_state = 0
pane_create pbutton=80,16,1,volatile
bitmap up_pic = GRFPATH "radio_up.bmp"
bitmap down_pic = GRFPATH "radio_down.bmp"
int id
region=up_pic
blit up_pic, 0,0 on pbutton
update(pbutton)
}
GUI_INIT
{
if (button_state == 0)
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
focus( o_playername )
if WaitStart==WAIT_DIALING || WaitStart==WAIT_FINDGAME
{
callback($$Disconnect$$)
WaitStart=WAIT_SELECTGAME
}
if (button_state == 0)
{
button_state = 1
if (id == 2)
{
play 0
o_create.button_state = 0
initialize(o_create)
}
else if (id == 3)
{
play 0
o_join.button_state = 0
initialize(o_join)
}
}
}
if (button_state == 0)
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
GUI_DRAW
{
render pbutton, location
if id==2
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
print3d_position = 316,375
print3d "Join"
}
if id==3
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
print3d_position = 316,400
print3d "Create"
}
}
}
//
//
// The edit box for the player name
//
//
s_playername
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left==BUTTON_CLICKED
{
focus (this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
if( o_create.button_state == 1 )
{
focus( o_gamename )
}
else
{
focus( o_phonenumber )
}
}
else
{
if key == 0x08)
{
if length$($$PlayerName$$)
{
play 1
$$PlayerName$$ = left$($$PlayerName$$, length$($$PlayerName$$)-1)
}
}
else
{
if length$($$PlayerName$$) < 19
{
play 1
$$PlayerName$$ = $$PlayerName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PLAYER && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$PlayerName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,3
else
lprint3d_position = 6,3
print3d $$PlayerName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Your Name"
}
}
//
//
// The edit box for the game name
//
//
s_gamename
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if o_create.button_state == 1
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$GameName$$)
{
play 1
$$GameName$$ = left$($$GameName$$, length$($$GameName$$)-1)
}
}
else
{
if length$($$GameName$$) < 19
{
play 1
$$GameName$$ = $$GameName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state == 1 && flasharea==FLASH_GAME && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
int col
if o_create.button_state == 1
col=0xffffffff
else
col=0xff404040
setpencolor(col)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$GameName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$GameName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, col, 1,0,1,1,0
print3d "Game Name"
}
}
s_password
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-80,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_playername )
}
else
{
if key == 0x08
{
if length$($$Password$$)
{
play 1
$$Password$$ = left$($$Password$$, length$($$Password$$)-1)
}
}
else
{
if length$($$Password$$) < 19
{
play 1
$$Password$$ = $$Password$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PASSWORD && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$Password$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$Password$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Password"
}
}
//
//
// The edit box for the phone number
//
//
s_phonenumber
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-80,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if o_create.button_state == 0
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$PhoneNumber$$)
{
play 1
$$PhoneNumber$$ = left$($$PhoneNumber$$, length$($$PhoneNumber$$)-1)
}
}
else
{
if length$($$PhoneNumber$$) < 19
{
play 1
$$PhoneNumber$$ = $$PhoneNumber$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state == 0 && flasharea==FLASH_NUMBER && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
int col
if o_create.button_state == 0
col=0xffffffff
else
col=0xff404040
setpencolor(col)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$PhoneNumber$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$PhoneNumber$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, col, 1,0,1,1,0
print3d "Phone Number"
}
}
@@ -0,0 +1,720 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
#DEFINE GRFPATH "Assets\\Graphics\\"
#DEFINE SNDPATH "Assets\\Sounds\\"
#DEFINE SCRIPTPATH "Assets\\Scripts\\"
#DEFINE FLASH_PLAYER 1
#DEFINE FLASH_GAME 2
#DEFINE FLASH_ADDRESS 4
#DEFINE FLASH_PASSWORD 5
#DEFINE WAIT_SELECTGAME 0
#DEFINE WAIT_PLAYERS 1
#DEFINE WAIT_TOSTART 2
#DEFINE WAIT_FINDGAME 3
#include SCRIPTPATH "Dropboxes.script"
main
{
GUI_CREATE
{
callback ($$UpdateSerialPortList$$)
int flasharea = 0
int flashtimer = 0
int connecting = 0
int WaitStart = WAIT_SELECTGAME
object o_cursor=s_cursor
object o_playername=s_PlayerName
object o_password=s_password
object o_gamename=s_GameName
font3d gFont3d= "arial.ttf"
object o_go=s_GoCancelButton
o_go.location=getresx()/2-128,getresy()-50,1
o_go.id = 0
object o_cancel=s_GoCancelButton
o_cancel.location=getresx()/2+64,getresy()-50,1
o_cancel.id = 1
object o_join=s_JoinCreateButton
o_join.location=getresx()/2-20,getresy()-105,1
o_join.id = 2
initialize(o_join)
object o_create=s_JoinCreateButton
o_create.location=getresx()/2-20,getresy()-80,1
o_create.id = 3
o_create.button_state = 1
initialize(o_create)
framerate=4
object o_dropbox = s_simpledropbox
o_dropbox.Name = "Serial Port"
o_dropbox.location = getresx()/2-68,getresy()/2-48,1
o_dropbox.total_items = $$NumberOfSerialPorts$$
o_dropbox.selected = $$CurrentSerialPort$$
for( int t0=0; t0<$$NumberOfSerialPorts$$; t0++ )
{
o_dropbox.o_dropitem[t0] = s_dropitem
o_dropbox.o_dropitem[t0].text = $$ListOfSerialPorts$$[t0]
}
initialize(o_dropbox)
focus( o_playername )
}
GUI_EXECUTE
{
if flasharea
{
flashtimer--
if( flashtimer<0 )
flasharea=0
}
if WaitStart==WAIT_FINDGAME
{
int error = callback($$JoinSelected$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
callback($$Disconnect$$)
if error==2
{
flasharea=FLASH_PLAYER
flashtimer=6
}
if error==3
{
WaitStart=WAIT_SELECTGAME
}
}
}
}
GUI_DRAW
{
setpencolor(0xff000000)
drawrect 0,0 to getresx(),getresy()
print3d_attributes = gFont3d, 0xffffffff, 2,0,1,0,0
print3d_position =getresx()/2 - getprint3dwidth("Create or Join a SERIAL Game")/2,100
if WaitStart==0
print3d "Create or Join a SERIAL Game"
if WaitStart==WAIT_PLAYERS
print3d " Waiting for other players"
if WaitStart==WAIT_FINDGAME
print3d " Searching for serial game"
}
}
//
// The mouse cursor
//
s_cursor
{
GUI_CREATE
{
pane_create pic=16,32,1,volatile
alphamode(pic)=am_alpha_alphainvalpha
bitmap bm=GRFPATH "mouse_pointer.tga"
blit bm,0,0 on pic
update(pic)
location=0,0,2
}
GUI_DRAW
{
render pic, mouse.x, mouse.y
}
}
//
//
// The Go and Cancel buttons
//
//
s_GoCancelButton
{
GUI_CREATE
{
int button_state = 0
int id
int bcolor = 0xff0000ff
region=0,0 to 64,16
}
REGION_ENTERED
{
bcolor = 0xff8080ff
}
REGION_EXITED
{
button_state = 0
bcolor = 0xff0000ff
}
LBUTTON_UPDATE
{
if mouse.left == BUTTON_PRESSED
{
//
// Pressed GO button?
//
if id == 0
{
if 0==length$($$PlayerName$$)
button_state = 0
else
{
if o_create.button_state == 1 && 0==length$($$GameName$$)
{
button_state = 0
}
else
{
button_state = 1
}
}
}
else
button_state = 1
button_state = 0
bcolor = 0xffa0a0ff
}
if mouse.left == BUTTON_CLICKED
{
unfocus
if id == 0 && WaitStart!=WAIT_FINDGAME
{
play 0
//
// Clicked on the GO button when JOIN is active
//
if o_join.button_state==1
{
$$CurrentSerialPort$$=o_dropbox.selected
callback ($$ConnectSerialPort$$)
if !$$Available$$
{
script_run SCRIPTPATH "Network.script",0x1000
script_end
return
}
int error = callback($$JoinSelected$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
if error==1
{
WaitStart=WAIT_FINDGAME
}
else
{
callback($$Disconnect$$)
flasharea=FLASH_PLAYER
flashtimer=6
}
}
}
else
//
// Clicked on the GO button when CREATE is active
//
{
$$CurrentSerialPort$$=o_dropbox.selected
callback ($$ConnectSerialPort$$)
if !$$Available$$
{
callback($$Disconnect$$)
script_run SCRIPTPATH "Network.script",0x1000
script_end
return
}
int error = callback($$CreateSession$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
if error==1
flasharea=FLASH_GAME
if error==2
flasharea=FLASH_PLAYER
if error==5
flasharea=FLASH_PASSWORD
flashtimer=6
callback($$Disconnect$$)
}
}
}
if id == 1
{
play 0
if WaitStart==WAIT_FINDGAME
{
callback($$Disconnect$$)
WaitStart=WAIT_SELECTGAME
}
else
{
script_run SCRIPTPATH "Network.script",0x1000
callback($$Disconnect$$)
script_end
}
}
}
}
GUI_DRAW
{
if id==0
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,2
print3d "Start"
}
if id == 1
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 14,2
print3d "Cancel"
}
}
}
//
//
// The Join and Create radio buttons
//
//
s_JoinCreateButton
{
GUI_CREATE
{
int button_state = 0
pane_create pbutton=80,16,1,volatile
bitmap up_pic = GRFPATH "radio_up.bmp"
bitmap down_pic = GRFPATH "radio_down.bmp"
int id
region=up_pic
blit up_pic, 0,0 on pbutton
update(pbutton)
}
GUI_INIT
{
if (button_state == 0)
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
LBUTTON_UPDATE
{
if (mouse.left == BUTTON_CLICKED)
{
if WaitStart==WAIT_FINDGAME
{
callback($$Disconnect$$)
WaitStart=WAIT_SELECTGAME
}
focus( o_playername )
if (button_state == 0)
{
button_state = 1
if (id == 2)
{
play 0
o_create.button_state = 0
initialize(o_create)
}
else if (id == 3)
{
play 0
o_join.button_state = 0
initialize(o_join)
}
}
}
if (button_state == 0)
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
GUI_DRAW
{
render pbutton, location
if id==2
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
print3d_position = 316,375
print3d "Join"
}
if id==3
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
print3d_position = 316,400
print3d "Create"
}
}
}
//
//
// The edit box for the player name
//
//
s_playername
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left==BUTTON_CLICKED
{
focus (this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
if( o_create.button_state == 1 )
{
focus( o_gamename )
}
else
{
focus( o_password )
}
}
else
{
if key == 0x08)
{
if length$($$PlayerName$$)
{
play 1
$$PlayerName$$ = left$($$PlayerName$$, length$($$PlayerName$$)-1)
}
}
else
{
if length$($$PlayerName$$) < 19
{
play 1
$$PlayerName$$ = $$PlayerName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PLAYER && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$PlayerName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,3
else
lprint3d_position = 6,3
print3d $$PlayerName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Your Name"
}
}
s_password
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-80,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_playername )
}
else
{
if key == 0x08
{
if length$($$Password$$)
{
play 1
$$Password$$ = left$($$Password$$, length$($$Password$$)-1)
}
}
else
{
if length$($$Password$$) < 19
{
play 1
$$Password$$ = $$Password$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PASSWORD && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$Password$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$Password$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Password"
}
}
//
//
// The edit box for the game name
//
//
s_gamename
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if o_create.button_state == 1
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$GameName$$)
{
play 1
$$GameName$$ = left$($$GameName$$, length$($$GameName$$)-1)
}
}
else
{
if length$($$GameName$$) < 19
{
play 1
$$GameName$$ = $$GameName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state == 1
{
if flasharea==FLASH_GAME && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$GameName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$GameName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Game Name"
}
}
}
@@ -0,0 +1,984 @@
#include "..\\content\\..\\Content\\..\\content\\..\\Content\\ShellScripts\\stddefs.h"
#DEFINE GRFPATH "Assets\\Graphics\\"
#DEFINE SNDPATH "Assets\\Sounds\\"
#DEFINE SCRIPTPATH "Assets\\Scripts\\"
#DEFINE FLASH_PLAYER 1
#DEFINE FLASH_GAME 2
#DEFINE FLASH_GAMELIST 3
#DEFINE FLASH_ADDRESS 4
#DEFINE FLASH_PASSWORD 5
#DEFINE WAIT_SELECTGAME 0
#DEFINE WAIT_PLAYERS 1
main
{
GUI_CREATE
{
callback ($$ConnectTCP$$)
if !$$Available$$
{
script_run SCRIPTPATH "Network.script",0x1000
script_end
return
}
else
{
int selected = 0
int flasharea = 0
int flashtimer = 0
int invalidServer = 0
int WaitStart = WAIT_SELECTGAME
$$GameName$$=""
object o_cursor=s_cursor
object o_gamelist=s_gamelist
object o_playerlist=s_playerlist
object o_playername=s_playername
object o_gamename=s_gamename
object o_password=s_password
object o_serveraddress=s_serveraddress
font3d gFont3d= "arial.ttf"
object o_go=s_GoCancelButton
o_go.location=getresx()/2-128,getresy()-50,1
o_go.id = 0
object o_cancel=s_GoCancelButton
o_cancel.location=getresx()/2+64,getresy()-50,1
o_cancel.id = 1
object o_join=s_JoinCreateButton
o_join.location=getresx()/2-20,getresy()-105,1
o_join.id = 2
initialize(o_join)
object o_create=s_JoinCreateButton
o_create.location=getresx()/2-20,getresy()-80,1
o_create.id = 3
o_create.button_state = 1
initialize(o_create)
framerate=4
focus( o_playername )
}
}
GUI_DRAW
{
setpencolor(0xff000000)
drawrect 0,0 to getresx(),getresy()
print3d_attributes = gFont3d, 0xffffffff, 2,0,1,0,0
print3d_position =getresx()/2 - getprint3dwidth("Create or Join a TCPIP Game")/2,100
if WaitStart==WAIT_SELECTGAME
print3d "Create or Join a TCPIP Game"
if WaitStart==WAIT_PLAYERS
print3d " Waiting for other players"
}
GUI_EXECUTE
{
if flasharea
{
flashtimer--
if( flashtimer<0 )
flasharea=0
}
}
}
s_gamelist
{
GUI_CREATE
{
region= 0,0 to 412,128
location = getresx()-448,getresy()/2-64,1
framerate=1
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
int yloc = mouse.y - location.y;
yloc -= 4
yloc /= 12
if yloc >= $$NumberOfGames$$
{
$$GameName$$ = ""
}
else
{
$$GameName$$ = $$ListOfGames$$[yloc]
}
}
}
}
GUI_DRAW
{
//
// Update the list of games
//
callback ($$UpdateGameList$$)
//
// Flahsing the game area to show no game selected?
//
if flasharea==FLASH_GAMELIST && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 128
ldrawrect 128, 0 to 320, 128
ldrawrect 320, 0 to 364, 128
ldrawrect 364, 0 to 380, 128
ldrawrect 380, 0 to 396, 128
ldrawrect 396, 0 to 412, 128
}
//
// Display the titles above the boxes
//
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
lprint3d_position = 4, -14
print3d "Available Games"
lprint3d_position = 134, -14
print3d "Description"
lprint3d_position = 322, -14
print3d "Players"
lprint3d_position = 369, -14
print3d "P"
lprint3d_position = 385, -14
print3d "L"
lprint3d_position = 400, -14
print3d "S"
//
// Draw box around names
//
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 128
//
// Draw game Info box
//
ldrawframe 128, 0 to 320, 128
//
// Draw box for players ( n/n )
//
ldrawframe 320, 0 to 364, 128
//
// Draw box for password
//
ldrawframe 364, 0 to 380, 128
//
// Draw box for locked
//
ldrawframe 380, 0 to 396, 128
//
// Draw box for encrypted
//
ldrawframe 396, 0 to 412, 128
//
// Display game information
//
lprint3d_margins = 0, 0 to 122, 126
if $$NumberOfGames$$
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1
for(int j = 0; j < $$NumberOfGames$$; j++)
{
if equal$( $$GameName$$, $$ListOfGames$$[j] ) // Current selected game?
{
setpencolor(0xff0000c0)
ldrawrect 4, 4+(j*12)-1 to 124, 4+(j*12)+12
ldrawrect 128+4, 4+(j*12)-1 to 320-3, 4+(j*12)+12
ldrawrect 320+2, 4+(j*12)-1 to 364-2, 4+(j*12)+12
ldrawrect 364+2, 4+(j*12)-1 to 380-2, 4+(j*12)+12
ldrawrect 380+2, 4+(j*12)-1 to 396-2, 4+(j*12)+12
ldrawrect 396+2, 4+(j*12)-1 to 412-2, 4+(j*12)+12
setpencolor(0xffffffff)
}
//
// Game Name
//
lprint3d_position = 8,4+(j*12)
print3d $$ListOfGames$$[j]
//
// Game description
//
lprint3d_position = 136,4+(j*12)
print3d $$ListOfDescriptions$$[j]
//
// Players and max players
//
lprint3d_position = 330,4+(j*12)
print3d $$ListOfNumPlayers$$[j]
//
// Passworded?
//
lprint3d_position = 370,4+(j*12)
print3d $$ListOfPassworded$$[j]
//
// Locked?
//
lprint3d_position = 386,4+(j*12)
print3d $$ListOfLocked$$[j]
//
// Secure?
//
lprint3d_position = 402,4+(j*12)
print3d $$ListOfSecure$$[j]
}
}
}
}
s_playerlist
{
GUI_CREATE
{
region = 0,0 to 128,128
location = 32,getresy()/2-64,1
framerate=1
}
GUI_DRAW
{
callback ($$UpdatePlayerList$$)
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
lprint3d_position = 4, -14
print3d "Players In Game"
lprint3d_margins = 0,0 to 122, 126
if !equal$( $$GameName$$ , "" )
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
for(int j = 0; j < $$NumberOfPlayers$$; j++)
{
lprint3d_position = 8,+4+(j*12)
print3d $$ListOfPlayers$$[j]
}
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 128
print3d_margins = 0,0 to getresx(),getresy()
}
}
//
//
// Mouse pointer
//
//
s_cursor
{
GUI_CREATE
{
pane_create pic=16,32,1,volatile
alphamode(pic)=am_alpha_alphainvalpha
bitmap bm=GRFPATH "mouse_pointer.tga"
blit bm,0,0 on pic
update(pic)
location=0,0,2
}
GUI_DRAW
{
render pic, mouse.x, mouse.y
}
}
//
//
// GO / START and CANCEL buttons
//
//
s_GoCancelButton
{
GUI_CREATE
{
int button_state = 0
int id
int bcolor = 0xff0000ff
region=0,0 to 64,16
}
REGION_ENTERED
{
bcolor = 0xff8080ff
}
REGION_EXITED
{
button_state = 0
bcolor = 0xff0000ff
}
LBUTTON_UPDATE
{
if mouse.left == BUTTON_PRESSED
{
//
// Pressed GO button?
//
if id == 0
{
if 0==length$($$PlayerName$$)
button_state = 0
else
{
if o_create.button_state == 1 && 0==length$($$GameName$$)
{
button_state = 0
}
else
{
button_state = 1
}
}
}
else
button_state = 1
button_state = 0
bcolor = 0xffa0a0ff
}
if mouse.left == BUTTON_CLICKED
{
if id == 0
{
play 0
//
// Clicked on the GO button when JOIN is active
//
if o_join.button_state==1
{
int error=callback($$JoinSelected$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
flasharea=FLASH_GAMELIST
if error==2
flasharea=FLASH_PLAYER
if error==5
flasharea=FLASH_PASSWORD
flashtimer=6
}
}
else
//
// Clicked on the GO button when CREATE is active
//
{
int error = callback($$CreateSession$$)
if error==0
{
callback($$SetShellCommand$$, END_NETWORK_STARTUP_SHELL_COMMAND)
script_end
}
else
{
flasharea=FLASH_GAME
if error==2
flasharea=FLASH_PLAYER
flashtimer=6
}
}
}
if id == 1
{
play 0
script_run SCRIPTPATH "Network.script",0x1000
callback($$Disconnect$$)
script_end
}
}
}
GUI_DRAW
{
if id==0
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,2
print3d "Start"
}
if id==1
{
setpencolor(bcolor)
ldrawrect region
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 14,2
print3d "Cancel"
}
}
}
s_JoinCreateButton
{
GUI_CREATE
{
int button_state = 0
pane_create pbutton=80,16,volatile
bitmap up_pic = GRFPATH "radio_up.bmp"
bitmap down_pic = GRFPATH "radio_down.bmp"
int id
region=up_pic
blit up_pic, 0,0 on pbutton
update(pbutton)
}
GUI_INIT
{
if button_state == 0
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus( o_playername )
if button_state == 0
{
button_state = 1
if (id == 2) // Selected CREATE button
{
play 0
o_create.button_state = 0
if length$($$ServerIPAddress$$) // If a server IP address was in use, clear it
{
invalidServer=0
$$ServerIPAddress$$=""
callback($$Disconnect$$)
callback($$ConnectTCP$$)
}
initialize(o_create)
if gotfocus(o_gamename)
{
focus( o_playername )
}
}
else if (id == 3)
{
play 0
o_join.button_state = 0
initialize(o_join)
if gotfocus(o_serveraddress)
{
focus( o_playername )
}
}
}
}
if button_state == 0
blit up_pic, 0,0 on pbutton
else
blit down_pic,0,0 on pbutton location
update(pbutton);
}
}
GUI_DRAW
{
if WaitStart==WAIT_SELECTGAME
{
render pbutton, location
if id == 2
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,4
print3d "Join"
}
if id == 3
{
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0
lprint3d_position = 16,4
print3d "Create"
}
}
}
}
s_playername
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left==BUTTON_CLICKED
{
focus (this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
if( o_create.button_state == 1 )
{
focus( o_gamename )
}
else
{
invalidServer=0
focus( o_serveraddress )
}
}
else
{
if key == 0x08)
{
if length$($$PlayerName$$)
{
play 1
$$PlayerName$$ = left$($$PlayerName$$, length$($$PlayerName$$)-1)
}
}
else
{
if length$($$PlayerName$$) < 19
{
play 1
$$PlayerName$$ = $$PlayerName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PLAYER && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$PlayerName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,3
else
lprint3d_position = 6,3
print3d $$PlayerName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Your Name"
}
}
s_gamename
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-130,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if o_create.button_state == 1
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$GameName$$)
{
play 1
$$GameName$$ = left$($$GameName$$, length$($$GameName$$)-1)
}
}
else
{
if length$($$GameName$$) < 19
{
play 1
$$GameName$$ = $$GameName$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state == 1 && flasharea==FLASH_GAME && flashtimer&1
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
int col
if o_create.button_state == 1
col=0xffffffff
else
col=0xff404040
setpencolor(col)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$GameName$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$GameName$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, col, 1,0,1,1,0
print3d "Game Name"
}
}
s_password
{
GUI_CREATE
{
region = 0,0 to 128,16
location = 128,getresy()-80,1
framerate = 4
int draw_caret = 0
}
LBUTTON_UPDATE
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_playername )
}
else
{
if key == 0x08
{
if length$($$Password$$)
{
play 1
$$Password$$ = left$($$Password$$, length$($$Password$$)-1)
}
}
else
{
if length$($$Password$$) < 19
{
play 1
$$Password$$ = $$Password$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if flasharea==FLASH_PASSWORD && flashtimer&1
{
setpencolor(0xffff0000)
drawrect location.x, location.y to location.x+128, location.y+16
}
setpencolor(0xffffffff)
ldrawframe 0, 0 to 128, 16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_margins = 6, 0 to 126, 16
int beyond = 12+getprint3dwidth($$Password$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,+3
else
lprint3d_position = 6,3
print3d $$Password$$
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, 0xffffffff, 1,0,1,1,0
print3d "Password"
}
}
//
// Server address - this is only available during JOIN game.
//
// The user can enter a web url or IP address that will be used to look for games
//
s_serveraddress
{
GUI_CREATE
{
region = 0,0 to 128,16
location = getresx()-256,getresy()-80,1
framerate = 4
int draw_caret = 0
int updated = 0
}
LBUTTON_UPDATE
{
if o_create.button_state != 1
{
if WaitStart==WAIT_SELECTGAME
{
if mouse.left == BUTTON_CLICKED
{
focus(this)
invalidServer=0
}
}
}
}
GUI_EXECUTE
{
if gotfocus(this)
draw_caret = !draw_caret
else
draw_caret = 0
}
GUI_UNFOCUS
{
if updated
{
updated = 0
callback($$Disconnect$$)
callback($$ConnectTCP$$)
if $$Available$$
invalidServer=0
else
invalidServer=1
}
}
GUI_CHAR
{
int key = getchar()
if key == char("\n")
{
focus( NULL )
}
else
{
if key == 0x09
{
focus( o_password )
}
else
{
if key == 0x08
{
if length$($$ServerIPAddress$$)
{
updated = 1
play 1
$$ServerIPAddress$$ = left$($$ServerIPAddress$$, length$($$ServerIPAddress$$)-1)
}
}
else
{
if length$($$ServerIPAddress$$) < 19
{
updated = 1
play 1
$$ServerIPAddress$$ = $$ServerIPAddress$$ chr$(key)
}
}
}
}
}
GUI_DRAW
{
if o_create.button_state != 1 && invalidServer
{
setpencolor(0xffff0000)
ldrawrect 0, 0 to 128, 16
}
int col
int DimColor
if o_create.button_state != 1
{
col=0xffffffff
DimColor=0xff808080
}
else
{
col=0xff404040
DimColor=0xff202020
}
setpencolor(col)
ldrawframe region
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
lprint3d_position = 6,3
lprint3d_margins = 6, 0 to 126, 16
if( length$($$ServerIPAddress$$) = 0 && !gotfocus(this) )
{
print3d_attributes = gFont3d, DimColor, 1,0,1,0,0
print3d " -Browse Local Net-"
}
else
{
print3d_attributes = gFont3d, col, 1,0,1,0,0,0,1 // Ignore embedded codes!
int beyond = 12+getprint3dwidth($$ServerIPAddress$$) - (region.p2.x)
if (beyond > 0 && gotfocus(this))
lprint3d_position = -beyond,3
else
lprint3d_position = 6, 3
print3d $$ServerIPAddress$$
}
if draw_caret && gotfocus(this)
{
print3d "|"
}
print3d_margins = 0,0 to getresx(),getresy()
lprint3d_position = 0,-16
print3d_attributes = gFont3d, col, 1,0,1,1,0
print3d "Server Address"
}
}
@@ -0,0 +1,111 @@
// ResourceViewer.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ResourceViewer.h"
#include "ResourceViewerDlg.h"
#include <mmsystem.h>
#if !defined(STUFF_STUFF_HPP)
#include "Stuff\Stuff.hpp"
#endif
#if !defined(ADEPT_ADEPT_HPP)
#include "Adept\Adept.hpp"
#endif
#include <GameOS\GameOS.hpp>
#include <DLLPlatform\DLLPlatform.hpp>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BOOL CTCL_IsConsole()
{
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerApp
BEGIN_MESSAGE_MAP(CResourceViewerApp, CWinApp)
//{{AFX_MSG_MAP(CResourceViewerApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerApp construction
CResourceViewerApp::CResourceViewerApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CResourceViewerApp object
CResourceViewerApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerApp initialization
BOOL CResourceViewerApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CResourceViewerDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void __stdcall GetGameOSEnvironment(char* CommandLine)
{
//
//----------------------------------------------------------
// This is where to set GOS environment settings.
//----------------------------------------------------------
//
Environment.applicationName = "ANIMSIZEINVIS";
Environment.directoryPath = "\\Tools\\AnimSize";
Environment.screenWidth = 640;
Environment.screenHeight = 480;
Environment.bitDepth = 16;
}
@@ -0,0 +1,158 @@
# Microsoft Developer Studio Project File - Name="ResourceViewer" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=ResourceViewer - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ResourceViewer.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ResourceViewer.mak" CFG="ResourceViewer - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ResourceViewer - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "ResourceViewer - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ResourceViewer - Win32 Release"
# PROP Use_MFC
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# ADD CPP /MD /GX /I "..\..\Libraries" /I "..\..\Code" /I "..\..\..\CoreTech\Libraries" /I "..\..\Code\Mw4" /D "_AFXDLL"
# ADD BASE RSC /l 0x412
# ADD RSC /l 0x412 /d "_AFXDLL"
BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /machine:IX86
# ADD LINK32 /machine:IX86
!ELSEIF "$(CFG)" == "ResourceViewer - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_DEBUG" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /G6 /Zp4 /MDd /W3 /Gm /GR /GX /Zi /Od /I "..\..\Libraries" /I "..\..\Code" /I "..\..\..\CoreTech\Libraries" /I "..\..\Code\Mw4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "MULTI_PLAYER" /D "USE_PROTOTYPES" /D "STRICT" /D TEST_CLASS=50 /D "_DEBUG" /D "_ARMOR" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "NDEBUG" /D "_DEBUG" /mktyplib203 /win32 /win32
# ADD MTL /nologo /D "NDEBUG" /D "_DEBUG" /mktyplib203 /win32 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "_DEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "ResourceViewer - Win32 Release"
# Name "ResourceViewer - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ResourceViewer.cpp
!IF "$(CFG)" == "ResourceViewer - Win32 Release"
!ELSEIF "$(CFG)" == "ResourceViewer - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ResourceViewer.rc
# End Source File
# Begin Source File
SOURCE=.\ResourceViewerDlg.cpp
!IF "$(CFG)" == "ResourceViewer - Win32 Release"
!ELSEIF "$(CFG)" == "ResourceViewer - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "ResourceViewer - Win32 Release"
# ADD CPP /Yc"stdafx.h"
!ELSEIF "$(CFG)" == "ResourceViewer - Win32 Debug"
# ADD CPP /Yc"stdafx.h"
!ENDIF
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\ResourceViewer.h
# End Source File
# Begin Source File
SOURCE=.\ResourceViewerDlg.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\ResourceViewer.ico
# End Source File
# Begin Source File
SOURCE=.\res\ResourceViewer.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
@@ -0,0 +1,164 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Adept"=..\..\Libraries\Adept\Adept.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Compost"=..\..\Libraries\Compost\Compost.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "DLLPlatform"=..\..\..\coretech\Libraries\DLLPlatform\DLLPlatform.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ElementRenderer"=..\..\Libraries\ElementRenderer\ElementRenderer.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "GOSScript"=..\..\..\coretech\Libraries\GOSScript\GOSScript.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "GameOS"=..\..\..\coretech\Libraries\GameOS\GameOS.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "MLR"=..\..\Libraries\MLR\MLR.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ResourceViewer"=.\ResourceViewer.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Adept
End Project Dependency
Begin Project Dependency
Project_Dep_Name DLLPlatform
End Project Dependency
Begin Project Dependency
Project_Dep_Name GameOS
End Project Dependency
Begin Project Dependency
Project_Dep_Name Stuff
End Project Dependency
Begin Project Dependency
Project_Dep_Name ElementRenderer
End Project Dependency
Begin Project Dependency
Project_Dep_Name gosFX
End Project Dependency
Begin Project Dependency
Project_Dep_Name MLR
End Project Dependency
Begin Project Dependency
Project_Dep_Name Compost
End Project Dependency
Begin Project Dependency
Project_Dep_Name GOSScript
End Project Dependency
}}}
###############################################################################
Project: "Stuff"=..\..\Libraries\Stuff\Stuff.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "gosFX"=..\..\Libraries\gosFX\gosFX.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,49 @@
// ResourceViewer.h : main header file for the RESOURCEVIEWER application
//
#if !defined(AFX_RESOURCEVIEWER_H__6ACE9E03_7060_4C06_9FED_F7FAE996173E__INCLUDED_)
#define AFX_RESOURCEVIEWER_H__6ACE9E03_7060_4C06_9FED_F7FAE996173E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerApp:
// See ResourceViewer.cpp for the implementation of this class
//
class CResourceViewerApp : public CWinApp
{
public:
CResourceViewerApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CResourceViewerApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CResourceViewerApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESOURCEVIEWER_H__6ACE9E03_7060_4C06_9FED_F7FAE996173E__INCLUDED_)
@@ -0,0 +1,175 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\ResourceViewer.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\ResourceViewer.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_RESOURCEVIEWER_DIALOG DIALOGEX 0, 0, 618, 431
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "ResourceViewer"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_RES_LIST,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,7,27,604,397
PUSHBUTTON "Open...",IDC_BUTTON1,7,7,35,14
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "ResourceViewer MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "ResourceViewer\0"
VALUE "LegalCopyright", "Copyright (C) 2000\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "ResourceViewer.EXE\0"
VALUE "ProductName", "ResourceViewer Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_RESOURCEVIEWER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 611
TOPMARGIN, 7
BOTTOMMARGIN, 424
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\ResourceViewer.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,314 @@
// ResourceViewerDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ResourceViewer.h"
#include "ResourceViewerDlg.h"
#include <Stuff\Stuff.hpp>
#include <Adept\Adept.hpp>
#include <Compost\Compost.hpp>
#include <gosfx\gosfx.hpp>
#include <elementrenderer\elementrenderer.hpp>
#include <GameOS\GameOS.hpp>
#include <DLLPlatform\DLLPlatform.hpp>
#include <Adept\Resource.hpp>
#include <buildnum\buildnum.h>
HGOSHEAP Heap;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerDlg dialog
CResourceViewerDlg::CResourceViewerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CResourceViewerDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CResourceViewerDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
HINSTANCE hInstance;
hInstance = AfxGetResourceHandle();
InitGameOS( hInstance, NULL, "\0" );
Stuff::ArmorLevel = 3;
Stuff::InitializeClasses();
MidLevelRenderer::InitializeClasses(NULL, 2048*8);
Compost::InitializeClasses();
gosFX::InitializeClasses();
ElementRenderer::InitializeClasses();
Adept::InitializeClasses();
Adept::ResourceManager::Instance = new Adept::ResourceManager;
Check_Object(Adept::ResourceManager::Instance);
Heap = gos_CreateMemoryHeap("Default");
Check_Pointer(Heap);
gos_PushCurrentHeap(Heap);
}
CResourceViewerDlg::~CResourceViewerDlg()
{
gos_PopCurrentHeap();
delete Adept::ResourceManager::Instance;
Adept::ResourceManager::Instance = NULL;
Adept::TerminateClasses();
ElementRenderer::TerminateClasses();
gosFX::TerminateClasses();
Compost::TerminateClasses();
MidLevelRenderer::TerminateClasses();
Stuff::TerminateClasses();
ExitGameOS();
}
void CResourceViewerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CResourceViewerDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResourceViewerDlg, CDialog)
//{{AFX_MSG_MAP(CResourceViewerDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnOpenButton)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_RES_LIST, OnColumnclickResList)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerDlg message handlers
#define RESID_COLUMN 0
#define NAME_COLUMN 1
#define SIZE_COLUMN 2
int ColumnArray[2];
BOOL CResourceViewerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CListCtrl *list = (CListCtrl *)GetDlgItem( IDC_RES_LIST );
ColumnArray[RESID_COLUMN] = list->InsertColumn( RESID_COLUMN, "ID", LVCFMT_LEFT, 50);
ColumnArray[NAME_COLUMN] = list->InsertColumn( NAME_COLUMN, "Name", LVCFMT_LEFT, 450);
ColumnArray[SIZE_COLUMN] = list->InsertColumn( SIZE_COLUMN, "Size", LVCFMT_LEFT, 50);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CResourceViewerDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CResourceViewerDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CResourceViewerDlg::OnOpenButton()
{
CFileDialog dlg(true, ".mw4", NULL, NULL, "Mech4 Resource (*.mw4)|*.mw4||");
if (dlg.DoModal() != IDOK)
{
return;
}
Adept::ResourceFile *res_file;
res_file = Adept::ResourceManager::Instance->OpenResourceFile(
dlg.GetPathName(),
NULL,
10,
VER_CONTENTVERSION,
false,
false
);
if (res_file)
{
CListCtrl *list = (CListCtrl *)GetDlgItem( IDC_RES_LIST );
Check_Pointer(list);
list->DeleteAllItems();
int count = 0;
Adept::Resource res;
res.First(res_file);
while (res.ReadAndNext())
{
CString data_name = res.GetName();
CString data_size;
data_size.Format("%d", res.GetSize());
char buffer[255];
Adept::ResourceID res_id = res.GetResourceID();
sprintf(buffer, "%d:%d", res_id.m_fileID, res_id.m_recordID);
CString res_id_string = buffer;
int item = list->InsertItem( count, res_id_string );
list->SetItemText( item, ColumnArray[SIZE_COLUMN], data_size );
list->SetItemText( item, ColumnArray[NAME_COLUMN], data_name );
count++;
}
Adept::ResourceManager::Instance->CloseAllButCore();
}
}
static int CALLBACK
CompName(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the list view control.
// The lParam of an item is just its index.
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
CString strItem1 = pListCtrl->GetItemText(lParam1, NAME_COLUMN);
CString strItem2 = pListCtrl->GetItemText(lParam2, NAME_COLUMN);
return strItem1.CompareNoCase(strItem2);
}
static int CALLBACK
CompSize(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the list view control.
// The lParam of an item is just its index.
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
return atoi(pListCtrl->GetItemText(lParam1, SIZE_COLUMN))>atoi(pListCtrl->GetItemText(lParam2, SIZE_COLUMN));
}
static int CALLBACK
CompResID(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the list view control.
// The lParam of an item is just its index.
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
CString strItem1 = pListCtrl->GetItemText(lParam1, RESID_COLUMN);
CString strItem2 = pListCtrl->GetItemText(lParam2, RESID_COLUMN);
int val1a,val2a;
int val1b,val2b;
val1a=atoi(strItem1.Left(strItem1.Find(':')));
val1b=atoi(strItem1.Mid(strItem1.Find(':')+1));
val2a=atoi(strItem2.Left(strItem1.Find(':')));
val2b=atoi(strItem2.Mid(strItem1.Find(':')+1));
if(val1a==val2a)
return val1b>val2b;
else
return val1a>val2a;
}
void CResourceViewerDlg::OnColumnclickResList(NMHDR* pNMHDR, LRESULT* pResult)
{
CListCtrl *list = (CListCtrl *)GetDlgItem( IDC_RES_LIST );
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) pNMHDR;
for(int i=0;i<list->GetItemCount();i++)
list->SetItemData(i,i);
switch(pnmv->iSubItem)
{
case NAME_COLUMN:
list->SortItems(CompName, (LPARAM) list);
break;
case SIZE_COLUMN:
list->SortItems(CompSize, (LPARAM) list);
break;
case RESID_COLUMN:
list->SortItems(CompResID, (LPARAM) list);
break;
}
*pResult = 0;
}
@@ -0,0 +1,58 @@
// ResourceViewerDlg.h : header file
//
#if !defined(AFX_RESOURCEVIEWERDLG_H__A12FA342_E24C_4EA5_8B4C_C4F93926A6E8__INCLUDED_)
#define AFX_RESOURCEVIEWERDLG_H__A12FA342_E24C_4EA5_8B4C_C4F93926A6E8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CResourceViewerDlg dialog
#if !defined(STUFF_STUFF_HPP)
#include "Stuff\Stuff.hpp"
#endif
#if !defined(ADEPT_ADEPT_HPP)
#include "Adept\Adept.hpp"
#endif
class CResourceViewerDlg : public CDialog
{
// Construction
public:
CResourceViewerDlg(CWnd* pParent = NULL); // standard constructor
~CResourceViewerDlg();
// Dialog Data
//{{AFX_DATA(CResourceViewerDlg)
enum { IDD = IDD_RESOURCEVIEWER_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CResourceViewerDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CResourceViewerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnOpenButton();
afx_msg void OnColumnclickResList(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESOURCEVIEWERDLG_H__A12FA342_E24C_4EA5_8B4C_C4F93926A6E8__INCLUDED_)
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// ResourceViewer.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,26 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__330EE3CC_4D24_49C1_BC60_E183E5FCF43A__INCLUDED_)
#define AFX_STDAFX_H__330EE3CC_4D24_49C1_BC60_E183E5FCF43A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__330EE3CC_4D24_49C1_BC60_E183E5FCF43A__INCLUDED_)
@@ -0,0 +1,13 @@
//
// RESOURCEVIEWER.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by ResourceViewer.rc
//
#define IDD_RESOURCEVIEWER_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_RES_LIST 1001
#define IDC_BUTTON1 1002
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif