PRINCE: blackPalette(), setPalette(), O_BLACKPALETTE, O_SETUPPALETTE
This commit is contained in:
parent
c54699721a
commit
8829b20ce9
3 changed files with 51 additions and 1 deletions
|
@ -372,6 +372,9 @@ bool AnimListItem::loadFromStream(Common::SeekableReadStream &stream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrinceEngine::loadLocation(uint16 locationNr) {
|
bool PrinceEngine::loadLocation(uint16 locationNr) {
|
||||||
|
|
||||||
|
blackPalette();
|
||||||
|
|
||||||
_flicPlayer.close();
|
_flicPlayer.close();
|
||||||
|
|
||||||
memset(_textSlots, 0, sizeof(_textSlots));
|
memset(_textSlots, 0, sizeof(_textSlots));
|
||||||
|
@ -407,7 +410,6 @@ bool PrinceEngine::loadLocation(uint16 locationNr) {
|
||||||
Resource::loadResource(_roomBmp, "room", true);
|
Resource::loadResource(_roomBmp, "room", true);
|
||||||
if (_roomBmp->getSurface()) {
|
if (_roomBmp->getSurface()) {
|
||||||
_sceneWidth = _roomBmp->getSurface()->w;
|
_sceneWidth = _roomBmp->getSurface()->w;
|
||||||
_graph->setPalette(_roomBmp->getPalette());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadZoom(_mainHero->_zoomBitmap, _mainHero->kZoomBitmapLen, "zoom"); // TODO - second hero
|
loadZoom(_mainHero->_zoomBitmap, _mainHero->kZoomBitmapLen, "zoom"); // TODO - second hero
|
||||||
|
@ -1760,6 +1762,48 @@ void PrinceEngine::drawScreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrinceEngine::blackPalette() {
|
||||||
|
byte *paletteBackup = (byte *)malloc(256 * 3);
|
||||||
|
byte *blackPalette = (byte *)malloc(256 * 3);
|
||||||
|
|
||||||
|
int fadeStep = kFadeStep - 1;
|
||||||
|
for (int i = 0; i < kFadeStep; i++) {
|
||||||
|
_system->getPaletteManager()->grabPalette(paletteBackup, 0, 256);
|
||||||
|
for (int j = 0; j < 256; j++) {
|
||||||
|
blackPalette[3 * j] = paletteBackup[3 * j] * fadeStep / 4;
|
||||||
|
blackPalette[3 * j + 1] = paletteBackup[3 * j + 1] * fadeStep / 4;
|
||||||
|
blackPalette[3 * j + 2] = paletteBackup[3 * j + 2] * fadeStep / 4;
|
||||||
|
}
|
||||||
|
fadeStep--;
|
||||||
|
_graph->setPalette(blackPalette);
|
||||||
|
_system->updateScreen();
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
free(paletteBackup);
|
||||||
|
free(blackPalette);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrinceEngine::setPalette() {
|
||||||
|
byte *paletteBackup;
|
||||||
|
byte *blackPalette = (byte *)malloc(256 * 3);
|
||||||
|
|
||||||
|
int fadeStep = 0;
|
||||||
|
for (int i = 0; i <= kFadeStep; i++) {
|
||||||
|
paletteBackup = (byte *)_roomBmp->getPalette();
|
||||||
|
for (int j = 0; j < 256; j++) {
|
||||||
|
blackPalette[3 * j] = paletteBackup[3 * j] * fadeStep / 4;
|
||||||
|
blackPalette[3 * j + 1] = paletteBackup[3 * j + 1] * fadeStep / 4;
|
||||||
|
blackPalette[3 * j + 2] = paletteBackup[3 * j + 2] * fadeStep / 4;
|
||||||
|
}
|
||||||
|
fadeStep++;
|
||||||
|
_graph->setPalette(blackPalette);
|
||||||
|
_system->updateScreen();
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
_graph->setPalette(paletteBackup);
|
||||||
|
free(blackPalette);
|
||||||
|
}
|
||||||
|
|
||||||
void PrinceEngine::pause() {
|
void PrinceEngine::pause() {
|
||||||
uint32 currentTime = _system->getMillis();
|
uint32 currentTime = _system->getMillis();
|
||||||
int delay = 1000/15 - int32(_system->getMillis() - currentTime);
|
int delay = 1000/15 - int32(_system->getMillis() - currentTime);
|
||||||
|
|
|
@ -439,6 +439,10 @@ public:
|
||||||
void doZoomOut(int slot);
|
void doZoomOut(int slot);
|
||||||
void freeZoomObject(int slot);
|
void freeZoomObject(int slot);
|
||||||
|
|
||||||
|
static const uint8 kFadeStep = 4;
|
||||||
|
void blackPalette();
|
||||||
|
void setPalette();
|
||||||
|
|
||||||
// Pathfinding
|
// Pathfinding
|
||||||
static const int16 kPathGridStep = 2;
|
static const int16 kPathGridStep = 2;
|
||||||
static const int32 kPathBitmapLen = (kMaxPicHeight / kPathGridStep * kMaxPicWidth / kPathGridStep) / 8;
|
static const int32 kPathBitmapLen = (kMaxPicHeight / kPathGridStep * kMaxPicWidth / kPathGridStep) / 8;
|
||||||
|
|
|
@ -520,10 +520,12 @@ void Interpreter::O_WAITFOREVER() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::O_BLACKPALETTE() {
|
void Interpreter::O_BLACKPALETTE() {
|
||||||
|
_vm->blackPalette();
|
||||||
debugInterpreter("O_BLACKPALETTE");
|
debugInterpreter("O_BLACKPALETTE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::O_SETUPPALETTE() {
|
void Interpreter::O_SETUPPALETTE() {
|
||||||
|
_vm->setPalette();
|
||||||
debugInterpreter("O_SETUPPALETTE");
|
debugInterpreter("O_SETUPPALETTE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue