Commit Graph

1890 Commits

Author SHA1 Message Date
terminx 7afd4c9226 JPG overrun fix from 6/10/14 kplib.c found in poly2vox.zip
git-svn-id: https://svn.eduke32.com/eduke32@4597 1a8010ca-5511-0410-912e-c29ae57300e0
2014-09-30 04:03:44 +00:00
helixhorned 96b3408dbd Mapster32: demote wall check "corruptions" introduced in r4569 to level 2.
The winding of a loop -- with clockdir() -- is determined by examining the
two line segments spanned between the points following a leftmost point of
the loop. If the loop contains a leftmost point that belongs to the "right"
side (as can happen with sliding door constructions), there's a chance that
an outer loop is misclassified.

git-svn-id: https://svn.eduke32.com/eduke32@4580 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-31 11:15:19 +00:00
helixhorned 77dc743f09 Factor out [l]dist() implementations into static inline functions in common.h.
And use these in jmact/mathutil.c's FindDistance2D()/FindDistance3D().
The main use is to allow passing dx/dy instead of sprite positions; the code
that actually uses this is not committed.

git-svn-id: https://svn.eduke32.com/eduke32@4579 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-31 11:15:17 +00:00
helixhorned 1eaf60b222 Classic: introduce two signed integer types, use in engine.c and a-c.c.
They classify former uses of int64_t into two classes:
 - coord_t: those that represent coordinates and need 64-bit precision for
   proper functioning with large values
 - inthi_t: those that were added for e.g. casts merely to prevent undefined
   behavior on overflow

DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4578 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-23 10:28:18 +00:00
helixhorned 81d3e4db73 pragmas.h: introduce preprocessor switch USE_ASM_DIVSCALE, for testing only.
git-svn-id: https://svn.eduke32.com/eduke32@4577 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-23 10:28:17 +00:00
helixhorned fb7fb403e0 engine.c: prevent a 64-bit multiply in dosetaspect(). DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4576 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-23 09:00:36 +00:00
helixhorned ceaa661304 Properly consider sprites with a clipshape as bridge (p->spritebridge).
git-svn-id: https://svn.eduke32.com/eduke32@4574 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-17 19:42:01 +00:00
helixhorned 63916ee8d1 Mapster32: fix possible integer overflow in loopinside().
This could happen when building outside the "classic" grid limits and would
then lead to e.g. incorrect loop assignment on sector splitting. Bug reported
by MetHy.

git-svn-id: https://svn.eduke32.com/eduke32@4572 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-16 18:32:47 +00:00
helixhorned 363f0b3af6 Mapster32: prototypical checker for wall loops, enabled partially.
Inspired by
 http://forums.duke4.net/topic/7506-tror-question/page__view__findpost__p__199151
the corruption checker now checks for certain conditions of the loops of each
sector. Recall that CW loops are outer and CCW loops are inner.

- If a sector has no or more than one outer loop, count that as corruption
  (level 4 and 3, respectively).
- (Disabled) For sectors with exactly one outer loop, check that all inner
  ones are inside it. This is currently not compiled due to an asymmetry of
  loopinside() for degenerate cases, similar to pre-r3898 inside().

git-svn-id: https://svn.eduke32.com/eduke32@4569 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-08 20:02:54 +00:00
helixhorned 21b852cd0d Clean up astub.c:CheckMapCorruption() and some build.c code a little.
There are no intended changes of functionality, it's readability tweaks only.

git-svn-id: https://svn.eduke32.com/eduke32@4568 1a8010ca-5511-0410-912e-c29ae57300e0
2014-08-08 20:02:53 +00:00
hendricks266 b310eaef2c Fix MSVC build.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4566 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 09:00:28 +00:00
hendricks266 9a4a4a627b Nuke rev.h.
Note to MSVC users: You can get the revision number if you run `make rev o=obj` with MinGW before you build.

DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4565 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 08:59:58 +00:00
hendricks266 b0e82d4264 Split parts of loadlookups() into generatefogpals() and fillemptylookups(), and move Duke-specific LOOKUP.DAT behavior to G_LoadLookups() in source/common.c, which contains the call to loadlookups() as factored out from astub.c and game.c.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4564 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:45:53 +00:00
hendricks266 a7fb2721e4 Move code non-specific to Duke Nukem 3D from astub.c to a new m32common.c.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4561 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:44:37 +00:00
hendricks266 16cd8b8aaa Progress towards KenBuild Editor, part 2.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4560 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:44:14 +00:00
hendricks266 5237346f5b Move code non-specific to Duke Nukem 3D from source/common.c to a new build/src/common.c.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4559 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:43:46 +00:00
hendricks266 b48f3b44e3 Progress towards KenBuild Editor, part 1.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4558 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:43:16 +00:00
hendricks266 e8949e1c31 Elimininate some codedup between game.c and astub.c.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4557 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-28 06:42:28 +00:00
hendricks266 4f67f8f969 KenBuild.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4555 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-24 14:01:44 +00:00
hendricks266 e79a2fe828 MSVC build system consolidation.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4553 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-23 07:21:29 +00:00
hendricks266 61f31c36ad Three Mac patches from rhoenie:
-sdlayer: Apple and GTK are not mutually exclusive.
-Makefile.common: Specify WITHOUT_GTK?=1 by default.
-Makefile: Limit linking with the QuickTime framework to OS X 10.6 and below.
One fix from me:
-osxbuild.sh: Fix building tools.

git-svn-id: https://svn.eduke32.com/eduke32@4548 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 11:19:45 +00:00
hendricks266 a5fb5f6795 Handle a concern kludged by SlackBuilds (used by Slackware Linux and NetBSD) where a warning in texcache.c spams the log.
git-svn-id: https://svn.eduke32.com/eduke32@4546 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 11:19:13 +00:00
hendricks266 1f68d2beb6 Apply/replicate patches from OpenBSD to dlopen .so names.
git-svn-id: https://svn.eduke32.com/eduke32@4545 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 11:18:59 +00:00
hendricks266 c1701f9299 Apply unpackssi_64bit_fix.patch from Gentoo Linux, with modifications.
https://bugs.gentoo.org/attachment.cgi?id=342598&action=edit

git-svn-id: https://svn.eduke32.com/eduke32@4544 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 11:18:41 +00:00
hendricks266 b332189ae5 Ball-busting Makefile restructure.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4543 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 07:25:54 +00:00
hendricks266 6ef05fe07c Delete a bunch of crusty old outdated unused files.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4542 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-22 07:25:09 +00:00
hendricks266 c1c01f0e0b Replace the funkily-formatted GNU.TXT with the FSF's official gpl-2.0.txt. Also, update the FSF's address in all source files that contain it.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4541 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-20 08:55:56 +00:00
hendricks266 af28013f39 Lunatic fixes:
1 compiler error.
2 compiler warnings.
1 runtime warning.

