Build 3241
SVN-
General
Add "dump_used_assets.m32" to samples. This script can be used to extract what tilenum and sound IDs are used in maps.
SVN handles and Git names are merged into one person.
Add "dump_used_assets.m32" to samples. This script can be used to extract what tilenum and sound IDs are used in maps.
Misc. engine cleanups, no functional changes.
engine.c: factor out 2 pract. ident. pieces of code into try_facespr_intersect.
The two uses are from hitscan and neartag. The functionality is reproduced exactly (assuming I made no mistake), down to different distance checking (<= vs. <).
RENDERTYPE=SDL on Windows, part 2.
This introduces winbits.[ch] in the engine, containing layer-independent code migrated from winlayer, including nedmalloc, ebacktrace1, OS version detection, and high-resolution profiling timers. sdlayer has been expanded to include the code from winbits under _WIN32. All uses of RENDERTYPEWIN in the source have been examined and changed to _WIN32 (or removed) where the block in question is layer-independent.
Remove many redundant (int16_t) casts and one now incorrect one.
The redundant ones are in code like this: s->cstat = (int16_t)32768; Because the value is eventually converted to the type of "s->cstat", any casts to integral types having at least as many bits are no-ops, signedness being irrelevant due to (probably any two's complement arch targeting compiler's) bit-pattern preserving semantics of these conversions. The now incorrect one is: if (lotag == (int16_t) 65535), "int32_t lotag" being read from a wall or sprite struct directly earlier. Now, with these members being unsigned, and (int16_t)65535 equalling -1, the check always fails. The correction fixes normal switches having such a lotag ending the level immediately. In short: integer casts before assignments are unnecessary, those in reads highly relevant!
Engine cleanup: factor out code getting bounds of sprites.
Clean up base engine functions: tighten scope of locals declarations.
Clean up engine code by factoring repeated 3-liners into spriteheightofs().
This function also changed: it doesn't handle floor-aligned sprites now, and the z offset is returned instead of set by pointer.
fix cycling picnum in 3D mode.
Using non-keypad [-]/[+] or LMB + mousewheel, it was broken when a void tile was in between.
Add "ulotag" and "uhitag" to get/setactor/wall/sector, which exposes the tags unsigned, without the typecast to int16_t. This might be useful to someone.
make lotag/hitag getters return signed values, as per agreement on IRC.
This means that the internal change done to these sprite members in r3159 is hidden from CON for backward-compatibility purposes. Note that .cstat and .{ceiling,floor}stat aren't touched, and will return unsigned values to CON.
Probably fix the zoom crash encountered with Mapster32 and CBP8.
Fix clipboard tile display in 3D mode.
Tools updates:
- Eliminate use of the C++ standard library from arttool. I improved some of the program's workings but it continues to corrupt my art files in certain circumstances. (Note: Not a regression; it happens with previous revisions.) - Construct "make utils" for the game side following the pattern of the engine. - Move ivfrate to this new distinction. - Minor Makefile cleanup and tweaks, mainly to facilitate CLANG=1 and to formalize text output in special cases.
Fix the warnings when building with C++, add MSVC C++ build support. This also changes the internal type of lotags, hitags and cstat type fields to uint16_t instead of int16_t to clean up some dubious behavior wherein the code was using a value of 32768 as a flag in these fields for certain types of things, like invisible sprites (using the value as if it was uint16_t) where it was elsewhere checking if the value was < 0 (using the value as if it was int16_t). This change may break a few specific effects if any part of the relevant code was missed when looking for areas that needed to be addressed.
I think there's also a fix for the CON precache system breakage in here (lost it in my local tree when I started getting the C++ build working in MSVC, sorry!)
set first walls more conveniently on split in one special case.
Specifically, if the first wall of the sector-to-split is to the left or right of the *start* of the splitting line AND the sector has no TROR extensions, make these two the new nextwalls of the respective split sectors.
Lunatic reorganization part 2: split into engine and editor/game parts.
On the engine side (functions starting with L_), there are now the basic parts like state creation and running code from strings and files. The game and editor can add to that by e.g. loading whatever they please into the state. Their functions start with El_ and Em_, respectively. The Lua scripts still reside in source/lunatic, even for the common ones. This is because they will be embedded into the binaries as bytecode or compressed source eventually, so their location on disk will be irrelevant.
Clean up texture loading code etc. in polymost.c, no functional changes.
fix rotatesprite with no screen scaling and non-widescreen aspects.
Also, enable showing sprites in Mapster32's overhead view again, since that was one (the only?) use of that code path. The uninitialized read was introduced in r2927.
When found a camera sprite for viewscreen, set position etc. immediately.
Instead of later in P_ProcessInput(). This fixes one drawrooms() call in between where the sectnum is the camera's, but the position the player's, which can lead to a slow "outer view" render in Polymer.
Add automatic tracking to the sector[], wall[], sprite[] and tsprite[]
arrays; any write access to them will run the corresponding hook and write to the [sector/wall/sprite/tsprite]clean array. Note: tsprite and sprite use the same hook and require running a few more instructions per access in order to disambiguiate; this could be made more optimal (like the other arrays) by clearly separating the types in the game code. Note #2: taking a member's address currently marks it dirty because of tons of helper functions across the editor code. I don't know how many read-only accesses we have after taking a member address, but it could also be fixed with some finessing of the code.
Fix the Linux mapster32 build with LTO enabled.
Work-in-progress adjustment to the C code to compile under C++. It builds for me without errors using Win32 MinGW-GCC, but it still generates warning soup. No guarantees about MSVC or anything using SDL. Enable C++ by building with CPLUSPLUS=1. C remains the default and should compile with no change in setup.
Credit to Plagman for the idea and doing the work on the game side, which is included in this commit. (Building as C++ will give us features with which we can make improvements and optimizations on the multiplayer code and Polymer.)
engine.c: add bound-check assert failing for sprites in m32's textured 2D mode.
Also, disable drawing sprites in that mode for now.
functionality to rotate or scale RShift-highlighted stuff smoothly.
This is done by pressing LShift and - holding down the left mouse button for scaling, or - the right mouse button for rotating the highlighted walls/sprites with respect to a pivot point determined as the center of the bounding box of all highlighted points. Note that scaling sectors isn't that easy and the current functionality is very rudimentary: there's no z scaling, no xrepeat correction, and sprites aren't touched expect for their position. The user is responsible to maintain map consistency, for example to prevent wall-lines of the same sector crossing each other.
when looking for matching wall in 2nd pt. ins., don't skip gray nextwalls.
This fixes a bug where it's not possible to split a sector under certain circumstances, reported by Micky C here: http://forums.duke4.net/topic/1348-mapster32-problems-and-bugs/page__view__findpost__p__138380 Also, don't allow zero in various 'F functions: Resize selection and Global {shade, visibility} divide.
Work around the transparent line with on-screen chaingun and linear filtering.
We do this by messing with the GL texture that gets uploaded for CHAINGUN. Since this is implemented on the engine side, the static value for CHAINGUN (2536) is used, and the tile dimensions are compared to 211x55 to have a little confidence that the tile wasn't overridden by a mod. Hack indeed.
draw lines to linking sprites with LShift, jump to them with +[ or +]
When LShift is pressed and the mouse is over a linking sprite (as determined by the tag labeling system), lines are drawn to all other sprites, and pressing [ or ] will cycle these then. False positives and missed sprites are possible. Additional changes: - consider SE 31 and 32's lotag to NOT be linking, since the ACTIVATOR is what matters. The original maps are inconsistent there. - When pressing Alt+[ or Alt+] and there are no corruptions, say so instead of doing [ or ].
when punching loop, fade screen; tweak two messages.
Two new player structure members: "autostep" and "autostep_sbw".
These control the maximum difference in height between two sectors that the player will automatically traverse without needing to jump. The latter controls the special case when the player's sector's lotag is ST_1_ABOVE_WATER or p->spritebridge == 1. BYTEVERSION bumped.
Slight makefile reorganization and cleanup.
* Centralize optimization strategies in Makefile.common. This required moving detection of $(PLATFORM), which makes sense if we work on the paradigm that Makefile.common is for generic compiler setup and Makefile.shared works with libraries and things closer to the engine and game code itself. * New Makefile variables OPTOPT (Optimization Options) and CUSTOMOPT (Custom Optimizations). OPTOPT by default contains -march, -mtune, etc. Setting this variable from Make invocation will blank these. CUSTOMOPT (Custom Optimizations) works the same but in an additive fashion, overwriting nothing. Technically CUSTOMOPT could stand for (Custom Options) and include any additional parameters sent to both linker and compiler. * Factor out literal names of the main executables. * The build process now prints assembler (if NOASM=0) and linker settings in addition to compiler settings.
Comment out the A_GetZLimits() call right before the Bassert() in A_MoveSprite(). This call is a problem because the assertion expects "dasectnum" and spr->sectnum to match, but A_GetZLimits() can itself call A_SetSprite() which results in another call to A_MoveSprite() and can potentially change the sectnum again.
This commit also adds the NOTELEPORT sprite flag, which of course prevents sprites from teleporting.