Commit graph

191 commits

Author SHA1 Message Date
Yamagi Burmeister
063776d504 Save gclient_t::resp.coop_respawn.*weapon to fix coop savegames
This fixed bug #357 - the problem was that
client->resp.coop_respawn.weapon and .lastweapon (pointers to gitem)
were not properly initialized when loading a savegame.
Now those fields are saved (=> we had to bump the savegame version)
and for old savegames client->resp.coop_rewspawn is initialized
from client->pers, as a hack for backwards-compatibility.
2019-02-04 10:50:23 +01:00
Yamagi Burmeister
1f82ad2154 Fix parasite, return true instead of false when checking attacks.
This was one of those stupid brainos where you know it better and still
do it wrong... In standard C the return value of a non-void function is
undefined if the closing } is reached. MSVC++5 and 6 returned 1 for
functions with return type int. Since qboolean == int parasite_blocked()
and parasite_checkattack() should return true and not false.

BUT: The true in parasite_blocked() was correct, in the original MSVC++6
build parasites always thought that they're blocked and tried to free
themself.

In parasite_checkattack() the false was wrong, so change it to true. And
yes, the function is crap. The better part of it doesn't make sense and
just burns CPU cycles for nothing. But it's working now and everyone is
happy, so let's leave it alone.

This fixes yquake2 issue #359.
2019-01-30 18:32:17 +01:00
Yamagi Burmeister
433a1423d9 Import Q_strlcpy() and replace several dangerous strncpy() with it. 2018-10-25 19:26:17 +02:00
Yamagi Burmeister
949e9aa008 Switch some annoying and wrong GCC warnings off. 2018-10-25 19:23:49 +02:00
Yamagi Burmeister
fbf3841eaa Call strcasecmp() and not Quake IIs home made version.
The home made version is crap and not const correct.
2018-10-25 19:22:27 +02:00
Yamagi Burmeister
ffdd699ff4 Add variable declaration missed in the last commit. 2018-10-13 09:08:31 +02:00
Yamagi Burmeister
ed4e94510d Split the gibs per frame limit between gibs and debris.
The gibs and debris per frame must be limited to prevent server mem
map overflows. Until now debris and gibs were handled the same, the
debris spawned by rockets and grenates could prevent the actual gibs
of the killed monster from spawning.

Before this change 20 entities were spawned at max. Now up tp 40
enties can be spawned. This needs some testings.
2018-10-07 12:03:23 +02:00
Yamagi Burmeister
c620cea34b Don't accelerate upper entities, let them be pushed by the lower ent.
A long time ago in 2b4f223 I introduced a small logic change to the
handling of stacked entities. If two entities were standing on each
other the original code set the movement speed of the upper entity
to 0. It would be pushed or dragged by the lower entity. I changed
that in way that the upper entity got the same speed as the lower
entity. With that change it wasn't pushed or dragged but moving on
it's own. I hoped to fix some of the 'elevator hurts player or monster'
bugs.

That hope was wrong, at a later time we quirked all elevators that hurt
the player. Additionally the change lead to physics bugs if entities are
standing on high speed elevators (more than 200 units per seconds). So
revert it
2018-10-07 11:58:46 +02:00
Daniel Gibson
82d8b31d02 Switch to Enforcers bloody skin when he's killed
When killing the enforcer with one shot (instead of damaging him first
without killing, which will switch to the bloody skin), the skin wasn't
changed. Now it is.
2018-10-03 17:45:47 +02:00
Daniel Gibson
525b7dc35a
README: Always put quotes around "Ground Zero"
for consistency.
2018-08-14 21:09:26 +02:00
Adam Leskis
7b69f06360 fix simple typo (#11)
* fix simple typo
* fix name of the addon
2018-08-14 21:08:06 +02:00
Yamagi Burmeister
0cfb74223e Replace strcasecmp() by Q_strcasecmp() for better MSVC compaibility.
This was suggest by @ajbonner in xatrix issue #11.
2018-03-23 15:52:08 +01:00
Yamagi Burmeister
02942e9544 Fix a potential crash in ai_run_melee() and ai_run_missile().
This was found and fixed by Maraakate.
2017-09-07 18:11:10 +02:00
Yamagi Burmeister
891e75c568 Enforce static linkage of libgcc on Windows. 2017-06-16 13:37:22 +02:00
Yamagi Burmeister
800a595225 Update the CHANGELOG for 2.04. 2017-05-25 11:45:51 +02:00
Yamagi Burmeister
b8f7d7e6b7 Fix grammar error
Reported by @lonkamikaze on IRC.
2017-02-11 15:02:38 +01:00
Yamagi Burmeister
1776ec3d31 Fix monsters getting stuck when resurrected by a medic.
While in baseq2 monsters had the abillity to duck it wasn't used
often. The same goes for medics, there are only a few throughout the
whole single player campaign. In rogue things are differed. Due to
some AI changes like support for dodging monsters duck more often and
there a a lot of medics and even it's improved version, the medic
commander.

When a monster dies it's mmove_t is set to the death animation and
it's AI flags are left as they are. When a monster is resurrected by
a medic, the AI flags are reset to 0 and it's spawn function is
called again. Normally this is totally save. But when there're two
medics and both try to resurrect there monster there's a small window
for the monster being respawned without the AI flags reset.

In this case the mmove_t is set to the monsters standard animation,
while the AI flags may be still contain AI_DUCK. When AI_DUCK is set,
but the current animation is not one of the duck animations, the
monster may get stuck. There's even a comment in the code for that
case. ;) Solve this problem by resetting AI_DUCK as soon as the
monster dies.

