Build 2871
SVN-
reflect the preceding rename in the sources.
-
General
Rename a certain file to appease Windows file systems.
-
implement a couple more 1.5 commands.
SVN handles and Git names are merged into one person.
reflect the preceding rename in the sources.
Rename a certain file to appease Windows file systems.
implement a couple more 1.5 commands.
Fix tile CAMERA1+4 being not changed to a CAMERA1 on spawn.
Fix slimers not disappearing on dnmonsters cheat, display 2nd 'on' state.
add "extend all highlighted sectors" func to 'F menu via a.m32.
Clean up game.c and actors.c.
clean up handing of ac/mv internally, add control module.
cleanup
'bitar': rewrite ops for colon syntax, serialization, set ops.
sdlayer.c: Add high-resolution timer for OS X, using mach_absolute_time().
fix build on OS X, pass LUNATIC define to build/ sources.
fix hex literal parsing on Windows, add two comments.
add 'stat' module for running statistics.
Also, rewrite the mapastats iterator and the LIZTROOP hitscan timing in terms of that.
OSX build: mighty tweak osxbuild.sh and link to LibPNG from Fink on x86_64.
The build script now has two more presets: helix and installtools (which was previously attempted after the build; untested). Also, - when detecting git, run commands such that the SVN repo isn't accessed - package kextract, kgroup and arttool into tools/ in the zip - try to exit on failure in some places, though that doesn't seem to work
osxbuild.sh: factor out building commands and exit 1 on failure
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.
build fix on Windows and translator fix with 32-bit archs?
erratum in r2844 commit message: ydim vs. bytesperline --> xdim vs. bytesperline
Add gethitickms() to the Windows layer.
Make DukePlayer_t's transporter_hold an int16_t again.
This was narrowed to int8_t in r1625, breaking CON code that wanted to lock the player for a longer time than 127 game tics.
Prevent integer div-by-0 (SIGFPE) when drawing console background with void tiles.
The tiles used are BIGHOLE (1141) and VIEWBORDER (3250). Ideally we'd draw the console background using something specially-coded instead of rotatesprite if it's fully black anyway.
Fix SHOW MAP ON/OFF message in the game.
PNG screenshots: fix oob read of malloc'd mem on Windows.
These could manifest themselves as garbage lines on the bottom and happened because of the ydim vs. bytesperline discrepancy again.
Add custom-built lean zlib and libpng and enable PNG screenshots on Windows.
Instructions on how I built the libs are in Windows/src/minipng.dfa.
time every event and actor call and print summary at game exit.
add "bit array" helper module, rewrite the bit test in terms of that.
fix underwalls being not animated (introduced in r2823).
clamp GL texture to edge if possible, preventing potential stray lines
don't call I_ClearAllInput() before idle loop.
If input is cleared before, it can become impossible to cancel the video when decoding and displaying a frame takes longer than a frame.
collect times while playing the video and print a summary to the log afterwards.
Update LibVPX prebuilt library and headers to git commit 3eb4143fc3381497128d.
The library was built with GCC 4.6.1 and configured like ./configure --disable-vp8-encoder --disable-multithread --disable-spatial-resampling On the aforementioned AMD system, this reduces the mean time for decoding a frame from 18.2 to 15.4 ms, so IMO it's worth the somewhat hefty addition of 430 Kb.
unroll 3 planes -> packed conversion loop.
On an AMD Phenom II X4 system with generic memory modules, this brings down the mean time for this conversion from 16.5 to 10.5 ms. (GCC 4.6.1, optimized build)
This should fix the "assignment discards 'const' qualifier" warning in music.c.
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).
EVENT_DRAW3DSCREEN, screenshot functonality.
The event is run after drawing the scene, but before the overlays. To make a screenshot from a script, set DOSCRSHOT to non-zero. It will then be scheduled to run once after the drawing but before the above-mentioned event. The screenshots will be called mcapXXXX.{png,tga}.
Comment out printext256's GL mode fallback code.
This would only hit when polymost_printext256 erred out (mem alloc failure, glGenTextures failure), i.e. "almost never". Also, tweak a bound check in polymost_printext256.
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 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.
add {,m,t}vlineasm1nonpow2, currently unreferenced from high-level drawing.
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.
Makefile.common: add a couple of C warning flags.
Most notably, -Wdeclaration-after-statement. This and -Wpointer-arith give some warning on linux, but this is "harmless" as it's assumed that we'll be always compiling with GCC or Clang there. Also, erratum in the "Make ksqrt take uint32_t ..." commit: hypotenuse -> squared length of the hypotenuse
Constify various char* vars, parameters, etc. for more -Wwrite-strings cleanness
-Wwrite-strings is useful to detect code where string literals and e.g. alloc'd strings are used side-by-side, potentially creating dangerous situations, or to find uses of old, non-constified APIs. However, enabling it would still flood the log with too many warnings. Also, GCC wrongly warns for initializations of char arrays.
const char *scripthist -> char *, since it's alloc'd/freed
actors.c: factor out 4 almost identical code instances into proj_spawn_and_sound
Most differences are handled with function parameters, except that one instance checked SpriteProjectile[i].spawns for being >0 instead of >=0. The factored function always checks for >=0.
Make nsqrtasm return int32_t (instead of uint32_t) when compiled with GCC/x86.
Fix actors at action 0 executing the action C code protion in gameexec.c.
The bug was introduced with SAMESIZE_ACTOR_T enabling in r2208. This fixes being unable to read the messages in A.Dream* by zykov eddy.
some trivial mapster tweaks
safety tweaks, expose more stuff
Arrays inside structs must not be accessible, since they're not bound-checked by the FFI. Therefore, we flatten them into repeated scalar fields and need to write accessor functions later.
When teleporting silently, also set g_player[].ps->bobposx/y to the new position
This fixes an integer overflow when a distance is calculated later.
Integer Overflow Offensive continued: first round of -ftrapv - cleanness.
That is, "clang -ftrapv" builds don't abort almost immediately after entering a level. There are various classes of overflow bugs, needing different handling: - Some texture mapping code was written with signed integer wrapping semantics in mind. In some places, we're able to get away with unsigned casts. - sometimes, we really need a wider range, like when calculating distances or dot products - negating INT_MIN. Here, we cast to int64_t temporarily. Note that if the result is 32-bit wide, no 64-bit code may actually need to be generated. - shifting into a signed integer's sign bit. We cast to uint32 here. - in hitscan(), at the "abyss crash prevention code" comment, it's clearly the other code that is better... This is not merely done for pedantry, but rather makes it easier to track down overflow bugs having a real impact on the game.
Fix being unable to hit ENTER on VIDEO SETTINS -> RENDERER SETUP with classic.
various stuff
- hitscan & related types and constants - profiling with gethitickms - translator: eval the opening parts of block commands early - fix getbunch
SDL layer: tweak high-resolution timers for profiling, add gethitickms().
For SDL 1.2 and when building on linux, the code using clock_gettime(CLOCK_MONOTINIC, ...) is taken over from SDL HG. gethitickms() is a convenience function that return milliseconds as doubles and isn't exposed in any header file, yet.
Add prototypical SDL 2.X support.
Doesn't work: indexed-color modes, gamma (at least for X11), mouse wheel, special keys like ENTER or BACKSPACE in the OSD, probably more... In build/Makefile.shared, we now have logic to autodetect an SDL2 installed in /usr/local, however OS X and Wii builds follow other Makefile code paths, it seems. Note that the matching SDL2_mixer must be used then, too. In source/jaudiolib/src/driver_sdl.c, change the #includes from <SDL/SDL_xxx.h> to "SDL_xxx.h". SDL wiki says this is the most portable way, hopefully this doesn't break builds for anyone.