mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +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
|
||||
|
||||
function bitint_member(bitint_struct_typename, membname)
|
||||
-- XXX: rename to '~bits' instead of '~x'?
|
||||
return string.format("union { %s %s; %s %sx; };",
|
||||
bitint_to_base_type[bitint_struct_typename], membname,
|
||||
bitint_struct_typename, membname)
|
||||
|
@ -121,26 +122,29 @@ bitint_new_struct_type("uint16_t", "UBit16")
|
|||
|
||||
--== 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 = [[
|
||||
struct {
|
||||
const int16_t wallptr, wallnum;
|
||||
|
||||
const int16_t ceilingpicnum;
|
||||
int16_t ceilingheinum;
|
||||
const int16_t ceilingbunch;
|
||||
uint16_t ceilingstat;
|
||||
int32_t ceilingz;
|
||||
int8_t ceilingshade;
|
||||
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;
|
||||
|
||||
]]..
|
||||
string.format([[
|
||||
union {
|
||||
struct { ceiling_or_floor_t ceiling, floor; };
|
||||
struct { %s %s };
|
||||
};
|
||||
]], CF_MEMBERS:gsub("~","ceiling"), CF_MEMBERS:gsub("~","floor"))
|
||||
..[[
|
||||
uint8_t visibility, filler;
|
||||
int16_t lotag, hitag; // NOTE: signed for Lunatic
|
||||
int16_t extra;
|
||||
|
@ -738,11 +742,13 @@ end
|
|||
-- sprite.CSTAT.TRANSLUCENT1
|
||||
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
|
||||
{
|
||||
PARALLAX = 1,
|
||||
SLOPED = 2,
|
||||
|
||||
XYSWAP = 4,
|
||||
SMOOSH = 8,
|
||||
XFLIP = 16,
|
||||
YFLIP = 32,
|
||||
RELATIVE = 64,
|
||||
|
@ -758,6 +764,8 @@ static_members.sector.STAT = conststruct
|
|||
static_members.wall.CSTAT = conststruct
|
||||
{
|
||||
BLOCKING = 1,
|
||||
BOTTOMSWAP = 2,
|
||||
BOTTOMALIGN = 4,
|
||||
XFLIP = 8,
|
||||
MASKED = 16,
|
||||
ONEWAY = 32,
|
||||
|
|
|
@ -43,9 +43,16 @@ print('tweaking sector pals')
|
|||
print('numsectors: ' .. gv.numsectors .. ' of ' .. gv.MAXSECTORS)
|
||||
|
||||
---[[
|
||||
local SF = sector.STAT
|
||||
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;
|
||||
local ceil = sec.ceiling
|
||||
ceil.shade = sector[i].ceiling.shade + 8
|
||||
ceil.statx:flip(SF.SMOOSH)
|
||||
sec.floorstatx:flip(SF.XYSWAP)
|
||||
end
|
||||
|
||||
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1
|
||||
|
|
Loading…
Reference in a new issue