Commit Graph

461 Commits

Author SHA1 Message Date
helixhorned 9911e96fe8 Lunatic: rename spriteext[].*off->mdoff.*, actor[].actorstayput->stayputsect.
git-svn-id: https://svn.eduke32.com/eduke32@3874 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:55 +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 bbcf6d6353 LunaCON: implement qgetsysstr/STR_VOLUMENAME.
git-svn-id: https://svn.eduke32.com/eduke32@3872 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:51 +00:00
helixhorned 570d35dbaa Lunatic: Propagate potentially remapped CON defines to the control module.
(This is the module that implements much of the "hard-coded" functionality
formerly on the C side.)

git-svn-id: https://svn.eduke32.com/eduke32@3871 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-12 17:49:49 +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 e955860950 Lunatic: commit preliminary, unfinished documentation written in AsciiDoc.
Don't (yet?) commit the generated HTML.

git-svn-id: https://svn.eduke32.com/eduke32@3868 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:22 +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 2003954492 CON: add projectile member .userdata and predefined label PROJ_USERDATA.
It is a 32-bit signed integer. No version bump necessary, although CON code
accessing this new member will not work with earlier revisions (obviously).

git-svn-id: https://svn.eduke32.com/eduke32@3866 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:18 +00:00
helixhorned 0d951f0256 LunaCON: bound-check defineprojectile tile/sound members.
Also from Lunatic, make these members read-only and provide methods that
allow setting them to either -1 or a number in [0..MAX{TILES,SOUNDS}-1].

git-svn-id: https://svn.eduke32.com/eduke32@3865 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-09 16:37:16 +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 bd49bc7bbd LunaCON: strip dir prefixes on file-not-found; _getpname, ud.m_player_skill.
git-svn-id: https://svn.eduke32.com/eduke32@3862 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 14:26:34 +00:00
helixhorned 16b3cb6a42 LunaCON: showview and showviewunbiased.
git-svn-id: https://svn.eduke32.com/eduke32@3861 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 14:26:32 +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 528366da46 Lunatic: add preliminary helper code for local gamevar saving.
git-svn-id: https://svn.eduke32.com/eduke32@3858 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:20 +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 a0f00e28c3 Lunatic: prettify listglobals.sh output.
git-svn-id: https://svn.eduke32.com/eduke32@3856 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:16 +00:00
helixhorned ddb0d3f63d LunaCON: properly generate references to gamevars named like Lua keywords.
git-svn-id: https://svn.eduke32.com/eduke32@3855 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:15 +00:00
helixhorned 7725544ef1 LunaCON: free a couple of file-scope local slots by storing stuff in tables.
git-svn-id: https://svn.eduke32.com/eduke32@3854 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-07 10:18:12 +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 185597d3b3 LunaCON: proper handling of dynamic remappings with weapon defaults.
That is, the gamevars named WEAPONx_* in CON will now have the remapped value
if they were not overridden from CON ('gamevar' at file scope).
For C-CON, everything except signaling an override from the CON parser is in
place.

git-svn-id: https://svn.eduke32.com/eduke32@3848 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-02 14:07:56 +00:00
helixhorned 882eb4cb8b LunaCON: hook up dynamicsoundremap.
git-svn-id: https://svn.eduke32.com/eduke32@3847 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-02 14:07:52 +00:00
helixhorned 7fcb577f51 LunaCON: hook up qstrdim and screentext.
Also add some recent keywords to the list in con_lang.lua which I had
forgotten all along.

git-svn-id: https://svn.eduke32.com/eduke32@3845 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 20:09:45 +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 e0433e66fb LunaCON: real user per-player vars.
The previous behavior was to translate them as global gamevars, since LunaCON
currently has no support for multiplayer. However, then some errors would be
missed where such gamevars are accessed in no-player context
(e.g. EVENT_ENTERLEVEL).
On by default, disabled with -fno-playervar.

git-svn-id: https://svn.eduke32.com/eduke32@3842 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 20:09:41 +00:00
helixhorned f0ed046a98 LunaCON: fix mistranslation of CON "else { if" to Lua "elseif".
When encountering a non-empty statement inside braces, emit "do" ... "end".

git-svn-id: https://svn.eduke32.com/eduke32@3840 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 20:09:37 +00:00
hendricks266 ced47cf9fc Add qstrdim and screentext, powerful new functions for HUD text.
git-svn-id: https://svn.eduke32.com/eduke32@3833 1a8010ca-5511-0410-912e-c29ae57300e0
2013-06-01 06:55:00 +00:00
helixhorned 5bfbfa3c5b Lunatic: also reset per-actor gamevars from spawns originating from C.
Take care not to do it twice. Still untested though.

git-svn-id: https://svn.eduke32.com/eduke32@3830 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:59 +00:00
helixhorned 97f857ec39 Lunatic: split 'replace' option for actor chaining flags into soft/hard.
Hard replacement reassigns the tile flags, while soft replacement bitwise
ORs them, as in CON (since some flags might already have been set using
commands like spritenoshade).

git-svn-id: https://svn.eduke32.com/eduke32@3829 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:54 +00:00
helixhorned 020be8d4b5 Lunatic: reset per-actor gamevars on actor spawn, untested.
git-svn-id: https://svn.eduke32.com/eduke32@3828 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:52 +00:00
helixhorned 640eda2194 LunaCON: implement 'definegametype', allow writing userdef.level_number.
Also, allow (implicit) actor index -1 to 'sound' like in C-CON and fix
MULTIMODE gamevar definition (was 0, not 1).

git-svn-id: https://svn.eduke32.com/eduke32@3826 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-30 18:10:49 +00:00
helixhorned 1715b7631f Make deletion of an ambient sound MUSICANDSFX sprite stop its sound again.
Add a test case source/lunatic/test/delmusicsfx.lua.

git-svn-id: https://svn.eduke32.com/eduke32@3822 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-28 19:52:51 +00:00
helixhorned 360aae414f Lunatic: add actor.delete() and various 'length' methods to geom.vec3/ivec3.
git-svn-id: https://svn.eduke32.com/eduke32@3821 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-28 19:52:48 +00:00
helixhorned 13b69711ac LunaCON: add a couple of ud members, gamevars; handle 'dynamicremap' only once.
Also, allow MAXVOLUMES+1 to first arg of 'music'.

git-svn-id: https://svn.eduke32.com/eduke32@3817 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-26 18:42:53 +00:00
helixhorned c366388a9e Lunatic: -Wchained-loadactor option for LunaCON, clear errors on restart.
The last only in release builds.

git-svn-id: https://svn.eduke32.com/eduke32@3813 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:39 +00:00
helixhorned 6f94af7399 LunaCON: implement dragpoint, clipmove*; fix gamearray serialization.
git-svn-id: https://svn.eduke32.com/eduke32@3812 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:37 +00:00
helixhorned f568f34636 LunaCON standalone: don't try default path on file-not-found for root names.
git-svn-id: https://svn.eduke32.com/eduke32@3809 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:33 +00:00
helixhorned 487d54793f For DNCOORDS display, add current sprite count and #inserted sprites / last sec.
Only in debugging builds.

git-svn-id: https://svn.eduke32.com/eduke32@3808 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:32 +00:00
helixhorned e3a85f4083 Lunatic: fix restoring of tables. Also add savegame.lua which I forgot!
git-svn-id: https://svn.eduke32.com/eduke32@3807 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:30 +00:00
helixhorned 4781eecdb4 LunaCON: partially sync with r3803, link with lpeg.a (update to LPeg 0.12).
For pre-1.3 CONs, determining the older script version with gamestartup and/or
definelevelname is not implemented.

git-svn-id: https://svn.eduke32.com/eduke32@3806 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:29 +00:00
helixhorned 8d74181ddf LunaCON: fix qsprintf, add test code for GAMEVAR_{NODEFAULT,NORESET} flags.
git-svn-id: https://svn.eduke32.com/eduke32@3805 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:27 +00:00
helixhorned 1ee43d5a6e LunaCON: Add -Wall option and sector[].*bunch, warn on some NYI gamevar flags.
git-svn-id: https://svn.eduke32.com/eduke32@3804 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-24 13:54:25 +00:00
helixhorned d966ed7de1 Lunatic: rename con.peractorvar to simply con.actorvar.
NOTE: I'm committing this from my git clone again. If this works OK,
everything is in good order again. If not, I hope that I won't damage
the SVN repo. *Runs away...*

git-svn-id: https://svn.eduke32.com/eduke32@3798 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-20 19:58:54 +00:00
helixhorned 0d79372216 Lunatic: prototypical gamevar serialization, currently very CON-centric.
git-svn-id: https://svn.eduke32.com/eduke32@3796 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-20 19:31:42 +00:00
helixhorned 76299ca635 LunaCON: partially implement {save,load}mapstate CON commands.
What is missing is saving and restoring per-player and per-actor gamevars.
Also add a test CON mutator 'mapstate.con'.

git-svn-id: https://svn.eduke32.com/eduke32@3794 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-20 19:31:34 +00:00
helixhorned 38d12b9441 LunaCON: fix Lua->CON line translation by recreating the line info, too.
git-svn-id: https://svn.eduke32.com/eduke32@3790 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:21 +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 9d858b9883 Lunatic: back up generated LunaCON code, recreate Lua state on map entering.
git-svn-id: https://svn.eduke32.com/eduke32@3787 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-19 19:29:13 +00:00
helixhorned a082ec76dd Lunatic: fix randgen module after md4 removal, run DEFS_BC_SIZE cmd only once.
git-svn-id: https://svn.eduke32.com/eduke32@3785 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-17 10:41:57 +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 3092fb20e7 Lunatic rotatesprite: disallow FULL16 coordinates since Lua numbers are FP.
git-svn-id: https://svn.eduke32.com/eduke32@3770 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-15 18:32:50 +00:00
helixhorned 1296f9ba55 map-text: don't save sector[].wallnum, signal last wall of sector in point2.
git-svn-id: https://svn.eduke32.com/eduke32@3751 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-12 18:51:23 +00:00
helixhorned e9844d2e51 Lunatic: reading of map-text prototype.
Also fixes a couple of oversights (introduced) with the saving.

git-svn-id: https://svn.eduke32.com/eduke32@3736 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-06 19:43:42 +00:00
helixhorned 34af7e6353 Lunatic: move readintostr() into defs_common.lua, fix an oversight.
git-svn-id: https://svn.eduke32.com/eduke32@3734 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-06 19:43:35 +00:00
helixhorned 3b65dc3a78 Lunatic: first prototype of map-text saving.
git-svn-id: https://svn.eduke32.com/eduke32@3733 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-06 19:43:34 +00:00
helixhorned 65a10afbc8 LunaCON: make on-disk gamearray footer contain non-printable chars.
Also, allow writing userdefs[].auto_run.

