| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
#include "g_local.h" |
| 34 |
#include "../botlib/botlib.h" |
| 35 |
#include "../botlib/be_aas.h" |
| 36 |
#include "../botlib/be_ea.h" |
| 37 |
#include "../botlib/be_ai_char.h" |
| 38 |
#include "../botlib/be_ai_chat.h" |
| 39 |
#include "../botlib/be_ai_gen.h" |
| 40 |
#include "../botlib/be_ai_goal.h" |
| 41 |
#include "../botlib/be_ai_move.h" |
| 42 |
#include "../botlib/be_ai_weap.h" |
| 43 |
|
| 44 |
#include "ai_main.h" |
| 45 |
#include "ai_dmq3.h" |
| 46 |
#include "ai_chat.h" |
| 47 |
#include "ai_cmd.h" |
| 48 |
#include "ai_dmnet.h" |
| 49 |
|
| 50 |
#include "chars.h" |
| 51 |
#include "inv.h" |
| 52 |
#include "syn.h" |
| 53 |
#include "match.h" |
| 54 |
|
| 55 |
|
| 56 |
#ifdef MISSIONPACK |
| 57 |
#include "../../ui/menudef.h" |
| 58 |
#endif |
| 59 |
|
| 60 |
#define TIME_BETWEENCHATTING 25 |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
int BotNumActivePlayers(void) { |
| 69 |
int i, num; |
| 70 |
char buf[MAX_INFO_STRING]; |
| 71 |
|
| 72 |
num = 0; |
| 73 |
for (i = 0; i < level.maxclients; i++) { |
| 74 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 75 |
|
| 76 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 77 |
|
| 78 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 79 |
|
| 80 |
num++; |
| 81 |
} |
| 82 |
return num; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
int BotIsFirstInRankings(bot_state_t *bs) { |
| 91 |
int i, score; |
| 92 |
char buf[MAX_INFO_STRING]; |
| 93 |
playerState_t ps; |
| 94 |
|
| 95 |
score = bs->cur_ps.persistant[PERS_SCORE]; |
| 96 |
for (i = 0; i < level.maxclients; i++) { |
| 97 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 98 |
|
| 99 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 100 |
|
| 101 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 102 |
|
| 103 |
if (BotAI_GetClientState(i, &ps) && score < ps.persistant[PERS_SCORE]) return qfalse; |
| 104 |
} |
| 105 |
return qtrue; |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
int BotIsLastInRankings(bot_state_t *bs) { |
| 114 |
int i, score; |
| 115 |
char buf[MAX_INFO_STRING]; |
| 116 |
playerState_t ps; |
| 117 |
|
| 118 |
score = bs->cur_ps.persistant[PERS_SCORE]; |
| 119 |
for (i = 0; i < level.maxclients; i++) { |
| 120 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 121 |
|
| 122 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 123 |
|
| 124 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 125 |
|
| 126 |
if (BotAI_GetClientState(i, &ps) && score > ps.persistant[PERS_SCORE]) return qfalse; |
| 127 |
} |
| 128 |
return qtrue; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
char *BotFirstClientInRankings(void) { |
| 137 |
int i, bestscore, bestclient; |
| 138 |
char buf[MAX_INFO_STRING]; |
| 139 |
static char name[32]; |
| 140 |
playerState_t ps; |
| 141 |
|
| 142 |
bestscore = -999999; |
| 143 |
bestclient = 0; |
| 144 |
for (i = 0; i < level.maxclients; i++) { |
| 145 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 146 |
|
| 147 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 148 |
|
| 149 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 150 |
|
| 151 |
if (BotAI_GetClientState(i, &ps) && ps.persistant[PERS_SCORE] > bestscore) { |
| 152 |
bestscore = ps.persistant[PERS_SCORE]; |
| 153 |
bestclient = i; |
| 154 |
} |
| 155 |
} |
| 156 |
EasyClientName(bestclient, name, 32); |
| 157 |
return name; |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
char *BotLastClientInRankings(void) { |
| 166 |
int i, worstscore, bestclient; |
| 167 |
char buf[MAX_INFO_STRING]; |
| 168 |
static char name[32]; |
| 169 |
playerState_t ps; |
| 170 |
|
| 171 |
worstscore = 999999; |
| 172 |
bestclient = 0; |
| 173 |
for (i = 0; i < level.maxclients; i++) { |
| 174 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 175 |
|
| 176 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 177 |
|
| 178 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 179 |
|
| 180 |
if (BotAI_GetClientState(i, &ps) && ps.persistant[PERS_SCORE] < worstscore) { |
| 181 |
worstscore = ps.persistant[PERS_SCORE]; |
| 182 |
bestclient = i; |
| 183 |
} |
| 184 |
} |
| 185 |
EasyClientName(bestclient, name, 32); |
| 186 |
return name; |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
char *BotRandomOpponentName(bot_state_t *bs) { |
| 195 |
int i, count; |
| 196 |
char buf[MAX_INFO_STRING]; |
| 197 |
int opponents[MAX_CLIENTS], numopponents; |
| 198 |
static char name[32]; |
| 199 |
|
| 200 |
numopponents = 0; |
| 201 |
opponents[0] = 0; |
| 202 |
for (i = 0; i < level.maxclients; i++) { |
| 203 |
if (i == bs->client) continue; |
| 204 |
|
| 205 |
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf)); |
| 206 |
|
| 207 |
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue; |
| 208 |
|
| 209 |
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue; |
| 210 |
|
| 211 |
if (BotSameTeam(bs, i)) continue; |
| 212 |
|
| 213 |
opponents[numopponents] = i; |
| 214 |
numopponents++; |
| 215 |
} |
| 216 |
count = random() * numopponents; |
| 217 |
for (i = 0; i < numopponents; i++) { |
| 218 |
count--; |
| 219 |
if (count <= 0) { |
| 220 |
EasyClientName(opponents[i], name, sizeof(name)); |
| 221 |
return name; |
| 222 |
} |
| 223 |
} |
| 224 |
EasyClientName(opponents[0], name, sizeof(name)); |
| 225 |
return name; |
| 226 |
} |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
char *BotMapTitle(void) { |
| 235 |
char info[1024]; |
| 236 |
static char mapname[128]; |
| 237 |
|
| 238 |
trap_GetServerinfo(info, sizeof(info)); |
| 239 |
|
| 240 |
Q_strncpyz(mapname, Info_ValueForKey( info, "mapname" ), sizeof(mapname)); |
| 241 |
|
| 242 |
return mapname; |
| 243 |
} |
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
char *BotWeaponNameForMeansOfDeath(int mod) { |
| 253 |
switch(mod) { |
| 254 |
case MOD_SHOTGUN: return "Shotgun"; |
| 255 |
case MOD_GAUNTLET: return "Gauntlet"; |
| 256 |
case MOD_MACHINEGUN: return "Machinegun"; |
| 257 |
case MOD_GRENADE: |
| 258 |
case MOD_GRENADE_SPLASH: return "Grenade Launcher"; |
| 259 |
case MOD_ROCKET: |
| 260 |
case MOD_ROCKET_SPLASH: return "Rocket Launcher"; |
| 261 |
case MOD_PLASMA: |
| 262 |
case MOD_PLASMA_SPLASH: return "Plasmagun"; |
| 263 |
case MOD_RAILGUN: return "Railgun"; |
| 264 |
case MOD_LIGHTNING: return "Lightning Gun"; |
| 265 |
case MOD_BFG: |
| 266 |
case MOD_BFG_SPLASH: return "BFG10K"; |
| 267 |
#ifdef MISSIONPACK |
| 268 |
case MOD_NAIL: return "Nailgun"; |
| 269 |
case MOD_CHAINGUN: return "Chaingun"; |
| 270 |
case MOD_PROXIMITY_MINE: return "Proximity Launcher"; |
| 271 |
case MOD_KAMIKAZE: return "Kamikaze"; |
| 272 |
case MOD_JUICED: return "Prox mine"; |
| 273 |
#endif |
| 274 |
case MOD_GRAPPLE: return "Grapple"; |
| 275 |
default: return "[unknown weapon]"; |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
char *BotRandomWeaponName(void) { |
| 285 |
int rnd; |
| 286 |
|
| 287 |
#ifdef MISSIONPACK |
| 288 |
rnd = random() * 11.9; |
| 289 |
#else |
| 290 |
rnd = random() * 8.9; |
| 291 |
#endif |
| 292 |
switch(rnd) { |
| 293 |
case 0: return "Gauntlet"; |
| 294 |
case 1: return "Shotgun"; |
| 295 |
case 2: return "Machinegun"; |
| 296 |
case 3: return "Grenade Launcher"; |
| 297 |
case 4: return "Rocket Launcher"; |
| 298 |
case 5: return "Plasmagun"; |
| 299 |
case 6: return "Railgun"; |
| 300 |
case 7: return "Lightning Gun"; |
| 301 |
#ifdef MISSIONPACK |
| 302 |
case 8: return "Nailgun"; |
| 303 |
case 9: return "Chaingun"; |
| 304 |
case 10: return "Proximity Launcher"; |
| 305 |
#endif |
| 306 |
default: return "BFG10K"; |
| 307 |
} |
| 308 |
} |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
int BotVisibleEnemies(bot_state_t *bs) { |
| 316 |
float vis; |
| 317 |
int i; |
| 318 |
aas_entityinfo_t entinfo; |
| 319 |
|
| 320 |
for (i = 0; i < MAX_CLIENTS; i++) { |
| 321 |
|
| 322 |
if (i == bs->client) continue; |
| 323 |
|
| 324 |
BotEntityInfo(i, &entinfo); |
| 325 |
|
| 326 |
if (!entinfo.valid) continue; |
| 327 |
|
| 328 |
if (EntityIsDead(&entinfo) || entinfo.number == bs->entitynum) continue; |
| 329 |
|
| 330 |
if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) { |
| 331 |
continue; |
| 332 |
} |
| 333 |
|
| 334 |
if (BotSameTeam(bs, i)) continue; |
| 335 |
|
| 336 |
vis = BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, i); |
| 337 |
if (vis > 0) return qtrue; |
| 338 |
} |
| 339 |
return qfalse; |
| 340 |
} |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
int BotValidChatPosition(bot_state_t *bs) { |
| 348 |
vec3_t point, start, end, mins, maxs; |
| 349 |
bsp_trace_t trace; |
| 350 |
|
| 351 |
|
| 352 |
if (BotIsDead(bs)) return qtrue; |
| 353 |
|
| 354 |
if (bs->inventory[INVENTORY_QUAD] || |
| 355 |
bs->inventory[INVENTORY_ENVIRONMENTSUIT] || |
| 356 |
bs->inventory[INVENTORY_HASTE] || |
| 357 |
bs->inventory[INVENTORY_INVISIBILITY] || |
| 358 |
bs->inventory[INVENTORY_REGEN] || |
| 359 |
bs->inventory[INVENTORY_FLIGHT]) return qfalse; |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
VectorCopy(bs->origin, point); |
| 364 |
point[2] -= 24; |
| 365 |
if (trap_PointContents(point,bs->entitynum) & (CONTENTS_LAVA|CONTENTS_SLIME)) return qfalse; |
| 366 |
|
| 367 |
VectorCopy(bs->origin, point); |
| 368 |
point[2] += 32; |
| 369 |
if (trap_PointContents(point,bs->entitynum) & MASK_WATER) return qfalse; |
| 370 |
|
| 371 |
VectorCopy(bs->origin, start); |
| 372 |
VectorCopy(bs->origin, end); |
| 373 |
start[2] += 1; |
| 374 |
end[2] -= 10; |
| 375 |
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, mins, maxs); |
| 376 |
BotAI_Trace(&trace, start, mins, maxs, end, bs->client, MASK_SOLID); |
| 377 |
if (trace.ent != ENTITYNUM_WORLD) return qfalse; |
| 378 |
|
| 379 |
return qtrue; |
| 380 |
} |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
int BotChat_EnterGame(bot_state_t *bs) { |
| 388 |
char name[32]; |
| 389 |
float rnd; |
| 390 |
|
| 391 |
if (bot_nochat.integer) return qfalse; |
| 392 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 393 |
|
| 394 |
if (TeamPlayIsOn()) return qfalse; |
| 395 |
|
| 396 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 397 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1); |
| 398 |
if (!bot_fastchat.integer) { |
| 399 |
if (random() > rnd) return qfalse; |
| 400 |
} |
| 401 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 402 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 403 |
BotAI_BotInitialChat(bs, "game_enter", |
| 404 |
EasyClientName(bs->client, name, 32), |
| 405 |
BotRandomOpponentName(bs), |
| 406 |
"[invalid var]", |
| 407 |
"[invalid var]", |
| 408 |
BotMapTitle(), |
| 409 |
NULL); |
| 410 |
bs->lastchat_time = FloatTime(); |
| 411 |
bs->chatto = CHAT_ALL; |
| 412 |
return qtrue; |
| 413 |
} |
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
int BotChat_ExitGame(bot_state_t *bs) { |
| 421 |
char name[32]; |
| 422 |
float rnd; |
| 423 |
|
| 424 |
if (bot_nochat.integer) return qfalse; |
| 425 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 426 |
|
| 427 |
if (TeamPlayIsOn()) return qfalse; |
| 428 |
|
| 429 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 430 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1); |
| 431 |
if (!bot_fastchat.integer) { |
| 432 |
if (random() > rnd) return qfalse; |
| 433 |
} |
| 434 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 435 |
|
| 436 |
BotAI_BotInitialChat(bs, "game_exit", |
| 437 |
EasyClientName(bs->client, name, 32), |
| 438 |
BotRandomOpponentName(bs), |
| 439 |
"[invalid var]", |
| 440 |
"[invalid var]", |
| 441 |
BotMapTitle(), |
| 442 |
NULL); |
| 443 |
bs->lastchat_time = FloatTime(); |
| 444 |
bs->chatto = CHAT_ALL; |
| 445 |
return qtrue; |
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
int BotChat_StartLevel(bot_state_t *bs) { |
| 454 |
char name[32]; |
| 455 |
float rnd; |
| 456 |
|
| 457 |
if (bot_nochat.integer) return qfalse; |
| 458 |
if (BotIsObserver(bs)) return qfalse; |
| 459 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 460 |
|
| 461 |
if (TeamPlayIsOn()) { |
| 462 |
#ifdef MISSIONPACK |
| 463 |
trap_EA_Command(bs->client, "vtaunt"); |
| 464 |
#endif |
| 465 |
return qfalse; |
| 466 |
} |
| 467 |
|
| 468 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 469 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1); |
| 470 |
if (!bot_fastchat.integer) { |
| 471 |
if (random() > rnd) return qfalse; |
| 472 |
} |
| 473 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 474 |
BotAI_BotInitialChat(bs, "level_start", |
| 475 |
EasyClientName(bs->client, name, 32), |
| 476 |
NULL); |
| 477 |
bs->lastchat_time = FloatTime(); |
| 478 |
bs->chatto = CHAT_ALL; |
| 479 |
return qtrue; |
| 480 |
} |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
int BotChat_EndLevel(bot_state_t *bs) { |
| 488 |
char name[32]; |
| 489 |
float rnd; |
| 490 |
|
| 491 |
if (bot_nochat.integer) return qfalse; |
| 492 |
if (BotIsObserver(bs)) return qfalse; |
| 493 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 494 |
|
| 495 |
if (TeamPlayIsOn()) |
| 496 |
{ |
| 497 |
#ifdef MISSIONPACK |
| 498 |
if (BotIsFirstInRankings(bs)) { |
| 499 |
trap_EA_Command(bs->client, "vtaunt"); |
| 500 |
} |
| 501 |
#endif |
| 502 |
return qtrue; |
| 503 |
} |
| 504 |
|
| 505 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 506 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1); |
| 507 |
if (!bot_fastchat.integer) { |
| 508 |
if (random() > rnd) return qfalse; |
| 509 |
} |
| 510 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 511 |
|
| 512 |
if (BotIsFirstInRankings(bs)) { |
| 513 |
BotAI_BotInitialChat(bs, "level_end_victory", |
| 514 |
EasyClientName(bs->client, name, 32), |
| 515 |
BotRandomOpponentName(bs), |
| 516 |
"[invalid var]", |
| 517 |
BotLastClientInRankings(), |
| 518 |
BotMapTitle(), |
| 519 |
NULL); |
| 520 |
} |
| 521 |
else if (BotIsLastInRankings(bs)) { |
| 522 |
BotAI_BotInitialChat(bs, "level_end_lose", |
| 523 |
EasyClientName(bs->client, name, 32), |
| 524 |
BotRandomOpponentName(bs), |
| 525 |
BotFirstClientInRankings(), |
| 526 |
"[invalid var]", |
| 527 |
BotMapTitle(), |
| 528 |
NULL); |
| 529 |
} |
| 530 |
else { |
| 531 |
BotAI_BotInitialChat(bs, "level_end", |
| 532 |
EasyClientName(bs->client, name, 32), |
| 533 |
BotRandomOpponentName(bs), |
| 534 |
BotFirstClientInRankings(), |
| 535 |
BotLastClientInRankings(), |
| 536 |
BotMapTitle(), |
| 537 |
NULL); |
| 538 |
} |
| 539 |
bs->lastchat_time = FloatTime(); |
| 540 |
bs->chatto = CHAT_ALL; |
| 541 |
return qtrue; |
| 542 |
} |
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
int BotChat_Death(bot_state_t *bs) { |
| 550 |
char name[32]; |
| 551 |
float rnd; |
| 552 |
|
| 553 |
if (bot_nochat.integer) return qfalse; |
| 554 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 555 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_DEATH, 0, 1); |
| 556 |
|
| 557 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 558 |
|
| 559 |
if (!bot_fastchat.integer) { |
| 560 |
if (random() > rnd) return qfalse; |
| 561 |
} |
| 562 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 563 |
|
| 564 |
if (bs->lastkilledby >= 0 && bs->lastkilledby < MAX_CLIENTS) |
| 565 |
EasyClientName(bs->lastkilledby, name, 32); |
| 566 |
else |
| 567 |
strcpy(name, "[world]"); |
| 568 |
|
| 569 |
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledby)) { |
| 570 |
if (bs->lastkilledby == bs->client) return qfalse; |
| 571 |
BotAI_BotInitialChat(bs, "death_teammate", name, NULL); |
| 572 |
bs->chatto = CHAT_TEAM; |
| 573 |
} |
| 574 |
else |
| 575 |
{ |
| 576 |
|
| 577 |
if (TeamPlayIsOn()) { |
| 578 |
#ifdef MISSIONPACK |
| 579 |
trap_EA_Command(bs->client, "vtaunt"); |
| 580 |
#endif |
| 581 |
return qtrue; |
| 582 |
} |
| 583 |
|
| 584 |
if (bs->botdeathtype == MOD_WATER) |
| 585 |
BotAI_BotInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL); |
| 586 |
else if (bs->botdeathtype == MOD_SLIME) |
| 587 |
BotAI_BotInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL); |
| 588 |
else if (bs->botdeathtype == MOD_LAVA) |
| 589 |
BotAI_BotInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL); |
| 590 |
else if (bs->botdeathtype == MOD_FALLING) |
| 591 |
BotAI_BotInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL); |
| 592 |
else if (bs->botsuicide || |
| 593 |
bs->botdeathtype == MOD_CRUSH || |
| 594 |
bs->botdeathtype == MOD_SUICIDE || |
| 595 |
bs->botdeathtype == MOD_TARGET_LASER || |
| 596 |
bs->botdeathtype == MOD_TRIGGER_HURT || |
| 597 |
bs->botdeathtype == MOD_UNKNOWN) |
| 598 |
BotAI_BotInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL); |
| 599 |
else if (bs->botdeathtype == MOD_TELEFRAG) |
| 600 |
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL); |
| 601 |
#ifdef MISSIONPACK |
| 602 |
else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "death_kamikaze")) |
| 603 |
BotAI_BotInitialChat(bs, "death_kamikaze", name, NULL); |
| 604 |
#endif |
| 605 |
else { |
| 606 |
if ((bs->botdeathtype == MOD_GAUNTLET || |
| 607 |
bs->botdeathtype == MOD_RAILGUN || |
| 608 |
bs->botdeathtype == MOD_BFG || |
| 609 |
bs->botdeathtype == MOD_BFG_SPLASH) && random() < 0.5) { |
| 610 |
|
| 611 |
if (bs->botdeathtype == MOD_GAUNTLET) |
| 612 |
BotAI_BotInitialChat(bs, "death_gauntlet", |
| 613 |
name, |
| 614 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 615 |
NULL); |
| 616 |
else if (bs->botdeathtype == MOD_RAILGUN) |
| 617 |
BotAI_BotInitialChat(bs, "death_rail", |
| 618 |
name, |
| 619 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 620 |
NULL); |
| 621 |
else |
| 622 |
BotAI_BotInitialChat(bs, "death_bfg", |
| 623 |
name, |
| 624 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 625 |
NULL); |
| 626 |
} |
| 627 |
|
| 628 |
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) { |
| 629 |
BotAI_BotInitialChat(bs, "death_insult", |
| 630 |
name, |
| 631 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 632 |
NULL); |
| 633 |
} |
| 634 |
else { |
| 635 |
BotAI_BotInitialChat(bs, "death_praise", |
| 636 |
name, |
| 637 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 638 |
NULL); |
| 639 |
} |
| 640 |
} |
| 641 |
bs->chatto = CHAT_ALL; |
| 642 |
} |
| 643 |
bs->lastchat_time = FloatTime(); |
| 644 |
return qtrue; |
| 645 |
} |
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
int BotChat_Kill(bot_state_t *bs) { |
| 653 |
char name[32]; |
| 654 |
float rnd; |
| 655 |
|
| 656 |
if (bot_nochat.integer) return qfalse; |
| 657 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 658 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1); |
| 659 |
|
| 660 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 661 |
|
| 662 |
if (!bot_fastchat.integer) { |
| 663 |
if (random() > rnd) return qfalse; |
| 664 |
} |
| 665 |
if (bs->lastkilledplayer == bs->client) return qfalse; |
| 666 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 667 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 668 |
|
| 669 |
if (BotVisibleEnemies(bs)) return qfalse; |
| 670 |
|
| 671 |
EasyClientName(bs->lastkilledplayer, name, 32); |
| 672 |
|
| 673 |
bs->chatto = CHAT_ALL; |
| 674 |
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledplayer)) { |
| 675 |
BotAI_BotInitialChat(bs, "kill_teammate", name, NULL); |
| 676 |
bs->chatto = CHAT_TEAM; |
| 677 |
} |
| 678 |
else |
| 679 |
{ |
| 680 |
|
| 681 |
if (TeamPlayIsOn()) { |
| 682 |
#ifdef MISSIONPACK |
| 683 |
trap_EA_Command(bs->client, "vtaunt"); |
| 684 |
#endif |
| 685 |
return qfalse; |
| 686 |
} |
| 687 |
|
| 688 |
if (bs->enemydeathtype == MOD_GAUNTLET) { |
| 689 |
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL); |
| 690 |
} |
| 691 |
else if (bs->enemydeathtype == MOD_RAILGUN) { |
| 692 |
BotAI_BotInitialChat(bs, "kill_rail", name, NULL); |
| 693 |
} |
| 694 |
else if (bs->enemydeathtype == MOD_TELEFRAG) { |
| 695 |
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL); |
| 696 |
} |
| 697 |
#ifdef MISSIONPACK |
| 698 |
else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "kill_kamikaze")) |
| 699 |
BotAI_BotInitialChat(bs, "kill_kamikaze", name, NULL); |
| 700 |
#endif |
| 701 |
|
| 702 |
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) { |
| 703 |
BotAI_BotInitialChat(bs, "kill_insult", name, NULL); |
| 704 |
} |
| 705 |
else { |
| 706 |
BotAI_BotInitialChat(bs, "kill_praise", name, NULL); |
| 707 |
} |
| 708 |
} |
| 709 |
bs->lastchat_time = FloatTime(); |
| 710 |
return qtrue; |
| 711 |
} |
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
int BotChat_EnemySuicide(bot_state_t *bs) { |
| 719 |
char name[32]; |
| 720 |
float rnd; |
| 721 |
|
| 722 |
if (bot_nochat.integer) return qfalse; |
| 723 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 724 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 725 |
|
| 726 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENEMYSUICIDE, 0, 1); |
| 727 |
|
| 728 |
if (TeamPlayIsOn()) return qfalse; |
| 729 |
|
| 730 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 731 |
|
| 732 |
if (!bot_fastchat.integer) { |
| 733 |
if (random() > rnd) return qfalse; |
| 734 |
} |
| 735 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 736 |
|
| 737 |
if (BotVisibleEnemies(bs)) return qfalse; |
| 738 |
|
| 739 |
if (bs->enemy >= 0) EasyClientName(bs->enemy, name, 32); |
| 740 |
else strcpy(name, ""); |
| 741 |
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL); |
| 742 |
bs->lastchat_time = FloatTime(); |
| 743 |
bs->chatto = CHAT_ALL; |
| 744 |
return qtrue; |
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
int BotChat_HitTalking(bot_state_t *bs) { |
| 753 |
char name[32], *weap; |
| 754 |
int lasthurt_client; |
| 755 |
float rnd; |
| 756 |
|
| 757 |
if (bot_nochat.integer) return qfalse; |
| 758 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 759 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 760 |
lasthurt_client = g_entities[bs->client].client->lasthurt_client; |
| 761 |
if (!lasthurt_client) return qfalse; |
| 762 |
if (lasthurt_client == bs->client) return qfalse; |
| 763 |
|
| 764 |
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse; |
| 765 |
|
| 766 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1); |
| 767 |
|
| 768 |
if (TeamPlayIsOn()) return qfalse; |
| 769 |
|
| 770 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 771 |
|
| 772 |
if (!bot_fastchat.integer) { |
| 773 |
if (random() > rnd * 0.5) return qfalse; |
| 774 |
} |
| 775 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 776 |
|
| 777 |
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name)); |
| 778 |
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod); |
| 779 |
|
| 780 |
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL); |
| 781 |
bs->lastchat_time = FloatTime(); |
| 782 |
bs->chatto = CHAT_ALL; |
| 783 |
return qtrue; |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
int BotChat_HitNoDeath(bot_state_t *bs) { |
| 792 |
char name[32], *weap; |
| 793 |
float rnd; |
| 794 |
int lasthurt_client; |
| 795 |
aas_entityinfo_t entinfo; |
| 796 |
|
| 797 |
lasthurt_client = g_entities[bs->client].client->lasthurt_client; |
| 798 |
if (!lasthurt_client) return qfalse; |
| 799 |
if (lasthurt_client == bs->client) return qfalse; |
| 800 |
|
| 801 |
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse; |
| 802 |
|
| 803 |
if (bot_nochat.integer) return qfalse; |
| 804 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 805 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 806 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1); |
| 807 |
|
| 808 |
if (TeamPlayIsOn()) return qfalse; |
| 809 |
|
| 810 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 811 |
|
| 812 |
if (!bot_fastchat.integer) { |
| 813 |
if (random() > rnd * 0.5) return qfalse; |
| 814 |
} |
| 815 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 816 |
|
| 817 |
if (BotVisibleEnemies(bs)) return qfalse; |
| 818 |
|
| 819 |
BotEntityInfo(bs->enemy, &entinfo); |
| 820 |
if (EntityIsShooting(&entinfo)) return qfalse; |
| 821 |
|
| 822 |
ClientName(lasthurt_client, name, sizeof(name)); |
| 823 |
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod); |
| 824 |
|
| 825 |
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL); |
| 826 |
bs->lastchat_time = FloatTime(); |
| 827 |
bs->chatto = CHAT_ALL; |
| 828 |
return qtrue; |
| 829 |
} |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
int BotChat_HitNoKill(bot_state_t *bs) { |
| 837 |
char name[32], *weap; |
| 838 |
float rnd; |
| 839 |
aas_entityinfo_t entinfo; |
| 840 |
|
| 841 |
if (bot_nochat.integer) return qfalse; |
| 842 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 843 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 844 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1); |
| 845 |
|
| 846 |
if (TeamPlayIsOn()) return qfalse; |
| 847 |
|
| 848 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 849 |
|
| 850 |
if (!bot_fastchat.integer) { |
| 851 |
if (random() > rnd * 0.5) return qfalse; |
| 852 |
} |
| 853 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 854 |
|
| 855 |
if (BotVisibleEnemies(bs)) return qfalse; |
| 856 |
|
| 857 |
BotEntityInfo(bs->enemy, &entinfo); |
| 858 |
if (EntityIsShooting(&entinfo)) return qfalse; |
| 859 |
|
| 860 |
ClientName(bs->enemy, name, sizeof(name)); |
| 861 |
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod); |
| 862 |
|
| 863 |
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL); |
| 864 |
bs->lastchat_time = FloatTime(); |
| 865 |
bs->chatto = CHAT_ALL; |
| 866 |
return qtrue; |
| 867 |
} |
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
int BotChat_Random(bot_state_t *bs) { |
| 875 |
float rnd; |
| 876 |
char name[32]; |
| 877 |
|
| 878 |
if (bot_nochat.integer) return qfalse; |
| 879 |
if (BotIsObserver(bs)) return qfalse; |
| 880 |
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse; |
| 881 |
|
| 882 |
if (gametype == GT_TOURNAMENT) return qfalse; |
| 883 |
|
| 884 |
if (bs->ltgtype == LTG_TEAMHELP || |
| 885 |
bs->ltgtype == LTG_TEAMACCOMPANY || |
| 886 |
bs->ltgtype == LTG_RUSHBASE) return qfalse; |
| 887 |
|
| 888 |
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_RANDOM, 0, 1); |
| 889 |
if (random() > bs->thinktime * 0.1) return qfalse; |
| 890 |
if (!bot_fastchat.integer) { |
| 891 |
if (random() > rnd) return qfalse; |
| 892 |
if (random() > 0.25) return qfalse; |
| 893 |
} |
| 894 |
if (BotNumActivePlayers() <= 1) return qfalse; |
| 895 |
|
| 896 |
if (!BotValidChatPosition(bs)) return qfalse; |
| 897 |
|
| 898 |
if (BotVisibleEnemies(bs)) return qfalse; |
| 899 |
|
| 900 |
if (bs->lastkilledplayer == bs->client) { |
| 901 |
strcpy(name, BotRandomOpponentName(bs)); |
| 902 |
} |
| 903 |
else { |
| 904 |
EasyClientName(bs->lastkilledplayer, name, sizeof(name)); |
| 905 |
} |
| 906 |
if (TeamPlayIsOn()) { |
| 907 |
#ifdef MISSIONPACK |
| 908 |
trap_EA_Command(bs->client, "vtaunt"); |
| 909 |
#endif |
| 910 |
return qfalse; |
| 911 |
} |
| 912 |
|
| 913 |
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) { |
| 914 |
BotAI_BotInitialChat(bs, "random_misc", |
| 915 |
BotRandomOpponentName(bs), |
| 916 |
name, |
| 917 |
"[invalid var]", |
| 918 |
"[invalid var]", |
| 919 |
BotMapTitle(), |
| 920 |
BotRandomWeaponName(), |
| 921 |
NULL); |
| 922 |
} |
| 923 |
else { |
| 924 |
BotAI_BotInitialChat(bs, "random_insult", |
| 925 |
BotRandomOpponentName(bs), |
| 926 |
name, |
| 927 |
"[invalid var]", |
| 928 |
"[invalid var]", |
| 929 |
BotMapTitle(), |
| 930 |
BotRandomWeaponName(), |
| 931 |
NULL); |
| 932 |
} |
| 933 |
bs->lastchat_time = FloatTime(); |
| 934 |
bs->chatto = CHAT_ALL; |
| 935 |
return qtrue; |
| 936 |
} |
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
float BotChatTime(bot_state_t *bs) { |
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
return 2.0; |
| 949 |
} |
| 950 |
|
| 951 |
|
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
void BotChatTest(bot_state_t *bs) { |
| 957 |
|
| 958 |
char name[32]; |
| 959 |
char *weap; |
| 960 |
int num, i; |
| 961 |
|
| 962 |
num = trap_BotNumInitialChats(bs->cs, "game_enter"); |
| 963 |
for (i = 0; i < num; i++) |
| 964 |
{ |
| 965 |
BotAI_BotInitialChat(bs, "game_enter", |
| 966 |
EasyClientName(bs->client, name, 32), |
| 967 |
BotRandomOpponentName(bs), |
| 968 |
"[invalid var]", |
| 969 |
"[invalid var]", |
| 970 |
BotMapTitle(), |
| 971 |
NULL); |
| 972 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 973 |
} |
| 974 |
num = trap_BotNumInitialChats(bs->cs, "game_exit"); |
| 975 |
for (i = 0; i < num; i++) |
| 976 |
{ |
| 977 |
BotAI_BotInitialChat(bs, "game_exit", |
| 978 |
EasyClientName(bs->client, name, 32), |
| 979 |
BotRandomOpponentName(bs), |
| 980 |
"[invalid var]", |
| 981 |
"[invalid var]", |
| 982 |
BotMapTitle(), |
| 983 |
NULL); |
| 984 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 985 |
} |
| 986 |
num = trap_BotNumInitialChats(bs->cs, "level_start"); |
| 987 |
for (i = 0; i < num; i++) |
| 988 |
{ |
| 989 |
BotAI_BotInitialChat(bs, "level_start", |
| 990 |
EasyClientName(bs->client, name, 32), |
| 991 |
NULL); |
| 992 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 993 |
} |
| 994 |
num = trap_BotNumInitialChats(bs->cs, "level_end_victory"); |
| 995 |
for (i = 0; i < num; i++) |
| 996 |
{ |
| 997 |
BotAI_BotInitialChat(bs, "level_end_victory", |
| 998 |
EasyClientName(bs->client, name, 32), |
| 999 |
BotRandomOpponentName(bs), |
| 1000 |
BotFirstClientInRankings(), |
| 1001 |
BotLastClientInRankings(), |
| 1002 |
BotMapTitle(), |
| 1003 |
NULL); |
| 1004 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1005 |
} |
| 1006 |
num = trap_BotNumInitialChats(bs->cs, "level_end_lose"); |
| 1007 |
for (i = 0; i < num; i++) |
| 1008 |
{ |
| 1009 |
BotAI_BotInitialChat(bs, "level_end_lose", |
| 1010 |
EasyClientName(bs->client, name, 32), |
| 1011 |
BotRandomOpponentName(bs), |
| 1012 |
BotFirstClientInRankings(), |
| 1013 |
BotLastClientInRankings(), |
| 1014 |
BotMapTitle(), |
| 1015 |
NULL); |
| 1016 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1017 |
} |
| 1018 |
num = trap_BotNumInitialChats(bs->cs, "level_end"); |
| 1019 |
for (i = 0; i < num; i++) |
| 1020 |
{ |
| 1021 |
BotAI_BotInitialChat(bs, "level_end", |
| 1022 |
EasyClientName(bs->client, name, 32), |
| 1023 |
BotRandomOpponentName(bs), |
| 1024 |
BotFirstClientInRankings(), |
| 1025 |
BotLastClientInRankings(), |
| 1026 |
BotMapTitle(), |
| 1027 |
NULL); |
| 1028 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1029 |
} |
| 1030 |
EasyClientName(bs->lastkilledby, name, sizeof(name)); |
| 1031 |
num = trap_BotNumInitialChats(bs->cs, "death_drown"); |
| 1032 |
for (i = 0; i < num; i++) |
| 1033 |
{ |
| 1034 |
|
| 1035 |
BotAI_BotInitialChat(bs, "death_drown", name, NULL); |
| 1036 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1037 |
} |
| 1038 |
num = trap_BotNumInitialChats(bs->cs, "death_slime"); |
| 1039 |
for (i = 0; i < num; i++) |
| 1040 |
{ |
| 1041 |
BotAI_BotInitialChat(bs, "death_slime", name, NULL); |
| 1042 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1043 |
} |
| 1044 |
num = trap_BotNumInitialChats(bs->cs, "death_lava"); |
| 1045 |
for (i = 0; i < num; i++) |
| 1046 |
{ |
| 1047 |
BotAI_BotInitialChat(bs, "death_lava", name, NULL); |
| 1048 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1049 |
} |
| 1050 |
num = trap_BotNumInitialChats(bs->cs, "death_cratered"); |
| 1051 |
for (i = 0; i < num; i++) |
| 1052 |
{ |
| 1053 |
BotAI_BotInitialChat(bs, "death_cratered", name, NULL); |
| 1054 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1055 |
} |
| 1056 |
num = trap_BotNumInitialChats(bs->cs, "death_suicide"); |
| 1057 |
for (i = 0; i < num; i++) |
| 1058 |
{ |
| 1059 |
BotAI_BotInitialChat(bs, "death_suicide", name, NULL); |
| 1060 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1061 |
} |
| 1062 |
num = trap_BotNumInitialChats(bs->cs, "death_telefrag"); |
| 1063 |
for (i = 0; i < num; i++) |
| 1064 |
{ |
| 1065 |
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL); |
| 1066 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1067 |
} |
| 1068 |
num = trap_BotNumInitialChats(bs->cs, "death_gauntlet"); |
| 1069 |
for (i = 0; i < num; i++) |
| 1070 |
{ |
| 1071 |
BotAI_BotInitialChat(bs, "death_gauntlet", |
| 1072 |
name, |
| 1073 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 1074 |
NULL); |
| 1075 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1076 |
} |
| 1077 |
num = trap_BotNumInitialChats(bs->cs, "death_rail"); |
| 1078 |
for (i = 0; i < num; i++) |
| 1079 |
{ |
| 1080 |
BotAI_BotInitialChat(bs, "death_rail", |
| 1081 |
name, |
| 1082 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 1083 |
NULL); |
| 1084 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1085 |
} |
| 1086 |
num = trap_BotNumInitialChats(bs->cs, "death_bfg"); |
| 1087 |
for (i = 0; i < num; i++) |
| 1088 |
{ |
| 1089 |
BotAI_BotInitialChat(bs, "death_bfg", |
| 1090 |
name, |
| 1091 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 1092 |
NULL); |
| 1093 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1094 |
} |
| 1095 |
num = trap_BotNumInitialChats(bs->cs, "death_insult"); |
| 1096 |
for (i = 0; i < num; i++) |
| 1097 |
{ |
| 1098 |
BotAI_BotInitialChat(bs, "death_insult", |
| 1099 |
name, |
| 1100 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 1101 |
NULL); |
| 1102 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1103 |
} |
| 1104 |
num = trap_BotNumInitialChats(bs->cs, "death_praise"); |
| 1105 |
for (i = 0; i < num; i++) |
| 1106 |
{ |
| 1107 |
BotAI_BotInitialChat(bs, "death_praise", |
| 1108 |
name, |
| 1109 |
BotWeaponNameForMeansOfDeath(bs->botdeathtype), |
| 1110 |
NULL); |
| 1111 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1112 |
} |
| 1113 |
|
| 1114 |
EasyClientName(bs->lastkilledplayer, name, 32); |
| 1115 |
|
| 1116 |
num = trap_BotNumInitialChats(bs->cs, "kill_gauntlet"); |
| 1117 |
for (i = 0; i < num; i++) |
| 1118 |
{ |
| 1119 |
|
| 1120 |
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL); |
| 1121 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1122 |
} |
| 1123 |
num = trap_BotNumInitialChats(bs->cs, "kill_rail"); |
| 1124 |
for (i = 0; i < num; i++) |
| 1125 |
{ |
| 1126 |
BotAI_BotInitialChat(bs, "kill_rail", name, NULL); |
| 1127 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1128 |
} |
| 1129 |
num = trap_BotNumInitialChats(bs->cs, "kill_telefrag"); |
| 1130 |
for (i = 0; i < num; i++) |
| 1131 |
{ |
| 1132 |
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL); |
| 1133 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1134 |
} |
| 1135 |
num = trap_BotNumInitialChats(bs->cs, "kill_insult"); |
| 1136 |
for (i = 0; i < num; i++) |
| 1137 |
{ |
| 1138 |
BotAI_BotInitialChat(bs, "kill_insult", name, NULL); |
| 1139 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1140 |
} |
| 1141 |
num = trap_BotNumInitialChats(bs->cs, "kill_praise"); |
| 1142 |
for (i = 0; i < num; i++) |
| 1143 |
{ |
| 1144 |
BotAI_BotInitialChat(bs, "kill_praise", name, NULL); |
| 1145 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1146 |
} |
| 1147 |
num = trap_BotNumInitialChats(bs->cs, "enemy_suicide"); |
| 1148 |
for (i = 0; i < num; i++) |
| 1149 |
{ |
| 1150 |
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL); |
| 1151 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1152 |
} |
| 1153 |
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name)); |
| 1154 |
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client); |
| 1155 |
num = trap_BotNumInitialChats(bs->cs, "hit_talking"); |
| 1156 |
for (i = 0; i < num; i++) |
| 1157 |
{ |
| 1158 |
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL); |
| 1159 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1160 |
} |
| 1161 |
num = trap_BotNumInitialChats(bs->cs, "hit_nodeath"); |
| 1162 |
for (i = 0; i < num; i++) |
| 1163 |
{ |
| 1164 |
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL); |
| 1165 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1166 |
} |
| 1167 |
num = trap_BotNumInitialChats(bs->cs, "hit_nokill"); |
| 1168 |
for (i = 0; i < num; i++) |
| 1169 |
{ |
| 1170 |
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL); |
| 1171 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1172 |
} |
| 1173 |
|
| 1174 |
if (bs->lastkilledplayer == bs->client) { |
| 1175 |
strcpy(name, BotRandomOpponentName(bs)); |
| 1176 |
} |
| 1177 |
else { |
| 1178 |
EasyClientName(bs->lastkilledplayer, name, sizeof(name)); |
| 1179 |
} |
| 1180 |
|
| 1181 |
num = trap_BotNumInitialChats(bs->cs, "random_misc"); |
| 1182 |
for (i = 0; i < num; i++) |
| 1183 |
{ |
| 1184 |
|
| 1185 |
BotAI_BotInitialChat(bs, "random_misc", |
| 1186 |
BotRandomOpponentName(bs), |
| 1187 |
name, |
| 1188 |
"[invalid var]", |
| 1189 |
"[invalid var]", |
| 1190 |
BotMapTitle(), |
| 1191 |
BotRandomWeaponName(), |
| 1192 |
NULL); |
| 1193 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1194 |
} |
| 1195 |
num = trap_BotNumInitialChats(bs->cs, "random_insult"); |
| 1196 |
for (i = 0; i < num; i++) |
| 1197 |
{ |
| 1198 |
BotAI_BotInitialChat(bs, "random_insult", |
| 1199 |
BotRandomOpponentName(bs), |
| 1200 |
name, |
| 1201 |
"[invalid var]", |
| 1202 |
"[invalid var]", |
| 1203 |
BotMapTitle(), |
| 1204 |
BotRandomWeaponName(), |
| 1205 |
NULL); |
| 1206 |
trap_BotEnterChat(bs->cs, 0, CHAT_ALL); |
| 1207 |
} |
| 1208 |
} |