From b72972e43b33a7eb2968030e990d8f1d372cf634 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 21 Dec 2011 18:43:08 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/lunatic/defs.ilua | 33 +++++++++++++++++++++++ polymer/eduke32/source/lunatic/dynsymlist | 2 ++ polymer/eduke32/source/lunatic/test.elua | 3 +++ 3 files changed, 38 insertions(+) diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 3f4656214..3b18fea3d 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -59,6 +59,28 @@ typedef struct { #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[[ sectortype *sector; walltype *wall; @@ -72,6 +94,10 @@ const int16_t prevspritesect[16384], prevspritestat[16384]; const int16_t nextspritesect[16384], nextspritestat[16384]; ]] +ffi.cdef[[ +actor_t actor[16384]; +]] + ---- _G tweaks -- pull in only 'safe' stuff ---- local G_ = {} -- our soon-to-be global environment @@ -147,6 +173,8 @@ gv = { headspritesect = det, headspritestat = det, prevspritesect = det, prevspritestat = det, nextspritesect = det, nextspritestat = det, + + actor = det, } local tmpmt = { __index = ffiC, @@ -208,6 +236,8 @@ nextspritestat = creategtab(ffiC.nextspritestat, 16384, 'nextspritestat[]') prevspritesect = creategtab(ffiC.prevspritesect, 16384, 'prevspritesect[]') prevspritestat = creategtab(ffiC.prevspritestat, 16384, 'prevspritestat[]') +actor = creategtab(ffiC.actor, 16384, 'actor[]') + ---- per-sector/per-statnum sprite iterators ---- local function iter_spritesofsect(sect, i) if (i < 0) then @@ -255,6 +285,9 @@ G_.nextspritesect = nextspritesect G_.nextspritestat = nextspritestat G_.prevspritesect = prevspritesect G_.prevspritestat = prevspritestat + +G_.actor = actor + G_.spritesofsect = spritesofsect G_.spritesofstat = spritesofstat diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index fb3337f48..8e783efff 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -13,4 +13,6 @@ prevspritesect; prevspritestat; nextspritesect; nextspritestat; + +actor; }; diff --git a/polymer/eduke32/source/lunatic/test.elua b/polymer/eduke32/source/lunatic/test.elua index 73673f849..3bc964c14 100644 --- a/polymer/eduke32/source/lunatic/test.elua +++ b/polymer/eduke32/source/lunatic/test.elua @@ -34,6 +34,9 @@ end for spr in spritesofsect(236) do print('#spr', spr) end + +actor[562].flags = bit.bor(actor[562].flags, 2); -- pal 6 with goggles on front SEENINE + --]] print('_G contains:') for k,v in pairs(_G) do