diff options
author | Travis Howell | 2005-04-11 07:40:14 +0000 |
---|---|---|
committer | Travis Howell | 2005-04-11 07:40:14 +0000 |
commit | 0c5253c1eb9182ca1af0c0f402d1dcb1f40cde9c (patch) | |
tree | 94c02e1e2612e0f1aaab83aa2a687e9b8289abe5 | |
parent | 140a1d7c4609251e671f442e75fd544ebc1ae809 (diff) | |
download | scummvm-rg350-0c5253c1eb9182ca1af0c0f402d1dcb1f40cde9c.tar.gz scummvm-rg350-0c5253c1eb9182ca1af0c0f402d1dcb1f40cde9c.tar.bz2 scummvm-rg350-0c5253c1eb9182ca1af0c0f402d1dcb1f40cde9c.zip |
Add a few extra sprite correction and functions, based off HE100.
svn-id: r17536
-rw-r--r-- | scumm/intern.h | 6 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 32 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 4 | ||||
-rw-r--r-- | scumm/sprite_he.cpp | 59 | ||||
-rw-r--r-- | scumm/sprite_he.h | 2 |
5 files changed, 68 insertions, 35 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 46d612b9c2..f8ed14a3f5 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -985,7 +985,7 @@ protected: int spriteInfoGet_delayAmount(int spriteId); int spriteInfoGet_field_7C(int spriteId); int spriteInfoGet_field_80(int spriteId); - int spriteInfoGet_field_88(int spriteId, int type); + int spriteInfoGet_field_8C_90(int spriteId, int type); void getSpriteImageDim(int spriteId, int32 &w, int32 &h); void spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty); void spriteInfoGet_dx_dy(int spriteId, int32 &dx, int32 &dy); @@ -1022,10 +1022,10 @@ protected: void spriteInfoSet_flagMarkDirty(int spriteId, int value); void spriteInfoSet_flagHasImage(int spriteId, int value); void spriteInfoSet_delay(int spriteId, int value); - void spriteInfoSet_setClassFlags(int spriteId, int value); void spriteInfoSet_setClassFlag(int spriteId, int classId, int toggle); void spriteInfoSet_resetClassFlags(int spriteId); - void spriteInfoSet_field_88(int spriteId, int type, int value); + void spriteInfoSet_field_84(int spriteId, int value); + void spriteInfoSet_field_8C_90(int spriteId, int type, int value); void redrawSpriteGroup(int spriteGroupId); void spriteGroupSet_case0_0(int spriteGroupId, int value1, int value2); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 7831c46eb5..4217385073 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -1726,7 +1726,6 @@ void ScummEngine_v100he::o100_setSpriteInfo() { int args[16]; int spriteId, n; int32 tmp[2]; - static int storedFields[2]; byte string[80]; byte subOp = fetchScriptByte(); @@ -1889,9 +1888,16 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteInfoSet_resetSprite(spriteId); break; case 54: - // TODO - pop(); - pop(); + args[1] = pop(); + args[0] = pop(); + if (_curSpriteId > _curMaxSpriteId) + break; + spriteId = _curSpriteId; + if (!spriteId) + spriteId++; + + for (; spriteId <= _curMaxSpriteId; spriteId++) + spriteInfoSet_field_8C_90(spriteId, args[0], args[1]); break; case 57: args[0] = pop(); @@ -2003,7 +2009,6 @@ void ScummEngine_v100he::o100_setSpriteInfo() { for (; spriteId <= _curMaxSpriteId; spriteId++) { spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - storedFields[0] = tmp[0]; spriteInfoSet_dx_dy(spriteId, args[0], tmp[1]); } break; @@ -2017,7 +2022,6 @@ void ScummEngine_v100he::o100_setSpriteInfo() { for (; spriteId <= _curMaxSpriteId; spriteId++) { spriteInfoGet_dx_dy(spriteId, tmp[0], tmp[1]); - storedFields[1] = tmp[1]; spriteInfoSet_dx_dy(spriteId, tmp[0], args[0]); } break; @@ -2053,7 +2057,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_setClassFlags(spriteId, args[0]); + spriteInfoSet_field_84(spriteId, args[0]); break; case 89: if (_curSpriteId > _curMaxSpriteId) @@ -2063,7 +2067,7 @@ void ScummEngine_v100he::o100_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_resetClassFlags(spriteId); + spriteInfoSet_field_84(spriteId, 0); break; default: error("o100_setSpriteInfo: Unknown case %d", subOp); @@ -2288,7 +2292,7 @@ void ScummEngine_v100he::o100_getSpriteGroupInfo() { push(0); break; case 54: - // TODO + // TODO: U32 related pop(); pop(); push(0); @@ -2613,10 +2617,12 @@ void ScummEngine_v100he::o100_getSpriteInfo() { push(0); break; case 54: - // TODO - pop(); - pop(); - push(0); + flags = pop(); + spriteId = pop(); + if (spriteId) + push(spriteInfoGet_field_8C_90(spriteId, flags)); + else + push(0); break; case 57: spriteId = pop(); diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 05cb6f51f1..4802cf3989 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -969,7 +969,7 @@ void ScummEngine_v90he::o90_getSpriteInfo() { flags = pop(); spriteId = pop(); if (spriteId) - push(spriteInfoGet_field_88(spriteId, flags)); + push(spriteInfoGet_field_8C_90(spriteId, flags)); else push(0); break; @@ -1284,7 +1284,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { spriteId++; for (; spriteId <= _curMaxSpriteId; spriteId++) - spriteInfoSet_field_88(spriteId, args[0], args[1]); + spriteInfoSet_field_8C_90(spriteId, args[0], args[1]); break; case 106: // HE 99+ args[0] = pop(); diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index b0e4f035fa..589cc765c4 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -372,13 +372,21 @@ int ScummEngine_v90he::spriteInfoGet_field_80(int spriteId) { return _spriteTable[spriteId].field_80; } -int ScummEngine_v90he::spriteInfoGet_field_88(int spriteId, int type) { +int ScummEngine_v90he::spriteInfoGet_field_8C_90(int spriteId, int type) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); - if (type == 0x7B) - return _spriteTable[spriteId].field_88; - else - return 0; + // XXX U32 related check + + switch(type) { + case 0x7B: + return _spriteTable[spriteId].field_8C; + case 0x7D: + return _spriteTable[spriteId].field_90; + case 0x7E: + return _spriteTable[spriteId].delayCount; + default: + error("spriteInfoGet_field_8C_90: Invalid type %d", type); + } } void ScummEngine_v90he::getSpriteImageDim(int spriteId, int32 &w, int32 &h) { @@ -709,12 +717,6 @@ void ScummEngine_v90he::spriteInfoSet_delay(int spriteId, int value) { _spriteTable[spriteId].delayCount = value; } -void ScummEngine_v90he::spriteInfoSet_setClassFlags(int spriteId, int value) { - checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); - - _spriteTable[spriteId].classFlags = value; -} - void ScummEngine_v90he::spriteInfoSet_setClassFlag(int spriteId, int classId, int toggle) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); checkRange(32, 1, classId, "class %d out of range in statement"); @@ -732,12 +734,35 @@ void ScummEngine_v90he::spriteInfoSet_resetClassFlags(int spriteId) { _spriteTable[spriteId].classFlags = 0; } -void ScummEngine_v90he::spriteInfoSet_field_88(int spriteId, int type, int value) { +void ScummEngine_v90he::spriteInfoSet_field_84(int spriteId, int value) { + checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + + _spriteTable[spriteId].field_84 = value; +} + +void ScummEngine_v90he::spriteInfoSet_field_8C_90(int spriteId, int type, int value) { checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d"); + int delay; - if (type == 0x7B) { - _spriteTable[spriteId].field_88 = value; + // XXX U32 related check + + switch(type) { + case 0x7B: + _spriteTable[spriteId].field_8C = value; + _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; + break; + case 0x7D: + _spriteTable[spriteId].field_90 = value; _spriteTable[spriteId].flags |= kSFChanged | kSFNeedRedraw; + break; + case 0x7E: + delay = MAX(0, value); + delay = MIN(value, _spriteTable[spriteId].delayAmount); + + _spriteTable[spriteId].delayCount = value; + break; + default: + error("spriteInfoSet_field_8C_90: Invalid value %d", type); } } @@ -767,7 +792,9 @@ void ScummEngine_v90he::spriteInfoSet_resetSprite(int spriteId) { _spriteTable[spriteId].field_7C = 0; _spriteTable[spriteId].field_80 = 0; _spriteTable[spriteId].zorderPriority = 0; - _spriteTable[spriteId].field_88 = 0; + _spriteTable[spriteId].field_84 = 0; + _spriteTable[spriteId].field_8C = 0; + _spriteTable[spriteId].field_90 = 0; } void ScummEngine_v90he::spriteAddImageToList(int spriteId, int imageNum, int *spriteIdptr) { @@ -1394,8 +1421,8 @@ void ScummEngine_v90he::saveOrLoadSpriteData(Serializer *s, uint32 savegameVersi MKLINE(SpriteInfo, delayAmount, sleInt32, VER(48)), MKLINE(SpriteInfo, field_7C, sleInt32, VER(48)), MKLINE(SpriteInfo, field_80, sleInt32, VER(48)), + MKLINE(SpriteInfo, field_84, sleInt32, VER(48)), MKLINE(SpriteInfo, classFlags, sleInt32, VER(48)), - MKLINE(SpriteInfo, field_88, sleInt32, VER(48)), MKLINE(SpriteInfo, field_8C, sleInt32, VER(48)), MKLINE(SpriteInfo, field_90, sleInt32, VER(48)), MKLINE(SpriteInfo, field_94, sleInt32, VER(48)), diff --git a/scumm/sprite_he.h b/scumm/sprite_he.h index ce950fc3f5..5c0af87ebd 100644 --- a/scumm/sprite_he.h +++ b/scumm/sprite_he.h @@ -77,8 +77,8 @@ struct SpriteInfo { int32 delayAmount; int32 field_7C; int32 field_80; + int32 field_84; int32 classFlags; - int32 field_88; int32 field_8C; int32 field_90; int32 field_94; |