This is an automated email from the git hooks/post-receive script. smcv pushed a commit to tag 1.51 in repository iortcw.
commit d6ee8fc999e4094eac4a66d0f357441fc55316bb Author: MAN-AT-ARMS <[email protected]> Date: Tue Mar 14 22:11:14 2017 -0400 All: Source alignment and cleanup - Part3 --- MP/code/game/ai_cast.c | 10 +- MP/code/game/ai_cast.h | 10 +- MP/code/game/ai_cast_characters.c | 300 +++++++++++++++++----------------- MP/code/game/ai_cast_debug.c | 3 +- MP/code/game/ai_cast_events.c | 32 ---- MP/code/game/ai_cast_fight.c | 44 +---- MP/code/game/ai_cast_func_attack.c | 28 +--- MP/code/game/ai_cast_funcs.c | 83 +++------- MP/code/game/ai_cast_script.c | 20 +-- MP/code/game/ai_cast_script_actions.c | 30 ++-- MP/code/game/ai_cast_sight.c | 9 +- MP/code/game/ai_cast_think.c | 30 ++-- SP/code/game/ai_cast.c | 44 ++--- SP/code/game/ai_cast.h | 10 +- SP/code/game/ai_cast_characters.c | 239 ++++++++++++++------------- SP/code/game/ai_cast_debug.c | 2 +- SP/code/game/ai_cast_events.c | 14 -- SP/code/game/ai_cast_fight.c | 5 +- SP/code/game/ai_cast_func_attack.c | 6 +- SP/code/game/ai_cast_func_boss1.c | 3 - SP/code/game/ai_cast_funcs.c | 93 +++++------ SP/code/game/ai_cast_script.c | 64 ++++---- SP/code/game/ai_cast_script_actions.c | 35 +--- SP/code/game/ai_cast_think.c | 25 +-- 24 files changed, 475 insertions(+), 664 deletions(-) diff --git a/MP/code/game/ai_cast.c b/MP/code/game/ai_cast.c index 714105a..58397ec 100644 --- a/MP/code/game/ai_cast.c +++ b/MP/code/game/ai_cast.c @@ -373,6 +373,7 @@ gentity_t *AICast_CreateCharacter( gentity_t *ent, float *attributes, cast_weapo // cs = AICast_GetCastState( newent->s.number ); // + cs->aiCharacter = ent->aiCharacter; // setup the attributes memcpy( cs->attributes, attributes, sizeof( cs->attributes ) ); ppStr = &ent->aiAttributes; @@ -392,7 +393,6 @@ gentity_t *AICast_CreateCharacter( gentity_t *ent, float *attributes, cast_weapo cs->bs->enemy = -1; cs->leaderNum = -1; cs->castScriptStatus.scriptGotoEnt = -1; - cs->aiCharacter = ent->aiCharacter; // newent->aiName = ent->aiName; newent->aiTeam = ent->aiTeam; @@ -730,12 +730,12 @@ void AICast_CheckLoadGame( void ) { if ( ready ) { trap_Cvar_Set( "savegame_loading", "0" ); // in-case it aborts + saveGamePending = qfalse; // G_LoadGame( NULL ); // always load the "current" savegame trap_Cvar_Set( "cg_norender", "0" ); - saveGamePending = qfalse; // wait for the clients to return from faded screen - // trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); +// trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 750", level.time + 500 ) ); level.reloadPauseTime = level.time + 1100; @@ -755,12 +755,12 @@ void AICast_CheckLoadGame( void ) { // not loading a game, we must be in a new level, so look for some persistant data to read in, then save the game if ( ready ) { // G_LoadPersistant(); // make sure we save the game after we have brought across the items -// G_SaveGame( NULL ); + trap_Cvar_Set( "cg_norender", "0" ); saveGamePending = qfalse; // wait for the clients to return from faded screen - // trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); +// trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 1500", level.time + 500 ) ); trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 750", level.time + 500 ) ); level.reloadPauseTime = level.time + 1100; diff --git a/MP/code/game/ai_cast.h b/MP/code/game/ai_cast.h index d3dd01d..f533dd1 100644 --- a/MP/code/game/ai_cast.h +++ b/MP/code/game/ai_cast.h @@ -194,10 +194,10 @@ extern AICharacterDefaults_t aiDefaults[NUM_CHARACTERS]; // // structure defines // -#define AIVIS_ENEMY 1 -#define AIVIS_INSPECTED 2 // we have inspected them once already -#define AIVIS_INSPECT 4 // we should inspect them when we get a chance -#define AIVIS_PROCESS_SIGHTING 8 // so we know if we have or haven't processed the sighting since they were last seen +#define AIVIS_ENEMY 1 +#define AIVIS_INSPECTED 2 // we have inspected them once already +#define AIVIS_INSPECT 4 // we should inspect them when we get a chance +#define AIVIS_PROCESS_SIGHTING 8 // so we know if we have or haven't processed the sighting since they were last seen // // share range #define AIVIS_SHARE_RANGE 170 // if we are within this range of a friendly, share their vis info @@ -532,7 +532,7 @@ typedef struct cast_state_s } cast_state_t; // -#define CSFOFS( x ) ( (int)&( ( (cast_state_t *)0 )->x ) ) +#define CSFOFS( x ) ( (size_t)&( ( (cast_state_t *)0 )->x ) ) // typedef struct aicast_predictmove_s { diff --git a/MP/code/game/ai_cast_characters.c b/MP/code/game/ai_cast_characters.c index 3104a55..1d850b0 100644 --- a/MP/code/game/ai_cast_characters.c +++ b/MP/code/game/ai_cast_characters.c @@ -48,8 +48,10 @@ If you have questions concerning this license or the applicable additional terms //--------------------------------------------------------------------------- // Character specific attributes (defaults, these can be altered in the editor (TODO!)) AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { + //AICHAR_NONE {0}, + //AICHAR_SOLDIER { "Soldier", @@ -71,28 +73,29 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "infantrySightPlayer", "infantryAttackPlayer", "infantryOrders", "infantryDeath", - "infantrySilentDeath", //----(SA) added + "infantrySilentDeath", //----(SA) added "infantryPain", - "infantryStay", // stay - you're told to stay put - "infantryFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "infantryOrdersDeny", // deny - refuse orders (doing something else) - AITEAM_NAZI, // team - "infantryss/default", // default model/skin - {WP_MP40,WP_GRENADE_LAUNCHER}, // starting weapons - BBOX_SMALL, {32,48}, // bbox, crouch/stand height - AIFL_CATCH_GRENADE | AIFL_STAND_IDLE2, // flags - 0, 0, 0, // special attack routine - NULL, // looping sound + "infantryStay", // stay - you're told to stay put + "infantryFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "infantryOrdersDeny", // deny - refuse orders (doing something else) + AITEAM_NAZI, // team + "infantryss/default", // default model/skin + {WP_MP40,WP_GRENADE_LAUNCHER}, // starting weapons + BBOX_SMALL, {32,48}, // bbox, crouch/stand height + AIFL_CATCH_GRENADE | AIFL_STAND_IDLE2, // flags + 0, 0, 0, // special attack routine + NULL, // looping sound AISTATE_RELAXED }, + //AICHAR_AMERICAN { "American", @@ -114,19 +117,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "americanSightPlayer", "americanAttackPlayer", "americanOrders", "americanDeath", - "americanDeath", //----(SA) added + "americanDeath", //----(SA) added "americanPain", - "americanStay", // stay - you're told to stay put - "americanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "americanOrdersDeny", // deny - refuse orders (doing something else) + "americanStay", // stay - you're told to stay put + "americanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "americanOrdersDeny", // deny - refuse orders (doing something else) AITEAM_ALLIES, "american/default", {WP_THOMPSON,WP_GRENADE_PINEAPPLE}, @@ -136,6 +139,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_RELAXED }, + //AICHAR_ZOMBIE { "Zombie", @@ -157,19 +161,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 180, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "zombieSightPlayer", "zombieAttackPlayer", "zombieOrders", "zombieDeath", - "zombieDeath", //----(SA) added + "zombieDeath", //----(SA) added "zombiePain", - "zombieStay", // stay - you're told to stay put - "zombieFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "zombieOrdersDeny", // deny - refuse orders (doing something else) + "zombieStay", // stay - you're told to stay put + "zombieFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "zombieOrdersDeny", // deny - refuse orders (doing something else) AITEAM_MONSTER, "zombie/default", {WP_GAUNTLET,WP_MONSTER_ATTACK2}, @@ -202,23 +206,23 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 180, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "warzombieSightPlayer", "warzombieAttackPlayer", "warzombieOrders", "warzombieDeath", - "warzombieDeath", //----(SA) added + "warzombieDeath", //----(SA) added "warzombiePain", - "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put - "warzombieFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "warzombieOrdersDeny", // deny - refuse orders (doing something else) + "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put + "warzombieFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "warzombieOrdersDeny", // deny - refuse orders (doing something else) AITEAM_MONSTER, "warrior/default", {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, - BBOX_SMALL, {10,48}, // very low defense position + BBOX_SMALL, {10,48}, // very low defense position AIFL_NO_RELOAD, AIFunc_WarriorZombieMeleeStart, /*AIFunc_WarriorZombieSightStart*/ 0, AIFunc_WarriorZombieDefenseStart, NULL, @@ -247,8 +251,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 180, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "zombieFemSightPlayer", @@ -294,8 +298,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "undeadSightPlayer", @@ -337,19 +341,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 240, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "venomSightPlayer", "venomAttackPlayer", "venomOrders", "venomDeath", - "venomDeath", //----(SA) added + "venomDeath", //----(SA) added "venomPain", - "venomStay", // stay - you're told to stay put - "venomFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "venomOrdersDeny", // deny - refuse orders (doing something else) + "venomStay", // stay - you're told to stay put + "venomFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "venomOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "venom/default", {WP_VENOM,WP_VENOM_FULL,WP_FLAMETHROWER}, @@ -359,6 +363,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_ALERT }, + //AICHAR_LOPER { "Loper", @@ -380,23 +385,23 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 500, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "loperSightPlayer", "loperAttackPlayer", "loperOrders", "loperDeath", - "loperDeath", //----(SA) added + "loperDeath", //----(SA) added "loperPain", - "loperStay", // stay - you're told to stay put - "loperFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "loperOrdersDeny", // deny - refuse orders (doing something else) + "loperStay", // stay - you're told to stay put + "loperFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "loperOrdersDeny", // deny - refuse orders (doing something else) AITEAM_MONSTER, "loper/default", {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, - BBOX_LARGE, {48,48}, // large is for wide characters + BBOX_LARGE, {48,48}, // large is for wide characters AIFL_NO_RELOAD, AIFunc_LoperAttack1Start, AIFunc_LoperAttack2Start, AIFunc_LoperAttack3Start, "sound/world/electloop.wav", @@ -425,8 +430,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 500, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "sealoperSightPlayer", @@ -447,7 +452,6 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { AIFunc_LoperAttack1Start, AIFunc_LoperAttack2Start, AIFunc_LoperAttack3Start, "sound/world/electloop.wav", AISTATE_ALERT - }, //AICHAR_ELITEGUARD @@ -471,19 +475,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 120, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "eliteGuardSightPlayer", "eliteGuardAttackPlayer", "eliteGuardOrders", "eliteGuardDeath", - "eliteGuardDeath", //----(SA) added + "eliteGuardDeath", //----(SA) added "eliteGuardPain", - "eliteGuardStay", // stay - you're told to stay put - "eliteGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "eliteGuardOrdersDeny", // deny - refuse orders (doing something else) + "eliteGuardStay", // stay - you're told to stay put + "eliteGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "eliteGuardOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "eliteguard/default", {WP_SILENCER}, //----(SA) TODO: replace w/ "silenced luger" @@ -515,28 +519,29 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "stimSoldierSightPlayer", "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierDeath", //----(SA) added + "stimSoldierDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "stim/default", - {WP_MONSTER_ATTACK2}, // TODO: dual machinegun attack + {WP_MONSTER_ATTACK2}, // TODO: dual machinegun attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, 0, AIFunc_StimSoldierAttack2Start, 0, NULL, AISTATE_ALERT }, + //AICHAR_STIMSOLDIER2 { "Stim Soldier", @@ -558,28 +563,29 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "stimSoldierSightPlayer", "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierDeath", //----(SA) added + "stimSoldierDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "stim/default", - {WP_MP40, WP_ROCKET_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is leaping rocket attack + {WP_MP40, WP_ROCKET_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is leaping rocket attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, AIFunc_StimSoldierAttack1Start, 0, 0, NULL, AISTATE_ALERT }, + //AICHAR_STIMSOLDIER3 { "Stim Soldier", @@ -601,28 +607,29 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "stimSoldierSightPlayer", "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierDeath", //----(SA) added + "stimSoldierDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "stim/default", - {WP_MP40, WP_TESLA}, // no monster_attack1, since that's only used for the jumping rocket attack + {WP_MP40, WP_TESLA}, // no monster_attack1, since that's only used for the jumping rocket attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, AIFunc_StimSoldierAttack1Start, 0, 0, NULL, AISTATE_ALERT }, + //AICHAR_SUPERSOLDIER { "Super Soldier", @@ -644,19 +651,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 2.0, // pain threshold multiplier }, "superSoldierSightPlayer", "superSoldierAttackPlayer", "superSoldierOrders", "superSoldierDeath", - "superSoldierDeath", //----(SA) added + "superSoldierDeath", //----(SA) added "superSoldierPain", - "superSoldierStay", // stay - you're told to stay put - "superSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "superSoldierOrdersDeny", // deny - refuse orders (doing something else) + "superSoldierStay", // stay - you're told to stay put + "superSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "superSoldierOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "supersoldier/default", {WP_VENOM}, @@ -666,6 +673,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_ALERT }, + //AICHAR_BLACKGUARD { "Black Guard", @@ -687,29 +695,30 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 120, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "blackGuardSightPlayer", "blackGuardAttackPlayer", "blackGuardOrders", "blackGuardDeath", - "blackGuardDeath", //----(SA) added + "blackGuardDeath", //----(SA) added "blackGuardPain", - "blackGuardStay", // stay - you're told to stay put - "blackGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "blackGuardOrdersDeny", // deny - refuse orders (doing something else) + "blackGuardStay", // stay - you're told to stay put + "blackGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "blackGuardOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "blackguard/default", -// {WP_MP40, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick - {WP_FG42, WP_FG42SCOPE, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick +// {WP_MP40, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick + {WP_FG42, WP_FG42SCOPE, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick BBOX_SMALL, {32,48}, AIFL_CATCH_GRENADE | AIFL_FLIP_ANIM | AIFL_STAND_IDLE2, AIFunc_BlackGuardAttack1Start, 0, 0, NULL, AISTATE_ALERT }, + //AICHAR_PROTOSOLDIER { "Protosoldier", @@ -731,19 +740,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 2.0, // pain threshold multiplier }, "protoSoldierSightPlayer", "protoSoldierAttackPlayer", "protoSoldierOrders", "protoSoldierDeath", - "protoSoldierDeath", //----(SA) added + "protoSoldierDeath", //----(SA) added "protoSoldierPain", - "protoSoldierStay", // stay - you're told to stay put - "protoSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "protoSoldierOrdersDeny", // deny - refuse orders (doing something else) + "protoSoldierStay", // stay - you're told to stay put + "protoSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "protoSoldierOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "protosoldier/default", // {WP_TESLA}, @@ -754,6 +763,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_ALERT }, + //AICHAR_REJECTX { "Reject X Creature", @@ -776,8 +786,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 500, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "rejectXSightPlayer", @@ -798,7 +808,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_ALERT }, -// AICHAR_FROGMAN + + // AICHAR_FROGMAN { "Frogman", { @@ -819,19 +830,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 200, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "frogmanSightPlayer", "frogmanAttackPlayer", "frogmanOrders", "frogmanDeath", - "frogmanDeath", //----(SA) added + "frogmanDeath", //----(SA) added "frogmanPain", - "frogmanStay", // stay - you're told to stay put - "frogmanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "frogmanOrdersDeny", // deny - refuse orders (doing something else) + "frogmanStay", // stay - you're told to stay put + "frogmanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "frogmanOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "frogman/default", {WP_SPEARGUN}, @@ -841,6 +852,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_RELAXED }, + //AICHAR_HELGA { "Helga", @@ -862,29 +874,30 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "helgaSightPlayer", "helgaAttackPlayer", "helgaOrders", "helgaDeath", - "helgaDeath", //----(SA) added + "helgaDeath", //----(SA) added "helgaPain", - "helgaStay", // stay - you're told to stay put - "helgaFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "helgaOrdersDeny", // deny - refuse orders (doing something else) - AITEAM_MONSTER, // team - "helga/default", // default model/skin - {WP_LUGER}, // starting weapons - BBOX_SMALL, {32,48}, // bbox, crouch/stand height + "helgaStay", // stay - you're told to stay put + "helgaFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "helgaOrdersDeny", // deny - refuse orders (doing something else) + AITEAM_MONSTER, // team + "helga/default", // default model/skin + {WP_LUGER}, // starting weapons + BBOX_SMALL, {32,48}, // bbox, crouch/stand height // AIFL_STAND_IDLE2, // flags 0, - 0, 0, 0, // special attack routine + 0, 0, 0, // special attack routine NULL, AISTATE_ALERT }, + //AICHAR_HEINRICH { "Heinrich", @@ -906,8 +919,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 300, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "heinrichSightPlayer", @@ -916,18 +929,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "heinrichDeath", "heinrichDeath", "heinrichPain", - "heinrichStay", // stay - you're told to stay put - "heinrichFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "heinrichOrdersDeny", // deny - refuse orders (doing something else) + "heinrichStay", // stay - you're told to stay put + "heinrichFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "heinrichOrdersDeny", // deny - refuse orders (doing something else) AITEAM_NAZI, "heinrich/default", {WP_VENOM_FULL}, - BBOX_LARGE, {110,140}, // (SA) height is not exact. just eyeballed. + BBOX_LARGE, {110,140}, // (SA) height is not exact. just eyeballed. AIFL_WALKFORWARD | AIFL_NO_RELOAD, 0, 0, 0, NULL, AISTATE_ALERT }, + //AICHAR_PARTISAN { "Partisan", @@ -949,15 +963,15 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "partisanSightPlayer", "partisanAttackPlayer", "partisanOrders", "partisanDeath", - "partisanDeath", //----(SA) added + "partisanDeath", //----(SA) added "partisanPain", "partisanStay", "partisanFollow", @@ -971,6 +985,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_RELAXED }, + //AICHAR_CIVILIAN { "Civilian", @@ -992,20 +1007,20 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "civilianSightPlayer", "civilianAttackPlayer", "civilianOrders", "civilianDeath", - "civilianDeath", //----(SA) added + "civilianDeath", //----(SA) added "civilianPain", "civilianStay", "civilianFollow", "civilianOrdersDeny", - AITEAM_NEUTRAL, //----(SA) changed affiliation for DK + AITEAM_NEUTRAL, //----(SA) changed affiliation for DK "civilian/default", {0}, BBOX_SMALL, {32,48}, @@ -1014,6 +1029,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { NULL, AISTATE_RELAXED }, + //AICHAR_CHIMP { "Chimp", @@ -1035,8 +1051,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { 0.0, // camper 16000, // alertness 100, // starting health - 1.0, // hearing range - 512, // relaxec detection radius + 1.0, // hearing scale + 512, // relaxed detection radius 1.0, // pain threshold multiplier }, "chimpSightPlayer", @@ -1064,7 +1080,6 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { // Bounding boxes static vec3_t bbmins[2] = {{-18, -18, -24},{-32,-32,-24}}; static vec3_t bbmaxs[2] = {{ 18, 18, 48},{ 32, 32, 68}}; -// TTimo unused //static float crouchMaxZ[2] = {32,48}; // same as player, will head be ok? //--------------------------------------------------------------------------- @@ -1139,8 +1154,6 @@ int AIChar_GetPainLocation( gentity_t *ent, vec3_t point ) { orientation_t or; // first make sure the client is able to retrieve tag information - // TTimo gcc: warning: comparison is always false due to limited range of data type - // initial line: if (trap_GetTag( ent->s.number, painTagNames[0], &or ) < 0) if ( !trap_GetTag( ent->s.number, painTagNames[0], &or ) ) { return 0; } @@ -1148,8 +1161,6 @@ int AIChar_GetPainLocation( gentity_t *ent, vec3_t point ) { // find a correct animation to play, based on the body orientation at previous frame for ( tagIndex = 0, bestDist = 0, bestTag = -1; painTagNames[tagIndex]; tagIndex++ ) { // grab the tag with this name - // TTimo gcc: warning: comparison is always true due to limited range of data type - // initial line: if (trap_GetTag( ent->s.number, painTagNames[tagIndex], &or ) >= 0) if ( trap_GetTag( ent->s.number, painTagNames[tagIndex], &or ) ) { dist = VectorDistance( or.origin, point ); if ( !bestDist || dist < bestDist ) { @@ -1439,6 +1450,7 @@ void AIChar_spawn( gentity_t *ent ) { for ( i = 0; aiCharDefaults->weapons[i]; i++ ) { //weaponInfo.startingWeapons[(aiCharDefaults->weapons[i] / 32)] |= ( 1 << aiCharDefaults->weapons[i] ); //weaponInfo.startingWeapons[0] |= ( 1 << aiCharDefaults->weapons[i] ); + COM_BitSet( weaponInfo.startingWeapons, aiCharDefaults->weapons[i] ); if ( aiCharDefaults->weapons[i] == WP_GRENADE_LAUNCHER ) { // give them a bunch of grenades, but not an unlimited supply weaponInfo.startingAmmo[BG_FindAmmoForWeapon( aiCharDefaults->weapons[i] )] = 6; @@ -1639,18 +1651,14 @@ warrior zombie entity /* ============ -SP_ai_zombie +SP_ai_warzombie ============ */ void SP_ai_warzombie( gentity_t *ent ) { AICast_DelayedSpawnCast( ent, AICHAR_WARZOMBIE ); } - - //----(SA) end - - //---------------------------------------------------------------------------------------------------------------------------- /*QUAKED ai_femzombie (1 0.25 0) (-16 -16 -24) (16 16 64) TriggerSpawn NoRevive zombie entity @@ -1669,9 +1677,6 @@ void SP_ai_femzombie( gentity_t *ent ) { AICast_DelayedSpawnCast( ent, AICHAR_FEMZOMBIE ); } - - - //---------------------------------------------------------------------------------------------------------------------------- /*QUAKED ai_undead (1 0.25 0) (-16 -16 -24) (16 16 64) TriggerSpawn NoRevive undead entity @@ -1957,7 +1962,6 @@ void SP_ai_protosoldier( gentity_t *ent ) { AICast_DelayedSpawnCast( ent, AICHAR_PROTOSOLDIER ); } - //---------------------------------------------------------------------------------------------------------------------------- /*QUAKED ai_rejectxcreature (1 0.25 0) (-16 -16 -24) (16 16 64) TriggerSpawn NoRevive Reject X creature diff --git a/MP/code/game/ai_cast_debug.c b/MP/code/game/ai_cast_debug.c index 961680d..3fdec37 100644 --- a/MP/code/game/ai_cast_debug.c +++ b/MP/code/game/ai_cast_debug.c @@ -114,7 +114,6 @@ AICast_DBG_RouteTable_f */ void AICast_DBG_RouteTable_f( vec3_t org, char *param ) { static int srcarea = 0, dstarea = 0; - // TTimo unused // extern botlib_export_t botlib; if ( !param || strlen( param ) < 1 ) { @@ -150,7 +149,7 @@ AICast_DBG_Spawn_f =============== */ void AICast_DBG_Spawn_f( gclient_t *client, char *cmd ) { - extern qboolean G_CallSpawn( gentity_t * ent ); + extern qboolean G_CallSpawn( gentity_t *ent ); gentity_t *ent; vec3_t dir; diff --git a/MP/code/game/ai_cast_events.c b/MP/code/game/ai_cast_events.c index f52606d..89067aa 100644 --- a/MP/code/game/ai_cast_events.c +++ b/MP/code/game/ai_cast_events.c @@ -213,19 +213,6 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // RF, changed this so Zombies always gib now GibEntity( self, killer ); nogib = qfalse; -/* - // Zombie has special exploding cloud effect - if (attacker != inflictor || attacker->s.weapon == WP_VENOM) - { - GibEntity( self, killer ); - nogib = qfalse; - } else { - // Zombie will decompose upon dying - self->client->ps.eFlags |= EF_MONSTER_EFFECT2; - self->s.effect2Time = level.time+200; - self->health = -1; - } -*/ self->takedamage = qfalse; self->r.contents = 0; cs->secondDeadTime = 2; @@ -286,24 +273,6 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // RF, changed this so Zombies always gib now GibEntity( self, killer ); nogib = qfalse; -/* - // Zombie has special exploding cloud effect - if (attacker != inflictor || attacker->s.weapon == WP_VENOM) - { - GibEntity( self, killer ); - nogib = qfalse; - self->takedamage = qfalse; - self->r.contents = 0; - cs->secondDeadTime = 2; - } else { - self->client->ps.eFlags |= EF_MONSTER_EFFECT2; - self->s.effect2Time = level.time+200; - self->takedamage = qfalse; - self->r.contents = 0; - self->health = -1; - cs->secondDeadTime = 2; - } -*/ } else if ( !( contents & CONTENTS_NODROP ) ) { body_die( self, inflictor, attacker, damage, meansOfDeath ); //GibEntity( self, killer ); @@ -430,7 +399,6 @@ void AICast_AIDoor_Touch( gentity_t *ent, gentity_t *aidoor_trigger, gentity_t * } } - // TTimo: assignment used as truth value for ( trav = NULL; ( trav = G_Find( trav, FOFS( target ), aidoor_trigger->targetname ) ); ) { // make sure the marker is vacant trap_Trace( &tr, trav->r.currentOrigin, ent->r.mins, ent->r.maxs, trav->r.currentOrigin, ent->s.number, ent->clipmask ); diff --git a/MP/code/game/ai_cast_fight.c b/MP/code/game/ai_cast_fight.c index 5595093..f110541 100644 --- a/MP/code/game/ai_cast_fight.c +++ b/MP/code/game/ai_cast_fight.c @@ -1265,7 +1265,7 @@ AICast_CombatMove bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) { bot_state_t *bs; float dist; - vec3_t forward; //, up = {0, 0, 1}; + vec3_t forward; bot_moveresult_t moveresult; bot_goal_t goal; @@ -1273,7 +1273,6 @@ bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) { //get the enemy entity info memset( &moveresult, 0, sizeof( bot_moveresult_t ) ); - //initialize the movement state BotSetupForMovement( bs ); //direction towards the enemy @@ -1468,30 +1467,6 @@ qboolean AICast_AimAtEnemy( cast_state_t *cs ) { bestorigin[2] += 16; } } - // - // adjust accuracy with distance if upclose, so we don't start firing the wrong direction -/* - scale = 1; - switch (cs->bs->weaponnum) { - // these weapons don't do random offsetting - case WP_FLAMETHROWER: - break; - default: - { - float scale; - - if (dist < 256) - scale *= (dist / 256); - else - scale *= 1.0; - - bestorigin[0] += scale * 96 * sin((float)level.time/(200.0 + (40.0*((cs->entityNum+3)%4)))) * (1 - aim_accuracy); - bestorigin[1] += scale * 96 * cos((float)level.time/(220.0 + (36.0*((cs->entityNum+1)%5)))) * (1 - aim_accuracy); - bestorigin[2] += scale * 48 * sin((float)level.time/(210.0 + (32.0*((cs->entityNum+2)%6)))) * (1 - aim_accuracy); - } - break; - } -*/ // if the enemy is moving, they are harder to hit if ( dist > 256 ) { VectorMA( bestorigin, ( 0.3 + 0.7 * ( 1 - aim_accuracy ) ) * 0.4 * sin( (float)level.time / ( 500.0 + ( 100.0 * ( ( cs->entityNum + 3 ) % 4 ) ) ) ), g_entities[bs->enemy].client->ps.velocity, bestorigin ); @@ -1515,7 +1490,7 @@ qboolean AICast_CanMoveWhileFiringWeapon( int weaponnum ) { case WP_GARAND: case WP_SNIPERRIFLE: //----(SA) added case WP_SNOOPERSCOPE: //----(SA) added - case WP_FG42SCOPE: //----(SA) added + case WP_FG42SCOPE: //----(SA) added case WP_PANZERFAUST: case WP_ROCKET_LAUNCHER: return qfalse; @@ -1732,13 +1707,6 @@ void AICast_RecordWeaponFire( gentity_t *ent ) { range = AICast_GetWeaponSoundRange( cs->lastWeaponFiredWeaponNum ); AICast_AudibleEvent( cs->entityNum, cs->lastWeaponFiredPos, range ); - //AICast_SightSoundEvent( cs, range ); - /* - if (!cs->sightSoundTime || cs->sightSoundRange < range) { - cs->sightSoundRange = range; - cs->sightSoundTime = level.time; - } - */ if ( cs->bs ) { // real player's don't need to play AI sounds AIChar_AttackSound( cs ); @@ -1926,9 +1894,9 @@ int AICast_SafeMissileFire( gentity_t *ent, int duration, int enemyNum, vec3_t e rval = ( Distance( org, enemyPos ) < ent->splashRadius ) && AICast_VisibleFromPos( org, ent->s.number, enemyPos, enemyNum, qfalse ); if ( rval ) { // don't hurt ourselves - // disabled, don't worry about us, we can get out the way in time (we hope!) - //if (Distance( org, g_entities[selfNum].r.currentOrigin ) < ent->splashRadius*1.5) - // return -1; +// if ( Distance( org, g_entities[selfNum].r.currentOrigin ) < ent->splashRadius * 1.5 ) { +// return -1; +// } // make sure we don't injure a friendly for ( trav = g_entities; trav < g_entities + g_maxclients.integer; trav++ ) { if ( !trav->inuse ) { @@ -2181,8 +2149,6 @@ void AICast_AudibleEvent( int srcnum, vec3_t pos, float range ) { if ( !cs->bs ) { continue; } - //if (cs->aiState >= AISTATE_COMBAT) - // continue; if ( ent == sent ) { continue; } diff --git a/MP/code/game/ai_cast_func_attack.c b/MP/code/game/ai_cast_func_attack.c index 3088076..44f0ede 100644 --- a/MP/code/game/ai_cast_func_attack.c +++ b/MP/code/game/ai_cast_func_attack.c @@ -82,7 +82,6 @@ char *AIFunc_ZombieFlameAttack( cast_state_t *cs ) { ent->client->ps.legsTimer = 0; return AIFunc_DefaultStart( cs ); } - // if outside range, move closer if ( VectorDistance( cs->bs->origin, cs->vislist[cs->bs->enemy].visible_pos ) > ZOMBIE_FLAME_RADIUS ) { ent->s.onFireEnd = level.time + 1500; @@ -101,9 +100,7 @@ char *AIFunc_ZombieFlameAttack( cast_state_t *cs ) { return AIFunc_DefaultStart( cs ); } else { - ent->client->ps.torsoTimer = 400; - //ent->client->ps.legsTimer = 400; // draw the client-side effect ent->client->ps.eFlags |= EF_MONSTER_EFFECT3; @@ -114,8 +111,7 @@ char *AIFunc_ZombieFlameAttack( cast_state_t *cs ) { // look slightly downwards since animation is facing upwards slightly cs->bs->ideal_viewangles[PITCH] += 10; } - // - // + return NULL; } @@ -128,7 +124,7 @@ char *AIFunc_ZombieFlameAttackStart( cast_state_t *cs ) { // // dont turn cs->bs->ideal_viewangles[YAW] = cs->bs->viewangles[YAW]; - cs->bs->ideal_viewangles[PITCH] = -45; // look upwards + cs->bs->ideal_viewangles[PITCH] = -45; // look upwards // start the flame ent->s.onFireStart = level.time; ent->s.onFireEnd = level.time + ZOMBIE_FLAME_DURATION; @@ -174,16 +170,15 @@ char *AIFunc_ZombieAttack2( cast_state_t *cs ) { // ent = &g_entities[cs->entityNum]; // - lastZombieSpiritAttack = level.time; - // if ( cs->bs->enemy < 0 ) { return AIFunc_DefaultStart( cs ); } - // // if we can't see them anymore, abort immediately if ( cs->vislist[cs->bs->enemy].real_visible_timestamp != cs->vislist[cs->bs->enemy].real_update_timestamp ) { return AIFunc_DefaultStart( cs ); } + // + lastZombieSpiritAttack = level.time; // we are firing this weapon, so record it cs->weaponFireTimes[WP_MONSTER_ATTACK2] = level.time; // once an attack has started, only abort once the player leaves our view, or time runs out @@ -193,11 +188,6 @@ char *AIFunc_ZombieAttack2( cast_state_t *cs ) { return AIFunc_DefaultStart( cs ); } } else { - - // set torso to the correct animation - // TODO - //ent->client->ps.torsoTimer = 300; // leave enough time to cancel if we stop coming in here, but stay in the anim if we come back next thing - // draw the client-side effect ent->client->ps.eFlags |= EF_MONSTER_EFFECT; @@ -205,8 +195,7 @@ char *AIFunc_ZombieAttack2( cast_state_t *cs ) { VectorCopy( g_entities[cs->bs->enemy].client->ps.origin, ent->s.origin2 ); ent->s.origin2[2] += g_entities[cs->bs->enemy].client->ps.viewheight; } - // - // + return NULL; } @@ -281,7 +270,6 @@ char *AIFunc_LoperAttack1( cast_state_t *cs ) { // ready to inflict damage? if ( cs->thinkFuncChangeTime < level.time - LOPER_MELEE_DAMAGE_DELAY ) { // check for damage - // TTimo: assignment used as truth value if ( ( tr = CheckMeleeAttack( &g_entities[cs->entityNum], LOPER_MELEE_RANGE, qfalse ) ) ) { G_Damage( &g_entities[tr->entityNum], ent, ent, vec3_origin, tr->endpos, LOPER_MELEE_DAMAGE, 0, MOD_LOPER_HIT ); @@ -373,8 +361,6 @@ char *AIFunc_LoperAttack2( cast_state_t *cs ) { // LOPER_LEAP_DAMAGE, 0, MOD_LOPER_LEAP ); G_Sound( &g_entities[cs->entityNum], level.loperZapSound ); //cs->weaponFireTimes[WP_MONSTER_ATTACK2] = level.time; - // TODO: client-side visual effect - // TODO: throw them backwards (away from us) } } } @@ -701,7 +687,6 @@ char *AIFunc_StimSoldierAttack2( cast_state_t *cs ) { } char *AIFunc_StimSoldierAttack2Start( cast_state_t *cs ) { - // cs->weaponFireTimes[cs->bs->weaponnum] = level.time; // // face them @@ -724,9 +709,8 @@ char *AIFunc_BlackGuardAttack1( cast_state_t *cs ) { } char *AIFunc_BlackGuardAttack1Start( cast_state_t *cs ) { - + // cs->weaponFireTimes[cs->bs->weaponnum] = level.time; - #if 1 // TODO! G_Printf( "TODO: black guard kick attack\n" ); diff --git a/MP/code/game/ai_cast_funcs.c b/MP/code/game/ai_cast_funcs.c index bb666e3..c818f4c 100644 --- a/MP/code/game/ai_cast_funcs.c +++ b/MP/code/game/ai_cast_funcs.c @@ -252,10 +252,10 @@ bot_moveresult_t *AICast_MoveToPos( cast_state_t *cs, vec3_t pos, int entnum ) { // this must go last so we face the direction we avoid move AICast_Blocked( cs, &lmoveresult, qfalse, &goal ); -//G_Printf("MoveToPos: %i ms\n", -pretime + Sys_MilliSeconds() ); +// G_Printf("MoveToPos: %i ms\n", -pretime + Sys_MilliSeconds() ); -// debug, print movement info - if ( 0 ) { // (SA) added to hide the print + // debug, print movement info + if ( 0 ) { // (SA) added to hide the print bot_input_t bi; trap_EA_GetInput( cs->bs->client, (float) level.time / 1000, &bi ); @@ -349,7 +349,7 @@ char *AIFunc_Idle( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -1300,7 +1300,7 @@ char *AIFunc_ChaseGoalIdle( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -1489,7 +1489,6 @@ char *AIFunc_ChaseGoal( cast_state_t *cs ) { if ( simTest ) { // try walking straight to them VectorSubtract( followent->r.currentOrigin, cs->bs->origin, dir ); - VectorNormalize( dir ); if ( !ent->waterlevel ) { dir[2] = 0; } @@ -1540,7 +1539,7 @@ char *AIFunc_ChaseGoal( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -1654,6 +1653,7 @@ char *AIFunc_DoorMarker( cast_state_t *cs ) { } // go to it + // moveresult = AICast_MoveToPos( cs, followent->r.currentOrigin, followent->s.number ); // if we cant get there, forget it if ( moveresult && moveresult->failure ) { @@ -1743,8 +1743,7 @@ AIFunc_BattleRollStart() */ char *AIFunc_BattleRollStart( cast_state_t *cs, vec3_t vec ) { int duration; - // TTimo unused - //gclient_t *client = &level.clients[cs->entityNum]; +// gclient_t *client = &level.clients[cs->entityNum]; // // backup the current thinkfunc, so we can return to it when done cs->oldAifunc = cs->aifunc; @@ -1784,8 +1783,7 @@ AIFunc_BattleDiveStart() */ char *AIFunc_BattleDiveStart( cast_state_t *cs, vec3_t vec ) { int duration; - // TTimo unused - //gclient_t *client = &level.clients[cs->entityNum]; +// gclient_t *client = &level.clients[cs->entityNum]; // // backup the current thinkfunc, so we can return to it when done cs->oldAifunc = cs->aifunc; @@ -1849,8 +1847,7 @@ AIFunc_FlipMoveStart() */ char *AIFunc_FlipMoveStart( cast_state_t *cs, vec3_t vec ) { int duration; - // TTimo unused - //gclient_t *client = &level.clients[cs->entityNum]; +// gclient_t *client = &level.clients[cs->entityNum]; // // backup the current thinkfunc, so we can return to it when done cs->oldAifunc = cs->aifunc; @@ -1887,12 +1884,9 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) { bot_state_t *bs; vec3_t destorg; qboolean moved = qfalse; - // TTimo unused - //gclient_t *client = &level.clients[cs->entityNum]; char *rval; - // TTimo might be used uninitialized float dist = 0; - int i; + int i; // // do we need to avoid a danger? @@ -1939,11 +1933,11 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) { // // if we can see them, go back to an attack state AICast_ChooseWeapon( cs, qtrue ); // enable special weapons, if we cant get them, change back - if ( AICast_EntityVisible( cs, bs->enemy, qtrue ) // take into account reaction time + if ( AICast_EntityVisible( cs, bs->enemy, qtrue ) // take into account reaction time && AICast_CheckAttack( cs, bs->enemy, qfalse ) && cs->obstructingTime < level.time ) { if ( AICast_StopAndAttack( cs ) ) { - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( rval = AIFunc_BattleStart( cs ) ) ) { return rval; } @@ -1963,7 +1957,7 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) { } else if ( numEnemies == -2 ) { // inspection may be required char *retval; if ( cs->aiState < AISTATE_COMBAT ) { - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -2098,8 +2092,7 @@ char *AIFunc_BattleAmbush( cast_state_t *cs ) { qboolean shouldAttack, idleYaw; aicast_predictmove_t move; vec3_t dir; - // TTimo unused - //gclient_t *client = &level.clients[cs->entityNum]; +// gclient_t *client = &level.clients[cs->entityNum]; // // do we need to avoid a danger? if ( cs->dangerEntityValidTime >= level.time ) { @@ -2150,6 +2143,8 @@ char *AIFunc_BattleAmbush( cast_state_t *cs ) { // if we are out of ammo, we shouldn't bother trying to attack (and we should keep hiding) shouldAttack = qfalse; numEnemies = AICast_ScanForEnemies( cs, enemies ); + + // we shouldnt be interrupted from BattleAmbush mode, so try to handle these without interference if ( numEnemies == -1 ) { // query mode return NULL; } else if ( numEnemies == -2 ) { // inspection may be required @@ -3457,7 +3452,7 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { if ( AICast_CheckAttack( cs, bs->enemy, qfalse ) && cs->obstructingTime < level.time ) { // give us some time to throw the grenade, otherwise go back to attack state if ( ( cs->grenadeFlushEndTime > 0 && cs->grenadeFlushEndTime < level.time ) ) { - //G_Printf("aborting, enemy is attackable\n"); +// G_Printf( "aborting, enemy is attackable\n" ); return AIFunc_BattleStart( cs ); } else if ( cs->grenadeFlushEndTime < 0 ) { cs->grenadeFlushEndTime = level.time + 1500; @@ -3485,7 +3480,7 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -3711,7 +3706,7 @@ char *AIFunc_BattleMG42( cast_state_t *cs ) { } if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -3841,7 +3836,7 @@ char *AIFunc_InspectBody( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -3968,7 +3963,6 @@ char *AIFunc_GrenadeKick( cast_state_t *cs ) { int weapon; // !!! NOTE: the only way control should pass out of here, is by calling AIFunc_DefaultStart() - ent = &g_entities[cs->entityNum]; danger = &g_entities[cs->dangerEntity]; @@ -4177,7 +4171,7 @@ char *AIFunc_GrenadeKick( cast_state_t *cs ) { } if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo gcc: suggest parentheses around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -4265,41 +4259,8 @@ AIFunc_GrenadeKickStart() */ char *AIFunc_GrenadeKickStart( cast_state_t *cs ) { gentity_t *danger; - //gentity_t *trav; - //int numFriends, i; - - //G_Printf( "Excuse me, you dropped something\n" ); danger = &g_entities[cs->dangerEntity]; - // should we dive onto the grenade? - /* - if (danger->s.pos.trDelta[2] < 30) { - // count the number of friends near us - numFriends = 0; - for (i=0, trav=g_entities; i<aicast_maxclients; i++, trav++) { - if (!trav->inuse) - continue; - if (trav->aiInactive) - continue; - if (trav->health <= 0) - continue; - if (!AICast_SameTeam( cs, i )) - continue; - if (VectorDistance( cs->takeCoverPos, trav->r.currentOrigin ) > 200) - continue; - numFriends++; - } - // if there are enough friends around, and we have a clear path to the position, sacrifice ourself! - if (numFriends > 2) { - trace_t tr; - trap_Trace( &tr, cs->bs->origin, ent->r.mins, ent->r.maxs, cs->takeCoverPos, cs->entityNum, MASK_SOLID ); - if (tr.fraction == 1.0 && !tr.startsolid) { - return AIFunc_GrenadeDiveStart( cs ); - } - } - } - */ - // // we have decided to kick or throw the grenade away cs->grenadeKickWeapon = danger->s.weapon; cs->grenadeFlushFiring = qfalse; diff --git a/MP/code/game/ai_cast_script.c b/MP/code/game/ai_cast_script.c index aac0f91..4f2675b 100644 --- a/MP/code/game/ai_cast_script.c +++ b/MP/code/game/ai_cast_script.c @@ -67,9 +67,9 @@ qboolean AICast_ScriptAction_Attack( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_PlayAnim( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_ClearAnim( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_SetAmmo( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_SelectWeapon( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_GiveArmor( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_GiveArmor( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_GiveWeapon( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_GiveInventory( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_TakeWeapon( cast_state_t *cs, char *params ); @@ -105,8 +105,8 @@ qboolean AICast_ScriptAction_StateType( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_KnockBack( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Zoom( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Parachute( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_StartCam( cast_state_t *cs, char *params ); //----(SA) added -qboolean AICast_ScriptAction_StartCamBlack( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_StartCam( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_StartCamBlack( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_EntityScriptName( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_AIScriptName( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_SetHealth( cast_state_t *cs, char *params ); @@ -131,11 +131,11 @@ cast_script_stack_action_t scriptActions[] = {"wait", AICast_ScriptAction_Wait}, {"trigger", AICast_ScriptAction_Trigger}, {"setammo", AICast_ScriptAction_SetAmmo}, - {"setclip", AICast_ScriptAction_SetClip}, //----(SA) added + {"setclip", AICast_ScriptAction_SetClip}, //----(SA) added {"selectweapon", AICast_ScriptAction_SelectWeapon}, {"noattack", AICast_ScriptAction_NoAttack}, {"attack", AICast_ScriptAction_Attack}, - {"givearmor", AICast_ScriptAction_GiveArmor}, //----(SA) added + {"givearmor", AICast_ScriptAction_GiveArmor}, //----(SA) added {"giveinventory", AICast_ScriptAction_GiveInventory}, {"giveweapon", AICast_ScriptAction_GiveWeapon}, {"takeweapon", AICast_ScriptAction_TakeWeapon}, @@ -172,8 +172,8 @@ cast_script_stack_action_t scriptActions[] = {"knockback", AICast_ScriptAction_KnockBack}, {"zoom", AICast_ScriptAction_Zoom}, {"parachute", AICast_ScriptAction_Parachute}, - {"startcam", AICast_ScriptAction_StartCam}, //----(SA) added - {"startcamblack", AICast_ScriptAction_StartCamBlack}, //----(SA) added + {"startcam", AICast_ScriptAction_StartCam}, //----(SA) added + {"startcamblack", AICast_ScriptAction_StartCamBlack}, //----(SA) added {"entityscriptname",AICast_ScriptAction_EntityScriptName}, {"aiscriptname", AICast_ScriptAction_AIScriptName}, {"sethealth", AICast_ScriptAction_SetHealth}, @@ -196,7 +196,7 @@ cast_script_event_define_t scriptEvents[] = {"enemydead", AICast_EventMatch_StringEqual}, // our enemy is now dead {"trigger", AICast_EventMatch_StringEqual}, // something has triggered us (always followed by an identifier) {"pain", AICast_EventMatch_IntInRange}, // we've been hurt - {"death", 0}, // RIP + {"death", 0}, // RIP {"activate", AICast_EventMatch_StringEqual}, // "param" has just activated us {"enemysightcorpse",AICast_EventMatch_StringEqual}, // sighted the given enemy as a corpse, for the first time {"friendlysightcorpse", 0}, // sighted a friendly as a corpse for the first time @@ -512,7 +512,7 @@ void AICast_ScriptParse( cast_state_t *cs ) { numEventItems++; } else // skip this character completely { - // TTimo gcc: suggest parentheses around assignment used as truth value + while ( ( token = COM_Parse( &pScript ) ) ) { if ( !token[0] ) { diff --git a/MP/code/game/ai_cast_script_actions.c b/MP/code/game/ai_cast_script_actions.c index 2afc6b2..f6eca45 100644 --- a/MP/code/game/ai_cast_script_actions.c +++ b/MP/code/game/ai_cast_script_actions.c @@ -179,7 +179,7 @@ qboolean AICast_ScriptAction_GotoMarker( cast_state_t *cs, char *params ) { } // find the ai_marker with the given "targetname" - // TTimo gcc: suggest parentheses around assignment used as truth value + while ( ( ent = G_Find( ent, FOFS( classname ), "ai_marker" ) ) ) { if ( ent->targetname && !Q_strcasecmp( ent->targetname, token ) ) { @@ -489,7 +489,7 @@ qboolean AICast_ScriptAction_Wait( cast_state_t *cs, char *params ) { && ( cs->bs->enemy >= 0 ) ) { // if we can attack them, or they can't attack us, stay here - // TTimo gcc: suggest parentheses around && within || + if ( AICast_CheckAttack( cs, cs->bs->enemy, qfalse ) || ( !AICast_EntityVisible( AICast_GetCastState( cs->bs->enemy ), cs->entityNum, qfalse ) && !AICast_CheckAttack( AICast_GetCastState( cs->bs->enemy ), cs->entityNum, qfalse ) ) ) { @@ -887,11 +887,8 @@ qboolean AICast_ScriptAction_SetAmmo( cast_state_t *cs, char *params ) { //----(SA) end } else { - // G_Printf( "--SCRIPTER WARNING-- AI Scripting: setammo: unknown ammo \"%s\"", params ); return qfalse; // (SA) temp as scripts transition to new names -// G_Error( "AI Scripting: setammo: unknown ammo \"%s\"", params ); - } return qtrue; @@ -954,7 +951,6 @@ qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ) { } else { // G_Printf( "--SCRIPTER WARNING-- AI Scripting: setclip: unknown weapon \"%s\"", params ); return qfalse; // (SA) temp as scripts transition to new names -// G_Error( "AI Scripting: setclip: unknown weapon \"%s\"", params ); } return qtrue; @@ -998,11 +994,10 @@ qboolean AICast_ScriptAction_SelectWeapon( cast_state_t *cs, char *params ) { if ( !cs->aiCharacter ) { // only do this for player g_entities[cs->entityNum].client->ps.weaponTime = 500; // (SA) HACK: FIXME: TODO: delay to catch initial weapon reload - } } else { // G_Printf( "--SCRIPTER WARNING-- AI Scripting: selectweapon: unknown weapon \"%s\"", params ); - return qfalse; // (SA) temp as scripts transition to new names + return qfalse; // (SA) temp as scripts transition to new names // G_Error( "AI Scripting: selectweapon: unknown weapon \"%s\"", params ); } @@ -1024,8 +1019,6 @@ AICast_ScriptAction_GiveArmor */ qboolean AICast_ScriptAction_GiveArmor( cast_state_t *cs, char *params ) { int i; - // TTimo unused -// gentity_t *ent=&g_entities[cs->entityNum]; gitem_t *item = 0; for ( i = 1; bg_itemlist[i].classname; i++ ) { @@ -1203,8 +1196,6 @@ AICast_ScriptAction_GiveInventory */ qboolean AICast_ScriptAction_GiveInventory( cast_state_t *cs, char *params ) { int i; - // TTimo unused -// gentity_t *ent=&g_entities[cs->entityNum]; gitem_t *item = 0; for ( i = 1; bg_itemlist[i].classname; i++ ) { @@ -1269,6 +1260,8 @@ qboolean AICast_ScriptAction_Movetype( cast_state_t *cs, char *params ) { return qtrue; } + + /* ================= AICast_ScriptAction_AlertEntity @@ -1321,7 +1314,7 @@ AICast_ScriptAction_SaveGame ================= */ qboolean AICast_ScriptAction_SaveGame( cast_state_t *cs, char *params ) { - char *pString; + char *pString; //, *saveName; pString = params; if ( cs->bs ) { @@ -1330,10 +1323,11 @@ qboolean AICast_ScriptAction_SaveGame( cast_state_t *cs, char *params ) { //----(SA) check for parameter COM_ParseExt( &pString, qfalse ); -// if (!saveName[0]) +// if ( !saveName[0] ) { // G_SaveGame( NULL ); // save the default "current" savegame -// else +// } else { // G_SaveGame( saveName ); +// } //----(SA) end return qtrue; @@ -1960,9 +1954,9 @@ qboolean AICast_ScriptAction_ChangeLevel( cast_state_t *cs, char *params ) { trap_Cvar_Set( "g_missionStats", cmd ); } - // save persistant data if required + // save persistent data if required newstr = va( "%s", params ); - pch = strstr( newstr, " persistant" ); + pch = strstr( newstr, " persistent" ); if ( pch ) { pch = strstr( newstr, " " ); *pch = '\0'; @@ -2290,8 +2284,6 @@ qboolean AICast_ScriptAction_StartCam( cast_state_t *cs, char *params ) { qboolean AICast_ScriptAction_StartCamBlack( cast_state_t *cs, char *params ) { return ScriptStartCam( cs, params, qtrue ); } - - //----(SA) end /* diff --git a/MP/code/game/ai_cast_sight.c b/MP/code/game/ai_cast_sight.c index bc0d68d..319330b 100644 --- a/MP/code/game/ai_cast_sight.c +++ b/MP/code/game/ai_cast_sight.c @@ -229,13 +229,12 @@ qboolean AICast_CheckVisibility( gentity_t *srcent, gentity_t *destent ) { if ( destent->flags & FL_NOTARGET ) { return qfalse; } - + // viewer = srcent->s.number; ent = destent->s.number; // cs = AICast_GetCastState( viewer ); AICast_GetCastState( ent ); - // set the FOV fov = cs->attributes[FOV] * aiStateFovScales[cs->aiState]; if ( !fov ) { // assume it's a player, give them a generic fov @@ -552,8 +551,6 @@ void AICast_SightUpdate( int numchecks ) { int src = 0, dest = 0; gentity_t *srcent, *destent; cast_state_t *cs; - // TTimo unused -// static int lastNumUpdated; cast_visibility_t *vis; if ( numchecks < 5 ) { @@ -704,14 +701,16 @@ void AICast_SightUpdate( int numchecks ) { continue; } } + if ( vis->lastcheck_timestamp == level.time ) { continue; // already checked this frame - } + if ( vis->lastcheck_timestamp > level.time ) { continue; // let the loadgame settle down } + // if they are friends, only check very infrequently if ( AICast_SameTeam( cs, destent->s.number ) && ( vis->lastcheck_timestamp == vis->visible_timestamp ) && ( destent->health == vis->lastcheck_health ) ) { diff --git a/MP/code/game/ai_cast_think.c b/MP/code/game/ai_cast_think.c index 964128c..68c3c09 100644 --- a/MP/code/game/ai_cast_think.c +++ b/MP/code/game/ai_cast_think.c @@ -102,7 +102,7 @@ void AICast_ChangeViewAngles( cast_state_t *cs, float thinktime ) { bs = cs->bs; // - // restoire locked viewangles if required + // restore locked viewangles if required if ( cs->aiFlags & AIFL_VIEWLOCKED ) { VectorCopy( cs->viewlock_viewangles, bs->ideal_viewangles ); } @@ -701,7 +701,7 @@ void AICast_Think( int client, float thinktime ) { trap_EA_Crouch( cs->entityNum ); break; default: - break; // TTimo gcc: MS_DEFAULT MS_RUN not handled in switch + break; } } // @@ -772,14 +772,14 @@ void AICast_StartFrame( int time ) { //G_Printf( "AI startframe: %i\n", time ); if ( elapsed < 0 ) { - // elapsed = 0; +// elapsed = 0; lasttime = time; } // don't let the framerate drop below 10 - //if ( elapsed > 100 ) { - // elapsed = 100; - //} - //AICast_SightUpdate( (int)((float)SIGHT_PER_SEC * ((float)elapsed / 1000)) ); +// if ( elapsed > 100 ) { +// elapsed = 100; +// } +// AICast_SightUpdate( (int)((float)SIGHT_PER_SEC * ((float)elapsed / 1000)) ); // count = 0; castcount = 0; @@ -787,8 +787,6 @@ void AICast_StartFrame( int time ) { ent = g_entities; // //update the AI characters - // TTimo gcc: left-hand operand of comma expression has no effect - // initial line was: for (i = 0; i < aicast_maxclients, clCount < level.numPlayingClients; i++, ent++) for ( i = 0; ( i < aicast_maxclients ) && ( clCount < level.numPlayingClients ) ; i++, ent++ ) { if ( ent->client ) { @@ -851,7 +849,7 @@ void AICast_StartServerFrame( int time ) { static vmCvar_t aicast_disable; gentity_t *ent; cast_state_t *pcs; -// int oldLegsTimer; +// int oldLegsTimer; if ( trap_Cvar_VariableIntegerValue( "savegame_loading" ) ) { return; @@ -898,7 +896,7 @@ void AICast_StartServerFrame( int time ) { pcs = AICast_GetCastState( 0 ); -//G_Printf( "AI startserverframe: %i\n", time ); +// G_Printf( "AI startserverframe: %i\n", time ); if ( elapsed < 0 ) { elapsed = 0; @@ -919,8 +917,6 @@ void AICast_StartServerFrame( int time ) { ent = g_entities; // //update the AI characters - // TTimo gcc: left-hand operand of comma expression has no effect - // initial line: for (i = 0; i < aicast_maxclients, clCount < level.numPlayingClients; i++, ent++) for ( i = 0; ( i < aicast_maxclients ) && ( clCount < level.numPlayingClients ) ; i++, ent++ ) { if ( ent->client ) { @@ -989,8 +985,8 @@ void AICast_PredictMovement( cast_state_t *cs, int numframes, float frametime, a vec3_t end, startHitVec, thisHitVec, lastOrg, projPoint; qboolean checkReachMarker; -//int pretime = Sys_MilliSeconds(); -//G_Printf("PredictMovement: %f duration, %i frames\n", frametime, numframes ); +// int pretime = Sys_MilliSeconds(); +// G_Printf("PredictMovement: %f duration, %i frames\n", frametime, numframes ); VectorCopy( vec3_origin, startHitVec ); if ( cs->bs ) { @@ -1113,9 +1109,7 @@ qboolean AICast_GetAvoid( cast_state_t *cs, bot_goal_t *goal, vec3_t outpos, qbo usercmd_t ucmd; qboolean enemyVisible; float angleDiff; - // TTimo might be used uninitialized - int starttraveltime = 0; - int traveltime; + int starttraveltime = 0, traveltime; int invert; float inc; qboolean averting = qfalse; diff --git a/SP/code/game/ai_cast.c b/SP/code/game/ai_cast.c index e994ada..e0fc48a 100644 --- a/SP/code/game/ai_cast.c +++ b/SP/code/game/ai_cast.c @@ -119,7 +119,7 @@ void AICast_Printf( int type, const char *fmt, ... ) { va_list ap; va_start( ap, fmt ); - Q_vsnprintf (str, sizeof(str), fmt, ap); + Q_vsnprintf( str, sizeof( str ), fmt, ap ); va_end( ap ); switch ( type ) { @@ -506,9 +506,9 @@ void AICast_Init( void ) { /* RF, this is useless, since the AAS hasnt been loaded yet // try and load in the AAS now, so we can interact with it during spawning of entities i = 0; - trap_AAS_SetCurrentWorld(0); - while (!trap_AAS_Initialized() && (i++ < 10)) { - trap_BotLibStartFrame((float) level.time / 1000); + trap_AAS_SetCurrentWorld( 0 ); + while ( !trap_AAS_Initialized() && ( i++ < 10 ) ) { + trap_BotLibStartFrame( (float) level.time / 1000 ); } */ } @@ -726,7 +726,7 @@ AICast_CheckLoadGame */ void AICast_CheckLoadGame( void ) { char loading[4]; - gentity_t *ent = NULL; // TTimo: VC6 'may be used without having been init' + gentity_t *ent = NULL; qboolean ready; cast_state_t *pcs; @@ -740,17 +740,14 @@ void AICast_CheckLoadGame( void ) { trap_Cvar_VariableStringBuffer( "savegame_loading", loading, sizeof( loading ) ); -// reloading = qtrue; trap_Cvar_Set( "g_reloading", "1" ); if ( strlen( loading ) > 0 && atoi( loading ) != 0 ) { // screen should be black if we are at this stage trap_SetConfigstring( CS_SCREENFADE, va( "1 %i 1", level.time - 10 ) ); -// if (!reloading && atoi(loading) == 2) { if ( !( g_reloading.integer ) && atoi( loading ) == 2 ) { // (SA) hmm, this seems redundant when it sets it above... -// reloading = qtrue; // this gets reset at the Map_Restart() since the server unloads the game dll trap_Cvar_Set( "g_reloading", "1" ); } @@ -766,16 +763,16 @@ void AICast_CheckLoadGame( void ) { if ( ready ) { trap_Cvar_Set( "savegame_loading", "0" ); // in-case it aborts saveGamePending = qfalse; - G_LoadGame( NULL ); // always load the "current" savegame + G_LoadGame( NULL ); // always load the "current" savegame +// trap_Cvar_Set( "cg_norender", "0" ); // RF, spawn a thinker that will enable rendering after the client has had time to process the entities and setup the display - //trap_Cvar_Set( "cg_norender", "0" ); ent = G_Spawn(); ent->nextthink = level.time + 200; ent->think = AICast_EnableRenderingThink; // wait for the clients to return from faded screen - //trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); +// trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 750", level.time + 500 ) ); level.reloadPauseTime = level.time + 1100; @@ -797,7 +794,7 @@ void AICast_CheckLoadGame( void ) { // not loading a game, we must be in a new level, so look for some persistant data to read in, then save the game if ( ready ) { - G_LoadPersistant(); // make sure we save the game after we have brought across the items + G_LoadPersistant(); // make sure we save the game after we have brought across the items trap_Cvar_Set( "g_totalPlayTime", "0" ); // reset play time trap_Cvar_Set( "g_attempts", "0" ); @@ -806,24 +803,15 @@ void AICast_CheckLoadGame( void ) { pcs->lastLoadTime = 0; pcs->attempts = 0; - // RF, disabled, since the pregame menu turns this off after the button is pressed, this isn't - // required here - // RF, spawn a thinker that will enable rendering after the client has had time to process the entities and setup the display - //trap_Cvar_Set( "cg_norender", "0" ); - //ent = G_Spawn(); - //ent->nextthink = level.time + 200; - //ent->think = AICast_EnableRenderingThink; - saveGamePending = qfalse; // wait for the clients to return from faded screen -// trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); -// trap_SetConfigstring( CS_SCREENFADE, va("0 %i 750", level.time + 500) ); - // (SA) send a command that will be interpreted for both the screenfade and any other effects (music cues, pregame menu, etc) +// trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 1500", level.time + 500 ) ); +// trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 750", level.time + 500 ) ); -// briefing menu will handle transition, just set a cvar for it to check for drawing the 'continue' button + // (SA) send a command that will be interpreted for both the screenfade and any other effects (music cues, pregame menu, etc) + // briefing menu will handle transition, just set a cvar for it to check for drawing the 'continue' button trap_SendServerCommand( -1, "rockandroll\n" ); - level.reloadPauseTime = level.time + 1100; AICast_CastScriptThink(); @@ -948,13 +936,13 @@ void AICast_AgePlayTime( int entnum ) { if ( saveGamePending ) { return; } -// if (reloading) + if ( g_reloading.integer ) { return; } - // + if ( ( level.time - cs->lastLoadTime ) > 1000 ) { - if ( /*(level.time - cs->lastLoadTime) < 2000 &&*/ ( level.time - cs->lastLoadTime ) > 0 ) { + if ( /*( level.time - cs->lastLoadTime ) < 2000 &&*/ ( level.time - cs->lastLoadTime ) > 0 ) { cs->totalPlayTime += level.time - cs->lastLoadTime; trap_Cvar_Set( "g_totalPlayTime", va( "%i", cs->totalPlayTime ) ); } diff --git a/SP/code/game/ai_cast.h b/SP/code/game/ai_cast.h index c156133..a64a641 100644 --- a/SP/code/game/ai_cast.h +++ b/SP/code/game/ai_cast.h @@ -209,11 +209,11 @@ extern AICharacterDefaults_t aiDefaults[NUM_CHARACTERS]; // // structure defines // -#define AIVIS_ENEMY 1 -#define AIVIS_INSPECTED 2 // we have inspected them once already -#define AIVIS_INSPECT 4 // we should inspect them when we get a chance -#define AIVIS_PROCESS_SIGHTING 8 // so we know if we have or haven't processed the sighting since they were last seen -#define AIVIS_SIGHT_SCRIPT_CALLED 0x10 // set once sight script has been called.. only call once +#define AIVIS_ENEMY 1 +#define AIVIS_INSPECTED 2 // we have inspected them once already +#define AIVIS_INSPECT 4 // we should inspect them when we get a chance +#define AIVIS_PROCESS_SIGHTING 8 // so we know if we have or haven't processed the sighting since they were last seen +#define AIVIS_SIGHT_SCRIPT_CALLED 0x10 // set once sight script has been called.. only call once // // share range #define AIVIS_SHARE_RANGE 384 // if we are within this range of a friendly, share their vis info diff --git a/SP/code/game/ai_cast_characters.c b/SP/code/game/ai_cast_characters.c index 913169b..71c5822 100644 --- a/SP/code/game/ai_cast_characters.c +++ b/SP/code/game/ai_cast_characters.c @@ -26,13 +26,13 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ -/* - * name: ai_cast_characters.c - * - * desc: - * - * $Archive: /Wolf5/src/game/ai_cast_characters.c $ -*/ +//=========================================================================== +// +// Name: ai_cast_characters.c +// Function: Wolfenstein AI Characters +// Programmer: Ridah +// Tab Size: 4 (real tabs) +//=========================================================================== #include "g_local.h" #include "../botlib/botlib.h" //bot lib interface @@ -83,20 +83,20 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "infantryAttackPlayer", "infantryOrders", "infantryDeath", - "infantrySilentDeath", //----(SA) added - "infantryFlameDeath", //----(SA) added + "infantrySilentDeath", //----(SA) added + "infantryFlameDeath", //----(SA) added "infantryPain", - "infantryStay", // stay - you're told to stay put - "infantryFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "infantryOrdersDeny", // deny - refuse orders (doing something else) + "infantryStay", // stay - you're told to stay put + "infantryFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "infantryOrdersDeny", // deny - refuse orders (doing something else) }, - AITEAM_NAZI, // team - "infantryss/default", // default model/skin - {WP_MP40,WP_GRENADE_LAUNCHER}, // starting weapons - BBOX_SMALL, {32,48}, // bbox, crouch/stand height - AIFL_CATCH_GRENADE | AIFL_STAND_IDLE2, // flags - 0, 0, 0, // special attack routine - NULL, // looping sound + AITEAM_NAZI, // team + "infantryss/default", // default model/skin + {WP_MP40,WP_GRENADE_LAUNCHER}, // starting weapons + BBOX_SMALL, {32,48}, // bbox, crouch/stand height + AIFL_CATCH_GRENADE | AIFL_STAND_IDLE2, // flags + 0, 0, 0, // special attack routine + NULL, // looping sound AISTATE_RELAXED }, @@ -131,12 +131,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "americanAttackPlayer", "americanOrders", "americanDeath", - "americanSilentDeath", //----(SA) added - "americanFlameDeath", //----(SA) added + "americanSilentDeath", //----(SA) added + "americanFlameDeath", //----(SA) added "americanPain", - "americanStay", // stay - you're told to stay put - "americanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "americanOrdersDeny", // deny - refuse orders (doing something else) + "americanStay", // stay - you're told to stay put + "americanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "americanOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_ALLIES, "american/default", @@ -179,12 +179,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "zombieAttackPlayer", "zombieOrders", "zombieDeath", - "zombieSilentDeath", //----(SA) added - "zombieFlameDeath", //----(SA) added + "zombieSilentDeath", //----(SA) added + "zombieFlameDeath", //----(SA) added "zombiePain", - "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put - "sound/weapons/melee/fstmiss.wav", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "zombieOrdersDeny", // deny - refuse orders (doing something else) + "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put + "sound/weapons/melee/fstmiss.wav", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "zombieOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_MONSTER, "zombie/default", @@ -196,6 +196,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { AISTATE_ALERT }, +//----(SA) added //AICHAR_WARZOMBIE { "WarriorZombie", @@ -227,25 +228,26 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "warzombieAttackPlayer", "warzombieOrders", "warzombieDeath", - "warzombieSilentDeath", //----(SA) added - "warzombieFlameDeath", //----(SA) added + "warzombieSilentDeath", //----(SA) added + "warzombieFlameDeath", //----(SA) added "warzombiePain", //----(SA) changed per DK -// "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put +// "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put "sound/weapons/melee/warz_hit.wav", -// "sound/weapons/melee/fstmiss.wav", // follow - go with ordering player ("i'm with you" rather than "yes sir!") +// "sound/weapons/melee/fstmiss.wav", // follow - go with ordering player ("i'm with you" rather than "yes sir!") "sound/weapons/melee/warz_miss.wav", - "warzombieOrdersDeny", // deny - refuse orders (doing something else) + "warzombieOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_MONSTER, "warrior/crypt2", {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, - BBOX_SMALL, {10,48}, // very low defense position + BBOX_SMALL, {10,48}, // very low defense position AIFL_NO_RELOAD, AIFunc_WarriorZombieMeleeStart, /*AIFunc_WarriorZombieSightStart*/ 0, AIFunc_WarriorZombieDefenseStart, NULL, AISTATE_ALERT }, +//----(SA) end //AICHAR_VENOM { @@ -278,12 +280,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "venomAttackPlayer", "venomOrders", "venomDeath", - "venomSilentDeath", //----(SA) added - "venomFlameDeath", //----(SA) added + "venomSilentDeath", //----(SA) added + "venomFlameDeath", //----(SA) added "venomPain", - "venomStay", // stay - you're told to stay put - "venomFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "venomOrdersDeny", // deny - refuse orders (doing something else) + "venomStay", // stay - you're told to stay put + "venomFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "venomOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "venom/default", @@ -326,18 +328,18 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "loperAttackPlayer", "loperOrders", "loperDeath", - "loperSilentDeath", //----(SA) added - "loperFlameDeath", //----(SA) added + "loperSilentDeath", //----(SA) added + "loperFlameDeath", //----(SA) added "loperPain", - "loperAttack2Start", // stay - you're told to stay put - "loperAttackStart", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "loperHit1", // deny - refuse orders (doing something else) - "loperHit2", // misc1 + "loperAttack2Start", // stay - you're told to stay put + "loperAttackStart", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "loperHit1", // deny - refuse orders (doing something else) + "loperHit2", // misc1 }, AITEAM_MONSTER, "loper/default", { /*WP_MONSTER_ATTACK1,*/ WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, - BBOX_LARGE, {32,32}, // large is for wide characters + BBOX_LARGE, {32,32}, // large is for wide characters AIFL_NO_RELOAD, 0 /*AIFunc_LoperAttack1Start*/, AIFunc_LoperAttack2Start, AIFunc_LoperAttack3Start, "sound/world/electloop.wav", @@ -375,12 +377,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "eliteGuardAttackPlayer", "eliteGuardOrders", "eliteGuardDeath", - "eliteGuardSilentDeath", //----(SA) added - "eliteGuardFlameDeath", //----(SA) added + "eliteGuardSilentDeath", //----(SA) added + "eliteGuardFlameDeath", //----(SA) added "eliteGuardPain", - "eliteGuardStay", // stay - you're told to stay put - "eliteGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "eliteGuardOrdersDeny", // deny - refuse orders (doing something else) + "eliteGuardStay", // stay - you're told to stay put + "eliteGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "eliteGuardOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "eliteguard/default", @@ -423,16 +425,16 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierSilentDeath", //----(SA) added - "stimSoldeirFlameDeath", //----(SA) added + "stimSoldierSilentDeath", //----(SA) added + "stimSoldeirFlameDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "stim/default", - {WP_MONSTER_ATTACK2}, // TODO: dual machinegun attack + {WP_MONSTER_ATTACK2}, // TODO: dual machinegun attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, 0, AIFunc_StimSoldierAttack2Start, 0, @@ -471,16 +473,16 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierSilentDeath", //----(SA) added - "stimSoldierFlameDeath", //----(SA) added + "stimSoldierSilentDeath", //----(SA) added + "stimSoldierFlameDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "stim/default", - {WP_MP40, WP_MONSTER_ATTACK1}, // attack1 is leaping rocket attack + {WP_MP40, WP_MONSTER_ATTACK1}, // attack1 is leaping rocket attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, AIFunc_StimSoldierAttack1Start, 0, 0, @@ -519,16 +521,16 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "stimSoldierAttackPlayer", "stimSoldierOrders", "stimSoldierDeath", - "stimSoldierSilentDeath", //----(SA) added - "stimSoldierFlameDeath", //----(SA) added + "stimSoldierSilentDeath", //----(SA) added + "stimSoldierFlameDeath", //----(SA) added "stimSoldierPain", - "stimSoldierStay", // stay - you're told to stay put - "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) + "stimSoldierStay", // stay - you're told to stay put + "stimSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "stimSoldierOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "stim/default", - {WP_MP40, WP_TESLA}, // no monster_attack1, since that's only used for the jumping rocket attack + {WP_MP40, WP_TESLA}, // no monster_attack1, since that's only used for the jumping rocket attack BBOX_LARGE, {48,64}, AIFL_NO_RELOAD, AIFunc_StimSoldierAttack1Start, 0, 0, @@ -567,12 +569,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "superSoldierAttackPlayer", "superSoldierOrders", "superSoldierDeath", - "superSoldierSilentDeath", //----(SA) added - "superSoldierFlameDeath", //----(SA) added + "superSoldierSilentDeath", //----(SA) added + "superSoldierFlameDeath", //----(SA) added "superSoldierPain", - "superSoldierStay", // stay - you're told to stay put - "superSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "superSoldierOrdersDeny", // deny - refuse orders (doing something else) + "superSoldierStay", // stay - you're told to stay put + "superSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "superSoldierOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "supersoldier/default", @@ -615,17 +617,17 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "blackGuardAttackPlayer", "blackGuardOrders", "blackGuardDeath", - "blackGuardSilentDeath", //----(SA) added - "blackGuardFlameDeath", //----(SA) added + "blackGuardSilentDeath", //----(SA) added + "blackGuardFlameDeath", //----(SA) added "blackGuardPain", - "blackGuardStay", // stay - you're told to stay put - "blackGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "blackGuardOrdersDeny", // deny - refuse orders (doing something else) + "blackGuardStay", // stay - you're told to stay put + "blackGuardFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "blackGuardOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "blackguard/default", -// {WP_MP40, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick - {WP_FG42, WP_FG42SCOPE, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick +// {WP_MP40, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick + {WP_FG42, WP_FG42SCOPE, WP_GRENADE_LAUNCHER, WP_MONSTER_ATTACK1}, // attack1 is melee kick BBOX_SMALL, {32,48}, AIFL_CATCH_GRENADE | AIFL_FLIP_ANIM | AIFL_STAND_IDLE2, AIFunc_BlackGuardAttack1Start, 0, 0, @@ -664,12 +666,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "protoSoldierAttackPlayer", "protoSoldierOrders", "protoSoldierDeath", - "protoSoldierSilentDeath", //----(SA) added - "protoSoldierFlameDeath", //----(SA) added + "protoSoldierSilentDeath", //----(SA) added + "protoSoldierFlameDeath", //----(SA) added "protoSoldierPain", - "protoSoldierStay", // stay - you're told to stay put - "protoSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "protoSoldierOrdersDeny", // deny - refuse orders (doing something else) + "protoSoldierStay", // stay - you're told to stay put + "protoSoldierFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "protoSoldierOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "protosoldier/default", @@ -712,12 +714,12 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "frogmanAttackPlayer", "frogmanOrders", "frogmanDeath", - "frogmanSilentDeath", //----(SA) added - "frogmanFlameDeath", //----(SA) added + "frogmanSilentDeath", //----(SA) added + "frogmanFlameDeath", //----(SA) added "frogmanPain", - "frogmanStay", // stay - you're told to stay put - "frogmanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "frogmanOrdersDeny", // deny - refuse orders (doing something else) + "frogmanStay", // stay - you're told to stay put + "frogmanFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "frogmanOrdersDeny", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "frogman/default", @@ -760,19 +762,19 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "helgaAttackPlayer", "helgaOrders", "helgaDeath", - "helgaSilentDeath", //----(SA) added - "helgaFlameDeath", //----(SA) added + "helgaSilentDeath", //----(SA) added + "helgaFlameDeath", //----(SA) added "helgaAttackPlayer", - "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put - "helgaFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "helgaOrdersDeny", // deny - refuse orders (doing something else) + "sound/weapons/melee/fstatck.wav", // stay - you're told to stay put + "helgaFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "helgaOrdersDeny", // deny - refuse orders (doing something else) }, - AITEAM_MONSTER, // team - "beast/default", // default model/skin - {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2 /*,WP_MONSTER_ATTACK3*/}, // starting weapons - BBOX_LARGE, {90,90}, // bbox, crouch/stand height + AITEAM_MONSTER, // team + "beast/default", // default model/skin + {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2 /*,WP_MONSTER_ATTACK3*/}, // starting weapons + BBOX_LARGE, {90,90}, // bbox, crouch/stand height AIFL_WALKFORWARD | AIFL_NO_RELOAD, - AIFunc_Helga_MeleeStart, AIFunc_Helga_SpiritAttack_Start, 0, // special attack routine + AIFunc_Helga_MeleeStart, AIFunc_Helga_SpiritAttack_Start, 0, // special attack routine NULL, AISTATE_ALERT }, @@ -809,16 +811,16 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "heinrichOrders", "heinrichDeath", "heinrichSilentDeath", - "heinrichFlameDeath", //----(SA) added + "heinrichFlameDeath", //----(SA) added "heinrichPain", - "heinrichStay", // stay - you're told to stay put - "heinrichFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") - "heinrichStomp", // deny - refuse orders (doing something else) + "heinrichStay", // stay - you're told to stay put + "heinrichFollow", // follow - go with ordering player ("i'm with you" rather than "yes sir!") + "heinrichStomp", // deny - refuse orders (doing something else) }, AITEAM_NAZI, "heinrich/default", - {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, // attack3 is given to him by scripting - BBOX_LARGE, {72,72}, // (SA) height is not exact. just eyeballed. + {WP_MONSTER_ATTACK1,WP_MONSTER_ATTACK2,WP_MONSTER_ATTACK3}, // attack3 is given to him by scripting + BBOX_LARGE, {72,72}, // (SA) height is not exact. just eyeballed. AIFL_NO_FLAME_DAMAGE | AIFL_WALKFORWARD | AIFL_NO_RELOAD, AIFunc_Heinrich_MeleeStart, AIFunc_Heinrich_RaiseDeadStart, AIFunc_Heinrich_SpawnSpiritsStart, NULL, @@ -856,8 +858,8 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "partisanAttackPlayer", "partisanOrders", "partisanDeath", - "partisanSilentDeath", //----(SA) added - "partisanFlameDeath", //----(SA) added + "partisanSilentDeath", //----(SA) added + "partisanFlameDeath", //----(SA) added "partisanPain", "partisanStay", "partisanFollow", @@ -904,14 +906,14 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { "civilianAttackPlayer", "civilianOrders", "civilianDeath", - "civilianSilentDeath", //----(SA) added - "civilianFlameDeath", //----(SA) added + "civilianSilentDeath", //----(SA) added + "civilianFlameDeath", //----(SA) added "civilianPain", "civilianStay", "civilianFollow", "civilianOrdersDeny", }, - AITEAM_NEUTRAL, //----(SA) changed affiliation for DK + AITEAM_NEUTRAL, //----(SA) changed affiliation for DK "civilian/default", {0}, BBOX_SMALL, {32,48}, @@ -928,7 +930,7 @@ AICharacterDefaults_t aiDefaults[NUM_CHARACTERS] = { // Bounding boxes static vec3_t bbmins[2] = {{-18, -18, -24},{-32,-32,-24}}; static vec3_t bbmaxs[2] = {{ 18, 18, 48},{ 32, 32, 68}}; -//static float crouchMaxZ[2] = {32,48}; // same as player, will head be ok? // TTimo: unused +//static float crouchMaxZ[2] = {32,48}; // same as player, will head be ok? //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -1115,9 +1117,9 @@ void AIChar_Pain( gentity_t *ent, gentity_t *attacker, int damage, vec3_t point // HACK: if the attacker is using the flamethrower, don't do any special pain anim or sound // FIXME: we should pass in the MOD here, since they could have fired a grenade, then switched weapons - //if (attacker->s.weapon == WP_FLAMETHROWER) { - // return; - //} +// if ( attacker->s.weapon == WP_FLAMETHROWER ) { +// return; +// } if ( !Q_stricmp( attacker->classname, "props_statue" ) ) { damage = 99999; // try and force a stun @@ -1553,6 +1555,7 @@ void SP_ai_zombie( gentity_t *ent ) { } +//----(SA) added //---------------------------------------------------------------------------------------------------------------------------- /*QUAKED ai_warzombie (1 0.25 0) (-16 -16 -24) (16 16 64) TriggerSpawn NoRevive PortalZombie warrior zombie entity @@ -1569,7 +1572,7 @@ SP_ai_warzombie void SP_ai_warzombie( gentity_t *ent ) { AICast_DelayedSpawnCast( ent, AICHAR_WARZOMBIE ); } - +//----(SA) end //---------------------------------------------------------------------------------------------------------------------------- /*QUAKED ai_venom (1 0.25 0) (-16 -16 -24) (16 16 64) TriggerSpawn NoRevive diff --git a/SP/code/game/ai_cast_debug.c b/SP/code/game/ai_cast_debug.c index 938f8ff..ab5ea22 100644 --- a/SP/code/game/ai_cast_debug.c +++ b/SP/code/game/ai_cast_debug.c @@ -114,7 +114,7 @@ AICast_DBG_RouteTable_f */ void AICast_DBG_RouteTable_f( vec3_t org, char *param ) { static int srcarea = 0, dstarea = 0; -// extern botlib_export_t botlib; // TTimo: unused +// extern botlib_export_t botlib; if ( !param || strlen( param ) < 1 ) { trap_Print( "You must specify 'src', 'dest' or 'show'\n" ); diff --git a/SP/code/game/ai_cast_events.c b/SP/code/game/ai_cast_events.c index 7248363..c2ca814 100644 --- a/SP/code/game/ai_cast_events.c +++ b/SP/code/game/ai_cast_events.c @@ -222,19 +222,6 @@ void AICast_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // RF, changed this so Zombies always gib now GibEntity( self, killer ); nogib = qfalse; -/* - // Zombie has special exploding cloud effect - if (attacker != inflictor || attacker->s.weapon == WP_VENOM) - { - GibEntity( self, killer ); - nogib = qfalse; - } else { - // Zombie will decompose upon dying - self->client->ps.eFlags |= EF_MONSTER_EFFECT2; - self->s.effect2Time = level.time+200; - self->health = -1; - } -*/ self->takedamage = qfalse; self->r.contents = 0; cs->secondDeadTime = 2; @@ -452,7 +439,6 @@ void AICast_AIDoor_Touch( gentity_t *ent, gentity_t *aidoor_trigger, gentity_t * } } - // TTimo: gcc: suggest () around assignment used as truth value for ( trav = NULL; ( trav = G_Find( trav, FOFS( target ), aidoor_trigger->targetname ) ); ) { // make sure the marker is vacant trap_Trace( &tr, trav->r.currentOrigin, ent->r.mins, ent->r.maxs, trav->r.currentOrigin, ent->s.number, ent->clipmask ); diff --git a/SP/code/game/ai_cast_fight.c b/SP/code/game/ai_cast_fight.c index cb2bcc3..40a77d3 100644 --- a/SP/code/game/ai_cast_fight.c +++ b/SP/code/game/ai_cast_fight.c @@ -1357,7 +1357,7 @@ AICast_CombatMove bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) { bot_state_t *bs; float dist; - vec3_t forward; //, backward; + vec3_t forward; bot_moveresult_t moveresult; bot_goal_t goal; @@ -1371,7 +1371,6 @@ bot_moveresult_t AICast_CombatMove( cast_state_t *cs, int tfl ) { VectorSubtract( cs->vislist[cs->enemyNum].visible_pos, bs->origin, forward ); //the distance towards the enemy VectorNormalize( forward ); - //VectorNegate( forward, backward ); // // do we have somewhere we are trying to get to? if ( cs->combatGoalTime > level.time ) { @@ -1576,7 +1575,7 @@ qboolean AICast_CanMoveWhileFiringWeapon( int weaponnum ) { case WP_GARAND: case WP_SNIPERRIFLE: //----(SA) added case WP_SNOOPERSCOPE: //----(SA) added - //case WP_FG42SCOPE: //----(SA) added +// case WP_FG42SCOPE: //----(SA) added case WP_PANZERFAUST: return qfalse; default: diff --git a/SP/code/game/ai_cast_func_attack.c b/SP/code/game/ai_cast_func_attack.c index 8a19d71..1017177 100644 --- a/SP/code/game/ai_cast_func_attack.c +++ b/SP/code/game/ai_cast_func_attack.c @@ -122,7 +122,7 @@ char *AIFunc_ZombieFlameAttackStart( cast_state_t *cs ) { // // dont turn cs->ideal_viewangles[YAW] = cs->viewangles[YAW]; - //cs->ideal_viewangles[PITCH] = -45; // look upwards +// cs->ideal_viewangles[PITCH] = -45; // look upwards // start the flame ent->s.onFireStart = level.time; ent->s.onFireEnd = level.time + ZOMBIE_FLAME_DURATION; @@ -167,8 +167,9 @@ int lastZombieSpiritAttack; char *AIFunc_ZombieAttack2( cast_state_t *cs ) { gentity_t *ent; + // ent = &g_entities[cs->entityNum]; - + // if ( cs->enemyNum < 0 ) { return AIFunc_DefaultStart( cs ); } @@ -383,7 +384,6 @@ char *AIFunc_LoperAttack1( cast_state_t *cs ) { anim = ( ent->client->ps.legsAnim & ~ANIM_TOGGLEBIT ) - BG_AnimationIndexForString( "legs_extra", cs->entityNum ); if ( cs->thinkFuncChangeTime < level.time - loperHitTimes[anim] ) { // check for damage - // TTimo: gcc: suggests () around assignment used as truth value if ( ( tr = CheckMeleeAttack( &g_entities[cs->entityNum], LOPER_MELEE_RANGE, qfalse ) ) ) { G_Damage( &g_entities[tr->entityNum], ent, ent, vec3_origin, tr->endpos, LOPER_MELEE_DAMAGE, 0, MOD_LOPER_HIT ); diff --git a/SP/code/game/ai_cast_func_boss1.c b/SP/code/game/ai_cast_func_boss1.c index e435986..d092026 100644 --- a/SP/code/game/ai_cast_func_boss1.c +++ b/SP/code/game/ai_cast_func_boss1.c @@ -46,9 +46,6 @@ If you have questions concerning this license or the applicable additional terms #include "ai_cast.h" -// TTimo: unused -//static vec3_t forward, right, up; - //================================================================================= // // Helga, the first boss diff --git a/SP/code/game/ai_cast_funcs.c b/SP/code/game/ai_cast_funcs.c index 5cf47af..221c06b 100644 --- a/SP/code/game/ai_cast_funcs.c +++ b/SP/code/game/ai_cast_funcs.c @@ -271,7 +271,6 @@ bot_moveresult_t *AICast_MoveToPos( cast_state_t *cs, vec3_t pos, int entnum ) { } } - } else { // manual routing towards markers VectorSubtract( pos, cs->bs->origin, dir ); @@ -289,17 +288,18 @@ bot_moveresult_t *AICast_MoveToPos( cast_state_t *cs, vec3_t pos, int entnum ) { // this must go last so we face the direction we avoid move AICast_Blocked( cs, &lmoveresult, qfalse, &goal ); -//G_Printf("MoveToPos: %i ms\n", -pretime + Sys_MilliSeconds() ); +// G_Printf("MoveToPos: %i ms\n", -pretime + Sys_MilliSeconds() ); + /* -// debug, print movement info -if(0) // (SA) added to hide the print -{ -bot_input_t bi; + // debug, print movement info + if ( 0 ) { // (SA) added to hide the print + bot_input_t bi; -trap_EA_GetInput(cs->bs->client, (float) level.time / 1000, &bi); -G_Printf("spd: %i\n", (int)bi.speed ); -} + trap_EA_GetInput( cs->bs->client, (float) level.time / 1000, &bi ); + G_Printf( "spd: %i\n", (int)bi.speed ); + } */ + return ( moveresult = &lmoveresult ); } @@ -494,7 +494,7 @@ char *AIFunc_Idle( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -769,7 +769,7 @@ char *AIFunc_InspectFriendly( cast_state_t *cs ) { if ( !ent->waterlevel ) { dir[2] = 0; } - //trap_EA_Move(cs->entityNum, dir, 400); +// trap_EA_Move( cs->entityNum, dir, 400 ); trap_EA_GetInput( cs->entityNum, (float) level.time / 1000, &bi ); VectorCopy( dir, bi.dir ); bi.speed = 400; @@ -987,6 +987,7 @@ char *AIFunc_InspectBulletImpact( cast_state_t *cs ) { gentity_t *ent; vec3_t v1; // + // ent = &g_entities[cs->entityNum]; // cs->bulletImpactIgnoreTime = level.time + 800; @@ -1226,7 +1227,7 @@ char *AIFunc_InspectAudibleEvent( cast_state_t *cs ) { if ( !ent->waterlevel ) { dir[2] = 0; } - //trap_EA_Move(cs->entityNum, dir, 400); +// trap_EA_Move( cs->entityNum, dir, 400 ); trap_EA_GetInput( cs->entityNum, (float) level.time / 1000, &bi ); VectorCopy( dir, bi.dir ); bi.speed = 400; @@ -1240,7 +1241,7 @@ char *AIFunc_InspectAudibleEvent( cast_state_t *cs ) { cs->ideal_viewangles[2] *= 0.5; moved = qtrue; } else { // clear movement - //trap_EA_Move(cs->entityNum, dir, 0); +// trap_EA_Move(cs->entityNum, dir, 0); } // G_FreeEntity( gent ); @@ -1252,7 +1253,6 @@ char *AIFunc_InspectAudibleEvent( cast_state_t *cs ) { moveresult = AICast_MoveToPos( cs, destorg, -1 ); // if we cant get there, do something else if ( moveresult && moveresult->failure ) { - // if we can get a visible target, then face it if ( trap_AAS_GetRouteFirstVisPos( cs->audibleEventOrg, cs->bs->origin, cs->travelflags, destorg ) ) { cs->aiFlags |= AIFL_MISCFLAG2; @@ -1512,7 +1512,7 @@ char *AIFunc_ChaseGoalIdle( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -1763,7 +1763,7 @@ char *AIFunc_ChaseGoal( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -2149,11 +2149,11 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) { // // if we can see them, go back to an attack state AICast_ChooseWeapon( cs, qtrue ); // enable special weapons, if we cant get them, change back - if ( AICast_EntityVisible( cs, cs->enemyNum, qtrue ) // take into account reaction time + if ( AICast_EntityVisible( cs, cs->enemyNum, qtrue ) // take into account reaction time && AICast_CheckAttack( cs, cs->enemyNum, qfalse ) && cs->obstructingTime < level.time ) { if ( AICast_StopAndAttack( cs ) ) { - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( rval = AIFunc_BattleStart( cs ) ) ) { return rval; } @@ -2173,7 +2173,7 @@ char *AIFunc_BattleHunt( cast_state_t *cs ) { } else if ( numEnemies == -2 ) { // inspection may be required char *retval; if ( cs->aiState < AISTATE_COMBAT ) { - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -2762,14 +2762,14 @@ char *AIFunc_BattleChase( cast_state_t *cs ) { // // if we only recently saw them, face them // - /* RF: disabled 9/19/01, characters like boss2 supersoldier are forced to walk backwards and look wierd +/* RF: disabled 9/19/01, characters like boss2 supersoldier are forced to walk backwards and look wierd if (cs->vislist[cs->enemyNum].visible_timestamp > level.time - 3000) { AICast_AimAtEnemy( cs ); // be ready for an attack if they become visible again //if (cs->attributes[ATTACK_CROUCH] > 0.1) { // crouching for combat // cs->attackcrouch_time = level.time + 1000; //} } - */ +*/ // // Lob a Grenade? @@ -2842,7 +2842,7 @@ char *AIFunc_BattleChase( cast_state_t *cs ) { if ( !ent->waterlevel ) { dir[2] = 0; } - //trap_EA_Move(cs->entityNum, dir, 400); + //trap_EA_Move( cs->entityNum, dir, 400 ); trap_EA_GetInput( cs->entityNum, (float) level.time / 1000, &bi ); VectorCopy( dir, bi.dir ); bi.speed = 400; @@ -3630,8 +3630,9 @@ AIFunc_BattleTakeCoverStart() char *AIFunc_BattleTakeCoverStart( cast_state_t *cs ) { // debugging #ifdef DEBUG -// if (cs->attributes[AGGRESSION] >= 1.0) +// if ( cs->attributes[AGGRESSION] >= 1.0 ) { // AICast_Printf( 0, "AI taking cover with full aggression!\n" ); +// } #endif if ( !AICast_CanMoveWhileFiringWeapon( cs->weaponNum ) ) { @@ -3667,7 +3668,7 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { vec3_t destorg, endPos; qboolean moved = qfalse; int hitclient; - //qboolean attacked = qfalse; // TTimo: unused +// qboolean attacked = qfalse; float dist, oldyaw; int grenadeType; @@ -3785,15 +3786,15 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { // if we can see them, go back to an attack state after some time if ( AICast_CheckAttack( cs, cs->enemyNum, qfalse ) && cs->obstructingTime < level.time ) { // give us some time to throw the grenade, otherwise go back to attack state - //if ((cs->grenadeFlushEndTime > 0 && cs->grenadeFlushEndTime < level.time)) { - //G_Printf("aborting, enemy is attackable\n"); - return AIFunc_BattleStart( cs ); - //} else if (cs->grenadeFlushEndTime < 0) { - // cs->grenadeFlushEndTime = level.time + 1500; - //} +// if ( ( cs->grenadeFlushEndTime > 0 && cs->grenadeFlushEndTime < level.time ) ) { +// G_Printf( "aborting, enemy is attackable\n" ); + return AIFunc_BattleStart( cs ); +// } else if ( cs->grenadeFlushEndTime < 0 ) { +// cs->grenadeFlushEndTime = level.time + 1500; +// } //attack the enemy if possible - //AICast_ProcessAttack( cs ); - //attacked = qtrue; +// AICast_ProcessAttack( cs ); +// attacked = qtrue; } else { // not visible, go to their previously visible position if ( !cs->vislist[cs->enemyNum].visible_timestamp || Distance( bs->origin, cs->vislist[cs->enemyNum].real_visible_pos ) < 16 ) { @@ -3814,7 +3815,7 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -3870,7 +3871,7 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { if ( !ent->waterlevel ) { dir[2] = 0; } - //trap_EA_Move(cs->entityNum, dir, 400); +// trap_EA_Move( cs->entityNum, dir, 400 ); trap_EA_GetInput( cs->entityNum, (float) level.time / 1000, &bi ); VectorCopy( dir, bi.dir ); bi.speed = 400; @@ -3909,8 +3910,9 @@ char *AIFunc_GrenadeFlush( cast_state_t *cs ) { hitclient = AICast_SafeMissileFire( grenade, grenade->nextthink - level.time, cs->enemyNum, destorg, cs->entityNum, endPos ); // kill the grenade G_FreeEntity( grenade ); - //if (!attacked) - // cs->weaponNum = grenadeType; // select grenade launcher +// if ( !attacked ) { +// cs->weaponNum = grenadeType; // select grenade launcher +// } // set our angles for the next frame oldyaw = cs->ideal_viewangles[YAW]; AICast_AimAtEnemy( cs ); @@ -3992,7 +3994,7 @@ AIFunc_BattleMG42() char *AIFunc_BattleMG42( cast_state_t *cs ) { bot_state_t *bs; gentity_t *mg42, *ent; - vec3_t angles, vec; //, bestangles; + vec3_t angles, vec; qboolean unmount = qfalse; mg42 = &g_entities[cs->mountedEntity]; @@ -4034,7 +4036,6 @@ char *AIFunc_BattleMG42( cast_state_t *cs ) { VectorNormalize( vec ); vectoangles( vec, angles ); angles[PITCH] = AngleNormalize180( angles[PITCH] ); -// VectorCopy( angles, bestangles ); } // check for enemy outside harc @@ -4074,13 +4075,11 @@ char *AIFunc_BattleMG42( cast_state_t *cs ) { unmount = qfalse; // if ( AICast_CheckAttack( cs, enemies[i], qfalse ) ) { - //VectorCopy( angles, bestangles ); cs->enemyNum = enemies[i]; shouldAttack = qtrue; break; } else if ( AICast_CheckAttack( cs, enemies[i], qtrue ) ) { // keep firing at anything behind solids, in case they find a position where they can shoot us, but our checkattack() doesn't find a clear shot - //VectorCopy( angles, bestangles ); cs->enemyNum = enemies[i]; shouldAttack = qtrue; } @@ -4186,7 +4185,7 @@ char *AIFunc_InspectBody( cast_state_t *cs ) { return NULL; } else if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -4519,7 +4518,7 @@ char *AIFunc_GrenadeKick( cast_state_t *cs ) { } if ( numEnemies == -2 ) { // inspection may be required char *retval; - // TTimo: gcc: suggest () around assignment used as truth value + if ( ( retval = AIFunc_InspectFriendlyStart( cs, enemies[0] ) ) ) { return retval; } @@ -4614,7 +4613,6 @@ AIFunc_Battle() */ char *AIFunc_Battle( cast_state_t *cs ) { bot_moveresult_t moveresult; - //int tfl; bot_state_t *bs; gentity_t *ent, *enemy; @@ -4767,15 +4765,6 @@ char *AIFunc_Battle( cast_state_t *cs ) { // // setup for the fight // - //tfl = cs->travelflags; - //if in lava or slime the bot should be able to get out - //if ( BotInLava( bs ) ) { - // tfl |= TFL_LAVA; - //} - //if ( BotInSlime( bs ) ) { - // tfl |= TFL_SLIME; - //} - // /* moveresult = AICast_CombatMove(cs, tfl); //if the movement failed diff --git a/SP/code/game/ai_cast_script.c b/SP/code/game/ai_cast_script.c index 9548e45..d468d1b 100644 --- a/SP/code/game/ai_cast_script.c +++ b/SP/code/game/ai_cast_script.c @@ -59,7 +59,7 @@ qboolean AICast_ScriptAction_GotoCast( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_WalkToCast( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_CrouchToCast( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Wait( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_AbortIfLoadgame( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_AbortIfLoadgame( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_Trigger( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_FollowCast( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_PlaySound( cast_state_t *cs, char *params ); @@ -68,11 +68,11 @@ qboolean AICast_ScriptAction_Attack( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_PlayAnim( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_ClearAnim( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_SetAmmo( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_SelectWeapon( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_GiveArmor( cast_state_t *cs, char *params ); //----(SA) added -qboolean AICast_ScriptAction_SetArmor( cast_state_t *cs, char *params ); //----(SA) added -qboolean AICast_ScriptAction_SuggestWeapon( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_GiveArmor( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_SetArmor( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_SuggestWeapon( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_GiveWeapon( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_GiveInventory( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_TakeWeapon( cast_state_t *cs, char *params ); @@ -94,8 +94,8 @@ qboolean AICast_ScriptAction_Mount( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Unmount( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_SavePersistant( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_ChangeLevel( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_EndGame( cast_state_t *cs, char *params ); //----(SA) added -qboolean AICast_ScriptAction_Teleport( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_EndGame( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_Teleport( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_FoundSecret( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_NoSight( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Sight( cast_state_t *cs, char *params ); @@ -111,9 +111,9 @@ qboolean AICast_ScriptAction_StateType( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_KnockBack( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Zoom( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Parachute( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_Cigarette( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_Cigarette( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_StartCam( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_StopCam( cast_state_t *cs, char *params ); //----(SA) added +qboolean AICast_ScriptAction_StopCam( cast_state_t *cs, char *params ); //----(SA) added qboolean AICast_ScriptAction_StartCamBlack( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_EntityScriptName( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_AIScriptName( cast_state_t *cs, char *params ); @@ -121,11 +121,11 @@ qboolean AICast_ScriptAction_SetHealth( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_NoTarget( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_Cvar( cast_state_t *cs, char *params ); -qboolean AICast_ScriptAction_MusicStart( cast_state_t *cs, char *params ); //----(SA) -qboolean AICast_ScriptAction_MusicPlay( cast_state_t *cs, char *params ); //----(SA) -qboolean AICast_ScriptAction_MusicStop( cast_state_t *cs, char *params ); //----(SA) -qboolean AICast_ScriptAction_MusicFade( cast_state_t *cs, char *params ); //----(SA) -qboolean AICast_ScriptAction_MusicQueue( cast_state_t *cs, char *params ); //----(SA) +qboolean AICast_ScriptAction_MusicStart( cast_state_t *cs, char *params ); //----(SA) +qboolean AICast_ScriptAction_MusicPlay( cast_state_t *cs, char *params ); //----(SA) +qboolean AICast_ScriptAction_MusicStop( cast_state_t *cs, char *params ); //----(SA) +qboolean AICast_ScriptAction_MusicFade( cast_state_t *cs, char *params ); //----(SA) +qboolean AICast_ScriptAction_MusicQueue( cast_state_t *cs, char *params ); //----(SA) qboolean AICast_ScriptAction_ExplicitRouting( cast_state_t *cs, char *params ); qboolean AICast_ScriptAction_LockPlayer( cast_state_t *cs, char *params ); @@ -149,16 +149,16 @@ cast_script_stack_action_t scriptActions[] = {"playanim", AICast_ScriptAction_PlayAnim}, {"clearanim", AICast_ScriptAction_ClearAnim}, {"wait", AICast_ScriptAction_Wait}, - {"abort_if_loadgame",AICast_ScriptAction_AbortIfLoadgame}, //----(SA) added + {"abort_if_loadgame",AICast_ScriptAction_AbortIfLoadgame}, //----(SA) added {"trigger", AICast_ScriptAction_Trigger}, {"setammo", AICast_ScriptAction_SetAmmo}, - {"setclip", AICast_ScriptAction_SetClip}, //----(SA) added + {"setclip", AICast_ScriptAction_SetClip}, //----(SA) added {"selectweapon", AICast_ScriptAction_SelectWeapon}, {"noattack", AICast_ScriptAction_NoAttack}, - {"suggestweapon", AICast_ScriptAction_SuggestWeapon}, //----(SA) added + {"suggestweapon", AICast_ScriptAction_SuggestWeapon}, //----(SA) added {"attack", AICast_ScriptAction_Attack}, - {"givearmor", AICast_ScriptAction_GiveArmor}, //----(SA) added - {"setarmor", AICast_ScriptAction_SetArmor}, //----(SA) added + {"givearmor", AICast_ScriptAction_GiveArmor}, //----(SA) added + {"setarmor", AICast_ScriptAction_SetArmor}, //----(SA) added {"giveinventory", AICast_ScriptAction_GiveInventory}, {"giveweapon", AICast_ScriptAction_GiveWeapon}, {"takeweapon", AICast_ScriptAction_TakeWeapon}, @@ -171,7 +171,7 @@ cast_script_stack_action_t scriptActions[] = {"spawncast", AICast_ScriptAction_SpawnCast}, {"missionfailed", AICast_ScriptAction_MissionFailed}, {"missionsuccess", AICast_ScriptAction_ObjectiveMet}, - {"objectivemet", AICast_ScriptAction_ObjectiveMet}, // dupe of missionsuccess so scripts can changeover to a more logical name + {"objectivemet", AICast_ScriptAction_ObjectiveMet}, // dupe of missionsuccess so scripts can changeover to a more logical name {"objectivesneeded",AICast_ScriptAction_ObjectivesNeeded}, {"noaidamage", AICast_ScriptAction_NoAIDamage}, {"print", AICast_ScriptAction_Print}, @@ -181,8 +181,8 @@ cast_script_stack_action_t scriptActions[] = {"unmount", AICast_ScriptAction_Unmount}, {"savepersistant", AICast_ScriptAction_SavePersistant}, {"changelevel", AICast_ScriptAction_ChangeLevel}, - {"endgame", AICast_ScriptAction_EndGame}, //----(SA) added - {"teleport", AICast_ScriptAction_Teleport}, //----(SA) added + {"endgame", AICast_ScriptAction_EndGame}, //----(SA) added + {"teleport", AICast_ScriptAction_Teleport}, //----(SA) added {"foundsecret", AICast_ScriptAction_FoundSecret}, {"nosight", AICast_ScriptAction_NoSight}, {"sight", AICast_ScriptAction_Sight}, @@ -199,10 +199,10 @@ cast_script_stack_action_t scriptActions[] = {"knockback", AICast_ScriptAction_KnockBack}, {"zoom", AICast_ScriptAction_Zoom}, {"parachute", AICast_ScriptAction_Parachute}, - {"cigarette", AICast_ScriptAction_Cigarette}, //----(SA) added + {"cigarette", AICast_ScriptAction_Cigarette}, //----(SA) added {"startcam", AICast_ScriptAction_StartCam}, {"startcamblack", AICast_ScriptAction_StartCamBlack}, - {"stopcam", AICast_ScriptAction_StopCam}, //----(SA) added + {"stopcam", AICast_ScriptAction_StopCam}, //----(SA) added {"entityscriptname",AICast_ScriptAction_EntityScriptName}, {"aiscriptname", AICast_ScriptAction_AIScriptName}, {"sethealth", AICast_ScriptAction_SetHealth}, @@ -210,11 +210,11 @@ cast_script_stack_action_t scriptActions[] = {"cvar", AICast_ScriptAction_Cvar}, //----(SA) added some music interface - {"mu_start", AICast_ScriptAction_MusicStart}, // (char *new_music, int time) // time to fade in - {"mu_play", AICast_ScriptAction_MusicPlay}, // (char *new_music) - {"mu_stop", AICast_ScriptAction_MusicStop}, // (int time) // time to fadeout - {"mu_fade", AICast_ScriptAction_MusicFade}, // (float target_volume, int time) // time to fade to target - {"mu_queue", AICast_ScriptAction_MusicQueue}, // (char *new_music) // music that will start when previous fades to 0 + {"mu_start", AICast_ScriptAction_MusicStart}, // (char *new_music, int time) // time to fade in + {"mu_play", AICast_ScriptAction_MusicPlay}, // (char *new_music) + {"mu_stop", AICast_ScriptAction_MusicStop}, // (int time) // time to fadeout + {"mu_fade", AICast_ScriptAction_MusicFade}, // (float target_volume, int time) // time to fade to target + {"mu_queue", AICast_ScriptAction_MusicQueue}, // (char *new_music) // music that will start when previous fades to 0 //----(SA) end {"explicit_routing", AICast_ScriptAction_ExplicitRouting}, @@ -240,7 +240,7 @@ cast_script_event_define_t scriptEvents[] = {"enemydead", AICast_EventMatch_StringEqual}, // our enemy is now dead {"trigger", AICast_EventMatch_StringEqual}, // something has triggered us (always followed by an identifier) {"pain", AICast_EventMatch_IntInRange}, // we've been hurt - {"death", AICast_EventMatch_StringEqual}, // RIP + {"death", AICast_EventMatch_StringEqual}, // RIP {"activate", AICast_EventMatch_StringEqual}, // "param" has just activated us {"enemysightcorpse",AICast_EventMatch_StringEqual}, // sighted the given enemy as a corpse, for the first time {"friendlysightcorpse", 0}, // sighted a friendly as a corpse for the first time @@ -319,8 +319,6 @@ int AICast_EventForString( char *string ) { return -1; } -//----(SA) added - /* =============== AICast_ActionForString @@ -585,7 +583,7 @@ void AICast_ScriptParse( cast_state_t *cs ) { numEventItems++; } else // skip this character completely { - // TTimo: gcc: suggest () around assignment used as truth value + while ( ( token = COM_Parse( &pScript ) ) ) { if ( !token[0] ) { diff --git a/SP/code/game/ai_cast_script_actions.c b/SP/code/game/ai_cast_script_actions.c index 150ab04..3f12af6 100644 --- a/SP/code/game/ai_cast_script_actions.c +++ b/SP/code/game/ai_cast_script_actions.c @@ -189,7 +189,7 @@ qboolean AICast_ScriptAction_GotoMarker( cast_state_t *cs, char *params ) { } // find the ai_marker with the given "targetname" - // TTimo: gcc: suggest () around assignment used as truth value + while ( ( ent = G_Find( ent, FOFS( classname ), "ai_marker" ) ) ) { if ( ent->targetname && !Q_strcasecmp( ent->targetname, token ) ) { @@ -537,9 +537,9 @@ qboolean AICast_ScriptAction_Wait( cast_state_t *cs, char *params ) { } // default to no moverange - //if (moverange == -999) { - // moverange = 200; - //} +// if ( moverange == -999 ) { +// moverange = 200; +// } if ( moverange != 0 ) { // default to 200 if no range given if ( moverange > 0 ) { @@ -549,7 +549,7 @@ qboolean AICast_ScriptAction_Wait( cast_state_t *cs, char *params ) { && ( cs->enemyNum >= 0 ) ) { // if we can attack them, or they can't attack us, stay here - // TTimo: gcc: warning: suggest parentheses around && within || + if ( AICast_CheckAttack( cs, cs->enemyNum, qfalse ) || ( !AICast_EntityVisible( AICast_GetCastState( cs->enemyNum ), cs->entityNum, qfalse ) && !AICast_CheckAttack( AICast_GetCastState( cs->enemyNum ), cs->entityNum, qfalse ) ) ) { @@ -1064,12 +1064,10 @@ qboolean AICast_ScriptAction_SetAmmo( cast_state_t *cs, char *params ) { } } else { - if ( g_cheats.integer ) { G_Printf( "--SCRIPTER WARNING-- AI Scripting: setammo: unknown ammo \"%s\"", params ); } return qfalse; // (SA) temp as scripts transition to new names - } return qtrue; @@ -1132,7 +1130,6 @@ qboolean AICast_ScriptAction_SetClip( cast_state_t *cs, char *params ) { } else { // G_Printf( "--SCRIPTER WARNING-- AI Scripting: setclip: unknown weapon \"%s\"", params ); return qfalse; // (SA) temp as scripts transition to new names -// G_Error( "AI Scripting: setclip: unknown weapon \"%s\"", params ); } return qtrue; @@ -1214,14 +1211,8 @@ qboolean AICast_ScriptAction_SelectWeapon( cast_state_t *cs, char *params ) { g_entities[cs->entityNum].client->ps.weaponstate = WEAPON_READY; if ( !cs->aiCharacter ) { // only do this for player - //vmCvar_t cvar; - // g_entities[cs->entityNum].client->ps.weaponTime = 750; // (SA) HACK: FIXME: TODO: delay to catch initial weapon reload - // tell it which weapon to use after spawning in - //trap_Cvar_Register( &cvar, "cg_loadWeaponSelect", "0", CVAR_ROM ); - //trap_Cvar_Set( "cg_loadWeaponSelect", va("%i", g_entities[cs->entityNum].client->ps.weapon ) ); } - } else { // G_Printf( "--SCRIPTER WARNING-- AI Scripting: selectweapon: unknown weapon \"%s\"", params ); // return qfalse; // (SA) temp as scripts transition to new names @@ -1388,7 +1379,6 @@ qboolean AICast_ScriptAction_TakeWeapon( cast_state_t *cs, char *params ) { } else { - for ( i = 1; bg_itemlist[i].classname; i++ ) { //----(SA) first try the name they see in the editor, then the pickup name @@ -1589,7 +1579,7 @@ qboolean AICast_ScriptAction_SaveGame( cast_state_t *cs, char *params ) { //----(SA) check for parameter saveName = COM_ParseExt( &pString, qfalse ); if ( !saveName[0] ) { - G_SaveGame( NULL ); // save the default "current" savegame + G_SaveGame( NULL ); // save the default "current" savegame } else { G_SaveGame( saveName ); } @@ -1609,7 +1599,8 @@ qboolean AICast_ScriptAction_FireAtTarget( cast_state_t *cs, char *params ) { gentity_t *ent; vec3_t vec, org, src; char *pString, *token; - int i, diff; + float diff; + int i; pString = params; @@ -2650,6 +2641,7 @@ qboolean AICast_ScriptAction_Zoom( cast_state_t *cs, char *params ) { } +//----(SA) added /* =================== AICast_ScriptAction_StartCam @@ -2690,8 +2682,6 @@ qboolean AICast_ScriptAction_StartCamBlack( cast_state_t *cs, char *params ) { return ScriptStartCam( cs, params, qtrue ); } - -//----(SA) added qboolean AICast_ScriptAction_StopCamBlack( cast_state_t *cs, char *params ) { trap_SendServerCommand( cs->entityNum, "stopCamblack" ); return qtrue; @@ -2701,10 +2691,7 @@ qboolean AICast_ScriptAction_StopCam( cast_state_t *cs, char *params ) { trap_SendServerCommand( cs->entityNum, "stopCam" ); return qtrue; } -//----(SA) end - -//----(SA) added qboolean AICast_ScriptAction_Cigarette( cast_state_t *cs, char *params ) { char *pString, *token; @@ -2853,10 +2840,6 @@ qboolean AICast_ScriptAction_Cvar( cast_state_t *cs, char *params ) { return qtrue; } - - -//----(SA) added some music interface - /* ================== AICast_ScriptAction_MusicStart diff --git a/SP/code/game/ai_cast_think.c b/SP/code/game/ai_cast_think.c index ec91d41..24376c1 100644 --- a/SP/code/game/ai_cast_think.c +++ b/SP/code/game/ai_cast_think.c @@ -948,7 +948,7 @@ void AICast_StartServerFrame( int time ) { gentity_t *ent; cast_state_t *pcs; qboolean highPriority; - int oldLegsTimer; + int oldLegsTimer; if ( trap_Cvar_VariableIntegerValue( "savegame_loading" ) ) { return; @@ -995,23 +995,23 @@ void AICast_StartServerFrame( int time ) { pcs = AICast_GetCastState( 0 ); -//G_Printf( "AI startserverframe: %i\n", time ); +// G_Printf( "AI startserverframe: %i\n", time ); AICast_AgePlayTime( 0 ); if ( elapsed < 0 ) { - // elapsed = 0; +// elapsed = 0; lasttime = time; } // don't let the framerate drop below 10 - //if ( elapsed > 100 ) { - // elapsed = 100; - //} +// if ( elapsed > 100 ) { +// elapsed = 100; +// } // // process player's current script if it exists AICast_ScriptRun( AICast_GetCastState( 0 ), qfalse ); // - //AICast_SightUpdate( (int)((float)SIGHT_PER_SEC * ((float)elapsed / 1000)) ); +// AICast_SightUpdate( (int)((float)SIGHT_PER_SEC * ((float)elapsed / 1000)) ); // castcount = 0; activeCount = 0; @@ -1019,8 +1019,9 @@ void AICast_StartServerFrame( int time ) { //update the AI characters for ( i = 0, ent = g_entities; i < level.maxclients /*&& clCount < level.numPlayingClients*/; i++, ent++ ) { - //if (ent->inuse && ent->client) - // clCount++; +// if ( ent->inuse && ent->client ) { +// clCount++; +// } // cs = AICast_GetCastState( i ); // is this a cast AI? @@ -1103,8 +1104,8 @@ void AICast_PredictMovement( cast_state_t *cs, int numframes, float frametime, a gentity_t *ent = &g_entities[cs->entityNum]; bot_input_t bi; -//int pretime = Sys_MilliSeconds(); -//G_Printf("PredictMovement: %f duration, %i frames\n", frametime, numframes ); +// int pretime = Sys_MilliSeconds(); +// G_Printf("PredictMovement: %f duration, %i frames\n", frametime, numframes ); if ( cs->bs ) { ps = cs->bs->cur_ps; @@ -1239,7 +1240,7 @@ qboolean AICast_GetAvoid( cast_state_t *cs, bot_goal_t *goal, vec3_t outpos, qbo usercmd_t ucmd; qboolean enemyVisible; float angleDiff; - int starttraveltime = 0, traveltime; // TTimo: init + int starttraveltime = 0, traveltime; int invert; float inc; qboolean averting = qfalse; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