With this change applied I was unable to reproduce any problem in
regard to medics, medic commanders, resurrection and spwaning of new
monsters.

This closes issue #6.
2017-01-20 16:32:00 +01:00
Yamagi Burmeister
7720887274 Make sure that a monsters enemy is still alive when deciding to attack.
When the monster was already killed by another monster or a coop player
some references may be NULL and the game was crashed. This was observed
by maraakte, who reported it in issue #164. I've just merged his fix
from q2dos.
2016-12-30 10:23:32 +01:00
Yamagi Burmeister
ff4c00e5e6 Reorder conditionals to please unoptimizing compilers
This was requested by Maraakate. This is likely a noop, since even
early compilers from th 1970th supported simple optimiziations like
this.
2016-12-20 15:18:32 +01:00
Yamagi Burmeister
1c70fd8840 Change edict_s->show_hostile from qboolean to int and add casts
This variable is used as an integer. Defining it as a qbooblean is
just wrong. Add some explicit float -> int casts while at it.
2016-12-18 09:23:04 +01:00
Yamagi Burmeister
88617fac09 Rename teleport_time to last_sound time
teleport_time has nothing to do with teleports, it's just the time
since the last player sound. Rename it accordingly. This was suggest
by maraakate in yquake2 issue #162.
2016-12-18 09:22:02 +01:00
Yamagi Burmeister
a389a36844 Fix monsters ignoring the player under certain circumstances
In ai_checkattack() is a check against AI_SOUND_TARGET. If the player
made a noice and the the monster noticed this noise it's true. If
that noice was more than 5 seconds ago the monster forgets that event
and continues with it's search for the player. Otherwise it informs
the surrounding monsters that something interesting has happened and
then returns false. So the problem is: Even if the monster heard the
player and can see him, it aborts at this point.

Fix this by adding an additional visibility check. Do the sound
checking only if the player is not visible, otherwise just continue.

