Commit graph

1653 commits

Author SHA1 Message Date
Yamagi Burmeister
4d299e26d7 Don't write stdout.txt and stderr.txt when portable.
To be able to test if the game is running portable all checks of the
portable cvar must be done after Cvar_Init(). Instead of redirecting
stdout and stderr as early as possible, delay the redirection right
after Cvar_Init(). After this change the printf() in WinMain() aren't
printed into stdout.txt, but I guess that it isn't a big problem. All
interessting stuff like the search pathes is still there.

Rename fs_portable to portable. It's no longer filesystem specific.
2017-03-13 16:24:26 +01:00
Yamagi Burmeister
3032698f95 Put console_history.txt in the binary dir when fs_portable is 1. 2017-03-13 15:41:41 +01:00
Yamagi Burmeister
00758277f1 Add a missing sanity check. attacker->classname may be NULL.
This was reported by maraakate in issue #170.
2017-03-13 14:17:51 +01:00
Yamagi Burmeister
692b64ad38 Add a cvar fs_portable. When set to 1 the game is 'portable'.
Normally Q2 writes all persistent data (the configurations, saves, etc.)
into a subdirectory in the users $HOME. That can be a problem when the
game is installed onto an thumb drive or something like that. Therefor
provide a cvar fs_portable. When set to 1 the games uses it binary dir
as it's persistent storage location.

Examples:

./quake2 +set fs_portable 1
./quake2 +set basedir ~/games/quake2 +set fs_portable 1

fs_portable is _not_ saved into the config file. It must be set at
every start!

This closed issue #158.
2017-03-13 14:12:33 +01:00
Yamagi Burmeister
4a54fdd0ed Ensure that '+set game baseq2' doesn't break the search pathes.
This is the first step to fix issue #158, consistent behavior for all
cases. This problem was also reported by @lonkamikaze through IRC.
2017-03-13 13:52:11 +01:00
Yamagi Burmeister
45cc75d2d9 Add an undocumented option for forcing busy waits.
Some people complained about the usage of non busy waits:

  * I was told that there's an input lag with nanosleep(). I still doubt
    that, but since the problem is easy to solve...
  * Some Intel CPUs throttle the GPU if the selected CPU pstate is too
    low. This is especially a problem on Haswell mobile CPUs. Keeping
    a core busy works around that.
2017-03-13 13:39:03 +01:00
Yamagi Burmeister
6e5cf7ee08 Add a cvar gl_showbbox for drawing entities bounding boxes 2017-01-19 21:04:58 +01:00
Yamagi Burmeister
55d7842a02 Add back 'spectator' and 'password' cvars.
Those are special cvars that just need to be registered. They're used
in the servers userinfo structures. This closes issue #166.
2017-01-02 19:45:22 +01:00
Yamagi Burmeister
44472722e0 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-28 18:29:08 +01:00
Yamagi Burmeister
af957c5e36 Fix a small buffer overflow when disabling shuffle playback
Repeat 10 times:
 - strcat() is evil
 - strcat() is evil
 ...

While here fix another small inconsistency: Vorbis playback should
stop when switching 'shuffle' on.

The overflow was reported by @tomgreen66 in pull request #168.
2016-12-28 17:23:51 +01:00
Yamagi Burmeister
c07fe5ac2d 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:14:59 +01:00
Yamagi Burmeister
693b7bfb84 Use strtod() instead of strof() to aid VS2005 2016-12-18 10:17:06 +01:00
Yamagi Burmeister
8fe8f832f8 Remove last remnant of multitexturing.
Pointed out by DanielGibson.
2016-12-18 09:48:06 +01:00
Yamagi Burmeister
a774846659 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:11:58 +01:00
Yamagi Burmeister
c26f85fd02 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 issue #162.
2016-12-18 09:07:51 +01:00
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
Daniel Gibson
883781c6f0 Also fix OSX build with OpenAL when *not* using dlopen()
using dlopen() (DLOPEN_OPENAL) is default, though.
2016-12-18 00:00:47 +01:00
Daniel Gibson
10899195b4 Fix OSX build with OpenAL if it's dlopen()'ed 2016-12-17 23:51:17 +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
6dab39d7d6 Finally remove the old README 2016-12-03 09:25:06 +01:00
Yamagi Burmeister
d4b9245f5b Always use # headings in the README 2016-12-03 09:24:33 +01:00
Yamagi Burmeister
f6ef5cff1b Reformat the CONTRIBUTE file 2016-12-03 09:23:13 +01:00
Yamagi Burmeister
21035bef8d Reformat the CHANGELOG to 72 characters width 2016-12-03 09:21:29 +01:00
Yamagi Burmeister
20caca09e3 Force the normal Windows build to OSTYPE := Windows
If someone really want's overwrite OSTYPE on Windows it's much easier to
just alter one line in the Makefile than supporting setting it through
the command line.
2016-12-03 09:17:21 +01:00
Yamagi Burmeister
248662ff73 Bump version number to 6.01pre 2016-12-03 09:16:02 +01:00
Yamagi Burmeister
ae2b4744a1 MinGW defines a global OSTYPE. Just overwrite it. 2016-12-02 16:53:30 +01:00
Yamagi Burmeister
bb54225ad9 Bump version to 6.00. 2016-12-02 16:39:02 +01:00
Yamagi Burmeister
cda6b723b1 Clarify compiling on Windows 2016-12-02 16:38:42 +01:00
Yamagi Burmeister
bcadbf5ab3 Update CHANGELOG for 6.0 2016-12-02 16:31:34 +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
e0b1f98f40 Make user overwriteable OSTYPE and ARCH somewhat more saner
In the Makefile we can use whatever variables we want. It's only
necessary that we don't leak them into the compiler context.
2016-10-31 10:22:17 +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
1a05d19d17 Use correct link :)
This fixes issue #149
2016-09-19 09:52:58 +02:00