xonotic/darkplaces.git
37 hours agosys: Don't bother doing Host_Shutdown on Sys_Error master
cloudwalk [Sat, 17 Apr 2021 17:12:48 +0000 (17:12 +0000)]
sys: Don't bother doing Host_Shutdown on Sys_Error

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13125 d7cf8633-e32d-0410-b094-e92efae38249

5 days agocl_main: Slight refactor 14/merge
cloudwalk [Tue, 13 Apr 2021 16:31:44 +0000 (16:31 +0000)]
cl_main: Slight refactor

Authored by bones_was_here and Cloudwalk
https://gitlab.com/xonotic/darkplaces/-/merge_requests/116

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13124 d7cf8633-e32d-0410-b094-e92efae38249

5 days agocom_list: Move all functions to the header and inline them. Include where needed
cloudwalk [Tue, 13 Apr 2021 16:31:41 +0000 (16:31 +0000)]
com_list: Move all functions to the header and inline them. Include where needed

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13123 d7cf8633-e32d-0410-b094-e92efae38249

5 days agohost: Move Host_GetConsoleCommands and rename it for consistency. Add comment
cloudwalk [Tue, 13 Apr 2021 16:31:41 +0000 (16:31 +0000)]
host: Move Host_GetConsoleCommands and rename it for consistency. Add comment

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13122 d7cf8633-e32d-0410-b094-e92efae38249

5 days agocurl: Rename Curl_Run to Curl_Frame. Fix typo in comment
cloudwalk [Tue, 13 Apr 2021 16:31:40 +0000 (16:31 +0000)]
curl: Rename Curl_Run to Curl_Frame. Fix typo in comment

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13121 d7cf8633-e32d-0410-b094-e92efae38249

5 days agohost, netconn: Use cvar callbacks on (cl_)port to reduce branching in main loop
cloudwalk [Tue, 13 Apr 2021 16:31:40 +0000 (16:31 +0000)]
host, netconn: Use cvar callbacks on (cl_)port to reduce branching in main loop

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13120 d7cf8633-e32d-0410-b094-e92efae38249

5 days agohost: Refactor Host_Frame; simplify control flow.
cloudwalk [Tue, 13 Apr 2021 16:31:39 +0000 (16:31 +0000)]
host: Refactor Host_Frame; simplify control flow.

Authored by bones_was_here and Cloudwalk
https://gitlab.com/xonotic/darkplaces/-/merge_requests/116

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13119 d7cf8633-e32d-0410-b094-e92efae38249

6 days agoFix a use of FALSE in some JPEG code. 116/merge
divverent [Mon, 12 Apr 2021 13:00:54 +0000 (13:00 +0000)]
Fix a use of FALSE in some JPEG code.

Should fix build for OS X.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13118 d7cf8633-e32d-0410-b094-e92efae38249

7 days agoimage: Sanitize paths on *all* images rather than images loaded from Q3 shaders
cloudwalk [Sun, 11 Apr 2021 19:23:23 +0000 (19:23 +0000)]
image: Sanitize paths on *all* images rather than images loaded from Q3 shaders

Implemented FS_SanitizePath. Perhaps expand on this? Not really a clean
way to do it that I can think of, but I can't see the harm in doing this
for all filepaths.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13117 d7cf8633-e32d-0410-b094-e92efae38249

7 days agohost: Make delta non-static in Host_Sleep
cloudwalk [Sun, 11 Apr 2021 16:46:15 +0000 (16:46 +0000)]
host: Make delta non-static in Host_Sleep

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13116 d7cf8633-e32d-0410-b094-e92efae38249

7 days agocl_parse: Implement 7th mode for cl_nettimesyncboundmode; jitter compensated dynamic...
cloudwalk [Sun, 11 Apr 2021 16:46:15 +0000 (16:46 +0000)]
cl_parse: Implement 7th mode for cl_nettimesyncboundmode; jitter compensated dynamic adjustment rate

This mode aims to prevent network jitter or other disturbances from
significantly affecting the client's timekeeping,
by correcting gradually (max 10% of mean error per tic).

The rolling harmonic mean gives large time error outliers low significance.

Correction rate is dynamic, determined by mean error size.
Time is correct within a few tics of connect/map start despite no hard bounding.

The adjustment approach is from mode 5 and can achieve
microsecond accuracy if client frametime is a multiple of server frametime.

Prevents 0ms move frame times with uncapped fps.

Smoothest mode esp for vsynced clients on servers with aggressive inputtimeout.

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13115 d7cf8633-e32d-0410-b094-e92efae38249

7 days agocl_input: Don't floor cl.cmd.frametime to the nearest millisecond in CL_SendMove
cloudwalk [Sun, 11 Apr 2021 16:46:14 +0000 (16:46 +0000)]
cl_input: Don't floor cl.cmd.frametime to the nearest millisecond in CL_SendMove

Removes the requirement of integer millisecond client and server frame times (eg 125fps) to get the smoothest asynchronous movement.

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13114 d7cf8633-e32d-0410-b094-e92efae38249

7 days agoclient: Improve input packet timing (netfps)
cloudwalk [Sun, 11 Apr 2021 16:46:13 +0000 (16:46 +0000)]
client: Improve input packet timing (netfps)

Increase min netfps to 10 (matches min ticrate).

Skip packettime calculations for 0ms packets.

Cap netfps when ticrate stat is available:
soft limit 2x, hard limit < 4x server frame rate.

Set packettime to (largest multiple of realframetime) <= packettime.
Prevents packet rates lower than cl_netfps or server frame rate,
eg: cl_netfps 60 and cl_maxfps 250 would otherwise send only 50 netfps.

Allow for float error when deciding if it's time to send yet.

Accumulate realframetime instead of storing host.realtime.
Fixes low packet rates in some configurations,
eg: with cl_maxfps 125 and cl_netfps 125 it would not send every frame,
as host.realtime - lastpackettime was often well below (or above) 8ms.

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13113 d7cf8633-e32d-0410-b094-e92efae38249

7 days agocl_parse: Clarify a few cvar descriptions
cloudwalk [Sun, 11 Apr 2021 16:46:13 +0000 (16:46 +0000)]
cl_parse: Clarify a few cvar descriptions

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13112 d7cf8633-e32d-0410-b094-e92efae38249

7 days agocl_parse: Further optimize CL_NetworkTimeReceived
cloudwalk [Sun, 11 Apr 2021 16:46:12 +0000 (16:46 +0000)]
cl_parse: Further optimize CL_NetworkTimeReceived

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13111 d7cf8633-e32d-0410-b094-e92efae38249

7 days agocl_parse: Refactor cl_nettimesyncboundmode check into a switch block
cloudwalk [Sun, 11 Apr 2021 16:46:12 +0000 (16:46 +0000)]
cl_parse: Refactor cl_nettimesyncboundmode check into a switch block

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13110 d7cf8633-e32d-0410-b094-e92efae38249

7 days agosv_main: Let the other players know if a connected player has timed out
cloudwalk [Sun, 11 Apr 2021 16:46:11 +0000 (16:46 +0000)]
sv_main: Let the other players know if a connected player has timed out

Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/114

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13109 d7cf8633-e32d-0410-b094-e92efae38249

7 days agorender: Refactor R_CullBox to simplify it. 114/merge
cloudwalk [Sun, 11 Apr 2021 15:18:38 +0000 (15:18 +0000)]
render: Refactor R_CullBox to simplify it.

Use bitwise comparisons instead of the previous switch. Skip the
nearclip plane on the view frustum.

From divVerent. Cleaned up further by Cloudwalk.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13108 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agosv_user: Check if frametime is positive 97/merge
cloudwalk [Tue, 30 Mar 2021 16:19:13 +0000 (16:19 +0000)]
sv_user: Check if frametime is positive

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13107 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agosv_user: Don't bound moveframetime to a multiple of frametime when frametime is...
cloudwalk [Tue, 30 Mar 2021 16:11:38 +0000 (16:11 +0000)]
sv_user:  Don't bound moveframetime to a multiple of frametime when frametime is zero

Fixes https://gitlab.com/xonotic/darkplaces/-/issues/347

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13106 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agocl_screen: Finish frames even if we're minimized, if recording video
cloudwalk [Mon, 29 Mar 2021 21:17:42 +0000 (21:17 +0000)]
cl_screen: Finish frames even if we're minimized, if recording video