Note that at this time, CPLUSPLUS=1 LUNATIC=1 fails to build due to C++ function mangling, and Win64 Lunatic crashes.

DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4540 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-10 09:01:48 +00:00
hendricks266 43eb98fdec Extend ebacktrace in two ways.
1. The application must specify its proper name and technical name. Instead of eduke32_or_mapster32.crash.log, we now have eduke32.crash.log and mapster32.crash.log.
2. The exception handler will display a message box informing the user of a crash and requesting they send in the crash log. The box has three options: "Quit", the DLL's current behavior, "Continue", which passes the exception to the next handler, and "Ignore", which resumes execution immediately. These should allow the user to skip bogus exceptions picked up by ebacktrace, such as one I get with my laptop that causes EDuke32 no issues.

git-svn-id: https://svn.eduke32.com/eduke32@4538 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 22:38:02 +00:00
terminx 06072db493 WIP OSD refactor, committing now before it stops applying cleanly to current svn. This shouldn't break anything in an obvious or major way.
git-svn-id: https://svn.eduke32.com/eduke32@4536 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:12:25 +00:00
terminx d7a3f8e78a Looks like another MSVC build fix
git-svn-id: https://svn.eduke32.com/eduke32@4535 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:11:58 +00:00
terminx 690c0abb16 I don't even remember which platform this fixes building on... probably MSVC. Cleaning out my tree.
git-svn-id: https://svn.eduke32.com/eduke32@4533 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:11:32 +00:00
terminx e4733449fd Add support for pressing backspace to go up one dir in the file selector in Mapster32
git-svn-id: https://svn.eduke32.com/eduke32@4531 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:11:01 +00:00
terminx b81a28b334 Fix MSVC warning caused by r4488
git-svn-id: https://svn.eduke32.com/eduke32@4528 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:10:14 +00:00
terminx 9378066660 lround for MSVC
git-svn-id: https://svn.eduke32.com/eduke32@4527 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-06 00:09:59 +00:00
hendricks266 304a13e259 Fix build with GCC 4.9.
git-svn-id: https://svn.eduke32.com/eduke32@4513 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-16 23:16:23 +00:00
hendricks266 a03f9bce40 Wrap most calls to exit() with a macro that will print the exit status, file name, line number, and function name to the log when using a debug build.
git-svn-id: https://svn.eduke32.com/eduke32@4502 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-13 09:02:37 +00:00
hendricks266 94ccdb076d Fix a recently-introduced C++ error.
git-svn-id: https://svn.eduke32.com/eduke32@4501 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-13 09:01:58 +00:00
Plagman f6dd12ffe5 Test commit to make sure synthesis works.
git-svn-id: https://svn.eduke32.com/eduke32@4500 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-02 02:23:08 +00:00
helixhorned 1e5549dc2f Polymost: r_npotwallmode, emulating 8-bit for walls w/ nonpow2 height textures.
When that mode is enabled (see below for caveats), wall textures that have a
non-power-of-two height (call it 'h') will be modified to look like in classic:
Let 'H' be the next power of two greater than 'h'. The texture will be uploaded
with height 'H', made up from 'h' hlines of the original texture, followed by
'H'-'h' first hlines of the same.
No panning "corrections" will take place. The mode is disabled by default.

Caveats/notes:
 * the mode requires that r_hightile is disabled
 * it is not implemented in Polymer
 * in the Lunatic build, it is ineffective when a VX map is loaded, as those
   display walls with NPOT height textures correctly

git-svn-id: https://svn.eduke32.com/eduke32@4498 1a8010ca-5511-0410-912e-c29ae57300e0
2014-06-01 11:55:19 +00:00
helixhorned 0900f4066c Bye, bye, B*alloc(), all hail X*alloc()! Replace large portion of the calls...
... and cull code that is dead with the X*alloc() versions since they never
return NULL on requesting memory.

Use something like
 git grep '[^Xx]\(m\|c\|re\)alloc *('
and
 git grep '[^Xx]strdup *('
to see places where I left the B*alloc() calls intact.

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4491 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-30 00:02:19 +00:00
helixhorned 1d26121514 Add X{m,c,re}alloc and Xstrdup macros that call an out-of-memory handler on failure.
These wrap the x*alloc or xstrdup functions in compat.c. The handler gets passed
__FILE__, __LINE__ and __func__ (if available) in debugging builds.

Terminating the application process immediately in case of allocation failure
will let us prune many error handling paths and simplify a good portion of code.

git-svn-id: https://svn.eduke32.com/eduke32@4490 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-30 00:02:16 +00:00
helixhorned 95a6c01045 A couple of stylistic cleanups and missed DAMETH_* flags substitutions.
git-svn-id: https://svn.eduke32.com/eduke32@4489 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-30 00:02:14 +00:00
helixhorned 89bbfcbdea Miscellaneous cleanup, still with the same suspects...
- in mdloadskin() and gloadtile_hi(), use new function check_nonpow2()
  (bit-twiddling) instead of loop
- Replace a couple of missed literals with CACHEAD_* enum labels

git-svn-id: https://svn.eduke32.com/eduke32@4488 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:19 +00:00
helixhorned 6fb9929f44 Factor out commonly occuring hictinting[]-accessing code into three functions.
Note: in polymer.c, this was buggy (but harmless) because .r is a char:
  if ((uint32_t)hictinting[MAXPALOOKUPS-1].r & 0xFFFFFF00) != 0xFFFFFF00)

git-svn-id: https://svn.eduke32.com/eduke32@4487 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:17 +00:00
helixhorned 69c867b8e3 Replace various GL rendering related literal flags with enum labels.
- pthtyp pth->flags bits
- Flags of the <dameth> argument of various functions
- hictinting[].f / gloadtile_hi() and daskinloader() <effect> arg bits
- hicreplctyp hicr->flags bits
- texcacheheader cachead.flags bits

git-svn-id: https://svn.eduke32.com/eduke32@4486 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:16 +00:00
helixhorned 2c84d175ed polymost.c: stylistic cleanup in gloadtile_hi, uploadtexture, fixtransparency.
git-svn-id: https://svn.eduke32.com/eduke32@4485 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:15 +00:00
helixhorned dfa9daa5d3 Polymost: in NPOT wall ypanning "correction", behave like Polymer in one corner case.
Specifically, the handling of one-way walls ([1] in Mapster32) was slightly
different.

git-svn-id: https://svn.eduke32.com/eduke32@4484 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-28 22:40:14 +00:00
helixhorned 4ea4bf2ea9 sdlayer.c: for Windows, switch keyboard layout to/from US on init/uninit.
Taking over the code from winlayer.c.

