CGE2: Implement snFlash().

This commit is contained in:
uruk 2014-07-29 10:38:05 +02:00
parent 5016e09acf
commit d4e14253c4
2 changed files with 22 additions and 3 deletions

View File

@ -254,7 +254,7 @@ public:
void snRmMTake(Sprite *spr);
void snRmFTake(Sprite *spr);
void snSetRef(Sprite *spr, int val);
void snFlash(int val);
void snFlash(bool on);
void snCycle(int cnt);
void snWalk(Sprite *spr, int val);
void snReach(Sprite *spr, int val);

View File

@ -555,8 +555,27 @@ void CGE2Engine::snSetRef(Sprite *spr, int val) {
}
}
void CGE2Engine::snFlash(int val) {
warning("STUB: CGE2Engine::snFlash()");
void CGE2Engine::snFlash(bool on) {
if (on) {
Dac *pal = (Dac *)malloc(sizeof(Dac) * kPalCount);
if (pal) {
memcpy(pal, _vga->_sysPal, kPalSize);
for (int i = 0; i < kPalCount; i++) {
register int c;
c = pal[i]._r << 1;
pal[i]._r = (c < 64) ? c : 63;
c = pal[i]._g << 1;
pal[i]._g = (c < 64) ? c : 63;
c = pal[i]._b << 1;
pal[i]._b = (c < 64) ? c : 63;
}
_vga->setColors(pal, 64);
}
free(pal);
} else
_vga->setColors(_vga->_sysPal, 64);
_dark = false;
}
void CGE2Engine::snCycle(int cnt) {