[Scummvm-devel] ATTN Engine authors: Advanced engine features

Johannes Schickel lordhoto at scummvm.org
Thu Oct 28 01:08:21 CEST 2010


On 10/27/2010 11:12 PM, Max Horn wrote:
>
> Maybe you meant something like the following, though: We could enhance the default pauseEngineIntern to keep track of the time since the engine was instantiated (subtracting the paused time). And add Engine::getTotalPlaytime() and Engine::resetTotalPlaytime(int msecs = 0) methods. (The param would be used when loading a savestate). That would make it pretty simple for engines to implement that feature.

I implemented that now, I inserted the code to Engine::pauseEngine 
instead of Engine::pauseEngineIntern though, so that no subclass has to 
worry about it (or calling the default pauseEngineIntern implementation 
if that is feasible).

> Adding kSavesSupportCreationDate support to an engine is already pretty much trivial: When a new game is started in your engine, record the current time using OSystem::getTimeAndDate. But *when* this should be done is highly engine specific. We could add a "TimeDate _startOfCurrentGame;" member to Engine, and a method to init that; and then we could add two functions (not member of Engine, I'd say) which can read/write a TimeDate struct to a stream; plus a syncTimeDate method to Common::Serializer. An engine then just has to call the init method at the right moment, and would have to read/load the "_startOfCurrentGame" value when syncing a savegame.

I think the creation date is the creation date of the savegame file, so 
I wonder why we need to store a "_startOfCurrentGame" or the like for that.

// Johannes




More information about the Scummvm-devel mailing list