Commit graph

249 commits

Author SHA1 Message Date
Johan Mattsson
c2a0a7d986 Fix memset 2022-02-05 13:27:42 +00:00
Zack Middleton
359db19619 Restore bots crushing unseen player on q3tourney6 in non-CTF
The affect of my 2017 commit c3e64d3806

    "Make bots only use q3tourney6 crusher to kill their enemy"

made it easier to beat the last map of the Quake 3 single player
campaign. It was mainly intended for CTF and Team Arena gametypes
variants of the map. (Team deathmatch is usually treated as deathmatch
with teams rather than an actual team based gametype.)

Restore original difficulty for non-CTF/Team Arena gametypes; bot will
crush player even if bot hasn't seen the player since either they or
player respawned. [This is not good in CTF where all five bots on the
team suddenly flip around and shoot at the crusher trigger.]

Team deathmatch still uses my added behavior of not triggering crusher
if there is a teammate under the crusher.
2021-02-27 00:26:03 -05:00
Zack Middleton
a6e66700e1 Fix duplicate team join center print for bots and g_teamAutoJoin
My 2017 commit f7c3276 ("Fix g_teamAutoJoin and g_teamForceBalance")
caused BroadcastTeamChange() to be run an extra time when bots connect.
This caused a duplicate center print message to be sent to all clients.

g_teamAutoJoin 1 sent an extra center print when any player or bot
connects. Though that is the original behavior from Team Arena.

Team set during connection no longer sends broadcast as it will be
sent later in ClientConnect().

Reported by Pascal Brochart (pbrochart) as causing clients to be
kicked due to server command overflow if many bots join at the
same time.
2019-11-16 01:38:38 -06:00
Zack Middleton
e4208cf5a7 Improve finding obelisk entitynum for bot AI
BotSetEntityNumForGoal() was checking all entities that are not
team_redobelisk (which is the obelisk visual entity) to find the
untitled obelisk collision entity. This may fail in rare cases where
there is an another entity within 10 units of the obelisk origin.
Failing to find the correct entity may cause bots to not attack the
obelisk.

Instead add BotSetEntityNumForGoalWithActivator() for looking for the
obelisk collision entity by activator classname (team_redobelisk) which
should be less likely to find the wrong entity.

This doesn't affect official Team Arena maps (unknown if it affects any
others).

Reversed strcmp check was reported by Thomas Köppe.
2018-09-12 16:26:39 -05:00
Zack Middleton
51743bbb01 Improvements for dedicated camera followers (team follow1/2)
Switching to dedicated camera follower with no possible players to
follow would spawn at the intermission point and display "connection
interrupted" HUD message. Pmove() was not run for the client so
ps.commandTime was too far behind. I made it so that dedicated camera
followers and scoreboard run Pmove() but cannot move (PM_FREEZE).

When all players possible to follow leave, the dedicated camera follower
would continue to display the old player state of the player they were
following (along with "connection interrupted" HUD message). Unlike the
regular case of a spectator following a specific player, dedicated
camera followers did not reset their player state to the intermission
point after the followed player was no longer valid.

Now a client can be set as 'team follow1' to automatically switch
between displaying the intermission point and following a player when
possible.
2018-05-01 21:25:14 -05:00
IR4T4
9b2df26024 Fix array index in CanDamage() function - discovered by MARTY
The wrong array element was accessed. However the correct element is the
same value so fixing it does not affect gameplay.
2018-04-26 11:31:07 -05:00
Zack Middleton
0b6d97f849 Fix negative frag/capturelimit causing an infinite map end loop
Reported by @vloup.
2018-02-04 10:37:39 -06:00
Zack Middleton
0822772ea2 Fix timelimit causing an infinite map ending loop
A negative timelimit value or a value that would overflow the
multiplication by 60000 caused an endless map change/reload.

Based on patch and description by @vloup.
2018-02-04 09:00:08 -06:00
David CARLIER
c904f6d4aa fix a few potential buffer overwrite in Game VM 2017-12-16 12:51:34 -06:00
Zack Middleton
bad8c3ba4e Fix GCC 6 misleading-indentation warning 2017-12-03 05:51:40 -06:00
Edward Betts
fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Zack Middleton
690c5a4dac Don't send team overlay info to bots 2017-10-09 02:34:22 -05:00
Zack Middleton
815c898bf5 Don't redefine MAX_PATH in bot code 2017-10-04 22:13:50 -05:00
Zack Middleton
51e9aa2df0 Fix hit accuracy stats for lightning gun and shotgun kills
If a lightning bolt killed a player or the first shotgun pellet that
hit a player killed them, the shot was not counted as accurate.

Check if shot player is alive for hit accuracy before dealing damage.
2017-09-29 18:54:57 -05:00
Zack Middleton
c3e64d3806 Make bots only use q3tourney6 crusher to kill their enemy
Only use the crusher for killing the bot's enemy. This doesn't
affect 1v1 very much but prevents the whole team of bots in CTF
from suddenly shooting at the crusher button. Entering the crusher
bounds was basically instant death.
2017-08-28 21:46:58 -05:00
Zack Middleton
ad1d0e616e Make bots use crusher on other q3tourney6 maps
Make bots activate crusher on q3tourney6_ctf and mpq3tourney6.

