Customizable color for the loading screen text. Bot stuff

This commit is contained in:
Andrei Drexler 2002-05-02 12:44:58 +00:00
parent e2e032c21a
commit 46b4488e28
4 changed files with 69 additions and 27 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.19 2002/05/02 12:44:58 makro
// Customizable color for the loading screen text. Bot stuff
//
// Revision 1.18 2002/05/02 00:12:22 makro
// Improved reloading and ammo handling for akimbo/hc
//
@ -1413,20 +1416,12 @@ int AINode_Stand(bot_state_t *bs) {
bs->standfindenemy_time = FloatTime() + BotChatTime(bs) + 0.1;
bs->stand_time = FloatTime() + BotChatTime(bs) + 0.1;
}
//Makro - if bot isn't bandaging already
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
//Makro - bot should bandage
if (bs->inventory[INVENTORY_HEALTH] > 60) {
willBandage = (random() < 0.3);
} else if (bs->inventory[INVENTORY_HEALTH] > 40) {
willBandage = (random() < 0.5);
} else if (bs->inventory[INVENTORY_HEALTH] > 20) {
willBandage = (random() < 0.7);
} else {
willBandage = qtrue;
}
if (willBandage) {
if (RQ3_Bot_CheckBandage(bs)) {
//Makro - if not bandaging already
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
Cmd_Bandage( &g_entities[bs->entitynum] );
//Not 100% sure this will work, but oh well...
AIEnter_Battle_Retreat(bs, "stand: bandaging");
}
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.23 2002/05/02 12:44:58 makro
// Customizable color for the loading screen text. Bot stuff
//
// Revision 1.22 2002/05/02 00:12:22 makro
// Improved reloading and ammo handling for akimbo/hc
//
@ -310,6 +313,19 @@ void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist) {
BotMoveTo(bs, dir);
}
/*
==================
RQ3_Bot_GetWeaponInfo
Added by Makro
==================
*/
void RQ3_Bot_GetWeaponInfo(bot_state_t *bs, int weaponstate, int weapon, void *weaponinfo) {
trap_BotGetWeaponInfo(weaponstate, weapon, weaponinfo);
//TODO: - set spreads here depending on what the player is doing - crouching, running etc.
// - set grenade range
}
/*
==================
BotSetUserInfo
@ -1566,6 +1582,7 @@ void BotRQ3TPSeekGoals( bot_state_t *bs ) {
//no arrive message
//bs->arrive_time = 0;
//
bs->ctfroam_time = FloatTime() + CTF_ROAM_TIME;
BotVoiceChat(bs, bs->teammate, VOICECHAT_ONFOLLOW);
//get the team goal time
bs->teamgoal_time = FloatTime() + TEAM_ACCOMPANY_TIME;
@ -2030,7 +2047,7 @@ void BotUpdateInventory(bot_state_t *bs) {
bs->inventory[INVENTORY_HANDCANNONAMMO] = amt;
//Blaze: Same ammo for Pistol and Akimbo Pistols
//bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_AKIMBO];
//Makro - same hack for akimbos
//Makro - same hack for akimbo
amt = bs->cur_ps.ammo[WP_AKIMBO] + ent->client->numClips[WP_AKIMBO] * RQ3_PISTOL_CLIP;
if (amt < 2)
amt = 0;
@ -2349,6 +2366,9 @@ Added by Makro
qboolean RQ3_Bot_CheckBandage( bot_state_t *bs ) {
qboolean doBandage = qfalse;
if ( (bs->flags & BFL_FIGHTSUICIDAL) == BFL_FIGHTSUICIDAL)
return qfalse;
if (bs->inventory[INVENTORY_HEALTH] > 20)
doBandage = (random() > (float) bs->inventory[INVENTORY_HEALTH] / 100.0f);
else
@ -2367,13 +2387,14 @@ void BotBattleUseItems(bot_state_t *bs) {
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)
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]));
}
*/
/*
if (bot_developer.integer == 2) {
G_Printf(va("^5BOT CODE: ^7Bandaging with %i health\n", bs->inventory[INVENTORY_HEALTH]));
}
*/
}
}
if (bs->inventory[INVENTORY_HEALTH] < 40) {
@ -2867,7 +2888,8 @@ int BotWantsToCamp(bot_state_t *bs) {
if (BotAggression(bs) < 50) return qfalse;
//the bot should have at least have the rocket launcher, the railgun or the bfg10k with some ammo
// Elder: changed a few of the numbers
if ((bs->inventory[INVENTORY_HANDCANNON] <= 0 || bs->inventory[INVENTORY_M3AMMO < 5]) &&
//Makro - fixed a typo - bs->inventory[INVENTORY_M3AMMO < 5]
if ((bs->inventory[INVENTORY_HANDCANNON] <= 0 || bs->inventory[INVENTORY_M3AMMO] < 5) &&
(bs->inventory[INVENTORY_M4] <= 0 || bs->inventory[INVENTORY_M4AMMO] < 10) &&
(bs->inventory[INVENTORY_SSG3000] <= 0 || bs->inventory[INVENTORY_SSG3000AMMO] < 6)) {
return qfalse;
@ -3672,7 +3694,9 @@ void BotAimAtEnemy(bot_state_t *bs) {
}
//get the weapon information
trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
//trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
//Makro - new function
RQ3_Bot_GetWeaponInfo(bs, bs->ws, bs->weaponnum, &wi);
//get the weapon specific aim accuracy and or aim skill
//Blaze: just gonna set the Characteristic aim to machinegun for all of these, but I am still doing the if's so we can edit it later for bot support
@ -3697,20 +3721,23 @@ void BotAimAtEnemy(bot_state_t *bs) {
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_MACHINEGUN, 0, 1);
}
//Blaze: Reaction HandCannon
//Makro - using shotgun accuracy for now
if (wi.number == WP_HANDCANNON) {
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_MACHINEGUN, 0, 1);
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_SHOTGUN, 0, 1);
}
//Blaze: Reaction Shotgun
//Makro - using shotgun accuracy for now
if (wi.number == WP_M3) {
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_MACHINEGUN, 0, 1);
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_SHOTGUN, 0, 1);
}
//Blaze: Reaction Akimbo
if (wi.number == WP_AKIMBO) {
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_MACHINEGUN, 0, 1);
}
//Blaze: Reaction Grenade
//Makro - changed to grenade launcher accuracy
if (wi.number == WP_GRENADE) {
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_MACHINEGUN, 0, 1);
aim_accuracy = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_AIM_ACCURACY_GRENADELAUNCHER, 0, 1);
}
//
if (aim_accuracy <= 0) aim_accuracy = 0.0001f;
@ -3962,7 +3989,9 @@ void BotCheckAttack(bot_state_t *bs) {
//
//Makro - we need the weapon info sooner
//get the weapon info
trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
//trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
//Makro - new function
RQ3_Bot_GetWeaponInfo(bs, bs->ws, bs->weaponnum, &wi);
reactiontime = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_REACTIONTIME, 0, 1);
if (bs->enemysight_time > FloatTime() - reactiontime) return;
if (bs->teleport_time > FloatTime() - reactiontime) return;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.60 2002/05/02 12:44:58 makro
// Customizable color for the loading screen text. Bot stuff
//
// Revision 1.59 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
@ -416,7 +419,10 @@ extern radio_msg_t female_radio_msgs[];
#define CS_SHADERSTATE 24
#define CS_BOTINFO 25
#define CS_ITEMS 27 // string of 0's and 1's that tell which items are present
#define CS_ITEMS 27 // string of 0's and 1's that tell which items are present
//Makro - color for the loading screen text
#define CS_LOADINGSCREEN 29
#define CS_MODELS 32
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.20 2002/05/02 12:44:58 makro
// Customizable color for the loading screen text. Bot stuff
//
// Revision 1.19 2002/04/30 12:23:35 jbravo
// Warningfix
//
@ -702,6 +705,8 @@ Every map should have exactly one worldspawn.
*/
void SP_worldspawn( void ) {
char *s;
vec3_t color;
char info[MAX_INFO_STRING];
G_SpawnString( "classname", "", &s );
if ( Q_stricmp( s, "worldspawn" ) ) {
@ -719,6 +724,13 @@ void SP_worldspawn( void ) {
G_SpawnString( "message", "", &s );
trap_SetConfigstring( CS_MESSAGE, s ); // map specific message
//Makro - color for the loading screen text
G_SpawnVector( "_color", "1 1 1", color );
Info_SetValueForKey(info, "red", va("%f", color[0]));
Info_SetValueForKey(info, "green", va("%f", color[1]));
Info_SetValueForKey(info, "blue", va("%f", color[2]));
trap_SetConfigstring( CS_LOADINGSCREEN, info );
trap_SetConfigstring( CS_MOTD, g_motd.string ); // message of the day
G_SpawnString( "gravity", "800", &s );