From a09ff6a165ded27abed68edd4067acd494ec5221 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Thu, 30 Jun 2016 12:35:02 +0200 Subject: DM: Add F0114_DUNGEONVIEW_GetExplosionBitmap --- engines/dm/TODOs/methodtree.txt | 2 +- engines/dm/gfx.cpp | 26 ++++++++++++++++++++++++++ engines/dm/gfx.h | 4 +++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/engines/dm/TODOs/methodtree.txt b/engines/dm/TODOs/methodtree.txt index 7a05ad177f..da5e0ccca9 100644 --- a/engines/dm/TODOs/methodtree.txt +++ b/engines/dm/TODOs/methodtree.txt @@ -2,7 +2,7 @@ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF F0113_DUNGEONVIEW_DrawField // stub method F0133_VIDEO_BlitBoxFilledWithMaskedBitmap // dummy FIELD_ASPECT // done - F0114_DUNGEONVIEW_GetExplosionBitmap + F0114_DUNGEONVIEW_GetExplosionBitmap // done F0133_VIDEO_BlitBoxFilledWithMaskedBitmap // dummy F0141_DUNGEON_GetObjectInfoIndex F0142_DUNGEON_GetProjectileAspect diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 2fa2bf5d5a..81b53d4ba6 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -39,6 +39,8 @@ namespace DM { Box gBoxMovementArrows = Box(224, 319, 124, 168); +byte gPalChangeSmoke[16] = {0, 10, 20, 30, 40, 50, 120, 10, 80, 90, 100, 110, 120, 130, 140, 150}; // @ G0212_auc_Graphic558_PaletteChanges_Smoke + ExplosionAspect gExplosionAspects[kExplosionAspectCount] = { // @ G0211_as_Graphic558_ExplosionAspects /* { ByteWidth, Height } */ ExplosionAspect(80, 111), /* Fire */ @@ -998,6 +1000,30 @@ void DisplayMan::flipBitmapVertical(byte *bitmap, uint16 width, uint16 height) { delete[] tmp; } +byte* DisplayMan::getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16& returnPixelWidth, int16& returnHeight) { + ExplosionAspect *explAsp = &gExplosionAspects[explosionAspIndex]; + if (scale > 32) + scale = 32; + int16 pixelWidth = getScaledDimension(explAsp->_pixelWidth, scale); + int16 height = getScaledDimension(explAsp->_height, scale); + byte *bitmap; + int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + kDerivedBitmapFirstExplosion - 2; + if ((scale == 32) && (explosionAspIndex != kExplosionAspectSmoke)) { + bitmap = getBitmap(explosionAspIndex + kFirstExplosionGraphicIndice); + } else if (isDerivedBitmapInCache(derBitmapIndex)) { + bitmap = getDerivedBitmap(derBitmapIndex); + } else { + byte *nativeBitmap = getBitmap(MIN(explosionAspIndex, (uint16)kExplosionAspectPoison) + kFirstExplosionGraphicIndice); + bitmap = getDerivedBitmap(derBitmapIndex); + blitToBitmapShrinkWithPalChange(nativeBitmap, explAsp->_pixelWidth, explAsp->_height, bitmap, pixelWidth, height, + (explosionAspIndex == kExplosionAspectSmoke) ? gPalChangeSmoke : gPalChangesNoChanges); + warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap"); + } + + returnPixelWidth = pixelWidth; + returnHeight = height; + return bitmap; +} void DisplayMan::updateScreen() { diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 34a1399366..2df0ac0a5c 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -166,7 +166,8 @@ enum GraphicIndice { kObjectDescCircleIndice = 29, // @ C029_GRAPHIC_OBJECT_DESCRIPTION_CIRCLE kFloorOrn_15_D3L_footprints = 241, // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS kFieldMask_D3R_GraphicIndice = 69, // @ C069_GRAPHIC_FIELD_MASK_D3R - kFieldTeleporterGraphicIndice = 73 // @ C073_GRAPHIC_FIELD_TELEPORTER + kFieldTeleporterGraphicIndice = 73, // @ C073_GRAPHIC_FIELD_TELEPORTER + kFirstExplosionGraphicIndice = 348 // @ C348_GRAPHIC_FIRST_EXPLOSION }; extern uint16 gPalSwoosh[16]; @@ -457,6 +458,7 @@ public: void flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height); void flipBitmapVertical(byte *bitmap, uint16 width, uint16 height); + byte *getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16 &returnPixelWidth, int16 &returnHeight); // @ F0114_DUNGEONVIEW_GetExplosionBitmap void clearBitmap(byte *bitmap, uint16 width, uint16 height, Color color); void clearScreen(Color color); -- cgit v1.2.3