Another attempt at a fix for bug #1032964 (INDY3-VGA: actors walking in wrong places), by making sure all actor walkdata is saved

svn-id: r15455
This commit is contained in:
Max Horn 2004-10-07 21:23:29 +00:00
parent 186201c68f
commit f488f4c15f
3 changed files with 36 additions and 21 deletions

View File

@ -46,9 +46,15 @@ void Actor::initActorClass(ScummEngine *scumm) {
Actor::Actor() {
assert(_vm != 0);
number = 0;
initActor(-1);
}
void Actor::initActor(int mode) {
if (mode == -1) {
_offsX = _offsY = 0;
top = bottom = 0;
number = 0;
needRedraw = needBgReset = costumeNeedsInit = visible = false;
flip = false;
speedx = 8;
@ -67,10 +73,9 @@ Actor::Actor() {
walkScript = 0;
memset(talkQueue, 0, sizeof(talkQueue));
initActor(1);
}
mode = 1;
}
void Actor::initActor(int mode) {
if (mode == 1) {
costume = 0;
room = 0;
@ -2056,6 +2061,9 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() {
MKLINE(Actor, walkdata.xfrac, sleUint16, VER(8)),
MKLINE(Actor, walkdata.yfrac, sleUint16, VER(8)),
MKLINE(Actor, walkdata.point3.x, sleUint16, VER(42)),
MKLINE(Actor, walkdata.point3.y, sleUint16, VER(42)),
MKARRAY(Actor, cost.active[0], sleByte, 16, VER(8)),
MKLINE(Actor, cost.stopped, sleUint16, VER(8)),
MKARRAY(Actor, cost.curpos[0], sleUint16, 16, VER(8)),

View File

@ -707,6 +707,13 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
_system->warpMouse(_mouse.x, _mouse.y);
}
if (s->isLoading()) {
// Not all actor data is saved; so when loading, we first reset
// all actors, to ensure completely reproducible behaviour (else,
// some not saved value in the actor class can cause odd things)
for (i = 0; i < _numActors; i++)
_actors[i].initActor(-1);
}
s->saveLoadArrayOf(_actors, _numActors, sizeof(_actors[0]), actorEntries);
s->saveLoadEntries(_sound, soundEntries);

View File

@ -32,7 +32,7 @@ namespace Scumm {
// Can be useful for other ports too :)
#define VER(x) x
#define CURRENT_VER 41
#define CURRENT_VER 42
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
// we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC