Commit graph

1257 commits

Author SHA1 Message Date
Yamagi Burmeister
935c37f819 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 issue #162.
2016-12-18 09:04:46 +01:00
Yamagi Burmeister
9b8bb03df7 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:47:43 +01:00
Yamagi Burmeister
025364677c Load sexed models only in multiplayer.
This was reported by maraakate in issue #160.
2016-12-17 11:28:57 +01:00
Yamagi Burmeister
d81768966b Use strtof() instead of strtod() to safe a case. 2016-12-17 11:27:30 +01:00
Yamagi Burmeister
bfae128a5c Use Q_strcasecmp instead of Q_stricmp().
This should be be noop but looks safer. Reported by maraakate in yquake2
issue #160.
2016-12-17 11:25:55 +01:00
Yamagi Burmeister
52fd07eb33 Add missing sanity checks to ED_ParseEdict() and ED_NewString()
This was reported by maraakate in issue #160.
2016-12-17 11:24:40 +01:00
Yamagi Burmeister
971bca9914 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 11:22:07 +01:00
Yamagi Burmeister
2b317075c7 Treat autoexec.cfg like every other config.
Until now autoexec.cfg was a special case. It was read several
times, whenever the 'game' cvar was altered or when the client was
restarted. But only if it was in the right directory in the right
position of the internal search path... Remove this altogether and
replace it by an ordinary 'exec autoexec.cfg' at startup.

This may break some mods that depend on an autoexec.cfg if the user has
his own version in ~/.yq2/. Such mods should use default.cfg instead.

This closes issue #163.
2016-12-13 17:03:11 +01:00
Yamagi Burmeister
68a12d4ee1 Remove multitexturing support
Multitexturing was never part of any official Quake II release. It was
added in version 3.21, which was released only in source. Over the years
many developers tried to fix multitexturing, including myself. Yamagi
Quake II had it even enabled by default for several releases... But:

  * Multitexturing is poorly implemented and **slow**
  * Multitexturing leads to render errors, for example in city3
  * Multitextring is ortogonal to the normal render path and adds a
    lot of special cases to the renderer

Remove it for good. Ciao, it wasn't a nice time. :) The last version
before this commit was at least somewhat fixed, read some of the worst
problems were fixed. If someone's ever going to resurrect it, it would
be a good idea to start at that point.
2016-12-03 09:46:08 +01:00
Yamagi Burmeister
248662ff73 Bump version number to 6.01pre 2016-12-03 09:16:02 +01:00
Yamagi Burmeister
bb54225ad9 Bump version to 6.00. 2016-12-02 16:39:02 +01:00
Yamagi Burmeister
c5a6dcf3e0 Revert 76e4017, it was a missmerge
In baseq2 there's no need to force a certain damage texture on gunners
since there's only one. Also gunners can't wear the powershield so
there's no need to turn it of.

This was noticed by Maraakate.
2016-12-02 15:51:14 +01:00
Yamagi Burmeister
f6f8394b74 Ensure that all keys are marked up when playing cinematics
Otherwise at least one key may be still marked as down causing an
immediate abort of playback. While here be a little bit paranoid
and clean up key states when focus is gained. In theory that's a
no-op.
2016-11-08 17:37:24 +01:00
Yamagi Burmeister
2f3f31f507 Remove an unused variables, forgotten in the last commit 2016-11-07 19:34:56 +01:00
Yamagi Burmeister
f41f96e899 Use correct texture coordinates when drawing the video
When the video is scaled through OpenGL we can just throw it on our
vertexes and everything's alright. But when we're softscaling the video
we must consider that the videos size doesn't really match the vertex
size...
2016-11-07 18:52:24 +01:00
Daniel Gibson
051be8285d Fix (text in) videos (for GPUs supporting NPOT textures)
especially in the intermission videos, the text looked broken, as parts
of the characters were missing.
This is because Draw_StretchRaw() converts the 320x240 video frame into
a 256x256 texture, without doing proper interpolation (just skipping
some pixels instead).
Now, if the GPU supports non-power-of-two texture sizes, the video
frames are uploaded as textures in their original size.

(Also fixed a harmless typo in common.h)
2016-11-06 23:44:54 +01:00
Yamagi Burmeister
5e5217e549 Fix a rare crash in flyer.c with self->enemy being NULL
This crash was found by DanielGibson, he even guessed the right fix
without having a usable coredump. ;) In boss1.bsp Macron is waiting for
the player, despawning as soon as the player moves to him. After that
the player needs to press 2 buttons, each button triggers 3 flyers. If
the player is fast enough, the first bunch of flyers may spawn before
macron is despawned. Now there's a small chance that a flyer decides to
attack macron... If Macron despwans at the the next frame, self->enemy
is set to NULL (Macron is gone) but nevertheless flyer_fire() is called.

