Skip to content

Commit

Permalink
DM: More renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendegúz Nagy committed Aug 26, 2016
1 parent 71e4b5b commit a9cda9d
Show file tree
Hide file tree
Showing 14 changed files with 779 additions and 779 deletions.
56 changes: 28 additions & 28 deletions engines/dm/champion.cpp
Expand Up @@ -142,13 +142,13 @@ void ChampionMan::applyModifiersToStatistics(Champion* champ, ChampionSlot slotI
int16 statIndex;
int16 modifier = 0;
ThingType thingType = thing.getType();
if (((thingType == kWeaponThingType) || (thingType == kArmourThingType))
if (((thingType == k5_WeaponThingType) || (thingType == k6_ArmourThingType))
&& (slotIndex >= k0_ChampionSlotReadyHand)
&& (slotIndex <= k12_ChampionSlotQuiverLine_1_1)) {
Weapon *weapon = (Weapon*)_vm->_dungeonMan->getThingData(thing);
Armour *armour = (Armour*)_vm->_dungeonMan->getThingData(thing);
if (((thingType == kWeaponThingType) && weapon->getCursed())
|| ((thingType == kArmourThingType) && armour->getCursed())) {
if (((thingType == k5_WeaponThingType) && weapon->getCursed())
|| ((thingType == k6_ArmourThingType) && armour->getCursed())) {
statIndex = k0_ChampionStatLuck;
modifier = -3;
goto T0299044_ApplyModifier;
Expand Down Expand Up @@ -437,7 +437,7 @@ ChampionIndex ChampionMan::getIndexInCell(ViewCell cell) {
}

void ChampionMan::resetDataToStartGame() {
if (!_vm->_dungeonMan->_messages._newGame) {
if (!_vm->_dungeonMan->_messages._g298_newGame) {
warning("MISSING CODE: stuff for resetting for loaded games");
assert(false);
}
Expand Down Expand Up @@ -468,26 +468,26 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
champ->_actionIndex = k255_ChampionActionNone;
champ->_enableActionEventIndex = -1;
champ->_hideDamageReceivedIndex = -1;
champ->_dir = dunMan._currMap._partyDir;
champ->_dir = dunMan._currMap._g308_partyDir;
ViewCell AL_0_viewCell = k0_ViewCellFronLeft;
while (getIndexInCell((ViewCell)((AL_0_viewCell + dunMan._currMap._partyDir) & 3)) != kM1_ChampionNone)
while (getIndexInCell((ViewCell)((AL_0_viewCell + dunMan._currMap._g308_partyDir) & 3)) != kM1_ChampionNone)
AL_0_viewCell = (ViewCell)(AL_0_viewCell + 1);
champ->_cell = (ViewCell)((AL_0_viewCell + dunMan._currMap._partyDir) & 3);
champ->_cell = (ViewCell)((AL_0_viewCell + dunMan._currMap._g308_partyDir) & 3);
champ->clearAttributes(k0x0400_ChampionAttributeIcon);
champ->_directionMaximumDamageReceived = dunMan._currMap._partyDir;
champ->_directionMaximumDamageReceived = dunMan._currMap._g308_partyDir;
champ->_food = 1500 + _vm->_rnd->getRandomNumber(256);
champ->_water = 1500 + _vm->_rnd->getRandomNumber(256);
int16 AL_0_slotIndex_Red;
for (AL_0_slotIndex_Red = k0_ChampionSlotReadyHand; AL_0_slotIndex_Red < k30_ChampionSlotChest_1; ++AL_0_slotIndex_Red) {
champ->setSlot((ChampionSlot)AL_0_slotIndex_Red, Thing::_none);
}
Thing thing = dunMan.getSquareFirstThing(dunMan._currMap._partyPosX, dunMan._currMap._partyPosY);
while (thing.getType() != kTextstringType) {
Thing thing = dunMan.getSquareFirstThing(dunMan._currMap._g306_partyPosX, dunMan._currMap._g307_partyPosY);
while (thing.getType() != k2_TextstringType) {
thing = dunMan.getNextThing(thing);
}
char decodedChampionText[77];
char* character_Green = decodedChampionText;
dunMan.decodeText(character_Green, thing, (TextType)(kTextTypeScroll | kDecodeEvenIfInvisible));
dunMan.decodeText(character_Green, thing, (TextType)(k2_TextTypeScroll | k0x8000_DecodeEvenIfInvisible));
int16 AL_0_characterIndex = 0;
uint16 AL_2_character;
while ((AL_2_character = *character_Green++) != '\n') {
Expand Down Expand Up @@ -557,21 +557,21 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
_vm->_menuMan->drawActionIcon((ChampionIndex)(_g305_partyChampionCount - 1));
}

int16 mapX = _vm->_dungeonMan->_currMap._partyPosX;
int16 mapY = _vm->_dungeonMan->_currMap._partyPosY;
int16 mapX = _vm->_dungeonMan->_currMap._g306_partyPosX;
int16 mapY = _vm->_dungeonMan->_currMap._g307_partyPosY;

uint16 championObjectsCell = returnOppositeDir((direction)(dunMan._currMap._partyDir));
mapX += _vm->_dirIntoStepCountEast[dunMan._currMap._partyDir];
mapY += _vm->_dirIntoStepCountNorth[dunMan._currMap._partyDir];
uint16 championObjectsCell = returnOppositeDir((direction)(dunMan._currMap._g308_partyDir));
mapX += _vm->_dirIntoStepCountEast[dunMan._currMap._g308_partyDir];
mapY += _vm->_dirIntoStepCountNorth[dunMan._currMap._g308_partyDir];
thing = dunMan.getSquareFirstThing(mapX, mapY);
AL_0_slotIndex_Red = k13_ChampionSlotBackpackLine_1_1;
uint16 slotIndex_Green;
while (thing != Thing::_endOfList) {
ThingType AL_2_thingType = thing.getType();
if ((AL_2_thingType > kSensorThingType) && (thing.getCell() == championObjectsCell)) {
int16 objectAllowedSlots = gObjectInfo[dunMan.getObjectInfoIndex(thing)].getAllowedSlots();
if ((AL_2_thingType > k3_SensorThingType) && (thing.getCell() == championObjectsCell)) {
int16 objectAllowedSlots = g237_ObjectInfo[dunMan.getObjectInfoIndex(thing)].getAllowedSlots();
switch (AL_2_thingType) {
case kArmourThingType:
case k6_ArmourThingType:
for (slotIndex_Green = k2_ChampionSlotHead; slotIndex_Green <= k5_ChampionSlotFeet; slotIndex_Green++) {
if (objectAllowedSlots & gSlotMasks[slotIndex_Green])
goto T0280048;
Expand All @@ -582,15 +582,15 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
goto T0280046;
}
break;
case kWeaponThingType:
case k5_WeaponThingType:
if (champ->getSlot(k1_ChampionSlotActionHand) == Thing::_none) {
slotIndex_Green = k1_ChampionSlotActionHand;
} else {
goto T0280046;
}
break;
case kScrollThingType:
case kPotionThingType:
case k7_ScrollThingType:
case k8_PotionThingType:
if (champ->getSlot(k11_ChampionSlotPouch_1) == Thing::_none) {
slotIndex_Green = k11_ChampionSlotPouch_1;
} else if (champ->getSlot(k6_ChampionSlotPouch_2) == Thing::_none) {
Expand All @@ -599,8 +599,8 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
goto T0280046;
}
break;
case kContainerThingType:
case kJunkThingType:
case k9_ContainerThingType:
case k10_JunkThingType:
T0280046:
if ((objectAllowedSlots & gSlotMasks[k10_ChampionSlotNeck]) && (champ->getSlot(k10_ChampionSlotNeck) == Thing::_none)) {
slotIndex_Green = k10_ChampionSlotNeck;
Expand Down Expand Up @@ -850,19 +850,19 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
}

{ // block so goto won't skip AL_0_championIconIndex initialization
int16 AL_0_championIconIndex = championIconIndex(champ->_cell, _vm->_dungeonMan->_currMap._partyDir);
int16 AL_0_championIconIndex = championIconIndex(champ->_cell, _vm->_dungeonMan->_currMap._g308_partyDir);

if ((champAttributes & k28_ChampionIcons) && (eventMan._useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(AL_0_championIconIndex))) {
dispMan.clearScreenBox(g46_ChampionColor[champIndex], g54_BoxChampionIcons[AL_0_championIconIndex]);
dispMan.blitToScreen(dispMan.getBitmap(k28_ChampionIcons), 80, championIconIndex(champ->_dir, _vm->_dungeonMan->_currMap._partyDir) * 19, 0,
dispMan.blitToScreen(dispMan.getBitmap(k28_ChampionIcons), 80, championIconIndex(champ->_dir, _vm->_dungeonMan->_currMap._g308_partyDir) * 19, 0,
g54_BoxChampionIcons[AL_0_championIconIndex], k12_ColorDarkestGray);
}
}

if ((champAttributes & k0x0800_ChampionAttributePanel) && isInventoryChamp) {
if (_vm->_pressingMouth) {
if (_vm->_g333_pressingMouth) {
invMan.drawPanelFoodWaterPoisoned();
} else if (_vm->_pressingEye) {
} else if (_vm->_g331_pressingEye) {
if (_g415_leaderEmptyHanded) {
warning("MISSING CODE: F0351_INVENTORY_DrawChampionSkillsAndStatistics");
}
Expand Down
44 changes: 22 additions & 22 deletions engines/dm/dm.cpp
Expand Up @@ -106,14 +106,14 @@ DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) {
_movsens = nullptr;
_groupMan = nullptr;
_timeline = nullptr;
_stopWaitingForPlayerInput = false;
_gameTimeTicking = false;
_restartGameAllowed = false;
_pressingEye = false;
_pressingMouth = false;
_stopPressingEye = false;
_stopPressingMouth = false;
_highlightBoxInversionRequested = false;
_g321_stopWaitingForPlayerInput = false;
_g301_gameTimeTicking = false;
_g524_restartGameAllowed = false;
_g331_pressingEye = false;
_g333_pressingMouth = false;
_g332_stopPressingEye = false;
_g334_stopPressingMouth = false;
_g340_highlightBoxInversionRequested = false;

debug("DMEngine::DMEngine");
}
Expand Down Expand Up @@ -164,11 +164,11 @@ void DMEngine::initializeGame() {


void DMEngine::startGame() {
_pressingEye = false;
_stopPressingEye = false;
_pressingMouth = false;
_stopPressingMouth = false;
_highlightBoxInversionRequested = false;
_g331_pressingEye = false;
_g332_stopPressingEye = false;
_g333_pressingMouth = false;
_g334_stopPressingMouth = false;
_g340_highlightBoxInversionRequested = false;
_eventMan->_highlightBoxEnabled = false;
_championMan->_g300_partyIsSleeping = false;
_championMan->_g506_actingChampionOrdinal = indexToOrdinal(kM1_ChampionNone);
Expand All @@ -179,9 +179,9 @@ void DMEngine::startGame() {
_eventMan->_secondaryMouseInput = gSecondaryMouseInput_Movement;
warning("MISSING CODE: set primary/secondary keyboard input");

processNewPartyMap(_dungeonMan->_currMap._currPartyMapIndex);
processNewPartyMap(_dungeonMan->_currMap._g309_currPartyMapIndex);

if (!_dungeonMan->_messages._newGame) {
if (!_dungeonMan->_messages._g298_newGame) {
warning("TODO: loading game");
} else {
_displayMan->_g578_useByteBoxCoordinates = false;
Expand All @@ -191,7 +191,7 @@ void DMEngine::startGame() {
warning("TODO: build copper");
_menuMan->drawMovementArrows();
_championMan->resetDataToStartGame();
_gameTimeTicking = true;
_g301_gameTimeTicking = true;
}

void DMEngine::processNewPartyMap(uint16 mapIndex) {
Expand Down Expand Up @@ -233,28 +233,28 @@ Common::Error DMEngine::run() {

void DMEngine::gameloop() {
warning("DUMMY CODE SETTING PARTY POS AND DIRECTION");
_dungeonMan->_currMap._partyPosX = 10;
_dungeonMan->_currMap._partyPosY = 4;
_dungeonMan->_currMap._partyDir = kDirNorth;
_dungeonMan->_currMap._g306_partyPosX = 10;
_dungeonMan->_currMap._g307_partyPosY = 4;
_dungeonMan->_currMap._g308_partyDir = kDirNorth;


warning("DUMMY CODE: setting InventoryMan::_inventoryChampionOrdinal to zero");
_inventoryMan->_inventoryChampionOrdinal = 0;
warning("DUMMY CODE: clearing screen to black"); // in loop below
while (true) {
_stopWaitingForPlayerInput = false;
_g321_stopWaitingForPlayerInput = false;

_menuMan->refreshActionAreaAndSetChampDirMaxDamageReceived();

//do {
_eventMan->processInput();
_eventMan->processCommandQueue();
//} while (!_stopWaitingForPlayerInput || !_gameTimeTicking);
//} while (!_g321_stopWaitingForPlayerInput || !_g301_gameTimeTicking);

if (!_inventoryMan->_inventoryChampionOrdinal && !_championMan->_g300_partyIsSleeping) {
Box box(0, 224, 0, 126);
_displayMan->clearScreenBox(k0_ColorBlack, box, g296_DungeonViewport); // dummy code
_displayMan->drawDungeon(_dungeonMan->_currMap._partyDir, _dungeonMan->_currMap._partyPosX, _dungeonMan->_currMap._partyPosY);
_displayMan->drawDungeon(_dungeonMan->_currMap._g308_partyDir, _dungeonMan->_currMap._g306_partyPosX, _dungeonMan->_currMap._g307_partyPosY);
}
// DUMMY CODE: next line
_menuMan->drawMovementArrows();
Expand Down
58 changes: 29 additions & 29 deletions engines/dm/dm.h
Expand Up @@ -71,29 +71,29 @@ void clearFlag(uint16 &val, uint16 mask);


enum ThingType {
kPartyThingType = -1, // @ CM1_THING_TYPE_PARTY, special value
kDoorThingType = 0,
kTeleporterThingType = 1,
kTextstringType = 2,
kSensorThingType = 3,
kGroupThingType = 4,
kWeaponThingType = 5,
kArmourThingType = 6,
kScrollThingType = 7,
kPotionThingType = 8,
kContainerThingType = 9,
kJunkThingType = 10,
kProjectileThingType = 14,
kExplosionThingType = 15,
kThingTypeTotal = 16 // +1 than the last (explosionThingType)
kM1_PartyThingType = -1, // @ CM1_THING_TYPE_PARTY, special value
k0_DoorThingType = 0,
k1_TeleporterThingType = 1,
k2_TextstringType = 2,
k3_SensorThingType = 3,
k4_GroupThingType = 4,
k5_WeaponThingType = 5,
k6_ArmourThingType = 6,
k7_ScrollThingType = 7,
k8_PotionThingType = 8,
k9_ContainerThingType = 9,
k10_JunkThingType = 10,
k14_ProjectileThingType = 14,
k15_ExplosionThingType = 15,
k16_ThingTypeTotal = 16 // +1 than the last (explosionThingType)
}; // @ C[00..15]_THING_TYPE_...

enum Cell {
kCellAny = -1, // @ CM1_CELL_ANY
kCellNorthWest = 0, // @ C00_CELL_NORTHWEST
kCellNorthEast = 1, // @ C01_CELL_NORTHEAST
kCellSouthEast = 2, // @ C02_CELL_SOUTHEAST
kCellSouthWest = 3 // @ C03_CELL_SOUTHWEST
kM1_CellAny = -1, // @ CM1_CELL_ANY
k0_CellNorthWest = 0, // @ C00_CELL_NORTHWEST
k1_CellNorthEast = 1, // @ C01_CELL_NORTHEAST
k2_CellSouthEast = 2, // @ C02_CELL_SOUTHEAST
k3_CellSouthWest = 3 // @ C03_CELL_SOUTHWEST
};

class Thing {
Expand Down Expand Up @@ -168,15 +168,15 @@ class DMEngine : public Engine {
GroupMan *_groupMan;
Timeline *_timeline;

bool _stopWaitingForPlayerInput; // G0321_B_StopWaitingForPlayerInput
bool _gameTimeTicking; // @ G0301_B_GameTimeTicking
bool _restartGameAllowed; // @ G0524_B_RestartGameAllowed
uint32 _gameId; // @ G0525_l_GameID, probably useless here
bool _pressingEye; // @ G0331_B_PressingEye
bool _stopPressingEye; // @ G0332_B_StopPressingEye
bool _pressingMouth; // @ G0333_B_PressingMouth
bool _stopPressingMouth; // @ G0334_B_StopPressingMouth
bool _highlightBoxInversionRequested; // @ G0340_B_HighlightBoxInversionRequested
bool _g321_stopWaitingForPlayerInput; // G0321_B_StopWaitingForPlayerInput
bool _g301_gameTimeTicking; // @ G0301_B_GameTimeTicking
bool _g524_restartGameAllowed; // @ G0524_B_RestartGameAllowed
uint32 _g525_gameId; // @ G0525_l_GameID, probably useless here
bool _g331_pressingEye; // @ G0331_B_PressingEye
bool _g332_stopPressingEye; // @ G0332_B_StopPressingEye
bool _g333_pressingMouth; // @ G0333_B_PressingMouth
bool _g334_stopPressingMouth; // @ G0334_B_StopPressingMouth
bool _g340_highlightBoxInversionRequested; // @ G0340_B_HighlightBoxInversionRequested

// TODO: refactor direction into a class
int8 _dirIntoStepCountEast[4];
Expand Down

0 comments on commit a9cda9d

Please sign in to comment.