Lunatic: submerging in code.

git-svn-id: https://svn.eduke32.com/eduke32@3254 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-12-03 18:24:30 +00:00
parent b062d5f572
commit 99c67c0190
7 changed files with 278 additions and 60 deletions

View file

@ -203,7 +203,7 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *p)
p->look_ang = p->rotscrnang = n>>1; p->look_ang = p->rotscrnang = n>>1;
} }
GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s) int32_t A_Dodge(spritetype *s)
{ {
int32_t bx,by,bxvect,byvect,i; int32_t bx,by,bxvect,byvect,i;
int32_t mx = s->x, my = s->y; int32_t mx = s->x, my = s->y;
@ -434,8 +434,6 @@ int32_t G_GetAngleDelta(int32_t a,int32_t na)
if (na > 1024) na -= 2048; if (na > 1024) na -= 2048;
if (a > 1024) a -= 2048; if (a > 1024) a -= 2048;
na -= 2048;
a -= 2048;
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); // OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
return (na-a); return (na-a);
} }

View file

@ -5,6 +5,7 @@ local ffiC = ffi.C
local bit = require("bit") local bit = require("bit")
local math = require("math") local math = require("math")
local geom = require("geom")
local setmetatable = setmetatable local setmetatable = setmetatable
@ -12,7 +13,10 @@ local error = error
local type = type local type = type
local player = assert(player) local player = assert(player)
local cansee = require("defs_common").cansee local defs_c = require("defs_common")
local cansee = defs_c.cansee
local neartag = defs_c.neartag
local inside = defs_c.inside
module(...) module(...)
@ -232,13 +236,7 @@ function _VM_ResetPlayer2(snum)
return (ffiC.VM_ResetPlayer2(snum)~=0) return (ffiC.VM_ResetPlayer2(snum)~=0)
end end
function _addinventory(p, inv, amount, pal)
if (inv == ffiC.GET_ACCESS) then
local PALBITS = { [0]=1, [21]=2, [23]=4 } local PALBITS = { [0]=1, [21]=2, [23]=4 }
if (PALBITS[pal]) then
ps.got_access = bit.bor(ps.got_access, PALBITS[pal])
end
else
local ICONS = { local ICONS = {
[ffiC.GET_FIRSTAID] = 1, -- ICON_FIRSTAID [ffiC.GET_FIRSTAID] = 1, -- ICON_FIRSTAID
[ffiC.GET_STEROIDS] = 2, [ffiC.GET_STEROIDS] = 2,
@ -249,6 +247,12 @@ function _addinventory(p, inv, amount, pal)
[ffiC.GET_BOOTS] = 7, [ffiC.GET_BOOTS] = 7,
} }
function _addinventory(ps, inv, amount, pal)
if (inv == ffiC.GET_ACCESS) then
if (PALBITS[pal]) then
ps.got_access = bit.bor(ps.got_access, PALBITS[pal])
end
else
if (ICONS[inv]) then if (ICONS[inv]) then
ps.inven_icon = ICONS[inv] ps.inven_icon = ICONS[inv]
end end
@ -262,6 +266,19 @@ function _addinventory(p, inv, amount, pal)
end end
end end
-- For GET_ACCESS: returns logical: whether player has card given by PAL
-- Else: returns inventory amount
function _getinventory(ps, inv, pal)
if (inv == ffiC.GET_ACCESS) then
if (PALBITS[pal]) then
return (bit.band(ps.got_access, PALBITS[pal])~=0)
end
return false
else
return ps:get_inv_amount(inv)
end
end
-- The return value is true iff the ammo was at the weapon's max. -- The return value is true iff the ammo was at the weapon's max.
-- In that case, no action is taken. -- In that case, no action is taken.
function _addammo(ps, weapon, amount) function _addammo(ps, weapon, amount)
@ -282,6 +299,118 @@ function _addweapon(ps, weapon, amount)
P_AddWeaponAmmoCommon(ps, weap, amount) P_AddWeaponAmmoCommon(ps, weap, amount)
end end
function _A_RadiusDamage(i, r, hp1, hp2, hp3, hp4)
check_sprite_idx(i)
ffiC.A_RadiusDamage(i, r, hp1, hp2, hp3, hp4)
end
function _testkey(pli, synckey)
local bound_check = player[pli]
if (synckey >= 32ULL) then
error("Invalid argument #2 to _testkey: must be in [0..31]", 2)
end
local bits = ffiC.player[pli].sync.bits
return (bit.band(bits, bit.lshift(1,synckey)) ~= 0)
end
function _operate(spritenum)
local NEAROP = {
[9] = true,
[15] = true,
[16] = true,
[17] = true,
[18] = true,
[19] = true,
[20] = true,
[21] = true,
[22] = true,
[23] = true,
[25] = true,
[26] = true,
[29] = true,
}
local spr = sprite[spritenum]
if (sector[spr.sectnum].lotag == 0) then
local tag = neartag(spr^(32*256), spr.sectnum, spr.ang, 768, 4+1)
if (tag.sector >= 0) then
local sect = sector[tag.sector]
local lotag = sect.lotag
if (NEAROP[bit.band(lotag, 0xff)]) then
if (lotag==23 or sect.floorz==sect.ceilingz) then
if (bit.band(lotag, 32768+16384) == 0) then
for j in spritesofsect(tag.sector) do
if (sprite[j].picnum==2) then
-- TODO: ^^^ actually ACTIVATOR. Make the
-- dynamic name->tilenum mappings work.
return
end
end
ffiC.G_OperateSectors(tag.sector, spritenum)
end
end
end
end
end
end
function _endofgame(pli, timebeforeexit)
player[pli].timebeforeexit = timebeforeexit
player[pli].customexitsound = -1
ffiC.ud.eog = 1
end
function _bulletnear(i)
return (ffiC.A_Dodge(sprite[i]) == 1)
end
-- d is a distance
function _awayfromwall(spr, d)
local vec2 = geom.vec2
local vecs = { vec2(d,d), vec2(-d,-d), vec2(d,-d), vec2(-d,d) }
for i=1,4 do
if (not inside(vecs[i]+spr, spr.sectnum)) then
return false
end
end
return true
end
function _canseetarget(spr, ps)
-- NOTE: &41 ?
return cansee(spr^(bit.band(ffiC.krand(),41)), spr.sectnum,
ps.pos, sprite[ps.i].sectnum)
end
function _getlastpal(spritenum)
local spr = sprite[spritenum]
if (spr.picnum == 1405) then -- TODO: APLAYER
spr.pal = player[spr.yvel].palookup
else
if (spr.pal == 1 and spr.extra == 0) then -- hack for frozen
spr.extra = spr.extra+1
end
spr.pal = actor[spritenum].tempang
end
actor[spritenum].tempang = 0
end
-- abs(G_GetAngleDelta(a1, a2))
function _angdiffabs(a1, a2)
a1 = bit.band(a1, 2047)
a2 = bit.band(a2, 2047)
-- a1 and a2 are in [0, 2047]
if (math.abs(a2-a1) < 1024) then
return math.abs(a2-a1)
end
-- |a2-a1| >= 1024
if (a2 > 1024) then a2=a2-2048 end
if (a1 > 1024) then a1=a1-2048 end
-- a1 and a2 is in [-1023, 1024]
return math.abs(a2-a1)
end
--- Exported functions --- --- Exported functions ---

