[Scummvm-cvs-logs] SF.net SVN: scummvm:[44303] scummvm/trunk/engines/groovie
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Sep 24 12:58:00 CEST 2009
Revision: 44303
http://scummvm.svn.sourceforge.net/scummvm/?rev=44303&view=rev
Author: thebluegr
Date: 2009-09-24 10:58:00 +0000 (Thu, 24 Sep 2009)
Log Message:
-----------
Changed _script to be a pointer, in order to control its creation/destruction, like the rest of the groovie engine parts, and resolve a potential issue that Microsoft claims to be severe (warning C4355, read more here: http://msdn.microsoft.com/en-us/library/3c594ae3.aspx)
Modified Paths:
--------------
scummvm/trunk/engines/groovie/debug.cpp
scummvm/trunk/engines/groovie/groovie.cpp
scummvm/trunk/engines/groovie/groovie.h
Modified: scummvm/trunk/engines/groovie/debug.cpp
===================================================================
--- scummvm/trunk/engines/groovie/debug.cpp 2009-09-24 10:30:05 UTC (rev 44302)
+++ scummvm/trunk/engines/groovie/debug.cpp 2009-09-24 10:58:00 UTC (rev 44303)
@@ -30,7 +30,7 @@
namespace Groovie {
Debugger::Debugger(GroovieEngine *vm) :
- _vm (vm), _script(&_vm->_script), _syst(_vm->_system) {
+ _vm (vm), _script(_vm->_script), _syst(_vm->_system) {
// Register the debugger comands
DCmd_Register("step", WRAP_METHOD(Debugger, cmd_step));
Modified: scummvm/trunk/engines/groovie/groovie.cpp
===================================================================
--- scummvm/trunk/engines/groovie/groovie.cpp 2009-09-24 10:30:05 UTC (rev 44302)
+++ scummvm/trunk/engines/groovie/groovie.cpp 2009-09-24 10:58:00 UTC (rev 44303)
@@ -35,7 +35,7 @@
namespace Groovie {
GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
- Engine(syst), _gameDescription(gd), _debugger(NULL), _script(this, gd->version),
+ Engine(syst), _gameDescription(gd), _debugger(NULL), _script(NULL),
_resMan(NULL), _grvCursorMan(NULL), _videoPlayer(NULL), _musicPlayer(NULL),
_graphicsMan(NULL), _waitingForInput(false) {
@@ -66,9 +66,12 @@
delete _videoPlayer;
delete _musicPlayer;
delete _graphicsMan;
+ delete _script;
}
Common::Error GroovieEngine::run() {
+ _script = new Script(this, _gameDescription->version);
+
// Initialize the graphics
switch (_gameDescription->version) {
case kGroovieV2:
@@ -87,7 +90,7 @@
// Create debugger. It requires GFX to be initialized
_debugger = new Debugger(this);
- _script.setDebugger(_debugger);
+ _script->setDebugger(_debugger);
// Create the graphics manager
_graphicsMan = new GraphicsMan(this);
@@ -161,7 +164,7 @@
}
// Load the script
- if (!_script.loadScript(filename)) {
+ if (!_script->loadScript(filename)) {
error("Couldn't load the script file %s", filename.c_str());
return Common::kUnknownError;
}
@@ -170,7 +173,7 @@
if (ConfMan.hasKey("save_slot")) {
// Get the requested slot
int slot = ConfMan.getInt("save_slot");
- _script.directGameLoad(slot);
+ _script->directGameLoad(slot);
}
// Check that the game files and the audio tracks aren't together run from
@@ -201,7 +204,7 @@
_debugger->attach();
// Send the event to the scripts
- _script.setKbdChar(ev.kbd.ascii);
+ _script->setKbdChar(ev.kbd.ascii);
// Continue the script execution to handle the key
_waitingForInput = false;
@@ -217,7 +220,7 @@
case Common::EVENT_LBUTTONDOWN:
// Send the event to the scripts
- _script.setMouseClick(1);
+ _script->setMouseClick(1);
// Continue the script execution to handle
// the click
@@ -226,7 +229,7 @@
case Common::EVENT_RBUTTONDOWN:
// Send the event to the scripts (to skip the video)
- _script.setMouseClick(2);
+ _script->setMouseClick(2);
break;
case Common::EVENT_QUIT:
@@ -252,7 +255,7 @@
// Wait a little bit between increments. While mouse is moving, this triggers
// only negligably slower.
if (tmr > 4) {
- _script.timerTick();
+ _script->timerTick();
tmr = 0;
}
@@ -263,7 +266,7 @@
_system->delayMillis(30);
} else {
// Everything's fine, execute another script step
- _script.step();
+ _script->step();
}
// Update the screen if required
@@ -300,7 +303,7 @@
}
Common::Error GroovieEngine::loadGameState(int slot) {
- _script.directGameLoad(slot);
+ _script->directGameLoad(slot);
// TODO: Use specific error codes
return Common::kNoError;
Modified: scummvm/trunk/engines/groovie/groovie.h
===================================================================
--- scummvm/trunk/engines/groovie/groovie.h 2009-09-24 10:30:05 UTC (rev 44302)
+++ scummvm/trunk/engines/groovie/groovie.h 2009-09-24 10:58:00 UTC (rev 44303)
@@ -87,7 +87,7 @@
Graphics::PixelFormat _pixelFormat;
bool _mode8bit;
- Script _script;
+ Script *_script;
ResMan *_resMan;
GrvCursorMan *_grvCursorMan;
VideoPlayer *_videoPlayer;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list