Commit graph

2496 commits

Author SHA1 Message Date
Denis Pauk
791b5e1e13 Save buffer size and use as limit for operations 2021-02-06 23:35:02 +02:00
Denis Pauk
ba173e68b5 rearrange init functions 2021-02-06 22:42:15 +02:00
Denis Pauk
0b79fa99ed #660: convert wrong modeltype to warning 2021-02-03 00:08:10 +02:00
Denis Pauk
1882fc2dbc #661: Use corrected resolution in fullscreen=1 2021-02-01 23:02:51 +02:00
Yamagi
06d183b6db
Merge pull request #655 from 0lvin/stereo_sound
Support of wav stereo sound
2021-01-31 12:18:26 +01:00
Ricardo Garcia
8599cab275 Load framebuffer contents correctly for MSAA
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.
2021-01-31 10:54:03 +01:00
Ricardo Garcia
9661ce0ba0 Make scaled down view borders work with MSAA
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.
2021-01-31 10:38:59 +01:00
Yamagi
9a17eb9ac3 Make limiting power screen sounds to 16 optional.
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.
2021-01-30 13:51:02 +01:00
Denis Pauk
6f045f71af sound: use current func name in Com_Error 2021-01-27 22:38:31 +02:00
Denis Pauk
f73bcf5fbd cppcheck fixes
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]
2021-01-27 22:38:31 +02:00
Denis Pauk
8c69684e8d client/sound: make local symbols static 2021-01-27 22:38:31 +02:00
Denis Pauk
c3e76236ba Support stereo effects #641
Based on:
  https://github.com/mczero80/KMQuake2/blob/4c23519/client/snd_mem.c#L324
  https://github.com/mczero80/KMQuake2/blob/4c23519/client/snd_mem.c#L236