View file

@ -191,8 +191,11 @@ local DUKEPLAYER_STRUCT = [[
const int16_t i; const int16_t i;
const int16_t one_parallax_sectnum; const int16_t one_parallax_sectnum;
int16_t random_club_frame, one_eighty_count; int16_t random_club_frame, one_eighty_count;
int16_t dummyplayersprite, extra_extra8; const int16_t dummyplayersprite;
int16_t actorsqu, timebeforeexit, customexitsound, last_pissed_time; int16_t extra_extra8;
int16_t actorsqu, timebeforeexit;
const int16_t customexitsound;
int16_t last_pissed_time;
const int16_t weaprecs[MAX_WEAPONS]; const int16_t weaprecs[MAX_WEAPONS];
int16_t weapon_sway, crack_time, bobcounter; int16_t weapon_sway, crack_time, bobcounter;
@ -432,6 +435,9 @@ int32_t A_IncurDamage(int32_t sn);
int32_t A_Spawn(int32_t j, int32_t pn); int32_t A_Spawn(int32_t j, int32_t pn);
void VM_FallSprite(int32_t i); void VM_FallSprite(int32_t i);
int32_t VM_ResetPlayer2(int32_t snum); int32_t VM_ResetPlayer2(int32_t snum);
void A_RadiusDamage(int32_t i, int32_t r, int32_t, int32_t, int32_t, int32_t);
void G_OperateSectors(int32_t sn, int32_t ii);
int32_t A_Dodge(spritetype *s);
]] ]]
-- functions -- functions
@ -696,14 +702,30 @@ local player_mt = {
ffi.cast(player_ptr_ct, p).inv_amount[inv] = amount ffi.cast(player_ptr_ct, p).inv_amount[inv] = amount
end, end,
set_customexitsound = function(p, soundnum)
if (soundnum >= con_lang.MAXSOUNDS+0ULL) then
error("Invalid sound number "..soundnum, 2)
end
ffi.cast(player_ptr_ct, p).customexitsound = soundnum
end,
-- CON-like addammo/addweapon, but without the non-local control flow -- CON-like addammo/addweapon, but without the non-local control flow
-- (returns true if weapon's ammo was at the max. instead). -- (returns true if weapon's ammo was at the max. instead).
addammo = con._addammo, addammo = con._addammo,
addweapon = con._addweapon, addweapon = con._addweapon,
addinventory = con._addinventory, addinventory = con._addinventory,
pstomp = con._pstomp, pstomp = con._pstomp,
wack = function(p)
p.horiz = p.horiz + 64
p.return_to_center = 9
local n = bit.arshift(128-bit.band(ffiC.krand(),255), 1)
p.rotscrnang = n
p.look_ang = n
end,
--- Not fully specified, off-limits to users. Might disappear, change --- Not fully specified, off-limits to users. Might disappear, change
--- signature, etc... --- signature, etc...
_palfrom = function(p, f, r,g,b) _palfrom = function(p, f, r,g,b)

View file

@ -201,10 +201,14 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
hitdata_t *hitinfo, uint32_t cliptype); hitdata_t *hitinfo, uint32_t cliptype);
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
int32_t x2, int32_t y2, int32_t z2, int16_t sect2); int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall,
int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
int32_t (*blacklist_sprite_func)(int32_t));
int32_t ldist(const spritetype *s1, const spritetype *s2); int32_t ldist(const spritetype *s1, const spritetype *s2);
int32_t dist(const spritetype *s1, const spritetype *s2); int32_t dist(const spritetype *s1, const spritetype *s2);
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
void updatesector(int32_t x, int32_t y, int16_t *sectnum); void updatesector(int32_t x, int32_t y, int16_t *sectnum);
void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum); void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum);
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum); void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum);
@ -220,6 +224,7 @@ double gethitickms(void);
int32_t krand(void); int32_t krand(void);
int32_t ksqrt(uint32_t num); int32_t ksqrt(uint32_t num);
int32_t __fastcall getangle(int32_t xvect, int32_t yvect);
]] ]]
local ivec3_ local ivec3_
@ -317,6 +322,12 @@ nextspritestat = creategtab(ffiC.nextspritestat, ffiC.MAXSPRITES, 'nextspritesta
prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]') prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]')
prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]') prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]')
local function check_sector_idx(sectnum)
if (sectnum >= ffiC.numsectors+0ULL) then
error("passed out-of-bounds sector number "..sectnum, 3)
end
end
--== Per-sector/per-statnum sprite iterators ==-- --== Per-sector/per-statnum sprite iterators ==--
local function iter_spritesofsect(sect, i) local function iter_spritesofsect(sect, i)
if (i < 0) then if (i < 0) then
@ -329,10 +340,7 @@ local function iter_spritesofsect(sect, i)
end end
function spritesofsect(sect) function spritesofsect(sect)
if (sect < 0 or sect >= ffiC.numsectors) then check_sector_idx(sect)
error("passed invalid sectnum to spritesofsect iterator", 2)
end
return iter_spritesofsect, sect, -1 return iter_spritesofsect, sect, -1
end end
@ -347,7 +355,7 @@ local function iter_spritesofstat(stat, i)
end end
function spritesofstat(stat) function spritesofstat(stat)
if (stat < 0 or stat >= ffiC.MAXSTATUS) then if (stat >= ffiC.MAXSTATUS+0ULL) then
error("passed invalid statnum to spritesofstat iterator", 2) error("passed invalid statnum to spritesofstat iterator", 2)
end end
@ -377,9 +385,7 @@ function sectorsofbunch(bunchnum, cf)
end end
function getbunch(sectnum, cf) function getbunch(sectnum, cf)
if (sectnum < 0 or sectnum >= ffiC.numsectors) then check_sector_idx(sectnum)
error("passed out-of-bounds sector number "..sectnum, 2)
end
if (cf ~= 0 and cf ~= 1) then if (cf ~= 0 and cf ~= 1) then
error("passed invalid 'cf' to getbunch, must be 0 or 1", 2) error("passed invalid 'cf' to getbunch, must be 0 or 1", 2)
end end
@ -389,14 +395,12 @@ end
---=== Engine functions, wrapped for Lua convenience ===--- ---=== Engine functions, wrapped for Lua convenience ===---
-- returns a hitdata_ct -- returns a hitdata_ct
-- TODO: make v[xyz] be passed as one aggregate, too? -- TODO: make v[xyz] be passed as one aggregate, too?
-- Additionally, permit different coordinates? (ang&horiz, ...) -- Additionally, permit different coordinates? (ang&horiz, ...)
function hitscan(pos, sectnum, vx,vy,vz, cliptype) function hitscan(pos, sectnum, vx,vy,vz, cliptype)
if (sectnum >= ffiC.numsectors+0ULL) then check_sector_idx(sectnum)
error("passed out-of-bounds sector number "..sectnum, 2)
end
local vec = vec3_ct(pos.x, pos.y, pos.z) local vec = vec3_ct(pos.x, pos.y, pos.z)
local hitdata = hitdata_ct() local hitdata = hitdata_ct()
@ -417,6 +421,31 @@ function cansee(pos1,sect1, pos2,sect2)
return (ret~=0) return (ret~=0)
end end
ffi.cdef[[
typedef struct {
int32_t sector, wall, sprite;
int32_t dist;
} neartag_ret_t;
]]
local neartag_ret_ct = ffi.typeof("const neartag_ret_t")
-- TODO: make tagsearch something more convenient
function neartag(pos, sectnum, ang, range, tagsearch)
check_sector_idx(sectnum)
local newar = function() return ffi.new("int16_t [1]") end
local a, b, c, d = newar(), newar(), newar(), ffi.new("int32_t [1]")
ffiC.neartag(pos.x, pos.y, pos.z, sectnum, ang, a, b, c, d, range, tagsearch, nil)
return neartag_ret_ct(a[0], b[0], c[0], d[0])
end
-- TODO: reimplement in Lua (benefit: no int overflow)? On the engine side,
-- make it take a sectortype pointer, and add as metamethod to our LuaJIT
-- sector type ("contains"?)
function inside(pos, sectnum)
check_sector_idx(sectnum)
return (ffiC.inside(pos.x, pos.y, sectnum)==1)
end
-- TODO: should these rather be one function, and the specific kind of updating -- TODO: should these rather be one function, and the specific kind of updating
-- controlled by an argument? -- controlled by an argument?
function updatesector(pos, sectnum) function updatesector(pos, sectnum)