git-svn-id: https://svn.eduke32.com/eduke32@3732 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-06 19:43:30 +00:00
helixhorned 258e28bafb Map-int VX: rearrange members so that ceiling* and floor* are contiguous.
git-svn-id: https://svn.eduke32.com/eduke32@3731 1a8010ca-5511-0410-912e-c29ae57300e0
2013-05-06 19:43:28 +00:00
helixhorned 3b39a87bd1 Fix a couple of issues identified in the preceding commit.
- In S_PlaySound(), move the sound index bound check above an indexing.
- For A_CheckHitSprite(), and A_FindPlayer(), allow NULL second arg.
- In A_ShootWithZvel(), make some one-letter vars be int32_t, making
  storing safeldist() results in them meaningful.
- In MaybeTrainKillEnemies(), remove two redundant checks and move another
  one further up.
- Comment that SIDEBOLT1 will never be translucent as was probably intended.
- In G_MoveFX(), fix an always-true comparison.

git-svn-id: https://svn.eduke32.com/eduke32@3680 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:13 +00:00
helixhorned 52fc0bdfc5 TROR no-SE7 water: handle projectiles.
Actually, the tweaked code in VM_Move() is not specific to projectiles, so
other sprites now may pass no-SE7 water boundaries too, but it's most noticeable
with projectiles.

git-svn-id: https://svn.eduke32.com/eduke32@3678 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-15 10:48:05 +00:00
helixhorned 0dba35b207 build.lua: add .sectsperbunch to map table, useful for TROR stats w/ findmaps.sh
Also, sync MAXBUNCHES to new limit in lunatic/defs_common.lua.

git-svn-id: https://svn.eduke32.com/eduke32@3665 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-12 11:59:32 +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 7b6bf4dda2 Lunatic: new-generation map format, in-memory representation ("map-int VX").
The Lunatic build compiles with new structures for sector and wall types.
They have separate members for TROR {up,down}{bunch,nextwall}, so there are
no conflicts with other uses of members into which they were previously
shoehorned.  Also, the maximum bunch limit is bumped to 512 in that build.

Currently, loading from V7/8/9 and saving to V7 and V8 are supported.

git-svn-id: https://svn.eduke32.com/eduke32@3658 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-09 17:35:11 +00:00
helixhorned a648522c68 Lunatic: move utility scripts to util/, bittest.lua -> test/test_bitar.lua.
git-svn-id: https://svn.eduke32.com/eduke32@3657 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-09 17:35:03 +00:00
helixhorned d1280de362 Lunatic: fix stuff after last commits; translator: clean up -f parsing code.
Also, implement 'cmenu' in LunaCON, make 'definequote' also allowed as inner
command.

git-svn-id: https://svn.eduke32.com/eduke32@3656 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-09 17:34:53 +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 fb41d91a50 Lunatic: get rid of some now unneeded set-member methods, add others.
git-svn-id: https://svn.eduke32.com/eduke32@3652 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-07 15:20:37 +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 53b01f57c6 Factor out displaying episode ending cutscenes into G_BonusCutscenes().
Also,
 - retire IFWITHIN() macro, preferring expanding it
 - fix _endofgame() in control.lua

git-svn-id: https://svn.eduke32.com/eduke32@3647 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:25 +00:00
helixhorned e638c38c35 LunaCON: gen. cleaner code, make actor[].movflag internal, update listglobals.sh
git-svn-id: https://svn.eduke32.com/eduke32@3646 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:21 +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 023ff8f190 Lunatic: begin gamevar system. Not much there yet.
In Lunatic, gamevars (variables that are saved with savegames) are per-module.

git-svn-id: https://svn.eduke32.com/eduke32@3642 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:53:06 +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 1e21ea3aae LunaCON: fix rotatesprite coordinate check, gen. events to chain at beginning.
git-svn-id: https://svn.eduke32.com/eduke32@3639 1a8010ca-5511-0410-912e-c29ae57300e0
2013-04-05 17:52:50 +00:00
helixhorned cbfd2eb438 In 'tip' display code, extrapolate four more values of the y coord table.
Also, for tip_incs values greater or equal than the number of elements in
this table, return early reporting that the hand has been drawn, so that
the otherwise selected weapon is not drawn.

git-svn-id: https://svn.eduke32.com/eduke32@3630 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-31 18:58:09 +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 85d6526264 Add some test CON files to source/lunatic/test.
The code is mostly by other people, who are credited in the CON files.

git-svn-id: https://svn.eduke32.com/eduke32@3627 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-29 15:59:26 +00:00
helixhorned 53f6d749df Return early from A_IncurDamage() if actor[].picnum ("htpicnum" in CON) is < 0.
With this change, it is impossible for negative values to be used as array
indices inside this function, and I believe that it is also impossible that
they escape to somewhere they might be used as such.

For Lunatic, allow setting actor[].picnum to negative values and in the
translator, add (commented out) code to warn whenever it is set to a constant
negative value.  Also, fix a _sound call in _addphealth in control.lua.

git-svn-id: https://svn.eduke32.com/eduke32@3626 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-29 15:59:23 +00:00
hendricks266 9d3b96a636 LunaCON: Properly implement rotatesprite16 by adding ROTATESPRITE_FULL16 to orientation.
git-svn-id: https://svn.eduke32.com/eduke32@3611 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-25 19:19:05 +00:00
hendricks266 30f510d521 Add "rotatespritea" to CON and M32script.
I hope I didn't bruise Lunatic too much.

git-svn-id: https://svn.eduke32.com/eduke32@3610 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-25 04:33:03 +00:00
hendricks266 c5044b3ecd Add orientation bit 2048, enumerated as ROTATESPRITE_FULL16, which is a courtesy provided by the engine for the purpose of the game to internally force use of full 32-bit coordinates. With this bit set, all CON screen drawing commands can use rotatesprite16-like coordinates.
While the functionality was already internally in place for gametext as one of two hacks using ROTATESPRITE_MAX (the other still used by minitext_() to align with the statusbar) we must codify a bit in the engine for safe external use. (Otherwise, ROTATESPRITE_MAX could/would theoretically increase and leave modders high and dry.)

(Dev note: In G_DrawTXDigiNumZ(), ROTATESPRITE_MAX was used to bitshift the value used to calculate digit spacing for no reason I can ascertain other than to introduce rounding errors into the zoom/textscale calculations. It was never used anywhere, so I removed it.)

Bonus: The scaling code for digitalnumberz and gametextz has been modified so that the spacing is no longer affected by rounding errors. Try animating the zoom value and compare how the text used to jump but now does not.

git-svn-id: https://svn.eduke32.com/eduke32@3608 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-25 04:31:58 +00:00
helixhorned 8d2a60ff70 Lunatic translator: proper Lua->CON line mapping for actor/event/etc. headers.
git-svn-id: https://svn.eduke32.com/eduke32@3604 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:55:27 +00:00
helixhorned 3a1c590572 LunaCON: readarrayfromfile: fail silently if file can't be opened.
git-svn-id: https://svn.eduke32.com/eduke32@3602 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:55:05 +00:00
helixhorned c7d97d55ec Lunatic: simplify RETURN handling, make its behavior across events same as C-CON.
There's only one RETURN value on the C side (g_RETURN), which is also referenced
from Lua.  Upon entering an event, its value takes on the per-event default one,
and its value when the event code finishes is passed back to the game.
Independently of that, its value is always saved and restored across event calls.

git-svn-id: https://svn.eduke32.com/eduke32@3601 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:54:56 +00:00
helixhorned 57416c541a Lunatic: add LuaJIT's 'dump' module, printing traced bytecode, IR and mcode.
git-svn-id: https://svn.eduke32.com/eduke32@3600 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:54:14 +00:00
helixhorned c5e76e73f3 Lunatic t.: don't error on changing stat/sect of sprite not in the game world.
git-svn-id: https://svn.eduke32.com/eduke32@3598 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:48 +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 290eb3a962 Lunatic: make some variables local, fix some bugs found using listglobals.sh.
git-svn-id: https://svn.eduke32.com/eduke32@3596 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:14 +00:00
helixhorned ea118fe436 Lunatic: fix weapondata_t read access, Lua->CON line mapping for if* commands.
git-svn-id: https://svn.eduke32.com/eduke32@3595 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:53:06 +00:00
helixhorned b7ea1cb205 Lunatic: in readgamearray support code, use engine file functions.
This is so that files residing in GRPs (or anywhere the engine looks for them)
can be read, too.

git-svn-id: https://svn.eduke32.com/eduke32@3594 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:52:52 +00:00
helixhorned 3e4a0dadf5 Lunatic: cancel logo on EVENT_LOGO error, fix CON mulscale and writable gv.
git-svn-id: https://svn.eduke32.com/eduke32@3593 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-24 18:52:41 +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 700d9cef0c Lunatic: slightly cleaner weapondata_t access.
Also, for the embedded translator: don't warn on unrecognized command line opt.

git-svn-id: https://svn.eduke32.com/eduke32@3590 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-21 10:20:20 +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 cec987631a Lunatic: properly protect weapondata_t members, fix Lua->CON line mapping.
Also, make -Werror-bad-getactorvar disabled by default.

git-svn-id: https://svn.eduke32.com/eduke32@3574 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-18 22:05:26 +00:00
helixhorned c397759217 Fix Lunatic build on Windows.
- Make _buildargv[_buildargc] NULL.
- With SDL layer, pass argv and argc directly and get rid of _build* ones.
- Add tilesiz* to dynsymlists.

git-svn-id: https://svn.eduke32.com/eduke32@3573 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-18 22:05:21 +00:00
helixhorned 38ee330c93 Lunatic translator embedded: handle command line arguments.
Also, fix an error() call in control.lua:gamearray_file_common().

git-svn-id: https://svn.eduke32.com/eduke32@3572 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:58 +00:00
helixhorned d909173065 Lunatic t.: allow hex literals with >9 digits if the high ones are all 'F's.
(Or '0's, but that case is handled automatically.) The resulting generated
number is taken by looking at the 8 lower nibbles and interpreting them as
a signed 32-bit integer.
Also add some number parsing tests to test/nlcf_break.con.

git-svn-id: https://svn.eduke32.com/eduke32@3571 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:53 +00:00
helixhorned 15d9165199 Lunatic translator: new switch -W(no-)error-bad-getactorvar.
Toggling whether a getactorvar for a global or per-player gamevar issues
a warning or a hard error, the latter being the default.
Also, make it possible to readgamevar/savegamevar per-actor gamevars and
add userdefs member "idplayers" (read-only).

git-svn-id: https://svn.eduke32.com/eduke32@3570 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:47 +00:00
helixhorned c7e90f2ed4 Lunatic translator: else if* -> elseif, fix codegen for "if {}".
The first transformation makes the "control structure too long" error appear
only with larger if/else cascades, though it's still possible.

git-svn-id: https://svn.eduke32.com/eduke32@3569 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:44 +00:00
helixhorned 56ea732ccd Lunatic translator: dynamic tile remapping.
Also, fix message when tiles get remapped in debugging builds.

