[Scummvm-cvs-logs] SF.net SVN: scummvm:[55045] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Sun Dec 26 16:10:34 CET 2010


Revision: 55045
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55045&view=rev
Author:   mthreepwood
Date:     2010-12-26 15:10:33 +0000 (Sun, 26 Dec 2010)

Log Message:
-----------
MOHAWK: Move myst_saveload.* to myst_state.*

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/module.mk
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst_scripts.h
    scummvm/trunk/engines/mohawk/myst_stacks/channelwood.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/mechanical.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/selenitic.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/stoneship.cpp

Added Paths:
-----------
    scummvm/trunk/engines/mohawk/myst_state.cpp
    scummvm/trunk/engines/mohawk/myst_state.h

Removed Paths:
-------------
    scummvm/trunk/engines/mohawk/myst_saveload.cpp
    scummvm/trunk/engines/mohawk/myst_saveload.h

Modified: scummvm/trunk/engines/mohawk/module.mk
===================================================================
--- scummvm/trunk/engines/mohawk/module.mk	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/module.mk	2010-12-26 15:10:33 UTC (rev 55045)
@@ -12,8 +12,8 @@
 	myst.o \
 	myst_areas.o \
 	myst_vars.o \
-	myst_saveload.o \
 	myst_scripts.o \
+	myst_state.o \
 	resource.o \
 	resource_cache.o \
 	riven.o \

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -32,7 +32,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/myst_areas.h"
 #include "mohawk/myst_scripts.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/dialogs.h"
 #include "mohawk/resource.h"
 #include "mohawk/resource_cache.h"

