Fixed bug with dead players being zombies (not visible but playing). Added option to change color at the beginning of level 1. Explosion animation now has player's color and takes place for all of them when they are killed (before only for last one). Final explosion animation and gameover now start where last player was killed.

This commit is contained in:
Phew
2026-03-15 22:35:00 +01:00
parent 9bf87677a4
commit a8c6a01422
3 changed files with 104 additions and 41 deletions

23
TWANG32/colors.h Normal file
View File

@@ -0,0 +1,23 @@
void random_player_color(Player& p)
{
float h = (float)random(0, 100000) / 100000.0;
float s = 0.95f; // high saturation
float v = 1.0f; // max brightness
float c = v * s;
float x = c * (1 - fabsf(fmodf(h * 6.0f, 2) - 1));
float m = v - c;
float r1=0, g1=0, b1=0;
if (h < 1.0/6) { r1=c; g1=x; }
else if (h < 2.0/6) { r1=x; g1=c; }
else if (h < 3.0/6) { g1=c; b1=x; }
else if (h < 4.0/6) { g1=x; b1=c; }
else if (h < 5.0/6) { r1=x; b1=c; }
else { r1=c; b1=x; }
p.setColor( (unsigned char)((r1 + m) * 255),
(unsigned char)((g1 + m) * 255),
(unsigned char)((b1 + m) * 255));
}