|
|
|
@ -13,30 +13,8 @@
|
|
|
|
|
|
|
|
|
|
namespace Interpreter
|
|
|
|
|
{
|
|
|
|
|
class OpMessageBox : public Opcode1
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void execute (Runtime& runtime, unsigned int arg0)
|
|
|
|
|
{
|
|
|
|
|
// message
|
|
|
|
|
int index = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
std::string message = runtime.getStringLiteral (index);
|
|
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
|
std::vector<std::string> buttons;
|
|
|
|
|
|
|
|
|
|
for (std::size_t i=0; i<arg0; ++i)
|
|
|
|
|
inline std::string formatMessage (const std::string& message, Runtime& runtime)
|
|
|
|
|
{
|
|
|
|
|
int index = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
buttons.push_back (runtime.getStringLiteral (index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::reverse (buttons.begin(), buttons.end());
|
|
|
|
|
|
|
|
|
|
// additional parameters
|
|
|
|
|
std::string formattedMessage;
|
|
|
|
|
|
|
|
|
|
for (std::size_t i=0; i<message.size(); ++i)
|
|
|
|
@ -92,10 +70,57 @@ namespace Interpreter
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formattedMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class OpMessageBox : public Opcode1
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void execute (Runtime& runtime, unsigned int arg0)
|
|
|
|
|
{
|
|
|
|
|
// message
|
|
|
|
|
int index = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
std::string message = runtime.getStringLiteral (index);
|
|
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
|
std::vector<std::string> buttons;
|
|
|
|
|
|
|
|
|
|
for (std::size_t i=0; i<arg0; ++i)
|
|
|
|
|
{
|
|
|
|
|
int index = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
buttons.push_back (runtime.getStringLiteral (index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::reverse (buttons.begin(), buttons.end());
|
|
|
|
|
|
|
|
|
|
// handle additional parameters
|
|
|
|
|
std::string formattedMessage = formatMessage (message, runtime);
|
|
|
|
|
|
|
|
|
|
runtime.getContext().messageBox (formattedMessage, buttons);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OpReport : public Opcode0
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void execute (Runtime& runtime)
|
|
|
|
|
{
|
|
|
|
|
// message
|
|
|
|
|
int index = runtime[0].mInteger;
|
|
|
|
|
runtime.pop();
|
|
|
|
|
std::string message = runtime.getStringLiteral (index);
|
|
|
|
|
|
|
|
|
|
// handle additional parameters
|
|
|
|
|
std::string formattedMessage = formatMessage (message, runtime);
|
|
|
|
|
|
|
|
|
|
runtime.getContext().report (formattedMessage);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OpMenuMode : public Opcode0
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|