Build 3529
SVN-
General
Lunatic translator: fix codegen for "break" inside while loops.
Show details
Note: usually, languages call this "continue". Jeez, CON...
SVN handles and Git names are merged into one person.
Lunatic translator: fix codegen for "break" inside while loops.
Note: usually, languages call this "continue". Jeez, CON...
initialize test Lua state earlier so that 'setdefname' has an effect.
Remove some duplicate or unused control layer defines.
Notes: - MAXJOYBUTTONS is out of sync between the two definitions - In menus.c, NUMMOUSEFUNCTIONS must equal MAXMOUSEBUTTONS, fail to compile if this becomes false.
Lunatic translator: handle RETURN across events.
engine.c: in setpolymost2dview(), set gloy=-1 unconditionally.
This fixes an update issue: start EDuke32 without warping to a map in Polymost, change to classic, and change to Polymost again. The OSD background will be displaced.
sector[]:zrangeat(), 'getzrange' command for the translator.
Also, fix quote commands there.
Lunatic Makefile.deps: make game.c depend on defs.ilua.
Since the size of defs.ilua's bytecode is used in game.c.
export C functions that may call into CON events using the Lua C API.
We must not call these functions using the FFI, since the Lua state is considered locked across such calls.
begin fixing up the code because it's now actually live!
Lunatic translator: keep states, game{vars, arrays} in tables instead of locals.
Since it's too easy to hit the 200 locals limit.
compile defs.ilua as bytecode and load it from the executable.
Lunatic translator: eventloadactor.
gameexec.c: factor out 2x used code into VM_KillIt.
Also, for Lunatic, handle killit from events.
Lunatic translator: switch statement.
Lunatic translator: qgetsysstr.
Lunatic translator: fix quote commands, taking care of corner cases. Add test.
add "movement by one" debugging functionality via a.m32.
If m32script gamevar "move_by_one" is nonzero, the some keys move the "player arrow" by increments of 1: - Without SHIFT: LEFT/RIGHT absolute x, DOWN/UP absolute y, A/Z absolute z. - With SHIFT: DOWN/UP (unbounded!) horiz, LEFT/RIGHT angle. This can be useful to debug renderer bugs that show a high sensitivity to the exact location ("are transient in space").
Disable playing RTS sounds until a crash can be resolved.
See comments in the source for details.
Lunatic translator: qsprintf.
CON qsprintf: fix specifying more than one "%s" conversion.
Also, slightly better, though still inadequate checking.
don't accept read-only vars for first arg of qstrlen.
Lunatic translator: a couple of quote commands, while*n.
Reduce volume number modulo MAXVOLUMES for -v command line option.
more commands...
gameexec.c: refactor 'starttrack' for proper bound checking.
more commands, timing test for xmath's sine functions.
xmath module + timing test for distance functions.
Fix build without Ken's ZIP library (WITHKPLIB not #define'd in compat.h).
Classic renderer: high-precision sprite drawing, preventing stray lines on top.
Face- and wall-aligned sprites are drawn using the wall routines in BUILD. However, the per-x-screen-coordinate distance (swall[]) is calculated in a way that potentially incurs great precision loss (for example 5 bits for xdimen=1280, yxaspect=65536). This leads to the starting (top) vertical texture coordinate possibly wrapping to large values, leaving an unsightly "stray line" on top of the sprite from certain viewing angles/horiz values. The approach to fix it has two parts: first, the distance is calculated using float values, preventing the precision loss. Because this doesn't fully prevent the unwanted lines, the texture coords are clamped to the mininum and maximum (0 and UINT32_MAX respectively) when calculating them for sprites. Note that stray lines may still appear at the *bottom* of sprites under certain circumstances, for example when viewing at a y-flipped sprite from above. These should be less noticable in real-world usage though. The feature is guarded by a macro HIGH_PRECISION_SPRITE in case using floating point or 64-bit integers is undesirable/impossible on some platforms.
engine.c: factor out calculation of texture coords / addresses in wall drawing.
engine.c: don't pass [udls]wal to maskwallscan(), use *wall globals instead.
Lunatic translator: more of everything...
CON myosx*: move masking orientation with user-bits-mask to G_DrawTileGeneric().
Make g_earthquakeTime into a uint16_t, remove DukePlayer_t's name[] member.
Bump BYTEVERSION.
input access.
Factor out player[].* allocation into G_MaybeAllocPlayer(), rename 2 functions.
sprite.change{sect,stat}, access to more members, member read test.
engine.c: in changesprite{sect,stat}, swap second and third early-out tests.
That is, first check if the sprite is in the game world and then if it already has the desired sector or status number. This doesn't change anything in our codebase, since the return values of these functions are never examined.
Lunatic translator: userdef access.
Fix POLYMER=0 build, cleaning up #include discipline on the way.
Also taking care that the USE_OPENGL=0 build builds.
Lunatic (translator): thisprojectile, *shoot.
Rework how the z velocity is passed from *zshoot to A_Shoot().
Previously, actor[].shootzvel (implementation detail, not available to CON) was checked, and if it was !=0, that was the overridden velocity. The value 0 meant "hardcoded, projectile-dependent velocity". But that neccesiated a hack where if zvel 0 was passed and really meant, it needed to be set to 1 instead. Now we have A_ShootWithZvel() taking an additional last argument plus a macro SHOOT_HARDCODED_ZVEL permissible for that argument.
player.c: factor out more identical code into Proj_DoHitscan().
Also, simplify a couple of other lines.
projectiles...
Lose the packed attribute on / rearrange some game struct types.
actors.h: remove 'packed' from projectile_t, tiledata_t. In tiledata_t, make .cacherange member an int32_t so that the following member "projectile_t defproj" is aligned on a 4-byte boundary. player.h: remove 'packed' from playerspawn_t, DukeStatus_t, input_t. In Lunatic, correct packing attribute of the base type of the unrestricted actor_t and DukePlayer_t pointer types (the declaration was used without Bump BYTEVERSION.
player.c: remove a couple of unnecessary casts.
conditionally compile out more legacy code, remove old mixed mode code.
Lose the 'packed' attribute for types declared in build.h.
Most of them are already aligned to their natural boundaries, so lowering the alignment to 1 byte can only worsen things by making the C compiler generate poorer (unaligned access) code for some platforms. The layout of structures is not specified by the C Standard, but is rather given by a particular platform + toolchain's ABI (application binary interface). Most ABIs follow the expected pattern "alignment of scalars is their size, alignment of arrays is that of its element type, alignment of structs is the maximum alignment of its members". A couple of links to particular ABIs are given in build.h. Problems are expected with archs that care about unaligned access when a pointer to a non-packed struct is taken that resides in a packed aggregate, but these uses should be weeded out (I'm not sure if there are any in our codebase). The following types are affected, only hitdata_t changes its size: sectortype, walltype, spritetype, spriteext_t, spritesmooth_t, struct validmode_t, picanm_t, palette_t, vec2_t, vec3_t, hitdata_t.
Lunatic translator: codegen for actor-tsprite accesses, sync some RO members.
Fix all hitscan weapons (not only pistol) wrongly fire without spread at enemies.
Introduced in r3358, where I missed a condition inside an 'if'.
provide access to actor-tsprite.
game.c: In G_DoSpriteAnimations, put t, i and s locals into their blocks.
And const them appropriately. Also remove #if 0'ed code related to an MSVC pragma.
NULL spriteext[].tpsr after each running EVENT_ANIMATESPRITES for a tsprite.
Meaning that only *ettsprite[THISACTOR] makes sense from CON. It did before too, because .tspr was set before each event run (and not before all runs), only that it was never nulled, which was kind of untidy.
remove unused tsprite access via spriteext[].tspr.
Don't set spriteext[].tspr when creating tsprites from the engine.
Its only use is to have a actor -> tsprite mapping for the EVENT_ANIMATESPRITE event and .tspr will be set before it is run.
Lunatic (translator): provide checked write access to a couple more members.
Centralize all bound-checking in bcheck.lua.
Lunatic translator: codegen for some "method-like" member write accesses.
Lunatic translator: a couple of set-struct commands, "-I" option for default dir.
Don't apply GL fogging to wall lines drawn in game's "light" overhead view.
prefer to use ctype objects instead of C type strings.
Pass types via ffi.typeof() instead of declaring them in the global namespace when possible.
player.c: return early from various P_Display*() if player's *incs are oob.
use bcarray types to guard accesses to arrays inside structs.
Lunatic translator: struct read access.
Lunatic translator: prototypical array/struct access, for reference only.
a little bit of everything.
sync with preceding change, complete two commands.
CON parser: don't accept read-only gamevars for 1st arg of *sprite{sect,stat}.
game.c: replace one missed instance of inline code with calc_smoothratio().
sync with preceding change, fix r3419.
Rework hardcoded BADGUY sprite flag initialization (i.e. amend r3257).
Use a new flag to mark hard-coded enemies, not SPRITE_BADGUY. This fixes an issue where in E1L4, a pigcop would appear in the area you have to crawl under shrunk. Thanks to LLCoolDave1 for pinpointing the range of relevant revisions.
Fix USE_OPENGL=0 build.
fix cycling to the next link sprite with LShift+"]", tweak message.
fix wrongly stripping debug binaries...
... when 'make' is invoked like "make ... STRIP=some_strip".
simplify how to determine whether the final binary is stripped.
Whenever it should be not, STRIP is set to the empty string. This fixes the Lunatic RELEASE=1 build.
Reimplement pixel doubling by drawing scene at 1/(2*2) resolution and expanding.
The pixel doubling now only applies to the area where the world scene is drawn, i.e. it may be smaller than the physical screen / WM window size. The optimized version is slightly faster than for non-doubled pixels for me (optimized build), but see code for caveats. Some other minor issues: - won't work when the world is drawn from demo cameras (and offscreen, but that matters less) - will leave a few pixels empty when running with x resolutions not evenly divisible by 4
game.c: pull out two G_DrawRooms blocks into G_OROR_DupSprite and G_ReadGLFrame.
... to have a little moew overview.
Lunatic translator: handle overriding system GVs.
player.c: make four functions file-local.