aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2010-07-01 12:01:17 +0000
committerPaul Gilbert2010-07-01 12:01:17 +0000
commit6c6d8b3fb39afe4a5866348ca2d34a7b13b566bb (patch)
tree2534a8ec7d4cd1cc155f99f0ad6f9d34fc9936be
parentb45d2cd92b137dc429f12f67b887a193f601afb2 (diff)
downloadscummvm-rg350-6c6d8b3fb39afe4a5866348ca2d34a7b13b566bb.tar.gz
scummvm-rg350-6c6d8b3fb39afe4a5866348ca2d34a7b13b566bb.tar.bz2
scummvm-rg350-6c6d8b3fb39afe4a5866348ca2d34a7b13b566bb.zip
Introduced a hash for storing all the miscellaneous data values, and used it to more properly implement display of all the wakeup text in the first room
svn-id: r50544
-rw-r--r--engines/m4/animation.cpp4
-rw-r--r--engines/m4/animation.h1
-rw-r--r--engines/m4/globals.h4
-rw-r--r--engines/m4/mads_logic.cpp54
-rw-r--r--engines/m4/mads_logic.h2
-rw-r--r--engines/m4/mads_scene.h1
-rw-r--r--engines/m4/mads_views.h1
7 files changed, 59 insertions, 8 deletions
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp
index f9dd8287ae..0ead57aac9 100644
--- a/engines/m4/animation.cpp
+++ b/engines/m4/animation.cpp
@@ -482,6 +482,10 @@ void MadsAnimation::setCurrentFrame(int frameNumber) {
_nextScrollTimer = _nextFrameTimer = _madsVm->_currentTimer;
}
+int MadsAnimation::getCurrentFrame() {
+ return _currentFrame;
+}
+
void MadsAnimation::load1(int frameNumber) {
if (_skipLoad)
return;
diff --git a/engines/m4/animation.h b/engines/m4/animation.h
index 21fa411426..583d829066 100644
--- a/engines/m4/animation.h
+++ b/engines/m4/animation.h
@@ -119,6 +119,7 @@ public:
virtual void load(const Common::String &filename, int abortTimers);
virtual void update();
virtual void setCurrentFrame(int frameNumber);
+ virtual int getCurrentFrame();
bool freeFlag() const { return _freeFlag; }
bool getAnimMode() const { return _animMode; }
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index 3a986ee294..0217a96777 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -28,6 +28,7 @@
#include "common/scummsys.h"
#include "common/array.h"
+#include "common/hashmap.h"
#include "common/rect.h"
#include "common/file.h"
#include "common/list.h"
@@ -223,6 +224,8 @@ struct MadsConfigData {
int screenFades;
};
+typedef Common::HashMap<uint16, uint16> IntStorage;
+
class MadsGlobals : public Globals {
private:
struct MessageItem {
@@ -250,6 +253,7 @@ public:
int sceneNumber;
int previousScene;
uint16 actionNouns[3];
+ IntStorage _dataMap;
void loadMadsVocab();
uint32 getVocabSize() { return _madsVocab.size(); }
diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp
index 9cb053a876..72c5fde40b 100644
--- a/engines/m4/mads_logic.cpp
+++ b/engines/m4/mads_logic.cpp
@@ -69,6 +69,10 @@ void MadsSceneLogic::getAnimName() {
strcpy(_madsVm->scene()->_aaName, newName);
}
+IntStorage &MadsSceneLogic::dataMap() {
+ return _madsVm->globals()->_dataMap;
+}
+
/*--------------------------------------------------------------------------*/
uint16 MadsSceneLogic::loadSpriteSet(uint16 suffixNum, uint16 sepChar) {
@@ -239,9 +243,13 @@ void MadsSceneLogic::enterScene() {
_madsVm->scene()->getSceneResources().playerPos = Common::Point(68, 140);
_madsVm->scene()->getSceneResources().playerDir = 4;
- // TODO: Flags setting
+
+ dataMap()[0x56FC] = 0;
+ dataMap()[0x5482] = 0;
+ dataMap()[0x5484] = 30;
}
+ _madsVm->globals()->_dataMap[0x5486] = 0;
lowRoomsEntrySound();
}
@@ -250,14 +258,44 @@ void MadsSceneLogic::doAction() {
}
void MadsSceneLogic::sceneStep() {
- // FIXME: Temporary code to display a message on-screen
- static bool tempBool = false;
- if (!tempBool) {
- tempBool = true;
+ // Wake up message sequence
+ Animation *anim = _madsVm->scene()->activeAnimation();
+ if (anim) {
+ if ((anim->getCurrentFrame() == 6) && (dataMap()[0x5482] == 0)) {
+ dataMap()[0x5482]++;
+ _madsVm->scene()->_kernelMessages.add(Common::Point(63, dataMap()[0x5484]),
+ 0x1110, 0, 0, 240, _madsVm->globals()->getQuote(49));
+ dataMap()[0x5484] += 14;
+ }
- _madsVm->scene()->_kernelMessages.add(Common::Point(63, 100), 0x1110, 0, 0, 240,
- _madsVm->globals()->getQuote(49));
- }
+ if ((anim->getCurrentFrame() == 7) && (dataMap()[0x5482] == 1)) {
+ dataMap()[0x5482]++;
+ _madsVm->scene()->_kernelMessages.add(Common::Point(63, dataMap()[0x5484]),
+ 0x1110, 0, 0, 240, _madsVm->globals()->getQuote(54));
+ dataMap()[0x5484] += 14;
+ }
+
+ if ((anim->getCurrentFrame() == 10) && (dataMap()[0x5482] == 2)) {
+ dataMap()[0x5482]++;
+ _madsVm->scene()->_kernelMessages.add(Common::Point(63, dataMap()[0x5484]),
+ 0x1110, 0, 0, 240, _madsVm->globals()->getQuote(55));
+ dataMap()[0x5484] += 14;
+ }
+
+ if ((anim->getCurrentFrame() == 17) && (dataMap()[0x5482] == 3)) {
+ dataMap()[0x5482]++;
+ _madsVm->scene()->_kernelMessages.add(Common::Point(63, dataMap()[0x5484]),
+ 0x1110, 0, 0, 240, _madsVm->globals()->getQuote(56));
+ dataMap()[0x5484] += 14;
+ }
+
+ if ((anim->getCurrentFrame() == 20) && (dataMap()[0x5482] == 4)) {
+ dataMap()[0x5482]++;
+ _madsVm->scene()->_kernelMessages.add(Common::Point(63, dataMap()[0x5484]),
+ 0x1110, 0, 0, 240, _madsVm->globals()->getQuote(50));
+ dataMap()[0x5484] += 14;
+ }
+ }
}
}
diff --git a/engines/m4/mads_logic.h b/engines/m4/mads_logic.h
index 8c3f41d08b..299464f62b 100644
--- a/engines/m4/mads_logic.h
+++ b/engines/m4/mads_logic.h
@@ -50,6 +50,8 @@ private:
const char *formAnimName(char sepChar, int16 suffixNum);
void getSceneSpriteSet();
void getAnimName();
+
+ IntStorage &dataMap();
public:
void selectScene(int sceneNum);
diff --git a/engines/m4/mads_scene.h b/engines/m4/mads_scene.h
index ef5cd312d7..c5fe6f01cd 100644
--- a/engines/m4/mads_scene.h
+++ b/engines/m4/mads_scene.h
@@ -128,6 +128,7 @@ public:
void loadPlayerSprites(const char *prefix);
void showMADSV2TextBox(char *text, int x, int y, char *faceName);
void loadAnimation(const Common::String &animName, int v0);
+ Animation *activeAnimation() const { return _activeAnimation; }
MadsInterfaceView *getInterface() { return (MadsInterfaceView *)_interfaceSurface; }
MadsSceneResources &getSceneResources() { return _sceneResources; }
diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h
index 2fbe6a6dc7..e3344bc8a4 100644
--- a/engines/m4/mads_views.h
+++ b/engines/m4/mads_views.h
@@ -376,6 +376,7 @@ public:
virtual void load(const Common::String &filename, int v0) = 0;
virtual void update() = 0;
virtual void setCurrentFrame(int frameNumber) = 0;
+ virtual int getCurrentFrame() = 0;
};