aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWinterGrascph2016-05-12 22:44:30 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit05fbf0b3584c5bef1827ce43951b325a20ac40ac (patch)
tree0f0d1316f42042f9a762d3481ba7498b32815075 /engines
parentaf6e6ca4682981e6d193968e508531055e18c52e (diff)
downloadscummvm-rg350-05fbf0b3584c5bef1827ce43951b325a20ac40ac.tar.gz
scummvm-rg350-05fbf0b3584c5bef1827ce43951b325a20ac40ac.tar.bz2
scummvm-rg350-05fbf0b3584c5bef1827ce43951b325a20ac40ac.zip
DM: Add dungeonman.o to module.mk, fix _bitmaps memory leak
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/dungeonman.h2
-rw-r--r--engines/dm/gfx.cpp33
-rw-r--r--engines/dm/gfx.h2
-rw-r--r--engines/dm/module.mk3
4 files changed, 22 insertions, 18 deletions
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index c88c08d478..e60fb40d43 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -163,7 +163,7 @@ public:
// TODO: this does stuff other than load the file!
void loadDungeonFile(); // @ F0434_STARTEND_IsLoadDungeonSuccessful_CPSC
void setCurrentMap(uint16 mapIndex); // @ F0173_DUNGEON_SetCurrentMap
- SquareType getRelSquareType(direction dir, uint16 stepsForward, uint16 stepsRight, uint16 posX, uint16 posY) {
+ SquareType getRelSquareType(direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) {
return getSquareType(getRelSquare(dir, stepsForward, stepsRight, posX, posY));
}// @ F0153_DUNGEON_GetRelativeSquareType
};
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 603021e8a1..ad8d230e6b 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -37,14 +37,14 @@ struct Frame {
uint16 srcX, srcY;
Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
- uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY):
+ uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) :
destFromX(destFromX), destToX(destToX + 1), destFromY(destFromY), destToY(destToY + 1),
srcWidth(srcWidth * 2), srcHeight(srcHeight), srcX(srcX), srcY(srcY) {}
};
Frame gCeilingFrame(0, 223, 0, 28, 112, 29, 0, 0);
Frame gFloorFrame(0, 223, 66, 135, 112, 70, 0, 0);
-Frame gWallFrameD3L2(0, 15, 25, 73, 8, 49, 0, 0); // @ FRAME G0711_s_Graphic558_Frame_Wall_D3L2
+Frame gWallFrameD3L2(0, 15, 25, 73, 8, 49, 0, 0); // @ FRAME G0711_s_Graphic558_Frame_Wall_D3L2
Frame gWallFrameD3R2(208, 223, 25, 73, 8, 49, 0, 0); // @ G0712_s_Graphic558_Frame_Wall_D3R2
extern Viewport gDefultViewPort = {0, 0};
@@ -63,6 +63,7 @@ DisplayMan::~DisplayMan() {
delete[] _packedBitmaps;
delete[] _packedItemPos;
delete[] _vgaBuffer;
+ delete[] _bitmaps[0];
delete[] _bitmaps;
delete[] _wallSetBitMaps[13]; // copy of another bitmap, but flipped
delete[] _wallSetBitMaps[14]; // copy of another bitmap, but flipped
@@ -248,8 +249,8 @@ uint16 DisplayMan::height(uint16 index) {
return READ_BE_UINT16(data + 2);
}
-void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f, uint16 srcWidth) {
- blitToScreen(bitmap, srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport);
+void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) {
+ blitToScreen(bitmap, f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport);
}
@@ -282,21 +283,23 @@ void DisplayMan::drawDungeon(direction dir, uint16 posX, uint16 posY) {
clearBitmap(tmpBitmap, 305, 111, kColorBlack);
if (flippedFloorCeiling) {
- blitToBitmap(_bitmaps[gFloorIndice], width(gFloorIndice), height(gFloorIndice), tmpBitmap, width(gFloorIndice));
- flipBitmapHorizontal(tmpBitmap, width(gFloorIndice), height(gFloorIndice));
- drawWallSetBitmap(tmpBitmap, gFloorFrame, width(gFloorIndice));
- drawWallSetBitmap(_bitmaps[gCeilingIndice], gCeilingFrame, width(gCeilingIndice));
+ uint16 w = gFloorFrame.srcWidth, h = gFloorFrame.srcHeight;
+ blitToBitmap(_floorBitmap, w, h, tmpBitmap, w);
+ flipBitmapHorizontal(tmpBitmap, w, h);
+ drawWallSetBitmap(tmpBitmap, gFloorFrame);
+ drawWallSetBitmap(_ceilingBitmap, gCeilingFrame);
} else {
- blitToBitmap(_bitmaps[gCeilingIndice], width(gCeilingIndice), height(gCeilingIndice), tmpBitmap, width(gCeilingIndice));
- flipBitmapHorizontal(tmpBitmap, width(gCeilingIndice), height(gCeilingIndice));
- drawWallSetBitmap(tmpBitmap, gCeilingFrame, width(gCeilingIndice));
- drawWallSetBitmap(_bitmaps[gFloorIndice], gFloorFrame, width(gFloorIndice));
+ uint16 w = gCeilingFrame.srcWidth, h = gCeilingFrame.srcHeight;
+ blitToBitmap(_ceilingBitmap, w, h, tmpBitmap, w);
+ flipBitmapHorizontal(tmpBitmap, w, h);
+ drawWallSetBitmap(tmpBitmap, gCeilingFrame);
+ drawWallSetBitmap(_floorBitmap, gFloorFrame);
}
- // TODO: CRUDE TEST CODE AT BEST
if (_vm->_dungeonMan->getRelSquareType(dir, 3, -2, posX, posY) == kWallSquareType)
- drawWallSetBitmap(_bitmaps[77 + 12], gWallFrameD3L2, width(77 + 12));
- // TODO CRUDE TEST CODE AT BEST
+ drawWallSetBitmap(_wallSetBitMaps[kWall_D3L2], gWallFrameD3L2);
+ if (_vm->_dungeonMan->getRelSquareType(dir, 3, 2, posX, posY) == kWallSquareType)
+ drawWallSetBitmap(_wallSetBitMaps[kWall_D3R2], gWallFrameD3R2);
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 45b1bb78b3..b2c29bf8c6 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -86,7 +86,7 @@ class DisplayMan {
// the original functions has two position parameters, but they are always set to zero
void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void unpackGraphics();
- void drawWallSetBitmap(byte *bitmap, Frame &f, uint16 srcWidth); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
+ void drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
public:
DisplayMan(DMEngine *dmEngine);
~DisplayMan();
diff --git a/engines/dm/module.mk b/engines/dm/module.mk
index 3fad4ee9f4..ca425c5ffb 100644
--- a/engines/dm/module.mk
+++ b/engines/dm/module.mk
@@ -3,7 +3,8 @@ MODULE := engines/dm
MODULE_OBJS := \
detection.o \
dm.o \
- gfx.o
+ gfx.o \
+ dungeonman.o
MODULE_DIRS += \
engines/dm