From malice

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13105 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agoprotocol: Make receivetime a float since it's derived from sv.time casted to float...
cloudwalk [Mon, 29 Mar 2021 20:55:14 +0000 (20:55 +0000)]
protocol: Make receivetime a float since it's derived from sv.time casted to float anyway

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13104 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agosv_user: Use sv.time directly, to limit reported time to current time
cloudwalk [Mon, 29 Mar 2021 20:55:13 +0000 (20:55 +0000)]
sv_user: Use sv.time directly, to limit reported time to current time

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13103 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agoRevert "Tell clients to reconnect before loading the next map. Should fix lag/stutter"
cloudwalk [Mon, 29 Mar 2021 20:55:13 +0000 (20:55 +0000)]
Revert "Tell clients to reconnect before loading the next map. Should fix lag/stutter"

This reverts commit b30c46fb9423afb892b639de58ade85d5dbed03e.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13102 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agoserver: Remove unused/broken ping smoothing feature
cloudwalk [Mon, 29 Mar 2021 20:55:12 +0000 (20:55 +0000)]
server: Remove unused/broken ping smoothing feature

Removes unused ping smoothing feature (didn't actually compile so safe
to say nobody is using it). It could cause problems for QC mods that use
ping for antilag purposes, and QC can easily average pings if desired.

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13101 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agosv_user: Don't detect heavy movement loss right after a map change
cloudwalk [Mon, 29 Mar 2021 20:55:12 +0000 (20:55 +0000)]
sv_user: Don't detect heavy movement loss right after a map change

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13100 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agoserver: Limit moveframetime to a multiple of sv.frametime
cloudwalk [Mon, 29 Mar 2021 20:55:11 +0000 (20:55 +0000)]
server: Limit moveframetime to a multiple of sv.frametime

Matches clmovement_inputtimeout decrementing behaviour and prevents player speed bugs with certain ticrate/inputtimeout/netfps combos.

Also use maximum of 0.1 for the timeout, not just the moveframetime limit.

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13099 d7cf8633-e32d-0410-b094-e92efae38249

2 weeks agosv_user: Remove redundant return/unreachable code
cloudwalk [Mon, 29 Mar 2021 20:55:11 +0000 (20:55 +0000)]
sv_user: Remove redundant return/unreachable code

moveframetime is already checked a few lines above and already returns
if it's less than 0.0005, making the redundant return unreachable.

From bones_was_here

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13098 d7cf8633-e32d-0410-b094-e92efae38249

5 weeks agocmd: Dynamically allocate the command interpreters
cloudwalk [Tue, 9 Mar 2021 00:12:25 +0000 (00:12 +0000)]
cmd: Dynamically allocate the command interpreters

Will help with threading and other stuff later.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13097 d7cf8633-e32d-0410-b094-e92efae38249

6 weeks agosys: Simplify Sys_LoadLibrary. Implement Sys_LoadDependency and move bloat to it
cloudwalk [Sat, 6 Mar 2021 12:03:22 +0000 (12:03 +0000)]
sys: Simplify Sys_LoadLibrary. Implement Sys_LoadDependency and move bloat to it

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13096 d7cf8633-e32d-0410-b094-e92efae38249

6 weeks agosys: Rename Sys_UnloadLibrary to Sys_FreeLibrary for consistency
cloudwalk [Sat, 6 Mar 2021 12:03:21 +0000 (12:03 +0000)]
sys: Rename Sys_UnloadLibrary to Sys_FreeLibrary for consistency

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13095 d7cf8633-e32d-0410-b094-e92efae38249

2 months agocl_particles: Fix rain splash particles falling through map by adding very slight... 103/merge
cloudwalk [Thu, 4 Feb 2021 14:16:52 +0000 (14:16 +0000)]
cl_particles: Fix rain splash particles falling through map by adding very slight bounce. A pbounce value of 0 disabled collisions. Minor framerate impact.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13094 d7cf8633-e32d-0410-b094-e92efae38249

2 months agosys_win: Remove pointless cls.state sets since we're calling Sys_Error immediately...
cloudwalk [Thu, 4 Feb 2021 13:48:10 +0000 (13:48 +0000)]
sys_win: Remove pointless cls.state sets since we're calling Sys_Error immediately after

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13093 d7cf8633-e32d-0410-b094-e92efae38249

2 months agokeys: Fix intermittent buffer overflow when pasting text. From malice
cloudwalk [Sun, 24 Jan 2021 02:23:33 +0000 (02:23 +0000)]
keys: Fix intermittent buffer overflow when pasting text. From malice

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13092 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_shared: Avoid Mod_MakeSortedSurfaces if dedicated. Fixes crash.
cloudwalk [Wed, 6 Jan 2021 17:57:00 +0000 (17:57 +0000)]
model_shared: Avoid Mod_MakeSortedSurfaces if dedicated. Fixes crash.

R_FrameData_Alloc isn't available in dedicated builds and sorting
surfaces is not really necessary without a renderer.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13091 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_shared: Clarify comments
cloudwalk [Wed, 6 Jan 2021 17:56:59 +0000 (17:56 +0000)]
model_shared: Clarify comments

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13090 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_brush: Rename some Q1BSP functions that are actually generic BSP functions
cloudwalk [Wed, 6 Jan 2021 17:56:59 +0000 (17:56 +0000)]
model_brush: Rename some Q1BSP functions that are actually generic BSP functions

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13089 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_brush: More work on VBSP. Still crashes.
cloudwalk [Fri, 1 Jan 2021 15:09:24 +0000 (15:09 +0000)]
model_brush: More work on VBSP. Still crashes.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13088 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_brush: Very early implementation of VBSP loader. It crashes
cloudwalk [Fri, 1 Jan 2021 07:53:23 +0000 (07:53 +0000)]
model_brush: Very early implementation of VBSP loader. It crashes

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13087 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoconsole: Readd code accidentally removed
cloudwalk [Thu, 31 Dec 2020 19:31:37 +0000 (19:31 +0000)]
console: Readd code accidentally removed

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13086 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_vbsp: Move magic header define to its appropriate place
cloudwalk [Thu, 31 Dec 2020 19:31:36 +0000 (19:31 +0000)]
model_vbsp: Move magic header define to its appropriate place

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13085 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_shared: Fix gcc warning
cloudwalk [Thu, 31 Dec 2020 19:31:35 +0000 (19:31 +0000)]
model_shared: Fix gcc warning

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13084 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoAdd missing include guards. Formatting improvement
cloudwalk [Thu, 31 Dec 2020 19:31:35 +0000 (19:31 +0000)]
Add missing include guards. Formatting improvement

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13083 d7cf8633-e32d-0410-b094-e92efae38249

3 months agofs: Create header for Source engine VPK format
cloudwalk [Thu, 31 Dec 2020 19:06:38 +0000 (19:06 +0000)]
fs: Create header for Source engine VPK format

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13082 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel: Create header for Half-Life MDL format
cloudwalk [Thu, 31 Dec 2020 19:06:37 +0000 (19:06 +0000)]
model: Create header for Half-Life MDL format

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13081 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel: Recognize Valve BSP format. Add file format headers.
cloudwalk [Thu, 31 Dec 2020 19:06:37 +0000 (19:06 +0000)]
model: Recognize Valve BSP format. Add file format headers.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13080 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoFix crash in q3bsp loading on submodels where it was adding the submodelsurfaces_star...
havoc [Tue, 29 Dec 2020 05:04:43 +0000 (05:04 +0000)]
Fix crash in q3bsp loading on submodels where it was adding the submodelsurfaces_start and shouldn't (reported by Cloudwalk - thanks).

Fix missing submodels in q3bsp loading where it was allocating a separate modelsurfaces_sorted for each submodel which was probably coming out uninitialized.

Simplified Mod_MakeSortedSurfaces a little by sorting each submodel separately - no need to worry about sorting by submodel this way, they're going to stay in the same ranges.

Refactored away the many duplicates of the mod->DrawSky and mod->DrawAddWaterPlanes setting code into Mod_SetDrawSkyAndWater function which is called after loader (and in submodel creation), this also means it checks for NULL texture pointer consistently whereas that varied a bit in the past by loader.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13079 d7cf8633-e32d-0410-b094-e92efae38249

3 months agocom_game: Add GAME_BATTLEMETAL
cloudwalk [Wed, 23 Dec 2020 18:27:48 +0000 (18:27 +0000)]
com_game: Add GAME_BATTLEMETAL

