mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-23 23:50:40 +00:00
Lunatic: add ceiling-or-floor method set_picnum(). BUILD_LUNATIC.
git-svn-id: https://svn.eduke32.com/eduke32@4207 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0c69779b98
commit
fa6746867c
3 changed files with 29 additions and 19 deletions
|
@ -167,6 +167,16 @@ end
|
||||||
bitint_new_struct_type("uint8_t", "UBit8")
|
bitint_new_struct_type("uint8_t", "UBit8")
|
||||||
bitint_new_struct_type("uint16_t", "UBit16")
|
bitint_new_struct_type("uint16_t", "UBit16")
|
||||||
|
|
||||||
|
-- Converts a template struct definition to an internal, unrestricted one.
|
||||||
|
-- NOTE: "[^ ]*" for const decorations in defs.ilua.
|
||||||
|
function strip_const(structstr)
|
||||||
|
return (string.gsub(structstr, "const[^ ]* ", ""));
|
||||||
|
end
|
||||||
|
|
||||||
|
local function maybe_strip_const(str)
|
||||||
|
return _LUNATIC_AUX and strip_const(str) or str
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--== Core engine structs ==--
|
--== Core engine structs ==--
|
||||||
|
|
||||||
|
@ -182,6 +192,8 @@ local CF_MEMBERS = [[
|
||||||
|
|
||||||
ffi.cdef("typedef struct { "..CF_MEMBERS:gsub("~","").." } ceiling_or_floor_t;")
|
ffi.cdef("typedef struct { "..CF_MEMBERS:gsub("~","").." } ceiling_or_floor_t;")
|
||||||
|
|
||||||
|
local hplane_ptr_ct = ffi.typeof("struct { "..strip_const(CF_MEMBERS:gsub("~","")).." } *")
|
||||||
|
|
||||||
local SECTOR_STRUCT = [[
|
local SECTOR_STRUCT = [[
|
||||||
struct {
|
struct {
|
||||||
const int16_t wallptr, wallnum;
|
const int16_t wallptr, wallnum;
|
||||||
|
@ -232,16 +244,6 @@ struct {
|
||||||
int16_t lotag, hitag, extra;
|
int16_t lotag, hitag, extra;
|
||||||
}]]
|
}]]
|
||||||
|
|
||||||
-- Converts a template struct definition to an internal, unrestricted one.
|
|
||||||
-- NOTE: "[^ ]*" for const decorations in defs.ilua.
|
|
||||||
function strip_const(structstr)
|
|
||||||
return (string.gsub(structstr, "const[^ ]* ", ""));
|
|
||||||
end
|
|
||||||
|
|
||||||
local function maybe_strip_const(str)
|
|
||||||
return _LUNATIC_AUX and strip_const(str) or str
|
|
||||||
end
|
|
||||||
|
|
||||||
-- NOTE for FFI definitions: we're compiling EDuke32 with -funsigned-char, so
|
-- NOTE for FFI definitions: we're compiling EDuke32 with -funsigned-char, so
|
||||||
-- we need to take care to declare chars as unsigned whenever it matters, for
|
-- we need to take care to declare chars as unsigned whenever it matters, for
|
||||||
-- example if it represents a palette index. (I think it's harmless for stuff
|
-- example if it represents a palette index. (I think it's harmless for stuff
|
||||||
|
@ -587,6 +589,16 @@ local sectortype_mt = {
|
||||||
}
|
}
|
||||||
ffi.metatype("sectortype", sectortype_mt)
|
ffi.metatype("sectortype", sectortype_mt)
|
||||||
|
|
||||||
|
local hplane_mt = {
|
||||||
|
__index = {
|
||||||
|
set_picnum = function(hp, picnum)
|
||||||
|
check_tile_idx(picnum)
|
||||||
|
ffi.cast(hplane_ptr_ct, hp).picnum = picnum
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
|
ffi.metatype("ceiling_or_floor_t", hplane_mt)
|
||||||
|
|
||||||
local walltype_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(WALL_STRUCT)))
|
local walltype_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(WALL_STRUCT)))
|
||||||
|
|
||||||
local walltype_mt = {
|
local walltype_mt = {
|
||||||
|
|
|
@ -656,10 +656,15 @@ _`u8`_ `cf.xpanning`, `cf.ypanning`::
|
||||||
The panning values of the ceiling or floor. One full cycle is covered by values
|
The panning values of the ceiling or floor. One full cycle is covered by values
|
||||||
from `0` to `255`.
|
from `0` to `255`.
|
||||||
|
|
||||||
|
===== ceiling-or-floor methods
|
||||||
|
|
||||||
|
`cf:set_picnum(tilenum)`::
|
||||||
|
Set the tile number of the ceiling-or-floor `cf`.
|
||||||
|
|
||||||
===== `sector` methods
|
===== `sector` methods
|
||||||
|
|
||||||
`sec:set_ceilingpicnum(tilenum)`, {nbsp} `sec:set_floorpicnum(tilenum)`::
|
`sec:set_ceilingpicnum(tilenum)`, {nbsp} `sec:set_floorpicnum(tilenum)`::
|
||||||
Set the tile number of the ceiling or floor.
|
Set the tile number of the ceiling or the floor.
|
||||||
|
|
||||||
[[sec_cfz_at]] `sec:ceilingzat(pos)`, {nbsp} `sec:floorzat(pos)`::
|
[[sec_cfz_at]] `sec:ceilingzat(pos)`, {nbsp} `sec:floorzat(pos)`::
|
||||||
Return the z coordinate of sector `sec`'s ceiling or floor at position `pos`,
|
Return the z coordinate of sector `sec`'s ceiling or floor at position `pos`,
|
||||||
|
|
|
@ -41,14 +41,7 @@ gameactor
|
||||||
local bunchnum = spr.extra
|
local bunchnum = spr.extra
|
||||||
for sectnum, what in sectorsofbunch(bunchnum, gv.BOTH_CF) do
|
for sectnum, what in sectorsofbunch(bunchnum, gv.BOTH_CF) do
|
||||||
local cf = sector[sectnum][what]
|
local cf = sector[sectnum][what]
|
||||||
|
cf:set_picnum(D.GLASS2 + cnt)
|
||||||
-- TODO: provide cf:set_picnum()
|
|
||||||
if (what=="ceiling") then
|
|
||||||
sector[sectnum]:set_ceilingpicnum(D.GLASS2 + cnt)
|
|
||||||
else
|
|
||||||
sector[sectnum]:set_floorpicnum(D.GLASS2 + cnt)
|
|
||||||
end
|
|
||||||
|
|
||||||
cf.statbits:clear(sector.STAT.BLOCK + sector.STAT.HITSCAN)
|
cf.statbits:clear(sector.STAT.BLOCK + sector.STAT.HITSCAN)
|
||||||
if (finish) then
|
if (finish) then
|
||||||
cf.statbits:clear(sector.STAT.TRANS_BITMASK)
|
cf.statbits:clear(sector.STAT.TRANS_BITMASK)
|
||||||
|
|
Loading…
Reference in a new issue