Skip to content

Commit

Permalink
Merge pull request #13 from pinguin999/dev
Browse files Browse the repository at this point in the history
Dialog Fixes
  • Loading branch information
pinguin999 authored Oct 21, 2024
2 parents 2d3d5be + 2c6904d commit a1d717d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dialog/dialog_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ void DialogManager::loadDialogsFromFile(std::string fileName, bool initializeVar
}
}

void DialogManager::play(const std::string &characterName, jngl::Vec2, const sol::function &callback)
void DialogManager::play(const std::string &dialogName, jngl::Vec2, const sol::function &callback)
{
cancelDialog();

currentDialog = schnackFile->dialogs[characterName];
currentDialog = schnackFile->dialogs[dialogName];
if (currentDialog)
{
currentNode = currentDialog->getEntryNode();
continueCurrent();
dialog_callback = callback;
}else
{
jngl::debugLn("Dialog " + characterName + " not found.");
jngl::debugLn("Dialog " + dialogName + " not found.");
}
}

Expand Down Expand Up @@ -227,13 +227,14 @@ void DialogManager::playCharacterVoice(const std::string &file)
try
{
jngl::play(file);
last_played_audio = file;
}
catch(std::exception&)
{
jngl::debugLn("Audiofile does not exist: " + file);
last_played_audio = "";
}

last_played_audio = file;
}

void DialogManager::playCharacterAnimation(const std::string &character, const std::string &id)
Expand Down Expand Up @@ -268,6 +269,7 @@ void DialogManager::continueCurrent()
return;
}
currentNode = result->currentNode;
currentDialog = result->currentDialog;

auto textResult = std::dynamic_pointer_cast<schnacker::TextStepResult>(result);
if(textResult)
Expand Down

0 comments on commit a1d717d

Please sign in to comment.