diff options
-rw-r--r-- | scumm/intern.h | 8 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 53 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 43 | ||||
-rw-r--r-- | scumm/sprite_he.h | 18 |
4 files changed, 102 insertions, 20 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index a33ca86cf5..0392ca5628 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -852,6 +852,9 @@ protected: const OpcodeEntryV90he *_opcodesV90he; WizParameters _wizParams; + int _curMaxSpriteId; + int _curSpriteId; + public: ScummEngine_v90he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v80he(detector, syst, gs, md5sum) {} @@ -893,6 +896,11 @@ protected: int spriteInfoGet_field_80(int spriteNun); void getSpriteImageDim(int spriteNum, int32 &w, int32 &h); + void spriteInfoSet_field_14(int spriteNum, int value); + void spriteInfoSet_field_7C(int spriteNum, int value); + void spriteInfoSet_field_80(int spriteNum, int value); + void spriteInfoSet_case183(int spriteNum); + void spritesAllocTables(int numSprites, int numGroups, int numImgSprites); void spritesResetTables(bool refreshScreen); void spriteGroupCheck(int sprGrpId); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 2be8fbafa5..f675bf065a 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -903,6 +903,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { void ScummEngine_v90he::o90_setSpriteInfo() { int args[16]; + int spriteId; byte subOp = fetchScriptByte(); subOp -= 34; @@ -934,12 +935,27 @@ void ScummEngine_v90he::o90_setSpriteInfo() { pop(); break; case 23: - pop(); - if (_gameId == GID_FREDDI4 || _heversion >= 99) - pop(); + if (_gameId == GID_FREDDI4 || _heversion >= 99) { + _curMaxSpriteId = pop(); + _curSpriteId = pop(); + + if (_curSpriteId > _curMaxSpriteId) + SWAP(_curSpriteId, _curMaxSpriteId); + } else { + _curSpriteId = pop(); + _curMaxSpriteId = _curSpriteId; // to make all functions happy + } break; case 28: // HE99+ - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_7C(spriteId, args[0]); break; case 29: pop(); @@ -959,7 +975,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() { pop(); break; case 52: // HE 98+ - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_14(spriteId, args[0]); break; case 58: // HE 99+ pop(); @@ -981,7 +1005,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() { pop(); break; case 106: // HE 99+ - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_80(spriteId, args[0]); break; case 124: break; @@ -990,6 +1022,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() { pop(); break; case 183: + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_case183(spriteId); break; default: error("o90_setSpriteInfo: Unknown case %d", subOp); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index dd0e5d19df..bce46f6727 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -161,6 +161,39 @@ void ScummEngine_v90he::getSpriteImageDim(int spriteNum, int32 &w, int32 &h) { getWizImageDim(_spriteTable[spriteNum].res_id, _spriteTable[spriteNum].res_state, w, h); } +// +// spriteInfoSet functions +// +void ScummEngine_v90he::spriteInfoSet_field_14(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + if (_spriteTable[spriteNum].field_14 != value) { + _spriteTable[spriteNum].field_14 = value; + _spriteTable[spriteNum].flags |= kSF01 | kSF02; + } +} + +void ScummEngine_v90he::spriteInfoSet_field_7C(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + if (_spriteTable[spriteNum].field_7C != value) { + _spriteTable[spriteNum].field_7C = value; + _spriteTable[spriteNum].flags |= kSF01 | kSF02; + } +} + +void ScummEngine_v90he::spriteInfoSet_field_80(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].field_80 = value; +} + +void ScummEngine_v90he::spriteInfoSet_case183(int spriteNum) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + // TODO +} + void ScummEngine_v90he::spritesAllocTables(int numSprites, int numGroups, int numImgLists) { _varNumSpriteGroups = numGroups; _numSpritesToProcess = 0; @@ -189,7 +222,7 @@ void ScummEngine_v90he::spritesResetTables(bool refreshScreen) { for (i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (spi->group_num == curGrp) { - spi->flags |= kSF1 | kSF2; + spi->flags |= kSF01 | kSF02; } } } @@ -199,18 +232,18 @@ void ScummEngine_v90he::spritesResetTables(bool refreshScreen) { for (i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (spi->group_num == curGrp) { - spi->flags |= kSF1 | kSF2; + spi->flags |= kSF01 | kSF02; } } } - spg->flags &= ~kSGF1; - spriteMarkIfInGroup(curGrp, kSF1 | kSF2); + spg->flags &= ~kSGF01; + spriteMarkIfInGroup(curGrp, kSF01 | kSF02); if (spg->field_20 != 0) { spriteGroupCheck(curGrp); for (i = 0; i < _numSpritesToProcess; ++i) { SpriteInfo *spi = _activeSpritesTable[i]; if (spi->group_num == curGrp) { - spi->flags |= kSF1 | kSF2; + spi->flags |= kSF01 | kSF02; } } } diff --git a/scumm/sprite_he.h b/scumm/sprite_he.h index a0c9700982..ffb1e9050f 100644 --- a/scumm/sprite_he.h +++ b/scumm/sprite_he.h @@ -26,15 +26,15 @@ namespace Scumm { enum SpriteFlags { - kSF1 = (1 << 0), - kSF2 = (1 << 1), - kSF3 = (1 << 2), - kSF4 = (1 << 3), + kSF01 = (1 << 0), + kSF02 = (1 << 1), + kSF03 = (1 << 2), + kSF04 = (1 << 3), kSFZoomed = (1 << 4), kSFRotated = (1 << 5), - kSF7 = (1 << 6), - kSF8 = (1 << 7), - kSF9 = (1 << 8), + kSF07 = (1 << 6), + kSF08 = (1 << 7), + kSF09 = (1 << 8), kSF10 = (1 << 9), kSF11 = (1 << 10), kSF12 = (1 << 11), @@ -61,8 +61,8 @@ enum SpriteFlags { }; enum SpriteGroupFlags { - kSGF1 = 1 << 0, - kSFG2 = 1 << 1 + kSGF01 = 1 << 0, + kSGF02 = 1 << 1 }; struct SpriteInfo { |