Commit graph

316 commits

Author SHA1 Message Date
Yamagi
2dbcc66efc
Merge pull request #22 from BjossiAlfreds/monster-viewheight-bugfix
Rogue bugfix for monsters not fighting back against parasites
2019-09-15 09:14:56 +02:00
BjossiAlfreds
fa063e9710 Killtarget teamchain cleanup crash fix 2019-09-14 11:59:06 +00:00
BjossiAlfreds
21a52d294a Fix for Makefile on Windows and gitignore now ignores the release folder 2019-09-14 11:03:05 +00:00
BjossiAlfreds
baf90e941c Rogue bugfix for monsters not fighting back against parasites 2019-09-14 08:12:33 +00:00
Yamagi Burmeister
325910d2fe Make sure that the entity to printes is valid.
Especially after savegame load not all slots in the edicts array may be
used. Check if the current entity has a classname string. This is
another part of yquake2/yquake2#430.
2019-09-07 14:26:42 +02:00
Yamagi Burmeister
e4daf3c070 Fix current health being reset to 100 if >100 at level change.
This is another code inconsistency, we must not clamp the current health
to the client max health (which apparently is always 100) but to the
current max health of the player entity.

Analyzed and fix suggest by @BjossiAlfreds, fixes yquake2/yquake2#441.
2019-09-06 07:17:14 +02:00
Yamagi Burmeister
119b9369e8 Fix monsters not fighting back when attacked by parasite or fixbot.
This is another corner case. Parasites and fixbots have a bbox height of
24, walkmonster_start_go() hardcodes a viewheight of 25. Therefor most
traces in other functions like visible() overshoot the parasite.  Fix
this by not overriding the monster viewheight.

Analyzed and fix suggested by @BjossiAlfreds. Closes issue
yquake2/yquake2#440.
2019-09-06 06:58:35 +02:00
Yamagi Burmeister
57df678fb6 Add 'listentities' command.
This rather sophisticated command prints all entities of one or more
given classes and their coordinates. Possible classes are:

* ammo
* items
* keys
* monsters
* weapons

