DM: Add F0491_CACHE_IsDerivedBitmapInCache, F0492_CACHE_GetDerivedBitmap

This commit is contained in:
Bendegúz Nagy 2016-06-29 23:02:34 +02:00
parent 36a29bbe86
commit 3f19bcdf6b
2 changed files with 31 additions and 5 deletions

View file

@ -617,6 +617,7 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
_ceilingBitmap = nullptr;
_currMapAllowedCreatureTypes = nullptr;
_derivedBitmapByteCount = nullptr;
_derivedBitmaps = nullptr;
_screenWidth = _screenHeight = 0;
_championPortraitOrdinal = 0;
@ -671,6 +672,13 @@ DisplayMan::~DisplayMan() {
delete[] _wallSetBitMaps[kDoorFrameRight_D1C]; // copy of another bitmap, but flipped
for (uint16 i = kWall_D0L_Flipped; i <= kWall_D3LCR_Flipped; ++i)
delete[] _wallSetBitMaps[i];
delete[] _derivedBitmapByteCount;
if (_derivedBitmaps) {
for (uint16 i = 0; i < kDerivedBitmapMaximumCount; ++i)
delete[] _derivedBitmaps;
delete[] _derivedBitmaps;
}
}
void DisplayMan::setUpScreens(uint16 width, uint16 height) {
@ -712,6 +720,11 @@ void DisplayMan::loadGraphics() {
if (!_derivedBitmapByteCount)
_derivedBitmapByteCount = new uint16[kDerivedBitmapMaximumCount];
if (!_derivedBitmaps) {
_derivedBitmaps = new byte*[kDerivedBitmapMaximumCount];
for (uint16 i = 0; i < kDerivedBitmapMaximumCount; ++i)
_derivedBitmaps[i] = nullptr;
}
_derivedBitmapByteCount[kDerivedBitmapViewport] = 224 * 136;
_derivedBitmapByteCount[kDerivedBitmapThievesEyeVisibleArea] = 96 * 95;
@ -1719,6 +1732,18 @@ int16 DisplayMan::getScaledDimension(int16 dimension, int16 scale) {
return (dimension * scale + scale / 2) / 32;
}
bool DisplayMan::isDerivedBitmapInCache(int16 derivedBitmapIndex) {
if (_derivedBitmaps == nullptr) {
_derivedBitmaps[derivedBitmapIndex] = new byte[_derivedBitmapByteCount[derivedBitmapIndex]];
return false;
} else
return true;
}
byte* DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) {
return _derivedBitmaps[derivedBitmapIndex];
}
void DisplayMan::clearScreenBox(Color color, Box &box, Viewport &viewport) {
uint16 width = box._x2 - box._x1;
for (int y = box._y1 + viewport._posY; y < box._y2 + viewport._posY; ++y)

View file

@ -391,6 +391,7 @@ class DisplayMan {
bool isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex); // @ F0107_DUNGEONVIEW_IsDrawnWallOrnamentAnAlcove_CPSF
uint16 *_derivedBitmapByteCount; // @ G0639_pui_DerivedBitmapByteCount
byte **_derivedBitmaps; // @ G0638_pui_DerivedBitmapBlockIndices
public:
// some methods use this for a stratchpad, don't make assumptions about content between function calls