Commit graph

200 commits

Author SHA1 Message Date
Yamagi Burmeister
cfb3e7abf0 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:22:56 +02:00
Yamagi Burmeister
6dfe39ba23 Fix long standing bug of dead parasites falling through the world model.
It's unclear were this comes from, maybe it's a bug in the collision
detection. Because the collision detection is ununderstandable for
people without 'special brain type game programming' like me and even
bugfixes to it have a very high chance to break things, work around
it. Save current position, perform move, check if we're in the world
model. If we are revert to old position.

Debugged and work around suggested by @BjossiAlfreds. Fixes
yquake2/yquake2#443.
2019-09-06 07:52:36 +02:00
Yamagi Burmeister
08a6bfd4df 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:13:29 +02:00
Yamagi Burmeister
244e0cfa01 Fix monsters not fighting back when attacked by a a parasite.
This is another corner case. Parasites 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:54:47 +02:00
Yamagi Burmeister
f64f112aa0 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:47:10 +02:00
Yamagi Burmeister
532ae678de 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:48:23 +02:00
Yamagi Burmeister
bc5f569880 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:17:38 +02:00
Yamagi Burmeister
a562cb8e40 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:16:46 +02:00
Yamagi Burmeister
f83ea253c8 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:15:41 +02:00
Yamagi Burmeister
31d46e672d Revert second part of aed38232d3.
Don't know if this has any noticeable impact, but it looks like the
commit was wrong... Revert this in an own commit and look here if there
problems with the gekk.
2019-08-07 07:46:23 +02:00
Yamagi Burmeister
8a1ea1725a Revert heat_think() part of aed38232d3.
@DanielGibson missinterpreted the code, the negation must be applied to
target->svflags only. Otherwise the codition is always true and the
homing rocket never aquires a target.
2019-08-07 07:44:37 +02:00
Yamagi Burmeister
a9cc79dddf Push entities 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:46:57 +02:00
Yamagi Burmeister
d6f8caed07 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:09:49 +02:00
Yamagi Burmeister
e16436efe2 Remove some unnecessary code duplication. 2019-05-09 18:17:06 +02:00
Yamagi
fef3b42212
Merge pull request #16 from afreuden/afreuden-patch-1
Add make game.dylib for Darwin
2019-05-09 18:15:29 +02:00
Yamagi Burmeister
bdcec720f0 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:21:05 +02:00
Angus Freudenberg
cec4adf2e4
Add make game.dylib for Darwin 2019-04-13 15:57:53 +10:00
Yamagi Burmeister
1d6e3f6eab Fix stupid missmerge, ReadField() may only be called once for a field. 2019-02-05 08:56:06 +01:00
Yamagi Burmeister
39e5a3189d Update the CHANGELOG for 2.06. 2019-02-04 14:39:19 +01:00
Yamagi Burmeister
b830f28827 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 12:05:13 +01:00
Yamagi
9394c3adad
Merge pull request #13 from Pickle/master
Added parenesis for REGEX REPLACE command to fix this error:
2018-12-21 15:25:54 +01:00
Scott
4067de64f2 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:05:42 -05:00
Yamagi Burmeister
a0fbb36fbc Import Q_strlcpy() and replace several dangerous strncpy() with it. 2018-10-25 19:15:41 +02:00
Yamagi Burmeister
4626e7a8d9 Switch some annoying and wrang GCC warnings off. 2018-10-25 19:11:30 +02:00
Yamagi Burmeister
50a6255b0a Call strcasecmp() and not Quake IIs home made version.
The home made version is crap and not const correct.
2018-10-25 19:09:01 +02:00
Yamagi Burmeister
315d0ad7ed Add variable declaration missed in last commit. 2018-10-13 09:06:11 +02:00
Yamagi Burmeister
eb0c7a3cb5 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:13:48 +02:00
Yamagi Burmeister
57c80dccf7 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 12:05:24 +02:00
Daniel Gibson
cd8d9afdaf 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:48:33 +02:00
Yamagi Burmeister
618953fbdd Replace strcasecmp() by Q_strcasecmp() for better MSVC compaibility.
This was suggest by @ajbonner in issue #11.
2018-03-23 15:54:14 +01:00
Yamagi Burmeister
a9b24bfa04 Fix a potential crash in ai_run_melee() and ai_run_missile().
This was found and fixed by Maraakate.
2017-09-07 18:09:25 +02:00
Yamagi Burmeister
99a032c6ae Enforce static linkage of libgcc on Windows. 2017-06-16 12:49:41 +02:00
Yamagi Burmeister
173892c2dc Update the CHANGELOG for 2.05. 2017-05-25 11:46:23 +02:00
Yamagi Burmeister
12480710e6 Add some maphack that're specific to coop.
These are some corner cases that can only happen when one or both
players die at the wrong place and time. This is based upon a fix by
Maraakate. This fixes issue #9.
2017-03-13 15:06:49 +01:00
Yamagi Burmeister
76a2d97569 The attack function for brains was missing, add it back.
This was likely lost in some merge or cleanup. Reported by maraakate
in issue #8.
2017-03-13 14:32:00 +01:00
Yamagi Burmeister
cc3b204e5a Add a missing sanity check. attacker->classname may be NULL.
This was reported by maraakate in issue #170.
2017-03-13 14:28:06 +01:00
Yamagi Burmeister
2cda032cee Fix a small typo: s/withe/with/1
Reported by @lonkamikaze in IRC
2017-02-11 13:23:57 +01:00
Yamagi Burmeister
80fb945cff 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:25:22 +01:00
Yamagi Burmeister
d98e1b9eb0 Add some missing sanity checks.
This was reported by Maraakate in yquake2 issue #164.
2016-12-28 18:04:14 +01:00
Yamagi Burmeister
d3f299cca6 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:21:24 +01:00
Yamagi Burmeister
3f66dec8c8 Use strtod() instead of strof() to aid VS2005 2016-12-18 10:19:35 +01:00
Yamagi Burmeister
77536e07d8 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:17:54 +01:00
Yamagi Burmeister
1bea78c4ec 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:16:28 +01:00
Yamagi Burmeister
20cdbfe1c0 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:15:21 +01:00
Yamagi Burmeister
60321a282f 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 11:09:09 +01:00
Yamagi Burmeister
8ad1ba53d6 Change from atoi() to strtol() to match baseq2.
This is a noop. This was reported by maraakate in yquake issue #160.
2016-12-17 11:08:00 +01:00
Yamagi Burmeister
5c004e2c22 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 11:06:40 +01:00
Yamagi Burmeister
fe0f0ad86f 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 11:05:52 +01:00
Yamagi Burmeister
0e00bb0d9f 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 11:04:34 +01:00
Yamagi Burmeister
be91d27005 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 11:02:18 +01:00