mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-11 15:52:30 +00:00
Bots
This commit is contained in:
parent
765a55f60d
commit
d514faeb74
8 changed files with 131 additions and 38 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.22 2002/05/04 16:13:04 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.21 2002/05/03 18:09:19 makro
|
||||
// Bot stuff. Jump kicks
|
||||
//
|
||||
|
@ -453,9 +456,14 @@ int BotReachedGoal(bot_state_t *bs, bot_goal_t *goal) {
|
|||
//if touching the goal
|
||||
if (trap_BotTouchingGoal(bs->origin, goal)) {
|
||||
if (!(goal->flags & GFL_DROPPED)) {
|
||||
trap_BotSetAvoidGoalTime(bs->gs, goal->number, -1);
|
||||
//Makro - check if the bot picked up a better weapon or item
|
||||
RQ3_Bot_NeedToDropStuff( bs , goal );
|
||||
//also added a TP check
|
||||
if (gametype != GT_TEAMPLAY) {
|
||||
trap_BotSetAvoidGoalTime(bs->gs, goal->number, -1);
|
||||
} else {
|
||||
trap_BotSetAvoidGoalTime(bs->gs, goal->number, FloatTime() + 20.0f + random() * 20.0f);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (g_entities[goal->entitynum].classname) {
|
||||
|
@ -1805,7 +1813,8 @@ int AINode_Seek_ActivateEntity(bot_state_t *bs) {
|
|||
// get the entity info of the entity the bot is shooting at
|
||||
BotEntityInfo(goal->entitynum, &entinfo);
|
||||
// if the entity the bot shoots at moved
|
||||
if (!VectorCompare(bs->activatestack->origin, entinfo.origin)) {
|
||||
// Makro - or if the entity is no longer in use - for func_breakables
|
||||
if (!VectorCompare(bs->activatestack->origin, entinfo.origin) || !(g_entities[entinfo.number].inuse)) {
|
||||
#ifdef DEBUG
|
||||
BotAI_Print(PRT_MESSAGE, "hit shootable button or trigger\n");
|
||||
#endif //DEBUG
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.28 2002/05/04 16:13:04 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.27 2002/05/04 01:21:47 makro
|
||||
// Crash bug :/
|
||||
//
|
||||
|
@ -253,8 +256,12 @@ Added by Makro
|
|||
void BotAttack(bot_state_t *bs) {
|
||||
|
||||
//Makro - if the weapon isn't ready, stop
|
||||
if (bs->cur_ps.weaponstate != WEAPON_READY)
|
||||
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;
|
||||
}
|
||||
|
||||
//If the gun is empty
|
||||
if ( (bs->cur_ps.ammo[bs->cur_ps.weapon]) == 0 ) {
|
||||
|
@ -262,6 +269,9 @@ void BotAttack(bot_state_t *bs) {
|
|||
if ( RQ3_Bot_CanReload(bs, bs->cur_ps.weapon) >= 1 ) {
|
||||
//Cmd_Reload( &g_entities[bs->entitynum] );
|
||||
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
|
||||
#ifdef DEBUG
|
||||
BotAI_Print(PRT_MESSAGE, "empty weapon (%i), reloading\n", bs->cur_ps.weapon);
|
||||
#endif //DEBUG
|
||||
}
|
||||
} else {
|
||||
//Gun is not empty
|
||||
|
@ -343,6 +353,9 @@ qboolean RQ3_Bot_GetWeaponInfo(bot_state_t *bs, int weaponstate, int weapon, voi
|
|||
|
||||
//if the weapon is not valid
|
||||
if (weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS) {
|
||||
#ifdef DEBUG
|
||||
BotAI_Print(PRT_MESSAGE, "weapon not ready (%i)\n", bs->cur_ps.weapon);
|
||||
#endif //DEBUG
|
||||
if (trap_Cvar_VariableIntegerValue("developer")) {
|
||||
BotAI_Print(PRT_ERROR, "Bot_GetWeaponInfo: weapon number out of range (%i)\n", weapon);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.8 2002/05/04 16:13:04 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.7 2002/05/04 01:03:42 makro
|
||||
// Bots
|
||||
//
|
||||
|
@ -194,7 +197,7 @@ int BotAI_GetEntityState( int entityNum, entityState_t *state ) {
|
|||
//Makro - hack for bots
|
||||
//if (ent->r.svFlags & SVF_NOCLIENT) return qfalse;
|
||||
if (ent->r.svFlags & SVF_NOCLIENT)
|
||||
if ( !(ent->s.eFlags & EF_NODRAW) )
|
||||
if ( !(ent->r.svFlags & SVF_BOTHACK) )
|
||||
return qfalse;
|
||||
//end Makro
|
||||
memcpy( state, &ent->s, sizeof(entityState_t) );
|
||||
|
@ -1485,7 +1488,7 @@ int BotAIStartFrame(int time) {
|
|||
}*/
|
||||
//Makro - hack for bots
|
||||
if (ent->r.svFlags & SVF_NOCLIENT) {
|
||||
if ( !(ent->s.eFlags & EF_NODRAW) ) {
|
||||
if ( !(ent->r.svFlags & SVF_BOTHACK) ) {
|
||||
trap_BotLibUpdateEntity(i, NULL);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.65 2002/05/04 16:13:04 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.64 2002/04/26 04:09:11 jbravo
|
||||
// Got rid of the grey excelent icon over players heads.
|
||||
//
|
||||
|
@ -850,9 +853,12 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
|
|||
ent->r.svFlags = SVF_BROADCAST; // send to everyone
|
||||
self->enemy = attacker;
|
||||
if (level.team_round_going) {
|
||||
self->client->ps.persistant[PERS_KILLED]++;
|
||||
//Blaze: Give the attacker 1 kill
|
||||
attacker->client->pers.records[REC_KILLS]++;
|
||||
//Makro - crash bug fix
|
||||
if ((self->client != NULL) && (attacker->client != NULL)) {
|
||||
self->client->ps.persistant[PERS_KILLED]++;
|
||||
//Blaze: Give the attacker 1 kill
|
||||
attacker->client->pers.records[REC_KILLS]++;
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker && attacker->client) {
|
||||
|
@ -1619,14 +1625,17 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
|
|||
|
||||
// NiceAss: This was moved too
|
||||
// add to the attacker's hit counter (if the target isn't a general entity like a prox mine)
|
||||
if (attacker->client && targ != attacker && targ->health > 0 &&
|
||||
targ->s.eType != ET_MISSILE && targ->s.eType != ET_GENERAL) {
|
||||
if (OnSameTeam(targ, attacker)) {
|
||||
attacker->client->ps.persistant[PERS_HITS]--;
|
||||
} else {
|
||||
attacker->client->ps.persistant[PERS_HITS]++;
|
||||
//Makro - added check; q3 crashed sometimes with .dlls
|
||||
if ( (attacker != NULL) && (client != NULL) && (targ != NULL) ) {
|
||||
if (attacker->client && targ != attacker && targ->health > 0 &&
|
||||
targ->s.eType != ET_MISSILE && targ->s.eType != ET_GENERAL) {
|
||||
if (OnSameTeam(targ, attacker)) {
|
||||
attacker->client->ps.persistant[PERS_HITS]--;
|
||||
} else {
|
||||
attacker->client->ps.persistant[PERS_HITS]++;
|
||||
}
|
||||
attacker->client->ps.persistant[PERS_ATTACKEE_ARMOR] = (targ->health<<8)|(client->ps.stats[STAT_ARMOR]);
|
||||
}
|
||||
attacker->client->ps.persistant[PERS_ATTACKEE_ARMOR] = (targ->health<<8)|(client->ps.stats[STAT_ARMOR]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1926,7 +1935,9 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
|
|||
targ->health = -999;
|
||||
}
|
||||
targ->enemy = attacker;
|
||||
targ->die (targ, inflictor, attacker, take, mod);
|
||||
//Makro - crash bug fix
|
||||
if (targ->die)
|
||||
targ->die (targ, inflictor, attacker, take, mod);
|
||||
return;
|
||||
} else if (targ->pain) {
|
||||
targ->pain (targ, attacker, take);
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.36 2002/05/04 16:13:04 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.35 2002/05/04 01:03:43 makro
|
||||
// Bots
|
||||
//
|
||||
|
@ -608,12 +611,21 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
qboolean predict;
|
||||
int bandolierFactor;
|
||||
|
||||
//Makro - some checks
|
||||
if (other == NULL || ent == NULL)
|
||||
return;
|
||||
|
||||
if (!other->client)
|
||||
return;
|
||||
if (other->health < 1)
|
||||
return; // dead people can't pickup
|
||||
|
||||
//Makro - if the item is not sent to the client, picking it up would be kinda odd
|
||||
if (ent->r.svFlags & SVF_NOCLIENT) {
|
||||
//G_Printf("^1Reached SVF_NOCLIENT item\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// the same pickup rules are used for client side and server side
|
||||
if ( !BG_CanItemBeGrabbed( g_gametype.integer, &ent->s, &other->client->ps ) ) return;
|
||||
|
||||
|
@ -1152,7 +1164,7 @@ void FinishSpawningItem( gentity_t *ent ) {
|
|||
if (ent->item != NULL) {
|
||||
if (ent->item->giType == IT_WEAPON || ent->item->giType == IT_AMMO) {
|
||||
if (g_gametype.integer == GT_TEAMPLAY) {
|
||||
ent->r.svFlags |= SVF_NOCLIENT;
|
||||
ent->r.svFlags |= MASK_BOTHACK;
|
||||
ent->s.eFlags |= EF_NODRAW;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.7 2002/05/04 16:13:05 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.6 2002/04/01 02:56:50 jbravo
|
||||
// Some sourcecode reformatting
|
||||
//
|
||||
|
@ -40,7 +43,8 @@
|
|||
#define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox
|
||||
#define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client
|
||||
// (entityShared_t->singleClient)
|
||||
|
||||
#define SVF_BOTHACK 0x00001000
|
||||
#define MASK_BOTHACK (SVF_NOCLIENT|SVF_BOTHACK)
|
||||
//===============================================================
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.75 2002/05/04 16:13:05 makro
|
||||
// Bots
|
||||
//
|
||||
// Revision 1.74 2002/05/04 01:03:43 makro
|
||||
// Bots
|
||||
//
|
||||
|
@ -465,7 +468,7 @@ void CleanLevel()
|
|||
if (!ent->item)
|
||||
continue;
|
||||
//Makro - added this for bots
|
||||
if (ent->r.svFlags & SVF_NOCLIENT)
|
||||
if ( (ent->r.svFlags & SVF_NOCLIENT) && (ent->r.svFlags & SVF_BOTHACK) )
|
||||
continue;
|
||||
if (ent->item->giType == IT_WEAPON) {
|
||||
switch (ent->item->giTag) {
|
||||
|
@ -495,6 +498,8 @@ void CleanLevel()
|
|||
break;
|
||||
}
|
||||
} else if (ent->item->giType == IT_AMMO) {
|
||||
//Makro - added
|
||||
G_FreeEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,32 +3,68 @@
|
|||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: cgame - Win32 Release--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
cgamex86.dll - 0 error(s), 0 warning(s)
|
||||
<h3>
|
||||
--------------------Configuration: game - Win32 Release--------------------
|
||||
--------------------Configuration: game - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2454.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\ai_dmq3.c"
|
||||
]
|
||||
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2454.tmp"
|
||||
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2455.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"
|
||||
\reactionoutput\ai_chat.obj
|
||||
\reactionoutput\ai_cmd.obj
|
||||
\reactionoutput\ai_dmnet.obj
|
||||
\reactionoutput\ai_dmq3.obj
|
||||
\reactionoutput\ai_main.obj
|
||||
\reactionoutput\ai_team.obj
|
||||
\reactionoutput\ai_vcmd.obj
|
||||
\reactionoutput\bg_misc.obj
|
||||
\reactionoutput\bg_pmove.obj
|
||||
\reactionoutput\bg_slidemove.obj
|
||||
\reactionoutput\g_active.obj
|
||||
\reactionoutput\g_arenas.obj
|
||||
\reactionoutput\g_bot.obj
|
||||
\reactionoutput\g_client.obj
|
||||
\reactionoutput\g_cmds.obj
|
||||
\reactionoutput\g_combat.obj
|
||||
\reactionoutput\g_fileio.obj
|
||||
\reactionoutput\g_items.obj
|
||||
\reactionoutput\g_main.obj
|
||||
\reactionoutput\g_matchmode.obj
|
||||
\reactionoutput\g_mem.obj
|
||||
\reactionoutput\g_misc.obj
|
||||
\reactionoutput\g_missile.obj
|
||||
\reactionoutput\g_mover.obj
|
||||
\reactionoutput\g_session.obj
|
||||
\reactionoutput\g_spawn.obj
|
||||
\reactionoutput\g_svcmds.obj
|
||||
\reactionoutput\g_syscalls.obj
|
||||
\reactionoutput\g_target.obj
|
||||
\reactionoutput\g_team.obj
|
||||
\reactionoutput\g_teamplay.obj
|
||||
\reactionoutput\g_trigger.obj
|
||||
\reactionoutput\g_utils.obj
|
||||
\reactionoutput\g_weapon.obj
|
||||
\reactionoutput\q_math.obj
|
||||
\reactionoutput\q_shared.obj
|
||||
\reactionoutput\rxn_game.obj
|
||||
\reactionoutput\zcam.obj
|
||||
\reactionoutput\zcam_target.obj
|
||||
]
|
||||
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2455.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
ai_dmq3.c
|
||||
Linking...
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
qagamex86.dll - 0 error(s), 0 warning(s)
|
||||
<h3>
|
||||
--------------------Configuration: ui - Win32 Release TA--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
uix86.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue