tune(trail): vida més llarga, offset darrere i paleta vermella per al P2
This commit is contained in:
@@ -55,12 +55,12 @@ namespace Effects {
|
||||
}
|
||||
}
|
||||
|
||||
for (std::size_t player_id = 0; player_id < ships.size(); player_id++) {
|
||||
tryEmitFromShip(ships[player_id], player_id, delta_time);
|
||||
for (std::size_t i = 0; i < ships.size(); i++) {
|
||||
tryEmitFromShip(ships[i], static_cast<std::uint8_t>(i), delta_time);
|
||||
}
|
||||
}
|
||||
|
||||
void TrailManager::tryEmitFromShip(const Ship& ship, std::size_t player_id, float delta_time) {
|
||||
void TrailManager::tryEmitFromShip(const Ship& ship, std::uint8_t player_id, float delta_time) {
|
||||
if (!ship.isActive()) {
|
||||
emit_cooldown_[player_id] = 0.0F;
|
||||
return;
|
||||
@@ -88,13 +88,13 @@ namespace Effects {
|
||||
.x = CENTER.x - (Defaults::Trail::REAR_OFFSET_PX * COS_F) + JITTER_X,
|
||||
.y = CENTER.y - (Defaults::Trail::REAR_OFFSET_PX * SIN_F) + JITTER_Y};
|
||||
|
||||
emitAt(REAR);
|
||||
emitAt(REAR, player_id);
|
||||
|
||||
emit_cooldown_[player_id] = Defaults::Trail::EMIT_INTERVAL_S +
|
||||
randUniform(-Defaults::Trail::EMIT_JITTER_S, Defaults::Trail::EMIT_JITTER_S);
|
||||
}
|
||||
|
||||
void TrailManager::emitAt(Vec2 pos) {
|
||||
void TrailManager::emitAt(Vec2 pos, std::uint8_t player_id) {
|
||||
const int SLOT = findFreeSlot();
|
||||
if (SLOT < 0) {
|
||||
return; // pool ple — descart silenciós
|
||||
@@ -102,6 +102,7 @@ namespace Effects {
|
||||
|
||||
Particle& particle = pool_[static_cast<std::size_t>(SLOT)];
|
||||
particle.active = true;
|
||||
particle.player_id = player_id;
|
||||
particle.origin = pos;
|
||||
particle.phase_x = randUniform(0.0F, TAU);
|
||||
particle.phase_y = randUniform(0.0F, TAU);
|
||||
@@ -146,10 +147,18 @@ namespace Effects {
|
||||
|
||||
const float MIX = 0.5F + (0.5F * std::sin((TAU * Defaults::Trail::PULSE_FREQ_HZ * time_accumulator_) + particle.phase_pulse));
|
||||
|
||||
const bool IS_P2 = particle.player_id == 1;
|
||||
const unsigned char A_R = IS_P2 ? Defaults::Trail::COLOR_P2_A_R : Defaults::Trail::COLOR_A_R;
|
||||
const unsigned char A_G = IS_P2 ? Defaults::Trail::COLOR_P2_A_G : Defaults::Trail::COLOR_A_G;
|
||||
const unsigned char A_B = IS_P2 ? Defaults::Trail::COLOR_P2_A_B : Defaults::Trail::COLOR_A_B;
|
||||
const unsigned char B_R = IS_P2 ? Defaults::Trail::COLOR_P2_B_R : Defaults::Trail::COLOR_B_R;
|
||||
const unsigned char B_G = IS_P2 ? Defaults::Trail::COLOR_P2_B_G : Defaults::Trail::COLOR_B_G;
|
||||
const unsigned char B_B = IS_P2 ? Defaults::Trail::COLOR_P2_B_B : Defaults::Trail::COLOR_B_B;
|
||||
|
||||
const SDL_Color COLOR = {
|
||||
.r = lerpU8(Defaults::Trail::COLOR_A_R, Defaults::Trail::COLOR_B_R, MIX),
|
||||
.g = lerpU8(Defaults::Trail::COLOR_A_G, Defaults::Trail::COLOR_B_G, MIX),
|
||||
.b = lerpU8(Defaults::Trail::COLOR_A_B, Defaults::Trail::COLOR_B_B, MIX),
|
||||
.r = lerpU8(A_R, B_R, MIX),
|
||||
.g = lerpU8(A_G, B_G, MIX),
|
||||
.b = lerpU8(A_B, B_B, MIX),
|
||||
.a = 255};
|
||||
|
||||
const float CURRENT_SCALE = particle.scale * FADE;
|
||||
|
||||
Reference in New Issue
Block a user