Skip to content

Commit

Permalink
Slightly adjust shootAt z offset
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Dec 15, 2018
1 parent 0dcbaa5 commit 38148a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion Pongbot/Bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void Bot::Think() {
cmd.forwardmove = movement->x;
cmd.sidemove = movement->y;
cmd.viewangles = *lookAt;

_IIBotController->RunPlayerMove(&cmd);

delete movement;
Expand Down
13 changes: 3 additions & 10 deletions Pongbot/BotTaskCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ void BotTaskCommon::_DoMovement(int *&pressedButtons, Vector2D *&movement) {

if (Util::DistanceToNoZ(currentPos, _LastPos) < POS_STUCK_RADIUS) {
_PosStuckTime++;

if (_PosStuckTime > POS_STUCK_GIVEUPTIME) {
_PosStuckTime = 0;

_UpdateNewWaypointNodeStack();
}
else if (_PosStuckTime > POS_STUCK_STARTPANICTIME) {
Expand All @@ -45,20 +43,17 @@ void BotTaskCommon::_DoMovement(int *&pressedButtons, Vector2D *&movement) {
else {
_PosStuckTime = 0;
_LastPos = currentPos;

_UpdateClosestWaypointNode();
}

if (_WaypointNodeStack.empty())
_UpdateNewWaypointNodeStack();
else {
WaypointNode *node = _WaypointNodeStack.top();

if (!node)
_WaypointNodeStack.pop();
else {
Vector nodePos = node->Pos;

if (currentPos.DistTo(nodePos) <= WAYPOINTNODE_TOUCHED_RADIUS)
_WaypointNodeStack.pop();
else
Expand All @@ -69,20 +64,18 @@ void BotTaskCommon::_DoMovement(int *&pressedButtons, Vector2D *&movement) {

void BotTaskCommon::_DoLooking(int *&pressedButtons, QAngle *&lookAt) {
Bot *bot = _GetBot();

std::vector<edict_t*> visibleEdicts = bot->GetBotVisibles()->GetVisibleEdicts();

if (visibleEdicts.size() > 0) {
lookAt = new QAngle(Util::GetLookAtAngleForPos(bot, Util::GetEdictOrigin(visibleEdicts[0])));

Vector shootAtPos = Util::GetEdictOrigin(visibleEdicts[0]);
shootAtPos.z += 10;
lookAt = new QAngle(Util::GetLookAtAngleForPos(bot, shootAtPos));
*pressedButtons |= IN_ATTACK;
}
else if (_WaypointNodeStack.size() > 0) {
WaypointNode *node = _WaypointNodeStack.top();

if (node) {
Vector nodePos = node->Pos;

lookAt = new QAngle(Util::GetLookAtAngleForPos(bot, Vector(nodePos.x, nodePos.y, bot->GetEarPos().z)));
}
}
Expand Down

0 comments on commit 38148a2

Please sign in to comment.