SCUMM: HE: Add new HE variant (99.5) as game feature flag

This commit is contained in:
AndywinXp 2024-03-30 15:55:29 +01:00 committed by Eugene Sandulenko
parent 9f460f6cf5
commit 1f493dec1a
7 changed files with 203 additions and 114 deletions

View File

@ -348,7 +348,13 @@ enum GameFeatures {
* The "Ultimate Talkie" versions of Monkey Island, which have been
* patched so that most workarounds/bugfixes no longer apply to them.
*/
GF_ULTIMATE_TALKIE = 1 << 18
GF_ULTIMATE_TALKIE = 1 << 18,
/**
* HE99 games which were ported to a C++ codebase with HE99 opcodes
* and several HE100 GFX/Wiz features.
*/
GF_HE_995 = 1 << 19
};
enum ScummGameId {

View File

@ -329,22 +329,22 @@ static const GameSettings gameVariantsTable[] = {
{"mustard", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
// Added the use of fonts
{"FreddisFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"SamsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"PuttsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"FreddisFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"SamsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"PuttsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
// Added the use of smacker videos
{"BluesTreasureHunt", 0, 0, GID_TREASUREHUNT, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_USE_KEY, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"BluesTreasureHunt", 0, 0, GID_TREASUREHUNT, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_USE_KEY | GF_HE_995 | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
// Added 16bit color
{"arttime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"baseball2001", 0, 0, GID_BASEBALL2001, 6, 99, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO5(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE, GUIO_NETWORK)},
{"readtime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"SoccerMLS", 0, 0, GID_SOCCERMLS, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"spyozon", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"arttime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"baseball2001", 0, 0, GID_BASEBALL2001, 6, 99, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO5(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE, GUIO_NETWORK)},
{"readtime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"SoccerMLS", 0, 0, GID_SOCCERMLS, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"spyozon", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"freddicove", "unenc", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"freddicove", "unenc", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_16BIT_COLOR | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"freddicove", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
// Restructured the Scumm engine
@ -377,6 +377,7 @@ static const GameSettings gameVariantsTable[] = {
{"", "HE 98", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"", "HE 98.5", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"", "HE 99", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"", "HE 99.5", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_995, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},
{"", "HE 101", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO4(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT, GUIO_AUDIO_OVERRIDE)},

View File

@ -1321,7 +1321,7 @@ void ScummEngine_v90he::o90_getWizData() {
break;
}
case SO_NEW_GENERAL_PROPERTY: // 139
if (_game.heversion > 99 || (_game.heversion == 99 && _wiz->_uses16BitColor)) {
if (_game.heversion > 99 || _isHE995) {
type = pop();
} else {
type = 0;

View File

@ -261,7 +261,7 @@ int Sprite::getSpriteAutoAnimFlag(int spriteId) {
int Sprite::getSpriteUpdateType(int spriteId) {
assertRange(1, spriteId, _maxSprites, "sprite");
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (_spriteTable[spriteId].flags & kSFSmartRender) {
return SPRDEF_SMART;
} else {
@ -432,7 +432,7 @@ void Sprite::getSpriteRectPrim(const SpriteInfo *spritePtr, Common::Rect *rectPt
if (image != 0) {
Common::Point tmpPt(spotPtr->x, spotPtr->y);
if (_vm->_game.heversion < 100) {
if (_vm->_game.heversion < 100 && !_vm->_isHE995) {
calcSpriteSpot(spritePtr, includeGroupTransform, x, y);
tmpPt.x = x;
tmpPt.y = y;
@ -531,7 +531,7 @@ void Sprite::calcSpriteSpot(const SpriteInfo *spritePtr, bool includeGroupTransf
y += _groupTable[spritePtr->group].posY;
}
} else if (_vm->_game.heversion >= 98) {
if (_vm->_game.heversion >= 100) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (spritePtr->image == 0) {
if (includeGroupTransform && spritePtr->group) {
x = _groupTable[spritePtr->group].posX;
@ -855,7 +855,7 @@ void Sprite::setSpriteAutoAnimFlag(int spriteId, int value) {
void Sprite::setSpriteUpdateType(int spriteId, int eraseType) {
assertRange(1, spriteId, _maxSprites, "sprite");
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
switch (eraseType) {
default:
case SPRDEF_SMART:
@ -969,15 +969,17 @@ void Sprite::newSprite(int sprite) {
setSourceImage(sprite, 0);
setMaskImage(sprite, 0);
setSpriteUpdateType(sprite, SPRDEF_SIMPLE);
setSpritePriority(sprite, 0);
setSpriteZBuffer(sprite, 0);
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
setSpriteUpdateType(sprite, SPRDEF_SIMPLE);
setSpritePriority(sprite, 0);
setSpriteZBuffer(sprite, 0);
_spriteTable[sprite].flags |= kSFAutoAnimate;
_spriteTable[sprite].conditionBits = 0;
_spriteTable[sprite].flags |= kSFAutoAnimate;
_spriteTable[sprite].conditionBits = 0;
_spriteTable[sprite].specialRenderFlags = 0;
// TODO U32 PU_SpriteNewHook(sprite);
_spriteTable[sprite].specialRenderFlags = 0;
// TODO U32 PU_SpriteNewHook(sprite);
}
}
}
@ -1022,14 +1024,14 @@ void Sprite::setImageList(int sprite, int count, const int *list) {
} else {
_spriteTable[sprite].maxStates = _vm->_wiz->getWizStateCount(_spriteTable[sprite].image);
if (_vm->_game.heversion < 100) {
_spriteTable[sprite].flags |= kSFDefaultFlagActive;
} else {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (_vm->VAR(_vm->VAR_SPRITE_IMAGE_CHANGE_DOES_NOT_RESET_SETTINGS)) {
_spriteTable[sprite].flags |= kSFActive;
} else {
_spriteTable[sprite].flags |= kSFDefaultFlagActive;
}
} else {
_spriteTable[sprite].flags |= kSFDefaultFlagActive;
}
if (_vm->_game.heversion > 80 &&
@ -1045,7 +1047,7 @@ void Sprite::setImageList(int sprite, int count, const int *list) {
} else {
_spriteTable[sprite].flags = kSFDefaultFlagInactive;
}
} else if (_vm->_game.heversion >= 100) {
} else if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (_vm->VAR(_vm->VAR_SPRITE_IMAGE_CHANGE_DOES_NOT_RESET_SETTINGS)) {
_spriteTable[sprite].flags &= ~kSFActive;
} else {
@ -1332,8 +1334,9 @@ void Sprite::newGroup(int group) {
clearGroupScaleInfo(group);
// TODO U32
// if (_vm->_game.heversion >= 99)
// PU_GroupNewHook(group);
// if (_vm->_game.heversion > 99 || _vm->_isHE995) {
// PU_GroupNewHook(group);
// }
}
void Sprite::resetSpriteSystem(bool eraseScreen) {
@ -1709,9 +1712,11 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
if (_vm->_game.heversion > 98) {
// Setup the image render command...
imageRenderCmd.extendedRenderInfo.sprite = (int32)(spritePtr[i] - _spriteTable);
imageRenderCmd.extendedRenderInfo.group = spritePtr[i]->group;
imageRenderCmd.extendedRenderInfo.conditionBits = spritePtr[i]->conditionBits;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
imageRenderCmd.extendedRenderInfo.sprite = (int32)(spritePtr[i] - _spriteTable);
imageRenderCmd.extendedRenderInfo.group = spritePtr[i]->group;
imageRenderCmd.extendedRenderInfo.conditionBits = spritePtr[i]->conditionBits;
}
imageRenderCmd.actionFlags = kWAFSpot;
imageRenderCmd.xPos = spot.x;
@ -1775,11 +1780,13 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
}
if (_vm->_game.heversion > 98) {
// Handle Z-Clipping
if (spritePtr[i]->zbufferImage != 0) {
imageRenderCmd.actionFlags |= kWAFZBufferImage;
imageRenderCmd.zbufferImage = spritePtr[i]->zbufferImage;
imageRenderCmd.zPos = spritePtr[i]->priority;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
// Handle Z-Clipping
if (spritePtr[i]->zbufferImage != 0) {
imageRenderCmd.actionFlags |= kWAFZBufferImage;
imageRenderCmd.zbufferImage = spritePtr[i]->zbufferImage;
imageRenderCmd.zPos = spritePtr[i]->priority;
}
}
// Set the source image...
@ -1789,7 +1796,9 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
imageRenderCmd.sourceImage = sourceImage;
}
renderFlags |= spritePtr[i]->specialRenderFlags;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
renderFlags |= spritePtr[i]->specialRenderFlags;
}
// Finally set the image render flags
imageRenderCmd.actionFlags |= kWAFFlags;
@ -1836,10 +1845,12 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
if (_groupTable[group].flags & kSGFUseClipRect) {
if (_vm->_game.heversion > 98) {
if (!_vm->_wiz->findRectOverlap(&spritePtr[i]->lastRect, &_groupTable[group].clipRect)) {
spritePtr[i]->lastRect.left = 1234;
spritePtr[i]->lastRect.top = 1234;
spritePtr[i]->lastRect.right = -1234;
spritePtr[i]->lastRect.bottom = -1234;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
spritePtr[i]->lastRect.left = 1234;
spritePtr[i]->lastRect.top = 1234;
spritePtr[i]->lastRect.right = -1234;
spritePtr[i]->lastRect.bottom = -1234;
}
continue;
}
@ -1895,7 +1906,7 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
// Finally actually do something by calling the command parser
// this function is the same core that renders images via the
// "image" draw command.
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
imageRenderCmd.actionType = kWADraw;
_vm->_wiz->processWizImageCmd(&imageRenderCmd);
} else {

View File

@ -209,7 +209,7 @@ void *Wiz::drawAWizPrimEx(int globNum, int state, int x, int y, int z, int shado
}
}
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
// If using a z-buffer make sure both globs are in ram!!!!
if (zbufferImage) {
// uncompressed 16-bit z-buffers only for now
@ -327,7 +327,7 @@ void *Wiz::drawAWizPrimEx(int globNum, int state, int x, int y, int z, int shado
}
// Get down to business and decompress the image...
if (_vm->_game.heversion >= 99 && zbufferImage) {
if ((_vm->_game.heversion > 99 || _vm->_isHE995) && zbufferImage) {
WizSimpleBitmap sbZBuffer;
sbZBuffer.bitmapHeight = 0;
sbZBuffer.bitmapWidth = 0;
@ -423,7 +423,7 @@ void *Wiz::drawAWizPrimEx(int globNum, int state, int x, int y, int z, int shado
error("Wiz::drawAWizPrimEx(): Raw data type mismatch for mode %d vs %d", src_c, kWCTNone16Bpp);
}
} else {
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (optionalColorConversionTable &&
((WizRawPixel *)_vm->getHEPaletteSlot(1) != optionalColorConversionTable)) {
flags |= kWRFRemap;
@ -635,6 +635,10 @@ int Wiz::pixelHitTestWizPrim(int globNum, int state, int x, int y, int32 flags)
src_d + _vm->_resourceHeaderSize, x, y, src_w, src_h,
_vm->VAR(_vm->VAR_WIZ_TRANSPARENT_COLOR));
if (!(_vm->_game.heversion > 99 || _vm->_isHE995)) {
return pixel;
}
int compType = getWizCompressionType(globNum, state);
if (LITTLE_ENDIAN_WIZ(compType)) {
@ -657,6 +661,11 @@ int Wiz::pixelHitTestWizPrim(int globNum, int state, int x, int y, int32 flags)
srcBitmap.bitmapHeight = src_h;
int pixel = pgReadPixel(&srcBitmap, x, y, _vm->VAR(_vm->VAR_WIZ_TRANSPARENT_COLOR));
if (!(_vm->_game.heversion > 99 || _vm->_isHE995)) {
return pixel;
}
int compType = getWizCompressionType(globNum, state);
if (LITTLE_ENDIAN_WIZ(compType)) {
@ -784,7 +793,12 @@ void Wiz::processWizImagePolyCaptureCmd(const WizImageCommand *params) {
if (params->actionFlags & kWAFCompressionType) {
compressionType = params->compressionType;
} else {
compressionType = kWCTNone;
compressionType = (_vm->_game.heversion > 99 || _vm->_isHE995) ? kWCTTRLE : kWCTNone;
}
if (!(_vm->_game.heversion > 99 || _vm->_isHE995)) {
_vm->_res->setModified(rtImage, params->image);
return;
}
if (params->actionFlags & kWAFShadow) {
@ -1234,9 +1248,11 @@ void Wiz::processWizImageDrawCmd(const WizImageCommand *params) {
shadowImage = 0;
}
if (params->actionFlags & kWAFZBufferImage) {
zbufferImage = params->zbufferImage;
ADD_REQUIRED_IMAGE(zbufferImage);
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (params->actionFlags & kWAFZBufferImage) {
zbufferImage = params->zbufferImage;
ADD_REQUIRED_IMAGE(zbufferImage);
}
}
if (params->actionFlags & kWAFRect) {
@ -1278,7 +1294,7 @@ void Wiz::processWizImageDrawCmd(const WizImageCommand *params) {
}
// See if the images are in their native format and twiddle if need be.
if (_vm->_game.heversion > 99 || (_vm->_game.heversion == 99 && _uses16BitColor)) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
for (int i = 0; i < requiredImageCount; i++) {
ensureNativeFormatImageForState(requiredImages[i], state);
}
@ -1296,7 +1312,7 @@ void Wiz::processWizImageDrawCmd(const WizImageCommand *params) {
destBitmap = nullptr;
}
if (_vm->_game.heversion >= 99 && (params->actionFlags & kWAFRemapList)) {
if ((_vm->_game.heversion > 99 || _vm->_isHE995) && (params->actionFlags & kWAFRemapList)) {
processWizImageModifyCmd(params);
flags |= kWRFRemap;
}
@ -1708,7 +1724,7 @@ void Wiz::dwHandleComplexImageDraw(int image, int state, int x, int y, int shado
y = boundingRect.top;
// Special case renderers don't use shadows...
if (!shadow) {
if (!shadow || (_vm->_game.heversion <= 99 && !_vm->_isHE995)) {
switch (correctedAngle) {
case 0:
handleRotate0SpecialCase(
@ -1740,7 +1756,10 @@ void Wiz::dwHandleComplexImageDraw(int image, int state, int x, int y, int shado
// If there is a shadow get it's address
if (shadow) {
shadowPtr = (byte *)getColorMixBlockPtrForWiz(shadow);
shadowPtr += _vm->_resourceHeaderSize;
// Let's replicate whichever bug they had in the interpreter...
if (_vm->_game.heversion > 99 || _vm->_isHE995)
shadowPtr += _vm->_resourceHeaderSize;
} else {
shadowPtr = nullptr;
}
@ -1770,7 +1789,7 @@ bool Wiz::dwIsUncompressedFormatTypeID(int id) {
}
int Wiz::dwGetImageGeneralProperty(int image, int state, int property) {
if (_vm->_game.heversion == 99 && !_uses16BitColor)
if (_vm->_isHE995)
return 0;
switch (property) {
@ -1984,7 +2003,10 @@ void Wiz::processWizImageRenderRectCmd(const WizImageCommand *params) {
// If we're here we must be able to render into the image (clipped)...
if (findRectOverlap(&renderRect, &clipRect)) {
pgDrawSolidRect(&renderBitmap, &renderRect, whatColor);
_vm->_res->setModified(rtImage, params->image);
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
_vm->_res->setModified(rtImage, params->image);
}
}
}
@ -2005,9 +2027,11 @@ void Wiz::processWizImageRenderLineCmd(const WizImageCommand *params) {
whichState = 0;
}
if (params->actionFlags & kWAFProperty) {
propertyNumber = params->propertyNumber;
propertyValue = params->propertyValue;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
if (params->actionFlags & kWAFProperty) {
propertyNumber = params->propertyNumber;
propertyValue = params->propertyValue;
}
}
whichImage = params->image;
@ -2040,28 +2064,36 @@ void Wiz::processWizImageRenderLineCmd(const WizImageCommand *params) {
}
// If we're here we must be able to render into the image (clipped)...
switch (propertyNumber) {
case 0:
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
switch (propertyNumber) {
case 0:
pgClippedLineDraw(
&renderBitmap,
params->renderCoords.left, params->renderCoords.top,
params->renderCoords.right, params->renderCoords.bottom,
&clipRect, whatColor);
break;
case 1:
pgClippedThickLineDraw(
&renderBitmap,
params->renderCoords.left, params->renderCoords.top,
params->renderCoords.right, params->renderCoords.bottom,
&clipRect,
propertyValue,
whatColor);
break;
}
_vm->_res->setModified(rtImage, params->image);
} else {
pgClippedLineDraw(
&renderBitmap,
params->renderCoords.left, params->renderCoords.top,
params->renderCoords.right, params->renderCoords.bottom,
&clipRect, whatColor);
break;
case 1:
pgClippedThickLineDraw(
&renderBitmap,
params->renderCoords.left, params->renderCoords.top,
params->renderCoords.right, params->renderCoords.bottom,
&clipRect,
propertyValue,
whatColor);
break;
}
_vm->_res->setModified(rtImage, params->image);
}
void Wiz::processWizImageRenderPixelCmd(const WizImageCommand *params) {
@ -2113,7 +2145,9 @@ void Wiz::processWizImageRenderPixelCmd(const WizImageCommand *params) {
if (isPointInRect(&clipRect,&pt)) {
pgWritePixel(&renderBitmap, pt.x, pt.y, whatColor);
_vm->_res->setModified(rtImage, params->image);
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
_vm->_res->setModified(rtImage, params->image);
}
}
}
@ -2378,7 +2412,7 @@ void Wiz::processWizImageRenderFloodFillCmd(const WizImageCommand *params) {
if (isPointInRect(&clipRect, &pt)) {
floodSimpleFill(&renderBitmap, pt.x, pt.y, whatColor, &clipRect, &renderRect);
if (_vm->_game.heversion >= 99) {
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
_vm->_res->setModified(rtImage, params->image);
}
}
@ -2409,24 +2443,29 @@ void Wiz::processNewWizImageCmd(const WizImageCommand *params) {
hotspotY = 0;
}
// Determine pixel depth...
if (params->actionFlags & kWAFProperty) {
propertyNumber = params->propertyNumber;
propertyValue = params->propertyValue;
}
int pixelDepth = (_vm->_game.features & GF_16BIT_COLOR) ? 16 : 8;
if (propertyNumber == 1) { // Color hint property
pixelDepth = propertyValue;
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
// Determine pixel depth...
if (params->actionFlags & kWAFProperty) {
propertyNumber = params->propertyNumber;
propertyValue = params->propertyValue;
}
if ((pixelDepth != 16) && (pixelDepth != 8)) {
error("Wiz::processNewWizImageCmd(): The only pixel depths supported for a new image are 16 and 8. You picked %d.", pixelDepth);
if (propertyNumber == 1) { // Color hint property
pixelDepth = propertyValue;
if ((pixelDepth != 16) && (pixelDepth != 8)) {
error("Wiz::processNewWizImageCmd(): The only pixel depths supported for a new image are 16 and 8. You picked %d.", pixelDepth);
}
}
}
dwCreateRawWiz(params->image, width, height, kCWFDefault, pixelDepth, hotspotX, hotspotY);
_vm->_res->setModified(rtImage, params->image);
if (_vm->_game.heversion > 99 || _vm->_isHE995) {
_vm->_res->setModified(rtImage, params->image);
}
}
void Wiz::processWizImageLoadCmd(const WizImageCommand *params) {
@ -2460,39 +2499,69 @@ void Wiz::processWizImageLoadCmd(const WizImageCommand *params) {
void Wiz::processWizImageSaveCmd(const WizImageCommand *params) {
if (params->actionFlags & kWAFFilename) {
switch (params->fileType) {
case DW_SAVE_RAW_FORMAT:
// Ignore on purpose...
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_NOT_TYPE;
break;
case DW_SAVE_PCX_FORMAT:
// TODO Write image to file
break;
case DW_SAVE_WIZ_FORMAT: {
if (_vm->_game.heversion <= 99 && !_vm->_isHE995) {
// Validate the type
if (params->fileType != DW_SAVE_WIZ_FORMAT) {
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_NOT_TYPE;
return;
}
// Open the file
Common::WriteStream *f = _vm->openSaveFileForWriting(params->filename);
if (!f) {
debug(0, "Unable to open for write '%s'", params->filename);
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_CREATE_FAILURE;
} else {
byte *p = _vm->getResourceAddress(rtImage, params->image);
uint32 size = READ_BE_UINT32(p + 4);
if (f->write(p, size) != size) {
error("i/o error when writing '%s'", params->filename);
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_WRITE_FAILURE;
} else {
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_SUCCESS;
}
f->finalize();
delete f;
return;
}
break;
}
default:
error("processWizImageCmd: actionType kWASave unhandled fileType %d", params->fileType);
// Get the data size and save out the glob.
byte *p = _vm->getResourceAddress(rtImage, params->image);
uint32 dataSize = READ_BE_UINT32(p + 4);
if (f->write(p, dataSize) == dataSize) {
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_SUCCESS;
} else {
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_WRITE_FAILURE;
}
f->finalize();
delete f;
} else {
switch (params->fileType) {
case DW_SAVE_RAW_FORMAT:
// Ignore on purpose...
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_NOT_TYPE;
break;
case DW_SAVE_PCX_FORMAT:
// TODO Write image to file
break;
case DW_SAVE_WIZ_FORMAT: {
Common::WriteStream *f = _vm->openSaveFileForWriting(params->filename);
if (!f) {
debug(0, "Unable to open for write '%s'", params->filename);
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_CREATE_FAILURE;
} else {
byte *p = _vm->getResourceAddress(rtImage, params->image);
uint32 size = READ_BE_UINT32(p + 4);
if (f->write(p, size) != size) {
error("i/o error when writing '%s'", params->filename);
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_WRITE_FAILURE;
} else {
_vm->VAR(_vm->VAR_OPERATION_FAILURE) = DW_SAVE_SUCCESS;
}
f->finalize();
delete f;
}
break;
}
default:
error("processWizImageCmd: actionType kWASave unhandled fileType %d", params->fileType);
}
}
}
}

View File

@ -1994,6 +1994,7 @@ void ScummEngine_v99he::resetScumm() {
_hePaletteSlot = (_game.features & GF_16BIT_COLOR) ? 1280 : 1024;
_hePalettes = (uint8 *)malloc((_numPalettes + 1) * _hePaletteSlot);
memset(_hePalettes, 0, (_numPalettes + 1) * _hePaletteSlot);
_isHE995 = (_game.features & GF_HE_995);
// Array 129 is set to base name
len = strlen(_filenamePattern.pattern);

View File

@ -558,6 +558,7 @@ public:
bool _enableCOMISong = false;
bool _isAmigaPALSystem = false;
bool _quitFromScriptCmd = false;
bool _isHE995 = false;
Common::Keymap *_insaneKeymap;