git-svn-id: https://svn.eduke32.com/eduke32@3568 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:38 +00:00
helixhorned 92e85fa0d3 Lunatic translator: music 0, add two userdefs members.
git-svn-id: https://svn.eduke32.com/eduke32@3567 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-17 18:11:27 +00:00
helixhorned 4601b2d203 Add new LOGO_FLAGS bit 2048, preventing cutscene at E4 beginning if set.
git-svn-id: https://svn.eduke32.com/eduke32@3566 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:29 +00:00
helixhorned 90421f0e10 geom.lua: fix copy-paste bugs and clean up code. Remove __eq metamethod.
git-svn-id: https://svn.eduke32.com/eduke32@3565 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:24 +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 9285a9054b Lunatic translator: warn if setting reserved bits in some system gamevar redef.
git-svn-id: https://svn.eduke32.com/eduke32@3563 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:15 +00:00
helixhorned c02199be48 Lunatic: g_tile access, rudimentary system gamearray support for the translator.
The only operation for which proper code is generated is reading a single value
from a system gamearray.

git-svn-id: https://svn.eduke32.com/eduke32@3562 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:11 +00:00
helixhorned 7a58a818ca Lunatic t.: option for generating code caching sprite/actor/player structs...
...at the beginning of each function called back from C, and each case/default
function. Called -fcache-sap. Disabled by default.

