Build 2566
SVN-
Fix a potential uninitialized mem read in debug msg when in void space.
SVN handles and Git names are merged into one person.
Fix a potential uninitialized mem read in debug msg when in void space.
fix specifying a custom configuration file with -cfg.
We were writing into a string literal. Ouch!
Add common.[ch] which should be used for common non-engine types/functions/data.
As inauguration, move G_AddGroup, G_AddPath and struct strllist there. The header is located in build/include, because in the future, code that resides closer to (but is not strictly part of) the engine might need to be factored into here. The source file, however, is in the source/ directory.
cull sprite lights after computing sprite geometry
This was broken ever since updatesprite() had been forked off drawsprite() and would cause static lights to never hit static sprites until one or the other changed, after which the light would always get culled against outdated sprite geometry.
don't shadow-optimize light culling in cached sprites
Since updatesprite() only happens once for static sprites, avoiding light culling if we hit it in a shadow pass means that sprite will never be lit as long as that happens.
Accumulated trivia.
- engine.c: move some variables into a lower block - premap.c: clearbufbyte --> Bmemset
Factor out assignment of various globals in 4 instances of wall drawing code.
This makes the differences in these codes stand out much more clearly.
- Makefiles:
- Fix typo, correctly adding SDL libs to the tools on OS X so that makesdlkeytrans builds. - Move all mention of $(LIBS) out of build/Makefile into build/Makefile.shared because no linking takes place in the engine itself so LIBS additions were lost. This should fix USE_LIBPNG=1 on Windows at least. - Other assorted cleanup.
Rather trivial changes in engine.c and crc32.c.
New game def token "nofloorpal <pbeg> <pend>", disabling sprites taking on floor pals.
It has always annoyed me how floors with "shirt-color" type palookups like 21 affected the color of its containing sprites and HUD-drawn stuff. This commit allows one to specify an inclusive range of pals for which this should be disabled for sprites (but not for HUD stuff, yet).
In Mapster32, remove ReadGamePalette() and GAMEpalette[] and use engine's palette[].
Make engine.c's loadpalette return -1 if palette.dat is not found.
... and initengine now returns 1 if loadpalette() fails.
Clear up after r2495. (Because I'm a pedantic asshole.)
- in Mapster, pre-form the default 10 clip map names before returning from G_CheckCommandLine() so it gets loaded even if we passed no cmdline args. - malloc + strlen + strcpy --> strdup - don't need to spank dead variables ;) - we may call calloc with zero size, which isn't bad by itself, but asserting for non-null afterwards is. Allocs of 0 are implementation-defined, and may well return a null pointer (C99 7.20.3).
Port tvlineasm2 to C and enable transmaskvline2 code also for all-C builds.
With the same setup as before, a screen-filling translucent wall (with nothing drawn behind it) renders at about 7 fps faster (from 60-something fps initially)
Port [m]vlineasm4 to C replacements and enable for solid and masked walls.
These two functions draw a vertical line 4 neighboring pixels at a time. This gives a significant speed boost for a full screen solid and masked wall scene for x86_64 (where we have plenty of registers), about 60 --> 76 fps.
Mapster32 tag-label system: don't consider 'switch' walls with an upwall as linking.
New "-clipmap" command-line switch to specify sector collision clip maps. This switch works in an additive fashion like -mx and -mh. _clipshape0.map through _clipshape9.map remain loaded by default.
Also, a very minor change in the con/def module code. (int --> int32_t)
Remix undo/redo system, fixing potential access of freed memory.
A run of consecutive mapstates may share sector/wall/sprite blocks, but the code was deciding whether to free them solely on local properties. Now, save a reference count at the beginning of each such allocated block and free it only if it reaches zero.
"Promote" oob sectnum/statnum sprites to corruption level 4.
Also, always print at least level 5 corruptions (that is, have no instances of completely silent corruptcheck).
sprite list consistency checker in corruptcheck.
This checks for about every possible type of sprite list corruption and reports back with a corruption level 5 if one of the 14 validations fail.
Tweak Mapster32's sound index (F2).
- start scrolling from about half of the visible page - PGUP/DGDN moves the cursor by 1/4 of the page - code cleanup (we only need one displine[80], use clearkeys())
Re-enable Mapster32's undo/redo functionality.
When loading map w/ oob sectnum sprites, make them have sect. 0 if updatesector fails.
Previously, if the sprite turned really out to be in void space, either freelist inconsistency (before the list rewrite) or oob access (now) would happen. Also add an bound-checking assert() for insertsprite's sectnum argument (it's not a bound check!)
fix faulty limit check in duplicate_selected_sprites().
Continuously keep track of the number of sprites in the world.
New engine variable 'int32_t Numsprites', not yet saved into savegames or mapstates. (The capitalization is to distinguish it from the often-used 'numsprites' locals or structure member names. In the editor, get rid of updatenumsprites().
Remove redundant sprite freelist.
Previously, the lists starting at headspritestat[MAXSTATUS] and headspritesect[MAXSECTORS] were both used as sprite freelists and were always in complete synchrony. Now, make only the statnum list keep the free sprites. This way, it has no CON compatibility implications because headspritesect[MAXSECTORS] is inaccessible there. Leave the array at its original size for now.
fix animations that loop to frame 0
With VBOs enabled, the virtual pointer to the geometry of frame 0 of a model is always NULL. This was confusing the polymer code responsible for deciding whether to enable smooth animations or not, which meant that any animation that would loop to frame 0 would do it as if animation interpolation was disabled, which looks very choppy.
With dndebug, show the currently playing sounds.
The format is snd #<sound number> inst <instance of that sound>: voice <internal voice handle>, ow <owner's sprite ID/-1> (this is the interesting part)
fix mirror-related oob access analogous to r1872's fix for classic.
When drawing from inside the mirror, there may be no 'bunches' (BUILD lingo, not TROR ones) collected, but following code used the first one unconditionally.
Optimizations and tweaks for C replacements of mhline and thline.
Hlines for masked and translucent masked ceiling/floor (sprites). - apply the --> 'do { ... } while (--cnt)' transformation, making these functions iterate cnt+1 times like the asm version. This also fixes an off-by-one issue where sprites or masked ceilings/floors had a one-pixel non-drawn line to the right. - This time, only declare-as-local two 'extern' globals (asm1 and asm2). It seems that I was too eager with "localing" all file-scoped vars earlier. GCC is able to remove the loads from memory inside the loop by itself, whereas clang is not. This is not trivial, since it has to prove that the 'screen' pointer passed to the functions will never alias these globals.
Optimize 'rainbow' background drawing in the editor with 8-bit renderer.
with r_parallaxskypanning=1, clamp the sky at a constant horizon.
See E4L1 for what this means.
Fix apparent horizon not being independent of viewingrange (classic/Polymost).
The apparent horizon (in units proportional to pixels by a constant factor) was being calculated without normalizing to viewingrange, resulting a discrepancy between the drawn and actual up/down angle with non-default viewingranges (e.g. with r_usenewaspect=1, or when setting it from setaspect). This also means that the center-of-aim will now be the same regardless of the aspect. This fixes many derived bugs: * inconsistency w/ crosshair when shooting a gun and aiming up/down (obviously) * bugs resulting from being able to look up/down too far (garbage non-slope texture-mapping and viewing BIGORBIT skies above the borders in classic). Note: mods that had workaround logic for this bug will have to remove it...
Tweak 'dncoords' display.
added: sector extra; viewingrange and yxaspect before the main drawrooms call removed: randomseed
sector.c: fix a possible oob access of a local array.
Make 'double ghoriz' static in polymost.c.
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.
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.