From 038a9f8eb65423c1c5c014d2edb534efaeef0821 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 19 Jan 2015 00:11:25 +0000 Subject: [PATCH] Lunatic: fix build and linking. DONT_BUILD. - t{sector,wall}type are simply typedef'd to the non-t versions - make FORCE_INLINE unconditional of DISABLE_INLINING (otherwise there are multiple definitions of these functions) - update lunatic/doc/lpeg-lunatic.patch to apply against the LPeg 0.12 I just downloaded git-svn-id: https://svn.eduke32.com/eduke32@4937 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 8 +++++++ polymer/eduke32/build/include/buildtypes.h | 2 ++ polymer/eduke32/build/include/compat.h | 24 +++++++++---------- polymer/eduke32/source/gameexec.c | 2 +- polymer/eduke32/source/gamevars.c | 18 +++++++++----- .../source/lunatic/doc/lpeg-lunatic.patch | 6 ++--- 6 files changed, 38 insertions(+), 22 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index e45d1bb6f..5412d9253 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -308,15 +308,19 @@ enum { SPR_ALIGN_MASK = 32+16, }; +#if !defined NEW_MAP_FORMAT #include "buildtypes.h" #define UNTRACKED_STRUCTS #undef buildtypes_h__ #include "buildtypes.h" #undef UNTRACKED_STRUCTS +#endif #ifdef NEW_MAP_FORMAT //////////////////// Lunatic new-generation map format //////////////////// +#include "buildtypes.h" + // 44 bytes typedef struct { @@ -505,6 +509,10 @@ static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp) typedef sectortypevx sectortype; typedef walltypevx walltype; + +typedef sectortype tsectortype; +typedef walltype twalltype; +typedef spritetype tspritetype; //////////////////// END Lunatic new-generation map format //////////////// #else typedef sectortypev7 sectortype; diff --git a/polymer/eduke32/build/include/buildtypes.h b/polymer/eduke32/build/include/buildtypes.h index 8fdf57a4e..e4923ed79 100644 --- a/polymer/eduke32/build/include/buildtypes.h +++ b/polymer/eduke32/build/include/buildtypes.h @@ -6,6 +6,7 @@ #undef SPRITETYPE #ifdef UNTRACKED_STRUCTS + #pragma push_macro("Tracker") #undef Tracker #define Tracker(tracker, type) type @@ -128,4 +129,5 @@ typedef struct #ifdef UNTRACKED_STRUCTS #pragma pop_macro("Tracker") #endif + #endif // buildtypes_h__ diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 0f9df89b0..e1b29a4f6 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -209,21 +209,21 @@ #ifndef DISABLE_INLINING # define EXTERN_INLINE static inline # define EXTERN_INLINE_HEADER static inline -# ifndef FORCE_INLINE -# ifdef _MSC_VER // Visual Studio -# define FORCE_INLINE static __forceinline -# else -# ifdef __GNUC__ -# define FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define FORCE_INLINE static inline -# endif -# endif -# endif #else # define EXTERN_INLINE __fastcall # define EXTERN_INLINE_HEADER extern __fastcall -# define FORCE_INLINE +#endif + +#ifndef FORCE_INLINE +# ifdef _MSC_VER // Visual Studio +# define FORCE_INLINE static __forceinline +# else +# ifdef __GNUC__ +# define FORCE_INLINE static inline __attribute__((always_inline)) +# else +# define FORCE_INLINE static inline +# endif +# endif #endif #if !defined DEBUG_MAIN_ARRAYS diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 12ce0b9b0..571907728 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5736,7 +5736,7 @@ int32_t VM_CheckSquished2(int32_t i, int32_t snum) vm.g_i = i; vm.g_sp = &sprite[i]; vm.g_p = snum; - vm.g_pp = &g_player[snum].ps; + vm.g_pp = g_player[snum].ps; return VM_CheckSquished(); } diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index aac6c7cbb..06a27a3ca 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1004,15 +1004,13 @@ void Gv_ResetSystemDefaults(void) { // call many times... #if !defined LUNATIC - int32_t i; - int32_t j; char aszBuf[64]; //AddLog("ResetWeaponDefaults"); - for (j=MAXPLAYERS-1; j>=0; j--) + for (int j=MAXPLAYERS-1; j>=0; j--) { - for (i=MAX_WEAPONS-1; i>=0; i--) + for (int i=MAX_WEAPONS-1; i>=0; i--) { Bsprintf(aszBuf,"WEAPON%d_CLIP",i); aplWeaponClip[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); @@ -1075,10 +1073,12 @@ void Gv_ResetSystemDefaults(void) g_iActorVarID=Gv_GetVarIndex("actorvar"); #endif - for (i = 0; i <= MAXTILES - 1; i++) + for (int i = 0; i <= MAXTILES - 1; i++) Bmemcpy(&ProjectileData[i], &g_tile[i].defproj, sizeof(projectile_t)); #ifndef LUNATIC + int i; + // hackhackhackhackhack if (i = hash_find(&h_arrays, "tilesizx"), i >= 0) { @@ -1487,13 +1487,19 @@ static void Gv_AddSystemVars(void) void Gv_Init(void) { +#if !defined LUNATIC // already initialized if (aGameVars[0].dwFlags) return; -#if !defined LUNATIC Gv_Clear(); +#else + static int32_t inited=0; + if (inited) + return; + inited = 1; #endif + // Set up weapon defaults, g_playerWeapon[][]. Gv_AddSystemVars(); #if !defined LUNATIC diff --git a/polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch b/polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch index 31eab27b7..b9b1dee32 100644 --- a/polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch +++ b/polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch @@ -17,7 +17,7 @@ index 57a18fb..88e8a60 100644 +++ b/makefile @@ -1,5 +1,8 @@ LIBNAME = lpeg --LUADIR = /usr/include/lua5.1/ +-LUADIR = ../lua/ +# Linux example: +LUADIR = /usr/local/include/luajit-2.0 +# Windows example (from MSYS bash): @@ -41,10 +41,10 @@ index 57a18fb..88e8a60 100644 +# 3. Build static lib (for EDuke32/Lunatic) +# $ PIC='' make liblpeg.a --CFLAGS = $(CWARNS) $(COPT) -ansi -I$(LUADIR) -fPIC +-CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC +PIC ?= -fPIC + -+CFLAGS = $(CWARNS) $(COPT) -ansi -I$(LUADIR) $(PIC) ++CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) $(PIC) CC = gcc FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o