diff options
author | Travis Howell | 2005-02-26 03:57:11 +0000 |
---|---|---|
committer | Travis Howell | 2005-02-26 03:57:11 +0000 |
commit | 2689832d75095e00d7a49cf53a73b75b3fcab682 (patch) | |
tree | 27b3c4277cc2152acf7097385b03ec62546faaed /scumm | |
parent | 4da8a6e1f05b9c2981465b7483fb677a84391e5f (diff) | |
download | scummvm-rg350-2689832d75095e00d7a49cf53a73b75b3fcab682.tar.gz scummvm-rg350-2689832d75095e00d7a49cf53a73b75b3fcab682.tar.bz2 scummvm-rg350-2689832d75095e00d7a49cf53a73b75b3fcab682.zip |
Rename sprite function
Correct spritesResetSpriteGroup
svn-id: r16922
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 4 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 4 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 118 |
4 files changed, 67 insertions, 63 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index f7ffe5f31c..c7077c411a 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -959,11 +959,11 @@ protected: void spriteGroupSet_tx_ty(int spriteGroupId, int value1, int value2); void spriteGroupSet_case26(int spriteGroupId, int value); void spriteGroupSet_case28(int spriteGroupId, int value1, int value2); - void spriteGroupSet_fields_0_4_8_C(int spriteGroupId, int value1, int value2, int value3, int value4); + void spriteGroupSet_bbox(int spriteGroupId, int x1, int y1, int x2, int y2); void spriteGroupSet_case56(int spriteGroupId); void spritesAllocTables(int numSprites, int numGroups, int numMaxSprites); - void spritesResetGroup(int spriteGroupId); + void spritesResetSpriteGroup(int spriteGroupId); void spritesResetTables(bool refreshScreen); void spriteGroupCheck(int spriteGroupId); void spriteMarkIfInGroup(int spriteGroupId, uint32 flags); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 185da73358..abc9569232 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -858,7 +858,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_fields_0_4_8_C(_curSpriteGroupId, value1, value2, value3, value4); + spriteGroupSet_bbox(_curSpriteGroupId, value1, value2, value3, value4); break; case 38: type = pop() - 1; @@ -945,7 +945,7 @@ void ScummEngine_v100he::o100_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spritesResetGroup(_curSpriteGroupId); + spritesResetSpriteGroup(_curSpriteGroupId); break; case 54: // dummy case diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 1d52129cdc..4684e88171 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -1507,7 +1507,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spriteGroupSet_fields_0_4_8_C(_curSpriteGroupId, value1, value2, value3, value4); + spriteGroupSet_bbox(_curSpriteGroupId, value1, value2, value3, value4); break; case 56: if (!_curSpriteGroupId) @@ -1519,7 +1519,7 @@ void ScummEngine_v90he::o90_setSpriteGroupInfo() { if (!_curSpriteGroupId) break; - spritesResetGroup(_curSpriteGroupId); + spritesResetSpriteGroup(_curSpriteGroupId); break; default: error("o90_setSpriteGroupInfo: Unknown case %d", subOp); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 3bfd649562..5a71f65611 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -697,9 +697,10 @@ void ScummEngine_v90he::spriteAddImageToList(int spriteId, int imageNum, int *sp origResId = _spriteTable[spriteId].res_id; origResWizStates = _spriteTable[spriteId].res_wiz_states; - if (imageNum == 1) + if (imageNum == 1) { _spriteTable[spriteId].res_id = *spriteIdptr; - else { + } else { + // This section is currently never called if (!_curSprImageListNum) error("Out of image lists"); @@ -957,14 +958,14 @@ void ScummEngine_v90he::spriteGroupSet_case28(int spriteGroupId, int value1, int redrawSpriteGroup(spriteGroupId); } -void ScummEngine_v90he::spriteGroupSet_fields_0_4_8_C(int spriteGroupId, int value1, int value2, int value3, int value4) { +void ScummEngine_v90he::spriteGroupSet_bbox(int spriteGroupId, int x1, int y1, int x2, int y2) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); _spriteGroups[spriteGroupId].flags |= kSGF01; - _spriteGroups[spriteGroupId].bbox.left = value1; - _spriteGroups[spriteGroupId].bbox.top = value2; - _spriteGroups[spriteGroupId].bbox.right = value3; - _spriteGroups[spriteGroupId].bbox.bottom = value4; + _spriteGroups[spriteGroupId].bbox.left = x1; + _spriteGroups[spriteGroupId].bbox.top = y1; + _spriteGroups[spriteGroupId].bbox.right = x2; + _spriteGroups[spriteGroupId].bbox.bottom = y2; redrawSpriteGroup(spriteGroupId); } @@ -989,50 +990,13 @@ void ScummEngine_v90he::spritesAllocTables(int numSprites, int numGroups, int nu _imageListStack = (uint16 *)malloc((_varMaxSprites + 1) * sizeof(uint16)); } -void ScummEngine_v90he::spritesResetGroup(int spriteGroupId) { - int i; - - SpriteGroup *spg = &_spriteGroups[spriteGroupId]; +void ScummEngine_v90he::spritesResetSpriteGroup(int spriteGroupId) { checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d"); - if (spg->field_10 != 0) { - spg->field_10 = 0; - spriteGroupCheck(spriteGroupId); - for (i = 0; i < _numSpritesToProcess; ++i) { - SpriteInfo *spi = _activeSpritesTable[i]; - if (spi->group_num == spriteGroupId) { - spi->flags |= kSFChanged | kSFNeedRedraw; - } - } - } - if (spg->tx != 0 || spg->ty != 0) { - spg->tx = spg->ty = 0; - spriteGroupCheck(spriteGroupId); - for (i = 0; i < _numSpritesToProcess; ++i) { - SpriteInfo *spi = _activeSpritesTable[i]; - if (spi->group_num == spriteGroupId) { - spi->flags |= kSFChanged | kSFNeedRedraw; - } - } - } - spg->flags &= ~kSGF01; - spriteMarkIfInGroup(spriteGroupId, kSFChanged | kSFNeedRedraw); - if (spg->field_20 != 0) { - spriteGroupCheck(spriteGroupId); - for (i = 0; i < _numSpritesToProcess; ++i) { - SpriteInfo *spi = _activeSpritesTable[i]; - if (spi->group_num == spriteGroupId) { - spi->flags |= kSFChanged | kSFNeedRedraw; - } - } + + for (int i = 1; i < _varNumSprites; i++) { + if (_spriteTable[i].group_num == spriteGroupId) + spriteInfoSet_resetSprite(i); } - spriteGroupCheck(spriteGroupId); - spg->scaling = 0; - spg->scale_x = 0x3F800000; - spg->field_30 = 0; - spg->field_34 = 0; - spg->scale_y = 0x3F800000; - spg->field_38 = 0; - spg->field_3C = 0; } void ScummEngine_v90he::spritesResetTables(bool refreshScreen) { @@ -1043,9 +1007,49 @@ void ScummEngine_v90he::spritesResetTables(bool refreshScreen) { } memset(_spriteTable, 0, (_varNumSprites + 1) * sizeof(SpriteInfo)); memset(_spriteGroups, 0, (_varNumSpriteGroups + 1) * sizeof(SpriteGroup)); - for (int curGrp = 1; curGrp < _varNumSpriteGroups; ++curGrp) - spritesResetGroup(curGrp); - + for (int curGrp = 1; curGrp < _varNumSpriteGroups; ++curGrp) { + SpriteGroup *spg = &_spriteGroups[curGrp]; + checkRange(_varNumSpriteGroups, 1, curGrp, "Invalid sprite group %d"); + if (spg->field_10) { + spg->field_10 = 0; + spriteGroupCheck(curGrp); + for (i = 0; i < _numSpritesToProcess; ++i) { + SpriteInfo *spi = _activeSpritesTable[i]; + if (spi->group_num == curGrp) { + spi->flags |= kSFChanged | kSFNeedRedraw; + } + } + } + if (spg->tx || spg->ty) { + spg->tx = spg->ty = 0; + spriteGroupCheck(curGrp); + for (i = 0; i < _numSpritesToProcess; ++i) { + SpriteInfo *spi = _activeSpritesTable[i]; + if (spi->group_num == curGrp) { + spi->flags |= kSFChanged | kSFNeedRedraw; + } + } + } + spg->flags &= ~kSGF01; + spriteMarkIfInGroup(curGrp, kSFChanged | kSFNeedRedraw); + if (spg->field_20 != 0) { + spriteGroupCheck(curGrp); + for (i = 0; i < _numSpritesToProcess; ++i) { + SpriteInfo *spi = _activeSpritesTable[i]; + if (spi->group_num == curGrp) { + spi->flags |= kSFChanged | kSFNeedRedraw; + } + } + } + spriteGroupCheck(curGrp); + spg->scaling = 0; + spg->scale_x = 0x3F800000; + spg->field_30 = 0; + spg->field_34 = 0; + spg->scale_y = 0x3F800000; + spg->field_38 = 0; + spg->field_3C = 0; + } if (refreshScreen) { gdi.copyVirtScreenBuffers(Common::Rect(_screenWidth, _screenHeight)); } @@ -1102,7 +1106,7 @@ void ScummEngine_v90he::spritesBlitToScreen() { } refreshScreen = true; } - if (!(spi->flags & (kSFNeedRedraw | kSF30)) && (spi->res_id != 0)) { + if (!(spi->flags & (kSFNeedRedraw | kSF30)) && spi->res_id) { spi->flags |= kSFNeedRedraw; } } @@ -1151,9 +1155,9 @@ void ScummEngine_v90he::spritesUpdateImages() { if (spi->flags & kSFYFlipped) { if (spi->field_78 != 0) { --spi->field_64; - if (spi->field_64 != 0) { + if (spi->field_64) continue; - } + spi->field_64 = spi->field_78; } int state = spi->res_state; @@ -1166,9 +1170,9 @@ void ScummEngine_v90he::spritesUpdateImages() { checkRange(_varMaxSprites, 1, spi->imglist_num, "Image list %d out of range"); uint16 img1 = _imageListTable[0x21 * spi->imglist_num - 1]; uint16 img2 = spi->field_74 + 1; - if (img2 >= img1) { + if (img2 >= img1) img2 = 0; - } + if (spi->field_74 != img2) { spi->field_74 = img2; spi->res_id = _imageListTable[0x21 * (img2 - 1)]; |