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.
730 lines
16 KiB
Plaintext
730 lines
16 KiB
Plaintext
//
|
|
// for new coop version by jcem
|
|
//
|
|
#define fs_id (-56789)
|
|
|
|
// from here events
|
|
#define fs_left 0x00010000
|
|
#define fs_right 0x00020000
|
|
#define fs_up 0x00040000
|
|
#define fs_down 0x00080000
|
|
|
|
#define fs_but1 101
|
|
#define fs_but2 102
|
|
#define fs_but3 103
|
|
|
|
// var keys...
|
|
#define fs_tab 209
|
|
#define fs_ret 213
|
|
#define fs_esc 227
|
|
#define fs_space 232
|
|
// to here events
|
|
|
|
// from here events - internal
|
|
#define fs_check_xval 1000
|
|
#define fs_check_yval 1001
|
|
#define fs_check_xdir 1002
|
|
#define fs_check_ydir 1003
|
|
// to here events - internal
|
|
|
|
#define HORZ_ZONE_LEFT (-600)
|
|
#define HORZ_ZONE_LEFT2 (-300)
|
|
#define HORZ_ZONE_RIGHT2 (+300)
|
|
#define HORZ_ZONE_RIGHT (+600)
|
|
|
|
#define VERT_ZONE_UP (-600)
|
|
#define VERT_ZONE_UP2 (-300)
|
|
#define VERT_ZONE_DOWN2 (+300)
|
|
#define VERT_ZONE_DOWN (+600)
|
|
|
|
s_fscreen
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
// temp vars
|
|
int maskh
|
|
int maskv
|
|
int timeDiff
|
|
// id
|
|
int id = fs_id
|
|
int nJoystick = 0
|
|
|
|
location = -2000, -2000, 30000 // 30000 is almost top-most z-order value...
|
|
int width = 2000 + getresx() + 2000
|
|
int height = 2000 + getresy() + 2000
|
|
region = location.x,location.y to width,height
|
|
|
|
int time_delay = 150 // check every ##/60 sec
|
|
int time_initial = 300 // additional delay for the first time...
|
|
int time_cutoff = gettimex() + time_delay + time_initial
|
|
|
|
int fsm_isHorz = 0x00000100
|
|
int fsm_isHorz2 = 0x00000200
|
|
int fsm_isVert = 0x00000400
|
|
int fsm_isVert2 = 0x00000800
|
|
|
|
int fsm_left = fs_left
|
|
int fsm_right = fs_right
|
|
int fsm_up = fs_up
|
|
int fsm_down = fs_down
|
|
|
|
int fsm_left2 = 0x00001000
|
|
int fsm_right2 = 0x00002000
|
|
int fsm_up2 = 0x00004000
|
|
int fsm_down2 = 0x00008000
|
|
|
|
int fsm_repx = 0x00100000
|
|
int fsm_repy = 0x00200000
|
|
|
|
int fsm_2dircheck = 0x00400000
|
|
|
|
// detect left/right & up/down sam-time?
|
|
// default FALSE
|
|
// if FALSE then greater(in abs(...)) side will be returned
|
|
// if TRUE then both(horz,vert) side could be setted as a bit..
|
|
int flagDirsMask = fsm_left | fsm_right | fsm_up | fsm_down
|
|
|
|
int fsm_horzAll = fsm_left | fsm_left2 | fsm_right2 | fsm_right
|
|
int fsm_vertAll = fsm_up | fsm_up2 | fsm_down2 | fsm_down
|
|
int CODE_INAVLID = fsm_horzAll | fsm_vertAll
|
|
|
|
int timeZoneCode = CODE_INAVLID // invalid value
|
|
int timeLast
|
|
int timeHorz
|
|
int timeHorz2
|
|
int timeVert
|
|
int timeVert2
|
|
|
|
int timeClickA = 10
|
|
int timeClickB = 800
|
|
int timeRepStart = 1000 // 485/60 second : for starting repeteating clicks
|
|
int timeRepDur = 750 // 30/60 second for repeteating clicks
|
|
|
|
int playBut1 = TRUE
|
|
int playBut2 = TRUE
|
|
int playBut3 = TRUE
|
|
int playHorz = FALSE
|
|
int playVert = FALSE
|
|
|
|
string strBut1 = SPATH "sfx_button7.wav"
|
|
string strBut2 = SPATH "sfx_button7.wav"
|
|
string strBut3 = SPATH "sfx_button7.wav"
|
|
string strHorz = SPATH "sfx_button7.wav"
|
|
string strVert = SPATH "sfx_button7.wav"
|
|
|
|
sound sndBut1
|
|
sound sndBut2
|
|
sound sndBut3
|
|
sound sndHorz
|
|
sound sndVert
|
|
|
|
// delay is frame based not time based
|
|
framerate = 30
|
|
|
|
focus(this)
|
|
}
|
|
|
|
GUI_INIT
|
|
{
|
|
region = 0,0 to width, height
|
|
|
|
timeZoneCode = CODE_INAVLID
|
|
|
|
sndBut1 = strBut1
|
|
sndBut2 = strBut2
|
|
sndBut3 = strBut3
|
|
sndHorz = strHorz
|
|
sndVert = strVert
|
|
}
|
|
|
|
LBUTTON_UPDATE
|
|
{
|
|
if (gettimex() >= time_cutoff)
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if (mouse.left == BUTTON_CLICKED)
|
|
{
|
|
if (playBut1)
|
|
play sndBut1, 1
|
|
mail(id, fs_but1, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
RBUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.right == BUTTON_CLICKED
|
|
{
|
|
if (playBut2)
|
|
play sndBut2, 1
|
|
mail(id, fs_but2, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
MBUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.middle == BUTTON_CLICKED
|
|
{
|
|
if (playBut3)
|
|
play sndBut3, 1
|
|
mail(id, fs_but3, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
HAT6BUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.hat6 == BUTTON_CLICKED
|
|
{
|
|
if (playVert)
|
|
play sndVert, 1
|
|
mail(id, fs_up, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
HAT7BUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.hat7 == BUTTON_CLICKED
|
|
{
|
|
if (playHorz)
|
|
play sndHorz, 1
|
|
mail(id, fs_left, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
HAT8BUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.hat8 == BUTTON_CLICKED
|
|
{
|
|
if (playVert)
|
|
play sndVert, 1
|
|
mail(id, fs_down, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
HAT9BUTTON_UPDATE
|
|
{
|
|
if gettimex() >= time_cutoff
|
|
{
|
|
//time_cutoff = gettimex() + time_delay
|
|
|
|
if mouse.hat9 == BUTTON_CLICKED
|
|
{
|
|
if (playHorz)
|
|
play sndHorz, 1
|
|
mail(id, fs_right, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
GUI_MAILBOX
|
|
{
|
|
int mx
|
|
int my
|
|
|
|
if sender == this
|
|
{
|
|
int m1
|
|
int m2
|
|
|
|
if getmessage() == fs_check_xval
|
|
{
|
|
mx = getmessage(1)
|
|
if (mx < HORZ_ZONE_LEFT)
|
|
return fsm_left
|
|
if (mx < HORZ_ZONE_LEFT2)
|
|
return fsm_left2
|
|
if (mx < HORZ_ZONE_RIGHT2)
|
|
return 0
|
|
if (mx < HORZ_ZONE_RIGHT)
|
|
return fsm_right2
|
|
return fsm_right
|
|
}
|
|
if getmessage() == fs_check_yval
|
|
{
|
|
my = getmessage(1)
|
|
if (my < VERT_ZONE_UP)
|
|
return fsm_up
|
|
if (my < VERT_ZONE_UP2)
|
|
return fsm_up2
|
|
if (my < VERT_ZONE_DOWN2)
|
|
return 0
|
|
if (my < VERT_ZONE_DOWN)
|
|
return fsm_down2
|
|
return fsm_down
|
|
}
|
|
if getmessage() == fs_check_xdir
|
|
{
|
|
mx = getmessage(1)
|
|
if mx & fsm_horzAll
|
|
{
|
|
if timeZoneCode & fsm_horzAll
|
|
{
|
|
m1 = mx & (fsm_left | fsm_left2)
|
|
m2 = timeZoneCode & (fsm_right | fsm_right2)
|
|
if m1 && m2
|
|
return 0
|
|
|
|
m1 = mx & (fsm_right | fsm_right2)
|
|
m2 = timeZoneCode & (fsm_left | fsm_left2)
|
|
if m1 && m2
|
|
return 0
|
|
}
|
|
}
|
|
return 1
|
|
}
|
|
if (getmessage() == fs_check_ydir)
|
|
{
|
|
my = getmessage(1)
|
|
if my & fsm_vertAll
|
|
{
|
|
if timeZoneCode & fsm_vertAll
|
|
{
|
|
m1 = my & (fsm_up | fsm_up2)
|
|
m2 = timeZoneCode & (fsm_down | fsm_down2)
|
|
if m1 && m2
|
|
return 0
|
|
|
|
m1 = my & (fsm_down | fsm_down2)
|
|
m2 = timeZoneCode & (fsm_up | fsm_up2)
|
|
if m1 && m2
|
|
return 0
|
|
}
|
|
}
|
|
return 1
|
|
}
|
|
}
|
|
}
|
|
|
|
GUI_EXECUTE
|
|
{
|
|
#if 0
|
|
int naJoyInfos[3 + 5]
|
|
|
|
callback($$CTCL_GetJoyInfo$$, nJoystick, naJoyInfos[0])
|
|
|
|
int nX = naJoyInfos[0]
|
|
int nY = naJoyInfos[1]
|
|
maskh = mail(fs_check_xval, nX, this)
|
|
maskv = mail(fs_check_yval, nY, this)
|
|
int timeCur = gettimex()
|
|
|
|
//spew "x: ", "%x", nX, "y: ", nY
|
|
//spew "maskh: ", maskh, "maskv: ", maskv, "time: ", timeCur
|
|
|
|
if timeZoneCode == CODE_INAVLID
|
|
{
|
|
//play sndHorz, 1
|
|
|
|
// initial processing...
|
|
timeZoneCode = maskh | maskv
|
|
timeLast = timeCur
|
|
|
|
timeHorz2 = 0
|
|
timeHorz = 0
|
|
if maskh & fsm_horzAll
|
|
{
|
|
if maskh & (fsm_left | fsm_right)
|
|
{
|
|
timeZoneCode |= fsm_isHorz
|
|
timeHorz = timeLast
|
|
}
|
|
timeZoneCode |= fsm_isHorz2
|
|
timeHorz2 = timeLast
|
|
}
|
|
|
|
timeVert = 0
|
|
timeVert2 = 0
|
|
if maskv & fsm_vertAll
|
|
{
|
|
if maskv & (fsm_up | fsm_down)
|
|
{
|
|
timeZoneCode |= fsm_isVert
|
|
timeVert = timeLast
|
|
}
|
|
timeZoneCode |= fsm_isVert2
|
|
timeVert2 = timeLast
|
|
}
|
|
return
|
|
}
|
|
|
|
int nRetCode = 0
|
|
int nOldHorz2 = timeHorz2
|
|
int nOldVert2 = timeVert2
|
|
|
|
// check left/right
|
|
if mail(fs_check_xdir, maskh, this)
|
|
{
|
|
// same direction
|
|
if maskh == 0
|
|
{
|
|
if timeZoneCode & fsm_isHorz
|
|
{
|
|
if timeClickA <= (timeCur - timeHorz2)
|
|
{
|
|
if (timeCur - timeHorz2) < timeClickB
|
|
{
|
|
nRetCode |= timeZoneCode & (fsm_left | fsm_right)
|
|
}
|
|
}
|
|
}
|
|
timeZoneCode &= ~(fsm_repx | fsm_horzAll | fsm_isHorz | fsm_isHorz2)
|
|
timeLast = timeCur
|
|
timeHorz2 = 0
|
|
timeHorz = 0
|
|
}
|
|
|
|
if maskh & (fsm_left | fsm_right)
|
|
{
|
|
if timeHorz
|
|
{
|
|
timeDiff = timeCur - timeHorz
|
|
if timeZoneCode & fsm_repx
|
|
{
|
|
if timeRepDur <= timeDiff
|
|
{
|
|
nRetCode |= maskh & (fsm_left | fsm_right)
|
|
timeLast = timeCur
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if timeRepStart <= timeDiff
|
|
{
|
|
timeZoneCode |= fsm_repx
|
|
timeLast = timeCur
|
|
nRetCode |= maskh & (fsm_left | fsm_right)
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
timeZoneCode &= ~(fsm_repx | fsm_horzAll)
|
|
timeZoneCode |= (maskh | fsm_isHorz | fsm_isHorz2)
|
|
timeLast = timeCur
|
|
if !timeHorz2
|
|
timeHorz2 = timeLast
|
|
timeHorz = timeLast
|
|
}
|
|
}
|
|
if maskh & (fsm_left2 | fsm_right2)
|
|
{
|
|
timeZoneCode &= ~(fsm_repx | fsm_horzAll)
|
|
timeZoneCode |= (maskh | fsm_isHorz2)
|
|
timeLast = timeCur
|
|
if !timeHorz2
|
|
timeHorz2 = timeCur
|
|
timeHorz = 0
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// invalid direction: you may moved stick too fast in both(left/right) direction
|
|
// new direction started as initial processing...
|
|
timeZoneCode &= ~(fsm_repx | fsm_horzAll | fsm_isHorz | fsm_isHorz2)
|
|
timeZoneCode |= (maskh | fsm_isHorz2)
|
|
timeLast = timeCur
|
|
|
|
timeHorz2 = timeLast
|
|
if maskh & (fsm_left | fsm_right)
|
|
{
|
|
timeZoneCode |= fsm_isHorz
|
|
timeHorz = timeLast
|
|
}
|
|
else
|
|
timeHorz = 0
|
|
}
|
|
|
|
// check up/down
|
|
if mail(fs_check_ydir, maskv, this)
|
|
{
|
|
// same direction
|
|
if maskv == 0
|
|
{
|
|
if timeZoneCode & fsm_isVert
|
|
{
|
|
if timeClickA <= (timeCur - timeVert2)
|
|
{
|
|
if (timeCur - timeVert2) < timeClickB
|
|
{
|
|
nRetCode |= timeZoneCode & (fsm_up | fsm_down)
|
|
}
|
|
}
|
|
}
|
|
timeZoneCode &= ~(fsm_repy | fsm_vertAll | fsm_isVert | fsm_isVert2)
|
|
timeLast = timeCur
|
|
timeVert2 = 0
|
|
timeVert = 0
|
|
}
|
|
if maskv & (fsm_up | fsm_down)
|
|
{
|
|
if timeVert
|
|
{
|
|
timeDiff = timeCur - timeVert
|
|
if timeZoneCode & fsm_repy
|
|
{
|
|
if timeRepDur <= timeDiff
|
|
{
|
|
nRetCode |= maskv & (fsm_up | fsm_down)
|
|
timeLast = timeCur
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if timeRepStart <= timeDiff
|
|
{
|
|
timeZoneCode |= fsm_repy
|
|
timeLast = timeCur
|
|
nRetCode |= maskv & (fsm_up | fsm_down)
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
timeZoneCode &= ~(fsm_repy | fsm_vertAll)
|
|
timeZoneCode |= (maskv | fsm_isVert | fsm_isVert2)
|
|
timeLast = timeCur
|
|
if !timeVert2
|
|
timeVert2 = timeLast
|
|
timeVert = timeLast
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if maskv & (fsm_up2 | fsm_down2)
|
|
{
|
|
timeZoneCode &= ~(fsm_repy | fsm_vertAll)
|
|
timeZoneCode |= (maskv | fsm_isVert2)
|
|
timeLast = timeCur
|
|
if !timeVert2
|
|
timeVert2 = timeLast
|
|
timeVert = 0
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// invalid direction: you may moved stick too fast in both(up/down) direction
|
|
// new direction started as initial processing...
|
|
timeZoneCode &= ~(fsm_repy | fsm_vertAll | fsm_isVert | fsm_isVert2)
|
|
timeZoneCode |= (maskv | fsm_isVert2)
|
|
timeLast = timeCur
|
|
|
|
timeVert2 = timeLast
|
|
if maskv & (fsm_up | fsm_down)
|
|
{
|
|
timeZoneCode |= fsm_isVert
|
|
timeVert = timeLast
|
|
}
|
|
else
|
|
timeVert = 0
|
|
}
|
|
|
|
#if 0
|
|
if nRetCode & (fsm_left | fsm_right)
|
|
spew "left or right"
|
|
if nRetCode & (fsm_up | fsm_down)
|
|
spew "up or down"
|
|
#endif
|
|
nRetCode &= flagDirsMask
|
|
if nRetCode
|
|
{
|
|
int nHorz = nRetCode & (fsm_left | fsm_right)
|
|
int nVert = nRetCode & (fsm_up | fsm_down)
|
|
|
|
if !(flagDirsMask & fsm_2dircheck)
|
|
{
|
|
if nHorz && nVert
|
|
{
|
|
if nOldHorz2 <= nOldVert2
|
|
{
|
|
nRetCode &= (fsm_left | fsm_right)
|
|
nVert = FALSE
|
|
}
|
|
else
|
|
{
|
|
nRetCode &= (fsm_up | fsm_down)
|
|
nHorz = FALSE
|
|
}
|
|
}
|
|
}
|
|
if nHorz
|
|
{
|
|
if (playHorz)
|
|
play sndHorz, 1
|
|
}
|
|
if nVert
|
|
{
|
|
if (playVert)
|
|
play sndVert, 1
|
|
}
|
|
mail(id, nRetCode, parent)
|
|
}
|
|
#endif
|
|
}
|
|
|
|
GUI_DRAW
|
|
{
|
|
}
|
|
GUI_CHAR
|
|
{
|
|
// Check for the Escape key to resume mission
|
|
int ch = getchar()
|
|
|
|
if (ch == 0x09)
|
|
{
|
|
mail(id, fs_tab, parent)
|
|
return
|
|
}
|
|
if (ch == 0x0d) || (ch == 0x0a)
|
|
{
|
|
mail(id, fs_ret, parent)
|
|
return
|
|
}
|
|
if (ch == 27)
|
|
{
|
|
mail(id, fs_esc, parent)
|
|
}
|
|
if (ch == ' ')
|
|
{
|
|
mail(id, fs_space, parent)
|
|
}
|
|
}
|
|
}
|
|
|
|
s_invite_check
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
int nDoChallenge = 0
|
|
}
|
|
GUI_EXECUTE
|
|
{
|
|
if (nDoChallenge == 0) && callback($$CTCL_CheckCOOP$$)
|
|
{
|
|
int nCheck = callback($$CTCL_CheckInviteCOOP$$, 0)
|
|
if nCheck && (nCheck != 2)
|
|
{
|
|
if nCheck == 1
|
|
{
|
|
if callback($$CTCL_GetType$$) == _ECTCL_CameraShip
|
|
{
|
|
callback($$CTCL_CheckInviteCOOP$$, 3)
|
|
}
|
|
else
|
|
{
|
|
#if 1 // TEST ROUTINE - rel
|
|
script_run "Content\\ShellScripts\\gs_PauseModalCampaign.script", 0x2000
|
|
#else // TEST ROUTINE - dbg
|
|
callback($$CTCL_CheckInviteCOOP$$, 3)
|
|
#endif
|
|
}
|
|
nCheck = callback($$CTCL_CheckInviteCOOP$$, 1)
|
|
}
|
|
|
|
if (nCheck == 3)
|
|
{
|
|
nDoChallenge = 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
s_typewriter
|
|
{
|
|
GUI_CREATE
|
|
{
|
|
// nReqCount: should be initialized as valid hop-count
|
|
// if nReqCount is 0, then text will be used...(no nStart, nEnd, nReqCount, nValues...)
|
|
int nReqCount = 0 // -1 at string end, -2 at int end
|
|
|
|
// if 0 < nReqCount then nReqCount numbers between nStart & nEnd will be calculated in nValues
|
|
// "nEnd <= nStart" could be possible... negative numbers is possible.
|
|
int nStart = 0
|
|
int nEnd = 0
|
|
int naValus[100]
|
|
|
|
// if nReqCount is 0, then text will be displayed at the end...
|
|
// text == "" could be possible...
|
|
string text
|
|
|
|
// if -1, then not initialized.. & after initialization nCount will be maxium display steps
|
|
// in string case, currently, nCount will be length$(text)
|
|
int nCount = -1
|
|
|
|
// current display step
|
|
// naValus[nCurIdx] or left$(text, nCurIdx)
|
|
// used internally, use result values at below...
|
|
int nCurIdx = 0 // should be 0 initially...
|
|
|
|
// result
|
|
int nResult = -1
|
|
string strResult = "!error"
|
|
|
|
framerate = 1
|
|
}
|
|
GUI_INIT
|
|
{
|
|
mail(0, this)
|
|
}
|
|
GUI_MAILBOX
|
|
{
|
|
if nReqCount < 0
|
|
return FALSE // already reach to the goal so use nResult/strResult(error case too, see above: -1 or !error)
|
|
|
|
if nReqCount == 0
|
|
{ // as string
|
|
if nCount == -1
|
|
{
|
|
nCount = length$(text)
|
|
}
|
|
strResult = left$(text, nCurIdx)
|
|
if nCurIdx < nCount
|
|
nCurIdx++
|
|
else
|
|
nReqCount = -1 // reached to the goal, no more processing
|
|
}
|
|
else
|
|
{
|
|
if nCount == -1
|
|
{
|
|
nCount = callback($$CTCL_GetIncNums$$, nReqCount, nStart, nEnd, naValus[0]) - 1
|
|
}
|
|
nResult = naValus[nCurIdx]
|
|
strResult = conv$(nResult)
|
|
if nCurIdx < nCount
|
|
nCurIdx++
|
|
else
|
|
nReqCount = -2 // reached to the goal, no more processing
|
|
}
|
|
|
|
return TRUE
|
|
}
|
|
}
|