aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2010-11-29 21:00:23 +0000
committerBastien Bouclet2010-11-29 21:00:23 +0000
commit7ea90ddf193deee82486cd3bd23f3af81511cf67 (patch)
treeba8cc6d7b9d18f42ef0456d01a487329bbe9bd6b
parent149eed5c3296175d122cc7f44db75fe352fae004 (diff)
downloadscummvm-rg350-7ea90ddf193deee82486cd3bd23f3af81511cf67.tar.gz
scummvm-rg350-7ea90ddf193deee82486cd3bd23f3af81511cf67.tar.bz2
scummvm-rg350-7ea90ddf193deee82486cd3bd23f3af81511cf67.zip
MOHAWK: Create constants for remaining Myst resource types
svn-id: r54634
-rw-r--r--engines/mohawk/myst.cpp31
-rw-r--r--engines/mohawk/myst.h22
-rw-r--r--engines/mohawk/myst_areas.h27
-rw-r--r--engines/mohawk/myst_scripts_selenitic.cpp4
4 files changed, 40 insertions, 44 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 21774e7967..14a2d96040 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -926,52 +926,45 @@ void MohawkEngine_Myst::redrawResource(MystResourceType8 *_resource) {
void MohawkEngine_Myst::redrawArea(uint16 var) {
for (uint16 i = 0; i < _resources.size(); i++)
- if (_resources[i]->type == 8 && _resources[i]->getType8Var() == var)
+ if (_resources[i]->type == kMystConditionalImage && _resources[i]->getType8Var() == var)
redrawResource(static_cast<MystResourceType8 *>(_resources[i]));
}
MystResource *MohawkEngine_Myst::loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent) {
MystResource *resource = 0;
- uint16 type = rlstStream->readUint16LE();
+ ResourceType type = static_cast<ResourceType>(rlstStream->readUint16LE());
debugC(kDebugResource, "\tType: %d", type);
debugC(kDebugResource, "\tSub_Record: %d", (parent == NULL) ? 0 : 1);
switch (type) {
- case kMystForwardResource:
- case kMystLeftResource:
- case kMystRightResource:
- case kMystDownResource:
- case kMystUpResource:
- case 14: // TODO: kMystBackwardResource?
- resource = new MystResource(this, rlstStream, parent);
- break;
- case kMystActionResource:
+ case kMystAction:
resource = new MystResourceType5(this, rlstStream, parent);
break;
- case kMystVideoResource:
+ case kMystVideo:
resource = new MystResourceType6(this, rlstStream, parent);
break;
- case kMystSwitchResource:
+ case kMystSwitch:
resource = new MystResourceType7(this, rlstStream, parent);
break;
- case 8:
+ case kMystConditionalImage:
resource = new MystResourceType8(this, rlstStream, parent);
break;
- case 10:
+ case kMystSlider:
resource = new MystResourceType10(this, rlstStream, parent);
break;
- case 11:
+ case kMystDragArea:
resource = new MystResourceType11(this, rlstStream, parent);
break;
- case 12:
+ case kMystVideoInfos:
resource = new MystResourceType12(this, rlstStream, parent);
break;
- case 13:
+ case kMystHoverArea:
resource = new MystResourceType13(this, rlstStream, parent);
break;
default:
- error ("Unknown/Unhandled MystResource type %d", type);
+ resource = new MystResource(this, rlstStream, parent);
+ break;
}
resource->type = type;
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 1d81a7d17c..0a2b0fbbbc 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -78,28 +78,6 @@ enum {
const uint16 kMasterpieceOnly = 0xFFFF;
-// Myst Resource Types
-// TODO: Other types and such
-enum {
- kMystForwardResource = 0,
- kMystLeftResource = 1,
- kMystRightResource = 2,
- kMystDownResource = 3,
- kMystUpResource = 4,
- kMystActionResource = 5,
- kMystVideoResource = 6,
- kMystSwitchResource = 7
-};
-
-// Myst Resource Flags
-// TODO: Figure out other flags
-enum {
- kMystSubimageEnableFlag = (1 << 0),
- kMystHotspotEnableFlag = (1 << 1),
- kMystUnknownFlag = (1 << 2),
- kMystZipModeEnableFlag = (1 << 3)
-};
-
struct MystCondition {
uint16 var;
uint16 numStates;
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index a866fca603..e5063408c3 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -30,6 +30,31 @@
namespace Mohawk {
+// Myst Resource Types
+enum ResourceType {
+ kMystForwardArea = 0,
+ kMystLeftArea = 1,
+ kMystRightArea = 2,
+ kMystDownArea = 3,
+ kMystUpArea = 4,
+ kMystAction = 5,
+ kMystVideo = 6,
+ kMystSwitch = 7,
+ kMystConditionalImage = 8,
+ kMystSlider = 10,
+ kMystDragArea = 11,
+ kMystVideoInfos = 12,
+ kMystHoverArea = 13
+};
+
+// Myst Resource Flags
+// TODO: Figure out other flags
+enum {
+ kMystSubimageEnableFlag = (1 << 0),
+ kMystHotspotEnableFlag = (1 << 1),
+ kMystUnknownFlag = (1 << 2),
+ kMystZipModeEnableFlag = (1 << 3)
+};
class MystResource {
public:
@@ -37,7 +62,7 @@ public:
virtual ~MystResource();
MystResource *_parent;
- uint16 type;
+ ResourceType type;
bool contains(Common::Point point) { return _rect.contains(point); }
virtual void drawDataToScreen() {}
diff --git a/engines/mohawk/myst_scripts_selenitic.cpp b/engines/mohawk/myst_scripts_selenitic.cpp
index 2eb79c20a2..26b22b2226 100644
--- a/engines/mohawk/myst_scripts_selenitic.cpp
+++ b/engines/mohawk/myst_scripts_selenitic.cpp
@@ -973,7 +973,7 @@ void MystScriptParser_Selenitic::o_204_soundLock_init(uint16 op, uint16 var, uin
debugC(kDebugScript, "Opcode %d: Sound lock init", op);
for (uint i = 0; i < _vm->_resources.size(); i++) {
- if (_vm->_resources[i]->type == 10) {
+ if (_vm->_resources[i]->type == kMystSlider) {
switch (_vm->_resources[i]->getType8Var()) {
case 20:
_sound_lock_slider_1 = static_cast<MystResourceType10 *>(_vm->_resources[i]);
@@ -996,7 +996,7 @@ void MystScriptParser_Selenitic::o_204_soundLock_init(uint16 op, uint16 var, uin
_sound_lock_slider_5->setStep(selenitic_vars[17]);
break;
}
- } else if (_vm->_resources[i]->type == 8) {
+ } else if (_vm->_resources[i]->type == kMystConditionalImage) {
if (_vm->_resources[i]->getType8Var() == 28) {
_sound_lock_button = static_cast<MystResourceType8 *>(_vm->_resources[i]);
}