git-svn-id: https://svn.eduke32.com/eduke32@3561 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:07 +00:00
helixhorned 0173c0908a Lunatic: spritesof{stat,sect} iterators that allow deletion inside the loop.
Also,
 - an optimization for sprite[]:setpos(). Calls to get_sprite_index()
   seem to be pretty slow (at least when they're not compiled).
 - add getzrange to the dynsymlists

git-svn-id: https://svn.eduke32.com/eduke32@3560 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:56:03 +00:00
helixhorned 83bc10791f Lunatic: correct SFLAG_* and actor_t definitions.
git-svn-id: https://svn.eduke32.com/eduke32@3559 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-15 16:55:59 +00:00
helixhorned f6d1af0532 Lunatic: replace some allocations by static data, some translator fixes.
Fix 'setsprite' and 'music'. A good timing test for actors performance is
the starfield of WGR2's E1L1 ("Nexus").

git-svn-id: https://svn.eduke32.com/eduke32@3558 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-13 10:48:23 +00:00
helixhorned 3b3bc6bc01 Lunatic: also save min, max actor times; fix release build.
git-svn-id: https://svn.eduke32.com/eduke32@3557 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-13 10:48:19 +00:00
helixhorned 6b1df7f1e9 Lunatic translator: handle LOGO_FLAGS.
This is the only gamevar of its kind that is handled for Lunatic, neither
PLR_MORALE nor LOGO_FLAGS are.

git-svn-id: https://svn.eduke32.com/eduke32@3556 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-13 10:48:14 +00:00
helixhorned 0646e41fa4 Lunatic: make con.ai accept literal action/move, check for calling from top.
Also, fix con._setgamepalette.

git-svn-id: https://svn.eduke32.com/eduke32@3541 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:37 +00:00
helixhorned 596b3e6d6a Lunatic translator standalone: option specifying a directory for gen'd code.
The option is -fgendir=<directory>.

git-svn-id: https://svn.eduke32.com/eduke32@3540 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:32 +00:00
helixhorned aeeec9d2aa Lunatic translator standalone: allow specifying list files.
All non-option positional arguments after an @ sign are taken as list files:
hashes at the beginning of a line denote comments, truly empty lines are
ignored, all other lines should contain one root CON file name.

git-svn-id: https://svn.eduke32.com/eduke32@3539 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:28 +00:00
helixhorned deeb6306a9 Lunatic translator: fix some codegen and some commands.
git-svn-id: https://svn.eduke32.com/eduke32@3537 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:22 +00:00
helixhorned bad2da3026 Lunatic translator: in error tracebacks, show line numbers of the source file.
Instead of those of the translated code. Also some codegen tweaks and fixes.

git-svn-id: https://svn.eduke32.com/eduke32@3535 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:16 +00:00
helixhorned ba0970cede Lunatic translator: dangling else for the 1000th time: not dangling any more.
Also update test/dangling_else.con. See there for how if* cascades are handled
in CON. It's actually kind of pretty. Also, take care to handle code deferred
to after the if/if-else properly (ifpdistl, ifpdistg, ifcanseetartet).

git-svn-id: https://svn.eduke32.com/eduke32@3534 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-03 16:06:12 +00:00
helixhorned 8955316bba Lunatic t.: {read,save}gamevar, fix break in nested while, fix rotatesprite16.
git-svn-id: https://svn.eduke32.com/eduke32@3533 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-28 17:30:15 +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 677c585b72 Lunatic translator: fix codegen for "break" inside while loops.
Note: usually, languages call this "continue". Jeez, CON...

git-svn-id: https://svn.eduke32.com/eduke32@3529 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-28 17:29:58 +00:00
helixhorned c5c1aa2331 Lunatic translator: handle RETURN across events.
git-svn-id: https://svn.eduke32.com/eduke32@3526 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-25 15:31:19 +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 b92c487c6f Lunatic translator: codegen fixes, setgamepalette, -fno=onlycheck option.
git-svn-id: https://svn.eduke32.com/eduke32@3523 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-25 15:31:09 +00:00
helixhorned c66b891a38 Lunatic: export C functions that may call into CON events using the Lua C API.
We must not call these functions using the FFI, since the Lua state is
considered locked across such calls.

git-svn-id: https://svn.eduke32.com/eduke32@3520 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:47 +00:00
helixhorned b1320d0ab5 Lunatic: begin fixing up the code because it's now actually live!
git-svn-id: https://svn.eduke32.com/eduke32@3519 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:42 +00:00
helixhorned f730e1242a Lunatic translator: keep states, game{vars, arrays} in tables instead of locals.
Since it's too easy to hit the 200 locals limit.

git-svn-id: https://svn.eduke32.com/eduke32@3518 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:37 +00:00
helixhorned 1685228ab7 Lunatic: compile defs.ilua as bytecode and load it from the executable.
git-svn-id: https://svn.eduke32.com/eduke32@3517 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:31 +00:00
helixhorned acddac64be Lunatic translator: nearing a workable state...
- some more outer commands
- gamearray persistence
- faster 'mod': use math.modf instead of math.fmod (the former is JIT-compiled)
- checkavail*
- THISACTOR special handling
- Fix building in Windows (export A_ShootWithZvel instead of A_Shoot).

git-svn-id: https://svn.eduke32.com/eduke32@3516 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-24 16:05:22 +00:00
helixhorned b0a8a381c8 Lunatic translator: eventloadactor.
git-svn-id: https://svn.eduke32.com/eduke32@3515 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-21 18:54:13 +00:00
helixhorned a83b2fee95 Lunatic translator: switch statement.
git-svn-id: https://svn.eduke32.com/eduke32@3513 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-21 18:54:02 +00:00
helixhorned e6fd95dde8 Lunatic translator: qgetsysstr.
git-svn-id: https://svn.eduke32.com/eduke32@3512 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-21 18:53:57 +00:00
helixhorned db2c24b7ef Lunatic translator: fix quote commands, taking care of corner cases. Add test.
git-svn-id: https://svn.eduke32.com/eduke32@3511 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-21 18:53:49 +00:00
helixhorned d1442ac88e Lunatic translator: qsprintf.
git-svn-id: https://svn.eduke32.com/eduke32@3507 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:59 +00:00
helixhorned 8637a7aa22 Lunatic translator: a couple of quote commands, while*n.
git-svn-id: https://svn.eduke32.com/eduke32@3504 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:51 +00:00
helixhorned fd2790da82 Lunatic translator: gamearrays.
git-svn-id: https://svn.eduke32.com/eduke32@3503 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-18 16:07:48 +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 3665fde85b Lunatic: more commands...
git-svn-id: https://svn.eduke32.com/eduke32@3491 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-16 18:53:24 +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
helixhorned 6cd3b9f4fc Lunatic: xmath module + timing test for distance functions.
git-svn-id: https://svn.eduke32.com/eduke32@3488 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-16 18:53:09 +00:00
helixhorned b489a62a93 Lunatic (translator): more commands, add some "length" methods to vec* types.
git-svn-id: https://svn.eduke32.com/eduke32@3487 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-16 18:53:04 +00:00
helixhorned 126b7257c0 Lunatic translator: more of everything...
git-svn-id: https://svn.eduke32.com/eduke32@3480 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-11 17:16:58 +00:00
helixhorned 200cd75275 Make g_earthquakeTime into a uint16_t, remove DukePlayer_t's name[] member.
Bump BYTEVERSION.

git-svn-id: https://svn.eduke32.com/eduke32@3478 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-11 17:16:50 +00:00
helixhorned 605de9f6d1 Lunatic: input access.
git-svn-id: https://svn.eduke32.com/eduke32@3477 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:24:44 +00:00
helixhorned fab00b4750 Lunatic: sprite.change{sect,stat}, access to more members, member read test.
git-svn-id: https://svn.eduke32.com/eduke32@3475 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:24:32 +00:00
helixhorned 4f3b139479 Lunatic translator: userdef access.
git-svn-id: https://svn.eduke32.com/eduke32@3473 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:24:20 +00:00
helixhorned 35802d7e41 Lunatic: [gs]et{player,actor}var, access to protected projectile members.
git-svn-id: https://svn.eduke32.com/eduke32@3469 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:23:59 +00:00
helixhorned 90793f6a67 Lunatic: working tsprite methods, static members, struct array timing test.
git-svn-id: https://svn.eduke32.com/eduke32@3468 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-10 16:23:54 +00:00
helixhorned 5e4edcaaa8 Lunatic (translator): thisprojectile, *shoot.
git-svn-id: https://svn.eduke32.com/eduke32@3466 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:01:18 +00:00
helixhorned 7c861cac42 Rework how the z velocity is passed from *zshoot to A_Shoot().
Previously, actor[].shootzvel (implementation detail, not available to CON)
was checked, and if it was !=0, that was the overridden velocity. The value
0 meant "hardcoded, projectile-dependent velocity". But that neccesiated a
hack where if zvel 0 was passed and really meant, it needed to be set to
1 instead.  Now we have A_ShootWithZvel() taking an additional last argument
plus a macro SHOOT_HARDCODED_ZVEL permissible for that argument.

git-svn-id: https://svn.eduke32.com/eduke32@3465 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:01:12 +00:00
helixhorned b92edcc798 Lunatic: projectiles...
git-svn-id: https://svn.eduke32.com/eduke32@3463 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-07 21:01:03 +00:00
helixhorned 728ae2bb76 Lose the packed attribute on / rearrange some game struct types.
actors.h: remove 'packed' from projectile_t, tiledata_t. In tiledata_t,
 make .cacherange member an int32_t so that the following member
 "projectile_t defproj" is aligned on a 4-byte boundary.
player.h: remove 'packed' from playerspawn_t, DukeStatus_t, input_t.
In Lunatic, correct packing attribute of the base type of the unrestricted
actor_t and DukePlayer_t pointer types (the declaration was used without

Bump BYTEVERSION.

git-svn-id: https://svn.eduke32.com/eduke32@3458 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-03 12:48:25 +00:00
helixhorned d82b198799 Lunatic: conditionally compile out more legacy code, remove old mixed mode code.
git-svn-id: https://svn.eduke32.com/eduke32@3456 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-03 12:48:17 +00:00
helixhorned 4e5cdba646 Lose the 'packed' attribute for types declared in build.h.
Most of them are already aligned to their natural boundaries, so lowering
the alignment to 1 byte can only worsen things by making the C compiler
generate poorer (unaligned access) code for some platforms.

The layout of structures is not specified by the C Standard, but is rather
given by a particular platform + toolchain's ABI (application binary interface).
Most ABIs follow the expected pattern "alignment of scalars is their size,
alignment of arrays is that of its element type, alignment of structs is the
maximum alignment of its members". A couple of links to particular ABIs are
given in build.h.

Problems are expected with archs that care about unaligned access when a pointer
to a non-packed struct is taken that resides in a packed aggregate, but these
uses should be weeded out (I'm not sure if there are any in our codebase).

The following types are affected, only hitdata_t changes its size:
sectortype, walltype, spritetype, spriteext_t, spritesmooth_t,
struct validmode_t, picanm_t, palette_t, vec2_t, vec3_t, hitdata_t.

git-svn-id: https://svn.eduke32.com/eduke32@3455 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-03 12:48:11 +00:00
helixhorned d5c62b7de3 Lunatic translator: codegen for actor-tsprite accesses, sync some RO members.
git-svn-id: https://svn.eduke32.com/eduke32@3454 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-03 12:48:06 +00:00
helixhorned 163c019209 Lunatic: provide access to actor-tsprite.
git-svn-id: https://svn.eduke32.com/eduke32@3452 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-01 13:05:20 +00:00
helixhorned 9230ec7ba7 Lunatic (translator): provide checked write access to a couple more members.
git-svn-id: https://svn.eduke32.com/eduke32@3446 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-01 13:05:00 +00:00
helixhorned 627c0625ae Lunatic: Centralize all bound-checking in bcheck.lua.
git-svn-id: https://svn.eduke32.com/eduke32@3445 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-01 13:04:56 +00:00
helixhorned f95b6fddb5 Lunatic translator: codegen for some "method-like" member write accesses.
git-svn-id: https://svn.eduke32.com/eduke32@3444 1a8010ca-5511-0410-912e-c29ae57300e0
2013-02-01 13:04:52 +00:00
helixhorned c0ebbbbb42 Lunatic translator: a couple of set-struct commands, "-I" option for default dir.
git-svn-id: https://svn.eduke32.com/eduke32@3439 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:08:02 +00:00
helixhorned 385095be76 Lunatic: prefer to use ctype objects instead of C type strings.
Pass types via ffi.typeof() instead of declaring them in the
global namespace when possible.

git-svn-id: https://svn.eduke32.com/eduke32@3437 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:07:53 +00:00
helixhorned ba8c6e487d Lunatic: use bcarray types to guard accesses to arrays inside structs.
git-svn-id: https://svn.eduke32.com/eduke32@3435 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:07:44 +00:00
helixhorned ddc2104065 Add bcarray.lua, implementing a factory for bound-checked array types.
git-svn-id: https://svn.eduke32.com/eduke32@3434 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-26 17:07:40 +00:00
helixhorned 91047d6d90 Lunatic translator: struct read access.
git-svn-id: https://svn.eduke32.com/eduke32@3433 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-24 20:03:10 +00:00
helixhorned faae812293 Lunatic translator: prototypical array/struct access, for reference only.
git-svn-id: https://svn.eduke32.com/eduke32@3432 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-24 20:03:06 +00:00
helixhorned 79384f0e79 Lunatic: a little bit of everything.
git-svn-id: https://svn.eduke32.com/eduke32@3431 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-24 20:03:02 +00:00
helixhorned 34c9bc8489 Lunatic: sync with preceding change, complete two commands.
git-svn-id: https://svn.eduke32.com/eduke32@3430 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-24 20:02:57 +00:00
helixhorned f10063eec3 Lunatic: sync with preceding change, fix r3419.
git-svn-id: https://svn.eduke32.com/eduke32@3427 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-23 19:36:48 +00:00
helixhorned c927de54b1 Lunatic translator: handle overriding system GVs.
git-svn-id: https://svn.eduke32.com/eduke32@3419 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-20 21:17:23 +00:00
helixhorned 142e36d6f4 Lunatic: cmdline switch to run test script, compile out more code, 2 more GVs.
git-svn-id: https://svn.eduke32.com/eduke32@3415 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-20 21:17:06 +00:00
helixhorned d63ddb6e39 Lunatic translator: more of the same.
- more predefined vars
- fix recursive states and ones with a stray "else" before the end

git-svn-id: https://svn.eduke32.com/eduke32@3409 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:55 +00:00
helixhorned fb1db25c4e Consolidate badly named HUD weapon globals ("g_looking_angSR1") into struct.
git-svn-id: https://svn.eduke32.com/eduke32@3408 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:48 +00:00
helixhorned 7acd1ad743 Lunatic: more convenient weapon data access.
git-svn-id: https://svn.eduke32.com/eduke32@3407 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:43 +00:00
helixhorned fbaa00665d Lunatic: various.
- Fix "gv" access.
- camera
- translator: comparison predicates, predefs...

git-svn-id: https://svn.eduke32.com/eduke32@3406 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:40 +00:00
helixhorned c9190e79ae Wrap some ud.camera* and g_camera{Distance,Clock} into CAMERA* macros.
In Lunatic, make it a struct type "camera_t" instead.

git-svn-id: https://svn.eduke32.com/eduke32@3405 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-19 18:28:32 +00:00
helixhorned 39ce7aee62 Lunatic: codegen beyond milestone 1.
- weapon data
- changing ones... (locals for now)
- operators

git-svn-id: https://svn.eduke32.com/eduke32@3392 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-13 16:40:32 +00:00
helixhorned 417dc33769 Lunatic translator: slight code reorganization to prevent too many local vars.
git-svn-id: https://svn.eduke32.com/eduke32@3391 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-13 16:40:26 +00:00
helixhorned 8e5d5f9b89 Lunatic: begin changing ones...
git-svn-id: https://svn.eduke32.com/eduke32@3390 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-13 16:40:21 +00:00
helixhorned 56ef10c893 Lunatic translator: handle -mx.
git-svn-id: https://svn.eduke32.com/eduke32@3388 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-13 16:40:07 +00:00
helixhorned 51c5afaae6 Lunatic: a couple of small changes.
git-svn-id: https://svn.eduke32.com/eduke32@3380 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-06 18:56:45 +00:00
helixhorned 8ed4667265 Lunatic: grabbag of different things.
- fix error handing with recursing events
- wallsofsect iterator, sector[]:contains()
- more codegen; mangle function names
- m32: compinside

git-svn-id: https://svn.eduke32.com/eduke32@3375 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-05 13:09:31 +00:00
helixhorned e72557d9d9 Lunatic translator: dangling else, hopefully for the last time!
git-svn-id: https://svn.eduke32.com/eduke32@3374 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-05 13:09:25 +00:00
helixhorned 50f5a2340f Lunatic: more commands, mostly of the define* variety.
git-svn-id: https://svn.eduke32.com/eduke32@3373 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-05 13:09:19 +00:00
helixhorned 0c44056945 Lunatic: getting closer to the first milestone.
On the C side, zrange, angrange and autoaimang are represented as
DukePlayer_t members then.

git-svn-id: https://svn.eduke32.com/eduke32@3366 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-02 22:33:37 +00:00
helixhorned e4caa58cf2 Move DukePlayer_t's .palette down so that 2-byte-sized members are 2-byte-aligned.
Bump BYTEVERSION.

git-svn-id: https://svn.eduke32.com/eduke32@3363 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-02 22:33:22 +00:00
helixhorned eda5b22030 Lunatic: more code...
git-svn-id: https://svn.eduke32.com/eduke32@3357 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:28 +00:00
helixhorned 311967f425 Lunatic: definesound, more control.lua fixes.
git-svn-id: https://svn.eduke32.com/eduke32@3355 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:22 +00:00
helixhorned 25f6255d28 Lunatic: fix stack discipline.
Preventing a continuously growing stack top and inevitable program termination.
Also, commonize the error handling to live on the engine side.

git-svn-id: https://svn.eduke32.com/eduke32@3352 1a8010ca-5511-0410-912e-c29ae57300e0
2013-01-01 15:24:11 +00:00
helixhorned 5fc9bb9779 Lunatic: more glue, fixes, backtrace for code called back from C.
git-svn-id: https://svn.eduke32.com/eduke32@3345 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 15:21:32 +00:00
helixhorned 80ee967b8e Lunatic: beginning to glue things together. Introducing LUNATIC_ONLY.
git-svn-id: https://svn.eduke32.com/eduke32@3343 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 15:21:24 +00:00
helixhorned 7d1879b777 Fix LTO=1 RELEASE=1 Lunatic build.
git-svn-id: https://svn.eduke32.com/eduke32@3341 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-29 15:21:16 +00:00
helixhorned 279a197e27 Lunatic translator: pack all translation units into one big blob.
git-svn-id: https://svn.eduke32.com/eduke32@3325 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-28 17:18:06 +00:00
helixhorned cc090a2ea8 Lunatic: sinking in code.
git-svn-id: https://svn.eduke32.com/eduke32@3324 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-28 17:18:02 +00:00
helixhorned fa2ac57674 Lunatic: event chaining.
git-svn-id: https://svn.eduke32.com/eduke32@3320 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-25 16:13:45 +00:00
helixhorned 41bfa1b841 Lunatic: print -> OSD_Printf, error reporting.
git-svn-id: https://svn.eduke32.com/eduke32@3319 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-25 16:13:41 +00:00
helixhorned 596b83aec1 Add a couple of test CONs: non-local control flow, rotation-fixed useractors.
git-svn-id: https://svn.eduke32.com/eduke32@3317 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-23 19:24:25 +00:00
helixhorned 4ea9f799b1 Lunatic: more complete gameactor(), misc. translator tweaks.
git-svn-id: https://svn.eduke32.com/eduke32@3315 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-23 19:24:16 +00:00
helixhorned 48c47af5dc Pack actor_t's bposx/bposy/bposz members into a vec3_t named "bpos".
git-svn-id: https://svn.eduke32.com/eduke32@3314 1a8010ca-5511-0410-912e-c29ae57300e0
2012-12-23 14:00:08 +00:00