Build 4965
SVN-
General
engine.c: style-cleanup owallmost() and wallmost(). DONT_BUILD.
-
General
In DEBUGANYWAY=2/DEBUG_MAIN_ARRAYS build, declare tsprite[] as tspritetype.
Show details
Fixing a bunch of warnings. DONT_BUILD.
SVN handles and Git names are merged into one person.
engine.c: style-cleanup owallmost() and wallmost(). DONT_BUILD.
In DEBUGANYWAY=2/DEBUG_MAIN_ARRAYS build, declare tsprite[] as tspritetype.
Fixing a bunch of warnings. DONT_BUILD.
engine.c: in qsetmodeany(), call initsmost() after setting xdim and ydim.
This makes sure that the engine arrays have sufficient space allocated for usage in Mapster32's 2D mode, for example from drawmapview().
fix build and linking. DONT_BUILD.
- t{sector,wall}type are simply typedef'd to the non-t versions - make FORCE_INLINE unconditional of DISABLE_INLINING (otherwise there are multiple definitions of these functions) - update lunatic/doc/lpeg-lunatic.patch to apply against the LPeg 0.12 I just downloaded
remove unused key* options in mapster32.cfg and corresponding BK_* macros. DONT_BUILD.
polymost.c: fix possible access of wallchanged[-1]. DONT_BUILD.
engine.c: fix memory leak. DONT_BUILD.
polymost.c: fix C build. DONT_BUILD.
Fix Mapster32 sector copying
Fix undefined behavior in Polymost
fix wall and floor sprites clipping into or z-fighting with surfaces (replaces glDepthRange() hacks for sprites), add r_nofog cvar for debugging, reduce the total number of OpenGL calls by only calling glFogi() to set the fog mode when initializing the renderer or changing r_usenewshading.
Introduce "twalltype" for temporary uses of walltype where using wall_tracker_hook() would be invalid. This is similar to "tspritetype" and fixes a bunch of problems in the editor that cropped up when changing the tracker sanity checks to an assert that only exists in debug builds (branching upon any write to a sprite, sector or wall had an unacceptable impact on performance).
Fix Mapster32 bug where pressing "O" on a sprite twice would corrupt your map due to unchecked use of hitscan results.
Revise C++ structure trackers for performance and introduce "tspritetype", for temporary sprites or other usages where using the trackers would be invalid or undesired. DONT_BUILD.
Replace hightile grayscale method (usually combined with tints to produce
replacements for the first handful of palette lookups) w8th superior "luma" method. DONT_BUILD.
engine.c: fix clipmove() against upper part of wall-aligned sprites.
engine.c: on non-touch devices, roughly double maximum voxel drawing distance.
By setting DISTRECIPSIZ to 131072, as far as I can see the absolute maximum that's possible with the integer scaling convention of the voxel drawing code. BUILD_LUNATIC.
make sprite duplication examples in m32script_ex.map work again.
- Work around a sequencing issue (assignment of searchstat) in M32_DrawRoomsAndMasks() - When having sprites highlighted and changing shade, since r1943 change every highlighted sprite's shade if one of them is aimed at. With this revision, if SHIFT is pressed while doing that, only change the aimed at sprite's shade - a.m32: Use 'break' from a state instead of 'return'. The former may be "sticky" in a way that is not intended. Needs to be debugged later. - Update instructions in m32script_ex.map DONT_BUILD.
engine.c: prevent multiple collection of same sector in scansector().
Also for polymost_scansector(). These were likely of little consequence because collection in scansector() is the exception than the rule (see added comments), and because the redundant drawwalls() would find the x range done the second and following times. Also, add a bound check for sectorborder[] (the limit was probably rarely hit in practice, but the check is mandatory nontheless) and add functions printscans() and printbunches() in the DEBUGGINGAIDS=2 build.
engine.c: in drawmasks(), remove sorting sprites by statnum.
There were various issues with that code. - It does not seem to be very meaningful to do so. - It was carried out on the same range as the sprites sorted by z coordinate (those with equal x/y) just a few lines away, effectively overriding it. The former is very meaningful, though. - It led to inconsistencies between editor and game, see http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__214873
Cleanup of various engine functions.
- factor out calculation of player-relative and screen+clipped-player-relative coordinates into get_rel_coords() and get_screen_coords(), respectively - the usual beautification stuff, especially since we're now on C99
always return non-negative values from 'clipmove' and related.
Previously, the C function clipmove() returned negative values when hit a wall (32768+wallnum) or sprite (49152+spritenum) because internally, these values were encoded into a *signed* 16-bit integer. This made no difference to C code using it, since it always proceeded by bit checks, but was inconsistent with documentation on CON 'clipmove' on the wiki. The following commands are affected too, since they use the value returned by clipmove(): 'clipmovenoslide', 'movesprite'. Also, the value of actor[].movflag ('htmovflag' from CON). Also, fix 'clipmove*' in LunaCON and add lunatic/test/checknearwall.con as an example of how to implement a being-close-to-a-wall checker as requested in http://forums.duke4.net/topic/7869-determining-closeness-to-a-wall/
engine.c: fix clipmove() against floor-aligned sprites.
Introduced in r3207. Oops.
engine.c: prevent an oob read of spriteext[] in drawsprite_classic().
disable all loop checks as they spam the log too much. DONT_BUILD.
The one introduced with r4569.
Propagate 'smoothratio' to scenes drawn from the position of a camera.
That is, make interpolation work properly there -- both when 'using' a VIEWSCREEN and when rendering the scene onto a TILE_VIEWSCR. This makes a difference only if the camera is in a moving sector.
Minor cleanup, mostly in engine.c:drawalls().
Tweak the behavior of viewscreens to what is more logical IMO.
- At a given time, at most one viewscreen may display TILE_VIEWSCR, namely that one which is g_curViewscreen - sync kinds of distance to compare against VIEWSCREEN_ACTIVE_DISTANCE (was Manhattan vs. dist(), now both the latter) - fix resetting to VIEWSCREEN tile when player is greater from it than that distance. When the player is closer to it again, it is *not* reset to TILE_VIEWSCR. - more sync'd g_curViewscreen and sprite[i].yvel (for 'i' being the viewscreen sprite) Note: in a multiplayer context, this needs to be thought about once more.
engine.c: clamp all indices for distrecip[] access, as more OOBs were observed.
Convert voxels to models only when starting or changing to Polymost.
Analogously to the way models are processed in a deferred manner for Polymer.
A couple of miscellaneous cleanups.
defs.c: sync some dup'd code for 'definevoxel' and 'voxel' DEF tokens. engine.c: factor out PolymerProcessModels().
engine.c: style-cleanup drawvox(). Also clean up ALL of voxmodel.c.
No deliberate semantic changes here.
include wall[].ypanning in wall invalidation logic.
Fixes bug reported here: http://forums.duke4.net/topic/1348-mapster32-problems-and-bugs/page__view__findpost__p__213759
Minor cleanup around security cameras / viewscreens. DONT_BUILD.
The only semantic change is that an out-of-sync instance of a distance to check (viewscreen sprite <-> player sprite) is changed in actors.c:G_MoveStandables(), from 2048 (as in Duke3D 1.5) to 8192, now represented by the define VIEWSCREEN_ACTIVE_DISTANCE. I have not yet observed any change in behavior regarding this change (but there ought to be one). Also, in DNCOORDS display, print 'totalclock' count, too.
don't draw masked walls with void tile. DONT_BUILD.
This prevents displaying W_FORCEFIELD+1 masks (as e.g. in front of viewscreens) completely black with ART mapping. The old behavior, which is inconsistent with classic, is kept for one-sided masked walls, though.
Pull setting g_noFloorPal[] further down, into makepalookup().
Now passed as last arg 'noFloorPal' to makepalookup(). Used as follows: - from loadlookups(): *false*, i.e. do take over floor pal. - from generatefogpals() [default fog pals] and fillemptylookups(): *true*, i.e. don't take over floor pal - from DEF 'fogpal': true - from DEF 'makepalookup': take over flag from pal from which we are remapping, or set to true if remapping from pal 0 - (CROSSHAIR_PAL: true) This should make the issue reported in http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__197583 resolve in a natural manner.
Move g_noFloorPal[] to the engine side and adapt other stuff accordingly.
- 'nofloorpalrange' DEF token: now handled for both game and editor (for the latter, it's effective only for "shade preview" mode, [']+[X]). - in generatefogpals(), assign g_noFloorPal[] = 1 for every generated (default) fog pal; get rid of its return value / g_firstFogPal
engine.c: prevent an oob access of uwall[] in ceilspritescan().
engine.c: style tweaks (tighter var. declaration) in sprite drawing functions.
voxmodel.c: fix Polymost rendering of voxels.
This reverts/corrects two semantic changes of r4639 as far as what is now voxmodel.c (formerly part of mdsprite.c) is concerned. One correction ends up having no effect (m->bscale is always 1.f for voxel models, as far as I can see), but is the proper rewrite. Also, in osdcmds.c:registerosdcommands(), tweak two help strings.
engine.c: minor stylistic changes. DONT_BUILD.
Since we're targeting C99/C++ now, we can finally declare variables as close to their use as possible.
Fix displaying a savegame preview shot when in OpenGL and/or when the selected slot is empty. DONT_BUILD.
Fix POLYMER=0 GTK C++ build. DONT_BUILD.
Fix POLYMER=0 build and a couple of unused-variable warnings with it. DONT_BUILD.
engine.c: in wallscan(), fix oob of umost[] and dmost[] when x2 == xdim-1.
Analogously treat maskwallscan() and transmaskwallscan(), although I could not get the respective accesses to be oob, too.
Fix Mapster32 fullscreen video modes. DONT_BUILD.
Fix voxels in classic -- my error, confusing divscale() and mulscale() in r4576.
Optimizations are left to the reader :P. I would prefer to look for ways of giving the compilers hints about loops to unroll instead of having to read the resulting mess of manual unrolling, though.