Commit Graph

3052 Commits

Author SHA1 Message Date
Zack Middleton f7c3276fe8 Fix g_teamAutoJoin and g_teamForceBalance
There are various issues caused by not knowing the initial team for
the local client and bots when they connect. This is can be reproduced
by starting a team game from the main menu.

When g_teamAutoJoin is enabled, bots and local client join a random
team at connect and then execute their team command a few frames
later. This may result in the player being killed if they specify a
different team. In Team Arena's Harvester mode this causes harvester
skulls to be spawned at the beginning of the game.

When g_teamForceBalance is enabled, the local client and bots may not
be able to join their desired team. This may result in them being
spectators. If g_teamAutoJoin is also enabled they may be left on
the opposite (red/blue) team they were meant to join.

There is a hack for including bot's team in their player info string
(used by cgame for which team skin to use) before the bot joins
their desired team. Bots aren't guaranteed to join their desired team
(as may happen when both g_teamAutoJoin and g_teamForceBalance are
enabled) so clients may see them as being on the wrong team!

----

Add teampref userinfo option for team preference. If teampref is set
it will be used for attempting to join the team immediately at connect.

Bots now join team at connect using teampref userinfo. So remove
the hack for setting bot's team in player info string before the bot
joins the team.

To avoid the client sending teampref userinfo to all network servers,
the local client uses a g_localTeamPref cvar. The g_localTeamPref
cvar is cleared after it's used so it doesn't get used when starting
another server later. Another reason not to use a teampref userinfo
cvar is there isn't a reliable way to clear it in CGame/UI which are
likely loaded from baseq3 pk3.

Make it so g_teamAutoJoin doesn't affect clients who specify
teampref. If teampref is invalid, the client will join a random team
like g_teamAutoJoin.

Don't apply g_teamForceBalance to the local client or bots. Otherwise
they may be left as spectators when starting team game from menu.

The start server menus use team command and g_localTeamPref to set
the human player's team. This way it's compatible with vanilla Q3
game VMs and the new setting team at connect feature.
2017-06-22 21:56:20 -05:00
SmileTheory e03cdf444c OpenGL2: Remove SF_VAO_MESH. 2017-06-16 16:52:53 -07:00
Zachary J. Slater fd3b58b967 Merge pull request #293 from rcgordon/autoupdater-rsa-signature 2017-06-10 21:00:51 -10:00
Zack Middleton e9436abff0 Only allow connectionless print/echo from server/rcon address
Reported by Ensiform.
2017-06-10 19:15:26 -05:00
Zack Middleton dfce71929a Add con_autochat and con_autoclear cvars 2017-06-08 15:46:19 -05:00
Zack Middleton c12b81a273 Fix strncpy usage in botlib
All usage of strncpy in botlib should now either set string
terminator or use Q_strncpyz.
2017-06-07 21:48:01 -05:00
Tobias Kuehnhammer 8956ab41dd Fix notarget cheat
Bots no longer target players in 'no target mode'.
2017-06-07 21:27:33 -05:00
Zack Middleton c99281a0da Make bots stop attacking player after disconnect
Bots did not notice player disconnected, so they kept attacking
the last known position.

Checking if entity is valid in BotEntityVisible might fix other
similar issues too.
2017-06-07 21:11:52 -05:00
Zack Middleton 9aae0948ab Remove unused define MAX_COMMANDARGUMENTS from be_ea.c 2017-06-07 21:11:38 -05:00
Zack Middleton 74a59f17c7 Don't copy p->org to itself in cg_particles.c 2017-06-07 21:07:42 -05:00
Zack Middleton 8a6c9d1038 Remove unneeded 'angles' variables/clearing in ai_dmq3.c 2017-06-07 21:06:28 -05:00
Zack Middleton 730b917059 Fix comment in BotAIPredictObstacles 2017-06-07 20:53:35 -05:00
Zack Middleton a738cb9592 Fix overdraw in CG_DrawRect
It was noticeable in the corners when alpha was less than 1.
2017-06-07 20:40:16 -05:00
Zack Middleton 1a8bf792e7 Range check client number for trap_BotUserCommand 2017-06-07 20:38:12 -05:00
Zack Middleton 5b9302a7ef Don't start game entity loops at index 1 2017-06-07 20:32:57 -05:00
Zack Middleton 71512bb1fd Show client's name in callvote clientkick vote display message
Make callvote always kick by client num so player can't rename to
avoid being kicked. Don't allow calling a vote to kick host or
non-existent players.
2017-06-07 20:24:10 -05:00
Zack Middleton eeb28dc1d0 Fix score info being dropped by server
Server drops reliable command string if it's length is more than 1022.
2017-06-07 19:55:36 -05:00
Zack Middleton 91acf8a681 Don't build score info for bots, they don't parse it 2017-06-07 19:54:34 -05:00
Zack Middleton b511b8f2f6 Fix Coverity warning that endVelocity is uninitialized 2017-06-07 19:51:32 -05:00
Zack Middleton c96acec428 Fix (unused) check for map restart in CG_TransitionSnapshot 2017-06-07 19:42:32 -05:00
Zack Middleton 1456008d96 Fix comment for CG_SetInitialSnapshot 2017-06-07 19:41:46 -05:00
Zack Middleton 1048073e26 Unify checks for missing COM_Parse() token 2017-06-07 19:16:05 -05:00
Zack Middleton d58234a6c7 Fix 'missing token' in parsers for animations.cfg 2017-06-07 19:06:41 -05:00
Zack Middleton 6e340f9a5b Don't use uninitialized ps from BotAI_GetClientState
If BotAI_GetPlayerState returns qfalse, ps is untouched and in
some cases means uninitialized. So don't use it if not valid.
2017-06-07 19:02:20 -05:00
Zack Middleton 74aa4268b2 Stop caching sv_maxclients in bot code 2017-06-07 19:00:28 -05:00
Zack Middleton d1631d6ea3 Use const char pointers when possible in botlib's libvar code 2017-06-07 18:54:49 -05:00
Ryan C. Gordon 76e6b3c534 Removed unnecessary trailing backslash. 2017-06-04 16:43:50 -04:00
Ryan C. Gordon b771192d52 Use "x86_64" and not "x86-64" like everything else in ioq3. 2017-06-04 02:46:49 -04:00
Ryan C. Gordon 749e17ab1d Add a log message if manifest is valid. 2017-06-04 02:23:49 -04:00
Ryan C. Gordon a761684a23 Windows support for autoupdater manifest signatures. 2017-06-04 02:21:55 -04:00
Ryan C. Gordon c9c5d8710a Added .gitignore for rsa_tools directory. 2017-06-04 01:49:33 -04:00
Ryan C. Gordon 06cc3a4e1b build-rsa-tools.sh now works on Linux. 2017-06-04 01:44:39 -04:00
Ryan C. Gordon ced7437042 Updated autoupdater-readme.txt with manifest signing details. 2017-06-04 01:32:41 -04:00
Ryan C. Gordon e04bfd4967 Autoupdater now checks RSA digital signature for manifest. 2017-06-04 01:32:10 -04:00
Ryan C. Gordon f71260eb8c Replace sha256.c with libTomCrypt equivalent, since we'll be using it anyway. 2017-06-04 01:17:17 -04:00
Ryan C. Gordon 62f6f0c7e0 Wire up libTom stuff to build system. 2017-06-04 01:16:37 -04:00
Ryan C. Gordon 7542966e33 Verify libTom source archives aren't tampered with. 2017-06-04 01:15:38 -04:00
Ryan C. Gordon ece37f1390 Initial add of rsa_tools.
This is just a simple RSA public key digital signature thing built on
libtomcrypt. The gist:

Some admin will generate a public/private key with rsa_make_keys, keeping the
private key secret. Using the private key and rsa_sign, the admin will sign
the autoupdater manifests, generating manifest.txt.sig.

The public key ships with the game (adding 270 bytes to the download), the
.sig is downloaded with the manifest by the autoupdater (256 bytes extra
download), then the autoupdater checks the manifest against the signature
with the public key. if the signature isn't valid (the manifest was tampered
with or corrupt), the autoupdater refuses to continue.

