Changes to bot code. New surfaceparm system.

This commit is contained in:
Andrei Drexler 2002-04-06 21:42:20 +00:00
parent 60aacdd152
commit 90c7e3b74f
10 changed files with 261 additions and 85 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.7 2002/04/06 21:42:19 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.6 2002/04/04 18:06:44 makro // Revision 1.6 2002/04/04 18:06:44 makro
// Improved door code. Bots reply to radio treport from teammates. // Improved door code. Bots reply to radio treport from teammates.
// Improved reloading code. // Improved reloading code.
@ -1066,7 +1069,8 @@ void BotMatch_TaskPreference(bot_state_t *bs, bot_match_t *match) {
BotAI_BotInitialChat(bs, "keepinmind", teammatename, NULL); BotAI_BotInitialChat(bs, "keepinmind", teammatename, NULL);
trap_BotEnterChat(bs->cs, teammate, CHAT_TELL); trap_BotEnterChat(bs->cs, teammate, CHAT_TELL);
BotVoiceChatOnly(bs, teammate, VOICECHAT_YES); BotVoiceChatOnly(bs, teammate, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
} }
/* /*
@ -1302,6 +1306,7 @@ void BotMatch_Suicide(bot_state_t *bs, bot_match_t *match) {
client = ClientFromName(netname); client = ClientFromName(netname);
// //
BotVoiceChat(bs, client, VOICECHAT_TAUNT); BotVoiceChat(bs, client, VOICECHAT_TAUNT);
//Makro - ACTION_AFFIRMATIVE = reload in RQ3
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.14 2002/04/06 21:42:19 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.13 2002/04/05 18:52:26 makro // Revision 1.13 2002/04/05 18:52:26 makro
// Cleaned things up a bit // Cleaned things up a bit
// //
@ -78,11 +81,14 @@
#include "../ui/menudef.h" #include "../ui/menudef.h"
//Makro - to get rid of the warnings //Makro - to get rid of the warnings
bot_moveresult_t BotMoveTo(bot_state_t *bs, vec3_t dest);
void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist);
void Cmd_Bandage (gentity_t *ent); void Cmd_Bandage (gentity_t *ent);
gentity_t *SelectRandomDeathmatchSpawnPoint( void ); gentity_t *SelectRandomDeathmatchSpawnPoint( void );
//From ai_dmq3.c
void VectorTargetDist(vec3_t src, vec3_t dest, int dist, vec3_t final);
void BotAttack(bot_state_t *bs); void BotAttack(bot_state_t *bs);
bot_moveresult_t BotMoveTo(bot_state_t *bs, vec3_t dest);
void BotMoveTowardsEnt(bot_state_t *bs, vec3_t dest, int dist);
//goal flag, see be_ai_goal.h for the other GFL_* //goal flag, see be_ai_goal.h for the other GFL_*
#define GFL_AIR 128 #define GFL_AIR 128
@ -377,7 +383,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
BotAI_BotInitialChat(bs, "help_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL); BotAI_BotInitialChat(bs, "help_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL); trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES); BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
bs->teammessage_time = 0; bs->teammessage_time = 0;
} }
//if trying to help the team mate for more than a minute //if trying to help the team mate for more than a minute
@ -422,7 +429,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
BotAI_BotInitialChat(bs, "accompany_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL); BotAI_BotInitialChat(bs, "accompany_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL); trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES); BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
bs->teammessage_time = 0; bs->teammessage_time = 0;
} }
//if accompanying the companion for 3 minutes //if accompanying the companion for 3 minutes
@ -624,7 +632,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
BotAI_BotInitialChat(bs, "getitem_start", buf, NULL); BotAI_BotInitialChat(bs, "getitem_start", buf, NULL);
trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL); trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES); BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
bs->teammessage_time = 0; bs->teammessage_time = 0;
} }
//set the bot goal //set the bot goal
@ -656,7 +665,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
BotAI_BotInitialChat(bs, "camp_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL); BotAI_BotInitialChat(bs, "camp_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL); trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES); BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
} }
bs->teammessage_time = 0; bs->teammessage_time = 0;
} }
@ -738,7 +748,8 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
BotAI_BotInitialChat(bs, "patrol_start", buf, NULL); BotAI_BotInitialChat(bs, "patrol_start", buf, NULL);
trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL); trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES); BotVoiceChatOnly(bs, bs->decisionmaker, VOICECHAT_YES);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); //Makro - ACTION_AFFIRMATIVE = reload in RQ3
//trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
bs->teammessage_time = 0; bs->teammessage_time = 0;
} }
// //
@ -1232,6 +1243,7 @@ AINode_Stand
================== ==================
*/ */
int AINode_Stand(bot_state_t *bs) { int AINode_Stand(bot_state_t *bs) {
qboolean willBandage = qfalse;
//if the bot's health decreased //if the bot's health decreased
if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) { if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
@ -1239,6 +1251,23 @@ int AINode_Stand(bot_state_t *bs) {
bs->standfindenemy_time = FloatTime() + BotChatTime(bs) + 0.1; bs->standfindenemy_time = FloatTime() + BotChatTime(bs) + 0.1;
bs->stand_time = FloatTime() + BotChatTime(bs) + 0.1; bs->stand_time = FloatTime() + BotChatTime(bs) + 0.1;
} }
//Makro - if bot isn't bandaging already
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
//Makro - bot should bandage
if (bs->inventory[INVENTORY_HEALTH] > 60) {
willBandage = (random() < 0.3);
} else if (bs->inventory[INVENTORY_HEALTH] > 40) {
willBandage = (random() < 0.5);
} else if (bs->inventory[INVENTORY_HEALTH] > 20) {
willBandage = (random() < 0.7);
} else {
willBandage = qtrue;
}
if (willBandage) {
Cmd_Bandage( &g_entities[bs->entitynum] );
AIEnter_Battle_Retreat(bs, "stand: bandaging");
}
}
} }
if (bs->standfindenemy_time < FloatTime()) { if (bs->standfindenemy_time < FloatTime()) {
if (BotFindEnemy(bs, -1)) { if (BotFindEnemy(bs, -1)) {
@ -1287,6 +1316,8 @@ void AIEnter_Respawn(bot_state_t *bs, char *s) {
bs->radioresponse_count = 0; bs->radioresponse_count = 0;
//set respawn state //set respawn state
bs->standfindenemy_time = FloatTime() + 5;
bs->stand_time = FloatTime() + 10;
bs->respawn_wait = qfalse; bs->respawn_wait = qfalse;
bs->ainode = AINode_Respawn; bs->ainode = AINode_Respawn;
} }
@ -1311,7 +1342,6 @@ 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);
} }
} }
} }
@ -2448,7 +2478,10 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy"); AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
//Makro - bot retreating, enemy not in sight - a good time to bandage //Makro - bot retreating, enemy not in sight - a good time to bandage
if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) { if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
//If not bandaging already
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
Cmd_Bandage( &g_entities[bs->entitynum] ); Cmd_Bandage( &g_entities[bs->entitynum] );
}
/* /*
if (bot_developer.integer == 2) { if (bot_developer.integer == 2) {
G_Printf("^5BOT CODE: ^7Bandaging\n"); G_Printf("^5BOT CODE: ^7Bandaging\n");

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.17 2002/04/06 21:42:19 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.16 2002/04/05 18:52:26 makro // Revision 1.16 2002/04/05 18:52:26 makro
// Cleaned things up a bit // Cleaned things up a bit
// //
@ -142,7 +145,6 @@ int red_numaltroutegoals;
aas_altroutegoal_t blue_altroutegoals[MAX_ALTROUTEGOALS]; aas_altroutegoal_t blue_altroutegoals[MAX_ALTROUTEGOALS];
int blue_numaltroutegoals; int blue_numaltroutegoals;
//Makro - the vector located on the line from src to dest dist units away //Makro - the vector located on the line from src to dest dist units away
void VectorTargetDist(vec3_t src, vec3_t dest, int dist, vec3_t final) { void VectorTargetDist(vec3_t src, vec3_t dest, int dist, vec3_t final) {
VectorClear(final); VectorClear(final);
@ -163,11 +165,12 @@ void BotAttack(bot_state_t *bs) {
//If the gun is empty //If the gun is empty
if ( (bs->cur_ps.ammo[bs->weaponnum]) == 0 ) { if ( (bs->cur_ps.ammo[bs->weaponnum]) == 0 ) {
//If bot has extra clips, reload //If bot has extra clips, reload
if (g_entities[bs->entitynum].client->numClips[bs->weaponnum] >= 1 ) { if ( (g_entities[bs->entitynum].client->numClips[bs->weaponnum]) >= 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
trap_EA_Attack(bs->client); trap_EA_Attack(bs->client);
} }
} }
@ -2189,7 +2192,10 @@ void BotBattleUseItems(bot_state_t *bs) {
} }
} }
if (doBandage) { if (doBandage) {
//Makro - if not bandaging already
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
Cmd_Bandage( &g_entities[bs->entitynum] ); Cmd_Bandage( &g_entities[bs->entitynum] );
}
/* /*
if (bot_developer.integer == 2) { if (bot_developer.integer == 2) {
G_Printf(va("^5BOT CODE: ^7Bandaging with %i health\n", bs->inventory[INVENTORY_HEALTH])); G_Printf(va("^5BOT CODE: ^7Bandaging with %i health\n", bs->inventory[INVENTORY_HEALTH]));

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.5 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.4 2002/01/11 19:48:29 jbravo // Revision 1.4 2002/01/11 19:48:29 jbravo
// Formatted the source in non DOS format. // Formatted the source in non DOS format.
// //
@ -203,3 +206,5 @@ extern bot_goal_t redobelisk;
extern bot_goal_t blueobelisk; extern bot_goal_t blueobelisk;
extern bot_goal_t neutralobelisk; extern bot_goal_t neutralobelisk;
#endif #endif

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.66 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.65 2002/03/31 03:31:24 jbravo // Revision 1.65 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups // Compiler warning cleanups
// //
@ -59,6 +62,7 @@
#include "bg_public.h" #include "bg_public.h"
#include "bg_local.h" #include "bg_local.h"
pmove_t *pm; pmove_t *pm;
pml_t pml; pml_t pml;
@ -1135,48 +1139,63 @@ Returns an event number apropriate for the groundsurface
================ ================
*/ */
static int PM_FootstepForSurface( void ) { static int PM_FootstepForSurface( void ) {
int Material = GetMaterialFromFlag(pml.groundTrace.surfaceFlags);
if ( pml.groundTrace.surfaceFlags & SURF_NOSTEPS ) { if ( pml.groundTrace.surfaceFlags & SURF_NOSTEPS ) {
return 0; return 0;
} }
if ( pml.groundTrace.surfaceFlags & SURF_METALSTEPS ) { //Makro - new surfaceparm system
//if ( pml.groundTrace.surfaceFlags & SURF_METALSTEPS ) {
if ( Material == MAT_METALSTEPS ) {
return EV_FOOTSTEP_METAL; return EV_FOOTSTEP_METAL;
} }
//Elder: added for footstep support //Elder: added for footstep support
if ( pml.groundTrace.surfaceFlags & SURF_GRASS ) { //if ( pml.groundTrace.surfaceFlags & SURF_GRASS ) {
if ( Material == MAT_GRASS ) {
return EV_FOOTSTEP_GRASS; return EV_FOOTSTEP_GRASS;
} }
// JBravo: re-enables Gravel. // JBravo: re-enables Gravel.
if ( pml.groundTrace.surfaceFlags & SURF_GRAVEL ) { //Makro - new surfaceparm system
//if ( pml.groundTrace.surfaceFlags & SURF_GRAVEL ) {
if ( Material == MAT_GRAVEL ) {
return EV_FOOTSTEP_GRAVEL; return EV_FOOTSTEP_GRAVEL;
} }
if ( pml.groundTrace.surfaceFlags & SURF_WOOD ) { //if ( pml.groundTrace.surfaceFlags & SURF_WOOD ) {
if ( Material == MAT_WOOD ) {
return EV_FOOTSTEP_WOOD; return EV_FOOTSTEP_WOOD;
} }
if ( pml.groundTrace.surfaceFlags & SURF_CARPET ) { //if ( pml.groundTrace.surfaceFlags & SURF_CARPET ) {
if ( Material == MAT_CARPET ) {
return EV_FOOTSTEP_CARPET; return EV_FOOTSTEP_CARPET;
} }
if ( pml.groundTrace.surfaceFlags & SURF_METAL2 ) { //if ( pml.groundTrace.surfaceFlags & SURF_METAL2 ) {
if ( Material == MAT_METAL2 ) {
return EV_FOOTSTEP_METAL2; return EV_FOOTSTEP_METAL2;
} }
// JBravo: Begin adding new sounds // JBravo: Begin adding new sounds
if ( pml.groundTrace.surfaceFlags & SURF_SNOW ) { //Makro - new surfaceparm system
//if ( pml.groundTrace.surfaceFlags & SURF_SNOW ) {
if ( Material == MAT_SNOW ) {
return EV_FOOTSTEP_SNOW; return EV_FOOTSTEP_SNOW;
} }
if ( pml.groundTrace.surfaceFlags & SURF_MUD ) { //if ( pml.groundTrace.surfaceFlags & SURF_MUD ) {
if ( Material == MAT_MUD ) {
return EV_FOOTSTEP_MUD; return EV_FOOTSTEP_MUD;
} }
if ( pml.groundTrace.surfaceFlags & SURF_WOOD2 ) { //if ( pml.groundTrace.surfaceFlags & SURF_WOOD2 ) {
if ( Material == MAT_WOOD2 ) {
return EV_FOOTSTEP_WOOD2; return EV_FOOTSTEP_WOOD2;
} }
if ( pml.groundTrace.surfaceFlags & SURF_HARDMETAL ) { //if ( pml.groundTrace.surfaceFlags & SURF_HARDMETAL ) {
if ( Material == MAT_HARDMETAL ) {
return EV_FOOTSTEP_HARDMETAL; return EV_FOOTSTEP_HARDMETAL;
} }
// JBravo: end adding new sounds // JBravo: end adding new sounds
@ -3727,4 +3746,50 @@ void Pmove (pmove_t *pmove) {
//PM_CheckStuck(); //PM_CheckStuck();
} }
/*
=====================
SURFACEPARM STUFF
=====================
*/
int MatFlags[] =
{
SURF_METALSTEPS,
SURF_GRAVEL,
SURF_WOOD,
SURF_CARPET,
SURF_METAL2,
SURF_GLASS,
SURF_GRASS,
SURF_SNOW,
SURF_MUD,
SURF_WOOD2,
SURF_HARDMETAL
};
#define MatFlagCount 11
int GetMaterialFromFlag( int flag ) {
int Material = 0;
int i = 0;
for (i = 0; i < MatFlagCount; i++) {
if ( (flag & MatFlags[i]) ) {
Material += (1 << i);
}
}
return Material;
}
qboolean IsMetalMat( int Material ) {
if (Material == MAT_METALSTEPS || Material == MAT_METAL2 || Material == MAT_HARDMETAL) {
return qtrue;
}
return qfalse;
}
qboolean IsMetalFlag( int flag ) {
return IsMetalMat(GetMaterialFromFlag(flag));
}

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.55 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.54 2002/04/03 03:13:16 blaze // Revision 1.54 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps) // NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
// //
@ -1334,3 +1337,22 @@ qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTim
#define KAMI_BOOMSPHERE_MAXRADIUS 720 #define KAMI_BOOMSPHERE_MAXRADIUS 720
#define KAMI_SHOCKWAVE2_MAXRADIUS 704 #define KAMI_SHOCKWAVE2_MAXRADIUS 704
//Makro - for the new surfaceparm system
#define MAT_DEFAULT 0
#define MAT_METALSTEPS 1
#define MAT_GRAVEL 2
#define MAT_WOOD 4
#define MAT_CARPET 8
#define MAT_METAL2 16
#define MAT_GLASS 32
#define MAT_GRASS 64
#define MAT_SNOW 128
#define MAT_MUD 256
#define MAT_WOOD2 512
#define MAT_HARDMETAL 1024
int GetMaterialFromFlag( int flag );
qboolean IsMetalMat( int Material );
qboolean IsMetalFlag( int flag );

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.25 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.24 2002/04/05 18:53:26 jbravo // Revision 1.24 2002/04/05 18:53:26 jbravo
// Warning fixes // Warning fixes
// //
@ -29,6 +32,12 @@
// Copyright (C) 1999-2000 Id Software, Inc. // Copyright (C) 1999-2000 Id Software, Inc.
// //
#include "g_local.h" #include "g_local.h"
//Makro - to get the new surfaceparm system to work :/
#include "surfaceflags.h"
int GetMaterialFromFlag( int flag );
qboolean IsMetalMat( int Material );
qboolean IsMetalFlag( int flag );
#define MISSILE_PRESTEP_TIME 50 #define MISSILE_PRESTEP_TIME 50
@ -455,7 +464,9 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
if ( other->takedamage && other->client ) { if ( other->takedamage && other->client ) {
G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) ); G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) );
ent->s.otherEntityNum = other->s.number; ent->s.otherEntityNum = other->s.number;
} else if( trace->surfaceFlags & SURF_METALSTEPS ) { //Makro - new surfaceparm system
//} else if( trace->surfaceFlags & SURF_METALSTEPS ) {
} else if( IsMetalFlag(trace->surfaceFlags) ) {
G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) ); G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) );
} else { } else {
G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) ); G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) );

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.59 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.58 2002/04/05 06:50:25 blaze // Revision 1.58 2002/04/05 06:50:25 blaze
// breakables should now respawn when the round restarts( when g_teamplay:SpawnPlayers() is called to be exact) // breakables should now respawn when the round restarts( when g_teamplay:SpawnPlayers() is called to be exact)
// //
@ -1331,7 +1334,7 @@ void GetNearbyTeammates (gentity_t *self, char *buf)
{ {
char nearby_teammates[MAXNEAR][MAX_NAME_LENGTH]; char nearby_teammates[MAXNEAR][MAX_NAME_LENGTH];
int nearby_teammates_num, l; int nearby_teammates_num, l;
gentity_t *ent; gentity_t *ent = NULL;
nearby_teammates_num = 0; nearby_teammates_num = 0;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.43 2002/04/06 21:42:20 makro
// Changes to bot code. New surfaceparm system.
//
// Revision 1.42 2002/04/03 09:26:47 jbravo // Revision 1.42 2002/04/03 09:26:47 jbravo
// New FF system. Warns and then finally kickbans teamwounders and // New FF system. Warns and then finally kickbans teamwounders and
// teamkillers // teamkillers
@ -47,9 +50,15 @@
// perform the server side effects of a weapon firing // perform the server side effects of a weapon firing
#include "g_local.h" #include "g_local.h"
#include "surfaceflags.h"
// JBravo: for warnings // JBravo: for warnings
void Use_BinaryMover(gentity_t *ent, gentity_t *other, gentity_t *activator); void Use_BinaryMover(gentity_t *ent, gentity_t *other, gentity_t *activator);
//Makro - to get the new surfaceparm system to work :/
int GetMaterialFromFlag( int flag );
qboolean IsMetalMat( int Material );
qboolean IsMetalFlag( int flag );
static float s_quadFactor; static float s_quadFactor;
static vec3_t forward, right, up; static vec3_t forward, right, up;
static vec3_t muzzle; static vec3_t muzzle;
@ -406,6 +415,8 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
gentity_t *tent2; gentity_t *tent2;
gentity_t *traceEnt; gentity_t *traceEnt;
int i, passent; int i, passent;
//Makro
int Material;
// Elder: Statistics tracking // Elder: Statistics tracking
if (ent->client && level.team_round_going) if (ent->client && level.team_round_going)
@ -470,6 +481,9 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT); trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT);
//Makro - saving the material flag to avoid useless calls to the GetMaterialFromFlag function
Material = GetMaterialFromFlag(tr.surfaceFlags);
if ( tr.surfaceFlags & SURF_NOIMPACT ) { if ( tr.surfaceFlags & SURF_NOIMPACT ) {
return; return;
} }
@ -526,11 +540,14 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int MOD ) {
//} else if ( tr.surfaceFlags & SURF_GRASS ) { //} else if ( tr.surfaceFlags & SURF_GRASS ) {
//tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH); //tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH);
//tent->s.eventParm = DirToByte( tr.plane.normal ); //tent->s.eventParm = DirToByte( tr.plane.normal );
} else if ((tr.surfaceFlags & SURF_METALSTEPS) || (tr.surfaceFlags & SURF_METAL2) || (tr.surfaceFlags & SURF_HARDMETAL)) { //Makro - new surfaceparm system
//} else if ((tr.surfaceFlags & SURF_METALSTEPS) || (tr.surfaceFlags & SURF_METAL2) || (tr.surfaceFlags & SURF_HARDMETAL)) {
} else if (IsMetalMat(Material)) {
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_METAL ); tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_METAL );
tent->s.eventParm = DirToByte( tr.plane.normal ); tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.otherEntityNum = ent->s.number; tent->s.otherEntityNum = ent->s.number;
} else if ( tr.surfaceFlags & SURF_GLASS) { //} else if ( tr.surfaceFlags & SURF_GLASS) {
} else if ( Material == MAT_GLASS ) {
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_GLASS ); tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_GLASS );
tent->s.eventParm = DirToByte( tr.plane.normal ); tent->s.eventParm = DirToByte( tr.plane.normal );
tent->s.otherEntityNum = ent->s.number; tent->s.otherEntityNum = ent->s.number;
@ -684,7 +701,8 @@ void ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, gentity_t *ent, in
//Elder: added //Elder: added
int count; int count;
int hc_multipler; //Makro - wasn't initialized, caused a warning in MSVC
int hc_multipler = 4;
// derive the right and up vectors from the forward vector, because // derive the right and up vectors from the forward vector, because
// the client won't have any other information // the client won't have any other information
@ -1543,6 +1561,8 @@ void Weapon_SSG3000_Fire (gentity_t *ent) {
float r; float r;
float u; float u;
float spread; float spread;
//Makro
int Material;
// Elder: Statistics tracking // Elder: Statistics tracking
if (ent->client && level.team_round_going) if (ent->client && level.team_round_going)
@ -1640,10 +1660,13 @@ void Weapon_SSG3000_Fire (gentity_t *ent) {
else else
{ {
// impact type // impact type
if ( (trace.surfaceFlags & SURF_METALSTEPS) || //Makro - new surfaceparm system
(trace.surfaceFlags & SURF_METAL2) ) Material = GetMaterialFromFlag(trace.surfaceFlags);
//if ( (trace.surfaceFlags & SURF_METALSTEPS) ||
// (trace.surfaceFlags & SURF_METAL2) )
if ( IsMetalMat(Material) )
tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_METAL ); tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_METAL );
else if (trace.surfaceFlags & SURF_GLASS) else if (Material == MAT_GLASS)
tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_GLASS ); tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_GLASS );
else else
tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_WALL ); tent[unlinked] = G_TempEntity( trace.endpos, EV_BULLET_HIT_WALL );
@ -1701,12 +1724,15 @@ void Weapon_SSG3000_Fire (gentity_t *ent) {
// send wall bullet impact // send wall bullet impact
// no explosion at end if SURF_NOIMPACT // no explosion at end if SURF_NOIMPACT
Material = GetMaterialFromFlag(trace.surfaceFlags);
if ( !(trace.surfaceFlags & SURF_NOIMPACT) ) if ( !(trace.surfaceFlags & SURF_NOIMPACT) )
{ {
if ( (trace.surfaceFlags & SURF_METALSTEPS) || //Makro - new surfaceparm system
(trace.surfaceFlags & SURF_METAL2) ) //if ( (trace.surfaceFlags & SURF_METALSTEPS) ||
// (trace.surfaceFlags & SURF_METAL2) )
if (IsMetalMat(Material))
tentWall = G_TempEntity( trace.endpos, EV_BULLET_HIT_METAL ); tentWall = G_TempEntity( trace.endpos, EV_BULLET_HIT_METAL );
else if (trace.surfaceFlags & SURF_GLASS) else if (Material == MAT_GLASS)
tentWall = G_TempEntity( trace.endpos, EV_BULLET_HIT_GLASS ); tentWall = G_TempEntity( trace.endpos, EV_BULLET_HIT_GLASS );
else else
{ {
@ -2512,7 +2538,9 @@ void Laser_Think( gentity_t *self )
break; break;
} }
*/ */
if (!(tr.surfaceFlags & SURF_GLASS)) break; //Makro - new surfaceparm system
//if (!(tr.surfaceFlags & SURF_GLASS)) break;
if (!(GetMaterialFromFlag(tr.surfaceFlags) == MAT_GLASS)) break;
VectorMA(tr.endpos, 10, forward, start); // Nudge it forward a little bit VectorMA(tr.endpos, 10, forward, start); // Nudge it forward a little bit
} }

View file

@ -3,56 +3,56 @@
<pre> <pre>
<h1>Build Log</h1> <h1>Build Log</h1>
<h3> <h3>
--------------------Configuration: game - Win32 Debug-------------------- --------------------Configuration: game - Win32 Release--------------------
</h3> </h3>
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D7.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPDE4.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\ai_chat.c" "C:\Games\Quake3\rq3source\reaction\game\ai_chat.c"
"C:\Development\reaction\game\ai_cmd.c" "C:\Games\Quake3\rq3source\reaction\game\ai_cmd.c"
"C:\Development\reaction\game\ai_dmnet.c" "C:\Games\Quake3\rq3source\reaction\game\ai_dmnet.c"
"C:\Development\reaction\game\ai_dmq3.c" "C:\Games\Quake3\rq3source\reaction\game\ai_dmq3.c"
"C:\Development\reaction\game\ai_main.c" "C:\Games\Quake3\rq3source\reaction\game\ai_main.c"
"C:\Development\reaction\game\ai_team.c" "C:\Games\Quake3\rq3source\reaction\game\ai_team.c"
"C:\Development\reaction\game\ai_vcmd.c" "C:\Games\Quake3\rq3source\reaction\game\ai_vcmd.c"
"C:\Development\reaction\game\bg_misc.c" "C:\Games\Quake3\rq3source\reaction\game\bg_misc.c"
"C:\Development\reaction\game\bg_pmove.c" "C:\Games\Quake3\rq3source\reaction\game\bg_pmove.c"
"C:\Development\reaction\game\bg_slidemove.c" "C:\Games\Quake3\rq3source\reaction\game\bg_slidemove.c"
"C:\Development\reaction\game\g_active.c" "C:\Games\Quake3\rq3source\reaction\game\g_active.c"
"C:\Development\reaction\game\g_arenas.c" "C:\Games\Quake3\rq3source\reaction\game\g_arenas.c"
"C:\Development\reaction\game\g_bot.c" "C:\Games\Quake3\rq3source\reaction\game\g_bot.c"
"C:\Development\reaction\game\g_client.c" "C:\Games\Quake3\rq3source\reaction\game\g_client.c"
"C:\Development\reaction\game\g_cmds.c" "C:\Games\Quake3\rq3source\reaction\game\g_cmds.c"
"C:\Development\reaction\game\g_combat.c" "C:\Games\Quake3\rq3source\reaction\game\g_combat.c"
"C:\Development\reaction\game\g_fileio.c" "C:\Games\Quake3\rq3source\reaction\game\g_fileio.c"
"C:\Development\reaction\game\g_items.c" "C:\Games\Quake3\rq3source\reaction\game\g_items.c"
"C:\Development\reaction\game\g_main.c" "C:\Games\Quake3\rq3source\reaction\game\g_main.c"
"C:\Development\reaction\game\g_matchmode.c" "C:\Games\Quake3\rq3source\reaction\game\g_matchmode.c"
"C:\Development\reaction\game\g_mem.c" "C:\Games\Quake3\rq3source\reaction\game\g_mem.c"
"C:\Development\reaction\game\g_misc.c" "C:\Games\Quake3\rq3source\reaction\game\g_misc.c"
"C:\Development\reaction\game\g_missile.c" "C:\Games\Quake3\rq3source\reaction\game\g_missile.c"
"C:\Development\reaction\game\g_mover.c" "C:\Games\Quake3\rq3source\reaction\game\g_mover.c"
"C:\Development\reaction\game\g_session.c" "C:\Games\Quake3\rq3source\reaction\game\g_session.c"
"C:\Development\reaction\game\g_spawn.c" "C:\Games\Quake3\rq3source\reaction\game\g_spawn.c"
"C:\Development\reaction\game\g_svcmds.c" "C:\Games\Quake3\rq3source\reaction\game\g_svcmds.c"
"C:\Development\reaction\game\g_syscalls.c" "C:\Games\Quake3\rq3source\reaction\game\g_syscalls.c"
"C:\Development\reaction\game\g_target.c" "C:\Games\Quake3\rq3source\reaction\game\g_target.c"
"C:\Development\reaction\game\g_team.c" "C:\Games\Quake3\rq3source\reaction\game\g_team.c"
"C:\Development\reaction\game\g_teamplay.c" "C:\Games\Quake3\rq3source\reaction\game\g_teamplay.c"
"C:\Development\reaction\game\g_trigger.c" "C:\Games\Quake3\rq3source\reaction\game\g_trigger.c"
"C:\Development\reaction\game\g_utils.c" "C:\Games\Quake3\rq3source\reaction\game\g_utils.c"
"C:\Development\reaction\game\g_weapon.c" "C:\Games\Quake3\rq3source\reaction\game\g_weapon.c"
"C:\Development\reaction\game\q_math.c" "C:\Games\Quake3\rq3source\reaction\game\q_math.c"
"C:\Development\reaction\game\q_shared.c" "C:\Games\Quake3\rq3source\reaction\game\q_shared.c"
"C:\Development\reaction\game\rxn_game.c" "C:\Games\Quake3\rq3source\reaction\game\rxn_game.c"
"C:\Development\reaction\game\zcam.c" "C:\Games\Quake3\rq3source\reaction\game\zcam.c"
"C:\Development\reaction\game\zcam_target.c" "C:\Games\Quake3\rq3source\reaction\game\zcam_target.c"
] ]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D7.tmp" Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPDE4.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D8.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPDE5.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
@ -93,16 +93,13 @@ 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\RSP2D8.tmp" Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPDE5.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
ai_chat.c ai_chat.c
ai_cmd.c ai_cmd.c
ai_dmnet.c ai_dmnet.c
C:\Development\reaction\game\ai_dmnet.c(1517) : warning C4013: 'BotMoveTowardsEnt' undefined; assuming extern returning int
C:\Development\reaction\game\ai_dmnet.c(2408) : warning C4013: 'Cmd_Bandage' undefined; assuming extern returning int
ai_dmq3.c ai_dmq3.c
C:\Development\reaction\game\ai_dmq3.c(2132) : warning C4013: 'Cmd_Bandage' undefined; assuming extern returning int
ai_main.c ai_main.c
ai_team.c ai_team.c
ai_vcmd.c ai_vcmd.c
@ -134,6 +131,7 @@ g_trigger.c
g_utils.c g_utils.c
g_weapon.c g_weapon.c
q_math.c q_math.c
C:\Games\Quake3\rq3source\reaction\game\g_weapon.c(2549) : warning C4701: local variable 'tr' may be used without having been initialized
q_shared.c q_shared.c
rxn_game.c rxn_game.c
zcam.c zcam.c
@ -144,7 +142,7 @@ Linking...
<h3>Results</h3> <h3>Results</h3>
qagamex86.dll - 0 error(s), 3 warning(s) qagamex86.dll - 0 error(s), 1 warning(s)
</pre> </pre>
</body> </body>
</html> </html>