https://store.steampowered.com/app/1447830/battleMETAL/

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13078 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoshader_glsl: Don't use the r_colorfringe codepath if not enabled (terencehill)
cloudwalk [Mon, 21 Dec 2020 16:36:54 +0000 (16:36 +0000)]
shader_glsl: Don't use the r_colorfringe codepath if not enabled (terencehill)

Fixes scr_screenshot_alpha

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13077 d7cf8633-e32d-0410-b094-e92efae38249

3 months agosv_ccmds: Comment fix
cloudwalk [Mon, 21 Dec 2020 16:36:53 +0000 (16:36 +0000)]
sv_ccmds: Comment fix

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13076 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_shared: Fix compile warning and error with gcc
cloudwalk [Sun, 20 Dec 2020 18:55:24 +0000 (18:55 +0000)]
model_shared: Fix compile warning and error with gcc

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13075 d7cf8633-e32d-0410-b094-e92efae38249

3 months agocvar: Check if cvar is NULL before adding callback. Implement Cvar_Callback to fire...
cloudwalk [Sun, 20 Dec 2020 18:55:23 +0000 (18:55 +0000)]
cvar: Check if cvar is NULL before adding callback. Implement Cvar_Callback to fire off a callback at any time

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13074 d7cf8633-e32d-0410-b094-e92efae38249

3 months agomodel_brush: Remove commented out code
cloudwalk [Sun, 20 Dec 2020 18:55:22 +0000 (18:55 +0000)]
model_brush: Remove commented out code

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13073 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoReplaced some model fields and changed their purpose slightly to simplify a lot of...
havoc [Sat, 19 Dec 2020 10:19:47 +0000 (10:19 +0000)]
Replaced some model fields and changed their purpose slightly to simplify a lot of code:
model->firstmodelsurface : model->submodelsurfaces_start
model->nummodelsurfaces : replaced with model->submodelsurfaces_end
model->sortedmodelsurfaces : replaced with model->modelsurfaces_sorted (which starts at surface 0, not firstmodelsurface).

Changed the implementation of MakeSortedSurfaces so that it now sorts by effect, texture, lightmap, previously it didn't care about lightmap or effect.

No behavior changes.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13072 d7cf8633-e32d-0410-b094-e92efae38249

3 months agoFix a few warnings in VS2019.
havoc [Sat, 19 Dec 2020 10:15:44 +0000 (10:15 +0000)]
Fix a few warnings in VS2019.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13071 d7cf8633-e32d-0410-b094-e92efae38249

4 months agocl_input: Implement CheckJump function. Rename ambiguous variable
cloudwalk [Fri, 18 Dec 2020 00:10:04 +0000 (00:10 +0000)]
cl_input: Implement CheckJump function. Rename ambiguous variable

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13070 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoRevert "shader_glsl: Don't apply the fringe effect if it's disabled, it fixes scr_scr...
cloudwalk [Wed, 16 Dec 2020 19:39:46 +0000 (19:39 +0000)]
Revert "shader_glsl: Don't apply the fringe effect if it's disabled, it fixes scr_screenshot_alpha and who knows what else (terencehill)"

This reverts commit a43f3de5a66db2b6c75248fe85f5ae1573ad0ee1.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13069 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoshader_glsl: Don't apply the fringe effect if it's disabled, it fixes scr_screenshot_...
cloudwalk [Wed, 16 Dec 2020 19:20:00 +0000 (19:20 +0000)]
shader_glsl: Don't apply the fringe effect if it's disabled, it fixes scr_screenshot_alpha and who knows what else (terencehill)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13068 d7cf8633-e32d-0410-b094-e92efae38249

4 months agocl_input: Simplify wishspeed calculation to use VectorNormalizeLength instead of...
cloudwalk [Wed, 16 Dec 2020 19:19:59 +0000 (19:19 +0000)]
cl_input: Simplify wishspeed calculation to use VectorNormalizeLength instead of duplicating its functionality

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13067 d7cf8633-e32d-0410-b094-e92efae38249

4 months agomathlib: Simplify VectorNormalizeLength to use existing math macros
cloudwalk [Wed, 16 Dec 2020 19:19:59 +0000 (19:19 +0000)]
mathlib: Simplify VectorNormalizeLength to use existing math macros

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13066 d7cf8633-e32d-0410-b094-e92efae38249

