Build 2273
SVN-
General
Fix a potential wall[-1] access in Mapster32.
SVN handles and Git names are merged into one person.
Fix a potential wall[-1] access in Mapster32.
minor engine cleanup.
- enclose glbuild.h in #idndef ... sentinels - engine.c: remove unused variable 'pageoffset', make 'lastx' static - formatting
Inreased debugging level for catching oob accesses to 'main' arrays.
If enabled, this makes the following arrays be allocated statically: spriteext, spritesmooth, sector, wall, sprite, tsprite, while necessarily disabling the clipshape feature (because it relies on setting sector/wall to different malloc'd block temporarily). To compile, pass DEBUGANYWAY=1 in addition to RELEASE=0 to 'make', and it's really only useful with CC=clang, of course.
cleanup:
- 'whitecol' was defined in the engine and in build.c, use only the engine one - make cachesize, artsize, artversion static in engine.c - undo some formatting havoc presumably done by astyle
Fix parallaxed sector display in Mapster32 on Polymer.
Fix the Polymer hitches first encountered with Parkade.
The cause was a combination of many factors. First, Polymer requires the start-drawing position to be inside the sector to draw (deviations lead to incorrect drawing). This was violated by the game, because it interpolated the current and next tic position without updating the sectnum, leading to inconsistencies especially when passing through narrow sectors. Polymer worked around it by doing an updatesector() each frame, however this works poorly for maps with overlapping geometry such as SoS or RoR. The solution to this is to add a new engine function, updatesector_onlynextwalls(), which searches the sectors (via nextsector) in breadth-first fashion instead of from 0 to numsectors-1, like updatesector does when it fails for the *immediate* nextwall neighbors. Internally, the breadt-first search helpers are moved into the engine.
polymer.c: "Compiling GPU program with bits (octal) %o" for easier reading.
Also, for debugging builds, show this message from verbosity level 1 on.
more internal cleanup...
the only visible change is that polymost_trytexcache (formerly two instances of nearly duplicate code) now prints a diagnostic after a cache miss. The one that one is most likely to encounter is "r_downsize doesn't match", meaning that this setting likely differs between Mapster and the game.
make the following static in polymost.c:
- texcacheindex *firstcacheindex, *curcacheindex - trytexcache(), gloadtile_cached() - Factor out duplicated code into clear_cache_internal()
- When saving game, clear all polymer lights before. Not doing this makes
the SE ones douple, triple, ... after each save. Maphack lights are reloaded with polymer_resetlights() (though I've had them disappearing after load, I couldn't reproduce it afterwards). - in debugging builds, print a message when polymer_resetlight is called on a nonexistent one. The problem is not so much the call itself (it's guarded), but the fact that resources on the caller side may not have been freed if it thinks that those lights do in fact exist. Right now, it's not the case though. - add 'loaded map hack' messages after some other successful loadmaphack calls
When loading a game, DON'T restore 'adult' TV tiles. This fixes the recent
crashes. Usually, after loading a game, some wall tiles are tweaked depending on whether adult mode is enabled or not. If it's not, those wall picnums are replaced with blank or broken screens. If it is, they are restored from the wall's .extra member. Apparently though, Mapster32 leaves some .extra members floating around even after deleting a TROR nextwall link (it's used as the 'lower wall index'). Because MAXWALLS is greater than MAXTILES, this may produce out-of-bounds accesses and corrupt memory (besides setting wall tilenums to nonsensical values) later in the game. Other than that, the change only affects loading savegames created with adult mode OFF. Kinky TV screenies simply won't be restored then.
a.m32 light hotkeys: clamp hitag (range) to 0..32767 instead of 0..16000
Besides the performance issues, there's another reason why changing the palette
'frequently' isn't such a good idea. Assume an actor constantly changes the palette to some value and you're attacked by a newbeast at the same time. Then the pain tinting would be reset each time the actor's code is run. This commit adds a new flag 16 to setbrightness(), meaning "don't reset the fade tinting". Its only use right now is from CON's setgamepalette command (and there, always). The change is done in the engine and thus affects all platforms.
make smoststart[] (which saves starting "smostcnt"s) an array of int32's
instead of shorts. This fixes their values' overflow in AMC TC megabase and probably a couple of other large maps.
patch up another out-of-bounds access in the voxel drawing code, though
I'm not sure whether the increased array size is enough.
minor cosmetic tweaks in sector.[ch] and a off-by-one limit correction there
Fix out-of-bounds write when passing a map filename to Mapster32.
Add new actor[].flags flag 2048 (SPRITE_NOCLIP), for 'spriteflags' CON usage.
Actors are always moved such that _they_ clip against blocking sprites, even if their blocking bit is clear. Setting the new bit make them not clip against anything. The promary use of this is for decorative moving sprites that are spawned in masses, such as rain or snow.
engine.c, in engine_addtsprite: if we can't add more tsprites because we
already have MAXSPRITESONSCREEN of them, return 1 to signal that the caller should break out of the loop.
Patch up out-of-bounds access in some voxel drawing code.
Don't spawn weapon tiles (WEAPONx_SPAWN) if any such value has been set
to negative numbers. Previously, only checks for being zero were performed, but CON code in the wild also has WEAPONx_SPAWN -1, which would propagate to the sprite picnum...
a.m32: new state 'print_parallel_midpts'
Rudimentary support for auto-aligning along TROR nextwalls.
Usage: press the ['] (quote) modifier together with the PERIOD key. Aligns only the immediate upper and lower neighbors of each wall that got aligned by following point2s or nextwalls. Doesn't play well with Alt (carry over xrepeat) yet, might need two subsequent alignment passes.
Fix a number of oob accesses with "switch switches".
Various code checked for switch tiles in the following manner, for (ii=0; ii<2; ii++) switch (DynamicTileMap[sprite[i].picnum-1+ii]) { case SOME_SWITCH: ... } which blows for picnum 0. Now, we simply disallow it.
Remove {eduke32,mapster32}.memmap files on clean/veryclean targets
(bioman request).
Fix sintable[] access with out-of-bounds values in core engine functions
(getzrange, hitscan, clipmove, drawmapview). They're reproducible with DNE1.3D; Since these angle values most likely come from CON code, my suggestion would be to bit-and all values representing angles with 2047 when setting the from CON, but I'd have to think about potential side-effects of doing this.
- Fix invalid polymer light array access originating from game's cleanup
callback 'G_Polymer_UnInit'. - In astub.c, reset spritelightid to -1 when nulling the spritelightptr of a sprite (no crashes observed, just precaution) - In sdlayer.c, catch SIGILLs with our signal handler too, since illegal instructions are what the instrumented debug builds will execute when attempting to carry out an undefined (per C) operation.
engine.c: fix shift by negative value in parascan().
polymer.c: fix out-of-bounds picanm[] read.
Fix shift by values greater than 31 in some voxel loading code.
a.m32: New function save_restore_hlsectors, also accessible from the Quote-F
menu. If some sectors are highlighted, save their indices. The highlighting of those particular sectors can then be restored at a later time (but careful across structural modifications that tweak sector indices) by running the same function. Shares a 'gamearray' with function 'collect_teleporting_sectors', so the latter will reset this one when run.
fix filling all sectors of a bunch with Ctrl-U. Previously, only
one sector was filled and the 'clear bunch' message was displayed even if the operation was canceled.