Deleted: scummvm/trunk/engines/mohawk/myst_saveload.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_saveload.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_saveload.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -1,328 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "mohawk/cursors.h"
-#include "mohawk/myst.h"
-#include "mohawk/myst_saveload.h"
-
-#include "common/serializer.h"
-#include "common/util.h"
-
-namespace Mohawk {
-
-MystGameState::MystGameState(MohawkEngine_Myst *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) {
-	// Most of the variables are zero at game start.
-	memset(&_globals, 0, sizeof(_globals));
-	memset(&_myst, 0, sizeof(_myst));
-	memset(&_channelwood, 0, sizeof(_channelwood));
-	memset(&_mechanical, 0, sizeof(_mechanical));
-	memset(&_selenitic, 0, sizeof(_selenitic));
-	memset(&_stoneship, 0, sizeof(_stoneship));
-	memset(&_dni, 0, sizeof(_dni));
-
-	// Unknown
-	_globals.u0 = 2;
-	// Current Age / Stack - Start in Myst
-	_globals.currentAge = 7;
-	_globals.u1 = 1;
-
-	// Library Bookcase Door - Default to Up
-	_myst.libraryBookcaseDoor = 1;
-	// Dock Imager Numeric Selection - Default to 67
-	_myst.imagerSelection = 67;
-	// Dock Imager Active - Default to Active
-	_myst.imagerActive = 1;
-	// Stellar Observatory Lights - Default to On
-	_myst.observatoryLights = 1;
-
-	// Lighthouse Trapdoor State - Default to Locked
-	_stoneship.trapdoorState = 2;
-	// Lighthouse Chest Water State - Default to Full
-	_stoneship.chestWaterState = 1;
-}
-
-MystGameState::~MystGameState() {
-}
-
-Common::StringArray MystGameState::generateSaveGameList() {
-	return _saveFileMan->listSavefiles("*.mys");
-}
-
-bool MystGameState::load(const Common::String &filename) {
-	Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename);
-	if (!loadFile)
-		return false;
-
-	debugC(kDebugSaveLoad, "Loading game from '%s'", filename.c_str());
-
-	// First, let's make sure we're using a saved game file from this version of Myst
-	// By checking length of file...
-	int32 size = loadFile->size();
-	if (size != 664 && size != 601) {
-		warning("Incompatible saved game version");
-		delete loadFile;
-		return false;
-	}
-
-	Common::Serializer s(loadFile, 0);
-	syncGameState(s, size == 664);
-	delete loadFile;
-
-	// Switch us back to the intro stack
-	_vm->changeToStack(kIntroStack);
-
-	// Set our default cursor
-	if (_globals.heldPage == 0 || _globals.heldPage > 13)
-		_vm->setMainCursor(kDefaultMystCursor);
-	else if (_globals.heldPage < 7)
-		_vm->setMainCursor(kBluePageCursor);
-	else if (_globals.heldPage < 13)
-		_vm->setMainCursor(kRedPageCursor);
-	else // if (globals.heldPage == 13)
-		_vm->setMainCursor(kWhitePageCursor);
-
-	// Set us to the linking book
-	_vm->changeToCard(5, true);
-
-	return true;
-}
-
-bool MystGameState::save(const Common::String &fname) {
-	Common::String filename(fname);
-	// Make sure we have the right extension
-	if (!filename.hasSuffix(".mys") && !filename.hasSuffix(".MYS"))
-		filename += ".mys";
-
-	Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
-	if (!saveFile)
-		return false;
-
-	debugC(kDebugSaveLoad, "Saving game to '%s'", filename.c_str());
-
-	Common::Serializer s(0, saveFile);
-	syncGameState(s, _vm->getFeatures() & GF_ME);
-	saveFile->finalize();
-	delete saveFile;
-
-	return true;
-}
-
-void MystGameState::syncGameState(Common::Serializer &s, bool isME) {
-	// Globals first
-	s.syncAsUint16LE(_globals.u0);
-	s.syncAsUint16LE(_globals.currentAge);
-	s.syncAsUint16LE(_globals.heldPage);
-	s.syncAsUint16LE(_globals.u1);
-	s.syncAsUint16LE(_globals.transitions);
-	s.syncAsUint16LE(_globals.ending);
-	s.syncAsUint16LE(_globals.redPagesInBook);
-	s.syncAsUint16LE(_globals.bluePagesInBook);
-
-	// Onto Myst
-	if (isME) {
-		s.syncAsUint32LE(_myst.cabinMarkerSwitch);
-		s.syncAsUint32LE(_myst.clockTowerMarkerSwitch);
-		s.syncAsUint32LE(_myst.dockMarkerSwitch);
-		s.syncAsUint32LE(_myst.poolMarkerSwitch);
-		s.syncAsUint32LE(_myst.gearsMarkerSwitch);
-		s.syncAsUint32LE(_myst.generatorMarkerSwitch);
-		s.syncAsUint32LE(_myst.observatoryMarkerSwitch);
-		s.syncAsUint32LE(_myst.rocketshipMarkerSwitch);
-	} else {
-		s.syncAsByte(_myst.cabinMarkerSwitch);
-		s.syncAsByte(_myst.clockTowerMarkerSwitch);
-		s.syncAsByte(_myst.dockMarkerSwitch);
-		s.syncAsByte(_myst.poolMarkerSwitch);
-		s.syncAsByte(_myst.gearsMarkerSwitch);
-		s.syncAsByte(_myst.generatorMarkerSwitch);
-		s.syncAsByte(_myst.observatoryMarkerSwitch);
-		s.syncAsByte(_myst.rocketshipMarkerSwitch);
-	}
-
-	s.syncAsUint16LE(_myst.greenBookOpenedBefore);
-	s.syncAsUint16LE(_myst.shipFloating);
-	s.syncAsUint16LE(_myst.cabinValvePosition);
-	s.syncAsUint16LE(_myst.clockTowerHourPosition);
-	s.syncAsUint16LE(_myst.clockTowerMinutePosition);
-	s.syncAsUint16LE(_myst.gearsOpen);
-	s.syncAsUint16LE(_myst.clockTowerBridgeOpen);
-	s.syncAsUint16LE(_myst.generatorBreakers);
-	s.syncAsUint16LE(_myst.generatorButtons);
-	s.syncAsUint16LE(_myst.generatorVoltage);
-	s.syncAsUint16LE(_myst.libraryBookcaseDoor);
-	s.syncAsUint16LE(_myst.imagerSelection);
-	s.syncAsUint16LE(_myst.imagerActive);
-	s.syncAsUint16LE(_myst.imagerWaterErased);
-	s.syncAsUint16LE(_myst.imagerMountainErased);
-	s.syncAsUint16LE(_myst.imagerAtrusErased);
-	s.syncAsUint16LE(_myst.imagerMarkerErased);
-	s.syncAsUint16LE(_myst.towerRotationAngle);
-	s.syncAsUint16LE(_myst.courtyardImageBoxes);
-	s.syncAsUint16LE(_myst.cabinPilotLightLit);
-	s.syncAsUint16LE(_myst.observatoryDaySetting);
-	s.syncAsUint16LE(_myst.observatoryLights);
-	s.syncAsUint16LE(_myst.observatoryMonthSetting);
-	s.syncAsUint16LE(_myst.observatoryTimeSetting);
-	s.syncAsUint16LE(_myst.observatoryYearSetting);
-	s.syncAsUint16LE(_myst.observatoryDayTarget);
-	s.syncAsUint16LE(_myst.observatoryMonthTarget);
-	s.syncAsUint16LE(_myst.observatoryTimeTarget);
-	s.syncAsUint16LE(_myst.observatoryYearTarget);
-	s.syncAsUint16LE(_myst.cabinSafeCombination);
-	s.syncAsUint16LE(_myst.treePosition);
-	s.syncAsUint32LE(_myst.treeLastMoveTime);
-
-	for (int i = 0; i < 5; i++)
-		s.syncAsUint16LE(_myst.rocketSliderPosition[i]);
-
-	s.syncAsUint16LE(_myst.u6);
-	s.syncAsUint16LE(_myst.u7);
-	s.syncAsUint16LE(_myst.u8);
-	s.syncAsUint16LE(_myst.u9);
-
-	// Channelwood
-	if (isME) {
-		s.syncAsUint32LE(_channelwood.waterPumpBridgeState);
-		s.syncAsUint32LE(_channelwood.elevatorState);
-		s.syncAsUint32LE(_channelwood.stairsLowerDoorState);
-		s.syncAsUint32LE(_channelwood.pipeState);
-	} else {
-		s.syncAsByte(_channelwood.waterPumpBridgeState);
-		s.syncAsByte(_channelwood.elevatorState);
-		s.syncAsByte(_channelwood.stairsLowerDoorState);
-		s.syncAsByte(_channelwood.pipeState);
-	}
-
-	s.syncAsUint16LE(_channelwood.waterValveStates);
-	s.syncAsUint16LE(_channelwood.holoprojectorSelection);
-	s.syncAsUint16LE(_channelwood.stairsUpperDoorState);
-
-	if (isME)
-		s.skip(4);
-	else
-		s.skip(1);
-
-	// Mechanical
-
-	s.syncAsUint16LE(_mechanical.achenarPanelState);
-	s.syncAsUint16LE(_mechanical.sirrusPanelState);
-	s.syncAsUint16LE(_mechanical.staircaseState);
-	s.syncAsUint16LE(_mechanical.elevatorRotation);
-
-	for (int i = 0; i < 4; i++)
-		s.syncAsUint16LE(_mechanical.codeShape[i]);
-
-	// Selenitic
-
-	if (isME) {
-		s.syncAsUint32LE(_selenitic.emitterEnabledWater);
-		s.syncAsUint32LE(_selenitic.emitterEnabledVolcano);
-		s.syncAsUint32LE(_selenitic.emitterEnabledClock);
-		s.syncAsUint32LE(_selenitic.emitterEnabledCrystal);
-		s.syncAsUint32LE(_selenitic.emitterEnabledWind);
-		s.syncAsUint32LE(_selenitic.soundReceiverOpened);
-		s.syncAsUint32LE(_selenitic.tunnelLightsSwitchedOn);
-	} else {
-		s.syncAsByte(_selenitic.emitterEnabledWater);
-		s.syncAsByte(_selenitic.emitterEnabledVolcano);
-		s.syncAsByte(_selenitic.emitterEnabledClock);
-		s.syncAsByte(_selenitic.emitterEnabledCrystal);
-		s.syncAsByte(_selenitic.emitterEnabledWind);
-		s.syncAsByte(_selenitic.soundReceiverOpened);
-		s.syncAsByte(_selenitic.tunnelLightsSwitchedOn);
-	}
-
-	s.syncAsUint16LE(_selenitic.soundReceiverCurrentSource);
-
-	for (byte i = 0; i < 5; i++)
-		s.syncAsUint16LE(_selenitic.soundReceiverPositions[i]);
-
-	for (byte i = 0; i < 5; i++)
-		s.syncAsUint16LE(_selenitic.soundLockSliderPositions[i]);
-
-	// Stoneship
-
-	if (isME) {
-		s.syncAsUint16LE(_stoneship.lightState);
-		s.syncAsUint16LE(_stoneship.u0);
-		s.syncAsUint16LE(_stoneship.u1);
-	} else {
-		s.syncAsByte(_stoneship.lightState);
-		s.syncAsByte(_stoneship.u0);
-		s.syncAsByte(_stoneship.u1);
-	}
-
-	s.syncAsUint16LE(_stoneship.pumpState);
-	s.syncAsUint16LE(_stoneship.trapdoorState);
-	s.syncAsUint16LE(_stoneship.chestWaterState);
-	s.syncAsUint16LE(_stoneship.chestValveState);
-	s.syncAsUint16LE(_stoneship.chestOpenState);
-	s.syncAsUint16LE(_stoneship.trapdoorKeyState);
-
-	for (int i = 0; i < 5; i++)
-		s.syncAsUint16LE(_stoneship.generatorPowerLevel[i]);
-
-	// D'ni
-	s.syncAsUint16LE(_dni.outcomeState);
-
-	// Reading unknown region...
-	// When Zero Value regions are included, these are 5 blocks of
-	// 41 uint16 values.
-
-	for (byte i = 0; i < 31; i++)
-		s.syncAsUint16LE(unknownMyst[i]);
-
-	s.skip(20);
-
-	for (byte i = 0; i < 37; i++)
-		s.syncAsUint16LE(unknownChannelwood[i]);
-
-	s.skip(8);
-
-	for (byte i = 0; i < 18; i++)
-		s.syncAsUint16LE(unknownMech[i]);
-
-	s.skip(46);
-
-	for (byte i = 0; i < 30; i++)
-		s.syncAsUint16LE(unknownSelenitic[i]);
-
-	s.skip(22);
-
-	for (byte i = 0; i < 22; i++)
-		s.syncAsUint16LE(unknownStoneship[i]);
-
-	s.skip(38);
-
-	if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601))
-		warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
-}
-
-void MystGameState::deleteSave(const Common::String &saveName) {
-	debugC(kDebugSaveLoad, "Deleting save file \'%s\'", saveName.c_str());
-	_saveFileMan->removeSavefile(saveName.c_str());
-}
-
-} // End of namespace Mohawk

Deleted: scummvm/trunk/engines/mohawk/myst_saveload.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_saveload.h	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_saveload.h	2010-12-26 15:10:33 UTC (rev 55045)
@@ -1,298 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef MYST_SAVELOAD_H
-#define MYST_SAVELOAD_H
-
-#include "common/savefile.h"
-#include "common/file.h"
-#include "common/str.h"
-
-namespace Common {
-	class Serializer;
-}
-
-namespace Mohawk {
-
-class MohawkEngine_Myst;
-
-class MystGameState {
-public:
-	MystGameState(MohawkEngine_Myst*, Common::SaveFileManager*);
-	~MystGameState();
-
-	Common::StringArray generateSaveGameList();
-	bool load(const Common::String &);
-	bool save(const Common::String &);
-	void deleteSave(const Common::String &);
-
-	/* 8 Game Global Variables :
-	   0 = Unknown - Fixed at 2
-	   1 = Current Age / Stack
-	   2 = Page Being Held
-	   3 = Unknown - Fixed at 1
-	   4 = Slide Transitions
-	   5 = Ending
-	   6 = Red Pages in Book
-	   7 = Blue Pages in Book
-	*/
-	struct Globals {
-		uint16 u0;
-		uint16 currentAge;
-		uint16 heldPage;
-		uint16 u1;
-		uint16 transitions;
-		uint16 ending;
-		uint16 redPagesInBook;
-		uint16 bluePagesInBook;
-	} _globals;
-
-	/* 50 Myst Specific Variables :
-	   0  = Marker Switch Near Cabin
-	   1  = Marker Switch Near Clock Tower
-	   2  = Marker Switch on Dock
-	   3  = Marker Switch Near Ship Pool
-	   4  = Marker Switch Near Gears
-	   5  = Marker Switch Near Generator Room
-	   6  = Marker Switch Near Stellar Observatory
-	   7  = Marker Switch Near Rocket Ship
-	   8  = Fireplace, Opened Green Book Before
-	   9  = Ship State
-	   10 = Cabin Gas Valve Position
-	   11 = Clock Tower Hour Hand Position
-	   12 = Clock Tower Minute Hand Position
-	   13 = Clock Tower Puzzle Solved / Gears Open
-	   14 = Clock Tower Gear Bridge
-	   15 = Generator Breaker State
-	   16 = Generator Button State
-	   17 = Generator Voltage State
-	   18 = Library Bookcase Door
-	   19 = Dock Imager Numeric Selection
-	   20 = Dock Imager Active
-	   21 = Unknown #1 - Fixed at 0
-	   22 = Unknown #2 - Fixed at 0
-	   23 = Unknown #3 - Fixed at 0
-	   24 = Unknown #4 - Fixed at 0
-	   25 = Tower Rotation Angle
-	   26 = Boxes For Ship Float Puzzle
-	   27 = Tree Boiler Pilot Light Lit
-	   28 = Stellar Observatory Viewer, Control Setting Day
-	   29 = Stellar Observatory Lights
-	   30 = Stellar Observatory Viewer, Control Setting Month
-	   31 = Stellar Observatory Viewer, Control Setting Time
-	   32 = Stellar Observatory Viewer, Control Setting Year
-	   33 = Stellar Observatory Viewer, Target Day
-	   34 = Stellar Observatory Viewer, Target Month
-	   35 = Stellar Observatory Viewer, Target Time
-	   36 = Stellar Observatory Viewer, Target Year
- 	   37 = Cabin Safe Combination
-	   38 = Channelwood Tree Position
-	   39 = Checksum? #1
-	   40 = Checksum? #2
-	   41 = Rocketship Music Puzzle Slider #1 Position
-	   42 = Rocketship Music Puzzle Slider #2 Position
-	   43 = Rocketship Music Puzzle Slider #3 Position
-	   44 = Rocketship Music Puzzle Slider #4 Position
-	   45 = Rocketship Music Puzzle Slider #5 Position
-	   46 = Unknown #5
-	   47 = Unknown #6
-	   48 = Unknown #7
-	   49 = Unknown #8
-	*/
-	struct Myst {
-		uint32 cabinMarkerSwitch;
-		uint32 clockTowerMarkerSwitch;
-		uint32 dockMarkerSwitch;
-		uint32 poolMarkerSwitch;
-		uint32 gearsMarkerSwitch;
-		uint32 generatorMarkerSwitch;
-		uint32 observatoryMarkerSwitch;
-		uint32 rocketshipMarkerSwitch;
-		uint16 greenBookOpenedBefore;
-		uint16 shipFloating;
-		uint16 cabinValvePosition;
-		uint16 clockTowerHourPosition;
-		uint16 clockTowerMinutePosition;
-		uint16 gearsOpen;
-		uint16 clockTowerBridgeOpen;
-		uint16 generatorBreakers;
-		uint16 generatorButtons;
-		uint16 generatorVoltage;
-		uint16 libraryBookcaseDoor;
-		uint16 imagerSelection;
-		uint16 imagerActive;
-		uint16 imagerWaterErased;
-		uint16 imagerMountainErased;
-		uint16 imagerAtrusErased;
-		uint16 imagerMarkerErased;
-		uint16 towerRotationAngle;
-		uint16 courtyardImageBoxes;
-		uint16 cabinPilotLightLit;
-		uint16 observatoryDaySetting;
-		uint16 observatoryLights;
-		uint16 observatoryMonthSetting;
-		uint16 observatoryTimeSetting;
-		uint16 observatoryYearSetting;
-		uint16 observatoryDayTarget;
-		uint16 observatoryMonthTarget;
-		uint16 observatoryTimeTarget;
-		uint16 observatoryYearTarget;
-		uint16 cabinSafeCombination;
-		uint16 treePosition;
-		uint32 treeLastMoveTime;
-		uint16 rocketSliderPosition[5];
-		uint16 u6;
-		uint16 u7;
-		uint16 u8;
-		uint16 u9;
-	} _myst;
-
-	/* 7 Channelwood Specific Variables :
-	    0 = Water Pump Bridge State
-	    1 = Lower Walkway to Upper Walkway Elevator State
-	    2 = Lower Walkway to Upper Walkway Spiral Stair Lower Door State
-	    3 = Extendable Pipe State
-	    4 = Water Valve States
-	    5 = Achenar's Holoprojector Selection
-	    6 = Lower Walkway to Upper Walkway Spiral Stair Upper Door State
-	*/
-	struct Channelwood {
-		uint32 waterPumpBridgeState;
-		uint32 elevatorState;
-		uint32 stairsLowerDoorState;
-		uint32 pipeState;
-		uint16 waterValveStates;
-		uint16 holoprojectorSelection;
-		uint16 stairsUpperDoorState;
-	} _channelwood;
-
-	/* 8 Mech Specific Variables :
-	    0 = Achenar's Room Secret Panel State
-	    1 = Sirrus' Room Secret Panel State
-	    2 = Fortress Staircase State
-	    3 = Fortress Elevator Rotation
-	    4 = Code Lock Shape #1 (Left)
-	    5 = Code Lock Shape #2
-	    6 = Code Lock Shape #3
-	    7 = Code Lock Shape #4 (Right)
-	*/
-	struct Mechanical {
-		uint16 achenarPanelState;
-		uint16 sirrusPanelState;
-		uint16 staircaseState;
-		uint16 elevatorRotation;
-		uint16 codeShape[4];
-	} _mechanical;
-
-	/* 18 Selenitic Specific Variables :
-	    0 = Sound Pickup At Water Pool
-	    1 = Sound Pickup At Volcanic Crack
-	    2 = Sound Pickup At Clock
-	    3 = Sound Pickup At Crystal Rocks
-	    4 = Sound Pickup At Windy Tunnel
-	    5 = Sound Receiver Doors
-	    6 = Windy Tunnel Lights
-	    7 = Sound Receiver Current Input
-	    8 = Sound Receiver Input #0 (Water Pool) Angle Value
-	    9 = Sound Receiver Input #1 (Volcanic Crack) Angle Value
-	   10 = Sound Receiver Input #2 (Clock) Angle Value
-	   11 = Sound Receiver Input #3 (Crystal Rocks) Angle Value
-	   12 = Sound Receiver Input #4 (Windy Tunnel) Angle Value
-	   13 = Sound Lock Slider #1 (Left) Position
-	   14 = Sound Lock Slider #2 Position
-	   15 = Sound Lock Slider #3 Position
-	   16 = Sound Lock Slider #4 Position
-	   17 = Sound Lock Slider #5 (Right) Position
-	*/
-	struct Selenitic {
-		uint32 emitterEnabledWater;
-		uint32 emitterEnabledVolcano;
-		uint32 emitterEnabledClock;
-		uint32 emitterEnabledCrystal;
-		uint32 emitterEnabledWind;
-		uint32 soundReceiverOpened;
-		uint32 tunnelLightsSwitchedOn;
-		uint16 soundReceiverCurrentSource;
-		uint16 soundReceiverPositions[5];
-		uint16 soundLockSliderPositions[5];
-	} _selenitic;
-
-	/* 14 Stoneship Specific Variables :
-	    0 = Light State
-	    1 = Unknown #1
-	    2 = Unknown #2
-	    3 = Water Pump State
-	    4 = Lighthouse Trapdoor State
-	    5 = Lighthouse Chest Water State
-	    6 = Lighthouse Chest Valve State
-	    7 = Lighthouse Chest Open State
-	    8 = Lighthouse Trapdoor Key State
-	    9 = Lighthouse Generator Power Level(?)
-	   10 = Lighthouse Generator Power...?
-	   11 = Lighthouse Generator Power Good
-	   12 = Lighthouse Generator Power #1?
-	   13 = Lighthouse Generator Power #2?
-	*/
-	struct Stoneship {
-		uint16 lightState;
-		uint16 u0;
-		uint16 u1;
-		uint16 pumpState;
-		uint16 trapdoorState;
-		uint16 chestWaterState;
-		uint16 chestValveState;
-		uint16 chestOpenState;
-		uint16 trapdoorKeyState;
-		uint16 generatorPowerLevel[5];
-	} _stoneship;
-
-	/* 1 Dunny Specific Variable :
-	    0 = Outcome State
-	*/
-	struct Dni {
-		uint16 outcomeState;
-	} _dni;
-
-	// The values in these regions seem to be lists of resource IDs
-	// which correspond to VIEW resources i.e. cards
-	uint16 unknownMyst[31];
-
-	uint16 unknownChannelwood[37];
-
-	uint16 unknownMech[18];
-
-	uint16 unknownSelenitic[30];
-
-	uint16 unknownStoneship[22];
-private:
-	void syncGameState(Common::Serializer &s, bool isME);
-
-	MohawkEngine_Myst *_vm;
-	Common::SaveFileManager *_saveFileMan;
-};
-
-} // End of namespace Mohawk
-
-#endif