Check if player is inside the crush bounds instead of below the
crusher. There is a jumppad the goes under it in mpq3tourney6.
2017-08-28 21:46:57 -05:00
Zack Middleton
e793c0c37c Fix crash when pmove_msec is 0
When pmove_fixed is set to 1, setting pmove_msec to 0 would crash.
2017-08-19 01:42:38 -05:00
Zack Middleton
9736e7ff91 Fix compiling Cmd_CallTeamVote_f 2017-08-09 19:19:59 -05:00
Zack Middleton
3f267728c3 Remove newlines from chat messages in Game VM
This has no affect due to ioquake3 engine already removing command
separators (which includes newlines) in Cmd_Args_Sanitize().
2017-08-09 18:41:26 -05:00
Zack Middleton
f0b74a27c9 Check for all command separators in callTeamVote
Make callTeamVote check for all command separators like in callVote.
It's not exploitable as the only vote option (leader) always uses an
integer argument.

Also the ioquake3 engine remove command separators from client game
commands in Cmd_Args_Sanitize().
2017-08-09 18:37:18 -05:00
Zack Middleton
0bce5463f7 Add spawnflags to QUAKED for trigger_multiple 2017-08-09 17:47:33 -05:00
Zack Middleton
c05fbe554e Make warmup in Team Deathmatch wait for players to join both teams
Reported by Cyrax.
2017-07-31 15:24:15 -05:00
Zack Middleton
39716745f9 Silence g_util.c warning about set but not read variable
Probably caused by my commit on June 2 2017.

  commit 4006358492
  Fix spawn/freed entity logic (specifically harvester skulls)
2017-07-28 17:36:20 -05:00
Zack Middleton
5f2e4a03c5 Add score bonus for defending the flag carrier in 1 Flag CTF
Set flag_pw to neutral flag instead of using CTF value for red or
blue flag so that flag carrier is detected correctly.
2017-07-14 19:06:43 -05:00
Zack Middleton
13831f9569 Restore not giving defense score bonus to flag carrier
The Team Arena code for giving defense bonus for fragging player
who recently damaged a skull carrier unintentionally applied to
the flag carrier.

The skull carrier case would of been handled by the flag carrier
block above it. However, Harvest mode doesn't call
Team_CheckHurtCarrier() so the skull carrier defense bonus does
not work.

This restores the pre-Team Arena behavior of not giving defense
score bonus to flag carrier.
2017-07-14 19:06:43 -05:00
Zack Middleton
c8db6c55e5 Fix score bonus for defending the flag carrier in CTF
Fix copy-paste error in the original Quake 3 code. The wrong values
are used for v1 and v2. v2 was previously set to distance of attacker
to flag base; which should be handled already.

The game now gives defense score bonus to player when they frag an
enemy near their team's flag carrier while the player is more than
1000 units from the flag carrier.

This may also fix not giving defense bonus when near carrier due to
checking if carrier and enemy (instead of attacker) are in PVS.

Found by @Razish.
2017-07-14 19:06:43 -05:00
Zack Middleton
b984dd4a23 Add range check for bot skill in addbot command
Adding a bot with skill of 0 doesn't show icon on hud.
2017-06-29 19:43:37 -05:00
Zack Middleton
cabc32362c Don't pick duplicate random bots until all bot types are added
Don't add the same bot to multiple teams until there are as many
bots on the server as there are bot types.

Previously each team would have unique bots until all bot types
were added to the team but other teams may have the same bot. Now
there will not be any duplicate bots until there are more bots than
bot types.

Now Quake 3 (32 bot types) in 16 vs 16 bot CTF will not contain
duplicate bot types. (You have to increase memory in code/game/
g_mem.c in order to add 32 bots though.)

I had to change G_AddRandomBot() to use 'addbot random' or else the
same bot could be added to red and blue teams. The bot was selected
and stored in console command buffer so game doesn't know not to
select the bot again.
2017-06-29 19:41:17 -05:00
Zack Middleton
0999aff28d Fix duplicate (delayed) random bots being choosen
Count delayed bots when looking for least used bot infos for deciding
which bot to add.
2017-06-29 19:41:17 -05:00
Zack Middleton
d8f2ff7a4b Check delayed bot's team when counting bots for bot_minplayers
note: This requires my previous commit that added teampref userinfo
so that bots choose correct team in ClientConnect.
2017-06-29 19:41:17 -05:00
Zack Middleton
7c601da651 Fix not adding random bot when all bot info are in use on team
If there are two bot infos in scripts/bots.txt then each team can
only add two random bots via bot_minplayers or addbot random.

Pick random bot info from least used bot infos instead of only ones
that are used by zero players. That way a random bot can always be
added to the game.

This rarely affected Quake 3 since there is 32 bot infos. It could
easily affect new games though.
2017-06-29 19:41:16 -05:00
Zack Middleton
d0d1fe1b7c Fix bot_minplayers passing delay as team to addbot in non-team gametypes 2017-06-29 19:41:16 -05:00
Zack Middleton
51649695a5 Fix random bot not looking for bots by funname
Quake 3's Anarki bot has a 'funname' with colors in it.
This commit fixes Anarki not being detected as in use.
2017-06-29 19:41:16 -05:00
Zack Middleton
23a331c9f8 Make 'addbot random' command select a random bot info
It reuses the random bot selection code for bot_minplayers cvar.
2017-06-29 19:41:16 -05:00
Zack Middleton
007e250e11 Split G_AddRandomBot into multiple functions 2017-06-29 17:52:06 -05:00
Zack Middleton
03336dd0bf Allow spectators to use noclip cheat 2017-06-24 20:27:24 -05:00
Zack Middleton
f19efb77c8 Fix Team Arena team base models not dropping to floor
Team Arena's Overload gametype has red and blue team Obelisk base
objects. It uses separate entities for visual and damage. Only the
damageable entity was dropped to floor. Leaving model floating off
the ground.

Team Arena's Harvester base has the same problem. Model entity
floats in air but trigger entity drops to floor.

Drop all Team Arena team base models to floor. Fixes CTF, 1Flag,
Overload, and Harvester base models.
2017-06-24 20:15:02 -05:00
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
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
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