4 months agosys: Remove unnecessary curly braces from a commented out if statement
cloudwalk [Wed, 16 Dec 2020 19:19:58 +0000 (19:19 +0000)]
sys: Remove unnecessary curly braces from a commented out if statement

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13065 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl: Fix r_lockpvs behaving like r_lockvisibility. Minor refactoring
cloudwalk [Wed, 16 Dec 2020 19:19:57 +0000 (19:19 +0000)]
gl: Fix r_lockpvs behaving like r_lockvisibility. Minor refactoring

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13064 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl_rmain: Fix skybox fog disappearing with certain explosion effects
cloudwalk [Thu, 3 Dec 2020 19:52:54 +0000 (19:52 +0000)]
gl_rmain: Fix skybox fog disappearing with certain explosion effects

Explicitly pass a "ui" qbool to the shader setup, where notrippy
resulted in fog being cancelled out under specific circumstances I
frankly barely understand.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13063 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoclvm_cmds, sv_main: Whitespace and cvar description fix
cloudwalk [Mon, 30 Nov 2020 18:37:25 +0000 (18:37 +0000)]
clvm_cmds, sv_main: Whitespace and cvar description fix

From terencehill
https://gitlab.com/xonotic/darkplaces/-/merge_requests/107

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13062 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl_textures: Remove redundant check. glt->bufferpixels being non-NULL already shortci...
cloudwalk [Mon, 30 Nov 2020 18:11:12 +0000 (18:11 +0000)]
gl_textures: Remove redundant check. glt->bufferpixels being non-NULL already shortcircuits this

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13061 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl_rmain: Comments and style fix (no pun intended...)
cloudwalk [Mon, 30 Nov 2020 18:11:11 +0000 (18:11 +0000)]
gl_rmain: Comments and style fix (no pun intended...)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13060 d7cf8633-e32d-0410-b094-e92efae38249

4 months agocl_demo: Fix demo loop playback bugs. Should behave like Quake again.
cloudwalk [Mon, 30 Nov 2020 18:11:10 +0000 (18:11 +0000)]
cl_demo: Fix demo loop playback bugs. Should behave like Quake again.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13059 d7cf8633-e32d-0410-b094-e92efae38249

