SCUMM: HE: Re-implement WIZ text and Aux images

This commit is contained in:
AndywinXp 2024-03-17 23:33:52 +01:00 committed by Eugene Sandulenko
parent 0ae4143e6f
commit 9dd2ea4e43
19 changed files with 825 additions and 307 deletions

View File

@ -107,7 +107,7 @@ static const byte v0WalkboxSlantedModifier[0x16] = {
Actor::Actor(ScummEngine *scumm, int id) :
_vm(scumm), _number(id), _visible(false), _shadowMode(0), _flip(false), _frame(0), _walkbox(0), _talkPosX(0), _talkPosY(0),
_talkScript(0), _walkScript(0), _ignoreTurns(false), _drawToBackBuf(false), _layer(0), _heOffsX(0), _heOffsY(0), _heSkipLimbs(false),
_heCondMask(0), _hePaletteNum(0), _heXmapNum(0), _elevation(0), _facing(0), _targetFacing(0), _speedx(0), _speedy(0),
_heCondMask(0), _hePaletteNum(0), _heShadow(0), _elevation(0), _facing(0), _targetFacing(0), _speedx(0), _speedy(0),
_animProgress(0), _animSpeed(0), _costumeNeedsInit(false) {
assert(_vm != nullptr);
}
@ -130,7 +130,7 @@ void ActorHE::initActor(int mode) {
_heSkipLimbs = false;
}
_heXmapNum = 0;
_heShadow = 0;
_hePaletteNum = 0;
_heFlags = 0;
_heTalking = false;
@ -140,7 +140,11 @@ void ActorHE::initActor(int mode) {
_clipOverride = ((ScummEngine_v60he *)_vm)->_actorClipOverride;
_auxBlock.reset();
_auxActor = 0;
_auxEraseX1 = 0;
_auxEraseY1 = 0;
_auxEraseX2 = -1;
_auxEraseY2 = -1;
}
void Actor::initActor(int mode) {
@ -1682,7 +1686,7 @@ void Actor::putActor(int dstX, int dstY, int newRoom) {
} else {
#ifdef ENABLE_HE
if (_vm->_game.heversion >= 71)
((ScummEngine_v71he *)_vm)->queueAuxBlock((ActorHE *)this);
((ScummEngine_v71he *)_vm)->heQueueEraseAuxActor((ActorHE *)this);
#endif
hideActor();
}
@ -2091,7 +2095,11 @@ void Actor::hideActor() {
void ActorHE::hideActor() {
Actor::hideActor();
_auxBlock.reset();
_auxActor = 0;
_auxEraseX1 = 0;
_auxEraseY1 = 0;
_auxEraseX2 = -1;
_auxEraseY2 = -1;
}
void Actor::showActor() {
@ -2355,7 +2363,7 @@ void ScummEngine_v6::processActors() {
void ScummEngine_v71he::processActors() {
heFlushAuxEraseQueue();
if (!_skipProcessActors)
if (!_disableActorDrawingFlag)
ScummEngine_v6::processActors();
_fullRedraw = false;
@ -2369,7 +2377,7 @@ void ScummEngine_v90he::processActors() {
_sprite->checkForForcedRedraws(false);
_sprite->renderSprites(true);
if (!_skipProcessActors)
if (!_disableActorDrawingFlag)
ScummEngine_v6::processActors();
_fullRedraw = false;
@ -2441,7 +2449,7 @@ void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) {
bcr->_shadowTable = _vm->_shadowPalette;
}
bcr->setCostume(_costume, (_vm->_game.heversion == 0) ? 0 : _heXmapNum);
bcr->setCostume(_costume, (_vm->_game.heversion == 0) ? 0 : _heShadow);
bcr->setPalette(_palette);
bcr->setFacing(this);
@ -2592,7 +2600,11 @@ void Actor::startAnimActor(int f) {
if (_vm->_game.version >= 3 && f == _initFrame) {
_cost.reset();
if (_vm->_game.heversion != 0) {
((ActorHE *)this)->_auxBlock.reset();
((ActorHE *)this)->_auxActor = 0;
((ActorHE *)this)->_auxEraseX1 = 0;
((ActorHE *)this)->_auxEraseY1 = 0;
((ActorHE *)this)->_auxEraseX2 = -1;
((ActorHE *)this)->_auxEraseY2 = -1;
}
}
_vm->_costumeLoader->costumeDecodeData(this, f, (uint) - 1);
@ -2835,7 +2847,7 @@ void ScummEngine::setActorRedrawFlags() {
} else {
if (_game.heversion >= 72) {
for (j = 1; j < _numActors; j++) {
if (_actors[j]->_costume && _actors[j]->_heXmapNum)
if (_actors[j]->_costume && _actors[j]->_heShadow)
_actors[j]->_needRedraw = true;
}
}
@ -3194,9 +3206,14 @@ void ActorHE::setActorCostume(int c) {
if (_vm->_game.features & GF_NEW_COSTUMES) {
#ifdef ENABLE_HE
if (_vm->_game.heversion >= 71)
((ScummEngine_v71he *)_vm)->queueAuxBlock(this);
((ScummEngine_v71he *)_vm)->heQueueEraseAuxActor(this);
#endif
_auxBlock.reset();
_auxActor = 0;
_auxEraseX1 = 0;
_auxEraseY1 = 0;
_auxEraseX2 = -1;
_auxEraseY2 = -1;
if (_visible) {
if (_vm->_game.heversion >= 60)
_needRedraw = true;
@ -3511,104 +3528,437 @@ bool ActorHE::isTalkConditionSet(int slot) const {
#ifdef ENABLE_HE
void ScummEngine_v71he::heFlushAuxEraseQueue() {
if (!_skipProcessActors) {
for (int i = 0; i < _auxBlocksNum; ++i) {
AuxBlock *ab = &_auxBlocks[i];
if (ab->r.top <= ab->r.bottom) {
backgroundToForegroundBlit(ab->r);
}
if (_disableActorDrawingFlag) {
_heAuxEraseActorIndex = 0;
return;
}
// Erase any AUX frames that were marked to be erased...
for (int i = 0; i < _heAuxEraseActorIndex; i++) {
if (_heAuxEraseActorTable[i].y1 <= _heAuxEraseActorTable[i].y2) {
Common::Rect blitRect(
_heAuxEraseActorTable[i].x1, _heAuxEraseActorTable[i].y1,
_heAuxEraseActorTable[i].x2, _heAuxEraseActorTable[i].y2);
backgroundToForegroundBlit(blitRect);
}
}
_auxBlocksNum = 0;
_heAuxEraseActorIndex = 0;
}
void ScummEngine_v71he::heFlushAuxQueues() {
if (!_skipProcessActors) {
for (int i = 0; i < _auxEntriesNum; ++i) {
AuxEntry *ae = &_auxEntries[i];
if (ae->actorNum != -1) {
ActorHE *a = (ActorHE *)derefActor(ae->actorNum, "postProcessAuxQueue");
const uint8 *cost = getResourceAddress(rtCostume, a->_costume);
int dy = a->_heOffsY + a->getPos().y;
int dx = a->_heOffsX + a->getPos().x;
int x, y, w, h, type, whichActor;
int updateRects, xOffset, yOffset;
byte *costumeAddress;
const byte *auxDataBlockPtr;
const byte *auxDataPtr;
const byte *auxFrameDataPtr;
const byte *auxUpdateRectPtr;
byte *foregroundBufferPtr;
byte *backgroundBufferPtr;
const byte *auxEraseRectPtr;
bool drewSomething;
VirtScreen *pvs = &_virtscr[kMainVirtScreen];
if (_game.heversion >= 72)
dy -= a->getElevation();
if (_disableActorDrawingFlag) {
_heAuxAnimTableIndex = 0;
return;
}
const uint8 *akax = findResource(MKTAG('A','K','A','X'), cost);
assert(akax);
const uint8 *auxd = findPalInPals(akax, ae->subIndex) - _resourceHeaderSize;
assert(auxd);
const uint8 *frel = findResourceData(MKTAG('F','R','E','L'), auxd);
if (frel) {
error("unhandled FREL block");
}
const uint8 *disp = findResourceData(MKTAG('D','I','S','P'), auxd);
if (disp) {
error("unhandled DISP block");
}
const uint8 *axfd = findResourceData(MKTAG('A','X','F','D'), auxd);
assert(axfd);
// Render queued animations...
for (int i = 0; i < _heAuxAnimTableIndex; i++) {
whichActor = _heAuxAnimTable[i].actor;
if (whichActor == -1)
continue;
uint16 comp = READ_LE_UINT16(axfd);
if (comp != 0) {
int x = (int16)READ_LE_UINT16(axfd + 2) + dx;
int y = (int16)READ_LE_UINT16(axfd + 4) + dy;
int w = (int16)READ_LE_UINT16(axfd + 6);
int h = (int16)READ_LE_UINT16(axfd + 8);
VirtScreen *pvs = &_virtscr[kMainVirtScreen];
uint8 *dst1 = pvs->getPixels(0, pvs->topline);
uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
switch (comp) {
case 1:
// TODO: Wiz::copyAuxImage(dst1, dst2, axfd + 10, pvs->pitch, pvs->h, x, y, w, h, _bytesPerPixel);
break;
default:
error("unimplemented compression type %d", comp);
}
}
const uint8 *axur = findResourceData(MKTAG('A','X','U','R'), auxd);
if (axur) {
uint16 n = READ_LE_UINT16(axur); axur += 2;
while (n--) {
int x1 = (int16)READ_LE_UINT16(axur + 0) + dx;
int y1 = (int16)READ_LE_UINT16(axur + 2) + dy;
int x2 = (int16)READ_LE_UINT16(axur + 4) + dx;
int y2 = (int16)READ_LE_UINT16(axur + 6) + dy;
markRectAsDirty(kMainVirtScreen, x1, x2, y1, y2 + 1);
axur += 8;
}
}
const uint8 *axer = findResourceData(MKTAG('A','X','E','R'), auxd);
if (axer) {
a->_auxBlock.visible = true;
a->_auxBlock.r.left = (int16)READ_LE_UINT16(axer + 0) + dx;
a->_auxBlock.r.top = (int16)READ_LE_UINT16(axer + 2) + dy;
a->_auxBlock.r.right = (int16)READ_LE_UINT16(axer + 4) + dx;
a->_auxBlock.r.bottom = (int16)READ_LE_UINT16(axer + 6) + dy;
}
ActorHE *a = (ActorHE *)derefActor(whichActor, "heFlushAuxQueues");
costumeAddress = getResourceAddress(rtCostume, a->_costume);
xOffset = a->_heOffsX + a->getPos().x - pvs->xstart;
yOffset = a->_heOffsY + a->getPos().y;
if (_game.heversion >= 72) {
yOffset -= a->getElevation();
}
auxDataBlockPtr = findResourceData(MKTAG('A', 'K', 'A', 'X'), costumeAddress);
if (!auxDataBlockPtr) {
error("heFlushAuxQueue(): NO AKAX block actor %d!", whichActor);
}
auxDataPtr = findPalInPals(auxDataBlockPtr, _heAuxAnimTable[i].auxIndex);
if (!auxDataPtr) {
error("heFlushAuxQueue(): NO AUXD block actor %d!", whichActor);
}
// Check the type of the AUXD block...
auxFrameDataPtr = findResourceData(MKTAG('A', 'X', 'F', 'D'), auxDataPtr);
if (!auxFrameDataPtr) {
warning("heFlushAuxQueue(): NO AXFD block actor %d; ignoring...", whichActor);
continue;
}
auxFrameDataPtr += _resourceHeaderSize;
type = READ_LE_UINT16(auxFrameDataPtr);
drewSomething = false;
if ((type == AKOS_AUXD_TYPE_DRLE_FRAME) || (type == AKOS_AUXD_TYPE_SRLE_FRAME)) {
x = xOffset + (int16)READ_LE_UINT16(auxFrameDataPtr + 2);
y = yOffset + (int16)READ_LE_UINT16(auxFrameDataPtr + 4);
w = READ_LE_UINT16(auxFrameDataPtr + 6);
h = READ_LE_UINT16(auxFrameDataPtr + 8);
auxFrameDataPtr += 10;
// Call the render function to go to the main buffer...
foregroundBufferPtr = pvs->getPixels(0, pvs->topline);
backgroundBufferPtr = pvs->getBackPixels(0, pvs->topline);
if (type == AKOS_AUXD_TYPE_SRLE_FRAME) {
error("Unimplemented compression type actor %d!", whichActor);
} else if (type == AKOS_AUXD_TYPE_DRLE_FRAME) {
_wiz->auxDecompDRLEImage(
(WizRawPixel *)foregroundBufferPtr, (WizRawPixel *)backgroundBufferPtr, auxFrameDataPtr,
pvs->w, pvs->h, x, y, w, h, nullptr, nullptr);
} else {
error("Unimplemented compression type actor %d!", whichActor);
}
drewSomething = true;
}
// Add any update rects to the list for the final blit(s)
auxUpdateRectPtr = findResourceData(MKTAG('A', 'X', 'U', 'R'), auxDataPtr);
if (!auxUpdateRectPtr) {
continue;
}
auxUpdateRectPtr += _resourceHeaderSize;
updateRects = READ_LE_UINT16(auxUpdateRectPtr);
auxUpdateRectPtr += 2;
for (int rectCounter = 0; rectCounter < updateRects; rectCounter++) {
markRectAsDirty(
kMainVirtScreen,
xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 0),
xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 4),
yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 2),
yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 6));
auxUpdateRectPtr += 8;
}
// Set the actors erase info...
auxEraseRectPtr = findResourceData(MKTAG('A', 'X', 'E', 'R'), auxDataPtr);
if (!auxEraseRectPtr) {
continue;
}
auxEraseRectPtr += _resourceHeaderSize;
a->_auxActor = 1;
a->_auxEraseX1 = xOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 0);
a->_auxEraseY1 = yOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 2);
a->_auxEraseX2 = xOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 4);
a->_auxEraseY2 = yOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 6);
}
_heAuxAnimTableIndex = 0;
}
void ScummEngine_v90he::heFlushAuxQueues() {
// TODO: VERIFY HE95
if (_game.heversion < 98) {
ScummEngine_v71he::heFlushAuxQueues();
return;
}
int x, y, w, h, type, whichActor;
int updateRects, xOffset, yOffset;
byte *costumeAddress;
const byte *auxDataPtr;
const byte *auxFrameDataPtr;
const byte *auxUpdateRectPtr;
WizRawPixel *foregroundBufferPtr;
WizRawPixel *backgroundBufferPtr;
const byte *auxEraseRectPtr;
const byte *colorTablePtr;
bool drewSomething;
HEAnimAuxData auxInfo;
int actorBits;
const WizRawPixel *conversionTablePtr;
VirtScreen *pvs = &_virtscr[kMainVirtScreen];
if (_disableActorDrawingFlag) {
_heAuxAnimTableIndex = 0;
return;
}
// Render queued animations...
for (int i = 0; i < _heAuxAnimTableIndex; i++, heAuxReleaseAuxDataInfo(&auxInfo)) {
actorBits = 0;
whichActor = _heAuxAnimTable[i].actor;
if (whichActor == -1)
continue;
ActorHE *a = (ActorHE *)derefActor(whichActor, "heFlushAuxQueues");
if (_game.heversion > 99 && a->_hePaletteNum) {
conversionTablePtr = (WizRawPixel *)getHEPaletteSlot(a->_hePaletteNum);
} else {
conversionTablePtr = (WizRawPixel *)getHEPaletteSlot(1);
}
costumeAddress = getResourceAddress(rtCostume, a->_costume);
xOffset = a->_heOffsX + a->getPos().x - pvs->xstart;
yOffset = a->_heOffsY + a->getPos().y;
if (_game.heversion >= 72) {
yOffset -= a->getElevation();
}
// Get the frame data ptr
heAuxGetAuxDataInfo(&auxInfo, whichActor, _heAuxAnimTable[i].auxIndex);
// Check the type of the AUXD block...
auxFrameDataPtr = heAuxFindBlock(&auxInfo, MKTAG('A', 'X', 'F', 'D'));
if (!auxFrameDataPtr) {
warning("heFlushAuxQueue(): NO AXFD block actor %d; ignoring...", whichActor);
continue;
}
auxFrameDataPtr += _resourceHeaderSize;
type = READ_LE_UINT16(auxFrameDataPtr);
drewSomething = false;
if ((type == AKOS_AUXD_TYPE_DRLE_FRAME) ||
(type == AKOS_AUXD_TYPE_SRLE_FRAME) ||
(type == AKOS_AUXD_TYPE_WRLE_FRAME)) {
x = xOffset + (int16)READ_LE_UINT16(auxFrameDataPtr + 2);
y = yOffset + (int16)READ_LE_UINT16(auxFrameDataPtr + 4);
w = READ_LE_UINT16(auxFrameDataPtr + 6);
h = READ_LE_UINT16(auxFrameDataPtr + 8);
auxFrameDataPtr += 10;
// Call the render function to go to the main buffer...
foregroundBufferPtr = (WizRawPixel *)pvs->getPixels(0, pvs->topline);
backgroundBufferPtr = (WizRawPixel *)pvs->getBackPixels(0, pvs->topline);
if (type == AKOS_AUXD_TYPE_SRLE_FRAME) {
colorTablePtr = heAuxFindBlock(&auxInfo, MKTAG('C', 'L', 'R', 'S'));
if (!colorTablePtr) {
error("heFlushAuxQueue(): NO CLRS block actor %d!", whichActor);
}
colorTablePtr += _resourceHeaderSize;
if ((x != 0) || (y != 0) || (w != 640) || (h != 480)) {
error("heFlushAuxQueue(): Actor %d invalid (%d,%d)[%d,%d]", whichActor, x, y, w, h);
}
_wiz->auxDecompSRLEStream(
foregroundBufferPtr, backgroundBufferPtr, colorTablePtr,
auxFrameDataPtr, w * h,
conversionTablePtr);
} else if (type == AKOS_AUXD_TYPE_DRLE_FRAME) {
_wiz->auxDecompDRLEImage(
(WizRawPixel *)foregroundBufferPtr, (WizRawPixel *)backgroundBufferPtr, auxFrameDataPtr,
pvs->w, pvs->h, x, y, w, h, nullptr, conversionTablePtr);
} else if (AKOS_AUXD_TYPE_WRLE_FRAME == type) {
// Where is the color table?
if ((x != 0) || (w != 640)) {
error("heFlushAuxQueue(): Actor %d invalid (%d,%d)[%d,%d]", whichActor, x, y, w, h);
}
// Where is the color table?
colorTablePtr = auxFrameDataPtr;
auxFrameDataPtr += 32;
// Handle the uncompress
_wiz->auxWRLEUncompressPixelStream(
foregroundBufferPtr + (y * 640),
colorTablePtr, auxFrameDataPtr, (w * h),
conversionTablePtr);
actorBits = a->_number;
a->_needRedraw = true;
} else {
error("heFlushAuxQueue(): Unimplemented compression type actor %d!", whichActor);
}
drewSomething = true;
}
// Add any update rects to the list for the final blit(s)
auxUpdateRectPtr = heAuxFindBlock(&auxInfo, MKTAG('A', 'X', 'U', 'R'));
if (!auxUpdateRectPtr) {
continue;
}
auxUpdateRectPtr += _resourceHeaderSize;
updateRects = READ_LE_UINT16(auxUpdateRectPtr);
auxUpdateRectPtr += 2;
for (int rectCounter = 0; rectCounter < updateRects; rectCounter++) {
markRectAsDirty(
kMainVirtScreen,
xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 0),
xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 4),
yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 2),
yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 6),
actorBits);
// TODO: Is this really needed?
//setActorUpdateArea(
// whichActor,
// xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 0),
// yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 2),
// xOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 4),
// yOffset + (int16)READ_LE_UINT16(auxUpdateRectPtr + 6));
auxUpdateRectPtr += 8;
}
// Set the actors erase info...
auxEraseRectPtr = heAuxFindBlock(&auxInfo, MKTAG('A', 'X', 'E', 'R'));
if (!auxEraseRectPtr) {
continue;
}
auxEraseRectPtr += _resourceHeaderSize;
a->_auxActor = 1;
a->_auxEraseX1 = xOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 0);
a->_auxEraseY1 = yOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 2);
a->_auxEraseX2 = xOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 4);
a->_auxEraseY2 = yOffset + (int16)READ_LE_UINT16(auxEraseRectPtr + 6);
}
_heAuxAnimTableIndex = 0;
}
const byte *ScummEngine_v90he::heAuxFindBlock(HEAnimAuxData *auxInfoPtr, int32 id) {
const byte *resultPtr;
// Search the external block thing
if (auxInfoPtr->externalDataPtr) {
resultPtr = findResourceData(id, auxInfoPtr->externalDataPtr);
if (resultPtr)
return resultPtr;
}
// Search the current block first
resultPtr = findResourceData(id, auxInfoPtr->auxDataBlock);
if (resultPtr)
return resultPtr;
// If the alt search isn't the same search there...
if (auxInfoPtr->auxDataBlock == auxInfoPtr->auxDefaultSearchBlock) {
return resultPtr;
}
// Search the default block
return findResourceData(id, auxInfoPtr->auxDefaultSearchBlock);
}
void ScummEngine_v90he::heAuxReleaseAuxDataInfo(HEAnimAuxData *auxInfoPtr) {
auxInfoPtr->auxDefaultSearchBlock = nullptr;
auxInfoPtr->auxDataBlock = nullptr;
if (auxInfoPtr->externalDataPtr) {
free(auxInfoPtr->externalDataPtr);
auxInfoPtr->externalDataPtr = nullptr;
}
}
bool ScummEngine_v90he::heAuxProcessFileRelativeBlock(HEAnimAuxData *auxInfoPtr, const byte *dataBlockPtr) {
error("heAuxProcessFileRelativeBlock(): This looks like a development path! If you end up here, please report it in our bug tracker!");
}
bool ScummEngine_v90he::heAuxProcessDisplacedBlock(HEAnimAuxData *auxInfoPtr, const byte *displacedBlockPtr) {
error("heAuxProcessDisplacedBlock(): This looks like a development path! If you end up here, please report it in our bug tracker!");
}
void ScummEngine_v90he::heAuxGetAuxDataInfo(HEAnimAuxData *auxInfoPtr, int whichActor, int auxIndex) {
const byte *fileRelativeDataBlockPtr;
const byte *displacedBlockPtr;
const byte *auxDataBlockPtr;
const byte *auxDataPtr;
byte *costumeAddress;
// Store off some of the passed in info
auxInfoPtr->externalDataPtr = nullptr;
auxInfoPtr->actor = whichActor;
// Get the interesting data
ActorHE *a = (ActorHE *)derefActor(whichActor, "heAuxGetAuxDataInfo");
costumeAddress = getResourceAddress(rtCostume, a->_costume);
auxDataBlockPtr = findResourceData(MKTAG('A', 'K', 'A', 'X'), costumeAddress);
if (!auxDataBlockPtr) {
error("heAuxGetAuxDataInfo(): NO AKAX block actor %d!", whichActor);
}
auxDataPtr = findPalInPals(auxDataBlockPtr, auxIndex);
if (!auxDataPtr) {
error("heAuxGetAuxDataInfo():NO AUXD block actor %d!", whichActor);
}
// Check for other outside block types
fileRelativeDataBlockPtr = findResourceData(MKTAG('F', 'R', 'E', 'L'), auxDataPtr);
if (fileRelativeDataBlockPtr) {
if (!heAuxProcessFileRelativeBlock(auxInfoPtr, fileRelativeDataBlockPtr)) {
error("heAuxGetAuxDataInfo(): Actor %d aux %d failed", whichActor, auxIndex);
}
}
_auxEntriesNum = 0;
// This is where the DISP block will be processed!
displacedBlockPtr = findResourceData(MKTAG('D', 'I', 'S', 'P'), auxDataPtr);
if (displacedBlockPtr) {
if (!heAuxProcessDisplacedBlock(auxInfoPtr, displacedBlockPtr)) {
error("heAuxGetAuxDataInfo(): Actor %d aux %d failed", whichActor, auxIndex);
}
}
// Fill in the data result
auxInfoPtr->auxDefaultSearchBlock = costumeAddress;
auxInfoPtr->auxDataBlock = auxDataPtr;
}
void ScummEngine_v71he::queueAuxBlock(ActorHE *a) {
if (!a->_auxBlock.visible)
void ScummEngine_v71he::heQueueEraseAuxActor(ActorHE *a) {
if (_heAuxEraseActorIndex >= ARRAYSIZE(_heAuxEraseActorTable)) {
warning("heQueueEraseAuxActor(): Queue full, ignoring...");
return;
}
assert(_auxBlocksNum < ARRAYSIZE(_auxBlocks));
_auxBlocks[_auxBlocksNum] = a->_auxBlock;
++_auxBlocksNum;
if (a->_auxActor) {
_heAuxEraseActorTable[_heAuxEraseActorIndex].actor = a->_number;
_heAuxEraseActorTable[_heAuxEraseActorIndex].x1 = a->_auxEraseX1;
_heAuxEraseActorTable[_heAuxEraseActorIndex].y1 = a->_auxEraseY1;
_heAuxEraseActorTable[_heAuxEraseActorIndex].x2 = a->_auxEraseX2;
_heAuxEraseActorTable[_heAuxEraseActorIndex].y2 = a->_auxEraseY2;
_heAuxEraseActorIndex++;
}
}
void ScummEngine_v71he::queueAuxEntry(int actorNum, int subIndex) {
assert(_auxEntriesNum < ARRAYSIZE(_auxEntries));
AuxEntry *ae = &_auxEntries[_auxEntriesNum];
ae->actorNum = actorNum;
ae->subIndex = subIndex;
++_auxEntriesNum;
void ScummEngine_v71he::heQueueAnimAuxFrame(int actor, int auxIndex) {
if (_heAuxAnimTableIndex >= ARRAYSIZE(_heAuxAnimTable)) {
warning("HEQueueAnimAuxFrame(): Queue full, ignoring...");
return;
}
_heAuxAnimTable[_heAuxAnimTableIndex].actor = actor;
_heAuxAnimTable[_heAuxAnimTableIndex].auxIndex = auxIndex;
_heAuxAnimTableIndex++;
}
#endif
void Actor_v0::animateActor(int anim) {
@ -3847,7 +4197,7 @@ void Actor::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsByte(_costumeNeedsInit, VER(8));
s.syncAsUint32LE(_heCondMask, VER(38));
s.syncAsUint32LE(_hePaletteNum, VER(59));
s.syncAsUint32LE(_heXmapNum, VER(59));
s.syncAsUint32LE(_heShadow, VER(59));
s.syncAsSint16LE(_talkPosY, VER(8));
s.syncAsSint16LE(_talkPosX, VER(8));

View File

@ -142,7 +142,7 @@ public:
bool _heSkipLimbs;
uint32 _heCondMask;
uint32 _hePaletteNum;
uint32 _heXmapNum;
uint32 _heShadow;
protected:
struct ActorWalkData {

View File

@ -27,26 +27,29 @@
namespace Scumm {
struct AuxBlock {
bool visible;
Common::Rect r;
void reset() {
visible = false;
r.left = r.top = 0;
r.right = r.bottom = -1;
}
void clear() {
reset();
r.right = 0;
r.bottom = 0;
}
struct HEEraseAuxEntry {
int actor;
int32 x1, y1, x2, y2;
};
struct AuxEntry {
int actorNum;
int subIndex;
struct HEAnimAuxEntry {
int actor;
int auxIndex;
};
struct HEAnimAuxData {
byte *auxDefaultSearchBlock;
byte *externalDataPtr;
const byte *auxDataBlock;
int actor;
};
struct HEAuxFileRelInfo {
int globFileOffset;
Common::File fileHandle;
int globType;
int globNum;
int roomNum;
};
class ActorHE : public Actor {
@ -78,7 +81,8 @@ public:
bool _heTalking;
byte _heFlags;
AuxBlock _auxBlock;
int _auxActor;
int32 _auxEraseX1, _auxEraseY1, _auxEraseX2, _auxEraseY2;
struct {
int16 posX;

View File

@ -1365,7 +1365,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int limb, const byte *aksq, con
curState += aksq[curState + 2];
break;
case AKC_DisplayAuxFrame:
akos_queCommand(7, a, GW(2), 0);
akos_queCommand(AKQC_DisplayAuxFrame, a, GW(2), 0);
curState += 4;
break;
default:
@ -1681,7 +1681,7 @@ void ScummEngine_v6::akos_processQueue() {
case AKQC_DisplayAuxFrame:
#ifdef ENABLE_HE
assert(_game.heversion >= 71);
((ScummEngine_v71he *)this)->queueAuxEntry(a->_number, param1);
((ScummEngine_v71he *)this)->heQueueAnimAuxFrame(a->_number, param1);
#endif
break;
case AKQC_StartTalkie:

View File

@ -31,6 +31,11 @@ namespace Scumm {
#define AKOS_RUN_MAJMIN_CODEC 16
#define AKOS_TRLE_CODEC 32
#define AKOS_AUXD_TYPE_EMPTY_FRAME 0x0000
#define AKOS_AUXD_TYPE_DRLE_FRAME 0x0001
#define AKOS_AUXD_TYPE_SRLE_FRAME 0x0010
#define AKOS_AUXD_TYPE_WRLE_FRAME 0x0020
struct CostumeData;
struct AkosHeader;
struct AkosOffset;

View File

@ -1204,6 +1204,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
if ((_vm->_game.heversion >= 71 && _bitsPerPixel >= 8) || (_vm->_game.heversion >= 90 && _bitsPerPixel == 0)) {
#ifdef ENABLE_HE
// TODO: FIX ZPLANE
if (ignoreCharsetMask || !vs->hasTwoBuffers) {
dstPtr = vs->getPixels(0, 0);
} else {
@ -1214,20 +1215,48 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
dstPtr = vs->getBackPixels(0, 0);
}
Common::Rect rScreen(vs->w, vs->h);
if (_bitsPerPixel >= 8) {
byte imagePalette[256];
memset(imagePalette, 0, sizeof(imagePalette));
memcpy(imagePalette, _vm->_charsetColorMap, 4);
// TODO: Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, imagePalette, NULL, _vm->_bytesPerPixel);
byte *colorLookupTable;
byte generalColorLookupTable[256];
int black = _vm->VAR_COLOR_BLACK != 0xFF ? _vm->VAR(_vm->VAR_COLOR_BLACK) : 0;
memset(generalColorLookupTable, black, sizeof(generalColorLookupTable));
for (int i = 0; i < 4; i++) {
generalColorLookupTable[i] = _vm->_charsetColorMap[i];
}
generalColorLookupTable[1] = _color;
if (_bitsPerPixel || _vm->_game.heversion < 90) {
colorLookupTable = generalColorLookupTable;
} else {
// TODO: Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, NULL, NULL, _vm->_bytesPerPixel);
colorLookupTable = nullptr;
}
if (_blitAlso && vs->hasTwoBuffers) {
Common::Rect dst(_left, _top, _left + origWidth, _top + origHeight);
((ScummEngine_v71he *)_vm)->backgroundToForegroundBlit(dst);
if (ignoreCharsetMask && vs->hasTwoBuffers) {
((ScummEngine_v71he *)_vm)->_wiz->pgDrawWarpDrawLetter(
(WizRawPixel *)dstPtr,
vs->w, vs->h,
charPtr, _left, drawTop, origWidth, origHeight,
colorLookupTable);
Common::Rect blitRect(_left, drawTop, _left + origWidth - 1, drawTop + origHeight);
((ScummEngine_v71he *)_vm)->backgroundToForegroundBlit(blitRect);
} else {
((ScummEngine_v71he *)_vm)->_wiz->pgDrawWarpDrawLetter((WizRawPixel *)dstPtr,
vs->w, vs->h,
charPtr, _left, drawTop, origWidth, origHeight,
colorLookupTable);
}
if (_vm->_game.heversion >= 80) {
if ((vs->number == kMainVirtScreen && !_blitAlso) || _vm->_game.heversion <= 90) {
((ScummEngine_v71he *)_vm)->_wiz->auxDrawZplaneFromTRLEImage(
dstPtr, charPtr,
_vm->_textSurface.w, _vm->_textSurface.h,
_left, drawTop, origWidth, origHeight,
nullptr, kWZOIgnore, kWZOSet);
}
}
#endif
} else {
Graphics::Surface dstSurface;

View File

@ -2559,7 +2559,7 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y,
// TODO: Wiz::copyWizImage(dst, bmap_ptr, vs->pitch, kDstScreen, vs->w, vs->h, x - scrX, y, w, h, &rScreen, 0, 0, 0, _vm->_bytesPerPixel);
((ScummEngine_v71he *)_vm)->_wiz->auxDecompTRLEImage(
dst, bmap_ptr, vs->w, vs->h,
x, y, w, h, &rScreen,
x - scrX, y, w, h, &rScreen,
nullptr);
}

View File

@ -376,7 +376,7 @@ void Wiz::auxDecompSRLEStream(WizRawPixel *destStream, const WizRawPixel *backgr
}
}
void Wiz::auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, const WizRawPixel *conversionTable) {
void Wiz::auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, const byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, const WizRawPixel *conversionTable) {
Common::Rect sourceRect, destRect, clipRect, workRect;
sourceRect.left = 0;
@ -390,7 +390,7 @@ void Wiz::auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *back
destRect.bottom = y + height - 1;
// Custom clip rect...
if (!clipRectPtr) {
if (clipRectPtr) {
clipRect = *clipRectPtr;
workRect.left = 0;
workRect.top = 0;
@ -431,7 +431,7 @@ void Wiz::auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *back
&destRect, compData, &sourceRect, conversionTable);
}
void Wiz::auxDecompDRLEPrim(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, int bufferWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, const WizRawPixel *conversionTable) {
void Wiz::auxDecompDRLEPrim(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, int bufferWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, const WizRawPixel *conversionTable) {
int decompWidth, decompHeight, counter, sX1, dX1, dX2, lineSize;
WizRawPixel8 *foregroundBuffer8 = (WizRawPixel8 *)foregroundBufferPtr;
WizRawPixel16 *foregroundBuffer16 = (WizRawPixel16 *)foregroundBufferPtr;
@ -509,7 +509,7 @@ void Wiz::auxDecompTRLEImage(WizRawPixel *bufferPtr, const byte *compData, int b
destRect.bottom = y + height - 1;
// Custom clip rect...
if (!clipRectPtr) {
if (clipRectPtr) {
clipRect = *clipRectPtr;
workRect.left = 0;
workRect.top = 0;
@ -601,7 +601,7 @@ void Wiz::auxDecompTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rec
}
void Wiz::auxDrawZplaneFromTRLEImage(byte *zplanePtr, byte *compData, int zplanePixelWidth, int zplanePixelHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int transOp, int solidOp) {
void Wiz::auxDrawZplaneFromTRLEImage(byte *zplanePtr, const byte *compData, int zplanePixelWidth, int zplanePixelHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int transOp, int solidOp) {
Common::Rect sourceRect, destRect, clipRect, workRect;
sourceRect.left = 0;
@ -615,7 +615,7 @@ void Wiz::auxDrawZplaneFromTRLEImage(byte *zplanePtr, byte *compData, int zplane
destRect.bottom = y + height - 1;
// Custom clip rect...
if (!clipRectPtr) {
if (clipRectPtr) {
clipRect = *clipRectPtr;
workRect.left = 0;
@ -657,7 +657,7 @@ void Wiz::auxDrawZplaneFromTRLEImage(byte *zplanePtr, byte *compData, int zplane
zplanePtr, zplanePixelWidth, &destRect, compData, &sourceRect, transOp, solidOp);
}
void Wiz::auxDrawZplaneFromTRLEPrim(byte *zplanePtr, int zplanePixelWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, int transOp, int solidOp) {
void Wiz::auxDrawZplaneFromTRLEPrim(byte *zplanePtr, int zplanePixelWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, int transOp, int solidOp) {
int decompWidth, decompHeight, counter, sX1, dX1, dX2, lineSize, mask, zplaneWidth;
// General setup...
@ -694,7 +694,7 @@ void Wiz::auxDrawZplaneFromTRLEPrim(byte *zplanePtr, int zplanePixelWidth, Commo
}
}
void Wiz::auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, byte *remapTable, const WizRawPixel *conversionTable) {
void Wiz::auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, const byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, byte *remapTable, const WizRawPixel *conversionTable) {
Common::Rect sourceRect, destRect, clipRect, workRect;
sourceRect.left = 0;
@ -708,7 +708,7 @@ void Wiz::auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, byte *compData, int
destRect.bottom = y + height - 1;
// Custom clip rect...
if (!clipRectPtr) {
if (clipRectPtr) {
clipRect = *clipRectPtr;
workRect.left = 0;
@ -751,7 +751,7 @@ void Wiz::auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, byte *compData, int
conversionTable);
}
void Wiz::auxDecompRemappedTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, byte *remapTable, const WizRawPixel *conversionTable) {
void Wiz::auxDecompRemappedTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, byte *remapTable, const WizRawPixel *conversionTable) {
int decompWidth, decompHeight, sX1, dX1, dX2, lineSize;
WizRawPixel8 *buffer8 = (WizRawPixel8 *)bufferPtr;
WizRawPixel16 *buffer16 = (WizRawPixel16 *)bufferPtr;
@ -950,7 +950,7 @@ void Wiz::auxDecompMixColorsTRLEImage(WizRawPixel *bufferPtr, byte *compData, in
destRect.bottom = y + height - 1;
// Custom clip rect...
if (!clipRectPtr) {
if (clipRectPtr) {
clipRect = *clipRectPtr;
workRect.left = 0;
@ -1043,7 +1043,7 @@ void Wiz::auxDecompMixColorsTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Co
}
}
void Wiz::auxDecompDRLEStream(WizRawPixel *destPtr, byte *dataStream, WizRawPixel *backgroundPtr, int skipAmount, int decompAmount, const WizRawPixel *conversionTable) {
void Wiz::auxDecompDRLEStream(WizRawPixel *destPtr, const byte *dataStream, WizRawPixel *backgroundPtr, int skipAmount, int decompAmount, const WizRawPixel *conversionTable) {
int runCount;
WizRawPixel8 *dest8 = (WizRawPixel8 *)destPtr;
WizRawPixel16 *dest16 = (WizRawPixel16 *)destPtr;
@ -1278,7 +1278,7 @@ void Wiz::auxDecompTRLEStream(WizRawPixel *destPtr, const byte *dataStream, int
}
}
void Wiz::auxDecompRemappedTRLEStream(WizRawPixel *destPtr, byte *dataStream, int skipAmount, int decompAmount, byte *remapTable, const WizRawPixel *conversionTable) {
void Wiz::auxDecompRemappedTRLEStream(WizRawPixel *destPtr, const byte *dataStream, int skipAmount, int decompAmount, byte *remapTable, const WizRawPixel *conversionTable) {
int runCount;
WizRawPixel8 *dest8 = (WizRawPixel8 *)destPtr;
WizRawPixel16 *dest16 = (WizRawPixel16 *)destPtr;
@ -1383,7 +1383,7 @@ void Wiz::auxDecompRemappedTRLEStream(WizRawPixel *destPtr, byte *dataStream, in
}
void Wiz::auxZplaneFromTRLEStream(byte *destPtr, byte *dataStream, int skipAmount, int decompAmount, int mask, int transOp, int solidOp) {
void Wiz::auxZplaneFromTRLEStream(byte *destPtr, const byte *dataStream, int skipAmount, int decompAmount, int mask, int transOp, int solidOp) {
int runCount;
// Decompress bytes to do simple clipping...
@ -1687,7 +1687,7 @@ void Wiz::auxHistogramTRLEPrim(int *histogramTablePtr, byte *compData, Common::R
}
}
void Wiz::auxRemappedMemcpy(WizRawPixel *dstPtr, byte *srcPtr, int count, byte *remapTable, const WizRawPixel *conversionTable) {
void Wiz::auxRemappedMemcpy(WizRawPixel *dstPtr, const byte *srcPtr, int count, byte *remapTable, const WizRawPixel *conversionTable) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;

View File

@ -615,7 +615,6 @@ void Wiz::pgSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpl
d16 = ((WizRawPixel16 *)destBM->bufferPtr) + destRect->top * dw + destRect->left;
s16 = ((WizRawPixel16 *)sourceBM->bufferPtr) + sourceRect->top * sw + sourceRect->left;
// Going up or down?
if (sourceRect->top > sourceRect->bottom) {
sw = -sw;
@ -909,6 +908,23 @@ void Wiz::pgTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRec
}
}
void Wiz::pgDrawWarpDrawLetter(WizRawPixel *bitmapBuffer, int bitmapWidth, int bitmapHeight, const byte *charData, int x1, int y1, int width, int height, byte *colorLookupTable) {
WizRawPixel *remapTable = (_vm->_game.heversion <= 90) ? nullptr : (WizRawPixel *)_vm->getHEPaletteSlot(1);
if (colorLookupTable) {
auxDecompRemappedTRLEImage(
bitmapBuffer, charData, bitmapWidth, bitmapHeight, x1, y1, width, height, nullptr,
colorLookupTable,
remapTable
);
} else {
auxDecompTRLEImage(
bitmapBuffer, charData, bitmapWidth, bitmapHeight, x1, y1, width, height, nullptr,
remapTable
);
}
}
void Wiz::pgDraw8BppFormatImage(WizRawPixel *bufferPtr, const byte *rawData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int32 wizFlags, const void *extraTable, int transparentColor, const WizRawPixel *conversionTable) {
Common::Rect srcRect, dstRect, clipRect;
WizSimpleBitmap srcBitmap, dstBitmap;
@ -991,16 +1007,17 @@ void Wiz::pgDraw8BppFormatImage(WizRawPixel *bufferPtr, const byte *rawData, int
void Wiz::pgDraw8BppSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, const WizRawPixel *conversionTable) {
int x, cw, dw, sw, ch;
const byte *s;
WizRawPixel *d;
const WizRawPixel8 *s8; // Source is always 8-bit
WizRawPixel16 *d16; // Dest is always 16-bit
// Common calcs...
dw = destBM->bitmapWidth;
sw = sourceBM->bitmapWidth;
cw = abs(sourceRect->right - sourceRect->left) + 1;
ch = abs(sourceRect->bottom - sourceRect->top) + 1;
d = destBM->bufferPtr + destRect->top * dw + destRect->left;
s = ((const byte *)sourceBM->bufferPtr) + sourceRect->top * sw + sourceRect->left;
d16 = ((WizRawPixel16 *)destBM->bufferPtr) + destRect->top * dw + destRect->left;
s8 = ((const WizRawPixel8 *)sourceBM->bufferPtr) + sourceRect->top * sw + sourceRect->left;
// Going up or down?
if (sourceRect->top > sourceRect->bottom) {
@ -1010,10 +1027,10 @@ void Wiz::pgDraw8BppSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect,
// Left or right?
if (sourceRect->left <= sourceRect->right) {
while (--ch >= 0) {
memcpy8BppConversion(d, s, cw, conversionTable);
memcpy8BppConversion(d16, s8, cw, conversionTable);
d += dw;
s += sw;
d16 += dw;
s8 += sw;
}
} else {
dw -= cw;
@ -1021,27 +1038,29 @@ void Wiz::pgDraw8BppSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect,
while (--ch >= 0) {
for (x = cw; --x >= 0;) {
*d++ = convert8BppToRawPixel(*s--, conversionTable);
*d16 = (WizRawPixel16)convert8BppToRawPixel((WizRawPixel)*s8, conversionTable);
d16++;
s8--;
}
d += dw;
s += sw;
d16 += dw;
s8 += sw;
}
}
}
void Wiz::pgDraw8BppTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, int transparentColor, const WizRawPixel *conversionTable) {
int cw, dw, sw, ch, soff, doff, value;
const byte *s;
WizRawPixel *d;
const WizRawPixel8 *s8; // Source is always 8-bit
WizRawPixel16 *d16; // Dest is always 16-bit
// Common calcs...
dw = destBM->bitmapWidth;
sw = sourceBM->bitmapWidth;
cw = abs(sourceRect->right - sourceRect->left) + 1;
ch = abs(sourceRect->bottom - sourceRect->top) + 1;
d = destBM->bufferPtr + destRect->top * dw + destRect->left;
s = ((const byte *)sourceBM->bufferPtr) + sourceRect->top * sw + sourceRect->left;
d16 = ((WizRawPixel16 *)destBM->bufferPtr) + destRect->top * dw + destRect->left;
s8 = ((const WizRawPixel8 *)sourceBM->bufferPtr) + sourceRect->top * sw + sourceRect->left;
// Going up or down?
if (sourceRect->top > sourceRect->bottom) {
@ -1055,17 +1074,17 @@ void Wiz::pgDraw8BppTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect
while (--ch >= 0) {
for (int x = cw; --x >= 0;) {
value = *s++;
value = *s8++;
if (value != transparentColor) {
*d++ = convert8BppToRawPixel(value, conversionTable);
*d16++ = (WizRawPixel16)convert8BppToRawPixel((WizRawPixel)value, conversionTable);
} else {
d++;
d16++;
}
}
s += soff;
d += doff;
s8 += soff;
d16 += doff;
}
} else {
soff = sw + cw;
@ -1073,22 +1092,25 @@ void Wiz::pgDraw8BppTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect
while (--ch >= 0) {
for (int x = cw; --x >= 0;) {
value = *s--;
value = *s8--;
if (value != transparentColor) {
*d++ = convert8BppToRawPixel(value, conversionTable);
*d16++ = (WizRawPixel16)convert8BppToRawPixel((WizRawPixel)value, conversionTable);
} else {
d++;
d16++;
}
}
s += soff;
d += doff;
s8 += soff;
d16 += doff;
}
}
}
void Wiz::pgDrawImageWith16BitZBuffer(WizSimpleBitmap *psbDst, const WizSimpleBitmap *psbZBuffer, const byte *imgData, int x, int y, int z, int width, int height, Common::Rect *prcClip) {
// validate parameters
// This is available only on HE100+, which hopefully means it should only be called for 16-bit games
assert(_uses16BitColor);
// Validate parameters
assert(psbDst && psbZBuffer && imgData && prcClip);
// z-buffer and destination buffer must have the same dimensions
@ -1120,14 +1142,13 @@ void Wiz::pgDrawImageWith16BitZBuffer(WizSimpleBitmap *psbDst, const WizSimpleBi
// perform the drawing
int dstWidth = psbDst->bitmapWidth; // same for destination and Z buffer
const int drawWidth = (prcClip->right - prcClip->left + 1);
const int drawHeight = (prcClip->bottom - prcClip->top + 1);
WizRawPixel *pSrc = (WizRawPixel *)imgData + (prcClip->top - y) * width + (prcClip->left - x);
WizRawPixel *pDst = (WizRawPixel *)psbDst->bufferPtr + prcClip->top * dstWidth + prcClip->left;
WizRawPixel *pZB = (WizRawPixel *)psbZBuffer->bufferPtr + prcClip->top * dstWidth + prcClip->left;
const int drawWidth = (prcClip->right - prcClip->left + 1);
const int drawHeight = (prcClip->bottom - prcClip->top + 1);
for (int row = 0; row < drawHeight; ++row) {
for (int col = 0; col < drawWidth; ++col, ++pZB, ++pDst, ++pSrc) {
// left hand rule - don't draw unless we're closer than the z-buffer value
@ -1145,41 +1166,53 @@ void Wiz::pgDrawImageWith16BitZBuffer(WizSimpleBitmap *psbDst, const WizSimpleBi
void Wiz::pgForewordRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
*dstPtr++ = *(lookupTable + *srcPtr++);
*dst8++ = *(lookupTable + *src8++);
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
*dstPtr++ = *srcPtr++;
*dst16++ = *src16++;
}
}
}
void Wiz::pgTransparentForewordRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, WizRawPixel transparentColor, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel8 srcColor = *src8++;
if (transparentColor != srcColor) {
WizRawPixel remappedColor = *(lookupTable + srcColor);
WizRawPixel8 remappedColor = *(lookupTable + srcColor);
if (transparentColor != remappedColor) {
*dstPtr++ = remappedColor;
*dst8++ = remappedColor;
} else {
++dstPtr;
++dst8;
}
} else {
++dstPtr;
++dst8;
}
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel16 srcColor = *src16++;
if (transparentColor != srcColor) {
*dstPtr++ = srcColor;
*dst16++ = srcColor;
} else {
++dstPtr;
++dst16;
}
}
}
@ -1187,29 +1220,35 @@ void Wiz::pgTransparentForewordRemapPixelCopy(WizRawPixel *dstPtr, const WizRawP
void Wiz::pgTransparentBackwardsRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, WizRawPixel transparentColor, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel srcColor = *src8++;
if (transparentColor != srcColor) {
WizRawPixel remappedColor = *(lookupTable + srcColor);
WizRawPixel8 remappedColor = *(lookupTable + srcColor);
if (transparentColor != remappedColor) {
*dstPtr-- = remappedColor;
*dst8-- = remappedColor;
} else {
--dstPtr;
--dst8;
}
} else {
--dstPtr;
--dst8;
}
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel16 srcColor = *src16++;
if (transparentColor != srcColor) {
*dstPtr-- = srcColor;
*dst16-- = srcColor;
} else {
--dstPtr;
--dst16;
}
}
}
@ -1217,32 +1256,44 @@ void Wiz::pgTransparentBackwardsRemapPixelCopy(WizRawPixel *dstPtr, const WizRaw
void Wiz::pgBackwardsRemapPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
*dstPtr-- = *(lookupTable + *srcPtr++);
*dst8-- = *(lookupTable + *src8++);
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
*dstPtr-- = *srcPtr++;
*dst16-- = *src16++;
}
}
}
void Wiz::pgForewordMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
*dstPtr++ = *(lookupTable + ((*srcPtr++) * 256) + *dstPtr);
*dst8++ = *(lookupTable + ((*src8++) * 256) + *dst8);
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
if (_vm->_game.heversion > 99) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel dstColor = *dstPtr;
WizRawPixel16 srcColor = *src16++;
WizRawPixel16 dstColor = *dst16;
*dstPtr++ = WIZRAWPIXEL_50_50_MIX(
*dst16++ = WIZRAWPIXEL_50_50_MIX(
WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
} else {
*dstPtr++ = (*srcPtr++);
*dst16++ = (*src16++);
}
}
}
@ -1250,20 +1301,26 @@ void Wiz::pgForewordMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *s
void Wiz::pgBackwardsMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
*dstPtr-- = *(lookupTable + ((*srcPtr++) * 256) + *dstPtr);
*dst8-- = *(lookupTable + ((*src8++) * 256) + *dst8);
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
if (_vm->_game.heversion > 99) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel dstColor = *dstPtr;
WizRawPixel16 srcColor = *src16++;
WizRawPixel16 dstColor = *dst16;
*dstPtr-- = WIZRAWPIXEL_50_50_MIX(
*dst16-- = WIZRAWPIXEL_50_50_MIX(
WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
} else {
*dstPtr-- = (*srcPtr++);
*dst16-- = (*src16++);
}
}
}
@ -1271,33 +1328,39 @@ void Wiz::pgBackwardsMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *
void Wiz::pgTransparentForewordMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, WizRawPixel transparentColor, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel8 srcColor = *src8++;
if (transparentColor != srcColor) {
WizRawPixel resultColor = *(lookupTable + (srcColor * 256) + *dstPtr);
WizRawPixel8 resultColor = *(lookupTable + (srcColor * 256) + *dst8);
if (transparentColor != resultColor) {
*dstPtr++ = resultColor;
*dst8++ = resultColor;
} else {
++dstPtr;
++dst8;
}
} else {
++dstPtr;
++dst8;
}
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel16 srcColor = *src16++;
if (transparentColor != srcColor) {
WizRawPixel dstColor = *dstPtr;
WizRawPixel16 dstColor = *dst16;
*dstPtr++ = WIZRAWPIXEL_50_50_MIX(
*dst16++ = WIZRAWPIXEL_50_50_MIX(
WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
} else {
++dstPtr;
++dst16;
}
}
}
@ -1305,57 +1368,97 @@ void Wiz::pgTransparentForewordMixColorsPixelCopy(WizRawPixel *dstPtr, const Wiz
void Wiz::pgTransparentBackwardsMixColorsPixelCopy(WizRawPixel *dstPtr, const WizRawPixel *srcPtr, int size, WizRawPixel transparentColor, const byte *lookupTable) {
if (!_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel8 srcColor = *src8++;
if (transparentColor != srcColor) {
WizRawPixel resultColor = *(lookupTable + (srcColor * 256) + *dstPtr);
WizRawPixel8 resultColor = *(lookupTable + (srcColor * 256) + *dst8);
if (transparentColor != resultColor) {
*dstPtr-- = resultColor;
*dst8-- = resultColor;
} else {
--dstPtr;
--dst8;
}
} else {
--dstPtr;
--dst8;
}
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
while (size-- > 0) {
WizRawPixel srcColor = *srcPtr++;
WizRawPixel16 srcColor = *src16++;
if (transparentColor != srcColor) {
WizRawPixel dstColor = *dstPtr;
WizRawPixel16 dstColor = *dst16;
*dstPtr-- = WIZRAWPIXEL_50_50_MIX(
*dst16-- = WIZRAWPIXEL_50_50_MIX(
WIZRAWPIXEL_50_50_PREMIX_COLOR(srcColor),
WIZRAWPIXEL_50_50_PREMIX_COLOR(dstColor));
} else {
--dstPtr;
--dst16;
}
}
}
}
static void pgBlitForwardSrcArbitraryDstPixelTransfer(Wiz *wiz, WizRawPixel *dstPtr, int dstStep, const WizRawPixel *srcPtr, int count, const void *userParam, const void *userParam2) {
for (int i = 0; i < count; i++) {
*dstPtr = *srcPtr++;
dstPtr += dstStep;
if (!wiz->_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
for (int i = 0; i < count; i++) {
*dst8 = *src8++;
dst8 += dstStep;
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
for (int i = 0; i < count; i++) {
*dst16 = *src16++;
dst16 += dstStep;
}
}
}
static void pgBlitForwardSrcArbitraryDstTransparentPixelTransfer(Wiz *wiz, WizRawPixel *dstPtr, int dstStep, const WizRawPixel *srcPtr, int count, const void *userParam, const void *userParam2) {
WizRawPixel transparentColor, color;
transparentColor = *((const WizRawPixel *)userParam);
if (!wiz->_uses16BitColor) {
WizRawPixel8 *dst8 = (WizRawPixel8 *)dstPtr;
const WizRawPixel8 *src8 = (const WizRawPixel8 *)srcPtr;
for (int i = 0; i < count; i++) {
color = *srcPtr++;
WizRawPixel8 transparentColor, color;
transparentColor = *((const WizRawPixel8 *)userParam);
if (transparentColor != color) {
*dstPtr = color;
for (int i = 0; i < count; i++) {
color = *src8++;
if (transparentColor != color) {
*dst8 = color;
}
dst8 += dstStep;
}
} else {
WizRawPixel16 *dst16 = (WizRawPixel16 *)dstPtr;
const WizRawPixel16 *src16 = (const WizRawPixel16 *)srcPtr;
dstPtr += dstStep;
WizRawPixel16 transparentColor, color;
transparentColor = *((const WizRawPixel16 *)userParam);
for (int i = 0; i < count; i++) {
color = *src16++;
if (transparentColor != color) {
*dst16 = color;
}
dst16 += dstStep;
}
}
}
@ -1377,8 +1480,11 @@ void Wiz::pgBlit90DegreeRotateCore(WizSimpleBitmap *dstBitmap, int x, int y, con
Common::Rect dstRect, srcRect, clipRect, clippedDstRect, clippedSrcRect;
int dstOffset, dstStep, w, h, srcOffset, dstX, dstY;
const WizRawPixel *srcPtr;
WizRawPixel *dstPtr;
const WizRawPixel8 *src8;
WizRawPixel8 *dst8;
const WizRawPixel16 *src16;
WizRawPixel16 *dst16;
// Do as much pre-clipping as possible
makeSizedRect(&clipRect, dstBitmap->bitmapWidth, dstBitmap->bitmapHeight);
@ -1433,19 +1539,30 @@ void Wiz::pgBlit90DegreeRotateCore(WizSimpleBitmap *dstBitmap, int x, int y, con
}
// Finally get down to business and do the blit!
dstPtr = dstBitmap->bufferPtr + dstX + (dstY * dstBitmap->bitmapWidth);
srcPtr = srcBitmap->bufferPtr + clippedSrcRect.left + (clippedSrcRect.top * srcBitmap->bitmapWidth);
w = getRectWidth(&clippedSrcRect);
h = getRectHeight(&clippedSrcRect);
// Transfer the src line to the dest line using the passed transfer prim.
srcOffset = srcBitmap->bitmapWidth;
while (--h >= 0) {
(*srcTransferFP)(this, dstPtr, dstStep, srcPtr, w, userParam, userParam2);
dstPtr += dstOffset;
srcPtr += srcOffset;
if (!_uses16BitColor) {
dst8 = ((WizRawPixel8 *)dstBitmap->bufferPtr) + dstX + (dstY * dstBitmap->bitmapWidth);
src8 = ((WizRawPixel8 *)srcBitmap->bufferPtr) + clippedSrcRect.left + (clippedSrcRect.top * srcBitmap->bitmapWidth);
while (--h >= 0) {
(*srcTransferFP)(this, (WizRawPixel *)dst8, dstStep, (WizRawPixel *)src8, w, userParam, userParam2);
dst8 += dstOffset;
src8 += srcOffset;
}
} else {
dst16 = ((WizRawPixel16 *)dstBitmap->bufferPtr) + dstX + (dstY * dstBitmap->bitmapWidth);
src16 = ((WizRawPixel16 *)srcBitmap->bufferPtr) + clippedSrcRect.left + (clippedSrcRect.top * srcBitmap->bitmapWidth);
while (--h >= 0) {
(*srcTransferFP)(this, (WizRawPixel *)dst16, dstStep, (WizRawPixel *)src16, w, userParam, userParam2);
dst16 += dstOffset;
src16 += srcOffset;
}
}
}

View File

@ -26,7 +26,7 @@
#ifdef ENABLE_HE
#include "scumm/he/wiz_he.h"
#endif
#include "scumm/actor_he.h" // For AuxBlock & AuxEntry
#include "scumm/actor_he.h" // For HEEraseAuxEntry & HEAnimAuxEntry
namespace Common {
class SeekableReadStream;
@ -275,7 +275,7 @@ protected:
SO_SET_POLYGON_LOCAL = 248,
};
bool _skipProcessActors;
bool _disableActorDrawingFlag;
public:
ScummEngine_v71he(OSystem *syst, const DetectorResult &dr);
@ -298,7 +298,7 @@ protected:
void processActors() override;
void heFlushAuxEraseQueue();
void heFlushAuxQueues();
virtual void heFlushAuxQueues();
void clearDrawQueues() override;
@ -321,13 +321,13 @@ protected:
byte VAR_WIZ_TRANSPARENT_COLOR;
public:
/* Actor AuxQueue stuff (HE) */
AuxBlock _auxBlocks[16];
uint16 _auxBlocksNum;
AuxEntry _auxEntries[16];
uint16 _auxEntriesNum;
HEEraseAuxEntry _heAuxEraseActorTable[16];
int _heAuxEraseActorIndex = 0;
HEAnimAuxEntry _heAuxAnimTable[16];
int _heAuxAnimTableIndex = 0;
void queueAuxBlock(ActorHE *a);
void queueAuxEntry(int actorNum, int subIndex);
void heQueueEraseAuxActor(ActorHE *a);
void heQueueAnimAuxFrame(int actorNum, int subIndex);
void remapHEPalette(const uint8 *src, uint8 *dst);
};
@ -680,6 +680,12 @@ protected:
void setResourceOffHeap(int typeId, int resId, int val);
void processActors() override;
void heFlushAuxQueues() override;
const byte *heAuxFindBlock(HEAnimAuxData *auxInfoPtr, int32 id);
void heAuxReleaseAuxDataInfo(HEAnimAuxData *auxInfoPtr);
void heAuxGetAuxDataInfo(HEAnimAuxData *auxInfoPtr, int whichActor, int auxIndex);
bool heAuxProcessFileRelativeBlock(HEAnimAuxData *auxInfoPtr, const byte *dataBlockPtr);
bool heAuxProcessDisplacedBlock(HEAnimAuxData *auxInfoPtr, const byte *displacedBlockPtr);
void getArrayDim(int array, int *dim2start, int *dim2end, int *dim1start, int *dim1end);
void sortArray(int array, int dim2start, int dim2end, int dim1start, int dim1end, int sortOrder);

View File

@ -313,6 +313,11 @@ void ScummEngine_v90he::readMAXS(int blockSize) {
_numSprites = _fileHandle->readUint16LE();
_numLocalScripts = _fileHandle->readUint16LE();
_HEHeapSize = _fileHandle->readUint16LE();
// In the original, this is hardcoded as well...
if (_game.heversion > 90)
_numPalettes = 16;
_numNewNames = 10;
_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);

View File

@ -428,7 +428,7 @@ void ScummEngine_v100he::o100_actorOps() {
a->setScale(i, i);
break;
case SO_SHADOW:
a->_heXmapNum = pop();
a->_heShadow = pop();
a->_needRedraw = true;
break;
case SO_STEP_DIST:

View File

@ -183,7 +183,7 @@ void ScummEngine_v71he::o71_kernelSetFunctions() {
break;
case 20: // HE72+
a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 20");
queueAuxBlock(a);
heQueueEraseAuxActor(a);
break;
case 21:
_skipDrawObject = 1;
@ -196,33 +196,33 @@ void ScummEngine_v71he::o71_kernelSetFunctions() {
_fullRedraw = true;
break;
case 24:
_skipProcessActors = 1;
_disableActorDrawingFlag = 1;
redrawAllActors();
break;
case 25:
_skipProcessActors = 0;
_disableActorDrawingFlag = 0;
redrawAllActors();
break;
case 26:
a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 26");
a->_auxBlock.r.left = 0;
a->_auxBlock.r.right = -1;
a->_auxBlock.r.top = 0;
a->_auxBlock.r.bottom = -2;
a->_auxEraseX1 = 0;
a->_auxEraseY1 = -1;
a->_auxEraseX2 = 0;
a->_auxEraseY2 = -2;
break;
case 30:
a = (ActorHE *)derefActor(args[1], "o71_kernelSetFunctions: 30");
a->_clipOverride.bottom = args[2];
break;
case 42:
_wiz->_lUseWizClipRect = true;
_wiz->_lWizClipRect.left = args[1];
_wiz->_lWizClipRect.top = args[2];
_wiz->_lWizClipRect.right = args[3];
_wiz->_lWizClipRect.bottom = args[4];
_wiz->_useWizClipRect = true;
_wiz->_wizClipRect.left = args[1];
_wiz->_wizClipRect.top = args[2];
_wiz->_wizClipRect.right = args[3];
_wiz->_wizClipRect.bottom = args[4];
break;
case 43:
_wiz->_lUseWizClipRect = false;
_wiz->_useWizClipRect = false;
break;
default:
error("o71_kernelSetFunctions: default case %d (param count %d)", args[0], num);

View File

@ -959,7 +959,7 @@ void ScummEngine_v72he::o72_actorOps() {
a->setAnimSpeed(pop());
break;
case SO_SHADOW:
a->_heXmapNum = pop();
a->_heShadow = pop();
a->_needRedraw = true;
break;
case SO_TEXT_OFFSET:

View File

@ -1617,7 +1617,7 @@ int auxRectsOverlap(const Common::Rect *destRectPtr, const Common::Rect *sourceR
void ScummEngine_v90he::o90_getOverlap() {
int firstCount, lastCount, checkType, firstRadius, ax, ay, bx, by;
int nVerts, index, lastRadius, distance, counter;
int nVerts, index, lastRadius, distance;
Common::Point lastCenterPoint, firstCenterPoint;
Common::Rect firstRect, lastRect;
int firstList[32], lastList[32];
@ -1890,9 +1890,9 @@ void ScummEngine_v90he::o90_redim2dimArray() {
}
void ScummEngine_v90he::o90_getLinesIntersectionPoint() {
int x1, y1, x2, y2, x3, y3, x4, y4, returnValue, x, y;
int dv, xVariable, yVariable, ta, tb, tc, td, t;
float ua, ub, oodv, tua, tub;
int x1, y1, x2, y2, x3, y3, x4, y4, x, y;
int dv, xVariable, yVariable, ta, tb, tc, td;
float ua, ub, oodv;
bool segAIsAPoint;
bool segBIsAPoint;
@ -1931,7 +1931,7 @@ void ScummEngine_v90he::o90_getLinesIntersectionPoint() {
} else {
// Check to see if we need to special case to point on a line...
if (segAIsAPoint) {
int dx, dy, py;
int dx, py;
dx = (x4 - x3);
@ -2432,7 +2432,7 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
switch (args[0]) {
case 20:
a = (ActorHE *)derefActor(args[1], "o90_kernelSetFunctions: 20");
queueAuxBlock(a); // TODO: Shouldn't this be HEQueueEraseAuxActor?
heQueueEraseAuxActor(a);
break;
case 21:
_skipDrawObject = 1;
@ -2445,25 +2445,25 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
_fullRedraw = true;
break;
case 24:
_skipProcessActors = 1;
_disableActorDrawingFlag = 1;
redrawAllActors();
break;
case 25:
_skipProcessActors = 0;
_disableActorDrawingFlag = 0;
redrawAllActors();
break;
case 27:
// Used in readdemo
break;
case 42:
_wiz->_lUseWizClipRect = true;
_wiz->_lWizClipRect.left = args[1];
_wiz->_lWizClipRect.top = args[2];
_wiz->_lWizClipRect.right = args[3];
_wiz->_lWizClipRect.bottom = args[4];
_wiz->_useWizClipRect = true;
_wiz->_wizClipRect.left = args[1];
_wiz->_wizClipRect.top = args[2];
_wiz->_wizClipRect.right = args[3];
_wiz->_wizClipRect.bottom = args[4];
break;
case 43:
_wiz->_lUseWizClipRect = false;
_wiz->_useWizClipRect = false;
break;
case 714:
setResourceOffHeap(args[1], args[2], args[3]);

View File

@ -1339,6 +1339,10 @@ void Sprite::resetSpriteSystem(bool refreshScreen) {
}
if (_vm->_game.heversion >= 98) {
for (int i = 1; i < _maxSprites; i++) {
newSprite(i);
}
for (int i = 1; i < _maxSpriteGroups; i++) {
newGroup(i);
}

View File

@ -39,7 +39,7 @@ Wiz::Wiz(ScummEngine_v71he *vm) : _vm(vm) {
memset(&_wizBuffer, 0, sizeof(_wizBuffer));
memset(&_polygons, 0, sizeof(_polygons));
_cursorImage = false;
_lUseWizClipRect = false;
_useWizClipRect = false;
_uses16BitColor = (_vm->_game.features & GF_16BIT_COLOR);
}
@ -140,16 +140,16 @@ byte *Wiz::drawAWizEx(int image, int state, int x, int y, int z, int flags, int
// Get the "shadow"...
if (!optionalShadowImage) {
if (_lWizActiveShadow && (flags & kWRFUseShadow)) {
optionalShadowImage = _lWizActiveShadow;
if (_wizActiveShadow && (flags & kWRFUseShadow)) {
optionalShadowImage = _wizActiveShadow;
}
}
if (!(flags & kWRFPolygon)) {
// Get the clipping rect if any...
if (!optionalClipRect) {
if (_lUseWizClipRect && !(flags & (kWRFPrint | kWRFAlloc))) {
clipRectPtr = &_lWizClipRect;
if (_useWizClipRect && !(flags & (kWRFPrint | kWRFAlloc))) {
clipRectPtr = &_wizClipRect;
} else {
clipRectPtr = nullptr;
}
@ -606,14 +606,13 @@ int Wiz::pixelHitTestWiz(int image, int state, int x, int y, int32 flags) {
}
int Wiz::pixelHitTestWizPrim(int globNum, int state, int x, int y, int32 flags) {
// U32 TODO
//int outValue = 0;
//
//if (PU_OverrideImagePixelHitTest(&outValue, globType, globNum, state, x, y, flags)) {
// return outValue;
//}
#ifdef SCUMM_XTL_BRIDGE // 5/9/2000 BPT
int outValue = 0;
if (PU_OverrideImagePixelHitTest(&outValue, globType, globNum, state, x, y, flags)) {
return outValue;
}
#endif
int src_c, src_w, src_h;
byte *src_d;

View File

@ -518,11 +518,11 @@ public:
Wiz(ScummEngine_v71he *vm);
void clearWizBuffer();
Common::Rect _lWizClipRect;
Common::Rect _wizClipRect;
bool _cursorImage;
bool _lUseWizClipRect = false;
bool _useWizClipRect = false;
bool _uses16BitColor = false;
int _lWizActiveShadow = 0;
int _wizActiveShadow = 0;
void deleteLocalPolygons();
void polygonLoad(const uint8 *polData);
@ -652,6 +652,7 @@ public:
void pgSimpleBlitTransparentMixColors(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, WizRawPixel transparentColor, const byte *mixColorTable);
void pgTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, WizRawPixel transparentColor);
void pgDrawWarpDrawLetter(WizRawPixel *bitmapBuffer, int bitmapWidth, int bitmapHeight, const byte *charData, int x1, int y1, int width, int height, byte *colorLookupTable);
void pgDraw8BppFormatImage(WizRawPixel *bufferPtr, const byte *rawData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int32 wizFlags, const void *extraTable, int transparentColor, const WizRawPixel *conversionTable);
void pgDraw8BppSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, const WizRawPixel *conversionTable);
void pgDraw8BppTransparentSimpleBlit(WizSimpleBitmap *destBM, Common::Rect *destRect, WizSimpleBitmap *sourceBM, Common::Rect *sourceRect, int transparentColor, const WizRawPixel *conversionTable);
@ -732,19 +733,19 @@ public:
void auxDecompSRLEStream(WizRawPixel *destStream, const WizRawPixel *backgroundStream, const byte *singleColorTable, const byte *streamData, int streamSize, const WizRawPixel *conversionTable);
void auxDecompDRLEStream(WizRawPixel *destPtr, byte *dataStream, WizRawPixel *backgroundPtr, int skipAmount, int decompAmount, const WizRawPixel *conversionTable);
void auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, const WizRawPixel *conversionTable);
void auxDecompDRLEPrim(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, int bufferWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, const WizRawPixel *conversionTable);
void auxDecompDRLEStream(WizRawPixel *destPtr, const byte *dataStream, WizRawPixel *backgroundPtr, int skipAmount, int decompAmount, const WizRawPixel *conversionTable);
void auxDecompDRLEImage(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, const byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, const WizRawPixel *conversionTable);
void auxDecompDRLEPrim(WizRawPixel *foregroundBufferPtr, WizRawPixel *backgroundBufferPtr, int bufferWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, const WizRawPixel *conversionTable);
void auxDecompTRLEStream(WizRawPixel *destPtr, const byte *dataStream, int skipAmount, int decompAmount, const WizRawPixel *conversionTable);
void auxDecompTRLEImage(WizRawPixel *bufferPtr, const byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, const WizRawPixel *conversionTable);
void auxDecompTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, const WizRawPixel *conversionTable);
void auxDrawZplaneFromTRLEImage(byte *zplanePtr, byte *compData, int zplanePixelWidth, int zplanePixelHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int transOp, int solidOp);
void auxDrawZplaneFromTRLEPrim(byte *zplanePtr, int zplanePixelWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, int transOp, int solidOp);
void auxDrawZplaneFromTRLEImage(byte *zplanePtr, const byte *compData, int zplanePixelWidth, int zplanePixelHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, int transOp, int solidOp);
void auxDrawZplaneFromTRLEPrim(byte *zplanePtr, int zplanePixelWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, int transOp, int solidOp);
void auxDecompRemappedTRLEStream(WizRawPixel *destPtr, byte *dataStream, int skipAmount, int decompAmount, byte *remapTable, const WizRawPixel *conversionTable);
void auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, byte *remapTable, const WizRawPixel *conversionTable);
void auxDecompRemappedTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rect *destRect, byte *compData, Common::Rect *sourceRect, byte *remapTable, const WizRawPixel *conversionTable);
void auxDecompRemappedTRLEStream(WizRawPixel *destPtr, const byte *dataStream, int skipAmount, int decompAmount, byte *remapTable, const WizRawPixel *conversionTable);
void auxDecompRemappedTRLEImage(WizRawPixel *bufferPtr, const byte *compData, int bufferWidth, int bufferHeight, int x, int y, int width, int height, Common::Rect *clipRectPtr, byte *remapTable, const WizRawPixel *conversionTable);
void auxDecompRemappedTRLEPrim(WizRawPixel *bufferPtr, int bufferWidth, Common::Rect *destRect, const byte *compData, Common::Rect *sourceRect, byte *remapTable, const WizRawPixel *conversionTable);
bool auxHitTestTRLEXPos(const byte *dataStream, int skipAmount);
bool auxHitTestTRLEImageRelPos(const byte *compData, int x, int y, int width, int height);
@ -759,11 +760,11 @@ public:
const WizRawPixel *conversionTable);
void auxRemappedMemcpy(
WizRawPixel *dstPtr, byte *srcPtr, int count, byte *remapTable,
WizRawPixel *dstPtr, const byte *srcPtr, int count, byte *remapTable,
const WizRawPixel *conversionTable);
void auxZplaneFromTRLEStream(
byte *destPtr, byte *dataStream, int skipAmount, int decompAmount,
byte *destPtr, const byte *dataStream, int skipAmount, int decompAmount,
int mask, int transOp, int solidOp);
void auxHistogramTRLELine(int *tablePtr, const byte *dataStream, int skipAmount, int decompAmount);

View File

@ -703,16 +703,14 @@ ScummEngine_v70he::~ScummEngine_v70he() {
#ifdef ENABLE_HE
ScummEngine_v71he::ScummEngine_v71he(OSystem *syst, const DetectorResult &dr)
: ScummEngine_v70he(syst, dr) {
_auxBlocksNum = 0;
for (uint i = 0; i < ARRAYSIZE(_auxBlocks); i++) {
_auxBlocks[i].clear();
}
_auxEntriesNum = 0;
memset(_auxEntries, 0, sizeof(_auxEntries));
_heAuxEraseActorIndex = 0;
memset(_heAuxEraseActorTable, 0, sizeof(_heAuxEraseActorTable));
_heAuxAnimTableIndex = 0;
memset(_heAuxAnimTable, 0, sizeof(_heAuxAnimTable));
_wiz = new Wiz(this);
_skipProcessActors = 0;
_disableActorDrawingFlag = 0;
VAR_WIZ_TRANSPARENT_COLOR = 0xFF;
}