aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mads/dialogs.cpp1
-rw-r--r--engines/mads/game.h2
-rw-r--r--engines/mads/game_data.h1
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp14
-rw-r--r--engines/mads/player.cpp4
-rw-r--r--engines/mads/player.h2
-rw-r--r--engines/mads/scene.cpp14
-rw-r--r--engines/mads/screen.cpp10
-rw-r--r--engines/mads/screen.h1
-rw-r--r--engines/mads/sequence.cpp13
-rw-r--r--engines/mads/sequence.h8
-rw-r--r--engines/mads/sprites.cpp2
-rw-r--r--engines/mads/user_interface.cpp2
-rw-r--r--engines/mads/user_interface.h1
14 files changed, 48 insertions, 27 deletions
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp
index 333bbe98b4..d5d7d64380 100644
--- a/engines/mads/dialogs.cpp
+++ b/engines/mads/dialogs.cpp
@@ -338,6 +338,7 @@ Dialogs *Dialogs::init(MADSEngine *vm) {
}
Dialogs::Dialogs(MADSEngine *vm): _vm(vm) {
+ _pendingDialog = DIALOG_NONE;
}
} // End of namespace MADS
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 444e2fa372..32491ce0d0 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -65,7 +65,6 @@ protected:
Difficulty _difficultyLevel;
int _saveSlot;
int _statusFlag;
- SectionHandler *_sectionHandler;
Common::StringArray _quotes;
int _v5;
int _v6;
@@ -118,6 +117,7 @@ public:
int _priorSectionNumber;
int _currentSectionNumber;
InventoryObjects _objects;
+ SectionHandler *_sectionHandler;
VisitedScenes _visitedScenes;
Scene _scene;
int _v1;
diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h
index 7674beed81..8b31e5260c 100644
--- a/engines/mads/game_data.h
+++ b/engines/mads/game_data.h
@@ -59,6 +59,7 @@ public:
virtual void preLoadSection() = 0;
virtual void sectionPtr2() = 0;
virtual void postLoadSection() = 0;
+ virtual void step() {}
};
} // End of namespace MADS
diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp
index 65787af655..d3df1e9787 100644
--- a/engines/mads/nebular/nebular_scenes1.cpp
+++ b/engines/mads/nebular/nebular_scenes1.cpp
@@ -147,15 +147,13 @@ void Scene103::enter() {
_scene->_sequences.setDepth(_globals._spriteIndexes[16], 0);
_globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(
_globals._spriteIndexes[2], false, 6, 0, 0, 25);
- _globals._spriteIndexes[18] = _scene->_sequences.addSubEntry(
- _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72);
- _globals._spriteIndexes[19] = _scene->_sequences.addSubEntry(
- _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72);
- _scene->_sequences.addSubEntry(_globals._spriteIndexes[17],
- SM_FRAME_INDEX, 2, 73);
-
+ _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(
+ _scene->_sequences.addSubEntry(_globals._spriteIndexes[17],
+ SM_FRAME_INDEX, 2, 72), false, 8);
_globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(
- _globals._spriteIndexes[8], false, 8);
+ _scene->_sequences.addSubEntry(_globals._spriteIndexes[18],
+ SM_FRAME_INDEX, 2, 73), false, 8);
+
_globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(
_globals._spriteIndexes[7], false, 6);
_globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 80343609b9..1e886ae704 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -747,4 +747,8 @@ void Player::startMovement() {
_v8452E = -_v84530;
}
+void Player::step() {
+ warning("TODO: Player::step");
+}
+
} // End of namespace MADS
diff --git a/engines/mads/player.h b/engines/mads/player.h
index b997e26a02..8bc0ae73a1 100644
--- a/engines/mads/player.h
+++ b/engines/mads/player.h
@@ -156,6 +156,8 @@ public:
void startWalking(const Common::Point &pos, int direction);
void nextFrame();
+
+ void step();
};
} // End of namespace MADS
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index e65460611e..ee5ff1f503 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -337,7 +337,9 @@ void Scene::doFrame() {
CursorType cursorId = CURSOR_ARROW;
if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA &&
_vm->_game->_screenObjects._category == CAT_HOTSPOT) {
- int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._screenObjectsCount;
+ int idx = _vm->_game->_screenObjects._selectedObject - _vm->_game->_screenObjects._hotspotsIndex;
+ assert(idx >= 0);
+
if (idx >= (int)_hotspots.size()) {
idx -= _hotspots.size();
_vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor;
@@ -482,7 +484,15 @@ void Scene::checkStartWalk() {
}
void Scene::doSceneStep() {
- warning("TODO: Scene::doSceneStep");
+ _vm->_game->_abortTimersMode2 = ABORTMODE_1;
+ _sceneLogic->step();
+ _vm->_game->_sectionHandler->step();
+
+ _vm->_game->_player.step();
+ _vm->_game->_player._unk3 = 0;
+
+ if (_vm->_game->_abortTimersMode == ABORTMODE_1)
+ _vm->_game->_abortTimers = 0;
}
void Scene::checkKeyboard() {
diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp
index 1f1fc0a41e..7fea54a2f2 100644
--- a/engines/mads/screen.cpp
+++ b/engines/mads/screen.cpp
@@ -261,6 +261,8 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) {
_objectIndex = 0;
_released = false;
_uiCount = 0;
+ _hotspotsIndex = 0;
+ _selectedObject = -1;
}
void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) {
@@ -282,10 +284,10 @@ void ScreenObjects::check(bool scanFlag) {
_v7FECA = false;
if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) {
- scene._userInterface._selectedInvIndex = scanBackwards(_vm->_events->currentPos(), LAYER_GUI);
- if (scene._userInterface._selectedInvIndex > 0) {
- _category = (ScrCategory)((*this)[scene._userInterface._selectedInvIndex - 1]._category & 7);
- _objectIndex = (*this)[scene._userInterface._selectedInvIndex - 1]._descId;
+ _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI);
+ if (_selectedObject > 0) {
+ _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7);
+ _objectIndex = (*this)[_selectedObject - 1]._descId;
}
// Handling for easy mouse
diff --git a/engines/mads/screen.h b/engines/mads/screen.h
index 862c8720f3..c1e51cb193 100644
--- a/engines/mads/screen.h
+++ b/engines/mads/screen.h
@@ -151,6 +151,7 @@ public:
int _objectIndex;
bool _released;
int _uiCount;
+ int _hotspotsIndex;
/*
* Constructor
diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp
index 6288f0ad61..e5cc3b5a2c 100644
--- a/engines/mads/sequence.cpp
+++ b/engines/mads/sequence.cpp
@@ -53,9 +53,9 @@ SequenceEntry::SequenceEntry() {
_timeout = 0;
_entries._count = 0;
- Common::fill(&_entries._mode[0], &_entries._mode[TIMER_ENTRY_SUBSET_MAX], SM_0);
- Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[TIMER_ENTRY_SUBSET_MAX], 0);
- Common::fill(&_entries._abortVal[0], &_entries._abortVal[TIMER_ENTRY_SUBSET_MAX], 0);
+ Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], SM_0);
+ Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[SEQUENCE_ENTRY_SUBSET_MAX], 0);
+ Common::fill(&_entries._abortVal[0], &_entries._abortVal[SEQUENCE_ENTRY_SUBSET_MAX], 0);
}
/*------------------------------------------------------------------------*/
@@ -81,7 +81,7 @@ void SequenceList::clear() {
}
bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal) {
- if (_entries[index]._entries._count >= TIMER_ENTRY_SUBSET_MAX)
+ if (_entries[index]._entries._count >= SEQUENCE_ENTRY_SUBSET_MAX)
return true;
int subIndex = _entries[index]._entries._count++;
@@ -305,7 +305,7 @@ bool SequenceList::loadSprites(int seqIndex) {
}
if (seqEntry._entries._count > 0) {
- for (int i = 0; i <= seqEntry._entries._count; ++i) {
+ for (int i = 0; i < seqEntry._entries._count; ++i) {
switch (seqEntry._entries._mode[i]) {
case SM_0:
case SM_1:
@@ -330,6 +330,9 @@ bool SequenceList::loadSprites(int seqIndex) {
if (idx >= 0) {
_vm->_game->_abortTimers = seqEntry._entries._abortVal[idx];
_vm->_game->_abortTimersMode = seqEntry._abortMode;
+
+ if (seqEntry._abortMode == ABORTMODE_1)
+ scene._action._activeAction = seqEntry._actionNouns;
}
return result;
diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h
index 2645e62acc..f1b963a3dc 100644
--- a/engines/mads/sequence.h
+++ b/engines/mads/sequence.h
@@ -36,13 +36,13 @@ enum SequenceSubEntryMode { SM_0 = 0, SM_1 = 1, SM_FRAME_INDEX = 2 };
enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2 };
-#define TIMER_ENTRY_SUBSET_MAX 5
+#define SEQUENCE_ENTRY_SUBSET_MAX 5
struct SequenceSubEntries {
int _count;
- SequenceSubEntryMode _mode[TIMER_ENTRY_SUBSET_MAX];
- int _frameIndex[TIMER_ENTRY_SUBSET_MAX];
- int8 _abortVal[TIMER_ENTRY_SUBSET_MAX];
+ SequenceSubEntryMode _mode[SEQUENCE_ENTRY_SUBSET_MAX];
+ int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX];
+ int8 _abortVal[SEQUENCE_ENTRY_SUBSET_MAX];
};
struct SequenceEntry {
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index e519c6966b..ea4dbbbaad 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -177,7 +177,7 @@ SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) {
}
void SpriteSlots::reset(bool flag) {
- _vm->_game->_scene._textDisplay.clear();
+ _vm->_game->_scene._textDisplay.reset();
if (flag)
_vm->_game->_scene._sprites.clear();
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index f6be725ac2..baec13318e 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -189,7 +189,6 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm),
_invSpritesIndex = -1;
_invFrameNumber = 1;
_category = CAT_NONE;
- _screenObjectsCount = 0;
_inventoryTopIndex = 0;
_objectY = 0;
_selectedInvIndex = -1;
@@ -445,6 +444,7 @@ void UserInterface::loadElements() {
}
if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) {
+ _vm->_game->_screenObjects._hotspotsIndex = _vm->_game->_screenObjects.size();
for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) {
Hotspot &hs = scene._hotspots[hotspotIdx];
_vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx);
diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h
index 80038e80e3..cd3ac1dd27 100644
--- a/engines/mads/user_interface.h
+++ b/engines/mads/user_interface.h
@@ -131,7 +131,6 @@ public:
UISlots _uiSlots;
DirtyAreas _dirtyAreas;
ScrCategory _category;
- int _screenObjectsCount;
Common::Rect _drawBounds;
Common::Rect *_rectP;
int _inventoryTopIndex;