From 4c2d219e45bf8063c2afe78aedfbd1c08a6525b0 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 30 Apr 2020 14:57:21 -0700 Subject: [PATCH] Move big chunky pixel colors to separate function Again, to make sure colors don't update more than 1000/34 frames a second, we'll need to separate this color calculation from rendeirng functions. --- desktop_version/src/Graphics.cpp | 23 ++++++++++++++--------- desktop_version/src/Graphics.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 50db9412..d980bea8 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1599,15 +1599,7 @@ void Graphics::drawentities() case 3: // Big chunky pixels! prect.x = xp; prect.y = yp - yoff; - //A seperate index of colours, for simplicity - if(obj.entities[i].colour==1) - { - FillRect(backBuffer, prect, (fRandom() * 64), 10, 10); - } - else if (obj.entities[i].colour == 2) - { - FillRect(backBuffer,prect, int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow); - } + FillRect(backBuffer, prect, bigchunkygetcol(obj.entities[i].colour)); break; case 4: // Small pickups huetilesetcol(obj.entities[i].colour); @@ -2673,6 +2665,19 @@ void Graphics::huetilesetcol(int t) } } +Uint32 Graphics::bigchunkygetcol(int t) +{ + //A seperate index of colours, for simplicity + switch (t) + { + case 1: + return getRGB((fRandom() * 64), 10, 10); + case 2: + return getRGB(int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow); + } + return 0x00000000; +} + void Graphics::setwarprect( int a, int b, int c, int d ) { warprect.x = a; diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 0b4cf43c..2b0105b8 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -34,6 +34,7 @@ public: void drawhuetile(int x, int y, int t); void huetilesetcol(int t); + Uint32 bigchunkygetcol(int t); void drawgravityline(int t);