git-svn-id: https://svn.eduke32.com/eduke32@4482 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-24 15:27:53 +00:00
helixhorned 2f6652e59a sdlayer.c: fix compiling wm_ynbox() for Linux/WITHOUT_GTK=1.
git-svn-id: https://svn.eduke32.com/eduke32@4476 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-18 09:55:43 +00:00
hendricks266 a755e95c2c Replace some constants with preprocessor macros.
git-svn-id: https://svn.eduke32.com/eduke32@4472 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-17 12:36:40 +00:00
hendricks266 20bf310cba Fix two Polymer crashes related to corrupted maps.
git-svn-id: https://svn.eduke32.com/eduke32@4471 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-17 12:36:03 +00:00
hendricks266 fe4e93fa1b Add support for an SDL2-based wm_ynbox based on SDL2's testmessage.
git-svn-id: https://svn.eduke32.com/eduke32@4469 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-17 12:35:03 +00:00
Plagman 8f12e0dca0 Revert window fullscreen stuff until we have aspect-correct upscaling
pass.

git-svn-id: https://svn.eduke32.com/eduke32@4466 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-10 21:20:09 +00:00
helixhorned b82b5dc6b7 Mapster32: in e.g. F5 "next free tag" display, note object w/ greatest tag.
git-svn-id: https://svn.eduke32.com/eduke32@4464 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-06 22:15:19 +00:00
helixhorned 6328f461a8 Mapster32: don't read some variables from mapster32.cfg redundant since r4344.
Mostly, these are rendering-related variables. We keep *writing* them to
mapster32.cfg so that older Mapster32 versions can be used side-by-side
for now.

git-svn-id: https://svn.eduke32.com/eduke32@4462 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-03 15:39:24 +00:00
helixhorned 5ca99a812e src/config.c: fix what is apparently a copy-paste typo in readconfig().
git-svn-id: https://svn.eduke32.com/eduke32@4461 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-03 15:39:22 +00:00
helixhorned 1c5da19874 In non-lookup GL modes, if fog is due to fogpal, make fog params indep. of shade.
git-svn-id: https://svn.eduke32.com/eduke32@4460 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-01 22:02:21 +00:00
helixhorned 521176d865 Polymost: make r_usetileshades 2 the default.
This mode does not take a sector's visibility values into account for uniform
darkening of a texture. It is more faithful to classic with respect to
fog/visibility *distances*, but may be less so as far as the "tint" of the
texture due to visibility attenuation is concerned.

git-svn-id: https://svn.eduke32.com/eduke32@4459 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-01 16:55:50 +00:00
helixhorned d180e55234 engine.c: instead of fogpal post-tweaks (last 2 commits), normalize by numshades-1.
That is, for every for palette (now, even ones created by the user) the last
shade is the (or rather, a color close to the) full fog color by construction.
In loadpalette(), reject a PALETTE.DAT with only one shade level.

git-svn-id: https://svn.eduke32.com/eduke32@4458 1a8010ca-5511-0410-912e-c29ae57300e0
2014-05-01 16:55:48 +00:00
helixhorned c697835073 engine.c: extend the last workaround to all four fogpals generated at startup.
git-svn-id: https://svn.eduke32.com/eduke32@4457 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-29 20:07:48 +00:00
helixhorned fc77a8aa3d engine.c: after creating gray fog palookup, make its greatest shade map to same color.
Concretely, for all 1 <= i <= 255, make graypalookup[31][i] := graypalookup[31][0].
Also document 'fogpal' in the Lunatic doc.

git-svn-id: https://svn.eduke32.com/eduke32@4456 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-29 19:34:25 +00:00
helixhorned b7910b1bcf Classic: fix fog/visibility on ceilings.
git-svn-id: https://svn.eduke32.com/eduke32@4455 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-22 18:10:19 +00:00
helixhorned d23ca5bbc5 engine.c: clean up scansector().
git-svn-id: https://svn.eduke32.com/eduke32@4454 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-21 17:00:54 +00:00
helixhorned 653c1b8acd Classic: prevent visibility overflow on sloped ceilings/floors at large distances.
git-svn-id: https://svn.eduke32.com/eduke32@4453 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-21 17:00:51 +00:00
helixhorned 8d9282bc24 Fix r_usenewshading 3 visibility/fog for shades >= Numshades-1 (usually 31).
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4452 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-19 22:42:23 +00:00
helixhorned b4a050b0cf Makefile.common: pass Clang sanitizer flags in release DEBUGANYWAY builds, too.
Also,
 - add a static assertion to engine.c
 - gameexec.c: compile out an unused function in Lunatic builds

git-svn-id: https://svn.eduke32.com/eduke32@4451 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-19 22:42:22 +00:00
helixhorned 66b789376b In G_SavePlayer(), save timers at beginning and restore when finished.
This makes the game not process as many ticks as have elapsed during the saving
afterwards.

git-svn-id: https://svn.eduke32.com/eduke32@4450 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-19 22:42:21 +00:00
Plagman dccf7ebadc Fix crash with GTK+SDL2 on startup and use windowed fullscreen instead of
exclusive fullscreen.

git-svn-id: https://svn.eduke32.com/eduke32@4447 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-19 02:51:33 +00:00
helixhorned 974fd50052 sdlayer.c: fix grabmouse_low() with DEBUGGINGAIDS!=0 builds. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4446 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-18 13:20:56 +00:00
terminx 345300ddbb This seems to need SDL_MAIN_HANDLED in some configurations... not sure why yet.
git-svn-id: https://svn.eduke32.com/eduke32@4444 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-17 20:00:07 +00:00
terminx ced138b578 Move DO_FREE_AND_NULL macro to compat.h
git-svn-id: https://svn.eduke32.com/eduke32@4442 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-17 19:58:31 +00:00
terminx a33f9c2ca1 Simplify mutex wrapper into simply differentiating between RENDERTYPEWIN (which is deprecated...) and everything else, which uses SDL mutexes.
git-svn-id: https://svn.eduke32.com/eduke32@4441 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-17 19:58:07 +00:00
terminx d287b50cd7 Android updates from Emile. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4440 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-15 19:02:48 +00:00
terminx 4815ebaa23 More Android. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4439 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-14 16:30:23 +00:00
terminx 04c466f1f2 OSD scaling fixes (mostly)
git-svn-id: https://svn.eduke32.com/eduke32@4435 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-13 03:19:50 +00:00
terminx 45dec87cf0 Clean up sdlayer a bit
git-svn-id: https://svn.eduke32.com/eduke32@4432 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-12 08:45:26 +00:00
terminx 82f5a3f39c Clamp macros for floats
git-svn-id: https://svn.eduke32.com/eduke32@4431 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-12 08:45:08 +00:00
helixhorned e1845c8d05 In ext. PALETTE.DAT, store log2 of last alpha table index. Handle alpha in classic.
The extended PALETTE.DAT format can now carry a trailing byte, called
'lognumalphatables'. If it is present, the engine assumes that alpha blending
tables are loaded at blend indices 1 to 1<<lognumalphatables and handles
rotatesprite's alpha and spriteext[].alpha accordingly.
The ability to save this new byte is added to engine.lua:savePaletteDat()
and the corresponding convenience functions in shadexfog.lua.

