#include "_bot.h"Go to the source code of this file.
Compounds | |
| struct | DECISION |
| struct | PERSONALITYstruct |
Defines | |
| #define | BOT_DEBUG 1 |
Typedefs | |
| typedef geBoolean(* | CONTROLp )(GenVSI *VSI, void *PlayerData, float Time) |
| typedef * | DECISIONp |
Functions | |
| geBoolean | Bot_Control (GenVSI *VSI, void *PlayerData, float Time) |
| GenVSI_CMove * | Bot_AI_Control (void) |
| geBoolean | CheckPlayer (GenVSI *VSI, void *PlayerData) |
| void | SetupPlayerXForm (GenVSI *VSI, void *PlayerData, float Time) |
| geBoolean | Bot_MatchStart (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName) |
| geBoolean | Bot_ActorStart (GenVSI *VSI, void *PlayerData, void *ClassData, char *EntityName) |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
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 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 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 2172 of file Genesis3d/src/Game/GMain.c. References GenVSI_CMove::Angles, CLIENT_NULL_HANDLE, GPlayer::ClientHandle, GenVSI_GetClientMove(), geXForm3d_RotateX(), geXForm3d_RotateY(), geXForm3d_RotateZ(), geXForm3d_SetIdentity(), geXForm3d_Translate(), GPlayer::Roll, geXForm3d::Translation, geVec3d::X, GPlayer::XForm, geVec3d::Y, and geVec3d::Z.
02173 {
02174 geVec3d Pos;
02175 GPlayer *Player;
02176 GenVSI_CMove *Move;
02177
02178 Player = (GPlayer*)PlayerData;
02179
02180 assert(Player->ClientHandle != CLIENT_NULL_HANDLE);
02181
02182 Move = GenVSI_GetClientMove(VSI, Player->ClientHandle);
02183
02184 assert(Move);
02185
02186 Pos = Player->XForm.Translation;
02187
02188 // Clear the matrix
02189 geXForm3d_SetIdentity(&Player->XForm);
02190
02191 // Rotate then translate.
02192 geXForm3d_RotateZ(&Player->XForm, Move->Angles.Z+Player->Roll);
02193
02194 geXForm3d_RotateX(&Player->XForm, Move->Angles.X);
02195 geXForm3d_RotateY(&Player->XForm, Move->Angles.Y);
02196
02197 geXForm3d_Translate(&Player->XForm, Pos.X, Pos.Y, Pos.Z);
02198
02199 }
|
1.3.2