fixed main fireworks

This commit is contained in:
2025-11-29 19:10:26 +01:00
parent 907c645ea3
commit a7d67b26a5
2 changed files with 314 additions and 133 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include <vector>
#include <array>
#include <memory>
#include <SDL3/SDL.h>
@ -73,21 +74,52 @@ public:
// Fireworks system (for menu animation)
struct BlockParticle {
float x, y, vx, vy;
int type;
float life, maxLife;
float size;
int generation = 0; // 0 = primary, 1 = secondary, 2 = tertiary
bool hasExploded = false; // Track if this particle has spawned children
float x = 0.0f;
float y = 0.0f;
float vx = 0.0f;
float vy = 0.0f;
float size = 0.0f;
float life = 0.0f;
float maxLife = 0.0f;
SDL_Color color{255, 255, 255, 255};
SDL_Color accentColor{255, 255, 255, 255};
int generation = 0;
bool hasExploded = false;
bool crackle = false;
float flickerSeed = 0.0f;
bool dualColor = false;
float colorBlendSpeed = 0.0f;
};
struct SparkParticle {
float x = 0.0f;
float y = 0.0f;
float vx = 0.0f;
float vy = 0.0f;
float life = 0.0f;
float maxLife = 0.0f;
float thickness = 1.0f;
SDL_Color color{255, 255, 255, 255};
};
struct TetrisFirework {
std::vector<BlockParticle> particles;
std::vector<SparkParticle> sparks;
bool active = false;
float originX = 0.0f;
float originY = 0.0f;
float elapsedMs = 0.0f;
int nextBurst = 0;
std::array<float, 3> burstSchedule{0.0f, 250.0f, 520.0f};
std::array<SDL_Color, 3> burstColors{};
};
std::vector<TetrisFirework> fireworks;
Uint64 lastFireworkTime = 0;
bool pendingStaggerFirework = false;
Uint64 nextStaggerFireworkTime = 0;
float lastFireworkX = 0.0f;
float lastFireworkY = 0.0f;
// Fireworks management methods
void updateFireworks(double frameMs);