The correct fix would be to call flyer_fire() before Macron despawns,
but that's hard to impossible. So take the easy route and check if
self->enemy is not NULL.
2016-11-04 19:22:33 +01:00
Yamagi Burmeister
548c217da8 Fix wrong monster count in city3.bsp
In city3.bsd ("Upper Palace") a hidden and unaccessible room next to the
security pass exists. In this room a grenate launcher and a pack of
grenates can be found. When the room is entered, two floaters are
triggered nearby. This can never happen, so the player is unable to
reach the goal of killing 75 monsters. Quirk around this by lowering
the total number of monsters by 2.

This bug has been known for a long time:
- http://quake2.weiel.net/2004/Aug/26/01150ca0bb36a5f46c9cb0b154aeb8d8.html
- https://groups.google.com/forum/#!topic/alt.games.quake2/W7jdIIHthrw
- http://www.quake3world.com/forum/viewtopic.php?f=3&t=4733
2016-11-04 19:12:39 +01:00
Yamagi Burmeister
882297c33e Fix monsters blocking when not on ground entity
This bug was "fixed" by id with removing two lines in the ground entity
check. When cleaning up the game I added them back... I don't know if
it's really correct to just remove them, but let's try it. This fixes
issue #157.
2016-10-31 11:51:07 +01:00
Yamagi Burmeister
aa897e3965 Make OSTYPE and ARCH user defineable.
The old implementation had two problems:

  * OSTYPE and ARCH are systemwide defines, overriding them may break
    the global libc headers. This is a theoretical problem, I've never
    seen it in praxis.

  * Not all system set ARCH correctly when building in a chroot env.
    For example on Linux ARCH is set to x86_64 when building in an
    i386 chroot. Now the user can do something like "make YQ2ARCH=i386"
    to get things right.
2016-10-24 18:02:17 +02:00
Daniel Gibson
5d440bbb00 Make debris SOLID_NOT, fixes #154
In lower mines you can drop a rock onto a tank by using a lever.
This was broken, the rock exploded instead of dropping, because debris
is spawned and that debris was solid.
Now the debris is not solid anymore (like it was up to
b4d16ab6b3
"Some additions to last commit:") and it works again
2016-10-24 17:27:57 +02:00
Yamagi Burmeister
a0a34e0a35 When an invalid muzzle flash offset is send, just return.
The original client crashed (or survived by pure luck) when muzzle
flash offsets >210 were send. Our fix was to bail out, but that broke
some buggy mods... So just return and print an optional debug message.

This fixes issue #153.
2016-10-23 18:36:43 +02:00
Daniel Gibson
10a8dfa388 Fix typo in ai_checkattack() leading to monsters running in place
this fixes #151
2016-10-23 17:55:04 +02:00
Yamagi Burmeister
7f996cc29e Don't smooth half height steps
This step height is used by several evelators, leading to stuttering due
to misspredictions. Additionally half height steps weren't smoothed by
the synchronous client.
2016-08-29 19:58:47 +02:00
Yamagi Burmeister
31c564a030 Setting the window position was unsupported for years. 2016-08-18 18:58:18 +02:00
Yamagi Burmeister
073d6ef837 Unify gl_cull and gl_nocull. 2016-08-18 18:25:23 +02:00
Yamagi Burmeister
b36e60e097 Remove gl_anisotropic_available. It's unnecessary... 2016-08-18 18:19:02 +02:00
Yamagi Burmeister
87f9084df1 Clamp overbright bits in warping surfaces to 1.
They oversaturate otherwise.
2016-08-17 21:12:52 +02:00
Yamagi Burmeister
1bbd8c04ff I think that steps between 94 and 98 are wrong, remove them.
Predicting these steps leads to a heavily stuttering elevator in
hangar1. I think that steps between 94 and 98 can't appear on stairs, so
just remove them. If I'm wrong we need a hack to the hack ontop of the
hack... ^^
2016-08-17 21:03:36 +02:00
Yamagi Burmeister
6ff41e6b2f Remove unused and broken functions for writing files. 2016-08-16 20:14:41 +02:00
Yamagi Burmeister
9af1af55a5 Allow reading player models from pak / pk2 / pk3 / zip files.
This fixes #119. As always I've chosen the least invasive way to solve
this problem. Trying to open players/$model/trix.md2 is hack, but solves
the problem without changes to filesystem.c and it's API.
2016-08-16 19:58:22 +02:00
Yamagi Burmeister
fb7c79c93b Be a tough boy and set cl_async to 1 2016-08-15 21:37:09 +02:00
Yamagi Burmeister
58d1fa02bc Switch overbright bits off by default to get the classic look 2016-08-15 21:36:33 +02:00
Yamagi Burmeister
88244bd4a4 Unbreak SDL 1.2 build. 2016-08-14 16:46:07 +02:00
Yamagi Burmeister
4d9d555d8e When vsync is enabled, cap the desired rfps.
With vsync enabled the render times of consecutive frames can diverge.
The first frame arrives right at the next display frame and is rendered
without waiting time. The next frame has to wait 20ms. The leads to some
problems with the move prediction if the client is asynchronous. Fix
this by capping the desired frame rate at the display refresh rate. Also
make sure that the network framerate is never higher then the renderer
framerate.

