commit
a68a4338a0
@ -1,63 +0,0 @@
|
||||
#ifndef INTERPRETER_SCRIPTOPCODES_H_INCLUDED
|
||||
#define INTERPRETER_SCRIPTOPCODES_H_INCLUDED
|
||||
|
||||
#include "opcodes.hpp"
|
||||
#include "runtime.hpp"
|
||||
#include "context.hpp"
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class OpScriptRunning : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime[0].mInteger = runtime.getContext().isScriptRunning (name);
|
||||
}
|
||||
};
|
||||
|
||||
class OpStartScript : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
runtime.getContext().startScript (name);
|
||||
}
|
||||
};
|
||||
|
||||
class OpStartScriptExplicit : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
std::string targetId = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
runtime.getContext().startScript (name, targetId);
|
||||
}
|
||||
};
|
||||
|
||||
class OpStopScript : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
runtime.getContext().stopScript (name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,43 +0,0 @@
|
||||
#ifndef INTERPRETER_SPATIALOPCODES_H_INCLUDED
|
||||
#define INTERPRETER_SPATIALOPCODES_H_INCLUDED
|
||||
|
||||
#include "opcodes.hpp"
|
||||
#include "runtime.hpp"
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class OpGetDistance : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
|
||||
Type_Float distance = runtime.getContext().getDistance (name);
|
||||
|
||||
runtime[0].mFloat = distance;
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetDistanceExplicit : public Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Runtime& runtime)
|
||||
{
|
||||
int index = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
std::string id = runtime.getStringLiteral (index);
|
||||
|
||||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
|
||||
Type_Float distance = runtime.getContext().getDistance (name, id);
|
||||
|
||||
runtime[0].mFloat = distance;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue