Commit Graph

113 Commits

Author SHA1 Message Date
helixhorned 9bbc5c52de Lunatic: rename test.elua to test.lua.
The old extension is an artifact from when I was thought that extensions
should label whether a Lunatic module is to be used in internal/external
contexts.
Also, change test.lua slightly and commit a little updated documentation.

git-svn-id: https://svn.eduke32.com/eduke32@3969 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-19 12:49:10 +00:00
helixhorned a942a8f660 Lunatic: protect global environment.
git-svn-id: https://svn.eduke32.com/eduke32@3967 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-19 12:49:07 +00:00
helixhorned 7860fb8c01 Lunatic: remove DBG_ variable for _DEBUG_LUNATIC=0.
git-svn-id: https://svn.eduke32.com/eduke32@3966 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-19 12:49:06 +00:00
helixhorned ac3a6a1bd2 Lunatic: fix some must-fail tests and module()s without require'end_gamevars'.
git-svn-id: https://svn.eduke32.com/eduke32@3965 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-19 12:49:05 +00:00
helixhorned 3835019c70 Lunatic: replace 'idx >= BOUND+0ULL' idiom with 'not (idx >= 0 and idx < BOUND)'
git-svn-id: https://svn.eduke32.com/eduke32@3964 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-19 12:49:02 +00:00
helixhorned 9ecbd633aa Lunatic: rework weapondata_t __newindex handling for the sound members.
Also, in test.elua, add a currently failing must-fail test (i.e. it wrongly
succeeds where it should not!).

git-svn-id: https://svn.eduke32.com/eduke32@3954 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:59 +00:00
helixhorned d7ad2c36d4 Lunatic: revamp sector changing/updating functions of sprites.
git-svn-id: https://svn.eduke32.com/eduke32@3953 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:57 +00:00
helixhorned 36c03b8610 Lunatic: create game Lua state just before EVENT_NEWGAME, not in G_EnterLevel().
git-svn-id: https://svn.eduke32.com/eduke32@3951 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-13 21:04:53 +00:00
helixhorned 7f2175fcec Lunatic: retire per-sprite tsprite access for per-tile animation callback reg.
Don't yet make this official API though, since there are unresolved issues
with newly created tsprites potentially being fed back to the animation loop.
Add xmath.angvec(), xmath.bangvec(), tspr:set_sectnum(), tspr:setpos().

git-svn-id: https://svn.eduke32.com/eduke32@3937 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-07 20:59:10 +00:00
helixhorned f506e0f570 Rename the external 'gethitickms()' to 'gethiticks()'.
git-svn-id: https://svn.eduke32.com/eduke32@3935 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-07 20:59:05 +00:00
helixhorned 44f71d313f Lunatic: on palfrom from CON or C, set palsfade{speed,next} and regard prio.
git-svn-id: https://svn.eduke32.com/eduke32@3927 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-04 19:38:39 +00:00
helixhorned 253a13ed29 Lunatic: various tweaks and fixes.
- fix getv movflags handling in VM_Move()
- add actor.fall()
- LunaCON: sanity-check some action members

git-svn-id: https://svn.eduke32.com/eduke32@3924 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-04 19:38:32 +00:00
helixhorned cb2edcf45e Lunatic: in con.action and con.move, allow mixed number/string key tables.
E.g. con.action{0, 4, delay=20}; for convenience, viewtype and incval are
initialized to 1 (not 0) here.

git-svn-id: https://svn.eduke32.com/eduke32@3923 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:54 +00:00
helixhorned cad7d49bd1 Lunatic: retire an actor's sprite[].hitag/lotag for new actor[] members.
git-svn-id: https://svn.eduke32.com/eduke32@3922 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:52 +00:00
helixhorned ebe0ecaded Lunatic: add actor methods allowing overriding action delay and move hvel/vvel.
Add testing code for an example actor 1275 (newspaper) to test.elua.

git-svn-id: https://svn.eduke32.com/eduke32@3918 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:44 +00:00
helixhorned 36f3a8e47c Lunatic: don't register con.action/move/ai by name, make these return a cdata.
git-svn-id: https://svn.eduke32.com/eduke32@3916 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-30 20:38:39 +00:00
helixhorned 885036a6a3 Lunatic: retire 'geom' module, putting vector types into xmath.
git-svn-id: https://svn.eduke32.com/eduke32@3909 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-28 14:07:41 +00:00
helixhorned 1febaae767 Lunatic: various minor tweaks and fixes.
- Pass original module name (dot=dirsep) to module via our require()
- geom.lua: fix some operations using the vector type constructor
- geom.lua: provide constructor for ivec3, useable like vec3

