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.
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.
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.
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.
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.
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...
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)
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.
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.
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.
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
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.
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.
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... ^^
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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...
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.
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.
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>
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.
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.
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.
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.
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.
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?
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.
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.)
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).
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.
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.
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.
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.
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...
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.
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.
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.
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!
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.
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.
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
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.
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.
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
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..)
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
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.
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.
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.
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.
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.
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()
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
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.
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.
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.
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.
- 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.
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!
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.
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.
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.
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.
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().
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.
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.
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.