Bot stuff. Jump kicks

This commit is contained in:
Andrei Drexler 2002-05-03 18:09:20 +00:00
parent 455303ef72
commit 4ac6c3421a
6 changed files with 100 additions and 178 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.21 2002/05/03 18:09:19 makro
// Bot stuff. Jump kicks
//
// Revision 1.20 2002/05/02 23:05:25 makro
// Loading screen. Jump kicks. Bot stuff
//
@ -372,15 +375,19 @@ Added by Makro
*/
qboolean RQ3_Bot_NeedToDropStuff(bot_state_t *bs, bot_goal_t *goal) {
float attack_skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
int itemType = IT_BAD;
//check the bot skill
if ( random() < (1 - attack_skill) ) return qfalse;
//if the bot doesn't have an item or it didn't reach one
//if the bot doesn't have an item
if ( !g_entities[goal->entitynum].item )
//no need to worry about dropping it
return qfalse;
itemType = g_entities[goal->entitynum].item->giType;
//if the bot can pick up an item
if ( g_entities[goal->entitynum].item->giType == IT_HOLDABLE ) {
if ( itemType == IT_HOLDABLE ) {
if ( bs->cur_ps.stats[STAT_HOLDABLE_ITEM] < 1 || bs->cur_ps.stats[STAT_HOLDABLE_ITEM] >= bg_numItems )
return qfalse;
else {
@ -393,10 +400,17 @@ qboolean RQ3_Bot_NeedToDropStuff(bot_state_t *bs, bot_goal_t *goal) {
//if the bot drops the bandolier a weapon might be dropped, too
if ( oldItem == HI_BANDOLIER && g_entities[bs->entitynum].client->uniqueWeapons > g_RQ3_maxWeapons.integer )
dropWeapon = RQ3_Bot_WeaponToDrop(bs);
if (dropWeapon != WP_NONE) {
//if the bot doesn't have any ammo for the dropped weapon
if (bs->cur_ps.ammo[dropWeapon] <= 0 && !RQ3_Bot_CanReload(bs, dropWeapon)) {
//it shouldn't care whether or not it's dropped
dropWeapon = WP_NONE;
}
}
newScore = oldScore = 0;
//check all the weapons
for ( i = WP_NONE+1; i < MAX_WEAPONS; i++ ) {
for ( i = 0; i < MAX_WEAPONS; i++ ) {
//if the bot has the weapon
if ( bs->cur_ps.stats[STAT_WEAPONS] & (1 << i) ) {
//get the score for it
@ -414,7 +428,7 @@ qboolean RQ3_Bot_NeedToDropStuff(bot_state_t *bs, bot_goal_t *goal) {
}
}
//if the bot can pick up a weapon
} else if ( g_entities[goal->entitynum].item->giType == IT_WEAPON ) {
} else if ( itemType == IT_WEAPON ) {
int dropWeapon = RQ3_Bot_WeaponToDrop(bs);
if (dropWeapon == WP_NONE) return qfalse;
@ -1491,8 +1505,14 @@ void AIEnter_Respawn(bot_state_t *bs, char *s) {
bs->standfindenemy_time = FloatTime() + 5;
bs->stand_time = FloatTime() + 10;
} else {
bs->standfindenemy_time = FloatTime() + 1;
bs->check_time = bs->stand_time = FloatTime() + 2;
//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);
}
bs->standfindenemy_time = bs->check_time = FloatTime() + 1;
bs->stand_time = 5;
}
bs->respawn_wait = qfalse;
bs->ainode = AINode_Respawn;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.25 2002/05/03 18:09:19 makro
// Bot stuff. Jump kicks
//
// Revision 1.24 2002/05/02 23:05:25 makro
// Loading screen. Jump kicks. Bot stuff
//
@ -116,6 +119,7 @@
//Makro - to get rid of the warnings
void Cmd_Bandage (gentity_t *ent);
void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText );
gentity_t *SelectRandomDeathmatchSpawnPoint( void );
// from aasfile.h
#define AREACONTENTS_MOVER 1024
@ -282,15 +286,19 @@ bot_moveresult_t BotMoveTo(bot_state_t *bs, vec3_t dest) {
//initialize the movement state
BotSetupForMovement(bs);
//trap_BotMoveInDirection(bs->ms, dir, dist, MOVE_RUN);
trap_BotPushGoal(bs->gs, &goal);
//move towards the goal
trap_BotMoveToGoal(&moveresult, bs->ms, &goal, TFL_DEFAULT);
trap_BotMoveToGoal(&moveresult, bs->ms, &goal, bs->tfl);
//if movement failed
if (moveresult.failure) {
//G_Printf("BotMoveTo: moveresult.failure = 1\n");
//G_Printf("BotMoveTo: moveresult.blocked = %i\n", moveresult.blocked);
//G_Printf("BotMoveTo: moveresult.type = %i\n", moveresult.type);
//reset the avoid reach, otherwise bot is stuck in current area
trap_BotResetAvoidReach(bs->ms);
bs->activatestack->time = 0;
}
//G_Printf("BotMoveTo: moveresult.flags = %i\n", moveresult.flags);
return moveresult;
}
/*
@ -328,6 +336,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) {
if (trap_Cvar_VariableIntegerValue("developer")) {
BotAI_Print(PRT_ERROR, "Bot_GetWeaponInfo: weapon number out of range (%i)\n", weapon);
}
return qfalse;
} else {
weaponinfo_t *wi;
@ -1572,15 +1583,16 @@ Added by Makro
==================
*/
void BotRQ3TPSeekGoals( bot_state_t *bs ) {
int firstBot = 0, firstHuman = 0, leader = 0, i;
int firstBot = -1, firstHuman = -1, leader = -1, i;
static int maxclients;
//if the bot already has a goal
if (bs->ltgtype || bs->ltg_time < FloatTime())
return;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
//if the bot already has a goal
if (bs->ltgtype)
return;
//find the first human/bot teammates
for ( i=0; i < MAX_CLIENTS && i < maxclients; i++ ) {
@ -1598,9 +1610,9 @@ void BotRQ3TPSeekGoals( bot_state_t *bs ) {
break;
}
if (firstHuman)
if (firstHuman != -1)
leader = firstHuman;
else if (firstBot)
else if (firstBot != -1)
leader = firstBot;
else
return;
@ -5203,7 +5215,7 @@ void BotReplyToRadioMessage( bot_state_t *bs, char *msg, int handle ) {
}
//Bots won't reply to ALL radio messages; they do have a life, you know
if ( (willreply) && (FloatTime() > BOT_RADIO_REPLY_TIME + bs->radioresponse_time) && (bs->radioresponse_count < 20) ) {
if ( (willreply) && (FloatTime() > BOT_RADIO_REPLY_TIME + bs->radioresponse_time) /*&& (bs->radioresponse_count < 20)*/ ) {
char *sender = COM_ParseExt(&msg, qtrue);
qboolean responded = qfalse;
@ -5219,6 +5231,17 @@ void BotReplyToRadioMessage( bot_state_t *bs, char *msg, int handle ) {
responded = qtrue;
}
/*
if (strstr(msg, "im_hit")) {
int senderId = ClientFromName(sender);
if (senderId != -1) {
BotMoveTo(bs, g_entities[senderId].r.currentOrigin);
G_Printf("%s: coming over to %s\n", g_entities[bs->entitynum].client->pers.netname, g_entities[senderId].client->pers.netname);
responded = qtrue;
}
}
*/
if (responded) {
bs->radioresponse_time = FloatTime();
bs->radioresponse_count++;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.8 2002/05/03 18:09:20 makro
// Bot stuff. Jump kicks
//
// Revision 1.7 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
@ -571,8 +574,8 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
char *model;
char *headmodel;
char userinfo[MAX_INFO_STRING];
weapon_t tpWeapon = WP_MP5;
holdable_t tpItem = HI_KEVLAR;
weapon_t tpWeapon = WP_M4;
holdable_t tpItem = HI_LASER;
// get the botinfo from bots.txt
botinfo = G_GetBotInfoByName( name );
@ -688,8 +691,8 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
if ( g_gametype.integer == GT_TEAMPLAY ) {
//Makro - load custom weapon/item from bot file
tpWeapon = CharToWeapon(Info_ValueForKey(botinfo, "weapon"), WP_MP5);
tpItem = CharToItem(Info_ValueForKey(botinfo, "item"), HI_KEVLAR);
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

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.71 2002/05/03 18:09:20 makro
// Bot stuff. Jump kicks
//
// Revision 1.70 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
@ -1399,9 +1402,9 @@ void ClientBegin(int clientNum) {
if (g_gametype.integer == GT_TEAMPLAY) {
// NiceAss: Only set it if there is no value. Fix for going into spectator resetting values.
if (ent->r.svFlags & SVF_BOT) {
//Makro - changed from WP_PISTOL to WP_MP5
if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5;
if (!client->teamplayItem) client->teamplayItem = HI_KEVLAR;
//Makro - changed to m4/laser from pistol/kevlar
if (!client->teamplayWeapon) client->teamplayWeapon = WP_M4;
if (!client->teamplayItem) client->teamplayItem = HI_LASER;
} else {
if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5;
if (!client->teamplayItem) client->teamplayItem = HI_KEVLAR;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.52 2002/05/03 18:09:20 makro
// Bot stuff. Jump kicks
//
// Revision 1.51 2002/05/02 23:05:25 makro
// Loading screen. Jump kicks. Bot stuff
//
@ -133,6 +136,15 @@ qboolean JumpKick( gentity_t *ent )
if ( g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action ) {
return qfalse; // JBravo: No kicking during LCA
}
//Makro - added
if ( ent == NULL ) {
return qfalse;
}
if ( ent->client == NULL ) {
return qfalse;
}
// set aiming directions
AngleVectors (ent->client->ps.viewangles, forward, right, up);
CalcMuzzlePoint ( ent, forward, right, up, muzzle );
@ -155,6 +167,12 @@ qboolean JumpKick( gentity_t *ent )
kickSuccess = DoorKick( &tr, ent, muzzle, forward );
traceEnt = &g_entities[ tr.entityNum ];
// JBravo: some sanity checks on the traceEnt
// Makro - this check made the sound only play when a client is hit
// if (traceEnt == NULL || traceEnt->client == NULL)
if (traceEnt == NULL)
return qfalse;
if ( !traceEnt->takedamage) {
return qfalse;
}
@ -178,19 +196,15 @@ qboolean JumpKick( gentity_t *ent )
}
//end Makro
// JBravo: some sanity checks on the traceEnt
// Makro - this check made the sound only play when a client is hit
// if (traceEnt == NULL || traceEnt->client == NULL)
if (traceEnt == NULL)
return qfalse;
// JBravo: no kicking teammates while rounds are going
if (g_gametype.integer == GT_TEAMPLAY) {
//Makro - client check here
if (ent->client)
if (traceEnt->client != NULL && ent->client != NULL) {
if (ent->client->sess.sessionTeam == traceEnt->client->sess.sessionTeam &&
level.team_round_going)
level.team_round_going) {
return qfalse;
}
}
}
//Makro - client check
@ -216,7 +230,7 @@ qboolean JumpKick( gentity_t *ent )
}
*/
if (traceEnt->client && traceEnt->takedamage)
if (traceEnt->client != NULL && traceEnt->takedamage)
{
tent = G_TempEntity( tr.endpos, EV_JUMPKICK );
tent->s.otherEntityNum = traceEnt->s.number;

View file

@ -3,110 +3,17 @@
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: cgame - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP212D.tmp" with contents
[
/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"Release/cgame.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
"C:\Games\Quake3\rq3source\reaction\game\bg_misc.c"
"C:\Games\Quake3\rq3source\reaction\game\bg_pmove.c"
"C:\Games\Quake3\rq3source\reaction\game\bg_slidemove.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_consolecmds.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_draw.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_drawtools.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_effects.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_ents.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_event.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_info.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_localents.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_main.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_marks.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_players.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_playerstate.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_predict.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_scoreboard.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_servercmds.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_snapshot.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_syscalls.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_view.c"
"C:\Games\Quake3\rq3source\reaction\cgame\cg_weapons.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP212D.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP212E.tmp" with contents
[
/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:no /pdb:"Release/cgamex86.pdb" /map:"Release/cgamex86.map" /machine:I386 /def:".\cgame.def" /out:"../Release/cgamex86.dll" /implib:"Release/cgamex86.lib"
.\Release\bg_misc.obj
.\Release\bg_pmove.obj
.\Release\bg_slidemove.obj
.\Release\cg_consolecmds.obj
.\Release\cg_draw.obj
.\Release\cg_drawtools.obj
.\Release\cg_effects.obj
.\Release\cg_ents.obj
.\Release\cg_event.obj
.\Release\cg_info.obj
.\Release\cg_localents.obj
.\Release\cg_main.obj
.\Release\cg_marks.obj
.\Release\cg_players.obj
.\Release\cg_playerstate.obj
.\Release\cg_predict.obj
.\Release\cg_scoreboard.obj
.\Release\cg_servercmds.obj
.\Release\cg_snapshot.obj
.\Release\cg_syscalls.obj
.\Release\cg_view.obj
.\Release\cg_weapons.obj
.\Release\q_math.obj
.\Release\q_shared.obj
.\Release\ui_shared.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP212E.tmp"
<h3>Output Window</h3>
Compiling...
bg_misc.c
bg_pmove.c
bg_slidemove.c
cg_consolecmds.c
cg_draw.c
cg_drawtools.c
cg_effects.c
cg_ents.c
cg_event.c
cg_info.c
cg_localents.c
cg_main.c
cg_marks.c
cg_players.c
cg_playerstate.c
cg_predict.c
cg_scoreboard.c
cg_servercmds.c
cg_snapshot.c
cg_syscalls.c
cg_view.c
cg_weapons.c
Linking...
Creating library Release/cgamex86.lib and object Release/cgamex86.exp
<h3>Results</h3>
cgamex86.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: game - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2132.tmp" with contents
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22B0.tmp" with contents
[
/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"
"C:\Games\Quake3\rq3source\reaction\game\ai_dmq3.c"
"C:\Games\Quake3\rq3source\reaction\game\g_spawn.c"
"C:\Games\Quake3\rq3source\reaction\game\ai_team.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2132.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2133.tmp" with contents
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22B0.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22B1.tmp" with contents
[
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
@ -149,12 +56,11 @@ 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\RSP2133.tmp"
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22B1.tmp"
<h3>Output Window</h3>
Compiling...
ai_dmnet.c
ai_dmq3.c
g_spawn.c
ai_team.c
Linking...
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
@ -162,53 +68,6 @@ Linking...
<h3>Results</h3>
qagamex86.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: ui - Win32 Release TA--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2137.tmp" with contents
[
/nologo /G6 /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fp"Release_TA/ta_ui.pch" /YX /Fo"Release_TA/" /Fd"Release_TA/" /FD /c
"C:\Games\Quake3\rq3source\reaction\game\bg_misc.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_atoms.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_gameinfo.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_main.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_players.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_shared.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_syscalls.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2137.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2138.tmp" with contents
[
/nologo /base:"0x40000000" /dll /incremental:no /pdb:"Release_TA/uix86.pdb" /map:"Release_TA/uix86.map" /machine:I386 /def:".\ui.def" /out:"uix86.dll" /implib:"Release_TA/uix86.lib"
.\Release_TA\bg_misc.obj
.\Release_TA\q_math.obj
.\Release_TA\q_shared.obj
.\Release_TA\ui_atoms.obj
.\Release_TA\ui_gameinfo.obj
.\Release_TA\ui_main.obj
.\Release_TA\ui_players.obj
.\Release_TA\ui_shared.obj
.\Release_TA\ui_syscalls.obj
.\Release_TA\ui_util.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2138.tmp"
<h3>Output Window</h3>
Compiling...
bg_misc.c
ui_atoms.c
ui_gameinfo.c
ui_main.c
ui_players.c
ui_shared.c
ui_syscalls.c
Linking...
Creating library Release_TA/uix86.lib and object Release_TA/uix86.exp
<h3>Results</h3>
uix86.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>