TITANIC: More implementing deskbot message handlers

This commit is contained in:
Paul Gilbert 2016-05-28 21:42:18 -04:00
parent a7ecc6d601
commit 421812f27c
8 changed files with 53 additions and 13 deletions

View File

@ -319,9 +319,23 @@ int CTreeItem::getPassengerClass() const {
return gameManager ? gameManager->_gameState._passengerClass : 3;
}
int CTreeItem::getStateC() const {
int CTreeItem::getPriorClass() const {
CGameManager *gameManager = getGameManager();
return gameManager ? gameManager->_gameState._fieldC : 3;
return gameManager ? gameManager->_gameState._priorClass : 3;
}
void CTreeItem::setPassengerClass(int newClass) {
if (newClass >= 1 && newClass <= 4) {
// Change the passenger class
CGameManager *gameMan = getGameManager();
gameMan->_gameState._priorClass = gameMan->_gameState._passengerClass;
gameMan->_gameState._passengerClass = newClass;
// Setup the PET again, so the new class's PET background can take effect
CPetControl *petControl = getPetControl();
if (petControl)
petControl->setup();
}
}
} // End of namespace Titanic

View File

@ -284,7 +284,15 @@ public:
*/
int getPassengerClass() const;
int getStateC() const;
/**
* Return the player's previous passenger class
*/
int getPriorClass() const;
/**
* Set's the player's passenger class
*/
void setPassengerClass(int newClass);
};
} // End of namespace Titanic

View File

@ -45,7 +45,7 @@ bool CGameStateMovieList::clear() {
CGameState::CGameState(CGameManager *gameManager) :
_gameManager(gameManager), _gameLocation(this),
_passengerClass(0), _fieldC(0), _mode(GSMODE_UNSELECTED),
_passengerClass(0), _priorClass(0), _mode(GSMODE_UNSELECTED),
_field14(0), _petActive(false), _field1C(0), _quitGame(false),
_field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) {
}
@ -53,7 +53,7 @@ CGameState::CGameState(CGameManager *gameManager) :
void CGameState::save(SimpleFile *file) const {
file->writeNumber(_petActive);
file->writeNumber(_passengerClass);
file->writeNumber(_fieldC);
file->writeNumber(_priorClass);
file->writeNumber(_field14);
file->writeNumber(_field24);
file->writeNumber(_field38);
@ -64,7 +64,7 @@ void CGameState::save(SimpleFile *file) const {
void CGameState::load(SimpleFile *file) {
_petActive = file->readNumber() != 0;
_passengerClass = file->readNumber();
_fieldC = file->readNumber();
_priorClass = file->readNumber();
_field14 = file->readNumber();
_field24 = file->readNumber();
_field38 = file->readNumber();

View File

@ -55,7 +55,7 @@ public:
CGameLocation _gameLocation;
CGameStateMovieList _movieList;
int _passengerClass;
int _fieldC;
int _priorClass;
GameStateMode _mode;
int _field14;
bool _petActive;

View File

@ -110,7 +110,6 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) {
flag = true;
}
bool flag = false;
if (_npcFlags & NPCFLAG_40000) {
_deskbotActive = false;
_npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000);
@ -155,7 +154,26 @@ bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) {
}
bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
// TODO
switch (msg->_action) {
case 19:
inc54();
lockMouse();
setPetArea(PET_CONVERSATION);
playClip("ReprogramPETInHand", 4);
_npcFlags |= NPCFLAG_10000;
_field10C = msg->_param1;
switch (_field10C) {
case 1:
petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely.");
break;
case 2:
petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy.");
break;
}
}
return true;
}

View File

@ -45,7 +45,7 @@ private:
static int _v2;
public:
bool _deskbotActive;
bool _field10C;
int _field10C;
public:
CLASSDEF
CDeskbot();

View File

@ -54,7 +54,7 @@ void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElem
if (classNum >= 1 && classNum <= 3) {
numString = CString(classNum);
} else if (classNum == 4) {
int stateC = petControl->getStateC();
int stateC = petControl->getPriorClass();
if (stateC == 1)
numString = CString(stateC);
}

View File

@ -202,7 +202,7 @@ void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petCont
if (mode <= 3) {
numStr = CString(mode);
} else if (mode == 4) {
mode = petControl->getStateC();
mode = petControl->getPriorClass();
if (mode == 1) {
numStr = CString(mode);
}
@ -220,7 +220,7 @@ void CPetSoundSlider::setupThumb2(const CString &name, CPetControl *petControl)
if (mode <= 3) {
numStr = CString(mode);
} else if (mode == 4) {
mode = petControl->getStateC();
mode = petControl->getPriorClass();
if (mode == 1) {
numStr = CString(mode);
}