cyx's WIP for sprites. Implemented spritesBlitToScreen

svn-id: r16852
This commit is contained in:
Eugene Sandulenko 2005-02-22 01:16:41 +00:00
parent 6409a3c4e4
commit 6dd4854ba4
3 changed files with 60 additions and 9 deletions

View File

@ -935,9 +935,9 @@ protected:
void spritesAllocTables(int numSprites, int numGroups, int numImgSprites);
void spritesResetTables(bool refreshScreen);
void spriteGroupCheck(int sprGrpId);
void spriteMarkIfInGroup(int sprGrpId, uint32 flags);
void spriteGroupCheck(int spriteGroupId);
void spriteMarkIfInGroup(int spriteGroupId, uint32 flags);
void spritesBlitToScreen();
void spriteInfoSet_addImageToList(int spriteId, int imageNum, int *spriteIdptr);
/* HE version 90 script opcodes */

View File

@ -543,12 +543,63 @@ void ScummEngine_v90he::spritesResetTables(bool refreshScreen) {
_numSpritesToProcess = 0;
}
void ScummEngine_v90he::spriteGroupCheck(int sprGrpId) {
// XXX
void ScummEngine_v90he::spriteGroupCheck(int spriteGroupId) {
checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
}
void ScummEngine_v90he::spriteMarkIfInGroup(int sprGrpId, uint32 flags) {
// XXX
void ScummEngine_v90he::spriteMarkIfInGroup(int spriteGroupId, uint32 flags) {
checkRange(_varNumSpriteGroups, 1, spriteGroupId, "Invalid sprite group %d");
for (int i = 0; i < _numSpritesToProcess; ++i) {
SpriteInfo *spi = _activeSpritesTable[i];
if (spi->group_num == spriteGroupId) {
spi->flags |= flags;
}
}
}
void ScummEngine_v90he::spritesBlitToScreen() {
int xmin, xmax, ymin, ymax;
xmin = ymin = 1234;
xmax = ymax = -1234;
bool firstLoop = true;
bool refreshScreen = false;
for (int i = 0; i < _numSpritesToProcess; ++i) {
SpriteInfo *spi = _activeSpritesTable[i];
if (!(spi->flags & kSF31) && (spi->flags & kSF01)) {
spi->flags &= ~kSF01;
if (spi->bbox_xmin <= spi->bbox_xmax && spi->bbox_ymin <= spi->bbox_ymax) {
if (spi->flags & kSF26) {
gdi.copyVirtScreenBuffers(Common::Rect(spi->bbox_xmin, spi->bbox_ymin, spi->bbox_ymin, spi->bbox_ymax)); // XXX 0, 0x40000000);
}
} else if (firstLoop) {
xmin = spi->bbox_xmin;
ymin = spi->bbox_ymin;
xmax = spi->bbox_xmax;
ymax = spi->bbox_ymax;
firstLoop = false;
} else {
if (xmin < spi->bbox_xmin) {
xmin = spi->bbox_xmin;
}
if (ymin < spi->bbox_ymin) {
ymin = spi->bbox_ymin;
}
if (xmax > spi->bbox_xmax) {
xmax = spi->bbox_xmax;
}
if (ymax > spi->bbox_ymax) {
ymax = spi->bbox_ymax;
}
refreshScreen = true;
}
if (!(spi->flags & (kSF02 | kSF30)) && (spi->res_id != 0)) {
spi->flags |= kSF02;
}
}
}
if (refreshScreen) {
gdi.copyVirtScreenBuffers(Common::Rect(xmin, ymin, xmax, ymax)); // , 0, 0x40000000);
}
}
} // End of namespace Scumm

View File

@ -27,7 +27,7 @@ namespace Scumm {
enum SpriteFlags {
kSF01 = (1 << 0),
kSF02 = (1 << 1),
kSF02 = (1 << 1), // kSFNeedRedraw
kSF03 = (1 << 2),
kSF04 = (1 << 3),
kSFZoomed = (1 << 4),
@ -51,7 +51,7 @@ enum SpriteFlags {
kSF23 = (1 << 22),
kSF24 = (1 << 23),
kSF25 = (1 << 24),
kSF26 = (1 << 25),
kSF26 = (1 << 25), // kSFBlitDirectly
kSF27 = (1 << 26),
kSF28 = (1 << 27),
kSF29 = (1 << 28),