mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
LunaCON: fix qsprintf, add test code for GAMEVAR_{NODEFAULT,NORESET} flags.
git-svn-id: https://svn.eduke32.com/eduke32@3805 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1ee43d5a6e
commit
8d74181ddf
2 changed files with 135 additions and 3 deletions
|
@ -13,6 +13,7 @@ local table = require("table")
|
||||||
local arg = arg
|
local arg = arg
|
||||||
|
|
||||||
local assert = assert
|
local assert = assert
|
||||||
|
--local error = error
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local loadstring = loadstring
|
local loadstring = loadstring
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
@ -43,6 +44,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module("lunacon")
|
module("lunacon")
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +68,15 @@ local function match_until(matchsp, untilsp) -- (!untilsp matchsp)* in PEG
|
||||||
return (matchsp - Pat(untilsp))^0
|
return (matchsp - Pat(untilsp))^0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
local function format(fmt, ...)
|
||||||
|
local ok, res = pcall(string.format, fmt, ...)
|
||||||
|
if (not ok) then
|
||||||
|
error(string.format("FAILED format(%q, ...) | message: %s", fmt, res))
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
--]]
|
||||||
local format = string.format
|
local format = string.format
|
||||||
|
|
||||||
local function printf(fmt, ...)
|
local function printf(fmt, ...)
|
||||||
|
@ -1179,7 +1190,8 @@ function Cmd.gamevar(identifier, initval, flags)
|
||||||
g_gamevar[identifier] = gv
|
g_gamevar[identifier] = gv
|
||||||
|
|
||||||
-- TODO: Write gamevar system on the Lunatic side and hook it up.
|
-- TODO: Write gamevar system on the Lunatic side and hook it up.
|
||||||
-- TODO: per-player gamevars
|
-- TODO: per-player gamevars. Currently, no error on using per-player var
|
||||||
|
-- in no-player context!
|
||||||
if (bit.band(flags, GVFLAG.PERX_MASK)==GVFLAG.PERACTOR) then
|
if (bit.band(flags, GVFLAG.PERX_MASK)==GVFLAG.PERACTOR) then
|
||||||
addcodef("%s=_con.actorvar(%d)", gv.name, initval)
|
addcodef("%s=_con.actorvar(%d)", gv.name, initval)
|
||||||
else
|
else
|
||||||
|
@ -1737,7 +1749,7 @@ local handle =
|
||||||
|
|
||||||
qsprintf = function(qdst, qsrc, ...)
|
qsprintf = function(qdst, qsrc, ...)
|
||||||
local codes = {...}
|
local codes = {...}
|
||||||
return format("_con._qsprintf(%d,%d%s%s)", qdst, qsrc,
|
return format("_con._qsprintf(%s,%s%s%s)", qdst, qsrc,
|
||||||
#codes>0 and "," or "", table.concat(codes, ','))
|
#codes>0 and "," or "", table.concat(codes, ','))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,57 @@
|
||||||
define Q 400
|
define Q 400
|
||||||
definequote Q ====== TEMP =======
|
definequote Q ====== TEMP =======
|
||||||
|
|
||||||
definequote 401 VOLUME %d
|
definequote 401 WILL WARP TO VOLUME %d
|
||||||
|
|
||||||
|
define SQ 402
|
||||||
|
definequote SQ <source>
|
||||||
|
definequote 403 <dest>
|
||||||
|
definequote 404 <dest>
|
||||||
|
definequote 405 <dest>
|
||||||
|
definequote 406 <dest>
|
||||||
|
definequote 407 <dest>
|
||||||
|
definequote 408 <dest>
|
||||||
|
definequote 409 <dest>
|
||||||
|
definequote 410 <dest>
|
||||||
|
definequote 411 <dest>
|
||||||
|
definequote 412 <dest>
|
||||||
|
definequote 413 <dest>
|
||||||
|
definequote 414 <dest>
|
||||||
|
|
||||||
|
// Test gamevar flags GAMEVAR_NODEFAULT and GAMEVAR_NORESET.
|
||||||
|
// Global.
|
||||||
|
define GV_NODEFAULT 1024
|
||||||
|
define GV_NORESET 131072
|
||||||
|
define GV_NODEFAULT_NORESET 132096
|
||||||
|
// Per-player.
|
||||||
|
define PV_NODEFAULT 1025
|
||||||
|
define PV_NORESET 131073
|
||||||
|
define PV_NODEFAULT_NORESET 132097
|
||||||
|
// Per-actor (not very meaningful, as the APLAYER actor will in general have a
|
||||||
|
// different sprite for different levels).
|
||||||
|
define AV_NODEFAULT 1026
|
||||||
|
define AV_NORESET 131074
|
||||||
|
define AV_NODEFAULT_NORESET 132098
|
||||||
|
|
||||||
|
// global
|
||||||
|
gamevar numwarps 0 0
|
||||||
|
gamevar numwarpsD 0 GV_NODEFAULT
|
||||||
|
gamevar numwarpsR 0 GV_NORESET
|
||||||
|
gamevar numwarpsDR 0 GV_NODEFAULT_NORESET
|
||||||
|
// per-player
|
||||||
|
gamevar Pnumwarps 0 1
|
||||||
|
gamevar PnumwarpsD 0 PV_NODEFAULT
|
||||||
|
gamevar PnumwarpsR 0 PV_NORESET
|
||||||
|
gamevar PnumwarpsDR 0 PV_NODEFAULT_NORESET
|
||||||
|
// per-actor
|
||||||
|
gamevar Anumwarps 0 2
|
||||||
|
gamevar AnumwarpsD 0 AV_NODEFAULT
|
||||||
|
gamevar AnumwarpsR 0 AV_NORESET
|
||||||
|
gamevar AnumwarpsDR 0 AV_NODEFAULT_NORESET
|
||||||
|
|
||||||
|
gamevar pal 0 0
|
||||||
|
gamevar dq 0 0
|
||||||
|
gamevar y 0 0
|
||||||
|
|
||||||
state calcvolume
|
state calcvolume
|
||||||
getplayer[THISACTOR].ang gs
|
getplayer[THISACTOR].ang gs
|
||||||
|
@ -15,13 +65,83 @@ state calcvolume
|
||||||
divvar gs 512
|
divvar gs 512
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
state dispnumwarps
|
||||||
|
gametextz STARTALPHANUM 20 y dq 0 pal 0 0 0 xdim ydim 32768
|
||||||
|
addvar dq 1
|
||||||
|
addvar y 8
|
||||||
|
ends
|
||||||
|
|
||||||
onevent EVENT_DISPLAYREST
|
onevent EVENT_DISPLAYREST
|
||||||
state calcvolume
|
state calcvolume
|
||||||
qsprintf Q /*<-*/ 401 /**/ gs
|
qsprintf Q /*<-*/ 401 /**/ gs
|
||||||
gametext STARTALPHANUM 20 20 Q 0 0 0 0 0 xdim ydim
|
gametext STARTALPHANUM 20 20 Q 0 0 0 0 0 xdim ydim
|
||||||
|
|
||||||
|
setvar y 40
|
||||||
|
setvar dq 403
|
||||||
|
setvar pal 0
|
||||||
|
|
||||||
|
// global
|
||||||
|
redefinequote SQ numwarps (no flags): %d
|
||||||
|
qsprintf dq SQ numwarps
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ numwarps (NODEFAULT): %d
|
||||||
|
qsprintf dq SQ numwarpsD
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ numwarps (NORESET): %d
|
||||||
|
qsprintf dq SQ numwarpsR
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ numwarps (NODEFAULT, NORESET): %d
|
||||||
|
qsprintf dq SQ numwarpsDR
|
||||||
|
state dispnumwarps
|
||||||
|
|
||||||
|
// per-player
|
||||||
|
setvar pal 14
|
||||||
|
redefinequote SQ Pnumwarps (no flags): %d
|
||||||
|
qsprintf dq SQ Pnumwarps
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Pnumwarps (NODEFAULT): %d
|
||||||
|
qsprintf dq SQ PnumwarpsD
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Pnumwarps (NORESET): %d
|
||||||
|
qsprintf dq SQ PnumwarpsR
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Pnumwarps (NODEFAULT, NORESET): %d
|
||||||
|
qsprintf dq SQ PnumwarpsDR
|
||||||
|
state dispnumwarps
|
||||||
|
|
||||||
|
// per-actor
|
||||||
|
setvar pal 10
|
||||||
|
redefinequote SQ Anumwarps (no flags): %d
|
||||||
|
qsprintf dq SQ Anumwarps
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Anumwarps (NODEFAULT): %d
|
||||||
|
qsprintf dq SQ AnumwarpsD
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Anumwarps (NORESET): %d
|
||||||
|
qsprintf dq SQ AnumwarpsR
|
||||||
|
state dispnumwarps
|
||||||
|
redefinequote SQ Anumwarps (NODEFAULT, NORESET): %d
|
||||||
|
qsprintf dq SQ AnumwarpsDR
|
||||||
|
state dispnumwarps
|
||||||
endevent
|
endevent
|
||||||
|
|
||||||
onevent EVENT_USESTEROIDS
|
onevent EVENT_USESTEROIDS
|
||||||
|
// global
|
||||||
|
addvar numwarps 1
|
||||||
|
addvar numwarpsD 1
|
||||||
|
addvar numwarpsR 1
|
||||||
|
addvar numwarpsDR 1
|
||||||
|
// per-player
|
||||||
|
addvar Pnumwarps 1
|
||||||
|
addvar PnumwarpsD 1
|
||||||
|
addvar PnumwarpsR 1
|
||||||
|
addvar PnumwarpsDR 1
|
||||||
|
// per-actor
|
||||||
|
addvar Anumwarps 1
|
||||||
|
addvar AnumwarpsD 1
|
||||||
|
addvar AnumwarpsR 1
|
||||||
|
addvar AnumwarpsDR 1
|
||||||
|
|
||||||
savemapstate
|
savemapstate
|
||||||
|
|
||||||
state calcvolume
|
state calcvolume
|
||||||
|
|
Loading…
Reference in a new issue