Fixed some crash bugs. Bot stuff. Triggerable func_statics.

Made flags only spawn in CTF mode
This commit is contained in:
Andrei Drexler 2002-05-05 15:18:03 +00:00
parent f74362d04d
commit 746b33120f
8 changed files with 184 additions and 25 deletions

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// 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
//
// Revision 1.22 2002/05/04 16:13:04 makro // Revision 1.22 2002/05/04 16:13:04 makro
// Bots // Bots
// //
@ -22,7 +26,7 @@
// //
// Revision 1.17 2002/05/01 05:32:45 makro // Revision 1.17 2002/05/01 05:32:45 makro
// Bots reload akimbos/handcannons. Also, they can decide whether // Bots reload akimbos/handcannons. Also, they can decide whether
// or not an item in the ground is better than theirs // or not an item on the ground is better than theirs
// //
// Revision 1.16 2002/04/30 11:54:37 makro // Revision 1.16 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things // Bots rule ! Also, added clips to give all. Maybe some other things
@ -439,6 +443,9 @@ qboolean RQ3_Bot_NeedToDropStuff(bot_state_t *bs, bot_goal_t *goal) {
if (RQ3_Bot_CanReload(bs, dropWeapon)) return qfalse; if (RQ3_Bot_CanReload(bs, dropWeapon)) return qfalse;
//Makro - the current weapon is empty, drop it //Makro - the current weapon is empty, drop it
Cmd_DropWeapon_f( &g_entities[bs->entitynum] ); Cmd_DropWeapon_f( &g_entities[bs->entitynum] );
#ifdef DEBUG
BotAI_Print(PRT_MESSAGE, "droppping weapon %i\n", dropWeapon);
#endif //DEBUG
return qtrue; return qtrue;
} }
@ -1796,13 +1803,16 @@ int AINode_Seek_ActivateEntity(bot_state_t *bs) {
targetvisible = qtrue; targetvisible = qtrue;
// if holding the right weapon // if holding the right weapon
// Makro - or if no weapon is set for the goal // Makro - or if no weapon is set for the goal
if (bs->cur_ps.weapon == bs->activatestack->weapon || bs->activatestack->weapon == WP_NONE) { if (bs->cur_ps.weapon == bs->activatestack->weapon || bs->activatestack->noWeapon) {
VectorSubtract(bs->activatestack->target, bs->eye, dir); VectorSubtract(bs->activatestack->target, bs->eye, dir);
vectoangles(dir, ideal_viewangles); vectoangles(dir, ideal_viewangles);
// if the bot is pretty close with it's aim // if the bot is pretty close with it's aim
if (InFieldOfVision(bs->viewangles, 20, ideal_viewangles)) { if (InFieldOfVision(bs->viewangles, 20, ideal_viewangles)) {
//Makro - using custom function to allow in-combat reloads //Makro - using custom function to allow in-combat reloads
//trap_EA_Attack(bs->client); //trap_EA_Attack(bs->client);
#ifdef DEBUG
BotAI_Print(PRT_MESSAGE, "attacking an entity; weapon = %i, required = %i\n", bs->cur_ps.weapon, bs->activatestack->weapon);
#endif //DEBUG
BotAttack(bs); BotAttack(bs);
} }
} }
@ -1814,7 +1824,7 @@ int AINode_Seek_ActivateEntity(bot_state_t *bs) {
BotEntityInfo(goal->entitynum, &entinfo); BotEntityInfo(goal->entitynum, &entinfo);
// if the entity the bot shoots at moved // if the entity the bot shoots at moved
// Makro - or if the entity is no longer in use - for func_breakables // 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)) { if (!VectorCompare(bs->activatestack->origin, entinfo.origin) || !(g_entities[entinfo.number].r.linked)) {
#ifdef DEBUG #ifdef DEBUG
BotAI_Print(PRT_MESSAGE, "hit shootable button or trigger\n"); BotAI_Print(PRT_MESSAGE, "hit shootable button or trigger\n");
#endif //DEBUG #endif //DEBUG

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// 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
//
// Revision 1.28 2002/05/04 16:13:04 makro // Revision 1.28 2002/05/04 16:13:04 makro
// Bots // Bots
// //
@ -28,7 +32,7 @@
// //
// Revision 1.21 2002/05/01 05:32:45 makro // Revision 1.21 2002/05/01 05:32:45 makro
// Bots reload akimbos/handcannons. Also, they can decide whether // Bots reload akimbos/handcannons. Also, they can decide whether
// or not an item in the ground is better than theirs // or not an item on the ground is better than theirs
// //
// Revision 1.20 2002/04/30 12:14:53 makro // Revision 1.20 2002/04/30 12:14:53 makro
// Fixed a small warning // Fixed a small warning
@ -354,12 +358,13 @@ qboolean RQ3_Bot_GetWeaponInfo(bot_state_t *bs, int weaponstate, int weapon, voi
//if the weapon is not valid //if the weapon is not valid
if (weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS) { if (weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS) {
#ifdef DEBUG #ifdef DEBUG
BotAI_Print(PRT_MESSAGE, "weapon not ready (%i)\n", bs->cur_ps.weapon); BotAI_Print(PRT_MESSAGE, "Bot_GetWeaponInfo: weapon number out of range (%i)\n", weapon);
#endif //DEBUG #else //DEBUG
if (trap_Cvar_VariableIntegerValue("developer")) { if (trap_Cvar_VariableIntegerValue("developer")) {
BotAI_Print(PRT_ERROR, "Bot_GetWeaponInfo: weapon number out of range (%i)\n", weapon); BotAI_Print(PRT_ERROR, "Bot_GetWeaponInfo: weapon number out of range (%i)\n", weapon);
} }
return qfalse; return qfalse;
#endif
} else { } else {
weaponinfo_t *wi; weaponinfo_t *wi;
trap_BotGetWeaponInfo(weaponstate, weapon, weaponinfo); trap_BotGetWeaponInfo(weaponstate, weapon, weaponinfo);
@ -1903,6 +1908,70 @@ int BotSynonymContext(bot_state_t *bs) {
return context; return context;
} }
/*
====================================
RQ3_Bot_WeaponFitness
Added by Makro
We have to take into account factors
that the trap calls don't seem to
====================================
*/
#define Score_M3_1 50
#define Score_M3_2 65
#define Score_M3_3 80
#define Score_HC_1 50
#define Score_HC_2 65
#define Score_HC_3 80
int 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 (bs->cur_ps.ammo[weapon] <= 0 && !RQ3_Bot_CanReload(bs, weapon))
return 0;
switch (weapon) {
case WP_PISTOL:
return 70;
case WP_AKIMBO:
return 80;
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;
}
case WP_HANDCANNON:
{
if (dist > 500)
return 0;
else if (dist > 200)
return 50;
else if (dist > 100)
return 50;
else
return 80;
}
default:
return 0;
}
}
/*
======================
RQ3_Bot_ChooseWeapon
Added by Makro
======================
*/
void RQ3_Bot_ChooseBestFightWeapon(bot_state_t *bs) {
}
/* /*
================== ==================
BotChooseWeapon BotChooseWeapon
@ -4511,7 +4580,8 @@ int BotFuncBreakableGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activa
activategoal->goal.entitynum = entitynum; activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0; activategoal->goal.number = 0;
activategoal->goal.flags = 0; activategoal->goal.flags = 0;
activategoal->weapon = WP_NONE; //activategoal->weapon = WP_NUM_WEAPONS;
activategoal->noWeapon = qtrue;
//Makro - hmm, not quite sure this is right, but they did it for func_doors //Makro - hmm, not quite sure this is right, but they did it for func_doors
VectorCopy(bs->origin, activategoal->goal.origin); VectorCopy(bs->origin, activategoal->goal.origin);
activategoal->goal.areanum = bs->areanum; activategoal->goal.areanum = bs->areanum;
@ -5702,9 +5772,20 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
case EV_FOOTSPLASH: case EV_FOOTSPLASH:
case EV_FOOTWADE: case EV_FOOTWADE:
case EV_SWIM: case EV_SWIM:
break;
case EV_FALL_SHORT: case EV_FALL_SHORT:
case EV_FALL_MEDIUM: case EV_FALL_MEDIUM:
case EV_FALL_FAR: case EV_FALL_FAR: // Makro - check for falling damage
{
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
Cmd_Bandage( &g_entities[bs->entitynum] );
}
}
}
case EV_STEP_4: case EV_STEP_4:
case EV_STEP_8: case EV_STEP_8:
case EV_STEP_12: case EV_STEP_12:

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.8 2002/05/05 15:18:02 makro
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
// Made flags only spawn in CTF mode
//
// Revision 1.7 2002/04/05 03:12:28 makro // Revision 1.7 2002/04/05 03:12:28 makro
// Radio stuff // Radio stuff
// //
@ -119,6 +123,8 @@ typedef struct bot_activategoal_s
int shoot; //true if bot has to shoot to activate int shoot; //true if bot has to shoot to activate
int openDoor; //Makro - true if bot has to open a door int openDoor; //Makro - true if bot has to open a door
int weapon; //weapon to be used for activation int weapon; //weapon to be used for activation
qboolean noWeapon; //Makro - true if a weapon is NOT needed for
//activation - breakables can be shot with any weapon
vec3_t target; //target to shoot at to activate something vec3_t target; //target to shoot at to activate something
vec3_t origin; //origin of the blocking entity to activate vec3_t origin; //origin of the blocking entity to activate
int areas[MAX_ACTIVATEAREAS]; //routing areas disabled by blocking entity int areas[MAX_ACTIVATEAREAS]; //routing areas disabled by blocking entity

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.26 2002/05/05 15:18:02 makro
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
// Made flags only spawn in CTF mode
//
// Revision 1.25 2002/04/03 15:51:01 jbravo // Revision 1.25 2002/04/03 15:51:01 jbravo
// Small warning fixes // Small warning fixes
// //
@ -2136,17 +2140,45 @@ STATIC
*/ */
/*QUAKED func_static (0 .5 .8) ? /*QUAKED func_static (0 .5 .8) ? START_OFF
A bmodel that just sits there, doing nothing. Can be used for conditional walls and models. A bmodel that just sits there, doing nothing. Can be used for conditional walls and models.
"model2" .md3 model to also draw "model2" .md3 model to also draw
"color" constantLight color "color" constantLight color
"light" constantLight radius "light" constantLight radius
*/ */
//Makro - added for triggerable func_statics
void use_func_static( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
ent->count ^= 1;
if ( ent->count ) {
ent->s.eFlags &= ~EF_NODRAW;
ent->r.contents = CONTENTS_SOLID;
ent->r.svFlags &= ~SVF_NOCLIENT;
} else {
ent->s.eFlags |= EF_NODRAW;
ent->r.contents = CONTENTS_TRIGGER;
ent->r.svFlags |= SVF_NOCLIENT;
}
}
void SP_func_static( gentity_t *ent ) { void SP_func_static( gentity_t *ent ) {
trap_SetBrushModel( ent, ent->model ); trap_SetBrushModel( ent, ent->model );
InitMover( ent ); InitMover( ent );
VectorCopy( ent->s.origin, ent->s.pos.trBase ); VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.origin, ent->r.currentOrigin ); VectorCopy( ent->s.origin, ent->r.currentOrigin );
//Makro - added
if ( ent->spawnflags & 1 ) {
ent->s.eFlags |= EF_NODRAW;
ent->r.contents = CONTENTS_TRIGGER;
ent->r.svFlags |= SVF_NOCLIENT;
ent->count = 0;
} else {
ent->s.eFlags &= ~EF_NODRAW;
ent->r.contents = CONTENTS_SOLID;
ent->r.svFlags &= ~SVF_NOCLIENT;
ent->count = 1;
}
ent->use = use_func_static;
//end Makro
} }

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.24 2002/05/05 15:18:02 makro
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
// Made flags only spawn in CTF mode
//
// Revision 1.23 2002/05/04 06:28:58 makro // Revision 1.23 2002/05/04 06:28:58 makro
// no message // no message
// //
@ -439,8 +443,16 @@ qboolean G_CallSpawn( gentity_t *ent ) {
//Makro - new code //Makro - new code
for ( item=bg_itemlist+1 ; item->classname ; item++ ) { for ( item=bg_itemlist+1 ; item->classname ; item++ ) {
if ( !strcmp(item->classname, ent->classname) ) { if ( !strcmp(item->classname, ent->classname) ) {
G_SpawnItem( ent, item ); //only spawn flags in CTF mode
return qtrue; if ( item->giTag == PW_REDFLAG || item->giTag == PW_BLUEFLAG ) {
if (g_gametype.integer == GT_CTF) {
G_SpawnItem( ent, item );
return qtrue;
}
} else {
G_SpawnItem( ent, item );
return qtrue;
}
} }
} }

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.9 2002/05/05 15:18:03 makro
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
// Made flags only spawn in CTF mode
//
// Revision 1.8 2002/03/18 06:20:39 blaze // Revision 1.8 2002/03/18 06:20:39 blaze
// noise tag will play sounds for trigger_push and target_push // noise tag will play sounds for trigger_push and target_push
// //
@ -46,14 +50,18 @@ void multi_trigger( gentity_t *ent, gentity_t *activator ) {
return; // can't retrigger until the wait is over return; // can't retrigger until the wait is over
} }
if ( activator->client ) { //Makro - added check; Q3 crashed in archives when playing
if ( ( ent->spawnflags & 1 ) && //with .dll's and shooting one of the barrels
activator->client->sess.sessionTeam != TEAM_RED ) { if ( activator != NULL ) {
return; if ( activator->client ) {
} if ( ( ent->spawnflags & 1 ) &&
if ( ( ent->spawnflags & 2 ) && activator->client->sess.sessionTeam != TEAM_RED ) {
activator->client->sess.sessionTeam != TEAM_BLUE ) { return;
return; }
if ( ( ent->spawnflags & 2 ) &&
activator->client->sess.sessionTeam != TEAM_BLUE ) {
return;
}
} }
} }

View file

@ -5,6 +5,10 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.53 2002/05/05 15:18:03 makro
// Fixed some crash bugs. Bot stuff. Triggerable func_statics.
// Made flags only spawn in CTF mode
//
// Revision 1.52 2002/05/03 18:09:20 makro // Revision 1.52 2002/05/03 18:09:20 makro
// Bot stuff. Jump kicks // Bot stuff. Jump kicks
// //
@ -2086,6 +2090,12 @@ LogAccuracyHit
=============== ===============
*/ */
qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ) { qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ) {
//Makro - some checks; Q3 crashed with .dlls
//when shooting one of the barrels in archives
if (target == NULL || attacker == NULL) {
return qfalse;
}
if( !target->takedamage ) { if( !target->takedamage ) {
return qfalse; return qfalse;
} }

View file

@ -6,13 +6,13 @@
--------------------Configuration: game - Win32 Debug-------------------- --------------------Configuration: game - Win32 Debug--------------------
</h3> </h3>
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2454.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE4.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 /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" "C:\Games\Quake3\rq3source\reaction\game\g_spawn.c"
] ]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2454.tmp" Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE4.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2455.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE5.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: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_chat.obj
@ -55,10 +55,10 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
\reactionoutput\zcam.obj \reactionoutput\zcam.obj
\reactionoutput\zcam_target.obj \reactionoutput\zcam_target.obj
] ]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP2455.tmp" Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPE5.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
ai_dmq3.c g_spawn.c
Linking... Linking...