linters
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string
|
||||
|
||||
@@ -24,7 +25,7 @@ class AnimatedSprite;
|
||||
*/
|
||||
class Door : public SolidActor {
|
||||
public:
|
||||
enum class State : int {
|
||||
enum class State : std::uint8_t {
|
||||
CLOSED = 0,
|
||||
OPENING = 1,
|
||||
OPENED = 2
|
||||
|
||||
@@ -82,7 +82,7 @@ void MovingPlatform::recalcSegmentLength() {
|
||||
|
||||
float dx = path_[to].x - path_[from].x;
|
||||
float dy = path_[to].y - path_[from].y;
|
||||
segment_length_ = std::sqrt(dx * dx + dy * dy);
|
||||
segment_length_ = std::sqrt((dx * dx) + (dy * dy));
|
||||
}
|
||||
|
||||
// Avanza al siguiente segmento
|
||||
@@ -174,8 +174,8 @@ void MovingPlatform::update(float delta_time) {
|
||||
int from = getSegmentFrom();
|
||||
int to = getSegmentTo();
|
||||
|
||||
float new_x = path_[from].x + (path_[to].x - path_[from].x) * t;
|
||||
float new_y = path_[from].y + (path_[to].y - path_[from].y) * t;
|
||||
float new_x = path_[from].x + ((path_[to].x - path_[from].x) * t);
|
||||
float new_y = path_[from].y + ((path_[to].y - path_[from].y) * t);
|
||||
sprite_->setPosX(new_x);
|
||||
sprite_->setPosY(new_y);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string
|
||||
#include <vector> // Para vector
|
||||
@@ -18,7 +19,7 @@ struct Waypoint {
|
||||
};
|
||||
|
||||
// Modo de recorrido de la ruta
|
||||
enum class LoopMode { PINGPONG,
|
||||
enum class LoopMode : std::uint8_t { PINGPONG,
|
||||
CIRCULAR };
|
||||
|
||||
// Tipo de función de easing
|
||||
|
||||
@@ -540,18 +540,10 @@ void Player::transitionToState(State state) {
|
||||
|
||||
switch (state) {
|
||||
case State::ON_GROUND:
|
||||
vy_ = 0;
|
||||
// Clamp vx al aterrizar (el salto puede dar un boost extra)
|
||||
if (vx_ > HORIZONTAL_VELOCITY) { vx_ = HORIZONTAL_VELOCITY; }
|
||||
if (vx_ < -HORIZONTAL_VELOCITY) { vx_ = -HORIZONTAL_VELOCITY; }
|
||||
if (previous_state_ == State::ON_AIR) {
|
||||
Audio::get()->playSound(land_sound_, Audio::Group::GAME);
|
||||
}
|
||||
break;
|
||||
case State::ON_SLOPE:
|
||||
vy_ = 0;
|
||||
if (vx_ > HORIZONTAL_VELOCITY) { vx_ = HORIZONTAL_VELOCITY; }
|
||||
if (vx_ < -HORIZONTAL_VELOCITY) { vx_ = -HORIZONTAL_VELOCITY; }
|
||||
// Clamp vx al aterrizar (el salto puede dar un boost extra)
|
||||
vx_ = std::clamp(vx_, -HORIZONTAL_VELOCITY, HORIZONTAL_VELOCITY);
|
||||
if (previous_state_ == State::ON_AIR) {
|
||||
Audio::get()->playSound(land_sound_, Audio::Group::GAME);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string
|
||||
#include <utility>
|
||||
@@ -17,13 +18,13 @@ class SolidActor;
|
||||
class Player {
|
||||
public:
|
||||
// --- Enums y Structs ---
|
||||
enum class State {
|
||||
enum class State : std::uint8_t {
|
||||
ON_GROUND,
|
||||
ON_SLOPE,
|
||||
ON_AIR,
|
||||
};
|
||||
|
||||
enum class Direction {
|
||||
enum class Direction : std::uint8_t {
|
||||
LEFT,
|
||||
RIGHT,
|
||||
UP,
|
||||
@@ -151,7 +152,7 @@ class Player {
|
||||
void syncSpriteAndCollider();
|
||||
void placeSprite();
|
||||
void animate(float delta_time);
|
||||
auto handleBorders() const -> Room::Border;
|
||||
[[nodiscard]] auto handleBorders() const -> Room::Border;
|
||||
|
||||
// --- Inicialización ---
|
||||
void initSprite(const std::string& animations_path);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
class SolidActor {
|
||||
public:
|
||||
// NOLINTNEXTLINE(performance-enum-size) -- bitmask con margen para crecer
|
||||
enum Flags : uint32_t {
|
||||
BLOCKS_PLAYER = 1U << 0U,
|
||||
CARRY_ON_TOP = 1U << 1U,
|
||||
|
||||
Reference in New Issue
Block a user