Skip to content

Commit

Permalink
botlib removal, refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
IR4T4 authored and morsik committed May 6, 2012
1 parent 173c741 commit 10a0785
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 123 deletions.
31 changes: 0 additions & 31 deletions src/game/g_active.c
Expand Up @@ -245,7 +245,6 @@ void G_SetClientSound(gentity_t *ent)
PushBot
==============
*/
void BotVoiceChatAfterIdleTime(int client, const char *id, int mode, int delay, qboolean voiceonly, int idleTime, qboolean forceIfDead);

void PushBot(gentity_t *ent, gentity_t *other)
{
Expand Down Expand Up @@ -273,12 +272,6 @@ void PushBot(gentity_t *ent, gentity_t *other)
VectorNormalize(other->client->ps.velocity);
VectorScale(other->client->ps.velocity, oldspeed, other->client->ps.velocity);
}
//
// also, if "ent" is a bot, tell "other" to move!
if (rand() % 50 == 0 && (ent->r.svFlags & SVF_BOT) && oldspeed < 10)
{
BotVoiceChatAfterIdleTime(ent->s.number, "Move", SAY_TEAM, 1000, qfalse, 20000, qfalse);
}
}

/*
Expand Down Expand Up @@ -359,25 +352,6 @@ qboolean ReadyToConstruct(gentity_t *ent, gentity_t *constructible, qboolean upd
return qtrue;
}

void BotSetBlockEnt(int client, int blocker);
/*
==============
CheckBotImpacts
==============
*/
void CheckBotImpacts(gentity_t *ent, gentity_t *other)
{
char *blockEnts[] = { "func_explosive", NULL };
int j;

for (j = 0; blockEnts[j]; j++)
{
if (other->classname && !Q_stricmp(other->classname, blockEnts[j]))
{
BotSetBlockEnt(ent->s.number, other->s.number);
}
}
}

//==============================================================

Expand Down Expand Up @@ -433,11 +407,6 @@ void ClientImpacts(gentity_t *ent, pmove_t *pm)
PushBot(other, ent);
}

if (ent->r.svFlags & SVF_BOT)
{
CheckBotImpacts(ent, other);
}

