aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_hof.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/gui_hof.cpp')
-rw-r--r--engines/kyra/gui_hof.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index a37ac7b306..69e7419757 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -95,7 +95,11 @@ const char *GUI_HoF::getMenuItemTitle(const MenuItem &menuItem) {
if (!menuItem.itemId)
return 0;
- return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 1);
+ // Strings 41-45 are menu labels, those must be handled uncompressed!
+ if (menuItem.itemId >= 41 && menuItem.itemId <= 45)
+ return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 0);
+ else
+ return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 1);
}
const char *GUI_HoF::getMenuItemLabel(const MenuItem &menuItem) {
@@ -272,7 +276,7 @@ void KyraEngine_HoF::redrawInventory(int page) {
}
void KyraEngine_HoF::scrollInventoryWheel() {
- WSAMovie_v2 movie(this, _screen);
+ WSAMovie_v2 movie(this);
movie.open("INVWHEEL.WSA", 0, 0);
int frames = movie.opened() ? movie.frames() : 6;
memcpy(_screenBuffer, _screen->getCPagePtr(2), 64000);
@@ -287,7 +291,7 @@ void KyraEngine_HoF::scrollInventoryWheel() {
for (int i = 0; i <= 6 && !breakFlag; ++i) {
if (movie.opened()) {
_screen->hideMouse();
- movie.displayFrame(i % frames, 0, 0, 0, 0);
+ movie.displayFrame(i % frames, 0, 0, 0, 0, 0, 0);
_screen->showMouse();
_screen->updateScreen();
}
@@ -361,9 +365,9 @@ int KyraEngine_HoF::bookButton(Button *button) {
_screen->showMouse();
}
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
+ _screen->copyPalette(2, 0);
_screen->fadeToBlack(7, &_updateFunctor);
- _res->loadFileToBuf("_BOOK.COL", _screen->getPalette(0), 768);
+ _screen->loadPalette("_BOOK.COL", _screen->getPalette(0));
loadBookBkgd();
showBookPage();
_screen->copyRegion(0, 0, 0, 0, 0x140, 0xC8, 2, 0, Screen::CR_NO_P_CHECK);
@@ -389,7 +393,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
}
setHandItem(_itemInHand);
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
+ _screen->copyPalette(0, 2);
_screen->fadePalette(_screen->getPalette(0), 7, &_updateFunctor);
_screen->showMouse();
@@ -700,7 +704,6 @@ int GUI_HoF::optionsButton(Button *button) {
int oldHandItem = _vm->_itemInHand;
_screen->setMouseCursor(0, 0, _vm->getShapePtr(0));
_vm->displayInvWsaLastFrame();
- //XXX
_displayMenu = true;
for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) {
@@ -763,7 +766,7 @@ int GUI_HoF::optionsButton(Button *button) {
}
while (_displayMenu) {
- processHighlights(*_currentMenu, _vm->_mouseX, _vm->_mouseY);
+ processHighlights(*_currentMenu);
getInput();
}
@@ -796,16 +799,11 @@ void GUI_HoF::createScreenThumbnail(Graphics::Surface &dst) {
}
void GUI_HoF::setupPalette() {
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
-
- uint8 *palette = _screen->getPalette(0);
- for (int i = 0; i < 768; ++i)
- palette[i] >>= 1;
-
- static const uint8 guiPal[] = { 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFc, 0xFD, 0xFE };
+ _screen->copyPalette(1, 0);
- for (uint i = 0; i < ARRAYSIZE(guiPal); ++i)
- memcpy(_screen->getPalette(0)+guiPal[i]*3, _screen->getPalette(1)+guiPal[i]*3, 3);
+ Palette &pal = _screen->getPalette(0);
+ for (int i = 0; i < 741; ++i)
+ pal[i] >>= 1;
if (_isDeathMenu)
_screen->fadePalette(_screen->getPalette(0), 0x64);
@@ -814,7 +812,7 @@ void GUI_HoF::setupPalette() {
}
void GUI_HoF::restorePalette() {
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
+ _screen->copyPalette(0, 1);
_screen->setScreenPalette(_screen->getPalette(0));
}
@@ -851,8 +849,7 @@ void GUI_HoF::drawSliderBar(int slider, const uint8 *shape) {
position = _vm->_configTextspeed;
}
- position = MAX(2, position);
- position = MIN(97, position);
+ position = CLIP(position, 2, 97);
_screen->drawShape(0, shape, x+position, y, 0, 0);
}
@@ -908,7 +905,7 @@ int GUI_HoF::audioOptions(Button *caller) {
updateAllMenuButtons();
bool speechEnabled = _vm->speechEnabled();
while (_isOptionsMenu) {
- processHighlights(_audioOptions, _vm->_mouseX, _vm->_mouseY);
+ processHighlights(_audioOptions);
getInput();
}
@@ -956,7 +953,7 @@ int GUI_HoF::gameOptions(Button *caller) {
}
while (_isOptionsMenu) {
- processHighlights(_gameOptions, _vm->_mouseX, _vm->_mouseY);
+ processHighlights(_gameOptions);
getInput();
}
@@ -983,7 +980,7 @@ int GUI_HoF::gameOptionsTalkie(Button *caller) {
_isOptionsMenu = true;
while (_isOptionsMenu) {
- processHighlights(_gameOptions, _vm->_mouseX, _vm->_mouseY);
+ processHighlights(_gameOptions);
getInput();
}
@@ -1094,8 +1091,7 @@ int GUI_HoF::sliderHandler(Button *caller) {
else
newVolume = _vm->_mouseX - caller->x - 7;
- newVolume = MAX(2, newVolume);
- newVolume = MIN(97, newVolume);
+ newVolume = CLIP(newVolume, 2, 97);
if (newVolume == oldVolume)
return 0;
@@ -1175,7 +1171,7 @@ int GUI_HoF::loadMenu(Button *caller) {
_screen->updateScreen();
while (_isLoadMenu) {
- processHighlights(_loadMenu, _vm->_mouseX, _vm->_mouseY);
+ processHighlights(_loadMenu);
getInput();
}