4 months agocl_parse: Only print if server actually disconnected
cloudwalk [Mon, 30 Nov 2020 18:11:09 +0000 (18:11 +0000)]
cl_parse: Only print if server actually disconnected

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13058 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl_textures: Fix warning
cloudwalk [Mon, 30 Nov 2020 18:11:09 +0000 (18:11 +0000)]
gl_textures: Fix warning

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13057 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoRefactored lightmap update handling and added cvars to replace gl_nopartialtextureupd...
havoc [Mon, 30 Nov 2020 06:40:43 +0000 (06:40 +0000)]
Refactored lightmap update handling and added cvars to replace gl_nopartialtextureupdates cvar with finer-grained control:
* r_q1bsp_lightmap_updates_enabled (default 1 - shouldn't turn this off)
* r_q1bsp_lightmap_updates_combine (default 2 - upload full lightmap texture)
* r_q1bsp_lightmap_updates_hidden_surfaces (default 0 - if turned on it may improve fps when the view is moving/turning by only uploading lightmaps on certain frames)

Previously there was a bug that made hidden surfaces get lightmap updates, which was never intended, but a cvar was added to allow the behavior to be toggled in case it has some use.

Overall this change performs better on AMD drivers for Windows, and is expected to perform a lot better on all Mesa drivers for Linux as they have even worse performance with partial texture update locking, it may reduce performance on NVIDIA drivers for Windows as they have always had good handling of thousands of small partial texture updates.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13056 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoRemove inline keyword on List_* functions, inline in a .c file does not work in VS201...
havoc [Mon, 30 Nov 2020 03:36:56 +0000 (03:36 +0000)]
Remove inline keyword on List_* functions, inline in a .c file does not work in VS2019 and it's odd to think that it would work anywhere else.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13055 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoAdd missing code modules to vs2019 project.
havoc [Mon, 30 Nov 2020 03:33:37 +0000 (03:33 +0000)]
Add missing code modules to vs2019 project.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13054 d7cf8633-e32d-0410-b094-e92efae38249

4 months agogl_textures: Totally disable the partial update codepath until it can be done correctly.
cloudwalk [Sun, 29 Nov 2020 21:50:23 +0000 (21:50 +0000)]
gl_textures: Totally disable the partial update codepath until it can be done correctly.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13053 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoprvm_edict: Spelling
cloudwalk [Sat, 28 Nov 2020 16:08:23 +0000 (16:08 +0000)]
prvm_edict: Spelling

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13052 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoprvm_execprogram: Polish pass over error messages
cloudwalk [Sat, 28 Nov 2020 16:08:23 +0000 (16:08 +0000)]
prvm_execprogram: Polish pass over error messages

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13051 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoprvm_execprogram: Compare against numglobals instead of numglobaldefs. This should...
cloudwalk [Sat, 28 Nov 2020 16:08:22 +0000 (16:08 +0000)]
prvm_execprogram: Compare against numglobals instead of numglobaldefs. This should be correct...

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13050 d7cf8633-e32d-0410-b094-e92efae38249

4 months agopr_comp: Slightly improve commenting. Use explicit stdint types
cloudwalk [Sat, 28 Nov 2020 16:08:21 +0000 (16:08 +0000)]
pr_comp: Slightly improve commenting. Use explicit stdint types

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13049 d7cf8633-e32d-0410-b094-e92efae38249

4 months agopr_comp: Add the rest of FTEQW's opcodes
cloudwalk [Sat, 28 Nov 2020 16:08:21 +0000 (16:08 +0000)]
pr_comp: Add the rest of FTEQW's opcodes

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13048 d7cf8633-e32d-0410-b094-e92efae38249

4 months agocsprogs: Pass menu/focus state as a third parameter to CSQC_UpdateView
cloudwalk [Sat, 28 Nov 2020 16:08:20 +0000 (16:08 +0000)]
csprogs: Pass menu/focus state as a third parameter to CSQC_UpdateView

https://gitlab.com/xonotic/darkplaces/-/merge_requests/106

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13047 d7cf8633-e32d-0410-b094-e92efae38249

4 months agoprvm_edict: Add warning for attempting to load FTEQW progs while support is incomplete
cloudwalk [Sat, 28 Nov 2020 16:08:19 +0000 (16:08 +0000)]
prvm_edict: Add warning for attempting to load FTEQW progs while support is incomplete

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13046 d7cf8633-e32d-0410-b094-e92efae38249

4 months agopr_comp: Fix typo in comments
cloudwalk [Sat, 28 Nov 2020 16:08:19 +0000 (16:08 +0000)]
pr_comp: Fix typo in comments

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13045 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_draw, model_shared: Refactor vertex adding. Add faster codepath that skips hash...
cloudwalk [Sat, 14 Nov 2020 16:26:31 +0000 (16:26 +0000)]
gl_draw, model_shared: Refactor vertex adding. Add faster codepath that skips hash function for drawing lines. Modest improvement in netgraph performance.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13044 d7cf8633-e32d-0410-b094-e92efae38249

5 months agoRevert "cmd: Merge cmd_server and cmd_client into cmd_local again"
cloudwalk [Mon, 9 Nov 2020 20:02:00 +0000 (20:02 +0000)]
Revert "cmd: Merge cmd_server and cmd_client into cmd_local again"

This reverts commit aadd101471d0227217f84d3dc6ed03fec4aacd4c.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13043 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_textures: Optimize the gl_nopartialtextureupdates 0 path to accumulate partial...
cloudwalk [Mon, 9 Nov 2020 20:01:59 +0000 (20:01 +0000)]
gl_textures: Optimize the gl_nopartialtextureupdates 0 path to accumulate partial updates for one big glTexSubImage2D call. Fixes lightmap update performance.

This can probably be optimized further by uploading the lightmaps per
model as soon as they're ready instead of waiting until a specific point
in the frame. For now, this'll do.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13042 d7cf8633-e32d-0410-b094-e92efae38249

5 months agoprvm_edict: Link all edicts to the world when loaded from file. Fixes issue with...
cloudwalk [Sun, 8 Nov 2020 06:25:14 +0000 (06:25 +0000)]
prvm_edict: Link all edicts to the world when loaded from file. Fixes issue with some entities being spawned at world origin in Xonotic.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13041 d7cf8633-e32d-0410-b094-e92efae38249

5 months agoimage: Check if file exists first to allow early out and avoid a slower codepath
cloudwalk [Sun, 8 Nov 2020 06:25:13 +0000 (06:25 +0000)]
image: Check if file exists first to allow early out and avoid a slower codepath

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13040 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Duplicate the lightmap update code to avoid the extra check for non-world...
cloudwalk [Sun, 8 Nov 2020 06:25:13 +0000 (06:25 +0000)]
gl_rmain: Duplicate the lightmap update code to avoid the extra check for non-world brush entities, which would previously unconditionally update their lightmaps even if not visible.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13039 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Render anything RENDER_VIEWMODEL when in the void
cloudwalk [Sun, 8 Nov 2020 06:25:12 +0000 (06:25 +0000)]
gl_rmain: Render anything RENDER_VIEWMODEL when in the void

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13038 d7cf8633-e32d-0410-b094-e92efae38249

5 months agocom_list: Implement the rest of the linked list API from the Linux kernel
cloudwalk [Sun, 8 Nov 2020 06:25:12 +0000 (06:25 +0000)]
com_list: Implement the rest of the linked list API from the Linux kernel

Also added DP_GCC_COMPATIBLE define. Used to make checking for
GCC-compatible compilers easier (for checking if we should use typeof or
decltype in this case).

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13037 d7cf8633-e32d-0410-b094-e92efae38249

5 months agocvar: When saving init state, simply make a copy of the entire cvar
cloudwalk [Sun, 8 Nov 2020 06:25:11 +0000 (06:25 +0000)]
cvar: When saving init state, simply make a copy of the entire cvar

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13036 d7cf8633-e32d-0410-b094-e92efae38249

5 months agocmd: Merge cmd_server and cmd_client into cmd_local again
cloudwalk [Tue, 27 Oct 2020 14:50:20 +0000 (14:50 +0000)]
cmd: Merge cmd_server and cmd_client into cmd_local again

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13035 d7cf8633-e32d-0410-b094-e92efae38249

5 months agoMerge the sendcvar command into one. Call the old functions using hooks.
cloudwalk [Tue, 27 Oct 2020 14:50:19 +0000 (14:50 +0000)]
Merge the sendcvar command into one. Call the old functions using hooks.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13034 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_textures: Set gl_max_lightmapsize to 512 by default to eliminate stutter without...
cloudwalk [Sun, 25 Oct 2020 14:32:20 +0000 (14:32 +0000)]
gl_textures: Set gl_max_lightmapsize to 512 by default to eliminate stutter without partial updates

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13033 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rsurf: Actually use the model pointer
cloudwalk [Sun, 25 Oct 2020 14:32:20 +0000 (14:32 +0000)]
gl_rsurf: Actually use the model pointer

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13032 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Small cleanup
cloudwalk [Sun, 25 Oct 2020 14:32:19 +0000 (14:32 +0000)]
gl_rmain: Small cleanup

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13031 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_textures: Set gl_nopartialtextureupdates to 1 by default. Massive performance...
cloudwalk [Tue, 20 Oct 2020 10:58:31 +0000 (10:58 +0000)]
gl_textures: Set gl_nopartialtextureupdates to 1 by default. Massive performance improvement with dynamic lightmaps but may be slow for some drivers. Testing needed.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13030 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rsurf: Whitespace
cloudwalk [Tue, 20 Oct 2020 10:58:30 +0000 (10:58 +0000)]
gl_rsurf: Whitespace

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13029 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Don't draw any entities except the world and viewent if floating in the...
cloudwalk [Tue, 20 Oct 2020 10:58:29 +0000 (10:58 +0000)]
gl_rmain: Don't draw any entities except the world and viewent if floating in the void. Massive performance improvement on many large maps when flying in the void.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13028 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Remove some dead code
cloudwalk [Tue, 20 Oct 2020 10:58:29 +0000 (10:58 +0000)]
gl_rmain: Remove some dead code

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13027 d7cf8633-e32d-0410-b094-e92efae38249

5 months agogl_rmain: Instead of avoiding a call to R_BuildLightmap if surface is not visible...
cloudwalk [Tue, 20 Oct 2020 10:58:28 +0000 (10:58 +0000)]
gl_rmain: Instead of avoiding a call to R_BuildLightmap if surface is not visible, simply don't set the update flag.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13026 d7cf8633-e32d-0410-b094-e92efae38249