Build 3027
SVN-
General
foreachmap.lua: add shortcut for quickly finding certain sectors/walls/sprites.
SVN handles and Git names are merged into one person.
foreachmap.lua: add shortcut for quickly finding certain sectors/walls/sprites.
Make getangle() a __fastcall function instead of static inline.
This trims four 4k pages of code from the release EDuke32 build and one page from Mapster32.
In dosetaspect(), bail out calculating radarang2[] instead of failing assertion.
When this happens, parallaxmodes other than 0 will be unavailable and silently draw as parallaxmode 0. This usually happens with extremely wide resolutions.
Move #include <math.h> from polymer.h to polymer.c.
Remove some #if 0 blocks that are probably of no interest any more.
For reference, they are the following: - cache1d.c: suckcache() - build.c: compare_wall_coords() - make switch-invisible heuristic - Mapster32: old sprite search - Mapster32: manual z range - m32script: read/writearray, qgetsysstr - menus.c: savetemp()
Quit the game if SE17 (warp elevator) setup fails.
The spawn-time SE 17 setup uses nextsectorneighborz() which can fail (return -1) on some circumstances and would cause an OOB sector[] access.
engine.c: rewrite nextsectorneighborz() for clarity.
build.lua map loader: add the option of canonicalizing sprite order.
This is mostly for debugging, since currently, Mapster32 restores sprites not in the same order as the original sprite index order. Also, expose this option from map2text.lua and mapdiff.sh.
for c&p-ing map portions w/o TROR, fix wrongly resetting wall lotag/extra
for copy-pasting map portions without TROR, fix wrongly resetting xpanning.
This is really an artifact of overloading the sector fields for different uses. For copy-pasting TROR'd portions, the bug still persists.
Keep full-screen tints through palette changes again.
A debug macro to test tints being stuck at the least intense non-zero value is provided in engine.c.
Make a colored REACTOR/REACTOR2 sprite disappear in single player again.
Noted by Nukey. See Duke3D 1.5 GAME.C line 4220.
properly reset highlights in undo/redo.
with highlighted sectors, print rot. angle; Alt + [,]: manual angle.
Because rotating sectors "smoothly" by 1 BUILD ang will quickly accumulate roundoff error, this lets the user first do that as a preview and then use the manual angle rotation do carry it out for real.
use the rotatepoint code for both smooth and 90-degree sect. rotation.
Factor out Polymost's widescreen bit handling code and use it in classic, too.
This means that classic and the GL modes now look the same as far as e.g. hud_bgstretch or HUD weapons are concerned.
polymost.c: rewite widescreen bit code, part 2.
Use integer math; both args to setaspect are constant.
Clean up classic's and Polymost's dorotatesprite functions (triv. changes only)
polymost.c: rewrite dorotatesprite's widescreen bit handling (256,512,1024).
Instead of setting and resetting the [xy]dim globals, use them as locals in a block (shadowing the globals). Also, do some common subexpression elimination for clarity.
use updatesector instead of *z.
When shrunk, the player position is below the floor for some weird reason. Updatesectorz would set the sector to -1, and the view would not be drawn.
in setaspect_new, determine the aspect with {x,y}dimen instead of {x,y}dim.
That is, use the view boundries instead of the whole screen.
Fix mirrors in Polymost.
Text-repl.: hitinfo variables -> hit, hit{sprite,sect,wall} members -> no "hit"
This makes the code rather more readable in some places. Unlike the two preceding commits, this one is actually purely textual replacement.
add "extend all highlighted sectors" func to 'F menu via a.m32.
on x86 GCC asm builds, fix crash with floor sprites of (x or y) size 2.
The idiv instruction also signals an FPE when the resulting *signed* quotient overflows, so we simply use div instead.
fix underwalls being not animated (introduced in r2823).
a.m32: in collect_*_sectors from the 'F menu, start query with sector under mouse
simplify some code while I'm at it (equivalence tranformations only)
bring the ypanning correction for non-pow2 walls closer to Pmost's, pt2
This changes a constant inside the panning calculation from 256 to 255 (making e.g. panning 255 and 0 the same in the "San Andreas fault" sign in E1L5) and uses the correct reference wall for the "do panning correction?" conditional. Now, the problematic walls should look the same as in Polymost.
bring the ypanning correction for non-pow2 walls closer to Pmost's, pt1
This makes the corrections conditional on where they appear in (under-, over-, white or mask wall).
a.m32: add some commented out example code for the screenshot functionality.
draw walls with non-pow2 ysizes in the old fashion for the time being.
I'm willing to make this one concession to correctness in the name of backward- compatibility. I think that one reason why this has never cause a crash is that tiles in BUILD are allocated in Ken's big allocache buffer, so oob accesses were dampened by that (though they hit uninitialized data).
if printext256's <col> arg is negative, use editorcolors[-<col>].
The editor colors are the ones listed on page 9 of the Mapster32 built-in help.
factor out y panning coefficient calculation code.
Add ART loader for the LuaJIT BUILD struct loader module, 2 more examples.
The map iterator now has init/finish capability, making it possible to write scripts that aggregate data over multiple map files. One such example calculates some statistics, the other loads art metadata and looks for red walls with non-pow2 ysize tiles.
factor out wall y panning coefficient calculation.
Non-pow2 wall/mask drawing in classic introduced cases where walls are drawn "incorrectly" because they were constructed with the old behavior in mind. Polymer appears to "correct" for it partially, but doesn't cover all cases. Specifically, now we have: - E1L1 first inside secret room (5000, 50000): Polymer draws like Duke 1.5, classic now draws with an offset. - E3L2 near the vault (-20000, 25000): both classic and Polymer draw with offsets compared to Duke 1.5, but they're different! This means that more research is needed into what makes these two cases diverge, even though both have the same root cause. !!! Also, mappers should abstain from using non-power-of two textures on walls until this issue is resolved in a satisfactory fashion !!!
fix glitches where stuff would be drawn transiently on sect change.
This was introduced with r2771, which fixed e.g. AMC TC city_si's mirrors, but instructed the base drawrooms inside yax_drawrooms to not correct the passed sectnum. Therefore, stuff would get drawn wrongly when passing sector boundaries, like from the platform to the rails in trueror1.map.
fix drawing mirrors, introduced by nonpow2-ysize wall/mask drawing.
Some more drawing glitches remain.
Add description for 'remap' to mapster32.cfg, add 'setstartpos' to a.m32.
The latter is commented out, since it has to be *compiled* with script_expertmode enabled.
hook up non-power-of-two ysize wall/mask drawing in asm builds, too.
fix drawing of walls and maskwalls with non-pow2 y size tiles.
Related to that, it looks like out-of-bounds accesses when drawing such walls/ maskwalls or *sprites* are fixed, too. Sprites still show a stray lines on some occasions, but Valgrind doesn't complain then.
Make ksqrt take uint32_t, add helper function uint32_t uhypsq(int32_t,int32_t).
uhypsq calculates the hypotenuse using unsigned multiplication. This is permissible since for arbitrary int32s a and b, the following holds in two's complement arithmetic: (int32_t)((uint32_t)a * b) == (int32_t)((int64_t)a * b) ("Signed and unsigned multiplication is the same on the bit level.") This fixes various overflows where wall lengths for walls of length > 46340 are calculated, but does not rid us of other overflows in the same vein (usually dot products between vectors where one point is a wall vertex and the other a position in a sector).
some trivial mapster tweaks
engine.c: factor out two instances of dup code into setup_globals_sprite1()