mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
TITANIC: Added RoomFlagsComparison enum
This commit is contained in:
parent
92ec3a470a
commit
54c6f27a60
@ -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:
|
||||
|
@ -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 ---*/
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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)) {
|
||||
|
@ -66,7 +66,7 @@ protected:
|
||||
int _offEndFrame;
|
||||
int _okStartFrame;
|
||||
int _okEndFrame;
|
||||
int _field140;
|
||||
RoomFlagsComparison _flagsComparison;
|
||||
CGameObject *_mailP;
|
||||
int _afterReceiveStartFrame;
|
||||
int _afterReceiveEndFrame;
|
||||
|
Loading…
x
Reference in New Issue
Block a user