I added more missing fields to savegame/tables/fields.h and reordered
everything to make missing fields easier to find.
This broke savegame compatibility, and that might happen again.
I hope I'll remember to bump the savegame version before merging this
branch to master.
I also got segfaults (e.g. when a door was blocked by a corpse) in
G_UseTargets() because activator was NULL.
And in g_cmds.c there was a typo in OnSameTeam() - from the relatively
recent fix. No idea why, it doesn't exist in the other addons..
savegame/tables/fields.h was missing some fields with FFL_NOSPAWN
and FFL_NOSPAWN handling in g_spawn.c was missing
Because of that after loading a savegame some pointers were invalid
and dereferencing them resulted in segfaults.
See https://github.com/yquake2/yquake2/issues/71
and https://github.com/yquake2/xatrix/issues/4
In ClientThink(), the float value ent->velocity[i]*8 is saved into
a short and if the value is too big for a short, in 32bit gcc builds
the short is set to SHRT_MIN, resulting in the player being pressed
down instead of up.
Now we put the result in a 32bit int first (which should be big enough)
and assign the int to the short. This still overflows, but with -fwrapv
at least in a defined way (most probably the same way the original
binaries did).
The Makefile now sets $CC to gcc for MingW builds, this should fix
https://github.com/yquake2/xatrix/issues/3
And while I was at it, when the game lib is loaded, it prints the date
it was built, this is especially interesting for our Win32 binaries.
In rogue's RHANGAR1 the turret didn't blow up the ceiling when friendly fire
was off, because in ClientTeam() both entities were set to "" (no team),
but OnSameTeam() just did a strcmp() instead of checking this special
case (no team).
We check this now and thus it works. Hooray.
I also refactored ClientTeam() to take the buffer instead of using a
static one and to be static (it's only called by OnSameTeam() anyway).
The savegame table entry for this function was invalid, but it doesn't
need to be saved anyway, so I just deleted it from the table.
This is a port of Team Evolves Zaero to Yamagi Quake II. It's
unfinished. While it might work, there are most likely some serious bugs
left! Use this at you own risk! Patches (or better pull requests) are
welcome.
The first commit messages are a mess and in german. Sorry for that.