Commit graph

1760 commits

Author SHA1 Message Date
Daniel Gibson
5938a665e8 pass Com_VPrintf() to reflib used by R_Printf(), remove VID_Printf()
So in all code in the reflib (ref_gl.dll/.so/.dylib) calls to
ri.Con_Printf(print_level, fmt, ...) have been replaced by calls to
R_Printf(print_level, fmt, ...) which uses ri.Com_VPrintf().
2017-02-19 06:03:07 +01:00
Daniel Gibson
a0c1c74a2e (Mostly) get rid of VID_Printf() and VID_Error()
they're only wrapping Com_Printf() and Com_Error() anyway
2017-02-19 06:03:07 +01:00
Daniel Gibson
54ae3be0c6 Com_VPrintf(level, fmt, argptr) (Com_D?Printf() wraps that)
somehow all the printf()-like things in Q2 wrap each other and each
one prints into a buffer and then calls the next one with ("%s", buf).
That's not very clever and kinda annoying.
As in the end everyone calls Com_Printf() I created Com_VPrintf()
that can be called instead with the va_list.

I also added printf-format annotation to Com_Printf() and Com_DPrintf()
and fixed places where Com_Printf() was called with the wrong type.
2017-02-19 06:03:07 +01:00
Daniel Gibson
c743aaa8fe Copyright-header in r_sdl.c
forgot that when I created the file..
2017-02-19 06:03:07 +01:00
Daniel Gibson
181d4fa0ea Move client/refresh/header/* and qgl.h to client/refresh/gl/header/*
and the changes in the including files for this.

(also removed gl.h includes from local.h, as it's already included in
 qgl.h which is included by local.h)
2017-02-19 06:03:07 +01:00
Daniel Gibson
73cf610cdb Only use client/refresh/header/local.h in refresh lib
that's why it's called "local.h". duh.
(next I'll move it to refresh/gl/)
2017-02-19 06:03:07 +01:00
Daniel Gibson
9252eba643 use vid_ref cvar to select render dll 2017-02-19 06:03:07 +01:00
Daniel Gibson
4ede163794 Fix window build with Makefile
the problem is that sdl2-config --libs apparently includes shit that's only
useful for the executable, but not dlls, like linking against SDL2main and
libmingw32 and setting -mwindows

Furthermore I forgot to add -lopengl32 and -shared to the ref_gl Windows
LDFLAGS.
2017-02-19 06:03:07 +01:00
Daniel Gibson
7f27c549a8 It works again, ref_gl doesn't use any client symbols anymore
So in theory this should even work on Windows now.
2017-02-19 06:03:07 +01:00
Daniel Gibson
0588d3f988 VID_Error -> ri.Sys_Error; VID_Printf -> ri.Con_Printf 2017-02-19 05:53:56 +01:00
Daniel Gibson
2062b319e9 move qgl.[ch] to src/client/refresh/gl/ 2017-02-19 05:53:56 +01:00
Daniel Gibson
f13e15e561 ref_gl.so builds and works (on Linux, with Makefile)
still dirty, seems to use some symbols from client directly, which will
not work on Windows.
2017-02-19 05:53:56 +01:00
Daniel Gibson
3a65b41d60 Move OpenGL render specific files to src/client/refresh/gl/ 2017-02-19 05:53:56 +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