mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
Lunatic: expose "con.shoot(tilenum, i [, zvel])". Document and add example.
git-svn-id: https://svn.eduke32.com/eduke32@4201 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cfedcbd7d7
commit
25108494d1
4 changed files with 36 additions and 16 deletions
|
@ -365,7 +365,7 @@ local int16_st = ffi.typeof "struct { int16_t s; }"
|
||||||
-- out of the range for an int32_t and thus undefined behavior!
|
-- out of the range for an int32_t and thus undefined behavior!
|
||||||
local SHOOT_HARDCODED_ZVEL = tobit(0x80000000)
|
local SHOOT_HARDCODED_ZVEL = tobit(0x80000000)
|
||||||
|
|
||||||
function _shoot(i, tilenum, zvel)
|
function shoot(tilenum, i, zvel)
|
||||||
check_sprite_idx(i)
|
check_sprite_idx(i)
|
||||||
check_sector_idx(ffiC.sprite[i].sectnum) -- accessed in A_ShootWithZvel
|
check_sector_idx(ffiC.sprite[i].sectnum) -- accessed in A_ShootWithZvel
|
||||||
check_tile_idx(tilenum)
|
check_tile_idx(tilenum)
|
||||||
|
@ -1068,12 +1068,6 @@ function _A_SpawnGlass(i, n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function _A_Shoot(i, atwith)
|
|
||||||
check_sprite_idx(i)
|
|
||||||
check_tile_idx(atwith)
|
|
||||||
return CF.A_ShootWithZvel(i, atwith, SHOOT_HARDCODED_ZVEL)
|
|
||||||
end
|
|
||||||
|
|
||||||
function _A_IncurDamage(sn)
|
function _A_IncurDamage(sn)
|
||||||
check_sprite_idx(sn)
|
check_sprite_idx(sn)
|
||||||
return ffiC.A_IncurDamage(sn)
|
return ffiC.A_IncurDamage(sn)
|
||||||
|
|
|
@ -1924,7 +1924,7 @@ exits.footnote:[This is subject to change and must not be relied on.]
|
||||||
Otherwise, relevant per-sprite data for the newly inserted sprite is
|
Otherwise, relevant per-sprite data for the newly inserted sprite is
|
||||||
cleared. No additional ``hard-wired'' C code is run.
|
cleared. No additional ``hard-wired'' C code is run.
|
||||||
|
|
||||||
The return value is the index of the inserted sprite.
|
Returns the index of the inserted sprite.
|
||||||
|
|
||||||
The function `con.insertsprite` is called with a single table whose values are
|
The function `con.insertsprite` is called with a single table whose values are
|
||||||
taken as the actual arguments. The first three, `tilenum`, `pos` and `sectnum`,
|
taken as the actual arguments. The first three, `tilenum`, `pos` and `sectnum`,
|
||||||
|
@ -1964,6 +1964,15 @@ run afterwards, possibly modifying the sprite.
|
||||||
|
|
||||||
Returns the index of the spawned sprite on success.
|
Returns the index of the spawned sprite on success.
|
||||||
|
|
||||||
|
===== The function `con.shoot(tilenum, parentspritenum [, zvel])`
|
||||||
|
|
||||||
|
Attempts to shoot a projectile with tile number `tilenum` from the sprite with
|
||||||
|
index `parentspritenum`. The z velocity can be overridden by passing `zvel`.
|
||||||
|
|
||||||
|
// TODO: document how zvel is interpreted
|
||||||
|
|
||||||
|
Returns the index of the spawned sprite on success, or -1 otherwise.
|
||||||
|
|
||||||
|
|
||||||
The `fs` module -- virtual file system facilities
|
The `fs` module -- virtual file system facilities
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -2507,21 +2507,21 @@ local Cinner = {
|
||||||
/ ACS".timetosleep=%1",
|
/ ACS".timetosleep=%1",
|
||||||
|
|
||||||
eshoot = cmd(D)
|
eshoot = cmd(D)
|
||||||
/ "_gv.RETURN=_con._shoot(_aci,%1)",
|
/ "_gv.RETURN=_con.shoot(%1,_aci)",
|
||||||
eshootvar = cmd(R)
|
eshootvar = cmd(R)
|
||||||
/ "_gv.RETURN=_con._shoot(_aci,%1)",
|
/ "_gv.RETURN=_con.shoot(%1,_aci)",
|
||||||
ezshoot = cmd(R,D)
|
ezshoot = cmd(R,D)
|
||||||
/ "_gv.RETURN=_con._shoot(_aci,%2,%1)",
|
/ "_gv.RETURN=_con.shoot(%2,_aci,%1)",
|
||||||
ezshootvar = cmd(R,R)
|
ezshootvar = cmd(R,R)
|
||||||
/ "_gv.RETURN=_con._shoot(_aci,%2,%1)",
|
/ "_gv.RETURN=_con.shoot(%2,_aci,%1)",
|
||||||
shoot = cmd(D)
|
shoot = cmd(D)
|
||||||
/ "_con._shoot(_aci,%1)",
|
/ "_con.shoot(%1,_aci)",
|
||||||
shootvar = cmd(R)
|
shootvar = cmd(R)
|
||||||
/ "_con._shoot(_aci,%1)",
|
/ "_con.shoot(%1,_aci)",
|
||||||
zshoot = cmd(R,D)
|
zshoot = cmd(R,D)
|
||||||
/ "_con._shoot(_aci,%2,%1)",
|
/ "_con.shoot(%2,_aci,%1)",
|
||||||
zshootvar = cmd(R,R)
|
zshootvar = cmd(R,R)
|
||||||
/ "_con._shoot(_aci,%2,%1)",
|
/ "_con.shoot(%2,_aci,%1)",
|
||||||
|
|
||||||
fall = cmd()
|
fall = cmd()
|
||||||
/ "actor.fall(_aci)",
|
/ "actor.fall(_aci)",
|
||||||
|
|
|
@ -650,6 +650,23 @@ gameactor
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gameactor
|
||||||
|
{
|
||||||
|
-- Innocent sign, similar to test/weaponvars.con actor 909 (tree trunk)
|
||||||
|
1211, actor.FLAGS.replace_hard,
|
||||||
|
|
||||||
|
function(aci, pli)
|
||||||
|
local a = actor[aci]
|
||||||
|
|
||||||
|
if (a:get_count() >= 120) then
|
||||||
|
local i = con.spawn(D.TRANSPORTERSTAR, aci)
|
||||||
|
sprite[i].z = sprite[i].z - 1024*16
|
||||||
|
con.shoot(D.MORTER, aci, -4096)
|
||||||
|
a:set_count(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
local function testbit(num, b)
|
local function testbit(num, b)
|
||||||
return bit.band(num,b)~=0 and 1 or 0
|
return bit.band(num,b)~=0 and 1 or 0
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue