aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-22 11:08:04 -0500
committerPaul Gilbert2017-01-22 11:08:04 -0500
commit54c6f27a60e0068385a94ebab321f305db65387c (patch)
tree8e1f8e927eef321e569b2a43d2db01af39d209aa /engines/titanic
parent92ec3a470a8df2fab6aae5caab5105a617a37818 (diff)
downloadscummvm-rg350-54c6f27a60e0068385a94ebab321f305db65387c.tar.gz
scummvm-rg350-54c6f27a60e0068385a94ebab321f305db65387c.tar.bz2
scummvm-rg350-54c6f27a60e0068385a94ebab321f305db65387c.zip
TITANIC: Added RoomFlagsComparison enum
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp14
-rw-r--r--engines/titanic/core/game_object.h8
-rw-r--r--engines/titanic/npcs/bilge_succubus.cpp2
-rw-r--r--engines/titanic/npcs/succubus.cpp12
-rw-r--r--engines/titanic/npcs/succubus.h2
5 files changed, 21 insertions, 17 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index beee255c2d..af7020532c 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -960,14 +960,14 @@ CGameObject *CGameObject::getMailManNextObject(CGameObject *prior) const {
return mailMan ? mailMan->getNextObject(prior) : nullptr;
}
-CGameObject *CGameObject::findMailByFlags(int mode, uint roomFlags) {
+CGameObject *CGameObject::findMailByFlags(RoomFlagsComparison compareType, uint roomFlags) {
CMailMan *mailMan = getMailMan();
if (!mailMan)
return nullptr;
for (CGameObject *obj = mailMan->getFirstObject(); obj;
obj = mailMan->getNextObject(obj)) {
- if (compareRoomFlags(mode, roomFlags, obj->_roomFlags))
+ if (compareRoomFlags(compareType, roomFlags, obj->_roomFlags))
return obj;
}
@@ -1413,15 +1413,15 @@ Common::SeekableReadStream *CGameObject::getResource(const CString &name) {
return g_vm->_filesManager->getResource(name);
}
-bool CGameObject::compareRoomFlags(int mode, uint flags1, uint flags2) {
- switch (mode) {
- case 1:
+bool CGameObject::compareRoomFlags(RoomFlagsComparison compareType, uint flags1, uint flags2) {
+ switch (compareType) {
+ case RFC_LOCATION:
return CRoomFlags::compareLocation(flags1, flags2);
- case 2:
+ case RFC_CLASS_ELEVATOR:
return CRoomFlags::compareClassElevator(flags1, flags2);
- case 3:
+ case RFC_TITANIA:
return CRoomFlags::isTitania(flags1, flags2);
default:
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 629c6a038d..30b3321128 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -41,6 +41,7 @@ namespace Titanic {
enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 };
enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 };
+enum RoomFlagsComparison { RFC_LOCATION = 1, RFC_CLASS_ELEVATOR = 2, RFC_TITANIA = 3 };
class CDontSaveFileItem;
class CMailMan;
@@ -337,7 +338,7 @@ protected:
/**
* Find mail by room flags
*/
- CGameObject *findMailByFlags(int mode, uint roomFlags);
+ CGameObject *findMailByFlags(RoomFlagsComparison compareType, uint roomFlags);
/**
* Find next mail from a given prior one
@@ -712,7 +713,10 @@ public:
*/
CGameObject *getDraggingObject() const;
- bool compareRoomFlags(int mode, uint flags1, uint flags2);
+ /**
+ * Compares two sets of room flags together
+ */
+ static bool compareRoomFlags(RoomFlagsComparison compareType, uint flags1, uint flags2);
/*--- Text display methods ---*/
diff --git a/engines/titanic/npcs/bilge_succubus.cpp b/engines/titanic/npcs/bilge_succubus.cpp
index 8fc13f3933..d5436ebc55 100644
--- a/engines/titanic/npcs/bilge_succubus.cpp
+++ b/engines/titanic/npcs/bilge_succubus.cpp
@@ -88,7 +88,7 @@ bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
} else {
uint roomFlags = pet->getRoomFlags();
CGameObject *mailObject = findMailByFlags(
- _v3 && compareRoomNameTo("Titania") ? 3 : _field140,
+ _v3 && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison,
roomFlags);
if (mailObject) {
diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp
index 1581e15d5f..de3c3793e1 100644
--- a/engines/titanic/npcs/succubus.cpp
+++ b/engines/titanic/npcs/succubus.cpp
@@ -67,7 +67,7 @@ CSuccUBus::CSuccUBus() : CTrueTalkNPC() {
_offEndFrame = 27;
_okStartFrame = 40;
_okEndFrame = 68;
- _field140 = 1;
+ _flagsComparison = RFC_LOCATION;
_mailP = nullptr;
_afterReceiveStartFrame = 0;
_afterReceiveEndFrame = 0;
@@ -118,7 +118,7 @@ void CSuccUBus::save(SimpleFile *file, int indent) {
file->writeNumberLine(_offEndFrame, indent);
file->writeNumberLine(_okStartFrame, indent);
file->writeNumberLine(_okEndFrame, indent);
- file->writeNumberLine(_field140, indent);
+ file->writeNumberLine(_flagsComparison, indent);
file->writeNumberLine(_v2, indent);
file->writeNumberLine(_afterReceiveStartFrame, indent);
@@ -182,7 +182,7 @@ void CSuccUBus::load(SimpleFile *file) {
_offEndFrame = file->readNumber();
_okStartFrame = file->readNumber();
_okEndFrame = file->readNumber();
- _field140 = file->readNumber();
+ _flagsComparison = (RoomFlagsComparison)file->readNumber();
_v2 = file->readNumber();
_afterReceiveStartFrame = file->readNumber();
@@ -491,7 +491,7 @@ bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
}
} else {
CGameObject *mailObject = findMailByFlags(
- _v3 && compareRoomNameTo("Titania") ? 3 : _field140, petRoomFlags);
+ _v3 && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, petRoomFlags);
if (!mailObject) {
// No mail for this SuccUBus
if (getRandomNumber(1) == 0) {
@@ -542,8 +542,8 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
if (pet && !mailExists(petRoomFlags)) {
CGameObject *mailObject = _v3 && compareRoomNameTo("Titania") ?
- findMailByFlags(3, petRoomFlags) :
- findMailByFlags(_field140, petRoomFlags);
+ findMailByFlags(RFC_TITANIA, petRoomFlags) :
+ findMailByFlags(_flagsComparison, petRoomFlags);
if (mailObject) {
switch (getRandomNumber(4)) {
diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h
index fe88d9b8c3..7c0edf711a 100644
--- a/engines/titanic/npcs/succubus.h
+++ b/engines/titanic/npcs/succubus.h
@@ -66,7 +66,7 @@ protected:
int _offEndFrame;
int _okStartFrame;
int _okEndFrame;
- int _field140;
+ RoomFlagsComparison _flagsComparison;
CGameObject *_mailP;
int _afterReceiveStartFrame;
int _afterReceiveEndFrame;