mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Lunatic: slight Makefile tweak for Windows preparation.
Add doc/how_to_build_lunatic.txt and doc/lpeg-lunatic.patch. git-svn-id: https://svn.eduke32.com/eduke32@3938 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7f2175fcec
commit
750fbb0a0e
7 changed files with 116 additions and 12 deletions
|
@ -148,7 +148,16 @@ ifneq (0,$(LUNATIC))
|
||||||
EDITOROBJS+= $(OBJ)/lunatic_m32.$o $(LUNATIC_COMMON_OBJS)
|
EDITOROBJS+= $(OBJ)/lunatic_m32.$o $(LUNATIC_COMMON_OBJS)
|
||||||
GAMEOBJS+= $(OBJ)/lunatic_game.$o $(LUNATIC_COMMON_OBJS)
|
GAMEOBJS+= $(OBJ)/lunatic_game.$o $(LUNATIC_COMMON_OBJS)
|
||||||
|
|
||||||
GAMEOBJS+= $(OBJ)/../lpeg.a # TEMP
|
ifneq ($(PLATFORM),WINDOWS)
|
||||||
|
# On non-Windows, we expect to have liblpeg.a (or a symlink to it) in source/.
|
||||||
|
# On Windows, it will reside in platform/Windows/lib32 or lib64.
|
||||||
|
LIBDIRS+= -L$(realpath (OBJ)/..)
|
||||||
|
ifeq ($(realpath $(OBJ)/../liblpeg.a),)
|
||||||
|
# XXX: This cripples "make clean" etc. too, but IMO it's better than warning.
|
||||||
|
$(error "liblpeg.a not found in $(realpath $(OBJ)/..)")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
LIBS+= -llpeg
|
||||||
GAMEOBJS+= $(OBJ)/luaJIT_BC_con_lang.$o \
|
GAMEOBJS+= $(OBJ)/luaJIT_BC_con_lang.$o \
|
||||||
$(OBJ)/luaJIT_BC_lunacon.$o \
|
$(OBJ)/luaJIT_BC_lunacon.$o \
|
||||||
$(OBJ)/luaJIT_BC_randgen.$o \
|
$(OBJ)/luaJIT_BC_randgen.$o \
|
||||||
|
|
|
@ -427,7 +427,7 @@ LUNATIC=0
|
||||||
LUAJIT=luajit
|
LUAJIT=luajit
|
||||||
|
|
||||||
# for LJ headers:
|
# for LJ headers:
|
||||||
LUAJIT_WIN_SRC:= g:/mod/luajit-2.0/src
|
LUAJIT_WIN_SRC:= f:/g/mod/luajit-2.0/src
|
||||||
|
|
||||||
ifneq ($(LUNATIC),0)
|
ifneq ($(LUNATIC),0)
|
||||||
# FIXME: Lunatic doesn't build with inlining because of wacky include
|
# FIXME: Lunatic doesn't build with inlining because of wacky include
|
||||||
|
|
|
@ -673,9 +673,11 @@ end
|
||||||
|
|
||||||
---=== Methods that are specific to sprites ===---
|
---=== Methods that are specific to sprites ===---
|
||||||
|
|
||||||
|
local l_updatesector -- fwd-decl
|
||||||
|
|
||||||
function spritetype_mt.__index.setpos(spr, pos) -- setsprite() clone
|
function spritetype_mt.__index.setpos(spr, pos) -- setsprite() clone
|
||||||
spr.x, spr.y, spr.z = pos.x, pos.y, pos.z
|
spr.x, spr.y, spr.z = pos.x, pos.y, pos.z
|
||||||
local newsect = updatesector(spr, spr.sectnum)
|
local newsect = l_updatesector(spr, spr.sectnum)
|
||||||
|
|
||||||
if (newsect >= 0 and spr.sectnum ~= newsect) then
|
if (newsect >= 0 and spr.sectnum ~= newsect) then
|
||||||
ffiC.changespritesect(get_sprite_idx(spr), newsect)
|
ffiC.changespritesect(get_sprite_idx(spr), newsect)
|
||||||
|
@ -696,7 +698,7 @@ end
|
||||||
-- e.g. for example because it's already there from "hitscan").
|
-- e.g. for example because it's already there from "hitscan").
|
||||||
function tspritetype_mt.__index.setpos(tspr, pos)
|
function tspritetype_mt.__index.setpos(tspr, pos)
|
||||||
tspr.x, tspr.y, tspr.z = pos.x, pos.y, pos.z
|
tspr.x, tspr.y, tspr.z = pos.x, pos.y, pos.z
|
||||||
local newsect = updatesector(tspr, tspr.sectnum)
|
local newsect = l_updatesector(tspr, tspr.sectnum)
|
||||||
|
|
||||||
if (newsect >= 0 and tspr.sectnum ~= newsect) then
|
if (newsect >= 0 and tspr.sectnum ~= newsect) then
|
||||||
tspr:set_sectnum(newsect)
|
tspr:set_sectnum(newsect)
|
||||||
|
@ -942,6 +944,7 @@ end
|
||||||
--== ALL GLOBALS FROM HERE ON ARE EXPORTED UPWARDS (see create_globals() below) ==--
|
--== ALL GLOBALS FROM HERE ON ARE EXPORTED UPWARDS (see create_globals() below) ==--
|
||||||
|
|
||||||
sector = setmtonce({}, sector_mt)
|
sector = setmtonce({}, sector_mt)
|
||||||
|
local sector = sector
|
||||||
wall = setmtonce({}, wall_mt)
|
wall = setmtonce({}, wall_mt)
|
||||||
sprite = setmtonce({}, sprite_mt)
|
sprite = setmtonce({}, sprite_mt)
|
||||||
spriteext = creategtab(ffiC.spriteext, ffiC.MAXSPRITES, 'spriteext[]')
|
spriteext = creategtab(ffiC.spriteext, ffiC.MAXSPRITES, 'spriteext[]')
|
||||||
|
@ -1122,6 +1125,8 @@ function updatesector(pos, sectnum, flags)
|
||||||
return us_retsect[0]
|
return us_retsect[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
l_updatesector = updatesector
|
||||||
|
|
||||||
function updatesectorz(pos, sectnum, flags)
|
function updatesectorz(pos, sectnum, flags)
|
||||||
if (sectnum ~= -1) then
|
if (sectnum ~= -1) then
|
||||||
check_sector_idx(sectnum)
|
check_sector_idx(sectnum)
|
||||||
|
|
15
polymer/eduke32/source/lunatic/doc/how_to_build_lunatic.txt
Normal file
15
polymer/eduke32/source/lunatic/doc/how_to_build_lunatic.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
Lunatic depends on the following:
|
||||||
|
|
||||||
|
* LuaJIT 2.0.2 or later [http://luajit.org]. It is recommended to get the
|
||||||
|
latest git HEAD of the 2.0 branch, see http://luajit.org/download.html for
|
||||||
|
that. As of time of writing, LuaJIT 2.1 is in alpha, and has not been
|
||||||
|
successfully tested with Lunatic. LuaJIT is built with the following change
|
||||||
|
to src/luaconf.h:
|
||||||
|
#define LUAI_MAXCSTACK 64000
|
||||||
|
(instead of the default 8000.)
|
||||||
|
|
||||||
|
* LPeg 0.12 [http://www.inf.puc-rio.br/~roberto/lpeg], but with our patch
|
||||||
|
"lpeg-lunatic.patch" applied. It will allow to build a statically linked
|
||||||
|
library of LPeg, "liblpeg.a". On Windows, liblpeg.a is pre-compiled and
|
||||||
|
resides in platform/Windows/lib/{32,64} [TODO on release].
|
73
polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch
Normal file
73
polymer/eduke32/source/lunatic/doc/lpeg-lunatic.patch
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
diff --git a/lpcap.h b/lpcap.h
|
||||||
|
index c0a0e38..1bfc109 100644
|
||||||
|
--- a/lpcap.h
|
||||||
|
+++ b/lpcap.h
|
||||||
|
@@ -18,7 +18,7 @@ typedef enum CapKind {
|
||||||
|
|
||||||
|
typedef struct Capture {
|
||||||
|
const char *s; /* subject position */
|
||||||
|
- short idx; /* extra info about capture (group name, arg index, etc.) */
|
||||||
|
+ int idx; /* extra info about capture (group name, arg index, etc.) */
|
||||||
|
byte kind; /* kind of capture */
|
||||||
|
byte siz; /* size of full capture + 1 (0 = not a full capture) */
|
||||||
|
} Capture;
|
||||||
|
diff --git a/makefile b/makefile
|
||||||
|
index 57a18fb..88e8a60 100644
|
||||||
|
--- a/makefile
|
||||||
|
+++ b/makefile
|
||||||
|
@@ -1,5 +1,8 @@
|
||||||
|
LIBNAME = lpeg
|
||||||
|
-LUADIR = /usr/include/lua5.1/
|
||||||
|
+# Linux example:
|
||||||
|
+LUADIR = /usr/local/include/luajit-2.0
|
||||||
|
+# Windows example (from MSYS bash):
|
||||||
|
+#LUADIR = /f/g/mod/luajit-2.0/src
|
||||||
|
|
||||||
|
COPT = -O2
|
||||||
|
# COPT = -DLPEG_DEBUG -g
|
||||||
|
@@ -19,10 +22,21 @@ CWARNS = -Wall -Wextra -pedantic \
|
||||||
|
-Wmissing-prototypes \
|
||||||
|
-Wnested-externs \
|
||||||
|
-Wstrict-prototypes \
|
||||||
|
+ -Werror-implicit-function-declaration \
|
||||||
|
# -Wunreachable-code \
|
||||||
|
|
||||||
|
+# Example:
|
||||||
|
+# --------
|
||||||
|
+# 1. Build shared lib (for LunaCON standalone)
|
||||||
|
+# $ make linux
|
||||||
|
+# 2. Remove shared-lib *.o
|
||||||
|
+# $ rm *.o
|
||||||
|
+# 3. Build static lib (for EDuke32/Lunatic)
|
||||||
|
+# $ PIC='' make liblpeg.a
|
||||||
|
|
||||||
|
-CFLAGS = $(CWARNS) $(COPT) -ansi -I$(LUADIR) -fPIC
|
||||||
|
+PIC ?= -fPIC
|
||||||
|
+
|
||||||
|
+CFLAGS = $(CWARNS) $(COPT) -ansi -I$(LUADIR) $(PIC)
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
|
||||||
|
@@ -38,13 +52,16 @@ macosx:
|
||||||
|
lpeg.so: $(FILES)
|
||||||
|
env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
|
||||||
|
|
||||||
|
+liblpeg.a: $(FILES)
|
||||||
|
+ $(AR) rc $@ $^
|
||||||
|
+
|
||||||
|
$(FILES): makefile
|
||||||
|
|
||||||
|
test: test.lua re.lua lpeg.so
|
||||||
|
./test.lua
|
||||||
|
|
||||||
|
clean:
|
||||||
|
- rm -f $(FILES) lpeg.so
|
||||||
|
+ rm -f $(FILES) lpeg.so liblpeg.a
|
||||||
|
|
||||||
|
|
||||||
|
lpcap.o: lpcap.c lpcap.h lptypes.h
|
||||||
|
@@ -52,4 +69,3 @@ lpcode.o: lpcode.c lptypes.h lpcode.h lptree.h lpvm.h lpcap.h
|
||||||
|
lpprint.o: lpprint.c lptypes.h lpprint.h lptree.h lpvm.h lpcap.h
|
||||||
|
lptree.o: lptree.c lptypes.h lpcap.h lpcode.h lptree.h lpvm.h lpprint.h
|
||||||
|
lpvm.o: lpvm.c lpcap.h lptypes.h lpvm.h lpprint.h lptree.h
|
||||||
|
-
|
|
@ -243,6 +243,7 @@ sensitive_ walls and sprites.
|
||||||
The number of times in a second each actor excecutes its code and updates its
|
The number of times in a second each actor excecutes its code and updates its
|
||||||
position (``game tics'').
|
position (``game tics'').
|
||||||
|
|
||||||
|
//////////
|
||||||
`gv.*` inventory indices::
|
`gv.*` inventory indices::
|
||||||
`GET_STEROIDS`, `GET_SHIELD`, `GET_SCUBA`, `GET_HOLODUKE`, `GET_JETPACK`,
|
`GET_STEROIDS`, `GET_SHIELD`, `GET_SCUBA`, `GET_HOLODUKE`, `GET_JETPACK`,
|
||||||
`GET_DUMMY1`, `GET_ACCESS`, `GET_HEATS`, `GET_DUMMY2`, `GET_FIRSTAID`,
|
`GET_DUMMY1`, `GET_ACCESS`, `GET_HEATS`, `GET_DUMMY2`, `GET_FIRSTAID`,
|
||||||
|
@ -253,14 +254,6 @@ position (``game tics'').
|
||||||
`RPG_WEAPON`, `HANDBOMB_WEAPON`, `SHRINKER_WEAPON`, `DEVISTATOR_WEAPON`,
|
`RPG_WEAPON`, `HANDBOMB_WEAPON`, `SHRINKER_WEAPON`, `DEVISTATOR_WEAPON`,
|
||||||
`TRIPBOMB_WEAPON`, `FREEZE_WEAPON`, `HANDREMOTE_WEAPON`,
|
`TRIPBOMB_WEAPON`, `FREEZE_WEAPON`, `HANDREMOTE_WEAPON`,
|
||||||
`GROW_WEAPON`. `MAX_WEAPONS`.
|
`GROW_WEAPON`. `MAX_WEAPONS`.
|
||||||
|
|
||||||
// TODO: the others, like EVENT_*.
|
|
||||||
//////////
|
|
||||||
[[gv_STAT]] `gv.*` sprite status numbers::
|
|
||||||
`STAT_DEFAULT`, `STAT_ACTOR`, `STAT_ZOMBIEACTOR`, `STAT_EFFECTOR`,
|
|
||||||
`STAT_PROJECTILE`, `STAT_MISC`, `STAT_STANDABLE`, `STAT_LOCATOR`,
|
|
||||||
`STAT_ACTIVATOR`, `STAT_TRANSPORT`, `STAT_PLAYER`, `STAT_FX`, `STAT_FALLER`,
|
|
||||||
`STAT_DUMMYPLAYER`, `STAT_LIGHT`.
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
[[gv_REND]] `gv.REND`::
|
[[gv_REND]] `gv.REND`::
|
||||||
|
@ -1008,6 +1001,8 @@ Returns a boolean of whether the position `pos` (which can be anything
|
||||||
indexable with `x` and `y`) is considered inside the sector with number
|
indexable with `x` and `y`) is considered inside the sector with number
|
||||||
`sectnum`, which must be valid. The `z` component is not taken into account.
|
`sectnum`, which must be valid. The `z` component is not taken into account.
|
||||||
|
|
||||||
|
===== Sector updating
|
||||||
|
|
||||||
A number of engine functions take a position `pos` and a starting sector number
|
A number of engine functions take a position `pos` and a starting sector number
|
||||||
`sectnum` and try to find a sector that contains `pos`, assuming it started out
|
`sectnum` and try to find a sector that contains `pos`, assuming it started out
|
||||||
in `sectnum`.footnote:[Note that this is different from CON's `updatesector`,
|
in `sectnum`.footnote:[Note that this is different from CON's `updatesector`,
|
||||||
|
@ -1019,6 +1014,9 @@ and then attempt to search neighboring sectors. If the passed `sectnum` is
|
||||||
`-1`, all sectors are searched in an unspecified order. On success, these
|
`-1`, all sectors are searched in an unspecified order. On success, these
|
||||||
functions return the sector number of the ``updated'' sector, otherwise `-1`.
|
functions return the sector number of the ``updated'' sector, otherwise `-1`.
|
||||||
|
|
||||||
|
// XXX: With breadth-first search, there is no all-sector search when passing
|
||||||
|
// -1. The above paragraph suggests otherwise.
|
||||||
|
|
||||||
[[updatesector]] `updatesector(pos, sectnum [, flags])`::
|
[[updatesector]] `updatesector(pos, sectnum [, flags])`::
|
||||||
|
|
||||||
Searches for a sector containing `pos`, which can be anything indexable with
|
Searches for a sector containing `pos`, which can be anything indexable with
|
||||||
|
|
|
@ -79,6 +79,8 @@ function cosb(ang)
|
||||||
return dsintab[ksc_common(ang+512)]
|
return dsintab[ksc_common(ang+512)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cosb, sinb = cosb, sinb
|
||||||
|
|
||||||
|
|
||||||
---=== Approximations to 2D and 3D Euclidean distances ===---
|
---=== Approximations to 2D and 3D Euclidean distances ===---
|
||||||
-- (also see common.c)
|
-- (also see common.c)
|
||||||
|
@ -282,6 +284,8 @@ function ivec3(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local vec2, vec3 = vec2, vec3
|
||||||
|
|
||||||
|
|
||||||
---=== MISCELLANEOUS MATH ===---
|
---=== MISCELLANEOUS MATH ===---
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue