Commit graph

210 commits

Author SHA1 Message Date
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
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
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
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
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
Zack Middleton
2c225a5a2b Merge pull request #199 from UniQP/typos
Fix some typos in comments
2017-05-24 13:41:15 -05:00
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
Sebastian Buchwald
5eae6de2f4 Fix some typos in comments 2016-07-26 14:43:41 +02: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