Commit Graph

2764 Commits

Author SHA1 Message Date
hendricks266 c1bbf25700 Fix the long-standing trivial warnings in net.c.
Cognitively, so much time has passed that these unused variables would offer little help indicating the roadmap for networking. In any case, I have taken care only to comment rather than remove anything that is more than just a throwaway loop counter.

If this commit inconveniences anyone in any way, please contact me personally and I will make it right.

git-svn-id: https://svn.eduke32.com/eduke32@4079 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-07 10:03:23 +00:00
hendricks266 612284cfea Improve SDL2 support as much as I can, for now. The game compiles, links, and starts, but all three renderers either don't display correctly or crash.
To build with SDL2: make RENDERTYPE=SDL SDL_TARGET=2

git-svn-id: https://svn.eduke32.com/eduke32@4074 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-06 07:49:53 +00:00
hendricks266 a831f408e4 Fix building of astub.c with MinGW 4.8.
We have to work around namespace pollution in <sys/stat.h>.

git-svn-id: https://svn.eduke32.com/eduke32@4072 1a8010ca-5511-0410-912e-c29ae57300e0
2013-10-06 07:49:10 +00:00
helixhorned b2503da051 Lunatic: rename hitdata_t member 'sect' to 'sector' for consistency. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4071 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-22 12:42:06 +00:00
helixhorned 9d21cff5d3 Lunatic: document xmath.kangvec() and hitscan().
git-svn-id: https://svn.eduke32.com/eduke32@4070 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-22 12:42:00 +00:00
helixhorned f30cc01a7a In C++ build, fix "narrowing conversion inside { } is ill-formed" warning.
This also exposes an actual issue. The sound definitions may be dynamically
remapped, in which case they are not necessarily <=255 any more.

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4069 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-21 13:38:56 +00:00
helixhorned 514a3bfd64 Prevent calling function pointers cast to an incompatible type.
Most often, this had happened when casting comparison functions for qsort()
like these: "int yax_cmpbunches(const int16_t *b1, const int16_t *b2)"
to a function pointer type expecting "const void *". Alas, this is undefined
behavior: see
http://blog.frama-c.com/index.php?post/2013/08/24/Function-pointers-in-C
and posts linked from it.

At least two cases have not been fixed:
- The savegame system maintains pointers which are either to data or a function in
  the generic "void *". This ought to be made into a union.
- Probably also:
  #define OSD_ALIAS     (int32_t (*)(const osdfuncparm_t*))0x1337

git-svn-id: https://svn.eduke32.com/eduke32@4068 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-21 13:38:44 +00:00
helixhorned d2cd8af510 Minor changes for Lunatic utils, replace missed sound flag literals with macros.
git-svn-id: https://svn.eduke32.com/eduke32@4067 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-21 13:38:07 +00:00
terminx d5b6496ddb Additional fix for the shareware version
git-svn-id: https://svn.eduke32.com/eduke32@4065 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-15 17:59:21 +00:00
terminx 95cf4ec90b Fix shareware version breakage introduced in r3913
git-svn-id: https://svn.eduke32.com/eduke32@4064 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-15 16:00:55 +00:00
helixhorned e94fa7f70f Lunatic: make hitscan accept ray as vector, add xmath.kangvec.
Also, add hitscan test to test.lua -- a crosshair-like sprite is spawned
and continuously updated to the position of where the player aims at.

git-svn-id: https://svn.eduke32.com/eduke32@4059 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-13 20:23:54 +00:00
helixhorned 694975b2f5 Polymost: make spriteext[].{x,y,z}off independent of xdimen/viewingrange/aspect.
The offsets (that will translate the axes for .pitch/.roll rotation) were
calculated improperly with screen sizes other than 1280 x 1024 and were
dependent on other related variables. The fix proceeded empirically, i.e. mostly
trial, error, and some educated guesswork. (It's telling that the magic constant
1280 is needed.)  A test for Lunatic is added to test.lua that will rotate
SEENINES.
Bug pointed out by Mblackwell.

git-svn-id: https://svn.eduke32.com/eduke32@4058 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-13 20:23:45 +00:00
terminx 1baf9fa275 Add -usecwd parameter on Windows, to disable searching for Megaton Edition or GOG.com game data
git-svn-id: https://svn.eduke32.com/eduke32@4057 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-10 22:41:19 +00:00
helixhorned f64fdf3384 Add foreachmap.lua module 'colenemy', allow passing module name to findmaps.sh.
The 'colenemy' module searches for colored enemies in maps, excluding pal-21
liztroops. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4056 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-10 19:17:06 +00:00
helixhorned 14467dec24 Replace literal g_sounds[].m bits with enum constants. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4055 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-08 20:18:56 +00:00
helixhorned 28d99e9658 Lunatic doc: add some text and examples for using require()/module().
git-svn-id: https://svn.eduke32.com/eduke32@4054 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-08 20:18:51 +00:00
helixhorned 2065cc911f Lunatic: document gv.getangle(), -Lopts=strict, sec:zrangeat(). DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4053 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-06 14:43:21 +00:00
helixhorned 7f37ac1303 Lunatic: r/w gamearrays in binary mode, checks for mapdiff.sh, add test/gamearray.con.
git-svn-id: https://svn.eduke32.com/eduke32@4052 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-06 14:43:20 +00:00
helixhorned eef1977662 Lunatic/util: fixes for Windows.
- Need to open some files in binary mode.
- MinGW's "find" doesn't provide -L option, detect that.

