Skip to content

Commit

Permalink
DM: Add F0114_DUNGEONVIEW_GetExplosionBitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent b3e1760 commit a09ff6a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion engines/dm/TODOs/methodtree.txt
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions engines/dm/gfx.cpp
Expand Up @@ -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 */
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion engines/dm/gfx.h
Expand Up @@ -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];
Expand Down Expand Up @@ -457,6 +458,7 @@ class DisplayMan {

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);
Expand Down

0 comments on commit a09ff6a

Please sign in to comment.