diff options
author | Travis Howell | 2006-04-21 03:09:21 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-21 03:09:21 +0000 |
commit | 6ea936c41f928347156dbfa0c8232deb005f34bc (patch) | |
tree | e3c6d175140bcfc69ea2b53b477f530cc9d2b005 /engines | |
parent | fc3284efce00c130de80c5522dde2055de423283 (diff) | |
download | scummvm-rg350-6ea936c41f928347156dbfa0c8232deb005f34bc.tar.gz scummvm-rg350-6ea936c41f928347156dbfa0c8232deb005f34bc.tar.bz2 scummvm-rg350-6ea936c41f928347156dbfa0c8232deb005f34bc.zip |
Add animate sprites by Y function for FF
svn-id: r22064
Diffstat (limited to 'engines')
-rw-r--r-- | engines/simon/simon.cpp | 79 | ||||
-rw-r--r-- | engines/simon/simon.h | 1 |
2 files changed, 78 insertions, 2 deletions
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 0aa93c4b11..aefb9080ac 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -2611,8 +2611,8 @@ void SimonEngine::animateSprites() { } if (getGameType() == GType_FF && getBitFlag(84)) { - // TODO - warning("Animation by Y value not supported"); + animateSpritesByY(); + return; } vsp = _vgaSprites; @@ -2690,6 +2690,81 @@ void SimonEngine::animateSpritesDebug() { _vcPtr = vc_ptr_org; } +void SimonEngine::animateSpritesByY() { + VgaSprite *vsp; + VgaPointersEntry *vpe; + const byte *vc_ptr_org = _vcPtr; + uint16 params[5]; // parameters to vc10 + int16 spriteTable[180][2]; + + byte *src; + int height, slot, y; + uint i, numSprites = 0; + + vsp = _vgaSprites; + while (vsp->id != 0) { + if (vsp->flags & kDFScaled) { + y = vsp->y; + } else { + y = vsp->priority; + vpe = &_vgaBufferPointers[vsp->zoneNum]; + src = vpe->vgaFile2 + vsp->image * 8; + height = READ_LE_UINT16(src + 4) & 0x7FFF; + y += height; + } + + spriteTable[numSprites][0] = y; + spriteTable[numSprites][1] = numSprites; + numSprites++; + vsp++; + } + + while(1) { + y = spriteTable[0][0]; + slot = spriteTable[0][1]; + + for (i = 0; i < numSprites; i++) { + if (y >= spriteTable[i][0]) { + y = spriteTable[i][0]; + slot = spriteTable[i][1]; + } + } + + if (y == 9999) + break; + + for (i = 0; i < numSprites; i++) { + if (slot == spriteTable[i][1]) { + spriteTable[i][0] = 9999; + break; + } + } + + vsp = &_vgaSprites[slot]; + vsp->windowNum &= 0x7FFF; + + vpe = &_vgaBufferPointers[vsp->zoneNum]; + _curVgaFile1 = vpe->vgaFile1; + _curVgaFile2 = vpe->vgaFile2; + _curSfxFile = vpe->sfxFile; + _windowNum = vsp->windowNum; + _vgaCurSpriteId = vsp->id; + _vgaCurSpritePriority = vsp->priority; + + params[0] = readUint16Wrapper(&vsp->image); + params[1] = readUint16Wrapper(&vsp->palette); + params[2] = readUint16Wrapper(&vsp->x); + params[3] = readUint16Wrapper(&vsp->y); + *(byte *)(¶ms[4]) = (byte)vsp->flags; + + _vcPtr = (const byte *)params; + vc10_draw(); + } + + _updateScreen++; + _vcPtr = vc_ptr_org; +} + void SimonEngine::scrollScreen() { byte *dst = getFrontBuf(); const byte *src; diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 677d97eb46..ffde748c37 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -1065,6 +1065,7 @@ protected: void animateSprites(); void animateSpritesDebug(); + void animateSpritesByY(); void dx_clear_surfaces(uint num_lines); void dx_update_screen_and_palette(); |