Modified: scummvm/trunk/engines/mohawk/myst_scripts.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.h	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_scripts.h	2010-12-26 15:10:33 UTC (rev 55045)
@@ -30,7 +30,7 @@
 #include "common/scummsys.h"
 #include "common/util.h"
 
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 
 namespace Mohawk {
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/channelwood.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/channelwood.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/channelwood.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -26,7 +26,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/channelwood.h"

Modified: scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -26,7 +26,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/intro.h"

Modified: scummvm/trunk/engines/mohawk/myst_stacks/mechanical.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/mechanical.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/mechanical.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -26,7 +26,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/mechanical.h"

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -27,7 +27,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/myst.h"

Modified: scummvm/trunk/engines/mohawk/myst_stacks/selenitic.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/selenitic.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/selenitic.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -27,7 +27,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/selenitic.h"

Modified: scummvm/trunk/engines/mohawk/myst_stacks/stoneship.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/stoneship.cpp	2010-12-26 14:58:15 UTC (rev 55044)
+++ scummvm/trunk/engines/mohawk/myst_stacks/stoneship.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -26,7 +26,7 @@
 #include "mohawk/myst.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
-#include "mohawk/myst_saveload.h"
+#include "mohawk/myst_state.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/stoneship.h"

Copied: scummvm/trunk/engines/mohawk/myst_state.cpp (from rev 55042, scummvm/trunk/engines/mohawk/myst_saveload.cpp)
===================================================================
--- scummvm/trunk/engines/mohawk/myst_state.cpp	                        (rev 0)
+++ scummvm/trunk/engines/mohawk/myst_state.cpp	2010-12-26 15:10:33 UTC (rev 55045)
@@ -0,0 +1,328 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "mohawk/cursors.h"
+#include "mohawk/myst.h"
+#include "mohawk/myst_state.h"
+
+#include "common/serializer.h"
+#include "common/util.h"
+
+namespace Mohawk {
+
+MystGameState::MystGameState(MohawkEngine_Myst *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) {
+	// Most of the variables are zero at game start.
+	memset(&_globals, 0, sizeof(_globals));
+	memset(&_myst, 0, sizeof(_myst));
+	memset(&_channelwood, 0, sizeof(_channelwood));
+	memset(&_mechanical, 0, sizeof(_mechanical));
+	memset(&_selenitic, 0, sizeof(_selenitic));
+	memset(&_stoneship, 0, sizeof(_stoneship));
+	memset(&_dni, 0, sizeof(_dni));
+
+	// Unknown
+	_globals.u0 = 2;
+	// Current Age / Stack - Start in Myst
+	_globals.currentAge = 7;
+	_globals.u1 = 1;
+
+	// Library Bookcase Door - Default to Up
+	_myst.libraryBookcaseDoor = 1;
+	// Dock Imager Numeric Selection - Default to 67
+	_myst.imagerSelection = 67;
+	// Dock Imager Active - Default to Active
+	_myst.imagerActive = 1;
+	// Stellar Observatory Lights - Default to On
+	_myst.observatoryLights = 1;
+
+	// Lighthouse Trapdoor State - Default to Locked
+	_stoneship.trapdoorState = 2;
+	// Lighthouse Chest Water State - Default to Full
+	_stoneship.chestWaterState = 1;
+}
+
+MystGameState::~MystGameState() {
+}
+
+Common::StringArray MystGameState::generateSaveGameList() {
+	return _saveFileMan->listSavefiles("*.mys");
+}
+
+bool MystGameState::load(const Common::String &filename) {
+	Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filename);
+	if (!loadFile)
+		return false;
+
+	debugC(kDebugSaveLoad, "Loading game from '%s'", filename.c_str());
+
+	// First, let's make sure we're using a saved game file from this version of Myst
+	// By checking length of file...
+	int32 size = loadFile->size();
+	if (size != 664 && size != 601) {
+		warning("Incompatible saved game version");
+		delete loadFile;
+		return false;
+	}
+
+	Common::Serializer s(loadFile, 0);
+	syncGameState(s, size == 664);
+	delete loadFile;
+
+	// Switch us back to the intro stack
+	_vm->changeToStack(kIntroStack);
+
+	// Set our default cursor
+	if (_globals.heldPage == 0 || _globals.heldPage > 13)
+		_vm->setMainCursor(kDefaultMystCursor);
+	else if (_globals.heldPage < 7)
+		_vm->setMainCursor(kBluePageCursor);
+	else if (_globals.heldPage < 13)
+		_vm->setMainCursor(kRedPageCursor);
+	else // if (globals.heldPage == 13)
+		_vm->setMainCursor(kWhitePageCursor);
+
+	// Set us to the linking book
+	_vm->changeToCard(5, true);
+
+	return true;
+}
+
+bool MystGameState::save(const Common::String &fname) {
+	Common::String filename(fname);
+	// Make sure we have the right extension
+	if (!filename.hasSuffix(".mys") && !filename.hasSuffix(".MYS"))
+		filename += ".mys";
+
+	Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
+	if (!saveFile)
+		return false;
+
+	debugC(kDebugSaveLoad, "Saving game to '%s'", filename.c_str());
+
+	Common::Serializer s(0, saveFile);
+	syncGameState(s, _vm->getFeatures() & GF_ME);
+	saveFile->finalize();
+	delete saveFile;
+
+	return true;
+}
+
+void MystGameState::syncGameState(Common::Serializer &s, bool isME) {
+	// Globals first
+	s.syncAsUint16LE(_globals.u0);
+	s.syncAsUint16LE(_globals.currentAge);
+	s.syncAsUint16LE(_globals.heldPage);
+	s.syncAsUint16LE(_globals.u1);
+	s.syncAsUint16LE(_globals.transitions);
+	s.syncAsUint16LE(_globals.ending);
+	s.syncAsUint16LE(_globals.redPagesInBook);
+	s.syncAsUint16LE(_globals.bluePagesInBook);
+
+	// Onto Myst
+	if (isME) {
+		s.syncAsUint32LE(_myst.cabinMarkerSwitch);
+		s.syncAsUint32LE(_myst.clockTowerMarkerSwitch);
+		s.syncAsUint32LE(_myst.dockMarkerSwitch);
+		s.syncAsUint32LE(_myst.poolMarkerSwitch);
+		s.syncAsUint32LE(_myst.gearsMarkerSwitch);
+		s.syncAsUint32LE(_myst.generatorMarkerSwitch);
+		s.syncAsUint32LE(_myst.observatoryMarkerSwitch);
+		s.syncAsUint32LE(_myst.rocketshipMarkerSwitch);
+	} else {
+		s.syncAsByte(_myst.cabinMarkerSwitch);
+		s.syncAsByte(_myst.clockTowerMarkerSwitch);
+		s.syncAsByte(_myst.dockMarkerSwitch);
+		s.syncAsByte(_myst.poolMarkerSwitch);
+		s.syncAsByte(_myst.gearsMarkerSwitch);
+		s.syncAsByte(_myst.generatorMarkerSwitch);
+		s.syncAsByte(_myst.observatoryMarkerSwitch);
+		s.syncAsByte(_myst.rocketshipMarkerSwitch);
+	}
+
+	s.syncAsUint16LE(_myst.greenBookOpenedBefore);
+	s.syncAsUint16LE(_myst.shipFloating);
+	s.syncAsUint16LE(_myst.cabinValvePosition);
+	s.syncAsUint16LE(_myst.clockTowerHourPosition);
+	s.syncAsUint16LE(_myst.clockTowerMinutePosition);
+	s.syncAsUint16LE(_myst.gearsOpen);
+	s.syncAsUint16LE(_myst.clockTowerBridgeOpen);
+	s.syncAsUint16LE(_myst.generatorBreakers);
+	s.syncAsUint16LE(_myst.generatorButtons);
+	s.syncAsUint16LE(_myst.generatorVoltage);
+	s.syncAsUint16LE(_myst.libraryBookcaseDoor);
+	s.syncAsUint16LE(_myst.imagerSelection);
+	s.syncAsUint16LE(_myst.imagerActive);
+	s.syncAsUint16LE(_myst.imagerWaterErased);
+	s.syncAsUint16LE(_myst.imagerMountainErased);
+	s.syncAsUint16LE(_myst.imagerAtrusErased);
+	s.syncAsUint16LE(_myst.imagerMarkerErased);
+	s.syncAsUint16LE(_myst.towerRotationAngle);
+	s.syncAsUint16LE(_myst.courtyardImageBoxes);
+	s.syncAsUint16LE(_myst.cabinPilotLightLit);
+	s.syncAsUint16LE(_myst.observatoryDaySetting);
+	s.syncAsUint16LE(_myst.observatoryLights);
+	s.syncAsUint16LE(_myst.observatoryMonthSetting);
+	s.syncAsUint16LE(_myst.observatoryTimeSetting);
+	s.syncAsUint16LE(_myst.observatoryYearSetting);
+	s.syncAsUint16LE(_myst.observatoryDayTarget);
+	s.syncAsUint16LE(_myst.observatoryMonthTarget);
+	s.syncAsUint16LE(_myst.observatoryTimeTarget);
+	s.syncAsUint16LE(_myst.observatoryYearTarget);
+	s.syncAsUint16LE(_myst.cabinSafeCombination);
+	s.syncAsUint16LE(_myst.treePosition);
+	s.syncAsUint32LE(_myst.treeLastMoveTime);
+
+	for (int i = 0; i < 5; i++)
+		s.syncAsUint16LE(_myst.rocketSliderPosition[i]);
+
+	s.syncAsUint16LE(_myst.u6);
+	s.syncAsUint16LE(_myst.u7);
+	s.syncAsUint16LE(_myst.u8);
+	s.syncAsUint16LE(_myst.u9);
+
+	// Channelwood
+	if (isME) {
+		s.syncAsUint32LE(_channelwood.waterPumpBridgeState);
+		s.syncAsUint32LE(_channelwood.elevatorState);
+		s.syncAsUint32LE(_channelwood.stairsLowerDoorState);
+		s.syncAsUint32LE(_channelwood.pipeState);
+	} else {
+		s.syncAsByte(_channelwood.waterPumpBridgeState);
+		s.syncAsByte(_channelwood.elevatorState);
+		s.syncAsByte(_channelwood.stairsLowerDoorState);
+		s.syncAsByte(_channelwood.pipeState);
+	}
+
+	s.syncAsUint16LE(_channelwood.waterValveStates);
+	s.syncAsUint16LE(_channelwood.holoprojectorSelection);
+	s.syncAsUint16LE(_channelwood.stairsUpperDoorState);
+
+	if (isME)
+		s.skip(4);
+	else
+		s.skip(1);
+
+	// Mechanical
+
+	s.syncAsUint16LE(_mechanical.achenarPanelState);
+	s.syncAsUint16LE(_mechanical.sirrusPanelState);
+	s.syncAsUint16LE(_mechanical.staircaseState);
+	s.syncAsUint16LE(_mechanical.elevatorRotation);
+
+	for (int i = 0; i < 4; i++)
+		s.syncAsUint16LE(_mechanical.codeShape[i]);
+
+	// Selenitic
+
+	if (isME) {
+		s.syncAsUint32LE(_selenitic.emitterEnabledWater);
+		s.syncAsUint32LE(_selenitic.emitterEnabledVolcano);
+		s.syncAsUint32LE(_selenitic.emitterEnabledClock);
+		s.syncAsUint32LE(_selenitic.emitterEnabledCrystal);
+		s.syncAsUint32LE(_selenitic.emitterEnabledWind);
+		s.syncAsUint32LE(_selenitic.soundReceiverOpened);
+		s.syncAsUint32LE(_selenitic.tunnelLightsSwitchedOn);
+	} else {
+		s.syncAsByte(_selenitic.emitterEnabledWater);
+		s.syncAsByte(_selenitic.emitterEnabledVolcano);
+		s.syncAsByte(_selenitic.emitterEnabledClock);
+		s.syncAsByte(_selenitic.emitterEnabledCrystal);
+		s.syncAsByte(_selenitic.emitterEnabledWind);
+		s.syncAsByte(_selenitic.soundReceiverOpened);
+		s.syncAsByte(_selenitic.tunnelLightsSwitchedOn);
+	}
+
+	s.syncAsUint16LE(_selenitic.soundReceiverCurrentSource);
+
+	for (byte i = 0; i < 5; i++)
+		s.syncAsUint16LE(_selenitic.soundReceiverPositions[i]);
+
+	for (byte i = 0; i < 5; i++)
+		s.syncAsUint16LE(_selenitic.soundLockSliderPositions[i]);
+
+	// Stoneship
+
+	if (isME) {
+		s.syncAsUint16LE(_stoneship.lightState);
+		s.syncAsUint16LE(_stoneship.u0);
+		s.syncAsUint16LE(_stoneship.u1);
+	} else {
+		s.syncAsByte(_stoneship.lightState);
+		s.syncAsByte(_stoneship.u0);
+		s.syncAsByte(_stoneship.u1);
+	}
+
+	s.syncAsUint16LE(_stoneship.pumpState);
+	s.syncAsUint16LE(_stoneship.trapdoorState);
+	s.syncAsUint16LE(_stoneship.chestWaterState);
+	s.syncAsUint16LE(_stoneship.chestValveState);
+	s.syncAsUint16LE(_stoneship.chestOpenState);
+	s.syncAsUint16LE(_stoneship.trapdoorKeyState);
+
+	for (int i = 0; i < 5; i++)
+		s.syncAsUint16LE(_stoneship.generatorPowerLevel[i]);
+
+	// D'ni
+	s.syncAsUint16LE(_dni.outcomeState);
+
+	// Reading unknown region...
+	// When Zero Value regions are included, these are 5 blocks of
+	// 41 uint16 values.
+
+	for (byte i = 0; i < 31; i++)
+		s.syncAsUint16LE(unknownMyst[i]);
+
+	s.skip(20);
+
+	for (byte i = 0; i < 37; i++)
+		s.syncAsUint16LE(unknownChannelwood[i]);
+
+	s.skip(8);
+
+	for (byte i = 0; i < 18; i++)
+		s.syncAsUint16LE(unknownMech[i]);
+
+	s.skip(46);
+
+	for (byte i = 0; i < 30; i++)
+		s.syncAsUint16LE(unknownSelenitic[i]);
+
+	s.skip(22);
+
+	for (byte i = 0; i < 22; i++)
+		s.syncAsUint16LE(unknownStoneship[i]);
+
+	s.skip(38);
+
+	if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601))
+		warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
+}
+
+void MystGameState::deleteSave(const Common::String &saveName) {
+	debugC(kDebugSaveLoad, "Deleting save file \'%s\'", saveName.c_str());
+	_saveFileMan->removeSavefile(saveName.c_str());
+}
+
+} // End of namespace Mohawk

