aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-18 23:05:45 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit7dd90c3daf2d9955ba232c0ed70d1f4b90ba81e9 (patch)
tree544283813f779139af0de206090ef29622c76842
parent6b833550b0371919c9108ceb36c916a7030f9b7c (diff)
downloadscummvm-rg350-7dd90c3daf2d9955ba232c0ed70d1f4b90ba81e9.tar.gz
scummvm-rg350-7dd90c3daf2d9955ba232c0ed70d1f4b90ba81e9.tar.bz2
scummvm-rg350-7dd90c3daf2d9955ba232c0ed70d1f4b90ba81e9.zip
DM: Add F0141_DUNGEON_GetObjectInfoIndex, getType for Container
-rw-r--r--engines/dm/dungeonman.cpp28
-rw-r--r--engines/dm/dungeonman.h4
2 files changed, 31 insertions, 1 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 6b577ca3af..93bde021e0 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1036,4 +1036,32 @@ uint16 DungeonMan::getObjectWeight(Thing thing) {
return 0; // dummy
}
+/* Object info */
+#define kObjectInfoIndexFirstScroll 0 // @ C000_OBJECT_INFO_INDEX_FIRST_SCROLL
+#define kObjectInfoIndexFirstContainer 1 // @ C001_OBJECT_INFO_INDEX_FIRST_CONTAINER
+#define kObjectInfoIndexFirstPotion 2 // @ C002_OBJECT_INFO_INDEX_FIRST_POTION
+#define kObjectInfoIndexFirstWeapon 23 // @ C023_OBJECT_INFO_INDEX_FIRST_WEAPON
+#define kObjectInfoIndexFirstArmour 69 // @ C069_OBJECT_INFO_INDEX_FIRST_ARMOUR
+#define kObjectInfoIndexFirstJunk 127 // @ C127_OBJECT_INFO_INDEX_FIRST_JUNK
+
+int16 DungeonMan::getObjectInfoIndex(Thing thing) {
+ uint16 *rawType = getThingData(thing);
+ switch (thing.getType()) {
+ case kScrollThingType:
+ return kObjectInfoIndexFirstScroll;
+ case kContainerThingType:
+ return kObjectInfoIndexFirstContainer + Container(rawType).getType();
+ case kJunkThingType:
+ return kObjectInfoIndexFirstJunk + Junk(rawType).getType();
+ case kWeaponThingType:
+ return kObjectInfoIndexFirstWeapon + Weapon(rawType).getType();
+ case kArmourThingType:
+ return kObjectInfoIndexFirstArmour + Armour(rawType).getType();
+ case kPotionThingType:
+ return kObjectInfoIndexFirstPotion + Potion(rawType).getType();
+ default:
+ return -1;
+ }
+}
+
} \ No newline at end of file
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index aba2872a65..0a68600c1a 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -341,6 +341,7 @@ class Container {
public:
Container(uint16 *rawDat) : _nextThing(rawDat[0]), _nextContainedThing(rawDat[1]), _type(rawDat[2]) {}
+ uint16 getType() { return (_type >> 1) & 0x3; }
Thing getNextContainedThing() { return _nextContainedThing; }
Thing getNextThing() { return _nextThing; }
}; // @ CONTAINER
@@ -554,7 +555,8 @@ public:
void setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
void decodeText(char *destString, Thing thing, TextType type); // F0168_DUNGEON_DecodeText
- uint16 getObjectWeight(Thing thing);// @ F0140_DUNGEON_GetObjectWeight
+ uint16 getObjectWeight(Thing thing); // @ F0140_DUNGEON_GetObjectWeight
+ int16 getObjectInfoIndex(Thing thing); // @ F0141_DUNGEON_GetObjectInfoIndex
uint32 _rawDunFileDataSize; // @ probably NONE
byte *_rawDunFileData; // @ ???