Commit graph

3417 commits

Author SHA1 Message Date
Denis Pauk
067a30e83d savegame: fix load/save Q64 maps 2024-04-20 18:40:32 +03:00
Denis Pauk
85dcc852b7 cmodels: Add quake2 map type for remove all ReRelease flags 2024-04-20 17:21:51 +03:00
Denis Pauk
119e1f6993 cmodels: extend texture name size to 64 2024-04-20 13:07:19 +03:00
Denis Pauk
cca9317a55 cmodels: add surface and contents flags convert logic
Based on:
* https://github.com/NightDive-Studio/sin-ex-game
* https://github.com/TrenchBroom/TrenchBroom/
2024-04-20 01:35:12 +03:00
Denis Pauk
9b6bae3454 renders: remove custom function for non QBSP format
Also remove Little* function usage, QBSP come with correct byte order.
2024-04-18 01:06:06 +03:00
Denis Pauk
8d21ed6874 renders: remove support of QBSP map format
Map should be converted from any format to QBSP before render by
Mod_Load2QBSP
2024-04-18 00:29:14 +03:00
Denis Pauk
c3af9815e6 renders: use converted to QBSP format map
Mod_LoadValidateLumps is fully removed.
2024-04-17 01:14:22 +03:00
Denis Pauk
606451cc9c collision: move surface flag to QBSP convert logic
Only Mod_LoadVisibility has LittleLong format convertion logic on
server side.
2024-04-17 00:34:36 +03:00
Denis Pauk
3e46e777c0 cmodel: implement left QBSP to QBSP convert 2024-04-17 00:28:43 +03:00
Denis Pauk
becea2987b collision: direct QBSP map load 2024-04-17 00:22:10 +03:00
Denis Pauk
1bc2d7d18b collision: add DKBSP callbacks 2024-04-17 00:20:23 +03:00
Denis Pauk
aefea127e2 cmodel: move convert callback to rules tables 2024-04-17 00:16:33 +03:00
Denis Pauk
c0e3a86f30 collision: use RBSP to QBSP converted maps 2024-04-16 23:55:39 +03:00
Denis Pauk
3cd279248d cmodel: Split Mod_Load2QBSP_IBSP to separate functions 2024-04-16 23:38:49 +03:00
Denis Pauk
53d69f98e5 collision: create IBSP -> QBSP convert logic 2024-04-16 23:22:36 +03:00
Denis Pauk
12aaebf80e maps: validate read outside of BSPX section 2024-04-16 01:17:09 +03:00
Denis Pauk
2f0d3e2189 render: support texture name with full field size 2024-04-16 00:12:43 +03:00
Denis Pauk
ea91764196 collision: make firstbrushside unsigned 2024-04-16 00:12:24 +03:00
Denis Pauk
446224467d Fix memory use after free detected by ASAN 2024-04-15 00:30:30 +03:00
Denis Pauk
701defd4ad maps: move get rules to separate function 2024-04-13 15:58:32 +03:00
Denis Pauk
2d6241b31e renders: move lightmap calls to LM_CreateLightmapsPoligon 2024-04-13 14:44:40 +03:00
Denis Pauk
02b8e85c01 opengl renders: support of gl_version_override cvar
Provides way to check render with lower officialy
reported OpenGL version.

Same as:
* MESA_GL_VERSION_OVERRIDE=4.6
* MESA_GLSL_VERSION_OVERRIDE=460
2024-04-13 13:25:34 +03:00
Denis Pauk
5babb3b96a renders: fix function name in GL4*_InitContext errors 2024-04-13 01:03:42 +03:00
Denis Pauk
4ab6777e1f renders: move lightmap creation call outside of LoadFace code 2024-04-13 00:15:31 +03:00
Denis Pauk
310c0fdb58 maps: load code cleanup 2024-04-12 00:13:14 +03:00
Denis Pauk
7a5154bd6b renders: Add RBSP initial support
Surfaces/faces/tetures flags is incorrect.
2024-04-11 00:35:43 +03:00
Denis Pauk
c13074758a client: Add RBSP initial support
Structures sizes should be mosly correct and have found by estimate
sizes that could have lump size mod equal to zero as for other formats.
Possition of fields are taken from IBSP structures, that could be
incorrect. All other fields marked as unknow/unused.
2024-04-11 00:13:10 +03:00
Denis Pauk
d4bc315363 client: play arbitrary CDTRACK ogg file
Initial implementation of https://github.com/yquake2/yquake2remaster/issues/18
2024-04-09 00:34:47 +03:00
Denis Pauk
1e935a5879 collision: fix crash without vis info 2024-04-08 23:07:01 +03:00
Denis Pauk
c1920e3ec4 client: fix gles3 name
Fix regression introduced in e61d9444c

