aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2005-02-21 02:02:32 +0000
committerEugene Sandulenko2005-02-21 02:02:32 +0000
commit6942100a940ac4ff8cf43f0c0e29f358adcf4175 (patch)
tree6d1e4fc9369e80aa583a24e13abac2e709629fae
parentb1e67c4ce87210b8c240e7da65ded3562e4349aa (diff)
downloadscummvm-rg350-6942100a940ac4ff8cf43f0c0e29f358adcf4175.tar.gz
scummvm-rg350-6942100a940ac4ff8cf43f0c0e29f358adcf4175.tar.bz2
scummvm-rg350-6942100a940ac4ff8cf43f0c0e29f358adcf4175.zip
WIP for o90_spriteInfoSet
svn-id: r16842
-rw-r--r--scumm/intern.h10
-rw-r--r--scumm/script_v90he.cpp110
-rw-r--r--scumm/sprite_he.cpp105
3 files changed, 215 insertions, 10 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 17d1a9ba8f..cba2ae7479 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -919,6 +919,16 @@ protected:
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 spriteInfoSet_rotAngle(int spriteNum, int value);
+ void spriteInfoSet_flag22(int spriteNum, int value);
+ void spriteInfoSet_flag7(int spriteNum, int value);
+ void spriteInfoSet_flagRotated(int spriteNum, int value);
+ void spriteInfoSet_flag8(int spriteNum, int value);
+ void spriteInfoSet_flagZoomed(int spriteNum, int value);
+ void spriteInfoSet_flag20(int spriteNum, int value);
+ void spriteInfoSet_flags23_26(int spriteNum, int value);
+ void spriteInfoSet_flag31(int spriteNum, int value);
+ void spriteInfoSet_field_78_64(int spriteNum, int value);
void spritesAllocTables(int numSprites, int numGroups, int numImgSprites);
void spritesResetTables(bool refreshScreen);
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index b3e8d211d0..01a470ac2e 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -928,16 +928,39 @@ void ScummEngine_v90he::o90_getSpriteInfo() {
void ScummEngine_v90he::o90_setSpriteInfo() {
int args[16];
- int spriteId;
+ int spriteId, tmp[2];
+ static int storedFields[2];
byte subOp = fetchScriptByte();
subOp -= 34;
switch (subOp) {
case 0:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++) {
+ spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ storedFields[0] = tmp[0];
+ spriteInfoSet_field_2C_30(spriteId, args[0], tmp[1]);
+ }
break;
case 1:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++) {
+ spriteInfoGet_field_2C_30(spriteId, tmp[0], tmp[1]);
+ storedFields[1] = tmp[1];
+ spriteInfoSet_field_2C_30(spriteId, tmp[0], args[0]);
+ }
break;
case 3:
args[0] = pop();
@@ -951,8 +974,34 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_groupNum(spriteId, args[0]);
break;
case 8:
- pop();
- pop();
+ args[1] = pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ switch(args[1]) {
+ case 0:
+ spriteInfoSet_flag7(spriteId, args[0]);
+ break;
+ case 1:
+ spriteInfoSet_flagRotated(spriteId, args[0]);
+ break;
+ case 2:
+ spriteInfoSet_flag8(spriteId, args[0]);
+ break;
+ case 3:
+ spriteInfoSet_flagZoomed(spriteId, args[0]);
+ break;
+ case 4:
+ spriteInfoSet_flag20(spriteId, args[0]);
+ break;
+ default:
+ break;
+ }
break;
case 9:
args[0] = pop();
@@ -989,7 +1038,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_resState(spriteId, args[0]);
break;
case 19:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ spriteInfoSet_rotAngle(spriteId, args[0]);
break;
case 23:
if (_gameId == GID_FREDDI4 || _heversion >= 99) {
@@ -1038,7 +1095,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_tx_ty(spriteId, args[0], args[1]);
break;
case 34:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ spriteInfoSet_flag31(spriteId, args[0]);
break;
case 43:
args[1] = pop();
@@ -1053,7 +1118,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_field_2C_30(spriteId, args[0], args[1]);
break;
case 48:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ spriteInfoSet_flag22(spriteId, args[0]);
break;
case 52: // HE 98+
args[0] = pop();
@@ -1078,7 +1151,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_zoom(spriteId, args[0]);
break;
case 63: // HE 98+
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ spriteInfoSet_field_78_64(spriteId, args[0]);
break;
case 64:
args[0] = pop();
@@ -1092,7 +1173,15 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_field_54(spriteId, args[0]);
break;
case 90:
- pop();
+ args[0] = pop();
+ if (_curSpriteId > _curMaxSpriteId)
+ break;
+ spriteId = _curSpriteId;
+ if (!spriteId)
+ spriteId++;
+
+ for (; spriteId <= _curMaxSpriteId; spriteId++)
+ spriteInfoSet_flags23_26(spriteId, args[0]);
break;
case 91:
getStackList(args, ARRAYSIZE(args));
@@ -1113,6 +1202,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() {
spriteInfoSet_field_80(spriteId, args[0]);
break;
case 124:
+ spritesResetTables(true);
break;
case 164:
args[1] = pop();
diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp
index b79fd7aaa1..d881a0783a 100644
--- a/scumm/sprite_he.cpp
+++ b/scumm/sprite_he.cpp
@@ -343,6 +343,111 @@ void ScummEngine_v90he::spriteInfoSet_zoom(int spriteNum, int value) {
}
}
+void ScummEngine_v90he::spriteInfoSet_rotAngle(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ _spriteTable[spriteNum].flags |= kSFRotated;
+
+ if (_spriteTable[spriteNum].rot_angle != value) {
+ _spriteTable[spriteNum].rot_angle = value;
+
+ if (_spriteTable[spriteNum].res_id)
+ _spriteTable[spriteNum].flags |= kSF01 | kSF02;
+ }
+}
+
+void ScummEngine_v90he::spriteInfoSet_flag22(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSF22;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF22);
+}
+
+void ScummEngine_v90he::spriteInfoSet_flag7(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSF07;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF07);
+
+ if (_spriteTable[spriteNum].res_id)
+ _spriteTable[spriteNum].flags |= kSF01 | kSF02;
+}
+
+void ScummEngine_v90he::spriteInfoSet_flagRotated(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSFRotated;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSFRotated);
+
+ if (_spriteTable[spriteNum].res_id)
+ _spriteTable[spriteNum].flags |= kSF01 | kSF02;
+}
+
+void ScummEngine_v90he::spriteInfoSet_flag8(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSF08;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF08);
+}
+
+void ScummEngine_v90he::spriteInfoSet_flagZoomed(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSFZoomed;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSFZoomed);
+
+ if (_spriteTable[spriteNum].res_id)
+ _spriteTable[spriteNum].flags |= kSF01 | kSF02;
+}
+
+void ScummEngine_v90he::spriteInfoSet_flag20(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSF20;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF20);
+
+ if (_spriteTable[spriteNum].res_id)
+ _spriteTable[spriteNum].flags |= kSF01 | kSF02;
+}
+
+void ScummEngine_v90he::spriteInfoSet_flags23_26(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ if (value)
+ _spriteTable[spriteNum].flags |= kSF23 | kSF26;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF23 | kSF26);
+}
+
+void ScummEngine_v90he::spriteInfoSet_flag31(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ // Note that condition is inverted
+ if (!value)
+ _spriteTable[spriteNum].flags |= kSF31;
+ else
+ _spriteTable[spriteNum].flags &= ~(kSF01 | kSF31);
+}
+
+void ScummEngine_v90he::spriteInfoSet_field_78_64(int spriteNum, int value) {
+ checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");
+
+ _spriteTable[spriteNum].field_78 = value;
+ _spriteTable[spriteNum].field_64 = value;
+}
+
void ScummEngine_v90he::spriteInfoSet_case183(int spriteNum) {
checkRange(_varNumSprites, 1, spriteNum, "Invalid sprite %d");