aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Gunkel2012-02-04 17:35:59 +0100
committerTobias Gunkel2012-02-11 08:30:07 +0100
commit8d3b27293965ea17a4a34a1258688f9eeb3410d1 (patch)
tree7da35a5b4e6ad0f0046be1fe4491c57ae6f12228
parent5d3e1dd0dc7542057779f192c6865e9501eb8e36 (diff)
downloadscummvm-rg350-8d3b27293965ea17a4a34a1258688f9eeb3410d1.tar.gz
scummvm-rg350-8d3b27293965ea17a4a34a1258688f9eeb3410d1.tar.bz2
scummvm-rg350-8d3b27293965ea17a4a34a1258688f9eeb3410d1.zip
SCUMM: save complete v0 state and initialize actors correctly
-rw-r--r--engines/scumm/actor.cpp19
-rw-r--r--engines/scumm/actor.h27
-rw-r--r--engines/scumm/saveload.cpp12
-rw-r--r--engines/scumm/saveload.h2
4 files changed, 35 insertions, 25 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index f58d3fde4e..59c4110348 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -175,6 +175,21 @@ void Actor_v2::initActor(int mode) {
_talkStopFrame = 4;
}
+void ActorC64::initActor(int mode) {
+ Actor_v2::initActor(mode);
+
+ _costCommandNew = 0xFF;
+ _costCommand = 0xFF;
+ _miscflags = 0;
+ _speaking = 0;
+
+ _animFrameRepeat = 0;
+ for(int i = 0; i < 8; ++i) {
+ _limbFrameRepeatNew[i] = 0;
+ _limbFrameRepeat[i] = 0;
+ _limb_flipped[i] = false;
+ }
+}
void Actor::setBox(int box) {
_walkbox = box;
@@ -2812,11 +2827,11 @@ void ActorC64::saveLoadWithSerializer(Serializer *ser) {
static const SaveLoadEntry actorEntries[] = {
MKLINE(ActorC64, _costCommand, sleByte, VER(84)),
- MKLINE_OLD(ActorC64, _costFrame, sleByte, VER(84), VER(89)),
+ MK_OBSOLETE(ActorC64, _costFrame, sleByte, VER(84), VER(89)),
MKLINE(ActorC64, _miscflags, sleByte, VER(84)),
MKLINE(ActorC64, _speaking, sleByte, VER(84)),
MK_OBSOLETE(ActorC64, _speakingPrev, sleByte, VER(84), VER(89)),
- MK_OBSOLETE(ActorC64, _byte_FD0A, sleByte, VER(89), VER(89)),
+ MK_OBSOLETE(ActorC64, _limbTemp, sleByte, VER(89), VER(89)),
MKLINE(ActorC64, _animFrameRepeat, sleByte, VER(89)),
MKARRAY(ActorC64, _limbFrameRepeatNew[0], sleInt8, 8, VER(89)),
MKARRAY(ActorC64, _limbFrameRepeat[0], sleInt8, 8, VER(90)),
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index c2ffcf1275..9e4955c079 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -348,36 +348,21 @@ enum ActorC64MiscFlags {
class ActorC64 : public Actor_v2 {
public:
- byte _costCommandNew, _costCommand, _costFrame;
+ byte _costCommandNew;
+ byte _costCommand;
byte _miscflags;
byte _speaking;
int8 _animFrameRepeat;
- int8 _limbFrameRepeatNew[8], _limbFrameRepeat[8];
+ int8 _limbFrameRepeatNew[8];
+ int8 _limbFrameRepeat[8];
bool _limb_flipped[8];
public:
- ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {
- _costCommand = 0xFF;
- _speaking = 0;
- _animFrameRepeat = 0;
- _costCommandNew = 0xFF;
-
- for(int i = 0; i < 8; ++i) {
- _limbFrameRepeatNew[i] = 0;
- _limbFrameRepeat[i] = 0;
- _limb_flipped[i] = false;
- }
- }
-
- virtual void initActor(int mode) {
- Actor_v2::initActor(mode);
- if (mode == -1) {
- _miscflags = 0;
- }
- }
+ ActorC64(ScummEngine *scumm, int id) : Actor_v2(scumm, id) {}
+ virtual void initActor(int mode);
virtual void animateActor(int anim);
virtual void animateCostume();
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index a1b2fafa86..6e54377199 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1210,10 +1210,12 @@ void ScummEngine::saveOrLoad(Serializer *s) {
// Since roughly v13 of the save games, the objs storage has changed a bit
for (i = _numObjectsInRoom; i < _numLocalObjects; i++)
_objs[i].obj_nr = 0;
- } else if (_game.version == 0) { // TODO: handle this correctly
+ } else if (_game.version == 0 && s->getVersion() < VER(91)) {
for (i = 0; i < _numLocalObjects; i++) {
+ // Merge object id and type (previously stored in flags)
if (_objs[i].obj_nr != 0 && OBJECT_V0_TYPE(_objs[i].obj_nr) == 0 && _objs[i].flags != 0)
_objs[i].obj_nr = OBJECT_V0(_objs[i].obj_nr, _objs[i].flags);
+ _objs[i].flags = 0;
}
}
}
@@ -1502,6 +1504,14 @@ void ScummEngine_v0::saveOrLoad(Serializer *s) {
const SaveLoadEntry v0Entrys[] = {
MKLINE(ScummEngine_v0, _currentMode, sleByte, VER(78)),
MKLINE(ScummEngine_v0, _currentLights, sleByte, VER(78)),
+ MKLINE(ScummEngine_v0, _activeVerb, sleByte, VER(92)),
+ MKLINE(ScummEngine_v0, _activeObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _activeObject2, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdVerb, sleByte, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _cmdObject2, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _walkToObject, sleUint16, VER(92)),
+ MKLINE(ScummEngine_v0, _walkToObjectState, sleByte, VER(92)),
MKEND()
};
s->saveLoadEntries(this, v0Entrys);
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index a316670e3d..90feee6dc0 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -47,7 +47,7 @@ namespace Scumm {
* only saves/loads those which are valid for the version of the savegame
* which is being loaded/saved currently.
*/
-#define CURRENT_VER 91
+#define CURRENT_VER 92
/**
* An auxillary macro, used to specify savegame versions. We use this instead