https://github.com/yquake2/yquake2/issues/1097
2024-04-07 18:50:01 +03:00
Denis Pauk
30861e07ef filesystem: sort files in pack and use binary search in packs 2024-04-07 18:46:40 +03:00
Denis Pauk
e3a1b0ef11 maps: Mod_CalcNonModelLumpHunkSize combine QBSP cases 2024-04-07 18:46:40 +03:00
Denis Pauk
e90fa70680 renders: reuse Mod_CalcNonModelLumpHunkSize 2024-04-07 18:46:40 +03:00
Denis Pauk
d2e5955547 renders: reuse CalcLumpHunkSize for Leaf and Nodes 2024-04-07 18:46:40 +03:00
Denis Pauk
851c72f7b4 soft: sync code with other renders 2024-04-07 18:46:40 +03:00
Denis Pauk
fe96447980 client: fix gles3 name
Fix regression introduced in e61d9444c

https://github.com/yquake2/yquake2/issues/1097
2024-04-07 18:43:45 +03:00
Yamagi
352d87af15 Add SDL 3 support to ref_gl4.
This is mostly a port of the same changes to ref_gl3:

* Add SDL 3 support to the Makefile.
* Port API changes.
* Bump renderer API to version 7.

a884514f97
https://github.com/yquake2/yquake2/issues/1097
2024-04-07 18:38:15 +03:00
Yamagi
4fedab5914 Port ref_vk to SDL3.
* Makefile support for SDL3.
* Change API to match SDL3.
* Bump renderer API to version 7 and communicate SDL version to client.

61be37b183
2024-04-07 18:25:14 +03:00
Denis Pauk
4bd19bf982 Merge remote-tracking branch 'yquake2/master' 2024-04-07 18:12:09 +03:00
Yamagi
e61d9444c9 Bump default renderer to GL3...
...and alter the render finding and fallback sequences to include GLES3
as the first fallback. This should have been done years ago, when GL3
became the clear better option above GL1.
2024-04-07 11:01:45 +02:00
Yamagi
23f60d25b1 Pass SDL major version between ref and client, bump ref API version.
SDL major versions must not be combined in one process, otherwise bad
things will happen. In the best case the game crashes, in the worst case
strange bugs will occure. To prevent that:

* Add a new field `framework_version` to the renderer API and use it to
  pass the SDL major version from the renderer to client. Don't load the
  renderer if it and the client were build with different SDL major
  versions.
* Bump the renderer API version to 7. This could have been implemented
  by assuming `framework_version == 0` (not filled by renderer) as SDL
  2, but let's keep things clean and bump the version.

While here fix a long standing bug with printing the error when not
loading a renderer lib. The message must be generated before shutting
down the renderer, otherwise the API version will alsways be 0. The
struct is zeroed at renderer shutdown.
2024-04-07 11:01:45 +02:00
Yamagi
8cedbb0694 Port the Windows platform backend including Makefile support to SDL3.
This also fixes a long standing bug with the Windows part of the
Makefile linking -lSDL2 into q2ded.exe.
2024-04-07 11:01:45 +02:00
Yamagi
a675b654c6 Update to SDL 3.1.1 API.
Changes are:
* SDL_SetWindowGrab() was renamed to SDL_SetWindowMouseGrab().
* SDL doesn't give precalculated battery states anymore. Use the same
  scale as SDL 3.1.0, 20% is low and 1% is empty.
2024-04-07 11:01:45 +02:00
Yamagi
af82cfe978 Switch the default for vid_highdpiaware to 1 when build against SDL3.
With SDL3 the high dpi support is in much better shape than with SDL2.
And for Wayland the experience on high dpi displays is generally better
when the application is high dpi aware.
2024-04-07 11:01:45 +02:00
Yamagi
218829f031 Port the SDL audio backend to SDL 3.
Reimplement `SDL_BackendInit()` and `SDL_BackendShutdown()` for SDL 3.
Hide now unnecessary locking calls behind !USE_SDL3. To minimize code
duplication `SDL_Callback()` is hidden behind a wrapper function.
2024-04-07 11:01:45 +02:00
Yamagi
74ac473447 Remove support for older SDL version in the SDL 3 input backend.
SDL 3 is a fresh start, no need to support older versions.
2024-04-07 11:01:45 +02:00
Yamagi
40e1830885 Port joystick and controller handling to SDL 3. 2024-04-07 11:01:45 +02:00
Yamagi
d315f02a7b Port window event handling to SDL3. 2024-04-07 11:01:45 +02:00
Yamagi
a81b065893 Apply Coccinelle to input/sdl3.c.
Again this isn't enough to get the file compiling, but it's a start.
2024-04-07 11:01:45 +02:00
Yamagi
adfd7362b5 Explicitly shutdown the SDL_INIT_EVENTS subsystem.
SDL_INIT_VIDEO includes SDL_INIT_EVENTS when initialized through
SDL_Init(), but not when shutdown to SDL_Quit(). Handle the shutdown
in the input subsystem. This closes some memory leaks in SDL.
2024-04-07 11:01:44 +02:00
Yamagi
5a21397761 Refactor refreshrate handling from int to float.
With SDL 2 the refreshrate handling was rather limited by SDL 2 only
supporting integer refreshrates, making it impossible to represent the
common 59.95hz and other non-integer refreshrates. Quake II works around
this by assuming a refreshrate of 2hz higher than returned by SDL.