Classes can be combined into one command, e.g. `listentities ammo keys'
would print all ammunition and all keys. The special class `all` prints
all entities, regardless of their class.

The command is protected by `cheats 1`.

This is part of issue yquake2/yquake2#430.
2019-09-05 17:45:31 +02:00
Yamagi Burmeister
d376d0e5ec Add a new command 'teleport'.
A command that teleports the player to abitrary locations was often
requested and may be helpfull for debugging, so finally add it. It works
like a normal teleporter: It moves the player to the requested location,
clears all movements, tells the server and clients that the entity just
teleported and telefrags everything that's in the target location.

The implementation does not verify if the requested location is save,
the player may teleport into the world model or even the void. But the
requested Z coordinate is elevated by 10 units to prevent the player
getting stuck in the floor.

The command is protected by sv_cheats.

This is part of issue yquake2/yquake2#430.
2019-09-05 16:51:53 +02:00
Yamagi Burmeister
501ed1e71a Try to fix monsters getting stuck by waiting forever for their enemy.
44472722e added some sanity checks to the AI code. The checks in
ai_run() are likely wrong because the enemy entity might be already
NULL if we arrive their. By aborting early the code is unable to
determine a new enemy or return the monster to idle state, so the
monster will wait forever for an enemy that'll never come.

This happens only in monster vs. monster fights. Never in monster vs.
player, that game ends if the player dies.

In theory this change should be harmless, because if the enemy entity is
gone it won't generate sound targets now be visible. If the game crashes
by self->enemy being NULL we've got a problem elsewere.

This was reported by @BjossiAlfreds in #483. He also suggested the fix
2019-08-31 11:11:04 +02:00
Yamagi Burmeister
003a1282ad Fix monsters being unable to see the player if he generates noise.
When searching for the player FinTarget() always goes after sound
targets and aborts as soon as it finds one. So if the player is
constantly generating sounds - for example firing the machine gun -
there's a high chance that monsters will only hear but never see
him. Work around this by adding a small timeout to player noises, make
sure that at least 3 frames passed since the last noise. This gives
monsters 2 frames to see the player.

This bug was present in the original code, this is a small gameplay
change.

The problem was analysed by @BjossiAlfreds in #436. He also suggested
the fix.
2019-08-31 11:10:04 +02:00
Yamagi Burmeister
8be3688b1a Fix berserker fidget animation aborting attack.
M_MoveFrame() calls first the AI functions that decide if a monster
should attack or not. After that the monsters think function is called
which walks through berserk_frames_stand[]. Even if the AI function found
an enemy and decided to attack, the monster is still standing for this
frame and berserker_fidget() is called. It may override the earlier
earlier decision, aborting the attack. Even worse this may let the
berserker stuck, because AI_STAND_GROUND may be cleared which prevents
further attacks.

This bug was present in the original code, so this is small gameplay
change. It's likely also present in both addons.

Reported and analyzed by @BjossiAlfreds in issue #433. He also suggested
the fix.
2019-08-31 11:08:44 +02:00
Yamagi Burmeister
ffb5bb57f8 Push entitie slightly away from non horizontal surfaces.
Otherwise the entities origin might be in the surface, which causes it
to be rendered in full black.
2019-06-15 17:45:50 +02:00
Yamagi Burmeister
9989340968 Add back the disruptor / desintegrator.
Make the disruptor and it's ammo available by 'give disruptor' and 'give
rounds'. If g_disruptor is set 0 (the defaults) neither the weapon, nor
the ammo is spawned in, if set to 1 it behaves like a normal weapon.
Based upon an idea by @NeonKnightOA submitted in PR #18.

This was requested in issue #17.
2019-06-11 14:07:48 +02:00
Yamagi Burmeister
90420227db Link with -lm.
This is not strictly necessary since the main executable should provide
the symbols, but it may increase compatibility with other source ports
and underlinking is never a good idea.
2019-05-13 17:05:54 +02:00
Daniel Gibson
000da6a653 Parasite doesn't leech through walls anymore
The problem was that its head was too close to/in the wall, so the trace
towards the player (to decide if he's reachable) started *in* the wall,
so the wall itself wasn't hit/detected.
Now the trace start is 8 units behind the head and it seems to work.

Fixes #9
2019-05-11 19:44:59 +02:00
Yamagi Burmeister
cf6bf166ff Fix missing sanity check, self->enemy can be null.
Suggested by @maraakate, closes #7.
2019-05-09 18:33:23 +02:00
Yamagi Burmeister
96bec2bf1f Remove some unnecessary code duplications. 2019-05-09 18:26:46 +02:00
Yamagi
702110da7d
Merge pull request #15 from afreuden/master
Add make game.dylib for Darwin
2019-05-09 18:24:40 +02:00
Yamagi
a689a020f5
Merge pull request #13 from Pickle/master
Added parenesis for REGEX REPLACE command to fix this error:
2019-05-09 18:23:45 +02:00
Yamagi Burmeister
47520a0020 Don't allow 'give health 0' or even less.
Giving the player < -1 health and increasing it to something above 0
without closing the console breaks the player state.
2019-04-27 19:19:03 +02:00
Angus Freudenberg
c18ba3bd91
Add make game.dylib for Darwin 2019-04-13 16:12:53 +10:00
Yamagi Burmeister
eaaf6c43d4 Fix a missmerge, save_ver is supported since version 4 and not 3. 2019-02-05 09:05:18 +01:00
Yamagi Burmeister
dc16877ae2 Update the CHANGELOG for 2.05. 2019-02-04 14:44:41 +01:00
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
Scott
e8d3d5e41c Added parenesis for REGEX REPLACE command to fix this error:
CMake Error at CMakeLists.txt:25 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.
2018-12-15 17:01:39 -05: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