#include <Windows.h>#include <Assert.h>#include <Math.h>#include "GMain.h"#include "_bot.h"#include "track.h"#include "Bot.h"#include "botmatch.h"#include "botact.h"Go to the source code of this file.
Compounds | |
| struct | Bot_Var |
Defines | |
| #define | NEW_WANDER |
| #define | BOT_DIR_AWAY -1 |
| #define | BOT_DIR_TOWARD 1 |
| #define | BOT_DIR_NONE 0 |
| #define | BOT_SEARCH_Y_RANGE 40.0f |
| #define | BOT_STRENGTH_LOW(hd, wd) ((hd) < -30 && (wd) < -30) |
| #define | BOT_STRENGTH_HIGH(hd, wd) ((hd) > 30 && (wd) > 30) |
| #define | CONTENTS_WATER GE_CONTENTS_USER1 |
| #define | CONTENTS_LAVA GE_CONTENTS_USER2 |
| #define | BOT_GROUND_FRICTION 7.0f |
| #define | BOT_LIQUID_FRICTION 2.5f |
| #define | BOT_AIR_FRICTION 1.00f |
| #define | BOT_GRAVITY 1600.0f |
| #define | BOT_JUMP_THRUST 700 |
| #define | BOT_SIDE_SPEED 4000.0f |
| #define | BOT_RUN_SPEED 3700.0f |
| #define | CLOSE_RANGE_DIST 400.0f |
| #define | MED_RANGE_DIST 900.0f |
| #define | LONG_RANGE_DIST 1600.0f |
| #define | CLOSE_RANGE 0 |
| #define | MED_RANGE 1 |
| #define | LONG_RANGE 2 |
| #define | TARGET_FEET_ADJUST_Y 130.0f |
| #define | TARGET_FEET_ADJUST_Y2 100.0f |
| #define | ALL_BUT_SELF (0xffffffff & ~(1<<0)) |
| #define | MAX_CLIP_PLANES 5 |
Enumerations | |
| enum | { MODE_NULL = -1, MODE_ATTACK = 0, MODE_RETREAT, MODE_WANDER, MODE_FIND_PLAYER, MODE_FIND_PLAYER_QUICK, MODE_CROWD_PLAYER, MODE_GOAL_POINT, MODE_ON_TRACK, MODE_RETREAT_ON_TRACK, MODE_UNSTICK, MODE_WANDER_ON_TRACK, MODE_MAX } |
Functions | |
| void | GenVS_Error (const char *Msg,...) |
| geBoolean | Bot_TrackAction (GenVSI *VSI, void *PlayerData, const TrackPt *ThisPoint, const TrackPt *NextPoint, float Time) |
| geBoolean | Bot_ModeChange (GenVSI *VSI, void *PlayerData, int32 NewMode, geBoolean Think, float Time) |
| geBoolean | Bot_ClearTrack (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_FinishTrack (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_InitGenericMove (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_FindNewMoveVec (GenVSI *VSI, void *PlayerData, const geVec3d *TargetPos, int32 dir, float DistToMove, geVec3d *) |
| geBoolean | Bot_Physics (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_OverLedge (GenVSI *VSI, void *PlayerData, geVec3d *) |
| GPlayer * | Bot_PickTgtPlayer (GenVSI *VSI, void *PlayerData, geBoolean) |
| geBoolean | Bot_LeaveTrack (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_Animate (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_GetContents (GenVSI *VSI, void *PlayerData, float Time) |
| int16 | Bot_ComparePlayers (GenVSI *VSI, void *PlayerData1, void *PlayerData2) |
| int32 | Bot_CompareWeapons (GenVSI *VSI, void *PlayerData, void *TgtPlayerData) |
| geBoolean | Bot_SetupXForm (GenVSI *VSI, void *PlayerData, geVec3d *OrientVec) |
| geBoolean | Bot_Shoot (GenVSI *VSI, void *PlayerData, geVec3d *ShootPosition, float Time) |
| geBoolean | Bot_Keys (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_MoveToPoint (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitMoveFree (GenVSI *VSI, void *PlayerData, geVec3d *Pos) |
| geBoolean | Bot_MoveFree (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitMoveToPoint (GenVSI *VSI, void *PlayerData, geVec3d *Pos) |
| geBoolean | Bot_PastPoint (geVec3d *Pos, geVec3d *MoveVector, geVec3d *TgtPos) |
| geBoolean | Bot_CheckPosition (GenVSI *VSI, void *PlayerData) |
| int32 | Bot_GetRank (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_InitWaitForPlayer (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_WaitForPlayer (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitWaitForEntityVisible (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_WaitForEntityVisible (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitWaitForEntityDist (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_WaitForEntityDist (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitShootPoint (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ShootPoint (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_Reposition (GenVSI *VSI, void *PlayerData, geVec3d *, int32) |
| void | Bot_WeaponSetFromArray (GenVSI *VSI, void *PlayerData, int32 *WeaponArr) |
| geBoolean | Bot_SetWeapon (GenVSI *VSI, void *PlayerData, int16 WeaponNum) |
| geBoolean | Bot_SetupShootXForm (GenVSI *VSI, void *PlayerData, geVec3d *TargetVec) |
| int32 | Bot_GetRangeIndex (GenVSI *VSI, void *PlayerData) |
| int32 | Bot_GetStrengthIndex (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_CanSeePointToPoint (geWorld *World, geVec3d *Pos1, geVec3d *Pos2) |
| geBoolean | Bot_CanSeePlayerToPlayer (geWorld *World, geVec3d *Pos1, geVec3d *Pos2) |
| geBoolean | Bot_CanSeePlayerToPoint (geWorld *World, geVec3d *Pos1, geVec3d *Pos2) |
| Track * | Bot_FindTrackToGoal (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ValidateTrackPoints (GenVSI *VSI, void *PlayerData, Track *t) |
| geBoolean | Bot_ValidateMultiTrackPoints (GenVSI *VSI, void *PlayerData, Track *t) |
| geBoolean | Bot_FireWeapon (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitFindMultiTrack (GenVSI *VSI, void *PlayerData, geVec3d *DestPos, float Time) |
| Track * | Bot_FindTrack (GenVSI *VSI, void *PlayerData, int32 TrackArr[]) |
| GPlayer * | GetBotMatchSpawn (GenVSI *VSI) |
| BotActorStart * | Bot_GetActorStart (GenVSI *VSI, void *PlayerData) |
| geBoolean | BlockActor_Spawn (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName) |
| geBoolean | Bot_ActionGetHealth (GenVSI *VSI, void *PlayerData, float Range, float Time) |
| geBoolean | Bot_ActionGetWeapon (GenVSI *VSI, void *PlayerData, float Range, float Time) |
| GPlayer * | Bot_FindRandomItem (GenVSI *VSI, geVec3d *Pos, char *ClassList[]) |
| Track * | Bot_FindRandomTrack (GenVSI *VSI, geVec3d *Pos, int32 *TrackTypeList) |
| geBoolean | Bot_InitRunCloser (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitMoveCloser (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitTrackToGoal (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitTrackAwayGoal (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitMaintain (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitMoveAway (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitRunAway (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitUnload (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitFindPlayer (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitWander (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitHide (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_InitFindMultiTrackAway (GenVSI *VSI, void *PlayerData, geVec3d *, float Time) |
| geBoolean | Bot_ModeThink (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkAttack (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkRetreat (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkWander (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkFindPlayer (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkFindPlayerQuick (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkCrowdPlayer (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkGoalPoint (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkOnTrack (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkUnstick (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkWanderGoal (GenVSI *VSI, void *PlayerData, float Time) |
| int32 | Bot_RankWeapons (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_ModeActionRetreat (GenVSI *VSI, void *PlayerData, float Time) |
| void * | ChooseAction (DECISION decision[]) |
| geBoolean | Bot_SuicideTest (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | MovePlayerUpStep (GenVSI *VSI, void *PlayerData, GE_Collision *Collision) |
| void | SwitchToNextBestWeapon (GenVSI *VSI, void *PlayerData) |
| geBoolean | PlayerDead (GPlayer *Player) |
| int32 | PlayerLiquid (GPlayer *Player) |
| void | ValidateWeapon (GenVSI *VSI, void *PlayerData) |
| void | FireBlaster (GenVSI *VSI, void *PlayerData, float Time) |
| void | FireShredder (GenVSI *VSI, void *PlayerData, float Time) |
| void | Bot_SetLighting (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_TargetTest (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ShootFoot (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_Suicide (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_Control (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ModeThinkLedge (GenVSI *VSI, void *PlayerData, float Time) |
| void | Bot_SetMode (void *PlayerData, int32 NewMode) |
| geBoolean | Bot_Destroy (GenVSI *VSI, void *PlayerData, void *ClassData) |
| geBoolean | Bot_WeaponJump (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_Jump (GenVSI *VSI, void *PlayerData, float Time) |
| GPlayer * | Bot_FindItem (GenVSI *VSI, geVec3d *Pos, char *ClassList[], float YDiff, float Range) |
| geBoolean | Bot_Dying (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ActorDying (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_NudgePlayer (GenVSI *VSI, void *PlayerData, geVec3d *TgtPos, float Time) |
| geBoolean | Bot_CheckVelocity (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ScanCheckVelocity (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_ScanPhysics (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_MoveScan (GenVSI *VSI, void *PlayerData, geVec3d *vec_dir, float dist, geVec3d *stop_pos) |
| geBoolean | Bot_OverLedgeScan (GenVSI *VSI, void *PlayerData, const geVec3d *StartPos, const geVec3d *EndPos, geVec3d *StopPos) |
| void | Bot_ChooseBestWeapon (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_Main (GenVSI *VSI, const char *LevelName) |
| geBoolean | Bot_MatchStart (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName) |
| void | Bot_Create (GenVSI *VSI, void *PlayerData) |
| geBoolean | Game_SpawnBot (GenVSI *VSI, geWorld *World, void *PlayerData, void *ClassData) |
| geBoolean | Bot_IsActorRespawn (GenVSI *VSI, void *PlayerData) |
| geBoolean | Bot_ActorStart (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName) |
| geBoolean | BlockActor_Trigger (GenVSI *VSI, void *PlayerData, void *TargetData, void *Data) |
Variables | |
| char * | ItemHealthList [] = {"ItemHealth", "ItemArmor", NULL} |
| char * | ItemWeaponList [] = {"ItemRocket", "ItemGrenade", "ItemShredder", NULL} |
| char * | ItemAmmoList [] = {"ItemRocketAmmo", "ItemGrenadeAmmo", "ItemShredderAmmo", NULL} |
| int32 | HealthTrackList [] |
| int32 | WeaponTrackList [] |
| int32 | HideTrackList [] |
| int32 | WeaponSetClose [] = {3, 0, 1, 2} |
| int32 | WeaponSetMed [] = {3, 1, 2, 0} |
| int32 | WeaponSetLong [] = {3, 2, 1, 0} |
| int32 * | WeaponSetRange [] = {WeaponSetClose, WeaponSetMed, WeaponSetLong} |
| GPlayer * | BotDeathMatchStart = NULL |
| geVec3d | RayMins = {-1.0f,-1.0f,-1.0f} |
| geVec3d | RayMaxs = {1.0f,1.0f,1.0f} |
| int32 | ModeTable [MODE_MAX] |
| char * | ModeText [] |
| CONTROLp | Bot_ModeThinkFunc [MODE_MAX] |
| CONTROLp | Bot_ModeAction [MODE_MAX] |
| RankTable [3][3] | |
| geBoolean | GodMode = GE_FALSE |
| geBoolean | PathLight = GE_FALSE |
| geBoolean | BotDebugPrint = GE_FALSE |
| geBoolean | MultiPathLight = GE_FALSE |
|
|
|
|
|
Definition at line 161 of file bot.c. Referenced by Bot_Physics(). |
|
|
Definition at line 147 of file bot.c. Referenced by Bot_FindNewMoveVec(), Bot_FindTrackToGoal(), Bot_InitFindMultiTrackAway(), Bot_InitMoveAway(), Bot_InitRunAway(), and Bot_InitTrackAwayGoal(). |
|
|
Definition at line 149 of file bot.c. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FindNewMoveVec(), Bot_FindTrackToGoal(), Bot_InitHide(), and Bot_InitMaintain(). |
|
|
Definition at line 148 of file bot.c. Referenced by Bot_FindNewMoveVec(), Bot_FindTrackToGoal(), Bot_InitFindMultiTrack(), Bot_InitMoveCloser(), Bot_InitRunCloser(), and Bot_InitTrackToGoal(). |
|
|
Definition at line 162 of file bot.c. Referenced by Bot_Physics(). |
|
|
Definition at line 159 of file bot.c. Referenced by Bot_Physics(). |
|
|
Definition at line 163 of file bot.c. Referenced by Bot_TrackAction(). |
|
|
Definition at line 160 of file bot.c. Referenced by Bot_Physics(). |
|
|
Definition at line 165 of file bot.c. Referenced by Bot_ActorDying(), Bot_Create(), Bot_Dying(), Bot_Jump(), and Bot_WeaponJump(). |
|
|
Definition at line 151 of file bot.c. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FindTrackToGoal(), and Bot_ValidateTrackPoints(). |
|
|
|
|
|
Definition at line 154 of file bot.c. Referenced by Bot_GetStrengthIndex(). |
|
|
Definition at line 153 of file bot.c. Referenced by Bot_GetStrengthIndex(). |
|
|
Definition at line 171 of file bot.c. Referenced by Bot_GetRangeIndex(). |
|
|
Definition at line 167 of file bot.c. Referenced by Bot_GetRangeIndex(), and Bot_ModeThinkAttack(). |
|
|
Definition at line 157 of file bot.c. Referenced by Bot_GetContents(), and UpdatePlayerContents(). |
|
|
Definition at line 156 of file bot.c. Referenced by Bot_GetContents(), and UpdatePlayerContents(). |
|
|
Definition at line 173 of file bot.c. Referenced by Bot_GetRangeIndex(). |
|
|
|
|
|
Definition at line 3109 of file bot.c. Referenced by Bot_CheckVelocity(), Bot_ScanCheckVelocity(), and CheckVelocity(). |
|
|
Definition at line 172 of file bot.c. Referenced by Bot_GetRangeIndex(). |
|
|
Definition at line 168 of file bot.c. Referenced by Bot_GetRangeIndex(), and Bot_ModeThinkAttack(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 244 of file bot.c.
00244 {
00245 MODE_NULL = -1,
00246 MODE_ATTACK = 0,
00247 MODE_RETREAT,
00248 MODE_WANDER,
00249 MODE_FIND_PLAYER,
00250 MODE_FIND_PLAYER_QUICK,
00251 MODE_CROWD_PLAYER,
00252 MODE_GOAL_POINT,
00253 MODE_ON_TRACK,
00254 MODE_RETREAT_ON_TRACK,
00255 MODE_UNSTICK,
00256 MODE_WANDER_ON_TRACK,
00257 MODE_MAX,
00258 };
|
|
||||||||||||||||||||
|
||||||||||||||||||||
|
Definition at line 4939 of file bot.c. References GE_FALSE, and geBoolean. Referenced by BlockActor_Spawn().
|
|
||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||
|
Definition at line 3001 of file bot.c. References Bot_Var::Action, ACTOR_MOTION_PLAYER_DIE, ACTOR_MOTION_PLAYER_RUN, AnimatePlayer(), Bot_ClearTrack(), Bot_Control(), Bot_GetActorStart(), Bot_InitGenericMove(), Bot_ModeChange(), BOT_RUN_SPEED, Bot_SetupXForm(), Bot_Var::BotTgtPicked, GPlayer::Control, GPlayer::FrameTime, FX_EXPLODE2, GE_FALSE, GE_TRUE, geBoolean, GenVSI_DestroyPlayer(), GenVSI_SpawnFx(), geVec3d_Clear(), geXForm3d_SetIdentity(), MODE_WANDER, GPlayer::MotionIndex, Bot_Var::MoveVec, BotActorStart::origin, Bot_Var::PickTimeout, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerPhysics(), PSTATE_Normal, BotActorStart::Respawn, GPlayer::Roll, Bot_Var::RunSpeed, SOUND_INDEX_PLAYER_SPAWN, StackReset(), GPlayer::State, Bot_Var::TgtPos, Bot_Var::TimeSinceTrack, Bot_Var::TrackStack, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, VIEW_TYPE_FORCE_XFORM, GPlayer::ViewFlags, GPlayer::ViewIndex, and GPlayer::XForm. Referenced by KillPlayer().
03002 {
03003 GPlayer *Player;
03004 Bot_Var *DBot;
03005 static float WaitTime = 0.0f;
03006
03007 Player = (GPlayer*)PlayerData;
03008 DBot = (Bot_Var*)Player->userData;
03009
03010 Player->MotionIndex = ACTOR_MOTION_PLAYER_DIE;
03011 AnimatePlayer(VSI, Player, Player->MotionIndex, Time, GE_FALSE);
03012
03013 Player->Roll -= 2.0f*Time;
03014
03015 if (Player->Roll < -(3.14159f/2.0f))
03016 {
03017 Player->Roll = -(3.14159f/2.0f);
03018
03019 WaitTime += Time;
03020
03021 //if (Move->ButtonBits & HOST_BUTTON_FIRE)
03022 if (WaitTime > 3.0f)
03023 {
03024 BotActorStart *Bs;
03025
03026 Bs = Bot_GetActorStart(VSI, Player);
03027
03028 assert(Bs);
03029
03030 if (!Bs->Respawn)
03031 {
03032 GenVSI_DestroyPlayer(VSI, Player);
03033 return GE_TRUE;;
03034 }
03035
03036 Player->Roll = 0.0f; // Make him stand right side up again
03037 Player->Control = Bot_Control;
03038 Player->ViewIndex = 0;
03039 Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
03040 Player->FrameTime = 0.0f;
03041 geVec3d_Clear(&Player->Velocity);
03042 geVec3d_Clear(&DBot->TgtPos);
03043 Bot_ClearTrack(VSI, Player);
03044 DBot->PickTimeout = 0.0f;
03045 DBot->BotTgtPicked = 0;
03046 DBot->TimeSinceTrack = 0.0f;
03047 StackReset(&DBot->TrackStack);
03048 Bot_ModeChange(VSI, Player, MODE_WANDER, GE_TRUE, Time);
03049 DBot->Action = Bot_InitGenericMove;
03050 DBot->RunSpeed = BOT_RUN_SPEED;
03051 Player->State = PSTATE_Normal; // Back to normal now...
03052
03053 Player->ViewFlags &= ~VIEW_TYPE_FORCE_XFORM;
03054
03055 geXForm3d_SetIdentity(&Player->XForm);
03056 Player->XForm.Translation = Bs->origin;
03057 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_PLAYER_SPAWN);
03058
03059 return GE_TRUE;
03060 }
03061 }
03062 else
03063 {
03064 WaitTime = 0.0f;
03065 }
03066
03067 Bot_SetupXForm(VSI, Player, &DBot->MoveVec);
03068
03069 PlayerPhysics(VSI, Player, PLAYER_GROUND_FRICTION, PLAYER_AIR_FRICTION, PLAYER_LIQUID_FRICTION, PLAYER_GRAVITY, 1.0f, GE_FALSE, Time);
03070
03071 return GE_TRUE;
03072 }
|
|
||||||||||||||||||||
|
Definition at line 4855 of file bot.c. References ACTOR_INDEX_PLAYER, ACTOR_MOTION_PLAYER_RUN, Bot_Control(), Bot_Create(), Bot_Destroy(), Bot_Var::BotType, GPlayer::Control, GPlayer::ControlIndex, GPlayer::CurrentWeapon, DAMMAGE_TYPE_NORMAL, DAMMAGE_TYPE_RADIUS, GPlayer::DammageFlags, GPlayer::DFunc, GE_FALSE, GE_TRUE, geBoolean, GenVS_Error(), GenVSI_SpawnPlayer(), geXForm3d_SetIdentity(), geXForm3d_SetTranslation(), GPlayer::GunOffset, GPlayer::Health, int32, GPlayer::Inventory, GPlayer::InventoryHas, MAX_PLAYER_ITEMS, GPlayer::Maxs, GPlayer::Mins, GPlayer::MotionIndex, GPlayer::NextWeaponTime, NULL, BotActorStart::origin, BotActorStart::Ptr, GPlayer::Scale, GPlayer::Score, GPlayer::Time, GPlayer::userData, VIEW_TYPE_ACTOR, VIEW_TYPE_COLLIDEMODEL, VIEW_TYPE_YAW_ONLY, GPlayer::ViewFlags, GPlayer::ViewIndex, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z. Referenced by Bot_Main().
04856 {
04857 int32 i;
04858 GPlayer *Player;
04859 BotActorStart *Start;
04860 Bot_Var *DBot;
04861
04862 if (ClassData == NULL)
04863 {
04864 GenVS_Error("Bot_ActorStart: entity missing class data ('%s')\n",EntityName);
04865 }
04866
04867 Start = (BotActorStart*)ClassData;
04868
04869 Player = (GPlayer*)GenVSI_SpawnPlayer(VSI, "Bot_Actor");
04870
04871 Start->Ptr = (char*)(Player); //link to entity - sort of hacky
04872
04873 //Player->XForm = Start->XForm;
04874 geXForm3d_SetIdentity(&Player->XForm);
04875 geXForm3d_SetTranslation(&Player->XForm, Start->origin.X, Start->origin.Y, Start->origin.Z);
04876
04877 Player->Time = 0.0f;
04878
04879 Player->Scale = 2.7f;
04880
04881 Player->Mins.X = -30.0f;
04882 Player->Mins.Y = -10.0f;
04883 Player->Mins.Z = -30.0f;
04884 Player->Maxs.X = 30.0f;
04885 Player->Maxs.Y = 160.0f;
04886 Player->Maxs.Z = 30.0f;
04887
04888 Player->GunOffset.X = 0.0f;
04889 Player->GunOffset.Y = 130.0f;
04890 Player->GunOffset.Z = 0.0f;
04891
04892 // Set the view info
04893 Player->ViewFlags = VIEW_TYPE_ACTOR | VIEW_TYPE_YAW_ONLY | VIEW_TYPE_COLLIDEMODEL;
04894 Player->ViewIndex = ACTOR_INDEX_PLAYER;
04895 Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
04896 Player->DammageFlags = DAMMAGE_TYPE_NORMAL | DAMMAGE_TYPE_RADIUS;
04897
04898 // Hook player up to client physics controller
04899 Player->ControlIndex = 0;
04900 Player->DFunc = (void*)Bot_Destroy;
04901
04902 Bot_Create(VSI, Player);
04903 //Player->Control = Bot_MoveToPoint;
04904 Player->Control = Bot_Control;
04905 DBot = (Bot_Var*)Player->userData;
04906
04907 DBot->BotType = 1;
04908
04909 Player->Health = 100;
04910 Player->Score = 0;
04911
04912 // FIXME: Soon, Scores, Health, etc won't be so arbitrary. Maybe somthing like
04913 // Quake2's Layouts will be used instead, making it easier to make games that don't
04914 // use this sort of scoring system...
04915 //GenVSI_SetClientScore(VSI, Player->ClientHandle, Player->Score);
04916 //GenVSI_SetClientHealth(VSI, Player->ClientHandle, Player->Health);
04917
04918 for (i=0; i< MAX_PLAYER_ITEMS; i++)
04919 {
04920 Player->Inventory[i] = 0;
04921 Player->InventoryHas[i] = GE_FALSE;
04922 }
04923
04924 Player->CurrentWeapon = 0;
04925
04926 //GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_GRENADES, 0, GE_FALSE);
04927 //GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_ROCKETS, 0, GE_FALSE);
04928 //GenVSI_SetClientInventory(VSI, Player->ClientHandle, ITEM_SHREDDER, 0, GE_FALSE);
04929
04930 Player->NextWeaponTime = 0.0f;
04931
04932 return GE_TRUE;
04933 }
|
|
||||||||||||||||
|
Definition at line 2365 of file bot.c. References ACTOR_MOTION_PLAYER_IDLE, ACTOR_MOTION_PLAYER_RUN, AnimatePlayer(), GPlayer::FrameTime, GE_FALSE, GE_TRUE, geBoolean, geVec3d_Length(), GPlayer::MotionIndex, GPlayer::userData, and GPlayer::Velocity. Referenced by Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WaitForPlayer(), and Bot_WeaponJump().
02366 {
02367 GPlayer *Player;
02368 Bot_Var *DBot;
02369 float Speed;
02370 geBoolean DoWalk = GE_FALSE;
02371
02372 Player = (GPlayer*)PlayerData;
02373 assert(Player);
02374 DBot = (Bot_Var*)Player->userData;
02375
02376 Speed = geVec3d_Length(&Player->Velocity);
02377
02378 if (Speed > 0.1f)
02379 {
02380 if (Player->MotionIndex != ACTOR_MOTION_PLAYER_RUN)
02381 Player->FrameTime = 0.0f;
02382
02383 Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
02384 DoWalk = GE_TRUE;
02385 }
02386
02387 if (Speed > 0.1f && DoWalk)
02388 {
02389 if (Player->MotionIndex == ACTOR_MOTION_PLAYER_RUN)
02390 {
02391 Speed*=0.004f;
02392
02393 //if (Move->ForwardSpeed<0)
02394 // Speed *= -1.0f;
02395 }
02396 else
02397 Speed = 1.0f;
02398
02399 if (AnimatePlayer(VSI, Player, Player->MotionIndex, Time*Speed, GE_TRUE))
02400 {
02401 if (Player->MotionIndex != ACTOR_MOTION_PLAYER_RUN)
02402 Player->FrameTime = 0.0f;
02403
02404 Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
02405 }
02406 }
02407 else
02408 {
02409 if (Player->MotionIndex != ACTOR_MOTION_PLAYER_IDLE)
02410 {
02411 Player->MotionIndex = ACTOR_MOTION_PLAYER_IDLE;
02412 Player->FrameTime = 0.0f;
02413 }
02414
02415 AnimatePlayer(VSI, Player, Player->MotionIndex, Time, GE_TRUE);
02416 }
02417
02418 return GE_TRUE;
02419 }
|
|
||||||||||||||||
|
Definition at line 2576 of file bot.c. References GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_FALSE, geBoolean, geWorld_Collision(), geWorld_GetLeaf(), geWorld_LeafMightSeeLeaf(), int32, NULL, Pos2, RayMaxs, RayMins, and geVec3d::Y. Referenced by Bot_Control(), Bot_PickTgtPlayer(), Bot_TrackAction(), and Bot_WaitForPlayer().
02577 {
02578 GE_Collision Collision;
02579 geVec3d PosAdj1,PosAdj2;
02580 int32 Leaf1, Leaf2;
02581
02582 assert (World);
02583
02584 PosAdj1 = *Pos1;
02585 PosAdj2 = *Pos2;
02586
02587 PosAdj1.Y += 140.0f;
02588 PosAdj2.Y += 140.0f;
02589
02590 geWorld_GetLeaf(World, &PosAdj1, &Leaf1);
02591 geWorld_GetLeaf(World, &PosAdj2, &Leaf2);
02592
02593 if (geWorld_LeafMightSeeLeaf(World, Leaf1, Leaf2, 0))
02594 return !geWorld_Collision(World, &RayMins, &RayMaxs, &PosAdj1, &PosAdj2, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0, NULL, NULL, &Collision);
02595
02596 return(GE_FALSE);
02597 }
|
|
||||||||||||||||
|
Definition at line 2550 of file bot.c. References GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_FALSE, geBoolean, geWorld_Collision(), geWorld_GetLeaf(), geWorld_LeafMightSeeLeaf(), int32, NULL, Pos2, RayMaxs, RayMins, and geVec3d::Y. Referenced by Bot_WaitForEntityVisible().
02551 {
02552 GE_Collision Collision;
02553 geVec3d PosAdj1,PosAdj2;
02554 int32 Leaf1, Leaf2;
02555
02556 assert (World);
02557
02558 PosAdj1 = *Pos1;
02559 PosAdj2 = *Pos2;
02560
02561 PosAdj1.Y += 30.0f;
02562
02563 geWorld_GetLeaf(World, &PosAdj1, &Leaf1);
02564 geWorld_GetLeaf(World, &PosAdj2, &Leaf2);
02565
02566 if (geWorld_LeafMightSeeLeaf(World, Leaf1, Leaf2, 0))
02567 return !geWorld_Collision(World, &RayMins, &RayMaxs, &PosAdj1, &PosAdj2, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0, NULL, NULL, &Collision);
02568
02569 return(GE_FALSE);
02570 }
|
|
||||||||||||||||
|
Definition at line 2530 of file bot.c. References GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_FALSE, geBoolean, geWorld_Collision(), geWorld_GetLeaf(), geWorld_LeafMightSeeLeaf(), int32, NULL, Pos2, RayMaxs, and RayMins.
02531 {
02532 GE_Collision Collision;
02533 int32 Leaf1, Leaf2;
02534
02535 assert (World);
02536
02537 geWorld_GetLeaf(World, Pos1, &Leaf1);
02538 geWorld_GetLeaf(World, Pos2, &Leaf2);
02539
02540 if (geWorld_LeafMightSeeLeaf(World, Leaf1, Leaf2, 0))
02541 return !geWorld_Collision(World, &RayMins, &RayMaxs, Pos1, Pos2, GE_CONTENTS_CANNOT_OCCUPY, GE_COLLIDE_MODELS, 0, NULL, NULL, &Collision);
02542
02543 return(GE_FALSE);
02544 }
|
|
||||||||||||
|
Definition at line 3580 of file bot.c. References GE_Contents::Contents, GE_COLLIDE_MODELS, GE_CONTENTS_SOLID, GE_FALSE, GE_TRUE, geBoolean, GenVSI_GetWorld(), geWorld_GetContents(), GPlayer::LastGoodPos, GPlayer::Maxs, GPlayer::Mins, NULL, geXForm3d::Translation, uint32, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_Physics(), and Bot_ScanPhysics().
03581 {
03582 geVec3d Mins, Maxs, Pos;
03583 GE_Contents Contents;
03584 GPlayer *Player;
03585 Bot_Var *DBot;
03586 uint32 ColFlags;
03587
03588 Player = (GPlayer*)PlayerData;
03589 DBot = (Bot_Var*)Player->userData;
03590
03591 Mins = Player->Mins;
03592 Maxs = Player->Maxs;
03593
03594 Pos = Player->XForm.Translation;
03595
03596 ColFlags = GE_COLLIDE_MODELS;
03597
03598 if (geWorld_GetContents(GenVSI_GetWorld(VSI), &Pos, &Mins, &Maxs, ColFlags, 0, NULL, NULL, &Contents))
03599 {
03600 if (Contents.Contents & GE_CONTENTS_SOLID)
03601 {
03602 Player->XForm.Translation = Player->LastGoodPos;
03603 return GE_TRUE;
03604 }
03605 }
03606
03607 return GE_FALSE;
03608 }
|
|
||||||||||||||||
|
Definition at line 3114 of file bot.c. References GE_Collision::Actor, GE_Contents::Contents, GE_Plane::Dist, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_CONTENTS_SOLID, GE_FALSE, GE_TRUE, geBoolean, GenVSI_ConsolePrintf(), GenVSI_GetWorld(), geVec3d_AddScaled(), geVec3d_Clear(), geVec3d_Copy(), geVec3d_CrossProduct(), geVec3d_DotProduct(), geVec3d_Scale(), geWorld_Collision(), geWorld_GetContents(), geWorld_ModelGetUserData(), GE_Collision::Impact, int32, GPlayer::LastGoodPos, MAX_CLIP_PLANES, GPlayer::Maxs, GPlayer::Mins, GE_Collision::Model, MovePlayerUpStep(), GE_Plane::Normal, NULL, GE_Collision::Plane, PSTATE_Dead, PSTATE_DeadOnGround, PSTATE_InAir, PSTATE_Normal, GE_Collision::Ratio, ReflectVelocity(), GPlayer::State, geXForm3d::Translation, GPlayer::Trigger, uint32, GPlayer::Velocity, VIEW_TYPE_PHYSOB, VIEW_TYPE_STANDON, GPlayer::ViewFlags, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_Physics().
03115 {
03116 int32 NumHits, NumPlanes;
03117 GE_Collision Collision;
03118 int32 HitCount, i, j;
03119 geVec3d Mins, Maxs;
03120 geVec3d Planes[MAX_CLIP_PLANES];
03121 geVec3d Pos, NewPos, OriginalVelocity, PrimalVelocity;
03122 geVec3d NewVelocity, Dir;
03123 float TimeLeft, Dist;
03124 GE_Contents Contents;
03125 GPlayer *Player;
03126 geWorld *World;
03127 uint32 ColFlags;
03128
03129 Player = (GPlayer*)PlayerData;
03130
03131 World = GenVSI_GetWorld(VSI);
03132
03133 assert(World);
03134
03135 Mins = Player->Mins;
03136 Maxs = Player->Maxs;
03137
03138 geVec3d_Copy(&Player->Velocity, &OriginalVelocity);
03139 geVec3d_Copy(&Player->Velocity, &PrimalVelocity);
03140
03141 TimeLeft = Time;
03142
03143 NumHits = 4;
03144 //NumHits = 1;
03145 NumPlanes = 0;
03146
03147 Player->State = PSTATE_InAir;
03148
03149 ColFlags = GE_COLLIDE_MODELS;
03150
03151 for (HitCount=0 ; HitCount<NumHits ; HitCount++)
03152 {
03153 float Fd, Bd;
03154 //Server_Player *UPlayer;
03155
03156 Pos = Player->XForm.Translation;
03157
03158 geVec3d_AddScaled(&Pos, &Player->Velocity, TimeLeft, &NewPos);
03159
03160 if (geWorld_GetContents(World, &Pos, &Mins, &Maxs, ColFlags, 1, NULL, NULL, &Contents))
03161 {
03162 if (Contents.Contents & GE_CONTENTS_SOLID)
03163 {
03164 if (geWorld_GetContents(World, &NewPos, &Mins, &Maxs, ColFlags, 0xffffffff, NULL, NULL, &Contents))
03165 {
03166 if (Contents.Contents & GE_CONTENTS_SOLID)
03167 {
03168 geVec3d_Copy(&Player->LastGoodPos, &Player->XForm.Translation);
03169 geVec3d_Clear(&Player->Velocity);
03170 return GE_TRUE;
03171 }
03172 }
03173 }
03174 }
03175
03176 if (!geWorld_Collision(World, &Mins, &Maxs, &Pos, &NewPos, GE_CONTENTS_CANNOT_OCCUPY, ColFlags, 0xffffffff, NULL, NULL, &Collision))
03177 return GE_TRUE; // Covered the entire distance...
03178
03179 if (Collision.Plane.Normal.Y > 0.7f)
03180 {
03181 if (Player->State == PSTATE_InAir)
03182 Player->State = PSTATE_Normal; // Put the player on the ground if in air
03183 else if (Player->State == PSTATE_Dead)
03184 Player->State = PSTATE_DeadOnGround; // Put the player on the ground if in air
03185
03186 if (Collision.Model)
03187 {
03188 GPlayer *Target;
03189 Target = (GPlayer*)geWorld_ModelGetUserData(Collision.Model);
03190 if (Target && Target->Trigger && Target->ViewFlags & VIEW_TYPE_STANDON)
03191 Target->Trigger(VSI, Target, Player, NULL);
03192 }
03193 }
03194
03195
03196 if (Collision.Model)
03197 {
03198 GPlayer *Target;
03199 Target = (GPlayer*)geWorld_ModelGetUserData(Collision.Model);
03200 if (Target && Target->Trigger && Target->ViewFlags & VIEW_TYPE_PHYSOB)
03201 Target->Trigger(VSI, Target, Player, (void*)&Collision);
03202 }
03203
03204 if (Collision.Actor) // Just stop at actors for now...
03205 {
03206 geVec3d_Copy(&Player->LastGoodPos, &Player->XForm.Translation);
03207 geVec3d_Clear(&Player->Velocity);
03208 return GE_TRUE;
03209 }
03210
03211 // FIXME: Save this ratio in the impact function...
03212 Fd = geVec3d_DotProduct(&Pos, &Collision.Plane.Normal) - Collision.Plane.Dist;
03213 Bd = geVec3d_DotProduct(&NewPos, &Collision.Plane.Normal) - Collision.Plane.Dist;
03214
03215 Collision.Ratio = Fd / (Fd - Bd);
03216
03217 if (Collision.Ratio > 0.00f) // Actually covered some distance
03218 {
03219 // Set the players pos to the impact point
03220 geVec3d_Copy(&Collision.Impact, &Player->XForm.Translation);
03221 // Restore Velocity
03222 geVec3d_Copy(&Player->Velocity, &OriginalVelocity);
03223 NumPlanes = 0;
03224 }
03225
03226 if (!Collision.Plane.Normal.Y)
03227 {
03228 if (MovePlayerUpStep(VSI, Player, &Collision))
03229 {
03230 continue;
03231 }
03232 }
03233
03234 // This is the main change
03235 if (Collision.Plane.Normal.Y < 0.2f)
03236 {
03237 //geVec3d_Copy(&Collision.Impact, &Player->XForm.Translation);
03238 geVec3d_Clear(&Player->Velocity);
03239 return GE_FALSE;
03240 }
03241
03242 //TimeLeft -= TimeLeft * Collision.Ratio;
03243
03244 // Clipped to another plane
03245 if (NumPlanes >= MAX_CLIP_PLANES)
03246 {
03247 GenVSI_ConsolePrintf(VSI, "MAX_CLIP_PLANES!!!\n");
03248 geVec3d_Clear(&Player->Velocity);
03249 return GE_TRUE;
03250 }
03251
03252 // Add the plane hit, to the plane list
03253 geVec3d_Copy (&Collision.Plane.Normal, &Planes[NumPlanes]);
03254 NumPlanes++;
03255
03256 //
03257 // Modify original_velocity so it parallels all of the clip planes
03258 //
03259 for (i=0 ; i<NumPlanes ; i++)
03260 {
03261 ReflectVelocity(&OriginalVelocity, &Planes[i], &NewVelocity, 1.0f);
03262
03263 for (j=0 ; j<NumPlanes ; j++)
03264 {
03265 if (j != i)
03266 {
03267 if (geVec3d_DotProduct(&NewVelocity, &Planes[j]) < 0.0f)
03268 break; // not ok
03269 }
03270 }
03271 if (j == NumPlanes)
03272 break;
03273 }
03274
03275 if (i != NumPlanes)
03276 { // Go along this plane
03277 geVec3d_Copy(&NewVelocity, &Player->Velocity);
03278 }
03279 else
03280 { // Go along the crease
03281 if (NumPlanes != 2)
03282 {
03283 geVec3d_Clear(&Player->Velocity);
03284 return GE_FALSE;
03285 }
03286
03287 geVec3d_CrossProduct(&Planes[0], &Planes[1], &Dir);
03288 Dist = geVec3d_DotProduct(&Dir, &Player->Velocity);
03289 geVec3d_Scale(&Dir, Dist, &Player->Velocity);
03290 }
03291
03292 //
03293 // If original velocity is against the original velocity, stop dead
03294 // to avoid tiny occilations in sloping corners
03295 //
03296 if (geVec3d_DotProduct (&Player->Velocity, &PrimalVelocity) <= 0.0f)
03297 {
03298 geVec3d_Clear(&Player->Velocity);
03299 return GE_FALSE;
03300 }
03301 //
03302
03303 }
03304 return GE_TRUE;
03305 }
|
|
||||||||||||
|
Definition at line 4454 of file bot.c. References GPlayer::CurrentWeapon, int16, GPlayer::Inventory, GPlayer::InventoryHas, and GPlayer::userData.
04455 {
04456 int16 i;
04457 GPlayer *Player;
04458 Bot_Var *DBot;
04459
04460 Player = (GPlayer*)PlayerData;
04461 DBot = (Bot_Var*)Player->userData;
04462
04463 for (i=3; i>=0; i--)
04464 {
04465 if (i == 0)
04466 {
04467 Player->CurrentWeapon = 0;
04468 break;
04469 }
04470
04471 if (Player->InventoryHas[i] && Player->Inventory[i] > 0)
04472 {
04473 Player->CurrentWeapon = i;
04474 break;
04475 }
04476 }
04477
04478 assert(Player->CurrentWeapon >= 0 && Player->CurrentWeapon < 4);
04479 }
|
|
||||||||||||
|
Definition at line 5754 of file bot.c. References GE_TRUE, geBoolean, StackReset(), Track_ClearTrack(), Bot_Var::TrackInfo, Bot_Var::TrackInfoPrev, Bot_Var::TrackStack, and GPlayer::userData. Referenced by Bot_ActorDying(), Bot_Create(), Bot_Dying(), Bot_LeaveTrack(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), and Bot_WaitForPlayer().
05755 {
05756 Bot_Var *DBot;
05757 GPlayer *Player;
05758
05759 Player = (GPlayer*)PlayerData;
05760 assert(Player);
05761 DBot = (Bot_Var*)Player->userData;
05762 assert(DBot);
05763
05764 Track_ClearTrack(&DBot->TrackInfoPrev);
05765 Track_ClearTrack(&DBot->TrackInfo);
05766 StackReset(&DBot->TrackStack);
05767
05768 return GE_TRUE;
05769 }
|
|
||||||||||||||||
|
Definition at line 2225 of file bot.c. References GPlayer::Health, int16, and int32.
02226 {
02227 GPlayer *Player1;
02228 GPlayer *Player2;
02229 int32 diff;
02230
02231 // this func should be extended and to make better decision
02232
02233 Player1 = (GPlayer*)PlayerData1;
02234 Player2 = (GPlayer*)PlayerData2;
02235
02236 diff = Player1->Health - Player2->Health;
02237
02238 if (diff > 30)
02239 {
02240 return(1);
02241 }
02242 else
02243 if (diff < -30)
02244 {
02245 return(-1);
02246 }
02247 else
02248 return(1);
02249 }
|
|
||||||||||||||||
|
Definition at line 5029 of file bot.c. References Bot_RankWeapons(), and int32. Referenced by Bot_GetStrengthIndex(), Bot_ModeThinkAttack(), Bot_ModeThinkCrowdPlayer(), and Bot_ModeThinkFindPlayer().
05030 {
05031 int32 d1, d2;
05032
05033 d1 = Bot_RankWeapons(VSI, PlayerData);
05034 d2 = Bot_RankWeapons(VSI, TgtPlayerData);
05035
05036 return d1 - d2;
05037 }
|
|
||||||||||||||||
|
Definition at line 353 of file bot.c. References Bot_Var::Action, Bot_Var::ActiveTime, Bot_CanSeePlayerToPlayer(), Bot_Keys(), Bot_ModeAction, Bot_SuicideTest(), Bot_TargetTest(), Bot_Var::BotType, GE_TRUE, geBoolean, GenVSI_GetWorld(), Bot_Var::GoalPos, Bot_Var::Mode, MODE_GOAL_POINT, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, Bot_Var::TgtPlayer, GPlayer::Time, Bot_Var::TimeNotSeen, Bot_Var::TimeSeen, Bot_Var::TimeSinceTrack, Track_OnTrack(), Bot_Var::TrackInfo, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_ActorDying(), Bot_ActorStart(), Bot_Create(), and Bot_Dying().
00354 {
00355 GPlayer *Player;
00356 Bot_Var *DBot;
00357 geWorld *World;
00358 geBoolean CanSee;
00359
00360 World = GenVSI_GetWorld(VSI);
00361 assert(World);
00362
00363 Player = (GPlayer*)PlayerData;
00364 assert(Player);
00365
00366 DBot = (Bot_Var*)Player->userData;
00367
00368 assert(DBot);
00369
00370 Player->Time += Time;
00371 DBot->ModeTimeOut += Time;
00372 DBot->TimeSinceTrack += Time;
00373
00374 //Bot_SetLighting(VSI, Player);
00375
00376 if (Bot_SuicideTest(VSI, Player, Time))
00377 return GE_TRUE;
00378
00379 Bot_TargetTest(VSI, Player, Time);
00380
00381 assert(DBot->TgtPlayer);
00382
00383 CanSee = Bot_CanSeePlayerToPlayer(World, &Player->XForm.Translation, &DBot->TgtPlayer->XForm.Translation);
00384 if (CanSee)
00385 {
00386 DBot->TimeNotSeen = 0.0f;
00387 DBot->TimeSeen += Time;
00388 DBot->ModeTimeSeen += Time;
00389 }
00390 else
00391 {
00392 DBot->TimeSeen = 0.0f;
00393 DBot->TimeNotSeen += Time;
00394 DBot->ModeTimeNotSeen += Time;
00395 }
00396
00397 // Actor Bot
00398 if (DBot->BotType == 1)
00399 {
00400 if (CanSee)
00401 {
00402 // stay active for 20 seconds after bot goes from ALL players views
00403 DBot->ActiveTime = 20.0f;
00404 }
00405 else
00406 {
00407 if (DBot->ActiveTime <= 0.0f)
00408 return GE_TRUE;
00409
00410 DBot->ActiveTime -= Time;
00411 }
00412 }
00413
00414 Bot_Keys(VSI, Player, Time);
00415
00416 // default goal to target player if not on a track or similar circumstance
00417 if (!Track_OnTrack(&DBot->TrackInfo) && !(DBot->Mode == MODE_GOAL_POINT))
00418 DBot->GoalPos = DBot->TgtPlayer->XForm.Translation;
00419
00420 // Purely for debug purposes so we can break at any point
00421 #if BOT_DEBUG
00422 if (GetAsyncKeyState('M') & 0x8000)
00423 Player = Player;
00424 #endif
00425
00426 assert(DBot->Action);
00427 DBot->Action(VSI, PlayerData, Time);
00428
00429 // mode specific action testing - called every time through the loop
00430 // for certain modes
00431 if (Bot_ModeAction[DBot->Mode])
00432 Bot_ModeAction[DBot->Mode](VSI, PlayerData, Time);
00433
00434 return GE_TRUE;
00435 }
|
|
||||||||||||
|
Definition at line 4623 of file bot.c. References Bot_Var::Action, Bot_ClearTrack(), Bot_Control(), Bot_Destroy(), Bot_ModeThink(), BOT_RUN_SPEED, GPlayer::Control, GPlayer::DFunc, Bot_Var::Dir, GE_RAM_ALLOCATE_STRUCT, Bot_Var::RunSpeed, StackInit(), Bot_Var::TrackStack, and GPlayer::userData. Referenced by Bot_ActorStart(), and Game_SpawnBot().
04624 {
04625 Bot_Var *DBot;
04626 GPlayer *Player;
04627
04628 Player = (GPlayer*)PlayerData;
04629 assert(Player);
04630
04631 Player->Control = Bot_Control;
04632 Player->DFunc = Bot_Destroy;
04633
04634 if (!Player->userData)
04635 {
04636 DBot = GE_RAM_ALLOCATE_STRUCT(Bot_Var);
04637 assert(DBot);
04638 Player->userData = (void *)DBot;
04639 }
04640
04641 memset(DBot, 0, sizeof(Bot_Var));
04642 DBot->RunSpeed = BOT_RUN_SPEED;
04643 DBot->Action = Bot_ModeThink;
04644 Bot_ClearTrack(VSI, Player);
04645 DBot->Dir = 1;
04646 StackInit(&DBot->TrackStack);
04647 //DBot->TOS = -1;
04648 }
|
|
||||||||||||||||
|
Definition at line 1293 of file bot.c. References CLIENT_NULL_HANDLE, GPlayer::ClientHandle, Stack::Data, GE_TRUE, geBoolean, GenVSI_GetNextPlayer(), GenVSI_GetWorld(), GenVSI_IsClientBot(), geRam_Free, NULL, Bot_Var::TgtPlayer, Bot_Var::TrackStack, and GPlayer::userData. Referenced by Bot_ActorStart(), Bot_Create(), and Game_SpawnBot().
01294 {
01295 GPlayer *Player,*Hit;
01296 Bot_Var *DBot,*HBot;
01297 geWorld *World;
01298
01299 Player = (GPlayer*)PlayerData;
01300 DBot = (Bot_Var*)Player->userData;
01301
01302 World = GenVSI_GetWorld(VSI);
01303
01304 // run through players setting resetting any targets pointing to this player
01305 // being killed
01306
01307 Hit = NULL;
01308 while (1)
01309 {
01310 Hit = GenVSI_GetNextPlayer(VSI, Hit, NULL);
01311
01312 if (!Hit)
01313 break;
01314
01315 if (Hit == Player)
01316 break;
01317
01318 if (Hit->ClientHandle == CLIENT_NULL_HANDLE) // Will not find ACTORS!
01319 continue;
01320
01321 if (GenVSI_IsClientBot(VSI, Hit->ClientHandle))
01322 {
01323 HBot = Hit->userData;
01324 if (HBot)
01325 {
01326 //assert(HBot);
01327
01328 if (HBot->TgtPlayer == Player)
01329 {
01330 HBot->TgtPlayer = NULL;
01331 }
01332 }
01333 }
01334 }
01335
01336 Player = (GPlayer*)PlayerData;
01337 DBot = Player->userData;
01338 assert(DBot);
01339
01340 assert(DBot->TrackStack.Data);
01341 geRam_Free(DBot->TrackStack.Data);
01342
01343 geRam_Free(Player->userData);
01344 Player->userData = NULL;
01345
01346 return GE_TRUE;
01347 }
|
|
||||||||||||||||
|
Definition at line 2934 of file bot.c. References Bot_Var::Action, ACTOR_MOTION_PLAYER_DIE, ACTOR_MOTION_PLAYER_RUN, AnimatePlayer(), Bot_ClearTrack(), Bot_Control(), Bot_InitGenericMove(), Bot_ModeChange(), BOT_RUN_SPEED, Bot_Var::BotTgtPicked, GPlayer::Control, GPlayer::FrameTime, FX_EXPLODE2, GE_FALSE, GE_TRUE, geBoolean, GenVSI_SpawnFx(), GetBotMatchSpawn(), geVec3d_Clear(), MODE_WANDER, GPlayer::MotionIndex, Bot_Var::PickTimeout, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerPhysics(), PSTATE_Normal, GPlayer::Roll, Bot_Var::RunSpeed, SetupPlayerXForm(), SOUND_INDEX_PLAYER_SPAWN, StackReset(), GPlayer::State, Bot_Var::TgtPos, Bot_Var::TimeSinceTrack, Bot_Var::TrackStack, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, VIEW_TYPE_FORCE_XFORM, GPlayer::ViewFlags, GPlayer::ViewIndex, and GPlayer::XForm. Referenced by KillPlayer().
02935 {
02936 GPlayer *Player;
02937 Bot_Var *DBot;
02938 static float WaitTime = 0.0f;
02939
02940 Player = (GPlayer*)PlayerData;
02941 DBot = (Bot_Var*)Player->userData;
02942
02943 Player->MotionIndex = ACTOR_MOTION_PLAYER_DIE;
02944 AnimatePlayer(VSI, Player, Player->MotionIndex, Time, GE_FALSE);
02945
02946 Player->Roll -= 2.0f*Time;
02947
02948 if (Player->Roll < -(3.14159f/2.0f))
02949 {
02950 Player->Roll = -(3.14159f/2.0f);
02951
02952 WaitTime += Time;
02953
02954 if (WaitTime > 3.0f)
02955 {
02956 GPlayer *DMStart;
02957
02958 DMStart = (GPlayer*)GetBotMatchSpawn(VSI);
02959
02960 Player->Roll = 0.0f; // Make him stand right side up again
02961 Player->Control = Bot_Control;
02962 Player->ViewIndex = 0;
02963 Player->MotionIndex = ACTOR_MOTION_PLAYER_RUN;
02964 Player->FrameTime = 0.0f;
02965 geVec3d_Clear(&Player->Velocity);
02966 geVec3d_Clear(&DBot->TgtPos);
02967 Bot_ClearTrack(VSI, Player);
02968 StackReset(&DBot->TrackStack);
02969 DBot->Action = Bot_InitGenericMove;
02970 DBot->PickTimeout = 0.0f;
02971 DBot->TimeSinceTrack = 0.0f;
02972 DBot->BotTgtPicked = 0;
02973 Bot_ModeChange(VSI, Player, MODE_WANDER, GE_TRUE, Time);
02974 DBot->RunSpeed = BOT_RUN_SPEED;
02975 Player->State = PSTATE_Normal; // Back to normal now...
02976
02977 Player->ViewFlags &= ~VIEW_TYPE_FORCE_XFORM;
02978
02979 Player->XForm = DMStart->XForm;
02980 GenVSI_SpawnFx(VSI, FX_EXPLODE2, &Player->XForm.Translation, SOUND_INDEX_PLAYER_SPAWN);
02981
02982 return GE_TRUE;
02983 }
02984 }
02985 else
02986 {
02987 WaitTime = 0.0f;
02988 }
02989
02990 SetupPlayerXForm(VSI, Player, Time);
02991
02992 PlayerPhysics(VSI, Player, PLAYER_GROUND_FRICTION, PLAYER_AIR_FRICTION, PLAYER_LIQUID_FRICTION, PLAYER_GRAVITY, 1.0f, GE_FALSE, Time);
02993
02994 return GE_TRUE;
02995 }
|
|
||||||||||||||||||||||||
|
Definition at line 2769 of file bot.c. References Bot_CanSeePointToPoint(), GPlayer::ClassName, GenVSI_GetNextPlayer(), GenVSI_GetWorld(), geVec3d_DistanceBetween(), GenVSI::Mode, MODE_Server, NULL, GPlayer::Pos, Pos2, geXForm3d::Translation, GPlayer::ViewIndex, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_TrackAction(), and Bot_ValidateTrackPoints().
02770 {
02771 GPlayer *Hit;
02772 geVec3d Pos2;
02773 float Dist, NearDist = 999999.0f;
02774 geWorld *World;
02775 int i;
02776 GPlayer *FoundPlayerCanSeeNearDist;
02777
02778 if (VSI->Mode != MODE_Server)
02779 return NULL;
02780
02781 FoundPlayerCanSeeNearDist = NULL;
02782
02783 World = GenVSI_GetWorld(VSI);
02784
02785 Hit = NULL;
02786 while (1)
02787 {
02788 Hit = GenVSI_GetNextPlayer(VSI, Hit, NULL);
02789
02790 if (!Hit)
02791 break;
02792
02793 if (Hit->ViewIndex == 0xffff)
02794 continue;
02795
02796 if (fabs(Pos->Y - Hit->Pos.Y) > YDiff)
02797 continue;
02798
02799 for (i=0; ClassList[i]; i++)
02800 {
02801 if (strcmp(ClassList[i], Hit->ClassName) == 0)
02802 break;
02803 }
02804
02805 if (!ClassList[i])
02806 continue;
02807
02808 Pos2 = Hit->XForm.Translation;
02809
02810 Dist = geVec3d_DistanceBetween(Pos, &Pos2);
02811
02812 if (Dist > Range)
02813 continue;
02814
02815 if (Dist < NearDist)
02816 {
02817 if (Bot_CanSeePointToPoint(World, Pos, &Pos2))
02818 {
02819 FoundPlayerCanSeeNearDist = Hit;
02820 }
02821 }
02822 }
02823
02824 if (FoundPlayerCanSeeNearDist)
02825 return FoundPlayerCanSeeNearDist;
02826
02827 return NULL;
02828 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 3821 of file bot.c. References BOT_DIR_AWAY, BOT_DIR_NONE, BOT_DIR_TOWARD, Bot_MoveScan(), Bot_OverLedgeScan(), GE_FALSE, GE_TRUE, geBoolean, geVec3d_Add(), geVec3d_DistanceBetween(), geVec3d_Length(), geVec3d_Normalize(), geVec3d_Scale(), geVec3d_Subtract(), PI_2, RandomRange(), Bot_Var::TgtPos, geXForm3d::Translation, GPlayer::userData, VectorRotateY(), geVec3d::X, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_Reposition().
03822 {
03823 GPlayer *Player;
03824 Bot_Var *DBot;
03825
03826 static float toward_angle_delta[4][10] =
03827 {
03828 { -28.0f, -68.0f, 28.0f, 68.0f, -45.0f, 45.0f, -90.0f, 90.0f, -999.0f},
03829 //{ 0.0f, -28.0f, -68.0f, 28.0f, 68.0f, -45.0f, 45.0f, -90.0f, 90.0f, -999}.0f, // This is pretty good for circle strafing
03830 { -18.0f, -28.0f, 18.0f, 28.0f, -45.0f, 45.0f, -90.0f, 90.0f, -999.0f},
03831 { 28.0f, 68.0f, -28.0f, -68.0f, 45.0f, -45.0f, 90.0f, -90.0f, -999.0f},
03832 { 18.0f, 28.0f, -18.0f, -28.0f, 45.0f, -45.0f, 90.0f, -90.0f, -999.0f}
03833 };
03834
03835 static float away_angle_delta[4][10] =
03836 {
03837 //{ 180.0f, 135.0f, -112.0f, 112.0f, -157.0f, 157.0f, 180.0f, 45.0f, -45.0f, -999}.0f,
03838 { -135.0f, 135.0f, -112.0f, 112.0f, -157.0f, 157.0f, 180.0f, -999.0f},
03839 { 135.0f, -135.0f, 112.0f, -112.0f, -157.0f, 157.0f, 180.0f, -999.0f},
03840 { 157.0f, -157.0f, -135.0f, 135.0f, -112.0f, 112.0f, 180.0f, -999.0f},
03841 { 157.0f, -157.0f, 135.0f, -135.0f, 112.0f, -112.0f, 180.0f, -999.0f}
03842 };
03843
03844 static float evade_angle_delta[4][8] =
03845 {
03846 { 90.0f, -90.0f, -112.0f, 112.0f, -68.0f, 68.0f, 45.0f, -999.0f},
03847 { -90.0f, 90.0f, 68.0f, -68.0f, -112.0f, 112.0f, 135.0f, -999.0f},
03848 { 68.0f, -68.0f, -112.0f, 112.0f, -90.0f, 90.0f, 45.0f, -999.0f},
03849 { 68.0f, 90.0f, -68.0f, -90.0f, 112.0f, -112.0f, 135.0f, -999.0f}
03850 };
03851
03852 float *adp;
03853
03854 geBoolean ret;
03855 geBoolean found = GE_FALSE;
03856
03857 float dist;
03858 // start out with mininum distance that will be accepted as a move
03859 float save_dist = 25.0f;
03860
03861 geVec3d Vec2Tgt;
03862 geVec3d Pos, TgtPos;
03863 geVec3d vec_dir, stop_pos, save_stop_pos;
03864 float Dist2TgtPos,NewDist2TgtPos;
03865
03866 Player = (GPlayer*)PlayerData;
03867 DBot = (Bot_Var*)Player->userData;
03868
03869 Pos = Player->XForm.Translation;
03870 TgtPos = *TargetPos;
03871 Dist2TgtPos = geVec3d_DistanceBetween(&TgtPos, &Pos);
03872
03873 save_dist = Dist2TgtPos;
03874
03875 // Find vector to the player
03876 geVec3d_Subtract(&TgtPos, &Pos, &Vec2Tgt);
03877 Vec2Tgt.Y = 0.0f;
03878 if (geVec3d_Length(&Vec2Tgt) == 0)
03879 Vec2Tgt.X = 1.0f;
03880
03881 // choose a random angle array
03882 if (dir == BOT_DIR_TOWARD)
03883 adp = &toward_angle_delta[RandomRange(4)][0];
03884 else
03885 if (dir == BOT_DIR_AWAY)
03886 adp = &away_angle_delta[RandomRange(4)][0];
03887 else
03888 if (dir == BOT_DIR_NONE)
03889 {
03890 adp = &evade_angle_delta[RandomRange(4)][0];
03891 save_dist = 20.0f;
03892 }
03893
03894 for (; *adp != -999; adp++)
03895 {
03896 Vec2Tgt.Y = 0.0f;
03897 VectorRotateY(&Vec2Tgt, (*adp * (PI_2/360)), &vec_dir);
03898 vec_dir.Y = 0.0f;
03899 geVec3d_Normalize(&vec_dir);
03900
03901 // check to see how far we can move
03902 ret = Bot_MoveScan(VSI, Player, &vec_dir, DistToMove, &stop_pos);
03903
03904 NewDist2TgtPos = geVec3d_DistanceBetween(&TgtPos, &stop_pos);
03905
03906 dist = geVec3d_DistanceBetween(&Pos, &stop_pos);
03907
03908 // hit something really close
03909 if (dist < 25.0f)
03910 continue;
03911
03912 if (Bot_OverLedgeScan(VSI, Player, &Pos, &stop_pos, &stop_pos))
03913 {
03914 dist = geVec3d_DistanceBetween(&Pos, &stop_pos);
03915 // hit something really close
03916 if (dist < 25.0f)
03917 continue;
03918 }
03919
03920 if (dir == BOT_DIR_TOWARD)
03921 {
03922 if (NewDist2TgtPos < save_dist)
03923 {
03924 save_stop_pos = stop_pos;
03925 *save_vec = vec_dir;
03926 save_dist = dist;
03927 found = GE_TRUE;
03928 }
03929 }
03930 else
03931 if (dir == BOT_DIR_AWAY)
03932 {
03933 if (NewDist2TgtPos > save_dist)
03934 {
03935 save_stop_pos = stop_pos;
03936 *save_vec = vec_dir;
03937 save_dist = dist;
03938 found = GE_TRUE;
03939 }
03940 }
03941 else
03942 if (dir == BOT_DIR_NONE)
03943 {
03944 if (dist > save_dist)
03945 {
03946 save_stop_pos = stop_pos;
03947 *save_vec = vec_dir;
03948 save_dist = dist;
03949 found = GE_TRUE;
03950 }
03951 }
03952
03953 if (ret == GE_FALSE)
03954 {
03955 // cleanly moved in new direction without hitting something
03956 save_stop_pos = stop_pos;
03957 found = GE_TRUE;
03958 break;
03959 }
03960 }
03961
03962 if (found)
03963 {
03964 geVec3d Vec2Point;
03965
03966 // gimme the actual vector to the stop point
03967 geVec3d_Subtract(&save_stop_pos, &Pos, &Vec2Point);
03968 Vec2Point.Y = 0.0f;
03969
03970 // scale it so that its a little shorter and find new stop point
03971 geVec3d_Scale(&Vec2Point, 0.8f, &Vec2Point);
03972 geVec3d_Add(&Pos, &Vec2Point, &save_stop_pos);
03973
03974 DBot->TgtPos = save_stop_pos;
03975
03976 return(GE_TRUE);
03977 }
03978
03979 return(GE_FALSE);
03980 }
|
|
||||||||||||||||
|
Definition at line 2834 of file bot.c. References GPlayer::ClassName, GenVSI_GetNextPlayer(), GenVSI_GetWorld(), geVec3d_DistanceBetween(), GenVSI::Mode, MODE_Server, NULL, Pos2, RandomRange(), geXForm3d::Translation, GPlayer::ViewIndex, and GPlayer::XForm. Referenced by Bot_ModeThinkFindPlayerQuick(), Bot_ModeThinkRetreat(), and Bot_ModeThinkWander().
02835 {
02836 GPlayer *Hit;
02837 geVec3d Pos2;
02838 float Dist, NearDist = 999999.0f;
02839 geWorld *World;
02840 int i,GoalCount;
02841 GPlayer *FoundPlayerCanSeeNearDist;
02842 static GPlayer *GoalList[300];
02843
02844 if (VSI->Mode != MODE_Server)
02845 return NULL;
02846
02847 FoundPlayerCanSeeNearDist = NULL;
02848
02849 World = GenVSI_GetWorld(VSI);
02850
02851 GoalCount = 0;
02852 Hit = NULL;
02853 while (1)
02854 {
02855 Hit = GenVSI_GetNextPlayer(VSI, Hit, NULL);
02856
02857 if (!Hit)
02858 break;
02859
02860 if (Hit->ViewIndex == 0xffff)
02861 continue;
02862
02863 for (i=0; ClassList[i]; i++)
02864 {
02865 if (strcmp(ClassList[i], Hit->ClassName) == 0)
02866 break;
02867 }
02868
02869 if (!ClassList[i])
02870 continue;
02871
02872 Pos2 = Hit->XForm.Translation;
02873 Dist = geVec3d_DistanceBetween(Pos, &Pos2);
02874
02875 if (Dist < 2000)
02876 continue;
02877
02878 GoalList[GoalCount++] = Hit;
02879 if ( GoalCount >= sizeof(GoalList)/sizeof(GoalList[0]) )
02880 break;
02881
02882 }
02883
02884 if (!GoalCount)
02885 return NULL;
02886
02887 return(GoalList[RandomRange(GoalCount)]);
02888 }
|
|
||||||||||||||||
|
Definition at line 2894 of file bot.c. References NULL, RandomRange(), t, and Track_GetNextTrack(). Referenced by Bot_ModeThinkWander().
02895 {
02896 int i,GoalCount;
02897 static Track *GoalList[300];
02898 Track *t;
02899
02900 GoalCount = 0;
02901 t = NULL;
02902 while (1)
02903 {
02904 t = Track_GetNextTrack(t);
02905
02906 if (!t)
02907 break;
02908
02909 for (i=0; TrackTypeList[i] >= 0; i++)
02910 {
02911 if (t->Type == TrackTypeList[i])
02912 break;
02913 }
02914
02915 if (TrackTypeList[i] <= -1)
02916 continue;
02917
02918 GoalList[GoalCount++] = t;
02919 if ( GoalCount >= sizeof(GoalList)/sizeof(GoalList[0]) )
02920 break;
02921
02922 }
02923
02924 if (!GoalCount)
02925 return NULL;
02926
02927 return(GoalList[RandomRange(GoalCount)]);
02928 }
|
|
||||||||||||||||
|
Definition at line 5341 of file bot.c. References Bot_ValidateTrackPoints(), GE_FALSE, GenVSI_GetWorld(), Bot_Var::GoalPos, NULL, Bot_Var::PastFirstTrackPoint, StackPush(), StackTop(), Track_ClearTrack(), Track_FindTrack(), Bot_Var::TrackInfo, TrackData::TrackNdx, Bot_Var::TrackStack, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), and Bot_InitHide().
05342 {
05343 Track *track;
05344 TrackData TrackInfo;
05345
05346 geVec3d Pos, TgtPos;
05347 GPlayer *Player;
05348 Bot_Var *DBot;
05349
05350 geWorld *World;
05351
05352 World = GenVSI_GetWorld(VSI);
05353
05354 Player = (GPlayer*)PlayerData;
05355 assert(Player);
05356 DBot = (Bot_Var*)Player->userData;
05357
05358 Pos = Player->XForm.Translation;
05359 TgtPos = DBot->GoalPos;
05360
05361 Track_ClearTrack(&TrackInfo);
05362 while (1)
05363 {
05364 track = Track_FindTrack(VSI, &Pos, &TgtPos, 0, TrackArr, &TrackInfo);
05365
05366 if (!track)
05367 break;
05368
05369 if (Bot_ValidateTrackPoints(VSI, Player, track))
05370 {
05371 // can't add the same track!
05372 if (StackTop(&DBot->TrackStack) == TrackInfo.TrackNdx)
05373 continue;
05374
05375 DBot->TrackInfo = TrackInfo;
05376 StackPush(&DBot->TrackStack, DBot->TrackInfo.TrackNdx);
05377 DBot->PastFirstTrackPoint = GE_FALSE;
05378 return (track);
05379 }
05380 }
05381
05382 return (NULL);
05383 }
|
|
||||||||||||||||
|
Definition at line 5121 of file bot.c. References BOT_DIR_AWAY, BOT_DIR_NONE, BOT_DIR_TOWARD, BOT_SEARCH_Y_RANGE, Bot_ValidateTrackPoints(), Bot_Var::Dir, GE_FALSE, GenVSI_GetWorld(), Bot_Var::GoalPos, int32, NULL, Bot_Var::PastFirstTrackPoint, StackPush(), StackTop(), Track_ClearTrack(), Track_FindTrack(), TRACK_TYPE_DOWN, TRACK_TYPE_ELEVATOR_DOWN, TRACK_TYPE_ELEVATOR_UP, TRACK_TYPE_EXIT, TRACK_TYPE_TRAVERSE, TRACK_TYPE_TRAVERSE_DOOR, TRACK_TYPE_TRAVERSE_ONEWAY, TRACK_TYPE_UP, Bot_Var::TrackInfo, TrackData::TrackNdx, Bot_Var::TrackStack, geXForm3d::Translation, type, GPlayer::userData, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_InitTrackAwayGoal(), and Bot_InitTrackToGoal().
05122 {
05123 Track *track;
05124 int32 *type;
05125 float ydiff;
05126 TrackData TrackInfo;
05127
05128 geVec3d Pos, TgtPos;
05129 GPlayer *Player;
05130 Bot_Var *DBot;
05131
05132 static int32 Away[] =
05133 {
05134 TRACK_TYPE_UP,
05135 TRACK_TYPE_DOWN,
05136 TRACK_TYPE_ELEVATOR_UP,
05137 TRACK_TYPE_ELEVATOR_DOWN,
05138 TRACK_TYPE_TRAVERSE,
05139 TRACK_TYPE_TRAVERSE_ONEWAY,
05140 TRACK_TYPE_EXIT,
05141 TRACK_TYPE_TRAVERSE_DOOR,
05142 -1
05143 };
05144
05145 static int32 PlayerAbove[] =
05146 {
05147 TRACK_TYPE_UP,
05148 TRACK_TYPE_ELEVATOR_UP,
05149 TRACK_TYPE_TRAVERSE,
05150 TRACK_TYPE_TRAVERSE_ONEWAY,
05151 -1
05152 };
05153
05154 static int32 PlayerBelow[] =
05155 {
05156 TRACK_TYPE_DOWN,
05157 TRACK_TYPE_ELEVATOR_DOWN,
05158 TRACK_TYPE_TRAVERSE,
05159 TRACK_TYPE_TRAVERSE_ONEWAY,
05160 -1
05161 };
05162
05163 static int32 PlayerOnLevel[] =
05164 {
05165 TRACK_TYPE_TRAVERSE,
05166 TRACK_TYPE_TRAVERSE_ONEWAY,
05167 TRACK_TYPE_EXIT,
05168 TRACK_TYPE_TRAVERSE_DOOR,
05169 -1
05170 };
05171
05172 geWorld *World;
05173
05174 World = GenVSI_GetWorld(VSI);
05175
05176 Player = (GPlayer*)PlayerData;
05177 assert(Player);
05178 DBot = (Bot_Var*)Player->userData;
05179
05180 Pos = Player->XForm.Translation;
05181 TgtPos = DBot->GoalPos;
05182
05183 ydiff = TgtPos.Y - Pos.Y;
05184
05185 if (DBot->Dir == BOT_DIR_TOWARD)
05186 {
05187 if (fabs(ydiff) <= BOT_SEARCH_Y_RANGE)
05188 type = PlayerOnLevel;
05189 else
05190 {
05191 if (ydiff < 0.0f)
05192 type = PlayerBelow;
05193 else
05194 type = PlayerAbove;
05195 }
05196 }
05197 else
05198 if (DBot->Dir == BOT_DIR_AWAY)
05199 {
05200 type = Away;
05201 }
05202 if (DBot->Dir == BOT_DIR_NONE)
05203 {
05204 type = Away;
05205 }
05206
05207 Track_ClearTrack(&TrackInfo);
05208 while (1)
05209 {
05210 track = Track_FindTrack(VSI, &Pos, &TgtPos, DBot->Dir, type, &TrackInfo);
05211
05212 if (!track)
05213 return NULL;
05214
05215 if (Bot_ValidateTrackPoints(VSI, Player, track))
05216 {
05217 // can't add the same track!
05218 if (StackTop(&DBot->TrackStack) == TrackInfo.TrackNdx)
05219 continue;
05220
05221 DBot->TrackInfo = TrackInfo;
05222 StackPush(&DBot->TrackStack, DBot->TrackInfo.TrackNdx);
05223 DBot->PastFirstTrackPoint = GE_FALSE;
05224
05225 return (track);
05226 }
05227 }
05228
05229 return NULL;
05230 }
|
|
||||||||||||
|
Definition at line 5719 of file bot.c. References Bot_InitMoveToPoint(), GE_FALSE, GE_TRUE, geBoolean, Bot_Var::GoalPos, int32, Bot_Var::PastFirstTrackPoint, TrackPt::Pos, StackIsEmpty(), StackPop(), StackTop(), Bot_Var::TgtPlayer, Track_ClearTrack(), Track_GetPoint(), Track_NextMultiTrack(), Bot_Var::TrackInfo, Bot_Var::TrackStack, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_MoveToPoint().
05720 {
05721 Bot_Var *DBot;
05722 GPlayer *Player;
05723 int32 NewTrack;
05724
05725 Player = (GPlayer*)PlayerData;
05726 assert(Player);
05727 DBot = (Bot_Var*)Player->userData;
05728 assert(DBot);
05729
05730 Track_ClearTrack(&DBot->TrackInfo);
05731
05732 StackPop(&DBot->TrackStack);
05733 if (!StackIsEmpty(&DBot->TrackStack))
05734 {
05735 NewTrack = StackTop(&DBot->TrackStack);
05736 Track_NextMultiTrack(VSI, &Player->XForm.Translation, NewTrack, &DBot->TrackInfo);
05737 DBot->PastFirstTrackPoint = GE_FALSE;
05738 // now on track
05739 // set goal to next point
05740 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
05741 Bot_InitMoveToPoint(VSI, Player, &DBot->GoalPos);
05742 }
05743 else
05744 {
05745 DBot->GoalPos = DBot->TgtPlayer->XForm.Translation;
05746 }
05747
05748 return GE_TRUE;
05749 }
|
|
||||||||||||||||
|
Definition at line 2255 of file bot.c. References GPlayer::CurrentWeapon, FireBlaster(), FireGrenade(), FireRocket(), FireShredder(), GE_FALSE, GE_TRUE, geBoolean, GenVSI_GetTime(), GPlayer::NextWeaponTime, and ValidateWeapon(). Referenced by Bot_Shoot(), and Bot_ShootPoint().
02256 {
02257 GPlayer *Player;
02258
02259 assert(PlayerData);
02260
02261 Player = (GPlayer*)PlayerData;
02262
02263 if (GenVSI_GetTime(VSI) < Player->NextWeaponTime)
02264 return GE_FALSE;
02265
02266 ValidateWeapon(VSI, PlayerData);
02267
02268 switch (Player->CurrentWeapon)
02269 {
02270 case 0:
02271 FireBlaster(VSI, Player, Time);
02272 Player->NextWeaponTime += 0.4f;
02273 break;
02274 case 1:
02275 FireGrenade(VSI, Player, Time);
02276 Player->NextWeaponTime += 0.4f;
02277 break;
02278 case 2:
02279 FireRocket(VSI, Player, Time);
02280 Player->NextWeaponTime += 0.4f;
02281 break;
02282 case 3:
02283 FireShredder(VSI, Player, Time);
02284 Player->NextWeaponTime += 0.1f;
02285 break;
02286 }
02287
02288 return GE_TRUE;
02289 }
|
|
||||||||||||
|
Definition at line 4812 of file bot.c. References GE_FALSE, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), GenVSI_GetWorld(), geWorld_GetEntitySet(), NULL, and BotActorStart::Ptr. Referenced by Bot_ActorDying().
04813 {
04814 geEntity_EntitySet *ClassSet;
04815 geEntity *Entity;
04816 BotActorStart *Bs;
04817 GPlayer *Player;
04818 geWorld *World;
04819
04820 Player = (GPlayer*)PlayerData;
04821
04822 World = GenVSI_GetWorld(VSI);
04823 assert(World);
04824
04825 // Look for the class name in the world
04826 ClassSet = geWorld_GetEntitySet(World, "BotActorStart");
04827 if (!ClassSet)
04828 return GE_FALSE;
04829
04830 Entity = NULL;
04831
04832 while (1)
04833 {
04834 Entity = geEntity_EntitySetGetNextEntity(ClassSet, Entity);
04835
04836 if (!Entity)
04837 break;
04838
04839 Bs = (BotActorStart*)geEntity_GetUserData(Entity);
04840
04841 if ((GPlayer*)Bs->Ptr == Player)
04842 {
04843 return(Bs);
04844 }
04845 }
04846
04847 return(NULL);
04848
04849 }
|
|
||||||||||||||||
|
Definition at line 2424 of file bot.c. References GE_Contents::Actor, GE_Contents::Contents, CONTENTS_LAVA, CONTENTS_WATER, DammagePlayer(), GE_COLLIDE_ACTORS, GE_COLLIDE_MODELS, GE_TRUE, geBoolean, GenVSI_ActorToPlayer(), GenVSI_GetWorld(), geWorld_GetContents(), geWorld_ModelGetUserData(), int32, GPlayer::Maxs, GPlayer::Mins, GenVSI::Mode, MODE_Server, GE_Contents::Model, NULL, CData::Player, PlayerDead(), PlayerLiquid(), PSTATE_InLava, PSTATE_InWater, PSTATE_Normal, GPlayer::Roll, SelfCollisionCB(), GPlayer::State, geXForm3d::Translation, GPlayer::Trigger, uint32, GPlayer::userData, VIEW_TYPE_TOUCH, GPlayer::ViewFlags, CData::VSI, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z. Referenced by Bot_Jump(), Bot_MoveFree(), Bot_MoveToPoint(), Bot_ShootPoint(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WaitForPlayer(), and Bot_WeaponJump().
02425 {
02426 GE_Contents Contents;
02427 geVec3d CMins, CMaxs;
02428 GPlayer *Player;
02429 Bot_Var *DBot;
02430 uint32 ColFlags;
02431 geWorld *World;
02432 CData Data;
02433 geBoolean SelfCollisionCB(geWorld_Model *Model, geActor *Actor, void *Context);
02434
02435 World = GenVSI_GetWorld(VSI);
02436
02437 #define ALL_BUT_SELF (0xffffffff & ~(1<<0))
02438
02439 assert(World);
02440
02441 Player = (GPlayer*)PlayerData;
02442 DBot = (Bot_Var*)Player->userData;
02443
02444 ColFlags = GE_COLLIDE_MODELS;
02445
02446 if (VSI->Mode == MODE_Server) // Only do this stuff when we are in server mode...
02447 {
02448 if (!PlayerDead(Player) && Player->Roll > 0.0f)
02449 Player->Roll -= Time;
02450
02451 if (geWorld_GetContents(World, &Player->XForm.Translation, &Player->Mins, &Player->Maxs, GE_COLLIDE_MODELS, 0, NULL, NULL, &Contents))
02452 {
02453 // Check to see if player is in lava...
02454 if (Contents.Contents & CONTENTS_WATER)
02455 {
02456 Player->State = PSTATE_InWater;
02457 }
02458
02459 if (Contents.Contents & CONTENTS_LAVA)
02460 {
02461 if (Player->Roll <= 0.0f)
02462 {
02463 DammagePlayer(VSI, NULL, Player, 20, 0.0f, Time);
02464 Player->Roll = 0.5f;
02465 }
02466
02467 Player->State = PSTATE_InLava;
02468 }
02469 }
02470 else if (PlayerLiquid(Player))
02471 Player->State = PSTATE_Normal;
02472
02473 // Get a box a little bigger than the player for doors, etc...
02474 CMins = Player->Mins;
02475 CMaxs = Player->Maxs;
02476
02477 CMins.X -= 100;
02478 CMins.Y -= 10;
02479 CMins.Z -= 100;
02480 CMaxs.X += 100;
02481 CMaxs.Y += 10;
02482 CMaxs.Z += 100;
02483
02484 if (geWorld_GetContents(World, &Player->XForm.Translation, &CMins, &CMaxs, GE_COLLIDE_MODELS, 0, NULL, NULL, &Contents))
02485 {
02486 if (Contents.Model)
02487 {
02488 GPlayer *TPlayer;
02489
02490 TPlayer = (GPlayer*)geWorld_ModelGetUserData(Contents.Model);
02491
02492 if (TPlayer && TPlayer->Trigger && TPlayer->ViewFlags & VIEW_TYPE_TOUCH)
02493 {
02494 TPlayer->Trigger(VSI, TPlayer, Player, NULL);
02495 }
02496 }
02497 }
02498
02499
02500 Data.VSI = VSI;
02501 Data.Player = Player;
02502
02503 if (geWorld_GetContents(World, &Player->XForm.Translation, &CMins, &CMaxs, GE_COLLIDE_ACTORS, 0xffffffff, SelfCollisionCB, &Data, &Contents))
02504 {
02505
02506 if (Contents.Actor)
02507 {
02508 GPlayer *TPlayer;
02509 static int32 HackV;
02510
02511 TPlayer = (GPlayer*)GenVSI_ActorToPlayer(VSI, Contents.Actor);
02512
02513 if (TPlayer && TPlayer->Trigger)
02514 {
02515 TPlayer->Trigger(VSI, TPlayer, Player, NULL);
02516 }
02517 }
02518 }
02519
02520 }
02521
02522
02523
02524 return GE_TRUE;
02525 }
|
|
||||||||||||
|
Definition at line 5042 of file bot.c. References CLOSE_RANGE, CLOSE_RANGE_DIST, geVec3d_DistanceBetween(), int32, LONG_RANGE, MED_RANGE, MED_RANGE_DIST, Bot_Var::TgtPlayer, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_GetRank(), and Bot_ModeChange().
05043 {
05044 int32 index;
05045 GPlayer *Player;
05046 Bot_Var *DBot;
05047 float Dist;
05048
05049 Player = (GPlayer*)PlayerData;
05050 DBot = (Bot_Var*)Player->userData;
05051
05052 Dist = geVec3d_DistanceBetween(&Player->XForm.Translation, &DBot->TgtPlayer->XForm.Translation);
05053
05054 if (Dist <= CLOSE_RANGE_DIST)
05055 index = CLOSE_RANGE;
05056 else
05057 if (Dist <= MED_RANGE_DIST)
05058 index = MED_RANGE;
05059 else
05060 index = LONG_RANGE;
05061
05062 return index;
05063 }
|
|
||||||||||||
|
Definition at line 5096 of file bot.c. References Bot_GetRangeIndex(), Bot_GetStrengthIndex(), int32, and RankTable. Referenced by Bot_ModeThinkAttack(), and Bot_ModeThinkCrowdPlayer().
05097 {
05098 int32 RNdx,SNdx,Rank;
05099 GPlayer *Player;
05100
05101 Player = (GPlayer*)PlayerData;
05102
05103 RNdx = Bot_GetRangeIndex(VSI, Player);
05104 SNdx = Bot_GetStrengthIndex(VSI, Player);
05105 Rank = RankTable[RNdx][SNdx];
05106
05107 return Rank;
05108 }
|
|
||||||||||||
|
Definition at line 5068 of file bot.c. References Bot_CompareWeapons(), BOT_STRENGTH_HIGH, BOT_STRENGTH_LOW, GPlayer::Health, Bot_Var::HealthDiff, int32, Bot_Var::TgtPlayer, GPlayer::userData, and Bot_Var::WeaponDiff. Referenced by Bot_GetRank(), and Bot_ModeChange().
05069 {
05070 int32 index;
05071 GPlayer *Player;
05072 Bot_Var *DBot;
05073
05074 Player = (GPlayer*)PlayerData;
05075 DBot = (Bot_Var*)Player->userData;
05076
05077 // health assessment
05078 DBot->HealthDiff = Player->Health - DBot->TgtPlayer->Health;
05079 // weapon assessment
05080 DBot->WeaponDiff = Bot_CompareWeapons(VSI, Player, DBot->TgtPlayer);
05081
05082 if (BOT_STRENGTH_HIGH(DBot->HealthDiff, DBot->WeaponDiff))
05083 index = 2;
05084 else
05085 if (BOT_STRENGTH_LOW(DBot->HealthDiff, DBot->WeaponDiff))
05086 index = 0;
05087 else
05088 index = 1;
05089
05090 return index;
05091 }
|
|
||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 1531 of file bot.c. References Bot_Var::Action, Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, Track_OnTrack(), Bot_Var::TrackInfo, and GPlayer::userData. Referenced by Bot_ActorDying(), Bot_Dying(), Bot_Jump(), Bot_ShootPoint(), Bot_WaitForEntityDist(), Bot_WaitForEntityVisible(), Bot_WaitForPlayer(), and Bot_WeaponJump().
01532 {
01533 GPlayer *Player;
01534 Bot_Var *DBot;
01535
01536 Player = (GPlayer*)PlayerData;
01537 assert(Player);
01538 DBot = (Bot_Var*)Player->userData;
01539
01540 // if still on a track
01541 if (Track_OnTrack(&DBot->TrackInfo))
01542 {
01543 // continue on the track
01544 DBot->Action = Bot_MoveToPoint;
01545 return GE_TRUE;
01546 }
01547
01548 Bot_Reposition(VSI, Player, &DBot->GoalPos, DBot->Dir);
01549 DBot->Action = Bot_MoveToPoint;
01550
01551 return GE_TRUE;
01552 }
|
|
||||||||||||||||
|
Definition at line 1649 of file bot.c. References BOT_DIR_NONE, Bot_FindTrack(), Bot_InitMoveToPoint(), Bot_Var::Dir, GE_FALSE, GE_TRUE, geBoolean, Bot_Var::GoalPos, HideTrackList, TrackPt::Pos, Track_GetPoint(), Bot_Var::TrackInfo, and GPlayer::userData. Referenced by Bot_ModeThinkFindPlayer(), Bot_ModeThinkFindPlayerQuick(), and Bot_ModeThinkRetreat().
01650 {
01651 GPlayer *Player;
01652 Bot_Var *DBot;
01653
01654 Player = PlayerData;
01655 DBot = Player->userData;
01656
01657 DBot->Dir = BOT_DIR_NONE;
01658
01659 if (Bot_FindTrack(VSI, Player, HideTrackList))
01660 {
01661 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
01662 Bot_InitMoveToPoint(VSI, PlayerData, &DBot->GoalPos);
01663 Bot_InitMoveToPoint(VSI, Player, Track_GetPoint(&DBot->TrackInfo)->Pos);
01664 return GE_TRUE;
01665 }
01666
01667 return GE_FALSE;
01668 }
|
|
||||||||||||||||
|
Definition at line 1718 of file bot.c. References Bot_Var::Action, BOT_DIR_NONE, Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, and GPlayer::userData. Referenced by Bot_ModeThinkAttack().
01719 {
01720 GPlayer *Player;
01721 Bot_Var *DBot;
01722
01723 Player = (GPlayer*)PlayerData;
01724 assert(Player);
01725 DBot = (Bot_Var*)Player->userData;
01726
01727 DBot->Dir = BOT_DIR_NONE;
01728
01729 Bot_Reposition(VSI, PlayerData, &DBot->GoalPos, DBot->Dir);
01730 DBot->Action = Bot_MoveToPoint;
01731
01732 return GE_TRUE;
01733 }
|
|
||||||||||||||||
|
Definition at line 1674 of file bot.c. References Bot_Var::Action, BOT_DIR_AWAY, Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, and GPlayer::userData. Referenced by Bot_ModeThinkAttack().
01675 {
01676 GPlayer *Player;
01677 Bot_Var *DBot;
01678
01679 Player = (GPlayer*)PlayerData;
01680 assert(Player);
01681 DBot = (Bot_Var*)Player->userData;
01682
01683 DBot->Dir = BOT_DIR_AWAY;
01684
01685 Bot_Reposition(VSI, PlayerData, &DBot->GoalPos, DBot->Dir);
01686 DBot->Action = Bot_MoveToPoint;
01687
01688 return GE_TRUE;
01689 }
|
|
||||||||||||||||
|
Definition at line 1557 of file bot.c. References Bot_Var::Action, BOT_DIR_TOWARD, Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, and GPlayer::userData.
01558 {
01559 GPlayer *Player;
01560 Bot_Var *DBot;
01561
01562 Player = (GPlayer*)PlayerData;
01563 assert(Player);
01564 DBot = (Bot_Var*)Player->userData;
01565
01566 DBot->Dir = BOT_DIR_TOWARD;
01567
01568 Bot_Reposition(VSI, Player, &DBot->GoalPos, DBot->Dir);
01569 DBot->Action = Bot_MoveToPoint;
01570
01571 return GE_TRUE;
01572 }
|
|
||||||||||||||||
|
Definition at line 1508 of file bot.c. References Bot_Var::Action, Bot_MoveFree(), GE_TRUE, geBoolean, geVec3d_Normalize(), geVec3d_Subtract(), Bot_Var::MoveVec, Bot_Var::TgtPos, geXForm3d::Translation, GPlayer::userData, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_ModeThinkUnstick().
01509 {
01510 GPlayer *Player;
01511 Bot_Var *DBot;
01512
01513 Player = (GPlayer*)PlayerData;
01514 DBot = (Bot_Var*)Player->userData;
01515
01516 DBot->TgtPos = *Pos;
01517
01518 geVec3d_Subtract(&DBot->TgtPos, &Player->XForm.Translation, &DBot->MoveVec);
01519 DBot->MoveVec.Y = 0.0f;
01520 geVec3d_Normalize(&DBot->MoveVec);
01521
01522 DBot->Action = Bot_MoveFree;
01523
01524 return GE_TRUE;
01525 }
|
|
||||||||||||||||
|
Definition at line 1486 of file bot.c. References Bot_Var::Action, Bot_MoveToPoint(), GE_TRUE, geBoolean, geVec3d_Normalize(), geVec3d_Subtract(), Bot_Var::MoveVec, Bot_Var::TgtPos, geXForm3d::Translation, GPlayer::userData, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FinishTrack(), Bot_InitFindMultiTrack(), Bot_InitFindMultiTrackAway(), Bot_InitHide(), Bot_InitTrackAwayGoal(), Bot_InitTrackToGoal(), Bot_ShootPoint(), Bot_TrackAction(), Bot_WaitForEntityDist(), and Bot_WaitForEntityVisible().
01487 {
01488 GPlayer *Player;
01489 Bot_Var *DBot;
01490
01491 Player = (GPlayer*)PlayerData;
01492 DBot = (Bot_Var*)Player->userData;
01493
01494 DBot->TgtPos = *Pos;
01495
01496 geVec3d_Subtract(&DBot->TgtPos, &Player->XForm.Translation, &DBot->MoveVec);
01497 DBot->MoveVec.Y = 0.0f;
01498 geVec3d_Normalize(&DBot->MoveVec);
01499
01500 DBot->Action = Bot_MoveToPoint;
01501
01502 return GE_TRUE;
01503 }
|
|
||||||||||||||||
|
Definition at line 1695 of file bot.c. References Bot_Var::Action, BOT_DIR_AWAY, Bot_InitTrackAwayGoal(), Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, and GPlayer::userData. Referenced by Bot_ModeThinkRetreat().
01696 {
01697 GPlayer *Player;
01698 Bot_Var *DBot;
01699
01700 Player = (GPlayer*)PlayerData;
01701 assert(Player);
01702 DBot = (Bot_Var*)Player->userData;
01703
01704 DBot->Dir = BOT_DIR_AWAY;
01705
01706 if (Bot_InitTrackAwayGoal(VSI, PlayerData, Time))
01707 return GE_TRUE;
01708
01709 Bot_Reposition(VSI, PlayerData, &DBot->GoalPos, DBot->Dir);
01710 DBot->Action = Bot_MoveToPoint;
01711
01712 return GE_TRUE;
01713 }
|
|
||||||||||||||||
|
Definition at line 1577 of file bot.c. References Bot_Var::Action, BOT_DIR_TOWARD, Bot_InitTrackToGoal(), Bot_MoveToPoint(), Bot_Reposition(), Bot_Var::Dir, GE_TRUE, geBoolean, Bot_Var::GoalPos, and GPlayer::userData. Referenced by Bot_ModeThinkAttack(), Bot_ModeThinkCrowdPlayer(), Bot_ModeThinkFindPlayer(), Bot_ModeThinkFindPlayerQuick(), Bot_ModeThinkOnTrack(), and Bot_ModeThinkWanderGoal().
01578 {
01579 GPlayer *Player;
01580 Bot_Var *DBot;
01581
01582 Player = (GPlayer*)PlayerData;
01583 assert(Player);
01584 DBot = (Bot_Var*)Player->userData;
01585
01586 DBot->Dir = BOT_DIR_TOWARD;
01587
01588 if (Bot_InitTrackToGoal(VSI, PlayerData, Time))
01589 return GE_TRUE;
01590
01591 Bot_Reposition(VSI, Player, &DBot->GoalPos, DBot->Dir);
01592 DBot->Action = Bot_MoveToPoint;
01593
01594 return GE_TRUE;
01595 }
|
|
||||||||||||||||
|
Definition at line 2045 of file bot.c. References Bot_Var::Action, Bot_ShootPoint(), GE_TRUE, geBoolean, geVec3d_Clear(), GPlayer::userData, and GPlayer::Velocity. Referenced by Bot_TrackAction().
02046 {
02047 GPlayer *Player;
02048 Bot_Var *DBot;
02049
02050 Player = (GPlayer*)PlayerData;
02051 assert(Player);
02052 DBot = (Bot_Var*)Player->userData;
02053
02054 //Bot_SetupXForm(VSI, Player, &DBot->MoveVec);
02055
02056 // Stop
02057 geVec3d_Clear(&Player->Velocity);
02058
02059 DBot->Action = Bot_ShootPoint;
02060
02061 return GE_TRUE;
02062 }
|
|
||||||||||||||||
|
Definition at line 1624 of file bot.c. References BOT_DIR_AWAY, Bot_FindTrackToGoal(), Bot_InitMoveToPoint(), Bot_Var::Dir, GE_FALSE, GE_TRUE, geBoolean, Bot_Var::GoalPos, TrackPt::Pos, Track_GetPoint(), Bot_Var::TrackInfo, and GPlayer::userData. Referenced by Bot_InitRunAway().
01625 {
01626 GPlayer *Player;
01627 Bot_Var *DBot;
01628
01629 Player = (GPlayer*)PlayerData;
01630 assert(Player);
01631 DBot = (Bot_Var*)Player->userData;
01632
01633 DBot->Dir = BOT_DIR_AWAY;
01634
01635 if (Bot_FindTrackToGoal(VSI, PlayerData, Time))
01636 {
01637 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
01638 Bot_InitMoveToPoint(VSI, PlayerData, &DBot->GoalPos);
01639 return GE_TRUE;
01640 }
01641
01642 return GE_FALSE;
01643 }
|
|
||||||||||||||||
|
Definition at line 1600 of file bot.c. References BOT_DIR_TOWARD, Bot_FindTrackToGoal(), Bot_InitMoveToPoint(), Bot_Var::Dir, GE_FALSE, GE_TRUE, geBoolean, Bot_Var::GoalPos, TrackPt::Pos, Track_GetPoint(), Bot_Var::TrackInfo, and GPlayer::userData. Referenced by Bot_InitRunCloser(), and Bot_ModeThinkLedge().
01601 {
01602 GPlayer *Player;
01603 Bot_Var *DBot;
01604
01605 Player = (GPlayer*)PlayerData;
01606 assert(Player);
01607 DBot = (Bot_Var*)Player->userData;
01608
01609 DBot->Dir = BOT_DIR_TOWARD;
01610
01611 if (Bot_FindTrackToGoal(VSI, PlayerData, Time))
01612 {
01613 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
01614 Bot_InitMoveToPoint(VSI, PlayerData, &DBot->GoalPos);
01615 return GE_TRUE;
01616 }
01617
01618 return GE_FALSE;
01619 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 1883 of file bot.c. References Bot_Var::Action, Bot_SetupXForm(), Bot_WaitForEntityDist(), GE_TRUE, geBoolean, geVec3d_Clear(), GPlayer::Health, Bot_Var::HealthCheck, Bot_Var::MoveVec, GPlayer::userData, and GPlayer::Velocity. Referenced by Bot_TrackAction().
01884 {
01885 GPlayer *Player;
01886 Bot_Var *DBot;
01887
01888 Player = (GPlayer*)PlayerData;
01889 assert(Player);
01890 DBot = (Bot_Var*)Player->userData;
01891
01892 Bot_SetupXForm(VSI, Player, &DBot->MoveVec);
01893
01894 // Stop
01895 geVec3d_Clear(&Player->Velocity);
01896
01897 DBot->HealthCheck = Player->Health; // save health
01898 DBot->Action = Bot_WaitForEntityDist;
01899
01900 return GE_TRUE;
01901 }
|
|
||||||||||||||||
|
Definition at line 1797 of file bot.c. References Bot_Var::Action, Bot_SetupXForm(), Bot_WaitForEntityVisible(), GE_TRUE, geBoolean, geVec3d_Clear(), GPlayer::Health, Bot_Var::HealthCheck, Bot_Var::MoveVec, GPlayer::userData, and GPlayer::Velocity. Referenced by Bot_TrackAction().
01798 {
01799 GPlayer *Player;
01800 Bot_Var *DBot;
01801
01802 Player = (GPlayer*)PlayerData;
01803 assert(Player);
01804 DBot = (Bot_Var*)Player->userData;
01805
01806 Bot_SetupXForm(VSI, Player, &DBot->MoveVec);
01807
01808 geVec3d_Clear(&Player->Velocity); // Stop moving
01809
01810 DBot->HealthCheck = Player->Health; // save health
01811 DBot->Action = Bot_WaitForEntityVisible;
01812
01813 return GE_TRUE;
01814 }
|
|
||||||||||||||||
|
Definition at line 1739 of file bot.c. References Bot_Var::Action, Bot_SetupXForm(), Bot_WaitForPlayer(), GE_TRUE, geBoolean, geVec3d_Clear(), Bot_Var::MoveVec, GPlayer::userData, and GPlayer::Velocity. Referenced by Bot_TrackAction().
01740 {
01741 GPlayer *Player;
01742 Bot_Var *DBot;
01743
01744 Player = (GPlayer*)PlayerData;
01745 assert(Player);
01746 DBot = (Bot_Var*)Player->userData;
01747
01748 Bot_SetupXForm(VSI, Player, &DBot->MoveVec);
01749
01750 // Stop here
01751 geVec3d_Clear(&Player->Velocity);
01752
01753 DBot->Action = Bot_WaitForPlayer;
01754
01755 return GE_TRUE;
01756 }
|
|
||||||||||||||||
|
|
|
||||||||||||
|
Definition at line 4770 of file bot.c. References GE_FALSE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), GenVSI_GetWorld(), geWorld_GetEntitySet(), NULL, BotActorStart::Ptr, and BotActorStart::Respawn.
04771 {
04772 geEntity_EntitySet *ClassSet;
04773 geEntity *Entity;
04774 BotActorStart *Bs;
04775 GPlayer *Player;
04776 geWorld *World;
04777
04778 Player = (GPlayer*)PlayerData;
04779
04780 World = GenVSI_GetWorld(VSI);
04781 assert(World);
04782
04783 // Look for the class name in the world
04784 ClassSet = geWorld_GetEntitySet(World, "BotActorStart");
04785 if (!ClassSet)
04786 return GE_FALSE;
04787
04788 Entity = NULL;
04789
04790 while (1)
04791 {
04792 Entity = geEntity_EntitySetGetNextEntity(ClassSet, Entity);
04793
04794 if (!Entity)
04795 break;
04796
04797 Bs = (BotActorStart*)geEntity_GetUserData(Entity);
04798
04799 if ((GPlayer*)Bs->Ptr == Player)
04800 {
04801 return(Bs->Respawn);
04802 }
04803 }
04804
04805 return(GE_FALSE);
04806
04807 }
|
|
||||||||||||||||
|
Definition at line 2000 of file bot.c. References Bot_Animate(), Bot_GetContents(), Bot_InitGenericMove(), BOT_RUN_SPEED, Bot_SetupXForm(), GE_FALSE, GE_TRUE, geBoolean, geVec3d_AddScaled(), Bot_Var::MoveVec, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerPhysics(), PSTATE_InAir, PSTATE_Normal, Bot_Var::RunSpeed, GPlayer::State, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, GPlayer::VPos, and GPlayer::XForm. Referenced by Bot_TrackAction().
02001 {
02002 geVec3d Pos;
02003 float MoveSpeed;
02004 GPlayer *Player;
02005 Bot_Var *DBot;
02006
02007 Player = (GPlayer*)PlayerData;
02008 assert(Player);
02009 DBot = (Bot_Var*)Player->userData;
02010
02011 Bot_SetupXForm(VSI, PlayerData, &DBot->MoveVec);
02012
02013 MoveSpeed = Time;
02014
02015 if (Player->State == PSTATE_InAir)
02016 MoveSpeed *= 0.15f;
02017
02018 geVec3d_AddScaled(&Player->Velocity, &DBot->MoveVec, DBot->RunSpeed*MoveSpeed, &Player->Velocity);
02019
02020 // save off the position
02021 Pos = Player->XForm.Translation;
02022
02023 PlayerPhysics(VSI, Player, PLAYER_GROUND_FRICTION, PLAYER_AIR_FRICTION, PLAYER_LIQUID_FRICTION, PLAYER_GRAVITY, 1.0f, GE_FALSE, Time);
02024
02025 Bot_GetContents(VSI, Player, Time);
02026
02027 Bot_Animate(VSI, Player, Time);
02028
02029 Player->VPos = Player->XForm.Translation;
02030
02031 if (Player->State == PSTATE_Normal)
02032 {
02033 DBot->RunSpeed = BOT_RUN_SPEED;
02034 Bot_InitGenericMove(VSI, Player, Time);
02035 return GE_TRUE;
02036 }
02037
02038 return GE_TRUE;
02039 }
|
|
||||||||||||||||
|
Definition at line 5784 of file bot.c. References BotDebugPrint, GPlayer::ClientHandle, Bot_Var::ClientPlayer, GE_FALSE, GE_TRUE, geBoolean, GenVSI_ConsoleHeaderPrintf(), GenVSI_SetViewPlayer(), GodMode, MultiPathLight, PathLight, Bot_Var::TgtPlayer, and GPlayer::userData. Referenced by Bot_Control().
05785 {
05786 GPlayer *Player;
05787 Bot_Var *DBot;
05788
05789 Player = (GPlayer*)PlayerData;
05790 assert(Player);
05791 DBot = (Bot_Var*)Player->userData;
05792 assert(DBot);
05793
05794 if (GetAsyncKeyState('O') & 0x8000)
05795 {
05796 static geBoolean Mode = GE_FALSE;
05797 if (Mode)
05798 GenVSI_SetViewPlayer(VSI, DBot->ClientPlayer->ClientHandle, Player);
05799 else
05800 GenVSI_SetViewPlayer(VSI, DBot->ClientPlayer->ClientHandle, DBot->TgtPlayer);
05801 Mode = !Mode;
05802 }
05803
05804 if (GetAsyncKeyState('I') & 0x8000)
05805 {
05806 GodMode = !GodMode;
05807 GenVSI_ConsoleHeaderPrintf(VSI, DBot->ClientPlayer->ClientHandle, GE_TRUE, "God Mode %d", GodMode);
05808 }
05809
05810 if (GetAsyncKeyState('P') & 0x8000)
05811 {
05812 PathLight = !PathLight;
05813 GenVSI_ConsoleHeaderPrintf(VSI, DBot->ClientPlayer->ClientHandle, GE_TRUE, "Path Light %d", PathLight);
05814 }
05815
05816 if (GetAsyncKeyState('N') & 0x8000)
05817 {
05818 MultiPathLight = !MultiPathLight;
05819 GenVSI_ConsoleHeaderPrintf(VSI, DBot->ClientPlayer->ClientHandle, GE_TRUE, "Multi-Path Light %d", MultiPathLight);
05820 }
05821
05822 if (GetAsyncKeyState('D') & 0x8000)
05823 {
05824 BotDebugPrint = !BotDebugPrint;
05825 GenVSI_ConsoleHeaderPrintf(VSI, DBot->ClientPlayer->ClientHandle, GE_TRUE, "Debug Print %d", BotDebugPrint);
05826 }
05827
05828 return GE_TRUE;
05829 }
|
|
||||||||||||||||
|
Definition at line 5678 of file bot.c. References Bot_ClearTrack(), GE_FALSE, GE_TRUE, geBoolean, geVec3d_DistanceBetween(), Bot_Var::Mode, MODE_FIND_PLAYER, MODE_FIND_PLAYER_QUICK, MODE_RETREAT, MODE_RETREAT_ON_TRACK, PSTATE_InAir, GPlayer::State, Bot_Var::TgtPlayer, Bot_Var::TimeSeen, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm. Referenced by Bot_MoveToPoint().
05679 {
05680 Bot_Var *DBot;
05681 GPlayer *Player;
05682 float dist;
05683
05684 Player = (GPlayer*)PlayerData;
05685 assert(Player);
05686 DBot = (Bot_Var*)Player->userData;
05687 assert(DBot);
05688
05689 // run by when retreating
05690 if (DBot->Mode == MODE_RETREAT_ON_TRACK || DBot->Mode == MODE_RETREAT)
05691 return GE_FALSE;
05692
05693 // don't leave the track when in the air
05694 if (Player->State == PSTATE_InAir)
05695 return GE_FALSE;
05696
05697 dist = geVec3d_DistanceBetween(&Player->XForm.Translation, &DBot->TgtPlayer->XForm.Translation);
05698
05699 if ((DBot->Mode == MODE_FIND_PLAYER || DBot->Mode == MODE_FIND_PLAYER_QUICK) &&
05700 dist < 500.0f && DBot->TimeSeen > 0.0f)
05701 {
05702 Bot_ClearTrack(VSI, Player);
05703 return GE_TRUE;
05704 }
05705
05706 if (dist < 150.0f && DBot->TimeSeen > 0.0f)
05707 {
05708 Bot_ClearTrack(VSI, Player);
05709 return GE_TRUE;
05710 }
05711
05712 return GE_FALSE;
05713 }
|
|
||||||||||||
|
Definition at line 4551 of file bot.c. References BlockActor_Spawn(), Bot_ActorStart(), Bot_MatchStart(), BotDeathMatchStart, GE_TRUE, geBoolean, GenVSI_SetClassSpawn(), and NULL. Referenced by Server_Main().
04552 {
04553
04554 BotDeathMatchStart = NULL;
04555
04556 GenVSI_SetClassSpawn(VSI, "BotMatchStart", Bot_MatchStart, NULL);
04557 GenVSI_SetClassSpawn(VSI, "BotActorStart", Bot_ActorStart, NULL);
04558 GenVSI_SetClassSpawn(VSI, "BlockActor", BlockActor_Spawn, NULL);
04559
04560 return GE_TRUE;
04561 }
|
|
||||||||||||||||||||
|
Definition at line 4567 of file bot.c. References GPlayer::Blocked, GPlayer::Control, GE_TRUE, geBoolean, GenVS_Error(), geXForm3d_SetIdentity(), geXForm3d_SetTranslation(), NULL, BotMatchStart::origin, GPlayer::Time, geXForm3d::Translation, GPlayer::Trigger, GPlayer::VPos, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z. Referenced by Bot_Main().
04568 {
04569 BotMatchStart *Ps;
04570 GPlayer *Player;
04571
04572 Player = (GPlayer*)PlayerData;
04573
04574 Player->Control = NULL;
04575 Player->Trigger = NULL;
04576 Player->Blocked = NULL;
04577 Player->Time = 0.0f;
04578
04579 if (ClassData == NULL)
04580 {
04581 GenVS_Error("Bot_MatchStart: entity missing class data ('%s')\n",EntityName);
04582 }
04583
04584 Ps = (BotMatchStart*)ClassData;
04585
04586 geXForm3d_SetIdentity(&Player->XForm);
04587 geXForm3d_SetTranslation(&Player->XForm, Ps->origin.X, Ps->origin.Y, Ps->origin.Z);
04588
04589 Player->VPos = Player->XForm.Translation;
04590
04591 return GE_TRUE;
04592 }
|
|
||||||||||||||||
|
Definition at line 858 of file bot.c. References Bot_Var::FaceTgtPlayerOnRetreat, GE_TRUE, geBoolean, GPlayer::Health, Bot_Var::HealthCheck, and GPlayer::userData.
00859 {
00860 GPlayer *Player;
00861 Bot_Var *DBot;
00862
00863 Player = (GPlayer*)PlayerData;
00864 DBot = Player->userData;
00865
00866 // if hit when retreating - stand and fight like a (wo)man
00867 if (DBot->HealthCheck < Player->Health - 20)
00868 {
00869 DBot->FaceTgtPlayerOnRetreat = GE_TRUE;
00870 //Bot_ModeChange(VSI, Player, MODE_ATTACK, GE_FALSE, Time);
00871 return GE_TRUE;
00872 }
00873
00874 return GE_TRUE;
00875 }
|
|
||||||||||||||||||||||||
|
Definition at line 633 of file bot.c. References Bot_GetRangeIndex(), Bot_GetStrengthIndex(), Bot_ModeThink(), Bot_SetMode(), Bot_WeaponSetFromArray(), ChooseAction(), GE_FALSE, GE_TRUE, geBoolean, int32, MODE_ATTACK, MODE_FIND_PLAYER, MODE_FIND_PLAYER_QUICK, MODE_NULL, MODE_RETREAT, MODE_WANDER, ModeTable, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, RandomRange(), RankTable, Bot_Var::TimeNotSeen, Bot_Var::TimeSeen, GPlayer::userData, and WeaponSetRange. Referenced by Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_ActorDying(), Bot_Dying(), Bot_ModeThinkAttack(), Bot_ModeThinkCrowdPlayer(), Bot_ModeThinkFindPlayer(), Bot_ModeThinkFindPlayerQuick(), Bot_ModeThinkGoalPoint(), Bot_ModeThinkOnTrack(), Bot_ModeThinkRetreat(), Bot_ModeThinkUnstick(), Bot_ModeThinkWander(), Bot_ModeThinkWanderGoal(), Bot_MoveToPoint(), and Bot_TrackAction().
00634 {
00635 GPlayer *Player;
00636 Bot_Var *DBot;
00637 int32 *iptr;
00638 int32 Rank,RNdx,SNdx;
00639
00640 Player = (GPlayer*)PlayerData;
00641 DBot = Player->userData;
00642
00643 // Reset Mode specific timers & counters
00644 DBot->ModeTimeSeen = 0.0f;
00645 DBot->ModeTimeNotSeen = 0.0f;
00646 DBot->ModeTimeOut = 0.0f;
00647
00648 // get ranking info
00649 RNdx = Bot_GetRangeIndex(VSI, Player);
00650 SNdx = Bot_GetStrengthIndex(VSI, Player);
00651 Rank = RankTable[RNdx][SNdx];
00652
00653 Bot_WeaponSetFromArray(VSI, Player, WeaponSetRange[RNdx]);
00654
00655 // Set specific mode
00656 if (NewMode != MODE_NULL)
00657 {
00658 Bot_SetMode(Player, NewMode);
00659 if (Think)
00660 Bot_ModeThink(VSI, Player, Time);
00661 return GE_TRUE;
00662 }
00663
00664 // CAN NOT SEE
00665 if (DBot->TimeNotSeen > 10.0f)
00666 {
00667 #ifdef NEW_WANDER
00668 if (RandomRange(1000) < 500)
00669 Bot_SetMode(Player, MODE_FIND_PLAYER_QUICK);
00670 else
00671 Bot_SetMode(Player, MODE_WANDER);
00672 #else
00673 Bot_SetMode(Player, MODE_FIND_PLAYER_QUICK);
00674 #endif
00675 if (Think)
00676 Bot_ModeThink(VSI, Player, Time);
00677 return GE_TRUE;
00678 }
00679
00680 if (DBot->TimeNotSeen > 5.0f)
00681 {
00682 DECISION *dptr;
00683
00684 static DECISION d[] =
00685 {
00686 #ifdef WANDER_TEST
00687 {1000, &ModeTable[MODE_WANDER]},
00688 #else
00689 #ifdef NEW_WANDER
00690 {200, &ModeTable[MODE_FIND_PLAYER]},
00691 {500, &ModeTable[MODE_FIND_PLAYER_QUICK]},
00692 {1000, &ModeTable[MODE_WANDER]},
00693 #else
00694 {600, &ModeTable[MODE_FIND_PLAYER]},
00695 {1000, &ModeTable[MODE_FIND_PLAYER_QUICK]},
00696 #endif
00697 #endif
00698 };
00699
00700 static DECISION d2[] =
00701 {
00702 #ifdef WANDER_TEST
00703 {1000, &ModeTable[MODE_WANDER]},
00704 #else
00705 #ifdef NEW_WANDER
00706 {200, &ModeTable[MODE_FIND_PLAYER]},
00707 {900, &ModeTable[MODE_FIND_PLAYER_QUICK]},
00708 {1000, &ModeTable[MODE_WANDER]},
00709 #else
00710 {400, &ModeTable[MODE_FIND_PLAYER]},
00711 {1000, &ModeTable[MODE_FIND_PLAYER_QUICK]},
00712 #endif
00713 #endif
00714 };
00715
00716 if (Rank >= 8)
00717 dptr = d2;
00718 else
00719 dptr = d;
00720
00721 iptr = ChooseAction(dptr);
00722 Bot_SetMode(Player, *iptr);
00723
00724 if (Think)
00725 Bot_ModeThink(VSI, Player, Time);
00726 return GE_TRUE;
00727 }
00728
00729 if (DBot->TimeNotSeen > 0.0f)
00730 {
00731 static DECISION d[] =
00732 {
00733 {600, &ModeTable[MODE_FIND_PLAYER]},
00734 {1000, &ModeTable[MODE_FIND_PLAYER_QUICK]},
00735 //{1000, &ModeTable[MODE_RETREAT]},
00736 };
00737
00738 iptr = ChooseAction(d);
00739 Bot_SetMode(Player, *iptr);
00740
00741 if (Think)
00742 Bot_ModeThink(VSI, Player, Time);
00743 return GE_TRUE;
00744 }
00745
00746 // CANSEE
00747 if (DBot->TimeSeen > 15.0f)
00748 {
00749 if (Rank <= 3)
00750 Bot_SetMode(Player, MODE_RETREAT);
00751 else
00752 Bot_SetMode(Player, MODE_ATTACK);
00753
00754 if (Think)
00755 Bot_ModeThink(VSI, Player, Time);
00756 return GE_TRUE;
00757 }
00758
00759 if (DBot->TimeSeen > 5.0f)
00760 {
00761 if (Rank <= 2)
00762 Bot_SetMode(Player, MODE_RETREAT);
00763 else
00764 Bot_SetMode(Player, MODE_ATTACK);
00765
00766 if (Think)
00767 Bot_ModeThink(VSI, Player, Time);
00768 return GE_TRUE;
00769 }
00770
00771 if (DBot->TimeSeen > 0.0f)
00772 {
00773 if (Rank <= 1)
00774 Bot_SetMode(Player, MODE_RETREAT);
00775 else
00776 Bot_SetMode(Player, MODE_ATTACK);
00777
00778 if (Think)
00779 Bot_ModeThink(VSI, Player, Time);
00780 return GE_TRUE;
00781 }
00782
00783 return GE_FALSE;
00784 }
|
|
||||||||||||||||
|
Definition at line 545 of file bot.c. References Bot_ModeThinkFunc, GE_TRUE, geBoolean, Bot_Var::Mode, and GPlayer::userData. Referenced by Bot_Create(), Bot_ModeChange(), Bot_MoveFree(), and Bot_MoveToPoint().
00546 {
00547 GPlayer *Player;
00548 Bot_Var *DBot;
00549
00550 Player = (GPlayer*)PlayerData;
00551 DBot = Player->userData;
00552
00553 //if (BotDebugPrint) GenVSI_ConsoleHeaderPrintf(VSI, DBot->TgtPlayer->ClientHandle, GE_TRUE, "Bot Think Mode %s", ModeText[DBot->Mode]);
00554
00555 Bot_ModeThinkFunc[DBot->Mode](VSI, PlayerData, Time);
00556
00557 return GE_TRUE;
00558 }
|
|
||||||||||||||||
|
Definition at line 1066 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_CompareWeapons(), Bot_GetRank(), Bot_InitFindMultiTrackAway(), Bot_InitMaintain(), Bot_InitMoveAway(), Bot_InitRunCloser(), Bot_ModeChange(), CLOSE_RANGE_DIST, GE_FALSE, GE_TRUE, geBoolean, geVec3d_DistanceBetween(), GPlayer::Health, Bot_Var::HealthDiff, MED_RANGE_DIST, MODE_CROWD_PLAYER, MODE_FIND_PLAYER, MODE_NULL, MODE_RETREAT, MODE_RETREAT_ON_TRACK, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, PlayerDead(), RandomRange(), Bot_Var::TgtPlayer, geXForm3d::Translation, GPlayer::userData, Bot_Var::WeaponDiff, and GPlayer::XForm.
01067 {
01068 GPlayer *Player;
01069 Bot_Var *DBot;
01070 geVec3d Pos,TgtPlayerPos;
01071 float Dist;
01072
01073 Player = (GPlayer*)PlayerData;
01074 DBot = Player->userData;
01075
01076 Pos = Player->XForm.Translation;
01077 TgtPlayerPos = DBot->TgtPlayer->XForm.Translation;
01078
01079 DBot->WeaponDiff = Bot_CompareWeapons(VSI, Player, DBot->TgtPlayer);
01080
01081 // outgunned
01082 if (DBot->WeaponDiff < -40)
01083 {
01084 Bot_ModeChange(VSI, Player, MODE_RETREAT, GE_FALSE, Time);
01085 return GE_TRUE;
01086 }
01087
01088 if (DBot->ModeTimeNotSeen > 1.5f)
01089 {
01090 Bot_ModeChange(VSI, Player, MODE_FIND_PLAYER, GE_TRUE, Time);
01091 return GE_TRUE;
01092 }
01093
01094 if (PlayerDead(DBot->TgtPlayer))
01095 {
01096 if (Bot_InitFindMultiTrackAway(VSI, Player, &DBot->TgtPlayer->XForm.Translation, Time))
01097 {
01098 Bot_ModeChange(VSI, Player, MODE_RETREAT_ON_TRACK, GE_FALSE, Time);
01099 return GE_TRUE;
01100 }
01101 else
01102 {
01103 Bot_ModeChange(VSI, Player, MODE_RETREAT, GE_TRUE, Time);
01104 return GE_TRUE;
01105 }
01106 }
01107
01108 if (RandomRange(1000) < 300 &&
01109 Bot_GetRank(VSI, Player) >= 4)
01110 {
01111 Bot_ModeChange(VSI, Player, MODE_CROWD_PLAYER, GE_TRUE, Time);
01112 return GE_TRUE;
01113 }
01114
01115 if (DBot->ModeTimeOut > 12.0f || DBot->ModeTimeSeen > 7.0f)
01116 {
01117 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
01118 return GE_TRUE;
01119 }
01120
01121 if (Bot_ActionGetHealth(VSI, Player, 600.0f, Time))
01122 return GE_TRUE;
01123 if (Bot_ActionGetWeapon(VSI, Player, 600.0f, Time))
01124 return GE_TRUE;
01125
01126 // keep a medium range distance
01127 Dist = geVec3d_DistanceBetween(&Pos, &TgtPlayerPos);
01128 if (Dist <= CLOSE_RANGE_DIST)
01129 {
01130 Bot_InitMoveAway(VSI, Player, Time);
01131 return GE_TRUE;
01132 }
01133 else
01134 if (Dist <= MED_RANGE_DIST)
01135 {
01136 if (RandomRange(1000) < 200)
01137 Bot_InitRunCloser(VSI, Player, Time);
01138 else
01139 Bot_InitMaintain(VSI, Player, Time);
01140 return GE_TRUE;
01141 }
01142 else
01143 {
01144 Bot_InitRunCloser(VSI, Player, Time);
01145 return GE_TRUE;
01146 }
01147
01148 // health assessment
01149 DBot->HealthDiff = Player->Health - DBot->TgtPlayer->Health;
01150 DBot->WeaponDiff = Bot_CompareWeapons(VSI, Player, DBot->TgtPlayer);
01151
01152 return GE_TRUE;
01153 }
|
|
||||||||||||||||
|
Definition at line 1158 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_CompareWeapons(), Bot_GetRank(), Bot_InitFindMultiTrackAway(), Bot_InitRunCloser(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, MODE_NULL, MODE_RETREAT, MODE_RETREAT_ON_TRACK, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, PlayerDead(), Bot_Var::TgtPlayer, geXForm3d::Translation, GPlayer::userData, Bot_Var::WeaponDiff, and GPlayer::XForm.
01159 {
01160 GPlayer *Player;
01161 Bot_Var *DBot;
01162
01163 Player = (GPlayer*)PlayerData;
01164 DBot = Player->userData;
01165
01166 DBot->WeaponDiff = Bot_CompareWeapons(VSI, Player, DBot->TgtPlayer);
01167
01168 // outgunned
01169 if (DBot->WeaponDiff < -40)
01170 {
01171 Bot_ModeChange(VSI, Player, MODE_RETREAT, GE_FALSE, Time);
01172 return GE_TRUE;
01173 }
01174
01175 if (PlayerDead(DBot->TgtPlayer))
01176 {
01177 if (Bot_InitFindMultiTrackAway(VSI, Player, &DBot->TgtPlayer->XForm.Translation, Time))
01178 {
01179 Bot_ModeChange(VSI, Player, MODE_RETREAT_ON_TRACK, GE_FALSE, Time);
01180 return GE_TRUE;
01181 }
01182 else
01183 {
01184 Bot_ModeChange(VSI, Player, MODE_RETREAT, GE_TRUE, Time);
01185 return GE_TRUE;
01186 }
01187 }
01188
01189 if (DBot->ModeTimeOut > 6.0f ||
01190 DBot->ModeTimeNotSeen > 6.0f)
01191 {
01192 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
01193 return GE_TRUE;
01194 }
01195
01196 if (Bot_ActionGetHealth(VSI, Player, 400.0f, Time))
01197 return GE_TRUE;
01198 if (Bot_ActionGetWeapon(VSI, Player, 400.0f, Time))
01199 return GE_TRUE;
01200
01201 if (Bot_GetRank(VSI, Player) <= 3)
01202 {
01203 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
01204 return GE_TRUE;
01205 }
01206
01207 // crowd the player at all times
01208 Bot_InitRunCloser(VSI, Player, Time);
01209
01210 return GE_TRUE;
01211 }
|
|
||||||||||||||||
|
Definition at line 938 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_CompareWeapons(), Bot_InitHide(), Bot_InitRunCloser(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, MODE_FIND_PLAYER_QUICK, MODE_NULL, MODE_WANDER, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, Bot_Var::TgtPlayer, GPlayer::userData, and Bot_Var::WeaponDiff.
00939 {
00940 GPlayer *Player;
00941 Bot_Var *DBot;
00942
00943 Player = (GPlayer*)PlayerData;
00944 DBot = Player->userData;
00945
00946 DBot->WeaponDiff = Bot_CompareWeapons(VSI, Player, DBot->TgtPlayer);
00947
00948 // outgunned
00949 if (DBot->WeaponDiff < -40)
00950 {
00951 Bot_ModeChange(VSI, Player, MODE_WANDER, GE_FALSE, Time);
00952 return GE_TRUE;
00953 }
00954
00955 if (DBot->ModeTimeOut > 7.0f)
00956 {
00957 Bot_ModeChange(VSI, Player, MODE_FIND_PLAYER_QUICK, GE_TRUE, Time);
00958 return GE_TRUE;
00959 }
00960
00961 if (Bot_ActionGetHealth(VSI, Player, 600.0f, Time))
00962 return GE_TRUE;
00963 if (Bot_ActionGetWeapon(VSI, Player, 600.0f, Time))
00964 return GE_TRUE;
00965
00966 // Found Player
00967 if (DBot->ModeTimeSeen > 0.0f)
00968 {
00969 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00970 return GE_TRUE;
00971 }
00972
00973 if (DBot->ModeTimeNotSeen > 3.0f)
00974 {
00975 if (Bot_InitHide(VSI, Player, Time))
00976 return GE_TRUE;
00977 }
00978
00979 Bot_InitRunCloser(VSI, Player, Time);
00980
00981 return GE_TRUE;
00982 }
|
|
||||||||||||||||
|
Definition at line 881 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FindRandomItem(), Bot_InitFindMultiTrack(), Bot_InitHide(), Bot_InitRunCloser(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, ItemHealthList, MODE_NULL, MODE_ON_TRACK, MODE_WANDER_ON_TRACK, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, Bot_Var::TgtPlayer, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm.
00882 {
00883 GPlayer *Player;
00884 Bot_Var *DBot;
00885
00886 Player = (GPlayer*)PlayerData;
00887 DBot = Player->userData;
00888
00889 if (DBot->ModeTimeOut > 20.0f)
00890 {
00891 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00892 return GE_TRUE;
00893 }
00894
00895 if (Bot_InitFindMultiTrack(VSI, PlayerData, &DBot->TgtPlayer->XForm.Translation, Time))
00896 {
00897 Bot_ModeChange(VSI, Player, MODE_ON_TRACK, GE_FALSE, Time);
00898 return GE_TRUE;
00899 }
00900 else
00901 {
00902 GPlayer *GoalPlayer;
00903
00904 if (GoalPlayer = Bot_FindRandomItem(VSI, &Player->XForm.Translation, ItemHealthList))
00905 {
00906 if (Bot_InitFindMultiTrack(VSI, Player, &GoalPlayer->XForm.Translation, Time))
00907 {
00908 Bot_ModeChange(VSI, Player, MODE_WANDER_ON_TRACK, GE_FALSE, Time);
00909 return GE_TRUE;
00910 }
00911 }
00912 }
00913
00914 if (Bot_ActionGetHealth(VSI, Player, 400.0f, Time))
00915 return GE_TRUE;
00916 if (Bot_ActionGetWeapon(VSI, Player, 400.0f, Time))
00917 return GE_TRUE;
00918
00919 if (Bot_InitHide(VSI, Player, Time))
00920 return GE_TRUE;
00921
00922 // Found Player
00923 if (DBot->ModeTimeSeen > 1.0f)
00924 {
00925 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00926 return GE_TRUE;
00927 }
00928
00929 Bot_InitRunCloser(VSI, Player, Time);
00930
00931 return GE_TRUE;
00932 }
|
|
||||||||||||||||
|
Definition at line 1216 of file bot.c. References Bot_ModeChange(), GE_TRUE, geBoolean, MODE_NULL, and GPlayer::userData.
|
|
||||||||||||||||
|
Definition at line 563 of file bot.c. References Bot_InitTrackToGoal(), Bot_Reposition(), GE_FALSE, GE_TRUE, geBoolean, geVec3d_Clear(), Bot_Var::GoalPos, int32, GPlayer::LastGoodPos, Bot_Var::PastFirstTrackPoint, RandomRange(), Track_GetFirstPoint(), Track_GetPoint(), Track_OnTrack(), Bot_Var::TrackInfo, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, and GPlayer::XForm. Referenced by Bot_MoveToPoint().
00564 {
00565 GPlayer *Player;
00566 Bot_Var *DBot;
00567 int32 dir;
00568
00569 Player = (GPlayer*)PlayerData;
00570 DBot = Player->userData;
00571
00572 // Sometimes when making jumps the bot may land on a ledge
00573 // This attempts to see if we are in the middle of a track - not the first point
00574 // Also allows running off of ledges
00575 if (Track_OnTrack(&DBot->TrackInfo))
00576 {
00577 #if 1
00578 TrackPt *pt,*fpt;
00579 pt = Track_GetPoint(&DBot->TrackInfo);
00580 fpt = Track_GetFirstPoint(&DBot->TrackInfo);
00581 if (pt != fpt)
00582 return GE_FALSE; // do notdetect a ledge
00583 #else
00584 if (DBot->PastFirstTrackPoint)
00585 return GE_FALSE;
00586 #endif
00587
00588 Player->XForm.Translation = Player->LastGoodPos;
00589 geVec3d_Clear(&Player->Velocity);
00590
00591 if (!Bot_InitTrackToGoal(VSI, Player, Time))
00592 {
00593 dir = RandomRange(3) - 1; //-1 to 1
00594 Bot_Reposition(VSI, Player, &DBot->GoalPos, dir); //Try the opposite direction
00595 }
00596 }
00597 else
00598 {
00599 Player->XForm.Translation = Player->LastGoodPos;
00600 geVec3d_Clear(&Player->Velocity);
00601 dir = RandomRange(3) - 1; //-1 to 1
00602 Bot_Reposition(VSI, Player, &DBot->GoalPos, dir); //Try the opposite direction
00603 }
00604
00605
00606 return GE_TRUE;
00607 }
|
|
||||||||||||||||
|
Definition at line 1235 of file bot.c. References Bot_InitRunCloser(), Bot_ModeChange(), GE_TRUE, geBoolean, Bot_Var::GoalPos, MODE_NULL, TrackPt::Pos, Track_GetPoint(), Track_OnTrack(), Bot_Var::TrackInfo, and GPlayer::userData.
01236 {
01237 GPlayer *Player;
01238 Bot_Var *DBot;
01239
01240 Player = (GPlayer*)PlayerData;
01241 DBot = Player->userData;
01242
01243
01244 // left the track?
01245 if (!Track_OnTrack(&DBot->TrackInfo))
01246 {
01247 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
01248 return GE_TRUE;
01249 }
01250
01251 // IF HERE THEN HIT SOMETHING!!!!! - if didn't hit then check logic!
01252 if (Track_OnTrack(&DBot->TrackInfo))
01253 {
01254 // This MAY push a track on the stack
01255 Bot_InitRunCloser(VSI, Player, Time);
01256 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
01257 return GE_TRUE;
01258 }
01259
01260
01261 return GE_TRUE;
01262 }
|
|
||||||||||||||||
|
Definition at line 790 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FindRandomItem(), Bot_InitFindMultiTrack(), Bot_InitFindMultiTrackAway(), Bot_InitHide(), Bot_InitRunAway(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, GPlayer::Health, Bot_Var::HealthCheck, ItemHealthList, MODE_NULL, MODE_RETREAT, MODE_RETREAT_ON_TRACK, Bot_Var::ModeTimeNotSeen, Bot_Var::ModeTimeOut, Bot_Var::ModeTimeSeen, Bot_Var::TgtPlayer, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm.
00791 {
00792 GPlayer *Player;
00793 Bot_Var *DBot;
00794 GPlayer *GoalPlayer;
00795
00796 Player = (GPlayer*)PlayerData;
00797 DBot = Player->userData;
00798
00799 DBot->HealthCheck = Player->Health;
00800
00801 if (Bot_ActionGetHealth(VSI, Player, 500.0f, Time))
00802 return GE_TRUE;
00803 if (Bot_ActionGetWeapon(VSI, Player, 500.0f, Time))
00804 return GE_TRUE;
00805
00806 // first try and find some item to run towards
00807 if (GoalPlayer = Bot_FindRandomItem(VSI, &Player->XForm.Translation, ItemHealthList))
00808 {
00809 if (Bot_InitFindMultiTrack(VSI, Player, &GoalPlayer->XForm.Translation, Time))
00810 {
00811 Bot_ModeChange(VSI, Player, MODE_RETREAT, GE_FALSE, Time);
00812 return GE_TRUE;
00813 }
00814 }
00815
00816 if (Bot_InitFindMultiTrackAway(VSI, Player, &DBot->TgtPlayer->XForm.Translation, Time))
00817 {
00818 Bot_ModeChange(VSI, Player, MODE_RETREAT_ON_TRACK, GE_FALSE, Time);
00819 return GE_TRUE;
00820 }
00821
00822 // ModeTimeOut on this operation
00823 if (DBot->ModeTimeOut > 10.0f)
00824 {
00825 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00826 return GE_TRUE;
00827 }
00828 // cant get away
00829 if (DBot->ModeTimeSeen > 5.0f)
00830 {
00831 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00832 return GE_TRUE;
00833 }
00834
00835 if (DBot->ModeTimeNotSeen > 6.0f)
00836 {
00837 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
00838 return GE_TRUE;
00839 }
00840 if (DBot->ModeTimeNotSeen > 3.0f)
00841 {
00842 if (Bot_InitHide(VSI, Player, Time))
00843 {
00844 // this sets the Action
00845 return GE_TRUE;
00846 }
00847 }
00848
00849 // this sets the Action
00850 Bot_InitRunAway(VSI, Player, Time);
00851
00852 return GE_TRUE;
00853 }
|
|
||||||||||||||||
|
Definition at line 1267 of file bot.c. References Bot_InitMoveFree(), Bot_ModeChange(), Bot_Reposition(), GE_TRUE, geBoolean, int32, MODE_NULL, Bot_Var::ModeTimeOut, RandomRange(), Bot_Var::TgtPlayer, Bot_Var::TgtPos, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm.
01268 {
01269 GPlayer *Player;
01270 Bot_Var *DBot;
01271 int32 dir;
01272
01273 Player = (GPlayer*)PlayerData;
01274 DBot = Player->userData;
01275
01276 if (DBot->ModeTimeOut > 3.0f)
01277 {
01278 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
01279 return GE_TRUE;
01280 }
01281
01282 dir = RandomRange(3) - 1;
01283 Bot_Reposition(VSI, Player, &DBot->TgtPlayer->XForm.Translation, dir);
01284 Bot_InitMoveFree(VSI, Player, &DBot->TgtPos);
01285
01286 return GE_TRUE;
01287 }
|
|
||||||||||||||||
|
Definition at line 987 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_FindRandomItem(), Bot_FindRandomTrack(), Bot_InitFindMultiTrack(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, HideTrackList, ItemHealthList, MODE_FIND_PLAYER, MODE_ON_TRACK, MODE_WANDER_ON_TRACK, Track::PointList, TrackPt::Pos, geXForm3d::Translation, GPlayer::userData, and GPlayer::XForm.
00988 {
00989 GPlayer *Player;
00990 GPlayer *GoalPlayer;
00991 Bot_Var *DBot;
00992 Track *GoalTrack;
00993
00994 Player = (GPlayer*)PlayerData;
00995 DBot = Player->userData;
00996
00997 if (GoalTrack = Bot_FindRandomTrack(VSI, &Player->XForm.Translation, HideTrackList))
00998 {
00999 if (Bot_InitFindMultiTrack(VSI, Player, GoalTrack->PointList[0].Pos, Time))
01000 {
01001 Bot_ModeChange(VSI, Player, MODE_ON_TRACK, GE_FALSE, Time);
01002 return GE_TRUE;
01003 }
01004 }
01005
01006 // InitWanderGoal
01007 if (GoalPlayer = Bot_FindRandomItem(VSI, &Player->XForm.Translation, ItemHealthList))
01008 {
01009 if (Bot_InitFindMultiTrack(VSI, Player, &GoalPlayer->XForm.Translation, Time))
01010 {
01011 Bot_ModeChange(VSI, Player, MODE_WANDER_ON_TRACK, GE_FALSE, Time);
01012 return GE_TRUE;
01013 }
01014 }
01015
01016 if (Bot_ActionGetHealth(VSI, Player, 1200.0f, Time))
01017 return GE_TRUE;
01018 if (Bot_ActionGetWeapon(VSI, Player, 1200.0f, Time))
01019 return GE_TRUE;
01020
01021 Bot_ModeChange(VSI, Player, MODE_FIND_PLAYER, GE_FALSE, Time);
01022
01023 return GE_TRUE;
01024 }
|
|
||||||||||||||||
|
Definition at line 1029 of file bot.c. References Bot_ActionGetHealth(), Bot_ActionGetWeapon(), Bot_InitRunCloser(), Bot_ModeChange(), GE_FALSE, GE_TRUE, geBoolean, Bot_Var::GoalPos, MODE_FIND_PLAYER, TrackPt::Pos, Track_GetPoint(), Track_OnTrack(), Bot_Var::TrackInfo, and GPlayer::userData.
01030 {
01031 GPlayer *Player;
01032 Bot_Var *DBot;
01033
01034 Player = (GPlayer*)PlayerData;
01035 DBot = Player->userData;
01036
01037 if (!Track_OnTrack(&DBot->TrackInfo))
01038 {
01039 // Try and find an item
01040 if (Bot_ActionGetHealth(VSI, Player, 500.0f, Time))
01041 return GE_TRUE;
01042 if (Bot_ActionGetWeapon(VSI, Player, 500.0f, Time))
01043 return GE_TRUE;
01044
01045 Bot_ModeChange(VSI, Player, MODE_FIND_PLAYER, GE_FALSE, Time);
01046 }
01047 else
01048 // IF HERE THEN HIT SOMETHING!!!!! - if didn't hit then check logic!
01049 if (Track_OnTrack(&DBot->TrackInfo))
01050 {
01051 // This MAY push a track on the stack
01052 Bot_InitRunCloser(VSI, Player, Time);
01053 DBot->GoalPos = *Track_GetPoint(&DBot->TrackInfo)->Pos;
01054 return GE_TRUE;
01055 }
01056
01057 Bot_InitRunCloser(VSI, Player, Time);
01058
01059 return GE_TRUE;
01060 }
|
|
||||||||||||||||
|
Definition at line 4321 of file bot.c. References Bot_Animate(), Bot_GetContents(), Bot_ModeThink(), Bot_PastPoint(), Bot_SetupXForm(), GE_FALSE, GE_TRUE, geBoolean, GenVSI_GetWorld(), geVec3d_AddScaled(), geVec3d_DistanceBetween(), geVec3d_Subtract(), GPlayer::LastGoodPos, Bot_Var::MoveVec, NULL, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerPhysics(), PSTATE_InAir, Bot_Var::RunSpeed, GPlayer::State, Bot_Var::TgtPlayer, Bot_Var::TgtPos, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, GPlayer::VPos, and GPlayer::XForm. Referenced by Bot_InitMoveFree().
04322 {
04323 geVec3d Pos, TgtPlayerPos, Vec2Player;
04324 float MoveSpeed;
04325 GPlayer *Player;
04326 Bot_Var *DBot;
04327 geBoolean ResetVelocity = GE_FALSE;
04328 TrackPt *ThisPoint = NULL, *NextPoint = NULL;
04329 geWorld *World;
04330
04331 World = GenVSI_GetWorld(VSI);
04332 assert(World);
04333
04334 Player = (GPlayer*)PlayerData;
04335 assert(Player);
04336 DBot = (Bot_Var*)Player->userData;
04337
04338 // save off the position
04339 Pos = Player->XForm.Translation;
04340 TgtPlayerPos = DBot->TgtPlayer->XForm.Translation;
04341
04342 geVec3d_Subtract(&TgtPlayerPos, &Pos, &Vec2Player);
04343
04344 Bot_SetupXForm(VSI, PlayerData, &DBot->MoveVec); //Face run direction
04345
04346 MoveSpeed = Time;
04347
04348 if (Player->State == PSTATE_InAir)
04349 MoveSpeed *= 0.15f;
04350
04351 geVec3d_AddScaled(&Player->Velocity, &DBot->MoveVec, DBot->RunSpeed*MoveSpeed, &Player->Velocity);
04352
04353 PlayerPhysics(VSI, Player, PLAYER_GROUND_FRICTION, PLAYER_AIR_FRICTION, PLAYER_LIQUID_FRICTION, PLAYER_GRAVITY, 1.0f, GE_FALSE, Time);
04354 if (geVec3d_DistanceBetween(&Player->XForm.Translation, &Player->LastGoodPos) <= 25.0f)
04355 {
04356 // reposition again
04357 Bot_ModeThink(VSI, Player, Time);
04358 return GE_TRUE;
04359 }
04360
04361 Bot_GetContents(VSI, Player, Time);
04362
04363 Bot_Animate(VSI, Player, Time);
04364
04365 //??bot
04366 Player->VPos = Player->XForm.Translation;
04367
04368 // test current pos and MoveVec
04369 if (Bot_PastPoint(&Player->XForm.Translation, &DBot->MoveVec, &DBot->TgtPos))
04370 {
04371 // decide what to do next
04372 if (Bot_ModeThink(VSI, PlayerData, Time))
04373 return GE_TRUE;
04374 }
04375
04376 return GE_TRUE;
04377 }
|
|
||||||||||||||||||||||||
|
Definition at line 3614 of file bot.c. References Bot_ScanPhysics(), GE_FALSE, GE_TRUE, geBoolean, geVec3d_Scale(), int32, GPlayer::LastGoodPos, GPlayer::State, geXForm3d::Translation, GPlayer::userData, GPlayer::Velocity, and GPlayer::XForm. Referenced by Bot_FindNewMoveVec().
03615 {
03616 GPlayer *Player;
03617 Bot_Var *DBot;
03618 geVec3d SaveVelocity, SaveGoodPos, Pos;
03619 geBoolean ret_val = GE_FALSE;
03620 int32 SaveState;
03621 float Time = 1.0f; // don't allow scaling by time
03622
03623 Player = (GPlayer*)PlayerData;
03624 DBot = (Bot_Var*)Player->userData;
03625
03626 // Save off values that will change
03627 Pos = Player->XForm.Translation;
03628 SaveVelocity = Player->Velocity;
03629 SaveGoodPos = Player->LastGoodPos;
03630 SaveState = Player->State;
03631
03632 // New Velocity in this direction
03633 geVec3d_Scale(vec_dir, dist, &Player->Velocity);
03634
03635 if (!Bot_ScanPhysics(VSI, Player, Time))
03636 {
03637 ret_val = GE_TRUE;
03638 }
03639
03640 *stop_pos = Player->XForm.Translation;
03641
03642 // Restore saved values
03643 Player->Velocity = SaveVelocity;
03644 Player->XForm.Translation = Pos;
03645 Player->LastGoodPos = SaveGoodPos;
03646 Player->State = SaveState;
03647
03648 return ret_val;
03649 }
|
|
||||||||||||||||
|
Definition at line 4070 of file bot.c. References TrackPt::Action, Bot_Animate(), Bot_ClearTrack(), Bot_FinishTrack(), Bot_GetContents(), Bot_LeaveTrack(), Bot_ModeChange(), Bot_ModeThink(), Bot_ModeThinkLedge(), Bot_OverLedge(), Bot_PastPoint(), Bot_Physics(), Bot_Reposition(), Bot_SetupXForm(), Bot_Shoot(), Bot_TrackAction(), Bot_Var::Bumps, Bot_Var::Dir, Bot_Var::FaceTgtPlayerOnRetreat, FALSE, GE_FALSE, GE_TRUE, geBoolean, GenVSI_GetWorld(), geVec3d_AddScaled(), geVec3d_DistanceBetween(), geVec3d_Normalize(), geVec3d_Subtract(), Bot_Var::GoalPos, GPlayer::LastGoodPos, Bot_Var::LedgeBumps, Bot_Var::Mode, MODE_GOAL_POINT, MODE_NULL, MODE_RETREAT, MODE_RETREAT_ON_TRACK, MODE_UNSTICK, MODE_WANDER, MODE_WANDER_ON_TRACK, Bot_Var::MoveVec, NULL, Bot_Var::PastFirstTrackPoint, PLAYER_AIR_FRICTION, PLAYER_GRAVITY, PLAYER_GROUND_FRICTION, PLAYER_LIQUID_FRICTION, PlayerDead(), PlayerPhysics(), POINT_TYPE_WAIT_POINT_VISIBLE, TrackPt::Pos, PSTATE_InAir, PSTATE_Normal, Bot_Var::RunSpeed, StackIsEmpty(), GPlayer::State, Bot_Var::TgtPlayer, Bot_Var::TgtPos, Bot_Var::TimeSeen, Track_GetPoint(), Track_NextPoint(), Track_OnTrack(), Bot_Var::TrackInfo, Bot_Var::TrackInfoPrev, TrackData::TrackNdx, Bot_Var::TrackStack, geXForm3d::Translation, TRUE, GPlayer::userData, GPlayer::Velocity, GPlayer::VPos, GPlayer::XForm, and geVec3d::Y. Referenced by Bot_InitGenericMove(), Bot_InitMaintain(), Bot_InitMoveAway(), Bot_InitMoveCloser(), Bot_InitMoveToPoint(), Bot_InitRunAway(), Bot_InitRunCloser(), Bot_ShootPoint(), Bot_WaitForEntityDist(), and Bot_WaitForEntityVisible().
04071 {
04072 geVec3d Pos, TgtPlayerPos, Vec2Player;
04073 float MoveSpeed;
04074 GPlayer *Player;
04075 Bot_Var *DBot;
04076 geBoolean ResetVelocity = GE_FALSE, BotShoot;
04077 TrackPt *ThisPoint = NULL, *NextPoint = NULL;
04078 //int32 DoAction;
04079 geWorld *World;
04080
04081 World = GenVSI_GetWorld(VSI);
04082 assert(World);
04083
04084 Player = (GPlayer*)PlayerData;
04085 assert(Player);
04086 DBot = (Bot_Var*)Player->userData;
04087
04088
04089 assert(DBot->TgtPlayer);
04090
04091 // save off the position
04092 Pos = Player->XForm.Translation;
04093 TgtPlayerPos = DBot->TgtPlayer->XForm.Translation;
04094
04095 geVec3d_Subtract(&TgtPlayerPos, &Pos, &Vec2Player);
04096
04097 // decide whether to face player & shoot
04098 switch (DBot->Mode)
04099 {
04100 case MODE_UNSTICK:
04101 BotShoot = FALSE;
04102 Bot_SetupXForm(VSI, PlayerData, &Vec2Player); //Face Player
04103 break;
04104 case MODE_RETREAT:
04105 case MODE_RETREAT_ON_TRACK:
04106 if (DBot->FaceTgtPlayerOnRetreat)
04107 {
04108 BotShoot = TRUE;
04109 Bot_SetupXForm(VSI, PlayerData, &Vec2Player); //Face Player
04110 }
04111 else
04112 {
04113 BotShoot = FALSE;
04114 Bot_SetupXForm(VSI, PlayerData, &DBot->MoveVec); //Face run direction
04115 }
04116 break;
04117 case MODE_WANDER:
04118 case MODE_WANDER_ON_TRACK:
04119 //case MODE_GOAL_POINT:
04120 BotShoot = FALSE;
04121 Bot_SetupXForm(VSI, PlayerData, &DBot->MoveVec); //Face run direction
04122 break;
04123 default:
04124 BotShoot = TRUE;
04125 Bot_SetupXForm(VSI, PlayerData, &Vec2Player); //Face Player
04126 break;
04127
04128 }
04129
04130 MoveSpeed = Time;
04131
04132 if (Player->State == PSTATE_InAir)
04133 MoveSpeed *= 0.15f;
04134
04135 #if 1
04136 //an attempt to counteract Velocity and zero in on the target position
04137 if (!Bot_PastPoint(&Player->XForm.Translation, &DBot->MoveVec, &DBot->TgtPos))
04138 {
04139 geVec3d save = DBot->MoveVec;
04140
04141 // get a new MoveVec
04142 geVec3d_Subtract(&DBot->TgtPos, &Player->XForm.Translation, &DBot->MoveVec);
04143 DBot->MoveVec.Y = 0.0f;
04144 geVec3d_Normalize(&DBot->MoveVec);
04145
04146 if (Bot_PastPoint(&Player->XForm.Translation, &DBot->MoveVec, &DBot->TgtPos))
04147 {
04148 DBot->MoveVec = save;
04149 }
04150 }
04151 #endif
04152
04153 geVec3d_AddScaled(&Player->Velocity, &DBot->MoveVec, DBot->RunSpeed*MoveSpeed, &Player->Velocity);
04154
04155 if (Track_OnTrack(&DBot->TrackInfo))
04156 {
04157 PlayerPhysics(VSI, Player, PLAYER_GROUND_FRICTION, PLAYER_AIR_FRICTION, PLAYER_LIQUID_FRICTION, PLAYER_GRAVITY, 1.0f, GE_FALSE, Time);
04158
04159 if (DBot->TrackInfoPrev.TrackNdx == DBot->TrackInfo.TrackNdx &&
04160 Track_OnTrack(&DBot->TrackInfoPrev) &&
04161 Track_GetPoint(&DBot->TrackInfoPrev)->Action != POINT_TYPE_WAIT_POINT_VISIBLE)
04162 {
04163 if (geVec3d_DistanceBetween(&Player->XForm.Translation, &Player->LastGoodPos) <= 5.0f)
04164 {
04165 // get off of track
04166 Bot_ClearTrack(VSI, Player);
04167 // pick another mode
04168 Bot_ModeChange(VSI, Player, MODE_NULL, GE_TRUE, Time);
04169 //if (Bot_ModeThink(VSI, Player, Time)) //If couldn't move try a new action
04170 return GE_TRUE;
04171 }
04172 }
04173 else
04174 {
04175 if (geVec3d_DistanceBetween(&Playe |