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
This commit is contained in:
helixhorned 2015-01-19 00:11:25 +00:00
parent 621b52aec5
commit 038a9f8eb6
6 changed files with 38 additions and 22 deletions

View file

@ -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;

View file

@ -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__

View file

@ -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

View file

@ -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();
}

View file

@ -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

View file

@ -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