mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-30 07:41:16 +00:00
eb9fe030c4
################################################################################ This Patch fixes: ################################################################################ - The "fraglimit warning" was not played at all, if on the blue team. - The "where" console command was broken. - Obelisk explosion wasn't drawn if no Rocketlauncher was loaded. - Impact marks sometimes didn't draw at all. - IMPORTANT BUGFIX: No killing for cheaters with Lightning gun and Gauntlet. - If two doors are close to each other a spectator couldn't fly through them. - More robust, efficient and logical respawning routine. NOTE: The game.qvm will get notable smaller and will use LESS MEMORY! - Drowning sounds are fixed. Now they are played as intended. (as the id comment in the source code shows). - Some AI bugs (OVERFLOW!) in the bot movement code. - Several "Team Arena" Overload and Harvester bugs. - Stops bots from attacking a team mate (player) who only changed teams. - Some voice chats and CTF commands fixed. - "Team_ReturnFlag" was called twice, which did wired things sometimes. NOTE: (G_RunItem checks CONTENTS_NODROP already!) - A bugfix for Gauntlet animation. - Incorrect CTF scoring. - A bunch of corrected comments and print lines ("\n"). - Some regularity of expression and some small trivial bugs. ################################################################################ Details: ################################################################################ ******************************************************************************** BUG: in gamemode GT_TEAM the fraglimit warning will not be played if joining the blue team! -------------------------------------------------------------------------------- Solution: In "CG_CheckLocalSounds": if cgs.scores2 > highScore, highScore should be cgs.scores2. ******************************************************************************** BUG: the "where" console command doesn't work as expected (it's always 0 0 0) but not in id Quake 3 Arena. It seems that now Ioquake3 is affected! -------------------------------------------------------------------------------- Solution: In Function "Cmd_Where_f" ent->s.origin should be ent->r.currentOrigin. ******************************************************************************** BUG: in gamemode GT_OBELISK obelisk explosion won't be drawn if there is no Rocketlauncher loaded. (The "maps without Rocketlauncher" bug) -------------------------------------------------------------------------------- Solution: in "cg_main.c": cgs.media.rocketExplosionShader should be registered if gamemode is GT_OBELISK. ******************************************************************************** BUG: Impact marks sometimes doesn't draw at all. Not easy to reproduce if you don't play (io)Quake3 every day and know the places where it happens! ;) But anyway... Test: start q3dm12 go to "Long Jump Canyon" (where the small platform teleporter for the BFG is) place yourself at the point where the railgun spawns, look in the direction where the red suspended armor is. Now shoot at the sloped wall on the out/leftside of the door you see. (the sloped wall should be nearly in the center of your screen now). If you choose the correct brush face and shoot up and down at this brush face, the impact marks sometimes aren't visible. There are hundreds of custom maps where this can happen! -------------------------------------------------------------------------------- Solution: I replaced the function "SnapVectorTowards" with the one from "Wolfenstein - Enemy Territory (GPL Source Code)" ******************************************************************************** BUG: Normally "NOCLIP" cheaters are logically not allowed to fire a gun. Unfortunatly the Gauntlet (and Lightning gun) was forgotten and not restricted to that. All weapons except those two were handled correct. -------------------------------------------------------------------------------- Solution: Make Gauntlet and Lightning gun not firing for someone who cheats with "NOCLIP" (like all other weapons). ******************************************************************************** NOTE: A few bugfixes are not mine and are reported here: http://www.quake3world.com/forum/viewtopic.php?f=16&t=9179. Thanks to Quake3world, for all those years and the good guys there! ******************************************************************************** BUG: During making a mod I found a very strange bug, which mainly occurs if someone tries to implement a lot of singleplayer monsters which should walk slowly (like the "Crash" bot). So if someone wants to make slow down bots or monsters when they are walking towards a goal and alter the function "BotMoveInGoalArea" then the bots/monsters do stupid things. Otherwise and this is the default (also buggy) behavior they start running although they shouldn't (as seen with the "Crash" bot and will not be fixed here). -------------------------------------------------------------------------------- Solution: Fix overflow in bot user command. BUGFIX from "Hunt" mod by J. Hoffman. ******************************************************************************** BUG: in function "BotMoveToGoal" the special elevator case doesn't make sense. -------------------------------------------------------------------------------- Solution: in "be_ai_move.c": ((result->flags & MOVERESULT_ONTOPOF_FUNCBOB) || (result->flags & MOVERESULT_ONTOPOF_FUNCBOB)) should be ((result->flags & MOVERESULT_ONTOPOF_ELEVATOR) || (result->flags & MOVERESULT_ONTOPOF_FUNCBOB)). ******************************************************************************** BUG: in function "BotWantsToRetreat" and "BotWantsToChase" this is wrong: "(bs->enemy != redobelisk.entitynum || bs->enemy != blueobelisk.entitynum)" -------------------------------------------------------------------------------- Solution: "... redobelisk.entitynum) && (bs->enemy != blueobelisk.." is correct. ******************************************************************************** BUG: in gamemode GT_OBELISK there are too many node switches for bots (test: mpq3tourney6 with many bots). If that happens, game becomes unplayable. I don't know if this is the best solution but here it is: -------------------------------------------------------------------------------- Solution: In function "AINode_Battle_Fight" right after: if (!BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)) { I added this: #ifdef MISSIONPACK if (bs->enemy == redobelisk.entitynum || bs->enemy == blueobelisk.entitynum) { AIEnter_Battle_Chase(bs, "battle fight: obelisk out of sight"); return qfalse; } #endif ******************************************************************************** BUG: in gamemode >= GT_TEAM, after team change, bots will (sometimes) not stop shooting at you, although you are on their team now. It seems that the configstrings are f***** up or not reliable in this case! -------------------------------------------------------------------------------- Solution: In function "BotTeam" and "BotSameTeam" get the real team values. ******************************************************************************** BUG: Some of the bots voice commands are wrong. They are commanded to attack the enemy base but they say "Okay, I will defend!" -------------------------------------------------------------------------------- Solution: Corrected some voice commands in "BotCTFOrders_FlagNotAtBase" and "Bot1FCTFOrders_EnemyDroppedFlag" ******************************************************************************** BUG: Spectators couldn't fly through doors if they are very close to each other. You can test it with some regular id maps (q3dm14, q3dm12) but there are also many custom maps where this can happen! This is annoying because in the worst case you can't move at all and are caught inside a door. -------------------------------------------------------------------------------- Solution: There is a solution in a mod called "Hunt" by J. Hoffman. Bugfix is included in this patch! ******************************************************************************** BUG: During making a mod I found it very hard to implement some of my ideas (something like "Limbo" or "Meeting") because of the way the player spawn effect, intermission and spawning on victory pads is handled. I reworked it a bit and simplified it so that the effect is handled when a client respawns (as the name says) and not when a client begins. I think this will help more mod makers everytime they want to make changes to spawning of players, bots on victory pads or monsters... and want to avoid spectators with Machineguns which can kill and score... :() NOTE: I also renamed the poorly named function "respawn" to "ClientRespawn". If someone searches the code base for "respawn" it was really hard to find the correct place for what was meant. "respawn" is used so often, that you really get headache ... now with "ClientRespawn" it's easier! IMPORTANT: The whole respawning, moving to intermission point and everything related to that is now done in a more reliable way without changing the default behavior. (How critical the whole spwaning mess was did you see by yourself (ioquake3 rev. 2076). With this patch it's safer. Trust me, I spent hours of fixing silly problems... -------------------------------------------------------------------------------- Solution: Simplified "ClientBegin" and moved the teleport event to "ClientSpawn". ******************************************************************************** BUG: If a player is dying or hurted under water the hurt/dying sounds AND the drowning sounds are played together. This is silly. Moreover it's no good idea to let the server play client sounds! There was a solution in a mod called "Q3A++" by Dan 'Neurobasher' Gomes which fixes the problem. -------------------------------------------------------------------------------- Solution: Created a "CG_WaterLevel" function to play the appropriate sounds. ******************************************************************************** ################################################################################
1227 lines
34 KiB
C
1227 lines
34 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
|
|
This file is part of Quake III Arena source code.
|
|
|
|
Quake III Arena source code is free software; you can redistribute it
|
|
and/or modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2 of the License,
|
|
or (at your option) any later version.
|
|
|
|
Quake III Arena source code is distributed in the hope that it will be
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Quake III Arena source code; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
//
|
|
|
|
/*****************************************************************************
|
|
* name: ai_chat.c
|
|
*
|
|
* desc: Quake3 bot AI
|
|
*
|
|
* $Archive: /MissionPack/code/game/ai_chat.c $
|
|
*
|
|
*****************************************************************************/
|
|
|
|
#include "g_local.h"
|
|
#include "../botlib/botlib.h"
|
|
#include "../botlib/be_aas.h"
|
|
#include "../botlib/be_ea.h"
|
|
#include "../botlib/be_ai_char.h"
|
|
#include "../botlib/be_ai_chat.h"
|
|
#include "../botlib/be_ai_gen.h"
|
|
#include "../botlib/be_ai_goal.h"
|
|
#include "../botlib/be_ai_move.h"
|
|
#include "../botlib/be_ai_weap.h"
|
|
//
|
|
#include "ai_main.h"
|
|
#include "ai_dmq3.h"
|
|
#include "ai_chat.h"
|
|
#include "ai_cmd.h"
|
|
#include "ai_dmnet.h"
|
|
//
|
|
#include "chars.h" //characteristics
|
|
#include "inv.h" //indexes into the inventory
|
|
#include "syn.h" //synonyms
|
|
#include "match.h" //string matching types and vars
|
|
|
|
// for the voice chats
|
|
#ifdef MISSIONPACK
|
|
#include "../../ui/menudef.h"
|
|
#endif
|
|
|
|
#define TIME_BETWEENCHATTING 25
|
|
|
|
|
|
/*
|
|
==================
|
|
BotNumActivePlayers
|
|
==================
|
|
*/
|
|
int BotNumActivePlayers(void) {
|
|
int i, num;
|
|
char buf[MAX_INFO_STRING];
|
|
static int maxclients;
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
num = 0;
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//
|
|
num++;
|
|
}
|
|
return num;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotIsFirstInRankings
|
|
==================
|
|
*/
|
|
int BotIsFirstInRankings(bot_state_t *bs) {
|
|
int i, score;
|
|
char buf[MAX_INFO_STRING];
|
|
static int maxclients;
|
|
playerState_t ps;
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
score = bs->cur_ps.persistant[PERS_SCORE];
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//
|
|
BotAI_GetClientState(i, &ps);
|
|
if (score < ps.persistant[PERS_SCORE]) return qfalse;
|
|
}
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotIsLastInRankings
|
|
==================
|
|
*/
|
|
int BotIsLastInRankings(bot_state_t *bs) {
|
|
int i, score;
|
|
char buf[MAX_INFO_STRING];
|
|
static int maxclients;
|
|
playerState_t ps;
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
score = bs->cur_ps.persistant[PERS_SCORE];
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//
|
|
BotAI_GetClientState(i, &ps);
|
|
if (score > ps.persistant[PERS_SCORE]) return qfalse;
|
|
}
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotFirstClientInRankings
|
|
==================
|
|
*/
|
|
char *BotFirstClientInRankings(void) {
|
|
int i, bestscore, bestclient;
|
|
char buf[MAX_INFO_STRING];
|
|
static char name[32];
|
|
static int maxclients;
|
|
playerState_t ps;
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
bestscore = -999999;
|
|
bestclient = 0;
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//
|
|
BotAI_GetClientState(i, &ps);
|
|
if (ps.persistant[PERS_SCORE] > bestscore) {
|
|
bestscore = ps.persistant[PERS_SCORE];
|
|
bestclient = i;
|
|
}
|
|
}
|
|
EasyClientName(bestclient, name, 32);
|
|
return name;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotLastClientInRankings
|
|
==================
|
|
*/
|
|
char *BotLastClientInRankings(void) {
|
|
int i, worstscore, bestclient;
|
|
char buf[MAX_INFO_STRING];
|
|
static char name[32];
|
|
static int maxclients;
|
|
playerState_t ps;
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
worstscore = 999999;
|
|
bestclient = 0;
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//
|
|
BotAI_GetClientState(i, &ps);
|
|
if (ps.persistant[PERS_SCORE] < worstscore) {
|
|
worstscore = ps.persistant[PERS_SCORE];
|
|
bestclient = i;
|
|
}
|
|
}
|
|
EasyClientName(bestclient, name, 32);
|
|
return name;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotRandomOpponentName
|
|
==================
|
|
*/
|
|
char *BotRandomOpponentName(bot_state_t *bs) {
|
|
int i, count;
|
|
char buf[MAX_INFO_STRING];
|
|
int opponents[MAX_CLIENTS], numopponents;
|
|
static int maxclients;
|
|
static char name[32];
|
|
|
|
if (!maxclients)
|
|
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
|
|
numopponents = 0;
|
|
opponents[0] = 0;
|
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
if (i == bs->client) continue;
|
|
//
|
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
|
//if no config string or no name
|
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
|
//skip spectators
|
|
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
|
|
//skip team mates
|
|
if (BotSameTeam(bs, i)) continue;
|
|
//
|
|
opponents[numopponents] = i;
|
|
numopponents++;
|
|
}
|
|
count = random() * numopponents;
|
|
for (i = 0; i < numopponents; i++) {
|
|
count--;
|
|
if (count <= 0) {
|
|
EasyClientName(opponents[i], name, sizeof(name));
|
|
return name;
|
|
}
|
|
}
|
|
EasyClientName(opponents[0], name, sizeof(name));
|
|
return name;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotMapTitle
|
|
==================
|
|
*/
|
|
|
|
char *BotMapTitle(void) {
|
|
char info[1024];
|
|
static char mapname[128];
|
|
|
|
trap_GetServerinfo(info, sizeof(info));
|
|
|
|
strncpy(mapname, Info_ValueForKey( info, "mapname" ), sizeof(mapname)-1);
|
|
mapname[sizeof(mapname)-1] = '\0';
|
|
|
|
return mapname;
|
|
}
|
|
|
|
|
|
/*
|
|
==================
|
|
BotWeaponNameForMeansOfDeath
|
|
==================
|
|
*/
|
|
|
|
char *BotWeaponNameForMeansOfDeath(int mod) {
|
|
switch(mod) {
|
|
case MOD_SHOTGUN: return "Shotgun";
|
|
case MOD_GAUNTLET: return "Gauntlet";
|
|
case MOD_MACHINEGUN: return "Machinegun";
|
|
case MOD_GRENADE:
|
|
case MOD_GRENADE_SPLASH: return "Grenade Launcher";
|
|
case MOD_ROCKET:
|
|
case MOD_ROCKET_SPLASH: return "Rocket Launcher";
|
|
case MOD_PLASMA:
|
|
case MOD_PLASMA_SPLASH: return "Plasmagun";
|
|
case MOD_RAILGUN: return "Railgun";
|
|
case MOD_LIGHTNING: return "Lightning Gun";
|
|
case MOD_BFG:
|
|
case MOD_BFG_SPLASH: return "BFG10K";
|
|
#ifdef MISSIONPACK
|
|
case MOD_NAIL: return "Nailgun";
|
|
case MOD_CHAINGUN: return "Chaingun";
|
|
case MOD_PROXIMITY_MINE: return "Proximity Launcher";
|
|
case MOD_KAMIKAZE: return "Kamikaze";
|
|
case MOD_JUICED: return "Prox mine";
|
|
#endif
|
|
case MOD_GRAPPLE: return "Grapple";
|
|
default: return "[unknown weapon]";
|
|
}
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotRandomWeaponName
|
|
==================
|
|
*/
|
|
char *BotRandomWeaponName(void) {
|
|
int rnd;
|
|
|
|
#ifdef MISSIONPACK
|
|
rnd = random() * 11.9;
|
|
#else
|
|
rnd = random() * 8.9;
|
|
#endif
|
|
switch(rnd) {
|
|
case 0: return "Gauntlet";
|
|
case 1: return "Shotgun";
|
|
case 2: return "Machinegun";
|
|
case 3: return "Grenade Launcher";
|
|
case 4: return "Rocket Launcher";
|
|
case 5: return "Plasmagun";
|
|
case 6: return "Railgun";
|
|
case 7: return "Lightning Gun";
|
|
#ifdef MISSIONPACK
|
|
case 8: return "Nailgun";
|
|
case 9: return "Chaingun";
|
|
case 10: return "Proximity Launcher";
|
|
#endif
|
|
default: return "BFG10K";
|
|
}
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotVisibleEnemies
|
|
==================
|
|
*/
|
|
int BotVisibleEnemies(bot_state_t *bs) {
|
|
float vis;
|
|
int i;
|
|
aas_entityinfo_t entinfo;
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
if (i == bs->client) continue;
|
|
//
|
|
BotEntityInfo(i, &entinfo);
|
|
//
|
|
if (!entinfo.valid) continue;
|
|
//if the enemy isn't dead and the enemy isn't the bot self
|
|
if (EntityIsDead(&entinfo) || entinfo.number == bs->entitynum) continue;
|
|
//if the enemy is invisible and not shooting
|
|
if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) {
|
|
continue;
|
|
}
|
|
//if on the same team
|
|
if (BotSameTeam(bs, i)) continue;
|
|
//check if the enemy is visible
|
|
vis = BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, i);
|
|
if (vis > 0) return qtrue;
|
|
}
|
|
return qfalse;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotValidChatPosition
|
|
==================
|
|
*/
|
|
int BotValidChatPosition(bot_state_t *bs) {
|
|
vec3_t point, start, end, mins, maxs;
|
|
bsp_trace_t trace;
|
|
|
|
//if the bot is dead all positions are valid
|
|
if (BotIsDead(bs)) return qtrue;
|
|
//never start chatting with a powerup
|
|
if (bs->inventory[INVENTORY_QUAD] ||
|
|
bs->inventory[INVENTORY_ENVIRONMENTSUIT] ||
|
|
bs->inventory[INVENTORY_HASTE] ||
|
|
bs->inventory[INVENTORY_INVISIBILITY] ||
|
|
bs->inventory[INVENTORY_REGEN] ||
|
|
bs->inventory[INVENTORY_FLIGHT]) return qfalse;
|
|
//must be on the ground
|
|
//if (bs->cur_ps.groundEntityNum != ENTITYNUM_NONE) return qfalse;
|
|
//do not chat if in lava or slime
|
|
VectorCopy(bs->origin, point);
|
|
point[2] -= 24;
|
|
if (trap_PointContents(point,bs->entitynum) & (CONTENTS_LAVA|CONTENTS_SLIME)) return qfalse;
|
|
//do not chat if under water
|
|
VectorCopy(bs->origin, point);
|
|
point[2] += 32;
|
|
if (trap_PointContents(point,bs->entitynum) & MASK_WATER) return qfalse;
|
|
//must be standing on the world entity
|
|
VectorCopy(bs->origin, start);
|
|
VectorCopy(bs->origin, end);
|
|
start[2] += 1;
|
|
end[2] -= 10;
|
|
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, mins, maxs);
|
|
BotAI_Trace(&trace, start, mins, maxs, end, bs->client, MASK_SOLID);
|
|
if (trace.ent != ENTITYNUM_WORLD) return qfalse;
|
|
//the bot is in a position where it can chat
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_EnterGame
|
|
==================
|
|
*/
|
|
int BotChat_EnterGame(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
BotAI_BotInitialChat(bs, "game_enter",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_ExitGame
|
|
==================
|
|
*/
|
|
int BotChat_ExitGame(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
//
|
|
BotAI_BotInitialChat(bs, "game_exit",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_StartLevel
|
|
==================
|
|
*/
|
|
int BotChat_StartLevel(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (BotIsObserver(bs)) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) {
|
|
trap_EA_Command(bs->client, "vtaunt");
|
|
return qfalse;
|
|
}
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
BotAI_BotInitialChat(bs, "level_start",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_EndLevel
|
|
==================
|
|
*/
|
|
int BotChat_EndLevel(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (BotIsObserver(bs)) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
// teamplay
|
|
if (TeamPlayIsOn())
|
|
{
|
|
if (BotIsFirstInRankings(bs)) {
|
|
trap_EA_Command(bs->client, "vtaunt");
|
|
}
|
|
return qtrue;
|
|
}
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
//
|
|
if (BotIsFirstInRankings(bs)) {
|
|
BotAI_BotInitialChat(bs, "level_end_victory",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
"[invalid var]", // 2
|
|
BotLastClientInRankings(), // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
}
|
|
else if (BotIsLastInRankings(bs)) {
|
|
BotAI_BotInitialChat(bs, "level_end_lose",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
BotFirstClientInRankings(), // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
}
|
|
else {
|
|
BotAI_BotInitialChat(bs, "level_end",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
BotFirstClientInRankings(), // 2
|
|
BotLastClientInRankings(), // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
}
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_Death
|
|
==================
|
|
*/
|
|
int BotChat_Death(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_DEATH, 0, 1);
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chatting is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
//
|
|
if (bs->lastkilledby >= 0 && bs->lastkilledby < MAX_CLIENTS)
|
|
EasyClientName(bs->lastkilledby, name, 32);
|
|
else
|
|
strcpy(name, "[world]");
|
|
//
|
|
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledby)) {
|
|
if (bs->lastkilledby == bs->client) return qfalse;
|
|
BotAI_BotInitialChat(bs, "death_teammate", name, NULL);
|
|
bs->chatto = CHAT_TEAM;
|
|
}
|
|
else
|
|
{
|
|
//teamplay
|
|
if (TeamPlayIsOn()) {
|
|
trap_EA_Command(bs->client, "vtaunt");
|
|
return qtrue;
|
|
}
|
|
//
|
|
if (bs->botdeathtype == MOD_WATER)
|
|
BotAI_BotInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL);
|
|
else if (bs->botdeathtype == MOD_SLIME)
|
|
BotAI_BotInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL);
|
|
else if (bs->botdeathtype == MOD_LAVA)
|
|
BotAI_BotInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL);
|
|
else if (bs->botdeathtype == MOD_FALLING)
|
|
BotAI_BotInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL);
|
|
else if (bs->botsuicide || //all other suicides by own weapon
|
|
bs->botdeathtype == MOD_CRUSH ||
|
|
bs->botdeathtype == MOD_SUICIDE ||
|
|
bs->botdeathtype == MOD_TARGET_LASER ||
|
|
bs->botdeathtype == MOD_TRIGGER_HURT ||
|
|
bs->botdeathtype == MOD_UNKNOWN)
|
|
BotAI_BotInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL);
|
|
else if (bs->botdeathtype == MOD_TELEFRAG)
|
|
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
|
|
#ifdef MISSIONPACK
|
|
else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "death_kamikaze"))
|
|
BotAI_BotInitialChat(bs, "death_kamikaze", name, NULL);
|
|
#endif
|
|
else {
|
|
if ((bs->botdeathtype == MOD_GAUNTLET ||
|
|
bs->botdeathtype == MOD_RAILGUN ||
|
|
bs->botdeathtype == MOD_BFG ||
|
|
bs->botdeathtype == MOD_BFG_SPLASH) && random() < 0.5) {
|
|
|
|
if (bs->botdeathtype == MOD_GAUNTLET)
|
|
BotAI_BotInitialChat(bs, "death_gauntlet",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
else if (bs->botdeathtype == MOD_RAILGUN)
|
|
BotAI_BotInitialChat(bs, "death_rail",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
else
|
|
BotAI_BotInitialChat(bs, "death_bfg",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
}
|
|
//choose between insult and praise
|
|
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
|
|
BotAI_BotInitialChat(bs, "death_insult",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
}
|
|
else {
|
|
BotAI_BotInitialChat(bs, "death_praise",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
}
|
|
}
|
|
bs->chatto = CHAT_ALL;
|
|
}
|
|
bs->lastchat_time = FloatTime();
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_Kill
|
|
==================
|
|
*/
|
|
int BotChat_Kill(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1);
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chat is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (bs->lastkilledplayer == bs->client) return qfalse;
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
if (BotVisibleEnemies(bs)) return qfalse;
|
|
//
|
|
EasyClientName(bs->lastkilledplayer, name, 32);
|
|
//
|
|
bs->chatto = CHAT_ALL;
|
|
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledplayer)) {
|
|
BotAI_BotInitialChat(bs, "kill_teammate", name, NULL);
|
|
bs->chatto = CHAT_TEAM;
|
|
}
|
|
else
|
|
{
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) {
|
|
trap_EA_Command(bs->client, "vtaunt");
|
|
return qfalse; // don't wait
|
|
}
|
|
//
|
|
if (bs->enemydeathtype == MOD_GAUNTLET) {
|
|
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
|
|
}
|
|
else if (bs->enemydeathtype == MOD_RAILGUN) {
|
|
BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
|
|
}
|
|
else if (bs->enemydeathtype == MOD_TELEFRAG) {
|
|
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
|
|
}
|
|
#ifdef MISSIONPACK
|
|
else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "kill_kamikaze"))
|
|
BotAI_BotInitialChat(bs, "kill_kamikaze", name, NULL);
|
|
#endif
|
|
//choose between insult and praise
|
|
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
|
|
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
|
|
}
|
|
else {
|
|
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
|
|
}
|
|
}
|
|
bs->lastchat_time = FloatTime();
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_EnemySuicide
|
|
==================
|
|
*/
|
|
int BotChat_EnemySuicide(bot_state_t *bs) {
|
|
char name[32];
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
//
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENEMYSUICIDE, 0, 1);
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chat is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
}
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
if (BotVisibleEnemies(bs)) return qfalse;
|
|
//
|
|
if (bs->enemy >= 0) EasyClientName(bs->enemy, name, 32);
|
|
else strcpy(name, "");
|
|
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_HitTalking
|
|
==================
|
|
*/
|
|
int BotChat_HitTalking(bot_state_t *bs) {
|
|
char name[32], *weap;
|
|
int lasthurt_client;
|
|
float rnd;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
lasthurt_client = g_entities[bs->client].client->lasthurt_client;
|
|
if (!lasthurt_client) return qfalse;
|
|
if (lasthurt_client == bs->client) return qfalse;
|
|
//
|
|
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse;
|
|
//
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1);
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chat is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd * 0.5) return qfalse;
|
|
}
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
|
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
|
|
//
|
|
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_HitNoDeath
|
|
==================
|
|
*/
|
|
int BotChat_HitNoDeath(bot_state_t *bs) {
|
|
char name[32], *weap;
|
|
float rnd;
|
|
int lasthurt_client;
|
|
aas_entityinfo_t entinfo;
|
|
|
|
lasthurt_client = g_entities[bs->client].client->lasthurt_client;
|
|
if (!lasthurt_client) return qfalse;
|
|
if (lasthurt_client == bs->client) return qfalse;
|
|
//
|
|
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse;
|
|
//
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1);
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chat is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd * 0.5) return qfalse;
|
|
}
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
if (BotVisibleEnemies(bs)) return qfalse;
|
|
//
|
|
BotEntityInfo(bs->enemy, &entinfo);
|
|
if (EntityIsShooting(&entinfo)) return qfalse;
|
|
//
|
|
ClientName(lasthurt_client, name, sizeof(name));
|
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
|
|
//
|
|
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_HitNoKill
|
|
==================
|
|
*/
|
|
int BotChat_HitNoKill(bot_state_t *bs) {
|
|
char name[32], *weap;
|
|
float rnd;
|
|
aas_entityinfo_t entinfo;
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1);
|
|
//don't chat in teamplay
|
|
if (TeamPlayIsOn()) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//if fast chat is off
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd * 0.5) return qfalse;
|
|
}
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
if (BotVisibleEnemies(bs)) return qfalse;
|
|
//
|
|
BotEntityInfo(bs->enemy, &entinfo);
|
|
if (EntityIsShooting(&entinfo)) return qfalse;
|
|
//
|
|
ClientName(bs->enemy, name, sizeof(name));
|
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod);
|
|
//
|
|
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChat_Random
|
|
==================
|
|
*/
|
|
int BotChat_Random(bot_state_t *bs) {
|
|
float rnd;
|
|
char name[32];
|
|
|
|
if (bot_nochat.integer) return qfalse;
|
|
if (BotIsObserver(bs)) return qfalse;
|
|
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
|
|
// don't chat in tournament mode
|
|
if (gametype == GT_TOURNAMENT) return qfalse;
|
|
//don't chat when doing something important :)
|
|
if (bs->ltgtype == LTG_TEAMHELP ||
|
|
bs->ltgtype == LTG_TEAMACCOMPANY ||
|
|
bs->ltgtype == LTG_RUSHBASE) return qfalse;
|
|
//
|
|
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_RANDOM, 0, 1);
|
|
if (random() > bs->thinktime * 0.1) return qfalse;
|
|
if (!bot_fastchat.integer) {
|
|
if (random() > rnd) return qfalse;
|
|
if (random() > 0.25) return qfalse;
|
|
}
|
|
if (BotNumActivePlayers() <= 1) return qfalse;
|
|
//
|
|
if (!BotValidChatPosition(bs)) return qfalse;
|
|
//
|
|
if (BotVisibleEnemies(bs)) return qfalse;
|
|
//
|
|
if (bs->lastkilledplayer == bs->client) {
|
|
strcpy(name, BotRandomOpponentName(bs));
|
|
}
|
|
else {
|
|
EasyClientName(bs->lastkilledplayer, name, sizeof(name));
|
|
}
|
|
if (TeamPlayIsOn()) {
|
|
trap_EA_Command(bs->client, "vtaunt");
|
|
return qfalse; // don't wait
|
|
}
|
|
//
|
|
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) {
|
|
BotAI_BotInitialChat(bs, "random_misc",
|
|
BotRandomOpponentName(bs), // 0
|
|
name, // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
BotRandomWeaponName(), // 5
|
|
NULL);
|
|
}
|
|
else {
|
|
BotAI_BotInitialChat(bs, "random_insult",
|
|
BotRandomOpponentName(bs), // 0
|
|
name, // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
BotRandomWeaponName(), // 5
|
|
NULL);
|
|
}
|
|
bs->lastchat_time = FloatTime();
|
|
bs->chatto = CHAT_ALL;
|
|
return qtrue;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChatTime
|
|
==================
|
|
*/
|
|
float BotChatTime(bot_state_t *bs) {
|
|
//int cpm;
|
|
|
|
//cpm = trap_Characteristic_BInteger(bs->character, CHARACTERISTIC_CHAT_CPM, 1, 4000);
|
|
|
|
return 2.0; //(float) trap_BotChatLength(bs->cs) * 30 / cpm;
|
|
}
|
|
|
|
/*
|
|
==================
|
|
BotChatTest
|
|
==================
|
|
*/
|
|
void BotChatTest(bot_state_t *bs) {
|
|
|
|
char name[32];
|
|
char *weap;
|
|
int num, i;
|
|
|
|
num = trap_BotNumInitialChats(bs->cs, "game_enter");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "game_enter",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "game_exit");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "game_exit",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "level_start");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "level_start",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "level_end_victory");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "level_end_victory",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
BotFirstClientInRankings(), // 2
|
|
BotLastClientInRankings(), // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "level_end_lose");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "level_end_lose",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
BotFirstClientInRankings(), // 2
|
|
BotLastClientInRankings(), // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "level_end");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "level_end",
|
|
EasyClientName(bs->client, name, 32), // 0
|
|
BotRandomOpponentName(bs), // 1
|
|
BotFirstClientInRankings(), // 2
|
|
BotLastClientInRankings(), // 3
|
|
BotMapTitle(), // 4
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
EasyClientName(bs->lastkilledby, name, sizeof(name));
|
|
num = trap_BotNumInitialChats(bs->cs, "death_drown");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
//
|
|
BotAI_BotInitialChat(bs, "death_drown", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_slime");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_slime", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_lava");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_lava", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_cratered");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_cratered", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_suicide");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_suicide", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_telefrag");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_gauntlet");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_gauntlet",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_rail");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_rail",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_bfg");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_bfg",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_insult");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_insult",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "death_praise");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "death_praise",
|
|
name, // 0
|
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
//
|
|
EasyClientName(bs->lastkilledplayer, name, 32);
|
|
//
|
|
num = trap_BotNumInitialChats(bs->cs, "kill_gauntlet");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
//
|
|
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "kill_rail");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "kill_telefrag");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "kill_insult");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "kill_praise");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "enemy_suicide");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
|
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
|
num = trap_BotNumInitialChats(bs->cs, "hit_talking");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "hit_nodeath");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "hit_nokill");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
//
|
|
if (bs->lastkilledplayer == bs->client) {
|
|
strcpy(name, BotRandomOpponentName(bs));
|
|
}
|
|
else {
|
|
EasyClientName(bs->lastkilledplayer, name, sizeof(name));
|
|
}
|
|
//
|
|
num = trap_BotNumInitialChats(bs->cs, "random_misc");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
//
|
|
BotAI_BotInitialChat(bs, "random_misc",
|
|
BotRandomOpponentName(bs), // 0
|
|
name, // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
BotRandomWeaponName(), // 5
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
num = trap_BotNumInitialChats(bs->cs, "random_insult");
|
|
for (i = 0; i < num; i++)
|
|
{
|
|
BotAI_BotInitialChat(bs, "random_insult",
|
|
BotRandomOpponentName(bs), // 0
|
|
name, // 1
|
|
"[invalid var]", // 2
|
|
"[invalid var]", // 3
|
|
BotMapTitle(), // 4
|
|
BotRandomWeaponName(), // 5
|
|
NULL);
|
|
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
|
|
}
|
|
}
|