git-svn-id: https://svn.eduke32.com/eduke32@4051 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-06 14:43:17 +00:00
helixhorned 85aa90d82c Lunatic: make -Lopts=strict also error on some table reads w/ nonexistent keys.
Specifically, for the tables returned with require"DEFS" etc. This allows to
check if maybe parts of a bundle of files is missing (because comparisons like
"spr.picnum == D.NONEXISTENT_NAME" do not yield errors normally).

git-svn-id: https://svn.eduke32.com/eduke32@4050 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:47 +00:00
helixhorned 1328c66f9c Lunatic: add option -Lopts=... from command line.
Permitting to enable various debugging options. See "eduke32 -debughelp"
for which ones those are: they were previously settable from defs_common.lua,
and a new option 'strict' has been added that makes accesses to void sprites
error. (That is, already "sprite[i]", not "sprite[i].some_member".)

git-svn-id: https://svn.eduke32.com/eduke32@4049 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:46 +00:00
helixhorned d48383d2f7 A couple of minor changes.
- engine.c: comment out some unused decls with RELEASE=0 DEBUGANYWAY=1
- Lunatic: update dump.lua and v.lua
- Lunatic: test/test_geom.lua: note a perf regression (wrt older LuaJIT,
  or I mis-configured / built something wrong)

git-svn-id: https://svn.eduke32.com/eduke32@4048 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:44 +00:00
helixhorned 1b7c622f31 Lunatic: fix _digitalnumber, remove player._INPUT_BITS, add sprite.all().
git-svn-id: https://svn.eduke32.com/eduke32@4047 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:42 +00:00
helixhorned 3b69417792 util/build.lua: lose packing, use fread(), make bound-check nan-safe.
git-svn-id: https://svn.eduke32.com/eduke32@4046 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:40 +00:00
helixhorned 7543ba7226 premap.c: delete GPSPEED/CYCLERs only after the loop with EVENT_LOADACTOR events
git-svn-id: https://svn.eduke32.com/eduke32@4045 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:38 +00:00
helixhorned e402467676 Lunatic: gv.getangle() vs. analogous Lua function test, add some anchors to doc.
Also, in listglobals.sh, check for file existence.

git-svn-id: https://svn.eduke32.com/eduke32@4044 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:36 +00:00
helixhorned 40a2e1da24 Lunatic: in control.lua, use C's fwrite() to write gamearray to disk, fix typo.
git-svn-id: https://svn.eduke32.com/eduke32@4043 1a8010ca-5511-0410-912e-c29ae57300e0
2013-09-05 17:37:35 +00:00
terminx 603fbf7cb5 Update the info displayed in the "details" tab of the application properties dialog in Windows--change copyright date to 2013, update Duke Nukem trademark ownership from Apogee Software, Ltd to Gearbox Software, LLC
git-svn-id: https://svn.eduke32.com/eduke32@4040 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-31 04:57:46 +00:00
helixhorned 6ac486c9ee Lunatic doc: move icons to doc/ root, as they were not showing up properly online.
That is, here: http://lunatic.eduke32.com/ or more specifically in lunatic.html.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4036 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:19 +00:00
helixhorned ddea95c31b Lunatic doc: add appendix with hints on how to read Programming in Lua, 1st ed.
git-svn-id: https://svn.eduke32.com/eduke32@4035 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:16 +00:00
helixhorned e0e3973b47 Bounds-check the tile number gotten from EVENT_GETMENUTILE.
git-svn-id: https://svn.eduke32.com/eduke32@4034 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:14 +00:00
helixhorned 4f699a2f21 Lunatic: update documentation a bit.
- add gv.GET, gv.WEAPON, gv.RETURN
- specify that sprite[].x/y/z and wall[].x/y are 32-bit ints
- add an example for con.longjmp()
- add an appendix listing the RETURN usage of various events

git-svn-id: https://svn.eduke32.com/eduke32@4032 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:12 +00:00
helixhorned 15bcfe3f34 Lunatic: on the Lua side, rename gv.g_RETURN to the prettier gv.RETURN.
On the C side, keep the name g_RETURN. I'm still superstitious about
dropping the "g_".

git-svn-id: https://svn.eduke32.com/eduke32@4031 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:10 +00:00
helixhorned 55a3cda9e1 Lunatic: retire gv.*_WEAPON and gv.GET_* for gv.WEAPON.* and gv.GET.*.
git-svn-id: https://svn.eduke32.com/eduke32@4030 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:09 +00:00
helixhorned 0a06ca29f2 Lunatic: fix passing some string members to con.action(), rewrite conststruct().
... by creating a struct with 'static const int' members, as recommended on
http://www.freelists.org/post/luajit/Performance-implications-of-large-FFI-constants,4

