diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index fdccf44d1..702b1854e 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -134,6 +134,8 @@ ifneq ($(USE_LIBVPX),0) GAMEOBJS+= $(OBJ)/animvpx.$o endif +MISCGAMEDEPS= + ## Lunatic devel @@ -164,9 +166,11 @@ ifneq (0,$(LUNATIC)) # But, following _their_ directions does not give us the symbols! wtf? STRIP+= -s $(SRC)/lunatic/dynsymlist_osx + MISCGAMEDEPS+= $(SRC)/lunatic/dynsymlist_osx MISCLINKOPTS+= -pagezero_size 10000 -image_base 100000000 #-Wl,-alias_list -Wl,$(SRC)/lunatic/aliases_list #-exported_symbols_list $(SRC)/lunatic/dynsymlist_osx endif ifeq ($(PLATFORM),WINDOWS) + MISCGAMEDEPS+= $(SRC)/lunatic/eduke32.def MISCLINKOPTS+= $(SRC)/lunatic/eduke32.def endif ifeq ($(PLATFORM),LINUX) @@ -272,7 +276,7 @@ all: notice: $(BUILD_STARTED) -eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) +eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) $(MISCGAMEDEPS) $(LINK_STATUS) if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi ifeq (1,$(RELEASE)) @@ -298,7 +302,7 @@ enginelib editorlib: ifeq ($(PRETTY_OUTPUT),1) printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m \033[0m\n" endif - $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@ + $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@ LUNATIC=$(LUNATIC) #\ DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\ USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\ diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index 8864f7244..fa8c5f233 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -50,6 +50,10 @@ OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) $(ARCH) OURCXXFLAGS=$(BASECXXFLAGS) ASFLAGS=$(BASEASFLAGS) +ifneq ($(LUNATIC),0) + OURCFLAGS+= -DLUNATIC_ENABLE +endif + include Makefile.shared diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index b7a8176a1..812940cbc 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -240,6 +240,11 @@ typedef struct { uint8_t filler; float alpha; spritetype *tspr; +#if defined LUNATIC_ENABLE && UINTPTR_MAX == 0xffffffff + /* On a 32-bit build, pad the struct so it has the same size everywhere. + * REMINDER: Will break savegames. */ + void *dummy_; +#endif } spriteext_t; typedef struct { diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index 80f22e473..3f4656214 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -3,7 +3,7 @@ local ffi = require("ffi") ----- sector, wall, sprite ---- +---- sector, wall, sprite, ... ---- ffi.cdef[[ #pragma pack(push,1) typedef struct @@ -39,10 +39,23 @@ typedef struct uint8_t pal, clipdist, filler; uint8_t xrepeat, yrepeat; int8_t xoffset, yoffset; - int16_t sectnum, statnum; + const int16_t sectnum, statnum; int16_t ang, owner, xvel, yvel, zvel; int16_t lotag, hitag, extra; } spritetype; + +typedef struct { + const uint32_t mdanimtims; + const int16_t mdanimcur; + int16_t angoff, pitch, roll; + int32_t xoff, yoff, zoff; + uint8_t flags; + uint8_t xpanning, ypanning; + const uint8_t filler; + float alpha; + const int32_t _do_not_use1; + const int32_t _do_not_use2; +} spriteext_t; #pragma pack(pop) ]] @@ -50,6 +63,7 @@ ffi.cdef[[ sectortype *sector; walltype *wall; spritetype *sprite; +spriteext_t *spriteext; const int16_t numsectors, numwalls; @@ -128,6 +142,7 @@ gv = { sector = det, wall = det, sprite = det, + spriteext = det, headspritesect = det, headspritestat = det, prevspritesect = det, prevspritestat = det, @@ -185,6 +200,7 @@ local function creategtab(ctab, maxidx, name) end sprite = creategtab(ffiC.sprite, 16384, 'sprite[] struct') +spriteext = creategtab(ffiC.spriteext, 16384, 'spriteext[] struct') headspritesect = creategtab(ffiC.headspritesect, 16384, 'headspritesect[]') headspritestat = creategtab(ffiC.headspritestat, 1024, 'headspritestat[]') nextspritesect = creategtab(ffiC.nextspritesect, 16384, 'nextspritesect[]') @@ -232,6 +248,7 @@ G_.gv = gv G_.sector = sector G_.wall = wall G_.sprite = sprite +G_.spriteext = spriteext G_.headspritesect = headspritesect G_.headspritestat = headspritestat G_.nextspritesect = nextspritesect diff --git a/polymer/eduke32/source/lunatic/dynsymlist b/polymer/eduke32/source/lunatic/dynsymlist index a1775db84..fb3337f48 100644 --- a/polymer/eduke32/source/lunatic/dynsymlist +++ b/polymer/eduke32/source/lunatic/dynsymlist @@ -2,6 +2,7 @@ sector; wall; sprite; +spriteext; numsectors; numwalls; diff --git a/polymer/eduke32/source/lunatic/test.elua b/polymer/eduke32/source/lunatic/test.elua index cd6ef0149..73673f849 100644 --- a/polymer/eduke32/source/lunatic/test.elua +++ b/polymer/eduke32/source/lunatic/test.elua @@ -21,7 +21,12 @@ for i = 0, gv.numsectors/2 do end checkfail('gv.sprite[0].yrepeat = 100') -- direct gv array access forbidden -print('tweaking some sprites') +print('tweaking some sprites 2') +i = 562 +spriteext[i].alpha = 0.5; +sprite[i].cstat = bit.bor(sprite[i].cstat, 2+512); +spriteext[i].pitch = 128; +spriteext[i].roll = 256; for spr in spritesofsect(307) do -- some fence sprites in E1L1 print('spr', spr) sprite[spr].pal = 6