Add a few extra sprite correction and functions, based off HE100.

svn-id: r17536
This commit is contained in:
Travis Howell 2005-04-11 07:40:14 +00:00
parent 140a1d7c46
commit 0c5253c1eb
5 changed files with 68 additions and 35 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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");
if (type == 0x7B) {
_spriteTable[spriteId].field_88 = value;
_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;
// 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)),

View File

@ -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;