2021-01-27 22:38:31 +02:00
Yamagi
957c11513c
Merge pull request #657 from rg3/vulkan_fullscreen_fixes
Fullscreen Vulkan fixes
2021-01-27 08:38:03 +01:00
Ricardo Garcia
e85f266a84 Restore reduced view textured borders
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.
2021-01-24 23:47:21 +01:00
Ricardo Garcia
741f64604c Remove duplicate comment 2021-01-24 23:25:02 +01:00
Ricardo Garcia
abda667781 Fix screenshots so they capture the center of the framebuffer 2021-01-24 23:19:20 +01:00
Ricardo Garcia
fe13cfbbb7 Avoid frame cleaning hack in refdef changes
With the fix from 76f56458, we no longer need to clean the frame when
the world view changes sizes.
2021-01-24 22:18:41 +01:00
Ricardo Garcia
76f56458b1 Fix water warp edge distortion when keeping resolution
With vid_fullscreen 1 and a scaled down viewport, the water distortion
effect produced waves in the viewport edge. This commit fixes those.
2021-01-24 13:32:45 +01:00
Ricardo Garcia
5fcfcd56b3 Fullscreen Vulkan fixes
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.
2021-01-24 11:52:30 +01:00
Ricardo Garcia
bb827cad8c Fix text indicating MSAA samples for Vulkan 2021-01-23 09:56:24 +01:00
Yamagi
449776d3f6
Merge pull request #654 from 0lvin/ref_vk
Sync variable names for msaa, retexturing and anisotropic filtering
2021-01-22 12:27:18 +01:00
Yamagi
0488dcd4e9 Add a replacement chasing the cl_anglekicks -> cl_kickangles rename. 2021-01-22 12:22:47 +01:00
Denis Pauk
46c24d4d18 Sync variable names for msaa, retexturing and anisotropic filtering #646 2021-01-19 21:39:44 +02:00
Denis Pauk
6a89f30768 Show message about anisotropy for selected device 2021-01-19 21:39:34 +02:00
Denis Pauk
b9d4549a9b Add support r_customwidth/r_customheight in ref_vk #652 2021-01-19 21:39:25 +02:00
Denis Pauk
000c72fecc Rework vk_msaa to use number of samples #646 2021-01-19 21:39:13 +02:00
Hugo Locurcio
08d59ee8e8
Rename cl_anglekicks to cl_kickangles for consistency with Q2PRO 2021-01-18 04:41:57 +01:00
Yamagi
2fae58d56b Implement singleplayer in the dedicated server.
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.
2021-01-17 11:07:46 +01:00
Yamagi
f01998896f Hide the fix for sky surfaces missused for indoor lighting begind cvar.
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.
2021-01-17 10:25:09 +01:00
Yamagi
a9914efde7 Implement vk_underwater, make the underwater warp effect optional.
This was requested in #505.
2021-01-13 21:46:15 +01:00
Yamagi
8a54e49f61
Merge pull request #643 from 0lvin/ref_vk
Enable depthWriteEnable for particles
2021-01-13 18:27:17 +01:00
Yamagi
61766edbe1
Merge pull request #644 from rg3/skybox-fixes
Skybox fixes
2021-01-13 18:22:44 +01:00
Yamagi
d745e16523
Merge pull request #642 from DanielGibson/fix-lm-glitch
Makefile: Fix architecture detection on Windows
2021-01-13 18:11:03 +01:00
Ricardo Garcia
8142898b56 Fix black pixels along skybox edges in Vulkan
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.
2021-01-12 23:33:55 +01:00
Ricardo Garcia
aa2baedd97 Fix skybox edges being visible in Vulkan
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.
2021-01-12 23:33:55 +01:00
Daniel Gibson
9bc2fe29fe Clean up savegame's ReadGame() a bit
less duplicate code, more readable usage of strcmp()
2021-01-12 07:12:19 +01:00
Daniel Gibson
ee7923a9dd Fix architecture detection on Windows in Makefile, bump SAVEGAMEVER
$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)
2021-01-12 05:04:11 +01:00
Yamagi
023a012e82 Change the hyperblaster back to yellow for Vanilla Q2 lightning.
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.
2021-01-11 07:34:30 +01:00
Yamagi
462a0ddff5
Merge pull request #636 from rg3/vk_resolution_scaling
Add resolution scaling to Vulkan renderer
2021-01-10 19:02:51 +01:00
Yamagi
a98d533ae1 Add cl_r1q2_lighstyle, set to 0 for Vanilla Q2 dlight colors.
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.
2021-01-10 18:30:49 +01:00
Denis Pauk
3b9aa6448e Enable depthWriteEnable for particles 2021-01-10 13:25:10 +02:00
Denis Pauk
1bc60032e7 Fix pipeline debug naming 2021-01-10 13:07:44 +02:00
Yamagi
faf6a91ace
Merge pull request #635 from 0lvin/ref_soft
Port improvements to soft and vulkan
2020-12-31 10:27:03 +01:00
Yamagi
69ba055c2c Minimal error checking for Sys_Mkdir() on windows. 2020-12-31 09:09:09 +01:00
Yamagi
60d881437b Minimal error handling for Sys_Mkdir() under unixlike platforms. 2020-12-31 08:55:09 +01:00
Yamagi
8e223b2743 Make sure that the config dir exists.
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.
2020-12-30 18:45:16 +01:00
Ricardo Garcia
150db4d443 Widen pipeline scissor adjusted for vk_pixel_size
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.
2020-12-24 23:51:27 +01:00
Denis Pauk
84aceda76d Use submodels directly from current map 2020-12-24 13:40:07 +02:00
Ricardo Garcia
930872b358 Add resolution scaling to Vulkan renderer
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.
2020-12-24 10:14:39 +01:00
Denis Pauk
4f9067e6b8 Reallocate models with huge current map 2020-12-23 23:29:29 +02:00
Denis Pauk
2c00502b0b Free Unused Image and Models only if we are near to limit 2020-12-23 21:35:27 +02:00
Denis Pauk
b0cc97e6f3 make cppcheck happy with R_RestoreMips
132: Array 'image->pixels[4]' accessed at index -1, which is out of bounds.
133,134: Shifting by a negative value is undefined behaviour.
2020-12-23 12:36:45 +02:00
Denis Pauk
004e5e250f Rearange code and make loadmodel local 2020-12-23 12:12:35 +02:00
Denis Pauk
462633d3d9 Vulkan: Calculate needed hunk size in Mod_LoadBrushModel()
Based on ec6d743d
2020-12-23 11:48:41 +02:00
Denis Pauk
278f9104cd Remove unused TargaHeader 2020-12-22 16:47:35 +02:00
Denis Pauk
3418280b06 Fix cppcheck warnings
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.
2020-12-17 22:49:03 +02:00
Denis Pauk
a4181a0bdb Add m8 textures support(heretic2 mods) 2020-12-17 21:59:04 +02:00
Denis Pauk
f975a94c74 Add farsee flag to ref_soft 2020-12-17 00:05:45 +02:00
Denis Pauk
e23be99a49 Fix image shrink calls 2020-12-16 23:53:29 +02:00
Denis Pauk
2e93364940 Use SmoothColorImage as final filtering 2020-12-16 22:45:39 +02:00
Denis Pauk
be2e91e142 Sync LoadSP2, turret_driver_die, SP_info_player_intermission declarations
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]
2020-12-16 22:44:38 +02:00
Denis Pauk
d190c3d143 soft: scale cinema raw images 2020-12-16 22:11:02 +02:00
Yamagi
983f7f6b4b Port some lightning fixes from gl3 to vk.
* Fix for skyboxes abused as lightsources, was #393.
* Don't reuse i as counter variable when calculating light points.
2020-12-16 09:19:28 +01:00
Denis Pauk
b7bdd0be72 Add vk_nolerp_list support 2020-12-12 14:45:04 +01:00
Denis Pauk
539fea96bb add vk_retexturing force flag 2020-12-12 14:45:04 +01:00
Denis Pauk
1a4d495028 Enable retexturing by default and dump real image sizes 2020-12-12 14:45:04 +01:00
Denis Pauk
e3b387f7e7 Scale up 8bit images 2020-12-12 14:45:04 +01:00
Denis Pauk
8e5f68bb68 Remove vk_round_down as regressed visual quality 2020-12-12 14:45:04 +01:00
Denis Pauk
0d57f47b9b restore near color value only for transparent images 2020-12-12 14:45:04 +01:00
Denis Pauk
d4df592572 remove redundant suballocate (vk_util has already suballicate buffers) 2020-12-12 14:45:04 +01:00
Denis Pauk
07c043d8ce rename gammatable to overbrightable and apply only to world models 2020-12-12 14:45:04 +01:00
Denis Pauk
67821d753b Port VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU flag check 2020-12-12 14:45:04 +01:00
Denis Pauk
ff82bb5a78 Port memory flags from VulkanMemoryAllocator 2020-12-12 14:45:04 +01:00
Denis Pauk
16eb7f5c27 Show memory types supported by device 2020-12-12 14:45:04 +01:00
Denis Pauk
03a20b2050 Mark non VK_PRESENT_MODE_FIFO_KHR as triple buffered 2020-12-12 14:45:04 +01:00
Yamagi
17357d8c5e Fix another printf format specifier under Windows. 2020-12-12 14:45:04 +01:00
Denis Pauk
16ae9af406 Fix unmap warning on swap buffers resize 2020-12-12 14:45:04 +01:00
Denis Pauk
fd327dcdae vk: scale cinema raw images 2020-12-12 14:45:04 +01:00
Denis Pauk
124b0c224f Add palette image scale{2,3}x 2020-12-12 14:45:04 +01:00
Denis Pauk
4183c14cfa Update license in vk_util 2020-12-12 14:45:04 +01:00
Denis Pauk
5a4554cfb5 Fix multiplayer -> player setup 2020-12-12 14:45:04 +01:00
Denis Pauk
39e69c90f0 Rework memory allocation 2020-12-12 14:45:04 +01:00
Denis Pauk
59e5c4fca5 Add gunfov and farsee in ref_vk 2020-12-12 14:45:04 +01:00
Denis Pauk
17c5e04d8f Reuse TGA loader from STB 2020-12-12 14:45:04 +01:00
Denis Pauk
17d9ff77a6 update function declarations prototypes 2020-12-12 14:45:04 +01:00
Denis Pauk
01918110d7 fix symbol collision 2020-12-12 14:45:04 +01:00
Yamagi
85b9f84b3d Don't link against the Vulkan loader, load it at runtime. 2020-12-12 14:45:04 +01:00
Yamagi
d936bad256 Use uintptr_t instead of uint64_t for better Windows compatibility. 2020-12-12 14:45:04 +01:00
Yamagi
c9d54381a5 Fix uint64_t printf() format string for Windows. 2020-12-12 14:45:04 +01:00
Yamagi
3e0c3efa74 Fix size_t printf() format strings under Windows. 2020-12-12 14:45:04 +01:00
Yamagi
a72cd9ea50 Add the vulkan renderer to the beginning fallback sequence.
The fallback sequence is now: vk -> gl3 -> gl1 -> soft -> failed.
2020-12-12 14:45:04 +01:00
Yamagi
6329a1dfcb Shutdown QVK in R_Shutdown() by calling R_ShutdownContext().
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.
2020-12-12 14:45:04 +01:00
Denis Pauk
00f676c973 Add support lavapipe (mesa vulkan software render) 2020-12-12 14:45:04 +01:00
Denis Pauk
d5f8791728 make current entity local 2020-12-12 14:45:04 +01:00
Denis Pauk
3648ef0866 make current model local 2020-12-12 14:45:04 +01:00
Denis Pauk
832d9666d4 Merge vk_point_particles with vk_particle_square to vk_custom_particles 2020-12-12 14:45:04 +01:00
Denis Pauk
7be20ac1cd Use vkResetCommandPool for vk_stagingCommandPool 2020-12-12 14:45:04 +01:00
Denis Pauk
e6e2a45e87 Use vkResetCommandPool for vk_commandPool 2020-12-12 14:45:04 +01:00
Denis Pauk
ca79fc78a6 remove window save code 2020-12-12 14:45:04 +01:00
Krzysztof Kondrak
da38e2a8f8 No need to request optional fillModeNonSolid since we're only using VK_POLYGON_MODE_FILL in all pipelines. 2020-12-12 14:45:04 +01:00
Krzysztof Kondrak
da32d051b3 Create MSAA color buffer only when it's actually needed. 2020-12-12 14:45:04 +01:00
Krzysztof Kondrak
a2ab709c2b Check if swapchain supports VK_IMAGE_USAGE_TRANSFER_SRC_BIT. 2020-12-12 14:45:04 +01:00
Krzysztof Kondrak
7784b197ca Enable VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT only if the SDK supports it. 2020-12-12 14:45:04 +01:00
Denis Pauk
7eb075198e Fix vk_validation warnings 2020-12-12 14:45:04 +01:00
Denis Pauk
f6ae494637 rework Draw_StretchRaw 2020-12-12 14:45:04 +01:00
Denis Pauk
912fca15d9 Fix viewsize issues 2020-12-12 14:45:04 +01:00
Denis Pauk
2e5c5974d6 gamma calculation in shaders 2020-12-12 14:45:04 +01:00
Denis Pauk
a69c97f046 Add vk_particle_square support 2020-12-12 14:45:04 +01:00
Denis Pauk
3ec8e65d34 Staging buffers resize. 2020-12-12 14:45:04 +01:00
Denis Pauk
896346cf1a Fix MINGW64 windows build 2020-12-12 14:45:04 +01:00
Denis Pauk
a701226a19 cppcheck fixes
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]
2020-12-12 14:45:04 +01:00
Denis Pauk
9e71e69d1c fix sequence of destroing buffers 2020-12-12 14:45:04 +01:00
Denis Pauk
ca29093f64 Always compilein validation code 2020-12-12 14:45:04 +01:00
Denis Pauk
dc77a19d9f Allocate buffer for list of physicalDevices in Vk_Strings_f 2020-12-12 14:45:04 +01:00
Denis Pauk
706b9a0721 Codestyle cleanup 2020-12-12 14:45:04 +01:00
Denis Pauk
b1bd71ec7e Fix headers names 2020-12-12 14:45:04 +01:00
Denis Pauk
c9fae86cbe Fix build with -D_DEBUG=1 2020-12-12 14:45:04 +01:00
Denis Pauk
b94afbc6c1 remove unused vk_mem_alloc 2020-12-12 14:45:04 +01:00
Denis Pauk
5b5432b9dd rework code to use vkImage/vkBuffer C allocator 2020-12-12 14:45:04 +01:00
Denis Pauk
bda19f3421 Remove usage stagingBuffer in QVk_CreateIndexBuffer and QVk_CreateVertexBuffer 2020-12-12 14:45:04 +01:00
Denis Pauk
8d39a6a0e6 fix vk_validation flag 2020-12-12 14:45:04 +01:00
Denis Pauk
ffd3c65a82 remove nonrequired image scale 2020-12-12 14:45:04 +01:00
Denis Pauk
8bfb422ab2 Reuse FloodFillSkin from gl3 in vk 2020-12-12 14:45:04 +01:00
Denis Pauk
b249362d0f fix screenshot 2020-12-12 14:45:04 +01:00
Denis Pauk
4047285029 Implement vk image and memory flush code 2020-12-12 14:45:04 +01:00
Denis Pauk
518f46953b Build vk_util as part of ref_vk 2020-12-12 14:45:04 +01:00
Christoph Schied
aaf7f4e76c vk_utils from https://github.com/cschied/q2vkpt.git 2020-12-12 14:45:04 +01:00
Denis Pauk
c4a1147718 little bit revert 2020-12-12 14:45:04 +01:00
Denis Pauk
d3d433bd7f Add EndWorldRenderpass callback 2020-12-12 14:45:04 +01:00
Denis Pauk
31afc11133 make more code static 2020-12-12 14:45:04 +01:00
Denis Pauk
5707a70294 Change gamma only for 3d rendered 2020-12-12 14:45:04 +01:00
Denis Pauk
9bf3be03a7 Replace Vk_ResampleTexture to ResizeSTB 2020-12-12 14:45:04 +01:00
Denis Pauk
bf4a7f9ee6 Fix issue with menu M_Popup
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
2020-12-12 14:45:04 +01:00
Denis Pauk
400562cd2e Rearrange code little bit 2020-12-12 14:45:04 +01:00
Denis Pauk
e48a7f61c6 Use simular logic in ref_sw:setMode as in ref_gl 2020-12-12 14:45:04 +01:00
Denis Pauk
f508584067 small code cleanup 2020-12-12 14:45:04 +01:00
Denis Pauk
2add32b5a8 Add documentation 2020-12-12 14:45:04 +01:00
Denis Pauk
bfab2d3042 Rebuild shaders with glslang-tools 7.12.3352-10 2020-12-12 14:45:04 +01:00
Denis Pauk
eb935da156 vk: fix vid_gamma 2020-12-12 14:45:04 +01:00
Denis Pauk
8b70b55e17 vk: use os independent SDL_Vulkan_GetInstanceExtensions 2020-12-12 14:45:03 +01:00
Denis Pauk
eefcec35e9 ref_vk: Fix shutdown code 2020-12-12 14:45:03 +01:00
Denis Pauk
a71eae8b88 Cleanup create surface 2020-12-12 14:45:03 +01:00
Denis Pauk
a26d91ffc0 vk: Fix for light without current entity(5e7082e7) 2020-12-12 14:45:03 +01:00
Denis Pauk
63f6cdf698 ref_vk: Add support for 32k+ marksurfaces in map(659d8e15) 2020-12-12 14:45:03 +01:00
Denis Pauk
b558407423 use __func__ in R_Printf if required 2020-12-12 14:45:03 +01:00
Denis Pauk
65c76776ec fix world disconnect 2020-12-12 14:45:03 +01:00
Denis Pauk
5270cce1a1 use separate vk_intensity 2020-12-12 14:45:03 +01:00
Denis Pauk
8ae3ce9097 fix warning: missing braces around initializer [-Wmissing-braces] 2020-12-12 14:45:03 +01:00
Denis Pauk
53ddce9400 Add retexturing 2020-12-12 14:45:03 +01:00
Denis Pauk
d895e84f46 use global r_* variables 2020-12-12 14:45:03 +01:00
Denis Pauk
ca60275694 move headers to right place 2020-12-12 14:45:03 +01:00
Denis Pauk
823e0eb915 Add experemental vulkan render 2020-12-12 14:45:03 +01:00
Krzysztof Kondrak
4c3853ca56 vkQuake2 1.4.3
Vulkan render from https://github.com/kondrak/vkQuake2.git@9c85ad15a73320be6641c840697644d27e851fd4
2020-12-12 14:45:03 +01:00
Yamagi
bd4f7bed65
Merge pull request #634 from lazd/altloadfix
Flush keys when server data is parsed
2020-12-12 14:12:50 +01:00
Larry Davis
e22b4ec945 Don't print debug information all the time 2020-12-11 11:02:53 -08:00
Larry Davis
dc1353c67e Flush keys when server data is parsed, fixes #633 2020-12-11 10:50:40 -08:00
Larry Davis
b30d37d2cb nit: whitespace 2020-12-10 23:38:16 +00:00
Larry Davis
0d2e6f79f9 Move haptic to joy submenu, add up sensitivity 2020-12-10 23:25:35 +00:00
Larry Davis
693803c764 Support setting mouse sensitivity to 0 in UI
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
2020-12-10 17:24:32 +00:00
Larry Davis
5e78fd5ef4 Add UI for gamepad sensitivity and expo
This adds a "customize joystick" sub-menu that provides sliders for
changing the sensitivity and expo applied to joystick inputs.
2020-12-10 17:24:31 +00:00
Larry Davis
aafc2eb4f9 Apply expo to gamepad axes with joy_expo cvar
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.
2020-12-10 17:24:20 +00:00
Michael Barth
7e025a5eac Fix P_ProjectSource forward declaration 2020-12-08 06:39:39 -05:00
Yamagi
e86a678a3b Write configs before changing the mod.
Otherwise config changes will be lost if the mod is changed.

