mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
DM: Some renaming
This commit is contained in:
parent
7a25591999
commit
ea33eb8c87
@ -175,8 +175,8 @@ enum ChampionAction {
|
||||
|
||||
|
||||
class Skill {
|
||||
int TemporaryExperience;
|
||||
long Experience;
|
||||
int _temporaryExperience;
|
||||
long _experience;
|
||||
}; // @ SKILL
|
||||
|
||||
class Champion {
|
||||
@ -209,7 +209,7 @@ public:
|
||||
int16 _water;
|
||||
uint16 _load;
|
||||
int16 _shieldDefense;
|
||||
byte Portrait[464]; // 32 x 29 pixel portrait
|
||||
byte _portrait[464]; // 32 x 29 pixel portrait
|
||||
|
||||
Thing getSlot(ChampionSlot slot) { return _slots[slot]; }
|
||||
void setSlot(ChampionSlot slot, Thing val) { _slots[slot] = val; }
|
||||
|
@ -52,24 +52,24 @@ enum ThingType {
|
||||
}; // @ C[00..15]_THING_TYPE_...
|
||||
|
||||
class Thing {
|
||||
uint16 data;
|
||||
uint16 _data;
|
||||
public:
|
||||
static const Thing thingNone;
|
||||
static const Thing thingEndOfList;
|
||||
static const Thing _thingNone;
|
||||
static const Thing _thingEndOfList;
|
||||
|
||||
Thing() : data(0) {}
|
||||
Thing() : _data(0) {}
|
||||
Thing(uint16 d) { set(d); }
|
||||
|
||||
void set(uint16 d) {
|
||||
data = d;
|
||||
_data = d;
|
||||
}
|
||||
|
||||
byte getCell() const { return data >> 14; }
|
||||
ThingType getType() const { return (ThingType)((data >> 10) & 0xF); }
|
||||
uint16 getIndex() const { return data & 0x1FF; }
|
||||
uint16 toUint16() const { return data; } // I don't like 'em cast operators
|
||||
bool operator==(const Thing &rhs) const { return data == rhs.data; }
|
||||
bool operator!=(const Thing &rhs) const { return data != rhs.data; }
|
||||
byte getCell() const { return _data >> 14; }
|
||||
ThingType getType() const { return (ThingType)((_data >> 10) & 0xF); }
|
||||
uint16 getIndex() const { return _data & 0x1FF; }
|
||||
uint16 toUint16() const { return _data; } // I don't like 'em cast operators
|
||||
bool operator==(const Thing &rhs) const { return _data == rhs._data; }
|
||||
bool operator!=(const Thing &rhs) const { return _data != rhs._data; }
|
||||
}; // @ THING
|
||||
|
||||
|
||||
|
@ -216,17 +216,17 @@ void DungeonMan::mapCoordsAfterRelMovement(direction dir, int16 stepsForward, in
|
||||
}
|
||||
|
||||
DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL), _maps(NULL), _rawMapData(NULL) {
|
||||
_dunData.columCount = 0;
|
||||
_dunData.eventMaximumCount = 0;
|
||||
_dunData._columCount = 0;
|
||||
_dunData._eventMaximumCount = 0;
|
||||
|
||||
_dunData.mapsFirstColumnIndex = nullptr;
|
||||
_dunData.columnsCumulativeSquareThingCount = nullptr;
|
||||
_dunData.squareFirstThings = nullptr;
|
||||
_dunData.textData = nullptr;
|
||||
_dunData.mapData = nullptr;
|
||||
_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;
|
||||
_dunData._thingsData[i] = nullptr;
|
||||
|
||||
_currMap.partyDir = kDirNorth;
|
||||
_currMap.partyPosX = 0;
|
||||
@ -246,18 +246,18 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL
|
||||
_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;
|
||||
_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;
|
||||
_fileHeader._thingCounts[i] = 0;
|
||||
|
||||
_maps = nullptr;
|
||||
_rawMapData = nullptr;
|
||||
@ -275,15 +275,15 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine), _rawDunFileData(NULL
|
||||
DungeonMan::~DungeonMan() {
|
||||
delete[] _rawDunFileData;
|
||||
delete[] _maps;
|
||||
delete[] _dunData.mapsFirstColumnIndex;
|
||||
delete[] _dunData.columnsCumulativeSquareThingCount;
|
||||
delete[] _dunData.squareFirstThings;
|
||||
delete[] _dunData.textData;
|
||||
delete[] _dunData.mapData;
|
||||
delete[] _dunData._mapsFirstColumnIndex;
|
||||
delete[] _dunData._columnsCumulativeSquareThingCount;
|
||||
delete[] _dunData._squareFirstThings;
|
||||
delete[] _dunData._textData;
|
||||
delete[] _dunData._mapData;
|
||||
for (uint16 i = 0; i < 16; ++i) {
|
||||
if (_dunData.thingsData[i])
|
||||
delete[] _dunData.thingsData[i][0];
|
||||
delete[] _dunData.thingsData[i];
|
||||
if (_dunData._thingsData[i])
|
||||
delete[] _dunData._thingsData[i][0];
|
||||
delete[] _dunData._thingsData[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,8 +384,8 @@ unsigned char gThingDataWordCount[16] = {
|
||||
2 /* Explosion */
|
||||
}; // @ G0235_auc_Graphic559_ThingDataByteCount
|
||||
|
||||
const Thing Thing::thingNone(0);
|
||||
const Thing Thing::thingEndOfList(0xFFFE);
|
||||
const Thing Thing::_thingNone(0);
|
||||
const Thing Thing::_thingEndOfList(0xFFFE);
|
||||
|
||||
|
||||
void DungeonMan::loadDungeonFile() {
|
||||
@ -395,152 +395,152 @@ void DungeonMan::loadDungeonFile() {
|
||||
Common::MemoryReadStream dunDataStream(_rawDunFileData, _rawDunFileDataSize, DisposeAfterUse::NO);
|
||||
|
||||
// initialize _fileHeader
|
||||
_fileHeader.dungeonId = _fileHeader.ornamentRandomSeed = dunDataStream.readUint16BE();
|
||||
_fileHeader.rawMapDataSize = dunDataStream.readUint16BE();
|
||||
_fileHeader.mapCount = dunDataStream.readByte();
|
||||
_fileHeader._dungeonId = _fileHeader._ornamentRandomSeed = dunDataStream.readUint16BE();
|
||||
_fileHeader._rawMapDataSize = dunDataStream.readUint16BE();
|
||||
_fileHeader._mapCount = dunDataStream.readByte();
|
||||
dunDataStream.readByte(); // discard 1 byte
|
||||
_fileHeader.textDataWordCount = dunDataStream.readUint16BE();
|
||||
_fileHeader._textDataWordCount = dunDataStream.readUint16BE();
|
||||
uint16 partyPosition = dunDataStream.readUint16BE();
|
||||
_fileHeader.partyStartDir = (direction)((partyPosition >> 10) & 3);
|
||||
_fileHeader.partyStartPosY = (partyPosition >> 5) & 0x1F;
|
||||
_fileHeader.partyStartPosX = (partyPosition >> 0) & 0x1F;
|
||||
_fileHeader.squareFirstThingCount = dunDataStream.readUint16BE();
|
||||
_fileHeader._partyStartDir = (direction)((partyPosition >> 10) & 3);
|
||||
_fileHeader._partyStartPosY = (partyPosition >> 5) & 0x1F;
|
||||
_fileHeader._partyStartPosX = (partyPosition >> 0) & 0x1F;
|
||||
_fileHeader._squareFirstThingCount = dunDataStream.readUint16BE();
|
||||
for (uint16 i = 0; i < kThingTypeTotal; ++i)
|
||||
_fileHeader.thingCounts[i] = dunDataStream.readUint16BE();
|
||||
_fileHeader._thingCounts[i] = dunDataStream.readUint16BE();
|
||||
|
||||
// init party position and mapindex
|
||||
if (_messages.newGame) {
|
||||
_currMap.partyDir = _fileHeader.partyStartDir;
|
||||
_currMap.partyPosX = _fileHeader.partyStartPosX;
|
||||
_currMap.partyPosY = _fileHeader.partyStartPosY;
|
||||
_currMap.partyDir = _fileHeader._partyStartDir;
|
||||
_currMap.partyPosX = _fileHeader._partyStartPosX;
|
||||
_currMap.partyPosY = _fileHeader._partyStartPosY;
|
||||
_currMap.currPartyMapIndex = 0;
|
||||
}
|
||||
|
||||
// load map data
|
||||
delete[] _maps;
|
||||
_maps = new Map[_fileHeader.mapCount];
|
||||
for (uint16 i = 0; i < _fileHeader.mapCount; ++i) {
|
||||
_maps[i].rawDunDataOffset = dunDataStream.readUint16BE();
|
||||
_maps = new Map[_fileHeader._mapCount];
|
||||
for (uint16 i = 0; i < _fileHeader._mapCount; ++i) {
|
||||
_maps[i]._rawDunDataOffset = dunDataStream.readUint16BE();
|
||||
dunDataStream.readUint32BE(); // discard 4 bytes
|
||||
_maps[i].offsetMapX = dunDataStream.readByte();
|
||||
_maps[i].offsetMapY = dunDataStream.readByte();
|
||||
_maps[i]._offsetMapX = dunDataStream.readByte();
|
||||
_maps[i]._offsetMapY = dunDataStream.readByte();
|
||||
|
||||
uint16 tmp = dunDataStream.readUint16BE();
|
||||
_maps[i].height = tmp >> 11;
|
||||
_maps[i].width = (tmp >> 6) & 0x1F;
|
||||
_maps[i].level = tmp & 0x1F; // Only used in DMII
|
||||
_maps[i]._height = tmp >> 11;
|
||||
_maps[i]._width = (tmp >> 6) & 0x1F;
|
||||
_maps[i]._level = tmp & 0x1F; // Only used in DMII
|
||||
|
||||
tmp = dunDataStream.readUint16BE();
|
||||
_maps[i].randFloorOrnCount = tmp >> 12;
|
||||
_maps[i].floorOrnCount = (tmp >> 8) & 0xF;
|
||||
_maps[i].randWallOrnCount = (tmp >> 4) & 0xF;
|
||||
_maps[i].wallOrnCount = tmp & 0xF;
|
||||
_maps[i]._randFloorOrnCount = tmp >> 12;
|
||||
_maps[i]._floorOrnCount = (tmp >> 8) & 0xF;
|
||||
_maps[i]._randWallOrnCount = (tmp >> 4) & 0xF;
|
||||
_maps[i]._wallOrnCount = tmp & 0xF;
|
||||
|
||||
tmp = dunDataStream.readUint16BE();
|
||||
_maps[i].difficulty = tmp >> 12;
|
||||
_maps[i].creatureTypeCount = (tmp >> 4) & 0xF;
|
||||
_maps[i].doorOrnCount = tmp & 0xF;
|
||||
_maps[i]._difficulty = tmp >> 12;
|
||||
_maps[i]._creatureTypeCount = (tmp >> 4) & 0xF;
|
||||
_maps[i]._doorOrnCount = tmp & 0xF;
|
||||
|
||||
tmp = dunDataStream.readUint16BE();
|
||||
_maps[i].doorSet1 = (tmp >> 12) & 0xF;
|
||||
_maps[i].doorSet0 = (tmp >> 8) & 0xF;
|
||||
_maps[i].wallSet = (WallSet)((tmp >> 4) & 0xF);
|
||||
_maps[i].floorSet = (FloorSet)(tmp & 0xF);
|
||||
_maps[i]._doorSet1 = (tmp >> 12) & 0xF;
|
||||
_maps[i]._doorSet0 = (tmp >> 8) & 0xF;
|
||||
_maps[i]._wallSet = (WallSet)((tmp >> 4) & 0xF);
|
||||
_maps[i]._floorSet = (FloorSet)(tmp & 0xF);
|
||||
}
|
||||
|
||||
// TODO: ??? is this - begin
|
||||
delete[] _dunData.mapsFirstColumnIndex;
|
||||
_dunData.mapsFirstColumnIndex = new uint16[_fileHeader.mapCount];
|
||||
delete[] _dunData._mapsFirstColumnIndex;
|
||||
_dunData._mapsFirstColumnIndex = new uint16[_fileHeader._mapCount];
|
||||
uint16 columCount = 0;
|
||||
for (uint16 i = 0; i < _fileHeader.mapCount; ++i) {
|
||||
_dunData.mapsFirstColumnIndex[i] = columCount;
|
||||
columCount += _maps[i].width + 1;
|
||||
for (uint16 i = 0; i < _fileHeader._mapCount; ++i) {
|
||||
_dunData._mapsFirstColumnIndex[i] = columCount;
|
||||
columCount += _maps[i]._width + 1;
|
||||
}
|
||||
_dunData.columCount = columCount;
|
||||
_dunData._columCount = columCount;
|
||||
// TODO: ??? is this - end
|
||||
|
||||
|
||||
uint32 actualSquareFirstThingCount = _fileHeader.squareFirstThingCount;
|
||||
uint32 actualSquareFirstThingCount = _fileHeader._squareFirstThingCount;
|
||||
if (_messages.newGame) // TODO: what purpose does this serve?
|
||||
_fileHeader.squareFirstThingCount += 300;
|
||||
_fileHeader._squareFirstThingCount += 300;
|
||||
|
||||
// TODO: ??? is this - begin
|
||||
delete[] _dunData.columnsCumulativeSquareThingCount;
|
||||
_dunData.columnsCumulativeSquareThingCount = new uint16[columCount];
|
||||
delete[] _dunData._columnsCumulativeSquareThingCount;
|
||||
_dunData._columnsCumulativeSquareThingCount = new uint16[columCount];
|
||||
for (uint16 i = 0; i < columCount; ++i)
|
||||
_dunData.columnsCumulativeSquareThingCount[i] = dunDataStream.readUint16BE();
|
||||
_dunData._columnsCumulativeSquareThingCount[i] = dunDataStream.readUint16BE();
|
||||
// TODO: ??? is this - end
|
||||
|
||||
// TODO: ??? is this - begin
|
||||
delete[] _dunData.squareFirstThings;
|
||||
_dunData.squareFirstThings = new Thing[_fileHeader.squareFirstThingCount];
|
||||
delete[] _dunData._squareFirstThings;
|
||||
_dunData._squareFirstThings = new Thing[_fileHeader._squareFirstThingCount];
|
||||
for (uint16 i = 0; i < actualSquareFirstThingCount; ++i)
|
||||
_dunData.squareFirstThings[i].set(dunDataStream.readUint16BE());
|
||||
_dunData._squareFirstThings[i].set(dunDataStream.readUint16BE());
|
||||
if (_messages.newGame)
|
||||
for (uint16 i = 0; i < 300; ++i)
|
||||
_dunData.squareFirstThings[actualSquareFirstThingCount + i] = Thing::thingNone;
|
||||
_dunData._squareFirstThings[actualSquareFirstThingCount + i] = Thing::_thingNone;
|
||||
|
||||
// TODO: ??? is this - end
|
||||
|
||||
// load text data
|
||||
delete[] _dunData.textData;
|
||||
_dunData.textData = new uint16[_fileHeader.textDataWordCount];
|
||||
for (uint16 i = 0; i < _fileHeader.textDataWordCount; ++i)
|
||||
_dunData.textData[i] = dunDataStream.readUint16BE();
|
||||
delete[] _dunData._textData;
|
||||
_dunData._textData = new uint16[_fileHeader._textDataWordCount];
|
||||
for (uint16 i = 0; i < _fileHeader._textDataWordCount; ++i)
|
||||
_dunData._textData[i] = dunDataStream.readUint16BE();
|
||||
|
||||
// TODO: ??? what this
|
||||
if (_messages.newGame)
|
||||
_dunData.eventMaximumCount = 100;
|
||||
_dunData._eventMaximumCount = 100;
|
||||
|
||||
|
||||
// load things
|
||||
for (uint16 thingType = kDoorThingType; thingType < kThingTypeTotal; ++thingType) {
|
||||
uint16 thingCount = _fileHeader.thingCounts[thingType];
|
||||
uint16 thingCount = _fileHeader._thingCounts[thingType];
|
||||
if (_messages.newGame) {
|
||||
_fileHeader.thingCounts[thingType] = MIN((thingType == kExplosionThingType) ? 768 : 1024, thingCount + gAdditionalThingCounts[thingType]);
|
||||
_fileHeader._thingCounts[thingType] = MIN((thingType == kExplosionThingType) ? 768 : 1024, thingCount + gAdditionalThingCounts[thingType]);
|
||||
}
|
||||
uint16 thingStoreWordCount = gThingDataWordCount[thingType];
|
||||
|
||||
if (thingStoreWordCount == 0)
|
||||
continue;
|
||||
|
||||
if (_dunData.thingsData[thingType]) {
|
||||
delete[] _dunData.thingsData[thingType][0];
|
||||
delete[] _dunData.thingsData[thingType];
|
||||
if (_dunData._thingsData[thingType]) {
|
||||
delete[] _dunData._thingsData[thingType][0];
|
||||
delete[] _dunData._thingsData[thingType];
|
||||
}
|
||||
_dunData.thingsData[thingType] = new uint16*[_fileHeader.thingCounts[thingType]];
|
||||
_dunData.thingsData[thingType][0] = new uint16[_fileHeader.thingCounts[thingType] * thingStoreWordCount];
|
||||
for (uint16 i = 0; i < _fileHeader.thingCounts[thingType]; ++i)
|
||||
_dunData.thingsData[thingType][i] = _dunData.thingsData[thingType][0] + i * thingStoreWordCount;
|
||||
_dunData._thingsData[thingType] = new uint16*[_fileHeader._thingCounts[thingType]];
|
||||
_dunData._thingsData[thingType][0] = new uint16[_fileHeader._thingCounts[thingType] * thingStoreWordCount];
|
||||
for (uint16 i = 0; i < _fileHeader._thingCounts[thingType]; ++i)
|
||||
_dunData._thingsData[thingType][i] = _dunData._thingsData[thingType][0] + i * thingStoreWordCount;
|
||||
|
||||
if (thingType == kGroupThingType) {
|
||||
for (uint16 i = 0; i < thingCount; ++i)
|
||||
for (uint16 j = 0; j < thingStoreWordCount; ++j) {
|
||||
if (j == 2 || j == 3)
|
||||
_dunData.thingsData[thingType][i][j] = dunDataStream.readByte();
|
||||
_dunData._thingsData[thingType][i][j] = dunDataStream.readByte();
|
||||
else
|
||||
_dunData.thingsData[thingType][i][j] = dunDataStream.readUint16BE();
|
||||
_dunData._thingsData[thingType][i][j] = dunDataStream.readUint16BE();
|
||||
}
|
||||
} else if (thingType == kProjectileThingType) {
|
||||
for (uint16 i = 0; i < thingCount; ++i) {
|
||||
_dunData.thingsData[thingType][i][0] = dunDataStream.readUint16BE();
|
||||
_dunData.thingsData[thingType][i][1] = dunDataStream.readUint16BE();
|
||||
_dunData.thingsData[thingType][i][2] = dunDataStream.readByte();
|
||||
_dunData.thingsData[thingType][i][3] = dunDataStream.readByte();
|
||||
_dunData.thingsData[thingType][i][4] = dunDataStream.readUint16BE();
|
||||
_dunData._thingsData[thingType][i][0] = dunDataStream.readUint16BE();
|
||||
_dunData._thingsData[thingType][i][1] = dunDataStream.readUint16BE();
|
||||
_dunData._thingsData[thingType][i][2] = dunDataStream.readByte();
|
||||
_dunData._thingsData[thingType][i][3] = dunDataStream.readByte();
|
||||
_dunData._thingsData[thingType][i][4] = dunDataStream.readUint16BE();
|
||||
}
|
||||
} else {
|
||||
for (uint16 i = 0; i < thingCount; ++i) {
|
||||
for (uint16 j = 0; j < thingStoreWordCount; ++j)
|
||||
_dunData.thingsData[thingType][i][j] = dunDataStream.readUint16BE();
|
||||
_dunData._thingsData[thingType][i][j] = dunDataStream.readUint16BE();
|
||||
}
|
||||
}
|
||||
|
||||
if (_messages.newGame) {
|
||||
if ((thingType == kGroupThingType) || thingType >= kProjectileThingType)
|
||||
_dunData.eventMaximumCount += _fileHeader.thingCounts[thingType];
|
||||
_dunData._eventMaximumCount += _fileHeader._thingCounts[thingType];
|
||||
for (uint16 i = 0; i < gAdditionalThingCounts[thingType]; ++i) {
|
||||
_dunData.thingsData[thingType][thingCount + i][0] = Thing::thingNone.toUint16();
|
||||
_dunData._thingsData[thingType][thingCount + i][0] = Thing::_thingNone.toUint16();
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,16 +553,16 @@ void DungeonMan::loadDungeonFile() {
|
||||
|
||||
|
||||
if (!_messages.restartGameRequest) {
|
||||
uint8 mapCount = _fileHeader.mapCount;
|
||||
delete[] _dunData.mapData;
|
||||
_dunData.mapData = new byte**[_dunData.columCount + mapCount];
|
||||
byte **colFirstSquares = (byte**)_dunData.mapData + mapCount;
|
||||
uint8 mapCount = _fileHeader._mapCount;
|
||||
delete[] _dunData._mapData;
|
||||
_dunData._mapData = new byte**[_dunData._columCount + mapCount];
|
||||
byte **colFirstSquares = (byte**)_dunData._mapData + mapCount;
|
||||
for (uint8 i = 0; i < mapCount; ++i) {
|
||||
_dunData.mapData[i] = colFirstSquares;
|
||||
byte *square = _rawMapData + _maps[i].rawDunDataOffset;
|
||||
_dunData._mapData[i] = colFirstSquares;
|
||||
byte *square = _rawMapData + _maps[i]._rawDunDataOffset;
|
||||
*colFirstSquares++ = square;
|
||||
for (uint16 w = 1; w <= _maps[i].width; ++w) {
|
||||
square += _maps[i].height + 1;
|
||||
for (uint16 w = 1; w <= _maps[i]._width; ++w) {
|
||||
square += _maps[i]._height + 1;
|
||||
*colFirstSquares++ = square;
|
||||
}
|
||||
}
|
||||
@ -571,12 +571,12 @@ void DungeonMan::loadDungeonFile() {
|
||||
|
||||
void DungeonMan::setCurrentMap(uint16 mapIndex) {
|
||||
_currMap.index = mapIndex;
|
||||
_currMap.data = _dunData.mapData[mapIndex];
|
||||
_currMap.data = _dunData._mapData[mapIndex];
|
||||
_currMap.map = _maps + mapIndex;
|
||||
_currMap.width = _maps[mapIndex].width + 1;
|
||||
_currMap.height = _maps[mapIndex].height + 1;
|
||||
_currMap.width = _maps[mapIndex]._width + 1;
|
||||
_currMap.height = _maps[mapIndex]._height + 1;
|
||||
_currMap.colCumulativeSquareFirstThingCount
|
||||
= &_dunData.columnsCumulativeSquareThingCount[_dunData.mapsFirstColumnIndex[mapIndex]];
|
||||
= &_dunData._columnsCumulativeSquareThingCount[_dunData._mapsFirstColumnIndex[mapIndex]];
|
||||
}
|
||||
|
||||
void DungeonMan::setCurrentMapAndPartyMap(uint16 mapIndex) {
|
||||
@ -585,16 +585,16 @@ void DungeonMan::setCurrentMapAndPartyMap(uint16 mapIndex) {
|
||||
byte *metaMapData = _currMap.data[_currMap.width - 1] + _currMap.height;
|
||||
_vm->_displayMan->_currMapAllowedCreatureTypes = metaMapData;
|
||||
|
||||
metaMapData += _currMap.map->creatureTypeCount;
|
||||
memcpy(_vm->_displayMan->_currMapWallOrnIndices, metaMapData, _currMap.map->wallOrnCount);
|
||||
metaMapData += _currMap.map->_creatureTypeCount;
|
||||
memcpy(_vm->_displayMan->_currMapWallOrnIndices, metaMapData, _currMap.map->_wallOrnCount);
|
||||
|
||||
metaMapData += _currMap.map->wallOrnCount;
|
||||
memcpy(_vm->_displayMan->_currMapFloorOrnIndices, metaMapData, _currMap.map->floorOrnCount);
|
||||
metaMapData += _currMap.map->_wallOrnCount;
|
||||
memcpy(_vm->_displayMan->_currMapFloorOrnIndices, metaMapData, _currMap.map->_floorOrnCount);
|
||||
|
||||
metaMapData += _currMap.map->wallOrnCount;
|
||||
memcpy(_vm->_displayMan->_currMapDoorOrnIndices, metaMapData, _currMap.map->doorOrnCount);
|
||||
metaMapData += _currMap.map->_wallOrnCount;
|
||||
memcpy(_vm->_displayMan->_currMapDoorOrnIndices, metaMapData, _currMap.map->_doorOrnCount);
|
||||
|
||||
_currMapInscriptionWallOrnIndex = _currMap.map->wallOrnCount;
|
||||
_currMapInscriptionWallOrnIndex = _currMap.map->_wallOrnCount;
|
||||
_vm->_displayMan->_currMapWallOrnIndices[_currMapInscriptionWallOrnIndex] = kWallOrnInscription;
|
||||
}
|
||||
|
||||
@ -651,8 +651,8 @@ int16 DungeonMan::getSquareFirstThingIndex(int16 mapX, int16 mapY) {
|
||||
Thing DungeonMan::getSquareFirstThing(int16 mapX, int16 mapY) {
|
||||
int16 index = getSquareFirstThingIndex(mapX, mapY);
|
||||
if (index == -1)
|
||||
return Thing::thingEndOfList;
|
||||
return _dunData.squareFirstThings[index];
|
||||
return Thing::_thingEndOfList;
|
||||
return _dunData._squareFirstThings[index];
|
||||
}
|
||||
|
||||
|
||||
@ -701,7 +701,7 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX,
|
||||
T0172010_ClosedFakeWall:
|
||||
setSquareAspectOrnOrdinals(aspectArray, leftOrnAllowed, frontOrnAllowed, rightOrnAllowed, dir, mapX, mapY, squareIsFakeWall);
|
||||
|
||||
while ((thing != Thing::thingEndOfList) && (thing.getType() <= kSensorThingType)) {
|
||||
while ((thing != Thing::_thingEndOfList) && (thing.getType() <= kSensorThingType)) {
|
||||
int16 sideIndex = (thing.getCell() - dir) & 3;
|
||||
if (sideIndex) {
|
||||
if (thing.getType() == kTextstringType) {
|
||||
@ -720,7 +720,7 @@ T0172010_ClosedFakeWall:
|
||||
thing = getNextThing(thing);
|
||||
}
|
||||
if (squareIsFakeWall && (_currMap.partyPosX != mapX) && (_currMap.partyPosY != mapY)) {
|
||||
aspectArray[kFirstGroupOrObjectAspect] = Thing::thingEndOfList.toUint16();
|
||||
aspectArray[kFirstGroupOrObjectAspect] = Thing::_thingEndOfList.toUint16();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -745,11 +745,11 @@ T0172010_ClosedFakeWall:
|
||||
square = footPrintsAllowed ? 8 : 0;
|
||||
// intentional fallthrough
|
||||
case kCorridorElemType:
|
||||
aspectArray[kFloorOrnOrdAspect] = getRandomOrnOrdinal(square.get(kCorridorRandOrnAllowed), _currMap.map->randFloorOrnCount, mapX, mapY, 30);
|
||||
aspectArray[kFloorOrnOrdAspect] = getRandomOrnOrdinal(square.get(kCorridorRandOrnAllowed), _currMap.map->_randFloorOrnCount, mapX, mapY, 30);
|
||||
T0172029_Teleporter:
|
||||
footPrintsAllowed = true;
|
||||
T0172030_Pit:
|
||||
while ((thing != Thing::thingEndOfList) && (thing.getType() <= kSensorThingType)) {
|
||||
while ((thing != Thing::_thingEndOfList) && (thing.getType() <= kSensorThingType)) {
|
||||
if (thing.getType() == kSensorThingType)
|
||||
aspectArray[kFloorOrnOrdAspect] = Sensor(getThingData(thing)).getOrnOrdinal();
|
||||
thing = getNextThing(thing);
|
||||
@ -773,7 +773,7 @@ T0172030_Pit:
|
||||
}
|
||||
footPrintsAllowed = true;
|
||||
T0172046_Stairs:
|
||||
while ((thing != Thing::thingEndOfList) && (thing.getType() <= kSensorThingType))
|
||||
while ((thing != Thing::_thingEndOfList) && (thing.getType() <= kSensorThingType))
|
||||
thing = getNextThing(thing);
|
||||
T0172049_Footprints:
|
||||
unsigned char scentOrdinal; // see next line comment
|
||||
@ -785,7 +785,7 @@ T0172049_Footprints:
|
||||
|
||||
void DungeonMan::setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowed, bool frontAllowed, bool rightAllowed, direction dir,
|
||||
int16 mapX, int16 mapY, bool isFakeWall) {
|
||||
int16 ornCount = _currMap.map->randWallOrnCount;
|
||||
int16 ornCount = _currMap.map->_randWallOrnCount;
|
||||
|
||||
turnDirRight(dir);
|
||||
aspectArray[kRightWallOrnOrdAspect] = getRandomOrnOrdinal(leftAllowed, ornCount, mapX, ++mapY * (dir + 1), 30);
|
||||
@ -805,7 +805,7 @@ void DungeonMan::setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowe
|
||||
int16 DungeonMan::getRandomOrnOrdinal(bool allowed, int16 count, int16 mapX, int16 mapY, int16 modulo) {
|
||||
int16 index = (((((2000 + (mapX << 5) + mapY) * 31417) >> 1)
|
||||
+ (3000 + (_currMap.index << 6) + _currMap.width + _currMap.height) * 11
|
||||
+ _fileHeader.ornamentRandomSeed) >> 2) % modulo;
|
||||
+ _fileHeader._ornamentRandomSeed) >> 2) % modulo;
|
||||
if (allowed && index < count)
|
||||
return indexToOrdinal(index);
|
||||
return 0;
|
||||
@ -821,7 +821,7 @@ bool DungeonMan::isWallOrnAnAlcove(int16 wallOrnIndex) {
|
||||
}
|
||||
|
||||
uint16 *DungeonMan::getThingData(Thing thing) {
|
||||
return _dunData.thingsData[thing.getType()][thing.getIndex()];
|
||||
return _dunData._thingsData[thing.getType()][thing.getIndex()];
|
||||
}
|
||||
|
||||
Thing DungeonMan::getNextThing(Thing thing) {
|
||||
@ -931,7 +931,7 @@ char gInscriptionEscReplacementStrings[32][8] = { // @ G0257_aac_Graphic559_Insc
|
||||
|
||||
void DungeonMan::decodeText(char *destString, Thing thing, TextType type) {
|
||||
char sepChar;
|
||||
TextString textString(_dunData.thingsData[kTextstringType][thing.getIndex()]);
|
||||
TextString textString(_dunData._thingsData[kTextstringType][thing.getIndex()]);
|
||||
if ((textString.isVisible()) || (type & kDecodeEvenIfInvisible)) {
|
||||
type = (TextType)(type & ~kDecodeEvenIfInvisible);
|
||||
if (type == kTextTypeMessage) {
|
||||
@ -944,7 +944,7 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) {
|
||||
}
|
||||
uint16 codeCounter = 0;
|
||||
int16 escChar = 0;
|
||||
uint16 *codeWord = _dunData.textData + textString.getWordOffset();
|
||||
uint16 *codeWord = _dunData._textData + textString.getWordOffset();
|
||||
uint16 code = 0, codes = 0;
|
||||
char *escReplString = nullptr;
|
||||
for (;;) { /*infinite loop*/
|
||||
@ -998,7 +998,7 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) {
|
||||
|
||||
|
||||
uint16 DungeonMan::getObjectWeight(Thing thing) {
|
||||
if (thing == Thing::thingNone)
|
||||
if (thing == Thing::_thingNone)
|
||||
return 0;
|
||||
switch (thing.getType()) {
|
||||
case kWeaponThingType:
|
||||
@ -1016,7 +1016,7 @@ uint16 DungeonMan::getObjectWeight(Thing thing) {
|
||||
uint16 weight = 50;
|
||||
Container container = getThingData(thing);
|
||||
Thing slotThing = container.getNextContainedThing();
|
||||
while (slotThing != Thing::thingEndOfList) {
|
||||
while (slotThing != Thing::_thingEndOfList) {
|
||||
weight += getObjectWeight(slotThing);
|
||||
slotThing = getNextThing(slotThing);
|
||||
}
|
||||
|
@ -98,40 +98,40 @@ enum SquareAspectIndice {
|
||||
|
||||
|
||||
struct CreatureInfo {
|
||||
byte creatureAspectIndex;
|
||||
byte attackSoundOrdinal;
|
||||
uint16 attributes; /* Bits 15-14 Unreferenced */
|
||||
uint16 graphicInfo; /* Bits 11 and 6 Unreferenced */
|
||||
byte movementTicks; /* Value 255 means the creature cannot move */
|
||||
byte attackTicks; /* Minimum ticks between attacks */
|
||||
byte defense;
|
||||
byte baseHealth;
|
||||
byte attack;
|
||||
byte poisonAttack;
|
||||
byte dexterity;
|
||||
uint16 Ranges; /* Bits 7-4 Unreferenced */
|
||||
uint16 Properties;
|
||||
uint16 Resistances; /* Bits 15-12 and 3-0 Unreferenced */
|
||||
uint16 AnimationTicks; /* Bits 15-12 Unreferenced */
|
||||
uint16 WoundProbabilities; /* Contains 4 probabilities to wound a champion's Head (Bits 15-12), Legs (Bits 11-8), Torso (Bits 7-4) and Feet (Bits 3-0) */
|
||||
byte AttackType;
|
||||
byte _creatureAspectIndex;
|
||||
byte _attackSoundOrdinal;
|
||||
uint16 _attributes; /* Bits 15-14 Unreferenced */
|
||||
uint16 _graphicInfo; /* Bits 11 and 6 Unreferenced */
|
||||
byte _movementTicks; /* Value 255 means the creature cannot move */
|
||||
byte _attackTicks; /* Minimum ticks between attacks */
|
||||
byte _defense;
|
||||
byte _baseHealth;
|
||||
byte _attack;
|
||||
byte _poisonAttack;
|
||||
byte _dexterity;
|
||||
uint16 _ranges; /* Bits 7-4 Unreferenced */
|
||||
uint16 _properties;
|
||||
uint16 _resistances; /* Bits 15-12 and 3-0 Unreferenced */
|
||||
uint16 _animationTicks; /* Bits 15-12 Unreferenced */
|
||||
uint16 _woundProbabilities; /* Contains 4 probabilities to wound a champion's Head (Bits 15-12), Legs (Bits 11-8), Torso (Bits 7-4) and Feet (Bits 3-0) */
|
||||
byte _attackType;
|
||||
}; // @ CREATURE_INFO
|
||||
|
||||
|
||||
extern CreatureInfo gCreatureInfo[kCreatureTypeCount];
|
||||
|
||||
class Door {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Door(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Thing getNextThing() { return nextThing; }
|
||||
bool isMeleeDestructible() { return (attributes >> 8) & 1; }
|
||||
bool isMagicDestructible() { return (attributes >> 7) & 1; }
|
||||
bool hasButton() { return (attributes >> 6) & 1; }
|
||||
bool opensVertically() { return (attributes >> 5) & 1; }
|
||||
byte getOrnOrdinal() { return (attributes >> 1) & 0xF; }
|
||||
byte getType() { return attributes & 1; }
|
||||
Door(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
bool isMeleeDestructible() { return (_attributes >> 8) & 1; }
|
||||
bool isMagicDestructible() { return (_attributes >> 7) & 1; }
|
||||
bool hasButton() { return (_attributes >> 6) & 1; }
|
||||
bool opensVertically() { return (_attributes >> 5) & 1; }
|
||||
byte getOrnOrdinal() { return (_attributes >> 1) & 0xF; }
|
||||
byte getType() { return _attributes & 1; }
|
||||
}; // @ DOOR
|
||||
|
||||
enum TeleporterScope {
|
||||
@ -159,14 +159,14 @@ public:
|
||||
|
||||
|
||||
class TextString {
|
||||
Thing nextThing;
|
||||
uint16 textDataRef;
|
||||
Thing _nextThing;
|
||||
uint16 _textDataRef;
|
||||
public:
|
||||
TextString(uint16 *rawDat) : nextThing(rawDat[0]), textDataRef(rawDat[1]) {}
|
||||
TextString(uint16 *rawDat) : _nextThing(rawDat[0]), _textDataRef(rawDat[1]) {}
|
||||
|
||||
Thing getNextThing() { return nextThing; }
|
||||
uint16 getWordOffset() { return textDataRef >> 3; }
|
||||
bool isVisible() { return textDataRef & 1; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
uint16 getWordOffset() { return _textDataRef >> 3; }
|
||||
bool isVisible() { return _textDataRef & 1; }
|
||||
}; // @ TEXTSTRING
|
||||
|
||||
enum SensorActionType {
|
||||
@ -211,50 +211,50 @@ enum SensorType {
|
||||
};
|
||||
|
||||
class Sensor {
|
||||
Thing nextThing;
|
||||
uint16 datAndType;
|
||||
uint16 attributes;
|
||||
uint16 action;
|
||||
Thing _nextThing;
|
||||
uint16 _datAndType;
|
||||
uint16 _attributes;
|
||||
uint16 _action;
|
||||
public:
|
||||
Sensor(uint16 *rawDat) : nextThing(rawDat[0]), datAndType(rawDat[1]), attributes(rawDat[2]), action(rawDat[3]) {}
|
||||
Sensor(uint16 *rawDat) : _nextThing(rawDat[0]), _datAndType(rawDat[1]), _attributes(rawDat[2]), _action(rawDat[3]) {}
|
||||
|
||||
Thing getNextThing() { return nextThing; }
|
||||
SensorType getType() { return (SensorType)(datAndType & 0x7F); } // @ M39_TYPE
|
||||
uint16 getData() { return datAndType >> 7; } // @ M40_DATA
|
||||
uint16 getDataMask1() { return (datAndType >> 7) & 0xF; } // @ M42_MASK1
|
||||
uint16 getDataMask2() { return (datAndType >> 11) & 0xF; } // @ M43_MASK2
|
||||
void setData(int16 dat) { datAndType = (datAndType & 0x7F) | (dat << 7); } // @ M41_SET_DATA
|
||||
void setTypeDisabled() { datAndType &= 0xFF80; } // @ M44_SET_TYPE_DISABLED
|
||||
uint16 getOrnOrdinal() { return attributes >> 12; }
|
||||
bool isLocalAction() { return (attributes >> 11) & 1; }
|
||||
uint16 getDelay() { return (attributes >> 7) & 0xF; }
|
||||
bool hasSound() { return (attributes >> 6) & 1; }
|
||||
bool shouldRevert() { return (attributes >> 5) & 1; }
|
||||
SensorActionType getActionType() { return (SensorActionType)((attributes >> 3) & 3); }
|
||||
bool isSingleUse() { return (attributes >> 2) & 1; }
|
||||
uint16 getRemoteMapY() { return (action >> 11); }
|
||||
uint16 getRemoteMapX() { return (action >> 6) & 0x1F; }
|
||||
direction getRemoteDir() { return (direction)((action >> 4) & 3); }
|
||||
uint16 getLocalAction() { return (action >> 4); }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
SensorType getType() { return (SensorType)(_datAndType & 0x7F); } // @ M39_TYPE
|
||||
uint16 getData() { return _datAndType >> 7; } // @ M40_DATA
|
||||
uint16 getDataMask1() { return (_datAndType >> 7) & 0xF; } // @ M42_MASK1
|
||||
uint16 getDataMask2() { return (_datAndType >> 11) & 0xF; } // @ M43_MASK2
|
||||
void setData(int16 dat) { _datAndType = (_datAndType & 0x7F) | (dat << 7); } // @ M41_SET_DATA
|
||||
void setTypeDisabled() { _datAndType &= 0xFF80; } // @ M44_SET_TYPE_DISABLED
|
||||
uint16 getOrnOrdinal() { return _attributes >> 12; }
|
||||
bool isLocalAction() { return (_attributes >> 11) & 1; }
|
||||
uint16 getDelay() { return (_attributes >> 7) & 0xF; }
|
||||
bool hasSound() { return (_attributes >> 6) & 1; }
|
||||
bool shouldRevert() { return (_attributes >> 5) & 1; }
|
||||
SensorActionType getActionType() { return (SensorActionType)((_attributes >> 3) & 3); }
|
||||
bool isSingleUse() { return (_attributes >> 2) & 1; }
|
||||
uint16 getRemoteMapY() { return (_action >> 11); }
|
||||
uint16 getRemoteMapX() { return (_action >> 6) & 0x1F; }
|
||||
direction getRemoteDir() { return (direction)((_action >> 4) & 3); }
|
||||
uint16 getLocalAction() { return (_action >> 4); }
|
||||
// some macros missing, i got bored
|
||||
}; // @ SENSOR
|
||||
|
||||
class Group {
|
||||
Thing nextThing;
|
||||
Thing possessionID;
|
||||
byte type;
|
||||
byte position;
|
||||
uint16 health[4];
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
Thing _possessionID;
|
||||
byte _type;
|
||||
byte _position;
|
||||
uint16 _health[4];
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Group(uint16 *rawDat) : nextThing(rawDat[0]), possessionID(rawDat[1]), type(rawDat[2]),
|
||||
position(rawDat[3]), attributes(rawDat[8]) {
|
||||
health[0] = rawDat[4];
|
||||
health[1] = rawDat[5];
|
||||
health[2] = rawDat[6];
|
||||
health[3] = rawDat[7];
|
||||
Group(uint16 *rawDat) : _nextThing(rawDat[0]), _possessionID(rawDat[1]), _type(rawDat[2]),
|
||||
_position(rawDat[3]), _attributes(rawDat[8]) {
|
||||
_health[0] = rawDat[4];
|
||||
_health[1] = rawDat[5];
|
||||
_health[2] = rawDat[6];
|
||||
_health[3] = rawDat[7];
|
||||
}
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ GROUP
|
||||
|
||||
enum WeaponType {
|
||||
@ -271,13 +271,13 @@ enum WeaponType {
|
||||
kWeaponTypeThrowingStar = 32 // @ C32_WEAPON_THROWING_STAR
|
||||
};
|
||||
class Weapon {
|
||||
Thing nextThing;
|
||||
uint16 desc;
|
||||
Thing _nextThing;
|
||||
uint16 _desc;
|
||||
public:
|
||||
Weapon(uint16 *rawDat) : nextThing(rawDat[0]), desc(rawDat[1]) {}
|
||||
Weapon(uint16 *rawDat) : _nextThing(rawDat[0]), _desc(rawDat[1]) {}
|
||||
|
||||
WeaponType getType() { return (WeaponType)(desc & 0x7F); }
|
||||
Thing getNextThing() { return nextThing; }
|
||||
WeaponType getType() { return (WeaponType)(_desc & 0x7F); }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ WEAPON
|
||||
|
||||
enum ArmourType {
|
||||
@ -288,25 +288,25 @@ enum ArmourType {
|
||||
kArmourTypeFootPlate = 41 // @ C41_ARMOUR_FOOT_PLATE
|
||||
};
|
||||
class Armour {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Armour(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Armour(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
|
||||
ArmourType getType() { return (ArmourType)(attributes & 0x7F); }
|
||||
Thing getNextThing() { return nextThing; }
|
||||
ArmourType getType() { return (ArmourType)(_attributes & 0x7F); }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ ARMOUR
|
||||
|
||||
class Scroll {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Scroll(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Scroll(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
void set(Thing next, uint16 attribs) {
|
||||
nextThing = next;
|
||||
attributes = attribs;
|
||||
_nextThing = next;
|
||||
_attributes = attribs;
|
||||
}
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ SCROLL
|
||||
|
||||
enum PotionType {
|
||||
@ -325,24 +325,24 @@ enum PotionType {
|
||||
kPotionTypeEmptyFlask = 20 // @ C20_POTION_EMPTY_FLASK,
|
||||
};
|
||||
class Potion {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Potion(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Potion(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
|
||||
PotionType getType() { return (PotionType)((attributes >> 8) & 0x7F); }
|
||||
Thing getNextThing() { return nextThing; }
|
||||
PotionType getType() { return (PotionType)((_attributes >> 8) & 0x7F); }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ POTION
|
||||
|
||||
class Container {
|
||||
Thing nextThing;
|
||||
Thing nextContainedThing;
|
||||
uint16 type;
|
||||
Thing _nextThing;
|
||||
Thing _nextContainedThing;
|
||||
uint16 _type;
|
||||
public:
|
||||
Container(uint16 *rawDat) : nextThing(rawDat[0]), nextContainedThing(rawDat[1]), type(rawDat[2]) {}
|
||||
Container(uint16 *rawDat) : _nextThing(rawDat[0]), _nextContainedThing(rawDat[1]), _type(rawDat[2]) {}
|
||||
|
||||
Thing getNextContainedThing() { return nextContainedThing; }
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextContainedThing() { return _nextContainedThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ CONTAINER
|
||||
|
||||
enum JunkType {
|
||||
@ -359,37 +359,37 @@ enum JunkType {
|
||||
};
|
||||
|
||||
class Junk {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Junk(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Junk(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
|
||||
JunkType getType() { return (JunkType)(attributes & 0x7F); }
|
||||
uint16 getChargeCount() { return (attributes >> 14) & 0x3; }
|
||||
JunkType getType() { return (JunkType)(_attributes & 0x7F); }
|
||||
uint16 getChargeCount() { return (_attributes >> 14) & 0x3; }
|
||||
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ JUNK
|
||||
|
||||
class Projectile {
|
||||
Thing nextThing;
|
||||
Thing object;
|
||||
byte kineticEnergy;
|
||||
byte damageEnergy;
|
||||
uint16 timerIndex;
|
||||
Thing _nextThing;
|
||||
Thing _object;
|
||||
byte _kineticEnergy;
|
||||
byte _damageEnergy;
|
||||
uint16 _timerIndex;
|
||||
public:
|
||||
Projectile(uint16 *rawDat) : nextThing(rawDat[0]), object(rawDat[1]), kineticEnergy(rawDat[2]),
|
||||
damageEnergy(rawDat[3]), timerIndex(rawDat[4]) {}
|
||||
Projectile(uint16 *rawDat) : _nextThing(rawDat[0]), _object(rawDat[1]), _kineticEnergy(rawDat[2]),
|
||||
_damageEnergy(rawDat[3]), _timerIndex(rawDat[4]) {}
|
||||
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ PROJECTILE
|
||||
|
||||
class Explosion {
|
||||
Thing nextThing;
|
||||
uint16 attributes;
|
||||
Thing _nextThing;
|
||||
uint16 _attributes;
|
||||
public:
|
||||
Explosion(uint16 *rawDat) : nextThing(rawDat[0]), attributes(rawDat[1]) {}
|
||||
Explosion(uint16 *rawDat) : _nextThing(rawDat[0]), _attributes(rawDat[1]) {}
|
||||
|
||||
Thing getNextThing() { return nextThing; }
|
||||
Thing getNextThing() { return _nextThing; }
|
||||
}; // @ EXPLOSION
|
||||
|
||||
|
||||
@ -431,70 +431,70 @@ enum SquareType {
|
||||
}; // @ C[-2..19]_ELEMENT_...
|
||||
|
||||
class Square {
|
||||
byte data;
|
||||
byte _data;
|
||||
public:
|
||||
Square(byte dat = 0) : data(dat) {}
|
||||
Square(byte dat = 0) : _data(dat) {}
|
||||
Square(SquareType type) { setType(type); }
|
||||
Square &set(byte dat) { this->data = dat; return *this; }
|
||||
Square &set(SquareMask mask) { data |= mask; return *this; }
|
||||
byte get(SquareMask mask) { return data & mask; }
|
||||
byte getDoorState() { return data & 0x7; } // @ M36_DOOR_STATE
|
||||
Square &setDoorState(byte state) { data = ((data & ~0x7) | state); } // @ M37_SET_DOOR_STATE
|
||||
SquareType getType() { return (SquareType)(data >> 5); } // @ M34_SQUARE_TYPE
|
||||
Square &setType(SquareType type) { data = (data & 0x1F) | type << 5; return *this; }
|
||||
byte toByte() { return data; } // I don't like 'em casts
|
||||
Square &set(byte dat) { this->_data = dat; return *this; }
|
||||
Square &set(SquareMask mask) { _data |= mask; return *this; }
|
||||
byte get(SquareMask mask) { return _data & mask; }
|
||||
byte getDoorState() { return _data & 0x7; } // @ M36_DOOR_STATE
|
||||
Square &setDoorState(byte state) { _data = ((_data & ~0x7) | state); } // @ M37_SET_DOOR_STATE
|
||||
SquareType getType() { return (SquareType)(_data >> 5); } // @ M34_SQUARE_TYPE
|
||||
Square &setType(SquareType type) { _data = (_data & 0x1F) | type << 5; return *this; }
|
||||
byte toByte() { return _data; } // I don't like 'em casts
|
||||
};
|
||||
|
||||
struct DungeonFileHeader {
|
||||
uint16 dungeonId; // @ G0526_ui_DungeonID
|
||||
uint16 _dungeonId; // @ G0526_ui_DungeonID
|
||||
// equal to dungeonId
|
||||
uint16 ornamentRandomSeed;
|
||||
uint32 rawMapDataSize;
|
||||
uint8 mapCount;
|
||||
uint16 textDataWordCount;
|
||||
direction partyStartDir; // @ InitialPartyLocation
|
||||
uint16 partyStartPosX, partyStartPosY;
|
||||
uint16 squareFirstThingCount; // @ SquareFirstThingCount
|
||||
uint16 thingCounts[16]; // @ ThingCount[16]
|
||||
uint16 _ornamentRandomSeed;
|
||||
uint32 _rawMapDataSize;
|
||||
uint8 _mapCount;
|
||||
uint16 _textDataWordCount;
|
||||
direction _partyStartDir; // @ InitialPartyLocation
|
||||
uint16 _partyStartPosX, _partyStartPosY;
|
||||
uint16 _squareFirstThingCount; // @ SquareFirstThingCount
|
||||
uint16 _thingCounts[16]; // @ ThingCount[16]
|
||||
}; // @ DUNGEON_HEADER
|
||||
|
||||
struct Map {
|
||||
uint32 rawDunDataOffset;
|
||||
uint8 offsetMapX, offsetMapY;
|
||||
uint32 _rawDunDataOffset;
|
||||
uint8 _offsetMapX, _offsetMapY;
|
||||
|
||||
uint8 level; // only used in DMII
|
||||
uint8 width, height; // !!! THESRE ARE INCLUSIVE BOUNDARIES
|
||||
uint8 _level; // only used in DMII
|
||||
uint8 _width, _height; // !!! THESRE ARE INCLUSIVE BOUNDARIES
|
||||
// orn short for Ornament
|
||||
uint8 wallOrnCount; /* May be used in a Sensor on a Wall or closed Fake Wall square */
|
||||
uint8 randWallOrnCount; /* Used only on some Wall squares and some closed Fake Wall squares */
|
||||
uint8 floorOrnCount; /* May be used in a Sensor on a Pit, open Fake Wall, Corridor or Teleporter square */
|
||||
uint8 randFloorOrnCount; /* Used only on some Corridor squares and some open Fake Wall squares */
|
||||
uint8 _wallOrnCount; /* May be used in a Sensor on a Wall or closed Fake Wall square */
|
||||
uint8 _randWallOrnCount; /* Used only on some Wall squares and some closed Fake Wall squares */
|
||||
uint8 _floorOrnCount; /* May be used in a Sensor on a Pit, open Fake Wall, Corridor or Teleporter square */
|
||||
uint8 _randFloorOrnCount; /* Used only on some Corridor squares and some open Fake Wall squares */
|
||||
|
||||
uint8 doorOrnCount;
|
||||
uint8 creatureTypeCount;
|
||||
uint8 difficulty;
|
||||
uint8 _doorOrnCount;
|
||||
uint8 _creatureTypeCount;
|
||||
uint8 _difficulty;
|
||||
|
||||
FloorSet floorSet;
|
||||
WallSet wallSet;
|
||||
uint8 doorSet0, doorSet1;
|
||||
FloorSet _floorSet;
|
||||
WallSet _wallSet;
|
||||
uint8 _doorSet0, _doorSet1;
|
||||
}; // @ MAP
|
||||
|
||||
struct DungeonData {
|
||||
// I have no idea the heck is this
|
||||
uint16 *mapsFirstColumnIndex; // @ G0281_pui_DungeonMapsFirstColumnIndex
|
||||
uint16 columCount; // @ G0282_ui_DungeonColumnCount
|
||||
uint16 *_mapsFirstColumnIndex; // @ G0281_pui_DungeonMapsFirstColumnIndex
|
||||
uint16 _columCount; // @ G0282_ui_DungeonColumnCount
|
||||
|
||||
// I have no idea the heck is this
|
||||
uint16 *columnsCumulativeSquareThingCount; // @ G0280_pui_DungeonColumnsCumulativeSquareThingCount
|
||||
Thing *squareFirstThings; // @ G0283_pT_SquareFirstThings
|
||||
uint16 *textData; // @ G0260_pui_DungeonTextData
|
||||
uint16 *_columnsCumulativeSquareThingCount; // @ G0280_pui_DungeonColumnsCumulativeSquareThingCount
|
||||
Thing *_squareFirstThings; // @ G0283_pT_SquareFirstThings
|
||||
uint16 *_textData; // @ G0260_pui_DungeonTextData
|
||||
|
||||
uint16 **thingsData[16]; // @ G0284_apuc_ThingData
|
||||
uint16 **_thingsData[16]; // @ G0284_apuc_ThingData
|
||||
|
||||
byte ***mapData; // @ G0279_pppuc_DungeonMapData
|
||||
byte ***_mapData; // @ G0279_pppuc_DungeonMapData
|
||||
|
||||
// TODO: ??? is this doing here
|
||||
uint16 eventMaximumCount; // @ G0369_ui_EventMaximumCount
|
||||
uint16 _eventMaximumCount; // @ G0369_ui_EventMaximumCount
|
||||
}; // @ AGGREGATE
|
||||
|
||||
struct CurrMapData {
|
||||
|
@ -613,7 +613,7 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
|
||||
for (int i = 0; i < 18; i++)
|
||||
_currMapDoorOrnIndices[i] = 0;
|
||||
|
||||
_inscriptionThing = Thing::thingNone;
|
||||
_inscriptionThing = Thing::_thingNone;
|
||||
}
|
||||
|
||||
DisplayMan::~DisplayMan() {
|
||||
@ -1218,12 +1218,12 @@ void DisplayMan::loadWallSet(WallSet set) {
|
||||
|
||||
|
||||
void DisplayMan::loadCurrentMapGraphics() {
|
||||
loadFloorSet(_vm->_dungeonMan->_currMap.map->floorSet);
|
||||
loadWallSet(_vm->_dungeonMan->_currMap.map->wallSet);
|
||||
loadFloorSet(_vm->_dungeonMan->_currMap.map->_floorSet);
|
||||
loadWallSet(_vm->_dungeonMan->_currMap.map->_wallSet);
|
||||
|
||||
// the original loads some flipped walls here, I moved it to loadWallSet
|
||||
|
||||
for (uint16 i = 0, firstGraphicIndex = _vm->_dungeonMan->_currMap.map->wallSet * kStairsGraphicCount + kFirstStairs; i < kStairsGraphicCount; ++i)
|
||||
for (uint16 i = 0, firstGraphicIndex = _vm->_dungeonMan->_currMap.map->_wallSet * kStairsGraphicCount + kFirstStairs; i < kStairsGraphicCount; ++i)
|
||||
_stairIndices[i] = firstGraphicIndex + i;
|
||||
|
||||
for (int16 i = 0; i < kAlcoveOrnCount; ++i)
|
||||
@ -1240,7 +1240,7 @@ void DisplayMan::loadCurrentMapGraphics() {
|
||||
|
||||
_currMapViAltarIndex = -1;
|
||||
|
||||
for (uint16 i = 0; i < currMap.wallOrnCount; ++i) {
|
||||
for (uint16 i = 0; i < currMap._wallOrnCount; ++i) {
|
||||
uint16 ornIndice = _currMapWallOrnIndices[i];
|
||||
uint16 nativeIndice = kFirstWallOrn + ornIndice * 2;
|
||||
|
||||
@ -1260,14 +1260,14 @@ void DisplayMan::loadCurrentMapGraphics() {
|
||||
_currMapWallOrnInfo[i][kNativeCoordinateSet] = gWallOrnCoordSetIndices[ornIndice];
|
||||
}
|
||||
|
||||
for (uint16 i = 0; i < currMap.floorOrnCount; ++i) {
|
||||
for (uint16 i = 0; i < currMap._floorOrnCount; ++i) {
|
||||
uint16 ornIndice = _currMapFloorOrnIndices[i];
|
||||
uint16 nativeIndice = kFirstFloorOrn + ornIndice * 6;
|
||||
_currMapFloorOrnInfo[i][kNativeBitmapIndex] = nativeIndice;
|
||||
_currMapFloorOrnInfo[i][kNativeCoordinateSet] = gFloorOrnCoordSetIndices[ornIndice];
|
||||
}
|
||||
|
||||
for (uint16 i = 0; i < currMap.doorOrnCount; ++i) {
|
||||
for (uint16 i = 0; i < currMap._doorOrnCount; ++i) {
|
||||
uint16 ornIndice = _currMapDoorOrnIndices[i];
|
||||
uint16 nativeIndice = kFirstDoorOrn + ornIndice;
|
||||
_currMapDoorOrnInfo[i][kNativeBitmapIndex] = nativeIndice;
|
||||
@ -1277,7 +1277,7 @@ void DisplayMan::loadCurrentMapGraphics() {
|
||||
applyCreatureReplColors(9, 8);
|
||||
applyCreatureReplColors(10, 12);
|
||||
|
||||
for (uint16 creatureType = 0; creatureType < currMap.creatureTypeCount; ++creatureType) {
|
||||
for (uint16 creatureType = 0; creatureType < currMap._creatureTypeCount; ++creatureType) {
|
||||
CreatureAspect &aspect = gCreatureAspects[_currMapAllowedCreatureTypes[creatureType]];
|
||||
uint16 replColorOrdinal = aspect.getReplColour9();
|
||||
if (replColorOrdinal)
|
||||
|
@ -16,7 +16,7 @@ LoadgameResponse LoadsaveMan::loadgame() {
|
||||
if (newGame) {
|
||||
_vm->_restartGameAllowed = false;
|
||||
cm._partyChampionCount = 0;
|
||||
cm._leaderHand = Thing::thingNone;
|
||||
cm._leaderHand = Thing::_thingNone;
|
||||
_vm->_gameId = _vm->_rnd->getRandomNumber(65536) * _vm->_rnd->getRandomNumber(65536);
|
||||
} else {
|
||||
assert(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user