mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Lunatic: sector[].ceiling/.floor gets a reference to a ceiling-or-floor struct.
Also, make sector[].*stat a bitint type. Now, a piece of code could look like this: local sec = sector[i] local ceil = sec.ceiling ceil.statx:flip(sector.STAT.SMOOSH) git-svn-id: https://svn.eduke32.com/eduke32@3844 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
51ad20eda5
commit
75313a78c8
2 changed files with 34 additions and 19 deletions
|
@ -110,6 +110,7 @@ function bitint_new_struct_type(basetypename, newtypename)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bitint_member(bitint_struct_typename, membname)
|
function bitint_member(bitint_struct_typename, membname)
|
||||||
|
-- XXX: rename to '~bits' instead of '~x'?
|
||||||
return string.format("union { %s %s; %s %sx; };",
|
return string.format("union { %s %s; %s %sx; };",
|
||||||
bitint_to_base_type[bitint_struct_typename], membname,
|
bitint_to_base_type[bitint_struct_typename], membname,
|
||||||
bitint_struct_typename, membname)
|
bitint_struct_typename, membname)
|
||||||
|
@ -121,26 +122,29 @@ bitint_new_struct_type("uint16_t", "UBit16")
|
||||||
|
|
||||||
--== Core engine structs ==--
|
--== Core engine structs ==--
|
||||||
|
|
||||||
|
local CF_MEMBERS = [[
|
||||||
|
const int16_t ~picnum;
|
||||||
|
int16_t ~heinum;
|
||||||
|
const int16_t ~bunch;
|
||||||
|
]]..bitint_member("UBit16", "~stat")..[[
|
||||||
|
int32_t ~z;
|
||||||
|
int8_t ~shade;
|
||||||
|
uint8_t ~pal, ~xpanning, ~ypanning;
|
||||||
|
]]
|
||||||
|
|
||||||
|
ffi.cdef("typedef struct { "..CF_MEMBERS:gsub("~","").." } ceiling_or_floor_t;")
|
||||||
|
|
||||||
local SECTOR_STRUCT = [[
|
local SECTOR_STRUCT = [[
|
||||||
struct {
|
struct {
|
||||||
const int16_t wallptr, wallnum;
|
const int16_t wallptr, wallnum;
|
||||||
|
]]..
|
||||||
const int16_t ceilingpicnum;
|
string.format([[
|
||||||
int16_t ceilingheinum;
|
union {
|
||||||
const int16_t ceilingbunch;
|
struct { ceiling_or_floor_t ceiling, floor; };
|
||||||
uint16_t ceilingstat;
|
struct { %s %s };
|
||||||
int32_t ceilingz;
|
};
|
||||||
int8_t ceilingshade;
|
]], CF_MEMBERS:gsub("~","ceiling"), CF_MEMBERS:gsub("~","floor"))
|
||||||
uint8_t ceilingpal, ceilingxpanning, ceilingypanning;
|
..[[
|
||||||
|
|
||||||
const int16_t floorpicnum;
|
|
||||||
int16_t floorheinum;
|
|
||||||
const int16_t floorbunch;
|
|
||||||
uint16_t floorstat;
|
|
||||||
int32_t floorz;
|
|
||||||
int8_t floorshade;
|
|
||||||
uint8_t floorpal, floorxpanning, floorypanning;
|
|
||||||
|
|
||||||
uint8_t visibility, filler;
|
uint8_t visibility, filler;
|
||||||
int16_t lotag, hitag; // NOTE: signed for Lunatic
|
int16_t lotag, hitag; // NOTE: signed for Lunatic
|
||||||
int16_t extra;
|
int16_t extra;
|
||||||
|
@ -738,11 +742,13 @@ end
|
||||||
-- sprite.CSTAT.TRANSLUCENT1
|
-- sprite.CSTAT.TRANSLUCENT1
|
||||||
local static_members = { sector={}, wall={}, sprite={} }
|
local static_members = { sector={}, wall={}, sprite={} }
|
||||||
|
|
||||||
|
-- XXX: go over these constant names and see if they can be named better.
|
||||||
static_members.sector.STAT = conststruct
|
static_members.sector.STAT = conststruct
|
||||||
{
|
{
|
||||||
PARALLAX = 1,
|
PARALLAX = 1,
|
||||||
SLOPED = 2,
|
SLOPED = 2,
|
||||||
|
XYSWAP = 4,
|
||||||
|
SMOOSH = 8,
|
||||||
XFLIP = 16,
|
XFLIP = 16,
|
||||||
YFLIP = 32,
|
YFLIP = 32,
|
||||||
RELATIVE = 64,
|
RELATIVE = 64,
|
||||||
|
@ -758,6 +764,8 @@ static_members.sector.STAT = conststruct
|
||||||
static_members.wall.CSTAT = conststruct
|
static_members.wall.CSTAT = conststruct
|
||||||
{
|
{
|
||||||
BLOCKING = 1,
|
BLOCKING = 1,
|
||||||
|
BOTTOMSWAP = 2,
|
||||||
|
BOTTOMALIGN = 4,
|
||||||
XFLIP = 8,
|
XFLIP = 8,
|
||||||
MASKED = 16,
|
MASKED = 16,
|
||||||
ONEWAY = 32,
|
ONEWAY = 32,
|
||||||
|
|
|
@ -43,9 +43,16 @@ print('tweaking sector pals')
|
||||||
print('numsectors: ' .. gv.numsectors .. ' of ' .. gv.MAXSECTORS)
|
print('numsectors: ' .. gv.numsectors .. ' of ' .. gv.MAXSECTORS)
|
||||||
|
|
||||||
---[[
|
---[[
|
||||||
|
local SF = sector.STAT
|
||||||
for i = 0, gv.numsectors/2 do
|
for i = 0, gv.numsectors/2 do
|
||||||
sector[i].floorpal = 1;
|
local sec = sector[i]
|
||||||
|
sec.floorpal = 1;
|
||||||
|
sector[i].floor.shade = sec.floor.shade + 4
|
||||||
sector[i].ceilingpal = 2;
|
sector[i].ceilingpal = 2;
|
||||||
|
local ceil = sec.ceiling
|
||||||
|
ceil.shade = sector[i].ceiling.shade + 8
|
||||||
|
ceil.statx:flip(SF.SMOOSH)
|
||||||
|
sec.floorstatx:flip(SF.XYSWAP)
|
||||||
end
|
end
|
||||||
|
|
||||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||||
|
|
Loading…
Reference in a new issue