Bots rule ! Also, added clips to give all. Maybe some other things

This commit is contained in:
Andrei Drexler 2002-04-30 11:54:37 +00:00
parent 8abb7358a1
commit f5100250e4
11 changed files with 328 additions and 88 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.16 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.15 2002/04/14 21:49:52 makro // Revision 1.15 2002/04/14 21:49:52 makro
// Stuff // Stuff
// //
@ -1345,6 +1348,7 @@ int AINode_Respawn(bot_state_t *bs) {
BotEntityInfo(spot-g_entities, &entinfo); BotEntityInfo(spot-g_entities, &entinfo);
BotMoveTo(bs, entinfo.origin); BotMoveTo(bs, entinfo.origin);
//BotRoamGoal(bs, entinfo.origin);
} }
} }
} }
@ -1479,7 +1483,7 @@ void BotClearPath(bot_state_t *bs, bot_moveresult_t *moveresult) {
vectoangles(dir, moveresult->ideal_viewangles); vectoangles(dir, moveresult->ideal_viewangles);
// if the bot has a weapon that does splash damage // if the bot has a weapon that does splash damage
//Blaze: Just grenades //Blaze: Just grenades
if (bs->inventory[INVENTORY_GRENADE] > 0 && bs->inventory[INVENTORY_GRENADE] > 0) if (bs->inventory[INVENTORY_GRENADE] > 0 && bs->inventory[INVENTORY_GRENADEAMMO] > 0)
moveresult->weapon = WEAPONINDEX_GRENADE; moveresult->weapon = WEAPONINDEX_GRENADE;
/*else if (bs->inventory[INVENTORY_ROCKETLAUNCHER] > 0 && bs->inventory[INVENTORY_ROCKETS] > 0) /*else if (bs->inventory[INVENTORY_ROCKETLAUNCHER] > 0 && bs->inventory[INVENTORY_ROCKETS] > 0)
moveresult->weapon = WEAPONINDEX_ROCKET_LAUNCHER; moveresult->weapon = WEAPONINDEX_ROCKET_LAUNCHER;
@ -1602,7 +1606,8 @@ int AINode_Seek_ActivateEntity(bot_state_t *bs) {
if (bsptrace.fraction >= 1.0 || bsptrace.ent == goal->entitynum) { if (bsptrace.fraction >= 1.0 || bsptrace.ent == goal->entitynum) {
targetvisible = qtrue; targetvisible = qtrue;
// if holding the right weapon // if holding the right weapon
if (bs->cur_ps.weapon == bs->activatestack->weapon) { // Makro - or if no weapon is set for the goal
if (bs->cur_ps.weapon == bs->activatestack->weapon || bs->activatestack->weapon == WP_NONE) {
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

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.19 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.18 2002/04/20 15:03:47 makro // Revision 1.18 2002/04/20 15:03:47 makro
// More footstep sounds, a few other things // More footstep sounds, a few other things
// //
@ -157,6 +160,43 @@ void VectorTargetDist(vec3_t src, vec3_t dest, int dist, vec3_t final) {
VectorAdd(final, src, final); VectorAdd(final, src, final);
} }
/*
==================
RQ3_Bot_ClipForWeapon
Added by Makro
==================
*/
int RQ3_Bot_ClipForWeapon( bot_state_t *bs, int weapon )
{
switch (weapon) {
case WP_PISTOL:
case WP_AKIMBO:
return bs->inventory[INVENTORY_PISTOLCLIP];
break;
case WP_M3:
case WP_HANDCANNON:
return bs->inventory[INVENTORY_M3CLIP];
break;
case WP_MP5:
return bs->inventory[INVENTORY_MP5CLIP];
break;
case WP_M4:
return bs->inventory[INVENTORY_M4CLIP];
break;
case WP_SSG3000:
return bs->inventory[INVENTORY_SSG3000CLIP];
break;
default:
return 0;
break;
}
//not needed, but oh well...
return 0;
}
/* /*
================== ==================
BotAttack BotAttack
@ -165,16 +205,22 @@ Added by Makro
================== ==================
*/ */
void BotAttack(bot_state_t *bs) { void BotAttack(bot_state_t *bs) {
//Makro - if the weapon isn't ready, stop
if (bs->cur_ps.weaponstate != WEAPON_READY)
return;
//If the gun is empty //If the gun is empty
if ( (bs->cur_ps.ammo[bs->weaponnum]) == 0 ) { if ( (bs->cur_ps.ammo[bs->cur_ps.weapon]) == 0 ) {
//If bot has extra clips, reload //If bot has extra clips, reload
if ( (g_entities[bs->entitynum].client->numClips[bs->weaponnum]) >= 1 ) { if ( RQ3_Bot_ClipForWeapon(bs, bs->cur_ps.weapon) >= 1 ) {
//Cmd_Reload( &g_entities[bs->entitynum] ); //Cmd_Reload( &g_entities[bs->entitynum] );
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
} }
} else { } else {
//Gun is not empty //Gun is not empty
trap_EA_Attack(bs->client); //trap_EA_Attack(bs->client);
trap_EA_Action(bs->client, ACTION_ATTACK);
} }
} }
@ -194,8 +240,8 @@ bot_moveresult_t BotMoveTo(bot_state_t *bs, vec3_t dest) {
VectorCopy(dest, goal.origin); VectorCopy(dest, goal.origin);
VectorSet(goal.mins, -8, -8, -8); VectorSet(goal.mins, -8, -8, -8);
VectorSet(goal.maxs, 8, 8, 8); VectorSet(goal.maxs, 8, 8, 8);
VectorAdd(goal.mins, goal.origin, goal.mins); //VectorAdd(goal.mins, goal.origin, goal.mins);
VectorAdd(goal.maxs, goal.origin, goal.maxs); //VectorAdd(goal.maxs, goal.origin, goal.maxs);
goal.areanum = trap_AAS_PointAreaNum(goal.origin); goal.areanum = trap_AAS_PointAreaNum(goal.origin);
//initialize the movement state //initialize the movement state
BotSetupForMovement(bs); BotSetupForMovement(bs);
@ -221,19 +267,8 @@ Added by Makro
void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist) { void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist) {
vec3_t dir; vec3_t dir;
/* //VectorTargetDist(bs->origin, dest, dist, dir);
VectorClear(dir); //dir[2] = bs->origin[2];
VectorSubtract(bs->origin, dest, dir);
VectorNormalize(dir);
if (dist < 0 ) {
VectorScale(dir, -1, dir);
dist = -dist;
}
VectorScale(dir, dist, dir);
VectorAdd(dir, bs->origin, dir);
*/
VectorTargetDist(bs->origin, dest, dist, dir);
dir[2] = bs->origin[2];
/* /*
if (bot_developer.integer == 2) { if (bot_developer.integer == 2) {
G_Printf(va("^5BOT CODE: ^7Moving from (%i %i %i) towards entity at (%i %i %i) up to (%i %i %i)\n", G_Printf(va("^5BOT CODE: ^7Moving from (%i %i %i) towards entity at (%i %i %i) up to (%i %i %i)\n",
@ -1704,8 +1739,14 @@ BotChooseWeapon
void BotChooseWeapon(bot_state_t *bs) { void BotChooseWeapon(bot_state_t *bs) {
int newweaponnum; int newweaponnum;
//Makro - don't change weapons while bandaging
if (bs->cur_ps.weaponstate == WEAPON_BANDAGING) {
return;
}
if (bs->cur_ps.weaponstate == WEAPON_RAISING || if (bs->cur_ps.weaponstate == WEAPON_RAISING ||
bs->cur_ps.weaponstate == WEAPON_DROPPING) { bs->cur_ps.weaponstate == WEAPON_DROPPING)
{
trap_EA_SelectWeapon(bs->client, bs->weaponnum); trap_EA_SelectWeapon(bs->client, bs->weaponnum);
} }
else { else {
@ -1714,26 +1755,10 @@ void BotChooseWeapon(bot_state_t *bs) {
// JBravo: test hack // JBravo: test hack
// Makro - test unhack :P // Makro - test unhack :P
bs->weaponnum = newweaponnum; bs->weaponnum = newweaponnum;
bs->weaponnum = WP_PISTOL; //bs->weaponnum = WP_PISTOL;
//BotAI_Print(PRT_MESSAGE, "bs->weaponnum = %d\n", bs->weaponnum); //BotAI_Print(PRT_MESSAGE, "bs->weaponnum = %d\n", bs->weaponnum);
trap_EA_SelectWeapon(bs->client, bs->weaponnum); trap_EA_SelectWeapon(bs->client, bs->weaponnum);
} }
//Makro - gun is empty; if bot has extra clips - reload, otherwise switch to knife
if ( (bs->cur_ps.ammo[bs->weaponnum]) == 0 ) {
if (g_entities[bs->entitynum].client->numClips[bs->weaponnum] >= 1 ) {
//Cmd_Reload( &g_entities[bs->entitynum] );
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
/*
if (bot_developer.integer == 2) {
G_Printf("^5BOT CODE: ^7Reloading\n");
}
*/
} else {
bs->weaponnum = WP_KNIFE;
trap_EA_SelectWeapon(bs->client, bs->weaponnum);
}
}
} }
/* /*
@ -1875,7 +1900,12 @@ BotUpdateInventory
*/ */
void BotUpdateInventory(bot_state_t *bs) { void BotUpdateInventory(bot_state_t *bs) {
int oldinventory[MAX_ITEMS]; int oldinventory[MAX_ITEMS];
gentity_t *ent = &g_entities[bs->entitynum];
//DEBUG STUFF
qboolean showInfo = (trap_Cvar_VariableIntegerValue("bot_RQ3_report") != 0);
memcpy(oldinventory, bs->inventory, sizeof(oldinventory)); memcpy(oldinventory, bs->inventory, sizeof(oldinventory));
//armor //armor
bs->inventory[INVENTORY_ARMOR] = bs->cur_ps.stats[STAT_ARMOR]; bs->inventory[INVENTORY_ARMOR] = bs->cur_ps.stats[STAT_ARMOR];
@ -1891,16 +1921,21 @@ void BotUpdateInventory(bot_state_t *bs) {
bs->inventory[INVENTORY_AKIMBO] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_AKIMBO)) != 0; bs->inventory[INVENTORY_AKIMBO] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_AKIMBO)) != 0;
bs->inventory[INVENTORY_GRENADE] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_GRENADE)) != 0; bs->inventory[INVENTORY_GRENADE] = (bs->cur_ps.stats[STAT_WEAPONS] & (1 << WP_GRENADE)) != 0;
//ammo //ammo
bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_PISTOL]; //Makro - clips should be taken into account
bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_PISTOL] + ent->client->numClips[WP_PISTOL] * RQ3_PISTOL_CLIP;
bs->inventory[INVENTORY_KNIFEAMMO] = bs->cur_ps.ammo[WP_KNIFE]; bs->inventory[INVENTORY_KNIFEAMMO] = bs->cur_ps.ammo[WP_KNIFE];
bs->inventory[INVENTORY_M4AMMO] = bs->cur_ps.ammo[WP_M4]; bs->inventory[INVENTORY_M4AMMO] = bs->cur_ps.ammo[WP_M4] + ent->client->numClips[WP_M4] * RQ3_M4_CLIP;
bs->inventory[INVENTORY_SSG3000AMMO] = bs->cur_ps.ammo[WP_SSG3000]; bs->inventory[INVENTORY_SSG3000AMMO] = bs->cur_ps.ammo[WP_SSG3000] + ent->client->numClips[WP_SSG3000];
bs->inventory[INVENTORY_MP5AMMO] = bs->cur_ps.ammo[WP_MP5]; bs->inventory[INVENTORY_MP5AMMO] = bs->cur_ps.ammo[WP_MP5] + ent->client->numClips[WP_MP5] * RQ3_MP5_CLIP;
//Blaze: Same ammo for shotgun and handcannon //Blaze: Same ammo for shotgun and handcannon
bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_HANDCANNON]; //Makro - this was odd
bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_M3]; //bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_HANDCANNON];
//bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_M3];
bs->inventory[INVENTORY_M3AMMO] = bs->cur_ps.ammo[WP_M3] + ent->client->numClips[WP_M3];
bs->inventory[INVENTORY_HANDCANNONAMMO] = bs->cur_ps.ammo[WP_HANDCANNON] + ent->client->numClips[WP_HANDCANNON];
//Blaze: Same ammo for Pistol and Akimbo Pistols //Blaze: Same ammo for Pistol and Akimbo Pistols
bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_AKIMBO]; //bs->inventory[INVENTORY_PISTOLAMMO] = bs->cur_ps.ammo[WP_AKIMBO];
bs->inventory[INVENTORY_AKIMBOAMMO] = bs->cur_ps.ammo[WP_AKIMBO] + ent->client->numClips[WP_AKIMBO] * RQ3_PISTOL_CLIP;
bs->inventory[INVENTORY_GRENADEAMMO] = bs->cur_ps.ammo[WP_GRENADE]; bs->inventory[INVENTORY_GRENADEAMMO] = bs->cur_ps.ammo[WP_GRENADE];
// bs->inventory[INVENTORY_BFGAMMO] = bs->cur_ps.ammo[WP_BFG]; // bs->inventory[INVENTORY_BFGAMMO] = bs->cur_ps.ammo[WP_BFG];
@ -1938,6 +1973,32 @@ void BotUpdateInventory(bot_state_t *bs) {
bs->inventory[INVENTORY_BLUECUBE] = bs->cur_ps.generic1; bs->inventory[INVENTORY_BLUECUBE] = bs->cur_ps.generic1;
} }
#endif #endif
//Makro - adding clip info
//Note - this stuff is also added to the ammo info, so bots know they still have ammo for their guns
bs->inventory[INVENTORY_KNIFECLIP] = ent->client->numClips[WP_KNIFE];
bs->inventory[INVENTORY_PISTOLCLIP] = ent->client->numClips[WP_PISTOL];
bs->inventory[INVENTORY_M3CLIP] = ent->client->numClips[WP_M3];
bs->inventory[INVENTORY_SSG3000CLIP] = ent->client->numClips[WP_SSG3000];
bs->inventory[INVENTORY_MP5CLIP] = ent->client->numClips[WP_MP5];
bs->inventory[INVENTORY_M4CLIP] = ent->client->numClips[WP_M4];
bs->inventory[INVENTORY_HANDCANNONCLIP] = ent->client->numClips[WP_HANDCANNON];
bs->inventory[INVENTORY_AKIMBOCLIP] = ent->client->numClips[WP_AKIMBO];
bs->inventory[INVENTORY_GRENADECLIP] = ent->client->numClips[WP_GRENADE];
if (showInfo) {
BotAI_Print(PRT_MESSAGE, "Inventory for %s :\n-----------------\n", ent->client->pers.netname);
BotAI_Print(PRT_MESSAGE, "KNIFE : %i / %i\n", bs->inventory[INVENTORY_KNIFE], bs->inventory[INVENTORY_KNIFEAMMO]);
BotAI_Print(PRT_MESSAGE, "PISTOL: %i / %i\n", bs->inventory[INVENTORY_PISTOL], bs->inventory[INVENTORY_PISTOLAMMO]);
BotAI_Print(PRT_MESSAGE, "AKIMBO: %i / %i\n", bs->inventory[INVENTORY_AKIMBO], bs->inventory[INVENTORY_AKIMBOAMMO]);
BotAI_Print(PRT_MESSAGE, "M3 : %i / %i\n", bs->inventory[INVENTORY_M3], bs->inventory[INVENTORY_M3AMMO]);
BotAI_Print(PRT_MESSAGE, "HC : %i / %i\n", bs->inventory[INVENTORY_HANDCANNON], bs->inventory[INVENTORY_HANDCANNONAMMO]);
BotAI_Print(PRT_MESSAGE, "MP5 : %i / %i\n", bs->inventory[INVENTORY_MP5], bs->inventory[INVENTORY_MP5AMMO]);
BotAI_Print(PRT_MESSAGE, "M4 : %i / %i\n", bs->inventory[INVENTORY_M4], bs->inventory[INVENTORY_M4AMMO]);
BotAI_Print(PRT_MESSAGE, "M26 G : %i / %i\n", bs->inventory[INVENTORY_GRENADE], bs->inventory[INVENTORY_GRENADEAMMO]);
trap_Cvar_Set("bot_RQ3_report", "0");
}
BotCheckItemPickup(bs, oldinventory); BotCheckItemPickup(bs, oldinventory);
} }
@ -3455,7 +3516,7 @@ BotAimAtEnemy
================== ==================
*/ */
void BotAimAtEnemy(bot_state_t *bs) { void BotAimAtEnemy(bot_state_t *bs) {
int i, enemyvisible; int enemyvisible;
float dist, f, aim_skill, aim_accuracy, speed, reactiontime; float dist, f, aim_skill, aim_accuracy, speed, reactiontime;
vec3_t dir, bestorigin, end, start, groundtarget, cmdmove, enemyvelocity; vec3_t dir, bestorigin, end, start, groundtarget, cmdmove, enemyvelocity;
vec3_t mins = {-4,-4,-4}, maxs = {4, 4, 4}; vec3_t mins = {-4,-4,-4}, maxs = {4, 4, 4};
@ -3733,10 +3794,11 @@ void BotAimAtEnemy(bot_state_t *bs) {
aim_accuracy *= f; aim_accuracy *= f;
} }
//add some random stuff to the aim direction depending on the aim accuracy //add some random stuff to the aim direction depending on the aim accuracy
if (aim_accuracy < 0.8) { //Makro - bots look even more stupid than they are with this
VectorNormalize(dir); //if (aim_accuracy < 0.8) {
for (i = 0; i < 3; i++) dir[i] += 0.3 * crandom() * (1 - aim_accuracy); // VectorNormalize(dir);
} // for (i = 0; i < 3; i++) dir[i] += 0.3 * crandom() * (1 - aim_accuracy);
//}
//set the ideal view angles //set the ideal view angles
vectoangles(dir, bs->ideal_viewangles); vectoangles(dir, bs->ideal_viewangles);
//take the weapon spread into account for lower skilled bots //take the weapon spread into account for lower skilled bots
@ -3790,11 +3852,15 @@ void BotCheckAttack(bot_state_t *bs) {
#endif #endif
} }
// //
//Makro - we need the weapon info sooner
//get the weapon info
trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
reactiontime = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_REACTIONTIME, 0, 1); reactiontime = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_REACTIONTIME, 0, 1);
if (bs->enemysight_time > FloatTime() - reactiontime) return; if (bs->enemysight_time > FloatTime() - reactiontime) return;
if (bs->teleport_time > FloatTime() - reactiontime) return; if (bs->teleport_time > FloatTime() - reactiontime) return;
//if changing weapons //if changing weapons
if (bs->weaponchange_time > FloatTime() - 0.1) return; //Makro - changed from 0.1 to an expression that takes into account weapon info
if (bs->weaponchange_time > FloatTime() - 0.1 - wi.activate) return;
//check fire throttle characteristic //check fire throttle characteristic
if (bs->firethrottlewait_time > FloatTime()) return; if (bs->firethrottlewait_time > FloatTime()) return;
firethrottle = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_FIRETHROTTLE, 0, 1); firethrottle = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_FIRETHROTTLE, 0, 1);
@ -3829,8 +3895,7 @@ void BotCheckAttack(bot_state_t *bs) {
if (bsptrace.fraction < 1 && bsptrace.ent != attackentity) if (bsptrace.fraction < 1 && bsptrace.ent != attackentity)
return; return;
//get the weapon info //Makro - get weapon info sooner; was here before
trap_BotGetWeaponInfo(bs->ws, bs->weaponnum, &wi);
//get the start point shooting from //get the start point shooting from
VectorCopy(bs->origin, start); VectorCopy(bs->origin, start);
start[2] += bs->cur_ps.viewheight; start[2] += bs->cur_ps.viewheight;
@ -3995,8 +4060,10 @@ int BotModelMinsMaxs(int modelindex, int eType, int contents, vec3_t mins, vec3_
gentity_t *ent; gentity_t *ent;
int i; int i;
ent = &g_entities[0]; //Makro - started from 0
for (i = 0; i < level.num_entities; i++, ent++) { //ent = &g_entities[0];
ent = &g_entities[MAX_CLIENTS];
for (i = MAX_CLIENTS ; i<level.num_entities ; i++, ent++) {
if ( !ent->inuse ) { if ( !ent->inuse ) {
continue; continue;
} }
@ -4182,23 +4249,22 @@ BotFuncDoorGoal
int BotFuncDoorActivateGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) { int BotFuncDoorActivateGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) {
int modelindex, entitynum; int modelindex, entitynum;
char model[MAX_INFO_STRING]; char model[MAX_INFO_STRING];
vec3_t mins, maxs, origin, angles; vec3_t mins, maxs, origin;
//shoot at the shootable door //shoot at the shootable door
trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model)); trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model));
if (!*model) if (!*model)
return qfalse; return qfalse;
modelindex = atoi(model+1); modelindex = atoi(model+1);
if (!modelindex) if (!modelindex)
return qfalse; return qfalse;
VectorClear(angles); //VectorClear(angles);
entitynum = BotModelMinsMaxs(modelindex, ET_MOVER, 0, mins, maxs); entitynum = BotModelMinsMaxs(modelindex, ET_MOVER, 0, mins, maxs);
//door origin //door origin
VectorAdd(mins, maxs, origin); VectorAdd(mins, maxs, origin);
VectorScale(origin, 0.5, origin); VectorScale(origin, 0.5, origin);
VectorCopy(origin, activategoal->target); VectorCopy(origin, activategoal->target);
activategoal->shoot = qtrue; activategoal->shoot = qtrue;
//
activategoal->goal.entitynum = entitynum; //NOTE: this is the entity number of the shootable door activategoal->goal.entitynum = entitynum; //NOTE: this is the entity number of the shootable door
activategoal->goal.number = 0; activategoal->goal.number = 0;
activategoal->goal.flags = 0; activategoal->goal.flags = 0;
@ -4221,25 +4287,28 @@ function !
int BotFuncBreakableGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) { int BotFuncBreakableGoal(bot_state_t *bs, int bspent, bot_activategoal_t *activategoal) {
int modelindex, entitynum; int modelindex, entitynum;
char model[MAX_INFO_STRING]; char model[MAX_INFO_STRING];
vec3_t mins, maxs, origin, angles; vec3_t mins, maxs, origin;
//shoot at the func_breakable //shoot at the func_breakable
trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model)); trap_AAS_ValueForBSPEpairKey(bspent, "model", model, sizeof(model));
if (!*model) if (!*model)
return qfalse; return qfalse;
modelindex = atoi(model+1); modelindex = atoi(model+1);
if (!modelindex) if (!modelindex)
return qfalse; return qfalse;
VectorClear(angles); //VectorClear(angles);
entitynum = BotModelMinsMaxs(modelindex, ET_BREAKABLE, 0, mins, maxs); //Makro - changing from ET_BREAKABLE to 0
entitynum = BotModelMinsMaxs(modelindex, 0, 0, mins, maxs);
//breakable origin //breakable origin
VectorAdd(mins, maxs, origin); VectorAdd(mins, maxs, origin);
VectorScale(origin, 0.5, origin); VectorScale(origin, 0.5, origin);
VectorCopy(origin, activategoal->target); VectorCopy(origin, activategoal->target);
activategoal->shoot = qtrue; activategoal->shoot = qtrue;
activategoal->goal.entitynum = entitynum; //NOTE: this is the entity number of the shootable door activategoal->goal.entitynum = entitynum;
activategoal->goal.number = 0; activategoal->goal.number = 0;
activategoal->goal.flags = 0; activategoal->goal.flags = 0;
activategoal->weapon = WP_NONE;
//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;
VectorSet(activategoal->goal.mins, -8, -8, -8); VectorSet(activategoal->goal.mins, -8, -8, -8);

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.35 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.34 2002/04/23 06:03:39 niceass // Revision 1.34 2002/04/23 06:03:39 niceass
// pressure stuff // pressure stuff
// //
@ -1673,3 +1676,92 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
s->loopSound = ps->loopSound; s->loopSound = ps->loopSound;
s->generic1 = ps->generic1; s->generic1 = ps->generic1;
} }
//Makro - weapon string aliases
typedef struct {
const char *name;
weapon_t weapon;
} weaponAlias_t;
weaponAlias_t weaponAliases[] =
{
{RQ3_PISTOL_NAME, WP_PISTOL},
{"pistol", WP_PISTOL},
{"mk23", WP_PISTOL},
{RQ3_M3_NAME, WP_M3},
{"shotgun", WP_M3},
{RQ3_HANDCANNON_NAME, WP_HANDCANNON},
{"hc", WP_HANDCANNON},
{RQ3_M4_NAME, WP_M4},
{"m4", WP_M4},
{RQ3_MP5_NAME, WP_MP5},
{"mp5", WP_MP5},
{"mp5/10", WP_MP5},
{RQ3_SSG3000_NAME, WP_SSG3000},
{"sniper", WP_SSG3000},
{"ssg3000", WP_SSG3000},
{"ssg 3000", WP_SSG3000},
{"ssg", WP_SSG3000},
{RQ3_AKIMBO_NAME, WP_AKIMBO},
{"akimbo", WP_AKIMBO},
{RQ3_KNIFE_NAME, WP_KNIFE},
{"knife", WP_KNIFE},
{"knives", WP_KNIFE},
{RQ3_GRENADE_NAME, WP_GRENADE},
{"grenade", WP_GRENADE},
{"grenades", WP_GRENADE},
{NULL, WP_PISTOL}
};
#define num_weapon_aliases 25
weapon_t CharToWeapon ( char *name, weapon_t defweapon ) {
int i;
if (!name) return defweapon;
for (i=0; weaponAliases[i].name != NULL; i++) {
if ( !Q_stricmp(name, weaponAliases[i].name) )
return weaponAliases[i].weapon;
}
return defweapon;
}
//Makro - item string aliases
typedef struct {
const char *name;
holdable_t item;
} itemAlias_t;
itemAlias_t itemAliases[] =
{
{RQ3_SLIPPERS_NAME, HI_SLIPPERS},
{"slippers", HI_SLIPPERS},
{RQ3_KEVLAR_NAME, HI_KEVLAR},
{"vest", HI_KEVLAR},
{"kevlar", HI_KEVLAR},
{RQ3_BANDOLIER_NAME, HI_BANDOLIER},
{RQ3_LASER_NAME, HI_LASER},
{"laser", HI_LASER},
{RQ3_SILENCER_NAME, HI_SILENCER},
{NULL, HI_KEVLAR}
};
#define num_item_aliases 9
holdable_t CharToItem ( char *name, holdable_t defitem ) {
int i;
if (!name) return defitem;
for (i=0; itemAliases[i].name != NULL; i++) {
if ( !Q_stricmp(name, itemAliases[i].name) )
return itemAliases[i].item;
}
return defitem;
}

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.59 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.58 2002/04/29 06:17:39 niceass // Revision 1.58 2002/04/29 06:17:39 niceass
// small change to pressure system // small change to pressure system
// //
@ -1379,3 +1382,6 @@ int GetMaterialFromFlag( int flag );
qboolean IsMetalMat( int Material ); qboolean IsMetalMat( int Material );
qboolean IsMetalFlag( int flag ); qboolean IsMetalFlag( int flag );
holdable_t CharToItem ( char *name, holdable_t defitem );
weapon_t CharToWeapon ( char *name, weapon_t defweapon );

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.7 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.6 2002/01/11 19:48:30 jbravo // Revision 1.6 2002/01/11 19:48:30 jbravo
// Formatted the source in non DOS format. // Formatted the source in non DOS format.
// //
@ -568,6 +571,8 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
char *model; char *model;
char *headmodel; char *headmodel;
char userinfo[MAX_INFO_STRING]; char userinfo[MAX_INFO_STRING];
weapon_t tpWeapon = WP_MP5;
holdable_t tpItem = HI_KEVLAR;
// get the botinfo from bots.txt // get the botinfo from bots.txt
botinfo = G_GetBotInfoByName( name ); botinfo = G_GetBotInfoByName( name );
@ -681,6 +686,12 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
// register the userinfo // register the userinfo
trap_SetUserinfo( clientNum, userinfo ); trap_SetUserinfo( clientNum, userinfo );
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);
}
// have it connect to the game as a normal client // have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) ) { if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
return; return;
@ -688,10 +699,21 @@ static void G_AddBot( const char *name, float skill, const char *team, int delay
if( delay == 0 ) { if( delay == 0 ) {
ClientBegin( clientNum ); ClientBegin( clientNum );
//Makro - load custom weapon/item from bot file
if ( g_gametype.integer == GT_TEAMPLAY ) {
bot->client->teamplayWeapon = tpWeapon;
bot->client->teamplayItem = tpItem;
}
return; return;
} }
AddBotToSpawnQueue( clientNum, delay ); AddBotToSpawnQueue( clientNum, delay );
//Makro - load custom weapon/item from bot file
if ( g_gametype.integer == GT_TEAMPLAY ) {
bot->client->teamplayWeapon = tpWeapon;
bot->client->teamplayItem = tpItem;
}
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.70 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.69 2002/04/30 01:23:05 jbravo // Revision 1.69 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned // Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs. // all colors from the logs.
@ -1396,7 +1399,8 @@ void ClientBegin(int clientNum) {
if (g_gametype.integer == GT_TEAMPLAY) { if (g_gametype.integer == GT_TEAMPLAY) {
// NiceAss: Only set it if there is no value. Fix for going into spectator resetting values. // NiceAss: Only set it if there is no value. Fix for going into spectator resetting values.
if (ent->r.svFlags & SVF_BOT) { if (ent->r.svFlags & SVF_BOT) {
if (!client->teamplayWeapon) client->teamplayWeapon = WP_PISTOL; //Makro - changed from WP_PISTOL to WP_MP5
if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5;
if (!client->teamplayItem) client->teamplayItem = HI_KEVLAR; if (!client->teamplayItem) client->teamplayItem = HI_KEVLAR;
} else { } else {
if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5; if (!client->teamplayWeapon) client->teamplayWeapon = WP_MP5;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.100 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.99 2002/04/30 01:23:05 jbravo // Revision 1.99 2002/04/30 01:23:05 jbravo
// Changed the server logging to be more like a normal AQ server. Cleaned // Changed the server logging to be more like a normal AQ server. Cleaned
// all colors from the logs. // all colors from the logs.
@ -494,6 +497,8 @@ void Cmd_Give_f (gentity_t *ent)
for ( i = 0 ; i < MAX_WEAPONS ; i++ ) { for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
//Blaze: Give right amount of shots to each gun //Blaze: Give right amount of shots to each gun
ent->client->ps.ammo[i] = ClipAmountForAmmo(i); ent->client->ps.ammo[i] = ClipAmountForAmmo(i);
//Makro - I want clips, dammit !
Add_Ammo(ent, i, 100, 1);
} }
if (!give_all) if (!give_all)
return; return;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.18 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.17 2002/04/23 06:01:39 niceass // Revision 1.17 2002/04/23 06:01:39 niceass
// pressure stuff // pressure stuff
// //
@ -223,7 +226,8 @@ void SP_team_neutralobelisk( gentity_t *ent );
#endif #endif
// JBravo: SP_item_botroam doesnt really exsist. // JBravo: SP_item_botroam doesnt really exsist.
//void SP_item_botroam( gentity_t *ent ) {}; // Makro - still, bots are supposed to use these
void SP_item_botroam( gentity_t *ent ) {};
//Blaze: merged func_explosive into func_breakable //Blaze: merged func_explosive into func_breakable
// JBravo: adding explosive // JBravo: adding explosive
@ -307,7 +311,7 @@ spawn_t spawns[] = {
//Blaze: Merged func_explosive into func_breakable //Blaze: Merged func_explosive into func_breakable
// {"func_explosive", SP_func_explosive}, // JBravo: for explosive. // {"func_explosive", SP_func_explosive}, // JBravo: for explosive.
// {"item_botroam", SP_item_botroam}, {"item_botroam", SP_item_botroam},
{0, 0} {0, 0}
}; };

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.71 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.70 2002/04/30 11:20:12 jbravo // Revision 1.70 2002/04/30 11:20:12 jbravo
// Redid the teamcount cvars. // Redid the teamcount cvars.
// //
@ -915,11 +918,14 @@ void EquipPlayer (gentity_t *ent)
ent->client->ps.generic1 = ((ent->client->ps.generic1 & ANIM_TOGGLEBIT) ^ ent->client->ps.generic1 = ((ent->client->ps.generic1 & ANIM_TOGGLEBIT) ^
ANIM_TOGGLEBIT) | WP_ANIM_ACTIVATE; ANIM_TOGGLEBIT) | WP_ANIM_ACTIVATE;
} }
//Makro - equip bots, too
/*
if (ent->r.svFlags & SVF_BOT) { if (ent->r.svFlags & SVF_BOT) {
ent->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_PISTOL ); ent->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_PISTOL );
ent->client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_KNIFE ); ent->client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_KNIFE );
ent->client->uniqueWeapons = 0; ent->client->uniqueWeapons = 0;
} }
*/
ent->client->ps.weaponstate = WEAPON_RAISING; ent->client->ps.weaponstate = WEAPON_RAISING;
ent->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( ent->client->teamplayItem ) - bg_itemlist; ent->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( ent->client->teamplayItem ) - bg_itemlist;

View file

@ -3,18 +3,27 @@
<pre> <pre>
<h1>Build Log</h1> <h1>Build Log</h1>
<h3> <h3>
--------------------Configuration: game - Win32 Debug-------------------- --------------------Configuration: cgame - Win32 Release--------------------
</h3> </h3>
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPB32.tmp" with contents
<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\RSP1D0F.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 /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:\Development\reaction\game\g_misc.c" "C:\Games\Quake3\rq3source\reaction\game\ai_dmq3.c"
] ]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPB32.tmp" Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1D0F.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPB33.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1D10.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: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 \reactionoutput\ai_chat.obj
\reactionoutput\ai_cmd.obj \reactionoutput\ai_cmd.obj
\reactionoutput\ai_dmnet.obj \reactionoutput\ai_dmnet.obj
@ -55,22 +64,26 @@ 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 @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPB33.tmp" Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1D10.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
g_misc.c ai_dmq3.c
C:\Development\reaction\game\g_misc.c(691) : error C2107: illegal index, indirection not allowed Linking...
C:\Development\reaction\game\g_misc.c(691) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char ** ' Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
C:\Development\reaction\game\g_misc.c(691) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
C:\Development\reaction\game\g_misc.c(692) : error C2107: illegal index, indirection not allowed
C:\Development\reaction\game\g_misc.c(692) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char ** '
C:\Development\reaction\game\g_misc.c(692) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
Error executing cl.exe.
<h3>Results</h3> <h3>Results</h3>
qagamex86.dll - 2 error(s), 4 warning(s) 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> </pre>
</body> </body>
</html> </html>

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.9 2002/04/30 11:54:37 makro
// Bots rule ! Also, added clips to give all. Maybe some other things
//
// Revision 1.8 2002/04/01 02:56:50 jbravo // Revision 1.8 2002/04/01 02:56:50 jbravo
// Some sourcecode reformatting // Some sourcecode reformatting
// //
@ -95,6 +98,17 @@
#define INVENTORY_REDCUBE 48 #define INVENTORY_REDCUBE 48
#define INVENTORY_BLUECUBE 49 #define INVENTORY_BLUECUBE 49
//Makro - adding clips to inventory
#define INVENTORY_KNIFECLIP 100
#define INVENTORY_PISTOLCLIP 101
#define INVENTORY_M3CLIP 102
#define INVENTORY_SSG3000CLIP 103
#define INVENTORY_MP5CLIP 104
#define INVENTORY_M4CLIP 105
#define INVENTORY_HANDCANNONCLIP 106
#define INVENTORY_AKIMBOCLIP 107
#define INVENTORY_GRENADECLIP 108
//enemy stuff //enemy stuff
#define ENEMY_HORIZONTAL_DIST 200 #define ENEMY_HORIZONTAL_DIST 200
#define ENEMY_HEIGHT 201 #define ENEMY_HEIGHT 201