DM: Fix some compilation errors under MSVC9

This commit is contained in:
Strangerke 2016-06-03 23:47:04 +02:00 committed by Bendegúz Nagy
parent b9935dfddc
commit 24c7c1e905
4 changed files with 149 additions and 65 deletions

View File

@ -53,7 +53,62 @@ void DungeonMan::mapCoordsAfterRelMovement(direction dir, int16 stepsForward, in
posY += dirIntoStepCountNorth[dir] * stepsRight;
}
DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL), _maps(NULL), _rawMapData(NULL) {}
DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL), _maps(NULL), _rawMapData(NULL) {
_dunData.columCount = 0;
_dunData.eventMaximumCount = 0;
_dunData.mapsFirstColumnIndex = nullptr;
_dunData.columnsCumulativeSquareThingCount = nullptr;
_dunData.squareFirstThings = nullptr;
_dunData.textData = nullptr;
_dunData.mapData = nullptr;
for (int i = 0; i < 16; i++)
_dunData.thingsData[i] = nullptr;
_currMap.partyDir = kDirNorth;
_currMap.partyPosX = 0;
_currMap.partyPosY = 0;
_currMap.currPartyMapIndex = 0;
_currMap.index = 0;
_currMap.width = 0;
_currMap.height = 0;
_currMap.data = nullptr;
_currMap.map = nullptr;
_currMap.colCumulativeSquareFirstThingCount = nullptr;
_messages.newGame = true;
_messages.restartGameRequest = false;
_rawDunFileDataSize = 0;
_rawDunFileData = nullptr;
_fileHeader.dungeonId = 0;
_fileHeader.ornamentRandomSeed = 0;
_fileHeader.rawMapDataSize = 0;
_fileHeader.mapCount = 0;
_fileHeader.textDataWordCount = 0;
_fileHeader.partyStartDir = kDirNorth;
_fileHeader.partyStartPosX = 0;
_fileHeader.partyStartPosY = 0;
_fileHeader.squareFirstThingCount = 0;
for (int i = 0; i < 16; i++)
_fileHeader.thingCounts[i] = 0;
_maps = nullptr;
_rawMapData = nullptr;
_currMapInscriptionWallOrnIndex = 0;
_isFacingAlcove = false;
_isFacingViAltar = false;
_isFacingFountain = false;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 6; j++)
_dungeonViewClickableBoxes[j][i] = 0;
}
DungeonMan::~DungeonMan() {
delete[] _rawDunFileData;

View File

@ -331,7 +331,6 @@ public:
byte toByte() { return data; } // I don't like 'em casts
};
struct DungeonFileHeader {
uint16 dungeonId; // @ G0526_ui_DungeonID
// equal to dungeonId
@ -366,21 +365,19 @@ struct Map {
uint8 doorSet0, doorSet1;
}; // @ MAP
struct DungeonData {
// I have no idea the heck is this
uint16 *mapsFirstColumnIndex = NULL; // @ G0281_pui_DungeonMapsFirstColumnIndex
uint16 *mapsFirstColumnIndex; // @ G0281_pui_DungeonMapsFirstColumnIndex
uint16 columCount; // @ G0282_ui_DungeonColumnCount
// I have no idea the heck is this
uint16 *columnsCumulativeSquareThingCount = NULL; // @ G0280_pui_DungeonColumnsCumulativeSquareThingCount
Thing *squareFirstThings = NULL; // @ G0283_pT_SquareFirstThings
uint16 *textData = NULL; // @ G0260_pui_DungeonTextData
uint16 *columnsCumulativeSquareThingCount; // @ G0280_pui_DungeonColumnsCumulativeSquareThingCount
Thing *squareFirstThings; // @ G0283_pT_SquareFirstThings
uint16 *textData; // @ G0260_pui_DungeonTextData
uint16 **thingsData[16] = {NULL}; // @ G0284_apuc_ThingData
uint16 **thingsData[16]; // @ G0284_apuc_ThingData
byte ***mapData = NULL; // @ G0279_pppuc_DungeonMapData
byte ***mapData; // @ G0279_pppuc_DungeonMapData
// TODO: ??? is this doing here
uint16 eventMaximumCount; // @ G0369_ui_EventMaximumCount
@ -393,21 +390,18 @@ struct CurrMapData {
uint8 currPartyMapIndex; // @ G0309_i_PartyMapIndex
uint8 index; // @ G0272_i_CurrentMapIndex
byte **data = NULL; // @ G0271_ppuc_CurrentMapData
Map *map = NULL; // @ G0269_ps_CurrentMap
byte **data; // @ G0271_ppuc_CurrentMapData
Map *map; // @ G0269_ps_CurrentMap
uint16 width; // @ G0273_i_CurrentMapWidth
uint16 height; // @ G0274_i_CurrentMapHeight
uint16 *colCumulativeSquareFirstThingCount = NULL; // @G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount
uint16 *colCumulativeSquareFirstThingCount; // @G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount
}; // @ AGGREGATE
struct Messages {
bool newGame = true; // @ G0298_B_NewGame
bool restartGameRequest = false; // @ G0523_B_RestartGameRequested
bool newGame; // @ G0298_B_NewGame
bool restartGameRequest; // @ G0523_B_RestartGameRequested
}; // @ AGGREGATE
class DungeonMan {
DMEngine *_vm;
@ -446,15 +440,15 @@ public:
void setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect
void decodeText(char *destString, Thing thing, TextType type); // F0168_DUNGEON_DecodeText
uint32 _rawDunFileDataSize = 0; // @ probably NONE
byte *_rawDunFileData = NULL; // @ ???
uint32 _rawDunFileDataSize; // @ probably NONE
byte *_rawDunFileData; // @ ???
DungeonFileHeader _fileHeader; // @ G0278_ps_DungeonHeader
DungeonData _dunData; // @ NONE
CurrMapData _currMap; // @ NONE
Map *_maps = NULL; // @ G0277_ps_DungeonMaps
Map *_maps; // @ G0277_ps_DungeonMaps
// does not have to be freed
byte *_rawMapData = NULL; // @ G0276_puc_DungeonRawMapData
byte *_rawMapData; // @ G0276_puc_DungeonRawMapData
Messages _messages; // @ NONE;
int16 _currMapInscriptionWallOrnIndex; // @ G0265_i_CurrentMapInscriptionWallOrnamentIndex

View File

@ -633,15 +633,62 @@ int gFountainOrnIndices[kFountainOrnCount] = {35}; // @ G0193_ai_Graphic558_Foun
byte gAlcoveOrnIndices[kAlcoveOrnCount] = { // @ G0192_auc_Graphic558_AlcoveOrnamentIndices
1, /* Square Alcove */
2, /* Vi Altar */
3}; /* Arched Alcove */
3}; /* Arched Alcove */
}
using namespace DM;
DisplayMan::DisplayMan(DMEngine *dmEngine) :
_vm(dmEngine), _screenWidth(0), _screenHeight(0),
_vgaBuffer(NULL), _bitmaps(NULL) {}
DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
_vgaBuffer = nullptr;
_bitmaps = nullptr;
_grapItemCount = 0;
_packedItemPos = nullptr;
_packedBitmaps = nullptr;
_bitmaps = nullptr;
_tmpBitmap = nullptr;
_floorBitmap = nullptr;
_ceilingBitmap = nullptr;
_currMapAllowedCreatureTypes = nullptr;
_screenWidth = _screenHeight = 0;
_championPortraitOrdinal = 0;
_currMapViAltarIndex = 0;
for (int i = 0; i < 25; i++)
_wallSetBitMaps[i] = nullptr;
for (int i = 0; i < kStairsGraphicCount; i++)
_stairIndices[i] = 0;
for (int i = 0; i < 4; i++)
_palChangesProjectile[i] = nullptr;
for (int i = 0; i < kAlcoveOrnCount; i++)
_currMapAlcoveOrnIndices[i] = 0;
for (int i = 0; i < kFountainOrnCount; i++)
_currMapFountainOrnIndices[i] = 0;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 16; j++) {
_currMapWallOrnInfo[j][i] = 0;
_currMapFloorOrnInfo[j][i] = 0;
}
for (int j = 0; j < 17; j++) {
_currMapDoorOrnInfo[j][i] = 0;
}
}
for (int i = 0; i < 16; i++) {
_currMapWallOrnIndices[i] = 0;
_currMapFloorOrnIndices[i] = 0;
}
for (int i = 0; i < 18; i++)
_currMapDoorOrnIndices[i] = 0;
Thing _inscriptionThing = Thing::thingNone;
}
DisplayMan::~DisplayMan() {
delete[] _packedItemPos;

View File

@ -121,36 +121,26 @@ extern Viewport gDungeonViewport;
#define kDoorOrnDestroyedMask 15 // @ C15_DOOR_ORNAMENT_DESTROYED_MASK
#define kDoorOrnThivesEyeMask 16 // @ C16_DOOR_ORNAMENT_THIEVES_EYE_MASK
class DisplayMan {
DMEngine *_vm = NULL;
DMEngine *_vm;
uint16 _screenWidth;
uint16 _screenHeight = 0;
byte *_vgaBuffer = NULL;
uint16 _screenHeight;
byte *_vgaBuffer;
/// Related to graphics.dat file
uint16 _grapItemCount = 0; // @ G0632_ui_GraphicCount
uint32 *_packedItemPos = NULL;
byte *_packedBitmaps = NULL;
byte **_bitmaps = NULL;
uint16 _grapItemCount; // @ G0632_ui_GraphicCount
uint32 *_packedItemPos;
byte *_packedBitmaps;
byte **_bitmaps;
// pointers 13,14 and [15-19] are owned by this array
byte *_wallSetBitMaps[25] = {NULL}; // @G[0696..0710]_puc_Bitmap_WallSet_...
uint16 _stairIndices[kStairsGraphicCount] = {0};
byte *_wallSetBitMaps[25]; // @G[0696..0710]_puc_Bitmap_WallSet_...
uint16 _stairIndices[kStairsGraphicCount];
// pointers are not owned by these fields
byte *_floorBitmap = NULL;
byte *_ceilingBitmap = NULL;
byte *_palChangesProjectile[4] = {NULL}; // @G0075_apuc_PaletteChanges_Projectile
byte *_floorBitmap;
byte *_ceilingBitmap;
byte *_palChangesProjectile[4]; // @G0075_apuc_PaletteChanges_Projectile
DisplayMan(const DisplayMan &other); // no implementation on purpose
void operator=(const DisplayMan &rhs); // no implementation on purpose
@ -185,16 +175,14 @@ class DisplayMan {
bool isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex); // @ F0107_DUNGEONVIEW_IsDrawnWallOrnamentAnAlcove_CPSF
// some methods use this for a stratchpad, don't make assumptions about content between function calls
byte *_tmpBitmap = NULL;
byte *_tmpBitmap;
public:
DisplayMan(DMEngine *dmEngine);
~DisplayMan();
void setUpScreens(uint16 width, uint16 height);
void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader, F0460_START_InitializeGraphicData
void loadCurrentMapGraphics();
void loadPalette(uint16 *palette);
/// Gives the width of an IMG0 type item
@ -222,20 +210,20 @@ public:
void drawDungeon(direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF
void updateScreen();
int16 _championPortraitOrdinal = 0; // @ G0289_i_DungeonView_ChampionPortraitOrdinal
int16 _currMapAlcoveOrnIndices[kAlcoveOrnCount] = {0}; // @ G0267_ai_CurrentMapAlcoveOrnamentIndices
int16 _currMapFountainOrnIndices[kFountainOrnCount] = {0}; // @ G0268_ai_CurrentMapFountainOrnamentIndices
int16 _currMapWallOrnInfo[16][2] = {0}; // @ G0101_aai_CurrentMapWallOrnamentsInfo
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 _championPortraitOrdinal; // @ G0289_i_DungeonView_ChampionPortraitOrdinal
int16 _currMapAlcoveOrnIndices[kAlcoveOrnCount]; // @ G0267_ai_CurrentMapAlcoveOrnamentIndices
int16 _currMapFountainOrnIndices[kFountainOrnCount]; // @ G0268_ai_CurrentMapFountainOrnamentIndices
int16 _currMapWallOrnInfo[16][2]; // @ G0101_aai_CurrentMapWallOrnamentsInfo
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 = 0; // @ G0266_i_CurrentMapViAltarWallOrnamentIndex
int16 _currMapViAltarIndex; // @ G0266_i_CurrentMapViAltarWallOrnamentIndex
Thing _inscriptionThing = Thing::thingNone; // @ G0290_T_DungeonView_InscriptionThing
Thing _inscriptionThing; // @ G0290_T_DungeonView_InscriptionThing
};
}