GRIM/EMI: Move lua creation into each engine class

This commit is contained in:
Joel Teichroeb 2013-07-07 12:54:01 -07:00
parent 1593fefb45
commit 2fe6e3f2a6
4 changed files with 13 additions and 7 deletions

View File

@ -22,6 +22,7 @@
#include "engines/grim/emi/emi.h"
#include "engines/grim/emi/lua_v2.h"
namespace Grim {
@ -38,6 +39,10 @@ EMIEngine::~EMIEngine() {
g_emi = NULL;
}
LuaBase *EMIEngine::createLua() {
return new Lua_V2();
}
void EMIEngine::pushText(Common::List<TextObject *> *objects) {
_textstack.push_back(objects);
}

View File

@ -38,6 +38,7 @@ public:
Common::List<TextObject *> *popText();
private:
LuaBase *createLua();
Common::List<Common::List<TextObject *> *> _textstack;
};

View File

@ -46,7 +46,6 @@
#include "engines/grim/grim.h"
#include "engines/grim/lua.h"
#include "engines/grim/lua_v1.h"
#include "engines/grim/emi/lua_v2.h"
#include "engines/grim/emi/poolsound.h"
#include "engines/grim/actor.h"
#include "engines/grim/movie/movie.h"
@ -200,6 +199,10 @@ void GrimEngine::clearPools() {
_currSet = NULL;
}
LuaBase *GrimEngine::createLua() {
return new Lua_V1();
}
void GrimEngine::createRenderer() {
#ifdef USE_OPENGL
_softRenderer = g_registry->getBool("soft_renderer");
@ -288,12 +291,7 @@ Common::Error GrimEngine::run() {
if (_softRenderer)
g_driver->flipBuffer();
LuaBase *lua = NULL;
if (getGameType() == GType_GRIM) {
lua = new Lua_V1();
} else {
lua = new Lua_V2();
}
LuaBase *lua = createLua();
lua->registerOpcodes();
lua->registerLua();

View File

@ -46,6 +46,7 @@ class Set;
class TextObject;
class PrimitiveObject;
class Debugger;
class LuaBase;
enum GrimGameType {
GType_GRIM,
@ -198,6 +199,7 @@ private:
void buildActiveActorsList();
void savegameCallback();
void createRenderer();
virtual LuaBase *createLua();
void savegameSave();
void saveGRIM();