diff options
author | Bendegúz Nagy | 2016-08-05 16:37:17 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 65e40980801b346f8dff4fa5afff281b61202614 (patch) | |
tree | e0829b348a62dd9af038c9fdf756895a16161fc0 /engines/dm/dungeonman.cpp | |
parent | d02a66d5ee75d16f553c424986c92b905813460a (diff) | |
download | scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.tar.gz scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.tar.bz2 scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.zip |
DM: Improve on broken display
Diffstat (limited to 'engines/dm/dungeonman.cpp')
-rw-r--r-- | engines/dm/dungeonman.cpp | 160 |
1 files changed, 74 insertions, 86 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index c91412a0df..61b222ce16 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -827,149 +827,137 @@ Thing DungeonMan::f161_getSquareFirstThing(int16 mapX, int16 mapY) { // TODO: produce more GOTOs -void DungeonMan::f172_setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY) { // complete, except where marked -#define thingType dir - byte L0307_uc_Multiple; -#define square L0307_uc_Multiple -#define footprintsAllowed L0307_uc_Multiple -#define scentOrdinal L0307_uc_Multiple - Sensor* sensor; - bool leftRandWallOrnAllowed = false; +void DungeonMan::f172_setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY) { +#define AP0318_i_ThingType dir + unsigned char L0307_uc_Multiple; +#define AL0307_uc_Square L0307_uc_Multiple +#define AL0307_uc_FootprintsAllowed L0307_uc_Multiple +#define AL0307_uc_ScentOrdinal L0307_uc_Multiple + Sensor* L0308_ps_Sensor; + bool L0309_B_LeftRandomWallOrnamentAllowed = 0; int16 L0310_i_Multiple = 0; -#define frontRandWallOrnAllowed L0310_i_Multiple -#define sideIndex L0310_i_Multiple - bool rightRandWallOrnAllowed = false; - int16 thingTypeRedEagle; - bool squreIsFakeWall; - Thing thing; +#define AL0310_B_FrontRandomWallOrnamentAllowed L0310_i_Multiple +#define AL0310_i_SideIndex L0310_i_Multiple + bool L0311_B_RightRandomWallOrnamentAllowed = 0; + int16 L0312_i_ThingType; + bool L0313_B_SquareIsFakeWall; + Thing L0314_T_Thing; for (uint16 i = 0; i < 5; ++i) aspectArray[i] = 0; - - thing = _vm->_dungeonMan->f161_getSquareFirstThing(mapX, mapY); - square = _vm->_dungeonMan->f151_getSquare(mapX, mapY).toByte(); - switch (aspectArray[k0_ElemAspect] = Square(square).getType()) { + L0314_T_Thing = f161_getSquareFirstThing(mapX, mapY); + AL0307_uc_Square = f151_getSquare(mapX, mapY).toByte(); + switch (aspectArray[k0_ElemAspect] = Square(AL0307_uc_Square).getType()) { case k0_ElementTypeWall: switch (dir) { case kDirNorth: - leftRandWallOrnAllowed = getFlag(square, k0x0004_WallEastRandOrnAllowed); - frontRandWallOrnAllowed = getFlag(square, k0x0002_WallSouthRandOrnAllowed); - rightRandWallOrnAllowed = getFlag(square, k0x0001_WallWestRandOrnAllowed); + L0309_B_LeftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); + AL0310_B_FrontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); + L0311_B_RightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); break; case kDirEast: - leftRandWallOrnAllowed = getFlag(square, k0x0002_WallSouthRandOrnAllowed); - frontRandWallOrnAllowed = getFlag(square, k0x0001_WallWestRandOrnAllowed); - rightRandWallOrnAllowed = getFlag(square, k0x0008_WallNorthRandOrnAllowed); + L0309_B_LeftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); + AL0310_B_FrontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); + L0311_B_RightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); break; case kDirSouth: - leftRandWallOrnAllowed = getFlag(square, k0x0001_WallWestRandOrnAllowed); - frontRandWallOrnAllowed = getFlag(square, k0x0008_WallNorthRandOrnAllowed); - rightRandWallOrnAllowed = getFlag(square, k0x0004_WallEastRandOrnAllowed); + L0309_B_LeftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); + AL0310_B_FrontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); + L0311_B_RightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); break; case kDirWest: - leftRandWallOrnAllowed = getFlag(square, k0x0008_WallNorthRandOrnAllowed); - frontRandWallOrnAllowed = getFlag(square, k0x0004_WallEastRandOrnAllowed); - rightRandWallOrnAllowed = getFlag(square, k0x0002_WallSouthRandOrnAllowed); + L0309_B_LeftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); + AL0310_B_FrontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); + L0311_B_RightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); + break; + default: + assert(false); } - /* BUG0_75 Multiple champion portraits are drawn (one at a time) then the game crashes. This variable is only - reset to 0 when at least one square in the dungeon view is a wall. If the party is in front of a wall with a - champion portrait and the next time the dungeon view is drawn there is no wall square in the view and the - square in front of the party is a fake wall with a random ornament then the same champion portrait will be - drawn again because the variable was not reset to 0. Each time _vm->_displayMan->f107_isDrawnWallOrnAnAlcove - draws the portrait, _vm->_displayMan->_g289_championPortraitOrdinal is decremented so that the portait is - different each time the dungeon view is drawn until the game crashes */ - _vm->_displayMan->_g289_championPortraitOrdinal = 0; - squreIsFakeWall = false; + _vm->_displayMan->_g289_championPortraitOrdinal = 0; + L0313_B_SquareIsFakeWall = false; T0172010_ClosedFakeWall: - _vm->_dungeonMan->f171_setSquareAspectOrnOrdinals(aspectArray, - leftRandWallOrnAllowed, frontRandWallOrnAllowed, rightRandWallOrnAllowed, dir, mapX, mapY, squreIsFakeWall); - while ((thing != Thing::_endOfList) && ((thingTypeRedEagle = thing.getType()) <= k3_SensorThingType)) { - if (sideIndex = M21_normalizeModulo4(thing.getCell() - dir)) { /* Invisible on the back wall if 0 */ - sensor = (Sensor*)_vm->_dungeonMan->f156_getThingData(thing); - if (thingTypeRedEagle == k2_TextstringType) { - if (((TextString*)sensor)->isVisible()) { - aspectArray[sideIndex + 1] = _vm->_dungeonMan->_g265_currMapInscriptionWallOrnIndex + 1; -/* BUG0_76 The same text is drawn on multiple sides of a wall square. The engine stores only a -single text to draw on a wall in a global variable. Even if different texts are placed on -different sides of the wall, the same text is drawn on each affected side */ - _vm->_displayMan->_g290_inscriptionThing = thing; + f171_setSquareAspectOrnOrdinals(aspectArray, L0309_B_LeftRandomWallOrnamentAllowed, AL0310_B_FrontRandomWallOrnamentAllowed, L0311_B_RightRandomWallOrnamentAllowed, dir, mapX, mapY, L0313_B_SquareIsFakeWall); + while ((L0314_T_Thing != Thing::_endOfList) && ((L0312_i_ThingType = L0314_T_Thing.getType()) <= k3_SensorThingType)) { + if (AL0310_i_SideIndex = M21_normalizeModulo4(L0314_T_Thing.getCell() - dir)) { /* Invisible on the back wall if 0 */ + L0308_ps_Sensor = (Sensor*)f156_getThingData(L0314_T_Thing); + if (L0312_i_ThingType == k2_TextstringType) { + if (((TextString*)L0308_ps_Sensor)->isVisible()) { + aspectArray[AL0310_i_SideIndex + 1] = _g265_currMapInscriptionWallOrnIndex + 1; + _vm->_displayMan->_g290_inscriptionThing = L0314_T_Thing; /* BUG0_76 The same text is drawn on multiple sides of a wall square. The engine stores only a single text to draw on a wall in a global variable. Even if different texts are placed on differents sides of the wall, the same text is drawn on each affected side */ } } else { - aspectArray[sideIndex + 1] = sensor->getOrnOrdinal(); - if (sensor->getType() == k127_SensorWallChampionPortrait) { - _vm->_displayMan->_g289_championPortraitOrdinal = _vm->M0_indexToOrdinal(sensor->getData()); + aspectArray[AL0310_i_SideIndex + 1] = L0308_ps_Sensor->getOrnOrdinal(); + if (L0308_ps_Sensor->getType() == k127_SensorWallChampionPortrait) { + _vm->_displayMan->_g289_championPortraitOrdinal = _vm->M0_indexToOrdinal(L0308_ps_Sensor->getData()); } } } - thing = _vm->_dungeonMan->f159_getNextThing(thing); + L0314_T_Thing = f159_getNextThing(L0314_T_Thing); } - if (squreIsFakeWall && (_vm->_dungeonMan->_g306_partyMapX != mapX) && (_vm->_dungeonMan->_g307_partyMapY != mapY)) { + if (L0313_B_SquareIsFakeWall && (_g306_partyMapX != mapX) && (_g307_partyMapY != mapY)) { aspectArray[k1_FirstGroupOrObjectAspect] = Thing::_endOfList.toUint16(); return; } break; case k2_ElementTypePit: - if (getFlag(square, k0x0008_PitOpen)) { - aspectArray[k2_PitInvisibleAspect] = getFlag(square, k0x0004_PitInvisible); - footprintsAllowed &= 0x0001; + if (getFlag(AL0307_uc_Square, k0x0008_PitOpen)) { + aspectArray[k2_PitInvisibleAspect] = getFlag(AL0307_uc_Square, k0x0004_PitInvisible); + AL0307_uc_FootprintsAllowed &= 0x0001; } else { aspectArray[k0_ElemAspect] = k1_CorridorElemType; - footprintsAllowed = true; + AL0307_uc_FootprintsAllowed = true; } goto T0172030_Pit; case k6_ElementTypeFakeWall: - if (!getFlag(square, k0x0004_FakeWallOpen)) { + if (!getFlag(AL0307_uc_Square, k0x0004_FakeWallOpen)) { aspectArray[k0_ElemAspect] = k0_ElementTypeWall; - leftRandWallOrnAllowed = rightRandWallOrnAllowed = frontRandWallOrnAllowed = getFlag(square, k0x0008_FakeWallRandOrnOrFootPAllowed); - squreIsFakeWall = true; + L0309_B_LeftRandomWallOrnamentAllowed = L0311_B_RightRandomWallOrnamentAllowed = AL0310_B_FrontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_FakeWallRandOrnOrFootPAllowed); + L0313_B_SquareIsFakeWall = true; goto T0172010_ClosedFakeWall; } aspectArray[k0_ElemAspect] = k1_CorridorElemType; - footprintsAllowed = getFlag(square, k0x0008_FakeWallRandOrnOrFootPAllowed) ? 8 : 0; + AL0307_uc_FootprintsAllowed = getFlag(AL0307_uc_Square, k0x0008_FakeWallRandOrnOrFootPAllowed) ? 8 : 0; case k1_CorridorElemType: - aspectArray[k4_FloorOrnOrdAspect] = _vm->_dungeonMan->f170_getRandomOrnOrdinal(getFlag(square, k0x0008_CorridorRandOrnAllowed), - _vm->_dungeonMan->_g269_currMap->_randFloorOrnCount, mapX, mapY, 30); + aspectArray[k4_FloorOrnOrdAspect] = f170_getRandomOrnOrdinal(getFlag(AL0307_uc_Square, k0x0008_CorridorRandOrnAllowed), _g269_currMap->_randFloorOrnCount, mapX, mapY, 30); T0172029_Teleporter: - footprintsAllowed = true; + AL0307_uc_FootprintsAllowed = true; T0172030_Pit: - while ((thing != Thing::_endOfList) && ((thingType = (Direction)thing.getType()) <= k3_SensorThingType)) { - if (thingType == k3_SensorThingType) { - sensor = (Sensor*)_vm->_dungeonMan->f156_getThingData(thing); - aspectArray[k4_FloorOrnOrdAspect] = sensor->getOrnOrdinal(); + while ((L0314_T_Thing != Thing::_endOfList) && ((AP0318_i_ThingType = (Direction)L0314_T_Thing.getType()) <= k3_SensorThingType)) { + if (AP0318_i_ThingType == k3_SensorThingType) { + L0308_ps_Sensor = (Sensor*)f156_getThingData(L0314_T_Thing); + aspectArray[k4_FloorOrnOrdAspect] = L0308_ps_Sensor->getOrnOrdinal(); } - thing = _vm->_dungeonMan->f159_getNextThing(thing); + L0314_T_Thing = f159_getNextThing(L0314_T_Thing); } goto T0172049_Footprints; case k5_ElementTypeTeleporter: - aspectArray[k2_TeleporterVisibleAspect] = getFlag(square, k0x0008_TeleporterOpen) && getFlag(square, k0x0004_TeleporterVisible); + aspectArray[k2_TeleporterVisibleAspect] = getFlag(AL0307_uc_Square, k0x0008_TeleporterOpen) && getFlag(AL0307_uc_Square, k0x0004_TeleporterVisible); goto T0172029_Teleporter; case k3_ElementTypeStairs: - aspectArray[k0_ElemAspect] = ((getFlag(square, k0x0008_StairsNorthSouthOrient) >> 3) == (isOrientedWestEast(dir) ? 1 : 0)) ? k18_ElementTypeStairsSide : k19_ElementTypeStaisFront; - aspectArray[k2_StairsUpAspect] = getFlag(square, k0x0004_StairsUp); - footprintsAllowed = false; + aspectArray[k0_ElemAspect] = (bool((getFlag(AL0307_uc_Square, k0x0008_StairsNorthSouthOrient) >> 3)) == isOrientedWestEast(dir)) ? k18_ElementTypeStairsSide : k19_ElementTypeStaisFront; + aspectArray[k2_StairsUpAspect] = getFlag(AL0307_uc_Square, k0x0004_StairsUp); + AL0307_uc_FootprintsAllowed = false; goto T0172046_Stairs; case k4_DoorElemType: - if ((getFlag(square, k0x0008_DoorNorthSouthOrient) >> 3) == (isOrientedWestEast(dir) ? 1 : 0)) { + if (bool((getFlag(AL0307_uc_Square, k0x0008_DoorNorthSouthOrient) >> 3)) == isOrientedWestEast(dir)) { aspectArray[k0_ElemAspect] = k16_DoorSideElemType; } else { aspectArray[k0_ElemAspect] = k17_DoorFrontElemType; - aspectArray[k2_DoorStateAspect] = Square(square).getDoorState(); - aspectArray[k3_DoorThingIndexAspect] = _vm->_dungeonMan->f161_getSquareFirstThing(mapX, mapY).getIndex(); + aspectArray[k2_DoorStateAspect] = Square(AL0307_uc_Square).getDoorState(); + aspectArray[k3_DoorThingIndexAspect] = f161_getSquareFirstThing(mapX, mapY).getIndex(); } - footprintsAllowed = true; + AL0307_uc_FootprintsAllowed = true; T0172046_Stairs: - while ((thing != Thing::_endOfList) && (thing.getType() <= k3_SensorThingType)) { - thing = _vm->_dungeonMan->f159_getNextThing(thing); + while ((L0314_T_Thing != Thing::_endOfList) && (L0314_T_Thing.getType() <= k3_SensorThingType)) { + L0314_T_Thing = f159_getNextThing(L0314_T_Thing); } T0172049_Footprints: - if (footprintsAllowed && (scentOrdinal = _vm->_championMan->f315_getScentOrdinal(mapX, mapY)) - && (--scentOrdinal >= _vm->_championMan->_g407_party._firstScentIndex) - && (scentOrdinal < _vm->_championMan->_g407_party._lastScentIndex)) { + if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = _vm->_championMan->f315_getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= _vm->_championMan->_g407_party._firstScentIndex) && (AL0307_uc_ScentOrdinal < _vm->_championMan->_g407_party._lastScentIndex)) { setFlag(aspectArray[k4_FloorOrnOrdAspect], k0x8000_FootprintsAspect); } } - aspectArray[k1_FirstGroupOrObjectAspect] = thing.toUint16(); + aspectArray[k1_FirstGroupOrObjectAspect] = L0314_T_Thing.toUint16(); } void DungeonMan::f171_setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowed, bool frontAllowed, bool rightAllowed, int16 dir, |