mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-08 02:42:34 +00:00
TITANIC: Fleshing out of CTrueTalkManager class
This commit is contained in:
parent
9f6a3d36f7
commit
07c1b2b23d
@ -121,6 +121,7 @@ public:
|
|||||||
Common::RandomSource _randomSource;
|
Common::RandomSource _randomSource;
|
||||||
CScriptHandler *_scriptHandler;
|
CScriptHandler *_scriptHandler;
|
||||||
TTscriptBase *_script;
|
TTscriptBase *_script;
|
||||||
|
CTrueTalkManager *_trueTalkManager;
|
||||||
CExeResources _exeResources;
|
CExeResources _exeResources;
|
||||||
CMovieList _activeMovies;
|
CMovieList _activeMovies;
|
||||||
StringArray _itemNames;
|
StringArray _itemNames;
|
||||||
|
@ -32,7 +32,7 @@ namespace Titanic {
|
|||||||
|
|
||||||
int CTrueTalkManager::_v1;
|
int CTrueTalkManager::_v1;
|
||||||
int CTrueTalkManager::_v2;
|
int CTrueTalkManager::_v2;
|
||||||
int CTrueTalkManager::_v3;
|
int CTrueTalkManager::_passengerClass;
|
||||||
bool CTrueTalkManager::_v4;
|
bool CTrueTalkManager::_v4;
|
||||||
bool CTrueTalkManager::_v5;
|
bool CTrueTalkManager::_v5;
|
||||||
int CTrueTalkManager::_v6;
|
int CTrueTalkManager::_v6;
|
||||||
@ -50,10 +50,12 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) :
|
|||||||
_dialogueFile(nullptr), _dialogueId(0) {
|
_dialogueFile(nullptr), _dialogueId(0) {
|
||||||
_titleEngine.setup(3, 3);
|
_titleEngine.setup(3, 3);
|
||||||
_currentNPC = nullptr;
|
_currentNPC = nullptr;
|
||||||
|
g_vm->_trueTalkManager = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTrueTalkManager::~CTrueTalkManager() {
|
CTrueTalkManager::~CTrueTalkManager() {
|
||||||
clear();
|
clear();
|
||||||
|
g_vm->_trueTalkManager = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrueTalkManager::save(SimpleFile *file) const {
|
void CTrueTalkManager::save(SimpleFile *file) const {
|
||||||
@ -100,7 +102,7 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) {
|
|||||||
int count = file->readNumber();
|
int count = file->readNumber();
|
||||||
_v1 = file->readNumber();
|
_v1 = file->readNumber();
|
||||||
_v2 = file->readNumber();
|
_v2 = file->readNumber();
|
||||||
_v3 = file->readNumber();
|
_passengerClass = file->readNumber();
|
||||||
_v4 = file->readNumber() != 0;
|
_v4 = file->readNumber() != 0;
|
||||||
_v5 = file->readNumber() != 0;
|
_v5 = file->readNumber() != 0;
|
||||||
_v6 = file->readNumber();
|
_v6 = file->readNumber();
|
||||||
@ -124,7 +126,7 @@ void CTrueTalkManager::saveStatics(SimpleFile *file) {
|
|||||||
file->writeNumber(10);
|
file->writeNumber(10);
|
||||||
file->writeNumber(_v1);
|
file->writeNumber(_v1);
|
||||||
file->writeNumber(_v2);
|
file->writeNumber(_v2);
|
||||||
file->writeNumber(_v3);
|
file->writeNumber(_passengerClass);
|
||||||
file->writeNumber(_v4 ? 1 : 0);
|
file->writeNumber(_v4 ? 1 : 0);
|
||||||
file->writeNumber(_v5 ? 1 : 0);
|
file->writeNumber(_v5 ? 1 : 0);
|
||||||
file->writeNumber(_v6);
|
file->writeNumber(_v6);
|
||||||
@ -148,7 +150,7 @@ void CTrueTalkManager::setFlags(int index, int val) {
|
|||||||
switch (index) {
|
switch (index) {
|
||||||
case 1:
|
case 1:
|
||||||
if (val >= 1 && val <= 3)
|
if (val >= 1 && val <= 3)
|
||||||
_v3 = val;
|
_passengerClass = val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
@ -233,6 +235,14 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) {
|
|||||||
setDialogue(npc, roomScript, view);
|
setDialogue(npc, roomScript, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTrueTalkManager::start3(CTrueTalkNPC *npc, CViewItem *view) {
|
||||||
|
start(npc, 3, view);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTrueTalkManager::start4(CTrueTalkNPC *npc, CViewItem *view) {
|
||||||
|
start(npc, 4, view);
|
||||||
|
}
|
||||||
|
|
||||||
TTnpcScript *CTrueTalkManager::getTalker(const CString &name) const {
|
TTnpcScript *CTrueTalkManager::getTalker(const CString &name) const {
|
||||||
if (name.contains("Doorbot"))
|
if (name.contains("Doorbot"))
|
||||||
return _scripts.getNpcScript(104);
|
return _scripts.getNpcScript(104);
|
||||||
@ -285,6 +295,18 @@ TTroomScript *CTrueTalkManager::getRoomScript() const {
|
|||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TTroomScript *CTrueTalkManager::getRoomScript(int roomId) const {
|
||||||
|
TTroomScript *script = nullptr;
|
||||||
|
if (roomId)
|
||||||
|
script = _scripts.getRoomScript(roomId);
|
||||||
|
|
||||||
|
if (!script)
|
||||||
|
// Fall back on the default Room script
|
||||||
|
script = _scripts.getRoomScript(110);
|
||||||
|
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) {
|
void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) {
|
||||||
// If assets for the character are already loaded, simply exit
|
// If assets for the character are already loaded, simply exit
|
||||||
if (_currentCharId == charId)
|
if (_currentCharId == charId)
|
||||||
@ -526,7 +548,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTrueTalkManager::getStateVal(int stateNum) {
|
int CTrueTalkManager::getStateValue(int stateNum) {
|
||||||
if (!_currentNPC)
|
if (!_currentNPC)
|
||||||
return -1000;
|
return -1000;
|
||||||
|
|
||||||
@ -549,4 +571,22 @@ bool CTrueTalkManager::proximityMethod1(int val) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGameManager *CTrueTalkManager::getGameManager() const {
|
||||||
|
return _gameManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGameState *CTrueTalkManager::getGameState() const {
|
||||||
|
return _gameManager ? &_gameManager->_gameState : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTrueTalkManager::getPassengerClass() const {
|
||||||
|
CGameState *gameState = getGameState();
|
||||||
|
return gameState ? gameState->_passengerClass : 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTrueTalkManager::getState14() const {
|
||||||
|
CGameState *gameState = getGameState();
|
||||||
|
return gameState ? gameState->_field14 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Titanic
|
} // End of namespace Titanic
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
namespace Titanic {
|
namespace Titanic {
|
||||||
|
|
||||||
class CGameManager;
|
class CGameManager;
|
||||||
|
class CGameState;
|
||||||
class CTreeItem;
|
class CTreeItem;
|
||||||
class CViewItem;
|
class CViewItem;
|
||||||
class CTrueTalkManager;
|
class CTrueTalkManager;
|
||||||
@ -107,10 +108,27 @@ private:
|
|||||||
void playSpeech(TTtalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot);
|
void playSpeech(TTtalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot);
|
||||||
|
|
||||||
static bool proximityMethod1(int val);
|
static bool proximityMethod1(int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the game manager
|
||||||
|
*/
|
||||||
|
CGameManager *getGameManager() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the game state
|
||||||
|
*/
|
||||||
|
CGameState *getGameState() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the player's passenger class
|
||||||
|
*/
|
||||||
|
int getPassengerClass() const;
|
||||||
|
|
||||||
|
int getState14() const;
|
||||||
public:
|
public:
|
||||||
static int _v1;
|
static int _v1;
|
||||||
static int _v2;
|
static int _v2;
|
||||||
static int _v3;
|
static int _passengerClass;
|
||||||
static bool _v4;
|
static bool _v4;
|
||||||
static bool _v5;
|
static bool _v5;
|
||||||
static int _v6;
|
static int _v6;
|
||||||
@ -126,7 +144,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get a specified state value from the currently set NPC
|
* Get a specified state value from the currently set NPC
|
||||||
*/
|
*/
|
||||||
static int getStateVal(int stateNum);
|
static int getStateValue(int stateNum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger an NPC action
|
* Trigger an NPC action
|
||||||
@ -188,6 +206,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void start(CTrueTalkNPC *npc, uint id, CViewItem *view);
|
void start(CTrueTalkNPC *npc, uint id, CViewItem *view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a TrueTalk conversation
|
||||||
|
*/
|
||||||
|
void start3(CTrueTalkNPC *npc, CViewItem *view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a TrueTalk conversation
|
||||||
|
*/
|
||||||
|
void start4(CTrueTalkNPC *npc, CViewItem *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a TrueTalk talker/script
|
* Return a TrueTalk talker/script
|
||||||
*/
|
*/
|
||||||
@ -197,6 +225,11 @@ public:
|
|||||||
* Process player's input
|
* Process player's input
|
||||||
*/
|
*/
|
||||||
void processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view);
|
void processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the script associated with a specific room
|
||||||
|
*/
|
||||||
|
TTroomScript *getRoomScript(int roomId) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Titanic
|
} // End of namespace Titanic
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "common/textconsole.h"
|
#include "common/textconsole.h"
|
||||||
#include "titanic/true_talk/tt_npc_script.h"
|
#include "titanic/true_talk/tt_npc_script.h"
|
||||||
#include "titanic/true_talk/true_talk_manager.h"
|
#include "titanic/true_talk/true_talk_manager.h"
|
||||||
|
#include "titanic/titanic.h"
|
||||||
|
|
||||||
namespace Titanic {
|
namespace Titanic {
|
||||||
|
|
||||||
@ -229,4 +230,10 @@ void TTnpcScript::preLoad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TTnpcScript::getRoom54(int roomId) {
|
||||||
|
TTroomScript *room = g_vm->_trueTalkManager->getRoomScript(roomId);
|
||||||
|
return room ? room->_field54 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Titanic
|
} // End of namespace Titanic
|
||||||
|
@ -75,6 +75,8 @@ protected:
|
|||||||
void resetFlags();
|
void resetFlags();
|
||||||
|
|
||||||
void randomizeFlags();
|
void randomizeFlags();
|
||||||
|
|
||||||
|
static int getRoom54(int roomId);
|
||||||
public:
|
public:
|
||||||
TTnpcScript(int charId, const char *charClass, int v2,
|
TTnpcScript(int charId, const char *charClass, int v2,
|
||||||
const char *charName, int v3, int val2, int v4,
|
const char *charName, int v3, int val2, int v4,
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class TTroomScript : public TTroomScriptBase {
|
class TTroomScript : public TTroomScriptBase {
|
||||||
private:
|
public:
|
||||||
int _field54;
|
int _field54;
|
||||||
public:
|
public:
|
||||||
TTroomScript(int scriptId);
|
TTroomScript(int scriptId);
|
||||||
|
Loading…
Reference in New Issue
Block a user