aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/toltecs/menu.cpp168
-rw-r--r--engines/toltecs/menu.h13
-rw-r--r--engines/toltecs/palette.cpp6
-rw-r--r--engines/toltecs/palette.h1
-rw-r--r--engines/toltecs/screen.cpp24
-rw-r--r--engines/toltecs/screen.h2
-rw-r--r--engines/toltecs/script.cpp35
-rw-r--r--engines/toltecs/sprite.cpp31
-rw-r--r--engines/toltecs/toltecs.cpp19
-rw-r--r--engines/toltecs/toltecs.h6
10 files changed, 201 insertions, 104 deletions
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index 2747858fd6..cbb27cdc4d 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -35,16 +35,27 @@
#include "toltecs/toltecs.h"
#include "toltecs/menu.h"
#include "toltecs/palette.h"
+#include "toltecs/render.h"
#include "toltecs/resource.h"
#include "toltecs/screen.h"
namespace Toltecs {
MenuSystem::MenuSystem(ToltecsEngine *vm) : _vm(vm) {
+}
+
+MenuSystem::~MenuSystem() {
+}
+
+int MenuSystem::run() {
+
+ debug("MenuSystem::run()");
+
+ _background = new Graphics::Surface();
+ _background->create(640, 400, 1);
+
_currMenuID = kMenuIdNone;
_newMenuID = kMenuIdMain;
- _newMenuID = kMenuIdSave;
- _newMenuID = kMenuIdLoad;
_currItemID = kItemIdNone;
_editingDescription = false;
_needRedraw = false;
@@ -55,32 +66,23 @@ MenuSystem::MenuSystem(ToltecsEngine *vm) : _vm(vm) {
_cfgMusicVolume = 10;
_cfgSoundFXVolume = 10;
_cfgBackgroundVolume = 10;
-}
-
-MenuSystem::~MenuSystem() {
-}
-
-int MenuSystem::run() {
-
- _background = new Graphics::Surface();
- _background->create(640, 400, 1);
-
+ _running = true;
_top = 30 - _vm->_guiHeight / 2;
_needRedraw = false;
- memset(_vm->_screen->_frontScreen, 250, 640 * 400);
+ // TODO: buildColorTransTable2
+ _vm->_palette->buildColorTransTable(0, 16, 7);
- memcpy(_background->pixels, _vm->_screen->_frontScreen, 640 * 400);
+ _vm->_screen->_renderQueue->clear();
+ _vm->_screen->blastSprite(0x140 + _vm->_cameraX, 0x175 + _vm->_cameraY, 0, 1, 0x4000);
- _vm->_palette->buildColorTransTable(0, 16, 7);
+ memcpy(_background->pixels, _vm->_screen->_frontScreen, 640 * 400);
shadeRect(60, 39, 520, 246, 30, 94);
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
-
- while (1) {
+ while (_running) {
update();
- _vm->updateScreen();
+ _vm->_system->updateScreen();
}
delete _background;
@@ -99,7 +101,8 @@ void MenuSystem::update() {
handleEvents();
if (_needRedraw) {
- _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
+ //_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
+ _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
debug("redraw");
_needRedraw = false;
}
@@ -118,7 +121,7 @@ void MenuSystem::handleEvents() {
handleKeyDown(event.kbd);
break;
case Common::EVENT_QUIT:
- // TODO: quitGame();
+ _running = false;
break;
case Common::EVENT_MOUSEMOVE:
handleMouseMove(event.mouse.x, event.mouse.y);
@@ -187,8 +190,12 @@ void MenuSystem::handleKeyDown(const Common::KeyState& kbd) {
setItemCaption(_editingDescriptionItem, _editingDescriptionItem->caption.c_str());
drawItem(_editingDescriptionID, true);
} else if (kbd.keycode == Common::KEYCODE_RETURN) {
+ SavegameItem *savegameItem = getSavegameItemByID(_editingDescriptionID);
+ _editingDescription = false;
+ _vm->requestSavegame(savegameItem->_slotNum, _editingDescriptionItem->caption);
+ _running = false;
+ } else if (kbd.keycode == Common::KEYCODE_ESCAPE) {
_editingDescription = false;
- _newMenuID = kMenuIdMain;
}
}
}
@@ -222,6 +229,8 @@ void MenuSystem::setItemCaption(Item *item, const char *caption) {
void MenuSystem::initMenu(MenuID menuID) {
+ int newSlotNum;
+
_items.clear();
memcpy(_vm->_screen->_frontScreen, _background->pixels, 640 * 400);
@@ -249,7 +258,7 @@ void MenuSystem::initMenu(MenuID menuID) {
addClickTextItem(kItemIdSavegame5, 0, 115 + 20 * 4, 300, 0, "SAVEGAME 5", 231, 234);
addClickTextItem(kItemIdSavegame6, 0, 115 + 20 * 5, 300, 0, "SAVEGAME 6", 231, 234);
addClickTextItem(kItemIdSavegame7, 0, 115 + 20 * 6, 300, 0, "SAVEGAME 7", 231, 234);
- initSavegames();
+ loadSavegamesList();
setSavegameCaptions();
break;
case kMenuIdSave:
@@ -264,8 +273,8 @@ void MenuSystem::initMenu(MenuID menuID) {
addClickTextItem(kItemIdSavegame5, 0, 115 + 20 * 4, 300, 0, "SAVEGAME 5", 231, 234);
addClickTextItem(kItemIdSavegame6, 0, 115 + 20 * 5, 300, 0, "SAVEGAME 6", 231, 234);
addClickTextItem(kItemIdSavegame7, 0, 115 + 20 * 6, 300, 0, "SAVEGAME 7", 231, 234);
- initSavegames();
- _savegames.push_back(SavegameItem("", Common::String::printf("GAME %03d", _savegames.size() + 1)));
+ newSlotNum = loadSavegamesList() + 1;
+ _savegames.push_back(SavegameItem(newSlotNum, Common::String::printf("GAME %03d", _savegames.size() + 1)));
setSavegameCaptions();
break;
case kMenuIdVolumes:
@@ -337,6 +346,7 @@ void MenuSystem::clickItem(ItemID id) {
break;
case kItemIdPlay:
debug("kItemIdPlay");
+ _running = false;
break;
case kItemIdQuit:
debug("kItemIdQuit");
@@ -410,6 +420,7 @@ void MenuSystem::restoreRect(int x, int y, int w, int h) {
}
void MenuSystem::shadeRect(int x, int y, int w, int h, byte color1, byte color2) {
+#if 0
byte *src = (byte*)_background->getBasePtr(x, y);
for (int xc = 0; xc < w; xc++) {
src[xc] = color1;
@@ -426,6 +437,20 @@ void MenuSystem::shadeRect(int x, int y, int w, int h, byte color1, byte color2)
}
src += 640;
}
+#endif
+ byte *src = (byte*)_background->getBasePtr(x, y);
+ for (int xc = 0; xc < w; xc++) {
+ src[xc] = color2;
+ src[xc + h * 640] = color1;
+ }
+ src += 640;
+ w -= 1;
+ h -= 1;
+ while (h--) {
+ src[0] = color2;
+ src[w] = color1;
+ src += 640;
+ }
}
void MenuSystem::drawString(int16 x, int16 y, int w, uint fontNum, byte color, const char *text) {
@@ -438,11 +463,13 @@ void MenuSystem::drawString(int16 x, int16 y, int w, uint fontNum, byte color, c
_needRedraw = true;
}
-void MenuSystem::initSavegames() {
+int MenuSystem::loadSavegamesList() {
+
+ int maxSlotNum = -1;
_savegameListTopIndex = 0;
_savegames.clear();
-
+
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Toltecs::ToltecsEngine::SaveHeader header;
Common::String pattern = _vm->getTargetName();
@@ -453,32 +480,45 @@ void MenuSystem::initSavegames() {
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
- Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
- if (in) {
- if (_vm->readSaveHeader(in, false, header) == Toltecs::ToltecsEngine::kRSHENoError) {
- _savegames.push_back(SavegameItem(*file, header.description));
- debug("%s -> %s", file->c_str(), header.description.c_str());
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 3);
+ if (slotNum > maxSlotNum)
+ maxSlotNum = slotNum;
+
+ if (slotNum >= 0 && slotNum <= 999) {
+ Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
+ if (in) {
+ if (Toltecs::ToltecsEngine::readSaveHeader(in, false, header) == Toltecs::ToltecsEngine::kRSHENoError) {
+ _savegames.push_back(SavegameItem(slotNum, header.description));
+ debug("%s -> %s", file->c_str(), header.description.c_str());
+ }
+ delete in;
}
- delete in;
}
}
-#if 0
- // DEBUG: Add some more items
- _savegames.push_back(SavegameItem("abc", "Test 1"));
- _savegames.push_back(SavegameItem("abc", "Test 2"));
- _savegames.push_back(SavegameItem("abc", "Test 3"));
- _savegames.push_back(SavegameItem("abc", "Test 4"));
- _savegames.push_back(SavegameItem("abc", "Test 5"));
- _savegames.push_back(SavegameItem("abc", "Test 6"));
- _savegames.push_back(SavegameItem("abc", "Test 7"));
- _savegames.push_back(SavegameItem("abc", "Test 8"));
- _savegames.push_back(SavegameItem("abc", "Test 9"));
- _savegames.push_back(SavegameItem("abc", "Test 10"));
- _savegames.push_back(SavegameItem("abc", "Test 11"));
- _savegames.push_back(SavegameItem("abc", "Test 12"));
-#endif
+ return maxSlotNum;
+}
+MenuSystem::SavegameItem *MenuSystem::getSavegameItemByID(ItemID id) {
+ switch (id) {
+ case kItemIdSavegame1:
+ return &_savegames[_savegameListTopIndex + 0];
+ case kItemIdSavegame2:
+ return &_savegames[_savegameListTopIndex + 1];
+ case kItemIdSavegame3:
+ return &_savegames[_savegameListTopIndex + 2];
+ case kItemIdSavegame4:
+ return &_savegames[_savegameListTopIndex + 3];
+ case kItemIdSavegame5:
+ return &_savegames[_savegameListTopIndex + 4];
+ case kItemIdSavegame6:
+ return &_savegames[_savegameListTopIndex + 5];
+ case kItemIdSavegame7:
+ return &_savegames[_savegameListTopIndex + 6];
+ default:
+ return NULL;
+ }
}
void MenuSystem::setSavegameCaptions() {
@@ -508,33 +548,11 @@ void MenuSystem::scrollSavegames(int delta) {
void MenuSystem::clickSavegameItem(ItemID id) {
if (_currMenuID == kMenuIdLoad) {
- SavegameItem *savegameItem;
- switch (id) {
- case kItemIdSavegame1:
- savegameItem = &_savegames[_savegameListTopIndex + 0];
- break;
- case kItemIdSavegame2:
- savegameItem = &_savegames[_savegameListTopIndex + 1];
- break;
- case kItemIdSavegame3:
- savegameItem = &_savegames[_savegameListTopIndex + 2];
- break;
- case kItemIdSavegame4:
- savegameItem = &_savegames[_savegameListTopIndex + 3];
- break;
- case kItemIdSavegame5:
- savegameItem = &_savegames[_savegameListTopIndex + 4];
- break;
- case kItemIdSavegame6:
- savegameItem = &_savegames[_savegameListTopIndex + 5];
- break;
- case kItemIdSavegame7:
- savegameItem = &_savegames[_savegameListTopIndex + 6];
- break;
- default:
- return;
- }
- debug("filename = [%s]; description = [%s]", savegameItem->_filename.c_str(), savegameItem->_description.c_str());
+ SavegameItem *savegameItem = getSavegameItemByID(id);
+ debug("slotNum = [%d]; description = [%s]", savegameItem->_slotNum, savegameItem->_description.c_str());
+ //_vm->loadgame(savegameItem->_filename.c_str());
+ _vm->requestLoadgame(savegameItem->_slotNum);
+ _running = false;
} else {
_editingDescription = true;
_editingDescriptionItem = getItem(id);
diff --git a/engines/toltecs/menu.h b/engines/toltecs/menu.h
index e71557e751..12f48ca875 100644
--- a/engines/toltecs/menu.h
+++ b/engines/toltecs/menu.h
@@ -114,17 +114,18 @@ protected:
};
struct SavegameItem {
- Common::String _filename;
+ int _slotNum;
Common::String _description;
SavegameItem()
- : _filename(""), _description("") {}
- SavegameItem(Common::String filename, Common::String description)
- : _filename(filename), _description(description) {}
+ : _slotNum(-1), _description("") {}
+ SavegameItem(int slotNum, Common::String description)
+ : _slotNum(slotNum), _description(description) {}
};
ToltecsEngine *_vm;
Graphics::Surface *_background;
+ bool _running;
MenuID _currMenuID, _newMenuID;
ItemID _currItemID;
int _top;
@@ -161,7 +162,9 @@ protected:
void shadeRect(int x, int y, int w, int h, byte color1, byte color2);
void drawString(int16 x, int16 y, int w, uint fontNum, byte color, const char *text);
- void initSavegames();
+ SavegameItem *getSavegameItemByID(ItemID id);
+
+ int loadSavegamesList();
void setSavegameCaptions();
void scrollSavegames(int delta);
void clickSavegameItem(ItemID id);
diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp
index 52f847e8dd..1236d98431 100644
--- a/engines/toltecs/palette.cpp
+++ b/engines/toltecs/palette.cpp
@@ -199,6 +199,12 @@ void Palette::buildColorTransTable(byte limit, char deltaValue, byte mask) {
}
+void Palette::buildColorTransTable2(byte limit, char deltaValue, byte mask) {
+
+ // TODO
+
+}
+
void Palette::saveState(Common::WriteStream *out) {
// Save currently active palette
diff --git a/engines/toltecs/palette.h b/engines/toltecs/palette.h
index 920adedeec..59f0504091 100644
--- a/engines/toltecs/palette.h
+++ b/engines/toltecs/palette.h
@@ -60,6 +60,7 @@ public:
void clearFragments();
void buildColorTransTable(byte limit, char deltaValue, byte mask);
+ void buildColorTransTable2(byte limit, char deltaValue, byte mask);
byte getColorTransPixel(byte pixel) const { return _colorTransTable[pixel]; }
byte *getMainPalette() { return _mainPalette; }
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index 9f0ff51b5d..91527bdbf5 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -70,7 +70,7 @@ Screen::Screen(ToltecsEngine *vm) : _vm(vm) {
// Talk text
_talkTextItemNum = 0;
memset(_talkTextItems, 0, sizeof(_talkTextItems));
- _talkTextX = 0;//TODO correct init values
+ _talkTextX = 0;
_talkTextY = 0;
_talkTextFontColor = 0;
_talkTextMaxWidth = 520;
@@ -202,7 +202,7 @@ void Screen::addStaticSprite(byte *spriteItem) {
drawRequest.flags = READ_LE_UINT16(spriteItem + 8);
drawRequest.scaling = 0;
- //debug(0, "Screen::addStaticSprite() x = %d; y = %d; baseColor = %d; resIndex = %d; flags = %04X", drawRequest.x, drawRequest.y, drawRequest.baseColor, drawRequest.resIndex, drawRequest.flags);
+ debug(0, "Screen::addStaticSprite() x = %d; y = %d; baseColor = %d; resIndex = %d; flags = %04X", drawRequest.x, drawRequest.y, drawRequest.baseColor, drawRequest.resIndex, drawRequest.flags);
addDrawRequest(drawRequest);
@@ -271,6 +271,26 @@ void Screen::clearSprites() {
}
+void Screen::blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags) {
+
+ DrawRequest drawRequest;
+ SpriteDrawItem sprite;
+
+ drawRequest.x = x;
+ drawRequest.y = y;
+ drawRequest.baseColor = _vm->_palette->findFragment(fragmentId) & 0xFF;
+ drawRequest.resIndex = resIndex;
+ drawRequest.flags = flags;
+ drawRequest.scaling = 0;
+
+ if (createSpriteDrawItem(drawRequest, sprite)) {
+ sprite.x -= _vm->_cameraX;
+ sprite.y -= _vm->_cameraY;
+ drawSprite(sprite);
+ }
+
+}
+
void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
debug(0, "Screen::updateVerbLine() _verbLineNum = %d; _verbLineX = %d; _verbLineY = %d; _verbLineWidth = %d; _verbLineCount = %d",
diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h
index bd332a9da3..b7e14914e1 100644
--- a/engines/toltecs/screen.h
+++ b/engines/toltecs/screen.h
@@ -183,6 +183,7 @@ public:
// Sprite drawing
void drawSprite(const SpriteDrawItem &sprite);
void drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawItem &sprite);
+ void blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags);
// Verb line
void updateVerbLine(int16 slotIndex, int16 slotOffset);
@@ -252,6 +253,7 @@ public:
bool _fullRefresh;
bool _guiRefresh;
+ bool createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem &sprite);
void addDrawRequest(const DrawRequest &drawRequest);
};
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index 0c9f89e711..3c2060048b 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -36,6 +36,7 @@
#include "toltecs/toltecs.h"
#include "toltecs/animation.h"
+#include "toltecs/menu.h"
#include "toltecs/movie.h"
#include "toltecs/palette.h"
#include "toltecs/resource.h"
@@ -180,6 +181,14 @@ void ScriptInterpreter::runScript() {
if (_vm->_movieSceneFlag)
_vm->_mouseButton = 0;
+
+ if (_vm->_saveLoadRequested != 0) {
+ if (_vm->_saveLoadRequested == 1)
+ _vm->loadGameState(_vm->_saveLoadSlot);
+ else if (_vm->_saveLoadRequested == 2)
+ _vm->saveGameState(_vm->_saveLoadSlot, _vm->_saveLoadDescription.c_str());
+ _vm->_saveLoadRequested = 0;
+ }
if (_switchLocalDataNear) {
_switchLocalDataNear = false;
@@ -1037,20 +1046,38 @@ void ScriptInterpreter::sfClearScreen() {
}
void ScriptInterpreter::sfHandleInput() {
- // TODO: Recheck what this does
int16 varOfs = arg16(3);
int16 keyCode = 0;
if (_vm->_rightButtonDown) {
keyCode = 1;
} else {
- // TODO: Handle Escape
- // TODO: Set keyboard scancode
+ /* Convert keyboard scancode to IBM PC scancode
+ Only scancodes known to be used (so far) are converted
+ */
+ switch (_vm->_keyState.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ keyCode = 1;
+ break;
+ case Common::KEYCODE_F10:
+ keyCode = 68;
+ break;
+ default:
+ break;
+ }
}
localWrite16(varOfs, keyCode);
}
void ScriptInterpreter::sfRunOptionsScreen() {
- // TODO
+ _vm->_screen->loadMouseCursor(12);
+ _vm->_palette->loadAddPalette(9, 224);
+ _vm->_palette->setDeltaPalette(_vm->_palette->getMainPalette(), 7, 0, 31, 224);
+ _vm->_screen->finishTalkTextItems();
+ _vm->_screen->clearSprites();
+ _vm->_system->showMouse(true);
+ _vm->_menuSystem->run();
+ _vm->_keyState.reset();
+ _switchLocalDataNear = true;
}
/* NOTE: The opcodes sfPrecacheSprites, sfPrecacheSounds1, sfPrecacheSounds2 and
diff --git a/engines/toltecs/sprite.cpp b/engines/toltecs/sprite.cpp
index 84b485d49b..b6654b5346 100644
--- a/engines/toltecs/sprite.cpp
+++ b/engines/toltecs/sprite.cpp
@@ -193,18 +193,16 @@ protected:
int _scalerStatus;
};
-void Screen::addDrawRequest(const DrawRequest &drawRequest) {
-
+bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem &sprite) {
int16 scaleValueX, scaleValueY;
int16 xoffs, yoffs;
byte *spriteData;
int16 frameNum;
- SpriteDrawItem sprite;
memset(&sprite, 0, sizeof(SpriteDrawItem));
if (drawRequest.flags == 0xFFFF)
- return;
+ return false;
frameNum = drawRequest.flags & 0x0FFF;
@@ -215,7 +213,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
sprite.priority = drawRequest.y;
sprite.resIndex = drawRequest.resIndex;
sprite.frameNum = frameNum;
-
+
spriteData = _vm->_res->load(drawRequest.resIndex)->data;
if (drawRequest.flags & 0x1000) {
@@ -233,15 +231,14 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
// First initialize the sprite item with the values from the sprite resource
SpriteFrameEntry spriteFrameEntry(spriteData + frameNum * 12);
-
+
if (spriteFrameEntry.w == 0 || spriteFrameEntry.h == 0)
- return;
+ return false;
sprite.offset = spriteFrameEntry.offset;
sprite.width = spriteFrameEntry.w;
sprite.height = spriteFrameEntry.h;
-
sprite.origWidth = spriteFrameEntry.w;
sprite.origHeight = spriteFrameEntry.h;
@@ -278,7 +275,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
sprite.width = sprite.origWidth - scaleValueX;
sprite.height = sprite.origHeight - 1 - scaleValueY;
if (sprite.width <= 0 || sprite.height <= 0)
- return;
+ return false;
xoffs -= (xoffs * scaleValue) / 100;
yoffs -= (yoffs * scaleValue) / 100;
}
@@ -301,7 +298,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
sprite.height -= clipHeight;
if (sprite.height <= 0)
- return;
+ return false;
sprite.y = _vm->_cameraY;
@@ -332,7 +329,6 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
}
spriteFrameData = spriteData + sprite.offset;
-
// Now the sprite's offset is adjusted to point to the starting line
if ((sprite.flags & 0x10) == 0) {
while (skipHeight--) {
@@ -359,7 +355,7 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
if (sprite.y + sprite.height - _vm->_cameraY - _vm->_cameraHeight > 0)
sprite.height -= sprite.y + sprite.height - _vm->_cameraY - _vm->_cameraHeight;
if (sprite.height <= 0)
- return;
+ return false;
sprite.skipX = 0;
@@ -391,10 +387,15 @@ void Screen::addDrawRequest(const DrawRequest &drawRequest) {
}
if (sprite.width <= 0)
- return;
+ return false;
- _renderQueue->addSprite(sprite);
-
+ return true;
+}
+
+void Screen::addDrawRequest(const DrawRequest &drawRequest) {
+ SpriteDrawItem sprite;
+ if (createSpriteDrawItem(drawRequest, sprite))
+ _renderQueue->addSprite(sprite);
}
void Screen::drawSprite(const SpriteDrawItem &sprite) {
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 7fde696732..9a0f6694b2 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -105,7 +105,9 @@ Common::Error ToltecsEngine::run() {
_counter02 = 0;
_movieSceneFlag = false;
_flag01 = 0;
-
+
+ _saveLoadRequested = 0;
+
_cameraX = 0;
_cameraY = 0;
_newCameraX = 0;
@@ -148,10 +150,10 @@ Common::Error ToltecsEngine::run() {
_sound = new Sound(this);
- _system->showMouse(true);
-
syncSoundSettings();
+ _system->showMouse(true);
+
setupSysStrings();
//#define TEST_MENU
@@ -212,6 +214,17 @@ void ToltecsEngine::setupSysStrings() {
// TODO: Set yes/no chars
}
+void ToltecsEngine::requestSavegame(int slotNum, Common::String &description) {
+ _saveLoadRequested = 2;
+ _saveLoadSlot = slotNum;
+ _saveLoadDescription = description;
+}
+
+void ToltecsEngine::requestLoadgame(int slotNum) {
+ _saveLoadRequested = 1;
+ _saveLoadSlot = slotNum;
+}
+
void ToltecsEngine::loadScene(uint resIndex) {
// TODO
diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h
index 9d7a7672c1..5d0f39be6a 100644
--- a/engines/toltecs/toltecs.h
+++ b/engines/toltecs/toltecs.h
@@ -109,6 +109,8 @@ public:
const Common::String& getTargetName() const { return _targetName; }
void setupSysStrings();
+ void requestSavegame(int slotNum, Common::String &description);
+ void requestLoadgame(int slotNum);
void loadScene(uint resIndex);
@@ -148,6 +150,10 @@ public:
Common::String _sysStrings[kSysStrCount];
+ int _saveLoadRequested;
+ int _saveLoadSlot;
+ Common::String _saveLoadDescription;
+
uint _sceneResIndex;
int16 _sceneWidth, _sceneHeight;