git-svn-id: https://svn.eduke32.com/eduke32@3894 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-22 11:31:09 +00:00
helixhorned 5db04f585e Lunatic: player method fadecol(), an improved palfrom.
Also, an external 'minitext' with optional shade and pal. args and
documentation for ps:padecol().

git-svn-id: https://svn.eduke32.com/eduke32@3893 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-20 18:31:50 +00:00
helixhorned 10379910c1 Lunatic 'geom': retire tovec2 and tovec3, make vec2 and vec3 accept cdata, too.
git-svn-id: https://svn.eduke32.com/eduke32@3890 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-20 18:31:45 +00:00
helixhorned e2859cd133 Lunatic: write more documentation, handle randomangle movflag in a:set_move().
git-svn-id: https://svn.eduke32.com/eduke32@3887 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-15 12:52:06 +00:00
helixhorned d43cfe6232 Lunatic savegames: store g_playerWeapon[][], fix 'require' with submodules.
git-svn-id: https://svn.eduke32.com/eduke32@3883 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-13 17:11:09 +00:00
helixhorned 9c1eeae751 Lunatic: clean up 'geom' module, make walls readable with pseudo-member 'z'.
git-svn-id: https://svn.eduke32.com/eduke32@3875 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:56 +00:00
helixhorned f6065e227a Lunatic: make gameactor and gameevent be "table-called" functions.
git-svn-id: https://svn.eduke32.com/eduke32@3873 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:53 +00:00
helixhorned 2f29a89368 Lunatic: provide CON-defined labels in read-only table require("CON.DEFS").
git-svn-id: https://svn.eduke32.com/eduke32@3870 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:47 +00:00
helixhorned 224702b619 Lunatic: make require() translate dots to dir separators, make those illegal.
However, from the command line, reverse the situation: dirseps must be passed
as '/', dots are forbidden (except in the trailing ".lua").

git-svn-id: https://svn.eduke32.com/eduke32@3867 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:19 +00:00
helixhorned dee8dbe092 Lunatic: rename bitint members to *bits instead of *x.
git-svn-id: https://svn.eduke32.com/eduke32@3864 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:13 +00:00
helixhorned 5e5f80d61b Lunatic: keep status number symbols in actor.STAT instead of gv.STAT_*.
git-svn-id: https://svn.eduke32.com/eduke32@3860 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 14:26:30 +00:00
helixhorned 34138cdc96 Lunatic: fix current incarnation of gamevar saving/restoration.
git-svn-id: https://svn.eduke32.com/eduke32@3857 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:17 +00:00
helixhorned f8c04673b4 Lunatic: tweak sector.STAT.* and other names a little.
git-svn-id: https://svn.eduke32.com/eduke32@3851 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-06 11:22:35 +00:00
helixhorned 75313a78c8 Lunatic: sector[].ceiling/.floor gets a reference to a ceiling-or-floor struct.
Also, make sector[].*stat a bitint type.

Now, a piece of code could look like this:
local sec = sector[i]
local ceil = sec.ceiling
ceil.statx:flip(sector.STAT.SMOOSH)

git-svn-id: https://svn.eduke32.com/eduke32@3844 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 20:09:43 +00:00
helixhorned 51ad20eda5 Lunatic: fix a couple of oversights, tweak some stuff.
git-svn-id: https://svn.eduke32.com/eduke32@3843 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 20:09:42 +00:00
helixhorned 4ed1eaa520 Lunatic: accept any number of *.lua modules on the command line.
There's no option letter for loading them, and the extension is checked
case sensitively. Lua modules are loaded after CON translated to Lua.
Also remove -testlua option.

git-svn-id: https://svn.eduke32.com/eduke32@3788 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:16 +00:00
helixhorned f95967fad7 Lunatic: remove old gamevar/serialization code.
git-svn-id: https://svn.eduke32.com/eduke32@3771 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 18:32:52 +00:00
helixhorned ec5cd930e0 Lunatic: fix test.elua after map-int VX and one rename, add one microbenchmark.
git-svn-id: https://svn.eduke32.com/eduke32@3664 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-12 11:59:29 +00:00
helixhorned bbdc035335 Lunatic: replace DukePlayer_t set-member methods with metatable magic.
So that members needing it are checked when they're assigned to using the
usual syntax. What kind of check to perform (sector, player, ... x whether
negative values are allowed) is written in a declarative fashion inside the
C declaration.

Also, make Lunatic's MAXQUOTES be C's OBITQUOTEINDEX and bound-check an
access of sprite[p->wackedbyplayer] in the C code.

git-svn-id: https://svn.eduke32.com/eduke32@3653 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-07 15:20:41 +00:00
helixhorned abcc98d5c1 Lunatic: access to show2dsector[], fix some permit-negative bound checks.
git-svn-id: https://svn.eduke32.com/eduke32@3650 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-07 15:20:28 +00:00
helixhorned 6ebe2d4745 Lunatic: custom integer types treated as bitfields.
Used for engine struct's (c)stat and actor[].flags members.

git-svn-id: https://svn.eduke32.com/eduke32@3643 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:10 +00:00
helixhorned 49290a090c Lunatic: make palette_t a bcarray-generated type, various tweaks.
- Increase LuaJIT max. machine code limit to 10 MiB

git-svn-id: https://svn.eduke32.com/eduke32@3641 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:03 +00:00
helixhorned 512b9286fe LunaCON: ifsquished.
git-svn-id: https://svn.eduke32.com/eduke32@3640 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:52:59 +00:00
helixhorned e63874d011 Lunatic: chaining of actor callback functions.
For events and actors, a flag can be now passed whether to chain the new
function at the beginning or end of an already existing one, or to replace
it entirely.
Also, for the translator, add option -fno-error-nostate, disabled by default.

git-svn-id: https://svn.eduke32.com/eduke32@3629 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-31 18:58:04 +00:00
helixhorned efbc4cec90 Lunatic: actor usertypes from CON, set SFLAGs as 2nd gameactor() arg in Lua.
In passing, fix a couple of omissions: gameactor() being passed nil's in the
middle, more than one moveflag to CON *actor.

git-svn-id: https://svn.eduke32.com/eduke32@3597 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:28 +00:00
helixhorned ad55e2d424 Lunatic: make ivec3 and dvec3 types share same metatable, orthogonalize API.
Specifically, remove ivec3's blen1() method and add from/to BUILD coordinate
(z scaled by 16) conversion methods.

git-svn-id: https://svn.eduke32.com/eduke32@3591 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:20:27 +00:00
helixhorned 904a26e045 Clean up mdsprite.c:voxdraw() a little.
git-svn-id: https://svn.eduke32.com/eduke32@3589 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:20:14 +00:00
helixhorned ef464f2a1d Lunatic: allow indexing some weapon/inventory arrays with their names.
git-svn-id: https://svn.eduke32.com/eduke32@3564 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:19 +00:00
helixhorned 1606c17a77 Lunatic: fixups and debugging helpers.
- add LuaJIT's 'v' module printing trace info
- translator: fix game function name definitions
- revert math.fmod -> math.modf, they are different!
- disable JIT compilation for a function we're getting strange crashes with
- Make some of DukePlayer_t's members 'bool' on the Lua side. It's way
  too easy to write something like "ps.jetpack_on" where "ps.jetpack_on~=0"
  was meant. [Background: Kyle873 observed that Duke was always floating.]
- Error out if looping in our_module(). I find this behavior more logical
  than returning true.
- fix a couple of missed FORBID variables

git-svn-id: https://svn.eduke32.com/eduke32@3530 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-28 17:30:04 +00:00
helixhorned f791b5af20 Lunatic: sector[]:zrangeat(), 'getzrange' command for the translator.
Also, fix quote commands there.

git-svn-id: https://svn.eduke32.com/eduke32@3524 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-25 15:31:13 +00:00
helixhorned 185f0a8cc4 Lunatic translator: text rendering and other niceties.
git-svn-id: https://svn.eduke32.com/eduke32@3501 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:42 +00:00
helixhorned 2d61216758 Lunatic translator: sprite list commands, findnear*, protect player[].ftq.
git-svn-id: https://svn.eduke32.com/eduke32@3498 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:32 +00:00
helixhorned a3b3804a08 Lunatic: more commands, timing test for xmath's sine functions.
git-svn-id: https://svn.eduke32.com/eduke32@3489 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-16 18:53:15 +00:00