Commit graph

2617 commits

Author SHA1 Message Date
Yamagi Burmeister
41134fa204 Add a new command 'teleport'.
A command that teleports the player to abitrary locations was often
requested and may be helpfull for debugging, so finally add it. It works
like a normal teleporter: It moves the player to the requested location,
clears all movements, tells the server and clients that the entity just
teleported and telefrags everything that's in the target location.

The implementation does not verify if the requested location is save,
the player may teleport into the world model or even the void. But the
requested Z coordinate is elevated by 10 units to prevent the player
getting stuck in the floor.

The command is protected by sv_cheats.

This is part of issue #430.
2019-09-05 08:18:20 +02:00
David Carlier
28e22f15d5 Little code changes proposal. 2019-09-04 21:56:22 +01:00
Yamagi Burmeister
5ae4a73acd Fix stupid endless loop in HTTP->UDP Fallback handling.
The fallback logic is: r1q2 style URLs -> q2pro style URLs -> UDP. In
case that an r1q2 or q2pro server is missing files, we may fall through
to UDP and download files over abysmal slow UDP that are available over
HTTP. To work around this problem we reset the precacher iterations back
to 0 and start over with r1q2 style URLs. This works as long as we're
able to download all files. But if one or more files are unavailable
over all three download options we'll run into an endless loop. Mitigate
this by starting over only once. This comes with the drawback that on
servers that miss more than one file downloads might done over UDP were
HTTP is available. In that case the server should be fixed.

This closes #429.
2019-09-04 18:02:06 +02:00
Yamagi Burmeister
b7bb9f2550 Reset paused_at_load after loading has finished. 2019-09-03 08:45:59 +02:00
Yamagi Burmeister
fc5c2788a1 Put the client into pause mode when loading save games.
This prevenits the worlds from advancing during client connect. The
player won't get attacked by monsters or hurt by the environment. Note
that in baseq2 there're still 4 world frames processed by the game and
100 world frames if the player enters a level that he or she already
visited. Both aren't a big problem, 4 world frames are hardly enough
for monsters starting to attack and in most levels the starting area
can't be reached by monsters and is free from environmental effects.

Pause mode is only entered for local servers and only in single player
mode. This should prevent problems with coop and deathmatch games.

The behaviour can be controlled by `cl_loadpaused`:
* `0`: Do not enter pause mode, Vanilla Quake I behaviour.
* `1`: Enter pause mode at load and leave it at first regular server
       frame.
* `2`: Enter pause mode at load, never leave it. The player must leave
       it by hand.

This was requested in issue #417.
2019-09-03 08:42:05 +02:00
Yamagi Burmeister
81a36bb3ad Add 'dec' and 'inc' operations.
'dec' decrements and 'inc' increments a given cvar either by 1 or a
given value.

The code was taken from q2pro.

This closes issue #414.
2019-09-02 17:57:02 +02:00
Yamagi Burmeister
d1981e7edf Add 'toggle' cvar operation.
The 'toggle' operation allows toggling a cvar between `0` and `1` or two
custom values.

This code was taken from q2pro.

This is part of issue #414.
2019-09-02 17:29:00 +02:00
Yamagi Burmeister
66ca44e040 Add new cvar operation 'reset' and 'resetall'.
cvar operations are special commands that allow the programmatic
manipulation of cvar values. 'reset' resets a given cvar to it's
default value, e.g. `reset r_mode' would reset `r_mode` to `4`.
'resetall' resets all known cvar with the exception of `game`.

The code is based upon q2pro.

This is part of issue #414.
2019-09-02 17:28:41 +02:00
Yamagi Burmeister
5136ceb123 Try to fix monsters getting stuck by waiting forever for their enemy.
44472722e added some sanity checks to the AI code. The checks in
ai_run() are likely wrong because the enemy entity might be already
NULL if we arrive their. By aborting early the code is unable to
determine a new enemy or return the monster to idle state, so the
monster will wait forever for an enemy that'll never come.

This happens only in monster vs. monster fights. Never in monster vs.
player, that game ends if the player dies.

In theory this change should be harmless, because if the enemy entity is
gone it won't generate sound targets now be visible. If the game crashes
by self->enemy being NULL we've got a problem elsewere.

This was reported by @BjossiAlfreds in #483. He also suggested the fix.
2019-08-31 10:56:50 +02:00
Yamagi Burmeister
5c17eb0132 Fix monsters being unable to see the player if he generates noise.
When searching for the player FinTarget() always goes after sound
targets and aborts as soon as it finds one. So if the player is
constantly generating sounds - for example firing the machine gun -
there's a high chance that monsters will only hear but never see
him. Work around this by adding a small timeout to player noises, make
sure that at least 3 frames passed since the last noise. This gives
monsters 2 frames to see the player.

This bug was present in the original code, this is a small gameplay
change.

The problem was analysed by @BjossiAlfreds in #436. He also suggested
the fix.
2019-08-31 10:40:13 +02:00
Yamagi Burmeister
35547d813a Fix berserker fidget animation aborting attack.
M_MoveFrame() calls first the AI functions that decide if a monster
should attack or not. After that the monsters think function is called
which walks through berserk_frames_stand[]. Even if the AI function found
an enemy and decided to attack, the monster is still standing for this
frame and berserker_fidget() is called. It may override the earlier
earlier decision, aborting the attack. Even worse this may let the
berserker stuck, because AI_STAND_GROUND may be cleared which prevents
further attacks.

This bug was present in the original code, so this is small gameplay
change. It's likely also present in both addons.

Reported and analyzed by @BjossiAlfreds in issue #433. He also suggested
the fix.
2019-08-31 10:23:18 +02:00
Yamagi
8481b97e19
Merge pull request #437 from lourinaldi/patch-1
Update 03_configuration.md
2019-08-31 10:08:23 +02:00
Yamagi
6abaf69426
Merge pull request #432 from Marat-Tanalin/master
Typos in README: if => in, build => built
2019-08-31 10:07:57 +02:00
Yamagi
a50ac0ebd5
Merge pull request #431 from devnexen/apple_old_lambs_are_not_dead_yet
Silence deprecation warning with OpenGL.
2019-08-31 10:07:37 +02:00
Daniel Gibson
d615190e36 Fixes for PVS Studio warnings: warnings in unix/main.c and sv_send.c 2019-08-24 20:40:06 -01:00
Daniel Gibson
f9c77b98af YQ2_ALIGNAS_*() in common.h 2019-08-24 20:38:42 -01:00
Daniel Gibson
bebd9e73b3 YQ2_COM_CHECK_OOM() macro to check if malloc() etc was successful 2019-08-21 21:07:31 -01:00
Lou Rinaldi
9a68f1f52e
Update 03_configuration.md
typo fix
2019-08-21 09:40:21 -04:00
Marat Tanalin
dcc2cd18ab
Typos in README: if => in, build => built
if => in (in the last official release)
build => built (is built upon)
2019-08-02 22:27:20 +03:00
David Carlier
97e66dfd9b Silence deprecation warning with OpenGL.
on Darwin, Mojabe has deprecated it in favor of Metal,
here we silent the lengthy build warning.
2019-08-01 20:01:43 +01:00
Yamagi Burmeister
751b09ba33 Quote the raw architecture string, it might contain whitespaces. 2019-07-31 13:42:28 +02:00
Daniel Gibson
95983f08cf Fixes for PVS Studio warnings: Sound stuff 2019-07-21 05:29:05 +02:00
Daniel Gibson
d368a67976 Fixes for PVS Studio warnings: most of src/common/
except for frame.c, I'd like Yamagi's input on that
2019-07-21 03:14:21 +02:00
Daniel Gibson
90d0fe07e2 Fixes for PVS Studio warnings: (q)menu.c, glimp_sdl.c 2019-07-21 03:08:52 +02:00
Daniel Gibson
4c265d448f Fixes for PVS Studio warnings: client/cl_*.c and curl/download.c
except for cl_cin.c that'll need some actual refactorings

see #426
2019-07-21 03:02:22 +02:00
Yamagi Burmeister
eaa4aa46ce Don't screw up if 'sensitivity' is set to non-integral values.
Like most other cvars 'sensitivity' allowes for float values. But until
now mouse events were handled as integers which led to some confusing
problems. This was especially noticeable at values lower than 1, small
mouse movements were cut to 0 and discarded. Since the clients movement
code is written in floats and we're already using floats for joystick
movement switch the mouse event handling over to them, too.

This should have any impact on configs were 'sensitivity' is ste to
integral values. If it was set to decimal values the behaviour is now
correct.

This fixes #419.
2019-07-20 16:19:35 +02:00
Yamagi Burmeister
e3d4038233 Remove S_RegisterSexedModel().
I new that it was unused, I left it in the code because I thought it
might be usefull one day. It wasn't, so finally remove it. Closes #425.
2019-07-20 16:19:15 +02:00
Yamagi
56b3d91786
Merge pull request #423 from devnexen/curl_build_fix
curl buffer resizing lost fix proposal.
2019-07-20 15:34:00 +02:00
David Carlier
78a5a819c6 curl buffer resizing lost fix proposal. 2019-07-14 13:08:40 +01:00
Yamagi Burmeister
158fbbe559 Enable the numpad * key.
All other keys were already enabled. Reported by @m-x-d, closes #420.
2019-07-11 14:12:14 +02:00
Yamagi Burmeister
3b641e481d Trigger the SDL bug #4700 only if we're in fullscreen. 2019-07-11 14:04:14 +02:00
Yamagi Burmeister
2681276fa1 Remove unused variable and statement.
Reported by @m-x-d. Closes #420.
2019-07-11 14:02:05 +02:00
Yamagi
c1ccb95026
Merge pull request #416 from 0lvin/for_review
Fix overrun in RE_BufferDifferenceStart
2019-07-11 07:45:03 +02:00
Daniel Gibson
b9d8ceba0b Reset vid_rate when using fallback display mode 2019-07-06 19:44:27 +02:00
Denis Pauk
af27d68483 Remove unused sw_partialflush flag 2019-07-06 13:25:29 +03:00
Denis Pauk
5b98640dd2 use pixel position for skip unchanged 2019-07-06 11:43:01 +03:00
Denis Pauk
c6b31d1b46 change 2d buffer damage before frame flush 2019-07-06 10:33:15 +03:00
Denis Pauk
a7199f95db Always flush whole texture to render 2019-07-05 22:28:48 +03:00
Denis Pauk
ceb7fd03b1 fix issue with back_max in RE_BufferDifferenceStart 2019-07-05 22:28:48 +03:00
Yamagi Burmeister
6db1203f22 Evil hack to work around SDL bug 4700.
Check if we're in the requested mode after the fullscreen window was
created. If not: Try to switch again in the requested mode by calling
SDL_SetWindowDisplayMode(). If that's successfull set the new window
size with SDL_SetWindowSize(). That shouldn't be necessary, at least to
SDLs crappy doku, but without the subsequent SDL_GetWindowDisplayMode()
call fails with 'Invalid Window'. Use that call to check if we're now
in the requested mode. If yes, process. If not abort and trigger the
fallback magic. It'll set `r_mode 4` and `vid_fullscreen 0`.

Caveat: In the worst case this will switch the display mode 3 times.
To create the window, to work around the bug and to set a refresh rate.
No problem for flat panels, but my unforgotten Trinitron CRT would
have cried in pain.
2019-07-05 14:12:27 +02:00
Yamagi Burmeister
890d708085 Add a new cvar vid_rate and make sure that we're at the requested mode.
* Normaly SDL chooses a sane refresh rate for fullscreen windows. Users
  may want to override that, so provide a new cvar `vid_rate`. If it's
  set to a value greater than 0, we're trying to get a mode close to the
  requested resolution and refresh rate and switch to that.
* A bug in SDL may leave us in the wrong mode, detect that condition and
  abort. See https://bugzilla.libsdl.org/show_bug.cgi?id=4700 for details.

This is part of issue #302.
2019-07-02 19:04:13 +02:00
Yamagi Burmeister
aeca570a96 Fix code style after latest changes.
Since it's apperently too hard to stay within the style and I'm sick of
discussing it, I fix it by myself.
2019-07-02 17:52:17 +02:00
Yamagi Burmeister
b5f3a79f5d Print SDL display modes.
Print a list of all available modes as soon as SDLs video backend
initializes and the real display mode after the window was created
or altered.

This hopefully helps debbuging problem with display mode selection, see
issue #302 for an example.
2019-06-29 21:11:44 +02:00
Yamagi
40b5fbe87a
Merge pull request #412 from Spirrwell/master
Multi-Monitor Management
2019-06-29 21:06:37 +02:00
Spirrwell
4f5de01d8e (Code Formatting)Fix Indentation 2019-06-29 13:54:59 -04:00
Yamagi
75c0450508
Merge pull request #415 from 0lvin/for_review
Soft render speed up
2019-06-25 15:21:50 +02:00
Denis Pauk
f8c73ca731 Flush only frame difference. 2019-06-24 21:47:42 +03:00
Denis Pauk
60f9af27f5 Dynamicly allocate lights 2019-06-24 21:47:42 +03:00
Denis Pauk
9783e7955f correctly check limits in RE_Draw 2019-06-24 21:47:42 +03:00
Denis Pauk
65888e6b9b fix distance selection for mip level 2019-06-24 21:47:42 +03:00