if (!other->touch)
{
continue;
Expand Down
18 changes: 4 additions & 14 deletions src/game/g_cmds.c
Expand Up @@ -33,8 +33,6 @@

#include "g_local.h"

void BotDebug(int clientNum);
void GetBotAutonomies(int clientNum, int *weapAutonomy, int *moveAutonomy);
qboolean G_IsOnFireteam(int entityNum, fireteamData_t **teamNum);

/*
Expand Down Expand Up @@ -847,8 +845,6 @@ void Cmd_Kill_f(gentity_t *ent)
player_die(ent, ent, ent, (g_gamestate.integer == GS_PLAYING) ? 100000 : 135, MOD_SUICIDE);
}

void BotRecordTeamChange(int client);

void G_TeamDataForString(const char *teamstr, int clientNum, team_t *team, spectatorState_t *sState, int *specClient)
{
*sState = SPECTATOR_NOT;
Expand Down Expand Up @@ -1118,7 +1114,6 @@ qboolean SetTeam(gentity_t *ent, char *s, qboolean force, weapon_t w1, weapon_t
}

G_verifyMatchState(oldTeam);
BotRecordTeamChange(clientNum);

// Reset stats when changing teams
if (team != oldTeam)
Expand Down Expand Up @@ -1887,8 +1882,6 @@ void Cmd_Say_f(gentity_t *ent, int mode, qboolean arg0)
G_Say(ent, NULL, mode, ConcatArgs(((arg0) ? 0 : 1)));
}

extern void BotRecordVoiceChat(int client, int destclient, const char *id, int mode, qboolean noResponse);

// NERVE - SMF
void G_VoiceTo(gentity_t *ent, gentity_t *other, int mode, const char *id, qboolean voiceonly)
{
Expand Down Expand Up @@ -1956,10 +1949,6 @@ void G_VoiceTo(gentity_t *ent, gentity_t *other, int mode, const char *id, qbool
cmd = "vchat";
}

// RF, record this chat so bots can parse them
// bots respond with voiceonly, so we check for this so they dont keep responding to responses
BotRecordVoiceChat(ent->s.number, other->s.number, id, mode, voiceonly == 2);

if (voiceonly == 2)
{
voiceonly = qfalse;
Expand Down Expand Up @@ -2919,30 +2908,31 @@ void Cmd_SetCameraOrigin_f(gentity_t *ent)
}
}

extern gentity_t *BotFindEntityForName(char *name);

/*
==============
Cmd_InterruptCamera_f
==============
*/
void Cmd_InterruptCamera_f(gentity_t *ent)
{

/* FIXME
gentity_t *player;
if (g_gametype.integer != GT_SINGLE_PLAYER && g_gametype.integer != GT_COOP)
{
return;
}
player = BotFindEntityForName("player");
player = BotFindEntityForName("player"); // BotFindEntityForName is obsolete use FindEntityForName?
if (!player)
{
return;
}
G_Script_ScriptEvent(player, "trigger", "cameraInterrupt");
*/
}

extern vec3_t playerMins;
Expand Down
16 changes: 2 additions & 14 deletions src/game/g_combat.c
Expand Up @@ -370,7 +370,6 @@ char *modNames[] =
player_die
==================
*/
void BotRecordTeamDeath(int client);

void player_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath)
{
Expand Down Expand Up @@ -1883,24 +1882,13 @@ void G_Damage(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t
// RF, entity scripting
if (targ->health <= 0) // might have revived itself in death function
{
if (targ->r.svFlags & SVF_BOT)
{
// See if this is the first kill of this bot
if (wasAlive)
{
Bot_ScriptEvent(targ->s.number, "death", "");
}
}
else if ((targ->s.eType != ET_CONSTRUCTIBLE && targ->s.eType != ET_EXPLOSIVE) ||
(targ->s.eType == ET_CONSTRUCTIBLE && !targ->desstages)) // call manually if using desstages
if ( (!(targ->r.svFlags & SVF_BOT) && targ->s.eType != ET_CONSTRUCTIBLE && targ->s.eType != ET_EXPLOSIVE) ||
( targ->s.eType == ET_CONSTRUCTIBLE && !targ->desstages) ) // call manually if using desstages
{
G_Script_ScriptEvent(targ, "death", "");
}
}


}

}
else if (targ->pain)
{
Expand Down
11 changes: 3 additions & 8 deletions src/game/g_func_decs.h
Expand Up @@ -497,7 +497,7 @@ extern qboolean etpro_ScriptAction_SetValues(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_AbortIfNotSinglePlayer(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_AbortIfWarmup(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_Cvar(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_SpawnBot(gentity_t *ent, char *params) ;

extern qboolean G_ScriptAction_ConstructibleDuration(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_ConstructibleWeaponclass(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_ConstructibleHealth(gentity_t *ent, char *params) ;
Expand All @@ -506,12 +506,7 @@ extern qboolean G_ScriptAction_ConstructibleConstructXPBonus(gentity_t *ent, cha
extern qboolean G_ScriptAction_ConstructibleChargeBarReq(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_ConstructibleClass(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_Construct(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_SetBotGoalPriority(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_SetAASState(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_SetBotGoalState(gentity_t *ent, char *params) ;
extern qboolean G_IsValidBotStateGoal(gentity_t *ent) ;
extern qboolean G_ScriptAction_BotDebugging(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_RemoveBot(gentity_t *ent, char *params) ;

extern qboolean G_ScriptAction_PrintGlobalAccum(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_PrintAccum(gentity_t *ent, char *params) ;
extern qboolean G_ScriptAction_SetHQStatus(gentity_t *ent, char *params) ;
Expand Down Expand Up @@ -1224,7 +1219,7 @@ extern qboolean ClientInactivityTimer(gclient_t *client) ;
extern void SpectatorThink(gentity_t *ent, usercmd_t *ucmd) ;
extern void G_TouchTriggers(gentity_t *ent) ;
extern void ClientImpacts(gentity_t *ent, pmove_t *pm) ;
extern void CheckBotImpacts(gentity_t *ent, gentity_t *other) ;

extern qboolean ReadyToConstruct(gentity_t *ent, gentity_t *constructible, qboolean updateState) ;
extern qboolean ReadyToCallArtillery(gentity_t *ent) ;
extern qboolean ClientNeedsAmmo(int client) ;
Expand Down
11 changes: 3 additions & 8 deletions src/game/g_funcs.h
Expand Up @@ -497,7 +497,7 @@
{ "G_ScriptAction_AbortIfNotSinglePlayer", (byte *)G_ScriptAction_AbortIfNotSinglePlayer },
{ "G_ScriptAction_AbortIfWarmup", (byte *)G_ScriptAction_AbortIfWarmup },
{ "G_ScriptAction_Cvar", (byte *)G_ScriptAction_Cvar },
{ "G_ScriptAction_SpawnBot", (byte *)G_ScriptAction_SpawnBot },

{ "G_ScriptAction_ConstructibleDuration", (byte *)G_ScriptAction_ConstructibleDuration },
{ "G_ScriptAction_ConstructibleWeaponclass", (byte *)G_ScriptAction_ConstructibleWeaponclass },
{ "G_ScriptAction_ConstructibleHealth", (byte *)G_ScriptAction_ConstructibleHealth },
Expand All @@ -506,12 +506,7 @@
{ "G_ScriptAction_ConstructibleChargeBarReq", (byte *)G_ScriptAction_ConstructibleChargeBarReq },
{ "G_ScriptAction_ConstructibleClass", (byte *)G_ScriptAction_ConstructibleClass },
{ "G_ScriptAction_Construct", (byte *)G_ScriptAction_Construct },
{ "G_ScriptAction_SetBotGoalPriority", (byte *)G_ScriptAction_SetBotGoalPriority },
{ "G_ScriptAction_SetAASState", (byte *)G_ScriptAction_SetAASState },
{ "G_ScriptAction_SetBotGoalState", (byte *)G_ScriptAction_SetBotGoalState },
{ "G_IsValidBotStateGoal", (byte *)G_IsValidBotStateGoal },
{ "G_ScriptAction_BotDebugging", (byte *)G_ScriptAction_BotDebugging },
{ "G_ScriptAction_RemoveBot", (byte *)G_ScriptAction_RemoveBot },

{ "G_ScriptAction_PrintGlobalAccum", (byte *)G_ScriptAction_PrintGlobalAccum },
{ "G_ScriptAction_PrintAccum", (byte *)G_ScriptAction_PrintAccum },
{ "G_ScriptAction_SetHQStatus", (byte *)G_ScriptAction_SetHQStatus },
Expand Down Expand Up @@ -1223,7 +1218,7 @@
{ "SpectatorThink", (byte *)SpectatorThink },
{ "G_TouchTriggers", (byte *)G_TouchTriggers },
{ "ClientImpacts", (byte *)ClientImpacts },
{ "CheckBotImpacts", (byte *)CheckBotImpacts },

{ "ReadyToConstruct", (byte *)ReadyToConstruct },
{ "ReadyToCallArtillery", (byte *)ReadyToCallArtillery },
{ "ClientNeedsAmmo", (byte *)ClientNeedsAmmo },
Expand Down
9 changes: 0 additions & 9 deletions src/game/g_items.c
Expand Up @@ -618,9 +618,6 @@ void G_DropWeapon(gentity_t *ent, weapon_t weapon)
client->ps.ammoclip[BG_FindClipForWeapon(weapon)] = 0;
}

// TAT 1/6/2003 - Bot picks up a new weapon
void BotPickupWeapon(int client, int weaponnum, qboolean alreadyHave);

qboolean G_CanPickupWeapon(weapon_t weapon, gentity_t *ent)
{
if (ent->client->sess.sessionTeam == TEAM_AXIS)
Expand Down Expand Up @@ -808,12 +805,6 @@ int Pickup_Weapon(gentity_t *ent, gentity_t *other)
}
}

// TAT 1/6/2003 - If we are a bot, call the pickup function
if (other->r.svFlags & SVF_BOT)
{
BotPickupWeapon(other->s.number, ent->item->giTag, alreadyHave);
}

return -1;
}

Expand Down
10 changes: 0 additions & 10 deletions src/game/g_local.h
Expand Up @@ -1571,14 +1571,6 @@ float AngleDifference(float ang1, float ang2);
// g_props.c
void Props_Chair_Skyboxtouch(gentity_t *ent);

// ai_script.c
void Bot_ScriptLoad(void);
qboolean Bot_ScriptInitBot(int entnum);
void Bot_ScriptEvent(int entityNum, char *eventStr, char *params);

void Bot_TeamScriptEvent(int team, char *eventStr, char *params);


#include "g_team.h" // teamplay specific stuff

extern level_locals_t level;
Expand Down Expand Up @@ -2258,8 +2250,6 @@ void G_SetTargetName(gentity_t *ent, char *targetname);
void G_KillEnts(const char *target, gentity_t *ignore, gentity_t *killer, meansOfDeath_t mod);
void trap_EngineerTrace(trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask);

qboolean G_ConstructionIsPartlyBuilt(gentity_t *ent);

int G_CountTeamMedics(team_t team, qboolean alivecheck);
qboolean G_TankIsOccupied(gentity_t *ent);
qboolean G_TankIsMountable(gentity_t *ent, gentity_t *other);
Expand Down

0 comments on commit 10a0785

Please sign in to comment.