implemented "goodbye" script function that force-cancels dialogue

actorid
scrawl 13 years ago
parent 37095b62c6
commit c4aae96d94

@ -883,4 +883,11 @@ namespace MWDialogue
}
return factionID;
}
void DialogueManager::goodbye()
{
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->goodbye();
}
}

@ -56,6 +56,8 @@ namespace MWDialogue
void askQuestion(std::string question,int choice);
void goodbye();
///get the faction of the actor you are talking with
std::string getFaction();

@ -39,6 +39,7 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
, mEnabled(true)
{
// Centre dialog
center();
@ -64,6 +65,7 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
MyGUI::ButtonPtr byeButton;
getWidget(byeButton, "ByeButton");
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
byeButton->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str);
getWidget(pDispositionBar, "Disposition");
getWidget(pDispositionText,"DispositionText");
@ -81,6 +83,10 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
size_t cursorPosition = t->getCursorPosition(lastPressed);
MyGUI::UString color = history->getColorAtPos(cursorPosition);
if (!mEnabled && color == "#572D21")
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
if(color != "#B29154")
{
UString key = history->getColorTextAt(cursorPosition);
@ -119,11 +125,15 @@ void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
void DialogueWindow::onSelectTopic(std::string topic)
{
if (!mEnabled) return;
MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic));
}
void DialogueWindow::startDialogue(std::string npcName)
{
mEnabled = true;
topicsList->setEnabled(true);
static_cast<MyGUI::Window*>(mMainWidget)->setCaption(npcName);
adjustWindowCaption();
}
@ -224,3 +234,10 @@ void DialogueWindow::updateOptions()
pDispositionText->eraseText(0,pDispositionText->getTextLength());
pDispositionText->addText("#B29154"+std::string("40/100")+"#B29154");
}
void DialogueWindow::goodbye()
{
history->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str);
topicsList->setEnabled(false);
mEnabled = false;
}

@ -45,6 +45,7 @@ namespace MWGui
void addText(std::string text);
void addTitle(std::string text);
void askQuestion(std::string question);
void goodbye();
protected:
void onSelectTopic(std::string topic);
@ -60,6 +61,8 @@ namespace MWGui
*/
std::string parseText(std::string text);
bool mEnabled;
DialogueHistory* history;
Widgets::MWList* topicsList;
MyGUI::ProgressPtr pDispositionBar;

@ -115,6 +115,16 @@ namespace MWScript
}
};
class OpGoodbye : public Interpreter::Opcode0
{
public:
virtual void execute(Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getDialogueManager()->goodbye();
}
};
const int opcodeJournal = 0x2000133;
const int opcodeSetJournalIndex = 0x2000134;
const int opcodeGetJournalIndex = 0x2000135;
@ -122,6 +132,7 @@ namespace MWScript
const int opcodeChoice = 0x2000a;
const int opcodeForceGreeting = 0x200014f;
const int opcodeForceGreetingExplicit = 0x2000150;
const int opcodeGoodbye = 0x2000152;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -133,6 +144,7 @@ namespace MWScript
extensions.registerInstruction("forcegreeting","",opcodeForceGreeting);
extensions.registerInstruction("forcegreeting","",opcodeForceGreeting,
opcodeForceGreetingExplicit);
extensions.registerInstruction("goodbye", "", opcodeGoodbye);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -144,6 +156,7 @@ namespace MWScript
interpreter.installSegment3 (opcodeChoice,new OpChoice);
interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting<ImplicitRef>);
interpreter.installSegment5 (opcodeForceGreetingExplicit, new OpForceGreeting<ExplicitRef>);
interpreter.installSegment5 (opcodeGoodbye, new OpGoodbye);
}
}

@ -145,4 +145,5 @@ op 0x200014e: ModDisposition, explicit reference
op 0x200014f: ForceGreeting
op 0x2000150: ForceGreeting, explicit reference
op 0x2000151: ToggleFullHelp
opcodes 0x2000152-0x3ffffff unused
op 0x2000152: Goodbye
opcodes 0x2000153-0x3ffffff unused

Loading…
Cancel
Save