git-svn-id: https://svn.eduke32.com/eduke32@4029 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-23 17:01:04 +00:00
terminx e8c2250d0a Rip out all traces of nedmalloc. Sorry, XP users--it's time to upgrade to something newer than an OS from 2001 if this affects you.
git-svn-id: https://svn.eduke32.com/eduke32@4027 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-20 21:49:44 +00:00
helixhorned e53c50e6aa LunaCON: allow a certain type error present in 1.3D GAME.CON to pass.
git-svn-id: https://svn.eduke32.com/eduke32@4025 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-19 19:26:58 +00:00
helixhorned 9acb219721 Lunatic: a couple of trivial changes.
git-svn-id: https://svn.eduke32.com/eduke32@4021 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-18 19:24:25 +00:00
terminx ba4cfe704c Fix issue with PIPEBOMB_CONTROL mode 2, reported at http://forums.duke4.net/topic/6721-grenade-lifetime
git-svn-id: https://svn.eduke32.com/eduke32@4019 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-17 22:48:31 +00:00
helixhorned 171226c7ac game.c: remove dead bounds check for cheatbuf[], add assertion.
The check is dead because it is made after the fact (oob access), but the
cheat string matching logic below actually assures that
cheatbuflen < sizeof(cheatbuf) at all times.
Exposed using the Stack tool from http://css.csail.mit.edu/stack/ .
Also, in gamedef.c's definecheat handling, print the string length (19), not
the buffer length (20) if the cheat was truncated.

git-svn-id: https://svn.eduke32.com/eduke32@4016 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:20 +00:00
helixhorned 7a9e9fada4 When issuing "setrendmode" OSD command with mismatched vidmode, auto-switch.
git-svn-id: https://svn.eduke32.com/eduke32@4015 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:19 +00:00
helixhorned 4b44063853 Fix taking address out of bounds of stack'd array, introduced in r3983.
Clang's UBSan reports this as undefined behavior. I think that the reason
is as follows: C99 6.5.3.2#1 (Constraints) says:

 The operand of the unary & operator shall be either a function designator, the
 result of a [] or unary * operator, or an lvalue that designates an object that
 is not a bit-field and is not declared with the register storage-class specifier.

But in case of an expression like "&array[-1]", the operand ("array[-1]") does
not designate a valid object.

Moral: check first -- assure that an expression is valid for a particular
operation before carrying it out. Keep in mind that otherwise, the compiler
is absolutely free to optimize out the *check*.

git-svn-id: https://svn.eduke32.com/eduke32@4014 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:18 +00:00
helixhorned 2aa55e5900 baselayer.c: remove baselayer_onvideomodechange, onvideomodechange.
git-svn-id: https://svn.eduke32.com/eduke32@4013 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:16 +00:00
helixhorned d095ebf9b2 net.c: move a necessary bound check to BEFORE the oob access happening.
Fixes the undefined behavior discussed here:
http://forums.duke4.net/topic/3857-the-crash-thread/page__view__findpost__p__152612

git-svn-id: https://svn.eduke32.com/eduke32@4008 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-12 15:18:10 +00:00
helixhorned ff05fb9b5c Retire MultiPsky_TileToIdx() in favor of engine-side getpskyidx().
DONT_BUILD, because there have been no significant changes of the non-Lua build.

git-svn-id: https://svn.eduke32.com/eduke32@4006 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-11 15:28:51 +00:00
helixhorned af243f1cd6 Lunatic util: add foreachmap module 'plax', looking for maps w/ multiple psky tiles.
In foreachmap.lua, make init() be able to return a start index for cmdline args,
for the case where the run worker script wants to handle options, for example.

git-svn-id: https://svn.eduke32.com/eduke32@4005 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-11 15:28:50 +00:00
helixhorned b6ea2a5c53 Lunatic: sync defs.ilua's user_defs with r3993, adding member MasterVolume.
git-svn-id: https://svn.eduke32.com/eduke32@4004 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-11 15:28:48 +00:00
helixhorned e947f1fe87 Lunatic: prepare Makefiles for synthesis build.
- libs and headers are expected in platform/Windows/* (not there yet)
- prefix Lua #includes with luajit-2.0/
- build bytecode objects with absolute path name (used for debug info)

git-svn-id: https://svn.eduke32.com/eduke32@4000 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-11 15:28:42 +00:00
terminx c9f43383a7 Fix net.h, dunno why MSVC accepts functions that don't match their prototypes without complaining... :p
git-svn-id: https://svn.eduke32.com/eduke32@3996 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-07 14:29:10 +00:00
terminx 67d786f48f Factor some duplicate code into Net_SpawnPlayer(), adjust Net_ExtractPlayerUpdate() a bit.
git-svn-id: https://svn.eduke32.com/eduke32@3994 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-06 23:54:09 +00:00