Commit graph

1454 commits

Author SHA1 Message Date
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
Yamagi Burmeister
dd36eee0f1 Apply gl_overbrightbits only at lightmaps, not normal textures. 2016-08-06 18:11:10 +02:00
Yamagi Burmeister
38a72e018a Implement gl_overbrightbits in non multitexturing mode
This is still slighty broken, looks the overbright bits are applied in
both R_DrawGLPoly() and R_DrawGLPolyChain(). Fix to come.
2016-08-06 17:06:37 +02:00
Yamagi Burmeister
a2400bc145 Clamp gl_overbrightbits to 0, 1, 2 or 4.
Most (all?) GPUs / OpenGL implementation doen't support more
2016-08-06 15:39:46 +02:00
Yamagi Burmeister
698e2a26ba Switch GL_ARB_texture_env_combine to our new probing logic 2016-08-06 15:32:08 +02:00
Yamagi Burmeister
5840bd570b Use vertex arrays in R_RenderLightmappedPoly.
This is done for normal surfaces only. To change SURF_FLOWING surfes I
need to find such a surface somewhere in the game...
2016-08-06 15:25:54 +02:00
Yamagi Burmeister
bcde80834f Probe GL_ARB_multitexture with our new proping logic
And rename gl_ext_multitexture to gl_multitexture.
2016-08-06 15:15:18 +02:00
Yamagi Burmeister
dafc41f509 Switch GL_ARB_texture_non_power_of_two to our new probing logic.
While at it rename R_Upload32Old to R_Upload32Soft.
2016-08-06 10:37:24 +02:00
Yamagi Burmeister
2e7166b157 Probe GL_EXT_texture_filter_anisotropic with our new logic 2016-08-06 10:18:58 +02:00
Yamagi Burmeister
43c9970772 Switch GL_EXT_paletted_texture to the new probing logic 2016-08-06 10:08:17 +02:00
Yamagi Burmeister
9f0b5d067b Use GL_ARB_point_parameters instead of GL_EXT_point_parameters.
While here switch GL_ARB_point_parameters to a new probing logic and
rename the Cvar to gl_pointparameters.
2016-08-06 09:50:16 +02:00
Yamagi Burmeister
4057376993 GL_EXT_compiled_vertex_array is unused. Remove it.
At can be added back, if it's ever needed.
2016-08-06 09:35:08 +02:00
Yamagi Burmeister
0967f051d8 Require OpenGL 1.4 2016-08-06 09:32:20 +02:00
Yamagi Burmeister
e4751e8c44 Use OpenGL multitexturing extensions to implement multitexturing...
This is a slighty revised version of id Software original code. Icculus
code may have some advantages on broken drivers or underpowered GPUs.
Today it's just a performance hook. This is a first step in fixing #147.
2016-08-05 18:38:48 +02:00
Yamagi Burmeister
2baf97bdf6 Throttle the client to 1000 FPS.
This is more than enough for everyone and prevents wasting CPU time.
Without this change as many client frames as possible are rendered,
Quake II uses a complete core.
2016-08-05 07:49:47 +02:00
Yamagi Burmeister
7ea4db4ace Remove now unused function CL_SendCommand(). 2016-08-04 21:29:30 +02:00
Yamagi Burmeister
d15f5d5b97 Make sure CL_UpdateWindowedMouse() is called.
Without this the automatic mouse grab is not working.
2016-08-04 21:28:17 +02:00
Yamagi Burmeister
a70cc2d923 Switch the refresher to vertex arrays
This is based on work submitted by Scott "pickle" Smith. It's said that
vertex arrays are somewhat faster and more compatible than the old way.
This may remove support of some very, very old GPUs like the Riva128.
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
4dcdb0dc17 Force GL_LIGHTMAP_FORMAT instead of gl_tex_solid_format.
This is more less cosmetics since gl_tex_solid_format == GL_RGB and
GL_LIGHTMAP_FORMAT == GL_RGBA. No measurable FPS change on Nvidia and
Intel. Based upon the OpenGL ES patch by Scott "pickle" Smith.
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
275271c647 Always specify the alpha channel.
This is based upon the original OpenGL ES patch by Scott "pickle"
Smith. This change gives about the same frame rate on an 750TI but
about 3% more frames on an Ivy Bridge IGP with Mesa3D...
2016-08-04 21:11:31 +02:00
Yamagi Burmeister
4ae8706d22 Make the client asynchronous, e.g. decouble net and refresh frames.
This is largely based upon the cl_async 1 mode from KMQuake2, which in
turn is based upon r1q2. The origins of this code may be even older...
Different to KMQuake2 the asynchonous mode is not optional, the client
is always asynchonous. Since we're mainly integrating this rather
fundamental change to simplify the complex internal timing between
client, server and refresh, there's no point in keeping it optional.

The old cl_maxfps cvar controls the network frames. 30 frames should be
enough, even Q3A hasn't more. The new gl_maxfps cvar controls the render
frames. It's set to 95 fps by default to avoid possible remnant of the
famous 125hz bug.
2016-08-04 17:36:42 +02:00
Yamagi Burmeister
fa4eacc976 At OpenAL shutdown don't do not stop only the stream chan but all chans.
I'm not quite sure if this really makes a difference. But it's the only
idea I have regarding several "Quake II hangs at shutdown when OpenAL is
run with Pulseaudio backend" bugs.
2016-08-04 09:21:33 +02:00
Yamagi Burmeister
978eec1a8d Add an explicit fflush() when writing the config.
Yes, fclose() flushes the stream and yes, this is unnecessary. But I've
seen at least two times partial written configs on Win 10. :(
2016-08-04 09:07:47 +02:00
Yamagi Burmeister
f291693c59 Quit the game if a SDL_QUIT event is received. 2016-07-18 10:11:54 +02:00
Yamagi
7cb455459a Merge pull request #144 from smcv/source-date-epoch
savegame: ensure that BUILD_DATE is defined
2016-07-05 19:37:56 +02:00
Simon McVittie
38ff49e480 savegame: ensure that BUILD_DATE is defined
The game code does not include common.h, so it needs to redo this
part for builds without SOURCE_DATE_EPOCH, where BUILD_DATE will
not have been passed in from the outside.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-07-05 18:29:54 +01:00
Yamagi
5323873476 Merge pull request #143 from smcv/link-libopenal
Optionally link libopenal at compile time
2016-07-05 19:13:57 +02:00
Yamagi
0da70104e2 Merge pull request #142 from smcv/source-date-epoch
Override __DATE__ from SOURCE_DATE_EPOCH if set
2016-07-05 18:50:31 +02:00
Simon McVittie
5887a9e79e Optionally link libopenal at compile time
In Linux distributions, having the executable depend on the right
libraries and arrange for them to be installed is straightforward,
and there's a lot of infrastructure for tracking which library
version a particular executable needs, including making sure we have
a version that contains all of the symbols that were used. Loading
libopenal at runtime defeats that infrastructure.

The ability to substitute a different-but-compatible libopenal,
or operate with reduced functionality without libopenal, might
still be desirable for generic/portable binary releases.

The CMake build system already linked the executable to
${OPENAL_LIBRARY} anyway, so it is already a hard dependency in that
build system.
2016-07-01 09:44:00 +01:00
Simon McVittie
c00707d449 Override __DATE__ from SOURCE_DATE_EPOCH if set
For deterministic/reproducible builds (where the same source and
toolchain can be verified to produce the same binary, allowing
maliciously substituted binaries to be detected) it is desirable to
take the software's idea of the build date from the build system;
otherwise, the real-time clock at the time of building affects the
result, making it non-reproducible.

SOURCE_DATE_EPOCH is a distribution-neutral specification for how
to do that. It is meant to be set by meta-build systems such as
dpkg or RPM, using a date/time that is already part of the source code,
for example the date of the latest git commit, the date in
the package's debian/changelog, or the date in the RPM spec file.

See https://reproducible-builds.org/specs/source-date-epoch/ for the
specification of SOURCE_DATE_EPOCH, or https://reproducible-builds.org/
for more information on reproducible builds in general.
2016-07-01 09:41:23 +01:00
Simon McVittie
92668ca6b1 Fix spelling errors detected by lintian
Based on a patch by Fabian Greffrath against an earlier version of
yquake2.
2016-07-01 09:38:54 +01:00
Yamagi Burmeister
6d38cc8609 Bump version number to 5.35pre 2016-06-25 11:03:48 +02:00
Yamagi Burmeister
bb8be981d5 Bump version number to 5.34 2016-06-25 10:22:18 +02:00
Yamagi Burmeister
5a384c79b1 Switch from an arch whitelist to an "all archs are supported" approach.
The old whitelist was a leftover from the early days of YQ2. It should
run on most / all architectures, as long SDL supports them. As suggested
by smcv in issue #138 generate the OSTYPE and ARCH defines by the build
system instead of hardcoding it.

Savegame compatibility is provided by bumping the savegame version. Old
savegames are compared against the old OSTYPE and ARCH defined, new ones
against the new defines. This compatibility code should be removed
somewhere in the distant future.
2016-06-11 09:23:10 +02:00
Daniel Gibson
da6ad6953d Use software gamma for OSX, fix #134
Hardware gamma is broken, especially in fullscreen, and a Mac user told me
that setting HW/screen gamma on OSX is a bad idea anyway, because it resets
the monitor calibration.
The game /should/ look ok with vid_gamma 1 (if your display is configured
properly), but if you think it's too dark set it a bit higher and do
vid_restart.
2016-05-28 16:04:07 +02:00
Yamagi Burmeister
6f64efbd17 Disable gl_ext_multitexturing by default.
Multitexturing was enabled by default in 0f7b422. It gives a small but
on todays hardware neglectable performance boost, but caused several
problems over the years. For example gl_showtris doesn't work with it
and there's at least one render glitch in city3.bsp.
2016-05-01 09:01:39 +02:00
Yamagi Burmeister
b4d16ab6b3 Some additions to last commit:
- SOLID_BBOX seems to be more correct.
- Make debris SOLID_BBOX, too.
2016-04-29 17:40:33 +02:00
Daniel Gibson
07477e0f75 Make gibs solid so they move with conveyor belts etc, like in fact2
not sure if this has any drawbacks, seems to work good so far.

No idea why id apparently deactivated this at some point, maybe to
optimize performance?
2016-04-16 21:04:32 +02:00
Yamagi Burmeister
eaee1d71d5 Rename cl_stereo* cvars to gl_stereo*.
They're renderer cvars, not client cvars.
2016-04-07 17:01:09 +02:00
Yamagi Burmeister
238ccb8adf Fix warnings with clang after the stereo merge 2016-04-07 16:57:32 +02:00
Valery Guskov
f6c596c1c5 better default configuration for 3d 2016-04-04 23:57:59 +03:00
Valery Guskov
9693004afb removed unused variable 2016-04-04 23:57:08 +03:00
Valery Guskov
248bebeca6 unncecessary newlines 2016-04-04 22:41:27 +03:00
Valery Guskov
d09c942b52 added pause changes from stereo-quake 2016-04-04 22:25:53 +03:00
Valery Guskov
45d3dd0a2f fixed loading display
i guess
2016-04-04 20:55:17 +03:00
Valery Guskov
135fb021e5 fixed viewports a bit 2016-04-04 19:33:18 +03:00
Valery Guskov
294a4dfbb9 cleaning up
removed non-minimal changes from porting stereo-quake
2016-04-04 00:25:20 +03:00
Valery Guskov
2e87216abf Revert "ported meatball crosshair"
This reverts commit 1e6f016fca.
2016-04-04 00:11:03 +03:00
Valery Guskov
bfa212f6ba correct models provide skin path 2016-04-03 19:26:16 +03:00
Valery Guskov
b3bea99597 added new code for 3d crosshair
original meat can be thrown out
2016-04-03 00:26:35 +03:00
Valery Guskov
1e6f016fca ported meatball crosshair
copied from http://www.quakewiki.net/archives/qdevels/quake2/12_1_98.html
2016-04-02 01:24:14 +03:00
Valery Guskov
b662cb9979 added split view basic support 2016-04-01 16:22:28 +03:00
Valery Guskov
0f8bda3c33 first attempt at porting separation support
ported from stereo-quake
http://www.benryves.com/products/stereoquake
2016-04-01 08:51:11 +03:00
Daniel Gibson
7f7ba1870b Bump version to 5.34pre 2016-01-30 20:03:33 +01:00
Daniel Gibson
50fe9cfdbc Bump version to 5.33 2016-01-30 19:48:00 +01:00
Daniel Gibson
703cec74e7 Fix fix for not sending Char_Event to console when not opened
turns out the if the console is opened while no game is currently
running, cls.key_dest is not key_console but still key_game.
Changing it to key_console in those cases blows up in interesting ways.
So in Char_Event() we send events to the console in those cases.
2016-01-30 18:43:32 +01:00
Daniel Gibson
4a762c0002 Don't send Char_Event to Console if it isn't opened 2016-01-30 17:46:34 +01:00
Daniel Gibson
0fb8d80507 Small improvements to input code 2016-01-30 17:46:34 +01:00
Daniel Gibson
dc155cca9c Workaround for better AZERTY-Keyboard support
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à, ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188

As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have scancodes
which we need scancodes to identify the keys.

While at it I unified handling of SDL_KEYDOWN and SDL_KEYUP, the code
is almost identical anyway, apart from one bool argument to Key_Event().

We track this problem in #81
2016-01-30 17:46:34 +01:00
svdijk
31ffb96614 Console: Adjust line length based on scale 2015-12-19 20:36:25 +01:00
svdijk
5c54521199 Screen: Clamp scale to a minimum of 1, except for the HUD 2015-12-19 20:34:02 +01:00
svdijk
54b6d276b2 Screen: Make SCR_Get*Scale() callable before SCR_Init(). 2015-12-19 20:18:17 +01:00
svdijk
354d2ff789 Menu: Some alignment fixes for scaled menus 2015-12-13 11:48:02 +01:00
Daniel Gibson
ca4bab172e Make "no such (old)frame" warnings developer-only
those "problems" don't really matter, so don't spam the console with
it (unless you've enabled developer messages).

"Fixes" https://github.com/yquake2/xatrix/issues/7
2015-12-12 20:17:40 +01:00
svdijk
3e5ac1c15a Draw: Also don't lerp crosshairs 2015-11-24 14:19:16 +01:00
svdijk
0880bef8c8 Draw: Handle "nolerp" of console characters through a cvar 2015-11-24 14:16:18 +01:00
svdijk
44969748fb HUD: Fix centering of scaled crosshair 2015-11-20 22:04:27 +01:00
svdijk
712016783b UI scaling: Clamp the scale to avoid "over-scaling"
This clamps the UI scale, limiting the relative size of the UI
elements to what they would be at scale 1 in a 320x240 resolution.
Allowing bigger scales is not useful, and would make it possible
for the user to shoot him-/herself in the foot by setting a
"too big" UI scale value in the menu. (Since this would mess up
the menu, it could be hard te recover from for a casual user.)
2015-11-20 18:47:08 +01:00
svdijk
9964b2f3df q2icon.xbm: Make this a bit more like the new icon 2015-11-18 20:52:19 +01:00
svdijk
4194ff24dd q2icon64.h: Recreated to have the same margins as the source SVG 2015-11-18 19:58:08 +01:00
svdijk
8a9741dd89 Videomenu: Minor optimization to GetCustomValue for subsequent calls 2015-11-16 22:23:15 +01:00
svdijk
8d7f4a74e6 Videomenu: Simplify uiscale initialization 2015-11-16 19:26:46 +01:00
svdijk
a6b3bfd35a qmenu.c: Some whitespace changes for consistency. 2015-11-16 19:18:50 +01:00
svdijk
de8c50bcb9 Videomenu: Make the "custom" value handling less error prone. 2015-11-16 19:11:00 +01:00
svdijk
1804fad355 Videomenu: Add integer scaling options up to 6x 2015-11-09 22:14:45 +01:00
svdijk
e92b54990d Videomenu: Also include crosshair_scale in the ui scale option 2015-11-09 22:09:48 +01:00
svdijk
8d9cdc0768 Videomenu: Limit the ui scale option to integer values
Fractional values look ugly. If people really want this they can set this from the console, we won't "advise" it from the menu.
2015-11-08 18:20:54 +01:00
svdijk
0cdf927d3e Default the various scale variables to "-1" (automatic) 2015-11-08 12:48:27 +01:00
svdijk
64d4e8e619 Videomenu: Change the HUD scale option to a more generic UI scale option 2015-11-08 12:46:38 +01:00
svdijk
dae3de4b73 Videomenu: Don't mess up custom hudscale setting upon "apply" 2015-11-08 11:15:36 +01:00
svdijk
57c494cfd6 Fix compiler warning in stb_image.h 2015-11-05 19:51:22 +01:00
svdijk
97f9494400 Windows: Use a relative path for the icon. 2015-11-04 21:08:25 +01:00
svdijk
ec9657134f Windows: icon.rc is a source file, so move it to the source directory. 2015-11-04 21:05:30 +01:00
Daniel Gibson
4cbe5f25e0 Fix volume of looped sounds in OpenAL backend, fixes #111
AL_PlayChannel() is only called by AL_AddLoopSounds() and
S_IssuePlaysound() - but only the latter set a volume there.
Because of that, loopsounds weren't hearable anymore after the last
commit which removed adding s_volume to all volumes in AL_PlayChannel().
This is fixed by setting the volume for looped sounds in
AL_AddLoopSounds() as well.
Looped sounds don't seem to have a customizable volume and are always
played at full volume (the volume is only changed by distance, but
OpenAL does that automatically).
2015-11-02 01:48:52 +01:00
Daniel Gibson
4e13e3ee69 Uncouple s_volume from raw samples (Ogg playback and cinematics) 2015-11-01 18:02:22 +01:00
Daniel Gibson
fd31e0060d Remove CD music enable box and introduce OGG volume slider in menu
The CD music enable / disable box wasn't used by many users for two
reasons: CD music playback needs a CDROM drive with analog output.
Such drives aren't available for at least 10 years. And CD music is
unsupported with SDL2. A OGG volume slider is much more usefull.
2015-11-01 17:45:09 +01:00
Daniel Gibson
12604bebe9 Change version to 5.33pre, changes for arbitrary length version strings
Con_DrawConsole() assumed that the version string was always 21chars
long, we changed it to allow longer strings with other lenghts.
In Unix main() we changed the code for underlining
"Yamagi Quake II $version" with === so the underlining is as long
as the underlined string.
2015-11-01 17:15:10 +01:00
Yamagi Burmeister
92d48735f5 Bump version number to 5.32 2015-10-31 16:54:04 +01:00
Yamagi Burmeister
4b7b29c339 Don't stop the filesearch if the first try fails.
It was a wrong (and maybe stupid) assumption, that the config dir
(~/.yq2) is always the first element of the search path. When there's
at least one pak file in the config dir, it's added at a random
location. Work around this by probing all directories. This fixes
issue #107.
2015-10-28 07:41:58 +01:00
Yamagi Burmeister
7058052aea It's 'filename', not 'name'.
Pointyhead to: Yamagi
2015-10-28 07:31:06 +01:00
Yamagi Burmeister
1d709e5e27 Move file name check to prevent spurious "refusing to download messages
Moving the check under the "do we have the file localy" check prevents
spurious "Refusing to download a path with .." messages with some game
data. The tank commander skin is one example. This change has no
security impact since FS_LoadFile() just opens and closes the file.

While at it tighten the condition to prevent pathes with colons (this
condition is added at the server side, too) and pathes starting with
slashes and dots.
2015-10-27 17:38:28 +01:00
Daniel Gibson
17e791e528 shut up GCC warning about memset with 0bytes in Con_CenteredPrint()
yeah, if l<0 memset would have be called with length 0, which does not
really matter but was easily to prevent by only doing it if l>0.
2015-10-25 22:39:06 +01:00
Daniel Gibson
951fc2ffb7 Prettier Windowicon when using SDL2
for some reason this doesn't work properly with SDL1.2, so we keep
the old code for that.
2015-10-25 17:55:41 +01:00
Daniel Gibson
5ee1136ab5 Fix duplicate input through an activated keypad.
When the keypad was activated key presses were processed twice.
Once as a normal char event and once as a key event (not marked
as special). The key event to console character translation
function turned the key event into a second character...
2015-10-25 17:34:28 +01:00
Yamagi Burmeister
7456daf65f Do not display baseq2 savegames in mods / addons
The savegame list is generated by calling FS_FOpenFile() for each
possible savegame name. When a file handle is returned the savegame
exists, otherwise the savegame slot is empty. But FS_FOpenFile()
searches in every directory known to the VFS. If a savegame file
isn't found in $moddir but in baseq2, the file in baseq2 is opened
and a baseq2 savegame is displayed in the mods / addons savegame menu.

The fix is compromise between a clean solution and invasiveness:

- Refactor FS_FOpenFile() to include FS_FOpenFileRead(). FS_FOpenFile()
  was used only to open read only files, limit its's possibilities to
  do exactly that.
- Introduce a new flag "gamedir_only" to FS_FOpenFile(). When true
  only the gamedir directories are searched and not other directories
  like baseq2.
- Change all callers to FS_FOpenFile()s new signature.
- Use the new gamedir_only flag to limit the searchpath for savegames
  to the gamedir.
2015-10-25 16:44:22 +01:00
Yamagi Burmeister
2e82fe85fd Remove a bunch of unused VFS functions. 2015-10-25 08:48:19 +01:00
Simon McVittie
c20dbc7dac If SYSTEMWIDE, override the default basedir instead of adding a path
This makes it behave a little more like -basedir in Quake 1 and
fs_basepath in ioquake3.

This lets "+set basedir" take precedence over the SYSTEMDIR,
which is useful if you have the demo and full-game data installed
in different base directories to be able to test the demo for
regressions.
2015-10-23 19:30:42 +02:00
Yamagi Burmeister
de5849caf5 Reset gibsthisframe and lastgibframe at map change
Without this change the conditionals at g_misc.c:199 and 381 wouldn't
trigger until level.framenum reach it's previous value, resulting in
much to few debris or gibs being thrown. This fixes #104.

Many thanks to maraakate for the analysis and the idea how to fix it.
2015-10-23 19:24:52 +02:00
Yamagi
3c71ac6a08 Merge pull request #103 from mackron/brightness_fix
Apply gl_overbrightbits to regular meshes.
2015-10-23 15:06:38 +02:00
David Reid
3e0773fee4 Don't apply gl_overbrightbits to regular meshes when it's set to 0.
This should now be consistent with walls.
2015-10-23 09:39:54 +10:00
David Reid
33ad02b0d0 A couple more fixes to menu scaling.
Relates to issue #87. This should be the last commit for the menu scaling.
2015-10-22 22:06:48 +10:00
David Reid
dc53635f46 Fix alignment in the Multiplayer -> Player Setup menu.
Relates to issue #87.
2015-10-22 21:41:58 +10:00
David Reid
585e7dbfda Fix alignment in Multiplayer -> Join Network Server -> Address Book menu.
Relates to issue #87.
2015-10-22 21:04:45 +10:00
David Reid
490c5c15a3 Fix alignment in the key bindings menu.
Relates to issue #87.
2015-10-22 20:52:41 +10:00
David Reid
c623d5639c A bunch of alignment fixes to menus.
So far, fixed menus include:
 - Multiplayer
 - Multiplayer -> Start Network Server
 - Multiplayer -> Start Network Server -> Deathmatch Flags
 - Options
 - Video Options

Related to issue #87.
2015-10-22 20:36:41 +10:00
David Reid
fc33d5df64 Fix incorrect positioning of centered strings when scaling is applied.
This partially address issue #87.
2015-10-22 18:08:46 +10:00
David Reid
a856002772 Apply gl_overbrightbits to regular meshes.
This addresses issue #54. This commit also removes a couple of redundant OpenGL calls.
2015-10-22 16:26:44 +10:00
Daniel Gibson
1977570b17 Make sure not all OpenAL sources are relative, fix #100
OpenAL sources are reused in Quake2, so if a source has once been used
for a sound coming from the view entity, it'd stay relative, unless
told not to.

So now I set source's AL_SOURCE_RELATIVE to AL_TRUE or AL_FALSE in
AL_PlayChannel(), depending on the source coming from the player or not.

Thanks a lot to Tommi Teistelä for identifying the problem and pushing
me in the right direction!
2015-10-19 18:20:47 +02:00
Yamagi Burmeister
87ed67fd3d Revert "Cleanup vector math"
This reverts commit 123e409a2e.

This commit breaks several float calculations in subtiles ways. For
example grenates drift to the left. In fact, it's another example why
I'm so hesitant to merge anything that's not a fix for a clearly
reproducable bug. This fixes #99.
2015-10-19 18:20:47 +02:00
Daniel Gibson
5232088b02 Don't allow binding the "console keys" (^, ~, `) or Escape
should hopefully fix #93, which seemed to be caused by ^ and ` being
bound to toggleconsole in default.cfg (as shipped with Q2) *and*
in code, so it'd be called twice and cancel each other out.

It even warns if someone tries to bind those keys and includes an ugly
hack to *not* warn when it's done in default.cfg, to minimize confusion.
2015-10-19 18:20:47 +02:00
Sean Dwyer
159a3b8607 Add a cvar to switch behavior when misc track 0 is requested
OGG_OpenName(): add ogg_ignoretrack0 cvar to set whether we respect
default playback behaviour when track 0 is requested to be played via
standard cd audio playback.

Submitted by: ewe2
2015-10-19 18:18:44 +02:00
Yamagi Burmeister
123e409a2e Cleanup vector math
This work was submitted by Dmitry Antipov. We stick to macros instead of
inline functions since they're in line with the rest of the code base.
This patch removes several unused functions and tranfers most of the
rest into macros.
2015-10-01 15:47:37 +02:00
Yamagi Burmeister
432fdc271b Send view entity sounds from (0,0,0) and mark them AL_SOURCE_RELATIVE.
This was suggested by kcat at https://github.com/kcat/openal-soft/issues/19
This may fix #88.
2015-09-24 19:02:35 +02:00
Yamagi Burmeister
eba4ce95d4 Rename SCR_GetScale() to SCR_GetDefaultScale() 2015-09-14 19:23:44 +02:00
Yamagi Burmeister
f2e53e657b Fix crosshair_scale
The crosshair_scale cvar was broken a long time ago at Icculus Q2 or
even back at it. The fix is easy... This is part of issue #87.
2015-09-14 19:05:08 +02:00
Yamagi Burmeister
72a22b8915 Remove unreachable code 2015-09-09 08:23:23 +02:00
Yamagi Burmeister
0eb660609b Bump the version number to 5.31 2015-09-08 17:08:08 +02:00
Yamagi Burmeister
8da7a40142 FS_SetGamedir: reject "." as game directory. also reject empty string.
Submitted by: Ozkan Sezer
2015-09-03 20:35:09 +02:00
Yamagi Burmeister
8e61ccecca Remove unneed GetGameAPI() prototype.
Based upon a patch submitted by: Ozkan Sezer
2015-08-24 18:04:24 +02:00
Yamagi Burmeister
bd025ae5c5 Fix an off-by-one in memmove() call in SV_Map()
Submitted by: Ozkan Sezer
2015-08-24 18:02:08 +02:00
Yamagi Burmeister
c0fac70763 Cbuf_Execute: do not change 'i' if it overflowed sizeof line.
Submitted by: Ozkan Sezer
2015-08-24 18:00:57 +02:00
Yamagi Burmeister
a4d0d89720 Fix several potential security vulnerabilties
Submitted by: Ozkan Sezer
2015-08-24 17:58:19 +02:00
Yamagi Burmeister
5ad7b1e72d Fix several printf in the client.
Submitted by: Ozkan Sezer
2015-08-24 17:52:57 +02:00
Yamagi Burmeister
cfefe0c00c Fix a divinely dumbassed mistake of global 'i' and 'corners' variables.
Submitted by: Ozkan Sezer
2015-08-24 17:48:54 +02:00
Yamagi Burmeister
19cf5a63c7 Info_RemoveKey: use memmove instead of strcpy for overlapping memory areas.
Submitted by: Ozkan Sezer
2015-08-24 17:47:18 +02:00
Yamagi Burmeister
c17126278e SV_Physics_Pusher: fix the 'memory corrupted' check
Submitted by: Ozkan Sezer
2015-08-24 17:43:22 +02:00
Yamagi Burmeister
91245e3b70 Fix several printf format string errors in games' code
Submitted by: Ozkan Sezer
2015-08-24 17:42:01 +02:00
Yamagi Burmeister
126eb09a1e Fix missplaced brackets in boss32.c
Bad braces were added back in 2001 in icculus.org/quake2:
http://svn.icculus.org/quake2/trunk/src/game/m_boss32.c?r1=2&r2=26

Submitted by: Ozkan Sezer
2015-08-24 17:35:09 +02:00
Yamagi Burmeister
565f7f6e67 Let the Makefile generate a game.dynlib on OS X
This should have been done years ago, .dynlib is the canocial extension
for libraries on OS X. In a broader sense this simplifies the CMake
build system a little bit, since CMake enforces .dynlib for OS X
libraries.
2015-08-12 18:55:35 +02:00
Bradley Clemetson
2d20c5c801 Compiles on Linux with OpenAL support, SDL1/2 support.
Added build options for Zip/Ogg/OpenAL (On if available)
2015-08-10 22:55:01 -07:00
Bradley Clemetson
e55f7e7aeb
Now builds fully on OS X 2015-08-08 20:19:03 -07:00
Yamagi Burmeister
22a321d462 Fix animated textures on transparent surfaces
As Jack Whitham noticed [0], animated textures freeze at their first
frame if they're on a transparent surface. This can be seen in base3
(Com Centre), for example. At least for the OpenGL renderer this is
caused by the fact that the animation chain is never forwarded if the
texture is bound to a transparent surface. The fix is to do exactly
that...

I can only speculate why the animations on transparent surfaces were
never used / implemented. Maybe performance issues or it was just
forgotten.

0: http://blog.jwhitham.org/2015/04/more-fun-with-floating-point-numbers.html
2015-06-22 21:10:25 +02:00
Yamagi Burmeister
7ddbedc9c5 Enable hudscaling by default
The default value is now -1 aka "auto". If someone wants to disable it
hew can do so in the menu.
2015-06-06 20:56:39 +02:00
Yamagi Burmeister
50ad12ce13 Add a video menu entry to set the HUD scaling factor 2015-06-06 20:45:05 +02:00
Daniel Gibson
b5d810e5d8 Merge pull request #74 from yquake2/fix-max_ospath
Set MAX_OSPATH to 4096 for !Windows + Fixes for that
2015-05-31 18:28:57 +02:00
Daniel Gibson
d19cace026 Set MAX_OSPATH to 4096 for !Windows + fixes for that
sounds easy, right?
Except some genius decided to save CVAR_LATCH cvars in buffers of
MAX_OSPATH length into savegames.. so just changing MAX_OSPATH
breaks savegame compatibility.
Fortunately, this assumption only matters in SV_WriteServerFile() and
SV_ReadServerFile() so I worked around it by introducing a
platform-specific LATCH_CVAR_SAVELENGTH (because MAX_OSPATH was 256 on
Windows but 128 on other systems..)
2015-05-23 02:02:27 +02:00
Daniel Gibson
e62776fa08 global console-history instead of per-mod history 2015-05-22 23:42:23 +02:00
Daniel Gibson
c79257b5d8 Don't save consecutive duplicate commands to console history
.. I don't want to scroll through 20x /quit in the history..
2015-05-22 23:36:56 +02:00
Daniel Gibson
1ce9bdba51 Implemented a persistent, per game/mod console history
it's saved in $HOME/.yq2/$mod/history.txt

While I was at it, I made the max number of lines in the history
configurable at compiletime by introducing a NUM_KEY_LINES #define
2015-05-20 14:59:32 +02:00
Daniel Gibson
41ea8879e7 Fix bug with high velocities in vents in 32bit builds, fix #71
See https://github.com/yquake2/yquake2/issues/71
and https://github.com/yquake2/xatrix/issues/4

In ClientThink(), the float value ent->velocity[i]*8 is saved into
a short and if the value is too big for a short, in 32bit gcc builds
the short is set to SHRT_MIN, resulting in the player being pressed
down instead of up.
Now we put the result in a 32bit int first (which should be big enough)
and assign the int to the short. This still overflows, but with -fwrapv
at least in a defined way (most probably the same way the original
binaries did).

And while I was at it, when the game lib is loaded, it prints the date
it was built, this is especially interesting for our Win32 binaries.
2015-05-17 18:52:18 +02:00
Daniel Gibson
4e547feb2c *Really* support K_CAPSLOCK, K_COMMAND, K_POWER, K_PAUSE
we had constants for them in keyboard.h, but no mappings to name strings in
keynames[] in cl_keyboard.c, so they couldn't be bound.
2015-05-10 02:32:27 +02:00
Daniel Gibson
0b9ac6cb99 Fix "mark keys up when focus is lost" code, fixes #68
It didn't build on SDL1.2 (I though we tested that?!) and didn't work
with SDL2 either.

Now it builds and actually works with both SDL1.2 and 2.0
2015-04-14 00:51:38 +02:00
Daniel Gibson
e6646fb1e4 Bumped version to 5.30 2015-04-11 21:16:47 +02:00
Daniel Gibson
3cd9c76052 Fix fucking misleading comment in FS_AddGameDirectory()
that's not for *numbered* pak's, but all paks starting with "pak"!
2015-04-11 21:04:37 +02:00
Daniel Gibson
544a464eea Implement gamedata loading from binary path
even if $PWD is not the same path as the executable is in, the game
will look for game data in directories next to the executable.
2015-04-11 20:11:42 +02:00
Yamagi Burmeister
d2f7d27ad0 In case of focus loss, mark all keys up
Daniel is more or less sure that a stuck Alt key can occure if the user
switches through several windows by Alt-Tab. That sounds resonable,
because the keyup event for Alt may happen when the focus is not on
Quake II. In that case SDL2 misses it and for Quake II the key stays
down. Solve this by capturing the focus loss event and mark all keys
as up.
2015-03-31 21:23:04 +02:00
Yamagi Burmeister
aff37eda16 Make sure that no key is being marked down
It's apparently not enough to clear key repeats, we'll need to clear
the down states too. Without this Alt stays pressed after toggeling
fullscreen trhough Alt-Enter.
2015-03-30 21:22:55 +02:00
Yamagi Burmeister
02156e03ec Fix fullscreen switch on Alt-Enter
Switching to fullscreen through a SDL2 call is nice, but the renderer
needs to be reinitialized. Without it some things will break, for
example the gamma setting.
2015-03-30 20:57:32 +02:00
Yamagi
06834d1fb5 Merge pull request #65 from Jarvik7/OSX
OSX
2015-03-29 19:14:56 +02:00
jarvik7
150fb8b132 Remove old OS X cruft
This isn’t actually being used.
2015-03-29 12:22:40 +09:00
Daniel Gibson
a96218eb0a Simplify the mouse grabbing/relative mouse mode magic
basically, tell SDL each frame if you want stuff grabbed or not
+ make sure to ungrab when destroying window (e.g. on vid_restart)
2015-03-27 18:56:16 +01:00
Yamagi Burmeister
c1f5f62382 Remove the SDL.h even in !DEDICTED_SERVER builds
It was used for SDL on APPLE only. I just missread the code. :(
2015-03-20 17:45:57 +01:00
Yamagi Burmeister
531ee80ab4 We need to apply the lightmap.
This fixes #61. The issue was found and patched by ppsspp-gamer.
2015-03-20 17:41:52 +01:00
Yamagi Burmeister
177b424ba1 Remove Mac OS X support
No, this is not a rage quit but the result of a long discussion. There
are several reasons for us to drop OS X support:

- OS X support was always more or less hacky. For example is was never
  really integrated into the build system and some features like the
  OpenAL sound backend never worked well.
- The OS X support never grew into the new world based upon SDL2.
- It was broken since at least Lion which was released 4 years ago.
- None of the developers has a Mac or plans to buy one. Supporting
  a software for a platform not used by the developers is more or
  less impossible.
- And despite several appeals no one from the OS X community ever
  stept up and send patches.

Removed are:
- Makefile support
- The OpenAL quirks
- The Cocoa bindings
- The framworks

Not removed is:
- Savegame support
- Memory management support
- Platform detection
- OpenGL and SDL includes

So, if someone steps up and does a modern, fully integrated port based
upon SDL2 we're happy to merge it back. The requirements are:
- It must be a clean port, without any hacks
- Full build system integration must be provided
- The port must be maintained even after it was merged. At every release
  binaries must be build, API / ABI changes with new OS X versions must
  be tracked.
2015-03-20 17:33:46 +01:00
Daniel Gibson
47cde06e27 Use stb_image for retexturing support, also support png, no more libjpeg
Retexturing support is now always on (you can still switch it off with
the gl_retexturing  CVAR), as we don't have the additional libjpeg
dependency anymore.

stb_image is used for tga, jpg and the newly supported png, so the
old tga and jpeg loading code has been removed.

I furthermore cleaned up the somehow messy and possibly slightly broken
retexturing selection code in R_FindImage()
2015-03-20 17:33:37 +01:00
Yamagi Burmeister
046ae5c7eb Bump version number to 5.24 2015-03-13 17:59:14 +01:00
Daniel Gibson
6983d5dc3c R_Screenshot(): Write "yq2" image ID
because we can.
This should hopefully work around problems in old versions of gdk-pixbuf
that mistook TGAs without image ID as microsoft .ICO
2015-02-28 21:26:13 +01:00
Christoph Oelckers
d60dfa63bc - only #define GL constant if not already present (most likely only a problem on Windows.) 2015-02-28 20:31:07 +01:00
Christoph Oelckers
0d9a96bcc8 We have 2015 now so restricting textures to 256x256 seems a bit silly on modern hardware.
Check and use GL_ARB_texture_non_power_of_two and use it if present to allow using all textures unscaled. This makes a huge visual improvement since most skins are not power-of-two textures.

Conflicts:
	src/client/refresh/header/local.h
2015-02-28 20:31:07 +01:00
Yamagi Burmeister
104fd04e55 Boot the whole bloody anykeydown mess back in place.
Okay, I tried to solve this issue the gentle way. But apparently it's
not enough to track if a key is down. We must consider if the key is
just down or if it's already repeating... Therefor raise the white flag
and just put the original logic back in place. This may fix issue #57.
2015-01-31 11:23:32 +01:00
Yamagi Burmeister
3eca8d4e32 Use the same Sys_Microseconds() output for all CMDs
When we're building command we must make sure, that all command for
one keystroke will have the timestamp in microseconds. If that's not
the case the command may end up in differend server frames, breaking
things subtile. This may be part of bug #57, but I'm not sure.
2015-01-31 11:18:41 +01:00
Yamagi Burmeister
75280b4be8 Increase anykeydown
If we don't do this the special button state BUTTON_ANY is never
generated and the player can't leave the intermission. This fixes
bug #57.
2015-01-30 17:54:27 +01:00
Yamagi Burmeister
9bda84299c Mark all keys as "up" when the refresher is restarted
This is a less intrusive variant of the old Key_ClearState() function.
When the refresher is restarted or the menu is left, this function is
called to mark all keys as "up". That works around some corner cases
where a key is still marked "down" and thus the first stroke is detected
as a repetition.
2015-01-28 20:55:28 +01:00
Yamagi Burmeister
08f78ec3b5 Set SDL_EnableUNICODE() right after the window is created
This works around a bug in SDL 1.2 were the SDL_EnableUNICODE() state is
reset to false after the window is reacreated. Setting it in the render
backend ensures that no keystrokes are lost. This fixes #56.
2015-01-28 20:42:42 +01:00
Yamagi Burmeister
403d26d520 Process only keys between ASCII 32 and 126 as char events
This fixes bug #55 which ensued from special keys processed as char
and key events if SDL 1.2 was used.
2015-01-21 17:38:21 +01:00
Yamagi Burmeister
59ac327aba Solve some layer violations
- Handling of key combinations like Alt + Return or Shift + Escape
  clearly belong into the frontend. Now that the client won't clear
  the keystates any more it's save to handle them there.

- The 'force_centerview' command belongs into the client move stuff.
  I guess it was part of the backend sinces it messes with mouse
  handling. Since the renderer is now part of the client that's not
  necessary anymore.

- One can argue that +mlook and -mlook belong into client move stuff,
  too. But since we need there calculations in the backend anyway,
  leave things like they are.
2015-01-18 09:31:37 +01:00
Yamagi Burmeister
30fa1c5407 Use character events for some input subsystems
Until now Quake 2 used keysyms aka key events for everything, including
the console and the chat window. Since key events don't reflect if the
shift key is pressed, Quake 2 needed to convert the lower case chars to
upper case char through a hardcoded table. That lead to the problem that
the keyboard layout was utilised for lower case characters only.

Solve this long standing problem by refactoring both the input backend
and the frontends Key_Event() funktion to use character events for most
input subsystem. Character events are generated by SDL and send the
real character.

An example:
- On german keyboards shift and . is : but Quake 2 generated <.
- Now a character event with : is generated and used.

There are at least 3 disadvantes by this approach:
- The backend needs to tell the frontend if a normal character (ASCII
  32 to 126) or a special character is send. Only normal characters can
  be treated as character events.
- There may be some differences between the binding of a key seen
  through the console and seen by the game. If you have a german
  keyboard and bind :, the game may not react to :. This can be worked
  around by editing the config file.
- Users may need to rebind some keys.

Please note that Quake 2 can handle ASCII characters only!
2015-01-18 09:30:53 +01:00
Yamagi Burmeister
db10e0db87 Untangle the input system from the refresher
In the old times the refresher was a stand alone DLL. For performance
reasons and to avoid laggy input parts of the input system were
implemented in this DLL. Now that the renfresher is part of the main
binary and initialized at client startup we can remove most of the
abstractions between input system, refresher and client. Also the
input system can be treated as a normal subsystem.

Changes:
- Untangle the VID_* stuff and the IN_* stuff. The functions
  called by function pointers in in_state are now called directly
  and 'struct in_state' was removed.

- Remove input.h and rename the appropriate backend functions.
  There's no longer a need for an abstraction layer between the
  input backend and the input frontend.

- Move input initialization and shutdown into CL_Init(), like it's
  already done for all other subsystems.

- Remove Key_ClearStates(). I'm pretty sure that's a left over from
  the old Win 9x backends and unnecessary.

- General cleanup.
2015-01-16 18:23:39 +01:00
Daniel Gibson
5e33152f6a One entity shooting another should work even if friendly fire is off
In rogue's RHANGAR1 the turret didn't blow up the ceiling when friendly fire
was off, because in ClientTeam() both entities were set to "" (no team),
but OnSameTeam() just did a strcmp() instead of checking this special
case (no team).
We check this now and thus it works. Hooray.
I also refactored ClientTeam() to take the buffer instead of using a
static one and to be static (it's only called by OnSameTeam() anyway).

The savegame table entry for this function was invalid, but it doesn't
need to be saved anyway, so I just deleted it from the table.
2014-11-30 17:58:18 +01:00
Yamagi Burmeister
47634e64e8 Rename the 'ogg volume' functions to 'ogg enable'
These functions never set the OGG volume, the just enables or disabled
OGG playback. Rename them to match their purpose.
2014-10-25 09:40:13 +02:00
Yamagi Burmeister
4d5cb5686d Rename the "cdvolume" functions to "cdenable"
Historicaly this functions were used to adjust the cd music volume. In
YQ2 they were converted to enable or disable the cd music. Change their
name to match their current purpose.
2014-10-25 09:31:44 +02:00
Yamagi Burmeister
7742cd4893 Fix indention 2014-08-24 10:26:50 +02:00
Yamagi Burmeister
bffed68b2c Simplify preprocessor magic and fix dedicated server build 2014-08-24 10:24:05 +02:00
Yamagi
637aae9021 Merge pull request #50 from bibendovsky/lpf
Fix underwater sfx in demos
2014-08-23 16:42:07 +02:00
bibendovsky
120bb86458 Simplify PM_CalculateWaterLevelForDemo 2014-08-18 19:21:45 +03:00
bibendovsky
74c8c60e38 Turn off underwater sfx on disconnect 2014-08-17 18:58:26 +03:00
bibendovsky
1a514560da Fix underwater sfx in demos 2014-08-03 19:32:56 +03:00
Yamagi Burmeister
0ac4fdccfc A comparision "array != NULL" is always true 2014-08-03 11:10:22 +02:00
Yamagi Burmeister
f6a48b44bf Use the correct abs() flavor 2014-08-03 10:49:33 +02:00
Yamagi Burmeister
c0b27a8bb4 Revert "OpenGL-ES converstion"
This reverts commit 70eef55ab5.

It was premature to merge this commit into HEAD. Maybe we'll try again
one day, but only if a complete and fully working patch with build
system integartion is provided.
2014-08-03 09:34:32 +02:00
Rohit Nirmal
77492cd2f1 Fix some typos. 2014-07-30 20:58:09 -05:00
Yamagi Burmeister
5a7950683d Rewrite COM_FileExtention()
COM_FileExtension() was parsing strings from beginning to end, bailing
out as soon as '.' was found and treating everything thereafter as the
file extension. That behavior caused problem with relatives pathes like
models/monsters/tank/../ctank/skin.pcx. The new implementation uses
strrchr() to determine the last '.'.

This fixes issue #48. The bug was introduced in e07294b which replaced
hand rolled code with COM_FileExtention().
2014-07-24 21:03:00 +02:00
Yamagi Burmeister
3fc549ca42 Implement scaling of several non-menu elements
- The loading plaque
- The pause plaque
- The "Quit Screen"
2014-06-24 19:39:18 +02:00
Yamagi Burmeister
af70f276a9 Implement scaling of the menu
This commit has some drawbacks:
- It's rather hacky. The Quake II menu is crap and was never intended
  to be scaled. My approach was to add scaling to most of the generic
  functions and handle all the special cases in the non generic parts
  of the menu. A better solution would require to rewrite at least
  parts of the menu. And like it's said in qmenu.c: I won't do that.
- Some menu elements are aligned to the right, others to the left. In
  many places magic numbers are used to align elements by hand. This
  makes it very hard to impossible to implement a scaling logic which
  works in all situations. With this approach most menus look good up
  to at least a scaling factor of 3. Especially the "Player Setup"
  menu is very problematic at small disalignements are unavoidable.

Please note, that only the menu system itself is scaled. Some elements
like the the "Quit Screen" or the loading plaque are still missing. They
will be done in a later commit.
2014-06-24 19:39:10 +02:00
Yamagi Burmeister
2795088e86 Initialize the screen handling code before the renderer
This change is needed to break a otherwise fatal cycle:
- The renderer calls VID_MenuInit()
- VID_MenuInit() calls SCR_GetMenuScale()
- SCR_GetMenuScale() relies on gl_menuscale which is still
  uninitialized at this time.
2014-06-24 19:11:53 +02:00
Yamagi Burmeister
97139029b0 Implement gl_menuscale 2014-06-24 19:11:46 +02:00
Yamagi Burmeister
61667bd03d Decouple gl_hudscale and gl_consolescale 2014-06-23 08:09:01 +02:00
Yamagi Burmeister
869ce24922 Hide console scaling behin gl_consolescale
With this change it's possible to scale the HUD but not the console.
And vice versa.
2014-06-21 18:54:57 +02:00
Yamagi Burmeister
074891a8a2 Implement gl_hudscale for the console
After this change the HUD scaling is applied to the console and notify
messages. This was requested by many users.
2014-06-21 18:17:12 +02:00
bibendovsky
c1a3526a67 Add underwater sfx for SDL backend 2014-06-16 08:45:39 +03:00
bibendovsky
1dc71dbd97 Remove static keyword on some variables (these actually not static)
Caused by 1e52d35e84
2014-06-13 15:43:34 +03:00
bibendovsky
e4bb8b25a3 Fix compiling under Visual C++ when OggVorbis playback enabled 2014-06-13 14:07:56 +03:00
bibendovsky
8a28470a7a Enable TGA sky textures when retexturing is disabled 2014-06-10 10:45:49 +03:00
bibendovsky
1e52d35e84 Do not update mouse cursor position when paused, in menu, etc 2014-06-10 10:43:53 +03:00
bibendovsky
5d4c165b19 Stop Visual C++ to complain about uninitialized variable 2014-06-10 10:42:44 +03:00
bibendovsky
1ee09e3c20 Fix compiling under Visual C++ 2014-06-10 10:35:28 +03:00
bibendovsky
a53f321bed Use proper API to get pointers to OpenAL EFX extensions 2014-06-10 10:23:43 +03:00
Yamagi Burmeister
6c3fb38721 Merge remote-tracking branch 'opengles/master'
This integrates the backends for the pandora, gcw and gph written by
Scott "Pickle" Smith. Only the code itself is supplied, but no build
system integration.
2014-06-09 14:37:09 +02:00
Yamagi Burmeister
a0e7c67597 Bump version to 5.23 2014-05-08 17:24:09 +02:00
svdijk
013ad4aa45 screen: simplify SCR_GetHUDScale. 2014-05-08 04:12:39 +02:00
svdijk
9ae8192f04 video: revert commit 97e149ba9e, implement a better fix for this. 2014-05-07 18:21:12 +02:00
svdijk
6ced6809c6 savegame: update gamefunc_{decs,list}.h, for completeness sake. 2014-05-06 22:03:08 +02:00
svdijk
2b66ce0372 screen: move the SCR_DrawCrosshair declaration to the header. 2014-05-06 19:55:43 +02:00
svdijk
1d81f2e2b6 screen: auto-scale the HUD when gl_hudscale < 0. 2014-05-06 19:45:11 +02:00