Copied: scummvm/trunk/engines/mohawk/myst_state.h (from rev 55044, scummvm/trunk/engines/mohawk/myst_saveload.h)
===================================================================
--- scummvm/trunk/engines/mohawk/myst_state.h	                        (rev 0)
+++ scummvm/trunk/engines/mohawk/myst_state.h	2010-12-26 15:10:33 UTC (rev 55045)
@@ -0,0 +1,298 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef MYST_SAVELOAD_H
+#define MYST_SAVELOAD_H
+
+#include "common/savefile.h"
+#include "common/file.h"
+#include "common/str.h"
+
+namespace Common {
+	class Serializer;
+}
+
+namespace Mohawk {
+
+class MohawkEngine_Myst;
+
+class MystGameState {
+public:
+	MystGameState(MohawkEngine_Myst*, Common::SaveFileManager*);
+	~MystGameState();
+
+	Common::StringArray generateSaveGameList();
+	bool load(const Common::String &);
+	bool save(const Common::String &);
+	void deleteSave(const Common::String &);
+
+	/* 8 Game Global Variables :
+	   0 = Unknown - Fixed at 2
+	   1 = Current Age / Stack
+	   2 = Page Being Held
+	   3 = Unknown - Fixed at 1
+	   4 = Slide Transitions
+	   5 = Ending
+	   6 = Red Pages in Book
+	   7 = Blue Pages in Book
+	*/
+	struct Globals {
+		uint16 u0;
+		uint16 currentAge;
+		uint16 heldPage;
+		uint16 u1;
+		uint16 transitions;
+		uint16 ending;
+		uint16 redPagesInBook;
+		uint16 bluePagesInBook;
+	} _globals;
+
+	/* 50 Myst Specific Variables :
+	   0  = Marker Switch Near Cabin
+	   1  = Marker Switch Near Clock Tower
+	   2  = Marker Switch on Dock
+	   3  = Marker Switch Near Ship Pool
+	   4  = Marker Switch Near Gears
+	   5  = Marker Switch Near Generator Room
+	   6  = Marker Switch Near Stellar Observatory
+	   7  = Marker Switch Near Rocket Ship
+	   8  = Fireplace, Opened Green Book Before
+	   9  = Ship State
+	   10 = Cabin Gas Valve Position
+	   11 = Clock Tower Hour Hand Position
+	   12 = Clock Tower Minute Hand Position
+	   13 = Clock Tower Puzzle Solved / Gears Open
+	   14 = Clock Tower Gear Bridge
+	   15 = Generator Breaker State
+	   16 = Generator Button State
+	   17 = Generator Voltage State
+	   18 = Library Bookcase Door
+	   19 = Dock Imager Numeric Selection
+	   20 = Dock Imager Active
+	   21 = Unknown #1 - Fixed at 0
+	   22 = Unknown #2 - Fixed at 0
+	   23 = Unknown #3 - Fixed at 0
+	   24 = Unknown #4 - Fixed at 0
+	   25 = Tower Rotation Angle
+	   26 = Boxes For Ship Float Puzzle
+	   27 = Tree Boiler Pilot Light Lit
+	   28 = Stellar Observatory Viewer, Control Setting Day
+	   29 = Stellar Observatory Lights
+	   30 = Stellar Observatory Viewer, Control Setting Month
+	   31 = Stellar Observatory Viewer, Control Setting Time
+	   32 = Stellar Observatory Viewer, Control Setting Year
+	   33 = Stellar Observatory Viewer, Target Day
+	   34 = Stellar Observatory Viewer, Target Month
+	   35 = Stellar Observatory Viewer, Target Time
+	   36 = Stellar Observatory Viewer, Target Year
+ 	   37 = Cabin Safe Combination
+	   38 = Channelwood Tree Position
+	   39 = Checksum? #1
+	   40 = Checksum? #2
+	   41 = Rocketship Music Puzzle Slider #1 Position
+	   42 = Rocketship Music Puzzle Slider #2 Position
+	   43 = Rocketship Music Puzzle Slider #3 Position
+	   44 = Rocketship Music Puzzle Slider #4 Position
+	   45 = Rocketship Music Puzzle Slider #5 Position
+	   46 = Unknown #5
+	   47 = Unknown #6
+	   48 = Unknown #7
+	   49 = Unknown #8
+	*/
+	struct Myst {
+		uint32 cabinMarkerSwitch;
+		uint32 clockTowerMarkerSwitch;
+		uint32 dockMarkerSwitch;
+		uint32 poolMarkerSwitch;
+		uint32 gearsMarkerSwitch;
+		uint32 generatorMarkerSwitch;
+		uint32 observatoryMarkerSwitch;
+		uint32 rocketshipMarkerSwitch;
+		uint16 greenBookOpenedBefore;
+		uint16 shipFloating;
+		uint16 cabinValvePosition;
+		uint16 clockTowerHourPosition;
+		uint16 clockTowerMinutePosition;
+		uint16 gearsOpen;
+		uint16 clockTowerBridgeOpen;
+		uint16 generatorBreakers;
+		uint16 generatorButtons;
+		uint16 generatorVoltage;
+		uint16 libraryBookcaseDoor;
+		uint16 imagerSelection;
+		uint16 imagerActive;
+		uint16 imagerWaterErased;
+		uint16 imagerMountainErased;
+		uint16 imagerAtrusErased;
+		uint16 imagerMarkerErased;
+		uint16 towerRotationAngle;
+		uint16 courtyardImageBoxes;
+		uint16 cabinPilotLightLit;
+		uint16 observatoryDaySetting;
+		uint16 observatoryLights;
+		uint16 observatoryMonthSetting;
+		uint16 observatoryTimeSetting;
+		uint16 observatoryYearSetting;
+		uint16 observatoryDayTarget;
+		uint16 observatoryMonthTarget;
+		uint16 observatoryTimeTarget;
+		uint16 observatoryYearTarget;
+		uint16 cabinSafeCombination;
+		uint16 treePosition;
+		uint32 treeLastMoveTime;
+		uint16 rocketSliderPosition[5];
+		uint16 u6;
+		uint16 u7;
+		uint16 u8;
+		uint16 u9;
+	} _myst;
+
+	/* 7 Channelwood Specific Variables :
+	    0 = Water Pump Bridge State
+	    1 = Lower Walkway to Upper Walkway Elevator State
+	    2 = Lower Walkway to Upper Walkway Spiral Stair Lower Door State
+	    3 = Extendable Pipe State
+	    4 = Water Valve States
+	    5 = Achenar's Holoprojector Selection
+	    6 = Lower Walkway to Upper Walkway Spiral Stair Upper Door State
+	*/
+	struct Channelwood {
+		uint32 waterPumpBridgeState;
+		uint32 elevatorState;
+		uint32 stairsLowerDoorState;
+		uint32 pipeState;
+		uint16 waterValveStates;
+		uint16 holoprojectorSelection;
+		uint16 stairsUpperDoorState;
+	} _channelwood;
+
+	/* 8 Mech Specific Variables :
+	    0 = Achenar's Room Secret Panel State
+	    1 = Sirrus' Room Secret Panel State
+	    2 = Fortress Staircase State
+	    3 = Fortress Elevator Rotation
+	    4 = Code Lock Shape #1 (Left)
+	    5 = Code Lock Shape #2
+	    6 = Code Lock Shape #3
+	    7 = Code Lock Shape #4 (Right)
+	*/
+	struct Mechanical {
+		uint16 achenarPanelState;
+		uint16 sirrusPanelState;
+		uint16 staircaseState;
+		uint16 elevatorRotation;
+		uint16 codeShape[4];
+	} _mechanical;
+
+	/* 18 Selenitic Specific Variables :
+	    0 = Sound Pickup At Water Pool
+	    1 = Sound Pickup At Volcanic Crack
+	    2 = Sound Pickup At Clock
+	    3 = Sound Pickup At Crystal Rocks
+	    4 = Sound Pickup At Windy Tunnel
+	    5 = Sound Receiver Doors
+	    6 = Windy Tunnel Lights
+	    7 = Sound Receiver Current Input
+	    8 = Sound Receiver Input #0 (Water Pool) Angle Value
+	    9 = Sound Receiver Input #1 (Volcanic Crack) Angle Value
+	   10 = Sound Receiver Input #2 (Clock) Angle Value
+	   11 = Sound Receiver Input #3 (Crystal Rocks) Angle Value
+	   12 = Sound Receiver Input #4 (Windy Tunnel) Angle Value
+	   13 = Sound Lock Slider #1 (Left) Position
+	   14 = Sound Lock Slider #2 Position
+	   15 = Sound Lock Slider #3 Position
+	   16 = Sound Lock Slider #4 Position
+	   17 = Sound Lock Slider #5 (Right) Position
+	*/
+	struct Selenitic {
+		uint32 emitterEnabledWater;
+		uint32 emitterEnabledVolcano;
+		uint32 emitterEnabledClock;
+		uint32 emitterEnabledCrystal;
+		uint32 emitterEnabledWind;
+		uint32 soundReceiverOpened;
+		uint32 tunnelLightsSwitchedOn;
+		uint16 soundReceiverCurrentSource;
+		uint16 soundReceiverPositions[5];
+		uint16 soundLockSliderPositions[5];
+	} _selenitic;
+
+	/* 14 Stoneship Specific Variables :
+	    0 = Light State
+	    1 = Unknown #1
+	    2 = Unknown #2
+	    3 = Water Pump State
+	    4 = Lighthouse Trapdoor State
+	    5 = Lighthouse Chest Water State
+	    6 = Lighthouse Chest Valve State
+	    7 = Lighthouse Chest Open State
+	    8 = Lighthouse Trapdoor Key State
+	    9 = Lighthouse Generator Power Level(?)
+	   10 = Lighthouse Generator Power...?
+	   11 = Lighthouse Generator Power Good
+	   12 = Lighthouse Generator Power #1?
+	   13 = Lighthouse Generator Power #2?
+	*/
+	struct Stoneship {
+		uint16 lightState;
+		uint16 u0;
+		uint16 u1;
+		uint16 pumpState;
+		uint16 trapdoorState;
+		uint16 chestWaterState;
+		uint16 chestValveState;
+		uint16 chestOpenState;
+		uint16 trapdoorKeyState;
+		uint16 generatorPowerLevel[5];
+	} _stoneship;
+
+	/* 1 Dunny Specific Variable :
+	    0 = Outcome State
+	*/
+	struct Dni {
+		uint16 outcomeState;
+	} _dni;
+
+	// The values in these regions seem to be lists of resource IDs
+	// which correspond to VIEW resources i.e. cards
+	uint16 unknownMyst[31];
+
+	uint16 unknownChannelwood[37];
+
+	uint16 unknownMech[18];
+
+	uint16 unknownSelenitic[30];
+
+	uint16 unknownStoneship[22];
+private:
+	void syncGameState(Common::Serializer &s, bool isME);
+
+	MohawkEngine_Myst *_vm;
+	Common::SaveFileManager *_saveFileMan;
+};
+
+} // End of namespace Mohawk
+
+#endif


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