diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 28 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.h | 15 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 4 |
3 files changed, 41 insertions, 6 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index a62de341a0..c8d17e830d 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -216,7 +216,7 @@ void CPetConversations::load(SimpleFile *file, int param) { _textInput.load(file, param); _log.load(file, param); - for (int idx = 0; idx < 3; ++idx) + for (int idx = 0; idx < TOTAL_DIALS; ++idx) _npcLevels[idx] = file->readNumber(); } @@ -228,7 +228,7 @@ void CPetConversations::save(SimpleFile *file, int indent) const { _textInput.save(file, indent); _log.save(file, indent); - for (int idx = 0; idx < 3; ++idx) + for (int idx = 0; idx < TOTAL_DIALS; ++idx) file->writeNumberLine(_npcLevels[idx], indent); } @@ -252,7 +252,7 @@ void CPetConversations::proc25(int val) { } else { CString name = _field418 ? _npcName : getActiveNPCName(); - for (int idx = 0; idx < 3; ++idx) { + for (int idx = 0; idx < TOTAL_DIALS; ++idx) { if (!_dials[idx].hasActiveMovie()) updateDial(idx, name); } @@ -301,6 +301,17 @@ void CPetConversations::displayNPCName(CGameObject *npc) { } } +void CPetConversations::proc34(const CString &name) { + _field418 = 0; + resetDials(name); + startNPCTimer(); +} + +void CPetConversations::proc35() { + stopNPCTimer(); + resetDials("0"); +} + void CPetConversations::showCursor() { _textInput.showCursor(-2); } @@ -546,4 +557,15 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) } } +void CPetConversations::resetDials(const CString &name) { + TTNamedScript *script = getNPCScript(name); + + for (int idx = 0; idx < TOTAL_DIALS; ++idx) { + uint oldLevel = _npcLevels[idx]; + uint newLevel = getDialLevel(idx, script); + npcDialChange(idx, oldLevel, newLevel); + _npcLevels[idx] = newLevel; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 6e8ffbee41..ec3cdd64cb 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -30,12 +30,15 @@ namespace Titanic { +#define TOTAL_DIALS 3 + class CPetConversations : public CPetSection { private: CPetGfxElement _scrollUp; CPetGfxElement _scrollDown; CPetGfxElement _dialBackground; - CPetGfxElement _dials[3]; + CPetGfxElement _dials[TOTAL_DIALS]; + uint _npcLevels[TOTAL_DIALS]; CPetGfxElement _val4; CPetGfxElement _val5; CPetGfxElement _indent; @@ -47,7 +50,6 @@ private: int _npcNum; CPetText _log; CPetText _textInput; - uint _npcLevels[3]; bool _logChanged; int _field418; CString _npcName; @@ -146,6 +148,11 @@ private: * Called when the dial for an NPC is being changed */ void npcDialChange(uint dialNum, int oldLevel, int newLevel); + + /** + * Reset the dials with those for a given NPC + */ + void resetDials(const CString &name); public: CPetConversations(); virtual ~CPetConversations() {} @@ -221,6 +228,10 @@ public: */ virtual void displayNPCName(CGameObject *npc); + virtual void proc34(const CString &name); + + virtual void proc35() {} + /** * Show the text cursor */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 2a70b1dabb..296479d025 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -162,7 +162,9 @@ public: virtual void displayNPCName(CGameObject *npc) {} virtual void proc33() {} - virtual void proc34() {} + + virtual void proc34(const CString &name) {} + virtual void proc35() {} /** |