SDL 3 finally supports float refreshrates. Refactor the internal API to
also use floats.

This should be a no-op since the 'refreshrate * 1.02' logic stayes in
place for the time being. This can be reevaluated at a later time for
the SDL 3 build, but needs testing.

As a nice side effect fix the `vid_displayrefreshrate` cvar. It was
broken in both SDL 2 and 3 since it was always overwritten with the
actual display refresh rate.
2024-04-07 11:01:44 +02:00
Yamagi
5d30c5913b Query the primary display with SDL_GetPrimaryDisplay().
Everything else doesn't work reliable and is depended on the display
server. X11 uses it's display IDs, Wayland some UUIDs...
2024-04-07 11:01:44 +02:00
Yamagi
bcbeb81198 Several fixes in detection of the window position.
In SDL 2 the first display was 0 and the error code -1. In SDL 3 this
changed to 1 as the first display and 0 for the error code. While at
it implement error handling and fallbacks for all cases.
2024-04-07 11:01:44 +02:00
Yamagi
8a2336a375 Fix displaying the list of supported modes at startup.
While here limit the number of decimals of the real mode to 2.
2024-04-07 11:01:44 +02:00
Yamagi
bb8c6eac44 Refactor the fullscreen modes into an enum. 2024-04-07 11:01:44 +02:00
Yamagi
3c5dccb4d0 Port remaining parts of glimp_sdl3.c to SDL 3.
These are semantic changes to several functions which Coccinelle didn't
translate properly and some now superfluous SDL version checks.
2024-04-07 11:01:44 +02:00
Yamagi
cbc46009fd Port PrintDisplayModes() to SDL 3. 2024-04-07 11:01:44 +02:00
Yamagi
55a1e38717 Port GetWindowSize() to SDL 3. 2024-04-07 11:01:44 +02:00
Yamagi
6f0da6c247 Port fullscreen handling to SDL 3.
SDL 3 has a new approach to fullscreen handling, which is way better
than the old fiddling with several window flags. In SDL 3:

* The SDL_FULLSCREEN_FLAG puts the window in fullscreen window mode.
* For exclusive fullscreen a fullscreen mode must be requested and set.
* Applying the mode to the window is asynchronous, the mode change may
  occure at any later time. The window can be synchronized to force the
  mode change.

This is - of course - totaly untested, since the client doesn't build
yet with SDL 3. There will likely be bugs and shortcomings.

And the code is still ugly, it can be refactored somewhat more.
2024-04-07 11:01:44 +02:00
Yamagi
2877f1c391 Remove workaround for SDL bug #4700 from glimp_sdl3.c.
It has been fixed since SDL 2.22, all SDL 3 versions will have the fix.
2024-04-07 11:01:44 +02:00
Yamagi
2c624d0207 Port window creation to SDL 3.
Window properties and flags are now passed in an SDL_PropertiesID object
and no longer als parameters to `SDL_CreateWindow()`.
2024-04-07 11:01:44 +02:00
Yamagi
a33285bdd4 Apply Coccinelle to glimp_sdl3.c.
This isn't eneugh to get it compiling and some changes are looking fishy
but it's a start.
2024-04-07 11:01:44 +02:00
Yamagi
aaf917e28e Port ref_soft SDL 3. 2024-04-07 11:01:44 +02:00
Yamagi
61e7ec9697 Port ref_gl3 to SDL 3.
Not many changes here. `make ref_gl3` now builds a library and it works
with the proof of concept port of the client.
2024-04-07 11:01:44 +02:00
Yamagi
9a1990ecc4 Port ref_gl1 to SDL 3.
Not many changes here. `make ref_gl1` now builds a library and it works
with the proof of concept port of the client.

