mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-11 15:52:30 +00:00
Mainly bot stuff. Also fixed a couple of crash bugs
This commit is contained in:
parent
13aa3794ac
commit
a04a9eb263
7 changed files with 263 additions and 88 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.24 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.23 2002/05/05 15:18:02 makro
|
||||
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
|
||||
// Made flags only spawn in CTF mode
|
||||
|
@ -1466,6 +1469,7 @@ int AINode_Stand(bot_state_t *bs) {
|
|||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
//Not 100% sure this will work, but oh well...
|
||||
AIEnter_Battle_Retreat(bs, "stand: bandaging");
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1488,6 +1492,35 @@ int AINode_Stand(bot_state_t *bs) {
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
weapon_t weapon;
|
||||
holdable_t item;
|
||||
} RQ3_TPCombo_t;
|
||||
|
||||
static RQ3_TPCombo_t RQ3_TPCombos[] = {
|
||||
{WP_M4, HI_LASER},
|
||||
{WP_M4, HI_KEVLAR},
|
||||
{WP_M4, HI_BANDOLIER},
|
||||
{WP_MP5, HI_LASER},
|
||||
{WP_MP5, HI_SILENCER},
|
||||
{WP_MP5, HI_KEVLAR},
|
||||
{WP_MP5, HI_BANDOLIER},
|
||||
{WP_M3, HI_KEVLAR},
|
||||
{WP_M3, HI_BANDOLIER},
|
||||
{WP_M3, HI_SLIPPERS},
|
||||
{WP_HANDCANNON, HI_KEVLAR},
|
||||
{WP_HANDCANNON, HI_BANDOLIER},
|
||||
{WP_HANDCANNON, HI_SLIPPERS},
|
||||
// {WP_SSG3000, HI_SILENCER},
|
||||
// {WP_SSG3000, HI_KEVLAR},
|
||||
// {WP_SSG3000, HI_BANDOLIER},
|
||||
// {WP_SSG3000, HI_SLIPPERS},
|
||||
{WP_AKIMBO, HI_KEVLAR},
|
||||
{WP_AKIMBO, HI_BANDOLIER}
|
||||
};
|
||||
|
||||
static int num_RQ3_TPCombos = sizeof(RQ3_TPCombos) / sizeof(RQ3_TPCombo_t);
|
||||
|
||||
/*
|
||||
==================
|
||||
AIEnter_Respawn
|
||||
|
@ -1516,18 +1549,34 @@ void AIEnter_Respawn(bot_state_t *bs, char *s) {
|
|||
bs->radioresponse_count = 0;
|
||||
|
||||
//set respawn state
|
||||
//Makro - special code for TP; played a little with those numbers
|
||||
if (gametype != GT_TEAMPLAY) {
|
||||
bs->standfindenemy_time = FloatTime() + 5;
|
||||
bs->standfindenemy_time = FloatTime() + 3;
|
||||
bs->stand_time = FloatTime() + 10;
|
||||
bs->check_time = FloatTime() + 4;
|
||||
} else {
|
||||
//Makro - hackish, but oh well...
|
||||
gentity_t *ent = SelectRandomDeathmatchSpawnPoint();
|
||||
if (ent) {
|
||||
VectorCopy(ent->r.currentOrigin, bs->lastenemyorigin);
|
||||
bs->lastenemyareanum = trap_AAS_PointAreaNum(ent->r.currentOrigin);
|
||||
}
|
||||
weapon_t tpW = WP_NONE + atoi(BotGetUserInfoKey(bs, "tpw"));
|
||||
holdable_t tpI = HI_NONE + atoi(BotGetUserInfoKey(bs, "tpi"));
|
||||
int index = 0;
|
||||
|
||||
bs->standfindenemy_time = bs->check_time = FloatTime() + 1;
|
||||
bs->stand_time = 5;
|
||||
//don't use the same combo all the time
|
||||
if (random() > 0.3f) {
|
||||
//choose a random weapon/item
|
||||
index = (int) (random() * (num_RQ3_TPCombos - 0.1));
|
||||
tpW = RQ3_TPCombos[index].weapon;
|
||||
tpI = RQ3_TPCombos[index].item;
|
||||
}
|
||||
if (tpW <= WP_NONE || tpW >= WP_NUM_WEAPONS || tpI <= HI_NONE || tpI >= HI_NUM_HOLDABLE) {
|
||||
#ifdef DEBUG
|
||||
BotAI_Print(PRT_WARNING, "Bad combo %i/%i, index is %i\n", tpW, tpI, index);
|
||||
#endif
|
||||
tpW = WP_M4;
|
||||
tpI = HI_LASER;
|
||||
}
|
||||
g_entities[bs->entitynum].client->teamplayWeapon = tpW;
|
||||
g_entities[bs->entitynum].client->teamplayItem = tpI;
|
||||
}
|
||||
bs->respawn_wait = qfalse;
|
||||
bs->ainode = AINode_Respawn;
|
||||
|
@ -1573,14 +1622,19 @@ BotSelectActivateWeapon
|
|||
*/
|
||||
int BotSelectActivateWeapon(bot_state_t *bs) {
|
||||
//
|
||||
//Makro - I'm pretty sure it should be WP_ and not WEAPONINDEX_
|
||||
if (bs->inventory[INVENTORY_PISTOL] > 0 && bs->inventory[INVENTORY_PISTOLAMMO] > 0)
|
||||
return WEAPONINDEX_PISTOL;
|
||||
// return WEAPONINDEX_PISTOL;
|
||||
return WP_PISTOL;
|
||||
else if (bs->inventory[INVENTORY_M3] > 0 && bs->inventory[INVENTORY_M3AMMO] > 0)
|
||||
return WEAPONINDEX_M3;
|
||||
// return WEAPONINDEX_M3;
|
||||
return WP_M3;
|
||||
else if (bs->inventory[INVENTORY_M4] > 0 && bs->inventory[INVENTORY_M4AMMO] > 0)
|
||||
return WEAPONINDEX_M4;
|
||||
// return WEAPONINDEX_M4;
|
||||
return WP_M4;
|
||||
else if (bs->inventory[INVENTORY_MP5] > 0 && bs->inventory[INVENTORY_MP5AMMO] > 0)
|
||||
return WEAPONINDEX_MP5;
|
||||
// return WEAPONINDEX_MP5;
|
||||
return WP_MP5;
|
||||
#ifdef MISSIONPACK
|
||||
else if (bs->inventory[INVENTORY_CHAINGUN] > 0 && bs->inventory[INVENTORY_BELT] > 0)
|
||||
return WEAPONINDEX_CHAINGUN;
|
||||
|
@ -1588,11 +1642,14 @@ int BotSelectActivateWeapon(bot_state_t *bs) {
|
|||
return WEAPONINDEX_NAILGUN;
|
||||
#endif
|
||||
else if (bs->inventory[INVENTORY_SSG3000] > 0 && bs->inventory[INVENTORY_SSG3000AMMO] > 0)
|
||||
return WEAPONINDEX_SSG3000;
|
||||
// return WEAPONINDEX_SSG3000;
|
||||
return WP_SSG3000;
|
||||
else if (bs->inventory[INVENTORY_HANDCANNON] > 0 && bs->inventory[INVENTORY_M3AMMO] > 0)
|
||||
return WEAPONINDEX_HANDCANNON;
|
||||
// return WEAPONINDEX_HANDCANNON;
|
||||
return WP_HANDCANNON;
|
||||
else if (bs->inventory[INVENTORY_AKIMBO] > 0 && bs->inventory[INVENTORY_AKIMBOAMMO] > 0)
|
||||
return WEAPONINDEX_AKIMBO;
|
||||
// return WEAPONINDEX_AKIMBO;
|
||||
return WP_AKIMBO;
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1680,7 +1737,9 @@ void BotClearPath(bot_state_t *bs, bot_moveresult_t *moveresult) {
|
|||
// if the bot has a weapon that does splash damage
|
||||
//Blaze: Just grenades
|
||||
if (bs->inventory[INVENTORY_GRENADE] > 0 && bs->inventory[INVENTORY_GRENADEAMMO] > 0)
|
||||
moveresult->weapon = WEAPONINDEX_GRENADE;
|
||||
//Makro - changing to WP_ constants
|
||||
//moveresult->weapon = WEAPONINDEX_GRENADE;
|
||||
moveresult->weapon = WP_GRENADE;
|
||||
/*else if (bs->inventory[INVENTORY_ROCKETLAUNCHER] > 0 && bs->inventory[INVENTORY_ROCKETS] > 0)
|
||||
moveresult->weapon = WEAPONINDEX_ROCKET_LAUNCHER;
|
||||
else if (bs->inventory[INVENTORY_BFG10K] > 0 && bs->inventory[INVENTORY_BFGAMMO] > 0)
|
||||
|
@ -1718,7 +1777,15 @@ AIEnter_Seek_ActivateEntity
|
|||
==================
|
||||
*/
|
||||
void AIEnter_Seek_ActivateEntity(bot_state_t *bs, char *s) {
|
||||
int damage = RQ3_Bot_NeedToBandage(bs);
|
||||
|
||||
BotRecordNodeSwitch(bs, "activate entity", "", s);
|
||||
//Makro - check if the bot needs to bandage
|
||||
if (damage == 2 || ((damage == 1) && RQ3_Bot_CheckBandage(bs))) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
bs->ainode = AINode_Seek_ActivateEntity;
|
||||
}
|
||||
|
||||
|
@ -1960,6 +2027,7 @@ AIEnter_Seek_NBG
|
|||
void AIEnter_Seek_NBG(bot_state_t *bs, char *s) {
|
||||
bot_goal_t goal;
|
||||
char buf[144];
|
||||
int damage = RQ3_Bot_NeedToBandage(bs);
|
||||
|
||||
if (trap_BotGetTopGoal(bs->gs, &goal)) {
|
||||
trap_BotGoalName(goal.number, buf, 144);
|
||||
|
@ -1968,6 +2036,13 @@ void AIEnter_Seek_NBG(bot_state_t *bs, char *s) {
|
|||
else {
|
||||
BotRecordNodeSwitch(bs, "seek NBG", "no goal", s);
|
||||
}
|
||||
//Makro - check if the bot needs to bandage
|
||||
if (damage == 2 || ((damage == 1) && RQ3_Bot_CheckBandage(bs))) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
bs->ainode = AINode_Seek_ActivateEntity;
|
||||
bs->ainode = AINode_Seek_NBG;
|
||||
}
|
||||
|
||||
|
@ -2093,6 +2168,7 @@ AIEnter_Seek_LTG
|
|||
void AIEnter_Seek_LTG(bot_state_t *bs, char *s) {
|
||||
bot_goal_t goal;
|
||||
char buf[144];
|
||||
int damage = RQ3_Bot_NeedToBandage(bs);
|
||||
|
||||
if (trap_BotGetTopGoal(bs->gs, &goal)) {
|
||||
trap_BotGoalName(goal.number, buf, 144);
|
||||
|
@ -2101,6 +2177,12 @@ void AIEnter_Seek_LTG(bot_state_t *bs, char *s) {
|
|||
else {
|
||||
BotRecordNodeSwitch(bs, "seek LTG", "no goal", s);
|
||||
}
|
||||
//Makro - check if the bot needs to bandage
|
||||
if (damage == 2 || ((damage == 1) && RQ3_Bot_CheckBandage(bs))) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
bs->ainode = AINode_Seek_LTG;
|
||||
}
|
||||
|
||||
|
@ -2280,12 +2362,18 @@ AIEnter_Battle_Fight
|
|||
void AIEnter_Battle_Fight(bot_state_t *bs, char *s) {
|
||||
BotRecordNodeSwitch(bs, "battle fight", "", s);
|
||||
trap_BotResetLastAvoidReach(bs->ms);
|
||||
//Makro - check if the bot has leg damage
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
bs->ainode = AINode_Battle_Fight;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
AIEnter_Battle_Fight
|
||||
AIEnter_Battle_SuicidalFight
|
||||
==================
|
||||
*/
|
||||
void AIEnter_Battle_SuicidalFight(bot_state_t *bs, char *s) {
|
||||
|
@ -2338,6 +2426,14 @@ int AINode_Battle_Fight(bot_state_t *bs) {
|
|||
if (bs->enemydeath_time) {
|
||||
if (bs->enemydeath_time < FloatTime() - 1.0) {
|
||||
bs->enemydeath_time = 0;
|
||||
//Makro - check if the bot needs to bandage
|
||||
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
||||
if (RQ3_Bot_CheckBandage(bs)) {
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}//
|
||||
if (bs->enemysuicide) {
|
||||
BotChat_EnemySuicide(bs);
|
||||
}
|
||||
|
@ -2683,28 +2779,36 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
}
|
||||
//if the enemy is NOT visible for 4 seconds
|
||||
if (bs->enemyvisible_time < FloatTime() - 4) {
|
||||
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
|
||||
//Makro - bot retreating, enemy not in sight - a good time to bandage
|
||||
if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
|
||||
//If not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
/*
|
||||
if (bot_developer.integer == 2) {
|
||||
G_Printf("^5BOT CODE: ^7Bandaging\n");
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
|
||||
return qfalse;
|
||||
}
|
||||
//else if the enemy is NOT visible
|
||||
else if (bs->enemyvisible_time < FloatTime()) {
|
||||
//if there is another enemy
|
||||
if (BotFindEnemy(bs, -1)) {
|
||||
//if the bot has leg damage
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
//If the bot wants to bandage and not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING && RQ3_Bot_CheckBandage(bs)) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
AIEnter_Battle_Fight(bs, "battle retreat: another enemy");
|
||||
return qfalse;
|
||||
} else {
|
||||
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
||||
//If not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.30 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.29 2002/05/05 15:18:02 makro
|
||||
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
|
||||
// Made flags only spawn in CTF mode
|
||||
|
@ -261,9 +264,6 @@ void BotAttack(bot_state_t *bs) {
|
|||
|
||||
//Makro - if the weapon isn't ready, stop
|
||||
if (bs->cur_ps.weaponstate != WEAPON_READY) {
|
||||
#ifdef DEBUG
|
||||
BotAI_Print(PRT_MESSAGE, "weapon not ready (%i)\n", bs->cur_ps.weapon);
|
||||
#endif //DEBUG
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -403,6 +403,20 @@ void BotSetUserInfo(bot_state_t *bs, char *key, char *value) {
|
|||
ClientUserinfoChanged( bs->client );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
BotGetUserInfoKey
|
||||
|
||||
Added by Makro
|
||||
==================
|
||||
*/
|
||||
char *BotGetUserInfoKey(bot_state_t *bs, char *key) {
|
||||
char userinfo[MAX_INFO_STRING];
|
||||
|
||||
trap_GetUserinfo(bs->client, userinfo, sizeof(userinfo));
|
||||
return Info_ValueForKey(userinfo, key);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
BotCTFCarryingFlag
|
||||
|
@ -1925,39 +1939,41 @@ that the trap calls don't seem to
|
|||
#define Score_HC_2 65
|
||||
#define Score_HC_3 80
|
||||
|
||||
int RQ3_Bot_WeaponFitness(bot_state_t *bs, int weapon)
|
||||
#define PLAYER_SIZE_X 30.0f
|
||||
#define PLAYER_SIZE_Y 49.0f
|
||||
|
||||
float RQ3_Bot_WeaponFitness(bot_state_t *bs, int weapon)
|
||||
{
|
||||
int dist = bs->inventory[ENEMY_HORIZONTAL_DIST] * bs->inventory[ENEMY_HORIZONTAL_DIST] +
|
||||
bs->inventory[ENEMY_HEIGHT] * bs->inventory[ENEMY_HEIGHT];
|
||||
if (dist <= 0) {
|
||||
dist = 8;
|
||||
}
|
||||
|
||||
//no ammo
|
||||
if (bs->cur_ps.ammo[weapon] <= 0 && !RQ3_Bot_CanReload(bs, weapon))
|
||||
return 0;
|
||||
|
||||
//psx * psy / ((hs * d / 8192) * (vs * d / 8192))
|
||||
switch (weapon) {
|
||||
case WP_PISTOL:
|
||||
return 70;
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((PISTOL_SPREAD * dist / 8192) * (PISTOL_SPREAD * dist / 8192)) * bs->inventory[INVENTORY_PISTOLAMMO] * PISTOL_DAMAGE;
|
||||
case WP_AKIMBO:
|
||||
return 80;
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((PISTOL_SPREAD * dist / 8192) * (PISTOL_SPREAD * dist / 8192)) * bs->inventory[INVENTORY_AKIMBOAMMO] * PISTOL_DAMAGE;
|
||||
case WP_M3:
|
||||
{
|
||||
if (dist > 1000)
|
||||
return (int) (Score_M3_1 * 1000 / dist);
|
||||
else if (dist > 500)
|
||||
return Score_M3_2;
|
||||
else
|
||||
return Score_M3_3;
|
||||
}
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((DEFAULT_M3_HSPREAD * dist / 8192) * (DEFAULT_M3_VSPREAD * dist / 8192)) * bs->inventory[INVENTORY_M3AMMO] * M3_DAMAGE * 10;
|
||||
case WP_HANDCANNON:
|
||||
{
|
||||
if (dist > 500)
|
||||
return 0;
|
||||
else if (dist > 200)
|
||||
return 50;
|
||||
else if (dist > 100)
|
||||
return 50;
|
||||
else
|
||||
return 80;
|
||||
}
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((DEFAULT_SHOTGUN_HSPREAD * dist / 8192) * (DEFAULT_SHOTGUN_VSPREAD * dist / 8192)) * bs->inventory[INVENTORY_HANDCANNONAMMO] * HANDCANNON_DAMAGE * 10;
|
||||
case WP_M4:
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((M4_SPREAD * dist / 8192) * (M4_SPREAD * dist / 8192)) * bs->inventory[INVENTORY_M4AMMO] * M4_DAMAGE;
|
||||
case WP_MP5:
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((MP5_SPREAD * dist / 8192) * (MP5_SPREAD * dist / 8192)) * bs->inventory[INVENTORY_MP5AMMO] * MP5_DAMAGE;
|
||||
case WP_SSG3000:
|
||||
return (float) PLAYER_SIZE_X * PLAYER_SIZE_Y / ((SNIPER_SPREAD * dist / 8192) * (SNIPER_SPREAD * dist / 8192)) * bs->inventory[INVENTORY_SSG3000AMMO] * SNIPER_DAMAGE;
|
||||
case WP_KNIFE:
|
||||
return 0.1f;
|
||||
case WP_GRENADE:
|
||||
return 1.0f;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -1969,7 +1985,17 @@ RQ3_Bot_ChooseWeapon
|
|||
Added by Makro
|
||||
======================
|
||||
*/
|
||||
void RQ3_Bot_ChooseBestFightWeapon(bot_state_t *bs) {
|
||||
int RQ3_Bot_ChooseBestFightWeapon(bot_state_t *bs) {
|
||||
/*
|
||||
int i;
|
||||
|
||||
for (i=WP_NONE+1; i<WP_NUM_WEAPONS; i++) {
|
||||
if ((bs->cur_ps.stats[STAT_WEAPONS] & (1 << i)) == (1 << i)) {
|
||||
BotAI_Print(PRT_MESSAGE, "Weapon %i: %f\n", i, RQ3_Bot_WeaponFitness(bs, i));
|
||||
}
|
||||
}
|
||||
*/
|
||||
return trap_BotChooseBestFightWeapon(bs->ws, bs->inventory);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1991,7 +2017,9 @@ void BotChooseWeapon(bot_state_t *bs) {
|
|||
trap_EA_SelectWeapon(bs->client, bs->weaponnum);
|
||||
}
|
||||
else {
|
||||
newweaponnum = trap_BotChooseBestFightWeapon(bs->ws, bs->inventory);
|
||||
//Makro - new function
|
||||
//newweaponnum = trap_BotChooseBestFightWeapon(bs->ws, bs->inventory);
|
||||
newweaponnum = RQ3_Bot_ChooseBestFightWeapon(bs);
|
||||
if (bs->weaponnum != newweaponnum) bs->weaponchange_time = FloatTime();
|
||||
// JBravo: test hack
|
||||
// Makro - test unhack :P
|
||||
|
@ -2490,6 +2518,21 @@ void BotUseInvulnerability(bot_state_t *bs) {
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
RQ3_Bot_NeedToBandage
|
||||
|
||||
Added by Makro
|
||||
==================
|
||||
*/
|
||||
int RQ3_Bot_NeedToBandage( bot_state_t *bs) {
|
||||
if ((bs->cur_ps.stats[STAT_RQ3] & RQ3_BANDAGE_NEED) == RQ3_BANDAGE_NEED)
|
||||
return 1;
|
||||
if ((bs->cur_ps.stats[STAT_RQ3] & RQ3_LEGDAMAGE) == RQ3_LEGDAMAGE)
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
RQ3_Bot_CheckBandage
|
||||
|
@ -2518,18 +2561,16 @@ BotBattleUseItems
|
|||
*/
|
||||
void BotBattleUseItems(bot_state_t *bs) {
|
||||
//Makro - bot was hit; if very low on health, bandage immediately, otherwise, bandage randomly
|
||||
/*
|
||||
if ( bs->lastframe_health > bs->inventory[INVENTORY_HEALTH] ) {
|
||||
if (RQ3_Bot_CheckBandage(bs))
|
||||
//Makro - if not bandaging already
|
||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
/*
|
||||
if (bot_developer.integer == 2) {
|
||||
G_Printf(va("^5BOT CODE: ^7Bandaging with %i health\n", bs->inventory[INVENTORY_HEALTH]));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
*/
|
||||
//On second though, bots shouldn't bandage at all during combat
|
||||
|
||||
if (bs->inventory[INVENTORY_HEALTH] < 40) {
|
||||
if (bs->inventory[INVENTORY_TELEPORTER] > 0) {
|
||||
|
@ -5772,16 +5813,16 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
|||
case EV_FOOTSPLASH:
|
||||
case EV_FOOTWADE:
|
||||
case EV_SWIM:
|
||||
break;
|
||||
case EV_FALL_SHORT:
|
||||
break;
|
||||
case EV_FALL_MEDIUM:
|
||||
case EV_FALL_FAR: // Makro - check for falling damage
|
||||
case EV_FALL_FAR:
|
||||
case EV_FALL_FAR_NOSOUND: // Makro - check for falling damage
|
||||
{
|
||||
int skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||
//Makro - this is the attack skill, we should be using the overall skill
|
||||
int skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||
if (random() > (1.0f - skill)) {
|
||||
if ((bs->cur_ps.stats[STAT_RQ3] & RQ3_BANDAGE_NEED) == RQ3_BANDAGE_NEED ||
|
||||
(bs->cur_ps.stats[STAT_RQ3] & RQ3_LEGDAMAGE) == RQ3_LEGDAMAGE) {
|
||||
//Makro - this is the attack skill, we should be using the overall skill
|
||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.7 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.6 2002/05/02 23:05:25 makro
|
||||
// Loading screen. Jump kicks. Bot stuff
|
||||
//
|
||||
|
@ -186,11 +189,12 @@ void BotMapScripts(bot_state_t *bs);
|
|||
//RQ3 bot functions
|
||||
qboolean RQ3_Bot_CheckBandage( bot_state_t *bs );
|
||||
qboolean RQ3_Bot_CanReload( bot_state_t *bs, int weapon );
|
||||
int RQ3_Bot_NeedToBandage( bot_state_t *bs);
|
||||
void VectorTargetDist(vec3_t src, vec3_t dest, int dist, vec3_t final);
|
||||
void BotAttack(bot_state_t *bs);
|
||||
bot_moveresult_t BotMoveTo(bot_state_t *bs, vec3_t dest);
|
||||
void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist);
|
||||
|
||||
char *BotGetUserInfoKey(bot_state_t *bs, char *key);
|
||||
|
||||
//ctf flags
|
||||
#define CTF_FLAG_NONE 0
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.9 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.8 2002/05/03 18:09:20 makro
|
||||
// Bot stuff. Jump kicks
|
||||
//
|
||||
|
@ -682,6 +685,14 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
|
|||
Info_SetValueForKey( userinfo, "skill", va( "%5.2f", skill ) );
|
||||
Info_SetValueForKey( userinfo, "team", team );
|
||||
|
||||
if ( g_gametype.integer == GT_TEAMPLAY ) {
|
||||
//Makro - load custom weapon/item from bot file
|
||||
tpWeapon = CharToWeapon(Info_ValueForKey(botinfo, "weapon"), WP_M4);
|
||||
tpItem = CharToItem(Info_ValueForKey(botinfo, "item"), HI_LASER);
|
||||
}
|
||||
Info_SetValueForKey( userinfo, "tpw", va("%i", tpWeapon - WP_NONE) );
|
||||
Info_SetValueForKey( userinfo, "tpi", va("%i", tpItem - HI_NONE) );
|
||||
|
||||
bot = &g_entities[ clientNum ];
|
||||
bot->r.svFlags |= SVF_BOT;
|
||||
bot->inuse = qtrue;
|
||||
|
@ -689,12 +700,6 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
|
|||
// register the userinfo
|
||||
trap_SetUserinfo( clientNum, userinfo );
|
||||
|
||||
if ( g_gametype.integer == GT_TEAMPLAY ) {
|
||||
//Makro - load custom weapon/item from bot file
|
||||
tpWeapon = CharToWeapon(Info_ValueForKey(botinfo, "weapon"), WP_M4);
|
||||
tpItem = CharToItem(Info_ValueForKey(botinfo, "item"), HI_LASER);
|
||||
}
|
||||
|
||||
// have it connect to the game as a normal client
|
||||
if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.73 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.72 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
|
@ -1078,10 +1081,13 @@ void ClientUserinfoChanged( int clientNum ) {
|
|||
// send over a subset of the userinfo keys so other clients can
|
||||
// print scoreboards, display models, and play custom sounds
|
||||
if ( ent->r.svFlags & SVF_BOT ) {
|
||||
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d",
|
||||
//Makro - adding teamplay weapon/item info for bots
|
||||
//s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d",
|
||||
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d\\tpw\\%s\\tpi\\%s",
|
||||
client->pers.netname, team, model, headModel, c1, c2,
|
||||
client->pers.maxHealth, client->sess.wins, client->sess.losses,
|
||||
Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader );
|
||||
//Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader );
|
||||
Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader, Info_ValueForKey(userinfo, "tpw"), Info_ValueForKey(userinfo, "tpi"));
|
||||
} else {
|
||||
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d",
|
||||
client->pers.netname, client->sess.sessionTeam, model, headModel, redTeam, blueTeam, c1, c2,
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: game - Win32 Debug--------------------
|
||||
--------------------Configuration: game - Win32 Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE4.tmp" with contents
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1AC.tmp" with contents
|
||||
[
|
||||
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BUILDING_REF_GL" /D "DEBUG" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
|
||||
"C:\Games\Quake3\rq3source\reaction\game\g_spawn.c"
|
||||
/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
|
||||
"C:\Games\Quake3\rq3source\reaction\game\ai_dmnet.c"
|
||||
]
|
||||
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE4.tmp"
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE5.tmp" with contents
|
||||
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1AC.tmp"
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1AD.tmp" with contents
|
||||
[
|
||||
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"..\Debug/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
|
||||
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /machine:I386 /def:".\game.def" /out:"..\Release/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
|
||||
\reactionoutput\ai_chat.obj
|
||||
\reactionoutput\ai_cmd.obj
|
||||
\reactionoutput\ai_dmnet.obj
|
||||
|
@ -55,11 +55,12 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
|
|||
\reactionoutput\zcam.obj
|
||||
\reactionoutput\zcam_target.obj
|
||||
]
|
||||
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE5.tmp"
|
||||
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1AD.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
g_spawn.c
|
||||
ai_dmnet.c
|
||||
Linking...
|
||||
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.10 2002/05/10 13:21:53 makro
|
||||
// Mainly bot stuff. Also fixed a couple of crash bugs
|
||||
//
|
||||
// Revision 1.9 2002/04/30 11:54:37 makro
|
||||
// Bots rule ! Also, added clips to give all. Maybe some other things
|
||||
//
|
||||
|
@ -224,20 +227,31 @@
|
|||
#define MODELINDEX_CHAINGUN 51
|
||||
*/
|
||||
|
||||
//
|
||||
#define WEAPONINDEX_KNIFE 1
|
||||
#define WEAPONINDEX_PISTOL 2
|
||||
#define WEAPONINDEX_M4 3
|
||||
#define WEAPONINDEX_SSG3000 4
|
||||
#define WEAPONINDEX_MP5 5
|
||||
#define WEAPONINDEX_HANDCANNON 6
|
||||
#define WEAPONINDEX_M3 7
|
||||
#define WEAPONINDEX_AKIMBO 8
|
||||
#define WEAPONINDEX_GRENADE 9
|
||||
/*
|
||||
#define WEAPONINDEX_GRAPPLING_HOOK 10
|
||||
#define WEAPONINDEX_NAILGUN 11
|
||||
#define WEAPONINDEX_PROXLAUNCHER 12
|
||||
#define WEAPONINDEX_CHAINGUN 13
|
||||
*/
|
||||
//Makro - these were messed up
|
||||
/*
|
||||
#define WEAPONINDEX_KNIFE 1
|
||||
#define WEAPONINDEX_PISTOL 2
|
||||
#define WEAPONINDEX_M3 3
|
||||
#define WEAPONINDEX_GRENADE 4
|
||||
#define WEAPONINDEX_HANDCANNON 5
|
||||
#define WEAPONINDEX_AKIMBO 6
|
||||
#define WEAPONINDEX_SSG3000 7
|
||||
#define WEAPONINDEX_MP5 8
|
||||
#define WEAPONINDEX_M4 9
|
||||
*/
|
||||
#define WEAPONINDEX_PISTOL 1
|
||||
#define WEAPONINDEX_M3 2
|
||||
#define WEAPONINDEX_MP5 3
|
||||
#define WEAPONINDEX_HANDCANNON 4
|
||||
#define WEAPONINDEX_SSG3000 5
|
||||
#define WEAPONINDEX_M4 6
|
||||
#define WEAPONINDEX_AKIMBO 7
|
||||
#define WEAPONINDEX_KNIFE 8
|
||||
#define WEAPONINDEX_GRENADE 9
|
||||
|
||||
|
|
Loading…
Reference in a new issue