fix(hazard): aterrar damunt d'un Hole salta el LANDING_STUN

This commit is contained in:
JailDesigner committed 2026-04-30 13:53:26 +02:00
1 parent 4da50571eb
commit 3e5217066f
5 files changed
+80 -5

No files matched your search

@@ -58,6 +58,23 @@ void EntityManager::renderAll() {
for (const auto& e : entities_) { renderEntity(*e); }
}
auto EntityManager::findFloorTriggerAt(const SDL_FRect& rect) const -> const Entity* {
// Cerca lineal sobre `entities_`: cost menyspreable amb poques
// desenes d'entitats per sala i una sola crida per frame i per
// jugador (a l'aterratge). Si esdevé calent, es podria indexar
// per cel·la del tilemap. La doble condició filtra exclusivament
// decals de sòl que volen rebre triggers — avui Hole; en el
// futur pinchos plans, plaques de pressió, charcos.
for (const auto& entity : entities_) {
if (!entity->triggersOnOverlap()) { continue; }
if (!entity->isFloorDecal()) { continue; }
const auto BOX = entity->getCollisionRect();
const bool OVERLAP = rect.x + rect.w > BOX.x && BOX.x + BOX.w > rect.x && rect.y + rect.h > BOX.y && BOX.y + BOX.h > rect.y;
if (OVERLAP) { return entity.get(); }
}
return nullptr;
}
void EntityManager::checkPlayerCollisions(const std::vector<Player*>& players) {
if (players.empty()) { return; }
for (const auto& entity : entities_) {