Part of #630.
2020-12-02 08:57:46 +01:00
nia
92e62e49d3 Cast arguments to ctype functions to unsigned char
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.
2020-11-24 14:12:38 +01:00
Yamagi
d419e1f660 Make map name autocompletion case insensitive.
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.
2020-11-14 18:22:43 +01:00
Simon McVittie
45b922372a signalhandler: Fix a typo
Detected by Lintian, a QA tool used in Debian.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-10-31 11:59:22 +00:00
Yamagi
93008da0eb Make sure that the config dir exists before reopening stdout.
Without this to stdout.txt and stderr.txt are created at the first
start.
2020-10-20 09:38:26 +02:00
Yamagi
21d7c85044 Mark path passed to Sys_Mkdir as const. 2020-10-20 09:35:07 +02:00
Yamagi
f663d08922 Don't add dirs twice to the search path.
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.
2020-10-20 09:07:53 +02:00
Yamagi
1a913eb7d1 Resolve pathes before adding them to the search path.
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.
2020-10-20 08:20:20 +02:00
Yamagi
7553dc4856 Sanitize pathes before adding them to the search path.
* 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.
2020-10-19 17:51:11 +02:00
Yamagi
fa345ed38e Move FS_ListMods() upward, to a more appropriate place in the file. 2020-10-19 17:22:23 +02:00
Yamagi
36d64aaefb Check if FS_LIstFiles() returned NULL.
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.
2020-10-19 17:19:44 +02:00
Yamagi
5ed882763a Implement one qsort() comparator function for strings and use it. 2020-10-19 17:17:09 +02:00
Yamagi
cfd5bce43d Bump version number to 8.00pre (again). 2020-10-17 15:37:27 +02:00
Yamagi
6102a36dab Bump version number to 7.45. 2020-10-17 15:37:27 +02:00
Yamagi
f49a7f482f Pass correct path specifier to FS_ListFiles().
This prevents Sys_FindFirst() further down below getting called with
wrong arguments, returning a null pointer. The null pointer crashes
the filesystem. :/
2020-10-17 15:18:47 +02:00
Yamagi
6498876c1a Revert "Bump version number to 8.00pre."
This reverts commit 0d20fffd8e.
2020-10-17 15:18:21 +02:00
Yamagi
0d20fffd8e Bump version number to 8.00pre. 2020-10-16 10:17:37 +02:00
Yamagi
bbc382dc66 Bump version number to 7.44. 2020-10-16 10:13:44 +02:00
David Carlier
915c680f52 DragonFlyBSD build fix. 2020-10-10 14:29:28 +01:00
Yamagi
d5dcf3a772 Fix several inconsistencies and typos in console output. 2020-10-08 12:38:29 +02:00
Yamagi
e3aefbff2c Add some more build time options to the startup output.
* cURL
* Systemwide installation
2020-10-08 12:08:20 +02:00
Denis Pauk
db20a6ce18 Add ioquake3 vstr/nextdemo support 2020-10-06 23:38:12 +03:00
Yamagi
0a159eefb2 Limit the work around against wrong resolutions to fullscreen.
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.
2020-10-06 17:52:14 +02:00
Yamagi
dfaf33e478 Force stdout and standerr on Windows to unbuffered mode.
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.
2020-10-06 17:22:50 +02:00
Yamagi
741ffcdb1c
Merge pull request #604 from devnexen/last_bit_for_haiku
Last bit for proper Haiku support.
2020-10-06 16:55:41 +02:00
David Carlier
800cdf9617 Last bit for proper Haiku support.
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...
2020-10-02 14:36:57 +00:00
David Carlier
6bb23c908f Little simplification for NetBSD, sysctl works just fine too. 2020-09-30 22:56:19 +01:00
Yamagi
41931d7a06
Merge pull request #599 from earth-metal/master
Create "mods" submenu to allow changing "game" cvar via UI
2020-09-12 16:11:26 +02:00
Yamagi
213a338d03
Merge pull request #598 from JoBergeron/map-autocomplete
map name autocompletion
2020-09-12 16:02:44 +02:00
earth-metal
a4de026eb3 Create "mods" submenu to allow changing "game" cvar via UI
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.
2020-09-06 16:43:36 -04:00
JBerg
a843ef416f map name autocompletion 2020-09-05 22:32:13 -04:00
David Carlier
e4fac541a9 Haiku support, code simplification.
using more straightforward approach to get the current binary path.
Actual approach more fit to get other infos (e.g. address mappings and so on).
2020-09-01 11:27:26 +00:00
David Carlier
5e89f96067 Hunk: FreeBSD set the map permission to max read and write
which cannot be made executable afterwards.
2020-08-24 23:45:54 +01:00
Yamagi
2bb6fdf4a8
Merge pull request #592 from earth-metal/master
Start Server Menu: reload "maps.lst" after "game" dir is changed
2020-08-23 20:33:19 +02:00
earth-metal
c31926ec90 Reset map list in "start network server" menu when "game" cvar changes
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.
2020-08-23 14:06:01 -04:00
Daniel Gibson
37a5ca8a8d Make "wait" in scripts wait for >= 17ms, fix #591
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)
2020-08-23 17:21:20 +02:00
Yamagi
634748a5b5 Add missing return type for SV_ListMaps_f() 2020-08-23 10:34:52 +02:00
Daniel Gibson
93d1dfe60d Fix typo in Qcommon_Mainloop() that reduced performance, refs #591
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.
2020-08-20 17:27:09 +02:00
Yamagi
0fdc3750e0
Merge pull request #589 from JoBergeron/listmap-cmd
added listmaps command
2020-08-20 07:19:27 +02:00
JBerg
b746f4520d added listmaps command 2020-08-18 23:18:22 -04:00
Yamagi
1f3f796322 Add cl_anglekick, when set to 0 angle kicks are ignored.
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.
2020-08-17 14:18:51 +02:00
Daniel Gibson
fd0c058b2e Implemented coop_elevator_delay cvar (for func_plat)
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.
2020-08-10 14:27:35 +02:00
Yamagi
1a6dea5a0b Add coop_pickup_weapons, allow a weapon to be taken several times.
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.
2020-08-10 13:52:33 +02:00
David Carlier
0200434187 backtrace support rework proposal.
Linux/Solaris supports it in the libc however, BSD in general, Haiku
relies on an external library.
2020-08-03 10:19:41 +00:00
Yamagi
9136c8705a Fix lithium2 crashing at startup.
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.
2020-07-11 09:32:11 +02:00
Yamagi
2ab4e5553a Prevent music from playing even if ogg_enabled is 0.
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.
2020-06-30 14:46:48 +02:00
Yamagi
06436d0d30 Bump the buffers used by the config file parser to 32k.
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.
2020-06-30 14:13:14 +02:00
Yamagi
7439bdd45c
Merge pull request #581 from devnexen/haiku_port
Haiku porting proposal.
2020-06-26 16:12:34 +02:00
Yamagi
0491b54284 Force the dedicated server to use nanosleep() based waits.
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().
2020-06-26 12:46:40 +02:00
David Carlier
6c4187a6e3 using custom sting copy fn instead 2020-06-21 11:00:20 +00:00
David Carlier
a2b274d1a5 Haiku porting proposal. 2020-06-20 19:05:55 +00:00
Yamagi
ea0c0c04a2 Fix crash with some projectiles generating sound targets.
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, closes yquake2/xatrix#56.
2020-06-04 08:12:36 +02:00
Yamagi
57f7ce86e8 Make ffe8f89 somewhat more readable and add a comment. 2020-06-02 08:31:02 +02:00
Yamagi
ffe8f893ed Abort downloads if a server hasn't a file over UDP.
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.
2020-06-02 08:03:06 +02:00
Yamagi
7f339952cb
Merge pull request #575 from kondrak/master
Fixed the Jorg skin bug present since the original Quake 2 release.
2020-05-11 12:59:06 +02:00
Yamagi
3c681210ba
Merge pull request #574 from 0lvin/for_review
fix tearing with fix palette change(explosion near without move)
2020-05-11 12:30:47 +02:00
Yamagi
93c0302d79
Merge pull request #572 from BjossiAlfreds/gunner-idle
Fix for gunner AI freeze bug
2020-05-11 11:42:40 +02:00
Krzysztof Kondrak
6d9930fd75 Fixed the Jorg skin bug present since the original Quake 2 release. 2020-05-10 15:00:34 +02:00
Denis Pauk
ef841ce98c fix tearing with fix palette change(explosion near without move) 2020-05-09 14:11:12 +03:00
BjossiAlfreds
8de243a42f Fix for gunner AI freeze bug 2020-05-08 22:10:34 +00:00
Boris I. Bendovsky
0ae9f55089
Move liquid transformations into fragment shader 2020-05-04 22:42:08 +03:00
Yamagi
3492dff774
Merge pull request #564 from bibendovsky/fix/558_silenced_muzzle_flash
Don't play silenced muzzle flash sounds
2020-05-04 18:19:28 +02:00
Yamagi
33591ceb6e Update stb_vorbis to 37b9b20fdec06c75a0493e0bb59e2d0f288bfb51.
This fixes the crash reported in #568 for me.
2020-05-04 18:17:41 +02:00
Boris I. Bendovsky
93a0473244
Add cvar to control sorting of play sounds 2020-05-04 18:44:58 +03:00
Boris I. Bendovsky
1887072cc9
Merge remote-tracking branch 'upstream/master' into fix/558_silenced_muzzle_flash 2020-05-04 17:41:36 +03:00
Yamagi
8f2542e05f Limit the new order of the pending sound lists to baseq2 and the addons.
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.
2020-05-04 09:51:53 +02:00
Linux User
c4e43f0403 musl libc and uclibc do not have backtrace() 2020-04-25 20:30:55 -07:00
Boris I. Bendovsky
4646859535
Don't play silenced muzzle flash sounds 2020-04-22 17:53:41 +03:00
Yamagi
563ef16ee3 Exec autoexec.cfg everytime game changes.
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.
2020-04-21 14:06:16 +02:00
Yamagi
5455ffa96f s_doppler should default to 0.
The doppler effect is a game play change. And it's rather badly
implemented. Discussed in yquake2/xatrix#51.

