Lunatic: actor. (Needs SAMESIZE_ACTOR_T, which is not yet enabled)

git-svn-id: https://svn.eduke32.com/eduke32@2193 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-21 18:43:08 +00:00
parent f12bd9f13d
commit b72972e43b
3 changed files with 38 additions and 0 deletions

View file

@ -59,6 +59,28 @@ typedef struct {
#pragma pack(pop) #pragma pack(pop)
]] ]]
-- game structs
ffi.cdef[[
#pragma pack(push,1)
// ACTOR_T, might still need to make some fields read-only
typedef struct
{
const int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
int16_t picnum,ang,extra,owner; //8b
int16_t movflag,tempang,timetosleep; //6b
int32_t flags, bposx,bposy,bposz; //16b
int32_t floorz,ceilingz,lastvx,lastvy; //16b
int32_t lasttransport; //4b
const int16_t lightId, lightcount, lightmaxrange, cgg; //8b
int16_t actorstayput, dispicnum, shootzvel; // 6b
const int8_t _do_not_use[24];
} actor_t;
#pragma pack(pop)
]]
ffi.cdef[[ ffi.cdef[[
sectortype *sector; sectortype *sector;
walltype *wall; walltype *wall;
@ -72,6 +94,10 @@ const int16_t prevspritesect[16384], prevspritestat[16384];
const int16_t nextspritesect[16384], nextspritestat[16384]; const int16_t nextspritesect[16384], nextspritestat[16384];
]] ]]
ffi.cdef[[
actor_t actor[16384];
]]
---- _G tweaks -- pull in only 'safe' stuff ---- ---- _G tweaks -- pull in only 'safe' stuff ----
local G_ = {} -- our soon-to-be global environment local G_ = {} -- our soon-to-be global environment
@ -147,6 +173,8 @@ gv = {
headspritesect = det, headspritestat = det, headspritesect = det, headspritestat = det,
prevspritesect = det, prevspritestat = det, prevspritesect = det, prevspritestat = det,
nextspritesect = det, nextspritestat = det, nextspritesect = det, nextspritestat = det,
actor = det,
} }
local tmpmt = { local tmpmt = {
__index = ffiC, __index = ffiC,
@ -208,6 +236,8 @@ nextspritestat = creategtab(ffiC.nextspritestat, 16384, 'nextspritestat[]')
prevspritesect = creategtab(ffiC.prevspritesect, 16384, 'prevspritesect[]') prevspritesect = creategtab(ffiC.prevspritesect, 16384, 'prevspritesect[]')
prevspritestat = creategtab(ffiC.prevspritestat, 16384, 'prevspritestat[]') prevspritestat = creategtab(ffiC.prevspritestat, 16384, 'prevspritestat[]')
actor = creategtab(ffiC.actor, 16384, 'actor[]')
---- 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
@ -255,6 +285,9 @@ G_.nextspritesect = nextspritesect
G_.nextspritestat = nextspritestat G_.nextspritestat = nextspritestat
G_.prevspritesect = prevspritesect G_.prevspritesect = prevspritesect
G_.prevspritestat = prevspritestat G_.prevspritestat = prevspritestat
G_.actor = actor
G_.spritesofsect = spritesofsect G_.spritesofsect = spritesofsect
G_.spritesofstat = spritesofstat G_.spritesofstat = spritesofstat

View file

@ -13,4 +13,6 @@ prevspritesect;
prevspritestat; prevspritestat;
nextspritesect; nextspritesect;
nextspritestat; nextspritestat;
actor;
}; };

View file

@ -34,6 +34,9 @@ end
for spr in spritesofsect(236) do for spr in spritesofsect(236) do
print('#spr', spr) print('#spr', spr)
end end
actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE
--]] --]]
print('_G contains:') print('_G contains:')
for k,v in pairs(_G) do for k,v in pairs(_G) do