aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2010-03-16 08:26:08 +0000
committerPaul Gilbert2010-03-16 08:26:08 +0000
commit730405f975e05659b5f37ffd5bd8761eb20c7af4 (patch)
tree5a1c37e92f20b8c7546f753e8eceaf00eedf130f
parenta1f1cdf820f5eefac4fbcba8a596646fc05b954e (diff)
downloadscummvm-rg350-730405f975e05659b5f37ffd5bd8761eb20c7af4.tar.gz
scummvm-rg350-730405f975e05659b5f37ffd5bd8761eb20c7af4.tar.bz2
scummvm-rg350-730405f975e05659b5f37ffd5bd8761eb20c7af4.zip
Further code implemented for the current action display
svn-id: r48266
-rw-r--r--engines/m4/console.cpp26
-rw-r--r--engines/m4/hotspot.h4
-rw-r--r--engines/m4/m4_scene.cpp17
-rw-r--r--engines/m4/m4_scene.h6
-rw-r--r--engines/m4/mads_scene.cpp78
-rw-r--r--engines/m4/mads_scene.h18
-rw-r--r--engines/m4/mads_views.h1
-rw-r--r--engines/m4/scene.cpp18
-rw-r--r--engines/m4/scene.h5
-rw-r--r--engines/m4/staticres.cpp2
-rw-r--r--engines/m4/staticres.h2
11 files changed, 129 insertions, 48 deletions
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 8476b3ff53..49685c934f 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -103,7 +103,7 @@ bool Console::cmdListHotSpots(int argc, const char **argv) {
_vm->_scene->getSceneResources().hotspots->dump();
if (_vm->isM4()) {
DebugPrintf("Scene parallax\n");
- _vm->_scene->getSceneResources().parallax->dump();
+ _m4Vm->scene()->getSceneResources().parallax->dump();
DebugPrintf("Scene props\n");
_vm->_scene->getSceneResources().props->dump();
}
@@ -395,23 +395,23 @@ M4Console::M4Console(M4Engine *vm): Console(vm) {
}
bool M4Console::cmdSceneInfo(int argc, const char **argv) {
- DebugPrintf("Current scene is: %i\n", _vm->_scene->getCurrentScene());
+ DebugPrintf("Current scene is: %i\n", _m4Vm->scene()->getCurrentScene());
DebugPrintf("Scene resources:\n");
- DebugPrintf("artBase: %s\n", _vm->_scene->getSceneResources().artBase);
- DebugPrintf("pictureBase: %s\n", _vm->_scene->getSceneResources().pictureBase);
- DebugPrintf("hotspotCount: %i\n", _vm->_scene->getSceneResources().hotspotCount);
- DebugPrintf("parallaxCount: %i\n", _vm->_scene->getSceneResources().parallaxCount);
- DebugPrintf("propsCount: %i\n", _vm->_scene->getSceneResources().propsCount);
- DebugPrintf("frontY: %i\n", _vm->_scene->getSceneResources().frontY);
- DebugPrintf("backY: %i\n", _vm->_scene->getSceneResources().backY);
- DebugPrintf("frontScale: %i\n", _vm->_scene->getSceneResources().frontScale);
- DebugPrintf("backScale: %i\n", _vm->_scene->getSceneResources().backScale);
+ DebugPrintf("artBase: %s\n", _m4Vm->scene()->getSceneResources().artBase);
+ DebugPrintf("pictureBase: %s\n", _m4Vm->scene()->getSceneResources().pictureBase);
+ DebugPrintf("hotspotCount: %i\n", _m4Vm->scene()->getSceneResources().hotspotCount);
+ DebugPrintf("parallaxCount: %i\n", _m4Vm->scene()->getSceneResources().parallaxCount);
+ DebugPrintf("propsCount: %i\n", _m4Vm->scene()->getSceneResources().propsCount);
+ DebugPrintf("frontY: %i\n", _m4Vm->scene()->getSceneResources().frontY);
+ DebugPrintf("backY: %i\n", _m4Vm->scene()->getSceneResources().backY);
+ DebugPrintf("frontScale: %i\n", _m4Vm->scene()->getSceneResources().frontScale);
+ DebugPrintf("backScale: %i\n", _m4Vm->scene()->getSceneResources().backScale);
DebugPrintf("depthTable: ");
for (uint i = 0; i < 16; i++)
- DebugPrintf("%i ", _vm->_scene->getSceneResources().depthTable[i]);
+ DebugPrintf("%i ", _m4Vm->scene()->getSceneResources().depthTable[i]);
DebugPrintf("\n");
- DebugPrintf("railNodeCount: %i\n", _vm->_scene->getSceneResources().railNodeCount);
+ DebugPrintf("railNodeCount: %i\n", _m4Vm->scene()->getSceneResources().railNodeCount);
return true;
}
diff --git a/engines/m4/hotspot.h b/engines/m4/hotspot.h
index bd1bc480a7..5bb4f5888a 100644
--- a/engines/m4/hotspot.h
+++ b/engines/m4/hotspot.h
@@ -59,6 +59,7 @@ public:
void setRect(int x1, int y1, int x2, int y2);
void setFeet(int x, int y);
void setFacing(uint8 facing) { _facing = facing; }
+ void setArticle(int8 v) { _articleNumber = v; }
char *getVocab() const { return _vocab; }
int32 getVocabID() { return _vocabID; }
char *getVerb() const { return _verb; }
@@ -70,6 +71,7 @@ public:
uint8 getFacing() const { return _facing; }
int getFeetX() { return _feetX; }
int getFeetY() { return _feetY; }
+ int8 getArticle() const { return _articleNumber; }
Common::Rect getRect() const;
int32 area() const { return (_rect.width() - 1) * (_rect.height() - 1); }
@@ -85,6 +87,8 @@ private:
// Unused in Orion Burger, used in MADS games
uint8 _syntax;
int32 _vocabID, _verbID;
+ int8 _articleNumber;
+
//TODO: check if this is actually needed by the game
int16 _hash;
};
diff --git a/engines/m4/m4_scene.cpp b/engines/m4/m4_scene.cpp
index 90f288c31a..fcbf2b0dd7 100644
--- a/engines/m4/m4_scene.cpp
+++ b/engines/m4/m4_scene.cpp
@@ -41,8 +41,10 @@ namespace M4 {
M4Scene::M4Scene(M4Engine *vm): _sceneResources(), Scene(vm, &_sceneResources) {
_vm = vm;
_sceneSprites = NULL;
- _interfaceSurface = new M4InterfaceView(vm);
_inverseColourTable = NULL;
+
+ _sceneResources.parallax = new HotSpotList();
+ _interfaceSurface = new M4InterfaceView(vm);
}
M4Scene::~M4Scene() {
@@ -195,6 +197,9 @@ void M4Scene::show() {
}
void M4Scene::leaveScene() {
+ _sceneResources.parallax->clear();
+
+ delete _sceneResources.parallax;
delete[] _inverseColourTable;
Scene::leaveScene();
@@ -308,4 +313,14 @@ void M4Scene::nextCommonCursor() {
_vm->_mouse->setCursorNum(cursorIndex);
}
+void M4Scene::showHotSpots() {
+ Scene::showHotSpots();
+
+ // parallax (yellow)
+ for (int i = 0; i < _sceneResources.parallaxCount; i++) {
+ HotSpot *currentHotSpot = _sceneResources.parallax->get(i);
+ _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->YELLOW);
+ }
+}
+
} // End of namespace M4
diff --git a/engines/m4/m4_scene.h b/engines/m4/m4_scene.h
index 14eea3dfac..846c1a2ff8 100644
--- a/engines/m4/m4_scene.h
+++ b/engines/m4/m4_scene.h
@@ -42,6 +42,9 @@ public:
int32 frontScale, backScale;
int16 depthTable[16];
int32 railNodeCount; // # of rails
+
+ int32 parallaxCount;
+ HotSpotList *parallax;
};
class M4Scene : public Scene {
@@ -70,12 +73,13 @@ public:
virtual void leftClick(int x, int y);
virtual void rightClick(int x, int y);
virtual void setAction(int action, int objectId = -1);
- virtual void setStatusText(const char *text);
virtual void update();
+ virtual void showHotSpots();
byte *getInverseColourTable() const { return _inverseColourTable; }
M4InterfaceView *getInterface() { return (M4InterfaceView *)_interfaceSurface; };
M4SceneResources &getSceneResources() { return _sceneResources; };
+ void setStatusText(const char *text);
};
} // End of namespace M4
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp
index 338bc8fb4f..194aaa1317 100644
--- a/engines/m4/mads_scene.cpp
+++ b/engines/m4/mads_scene.cpp
@@ -43,7 +43,6 @@ namespace M4 {
MadsScene::MadsScene(MadsEngine *vm): _sceneResources(), Scene(vm, &_sceneResources) {
_vm = vm;
- strcpy(_statusText, "");
_interfaceSurface = new MadsInterfaceView(vm);
_spriteSlotsStart = 0;
for (int i = 0; i < 3; ++i)
@@ -94,6 +93,8 @@ void MadsScene::loadSceneTemporary() {
return;
loadSceneHotspots(_currentScene);
+
+ _action.clear();
}
void MadsScene::loadScene(int sceneNumber) {
@@ -149,11 +150,9 @@ void MadsScene::loadSceneHotspots(int sceneNumber) {
void MadsScene::leaveScene() {
_sceneResources.hotspots->clear();
- _sceneResources.parallax->clear();
_sceneResources.props->clear();
delete _sceneResources.hotspots;
- delete _sceneResources.parallax;
delete _sceneResources.props;
// Delete the sprites
@@ -263,10 +262,6 @@ void MadsScene::setAction(int action, int objectId) {
setStatusText(statusText);
}
-void MadsScene::setStatusText(const char *text) {
- strcpy(_statusText, text);
-}
-
/**
* Draws all the elements of the scene
*/
@@ -316,8 +311,11 @@ void MadsScene::update() {
// Draw all the various elements
drawElements();
+ _action.set();
+ const char *sStatusText = _action.statusText();
+
// Handle display of any status text
- if (_statusText[0]) {
+ if (sStatusText[0]) {
// Text colors are inverted in Dragonsphere
if (_vm->getGameType() == GType_DragonSphere)
_vm->_font->setColors(_vm->_palette->BLACK, _vm->_palette->WHITE, _vm->_palette->BLACK);
@@ -325,7 +323,7 @@ void MadsScene::update() {
_vm->_font->setColors(_vm->_palette->WHITE, _vm->_palette->BLACK, _vm->_palette->BLACK);
_vm->_font->setFont(FONT_MAIN_MADS);
- _vm->_font->writeString(this, _statusText, (width() - _vm->_font->getWidth(_statusText)) / 2, 142, 0);
+ _vm->_font->writeString(this, sStatusText, (width() - _vm->_font->getWidth(sStatusText)) / 2, 142, 0);
}
//***DEBUG***
@@ -476,16 +474,22 @@ MadsAction::MadsAction() {
void MadsAction::clear() {
_actionMode = ACTMODE_NONE;
+ _actionMode2 = ACTMODE2_0;
+ _word_86F42 = 0;
+ _word_86F4E = 0;
_articleNumber = 0;
_lookFlag = false;
+ _word_86F4A = 0;
_statusText[0] = '\0';
_selectedRow = -1;
_currentHotspot = -1;
+ _word_86F3A = -1;
+ _word_86F4C = -1;
//word_86F3A/word_86F4C
_currentAction = kVerbNone;
_objectNameId = -1;
_objectDescId = -1;
- //word_83334
+ _word_83334 = -1;
}
void MadsAction::appendVocab(int vocabId, bool capitalise) {
@@ -499,6 +503,7 @@ void MadsAction::appendVocab(int vocabId, bool capitalise) {
}
void MadsAction::set() {
+ int hotspotCount = _madsVm->scene()->getSceneResources().hotspotCount;
bool flag = false;
_currentAction = -1;
_objectNameId = -1;
@@ -562,14 +567,13 @@ void MadsAction::set() {
if (_currentHotspot >= 0) {
if (_selectedRow < 0) {
int verbId;
- int hotspotCount = _madsVm->scene()->getSceneResources().hotspotCount;
if (_currentHotspot < hotspotCount) {
// Get the verb Id from the hotspot
verbId = (*_madsVm->scene()->getSceneResources().hotspots)[_currentHotspot].getVerbID();
} else {
// Get the verb Id from the scene object
- verbId = 0;//Scene_object[_currentHotspot - _hotspotCount].verbId;
+ verbId = (*_madsVm->scene()->getSceneResources().props)[_currentHotspot - hotspotCount].getVerbID();
}
if (verbId > 0) {
@@ -583,12 +587,58 @@ void MadsAction::set() {
}
}
- //loc_21CE2
+ if ((_actionMode2 == ACTMODE2_2) || (_actionMode2 == ACTMODE2_5)) {
+ // Get name from given inventory object
+ int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_currentHotspot);
+ _objectNameId = _madsVm->globals()->getObject(objectId)->descId;
+ } else if (_currentHotspot < hotspotCount) {
+ // Get name from scene hotspot
+ _objectNameId = (*_madsVm->scene()->getSceneResources().hotspots)[_currentHotspot].getVocabID();
+ } else {
+ // Get name from temporary scene hotspot
+ _objectNameId = (*_madsVm->scene()->getSceneResources().props)[_currentHotspot].getVocabID();
+ }
+ }
+ }
+
+ if ((_currentHotspot >= 0) && (_articleNumber > 0) && !flag) {
+ if (_articleNumber == -1) {
+ if (_word_86F3A >= 0) {
+ int articleNum = 0;
+
+ if ((_word_86F42 == 2) || (_word_86F42 == 5)) {
+ int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_currentHotspot);
+ articleNum = _madsVm->globals()->getObject(objectId)->article;
+ } else if (_word_86F3A < hotspotCount) {
+ articleNum = (*_madsVm->scene()->getSceneResources().hotspots)[_currentHotspot].getArticle();
+ } else {
+
+ }
+ }
+
+ } else if ((_articleNumber == kVerbLook) || (_vm->getGameType() != GType_RexNebular) ||
+ (strcmp(_madsVm->globals()->getVocab(_objectDescId), fenceStr) != 0)) {
+ // Write out the article
+ strcat(_statusText, englishMADSArticleList[_articleNumber]);
+ } else {
+ // Special case for a 'fence' entry in Rex Nebular
+ strcat(_statusText, overStr);
}
+
+ strcat(_statusText, " ");
}
+
+ // Append object description if necessary
+ if (_word_86F3A >= 0)
+ appendVocab(_objectDescId);
+
+ // Remove any trailing space character
+ int statusLen = strlen(_statusText);
+ if ((statusLen > 0) && (_statusText[statusLen - 1] == ' '))
+ _statusText[statusLen - 1] = '\0';
}
- //word_83334 = -1;
+ _word_83334 = -1;
}
/*--------------------------------------------------------------------------*/
diff --git a/engines/m4/mads_scene.h b/engines/m4/mads_scene.h
index 82ac4f28ba..2f8fcf990b 100644
--- a/engines/m4/mads_scene.h
+++ b/engines/m4/mads_scene.h
@@ -124,26 +124,38 @@ public:
};
enum MadsActionMode {ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6};
+enum MAdsActionMode2 {ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_5 = 5};
class MadsAction {
private:
char _statusText[100];
+
+ void appendVocab(int vocabId, bool capitalise = false);
+public:
int _currentHotspot;
int _objectNameId;
int _objectDescId;
int _currentAction;
int8 _flags1, _flags2;
MadsActionMode _actionMode;
+ MAdsActionMode2 _actionMode2;
int _articleNumber;
bool _lookFlag;
int _selectedRow;
+ // Unknown fields
+ int16 _word_86F3A;
+ int16 _word_86F42;
+ int16 _word_86F4E;
+ int16 _word_86F4A;
+ int16 _word_83334;
+ int16 _word_86F4C;
- void appendVocab(int vocabId, bool capitalise = false);
public:
MadsAction();
void clear();
void set();
+ const char *statusText() const { return _statusText; }
};
typedef Common::Array<SpriteAsset *> SpriteAssetArray;
@@ -155,7 +167,7 @@ class MadsScene : public Scene {
private:
MadsEngine *_vm;
MadsSceneResources _sceneResources;
- char _statusText[100];
+ MadsAction _action;
MadsSceneLogic _sceneLogic;
SpriteAsset *_playerSprites;
@@ -187,7 +199,6 @@ public:
virtual void leftClick(int x, int y);
virtual void rightClick(int x, int y);
virtual void setAction(int action, int objectId = -1);
- virtual void setStatusText(const char *text);
virtual void update();
int loadSceneSpriteSet(const char *setName);
@@ -196,6 +207,7 @@ public:
MadsInterfaceView *getInterface() { return (MadsInterfaceView *)_interfaceSurface; };
MadsSceneResources &getSceneResources() { return _sceneResources; };
+ void setStatusText(const char *text) {};//***DEPRECATED***
};
} // End of namespace M4
diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h
index fa6247d4a9..8a936c1759 100644
--- a/engines/m4/mads_views.h
+++ b/engines/m4/mads_views.h
@@ -77,6 +77,7 @@ public:
virtual void setSelectedObject(int objectNumber);
virtual void addObjectToInventory(int objectNumber);
int getSelectedObject() { return _selectedObject; }
+ int getInventoryObject(int objectIndex) { return _inventoryList[objectIndex]; }
void onRefresh(RectList *rects, M4Surface *destSurface);
bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp
index fb4145c123..e9480ff9a6 100644
--- a/engines/m4/scene.cpp
+++ b/engines/m4/scene.cpp
@@ -44,7 +44,6 @@ Scene::Scene(MadsM4Engine *vm, SceneResources *res): View(vm, Common::Rect(0, 0,
_screenType = VIEWID_SCENE;
_sceneResources->hotspots = new HotSpotList();
- _sceneResources->parallax = new HotSpotList();
_sceneResources->props = new HotSpotList();
_backgroundSurface = new M4Surface();
_walkSurface = new M4Surface();
@@ -124,22 +123,17 @@ void Scene::showSprites() {
void Scene::showHotSpots() {
int i = 0;
HotSpot *currentHotSpot;
+
// hotspots (green)
for (i = 0; i < _sceneResources->hotspotCount; i++) {
currentHotSpot = _sceneResources->hotspots->get(i);
_backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->GREEN);
}
- if (_vm->isM4()) {
- // parallax (yellow)
- for (i = 0; i < _sceneResources->parallaxCount; i++) {
- currentHotSpot = _sceneResources->parallax->get(i);
- _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->YELLOW);
- }
- // props (red)
- for (i = 0; i < _sceneResources->propsCount; i++) {
- currentHotSpot = _sceneResources->props->get(i);
- _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->RED);
- }
+
+ // props (red)
+ for (i = 0; i < _sceneResources->propsCount; i++) {
+ currentHotSpot = _sceneResources->props->get(i);
+ _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->RED);
}
}
diff --git a/engines/m4/scene.h b/engines/m4/scene.h
index 67acfc6654..d232c16974 100644
--- a/engines/m4/scene.h
+++ b/engines/m4/scene.h
@@ -64,8 +64,6 @@ public:
char pictureBase[MAX_CHK_FILENAME_SIZE];
int32 hotspotCount;
HotSpotList *hotspots;
- int32 parallaxCount;
- HotSpotList *parallax;
int32 propsCount;
HotSpotList *props;
int32 frontY, backY;
@@ -103,13 +101,12 @@ public:
virtual void leftClick(int x, int y) = 0;
virtual void rightClick(int x, int y) = 0;
virtual void setAction(int action, int objectId = -1) = 0;
- virtual void setStatusText(const char *text) = 0;
virtual void update() = 0;
+ virtual void showHotSpots();
// TODO: perhaps move playIntro() someplace else?
void playIntro();
void showSprites();
- void showHotSpots();
void showCodes();
int getCurrentScene() { return _currentScene; }
M4Surface *getBackgroundSurface() const { return _backgroundSurface; }
diff --git a/engines/m4/staticres.cpp b/engines/m4/staticres.cpp
index f8f25b7455..fbcd78de3f 100644
--- a/engines/m4/staticres.cpp
+++ b/engines/m4/staticres.cpp
@@ -42,6 +42,8 @@ const char *lookAroundStr = "Look around";
const char *toStr = "to ";
const char *useStr = "Use ";
const char *walkToStr = "Walk to ";
+const char *fenceStr = "fence";
+const char *overStr = "over";
VerbInit verbList[10] = {
{kVerbLook, 2, 0},
diff --git a/engines/m4/staticres.h b/engines/m4/staticres.h
index 059fa80e68..2680965304 100644
--- a/engines/m4/staticres.h
+++ b/engines/m4/staticres.h
@@ -40,6 +40,8 @@ extern const char *lookAroundStr;
extern const char *toStr;
extern const char *useStr;
extern const char *walkToStr;
+extern const char *fenceStr;
+extern const char *overStr;
struct VerbInit {
int verb;