SDL3 dropped support for hardware gamma, so `vid_gamma` will be ignored
until we can come up with something else. If we can, gamma without
shaders is hard to impossible :/

SDL3 TODOs will be marked with 'TODO SDL3:'.
2024-04-07 11:01:44 +02:00
Yamagi
9b0c95daaa Fork the clients SDL 2 backends into SDL 3 versions.
At this time they are just copies. The actual porting will be done in
upcoming commits.
2024-04-07 11:01:44 +02:00
Yamagi
126c2ea10b Add SDL 3 support to the Makefile.
This is hidden behind WITH_SDL3, which is disabled by default.

Additionally rename the SDL sources files in the client to represent the
SDL major version they are supporting. They will be forked for SDL 3.
That isn't optimal, because it forces us to support two variants of the
same code. However the changes between SDL 2 and 3 are too big to work
with #ifdef and something like function pointer magic is even more
confusing.
2024-04-07 11:01:44 +02:00
Denis Pauk
97ab6314ab soft: fix build and cppcheck warnings 2024-04-06 19:09:03 +03:00
Denis Pauk
fd7b43f5c6 Merge remote-tracking branch 'yquake2/master' 2024-04-06 18:42:12 +03:00
Denis Pauk
51419ffc63 maps: add little bit knowledge about SIN
Without real implementation for now
2024-04-06 18:15:15 +03:00
Yamagi
34d2ddc2a9
Merge pull request #1100 from dkoreshkov/master
Some improvements to the SW renderer
2024-04-06 16:26:13 +02:00
Trey Harrison
a7d3bb7573 renders: add SWL texture support
Author: Trey Harrison <trey@u.washington.edu>
Based on: https://web.archive.org/web/20001212060900/http://starbase.neosoft.com:80/~otaku/program.html
2024-04-06 16:17:36 +03:00
Denis Pauk
4cafc778ef game: Sync CDTRACK code with ReRelease code
Look to: https://github.com/yquake2/yquake2remaster/issues/18
2024-04-05 00:48:43 +03:00
Denis Pauk
7a0d1d737e maps: rearrange Daikatana detect code 2024-04-05 00:19:53 +03:00
Denis Pauk
5770a9ff1b maps: Convert surface flags by gametype 2024-04-04 23:51:44 +03:00
Denis Pauk
18d0310e4b game: show values for unknow fields 2024-04-04 00:30:56 +03:00
Denis Pauk
31ace1fa5a soft: reuse calcTexinfoFacesLeafsSize 2024-04-03 18:39:10 +03:00
Denis Pauk
672fa8780d renders: share calcTexinfoFacesLeafsSize 2024-04-03 00:11:11 +03:00
Denis Pauk
80a4282ec7 Merge remote-tracking branch 'yquake2/master' 2024-04-01 23:22:25 +03:00
Denis
784f35faed move ifdef into function 2024-04-01 20:49:40 +03:00
Yamagi
5a642c4205
Merge pull request #1099 from BjossiAlfreds/cvar-cl_laseralpha
Added cvar cl_laseralpha and documentation in cvarlist
2024-04-01 09:12:03 +02:00
Yamagi
aa259a5d5f
Merge pull request #1096 from devnexen/unroll_dis
VectorLength reduces complexity.
2024-04-01 09:07:59 +02:00
Yamagi
48a4e5397c
Merge pull request #1094 from 0lvin/light_code_style
Rename functions r_dlightframecount parameter to lightframecount
2024-04-01 08:58:35 +02:00
Denis Pauk
f54aea1361 renders: Add autodetect Daikatana maps bsp format 2024-04-01 01:19:57 +03:00
Denis Pauk
2c0fca8458 filesystem: add sin pack file support
Based on: https://github.com/yquake2/pakextract
2024-03-31 23:55:49 +03:00
Denis
6d1ac97a77 cleanup alias scan conversion 2024-03-31 22:45:30 +03:00
Denis
85b7ae87ef fix bmodel clipping 2024-03-31 22:40:29 +03:00
Denis
d5c26f28d6 free for real 2024-03-31 22:39:50 +03:00
Denis Pauk
8cf9848291 filesystem: support daikatana pak files
Release leafs have 32 != 28 bytes record size, and unsupported
for now.
2024-03-31 19:13:31 +03:00
Denis Pauk
6b6da54054 filesystem: rearange pak load code 2024-03-31 16:43:31 +03:00
Denis Pauk
57e68967cb fix %zu windows build warnings 2024-03-31 16:14:44 +03:00
BjossiAlfreds
c134d0127d Added cvar cl_laseralpha and documentation in cvarlist 2024-03-31 10:45:31 +00:00
Denis Pauk
98ebc126c2 filesystem: check pak header record size 2024-03-30 23:30:27 +02:00
Denis Pauk
d1e23ae740 maps: initial flags surface flags convert
Convert map flags before load for load maps files from games with
different flags meaning.
2024-03-30 19:12:06 +02:00
Denis Pauk
c343f87928 maps: remove currently unused fields 2024-03-30 18:29:36 +02:00
Denis Pauk
d58e1493e3 maps: prevalidate lumps on load 2024-03-28 00:30:48 +02:00
Denis Pauk
d87b1b512d game: fix configstring convert before connection creation 2024-03-27 23:51:06 +02:00
Denis Pauk
eb566c3b70 files/light: rearrange light code 2024-03-25 23:05:58 +02:00
David Carlier
3e64b2c1f9 VectorLength reduces complexity. 2024-03-25 06:29:23 +00:00
Denis Pauk
f3ae3beacd Version bump to 8.31RR6
BraXi (2):
      renders: fix BSPX lightmaps
      Rename functions r_dlightframecount parameter to lightframecount

David Carlier (1):
      models_md5 few memory related fixes

Denis Pauk (58):
      client: add custom protocol with short model index
      client: bump protocol and game version / unstable compatibility
      render: sync count of images with protocol max image count
      models: md5 do not copy token before use
      models: md5 partial COM_Parse in ReadMD5Anim
      models: md5 partial COM_Parse usage in ReadMD5Model
      models: ReadMD5Anim use strtol for parse
      models: ReadMD5Model get rid of sscanf usage
      models: ReadMD5Model more strict validation
      models: ReadMD5Anim get rid sscanf usage
      models: md5 call R_CompressNormalMDL only once for vertex
      soft: reuse R_LerpVerts code
      soft: move R_LerpVerts upper by call stack
      refresh/files: cppcheck warning clean up
      gl3/gl4: fix count lightmap in mgu5m2
      gl1: cppcheck fixes
      models: md3/md5 show count of verts and tris
      models: show number commands in model
      models: md3 compress commands
      models: remove static buffers for commands compress
      models: prepare command compress to share logic
      models: md5 rearrange glcommands generation
      models: save triangles ofs/num in each mesh
      soft: fix multi mesh models render
      client: fix pickup message in demo
      models: md5 tris compress before compress gl commands.
      models: apply md3 compress tris logic
      models: revert slow vect compress logic
      models: md3/md5 share command generation code
      models: mdl compress triangles
      models: mdl support grouped frames
      models: make mdl count frames detect separate function
      models: mdl separate function for image load
      models: mdl fix texture coordinates
      models: dkm Daikatana, md2 Anachronox generate normals
      models: dkm split model to meshes
      models: add mdx / Kingpin models support
      renders: load mdx/Kingpin models support
      models: MDX mesh split by subobj value
      soft: fix cppcheck warnings, remove unused isflattop
      soft: fix cppcheck warning and remove unused fullscreen property
      cin: support tga/jpg/png static image
      models: fix md5 replacement load without md2 model
      filesystem: add support of Anachronox DAT archive format
      filesystem: Anachronox fix load sky
      filesystem: support longer path in archives (up to 128)
      client: add xatrix demo protocol check
      Add windows 32bit build releases
      small build clean up
      Add readme note about SiN maps
      protocol: share configstring convert logic
      server: convert config string to protocol range
      server: support of load original game library
      server: QII97 protocol version check unification
      server: extend count of sound indexes
      server: extend gun frame and index to short
      soft: fix original Quake 2 map lights regression
      renders: split R_BuildLightMap to two function

Feels Duck Man (4):
      Added a speedometer that displays the player's speed in QU/s.  Wasn't quite sure how to implement it without adding GetPlayerSpeed() to pmove.c.  Unsure if there is a cleaner way to do this while keeping it inside cl_screen.c
      Removed 'Speed' label for speedometer when being displayed
      Added an option to draw speed under the crosshair with cl_showspeed 2, fixed drawing the speedometer when the game wasn't playing.
      Added documentation for 'cl_showspeed' in 040_cvarlist.md

Guilherme Nemeth (1):
      berserker: slam attack, running club attack

Sajt (1):
      models: add gl command compress code from qwalk

apartfromtime (3):
      Texture filtering option
      Texture filtering options for OpenGL and Software video modes
      Fix software dithering
2024-03-24 19:01:49 +02:00