Commit graph

194 commits

Author SHA1 Message Date
Zack Middleton
729766150f Don't start a vote after vote passed for map change
Processing a callvote command after a vote passed to change maps but
has not been executed yet will result in 1) map change immediately
happening 2) after new map loads players have vote HUD messages but
Game VM doesn't have a vote in progress. The phantom vote status will
only be removed if players start a new vote or run vid_restart.

The underlying issue is that a second callvote sets vote config
strings but a map change is executed before they are sent to clients.
Resulting in clients getting "cs" reliable commands with the config
string changes _after_ the map change. Out of sync config strings.

Even if the underlying issue was fixed, the second vote would be lost.
So it's best to not force a map change to happen immediately anyway.

Reported by Tobias Kuehnhammer.
2017-04-12 18:29:17 -05:00
Simon McVittie
2ab109b772 Avoid 'register' declarations
gcc 6 with -Wall -Wextra warns:

code/botlib/l_precomp.c: In function ‘PC_NameHash’:
code/botlib/l_precomp.c:551:2: warning: ‘register’ is not at beginning of declaration [-Wold-style-declaration]
  int register hash, i;
  ^~~

Modern compilers either ignore the register storage class when
generating code, or generate better code without it, so just remove
most of them.

The remaining uses are in third-party bundled libraries (libjpeg, zlib),
and in a PowerPC-specific inline function consisting of inline
assembler (because I'm not 100% confident that it doesn't have
some practical use there).
2016-11-01 16:37:38 +00:00
Simon McVittie
9c76b546e3 Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
The goal of reproducible builds is that a rebuild of the same source
code with the same compiler, libraries, etc. should result in the same
binaries. SOURCE_DATE_EPOCH provides a standard way for build systems
to fill in the date of the latest source change, typically from a git
commit or from metadata like the debian/changelog in Debian packages.

This does not change anything if SOURCE_DATE_EPOCH is not defined;
the intention is that a larger build system like a Debian package
will define it.

Please see https://reproducible-builds.org/ for more information about
reproducible builds.
2016-09-22 09:02:20 +01:00
Thomas Köppe
3c8da8ca07 [game/ai_main.c] Use floating-point fabs() for floating-point values 2016-08-23 19:36:27 +01:00
Zack Middleton
4474297af8 Fix bot team order to kill last player it killed
Bot's lastkilledplayer was set to -1 after carrying out an ordered kill.
Later in BotChat_Random() the PlayerName function was passed -1 which
caused a "Error: PlayerName: playernum out of range" message.

I think the reason it was set to negative one is so that if the bot is
ordered to kill the player again, the bot will not say it's done and
drop the goal. Though, if the bot killed the player based on it's own
decision, it will just say it's done and drop the goal (bug?).

Let's check the time of the last kill to see if it happened since the
team order was received instead of setting lastkilledplayer to -1
after completing the team ordered kill. This fixes bot dropping goal
if target player was the last player they killed and the PlayerName
out of range error.
2016-07-11 05:20:36 -05:00
Zack Middleton
274fa898b1 Fix typo of empty in ai_main.c 2016-06-27 21:13:27 -05:00
Tobias Kuehnhammer
49ab0cc05e Fix (unused) watertype checks in PM_WaterMove 2015-07-30 19:33:28 -05:00
Zack Middleton
2292bf5bb2 Save bot accompany distance across map change or restart
If a bot is accompanying someone before map change or restart, the bot would
continue accompanying them but press up against them and orbit around them.
This is caused by the bot's formation distance being 0.

Save the formation distance so they maintain proper distance and do not
orbit around the player.
2015-04-30 17:19:00 -05:00
Zack Middleton
f47d148b72 Add a comment about non-functional bot code 2015-03-23 20:36:27 -05:00
Zack Middleton
c4f5176af4 Set bsp_trace_t::surface.flags to surfaceFlags in server and game
Revert last commit so that grapple sky check is compatible with BSPC
BotImport_Trace in (removed from repo) code/bspc/be_aas_bspq3.c.

Set bsp_trace_t::surface.flags instead of surface.value to trace_t::surfaceFlags.
surface.flags is only used for the sky check for grapple AAS reachability.
surface.value is not used at all.

bsp_trace_t is not part of the game VM API, so this does not affect VM compatibility.
BotAI_Trace in game was changed to match server. surface.value/flags are not used in game.
2015-02-18 15:17:57 -06:00
Zack Middleton
daa604ae9b Fix parsing bots in arena info with trailing spaces
q3_ui would shown bot at index of number of bots in list.
game would send empty name to addbot command and command would think skill
(i.e., 2.000000) was the bot name.
2015-01-12 21:28:03 -06:00
Zack Middleton
70e3d61006 Fix cg.intermissionStarted only being enabled at first intermission
Game sets CS_INTERMISSION to 1 at intermission, but does not clear it at
map_restart so it's only sent the first time. CG_MapRestart manually clears
cg.intermissionStarted (which is set to value of CS_INTERMISSION when it's
modified). So subsequent intermissions do not have cg.intermissionStarted
enabled.

Now CS_INTERMISSION is cleared and sent each time intermission is started
and cg.intermissionStarted is enabled each time.

This makes subsequent intermissions not play sounds in CG_CheckLocalSounds
during the 1 second between intermission starting and switching to scoreboard
(PM_INTERMISSION) and makes Team Arena voice chats not play.
2014-12-27 18:32:49 -06:00
Zack Middleton
4463af85fb When player stops following a player, keep view angles
Now player keeps looking the same direction instead of facing somewhere else
which is slightly disorienting.
2014-12-19 22:09:26 -06:00
Zack Middleton
5cf45c5937 Don't use dead view angles after stop following a dead player
If ps.stats[STAT_HEALTH] is less or equal to 0, cgame uses fixed view angles.
When stop following a player, make sure health isn't less or equal to 0.
2014-12-19 22:08:06 -06:00
Zack Middleton
424122c366 Fix bot's teamleader name field being too short
Players using names with 32 to 35 characters could not be recognized as
the team leader.

Reported by Razor.
2014-12-04 16:50:28 -06:00
Zack Middleton
3273df14af Add missing EV_USE_ITEM15 cases
Add EV_USE_ITEM15 to cg_event.c and ai_dmq3.c for consistency.
2014-10-29 00:03:49 -05:00
Tim Angus
f9c202f83e Use correct type for thinktime 2014-09-26 14:29:11 +01:00
Tim Angus
7277d8d6e7 Fix more warnings 2014-09-01 13:03:06 +01:00
Tim Angus
fbdb3e0875 Fix game warnings 2014-09-01 11:09:11 +01:00
Tim Angus
621a72e698 Fix a few warnings 2014-08-30 17:29:23 +01:00
Tobias Kuehnhammer
63463d1bcf Fix compiling game VM with OBSTACLEDEBUG defined 2014-03-24 17:10:24 -05:00
Tequila
baca82d64e Bunch of comment fixes 2014-03-13 02:20:54 +01:00
Ensiform
950dc7254a Fix native trap_BotMutateGoalFuzzyLogic 2014-03-02 22:53:15 -06:00
Zack Middleton
1633ac5b93 Make kamikaze timer loops use level.num_entities instead of MAX_GENTITIES
Optimization. Many other loops use level.num_entities, there was no
special reason that MAX_GENTITIES was used for these.
2013-11-21 02:26:31 -06:00
Zack Middleton
68a616c7f1 Free bot client if cannot load bot
Introduced by commit a57a5cfd9b.
2013-09-08 21:59:58 -05:00
Zack Middleton
b6d64b7dc4 Correct TeamCount return type and team argument type 2013-04-26 15:46:12 -05:00
Ensiform
e7753f9acf Fix vote Y/1 and teamvote Y/1 2013-03-03 21:53:14 -06:00
Zack Middleton
c9137d9d14 Update invalid g_gametype right away 2013-02-11 16:43:18 -06:00
Tobias Kuehnhammer
2147f2b7c2 Adds Z checking to CanDamage function. 2013-02-11 16:02:01 -06:00
Jeremy Davis
617107429d Use Q_strncpyz in G_AddRandomBot 2013-02-02 21:58:01 -06:00
Jeremy Davis
4de32b1c1a Fix error message in BG_EvaluateTrajectory 2013-01-14 14:50:12 -06:00
Jeremy Davis
76f906703e Fix error message in BG_EvaluateTrajectoryDelta 2013-01-14 00:22:57 -06:00
Zack Middleton
45bb0f7b53 Fix bot skill format so it doesn't always have a space at the beginning of it. 2012-12-29 03:35:48 +00:00
Zack Middleton
a57a5cfd9b Changes from Ensiform:
- In G_AddBot, try to allocate clientNum before doing anything else.
- In G_AddBot, don't set SVF_BOT and inuse. It's done in ClientConnect, plus inuse causes ClientDisconnect to be run for no reason.
- In G_AddBot, only set skill in bot useinfo once.
- Avoid using cl->ps.clientNum to check if cl is a bot.
2012-12-29 03:33:00 +00:00
Zack Middleton
b791040f42 - Fix spectator client being switched from follow to free after map_restart if following a client with a higher client number.
- Fix client unlinking issue caused by ent->s.number being set to followed client's ps->clientNum after map_restart. Reported by Ensiform.
2012-12-29 01:45:11 +00:00
Zack Middleton
b785f8a241 Changes suggested by DevHC:
- Remove "!target" checks from tell, vtell, and gc commands. Target was just set, cannot be NULL.
- Validate "order" in gc command before "player id."
2012-11-20 22:51:48 +00:00
Zack Middleton
bf9b5cd7de - Fix up "gc" command, make it more like "tell". Based on patch by Ensiform.
- Add usage messages for gc, tell, vtell, and votell commands.
- Check player names in gc, tell, vtell, and votell commands.
2012-11-18 22:08:58 +00:00
Zack Middleton
1cdb3b33e7 Fix follow command to find clients whose name begins with a number. 2012-11-18 21:55:40 +00:00
Zack Middleton
82f83cd092 Fix some "> MAX_*" to be ">= MAX_*". 2012-11-18 19:09:54 +00:00
Zack Middleton
36c30f6782 Remove initializing "sv_mapname" cvar in game. It's set to "" and never used. 2012-10-29 19:18:06 +00:00
Zack Middleton
02f3664b2e Fix game getting stuck in a do-while loop when "team follow1" or "team follow2" client sends a follownext or followprev command. 2012-09-10 01:22:13 +00:00
Zack Middleton
c65142179f Fix g_warmup < 2 causing client prediction issues (bug #5740). (Reused code for tournament gametype.) 2012-09-09 22:14:15 +00:00
Zack Middleton
e3fc1826b1 Send team info for team overlay to spectators for the team of the client they're following (bug #5740). 2012-09-08 23:19:06 +00:00
Zack Middleton
56ebe14239 Don't have g_teamAutoJoin affect bot's team
Bots set their team later, setting it here causes some bots to change team and die later. Can cause extra skulls to be spawn at beginning of harvester (bug #5740).
2012-09-08 22:32:41 +00:00
Zack Middleton
a3ae0dc5ef Removed a check that was made unnessicary by r1644. 2012-08-24 18:04:44 +00:00
Zack Middleton
9a69b738bf Added MISSIONPACK ifdef around GT_1FCTF code. 2012-08-17 06:18:37 +00:00
Zack Middleton
79bb668a9f Fixed G_LogPrintf format warning on 64 bit systems added in r2294. 2012-07-05 13:42:08 +00:00
Thilo Schulz
56f16e10d6 Various bugfixes by Tobias Kuehnhammer (#5270)
- A stupid bug where bots re-trigger jumppads if they fell onto it.
- A small "memset" bug concerning player animations.
- Reward sounds were never cleared and thus they are played on a map restart.
- Safer and more secure handling of disconnected clients and clients with 
  malformed or illegal info strings.
- first_gauntlet_hit.wav was not played (ops/ps) bug
- capturelimit not hit (from OAX)
2012-07-01 17:27:52 +00:00
Thilo Schulz
ca44693f34 More intelligent exponentiation in strtod/strtol (#5487) - patch by Ben Millwood 2012-07-01 16:43:28 +00:00
Zack Middleton
2db73231eb remove a bunch of superfluous formatting calls
From /dev/humancontroller.
2012-06-19 14:52:22 +00:00