diff --git a/scumm/intern.h b/scumm/intern.h index a78983b03dd..7e19084005f 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -693,8 +693,7 @@ protected: byte *_heV7RoomOffsets; - int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndFlags, _heSBNGId; - + int32 _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags, _heSndSoundFreq; public: ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); ~ScummEngine_v70he(); @@ -910,8 +909,10 @@ protected: const OpcodeEntryV80he *_opcodesV80he; + int32 _heSBNGId; + public: - ScummEngine_v80he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v72he(detector, syst, gs, md5sum) {} + ScummEngine_v80he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); protected: virtual void setupOpcodes(); @@ -953,27 +954,28 @@ protected: const char *desc; }; + const OpcodeEntryV90he *_opcodesV90he; + struct FloodStateParameters { Common::Rect box; - int field_10; - int field_14; - int field_18; - int field_1C; + int32 field_10; + int32 field_14; + int32 field_18; + int32 field_1C; }; - int _heObject, _heObjectNum; - int _hePaletteNum; - - const OpcodeEntryV90he *_opcodesV90he; FloodStateParameters _floodStateParams; - int _curMaxSpriteId; - int _curSpriteId; - int _curSpriteGroupId; - int _varNumSpriteGroups; - int _numSpritesToProcess; - int _varNumSprites; - int _varMaxSprites; + int32 _heObject, _heObjectNum; + int32 _hePaletteNum; + + int32 _curMaxSpriteId; + int32 _curSpriteId; + int32 _curSpriteGroupId; + int32 _numSpritesToProcess; + int32 _varNumSpriteGroups; + int32 _varNumSprites; + int32 _varMaxSprites; SpriteInfo *_spriteTable; SpriteGroup *_spriteGroups; SpriteInfo **_activeSpritesTable; @@ -1192,7 +1194,7 @@ protected: const char *desc; }; - int _heResId, _heResType; + int32 _heResId, _heResType; const OpcodeEntryV100he *_opcodesV100he; @@ -1204,6 +1206,8 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + virtual void saveOrLoad(Serializer *s, uint32 savegameVersion); + virtual void decodeParseString(int a, int b); /* HE version 100 script opcodes */ diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 64cf8889260..764e81db0c7 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -958,15 +958,63 @@ void ScummEngine_v70he::saveOrLoad(Serializer *s, uint32 savegameVersion) { MKEND() }; + const SaveLoadEntry HE70Entries[] = { + MKLINE(ScummEngine_v70he, _heSndSoundId, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndOffset, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndChannel, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndFlags, sleInt32, VER(51)), + MKEND() + }; + if (_heversion >= 71) { s->saveLoadArrayOf(_wiz._polygons, ARRAYSIZE(_wiz._polygons), sizeof(_wiz._polygons[0]), polygonEntries); } + + s->saveLoadEntries(this, HE70Entries); } void ScummEngine_v90he::saveOrLoad(Serializer *s, uint32 savegameVersion) { ScummEngine_v70he::saveOrLoad(s, savegameVersion); + const SaveLoadEntry floodStateEntries[] = { + MKLINE(FloodStateParameters, box.left, sleInt32, VER(51)), + MKLINE(FloodStateParameters, box.top, sleInt32, VER(51)), + MKLINE(FloodStateParameters, box.right, sleInt32, VER(51)), + MKLINE(FloodStateParameters, box.bottom, sleInt32, VER(51)), + MKLINE(FloodStateParameters, field_10, sleInt32, VER(51)), + MKLINE(FloodStateParameters, field_14, sleInt32, VER(51)), + MKLINE(FloodStateParameters, field_18, sleInt32, VER(51)), + MKLINE(FloodStateParameters, field_1C, sleInt32, VER(51)), + MKEND() + }; + + const SaveLoadEntry HE90Entries[] = { + MKLINE(ScummEngine_v90he, _curMaxSpriteId, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _curSpriteId, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _curSpriteGroupId, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _numSpritesToProcess, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _heObject, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _heObjectNum, sleInt32, VER(51)), + MKLINE(ScummEngine_v90he, _hePaletteNum, sleInt32, VER(51)), + MKEND() + }; + saveOrLoadSpriteData(&*s, savegameVersion); + + s->saveLoadArrayOf(&_floodStateParams, 1, sizeof(_floodStateParams), floodStateEntries); + s->saveLoadEntries(this, HE90Entries); +} + +void ScummEngine_v100he::saveOrLoad(Serializer *s, uint32 savegameVersion) { + ScummEngine_v90he::saveOrLoad(s, savegameVersion); + + const SaveLoadEntry HE100Entries[] = { + MKLINE(ScummEngine_v100he, _heResId, sleInt32, VER(51)), + MKLINE(ScummEngine_v100he, _heResType, sleInt32, VER(51)), + MKEND() + }; + + s->saveLoadEntries(this, HE100Entries); } void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 166f0dd94e8..ada86b97a32 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1266,7 +1266,6 @@ ScummEngine_v70he::ScummEngine_v70he(GameDetector *detector, OSystem *syst, cons _heSndChannel = 0; _heSndFlags = 0; _heSndSoundFreq = 0; - _heSBNGId = 0; VAR_NUM_SOUND_CHANNELS = 0xFF; } @@ -1296,6 +1295,11 @@ ScummEngine_v72he::ScummEngine_v72he(GameDetector *detector, OSystem *syst, cons VAR_WIZ_TCOLOR = 0xFF; } +ScummEngine_v80he::ScummEngine_v80he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) + : ScummEngine_v72he(detector, syst, gs, md5sum) { + _heSBNGId = 0; +} + ScummEngine_v8::ScummEngine_v8(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v7(detector, syst, gs, md5sum) { _objectIDMap = 0;