Knightmare of KMQ2 requested this as an easy way to support client site
prtocol auto detection.
While here fix the protocol version number in the error string.
This brings yquake2 closer to vkQuake2 regarding renderer restarts when
the swapchain is out of date, among other situations that trigger a
Vulkan renderer restart.
Basically, the current behavior has the problem that when the renderer
is restarted at the beginning of the frame, the models are lost and we
end up with "ERROR: Mod_PointInLeaf: bad model" when attempting to
render anything after that restart.
To solve this, we move the restart logic to EndFrame and add a twist to
it: we use a vid_refresh variable to signal the server that the client
needs re-registration before starting the next frame cleanly, which will
trigger the registration logic to prepare the models again.
When creating the Vulkan texture samplers, make them have the real
anisotropic filtering value selected by the user. This has two side
effects:
* We no longer need two sets of texture samplers in Vulkan (one with and
another one without anisotropic filtering).
* The anisotropic filter value in Vulkan is no longer an on/off switch
and we use the value as chosen by the user.
Making the anisotropic filter value only be applied after hitting Apply
in the video menu will make it more natural for the Vulkan renderer to
restart itself when a new anisotropic value is selected, paving the way
to use the actual anisotropic filtering value in Vulkan.
This was the default until 2.0.12 and is what the expects. It changed
with 2.0.14, casing problems with window ordering under windows and
some X11 window managers like kwin.
Do it unconditionally. So we're shure that we're ending with a minimized
windows, no matter what SDL does.
Fixes part of #647.
One of the most common bug reports is, that the fullscreen mode doesn't
behave like users expect. This is caused by `vid_fullscreen 1` setting
desktop fullscreen mode (a fullscreen windows) and not the native
fullscreen mode. This commits switches the semantics:
* 1: Native fullscreen, like Vanilla Quake II.
* 2: Desktop fullscreen.
With this alt-tab reverts to native fullscreen. While at it improve the
documentation, suggest setting `r_mode -2` when using `vid_fullscreen
2`. Change the menu strings to make things clearer, set `r_mode -2` when
selecting 'fullscreen window' in the menu.
I pondered several other options:
* Introducing a second cvar for the desktop fullscreen, like we did in
dhewm3. This has the problem, that in Quake II vi_fullscreen is
special and used to communicate changed to the renderer configuration
between the client and renderer. A second fullscreen cvar would
complicate this already shaky mechanism even more.
* Setting `r_mode -2` when `vid_fullscreen 2`. This might not be what
the user wants and causes problems when we're unable to get the
desktop resolution.
Switching this back to Vanilla Q2 behavior fixes at least one lightning
problem in the space map in baseq2. It'll break the lighting in some
addon maps, but is more correct from a global standpoint. You can't
have everything...
Closes#677.
If an error is detected in vkAcquireNextImageKHR or vkQueuePresentKHR,
avoid restarting the whole video system and the game window. Instead,
shut down the Vulkan subsystem as gracefully as possible and restart it
without touching the window.
This fixes the problem with infinite video restarts under the Gnome
desktop environment.
1: The Vanilla Quake II behaviour, footsteps are generated when the
player is faster than 255.
0: Footstep sounds are never generated.
2: Footstep sounds are always generated.
Defaults to `1`, cheat protected to `1`.
Closes#666.
In lab.bsp near the commanders head two parasites spawn in an hidden
place in the ceiling. On hard difficulty the box cracks open, exposing
the parasites. On medium skill it doesn't. Work around that by lowering
the monster count by 2.
Closes#668.
When coming down the river near the end on hard difficulty a gladiator
breaks out of a big metal crate to the left. On medium difficulty the
gladiator is spawned but never triggered. Work around this by lowering
the monstercount by one when skill is set to 1. This doesn't happen on
easy difficulty.
Closes#667.
Specify correct protection flags when calling mmap() on FreeBSD.
prot | PROT_MAX (prot) are the correct flags because just PROT_MAX
(prot) leaves current protection flags set to PROT_NONE which causes
segmentation fault when reading or writing to the mapped region.
When windowed or in "switch resolution" mode, the viewport must be kept
in the top-left corner or it will appear cut while in fullscreen.
Also, make offset and width calculations safe from the point of view of
the swapchain extent, in case there's a mismatch.
Since we are now loading the world color buffer content before drawing
on them again, we need to make sure the attachment layout transition
from shader-read-optimal to color-attachment-optimal happens before
color attachment read operations.
The contents of the previous drawn frame, used to mask geometry glitches
due to geometry sometimes not being watertight, was not being correctly
loaded for MSAA cases.
When MSAA is not used, the single-sample attachment needs to be loaded
and stored. With MSAA enabled, it's the multisample attachment the one
needing to be loaded and stored.
The pipeline used to draw a texture quad was only created compatible
with the RP_UI render pass, which has a single-sample color attachment.
This made the pipeline work when MSAA was disabled, but it did not work
properly with it enabled.
To fix the issue, create a set of pipelines, instead of a single one,
with compatibility with the different types of render passes, as the
pipeline is used for both the scaled down view borders as well as UI
elements in the third render pass.
This was added in e3e5bd1 as a work around for some openal-soft bug.
When too many audio samples got played at the same time, the global
volume dropped. This was fixed in openal-soft 0.19.0, released more
than two years ago. We're keeping the work around, because some
distros may still ship with buggy openal-soft versions and some
players may like the changed behavior. It's disabled by default.
src/client/refresh/soft/sw_main.c:
1512 (style) Variable 'err' is assigned a value that is never used. [unreadVariable]
src/client/refresh/vk/vk_rmain.c:
1023 (style) Suspicious calculation. Please use parentheses to clarify the code. The code ''a&b?c:d'' should be written as either ''(a&b)?c:d'' or ''a&(b?c:d)''. [clarifyCalculation]
src/client/sound/ogg.c:
335 (style,inconclusive) Function 'OGG_PlayTrack' argument 1 names different: declaration 'track' definition 'trackNo'. [funcArgNamesDifferent]
212 (style) Local variable 'gogTrack' shadows outer variable [shadowVariable]
src/client/sound/sdl.c:
179 (style) The scope of the variable 'i' can be reduced.
180 (style) The scope of the variable 'lpos' can be reduced.
181 (style) The scope of the variable 'ls_paintedtime' can be reduced.
182 (style) The scope of the variable 'out_idx' can be reduced.
183 (style) The scope of the variable 'count' can be reduced.
185 (style) The scope of the variable 'p' can be reduced.
186 (style) The scope of the variable 'snd_linear_count' can be reduced.
187 (style) The scope of the variable 'step' can be reduced.
189 (style) The scope of the variable 'snd_out' can be reduced.
330 (style) The scope of the variable 'data' can be reduced.
368 (style) The scope of the variable 'data' can be reduced.
369 (style) The scope of the variable 'left' can be reduced.
369 (style) The scope of the variable 'right' can be reduced.
401 (style) The scope of the variable 'end' can be reduced.
529 (style) The scope of the variable 's' can be reduced.
799 (style) The scope of the variable 'i' can be reduced.
874 (style) The scope of the variable 'scale' can be reduced.
910 (style) The scope of the variable 'srcsample' can be reduced.
1093 (style) The scope of the variable 'total' can be reduced.
196 (style) Local variable 'i' shadows outer variable [shadowVariable]
197 (style) Local variable 'count' shadows outer variable [shadowVariable]
src/client/sound/sound.c:
450 (style) The scope of the variable 'maleFilename' can be reduced.
980 (style) The scope of the variable 'num' can be reduced.
1085 (style) The scope of the variable 'sfx' can be reduced.
423 (style,inconclusive) Function 'S_RegisterSound' argument 1 names different: declaration 'sample' definition 'name'. [funcArgNamesDifferent]
909 (style,inconclusive) Function 'S_StartLocalSound' argument 1 names different: declaration 's' definition 'sound'. [funcArgNamesDifferent]
1048 (style,inconclusive) Function 'S_Update' argument 2 names different: declaration 'v_forward' definition 'forward'. [funcArgNamesDifferent]
1048 (style,inconclusive) Function 'S_Update' argument 3 names different: declaration 'v_right' definition 'right'. [funcArgNamesDifferent]
1048 (style,inconclusive) Function 'S_Update' argument 4 names different: declaration 'v_up' definition 'up'. [funcArgNamesDifferent]
This commit removes the previous R_CleanupBorders hack and fixes
textured border drawing, so borders are correctly drawn in the right
place and are not taken into account when applying the underwater
effect.
This commit includes the following changes:
* When vid_fullscreen is 1, the game is now drawn centered in the
screen instead of the top left corner, by modifying the viewport and
scissor when drawing the world warp and UI render passes.
* When vid_fullscreen is 1, the world view no longer has an incorrect
size and/or aspect ratio. This was due to the world warp and UI
render passes sampling from the whole color buffer instead of the
restricted render area. To fix this, the postprocessing and world warp
shaders now use unnormalized coordinates, corrected with the frame
offset, and sample directly from the appropriate texels.
* The game no longer outputs pixels which have not been written to,
which are usually displayed black but may come out with undefined
colors. For this, some output color attachments are cleared before
drawing the final elements in the frame.
When set to `1`, both `deathmatch` and `coop` are forced to `0`.
`maxclients` is forced to `1`. This makes it possible to play single
player campaigns over the dedicated server.
Closes#614.
All renderers had the fix, but it was only optional in the GL renderers.
And there it was missimplemented, cvars must be defined in the renderers
main() function. Otherwise they aren't available at startup.
Rename gl_fixsurfsky to r_fixsurfsky, implement it for all renderers and
enable it by default.
Due to the skybox geometry not always being watertight, it's sometimes
possible to see instances of isolated black pixels flickering along
skybox edges. This happens when the sampling coordinates for the given
pixel fall outside any triangle in the skybox due to the previous
problem.
These pixels are usually visible when MSAA is not used and pixels are
big enough on the screen, like when using lower screen resolutions or
large vk_pixel_size values. If MSAA is used, normally only a few of the
samples fall outside any triangle and the problem is masked a bit, being
harder to spot.
Instead of fixing the skybox clipping routines, which may be
complicated, this commit simply preserves color buffer contents between
frames. If any pixel ends up without coverage, its color will be taken
from a previous draw a few frames before, depending on the swapchain
size. This is usually more than enough to completely mask the problem
visually.
Skybox edges are sometimes visible in Vulkan, specially in lower screen
resolutions or when vk_pixel_size is used to the same effect.
To avoid this problem, draw the skybox using CLAMP_TO_EDGE addressing
mode in samplers. In order to do that, the number of texture samplers is
doubled and a second set of samplers with the new addressing mode are
created, and used only when drawing the skybox.
$PROCESSOR_ARCHITECTURE seems to contain the architecture of the host,
but we need the architecture the current MinGW shell is targeting.
$MINGW_CHOST seems to be just that, and on my system it's either
i686-w64-mingw32 (mingw32.exe) or x86_64-w64-mingw32 (mingw64.exe)
(No idea what it looks like for Windows on ARM...)
As fixing this would otherwise break existing savegames, I bumped the
SAVEGAMEVER to "YQ2-4" and added a quirk for older savegameversions:
On Windows i386 savegames that contain "AMD64" instead of "i386" as
architecture are also accepted.
(For YQ2-1 this didn't seem necessary, apparently "i386" was hardcoded)
In Vanilla Q2 (without any point releases) the hyperblaster projectiles
emitted white light. In the 3.21 sources it's yellow. It likely changed
in on of the (early) point releases. Change it to yellow, the code now
matches 3.21.
Since the first release Yamagi Quake II used the more fanzy R1Q2 colors
for some dynamic lights:
* In R1Q2 the rocket has orange light, matching the color of the fire
trail and the generic explosion. Vanilla Quake II had yellow light,
the same as the blaster and several muzzle flashs.
* In R1Q2 hyperblaster projectiles are emitting yellow light, like the
normal blaster. That matches the projectile colors, the muzzle flash
and the effect when hitting a wall. And it's more logical, since the
hyperblaster is just a blaster on steroids. Vanilla Quake II had white
/ uncolored lights.
Add an option to revert to Vanilla Quake II colors, leave the R1Q2
colors as default. Closes#640.
Since 1a913eb we're calling realpath() on every dir and bail out if the
real path isn't available. If the game is started the first time, the
configuration dir doesn't exist at the first realpath() call and the
game errors out. Always create the configuration dir when determining
it's path.
This didn't happen on Windows because the configuration dir was created
when opening stdout.txt right after we entered main().
TODO: Sys_Mkdir() should grow at leas a little bit error handling. We're
silently ending up in -portable mode if the configuration dir couldn't
created.
When calculating the pipeline scissor adjusted for vk_pixel_size, round
scissor offset down and size up. This avoids black bars on image borders
when scaling up if the division is not exact.
This commit adds a new cvar called vk_pixel_size that represents how big
pixels should look in the rendered world in order to simulate lower
screen resolutions. With its default value of 1 everything looks normal,
but with bigger sizes (e.g. 4) the rendered world starts to look
"pixelated" due to pixels appearing bigger.
To implement the effect, the viewport and scissor are modified when
drawing the world so the rendering results cover a smaller area in the
top-left corner of the image.
The post-processing fragment shader is used to scale the image back to
the swapchain size before drawing UI elements on top of it.
The UI is not affected by this change, so the existing UI scaling
options continue to work as before with no changes, adding some
flexibility to the mix.
Related to feature request #588.
src/common/cvar.c:160 Logical disjunction always evaluates to true: c >= '0' || c <= '9'. Are these conditions necessary? Did you intend to use && instead? Are the numbers correct? Are you comparing the correct variables?
src/common/cvar.c:141 The scope of the variable 'c' can be reduced.
src/common/cvar.c:517 The scope of the variable 'c' can be reduced.
src/common/shared/shared.c:1359 Either the condition '!value' is redundant or there is possible null pointer dereference: value.
src/common/shared/shared.c:1371 Either the condition '!value' is redundant or there is possible null pointer dereference: value.
src/common/shared/shared.c:1377 Either the condition '!value' is redundant or there is possible null pointer dereference: value.
src/client/refresh/soft/sw_main.c:1531 Variable 'err' is assigned a value that is never used.
src/client/refresh/gl1/gl1_model.c:39:6: warning: type of ‘LoadSP2’ does not match original declaration [-Wlto-type-mismatch]
src/game/g_turret.c:29:6: warning: type of ‘infantry_die’ does not match original declaration [-Wlto-type-mismatch]
src/game/g_spawn.c:43:6: warning: type of ‘SP_info_player_intermission’ does not match original declaration [-Wlto-type-mismatch]
The QVK shutdown is necessary, otherwise we'll leak all(?) allocated
Vulkan resources in case of a renderer restart by `vid_restart` and the
like. The also fixes some crashes in RADV at renderer shutdown.
vk_common.c:1618:19: style: The if condition is the same as the previous if condition [duplicateCondition]
vk_draw.c:93:7: style: The scope of the variable 'fullname' can be reduced. [variableScope]
vk_draw.c:273:9: style: The scope of the variable 'source' can be reduced. [variableScope]
vk_draw.c:274:8: style: The scope of the variable 'frac' can be reduced. [variableScope]
vk_draw.c:274:14: style: The scope of the variable 'fracstep' can be reduced. [variableScope]
vk_draw.c:276:8: style: The scope of the variable 'row' can be reduced. [variableScope]
vk_draw.c:295:12: style: The scope of the variable 'dest' can be reduced. [variableScope]
vk_draw.c:111:45: style:inconclusive: Function 'Draw_GetPicSize' argument 3 names different: declaration 'name' definition 'pic'. [funcArgNamesDifferent]
vk_draw.c:131:57: style:inconclusive: Function 'Draw_StretchPic' argument 5 names different: declaration 'name' definition 'pic'. [funcArgNamesDifferent]
vk_draw.c:159:53: style:inconclusive: Function 'Draw_PicScaled' argument 4 names different: declaration 'factor' definition 'scale'. [funcArgNamesDifferent]
vk_draw.c:185:56: style:inconclusive: Function 'Draw_TileClear' argument 5 names different: declaration 'name' definition 'pic'. [funcArgNamesDifferent]
vk_image.c:586:7: style: The scope of the variable 'best' can be reduced. [variableScope]
vk_image.c:1170:8: style: The scope of the variable 'p' can be reduced. [variableScope]
vk_image.c:1591:7: style: The scope of the variable 'r' can be reduced. [variableScope]
vk_image.c:1591:10: style: The scope of the variable 'g' can be reduced. [variableScope]
vk_image.c:1591:13: style: The scope of the variable 'b' can be reduced. [variableScope]
vk_image.c:1592:11: style: The scope of the variable 'v' can be reduced. [variableScope]
vk_image.c:1628:9: style: The scope of the variable 'j' can be reduced. [variableScope]
vk_image.c:1261:8: style: Local variable 'i' shadows outer variable [shadowVariable]
vk_light.c:231:18: warning: Identical condition '(back<0)==side', second condition is always false [identicalConditionAfterEarlyExit]
vk_light.c:40:8: style: The scope of the variable 'a' can be reduced. [variableScope]
vk_light.c:306:9: style: The scope of the variable 'add' can be reduced. [variableScope]
vk_mesh.c:107:7: style: The scope of the variable 'count' can be reduced. [variableScope]
vk_mesh.c:316:7: style: The scope of the variable 'count' can be reduced. [variableScope]
vk_mesh.c:317:7: style: The scope of the variable 'i' can be reduced. [variableScope]
vk_mesh.c:647:9: style: The scope of the variable 'min' can be reduced. [variableScope]
vk_mesh.c:766:9: style: Local variable 'model' shadows outer variable [shadowVariable]
vk_mesh.c:267:52: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
vk_mesh.c:750:128: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
vk_model.c:53:9: style: The scope of the variable 'd' can be reduced. [variableScope]
vk_model.c:54:12: style: The scope of the variable 'plane' can be reduced. [variableScope]
vk_model.c:407:7: style: The scope of the variable 'next' can be reduced. [variableScope]
vk_model.c:462:12: style: The scope of the variable 'e' can be reduced. [variableScope]
vk_model.c:519:8: style: The scope of the variable 'planenum' can be reduced. [variableScope]
vk_model.c:519:18: style: The scope of the variable 'side' can be reduced. [variableScope]
vk_model.c:520:8: style: The scope of the variable 'ti' can be reduced. [variableScope]
vk_model.c:613:21: style: The scope of the variable 'p' can be reduced. [variableScope]
vk_model.c:663:21: style: The scope of the variable 'p' can be reduced. [variableScope]
vk_model.c:722:10: style: The scope of the variable 'j' can be reduced. [variableScope]
vk_model.c:783:8: style: The scope of the variable 'bits' can be reduced. [variableScope]
vk_model.c:901:18: style: The scope of the variable 'pinframe' can be reduced. [variableScope]
vk_model.c:901:29: style: The scope of the variable 'poutframe' can be reduced. [variableScope]
vk_model.c:1102:7: style: The scope of the variable 'i' can be reduced. [variableScope]
vk_model.c:1103:13: style: The scope of the variable 'sprout' can be reduced. [variableScope]
vk_model.c:1072:28: style:inconclusive: Function 'R_BeginRegistration' argument 1 names different: declaration 'map' definition 'model'. [funcArgNamesDifferent]
vk_pipeline.c:51:87: style:inconclusive: Function 'QVk_CreatePipeline' argument 2 names different: declaration 'desLayoutCount' definition 'descLayoutCount'. [funcArgNamesDifferent]
vk_rmain.c:405:10: style: The scope of the variable 'scale' can be reduced. [variableScope]
vk_rmain.c:400:28: style:inconclusive: Function 'Vk_DrawParticles' argument 1 names different: declaration 'n' definition 'num_particles'. [funcArgNamesDifferent]
vk_rmain.c:956:62: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
vk_rmain.c:1196:12: style: Variable 'err' is assigned a value that is never used. [unreadVariable]
vk_rmisc.c:97:10: style: The scope of the variable 'temp' can be reduced. [variableScope]
vk_rmisc.c:140:23: style: Variable 'isPreferred' is assigned a value that is never used. [unreadVariable]
vk_rsurf.c:678:11: style: The scope of the variable 'k' can be reduced. [variableScope]
vk_rsurf.c:679:12: style: The scope of the variable 'pplane' can be reduced. [variableScope]
vk_rsurf.c:680:9: style: The scope of the variable 'dot' can be reduced. [variableScope]
vk_rsurf.c:682:12: style: The scope of the variable 'lt' can be reduced. [variableScope]
vk_rsurf.c:741:8: style: The scope of the variable 'i' can be reduced. [variableScope]
vk_rsurf.c:811:22: style: The scope of the variable 'mark' can be reduced. [variableScope]
vk_rsurf.c:980:10: style: The scope of the variable 'c' can be reduced. [variableScope]
vk_rsurf.c:982:7: style: The scope of the variable 'cluster' can be reduced. [variableScope]
vk_rsurf.c:1055:6: style: The scope of the variable 'height' can be reduced. [variableScope]
vk_rsurf.c:1104:13: style: The scope of the variable 'best2' can be reduced. [variableScope]
vk_rsurf.c:1142:11: style: The scope of the variable 'lindex' can be reduced. [variableScope]
vk_rsurf.c:1145:9: style: The scope of the variable 's' can be reduced. [variableScope]
vk_rsurf.c:1145:12: style: The scope of the variable 't' can be reduced. [variableScope]
vk_rsurf.c:1257:12: style: The scope of the variable 'dummy' can be reduced. [variableScope]
vk_swapchain.c:68:7: warning: Possible null pointer dereference: presentModes [nullPointer]
vk_swapchain.c:182:91: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
vk_warp.c:57:8: style: The scope of the variable 'm' can be reduced. [variableScope]
vk_warp.c:64:8: style: The scope of the variable 's' can be reduced. [variableScope]
vk_warp.c:64:11: style: The scope of the variable 't' can be reduced. [variableScope]
vk_warp.c:168:8: style: The scope of the variable 'lindex' can be reduced. [variableScope]
vk_warp.c:325:9: style: The scope of the variable 'j' can be reduced. [variableScope]
vk_warp.c:530:11: style: The scope of the variable 'k' can be reduced. [variableScope]
Menu popup can be called without initial run FrameBegin.
#0 0x0000007ff406bea8 in R_EndWorldRenderpass () at src/client/refresh/vk/vk_rmain.c:937
#1 0x0000007ff4060b5c in Draw_CharScaled (x=12, y=66, num=num@entry=1, scale=1) at src/client/refresh/vk/vk_draw.c:61
#2 0x0000005555581900 in M_DrawCharacter (cx=cx@entry=12, cy=cy@entry=66, num=num@entry=1) at src/client/menu/menu.c:410
#3 0x0000005555581964 in M_DrawTextBox (x=x@entry=12, y=y@entry=66, width=35, lines=3) at src/client/menu/menu.c:487
#4 0x0000005555581fa0 in M_Popup () at src/client/menu/menu.c:580
#5 0x0000005555583ad0 in SearchLocalGames () at src/client/menu/menu.c:2771
#6 0x0000005555583c94 in JoinServer_MenuInit () at src/client/menu/menu.c:2838
#7 0x0000005555585d2c in M_Menu_JoinServer_f () at src/client/menu/menu.c:2863
#8 JoinNetworkServerFunc (unused=<optimized out>) at src/client/menu/menu.c:737
#9 0x0000005555588724 in Action_DoEnter (a=<optimized out>) at src/client/menu/qmenu.c:55
#10 Menu_SelectItem (s=s@entry=0x5555611148 <s_multiplayer_menu>) at src/client/menu/qmenu.c:566
#11 0x0000005555586338 in Default_MenuKey (m=0x5555611148 <s_multiplayer_menu>, key=13) at src/client/menu/menu.c:393
#12 0x00000055555873fc in M_Keydown (key=key@entry=13) at src/client/menu/menu.c:4682
#13 0x000000555556f194 in Key_Event (key=<optimized out>, down=true, special=special@entry=true) at src/client/cl_keyboard.c:1331
#14 0x000000555557f078 in IN_Update () at src/client/input/sdl.c:641
#15 0x0000005555570e64 in CL_Frame (packetdelta=96239, renderdelta=<optimized out>, timedelta=<optimized out>,
packetframe=packetframe@entry=true, renderframe=renderframe@entry=true) at src/client/cl_main.c:802
#16 0x00000055555a8a78 in Qcommon_Frame (usec=96239) at src/common/frame.c:626
#17 0x00000055555a8c98 in Qcommon_Mainloop () at src/common/frame.c:163
#18 0x00000055555a92f0 in Qcommon_Init (argc=1, argv=0x7ffffff358) at src/common/frame.c:377
#19 0x0000005555561e44 in main (argc=1, argv=0x7ffffff358) at src/backends/unix/main.c:123
On RetroPie, it seems that the joystick input is mixed up with mouse
input, causing both joystick and mouse code to run in response to stick
input. this makes the game impossible to play with a gamepad.
Setting sensitivity to 0 solves this problem, this change just makes it
possible in the UI
Expo makes gamepad stick input non-linear such that small
movements on the stick are less pronounced. This enables
both precise and fast movements, even at higher sensitivity levels.
Expo is applied to all axes equally.
According to the C standard, arguments to the ctype functions
must fit into unsigned char (presumably so they can be implemented
with simple array access). This causes a build time warning on
NetBSD, and may function incorrectly if any UTF-8 strings are used.
Compare case insensitve and copy the case insensitive partial matches into the console. But copy the case sensitive match as soon as there's a full match. Should work under Windows and Linux.
Closes#621.
This can happen in some special cases, like basedir == binarydir. A
common case is Windows. If -basedir isn't given, basedir is set to '.'
and we end up with basedir == binarydir.
In theory adding a dir twice shouldn't be problem, because the first
addition always matches and the second addition is ignored. But I'm
not sure if that always the case in practice.
Working with canonical fullpathes everywhere makes debugging easier.
And it will be used in a later commit to make sure, that each path is
added only once.
* Convert back slashes into forward slashes.
* Make sure that there's no slash at the end.
In theory this is a noop, just making the output somewhat more readable.
This would have prevented the 7.44 release f*ckup. In practise this
shoudl never happen, because there's always baseq2/ but you never know
and it's better to be sure.
This prevents Sys_FindFirst() further down below getting called with
wrong arguments, returning a null pointer. The null pointer crashes
the filesystem. :/
When Q2 runs in windowed mode, SDL can never switch to the wrong the
resolution. The resolution isn't switched, of course. The work around
prevented Q2 from creating Windows larger than the resolution of the
primary display. For example a primary display of 1280x1024 prevented
a window size of 1680x1050 on the much bigger secondary display.
Normally stdout and stderr are buffered. In case of a crash the last
lines aren't written to the stdout.txt, making post mortem debugging
difficult. Forcing both FDs to unbuffered mode ensures that everything
gets written. The performance impact is negliable.
Even tough it is a multi user os, due to BeOs heritage and being backwards
compatible with, the desktop runs as root, thus its dog get eaten after all...
Combs all Raw search paths to find game dirs containing PAK/PK2/PK3
files. If multiple uniquely-named directories exist, then show a "mods"
option on the "Game" menu and allow selection of desired mod on new
eponymous submenu. Includes fix for memory leak of mapnames (read from
"maps.lst") when changing games.
When the "game" directory is changed, clear the current list of maps in
the "start network server" menu so that it will be re-initialized the
next time the menu is accessed.
so it waits for about the time of one frame at 60fps, but independently
of the actual framerate.
Without this fix, wait is broken unless vsync is on, because
CBuf_Execute() is called about 1000 times per second by Qcommon_Frame(),
even if no render- or packet-frame is executed.
(vsync "fixes" this because then we have a real wait at the end of each
renderframe)
We busy-looped for 5000 microseconds, i.e. 5 milliseconds, which reduces
the framerate to < 200fps
I guess the value was copypasted from Sys_Nanosleep() below, but
that was nanoseconds of course..
Anyway, busy-looping for 5 *micro*seconds instead fixes it.
Angle kicks are used for weapon recoil, damage kicks and the like.
Setting the `cl_anglekicks` to `0` ignored them, they're read from
the network but not displayed. The cvar is cheat protected, it's
reset to `1` on server connect.
Rquested by Martin via mail.
In coop it's often hard to get on the same elevator together, because
they're immediately triggered once the first player steps on it.
This cvar sets a delay (1 second by default) for the elevator to wait
before moving, so other players have some time to get on it.
If you like elevators/platforms that suck, just set it to `0` :-P
Currently only used in func_plat, if it turns out that other entities
are used for automatically triggered platforms, we'll have to adapt
those as well (I guess wait_and_change() is generally useful for that).
We're not bumping the savegame version because they should only break in
an uncommon corner case: *Coop* savegames created with clients including
this change will not work on older clients - SP savegames are not
affected and old savegames on new clients also still work.
In coop a weapon can be picked up only once. That's annoying, because in
coop ammunition is sparse and not getting the ammunition that comes with
a weapons make things worse. When `coop_pickup_weapons` is set to `1` a
weapon may be picked up if:
1) The player doesn't have the weapon in their inventory.
2) No other player has already picked it up.
This is one these constructs which makes you wonder how it could ever
work. When querying a cvar by calling Cvar_Get(), the default value
(given in `var_value`) is copied into `cvar_t->default_string`. If a
NULL pointer is given in `var_value`, the NULL pointer is passed to
CopyString() and dereferenced. The game crashes. There's already a NULL
pointer check in the 'cvar wasn't found' branch, but none in the 'cvar
was found' branch... Moving the check to the beginning of the function
isn't an option, because at least lithium2 doesn't implement a NULL
pointer check either. We would just move the crash from the server into
the game.dll. Therefore copy an empty string into
cvar_t->default_string` when a NULL pointer was passed in `cvar_value`
and the cvar was found. Pass the empty string trough `CopyString()` to
get an Z_MAlloc() allocation for it, otherwise we would call `Z_Free()`
on an unallocated object further down below.
Reported by Chris Stewart.
ogg_enabled doesn't prevent music from playing, it just toggles if the
ogg backend should be enabled or not. If the user does something like
`ogg_enable=0; snd_restart` everything is okay. If they just set
`ogg_enable=0` strange things happen because the backend stays
initialized and will play tracks as requested. Work around the by
shutting the backend down if `ogg_enable == 0 && ogg_started == true`.
Closes#583.
This allows really bug configuration files up to 32k. It would be better
to switch the global buffer to something allocated at runtime, but thats
non-trivial... This change should be save, since the buffers are global
(allocated in the BSS) and not included in savegames nor send over the
network.
Closes#582.
It's an often reported, that the q2ded dedicated server consumes huges
amounts of CPU time. That's because users don't know that `busywait`
must be set to `0`. Since there's no point in using busywaits in the
dedicated server (the network jitter is always bigger than the
jitter caused by nanosleep() and equivalents), just force q2ded to
use nanosleep().
Some projectiles like grenades or rockets are classified as enemies.
Their explosion spawn a sound entity, monsters should move to that. But
the projectile is destroyed when exploding, it's entity struct is set to
NULL. Therefor the self->enemy pointer is also NULL. The self->enemy
check was removed in bc5f5698. Work around this by pretending that the
enemy is already there.
This was reported by @Soldy, closesyquake2/xatrix#56.
This is a special case, the bug was already present in Vanilla Q2: If a
server is offering assets for download but is missing some files the
USP download code runs in an endless loop. CL_ParseDownload() detects
that something is wrong and calls CL_RequestNextDownload() which tries
to download the same file again... Work around this by skippig over that
file.
This closes#552.
The new ordering was introduced in 16ee007, fixing some problems with
the wrong sound getting played when an entity triggers several sound at
the same timestamp. This broke the behavior of the mods, in #558 dday
was mentioned, muzzle flashe sound prevent the firing sound from getting
played.
Since we don't control the source of all mods, add a simple band aid
fix: Use the new ordering for baseq2, xatrix and rouge. Use the old
ordering for everything else.
An alternative approach is being discussed in #564.
I don't remember why we restricted it to client startup. The original
code executed it everytime when `game` changed... Revert to that
behavior. Look here if some problems come up. ;)
Closes#544.
Adaptive vsync is a often requested feauture and easy to implement. Set
`r_vsync` to `2` to enable. This is untested because my system doesn't
support it.
There already was one (that I only recently fixed) for semicolon, but
the same problem can happen with quotes or $ (which is used in macros)
(single-quote ' is probably not affected, added it just to be sure)
regardless of keyboard layout, with a special exemption for layouts
where that key generates a quote character (like the Brazilian one)
because you may wanna type a quote into the console.
(It's SDL_SCANCODE_GRAVE, that key between Esc, 1 and Tab)
The old hack of matching for ^, ~ and ` in Char_Event() didn't work very
well for layouts we didn't anticipate, which is especially relevant with
the recent Scancode fallback, which for example allows binding the ^ key
on Belgian keyboards (which is on SDL_SCANCODE_LEFTBRACKET, far away
from the "console key"), but in that case would *also* open the console.
This is mostly straight-forward, except for a small hack to prevent the
key from generating text input (on German layouts you otherwise get
"^" in the console when closing+opening it), which requires the
"console key" to be pressed without any modifiers like Shift or AltGr.
Yes, it's ugly, but it works and all the uglyness is contained in
IN_Update() and on the other hand Char_Event() becomes less ugly :)
If we can't map a SDL_KEYDOWN/KEYUP events SDL_Keycode to a known
Quake2 K_* keycode, we try to map the SDL_Scancode to one of the new
K_SC_* YQ2 scancodes instead.
The scancode name corresponds to the key at that position on US-QWERTY
keyboards *not* the one in the local layout, for example the German 'Ö'
key is K_SC_SEMICOLON.
This way (hopefully!) all keys on common keyboards can be bound,
regardless of their layout. The key name won't be immediately obvious
to the user, but it's only a fallback and better than nothing.
fixes#543
this way it's easier to tell if a key constant is not handled.
Also, there was a half-finished workaround to allow binding a ';' key
(which apparently in configs would otherwise be interpreted as
command separator), now that should actually work (=> special case
it in Key_KeynumToString())
This is an enhancement to the previous `yield` work:
* Don't enforce `-march=armv8-a` for aarch64 builds, because it is the
initial ARMv8 revision and compilers will either use that or something
newer.
* Refine preprocessor guards around `asm("yield");` so the code isn't
compiled in if unsupported by the current `-march='.
Submitted by @smcv in #535.
On MacOS texture is cleaned up after render and code have to copy a whole
screen to texture, other platforms save previous texture content and can
be copied only changed parts.
YQ2 has a much more precise Sys_Milliseconds() than Vanilla Quake II and
it always start at 0, not some other semirandom value. If the client is
started by `./quake2 +connect example.com" or all user just walk their
way to the menu there's a very high propability that two ore more
clients end up with the same qport... We can't use rand(), because we're
always starting with the same seed, so all clients generate more or less
the same random numbers and we end up in the same situation.
So just call time(). It's portable and more or less in line what the
original code did for Windows. It may be necessary to implement some
kind of fallback logic just in case that still two clients end up with
the same qport, but that's a task for another day.
Closes#537.
This was introduced in 220f0a9 as fix. The submitter, @DanielGibson and
myself missunderstood the code:
* If net_interface is NULL (which in the current code can never happen),
an empty string (the user sets the `ip` cvar to an empty string) or
"localhost" (the default) we want to set `Host` to the unspecified
address. getaddrinfo() will return in6addr_any fot it and we'll bind
to any available address.
* "0.0.0.0" isn't the IPv4 any address, it's the unspecified address.
Thats correct and the code was working fine for IPv4. But at least
the submitter and me confused it with the any address (which is
0.0.0.0/0). So setting `Host` in the IPv6 to `::/128` (the lowest IPv6
address) or `::/0` (any IPv6) is wrong, it must be `::` (unspecified
IPv6 address)!
Have a look at RFC 3493 for the details.
I'm doing the change only for the Unix code path, not for Windows. For
some reason everything besides `::/128` or `::1` doesn't really work on
Windows and I don't know why. Even more scary is that changes to the
IPv6 case also break IPv4 sockets. Since the whole network.c for Windows
is confuse and rather hard to understand (there's still IPX support in
it) I'm leaving things as they are.
C11 _Noreturn is only accepted on function declarations, not on function
pointers, so we can't use it on callbacks like game_import_t.error and
refimport_t.Sys_Error. Use a separate macro for those.
The problematic situation doesn't currently happen because the Makefile
hard-codes -std=gnu99, which disables C11 features; but removing
-std=gnu99 (resulting in the compiler's default, currently gnu11) causes
compilation failures with at least gcc 9.x.
Signed-off-by: Simon McVittie <smcv@debian.org>
Until now CFGDIR was hardcoded to YamagiQ2 on Windows and .yq2 on
everything else. Sometimes it's desireable to have a separate dir
for some tasks, for example whentesting things that introduce new
cvars. Add -cfgdir to override CFGDIR.
This allows for longer arguments passed to cvars, gl_nolerp_list is a
good example for a case were a token length of 128 is too short. Keep
the mapname[] buffer in the server struct at 128 bytes to preserve
savegame compatibility.
Closes#526.
In the vanilla code show_hostile was a qboolean what's clearly wrong.
For wome reasons I don't remember I changed it to an integer and added
the casts. This is problematic because show_hostile is derived from
level.time which is a float. The loss in precision broke some corner
cases like monsters becoming activated when they shouldn't.
Found, analyzed and reported by @BjossiAlfreds #525. Closes#525.
Until this commit a cinematic was aborted as soon as any key were
marked down when finishing the user command and sending it to the
server. The whole logic to detect if a key is down is broken, for
example `vid_restart` may leave keys marked down that are in fact
up. And there's the possibility to inject fake key events from
nearly everywhere. I'm not really sure but I suspect that even the
server may be able to inject key events.
Therefore untangle the cinematic abort code from the user command
processing, it should depend only on real key strokes:
1. Introduce a new global variable `abort_cinamatic` and set it to
`cls.realtime` as soon as a key down event is detected. The only
exceptions are Escape and Shift, because opening the menu and
toggeling the console should never abort a cinematic.
2. When starting a cinematic `abort_cinamatic` is set to INT_MAX,
because it needs to be higher than the current `cls.realtime`.
3. When a cinematic is running, `cls.key_dest` is set to `key_game`
(`key_menu` and `key_console` are ignored, keys send to the menu
or the console should never abort a cinematic; `key_message`
can / should never happen while a cinematic is running) and
`abort_cinamatic` is less than `cls.realtime` the cinematic is
aborted.
`abort_cinamatic` less than `cls.realtime` is necessary because the
client needs one frame to pop up the menu or toggle the console and set
the `cls.key_dest` accordingly. `abort_cinamatic == cls.realtime - 1`
is not possible because not every frame finishes a user command.
This closes#502.