- Changed the segment manager to be a static part of the engine, and stopped deleting and recreating it when restoring games

- Merged game_exit(), script_free_vm_memory() and script_free_engine()
- Cleanup

svn-id: r45666
This commit is contained in:
Filippos Karapetis 2009-11-04 14:22:17 +00:00
parent f83d7c6339
commit c8fbac1517
14 changed files with 62 additions and 83 deletions

View file

@ -133,8 +133,10 @@ Common::Error SciEngine::run() {
_vocabulary = new Vocabulary(_resMan);
_audio = new AudioPlayer(_resMan);
SegManager *segMan = new SegManager(_resMan);
// We'll set the GUI below
_gamestate = new EngineState(_resMan, _kernel, _vocabulary, NULL, _audio);
_gamestate = new EngineState(_resMan, _kernel, _vocabulary, segMan, NULL, _audio);
if (script_init_engine(_gamestate))
return Common::kUnknownError;
@ -181,15 +183,16 @@ Common::Error SciEngine::run() {
}
_gamestate->_gui->init(_gamestate->usesOldGfxFunctions());
_gamestate->_segMan = segMan;
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()).c_str());
game_run(&_gamestate); // Run the game
game_exit(_gamestate);
script_free_engine(_gamestate); // Uninitialize game state
script_free_breakpoints(_gamestate);
delete segMan;
delete cursor;
delete palette;
delete screen;