From d419c6ed5bdc9958f6b5b52d9bca07d25261a52d Mon Sep 17 00:00:00 2001 From: NyakoFox Date: Wed, 5 Feb 2025 01:22:03 -0400 Subject: [PATCH] Remove extra unnecessary palettes This merges the colors from other palettes into the general entity palette function. --- desktop_version/src/Ent.cpp | 17 +++-- desktop_version/src/Entity.cpp | 9 ++- desktop_version/src/Graphics.cpp | 119 ++++++++++++------------------- desktop_version/src/Graphics.h | 3 - 4 files changed, 62 insertions(+), 86 deletions(-) diff --git a/desktop_version/src/Ent.cpp b/desktop_version/src/Ent.cpp index f159547f..1a6a206c 100644 --- a/desktop_version/src/Ent.cpp +++ b/desktop_version/src/Ent.cpp @@ -613,17 +613,24 @@ void entclass::updatecolour(void) switch (size) { case 0: // Sprites + case 3: // Big chunky pixels! + case 4: // Small pickups case 7: // Teleporter case 9: // Really Big Sprite! (2x2) case 10: // 2x1 Sprite case 13: // Special for epilogue: huge hero! realcol = graphics.getcol(colour); break; - case 3: // Big chunky pixels! - realcol = graphics.bigchunkygetcol(colour); - break; - case 4: // Small pickups - realcol = graphics.huetilegetcol(); + case 5: // Horizontal gravity line + case 6: // Vertical gravity line + if (life == 0) + { + realcol = graphics.getcol(colour); + } + else + { + realcol = graphics.getcol(24); + } break; case 11: // The fucking elephant if (game.noflashingmode) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index d329e3a8..7fe5efec 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -1292,7 +1292,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int //Size 1 is a tile //Beyond that are special cases (to do) //Size 2 is a moving platform of width 4 (32) - //Size 3 is apparently a "bug chunky pixel" + //Size 3 is apparently a "big chunky pixel" //Size 4 is a coin/small pickup //Size 5 is a horizontal line, 6 is vertical @@ -1515,7 +1515,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 6: //Decorative particles entity.rule = 2; entity.type = EntityType_PARTICLE; //Particles - entity.colour = 1; + entity.colour = 27; entity.size = 3; entity.vx = meta1; entity.vy = meta2; @@ -1525,7 +1525,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int case 7: //Decorative particles entity.rule = 2; entity.type = EntityType_PARTICLE; //Particles - entity.colour = 2; + entity.colour = 0; entity.size = 3; entity.vx = meta1; entity.vy = meta2; @@ -1536,6 +1536,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int entity.rule = 3; entity.type = EntityType_COIN; entity.size = 4; + entity.colour = 26; entity.tile = 48; entity.w = 8; entity.h = 8; @@ -1589,6 +1590,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int entity.type = EntityType_HORIZONTAL_GRAVITY_LINE; entity.size = 5; entity.life = 0; + entity.colour = 25; entity.w = meta1; entity.h = 1; entity.onentity = 1; @@ -1598,6 +1600,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int entity.type = EntityType_VERTICAL_GRAVITY_LINE; entity.size = 6; entity.life = 0; + entity.colour = 25; entity.w = 1; entity.h = meta1; //entity.colour = 0; diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index be992db0..ef6d24f6 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1869,53 +1869,7 @@ void Graphics::drawgravityline(const int t, const int x, const int y, const int return; } - if (obj.entities[t].life == 0) - { - if (game.noflashingmode) - { - set_color(200 - 20, 200 - 20, 200 - 20); - draw_line(x, y, x + w, y + h); - return; - } - - switch(linestate) - { - case 0: - set_color(200 - 20, 200 - 20, 200 - 20); - break; - case 1: - set_color(245 - 30, 245 - 30, 225 - 30); - break; - case 2: - set_color(225 - 30, 245 - 30, 245 - 30); - break; - case 3: - set_color(200 - 20, 200 - 20, 164 - 10); - break; - case 4: - set_color(196 - 20, 255 - 30, 224 - 20); - break; - case 5: - set_color(196 - 20, 235 - 30, 205 - 20); - break; - case 6: - set_color(164 - 10, 164 - 10, 164 - 10); - break; - case 7: - set_color(205 - 20, 245 - 30, 225 - 30); - break; - case 8: - set_color(225 - 30, 255 - 30, 205 - 20); - break; - case 9: - set_color(245 - 30, 245 - 30, 245 - 30); - break; - } - } - else - { - set_color(96, 96, 96); - } + set_color(obj.entities[t].realcol); draw_line(x, y, x + w, y + h); } @@ -3084,8 +3038,49 @@ SDL_Color Graphics::getcol( int t ) case 23: // Enemy : Indicator Gray return getRGB(255 - help.glow / 2 - (int) (GETCOL_RANDOM * 40), 255 - help.glow/2 - (int) (GETCOL_RANDOM * 40), 255 - help.glow/2 - (int) (GETCOL_RANDOM * 40)); - // Trophies - // cyan + case 24: // Gravity line (Inactive) + return getRGB(96, 96, 96); + case 25: // Gravity line (Active) + if (game.noflashingmode) + { + return getRGB(200 - 20, 200 - 20, 200 - 20); + } + + switch (linestate) + { + default: + case 0: + return getRGB(200 - 20, 200 - 20, 200 - 20); + case 1: + return getRGB(245 - 30, 245 - 30, 225 - 30); + case 2: + return getRGB(225 - 30, 245 - 30, 245 - 30); + case 3: + return getRGB(200 - 20, 200 - 20, 164 - 10); + case 4: + return getRGB(196 - 20, 255 - 30, 224 - 20); + case 5: + return getRGB(196 - 20, 235 - 30, 205 - 20); + case 6: + return getRGB(164 - 10, 164 - 10, 164 - 10); + case 7: + return getRGB(205 - 20, 245 - 30, 225 - 30); + case 8: + return getRGB(225 - 30, 255 - 30, 205 - 20); + case 9: + return getRGB(245 - 30, 245 - 30, 245 - 30); + } + case 26: // Coin + if (game.noflashingmode) + { + return getRGB(234, 234, 10); + } + return getRGB(250 - (int) (GETCOL_RANDOM * 32), 250 - (int) (GETCOL_RANDOM * 32), 10); + case 27: // Particle flashy red + return getRGB((GETCOL_RANDOM * 64), 10, 10); + + // Trophies + // cyan case 30: return RGBf(160, 200, 220); // Purple @@ -3202,32 +3197,6 @@ void Graphics::menuoffrender(void) } } -SDL_Color Graphics::huetilegetcol() -{ - if (game.noflashingmode) - { - return getRGB(234, 234, 10); - } - - return getRGB(250 - (int) (fRandom() * 32), 250 - (int) (fRandom() * 32), 10); -} - -SDL_Color Graphics::bigchunkygetcol(int t) -{ - // A seperate index of colours, for simplicity - float random = game.noflashingmode ? 0.5 : fRandom(); - - switch (t) - { - case 1: - return getRGB(random * 64, 10, 10); - case 2: - return getRGB(160 - help.glow / 2 - (int) (random * 20), 200 - help.glow / 2, 220 - help.glow); - } - const SDL_Color color = {0, 0, 0, 0}; - return color; -} - void Graphics::textboxabsolutepos(int x, int y) { if (!INBOUNDS_VEC(m, textboxes)) diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index ea9a2130..e04ddf6d 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -51,9 +51,6 @@ public: GraphicsResources grphx; - SDL_Color huetilegetcol(); - SDL_Color bigchunkygetcol(int t); - void drawgravityline(int t, int x, int y, int w, int h); void drawcoloredtile(int x, int y, int t, int r, int g, int b);