feat(lighting): seed estable per emissor (no deriva pel moviment)

This commit is contained in:
JailDesigner committed 2026-05-12 22:37:27 +02:00
1 parent 0046d526b0
commit 5cc8e349a5
5 files changed
+35 -15

No files matched your search

+5
View File
@@ -146,6 +146,11 @@ class Player : public AnimatedSprite {
// per a que el cercle "salti" amb el jugador, no es quedi al sòl.
[[nodiscard]] static auto getLightRadius() -> int { return light_radius; }
[[nodiscard]] static auto getLightFlicker() -> bool { return light_flicker; }
// Seed estable per al flicker: reusem `id_` (0 o 1 en multijugador
// local) amb un offset gran per evitar col·lisions amb el contador
// d'Entity (que arrenca des de 1). Així P1 i P2 oscil·len en fases
// pròpies que no s'encavalquen amb cap entitat.
[[nodiscard]] auto getLightSeed() const -> int { return id_ + 1000; }
[[nodiscard]] auto getLightCenter() const -> SDL_FPoint;
Player(const std::string& anim_key, int id, float x, float y, const Controls& controls, const Map::Info& map_info, int paint_tile_index = -1);