If the manifest is to be trusted, it lists sha256 checksums for every file to
download, so there's no need to sign every file; if they can't tamper with the
manifest, they can't tamper with any other file to be updated since the file's
listed sha256 won't match.

If the private key is compromised, we generate new keys and ship new
installers, so new installations will be able to update but existing ones
will need to do a new install to keep getting updates. Don't let the private
key get compromised. The private key doesn't go on a public server. Maybe it
doesn't even live on the admin's laptop hard drive.

If the download server is compromised and serving malware, the autoupdater
will reject it outright if they haven't compromised the private key, generated
a new manifest, and signed it with the private key.

libtomcrypt is sort of a big pile of source code, so instead of putting it
in revision control, we have a script to download it. Most things don't need
it. It lives on GitHub, so we _could_ do a git submodule, but most people
don't need it, so why waste their disk and bandwidth? That said, when compiled
you end up with a few hundred kilobytes of binary code to verify a signature
and no external dependencies, so it seems like a win.
2017-06-03 20:26:07 -04:00
Zack Middleton db1198f6ea Add mouse wheel support to UI list boxes
Allows scrolling server browser list and some other lists.
2017-06-03 14:03:09 -05:00
Zack Middleton 5592342b1b Only auto update empty Team Arena internet server cache
Previously tested a mod cvar which may be wrong when multiple
mods are involved or config is reset. Let's check the server
cache's internet server count directly.
2017-06-03 14:03:09 -05:00
Zack Middleton 66fec1b059 Remove unneeded code from OpenGL2's RB_RenderDrawSurfList
Make it more similar to OpenGL1.
2017-06-03 14:03:09 -05:00
Ryan C. Gordon 1aa20487a4 autoupdater: Fixed up GCC/clang printf function attribute. 2017-06-03 12:02:29 -04:00
Zachary J. Slater 87eecd7bc1 Merge pull request #290 from rcgordon/autoupdater
Initial shot at writing an ioquake3 autoupdater. Thank you icculus, and everyone who contributed to his patreon! https://www.patreon.com/icculus
2017-06-02 22:46:22 -10:00
Zack Middleton c14cb70f15 Draw disconnect icon over lagometer in Team Arena too
The blinking disconnect icon is drawn over lagometer in Q3.
Team Arena moved the lagometer location. Now let's draw the
disconnect icon over lagometer in Team Arena too!
2017-06-02 22:11:52 -05:00
Zack Middleton 082376ed9e Enable tourney scoreboard in Team Arena
"/team score" draws an oversized scoreboard in Q3. In Team Arena
it draws nothing. They probably intended to replace it with the
new .menu UI. But since it didn't happen, go ahead and use the Q3
tournament scoreboard.
2017-06-02 22:11:52 -05:00
Zack Middleton 1066214548 Fix "brought in 1 skulls" Harvester message
Use correct singular/plural form of skulls for Harvester's brought in
skulls message.

Reported by Tobias.
2017-06-02 22:11:52 -05:00
Zack Middleton 4006358492 Fix spawn/freed entity logic (specifically harvester skulls)
- Actually use the second 'force' pass in G_Spawn when out of
available slots.
- Make G_EntitiesFree return qtrue if we can open a new slot.
(Only used when spawning Harvester skulls.)

Fixes not spawning Harvester skulls when there are no 'open freed
slots', but we have other slots available to open.
2017-06-02 22:11:52 -05:00
Zack Middleton 4227d97958 Make Team Arena win logic handle more game types/blue team
The Team Arena menu uses red team for single player but q3_ui
(and mods could) use blue. Also handle all the game types, not
just the ones used by Team Arena. Fixes FFA and Team DM.
2017-06-02 22:07:27 -05:00
Zack Middleton 4506ebd5d7 Fix joining team when starting local team play server
AKA fix joining team in Team Arena single player. Though it also
affects starting Q3 skirmish in team dm or ctf modes.
2017-06-02 21:07:30 -05:00
Ryan C. Gordon b33551dfa2 Fixed comment typo: s/until/under 2017-06-02 11:28:33 -04:00