diff options
author | Eugene Sandulenko | 2005-02-21 00:59:50 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-02-21 00:59:50 +0000 |
commit | 97688df92d0356848e0c75a319b8d030881b6a85 (patch) | |
tree | b338dcbb78c8605a39a5bf27b97565ef42af4131 /scumm | |
parent | 7a6b7c2a1ce9ce4312f4d361d658029f01714004 (diff) | |
download | scummvm-rg350-97688df92d0356848e0c75a319b8d030881b6a85.tar.gz scummvm-rg350-97688df92d0356848e0c75a319b8d030881b6a85.tar.bz2 scummvm-rg350-97688df92d0356848e0c75a319b8d030881b6a85.zip |
WIP for o90_spriteInfoSet. Regression fix.
svn-id: r16840
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 11 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 109 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 92 |
3 files changed, 195 insertions, 17 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 181517b7c0..942d73d7b0 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -902,12 +902,23 @@ protected: void spriteInfoSet_field_7C(int spriteId, int value); void spriteInfoSet_field_80(int spriteId, int value); void spriteInfoSet_case183(int spriteId); + void spriteInfoSet_resState(int spriteNum, int value); + void spriteInfoSet_tx_ty(int spriteNum, int value1, int value2); + void spriteInfoSet_groupNum(int spriteNum, int value); + void spriteInfoSet_field_2C_30(int spriteNum, int value1, int value2); + void spriteInfoSet_field_54(int spriteNum, int value); + void spriteInfoSet_field_44(int spriteNum, int value1, int value2); + void spriteInfoSet_field_18(int spriteNum, int value); + void spriteInfoSet_Inc_tx_ty(int spriteNum, int value1, int value2); + void spriteInfoSet_zoom(int spriteNum, int value); void spritesAllocTables(int numSprites, int numGroups, int numImgSprites); void spritesResetTables(bool refreshScreen); void spriteGroupCheck(int sprGrpId); void spriteMarkIfInGroup(int sprGrpId, uint32 flags); + void spriteInfoSet_addImageToList(int spriteNum, int imageNum, int *spriteIdptr); + /* HE version 90 script opcodes */ void o90_dup(); void o90_min(); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 079c9d6d0c..be77aef170 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -940,21 +940,53 @@ void ScummEngine_v90he::o90_setSpriteInfo() { pop(); break; case 3: - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_groupNum(spriteId, args[0]); break; case 8: pop(); pop(); break; case 9: - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_18(spriteId, args[0]); break; case 10: - pop(); - pop(); + args[1] = pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_Inc_tx_ty(spriteId, args[0], args[1]); break; case 18: - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_resState(spriteId, args[0]); break; case 19: pop(); @@ -983,18 +1015,42 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteInfoSet_field_7C(spriteId, args[0]); break; case 29: - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_addImageToList(spriteId, 1, &args[0]); break; case 31: - pop(); - pop(); + args[1] = pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_tx_ty(spriteId, args[0], args[1]); break; case 34: pop(); break; case 43: - pop(); - pop(); + args[1] = pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_2C_30(spriteId, args[0], args[1]); break; case 48: pop(); @@ -1011,13 +1067,29 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteInfoSet_field_14(spriteId, args[0]); break; case 58: // HE 99+ - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_zoom(spriteId, args[0]); break; case 63: // HE 98+ pop(); break; case 64: - pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_54(spriteId, args[0]); break; case 90: pop(); @@ -1043,11 +1115,18 @@ void ScummEngine_v90he::o90_setSpriteInfo() { case 124: break; case 164: - pop(); - pop(); + args[1] = pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_44(spriteId, args[0], args[1]); break; case 183: - args[0] = pop(); if (_curSpriteId > _curMaxSpriteId) break; spriteId = _curSpriteId; diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index c7b8bee9ac..c1a5f04110 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -208,9 +208,97 @@ void ScummEngine_v90he::spriteInfoSet_field_80(int spriteId, int value) { _spriteTable[spriteId].field_80 = value; } -void ScummEngine_v90he::spriteInfoSet_case183(int spriteId) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); +void ScummEngine_v90he::spriteInfoSet_resState(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + if (_spriteTable[spriteNum].res_id) { + int state; + + state = MAX(value, _spriteTable[spriteNum].res_wiz_states - 1); + if (state < 0) + state = 0; + + if (_spriteTable[spriteNum].res_state != state) { + _spriteTable[spriteNum].res_state = state; + _spriteTable[spriteNum].flags |= kSF01 | kSF02; + } + } +} + +void ScummEngine_v90he::spriteInfoSet_tx_ty(int spriteNum, int value1, int value2) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + if (_spriteTable[spriteNum].tx != value1 || _spriteTable[spriteNum].ty != value2) { + _spriteTable[spriteNum].tx = value1; + _spriteTable[spriteNum].ty = value2; + _spriteTable[spriteNum].flags |= kSF01 | kSF02; + } +} + +void ScummEngine_v90he::spriteInfoSet_groupNum(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + checkRange(_varNumSpriteGroups, 1, value, "Invalid sprite group%d"); + + _spriteTable[spriteNum].group_num = value; +} + +void ScummEngine_v90he::spriteInfoSet_field_2C_30(int spriteNum, int value1, int value2) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].field_2C = value1; + _spriteTable[spriteNum].field_30 = value2; +} + +void ScummEngine_v90he::spriteInfoSet_field_54(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].field_54 = value; + if (_spriteTable[spriteNum].res_id) + _spriteTable[spriteNum].flags |= kSF01 | kSF02; +} + +void ScummEngine_v90he::spriteInfoSet_field_44(int spriteNum, int value1, int value2) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].field_44 = value2; +} + +void ScummEngine_v90he::spriteInfoSet_field_18(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].field_18 = value; +} + +void ScummEngine_v90he::spriteInfoSet_Inc_tx_ty(int spriteNum, int value1, int value2) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].tx += value1; + _spriteTable[spriteNum].ty += value2; + + if (_spriteTable[spriteNum].tx || _spriteTable[spriteNum].ty) + _spriteTable[spriteNum].flags |= kSF01 | kSF02; +} + +void ScummEngine_v90he::spriteInfoSet_zoom(int spriteNum, int value) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + _spriteTable[spriteNum].flags |= kSFZoomed; + + if (_spriteTable[spriteNum].zoom != value) { + _spriteTable[spriteNum].zoom = value; + + if (_spriteTable[spriteNum].res_id) + _spriteTable[spriteNum].flags |= kSF01 | kSF02; + } +} + +void ScummEngine_v90he::spriteInfoSet_case183(int spriteNum) { + checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d"); + + // TODO +} +void ScummEngine_v90he::spriteInfoSet_addImageToList(int spriteNum, int imageNum, int *spriteIdptr) { // TODO } |