mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 00:45:10 +00:00
TITANIC: Replaced int passenger class with PassengerClass enum
This commit is contained in:
parent
1c3ba9be14
commit
6eac69f45a
@ -1336,17 +1336,17 @@ CMusicRoom *CGameObject::getMusicRoom() const {
|
||||
return gameManager ? &gameManager->_musicRoom : nullptr;
|
||||
}
|
||||
|
||||
int CGameObject::getPassengerClass() const {
|
||||
PassengerClass CGameObject::getPassengerClass() const {
|
||||
CGameManager *gameManager = getGameManager();
|
||||
return gameManager ? gameManager->_gameState._passengerClass : 3;
|
||||
return gameManager ? gameManager->_gameState._passengerClass : THIRD_CLASS;
|
||||
}
|
||||
|
||||
int CGameObject::getPriorClass() const {
|
||||
PassengerClass CGameObject::getPriorClass() const {
|
||||
CGameManager *gameManager = getGameManager();
|
||||
return gameManager ? gameManager->_gameState._priorClass : 3;
|
||||
return gameManager ? gameManager->_gameState._priorClass : THIRD_CLASS;
|
||||
}
|
||||
|
||||
void CGameObject::setPassengerClass(int newClass) {
|
||||
void CGameObject::setPassengerClass(PassengerClass newClass) {
|
||||
if (newClass >= 1 && newClass <= 4) {
|
||||
// Change the passenger class
|
||||
CGameManager *gameMan = getGameManager();
|
||||
@ -1581,7 +1581,7 @@ void CGameObject::petMoveToHiddenRoom() {
|
||||
}
|
||||
}
|
||||
|
||||
void CGameObject::petReassignRoom(int passClassNum) {
|
||||
void CGameObject::petReassignRoom(PassengerClass passClassNum) {
|
||||
CPetControl *petControl = getPetControl();
|
||||
if (petControl)
|
||||
petControl->reassignRoom(passClassNum);
|
||||
|
@ -452,7 +452,7 @@ protected:
|
||||
/**
|
||||
* Set's the player's passenger class
|
||||
*/
|
||||
void setPassengerClass(int newClass);
|
||||
void setPassengerClass(PassengerClass newClass);
|
||||
|
||||
/**
|
||||
* Overrides whether the object's movie has audio timing
|
||||
@ -712,12 +712,12 @@ public:
|
||||
/**
|
||||
* Return the player's passenger class
|
||||
*/
|
||||
int getPassengerClass() const;
|
||||
PassengerClass getPassengerClass() const;
|
||||
|
||||
/**
|
||||
* Return the player's previous passenger class
|
||||
*/
|
||||
int getPriorClass() const;
|
||||
PassengerClass getPriorClass() const;
|
||||
|
||||
/**
|
||||
* Sets the mail identifier for an object
|
||||
@ -884,7 +884,7 @@ public:
|
||||
/**
|
||||
* Gives the player a new assigned room in the specified passenger class
|
||||
*/
|
||||
void petReassignRoom(int passClassNum);
|
||||
void petReassignRoom(PassengerClass passClassNum);
|
||||
|
||||
/**
|
||||
* Sets a new area in the PET
|
||||
|
@ -30,6 +30,11 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
enum PassengerClass {
|
||||
UNCHECKED = 4, THIRD_CLASS = 3, SECOND_CLASS = 2, FIRST_CLASS = 1,
|
||||
NO_CLASS = 0
|
||||
};
|
||||
|
||||
class CGameState;
|
||||
|
||||
class CGameLocation {
|
||||
|
@ -45,10 +45,10 @@ bool CGameStateMovieList::clear() {
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
CGameState::CGameState(CGameManager *gameManager) :
|
||||
_gameManager(gameManager), _gameLocation(this),
|
||||
_passengerClass(0), _priorClass(0), _mode(GSMODE_NONE),
|
||||
_seasonNum(SEASON_SUMMER), _petActive(false), _field1C(false), _quitGame(false),
|
||||
_field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) {
|
||||
_gameManager(gameManager), _gameLocation(this), _passengerClass(NO_CLASS),
|
||||
_priorClass(NO_CLASS), _mode(GSMODE_NONE), _seasonNum(SEASON_SUMMER),
|
||||
_petActive(false), _field1C(false), _quitGame(false), _field24(0),
|
||||
_nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) {
|
||||
}
|
||||
|
||||
void CGameState::save(SimpleFile *file) const {
|
||||
@ -64,8 +64,8 @@ void CGameState::save(SimpleFile *file) const {
|
||||
|
||||
void CGameState::load(SimpleFile *file) {
|
||||
_petActive = file->readNumber() != 0;
|
||||
_passengerClass = file->readNumber();
|
||||
_priorClass = file->readNumber();
|
||||
_passengerClass = (PassengerClass)file->readNumber();
|
||||
_priorClass = (PassengerClass)file->readNumber();
|
||||
_seasonNum = (Season)file->readNumber();
|
||||
_field24 = file->readNumber();
|
||||
_field38 = file->readNumber();
|
||||
|
@ -64,8 +64,8 @@ public:
|
||||
CGameManager *_gameManager;
|
||||
CGameLocation _gameLocation;
|
||||
CGameStateMovieList _movieList;
|
||||
int _passengerClass;
|
||||
int _priorClass;
|
||||
PassengerClass _passengerClass;
|
||||
PassengerClass _priorClass;
|
||||
GameStateMode _mode;
|
||||
Season _seasonNum;
|
||||
bool _petActive;
|
||||
|
@ -51,7 +51,7 @@ bool CRestrictedMove::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
|
||||
if (classNum <= _classNum) {
|
||||
// Okay to change to the given destination
|
||||
changeView(_destination);
|
||||
} else if (classNum != 4) {
|
||||
} else if (classNum != UNCHECKED) {
|
||||
petDisplayMessage(1, CLASS_NOT_ALLOWED_AT_DEST);
|
||||
} else if (compareRoomNameTo("EmbLobby")) {
|
||||
playSound("a#17.wav");
|
||||
@ -68,7 +68,7 @@ bool CRestrictedMove::EnterViewMsg(CEnterViewMsg *msg) {
|
||||
int classNum = getPassengerClass();
|
||||
bool flag = classNum > _classNum;
|
||||
|
||||
if (classNum == 4) {
|
||||
if (classNum == UNCHECKED) {
|
||||
if (compareRoomNameTo("EmbLobby"))
|
||||
flag = false;
|
||||
else if (compareViewNameTo("Titania.Node 1.S"))
|
||||
|
@ -52,7 +52,8 @@ END_MESSAGE_MAP()
|
||||
int CDeskbot::_v1;
|
||||
int CDeskbot::_v2;
|
||||
|
||||
CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _classNum(0) {
|
||||
CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false),
|
||||
_classNum(NO_CLASS) {
|
||||
}
|
||||
|
||||
void CDeskbot::save(SimpleFile *file, int indent) {
|
||||
@ -70,7 +71,7 @@ void CDeskbot::load(SimpleFile *file) {
|
||||
_v1 = file->readNumber();
|
||||
_v2 = file->readNumber();
|
||||
_deskbotActive = file->readNumber();
|
||||
_classNum = file->readNumber();
|
||||
_classNum = (PassengerClass)file->readNumber();
|
||||
|
||||
CTrueTalkNPC::load(file);
|
||||
}
|
||||
@ -116,7 +117,7 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) {
|
||||
dec54();
|
||||
unlockMouse();
|
||||
playSound("z#47.wav");
|
||||
_classNum = false;
|
||||
_classNum = NO_CLASS;
|
||||
}
|
||||
|
||||
_npcFlags &= ~NPCFLAG_10000;
|
||||
@ -174,21 +175,21 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
|
||||
petSetArea(PET_CONVERSATION);
|
||||
playClip("ReprogramPETInHand", MOVIE_NOTIFY_OBJECT);
|
||||
_npcFlags |= NPCFLAG_10000;
|
||||
_classNum = msg->_param1;
|
||||
_classNum = (PassengerClass)msg->_param1;
|
||||
|
||||
switch (_classNum) {
|
||||
case 1:
|
||||
case FIRST_CLASS:
|
||||
petDisplayMessage(UPGRADED_TO_FIRST_CLASS);
|
||||
setPassengerClass(_classNum);
|
||||
petReassignRoom(_classNum);
|
||||
break;
|
||||
case 2:
|
||||
case SECOND_CLASS:
|
||||
petDisplayMessage(UPGRADED_TO_SECOND_CLASS);
|
||||
setPassengerClass(_classNum);
|
||||
petReassignRoom(_classNum);
|
||||
break;
|
||||
case 3:
|
||||
setPassengerClass(3);
|
||||
case THIRD_CLASS:
|
||||
setPassengerClass(THIRD_CLASS);
|
||||
petReassignRoom(_classNum);
|
||||
break;
|
||||
default:
|
||||
@ -199,31 +200,31 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
|
||||
if (getPassengerClass() == 1) {
|
||||
CPetControl *petControl = getPetControl();
|
||||
if (petControl)
|
||||
petControl->changeLocationClass(4);
|
||||
petControl->changeLocationClass(UNCHECKED);
|
||||
}
|
||||
break;
|
||||
|
||||
case 21:
|
||||
if (getPassengerClass() == 1) {
|
||||
if (getPassengerClass() == FIRST_CLASS) {
|
||||
CPetControl *petControl = getPetControl();
|
||||
if (petControl)
|
||||
petControl->changeLocationClass(3);
|
||||
petControl->changeLocationClass(THIRD_CLASS);
|
||||
}
|
||||
break;
|
||||
|
||||
case 22:
|
||||
if (getPassengerClass() == 1) {
|
||||
if (getPassengerClass() == FIRST_CLASS) {
|
||||
CPetControl *petControl = getPetControl();
|
||||
if (petControl)
|
||||
petControl->changeLocationClass(2);
|
||||
petControl->changeLocationClass(SECOND_CLASS);
|
||||
}
|
||||
break;
|
||||
|
||||
case 23:
|
||||
if (getPassengerClass() == 1) {
|
||||
if (getPassengerClass() == FIRST_CLASS) {
|
||||
CPetControl *petControl = getPetControl();
|
||||
if (petControl)
|
||||
petControl->changeLocationClass(1);
|
||||
petControl->changeLocationClass(FIRST_CLASS);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
static int _v2;
|
||||
public:
|
||||
bool _deskbotActive;
|
||||
int _classNum;
|
||||
PassengerClass _classNum;
|
||||
public:
|
||||
CLASSDEF;
|
||||
CDeskbot();
|
||||
|
@ -180,7 +180,7 @@ bool CTitania::ActMsg(CActMsg *msg) {
|
||||
CActMsg actMsg("Woken");
|
||||
actMsg.execute("MouthSlot");
|
||||
actMsg.execute("VisionCentreSlot");
|
||||
setPassengerClass(4);
|
||||
setPassengerClass(UNCHECKED);
|
||||
|
||||
addTimer(1000);
|
||||
} else {
|
||||
|
@ -696,7 +696,7 @@ void CPetControl::resetDials0() {
|
||||
|
||||
int CPetControl::getMailDest(const CRoomFlags &roomFlags) const {
|
||||
if (!roomFlags.isSuccUBusRoomFlags())
|
||||
return roomFlags.getPassengerClassNum();
|
||||
return (int)roomFlags.getPassengerClassNum();
|
||||
|
||||
return roomFlags.getSuccUBusNum(roomFlags.getSuccUBusRoomName());
|
||||
}
|
||||
|
@ -422,14 +422,14 @@ public:
|
||||
/**
|
||||
* Gives the player a new assigned room in the specified passenger class
|
||||
*/
|
||||
void reassignRoom(int passClassNum) {
|
||||
void reassignRoom(PassengerClass passClassNum) {
|
||||
_rooms.reassignRoom(passClassNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the current location passenger class
|
||||
*/
|
||||
bool changeLocationClass(int newClassNum) {
|
||||
bool changeLocationClass(PassengerClass newClassNum) {
|
||||
return _rooms.changeLocationClass(newClassNum);
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ int CPetConversations::canSummonBot(const CString &name) {
|
||||
|
||||
void CPetConversations::summonBot(const CString &name) {
|
||||
if (_petControl) {
|
||||
if (_petControl->getPassengerClass() >= 4) {
|
||||
if (_petControl->getPassengerClass() >= UNCHECKED) {
|
||||
_petControl->displayMessage(AT_LEAST_3RD_CLASS_FOR_HELP);
|
||||
} else {
|
||||
_petControl->summonBot(name, 0);
|
||||
|
@ -277,7 +277,7 @@ uint CPetRooms::getRoomFlags() const {
|
||||
return roomFlags.get();
|
||||
}
|
||||
|
||||
void CPetRooms::reassignRoom(int passClassNum) {
|
||||
void CPetRooms::reassignRoom(PassengerClass passClassNum) {
|
||||
CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom();
|
||||
if (glyph)
|
||||
// Flag the old assigned room as no longer assigned
|
||||
@ -330,7 +330,7 @@ CPetRoomsGlyph *CPetRooms::addGlyph(uint roomFlags, bool highlight_) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CPetRooms::changeLocationClass(int newClassNum) {
|
||||
bool CPetRooms::changeLocationClass(PassengerClass newClassNum) {
|
||||
CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom();
|
||||
if (!glyph)
|
||||
return 0;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "titanic/pet_control/pet_section.h"
|
||||
#include "titanic/pet_control/pet_text.h"
|
||||
#include "titanic/pet_control/pet_rooms_glyphs.h"
|
||||
#include "titanic/game_location.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -155,12 +156,12 @@ public:
|
||||
/**
|
||||
* Gives the player a new assigned room in the specified passenger class
|
||||
*/
|
||||
void reassignRoom(int passClassNum);
|
||||
void reassignRoom(PassengerClass passClassNum);
|
||||
|
||||
/**
|
||||
* Change the current location passenger class
|
||||
*/
|
||||
bool changeLocationClass(int newClassNum);
|
||||
bool changeLocationClass(PassengerClass newClassNum);
|
||||
|
||||
/**
|
||||
* Returns true if a room glyph exists with the given flags
|
||||
|
@ -112,7 +112,7 @@ int CRoomFlags::getRoomArea() const {
|
||||
uint v6 = getElevatorNum();
|
||||
|
||||
if (v6 >= 1 && v6 <= 4) {
|
||||
uint v7 = getPassengerClassNum() - 1;
|
||||
uint v7 = (int)getPassengerClassNum() - 1;
|
||||
if (v7) {
|
||||
uint v8 = v7 - 1;
|
||||
if (v8) {
|
||||
@ -241,14 +241,14 @@ uint CRoomFlags::getPassengerClassBits() const {
|
||||
}
|
||||
|
||||
CString CRoomFlags::getPassengerClassDesc() const {
|
||||
int classNum = getPassengerClassNum();
|
||||
PassengerClass classNum = getPassengerClassNum();
|
||||
|
||||
switch (classNum) {
|
||||
case 1:
|
||||
case FIRST_CLASS:
|
||||
return "1st class";
|
||||
case 2:
|
||||
case SECOND_CLASS:
|
||||
return "2nd class";
|
||||
case 3:
|
||||
case THIRD_CLASS:
|
||||
return "SGT class";
|
||||
default:
|
||||
return "no class";
|
||||
@ -373,25 +373,25 @@ void CRoomFlags::changeLocation(int action) {
|
||||
uint floorNum = getFloorNum();
|
||||
uint roomNum = getRoomNum();
|
||||
uint elevatorNum = getElevatorNum();
|
||||
uint classNum = getPassengerClassNum();
|
||||
PassengerClass classNum = getPassengerClassNum();
|
||||
uint v10, v11, v12, v13;
|
||||
|
||||
switch (classNum) {
|
||||
case 1:
|
||||
case FIRST_CLASS:
|
||||
v10 = 2;
|
||||
v11 = 19;
|
||||
v12 = 1;
|
||||
v13 = 3;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case SECOND_CLASS:
|
||||
v10 = 20;
|
||||
v11 = 27;
|
||||
v12 = 1;
|
||||
v13 = (elevatorNum & 1) ? 3 : 4;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case THIRD_CLASS:
|
||||
v10 = 28;
|
||||
v11 = 38;
|
||||
v12 = 1;
|
||||
@ -442,16 +442,16 @@ bool CRoomFlags::compareClassElevator(uint flags1, uint flags2) {
|
||||
|
||||
uint elev1 = f1.getElevatorNum();
|
||||
uint elev2 = f2.getElevatorNum();
|
||||
uint class1 = f1.getPassengerClassNum();
|
||||
uint class2 = f2.getPassengerClassNum();
|
||||
PassengerClass class1 = f1.getPassengerClassNum();
|
||||
PassengerClass class2 = f2.getPassengerClassNum();
|
||||
|
||||
if (class1 > 0 && class1 < 3) {
|
||||
if (class1 == FIRST_CLASS || class1 == SECOND_CLASS) {
|
||||
if (elev1 == 2)
|
||||
elev1 = 1;
|
||||
else if (elev1 == 4)
|
||||
elev1 = 3;
|
||||
}
|
||||
if (class2 > 0 && class2 < 3) {
|
||||
if (class2 == FIRST_CLASS || class2 == SECOND_CLASS) {
|
||||
if (elev2 == 2)
|
||||
elev2 = 1;
|
||||
else if (elev2 == 4)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define TITANIC_ROOM_FLAGS_H
|
||||
|
||||
#include "titanic/support/string.h"
|
||||
#include "titanic/game_location.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -142,7 +143,9 @@ public:
|
||||
/**
|
||||
* Gets the passenger class number
|
||||
*/
|
||||
uint getPassengerClassNum() const { return getPassengerClassBits(); }
|
||||
PassengerClass getPassengerClassNum() const {
|
||||
return (PassengerClass)getPassengerClassBits();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a description for the passenger class
|
||||
|
Loading…
x
Reference in New Issue
Block a user