Closes yquake2/xatrix#51.
2020-04-21 13:58:58 +02:00
Yamagi
73d0812d9f
Merge pull request #561 from mjr4077au/Client_AimFixWithCVAR
Implement accurate-aiming CVAR in baseq2 game code.
2020-04-21 12:54:32 +02:00
Mitchell Richters
85fb607010 Implement accurate-aiming CVAR in baseq2 game code. 2020-04-21 06:17:40 +10:00
Yamagi
19214d6049 Implement adaptive vsync.
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.
2020-04-20 12:31:25 +02:00
Yamagi
fc99e5456f Make the gun fov optional.
Set r_gunfov to force the gun fov to be the same as the global fov.
While here finally commit somes missed parts of 50d442c.
2020-04-20 11:57:27 +02:00
Yamagi
1299a807ed
Merge pull request #557 from BjossiAlfreds/insta-powerups
Fix for some items playing wrong sound when instantly used
2020-04-20 09:00:13 +02:00
Yamagi
d1a53bdeec
Merge pull request #551 from DanielGibson/scancode-input
Scancodes for Input and other keyboard input improvements
2020-04-20 08:59:55 +02:00
Daniel Gibson
d675254e4e (More) special cases for key names in configs
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)
2020-04-12 00:40:30 +02:00
BjossiAlfreds
ef5c0adf0c Fix for some items playing wrong sound when instantly used 2020-04-11 01:50:57 +00:00
Daniel Gibson
d6cdcc3e52 Make sure K_CONSOLE up events are ignored
otherwise we might get an error about an unbound key for up (!down)
events.
2020-04-11 03:04:54 +02:00
Denis Pauk
3e039d1cbd dynamically allocate buffer for PAK 2020-04-10 23:35:26 +03:00
Daniel Gibson
a44225c625 Introduce K_CONSOLE, generated by the keyboard's "console key"
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 :)
2020-04-10 06:21:10 +02:00
Daniel Gibson
f1a81a5611 SV_Frame(int _usec_) instead of msec
it's microseconds, not milliseconds.
2020-04-08 15:28:59 +02:00
Daniel Gibson
bbde4e2a81 Support scancodes as fallback for unknown keyboard keys
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
2020-04-08 04:43:25 +02:00
Daniel Gibson
3015995d04 Reorder (and complete) K_* related listings to match the enum
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())
2020-04-08 04:43:25 +02:00
Daniel Gibson
e86ea9f86e Remove unused K_AUX*
no idea what this was exactly, but we never generate those so they
can't be used anyway
2020-04-08 04:43:25 +02:00
Daniel Gibson
c67d82dd53 Use K_LAST instead of 256 in some loops
It's not 256 anymore, hasn't been in a long time..
2020-04-08 04:43:25 +02:00
Denis Pauk
841076f2a9 Fix game shutting down on error 2020-04-06 23:11:07 +03:00
Yamagi
5b327c0417 Don't use yield opcode if unsupported.
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.
2020-04-03 08:30:41 +02:00