AQ2 JMod maintenance and puppet demo stability
update
Consolidated update from the original uploaded
source through the current v6 source package
Build system modernization
Reworked the old Linux-only Makefile into a cleaner multi-target
build layout.
Added separate build modes for normal, debug, release and sanitizer
builds.
Moved object files into a build directory instead of leaving them
loose in src.
Added print-config, clean,
distclean and install-oriented targets.
Added a Win64 cross-compile target intended to produce
gamex86_64.dll.
Made AQTION_EXTENSION opt-in instead of enabled by
default, avoiding accidental game API version 4 builds when the server
expects version 3 or 3302.
Replaced the original aggressive optimization flags with safer
debug-friendly defaults:
-O2 -g -fno-omit-frame-pointer -fcommon.
Added stronger warning flags to expose unsafe old C patterns.
Puppet demo crash fixes
Fixed a severe memory corruption bug in
CreatePuppetDemoFile() where an integer player number was
accidentally passed as the destination pointer to
sprintf.
Added safer client index handling for puppet demo filenames and
player demo IDs.
Hardened puppet demo file command parsing so missing command tokens
no longer become unsafe sprintf() or strtok()
inputs.
Fixed unsafe file write formatting in puppet demo load/save
paths.
Replaced direct atof() / atoi() parsing in
puppet demo playback with NULL-safe parsing wrappers.
Fixed the confirmed crash where FollowPuppetDemoFile()
called atof(NULL) while playing a puppet demo.
Added handling for blank, metadata and short lines in puppet demo
playback so footer data does not crash the server.
Confirmed via core dump that the crash path was
FollowPuppetDemoFile() → atof(NULL) from
puppet think/frame processing, then patched that path directly.
Puppet demo metadata and
display fixes
Fixed .pdm metadata parsing for footer lines like
info Author:playername JMod:1.23.
Fixed the load/play display showing Author:Unknown even
when the .pdm file contained a valid author footer.
Preserved support for older info/footer formats where possible.
Fixed the Pup and Time display collision
caused by repeated use of AltString()’s static buffer in
the same snprintf() call.
Made AltString() safer by avoiding uncontrolled writes
and handling NULL input.
Warning and undefined
behavior cleanup
Replaced several unsafe sprintf() calls with bounded
snprintf() or direct null termination.
Replaced zero-length sprintf(buffer, "") calls with
buffer[0] = '\0'.
Fixed format string vulnerabilities such as passing user/file
strings directly as format strings.
Replaced old FOFS/STOFS/LLOFS/CLOFS pointer-to-integer
offset macros with offsetof().
Fixed undefined pointer increment expressions such as
cur = cur++ and
ent->client->chase_target = ent++.
Fixed an accidental assignment in a condition,
if (max = 16), changing it to an actual comparison.
Replaced several float uses of integer abs() with
floating-point absolute value handling.
Replaced the strict-aliasing-unsafe Q_fabs()
implementation with a safer implementation.
Initialized puppet direction vectors before use in puppet look/aim
code.
Added safer appending for small fixed-size display buffers.
Runtime behavior fixes
Fixed the initial game library version mismatch caused by building
with -DAQTION_EXTENSION.
Confirmed the rebuilt game library loads under the expected game API
version when AQTION_EXTENSION is not enabled.
Confirmed puppet demos no longer crash after activation in the
tested server setup.
Improved resilience when puppet demo playback reaches
metadata/footer lines rather than movement-frame lines.
Remaining known
warnings / cleanup candidates
Several old nested-comment warnings remain.
Some misleading-indentation warnings remain in legacy game
logic.
Some unused variables and set-but-unused variables remain.
Some string truncation warnings remain in old Quake II/AQ2 code
paths.
Some nextmap and fixed-array truthiness warnings
remain.
Some save/load code still ignores fread() return
values.
Some old signedness warnings remain in radio/chat/item-name
code.