aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/main.cpp3
-rw-r--r--engines/mads/events.cpp6
-rw-r--r--engines/mads/game.cpp11
-rw-r--r--engines/mads/menu_views.cpp2
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp1
-rw-r--r--engines/mads/nebular/nebular_scenes2.cpp29
-rw-r--r--engines/mads/player.cpp10
-rw-r--r--engines/mads/sprites.cpp7
-rw-r--r--engines/mads/user_interface.cpp90
-rw-r--r--engines/mads/user_interface.h7
10 files changed, 105 insertions, 61 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 0f5ebc7845..3ea38b547a 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -552,6 +552,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
PluginManager::instance().loadAllPlugins(); // only for cached manager
} else {
GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game"));
+
+ // Clear the active domain
+ ConfMan.setActiveDomain("");
}
// reset the graphics to default
diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp
index 586ef7cbf3..06c6055f01 100644
--- a/engines/mads/events.cpp
+++ b/engines/mads/events.cpp
@@ -162,6 +162,12 @@ void EventsManager::pollEvents() {
return;
case Common::EVENT_KEYUP:
return;
+ case Common::EVENT_WHEELUP:
+ _pendingKeys.push(Common::KeyState(Common::KEYCODE_PAGEUP));
+ return;
+ case Common::EVENT_WHEELDOWN:
+ _pendingKeys.push(Common::KeyState(Common::KEYCODE_PAGEDOWN));
+ return;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
_mouseClicked = true;
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 27691d3380..3b8b053fec 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -420,6 +420,7 @@ void Game::handleKeypress(const Common::KeyState &kbd) {
}
}
+ Scene &scene = _vm->_game->_scene;
switch (kbd.keycode) {
case Common::KEYCODE_F1:
_vm->_dialogs->_pendingDialog = DIALOG_GAME_MENU;
@@ -430,6 +431,16 @@ void Game::handleKeypress(const Common::KeyState &kbd) {
case Common::KEYCODE_F7:
_vm->_dialogs->_pendingDialog = DIALOG_RESTORE;
break;
+ case Common::KEYCODE_PAGEUP:
+ scene._userInterface._scrollbarStrokeType = SCROLLBAR_UP;
+ scene._userInterface.changeScrollBar();
+ break;
+ case Common::KEYCODE_PAGEDOWN:
+ scene._userInterface._scrollbarStrokeType = SCROLLBAR_DOWN;
+ scene._userInterface.changeScrollBar();
+ break;
+
+
default:
break;
}
diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp
index 8f1fd2d7a5..5a0c7ee92e 100644
--- a/engines/mads/menu_views.cpp
+++ b/engines/mads/menu_views.cpp
@@ -426,7 +426,7 @@ void TextView::doFrame() {
scene._textDisplay.expire(tl._textDisplayIndex);
tl._pos.y--;
- if (tl._pos.y < 0) {
+ if (tl._pos.y + _font->getHeight() < 0) {
_textLines.remove_at(i);
} else {
tl._textDisplayIndex = scene._textDisplay.add(tl._pos.x, tl._pos.y,
diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp
index 7c85fd44db..3149343aee 100644
--- a/engines/mads/nebular/nebular_scenes1.cpp
+++ b/engines/mads/nebular/nebular_scenes1.cpp
@@ -1621,6 +1621,7 @@ void Scene104::setup() {
void Scene104::enter() {
_globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1));
_globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 0, 0, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8);
if (_scene->_priorSceneId == 105)
_game._player._playerPos = Common::Point(302, 107);
diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp
index 94e30aa4f2..3eef545b09 100644
--- a/engines/mads/nebular/nebular_scenes2.cpp
+++ b/engines/mads/nebular/nebular_scenes2.cpp
@@ -1448,12 +1448,14 @@ Scene207::Scene207(MADSEngine *vm) : Scene2xx(vm) {
_eyeFl = false;
_spiderHotspotId = -1;
_vultureHotspotId = -1;
- _spiderTime = 0;
- _vultureTime = 0;
+
+ _spiderTime = _game._player._priorTimer;
+ _vultureTime = _game._player._priorTimer;
}
void Scene207::synchronize(Common::Serializer &s) {
Scene2xx::synchronize(s);
+ uint32 unused;
s.syncAsByte(_vultureFl);
s.syncAsByte(_spiderFl);
@@ -1461,8 +1463,8 @@ void Scene207::synchronize(Common::Serializer &s) {
s.syncAsSint32LE(_spiderHotspotId);
s.syncAsSint32LE(_vultureHotspotId);
- s.syncAsSint32LE(_spiderTime);
- s.syncAsSint32LE(_vultureTime);
+ s.syncAsSint32LE(unused);
+ s.syncAsSint32LE(unused);
}
void Scene207::setup() {
@@ -1501,7 +1503,6 @@ void Scene207::enter() {
if (_vultureFl) {
_globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400);
- _vultureTime = _game._player._priorTimer;
_vultureHotspotId = _scene->_dynamicHotspots.add(389, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0));
_scene->_dynamicHotspots.setPosition(_vultureHotspotId, Common::Point(254, 94), FACING_WEST);
}
@@ -1509,7 +1510,6 @@ void Scene207::enter() {
if (_spiderFl) {
_globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -1);
- _spiderTime = _game._player._priorTimer;
_spiderHotspotId = _scene->_dynamicHotspots.add(333, 13, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0));
_scene->_dynamicHotspots.setPosition(_spiderHotspotId, Common::Point(59, 132), FACING_SOUTH);
}
@@ -1549,11 +1549,17 @@ void Scene207::moveSpider() {
}
void Scene207::step() {
- if (!_vultureFl)
- moveVulture();
+ Player &player = _game._player;
+
+ if (_vultureFl) {
+ if (((int32)player._priorTimer - _vultureTime) > 1700)
+ moveVulture();
+ }
- if (_spiderFl)
- moveSpider();
+ if (_spiderFl) {
+ if (((int32)player._priorTimer - _spiderTime) > 800)
+ moveSpider();
+ }
if (_game._trigger == 70) {
_globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0);
@@ -1745,7 +1751,8 @@ void Scene208::enter() {
}
void Scene208::step() {
- if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) {
+ if (_boundingFl && _scene->_activeAnimation &&
+ (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) {
_rhotundaTime = _scene->_activeAnimation->getCurrentFrame();
if (_rhotundaTime == 125)
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 1622031c6c..8720aeead3 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -240,8 +240,13 @@ void Player::updateFrame() {
return;
Scene &scene = _vm->_game->_scene;
+ assert(scene._sprites[idx] != nullptr);
SpriteAsset &spriteSet = *scene._sprites[idx];
- assert(spriteSet._charInfo);
+
+ // WORKAROUND: Certain cutscenes set up player sprites that don't have any
+ // character info. In such cases, simply ignore player updates
+ if (!spriteSet._charInfo)
+ return;
if (!spriteSet._charInfo->_numEntries) {
_frameNumber = 1;
@@ -515,8 +520,7 @@ void Player::idle() {
return;
SpriteAsset &spriteSet = *scene._sprites[idx];
- assert(spriteSet._charInfo);
- if (spriteSet._charInfo->_numEntries == 0)
+ if (spriteSet._charInfo == nullptr || spriteSet._charInfo->_numEntries == 0)
// No entries, so exit immediately
return;
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index fd73930475..f74edafc93 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -371,16 +371,13 @@ int SpriteSets::add(SpriteAsset *asset, int idx) {
if (idx)
idx = idx + 49;
else
- idx = size();
+ idx = _assetCount++;
if (idx >= (int)size())
resize(idx + 1);
- if ((*this)[idx]) {
+ if ((*this)[idx])
delete (*this)[idx];
- } else {
- ++_assetCount;
- }
(*this)[idx] = asset;
return idx;
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 822460d549..929390a073 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -495,7 +495,6 @@ void UserInterface::drawScroller() {
void UserInterface::updateInventoryScroller() {
ScreenObjects &screenObjects = _vm->_game->_screenObjects;
- Common::Array<int> &inventoryList = _vm->_game->_objects._inventoryList;
if (screenObjects._inputMode != kInputBuildingSentences)
return;
@@ -518,45 +517,8 @@ void UserInterface::updateInventoryScroller() {
_scrollbarQuickly = _vm->_events->_vD2 < 1;
_scrollbarMilliTime = currentMilli;
- switch (_scrollbarStrokeType) {
- case SCROLLBAR_UP:
- // Scroll up
- if (_inventoryTopIndex > 0 && inventoryList.size() > 0) {
- --_inventoryTopIndex;
- _inventoryChanged = true;
- }
- break;
-
- case SCROLLBAR_DOWN:
- // Scroll down
- if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) {
- ++_inventoryTopIndex;
- _inventoryChanged = true;
- }
- break;
-
- case SCROLLBAR_ELEVATOR: {
- // Inventory slider
- int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17)
- * inventoryList.size() / 10;
- if (newIndex >= (int)inventoryList.size())
- newIndex = inventoryList.size() - 1;
-
- if (inventoryList.size() > 0) {
- _inventoryChanged = newIndex != _inventoryTopIndex;
- _inventoryTopIndex = newIndex;
- }
- break;
- }
-
- default:
- break;
- }
-
- if (_inventoryChanged) {
- int dummy;
- updateSelection(CAT_INV_LIST, 0, &dummy);
- }
+ // Change the scrollbar and visible inventory list
+ changeScrollBar();
}
}
}
@@ -569,6 +531,54 @@ void UserInterface::updateInventoryScroller() {
_scrollbarOldElevator = _scrollbarElevator;
}
+void UserInterface::changeScrollBar() {
+ Common::Array<int> &inventoryList = _vm->_game->_objects._inventoryList;
+ ScreenObjects &screenObjects = _vm->_game->_screenObjects;
+
+ if (screenObjects._inputMode != kInputBuildingSentences)
+ return;
+
+ switch (_scrollbarStrokeType) {
+ case SCROLLBAR_UP:
+ // Scroll up
+ if (_inventoryTopIndex > 0 && inventoryList.size() > 0) {
+ --_inventoryTopIndex;
+ _inventoryChanged = true;
+ }
+ break;
+
+ case SCROLLBAR_DOWN:
+ // Scroll down
+ if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) {
+ ++_inventoryTopIndex;
+ _inventoryChanged = true;
+ }
+ break;
+
+ case SCROLLBAR_ELEVATOR: {
+ // Inventory slider
+ int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17)
+ * inventoryList.size() / 10;
+ if (newIndex >= (int)inventoryList.size())
+ newIndex = inventoryList.size() - 1;
+
+ if (inventoryList.size() > 0) {
+ _inventoryChanged = newIndex != _inventoryTopIndex;
+ _inventoryTopIndex = newIndex;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (_inventoryChanged) {
+ int dummy;
+ updateSelection(CAT_INV_LIST, 0, &dummy);
+ }
+}
+
void UserInterface::scrollbarChanged() {
Common::Rect r(73, 4, 73 + 9, 4 + 38);
_uiSlots.add(r);
diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h
index 89044c9bf1..71c6f64c2a 100644
--- a/engines/mads/user_interface.h
+++ b/engines/mads/user_interface.h
@@ -140,7 +140,6 @@ private:
bool _scrollFlag;
int _noSegmentsActive;
int _someSegmentsActive;
- ScrollbarActive _scrollbarStrokeType;
/**
* Loads the elements of the user interface
@@ -216,6 +215,7 @@ public:
bool _scrollbarQuickly;
uint32 _scrollbarMilliTime;
int _scrollbarElevator, _scrollbarOldElevator;
+ ScrollbarActive _scrollbarStrokeType;
public:
/**
* Constructor
@@ -275,6 +275,11 @@ public:
void updateSelection(ScrCategory category, int newIndex, int *idx);
+ /**
+ * Updates the current top visible item of the scrollbar
+ */
+ void changeScrollBar();
+
void scrollerChanged();
void scrollInventory();