Skip to content

Commit

Permalink
DM: Rename DungeonMan class members
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and Bendegúz Nagy committed Aug 26, 2016
1 parent 544ce35 commit 64b1c4f
Show file tree
Hide file tree
Showing 16 changed files with 1,042 additions and 1,049 deletions.
132 changes: 66 additions & 66 deletions engines/dm/champion.cpp

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions engines/dm/console.cpp
Expand Up @@ -120,8 +120,8 @@ bool Console::Cmd_noclip(int argc, const char** argv) {
bool Console::Cmd_pos(int argc, const char** argv) {
DungeonMan &dm = *_vm->_dungeonMan;
if (argc == 2 && cstrEquals("get", argv[1])) {
debugPrintf("Position: (%d, %d) Direction: %s\n", dm._g306_partyMapX + dm._g269_currMap->_offsetMapX,
dm._g307_partyMapY + dm._g269_currMap->_offsetMapY, debugGetDirectionName(_vm->_dungeonMan->_g308_partyDir));
debugPrintf("Position: (%d, %d) Direction: %s\n", dm._partyMapX + dm._currMap->_offsetMapX,
dm._partyMapY + dm._currMap->_offsetMapY, debugGetDirectionName(_vm->_dungeonMan->_partyDir));
} else if (argc == 4 && cstrEquals("set", argv[1])) {
int x = atoi(argv[2]);
int y = atoi(argv[3]);
Expand All @@ -130,7 +130,7 @@ bool Console::Cmd_pos(int argc, const char** argv) {
return true;
}

Map &currMap = *_vm->_dungeonMan->_g269_currMap;
Map &currMap = *_vm->_dungeonMan->_currMap;
// not >= because dimensions are inslucsive
if (x < currMap._offsetMapX || x > currMap._width + currMap._offsetMapX
|| y < currMap._offsetMapY || y > currMap._height + currMap._offsetMapY) {
Expand All @@ -143,7 +143,7 @@ bool Console::Cmd_pos(int argc, const char** argv) {
if (haventWarned.check())
debugPrintf("Setting position directly can cause glitches and crashes.\n");
debugPrintf("Position set to (%d, %d)\n", x, y);
_vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY,
_vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY,
x - currMap._offsetMapX, y - currMap._offsetMapY);
} else
goto argumentError;
Expand All @@ -158,7 +158,7 @@ bool Console::Cmd_pos(int argc, const char** argv) {

bool Console::Cmd_map(int argc, const char** argv) {
if (argc == 2 && cstrEquals("get", argv[1])) {
debugPrintf("Map index: %d\n", _vm->_dungeonMan->_g309_partyMapIndex);
debugPrintf("Map index: %d\n", _vm->_dungeonMan->_partyMapIndex);
} else if (argc == 3 && cstrEquals("set", argv[1])) {
int index = atoi(argv[2]);
if (index == 0 && !cstrEquals("0", argv[2])) {
Expand All @@ -167,8 +167,8 @@ bool Console::Cmd_map(int argc, const char** argv) {
}

// not >= because dimensions are inslucsive
if (index < 0 || index >= _vm->_dungeonMan->_g278_dungeonFileHeader._mapCount) {
debugPrintf("Map index %d is out of bounds, possible values [0, %d]\n", index, _vm->_dungeonMan->_g278_dungeonFileHeader._mapCount - 1);
if (index < 0 || index >= _vm->_dungeonMan->_dungeonFileHeader._mapCount) {
debugPrintf("Map index %d is out of bounds, possible values [0, %d]\n", index, _vm->_dungeonMan->_dungeonFileHeader._mapCount - 1);
return true;
}

Expand All @@ -177,15 +177,15 @@ bool Console::Cmd_map(int argc, const char** argv) {
debugPrintf("Setting map directly can cause glitches and crashes.\n");
debugPrintf("Map set to %d\n", index);

_vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, kM1_MapXNotOnASquare, 0);
_vm->_newPartyMapIndex = _vm->_dungeonMan->f154_getLocationAfterLevelChange(
_vm->_dungeonMan->_g309_partyMapIndex, index - _vm->_dungeonMan->_g309_partyMapIndex,
&_vm->_dungeonMan->_g306_partyMapX, &_vm->_dungeonMan->_g307_partyMapY);
_vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kM1_MapXNotOnASquare, 0);
_vm->_newPartyMapIndex = _vm->_dungeonMan->getLocationAfterLevelChange(
_vm->_dungeonMan->_partyMapIndex, index - _vm->_dungeonMan->_partyMapIndex,
&_vm->_dungeonMan->_partyMapX, &_vm->_dungeonMan->_partyMapY);
if (_vm->_newPartyMapIndex == -1)
_vm->_newPartyMapIndex = index;
_vm->_dungeonMan->f173_setCurrentMap(_vm->_newPartyMapIndex);
_vm->_championMan->setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY));
_vm->_dungeonMan->f173_setCurrentMap(_vm->_dungeonMan->_g309_partyMapIndex);
_vm->_dungeonMan->setCurrentMap(_vm->_newPartyMapIndex);
_vm->_championMan->setPartyDirection(_vm->_dungeonMan->getStairsExitDirection(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY));
_vm->_dungeonMan->setCurrentMap(_vm->_dungeonMan->_partyMapIndex);
} else
goto argumentError;

Expand Down Expand Up @@ -249,9 +249,9 @@ bool Console::Cmd_gimme(int argc, const char** argv) {
requestedItemName.deleteLastChar();

for (int16 thingType = 0; thingType < 16; ++thingType) { // 16 number of item types
uint16 *thingDataArray = _vm->_dungeonMan->_g284_thingData[thingType];
uint16 *thingDataArray = _vm->_dungeonMan->_thingData[thingType];
uint16 thingTypeSize = g235_ThingDataWordCount[thingType];
uint16 thingCount = _vm->_dungeonMan->_g278_dungeonFileHeader._thingCounts[thingType];
uint16 thingCount = _vm->_dungeonMan->_dungeonFileHeader._thingCounts[thingType];

Thing dummyThing(0);
dummyThing.setType(thingType);
Expand All @@ -266,8 +266,8 @@ bool Console::Cmd_gimme(int argc, const char** argv) {
delete[] thingDataArray;
for (uint16 i = 0; i < thingTypeSize; ++i)
newThingData[thingCount * thingTypeSize + i] = newThingData[thingIndex * thingTypeSize + i];
_vm->_dungeonMan->_g278_dungeonFileHeader._thingCounts[thingType]++;
_vm->_dungeonMan->_g284_thingData[thingType] = newThingData;
_vm->_dungeonMan->_dungeonFileHeader._thingCounts[thingType]++;
_vm->_dungeonMan->_thingData[thingType] = newThingData;
_vm->_championMan->addObjectInSlot((ChampionIndex)0, dummyThing, (ChampionSlot)29);
debugPrintf("Item gimmed to the first champion, last slot\n");
return true;
Expand Down
58 changes: 29 additions & 29 deletions engines/dm/dm.cpp
Expand Up @@ -306,7 +306,7 @@ void DMEngine::initializeGame() {

startGame();
if (_newGameFl)
_moveSens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
_moveSens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
_eventMan->f78_showMouse();
_eventMan->f357_discardAllInput();
}
Expand Down Expand Up @@ -342,7 +342,7 @@ void DMEngine::startGame() {
_eventMan->_g443_primaryKeyboardInput = _eventMan->_primaryKeyboardInputInterface;
_eventMan->_g444_secondaryKeyboardInput = _eventMan->_secondaryKeyboardInputMovement;

processNewPartyMap(_dungeonMan->_g309_partyMapIndex);
processNewPartyMap(_dungeonMan->_partyMapIndex);

if (!_newGameFl) {
_displayMan->f436_STARTEND_FadeToPalette(_displayMan->_g347_paletteTopAndBottomScreen);
Expand All @@ -366,7 +366,7 @@ void DMEngine::startGame() {

void DMEngine::processNewPartyMap(uint16 mapIndex) {
_groupMan->f194_removeAllActiveGroups();
_dungeonMan->f174_setCurrentMapAndPartyMap(mapIndex);
_dungeonMan->setCurrentMapAndPartyMap(mapIndex);
_displayMan->f96_loadCurrentMapGraphics();
_groupMan->f195_addAllActiveGroups();
_inventoryMan->f337_setDungeonViewPalette();
Expand Down Expand Up @@ -439,7 +439,7 @@ void DMEngine::gameloop() {

if (_newPartyMapIndex != kM1_mapIndexNone) {
processNewPartyMap(_newPartyMapIndex);
_moveSens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
_moveSens->f267_getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
_newPartyMapIndex = kM1_mapIndexNone;
_eventMan->f357_discardAllInput();
}
Expand All @@ -452,7 +452,7 @@ void DMEngine::gameloop() {
if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) {
Box box(0, 223, 0, 135);
_displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // (possibly dummy code)
_displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
_displayMan->f128_drawDungeon(_dungeonMan->_partyDir, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
if (_setMousePointerToObjectInMainLoop) {
_setMousePointerToObjectInMainLoop = false;
_eventMan->f78_showMouse();
Expand Down Expand Up @@ -634,7 +634,7 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) {
_eventMan->_g443_primaryKeyboardInput = nullptr;
_eventMan->_g444_secondaryKeyboardInput = nullptr;
if (doNotDrawCreditsOnly && !_gameWon) {
_sound->f064_SOUND_RequestPlay_CPSD(k06_soundSCREAM, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY, k0_soundModePlayImmediately);
_sound->f064_SOUND_RequestPlay_CPSD(k06_soundSCREAM, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY, k0_soundModePlayImmediately);
delay(240);
}

Expand Down Expand Up @@ -775,14 +775,14 @@ void DMEngine::drawEntrance() {

byte *microDungeonCurrentMapData[32];

_dungeonMan->_g309_partyMapIndex = k255_mapIndexEntrance;
_dungeonMan->_partyMapIndex = k255_mapIndexEntrance;
_displayMan->_g297_drawFloorAndCeilingRequested = true;
_dungeonMan->_g273_currMapWidth = 5;
_dungeonMan->_g274_currMapHeight = 5;
_dungeonMan->_g271_currMapData = microDungeonCurrentMapData;
_dungeonMan->_currMapWidth = 5;
_dungeonMan->_currMapHeight = 5;
_dungeonMan->_currMapData = microDungeonCurrentMapData;

Map map; // uninitialized, won't be used
_dungeonMan->_g269_currMap = &map;
_dungeonMan->_currMap = &map;
Square microDungeonSquares[25];
for (uint16 i = 0; i < 25; ++i)
microDungeonSquares[i] = Square(k0_ElementTypeWall, 0);
Expand Down Expand Up @@ -969,29 +969,29 @@ void DMEngine::fuseSequnce() {
_championMan->_party._fireShieldDefense = _championMan->_party._spellShieldDefense = _championMan->_party._shieldDefense = 100;
_timeline->f260_timelineRefreshAllChampionStatusBoxes();
fuseSequenceUpdate();
L1431_i_LordChaosMapX = _dungeonMan->_g306_partyMapX;
L1432_i_LordChaosMapY = _dungeonMan->_g307_partyMapY;
L1431_i_LordChaosMapX += _dirIntoStepCountEast[_dungeonMan->_g308_partyDir], L1432_i_LordChaosMapY += _dirIntoStepCountNorth[_dungeonMan->_g308_partyDir];
L1428_ps_Group = (Group*)_dungeonMan->f156_getThingData(L1433_T_LordChaosThing = _groupMan->f175_groupGetThing(L1431_i_LordChaosMapX, L1432_i_LordChaosMapY));
L1431_i_LordChaosMapX = _dungeonMan->_partyMapX;
L1432_i_LordChaosMapY = _dungeonMan->_partyMapY;
L1431_i_LordChaosMapX += _dirIntoStepCountEast[_dungeonMan->_partyDir], L1432_i_LordChaosMapY += _dirIntoStepCountNorth[_dungeonMan->_partyDir];
L1428_ps_Group = (Group*)_dungeonMan->getThingData(L1433_T_LordChaosThing = _groupMan->f175_groupGetThing(L1431_i_LordChaosMapX, L1432_i_LordChaosMapY));
L1428_ps_Group->_health[0] = 10000;
_dungeonMan->f146_setGroupCells(L1428_ps_Group, k255_CreatureTypeSingleCenteredCreature, _dungeonMan->_g309_partyMapIndex);
_dungeonMan->f148_setGroupDirections(L1428_ps_Group, returnOppositeDir(_dungeonMan->_g308_partyDir), _dungeonMan->_g309_partyMapIndex);
_dungeonMan->setGroupCells(L1428_ps_Group, k255_CreatureTypeSingleCenteredCreature, _dungeonMan->_partyMapIndex);
_dungeonMan->setGroupDirections(L1428_ps_Group, returnOppositeDir(_dungeonMan->_partyDir), _dungeonMan->_partyMapIndex);

AL1424_B_RemoveFluxcagesFromLoadChaosSquare = true;
AL1425_i_FluxcageMapX = _dungeonMan->_g306_partyMapX;
AL1426_i_FluxcageMapY = _dungeonMan->_g307_partyMapY;
AL1425_i_FluxcageMapX = _dungeonMan->_partyMapX;
AL1426_i_FluxcageMapY = _dungeonMan->_partyMapY;
T0446002:
L1427_T_Thing = _dungeonMan->f162_getSquareFirstObject(AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY);
L1427_T_Thing = _dungeonMan->getSquareFirstObject(AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY);
while (L1427_T_Thing != Thing::_endOfList) {
if (L1427_T_Thing.getType() == k15_ExplosionThingType) {
L1429_ps_Explosion = (Explosion*)_dungeonMan->f156_getThingData(L1427_T_Thing);
L1429_ps_Explosion = (Explosion*)_dungeonMan->getThingData(L1427_T_Thing);
if (L1429_ps_Explosion->getType() == k50_ExplosionType_Fluxcage) {
_dungeonMan->f164_unlinkThingFromList(L1427_T_Thing, Thing(0), AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY);
_dungeonMan->unlinkThingFromList(L1427_T_Thing, Thing(0), AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY);
L1429_ps_Explosion->setNextThing(Thing::_none);
goto T0446002;
}
}
L1427_T_Thing = _dungeonMan->f159_getNextThing(L1427_T_Thing);
L1427_T_Thing = _dungeonMan->getNextThing(L1427_T_Thing);
}
if (AL1424_B_RemoveFluxcagesFromLoadChaosSquare) {
AL1424_B_RemoveFluxcagesFromLoadChaosSquare = false;
Expand Down Expand Up @@ -1026,28 +1026,28 @@ void DMEngine::fuseSequnce() {
fuseSequenceUpdate();
_displayMan->_g77_doNotDrawFluxcagesDuringEndgame = true;
fuseSequenceUpdate();
for (AL1424_i_MapX = 0; AL1424_i_MapX < _dungeonMan->_g273_currMapWidth; AL1424_i_MapX++) {
for (AL1425_i_MapY = 0; AL1425_i_MapY < _dungeonMan->_g274_currMapHeight; AL1425_i_MapY++) {
for (AL1424_i_MapX = 0; AL1424_i_MapX < _dungeonMan->_currMapWidth; AL1424_i_MapX++) {
for (AL1425_i_MapY = 0; AL1425_i_MapY < _dungeonMan->_currMapHeight; AL1425_i_MapY++) {
if (((L1427_T_Thing = _groupMan->f175_groupGetThing(AL1424_i_MapX, AL1425_i_MapY)) != Thing::_endOfList) && ((AL1424_i_MapX != L1431_i_LordChaosMapX) || (AL1425_i_MapY != L1432_i_LordChaosMapY))) {
_groupMan->f189_delete(AL1424_i_MapX, AL1425_i_MapY);
}
}
}
fuseSequenceUpdate();
/* Count and get list of text things located at 0, 0 in the current map. Their text is then printed as messages in the order specified by their first letter (which is not printed) */
L1427_T_Thing = _dungeonMan->f161_getSquareFirstThing(0, 0);
L1427_T_Thing = _dungeonMan->getSquareFirstThing(0, 0);
AL1424_i_TextStringThingCount = 0;
while (L1427_T_Thing != Thing::_endOfList) {
if (L1427_T_Thing.getType() == k2_TextstringType) {
L1435_aT_TextStringThings[AL1424_i_TextStringThingCount++] = L1427_T_Thing;
}
L1427_T_Thing = _dungeonMan->f159_getNextThing(L1427_T_Thing);
L1427_T_Thing = _dungeonMan->getNextThing(L1427_T_Thing);
}
L1434_c_TextFirstCharacter = 'A';
AL1426_i_TextStringThingCount = AL1424_i_TextStringThingCount;
while (AL1424_i_TextStringThingCount--) {
for (AL1425_i_TextStringThingIndex = 0; AL1425_i_TextStringThingIndex < AL1426_i_TextStringThingCount; AL1425_i_TextStringThingIndex++) {
_dungeonMan->f168_decodeText(L1436_ac_String, L1435_aT_TextStringThings[AL1425_i_TextStringThingIndex], (TextType)(k1_TextTypeMessage | k0x8000_DecodeEvenIfInvisible));
_dungeonMan->decodeText(L1436_ac_String, L1435_aT_TextStringThings[AL1425_i_TextStringThingIndex], (TextType)(k1_TextTypeMessage | k0x8000_DecodeEvenIfInvisible));
if (L1436_ac_String[1] == L1434_c_TextFirstCharacter) {
_textMan->f43_messageAreaClearAllRows();
L1436_ac_String[1] = '\n'; /* New line */
Expand All @@ -1072,7 +1072,7 @@ void DMEngine::fuseSequnce() {

void DMEngine::fuseSequenceUpdate() {
_timeline->f261_processTimeline();
_displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY);
_displayMan->f128_drawDungeon(_dungeonMan->_partyDir, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
_sound->f65_playPendingSound();
_eventMan->f357_discardAllInput();
_displayMan->updateScreen();
Expand Down

0 comments on commit 64b1c4f

Please sign in to comment.