mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Reducing the number of fade variants when the effect is running quicker, to gain some more CPU.
This commit is contained in:
@@ -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(¤tButtons, 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) {
|
||||
|
||||
Reference in New Issue
Block a user