Examples test/screentext.con and test/sprite_access.con are updated for
demonstration purposes.

git-svn-id: https://svn.eduke32.com/eduke32@4426 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-09 18:51:31 +00:00
helixhorned b1e38e080d engine.c: for printext16(), make newlines do what you expect them to.
git-svn-id: https://svn.eduke32.com/eduke32@4422 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-06 22:24:19 +00:00
helixhorned 7603f432df Rename sector[].filler member to '.fogpal'. From CON, keep the '.alignto' alias.
The overall situation is thus as follows:
 - in C and from Lua, that member is called 'fogpal'
 - In CON (both C-CON and LunaCON), it's 'fogpal' with 'alignto' being an alias;
   'filler' wasn't available before, either.
 - In m32script, it's 'fogpal' or 'alignto' ('filler' is not available any more)

git-svn-id: https://svn.eduke32.com/eduke32@4416 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-05 11:28:10 +00:00
helixhorned bd0febb846 In non-lookup OpenGL modes, make sector[].filler (rename pending) override fogpal.
That is, if that member has a nonzero value, that one is taken for the color of
the GL fog instead of (most of the time) sector[].floorpal. "Sky sectors", that
is, skyboxes or simply parallaxed floors/ceilings are *not* handled.

git-svn-id: https://svn.eduke32.com/eduke32@4415 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-05 11:28:08 +00:00
helixhorned 66947aed95 engine.c: clean up code around wallmost(), owallmost() and grouscan().
git-svn-id: https://svn.eduke32.com/eduke32@4413 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-05 11:28:06 +00:00
helixhorned 2fd4617412 Add a second DNCOORDS/cl_showcoords mode, showing some renderer settings.
Also, extend the documentation for r_usenewshading a little. Specifically,
note when the different modes were introduced. BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4410 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 20:36:00 +00:00
helixhorned 9ac075be1c Polymer: disable normal/parallax mapping in rotatesprite.
It was plainly noticeable in the editor's tile info display, for
example.

git-svn-id: https://svn.eduke32.com/eduke32@4409 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 20:35:59 +00:00
helixhorned 7da6380dcb Amend r4394: don't use full brightness (glColor() factor 1) with hightiles.
This is done by factoring out some polymer.c:polymer_getbuildmaterial() code
into polymer_eligible_for_artmapping() and using that. The one in polymer.c
can still determine to not use ART mapping on some ("rare"?) occasions, so
it's not 100% in sync.

git-svn-id: https://svn.eduke32.com/eduke32@4407 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 13:53:09 +00:00
helixhorned 2d889c74f7 Minor Polymost code cleanup.
- factor out eligible_for_tileshades()
- remove some rendmode 1 code
- move some auto vars further down

git-svn-id: https://svn.eduke32.com/eduke32@4406 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 13:53:08 +00:00
helixhorned 99ddb32055 checkdefs.sh: for DEFs, also handle 'include ...', use 'find -L' (follow symlinks).
git-svn-id: https://svn.eduke32.com/eduke32@4405 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 13:53:06 +00:00
helixhorned e7d0c0abcb With r_usenewshade 3, do apply starting fog dist. eqn. for negative shade.
git-svn-id: https://svn.eduke32.com/eduke32@4403 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-30 13:53:03 +00:00
helixhorned 5d2ef07986 In 'tilefromtexture' DEF token, fix specifying -1 xoffset or yoffset.
git-svn-id: https://svn.eduke32.com/eduke32@4402 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-29 21:48:44 +00:00
helixhorned df7ec376ea SDL2: handle Ctrl-K/Ctrl-U in the OSD. BUILD_LUNATIC.
git-svn-id: https://svn.eduke32.com/eduke32@4397 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-25 21:04:39 +00:00
helixhorned e304f3a518 Really minor accumulated readability tweaks.
git-svn-id: https://svn.eduke32.com/eduke32@4395 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-25 21:04:33 +00:00
helixhorned 75baf37812 Polymer/rotatesprite: don't redundantly apply shade glColor() with ART mapping.
git-svn-id: https://svn.eduke32.com/eduke32@4394 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-23 23:14:50 +00:00
helixhorned 7a3776dfac Polymost: introduce r_usenewshading 3 and make it the default.
With this mode, the near distance of the linear fog is always 0, unlike being
negative with r_usenewshading 2.

git-svn-id: https://svn.eduke32.com/eduke32@4393 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-23 23:14:48 +00:00
helixhorned 21de8bb53a Factor out approaching val. to target val by half-difference steps into logapproach().
Fix a case in G_MovePlayers(), where the player sprite's shade is approached
toward the ceiling/floor's shade. Before, it could stop at one above or below!

