Curation round 15: restart and mods, Brimstone and Tech X, room gaps, eight bosses, the Womb and Mom's Heart, the Forgotten and tainted starts, alt path enemies and exits
This commit is contained in:
1 parent
6e3da161fc
commit
78a2680134
128 files changed
+13196
-2933
No files matched your search
+42
-3
@@ -4,6 +4,7 @@
|
||||
#include "npc_ai.h"
|
||||
#include "npc_basement.h"
|
||||
#include "room.h"
|
||||
#include "room_grid.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <queue>
|
||||
@@ -749,10 +750,48 @@ void PathFinder::MoveRandomlyAxisAligned(float speed, StatusMode mode)
|
||||
if (!vector_is_zero(movementTarget)) axis_steer(*this, speed, elapsed);
|
||||
}
|
||||
|
||||
// 007e6650
|
||||
void PathFinder::MoveRandomlyBoss(StatusMode)
|
||||
// How a boss wanders: pushed at half its speed along its heading, veering one time in 30, turning back off walls every
|
||||
// 5 frames, and trying up to 5 new headings while the cell 10 ahead is blocked.
|
||||
constexpr float BOSS_WANDER_PUSH = 0.5f;
|
||||
constexpr uint32_t BOSS_WANDER_TURN_ODDS = 30;
|
||||
constexpr int BOSS_WANDER_BOUNCE_FRAMES = 5;
|
||||
constexpr int BOSS_WANDER_TRIES = 5;
|
||||
constexpr float BOSS_WANDER_LOOKAHEAD = 10;
|
||||
|
||||
// 007e6650 Wanders like a boss along moveDirection. Stuck inside a wall it now and then heads for a free spot instead.
|
||||
// Unless told to ignore its status, a friendly owner paths to its target and a feared or shrunk one flees.
|
||||
void PathFinder::MoveRandomlyBoss(StatusMode mode)
|
||||
{
|
||||
reconstruction_missing("PathFinder::MoveRandomlyBoss 007e6650");
|
||||
if (entity->minecart) return;
|
||||
if (mode == STATUS_OBEYED && is_entity_friendly())
|
||||
return FindGridPath(static_cast<Entity_NPC*>(entity)->CalcTargetPosition(0), WANDER_FRIENDLY_SPEED, 0,
|
||||
DIRECT_PATH_FAR);
|
||||
if (mode == STATUS_OBEYED && entity->HasEntityFlags(FLAG_FEAR | FLAG_SHRINK))
|
||||
return EvadeTarget(static_cast<Entity_NPC*>(entity)->GetPlayerTarget()->pos, STATUS_OBEYED);
|
||||
|
||||
if (vector_is_zero(moveDirection)) moveDirection = random_direction();
|
||||
npc_push(*entity, vector_scale(moveDirection, BOSS_WANDER_PUSH));
|
||||
|
||||
Room& room = *g_game->room;
|
||||
if (room_grid_collision_at(entity->pos) != 0)
|
||||
{
|
||||
if (Random() % BOSS_WANDER_TURN_ODDS != 0) return;
|
||||
Vector spot = room_free_pickup_position_find({.position = entity->pos});
|
||||
moveDirection = vector_normalized(vector_sub(spot, entity->pos));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Random() % BOSS_WANDER_TURN_ODDS == 0)
|
||||
moveDirection = vector_normalized(vector_add(moveDirection, random_direction()));
|
||||
if (entity->isCollidesWithGrid && entity->IsFrame(BOSS_WANDER_BOUNCE_FRAMES, 0))
|
||||
moveDirection = vector_scale(moveDirection, -1);
|
||||
for (int triesLeft = BOSS_WANDER_TRIES; triesLeft > 0; triesLeft--)
|
||||
{
|
||||
Vector ahead = vector_add(entity->pos, vector_scale(moveDirection, BOSS_WANDER_LOOKAHEAD));
|
||||
if (room.GetGridCollision(room.GetGridIndex(ahead)) == 0) return;
|
||||
moveDirection = vector_normalized(vector_sub(random_direction(), moveDirection));
|
||||
entity->velocity = {};
|
||||
}
|
||||
}
|
||||
|
||||
// 007e6b90
|
||||
|
||||
Reference in new issue
Block a user