Skip to content

Commit

Permalink
Added comments and undid unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SpookyScaryDev committed Sep 5, 2024
1 parent 1b1fb4e commit 2e0f735
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/bot_botenemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ static void BestEnemy_apply(gedict_t *test_enemy, float *best_score, gedict_t **
enemy_score = look_traveltime + g_random();
}

// Prioritize enemy with flag
if (test_enemy->ctf_flag & CTF_FLAG) enemy_score /= 2;

if (enemy_score < *best_score && look_marker != NULL) // TODO hiipe - crashes here sometimes! Surely it should be possible for look_marker to be NULL?
Expand Down
3 changes: 2 additions & 1 deletion src/bot_botgoals.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static qbool GoalLeaveForTeammate(gedict_t *self, gedict_t *goal_entity)
if (streq(goal_entity->classname, ignore[i])) return false;
}

// Let the bot with the highest desire take the item, if the bots can see eachother.
// Let the bot with the highest desire take the item, if the bots can see each other.
if (goal_entity == player->fb.best_goal
&& Visible_360(self, player)
&& goal_entity->fb.saved_goal_desire <= player->fb.best_goal->fb.saved_goal_desire)
Expand Down Expand Up @@ -156,6 +156,7 @@ void EvalGoal(gedict_t *self, gedict_t *goal_entity)
if (match_end_time && goal_entity->fb.goal_respawn_time > match_end_time)
{
goal_entity->fb.saved_goal_desire = 0;

return;
}

Expand Down
2 changes: 0 additions & 2 deletions src/bot_botwater.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

static qbool BotCanReachMarker(gedict_t *self)
{
self->fb.linked_marker = self->fb.touch_marker;

vec3_t spot1, spot2;

VectorCopy(self->fb.linked_marker->s.v.origin, spot2);
Expand Down
4 changes: 2 additions & 2 deletions src/bot_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ static void BotFileGenerate(void)
snprintf(date, sizeof(date), "%d", i_rnd(0, 9999));
}

snprintf(fileName, sizeof(fileName), "bots/maps/%s[%s]%s.bot",
strnull(entityFile) ? mapname : entityFile, date, isCTF() ? "_ctf" : "");
snprintf(fileName, sizeof(fileName), "bots/maps/%s%s[%s].bot",
strnull(entityFile) ? mapname : entityFile, isCTF() ? "_ctf" : "", date);
file = std_fwopen("%s", fileName);
if (file == -1)
{
Expand Down
4 changes: 2 additions & 2 deletions src/bot_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static float goal_rune(gedict_t* self, gedict_t* rune)
if (!isCTF()) return 0;

int newRune = rune->ctf_flag;
int currentRune = self->ctf_flag & 15;
int currentRune = self->ctf_flag & CTF_RUNE_MASK;

// Already have a rune
if (self->ctf_flag & CTF_RUNE_MASK)
Expand Down Expand Up @@ -463,7 +463,7 @@ static float goal_rune(gedict_t* self, gedict_t* rune)
gedict_t* teammate = IdentifyMostVisibleTeammate(self);
if (teammate != world && !teammate->isBot && !(teammate->ctf_flag & CTF_RUNE_MASK))
{
// If a human is near and no enemies are, let them take the flag
// If a human is near and no enemies are, let them take the rune
vec3_t toTeam;
VectorSubtract(rune->s.v.origin, teammate->s.v.origin, toTeam);
float distance = VectorLength(toTeam);
Expand Down
7 changes: 0 additions & 7 deletions src/route_lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ void ZoneMarker(gedict_t *from_marker, gedict_t *to_marker, qbool path_normal, q
middle_marker = from_marker->fb.zones[to_marker->fb.Z_ - 1].reverse_marker;
zone_time = from_marker->fb.zones[to_marker->fb.Z_ - 1].reverse_time;
}

// TODO hiipe - FIXME
//if (!middle_marker)
//{
// middle_marker = dropper;
// zone_time = 1000000;
//}
}

gedict_t* ZonePathMarker(gedict_t *from_marker, gedict_t *to_marker, qbool path_normal,
Expand Down

0 comments on commit 2e0f735

Please sign in to comment.