Open
Description
I believe the FadeStepColor function could be improved by changing the calls to set_bkg_palette and set_sprite_palette to one call each outside the for loop:
https://github.com/Zal0/ZGB/blob/master/common/src/Fade_b.c#L61
void FadeStepColor(UINT8 i) {
UINT8 pal, c;
UWORD palette[4];
UWORD palette_s[4];
UWORD* col = ZGB_Fading_BPal;
UWORD* col_s = ZGB_Fading_SPal;
for(pal = 0; pal < 8; pal ++) {
for(c = 0; c < 4; ++c, ++col, ++col_s) {
palette[c] = UpdateColor(i, *col);
palette_s[c] = UpdateColor(i, *col_s);
};
}
set_bkg_palette(pal, 8, palette);
set_sprite_palette(pal, 8, palette_s);
delay(20);
}
This would reduce the number of function calls, and in cases where the for loop takes longer than a single frame would reduce the chances of the palette updates spanning frames (since they occur closer together), thus reducing out-of-sync palette updates.
Metadata
Assignees
Labels
No labels
Activity