forked from jaildesigner-jailgames/jaildoctors_dilemma
treballant en Player: abans d'entrar a moveOnSlope()
This commit is contained in:
@@ -202,6 +202,26 @@ auto CollisionMap::checkRightSlopes(const SDL_FPoint& p) -> bool {
|
||||
});
|
||||
}
|
||||
|
||||
// Obtiene puntero a slope en un punto (prioriza left_slopes_ sobre right_slopes_)
|
||||
auto CollisionMap::getSlopeAtPoint(const SDL_FPoint& p) const -> const LineDiagonal* {
|
||||
// Primero busca en rampas izquierdas
|
||||
for (const auto& slope : left_slopes_) {
|
||||
if (checkCollision(p, slope)) {
|
||||
return &slope;
|
||||
}
|
||||
}
|
||||
|
||||
// Luego busca en rampas derechas
|
||||
for (const auto& slope : right_slopes_) {
|
||||
if (checkCollision(p, slope)) {
|
||||
return &slope;
|
||||
}
|
||||
}
|
||||
|
||||
// No hay colisión con ninguna slope
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// === Helpers para recopilar tiles ===
|
||||
|
||||
// Helper: recopila tiles inferiores (muros sin muro debajo)
|
||||
|
||||
@@ -63,6 +63,7 @@ class CollisionMap {
|
||||
auto checkLeftSlopes(const SDL_FPoint& p) -> bool; // Colisión punto con rampas izquierdas
|
||||
auto checkRightSlopes(const LineVertical& line) -> int; // Colisión línea con rampas derechas (retorna Y)
|
||||
auto checkRightSlopes(const SDL_FPoint& p) -> bool; // Colisión punto con rampas derechas
|
||||
auto getSlopeAtPoint(const SDL_FPoint& p) const -> const LineDiagonal*; // Obtiene puntero a slope en un punto
|
||||
|
||||
// --- Métodos estáticos ---
|
||||
static auto getTileSize() -> int { return TILE_SIZE; } // Tamaño del tile en pixels
|
||||
|
||||
@@ -246,6 +246,11 @@ auto Room::checkRightSlopes(const SDL_FPoint& p) -> bool {
|
||||
return collision_map_->checkRightSlopes(p);
|
||||
}
|
||||
|
||||
// Obtiene puntero a slope en un punto
|
||||
auto Room::getSlopeAtPoint(const SDL_FPoint& p) const -> const LineDiagonal* {
|
||||
return collision_map_->getSlopeAtPoint(p);
|
||||
}
|
||||
|
||||
|
||||
// Carga las variables desde un fichero de mapa (delegado a RoomLoader)
|
||||
auto Room::loadRoomFile(const std::string& file_path, bool verbose) -> Data {
|
||||
|
||||
@@ -86,6 +86,7 @@ class Room {
|
||||
auto checkLeftSlopes(const SDL_FPoint& p) -> bool; // Comprueba las colisiones
|
||||
auto checkRightSlopes(const LineVertical& line) -> int; // Comprueba las colisiones
|
||||
auto checkRightSlopes(const SDL_FPoint& p) -> bool; // Comprueba las colisiones
|
||||
auto getSlopeAtPoint(const SDL_FPoint& p) const -> const LineDiagonal*; // Obtiene puntero a slope en un punto
|
||||
void setPaused(bool value); // Pone el mapa en modo pausa
|
||||
[[nodiscard]] auto getConveyorBeltDirection() const -> int { return conveyor_belt_direction_; } // Obten la direccion de las superficies automaticas
|
||||
|
||||
|
||||
Reference in New Issue
Block a user