git-svn-id: https://svn.eduke32.com/eduke32@4392 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-23 14:29:09 +00:00
terminx 2177591619 Add xxHash (https://code.google.com/p/xxhash/), a faster alternative to CRC32, and implement it in a few places. This is around 20-30% faster than CRC32 for me (it's also implemented into the "fileinfo" console command, so you can test for yourselves). I didn't have time to gather up all of the files supported by the startup window so this isn't used there yet. Additionally, this is by the same author as the LZ4 compression library we already use.
git-svn-id: https://svn.eduke32.com/eduke32@4387 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-22 09:26:39 +00:00
terminx ba0c64971c Widespread use of ARRAY_SIZE macro.
git-svn-id: https://svn.eduke32.com/eduke32@4385 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-22 09:25:15 +00:00
helixhorned 7573f0f09d engine.c: check (non-)clipping over a floor curb of an upper TROR neighbor.
git-svn-id: https://svn.eduke32.com/eduke32@4383 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-19 19:53:12 +00:00
helixhorned 88ddf6fe1a engine.c: factor out two functions from clipmove().
git-svn-id: https://svn.eduke32.com/eduke32@4382 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-19 19:53:08 +00:00
helixhorned 69d906c4f7 If 3rd person view gets outside map, try again w/o subtracting 3072 from player z.
Also, clean up G_DoThirdPerson().

git-svn-id: https://svn.eduke32.com/eduke32@4369 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-15 14:10:42 +00:00
helixhorned 802650048d Lunatic: extend map-VX walltype by 'blend' member. BUILD_LUNATIC.
Make Mapster32 save as map-text if there is a wall with non-zero 'blend'.

git-svn-id: https://svn.eduke32.com/eduke32@4368 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-10 20:08:27 +00:00
terminx c3187cea1e POLYMER=0 build fix. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4367 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-07 22:17:38 +00:00
terminx 206244b605 Zip support bugfix from a newer kplib
git-svn-id: https://svn.eduke32.com/eduke32@4365 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-07 22:17:12 +00:00
helixhorned 73b3199b7c Classic: implement screen tilting by 180 degrees without quality loss.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4364 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-05 21:12:59 +00:00
helixhorned c405a13bbd Adapt x86 GCC assembly copybufreverse() to x86_64 and enable unconditionally.
For a 1680x1050 scene standing directly in front of a mirror, this increases
FPS from ~90 to ~95 for me.

git-svn-id: https://svn.eduke32.com/eduke32@4363 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-05 21:12:58 +00:00
helixhorned 689a8aef1d Propagate 'blend' to rotatesprite_(), but don't hook it up to scripting yet.
git-svn-id: https://svn.eduke32.com/eduke32@4360 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-05 21:12:54 +00:00
helixhorned e6d6300ba7 Mapster32: when failing to paste selected sectors into loaded map, unhighlight.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4359 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-04 22:20:05 +00:00
helixhorned 82b87e1812 engine.c: in loadlookups(), allow pal 0.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4355 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-26 20:18:28 +00:00
helixhorned 6f34193bb6 Give sprite cstat bit 2048 (NOSHADE, Mapster32 key [N]) a macro name.
git-svn-id: https://svn.eduke32.com/eduke32@4350 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 19:38:51 +00:00
helixhorned 7a7fb71169 Mapster32: include .blend in sprite display/edit/search (Shift+TAB/F8/Alt+F8).
git-svn-id: https://svn.eduke32.com/eduke32@4349 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 19:38:49 +00:00
helixhorned caeb012843 engine.c: in loadlookups(), error out if attempting to load at a reserved pal.
git-svn-id: https://svn.eduke32.com/eduke32@4345 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 19:38:45 +00:00
hendricks266 a21f340553 Mapster32: Introduce m32_settings.cfg, analogous to settings.cfg, so that you can save your cvars and aliases for the editor.
One potential use is to add r_togglecomposition "0" if you don't like Aero turning on and off every time you switch between 2D mode and 32-bit 3D mode.

git-svn-id: https://svn.eduke32.com/eduke32@4344 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 08:03:02 +00:00
hendricks266 d67e977fb1 Further optimize our SDL_Renderer for 8-bit by making the SDL_Texture SDL_TEXTUREACCESS_STATIC, saving some RAM without any loss of functionality.
git-svn-id: https://svn.eduke32.com/eduke32@4341 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 08:02:13 +00:00
terminx 2aa167af01 Fix texcache
git-svn-id: https://svn.eduke32.com/eduke32@4340 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-22 01:27:03 +00:00
helixhorned 2afb680d22 engine.c: always setup blending table whenever drawing translucent objects.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4338 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-19 19:47:28 +00:00
helixhorned b79fa42903 Lunatic: add engine.saveLookupDat() and document, related tweaks.
- Mapster32: before loading LOOKUP.DAT, set palookup[0][239]=239 to
  make an identity map of the base shade table's shade 0
- Rewrite color index remapping case of makepalookup() for clarity

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4336 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-16 19:16:06 +00:00
helixhorned df25e3cd7c In loadlookups(), look for gap of 4 consecutive unused pals for fog pals.
As opposed to the previous way, where the first fog pals was <numlookups>+1,
where <numlookups> is the first byte value of LOOKUP.DAT. This allows to
pack e.g. lookups [1 .. 25] and [30 .. <lastpal>] into LOOKUP.DAT and have fog
pals be generated at pals [26 .. 29] (i.e. the additional lookups don't
shift the fog pals, making user maps depending on these numbers not look as
intended.)

git-svn-id: https://svn.eduke32.com/eduke32@4335 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-16 19:16:05 +00:00
helixhorned 7e7507746d Factor out common parts of loading LOOKUP.DAT into engine.c:loadlookups().
Also, error if didn't read enough data and account for TITLE and REALMS
swap between basepal number and on-disk order (sigh).

git-svn-id: https://svn.eduke32.com/eduke32@4334 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-16 19:16:03 +00:00
helixhorned 15e141452e Lunatic: disallow saving map-text files in Mapster32 for now.
git-svn-id: https://svn.eduke32.com/eduke32@4329 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-12 21:03:06 +00:00
terminx faa8133cda Support "r_windowpositioning" in SDL builds.
git-svn-id: https://svn.eduke32.com/eduke32@4327 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-11 17:55:45 +00:00
hendricks266 70caa24f24 MSVC: Set up support for SDL2. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4326 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-11 07:39:09 +00:00
terminx 497dc1fc7f Fix 64-bit MSVC builds. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4325 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-11 07:17:45 +00:00
hendricks266 990c99acc2 Fix 32-bit MSVC builds. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4324 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-11 06:14:03 +00:00
hendricks266 c2cb6a9754 Networking updates.
- Added preprocessor value NETVERSION, to be incremented in the source whenever changes are made to the network protocol.
- Implemented proper server-side version verification of all clients upon connection.
- Implemented connection refusal when we reach MAXPLAYERS. (Should be expanded to implement server player caps.)
- Protected against OOB array accesses if an invalid player id is received.
- Renamed all "Recieve" to "Receive".

git-svn-id: https://svn.eduke32.com/eduke32@4322 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 11:00:25 +00:00
hendricks266 3b5dea7347 Fix warnings when building in C++11 mode, i.e. with CPLUSPLUS=1 CUSTOMOPT="--std=gnu++11".
git-svn-id: https://svn.eduke32.com/eduke32@4321 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 11:00:07 +00:00
hendricks266 8f9ffcf23f MSVC: Add support for x64 building and all synthesis libs (libpng/zlib, libvpx, libFLAC).
External ogg/vorbis are no longer required.

git-svn-id: https://svn.eduke32.com/eduke32@4320 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:59:42 +00:00
hendricks266 fd3712ab22 Windows: Full library refresh.
git-svn-id: https://svn.eduke32.com/eduke32@4319 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:58:38 +00:00
hendricks266 5d92bef194 Very minor changes after an investigation into the possibility of Polymost on Wii.
git-svn-id: https://svn.eduke32.com/eduke32@4317 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:56:14 +00:00
hendricks266 7deb709ab6 Replace QuickLZ with LZ4.
git-svn-id: https://svn.eduke32.com/eduke32@4316 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:55:49 +00:00
hendricks266 8db0c9c729 Fix errors and warnings with LLVM/clang 3.4 Windows.
git-svn-id: https://svn.eduke32.com/eduke32@4315 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:55:13 +00:00
hendricks266 854c266cf7 Update commented SDL2 key debug log output.
git-svn-id: https://svn.eduke32.com/eduke32@4314 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-10 10:54:50 +00:00
helixhorned 846fcdf31c Extend PALETTE.DAT format to allow carrying additional blending tables.
Lunatic: also, add an additional argument 'moreblends' to
engine.savePaletteDat() and document that function.
See test/shadexfog.lua for a "user-friendly" wrapper shadexfog.save() which
prints success or errors.

git-svn-id: https://svn.eduke32.com/eduke32@4312 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-09 19:22:35 +00:00
terminx 83d23092cd Fix building on MinGW (MinGW-w64 was OK). DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4310 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 21:25:29 +00:00
helixhorned eec27960ea Lunatic: update dynsymlists. Move blendtable[] from build.h to engine.c.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4309 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:59 +00:00
helixhorned a9fb9e6356 Lunatic: add a 'lastokcol' argument to engine.nearcolor() and document it.
On the C side, slightly rewrite (now) getclosestcol_lim() for clarity.

git-svn-id: https://svn.eduke32.com/eduke32@4308 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:58 +00:00
helixhorned ad8d6795e2 In the C code, rename sprite[].filler to 'blend'.
Also, fix a missed .filler -> g_ambiencePlaying[] rewrite in the editor.
In C-CON, 'detail' is kept as alias to C-side (former) .filler / now .blend,
but that name is *deprecated*.

git-svn-id: https://svn.eduke32.com/eduke32@4305 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:55 +00:00
helixhorned b1b0da2852 Polymer: factor out polymer_invalidateartmap(), use it in invalidatetile().
This fixes updating the viewscreen in Polymer's ART mapping mode.

git-svn-id: https://svn.eduke32.com/eduke32@4304 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:53 +00:00
helixhorned e379cd3655 Polymer: factor out polymer_invalidatesprite(), use when viewscreen tex changed.
Also, rewrite invalidatetile() for clarity.

git-svn-id: https://svn.eduke32.com/eduke32@4303 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:52 +00:00
helixhorned 330b744a1b Classic: support for multiple blending tables + Lunatic interfaces.
Currently, sprite[].filler (to be renamed) selects a blending table. If none
is installed with that index, the blending table at index 0 is taken (which is
read from PALETTE.DAT on engine startup). Thus, for now, the non-Lunatic build
will never use a custom blending table because there's no way to register one!
But the functionality is there.

git-svn-id: https://svn.eduke32.com/eduke32@4301 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:49 +00:00
helixhorned 0d0f3a1cd2 Add Makefile.common switch ALLOCACHE_AS_MALLOC, remove DEBUG_WITH_VALGRIND.
git-svn-id: https://svn.eduke32.com/eduke32@4298 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-08 14:37:41 +00:00
helixhorned 2b583e9c9e gloadtex() cleanup, make some vars in kplib.c static, add source/valgrind_errors.log.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4295 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-02 15:56:13 +00:00
helixhorned c85feff063 engine.c: amend r4292, which introduced an even worse oob for NPOT xsize texs.
git-svn-id: https://svn.eduke32.com/eduke32@4293 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-02 15:56:09 +00:00
helixhorned 546a112741 engine.c: in calc_bufplc(), cope with negative lwall[] values.
This should fix the crash encountered here:
http://forums.duke4.net/topic/1348-mapster32-problems-and-bugs/page__view__findpost__p__184069

a-c.c also gets a new switch macro, DEBUG_WITH_VALGRIND.

git-svn-id: https://svn.eduke32.com/eduke32@4292 1a8010ca-5511-0410-912e-c29ae57300e0
2014-02-02 10:50:44 +00:00
helixhorned 842cce37b7 Lunatic: Fix compilation of C++ build, but not starting up yet.
BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4286 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-31 21:13:03 +00:00
helixhorned 6d4f56c643 Get rid of neartag* global variables. LunaCON: fix 'operate'.
git-svn-id: https://svn.eduke32.com/eduke32@4284 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-31 21:13:00 +00:00
helixhorned ab5c89430c sector.c and related cleanup, round 2.
- use SPRITES_OF* iterator macros
- new function: E_SpriteIsValid(); add some safety checks
  (e.g. hitag used as sprite index)
- the rest is mostly "the usual code transformations"

git-svn-id: https://svn.eduke32.com/eduke32@4281 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-31 21:12:56 +00:00
helixhorned da6c7109c1 Reincarnate RTS sound functionality together with cleaning up related code.
- Make Win+F* also make play and RTS sound, since modern OS's window managers
  like to eat Alt-F*. (Some Win+F* may be inaccessible too, but together all
  10 should hopefully be covered.)
- Fix an issue where keys other than F1-F10 were considered as starting an RTS
  sound and crashing EDuke32 in the process

git-svn-id: https://svn.eduke32.com/eduke32@4278 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-30 19:12:08 +00:00
helixhorned 39bd7110d6 Fix USE_OPENGL=0 build... again. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4277 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-30 16:13:53 +00:00
helixhorned 63e0de5e3d TROR: when clearing bunch number of c/f with yax_setbunch(), don't reset xpanning.
In the non-Lunatic build naturally, since the Lunatic one uses its own member.

git-svn-id: https://svn.eduke32.com/eduke32@4275 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-28 19:03:47 +00:00
hendricks266 62abd504ef Print "32-bit"/"64-bit" along with the version number in the log.
git-svn-id: https://svn.eduke32.com/eduke32@4274 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:31:39 +00:00
hendricks266 27dbb4d2e8 MapArt: gltexinvalidatetype(INVALIDATE_ART) so that loading or unloading an ART set will take effect when using the OpenGL renderers.
git-svn-id: https://svn.eduke32.com/eduke32@4272 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:31:08 +00:00
hendricks266 0bf2ae9bab SDL2: Don't use SDL_Renderer if it is a software fallback, because that would only waste memory and speed.
git-svn-id: https://svn.eduke32.com/eduke32@4271 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:30:54 +00:00
hendricks266 9f42ffc1ef SDL2: Eliminate a memory leak when changing resolutions with SDL_Renderer 8-bit mode.
git-svn-id: https://svn.eduke32.com/eduke32@4270 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:30:39 +00:00
hendricks266 31a8bfebb6 SDL: Fix "the issue where if you hold down a key and enter the console then release it that the key remains held down until you hit it again outside the console".
git-svn-id: https://svn.eduke32.com/eduke32@4269 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:30:25 +00:00
hendricks266 fedfcd81e3 MapArt: Fix a harmless C++ warning. (malloc casting, for those interested)
EDuke32 has me so accustomed to straight C... using a template and pass-by-reference makes my day.

git-svn-id: https://svn.eduke32.com/eduke32@4267 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-27 10:29:29 +00:00
helixhorned 8b7cb9e6c9 Mapster32: make wall texture alignment [.]/[,] work with bottom-swapped walls.
In simple cases, it should be added. Combinations of alignment across TROR
boundaries and bottom-swapping will probably not work right.

git-svn-id: https://svn.eduke32.com/eduke32@4265 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-24 21:39:03 +00:00
helixhorned ae299b0e59 Improve determination of when a sprite should be drawn before a masked wall.
Concretely, in the "behind, outside" case, draw the sprite early if any of its
2 or 4 corner points are behind the masked wall, and inside the cone or on the
other outside.

git-svn-id: https://svn.eduke32.com/eduke32@4264 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-24 21:39:02 +00:00
helixhorned 7ca71203f0 Classic: in debugging builds, add cvar debug_maskdrawmode.
git-svn-id: https://svn.eduke32.com/eduke32@4261 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-19 20:17:14 +00:00
helixhorned b79ee42553 Per-map ART tiles: don't back up or restore reserved tiles.
This prevents a crash and maybe other badnesses when e.g. loading a map
with ART tiles, doing something that allocates a reserved tile (such as
looking into a viewscreen), then loading another map where the tilesiz*
of TILE_VIEWSCR is restored to 0.

git-svn-id: https://svn.eduke32.com/eduke32@4259 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-15 20:29:09 +00:00
helixhorned 4881a13f99 Engine-side per-map ART file support.
When a map named <filename>.map is loaded (<filename> may also contain directory
separators), the engine checks for existence of <filename>_XX.art in the virtual
file system, where XX is a 0-padded number from 00 to 19. It loads a consecutive
sequence of these ART files, i.e. aborts whenever a number in the sequence isn't
found (in contrast to normal ART loading).

Restrictions:
 - the per-map ART files must not reside in ZIP files
 - if a tile number is attempted to be overridden that has a dummytile or is
   cache1d-locked, per-map ART loading fails
On failure, the map is still loaded, but a diagnostic message is output to the
log/OSD.

Loaded per-map ART data are cleared whenever the map is "left". In particular:
 - whenever another map is loaded
 - in the editor: when a new map is started
 - in the game: after the bonus ending screen of a finished level, after going
   to the title screen via the menu

A final note: file names are supposed to be looked up and compared
case-sensitively. That is, <filename> must match EXACTLY between the map's and
per-map ART one; 'art' must be lowercase. Otherwise, the cookie monster will
come and eat you!

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4257 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:54:36 +00:00
helixhorned 3b1515e51b Stylistic/formatting tweaks in cache1d code.
git-svn-id: https://svn.eduke32.com/eduke32@4255 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:54:33 +00:00
hendricks266 d452fd7891 Fix the startup window freeze under SDL2+Windows when a Yes/No box was supposed to be displayed.
git-svn-id: https://svn.eduke32.com/eduke32@4254 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:06:15 +00:00
hendricks266 3e0ad77b5e SDL2: Reintroduce SDL_Renderer for the classic renderer so that the Steam Overlay can function with it.
git-svn-id: https://svn.eduke32.com/eduke32@4253 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:05:56 +00:00
hendricks266 db2f532eca Novelty: Add Ken's "todo list from the Build days" alongside his other documentation.
git-svn-id: https://svn.eduke32.com/eduke32@4248 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:04:19 +00:00
hendricks266 3b1b5bb41d For DISABLEINLINING=1, apply __fastcall to make up for the lack of inlining.
git-svn-id: https://svn.eduke32.com/eduke32@4247 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:04:02 +00:00
hendricks266 8fa00afb7c Mapster32: Add EVENT_LOADMAP, EVENT_SAVEMAP, EVENT_PRELOADMAP, and EVENT_PRESAVEMAP.
Some are more useful than others.

git-svn-id: https://svn.eduke32.com/eduke32@4244 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-12 14:03:00 +00:00
helixhorned ca955899b0 Fix USE_OPENGL=0 build. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4241 1a8010ca-5511-0410-912e-c29ae57300e0
2014-01-02 17:08:08 +00:00
helixhorned 13c125db02 Lunatic: add 'engine' module, currently allowing to create custom shade tables.
Available in the game and editor. Provide test/shadexfog.lua, containing a
function to creating a set of 32 shade tables corresponding to different shades
of the same fog palookup table, together with some tests and convenience
functions.

Also,
- Add gv.LUNATIC_CLIENT{,_EDUKE32,_MAPSTER32}
- Add LUNATIC_FIRST_TIME in the global env for the game
- defs_m32.lua: add reload() convenience function
- Failed attempt at recreating the base shade table. It is NOT a linear ramp
  of the base palette colors to (0,0,0). That is, it's not created by
  build/util/transpal.exe!

git-svn-id: https://svn.eduke32.com/eduke32@4236 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:52:00 +00:00
helixhorned 8a4c5259a8 In the no-netcode build, don't expose four internal engine functions.
Also don't compile three multiplayer related OSD commands there.

git-svn-id: https://svn.eduke32.com/eduke32@4233 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:54 +00:00
helixhorned 74f789d083 defs.c: in '2dcol' DEF token, clamp R, G, B values to [0 .. 63].
git-svn-id: https://svn.eduke32.com/eduke32@4232 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-31 11:51:52 +00:00
helixhorned 8a2d786e23 Reserve 16 tiles from the end of MAXTILES, don't allow as user tiles from ART/DEF.
git-svn-id: https://svn.eduke32.com/eduke32@4225 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-28 17:04:22 +00:00
helixhorned aa37d8c82f engine.c: clean up code related to ART loading. BUILD_LUNATIC.
git-svn-id: https://svn.eduke32.com/eduke32@4223 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-26 19:45:17 +00:00
helixhorned 8dcee7c8dc Factor some code in config.c into OSD_WriteAliases(), move symbol_t to osd.c.
git-svn-id: https://svn.eduke32.com/eduke32@4213 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:24 +00:00
helixhorned 4739d3c00e Don't autoexec <mapname>.cfg files for clipshape maps.
git-svn-id: https://svn.eduke32.com/eduke32@4212 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:23 +00:00
helixhorned a2d0008e32 osd.c: patch up a possible oob access of osdtext[].
git-svn-id: https://svn.eduke32.com/eduke32@4210 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-24 09:44:20 +00:00
hendricks266 cfedcbd7d7 Rewrite and unify the handling of the scrollwheel between layers, fixing it in the editor's 2D mode and tile selector under SDL.
The scrollwheel is unique among PC input because it has no innate "hold length". Previously, the layers gave the mousewheel a fake hold length to allow the not-necessarily-synchronous game/editor code to pick up the input before the layers marked it as "no longer pressed". This passed under Windows, but it didn't slide under SDL.

Besides the two problems listed above, it also potentially limited the rate of weapon selection, where scrolling too fast would not register every clicks. [Unrelatedly, this is still the case when you scroll faster than the game's own tickrate, but addressing that would require rewriting input handling to go through a list of "events" for each tic instead of looking at overall pressed/unpressed states.]

git-svn-id: https://svn.eduke32.com/eduke32@4200 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-20 07:24:09 +00:00
helixhorned ee9e84c356 Various stylistic cleanup.
- Move ARRAY_SIZE() macro to compat.h, add another one ARRAY_SSIZE()
- In A_RadiusDamage(): note maybe-unaligned access issue, prevent unlikely oob
- sector.c: use SPRITES_OF* macros where appropriate

git-svn-id: https://svn.eduke32.com/eduke32@4199 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-12 19:22:16 +00:00
helixhorned 1628debd7c Really fix the Pause key on Windows/SDL2.
This requires enabling the same workaround as for Linux. Maybe it's not
system-dependent at all.

git-svn-id: https://svn.eduke32.com/eduke32@4193 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56:44 +00:00
helixhorned 19da43d23b Polymer: invalidate a wall when its sector's visibility has changed.
git-svn-id: https://svn.eduke32.com/eduke32@4192 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-06 18:56:42 +00:00
helixhorned 9a397a01c1 Fix mouse buttons 4 and 5 on SDL2/Windows.
git-svn-id: https://svn.eduke32.com/eduke32@4190 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:28:03 +00:00
helixhorned 2a43511c70 cache1d: add FIND_NOCURDIR option to klistpath().
git-svn-id: https://svn.eduke32.com/eduke32@4188 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:59 +00:00
helixhorned a783933726 Fix building stand-alone libcache1d.so.
git-svn-id: https://svn.eduke32.com/eduke32@4187 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:57 +00:00
helixhorned 4d8071e6b3 defs.c: in check_tile(), pass 'tile' by value.
git-svn-id: https://svn.eduke32.com/eduke32@4186 1a8010ca-5511-0410-912e-c29ae57300e0
2013-12-01 18:27:55 +00:00
helixhorned a68ef20182 a-c.c: Make vector extensions also be compiled with Clang.
I was checking for GCC >= 4.7, while Clangs pretends to be GCC 4.2. Use a
feature test macro instead. The comment I made in r4161 regarding GCC vs.
Clang code was wrong. Now, Clang generates slightly faster code for these cases
(solid and masked 4-pixel wide vlines).

git-svn-id: https://svn.eduke32.com/eduke32@4182 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-28 21:18:07 +00:00
helixhorned 82e50a14c7 In fullscreen_tint_gl() disable GL_FOG, preventing nasty flickering.
Which was especially noticeable in the Lunatic build. Also, use
glPushAttrib/glPopAttrib there.

git-svn-id: https://svn.eduke32.com/eduke32@4176 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:54 +00:00
helixhorned 198ba2d697 Give rotatesprite 'orientation' bits enum names, too.
git-svn-id: https://svn.eduke32.com/eduke32@4175 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:52 +00:00
helixhorned 9aa8bc7c82 Use named enum constants for the HUD flags instead of literal numbers.
git-svn-id: https://svn.eduke32.com/eduke32@4174 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:50 +00:00
helixhorned 9209b946bb Polymodes: bump the allowed range for 'r_pr_hudangadd' to [-1024 .. 1024].
git-svn-id: https://svn.eduke32.com/eduke32@4173 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:48 +00:00
helixhorned 9e3e2baa4d Polymost: handle HUD model 'fov' DEF token.
This "simply" requires an appropriate factor in the projection matrix.
Also, get rid of a special-case factor for >=1.6 aspects (making HUD models
wider then, I think).

git-svn-id: https://svn.eduke32.com/eduke32@4172 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:46 +00:00
helixhorned 7182f0a7f2 A couple of trivial changes.
git-svn-id: https://svn.eduke32.com/eduke32@4171 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:44 +00:00
helixhorned fd978ced59 Classic: implement horiz. tex panning for sprites (spriteext[].xpanning).
Known as getactor/sprite[].xpanning from CON, values are 0-255. It should be
assumed that this is only valid for wall-aligned sprites (currently, face
sprites also pan).

A test is provided in lunatic/test/animatesprites.con. It should be run in E1L2
and only with the Lunatic build.

git-svn-id: https://svn.eduke32.com/eduke32@4170 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:21 +00:00
helixhorned 85df1181fc Mapster32: show a message when setting the initial position with SCROLL LOCK.
git-svn-id: https://svn.eduke32.com/eduke32@4164 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:16 +00:00
helixhorned 5b53725c43 SDL2: fix Ctrl-F/Ctrl-G as "key FIFO" keys, used in Mapster32.
By detecting them in the SDL_KEYDOWN events. This list is getting a bit
ridiculous...

git-svn-id: https://svn.eduke32.com/eduke32@4163 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:15 +00:00
helixhorned 559c31159a a-c.c: use GCC vector extensions only on 64-bit targets.
Compiling a 32-bit NOASM build resulted in code containing a MOVAPS instruction
that accessed a memory location not aligned to 16 bytes (MinGW, GCC 4.8).

git-svn-id: https://svn.eduke32.com/eduke32@4162 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:12 +00:00
helixhorned 3753d45601 a-c.c: prevent stray lines on bottom of sprites by saturating v. tex coords.
The functions mvlineasm1, mvlineasm4 and tvlineasm2 can now be set to clamp
the vertical texture coordinate (vplc), preventing the unsightly stray lines
on the bottom of non-y-flipped sprites. (The first part of this effort, r3483,
handled their top).

However, this is only enabled for the mvlineasm ones: the vectorized variants
suffered almost no slowdown (even though a PADDUSD SSE instruction would be a
nice thing to have), while it was pretty significant for the sequential
translucent ones.

Summarizing, this leaves two cases where stray lines may appear in the non-ASM
build (the saturation is NYI for a.nasm):
- at the bottom of y-flipped sprites
- at the bottom of translucent sprites (can be toggled by #define)

Another observation is that recent GCC generates much faster code for this
stuff than Clang from SVN.

git-svn-id: https://svn.eduke32.com/eduke32@4161 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:11 +00:00
helixhorned ca22bf8185 a-c.c: in {v,mv}lineasm4, use vector types for vplc/vinc with GCC >=4.7.
For a full 1680x1050 screen drawing a solid/masked wall, the FPS increases
from 118 to 133 and from 114 to 116 (respectively) for me.
Guarded by the macro USE_VECTOR_EXT in the source.

git-svn-id: https://svn.eduke32.com/eduke32@4160 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-16 18:47:07 +00:00
helixhorned b1d6a97db4 Mapster32: don't produce erratic behavior w/ crash when not in 3D mode.
Also, BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4148 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-11 20:33:55 +00:00
helixhorned f63510cc33 In C_SetCfgName, don't use unsafe string functions with unknown-length input.
git-svn-id: https://svn.eduke32.com/eduke32@4144 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-08 18:08:47 +00:00
helixhorned ceebc8077c OSD: on non-Windows, make textmode=0 the default, just like in Windows.
This fixes some init and update anomalies: before,
 - init would always be the graphical mode (0), but writing
   merely "osdtextmode" would switch it
 - osdtextmode would not get saved to the cfg

git-svn-id: https://svn.eduke32.com/eduke32@4139 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-04 22:56:12 +00:00
helixhorned e19a271a86 OSD: retire OSD_GetFmt(), OSD_GetFmtPtr() and OSD_GetTextPtr() functions.
These were too much "looking into the implementation of a module" for my
taste, hence OSD_GetShadePal() earlier.

git-svn-id: https://svn.eduke32.com/eduke32@4138 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-04 22:56:10 +00:00