With the commit the timing is always correct:
* With no limit as much frames as possible are rendered. In this case
  rfps > nfps and everything's good.
* With vsync enabled rfps > nfps or rfps == nfps is given. Also rfps
  will never exceed the display refresh rate.
* On slow hardware either rfps > nfps or an implicit rfpc == nfps is
  given.
2016-08-14 16:35:48 +02:00
Yamagi Burmeister
0ba7614739 Use nanosleep() instead of a busy wait loop.
This cuts the cpu time requirements in half. Windows has no equivalent
for nanosleep(), so keep the busy loop.
2016-08-14 12:50:27 +02:00
Yamagi Burmeister
98683cbc31 Render the first frame right after the start.
Otherwise we would wait several client frames. This is a cosmetic change
without any visable effect.
2016-08-14 12:50:21 +02:00
Yamagi Burmeister
93e9633382 Port step smoothing code from r1q2.
While the bugfix in a6f4a3b made the steping prediction working for
stairs, elevators are still stuttering. r1q2s code solves this problem
and is a little bit faster. Use it instead.
2016-08-14 12:45:16 +02:00
Yamagi Burmeister
f16928f2cf Implement a better hack for warping surfaces regarding lightning.
The old hack was sufficient for classic rendering, but break with
gl_overbrightbits enabled. See the inline comment for details.
2016-08-13 12:18:31 +02:00
Yamagi Burmeister
d6136cbba5 Bump cl_maxfps to 60.
Yesterday I chose setting cl_async to 0 since I saw some movement
changed with the async client enabled. Especially when clipping against
bevels the game started to stutter and there were small rendering
problems. After some debugging I realized that it is caused by slight
inaccuracies in the move prediction. When cl_maxfps is too low, the
movement error between two render frames becomes to big, leading to
misspositions. There're two ways to solve this problem:

* Processing more client frames. Most async clients I've looked on
  process 60 or even 90 render frames. I chose to stay at 60 since
  I was unable to see differences with higher rates.

* Changed to pmove.c and the pmove_t struct. Some multiplayer focused
  clients go that way. But there's a very high of breaking singleplayer
  movement and pmove_t is part of the server <-> game API. Additionally
  the network code must / should be altered. So this is unsuitable for
  YQ2.

Please note that there's still a change in movement. Before 4ae8706 and
when cl_async is set to 0 movement is dependend on the render framerate.
At low framerate bevel clipping isn't working too good, at high
framerates prediction causes physics changes like the famous 125hz bug.
With cl_async set to 1 the network framerate is stable, leading to a
more consistant behahiour.
2016-08-13 12:17:31 +02:00
Yamagi Burmeister
070d94ec77 Add a cvar cl_async, off by default.
Most (all?) clients implement the synchronous and the asynchronous
client by seperate code pathes. Instead of doing that we force the
asynchronous path to process one network frame for each render frame.
2016-08-11 19:36:42 +02:00
Yamagi Burmeister
a6f4a3b309 Don't predict one frame too far.
We're missusing the current frame to pass data from the input subsystem
to the movement prediction without a server frame. While we can use the
current frame for the movements itself, it's not finished and thus
unsuitable for stair step prediction. Also oldframe is determined
wrongly. As a result the player "jumps" over stairs.
2016-08-11 19:11:33 +02:00
Yamagi Burmeister
a9853ae44e Remove more dead cvars. 2016-08-11 19:07:08 +02:00
Yamagi Burmeister
02725785dd Apply gl_overbrightbits to dynamic lightmaps.
Without this the dynamic lightning is too dark in contrast du the rest
of the world when gl_overbrightbits is 2 or even 4.
2016-08-08 21:06:59 +02:00
Yamagi Burmeister
347cdb7f81 Some more fixes to gl_overbrightbits in non multitexturing case.
- Apply overbright bits only to static lightmaps and not dynamic ones.
- Apply overbright bits to alias models.
2016-08-07 10:39:22 +02:00
Yamagi Burmeister
f8ac496b69 Bump version number to 6.00pre 2016-08-07 10:14:07 +02:00
Yamagi Burmeister
a6d77401ba Remove now unused variable 2016-08-07 10:12:56 +02:00
Yamagi Burmeister
5f4d4e533f Apply gl_overbrightbits only to full lightmap chains.
I think / guess / *fingers crossed* that this fixes the different
brightness levels between normal and multitexturing mode reported
in #147.
2016-08-06 19:21:34 +02:00
Yamagi Burmeister
f064c76eb2 Remove dead cvars and support code 2016-08-06 18:41:57 +02:00
Yamagi Burmeister
cd61504af8 gl_config.mtexcomb should depend on gl_config.multitexture 2016-08-06 18:28:02 +02:00