This was reported by shoober420 and debbuged by maraakate. This fix
was DanielGibons idea. This commit fixes yquake2 issue #162.
2016-12-18 09:21:17 +01:00
Yamagi Burmeister
eba36895bb Remove another unneeded sanity checks.
This fixes a warning generated by Clang 3.9.
2016-12-17 10:52:14 +01:00
Yamagi Burmeister
d294e86a45 Remove an unnecessary check.
This was found by Clangs code analyzer.
2016-12-17 10:49:52 +01:00
Yamagi Burmeister
b58a3ae131 Make sure that strings are null terminated.
This is a noop, it just adds some safety. This was reported by maraakate
in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
fbf505834f Use matching strtof(9 instead of atof().
This saves one cast. This was reported by maraakate in yquake2 issue
160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
b16293c01b Take into account that the player origin may not be in his center
This is another corner case that looks more correct in baseq2. This was
reported by maraakate in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
89d48af99d In M_CheckGround() use the trace velocity.
I have no clue what this is about. But when in doupt baseq2 is right...
:) This was reported by maraakate in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
f893d5f8d0 Only start monsters with max_health == health if max_health isn't set.
I dont' know if any monsters start with max_health != health, but this
looks more correct. This was reported by maraakate in yquake2 issue
160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
f4002456b4 In ED_ParseField() replace atof() with strtof().
On most implementations atof() is just a wrapper around strtod().
Calling strtof() saves one cast. For the sake of cinsistency change
atoi() to (int)strtol(), it's a noop. Reported by maraakate in yquake2
issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
c61bff46d7 Don't leak unknown entities.
I don't think that this has a visible effect, because there shouldn't be
any unknown entities in maps creates with the official entities.def.
This was reported by maraakate in quake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
63c71b4e4f Remove sanity check to *data in ED_ParseEdict().
There's another check down below. This was reported by maraakate in
yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
75ea8fe63c Send the player entity to the server when in intermission.
I don't think that this has any visible effect, but it's saver than
assume that in multiplayer all clients enter the intermission at the
same time. This was reported by maraakate in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
2820da8267 Fix sanity check of door_secret_move6() and door_secret_die().
After this change they match the sanity checks in baseq2 and xatrix.
This was reported by maraakate in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
78de36c25a Fix sanity checks of train_blocked() and train_use()
With the changes the sanity checks are the same as in baseq2 and
xatrix. Reported by maraakate in yquake2 issue #160.
2016-12-17 10:44:56 +01:00
Yamagi Burmeister
d5fbc8c0f1 In Move_Calc() and AngleMove_Calc() add a sanity check to *func.
This is the same as in baseq2 and xatrix. This was reported by maraakate
in yquake2 issue #160.
2016-12-17 10:44:21 +01:00
Yamagi Burmeister
23cbffbd39 Set self->targetname to NULL when the head is thrown off
This should be a noop, since heads are only removed when an entity is
dying or dead. Noticed by maraakate and part of yquake2 issue #160.
2016-12-17 10:43:46 +01:00
Daniel Gibson
6f45072c26 Make debris SOLID_NOT
in baseq2 this caused bug #154
2016-10-24 17:28:32 +02:00
Daniel Gibson
08404e0949 Apply fix from 2009 for ai_run() and ai_checkattack(), but w/o old bug
To fix some bug, in baseq2 and xatrix
if(coop->value)
{
	if(FindTargeget(self))
	{
		return;
	}
}
was moved from ai_run() to ai_checkattack().
Do the same here, but without the bug from yquake2/#151
2016-10-23 18:27:31 +02:00
Yamagi Burmeister
b7b8bec0fd Generate game.dylib on OS X. Fixes #148. 2016-08-14 16:29:06 +02:00
Yamagi Burmeister
d7c1d9d7fc Update CHANGELOG 2016-06-25 10:38:12 +02:00
Yamagi Burmeister
6467137619 Switch from an arch whitelist to an "all archs are supported" approach.
The old whitelist was a leftover from the early days of YQ2. It should
run on most / all architectures, as long SDL supports them. As suggested
by smcv in issue #138 generate the OSTYPE and ARCH defines by the build
system instead of hardcoding it.

Savegame compatibility is provided by bumping the savegame version. Old
savegames are compared against the old OSTYPE and ARCH defined, new ones
against the new defines. This compatibility code should be removed
somewhere in the distant future.
2016-06-11 09:47:05 +02:00
Yamagi Burmeister
7e7ed6bf94 Make gibs and debris SOLID_BBOX so they move on entities. 2016-04-29 17:44:52 +02:00
Yamagi Burmeister
89cb707444 Reset gibsthisframe and lastgibframe at map change
Without this change the conditionals at g_misc.c:199 and 381 wouldn't
trigger until level.framenum reach it's previous value, resulting in
much to few debris or gibs being thrown. This fixes #104.

Many thanks to maraakate for the analysis and the idea how to fix it.
2015-10-24 13:19:12 +02:00
Yamagi Burmeister
89586edf99 Update CHANGELOG 2015-09-07 17:16:50 +02:00
Yamagi Burmeister
ac864530cd fix a divinely dumbassed mistake of global 'i' and 'corners' variables
Info_RemoveKey: use memmove instead of strcpy for overlapping memory
areas.

Submitted by: Ozkan Sezer
2015-08-31 18:39:25 +02:00
Yamagi Burmeister
a32778260f SV_Physics_Pusher: fix the 'memory corrupted' check
Submitted by: Ozkan Sezer
2015-08-31 18:36:54 +02:00
Yamagi Burmeister
be3472d045 fix several printf format string errors in games' code
Submitted by: Ozkan Sezer
2015-08-31 18:36:18 +02:00
Yamagi Burmeister
40183c82ae fix misplaced braces in the last else case
Submitted by: Ozkan Sezer
2015-08-31 18:33:50 +02:00
Yamagi Burmeister
a2c0f5cb4f Remove unused prototype of GetGameAPI()
Submitted by: Ozkan Sezer
2015-08-31 18:32:43 +02:00