aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dm/dm.cpp3
-rw-r--r--engines/dm/dungeonman.cpp2
-rw-r--r--engines/dm/dungeonman.h14
-rw-r--r--engines/dm/gfx.h42
4 files changed, 31 insertions, 30 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 34efcf3407..64793a9bd9 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -56,11 +56,12 @@ Common::Error DMEngine::run() {
_displayMan->setUpScreens(320, 200);
+ _displayMan->loadGraphics();
+
_dungeonMan->loadDungeonFile();
_dungeonMan->setCurrentMapAndPartyMap(0);
- _displayMan->loadGraphics();
_displayMan->loadCurrentMapGraphics();
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 824a730602..9b9791aff4 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -421,7 +421,7 @@ int16 DungeonMan::getSquareFirstThingIndex(int16 mapX, int16 mapY) {
if (mapX < 0 || mapX >= _currMap.width || mapY < 0 || mapY >= _currMap.height || !Square(_currMap.data[mapX][mapY]).get(kThingListPresent))
return -1;
- int16 y;
+ int16 y = 0;
uint16 index = _currMap.colCumulativeSquareFirstThingCount[mapX];
byte* square = _currMap.data[mapX];
while (y++ != mapY)
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index df8395312c..5f1dcd3d40 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -402,11 +402,11 @@ struct CurrMapData {
uint8 currPartyMapIndex; // @ G0309_i_PartyMapIndex
uint8 index; // @ G0272_i_CurrentMapIndex
- byte **data; // @ G0271_ppuc_CurrentMapData
- Map *map; // @ G0269_ps_CurrentMap
+ byte **data = NULL; // @ G0271_ppuc_CurrentMapData
+ Map *map = NULL; // @ G0269_ps_CurrentMap
uint16 width; // @ G0273_i_CurrentMapWidth
uint16 height; // @ G0274_i_CurrentMapHeight
- uint16 *colCumulativeSquareFirstThingCount; // @G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount
+ uint16 *colCumulativeSquareFirstThingCount = NULL; // @G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount
}; // @ AGGREGATE
struct Messages {
@@ -454,15 +454,15 @@ public:
} // @ F0153_DUNGEON_GetRelativeSquareType
void setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
- uint32 _rawDunFileDataSize; // @ probably NONE
- byte *_rawDunFileData; // @ ???
+ uint32 _rawDunFileDataSize = 0; // @ probably NONE
+ byte *_rawDunFileData = NULL; // @ ???
DungeonFileHeader _fileHeader; // @ G0278_ps_DungeonHeader
DungeonData _dunData; // @ NONE
CurrMapData _currMap; // @ NONE
- Map *_maps; // @ G0277_ps_DungeonMaps
+ Map *_maps = NULL; // @ G0277_ps_DungeonMaps
// does not have to be freed
- byte *_rawMapData; // @ G0276_puc_DungeonRawMapData
+ byte *_rawMapData = NULL; // @ G0276_puc_DungeonRawMapData
Messages _messages; // @ NONE;
int16 _currMapInscriptionWallOrnIndex; // @ G0265_i_CurrentMapInscriptionWallOrnamentIndex
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 4c6b461446..576d9e3452 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -77,28 +77,28 @@ extern Viewport gDungeonViewport;
class DisplayMan {
- DMEngine *_vm;
+ DMEngine *_vm = NULL;
uint16 _screenWidth;
- uint16 _screenHeight;
- byte *_vgaBuffer;
+ uint16 _screenHeight = 0;
+ byte *_vgaBuffer = NULL;
/// Related to graphics.dat file
- uint16 grapItemCount; // @ G0632_ui_GraphicCount
- uint32 *_packedItemPos;
- byte *_packedBitmaps;
- byte **_bitmaps;
+ uint16 grapItemCount = 0; // @ G0632_ui_GraphicCount
+ uint32 *_packedItemPos = NULL;
+ byte *_packedBitmaps = NULL;
+ byte **_bitmaps = NULL;
// the last two pointers are owned by this array
byte *_wallSetBitMaps[15] = {NULL}; // @G[0696..0710]_puc_Bitmap_WallSet_...
// pointers are not owned by these fields
- byte *_floorBitmap;
- byte *_ceilingBitmap;
+ byte *_floorBitmap = NULL;
+ byte *_ceilingBitmap = NULL;
- byte *_palChangesProjectile[4]; // @G0075_apuc_PaletteChanges_Projectile
+ byte *_palChangesProjectile[4] = {NULL}; // @G0075_apuc_PaletteChanges_Projectile
DisplayMan(const DisplayMan &other); // no implementation on purpose
@@ -152,17 +152,17 @@ public:
int16 _championPortraitOrdinal = 0; // @ G0289_i_DungeonView_ChampionPortraitOrdinal
- int16 _currMapAlcoveOrnIndices[kAlcoveOrnCount]; // @ G0267_ai_CurrentMapAlcoveOrnamentIndices
- int16 _currMapFountainOrnIndices[kFountainOrnCount]; // @ G0268_ai_CurrentMapFountainOrnamentIndices
- int16 _currMapWallOrnInfo[16][2]; // @ G0101_aai_CurrentMapWallOrnamentsInf
- int16 _currMapFloorOrnInfo[16][2]; // @ G0102_aai_CurrentMapFloorOrnamentsInfo
- int16 _currMapDoorOrnInfo[17][2]; // @ G0103_aai_CurrentMapDoorOrnamentsInfo
- byte *_currMapAllowedCreatureTypes; // @ G0264_puc_CurrentMapAllowedCreatureTypes
- byte _currMapWallOrnIndices[16]; // @ G0261_auc_CurrentMapWallOrnamentIndices
- byte _currMapFloorOrnIndices[16]; // @ G0262_auc_CurrentMapFloorOrnamentIndices
- byte _currMapDoorOrnIndices[18]; // @ G0263_auc_CurrentMapDoorOrnamentIndices
-
- int16 _currMapViAltarIndex; // @ G0266_i_CurrentMapViAltarWallOrnamentIndex
+ int16 _currMapAlcoveOrnIndices[kAlcoveOrnCount] = {0}; // @ G0267_ai_CurrentMapAlcoveOrnamentIndices
+ int16 _currMapFountainOrnIndices[kFountainOrnCount] = {0}; // @ G0268_ai_CurrentMapFountainOrnamentIndices
+ int16 _currMapWallOrnInfo[16][2] = {0}; // @ G0101_aai_CurrentMapWallOrnamentsInf
+ int16 _currMapFloorOrnInfo[16][2] = {0}; // @ G0102_aai_CurrentMapFloorOrnamentsInfo
+ int16 _currMapDoorOrnInfo[17][2] = {0}; // @ G0103_aai_CurrentMapDoorOrnamentsInfo
+ byte *_currMapAllowedCreatureTypes = NULL; // @ G0264_puc_CurrentMapAllowedCreatureTypes
+ byte _currMapWallOrnIndices[16] = {0}; // @ G0261_auc_CurrentMapWallOrnamentIndices
+ byte _currMapFloorOrnIndices[16] = {0}; // @ G0262_auc_CurrentMapFloorOrnamentIndices
+ byte _currMapDoorOrnIndices[18] = {0}; // @ G0263_auc_CurrentMapDoorOrnamentIndices
+
+ int16 _currMapViAltarIndex = 0; // @ G0266_i_CurrentMapViAltarWallOrnamentIndex
};
}