mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 18:27:26 +00:00
DIRECTOR: LINGO: Reload builtins on version change
This commit is contained in:
parent
0ff7274993
commit
2f0090e11d
@ -132,6 +132,15 @@ void DirectorEngine::setCurrentMovie(Movie *movie) {
|
||||
_currentWindow = movie->getWindow();
|
||||
}
|
||||
|
||||
void DirectorEngine::setVersion(uint16 version) {
|
||||
if (version == _version)
|
||||
return;
|
||||
|
||||
debug("Switching to Director v%d", version);
|
||||
_version = version;
|
||||
_lingo->reloadBuiltIns();
|
||||
}
|
||||
|
||||
Common::Error DirectorEngine::run() {
|
||||
debug("Starting v%d Director game", getVersion());
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
const char *getGameId() const;
|
||||
uint16 getDescriptionVersion() const;
|
||||
uint16 getVersion() const { return _version; }
|
||||
void setVersion(uint16 version) { _version = version; }
|
||||
void setVersion(uint16 version);
|
||||
Common::Platform getPlatform() const;
|
||||
Common::Language getLanguage() const;
|
||||
const char *getExtra();
|
||||
|
@ -297,14 +297,13 @@ void Lingo::initBuiltIns() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_functions[(void *)sym.u.s] = new FuncDesc(blt->name, "");
|
||||
}
|
||||
}
|
||||
|
||||
void Lingo::cleanupBuiltins() {
|
||||
for (FuncHash::iterator it = _functions.begin(); it != _functions.end(); ++it)
|
||||
delete it->_value;
|
||||
void Lingo::cleanupBuiltIns() {
|
||||
_builtinCmds.clear();
|
||||
_builtinFuncs.clear();
|
||||
_builtinConsts.clear();
|
||||
}
|
||||
|
||||
void Lingo::printSTUBWithArglist(const char *funcname, int nargs, const char *prefix) {
|
||||
|
@ -176,6 +176,11 @@ void Lingo::initFuncs() {
|
||||
}
|
||||
}
|
||||
|
||||
void Lingo::cleanupFuncs() {
|
||||
for (FuncHash::iterator it = _functions.begin(); it != _functions.end(); ++it)
|
||||
delete it->_value;
|
||||
}
|
||||
|
||||
void Lingo::push(Datum d) {
|
||||
_stack.push_back(d);
|
||||
}
|
||||
|
@ -92,6 +92,11 @@ void Lingo::initMethods() {
|
||||
Window::initMethods(windowMethods);
|
||||
}
|
||||
|
||||
void Lingo::cleanupMethods() {
|
||||
_methods.clear();
|
||||
Window::cleanupMethods();
|
||||
}
|
||||
|
||||
static struct XLibProto {
|
||||
const char *name;
|
||||
void (*initializer)(int);
|
||||
@ -124,6 +129,10 @@ void Lingo::initXLibs() {
|
||||
}
|
||||
}
|
||||
|
||||
void Lingo::cleanupXLibs() {
|
||||
_xlibInitializers.clear();
|
||||
}
|
||||
|
||||
void Lingo::openXLib(Common::String name, ObjectType type) {
|
||||
|
||||
Common::Platform platform = _vm->getPlatform();
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanupMethods() {
|
||||
_methods->clear();
|
||||
}
|
||||
|
||||
virtual ~Object() {
|
||||
delete _refCount;
|
||||
};
|
||||
|
@ -312,6 +312,11 @@ void Lingo::initTheEntities() {
|
||||
}
|
||||
}
|
||||
|
||||
void Lingo::cleanUpTheEntities() {
|
||||
_entityNames.clear();
|
||||
_fieldNames.clear();
|
||||
}
|
||||
|
||||
const char *Lingo::entity2str(int id) {
|
||||
static char buf[20];
|
||||
|
||||
|
@ -194,7 +194,19 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
|
||||
|
||||
Lingo::~Lingo() {
|
||||
resetLingo();
|
||||
cleanupBuiltins();
|
||||
cleanupFuncs();
|
||||
}
|
||||
|
||||
void Lingo::reloadBuiltIns() {
|
||||
debug("Reloading builtins");
|
||||
cleanupBuiltIns();
|
||||
cleanUpTheEntities();
|
||||
cleanupMethods();
|
||||
cleanupXLibs();
|
||||
initBuiltIns();
|
||||
initTheEntities();
|
||||
initMethods();
|
||||
initXLibs();
|
||||
}
|
||||
|
||||
LingoArchive::~LingoArchive() {
|
||||
|
@ -244,12 +244,16 @@ public:
|
||||
void printCallStack(uint pc);
|
||||
Common::String decodeInstruction(LingoArchive *archive, ScriptData *sd, uint pc, uint *newPC = NULL);
|
||||
|
||||
void reloadBuiltIns();
|
||||
void initBuiltIns();
|
||||
void cleanupBuiltins();
|
||||
void cleanupBuiltIns();
|
||||
void initFuncs();
|
||||
void cleanupFuncs();
|
||||
void initBytecode();
|
||||
void initMethods();
|
||||
void cleanupMethods();
|
||||
void initXLibs();
|
||||
void cleanupXLibs();
|
||||
void openXLib(Common::String name, ObjectType type);
|
||||
|
||||
void runTests();
|
||||
@ -334,6 +338,7 @@ public:
|
||||
// lingo-the.cpp
|
||||
public:
|
||||
void initTheEntities();
|
||||
void cleanUpTheEntities();
|
||||
const char *entity2str(int id);
|
||||
const char *field2str(int id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user