Skip to content

Commit

Permalink
ENGINES: Add support for NPC initiated conversations in KotOR 1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii committed Jun 24, 2018
1 parent 9d55354 commit a3d4d7c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/engines/kotor/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,21 @@ void Module::loadSavedGame(SavedGame *save) {
}

void Module::startConversation(const Common::UString &name, Aurora::NWScript::Object *owner) {
if (_inDialog || name.empty())
if (_inDialog)
return;

_dialog->startConversation(name, owner);
Common::UString finalName(name);

if (finalName.empty() && owner) {
Creature *creature = ObjectContainer::toCreature(owner);
if (creature)
finalName = creature->getConversation();
}

if (finalName.empty())
return;

_dialog->startConversation(finalName, owner);

if (_dialog->isConversationActive()) {
stopCameraMovement();
Expand Down
15 changes: 13 additions & 2 deletions src/engines/kotor2/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,21 @@ void Module::toggleTriggers() {
}

void Module::startConversation(const Common::UString &name, Aurora::NWScript::Object *owner) {
if (_inDialog || name.empty())
if (_inDialog)
return;

_dialog->startConversation(name, owner);
Common::UString finalName(name);

if (finalName.empty() && owner) {
Creature *creature = ObjectContainer::toCreature(owner);
if (creature)
finalName = creature->getConversation();
}

if (finalName.empty())
return;

_dialog->startConversation(finalName, owner);

if (_dialog->isConversationActive()) {
_ingame->hide();
Expand Down

0 comments on commit a3d4d7c

Please sign in to comment.