Reducing the number of fade variants when the effect is running quicker, to gain some more CPU.

This commit is contained in:
Rezmason
2022-06-07 20:20:13 -07:00
parent 687c7ab613
commit c3f22a5afb

View File

@@ -128,12 +128,15 @@ static void init(void)
static int update(void* ud)
{
float delta;
int currentFadeSkip = 1;
if (sys->isCrankDocked()) {
speed += 0.07f;
if (speed > maxSpeed) {
speed = maxSpeed;
}
delta = sys->getElapsedTime() * speed;
currentFadeSkip = 6;
} else {
speed -= 0.07f;
if (speed < minSpeed) {
@@ -144,6 +147,8 @@ static int update(void* ud)
sys->resetElapsedTime();
time += delta;
int currentNumFades = numFades / currentFadeSkip;
PDButtons currentButtons;
sys->getButtonState(&currentButtons, NULL, NULL);
int addPDGlyphs = currentButtons & kButtonA && currentButtons & kButtonB;
@@ -160,7 +165,8 @@ static int update(void* ud)
1
);
int fadeIndex = brightness * numFades;
int fadeIndex = brightness * currentNumFades;
fadeIndex *= currentFadeSkip;
if (fadeIndex < 0) fadeIndex = 0;
if (fadeIndex >= numFades - 1) fadeIndex = numFades - 1;
if (cell->fadeIndex != fadeIndex) {