aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-02-23 04:05:22 +0000
committerTravis Howell2005-02-23 04:05:22 +0000
commit22b8b3e8ebc2e42fae5bc575c13c675df35df45c (patch)
tree7260371f1c610e8be7b1900f64073129511398f1
parenta33edcf009ca58a1b743e9965f729619f3786128 (diff)
downloadscummvm-rg350-22b8b3e8ebc2e42fae5bc575c13c675df35df45c.tar.gz
scummvm-rg350-22b8b3e8ebc2e42fae5bc575c13c675df35df45c.tar.bz2
scummvm-rg350-22b8b3e8ebc2e42fae5bc575c13c675df35df45c.zip
More sprite functions
svn-id: r16872
-rw-r--r--scumm/intern.h4
-rw-r--r--scumm/script_v100he.cpp14
-rw-r--r--scumm/script_v90he.cpp14
-rw-r--r--scumm/sprite_he.cpp95
4 files changed, 102 insertions, 25 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index d152afe668..8b609f5ce8 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -902,7 +902,7 @@ protected:
int spriteInfoGet_field_80(int spriteId);
void getSpriteImageDim(int spriteId, int32 &w, int32 &h);
void spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty);
- void spriteInfoGet_field_2C_30(int spriteId, int32 &field_2C, int32 &field_30);
+ void spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy);
int spriteGroupGet_allocateGroupSpritesList(int spriteGroupId);
int spriteGroupGet_field_10(int spriteGroupId);
@@ -920,7 +920,7 @@ protected:
void spriteInfoSet_resState(int spriteId, int value);
void spriteInfoSet_tx_ty(int spriteId, int value1, int value2);
void spriteInfoSet_groupNum(int spriteId, int value);
- void spriteInfoSet_field_2C_30(int spriteId, int value1, int value2);
+ void spriteInfoSet_dx_dy(int spriteId, int value1, int value2);
void spriteInfoSet_field_54(int spriteId, int value);
void spriteInfoSet_field_44(int spriteId, int value1, int value2);
void spriteInfoSet_field_18(int spriteId, int value);
diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp
index 1a5dd97a95..6c632d93e2 100644
--- a/scumm/script_v100he.cpp
+++ b/scumm/script_v100he.cpp
@@ -1827,7 +1827,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++)
- spriteInfoSet_field_2C_30(spriteId, args[0], args[1]);
+ spriteInfoSet_dx_dy(spriteId, args[0], args[1]);
break;
case 75:
args[0] = pop();
@@ -1838,9 +1838,9 @@ void ScummEngine_v100he::o100_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++) {
- spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
storedFields[0] = tmp[0];
- spriteInfoSet_field_2C_30(spriteId, args[0], tmp[1]);
+ spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]);
}
break;
case 76:
@@ -1852,9 +1852,9 @@ void ScummEngine_v100he::o100_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++) {
- spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
storedFields[1] = tmp[1];
- spriteInfoSet_field_2C_30(spriteId, tmp[0], args[0]);
+ spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]);
}
break;
case 82:
@@ -2490,7 +2490,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() {
case 75:
spriteId = pop();
if (spriteId) {
- spriteInfoGet_field_2C_30(spriteId, a, b);
+ spriteInfoGet_dx_dy(spriteId, a, b);
push(a);
} else {
push(0);
@@ -2499,7 +2499,7 @@ void ScummEngine_v100he::o100_getSpriteInfo() {
case 76:
spriteId = pop();
if (spriteId) {
- spriteInfoGet_field_2C_30(spriteId, a, b);
+ spriteInfoGet_dx_dy(spriteId, a, b);
push(b);
} else {
push(0);
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index c3f1e29f89..a87328ffe9 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -745,7 +745,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() {
case 4:
spriteId = pop();
if (spriteId) {
- spriteInfoGet_field_2C_30(spriteId, a, b);
+ spriteInfoGet_dx_dy(spriteId, a, b);
push(a);
} else {
push(0);
@@ -754,7 +754,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() {
case 5:
spriteId = pop();
if (spriteId) {
- spriteInfoGet_field_2C_30(spriteId, a, b);
+ spriteInfoGet_dx_dy(spriteId, a, b);
push(b);
} else {
push(0);
@@ -970,9 +970,9 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++) {
- spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
storedFields[0] = tmp[0];
- spriteInfoSet_field_2C_30(spriteId, args[0], tmp[1]);
+ spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]);
}
break;
case 1:
@@ -984,9 +984,9 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++) {
- spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]);
storedFields[1] = tmp[1];
- spriteInfoSet_field_2C_30(spriteId, tmp[0], args[0]);
+ spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]);
}
break;
case 3:
@@ -1142,7 +1142,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteId++;
for (; spriteId <= _curMaxSpriteId; spriteId++)
- spriteInfoSet_field_2C_30(spriteId, args[0], args[1]);
+ spriteInfoSet_dx_dy(spriteId, args[0], args[1]);
break;
case 48:
args[0] = pop();
diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp
index 96c6969782..5ff7ff1f7f 100644
--- a/scumm/sprite_he.cpp
+++ b/scumm/sprite_he.cpp
@@ -209,11 +209,11 @@ void ScummEngine_v90he::spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty)
ty = _spriteTable[spriteId].ty;
}
-void ScummEngine_v90he::spriteInfoGet_field_2C_30(int spriteId, int32 &field_2C, int32 &field_30) {
+void ScummEngine_v90he::spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy) {
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
- field_2C = _spriteTable[spriteId].dx;
- field_30 = _spriteTable[spriteId].dy;
+ dx = _spriteTable[spriteId].dx;
+ dy = _spriteTable[spriteId].dy;
}
//
@@ -330,7 +330,7 @@ void ScummEngine_v90he::spriteInfoSet_groupNum(int spriteId, int value) {
_spriteTable[spriteId].group_num = value;
}
-void ScummEngine_v90he::spriteInfoSet_field_2C_30(int spriteId, int value1, int value2) {
+void ScummEngine_v90he::spriteInfoSet_dx_dy(int spriteId, int value1, int value2) {
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
_spriteTable[spriteId].dx = value1;
@@ -642,7 +642,12 @@ void ScummEngine_v90he::spriteGroupSet_case0_3(int spriteGroupId, int value) {
}
void ScummEngine_v90he::spriteGroupSet_case0_4(int spriteGroupId) {
- // TODO
+ checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
+
+ for (int i = 1; i < _varNumSprites; i++) {
+ if (_spriteTable[i].group_num == spriteGroupId)
+ spriteInfoSet_resetSprite(i);
+ }
}
void ScummEngine_v90he::spriteGroupSet_case0_5(int spriteGroupId, int value) {
@@ -682,19 +687,91 @@ void ScummEngine_v90he::spriteGroupSet_case0_7(int spriteGroupId, int value) {
}
void ScummEngine_v90he::spriteGroupSet_case5_0(int spriteGroupId, int value) {
- // TODO
+ checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
+
+ if (_spriteGroups[spriteGroupId].field_30 == value)
+ return;
+
+ _spriteGroups[spriteGroupId].field_30 = value;
+ _spriteGroups[spriteGroupId].scale_x = _spriteGroups[spriteGroupId].field_30 / _spriteGroups[spriteGroupId].field_34;
+
+ if ((_spriteGroups[spriteGroupId].field_30 != _spriteGroups[spriteGroupId].field_34) || (_spriteGroups[spriteGroupId].field_38 != _spriteGroups[spriteGroupId].field_3C))
+ _spriteGroups[spriteGroupId].scaling = 1;
+ else
+ _spriteGroups[spriteGroupId].scaling = 0;
+
+ for (int i = 0; i < _numSpritesToProcess; ++i) {
+ SpriteInfo *spi = _activeSpritesTable[i];
+ if (spi->group_num == spriteGroupId) {
+ spi->flags |= kSF01 | kSFNeedRedraw;
+ }
+ }
}
void ScummEngine_v90he::spriteGroupSet_case5_1(int spriteGroupId, int value) {
- // TODO
+ checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
+
+ if (_spriteGroups[spriteGroupId].field_34 == value)
+ return;
+
+ _spriteGroups[spriteGroupId].field_34 = value;
+ _spriteGroups[spriteGroupId].scale_x = _spriteGroups[spriteGroupId].field_30 / _spriteGroups[spriteGroupId].field_34;
+
+ if ((_spriteGroups[spriteGroupId].field_30 != _spriteGroups[spriteGroupId].field_34) || (_spriteGroups[spriteGroupId].field_38 != _spriteGroups[spriteGroupId].field_3C))
+ _spriteGroups[spriteGroupId].scaling = 1;
+ else
+ _spriteGroups[spriteGroupId].scaling = 0;
+
+ for (int i = 0; i < _numSpritesToProcess; ++i) {
+ SpriteInfo *spi = _activeSpritesTable[i];
+ if (spi->group_num == spriteGroupId) {
+ spi->flags |= kSF01 | kSFNeedRedraw;
+ }
+ }
}
void ScummEngine_v90he::spriteGroupSet_case5_2(int spriteGroupId, int value) {
- // TODO
+ checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
+
+ if (_spriteGroups[spriteGroupId].field_38 == value)
+ return;
+
+ _spriteGroups[spriteGroupId].field_38 = value;
+ _spriteGroups[spriteGroupId].scale_y = _spriteGroups[spriteGroupId].field_38 / _spriteGroups[spriteGroupId].field_3C;
+
+ if ((_spriteGroups[spriteGroupId].field_30 != _spriteGroups[spriteGroupId].field_34) || (_spriteGroups[spriteGroupId].field_38 != _spriteGroups[spriteGroupId].field_3C))
+ _spriteGroups[spriteGroupId].scaling = 1;
+ else
+ _spriteGroups[spriteGroupId].scaling = 0;
+
+ for (int i = 0; i < _numSpritesToProcess; ++i) {
+ SpriteInfo *spi = _activeSpritesTable[i];
+ if (spi->group_num == spriteGroupId) {
+ spi->flags |= kSF01 | kSFNeedRedraw;
+ }
+ }
}
void ScummEngine_v90he::spriteGroupSet_case5_3(int spriteGroupId, int value) {
- // TODO
+ checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
+
+ if (_spriteGroups[spriteGroupId].field_3C == value)
+ return;
+
+ _spriteGroups[spriteGroupId].field_3C = value;
+ _spriteGroups[spriteGroupId].scale_y = _spriteGroups[spriteGroupId].field_38 / _spriteGroups[spriteGroupId].field_3C;
+
+ if ((_spriteGroups[spriteGroupId].field_30 != _spriteGroups[spriteGroupId].field_34) || (_spriteGroups[spriteGroupId].field_38 != _spriteGroups[spriteGroupId].field_3C))
+ _spriteGroups[spriteGroupId].scaling = 1;
+ else
+ _spriteGroups[spriteGroupId].scaling = 0;
+
+ for (int i = 0; i < _numSpritesToProcess; ++i) {
+ SpriteInfo *spi = _activeSpritesTable[i];
+ if (spi->group_num == spriteGroupId) {
+ spi->flags |= kSF01 | kSFNeedRedraw;
+ }
+ }
}
void ScummEngine_v90he::spriteGroupSet_field_10(int spriteGroupId, int value) {