Curation round 9: floors and walls, room transitions, collision, the first enemies, saving, damage, pickups
Seven agents took over the backdrop's floor and wall rendering, room transitions (StartRoomTransition, on_leave, room_enter), grid collision with tear hits and decal baking, Entity_NPC's core with the AI dispatch and the first enemies (flies, Gaper, Pooter, Clotty, Horf, Dip, Spider), the run's save, player damage, PlayerManager::Update, ShowName, pickups, slots and the common effects. Integration added LuaEngine::PostNewLevel/PostNewRoom, one shared lua_callback_check (4 copies merged) and the enemy type range the original checks. Under gdb a run draws its rooms with floors and walls, walks between rooms, fights Gapers with contact damage and the damage flash, and collects pickups. Next: tears hitting enemies, pathfinding, item pedestals, death. 2891 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69a354f843
commit
48933cd312
59 files changed
+13387
-6056
No files matched your search
@@ -0,0 +1,109 @@
|
||||
#include "path_finder.h"
|
||||
#include "entity_npc.h"
|
||||
#include "game.h"
|
||||
#include "log.h"
|
||||
#include "room.h"
|
||||
|
||||
constexpr float GRID_CELL = 40;
|
||||
constexpr float GRID_TOP = 120;
|
||||
constexpr float HALF = 0.5f;
|
||||
constexpr int PATH_ENEMY_TYPE_LAST = 999;
|
||||
|
||||
// 007e3260 Forgets every path, target and evasion, and its grid cell.
|
||||
void PathFinder::Reset()
|
||||
{
|
||||
gridIndex = -1;
|
||||
pathStep = 0;
|
||||
moveCountdown = 0;
|
||||
hasDirectPath = false;
|
||||
isPathFound = false;
|
||||
gridPathTarget = {};
|
||||
evadeMovementCountdown = 0;
|
||||
evadeDistance = 0;
|
||||
stuckFrames = 0;
|
||||
visitedGridIndices.clear();
|
||||
direction = PATH_DIRECTION_NONE;
|
||||
directionTimer = 0;
|
||||
targetGridIndex = -1;
|
||||
canCrushRocks = false;
|
||||
movementTarget = {};
|
||||
moveDirection = {};
|
||||
}
|
||||
|
||||
// 007e6fa0 Forgets the spot it wanders to.
|
||||
void PathFinder::ResetMovementTarget()
|
||||
{
|
||||
movementTarget = {};
|
||||
moveDirection = {};
|
||||
}
|
||||
|
||||
// 007e6ff0 Notes the grid cell its owner stands in, or -1 outside the grid.
|
||||
void PathFinder::UpdateGridIndex()
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
int column = (int)((entity->pos.x - GRID_CELL) / GRID_CELL + HALF);
|
||||
int row = (int)((entity->pos.y - GRID_TOP) / GRID_CELL + HALF);
|
||||
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
|
||||
gridIndex = isInside ? room.gridWidth * row + column : -1;
|
||||
}
|
||||
|
||||
// 007e3340 Whether its owner paths as the players' side: charmed, the Blood Puppy, after a baited target, or an
|
||||
// enemy under a player's control or forced onto a target.
|
||||
bool PathFinder::is_entity_friendly()
|
||||
{
|
||||
if (!entity) return false;
|
||||
if (entity->HasEntityFlags(FLAG_CHARM) || entity->type == ENTITY_BLOOD_PUPPY) return true;
|
||||
if (entity->target && entity->target->HasEntityFlags(FLAG_BAITED)) return true;
|
||||
if (entity->type < ENTITY_FIRST_ENEMY || entity->type > PATH_ENEMY_TYPE_LAST) return false;
|
||||
|
||||
Entity_NPC* npc = static_cast<Entity_NPC*>(entity);
|
||||
return npc->controllerID != -1 || npc->forcedTarget;
|
||||
}
|
||||
|
||||
// 007e33c0
|
||||
void PathFinder::FindGridPath(const Vector&, float, int, bool)
|
||||
{
|
||||
reconstruction_missing("PathFinder::FindGridPath 007e33c0");
|
||||
}
|
||||
|
||||
// 007e4940
|
||||
void PathFinder::EvadeTarget(const Vector&, StatusMode)
|
||||
{
|
||||
reconstruction_missing("PathFinder::EvadeTarget 007e4940");
|
||||
}
|
||||
|
||||
// 007e6300
|
||||
bool PathFinder::MoveRandomly(StatusMode)
|
||||
{
|
||||
reconstruction_missing("PathFinder::MoveRandomly 007e6300");
|
||||
}
|
||||
|
||||
// 007e5340
|
||||
void PathFinder::MoveRandomlyAxisAligned(float, StatusMode)
|
||||
{
|
||||
reconstruction_missing("PathFinder::MoveRandomlyAxisAligned 007e5340");
|
||||
}
|
||||
|
||||
// 007e6650
|
||||
void PathFinder::MoveRandomlyBoss(StatusMode)
|
||||
{
|
||||
reconstruction_missing("PathFinder::MoveRandomlyBoss 007e6650");
|
||||
}
|
||||
|
||||
// 007e6b90
|
||||
void PathFinder::update_chase_movement()
|
||||
{
|
||||
reconstruction_missing("PathFinder::update_chase_movement 007e6b90");
|
||||
}
|
||||
|
||||
// 007e7070
|
||||
bool PathFinder::HasPathToPos(const Vector&, bool)
|
||||
{
|
||||
reconstruction_missing("PathFinder::HasPathToPos 007e7070");
|
||||
}
|
||||
|
||||
// 007e8010
|
||||
void PathFinder::SimulatePlayerMovement(float*)
|
||||
{
|
||||
reconstruction_missing("PathFinder::SimulatePlayerMovement 007e8010");
|
||||
}
|
||||
Reference in new issue
Block a user