View file

@ -29,8 +29,11 @@ nextsectbunch;
krand; krand;
ksqrt; ksqrt;
inside;
getangle;
cansee; cansee;
hitscan; hitscan;
neartag;
rotatesprite; rotatesprite;
dist; dist;
@ -77,4 +80,7 @@ A_IncurDamage;
A_Spawn; A_Spawn;
VM_FallSprite; VM_FallSprite;
VM_ResetPlayer2; VM_ResetPlayer2;
A_RadiusDamage;
G_OperateSectors;
A_Dodge;
}; };

View file

@ -29,8 +29,11 @@ nextsectbunch;
krand; krand;
ksqrt; ksqrt;
inside;
getangle;
cansee; cansee;
hitscan; hitscan;
neartag;
rotatesprite; rotatesprite;
dist; dist;

View file

@ -586,8 +586,8 @@ local Co = {
music = sp1 * t_define * match_until(sp1 * t_filename, sp1 * conl.keyword * sp1) / cmd_music, music = sp1 * t_define * match_until(sp1 * t_filename, sp1 * conl.keyword * sp1) / cmd_music,
--- 3. Game Settings --- 3. Game Settings
-- gamestartup has 25/29 fixed defines, depending on 1.3D/1.5 version: -- gamestartup has 26/30 fixed defines, depending on 1.3D/1.5 version:
gamestartup = (sp1 * t_define)^25 / cmd_gamestartup, gamestartup = (sp1 * t_define)^26 / cmd_gamestartup,
spritenopal = cmd(D), spritenopal = cmd(D),
spritenoshade = cmd(D), spritenoshade = cmd(D),
spritenvg = cmd(D), spritenvg = cmd(D),
@ -766,7 +766,8 @@ local Ci = {
/ (SPS".cstat=_bit.bor(%1,"..SPS".cstat)"), / (SPS".cstat=_bit.bor(%1,"..SPS".cstat)"),
cstat = cmd(D) cstat = cmd(D)
/ SPS".cstat=%1", / SPS".cstat=%1",
clipdist = cmd(D), clipdist = cmd(D)
/ SPS".clipdist=%1",
sizeto = cmd(D,D) sizeto = cmd(D,D)
/ "_con._sizeto(_aci)", -- TODO: see control.lua:_sizeto / "_con._sizeto(_aci)", -- TODO: see control.lua:_sizeto
sizeat = cmd(D,D) sizeat = cmd(D,D)
@ -777,7 +778,8 @@ local Ci = {
/ (SPS".extra="..SPS".extra+%1"), / (SPS".extra="..SPS".extra+%1"),
spritepal = cmd(D), spritepal = cmd(D),
hitradius = cmd(D,D,D,D,D), hitradius = cmd(D,D,D,D,D)
/ "_con._A_RadiusDamage(%1,%2,%3,%4,%5)",
hitradiusvar = cmd(R,R,R,R,R), hitradiusvar = cmd(R,R,R,R,R),
-- some commands taking read vars -- some commands taking read vars
@ -821,7 +823,8 @@ local Ci = {
/ "", -- TODO / "", -- TODO
addinventory = cmd(D,D) addinventory = cmd(D,D)
/ PLS":addinventory(%1,%2)", / PLS":addinventory(%1,%2)",
guts = cmd(D,D), guts = cmd(D,D)
/ "", -- TODO
-- cont'd -- cont'd
addkills = cmd(D) addkills = cmd(D)
@ -831,20 +834,26 @@ local Ci = {
angoff = cmd(D), angoff = cmd(D),
debug = cmd(D) debug = cmd(D)
/ "", -- TODO? / "", -- TODO?
endofgame = cmd(D), endofgame = cmd(D)
/ "_con._endofgame(_pli,%1)",
eqspawn = cmd(D), eqspawn = cmd(D),
espawn = cmd(D), espawn = cmd(D),
globalsound = cmd(D) globalsound = cmd(D)
/ "", / "",
lotsofglass = cmd(D), lotsofglass = cmd(D),
mail = cmd(D), mail = cmd(D)
money = cmd(D), / "", -- TODO
paper = cmd(D), money = cmd(D)
/ "", -- TODO
paper = cmd(D)
/ "", -- TODO
qspawn = cmd(D), qspawn = cmd(D),
quote = cmd(D), quote = cmd(D)
/ "", -- TODO
savenn = cmd(D), savenn = cmd(D),
save = cmd(D), save = cmd(D),
sleeptime = cmd(D), sleeptime = cmd(D)
/ ACS".timetosleep=%1",
soundonce = cmd(D), soundonce = cmd(D),
sound = cmd(D) sound = cmd(D)
/ "", -- TODO: all things audio... / "", -- TODO: all things audio...
@ -863,13 +872,16 @@ local Ci = {
fall = cmd() fall = cmd()
/ "_con._VM_FallSprite(_aci)", / "_con._VM_FallSprite(_aci)",
flash = cmd(), flash = cmd(),
getlastpal = cmd(), getlastpal = cmd()
/ "_con._getlastpal(_aci)",
insertspriteq = cmd(), insertspriteq = cmd(),
killit = cmd() -- NLCF killit = cmd() -- NLCF
/ "_con.killit()", / "_con.killit()",
mikesnd = cmd(), mikesnd = cmd(),
nullop = cmd(), nullop = cmd()
pkick = cmd(), / "", -- NOTE: really generate no code
pkick = cmd()
/ "", -- TODO
pstomp = cmd() pstomp = cmd()
/ PLS":pstomp(_aci)", / PLS":pstomp(_aci)",
resetactioncount = cmd() resetactioncount = cmd()
@ -878,11 +890,14 @@ local Ci = {
/ ACS":set_count(0)", / ACS":set_count(0)",
resetplayer = cmd() -- NLCF resetplayer = cmd() -- NLCF
/ "if (_con._VM_ResetPlayer2(_pli,_aci)) then _con.longjmp() end", / "if (_con._VM_ResetPlayer2(_pli,_aci)) then _con.longjmp() end",
respawnhitag = cmd(), respawnhitag = cmd()
/ "", -- TODO
tip = cmd() tip = cmd()
/ PLS".tipincs=26", / PLS".tipincs=26",
tossweapon = cmd(), tossweapon = cmd()
wackplayer = cmd(), / "", -- TODO
wackplayer = cmd()
/ PLS":wack()",
-- player/sprite searching -- player/sprite searching
findplayer = cmd(W), findplayer = cmd(W),
@ -949,7 +964,8 @@ local Ci = {
palfrom = (sp1 * t_define)^-4 palfrom = (sp1 * t_define)^-4
/ handle_palfrom, / handle_palfrom,
operate = cmd() * #sp1, operate = cmd() * #sp1
/ "_con._operate(_aci)",
myos = cmd(R,R,R,R,R), myos = cmd(R,R,R,R,R),
myosx = cmd(R,R,R,R,R), myosx = cmd(R,R,R,R,R),
@ -1051,11 +1067,17 @@ local Cif = {
/ format("sprite[%s].extra<%%1", PLS".i"), / format("sprite[%s].extra<%%1", PLS".i"),
ifspritepal = cmd(D) ifspritepal = cmd(D)
/ SPS".pal==%1", / SPS".pal==%1",
ifgotweaponce = cmd(D), ifgotweaponce = cmd(D)
ifangdiffl = cmd(D), / "false", -- TODO? (multiplayer only)
ifangdiffl = cmd(D)
/ format("_con._angdiffabs(%s,%s)<=%%1", PLS".ang", SPS".ang"),
ifsound = cmd(D) ifsound = cmd(D)
/ "", / "",
ifpinventory = cmd(D,D), -- vvv TODO: this is not correct for GET_ACCESS or GET_SHIELD.
-- Additionally, it accesses the current sprite unconditinally
-- (will throw error if invalid).
ifpinventory = cmd(D,D)
/ format("_con._getinventory(%s,%%1,%s)~=%%2", PLS"", SPS".pal"),
ifvarl = cmd(R,D), ifvarl = cmd(R,D),
ifvarg = cmd(R,D), ifvarg = cmd(R,D),
@ -1077,36 +1099,45 @@ local Cif = {
ifactorsound = cmd(R,R), ifactorsound = cmd(R,R),
ifp = (sp1 * t_define)^1, ifp = (sp1 * t_define)^1
/ "false", -- TODO
ifsquished = cmd() ifsquished = cmd()
/ "false", -- TODO / "false", -- TODO
ifserver = cmd(), ifserver = cmd(),
ifrespawn = cmd(), ifrespawn = cmd()
/ "false", -- TODO
ifoutside = cmd() ifoutside = cmd()
/ format("_bit.band(sector[%s].ceilingstat,1)~=0", SPS".sectnum"), / format("_bit.band(sector[%s].ceilingstat,1)~=0", SPS".sectnum"),
ifonwater = cmd() ifonwater = cmd()
/ format("sectnum[%s].lotag==1 and _math.abs(%s-sector[%s].floorz)<32*256", / format("sectnum[%s].lotag==1 and _math.abs(%s-sector[%s].floorz)<32*256",
SPS".sectnum", SPS".z", SPS".sectnum"), SPS".sectnum", SPS".z", SPS".sectnum"),
ifnotmoving = cmd(), ifnotmoving = cmd()
/ "_bit.band(actor[_aci].movflag,49152)>16384",
ifnosounds = cmd(), ifnosounds = cmd(),
ifmultiplayer = cmd() ifmultiplayer = cmd()
/ "false", -- TODO? / "false", -- TODO?
ifinwater = cmd() ifinwater = cmd()
/ format("sector[%s].lotag==2", SPS".sectnum"), / format("sector[%s].lotag==2", SPS".sectnum"),
ifinspace = cmd(), ifinspace = cmd()
ifinouterspace = cmd(), / "false", -- TODO
ifinouterspace = cmd()
/ "false", -- TODO
ifhitweapon = cmd() ifhitweapon = cmd()
/ "_con._A_IncurDamage(_aci)", / "_con._A_IncurDamage(_aci)",
ifhitspace = cmd(), ifhitspace = cmd()
/ "_con._testkey(_pli,29)", -- XXX
ifdead = cmd() ifdead = cmd()
/ SPS".extra<=0", / SPS".extra<=0",
ifclient = cmd(), ifclient = cmd(),
ifcanshoottarget = cmd() ifcanshoottarget = cmd()
/ "false", -- TODO / "false", -- TODO
ifcanseetarget = cmd(), ifcanseetarget = cmd() -- TODO: maybe set timetosleep afterwards
/ format("_con._canseetarget(%s,%s)", SPS"", PLS""),
ifcansee = cmd() * #sp1, ifcansee = cmd() * #sp1,
ifbulletnear = cmd(), ifbulletnear = cmd()
ifawayfromwall = cmd(), / "_con._bulletnear(_aci)",
ifawayfromwall = cmd()
/ format("_con._awayfromwall(%s,108)", SPS""),
ifactornotstayput = cmd() ifactornotstayput = cmd()
/ ACS".actorstayput==-1", / ACS".actorstayput==-1",
} }