Build 2391
SVN-
General
Make 'dommxoverlay' and 'beforedrawrooms' static in engine.c.
SVN handles and Git names are merged into one person.
Make 'dommxoverlay' and 'beforedrawrooms' static in engine.c.
Significantly speed up non-power-of-two floor sprite texture mapping functions.
(Classic renderer). We don't need 64-bit integers; also use the nice asm version of divscale32() if possible.
zip -r
Fix osxbuild.sh on my setup.
Try to find another mirror wall if the assigned one breaks.
This fixes mirrors consisting of more than one walls not drawing when the first assigned mirror wall breaks. It still does not let you have more than one mirror (i.e. mirror sectors) showing up at the same time in the scene. Affects classic and Polymost only.
Do bound check for "quick" sector/wall accesses from CON, i.e. in getvarvar.
This was causing oob sector accesses with code like this: getwall[hitwall].nextsector temp ifvarvare sector[temp].floorz sector[temp].ceilingz setvar tempb 1 (from DT's HYPERCORE). Also validate quote indices passed to CON's quote and userquote commands at runtime.
Fix user quotes colored with a 2-digit number being wrongly x-aligned.
Such game text was shown starting from about the center of the screen. The reason for the bug was this code: t += 1 + isdigit(*(t+2)); The sequence points here are at the beginning and end of this assignment expression, and the updating of t may happen anywhere between these (C99 6.5.16 #3). Please don't write such code. When in doubt, and assignment and reference to the same object should be split!
Pull the 'for (' ... ')' out of the TRAVERSE_{CONNECT,SPRITE_*} macros.
This plays more nicely with automatic formatters. Also indent accordingly.
QUOTE_NVG_OFF-p->heat_on --> QUOTE_NVG_OFF-!!p->heat_on in sector.c.
Because: 1) It used to be like this; 2) guard against bad CON input.
Fix potential (certain?) oob access with ST28/SE21.
Encountered with Scent.map. Since the SE21 are deleted after they have been used, the search for them in the ST28 code in sector.c may come up empty, in which case sector[-1] would be accessed.
Fix sprites with picnums >= MAXSPRITES not drawing in classic.
This was discovered because viewscreens (TILE_VIEWSCR) ceased being drawn with the MAXTILES increase (reported by Hank, who also did the bisect).
Uncomment "CrosshairColor" parsing code in config.c.
Untested, but LeoD says it works.
Define Batoi/Batol to strtol(...) in compat.h and use these when necessary.
That is, everyplace a user input is to be converted. The only remaining instance of atoi() is now atoi(s_buildDate).
make neartag accept a sprite-blacklist function and use it in sector.c.
Internally, the last argument to neartag is now a pointer to a function int32_t (*blacklist_sprite_func)(int32_t i), which is supposed to return 1 if sprite[i] should NOT be considered for hitting. This is now used in the hard-coded neartag() calls in sector.c, but not in any way in CON (there's neither a C blacklist function provided, nor is there a possibility to define one in CON). There, all sprites with picnums >=1 and <=10 (i.e. the effectors) will be blacklisted. This remedies problems where such sprites would get in the way of switches. Note that a whitelist approach (only consider a predefined set, namely those picnums which will be checked afterwards) has back-compatibility implications since people may have used e.g. lotagged window sprites to cover a switch. Also, the >=1 to <=10 range is [sic] (the static, not dynamic values are used), since anyone redefining effector picnums is clearly out of their mind.
Make neartag() return void instead of always 0.
polymost.c: More informative failure message for gloadtile_cached().
Use maps selector: draw files found in ZIPs with pal 8.
cache1d.c: more meaning-preserving transformations, patch up one oob access.
lzwcompress can access one byte after lzwrawbuf[LZWSIZE] when provided with an uncompleng of LZWSIZE, so we increase that array's size by one.
Make compiler happy: remove 'may be used uninitialized' warning in multivoc.c.
I'm not getting this warning (synthesis is) but I think it's justified because the VOC block parsing code isn't terribly validating...
Fix a potential free() of stack memory in screenshot code. Ouch!
Comment out unused dfread and kdfwrite functions in cache1d.c.
constify various cache1d and pragmas functions, some copybuf* -> memcpy/move.
The following functions have const qualifiers attached for the 'destination' arguments: kdfwrite, dfwrite in cache1d.c and copybuf{byte,reverse,} in the pragmas source or headers. A couple uses of the latter ones were replaced with calls to standard library functions.
cache1d.c: debugging feature routing all allocache requests to malloc.
This is useful to debug out-of-bound violations for memory allocated with that function.
menus.c: rename _bar to sliderbar.
make aspect ratio also control r_usenewaspect.
- RENDERER SETUP is now also accessible from classic, with only 2 options: 'aspect ratio' and 'ambient light level' - remove the latter option from the VIDEO SETUP menu - When compiled with OpenGL, the aspect ratio option cycles between 3 states: r_usenewaspect=1 (the modern way), and r_usenewaspect=0 but r_widescreen=0/1. In non-GL builds, there are only 2 states. - don't display black translucent overlay in COLOR CORRECTION menu
Fix non-OpenGL build.
In the user map selector, sort file names case-insensitively on Unix'y systems.
This makes more sense because the game selector draws the names with uppercase letters and the hotkeys to jump to a map starting with a particualar letter aren't case sensitive, either. Mapster32's selector will still display maps starting with upper case first.
osxbuild.sh: detect whether we're keeping the source in SVN or git.
Update samples/trueror1.map with some tests of sprites lying on TROR floors.
Also, there's a "ladder" that passes through a TROR portal, and the mirror in that map has been fixed for the classic renderer.
Fix extended ceiling/floor picnums taking on picnum 0 in Polymer.
The reason was that drawmasks(), which was where the resetting of the fake RoR textures happened under Polymer, can be called from polymer_displayrooms() when mirrors are present. I was assuming that drawmasks() was only ever called after the 'main' drawrooms and that hence the sequence of fake RoR tile tweaking was set, reset, set, reset, ... which it was not. Now, do the resetting explicitly after every drawmasks() in the editor.
When loading a map in-game, clear TROR wall members corresponding to up/down links.
I find this cleaner for two reasons. First, lotags won't get in the way of neartag(), so that doors and switches near constrained TROR walls can be pushed. Second, this removes the information leak so that CON coders aren't tempted to read that values directly before a proper API for that comes along. When writing out a map in-game (e.g. with dndebug), restore the respective members so that it can be loaded in the editor again.
engine.c: Rewrite tslopevlin (translucent slope vline texmapping) for clarity.
Fix player being not blocked by sprites lying on an extended floor.
getzrange() returns the floor rather than the sprite if their heights are equal. Now, make an exception for extended floors (analogously, ceilings).
Fix use of an uninitialized variable in P_FindWall->FindDistance2D with noclip.
engine.c: replace 0xXXXXXXXX literals with INT32_MIN/MAX; whitespace changes.
Fix a couple of out-of-bounds accesses when roaming around with noclip.
- guard cansee() against negative sectnums (return 0 immediately), since it's often called with the player sectnum as one argument - in resetpspritevars(), don't inset APLAYER sprite if sectnum < 0, which can happen if a map is started in void space accidentally (e.g. from the editor) - two checks before accessing sector[] with a player sectnum
Fix sprite rendering glitches with r_usenewaspect=1 in 8-bit mode.
Make 5th mouse button functional in Windows.
Draw HANDHOLDINGLASER and ~ACCESS with guniqhud=200 and 201, respectively.
This fixes updateanimation picking up foreign (and thus potentially oob) frame numbers at "3: c > n".
Remix mdsprite.c's updateanimation() to look prettier and clearer.
Specifically, - rearrange conditionals - factor out constant expressions - add a couple of debugging printfs for extraordinary events (oob frames) - add VERIFY comments for implicit assertions I'd like to verify sometime Also, one calloc -> malloc.
Debugging helper disabling a.nasm calls with OpenGL renderers.
Uncomment #define DEBUG_VALGRIND_NO_SMC in duke3d.h to be able to valgrind --smc-check=none (or the default stack-only) with Polymost and Polymer renderers.
Patch up out-of-bounds access (r/w) when mixing 16-bit stereo *source* data.
... by allocating two bytes more for the mixing buffers.
Fix uninitialized mem access in dorotatesprite with thin tiles (e.g. 3085).
jmact/control.c: rewrite strange looking loop.
Draw translucent black background only when playing (back a demo or oneself).
Fix menu text not drawing when not playing (back), introduced in r2326.
Fix zero-size calloc when enumerating a joystick with no hats in SDL.
Remove a couple of redundant declarations.
interface to events.
Add some #includes to gameexec.h and sector.h so that they can be included directly
Use a tokenlist for the event names and add tokenlist typedef to gamedef.h.
Make r_maxfps functional in demo playback.
Probably fix crash when reaching light count limit in G_MoveEffectors SE50 code.
use enum constants
rotatesprite(..., windowx1,windowy1,windowx2,windowy2) --> rotatesprite_win
a bit rearrangement, getbunch.
game.c: trivial tweaks to reduce code duplication (which is hard on the eyes)
fix crash with 'vidmode <bpp>' introduced in r2311.
Factor out four instances of identical code into M32_DrawRoomsAndMasks().