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 | |
parent | d02a66d5ee75d16f553c424986c92b905813460a (diff) | |
download | scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.tar.gz scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.tar.bz2 scummvm-rg350-65e40980801b346f8dff4fa5afff281b61202614.zip |
DM: Improve on broken display
-rw-r--r-- | engines/dm/dungeonman.cpp | 160 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 89 |
2 files changed, 120 insertions, 129 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, diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 2103a5e82d..18241890b8 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -255,7 +255,7 @@ byte g195_FloorOrnCoordSetIndices[9] = { // @ G0195_auc_Graphic558_FloorOrnament 0}; /* Floor Ornament 08 Puddle */ byte g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets - /* { X1, X2, Y1, Y2, PixelWidth, Height } */ + /* { X1, X2, Y1, Y2, ByteWidth, Height } */ {{80, 83, 41, 45, 8, 5}, /* D3L */ {140, 143, 41, 45, 8, 5}, /* D3R */ {16, 29, 39, 50, 8, 12}, /* D3L */ @@ -349,9 +349,9 @@ byte g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamen {64, 159, 9, 119, 48, 111}}, /* D1C */ {{74, 85, 25, 75, 8, 51}, /* D3L */ {137, 149, 25, 75, 8, 51}, /* D3R */ - {0, 75, 25, 75, 40, 51}, /* D3L Atari ST: { 0, 83, 25, 75, 48*2, 51 } */ - {74, 149, 25, 75, 40, 51}, /* D3C Atari ST: { 74, 149, 25, 75, 48*2, 51 } */ - {148, 223, 25, 75, 40, 51}, /* D3R Atari ST: { 139, 223, 25, 75, 48*2, 51 } */ + {0, 75, 25, 75, 40, 51}, /* D3L Atari ST: { 0, 83, 25, 75, 48, 51 } */ + {74, 149, 25, 75, 40, 51}, /* D3C Atari ST: { 74, 149, 25, 75, 48, 51 } */ + {148, 223, 25, 75, 40, 51}, /* D3R Atari ST: { 139, 223, 25, 75, 48, 51 } */ {60, 77, 20, 90, 16, 71}, /* D2L */ {146, 163, 20, 90, 16, 71}, /* D2R */ {0, 74, 20, 90, 56, 71}, /* D2L */ @@ -1616,10 +1616,10 @@ void DisplayMan::f118_drawSquareD3C(Direction dir, int16 posX, int16 posY) { Frame(118, 135, 28, 67, 24, 41, 24, 0) /* Right Horizontal Closed three fourth */ ); int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -1681,9 +1681,9 @@ void DisplayMan::f119_drawSquareD2L(Direction dir, int16 posX, int16 posY) { ); int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -1747,10 +1747,10 @@ void DisplayMan::f120_drawSquareD2R(Direction dir, int16 posX, int16 posY) { ); int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -1815,10 +1815,10 @@ void DisplayMan::f121_drawSquareD2C(Direction dir, int16 posX, int16 posY) { ); int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -1881,10 +1881,10 @@ void DisplayMan::f122_drawSquareD1L(Direction dir, int16 posX, int16 posY) { ); int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -1948,10 +1948,10 @@ void DisplayMan::f123_drawSquareD1R(Direction dir, int16 posX, int16 posY) { ); /* Right Horizontal Closed three fourth */ int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -2001,11 +2001,11 @@ T0123021: void DisplayMan::f124_drawSquareD1C(Direction dir, int16 posX, int16 posY) { static Box g107_BoxThievesEyeVisibleArea(0, 95, 0, 94); // @ G0107_s_Graphic558_Box_ThievesEye_VisibleArea int16 order; - int16 squareAspect[5]; + uint16 squareAspect[5]; byte* bitmap; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (_vm->_dungeonMan->_g285_squareAheadElement = (ElementType)squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { @@ -2089,10 +2089,10 @@ void DisplayMan::f125_drawSquareD0L(Direction dir, int16 posX, int16 posY) { } void DisplayMan::f126_drawSquareD0R(Direction dir, int16 posX, int16 posY) { - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k18_ElementTypeStairsSide: f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_g692_stairsNativeBitmapIndex_Side_D0L, g139_FrameStairsSide_D0R); @@ -2118,9 +2118,9 @@ void DisplayMan::f126_drawSquareD0R(Direction dir, int16 posX, int16 posY) { void DisplayMan::f127_drawSquareD0C(Direction dir, int16 posX, int16 posY) { static Box g108_BoxThievesEyeHoleInDoorFrame(0, 31, 19, 113); // @ G0108_s_Graphic558_Box_ThievesEye_HoleInDoorFrame - int16 squareAspect[5]; + uint16 squareAspect[5]; - _vm->_dungeonMan->f172_setSquareAspect((uint16 *)squareAspect, dir, posX, posY); + _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElemAspect]) { case k16_DoorSideElemType: if (_vm->_championMan->_g407_party._event73Count_ThievesEye) { @@ -2378,27 +2378,28 @@ void DisplayMan::f96_loadCurrentMapGraphics() { _g266_currMapViAltarIndex = -1; - for (uint16 i = 0; i < currMap._wallOrnCount; ++i) { - uint16 ornIndice = _g261_currMapWallOrnIndices[i]; - uint16 nativeIndice = k121_FirstWallOrn + ornIndice * 2; - - _g101_currMapWallOrnInfo[i][k0_NativeBitmapIndex] = nativeIndice; - for (uint16 ornCounter = 0; ornCounter < k3_AlcoveOrnCount; ++ornCounter) { - if (ornIndice == g192_AlcoveOrnIndices[ornCounter]) { - _g267_currMapAlcoveOrnIndices[alcoveCount++] = i; - if (ornIndice == 2) - _g266_currMapViAltarIndex = i; + for (int16 ornamentIndex = 0; ornamentIndex <= currMap._wallOrnCount; ornamentIndex++) { + int16 greenOrn = _g261_currMapWallOrnIndices[ornamentIndex]; + int16 counter = k121_FirstWallOrn + greenOrn * 2; /* Each wall ornament has 2 graphics */ + _g101_currMapWallOrnInfo[ornamentIndex][k0_NativeBitmapIndex] = counter; + for (int16 ornamentCounter = 0; ornamentCounter < k3_AlcoveOrnCount; ornamentCounter++) { + if (greenOrn == g192_AlcoveOrnIndices[ornamentCounter]) { + _g267_currMapAlcoveOrnIndices[alcoveCount++] = ornamentIndex; + if (greenOrn == 2) { /* Wall ornament #2 is the Vi Altar */ + _g266_currMapViAltarIndex = ornamentIndex; + } } } - - for (uint16 ornCounter = 0; ornCounter < k1_FountainOrnCount; ++ornCounter) { - if (ornIndice == g193_FountainOrnIndices[ornCounter]) - _g268_currMapFountainOrnIndices[fountainCount++] = i; + for (int16 ornamentCounter = 0; ornamentCounter < k1_FountainOrnCount; ornamentCounter++) { + if (greenOrn == g193_FountainOrnIndices[ornamentCounter]) { + _g268_currMapFountainOrnIndices[fountainCount++] = ornamentIndex; + } } - _g101_currMapWallOrnInfo[i][k1_CoordinateSet] = g194_WallOrnCoordSetIndices[ornIndice]; + _g101_currMapWallOrnInfo[ornamentIndex][k1_CoordinateSet] = g194_WallOrnCoordSetIndices[greenOrn]; } + for (uint16 i = 0; i < currMap._floorOrnCount; ++i) { uint16 ornIndice = _g262_currMapFloorOrnIndices[i]; uint16 nativeIndice = k247_FirstFloorOrn + ornIndice * 6; @@ -2586,7 +2587,7 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall AL0089_i_PixelWidth = (AL0090_puc_CoordinateSet + L0093_i_CoordinateSetOffset)[1] - (AL0090_puc_CoordinateSet + L0093_i_CoordinateSetOffset)[0]; if (!f491_isDerivedBitmapInCache(AP0116_i_WallOrnamentIndex = k4_DerivedBitmapFirstWallOrnament + (AP0116_i_WallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex])) { L0092_puc_Bitmap = f489_getNativeBitmapOrGraphic(AL0088_i_NativeBitmapIndex); - f129_blitToBitmapShrinkWithPalChange(L0092_puc_Bitmap, f492_getDerivedBitmap(AP0116_i_WallOrnamentIndex), AL0091_puc_CoordinateSet[4] << 1, AL0091_puc_CoordinateSet[5], AL0089_i_PixelWidth + 1, AL0090_puc_CoordinateSet[5], (viewWallIndex <= k4_ViewWall_D3R_FRONT) ? g198_PalChangesDoorButtonAndWallOrn_D3 : g199_PalChangesDoorButtonAndWallOrn_D2); + f129_blitToBitmapShrinkWithPalChange(L0092_puc_Bitmap, f492_getDerivedBitmap(AP0116_i_WallOrnamentIndex), AL0091_puc_CoordinateSet[4] << 1, AL0091_puc_CoordinateSet[5], AL0090_puc_CoordinateSet[4] << 1, AL0090_puc_CoordinateSet[5], (viewWallIndex <= k4_ViewWall_D3R_FRONT) ? g198_PalChangesDoorButtonAndWallOrn_D3 : g199_PalChangesDoorButtonAndWallOrn_D2); f493_addDerivedBitmap(AP0116_i_WallOrnamentIndex); } AL0091_puc_Bitmap = f492_getDerivedBitmap(AP0116_i_WallOrnamentIndex); @@ -2623,12 +2624,15 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall } { Box tmpBox(AL0090_puc_CoordinateSet); - f132_blitToBitmap(AL0091_puc_Bitmap, _g296_bitmapViewport, tmpBox, AL0089_i_X, 0, AL0090_puc_CoordinateSet[4], k112_byteWidthViewport, k10_ColorFlesh, AL0090_puc_CoordinateSet[5], k136_heightViewport); + f132_blitToBitmap(AL0091_puc_Bitmap, _g296_bitmapViewport, tmpBox, + AL0089_i_X, 0, + AL0090_puc_CoordinateSet[4], k112_byteWidthViewport, k10_ColorFlesh, AL0090_puc_CoordinateSet[5], k136_heightViewport); } if ((viewWallIndex == k12_ViewWall_D1C_FRONT) && _g289_championPortraitOrdinal--) { f132_blitToBitmap(f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), _g296_bitmapViewport, boxChampionPortraitOnWall, - (_g289_championPortraitOrdinal & 0x0007) << 5, (_g289_championPortraitOrdinal >> 3) * 29, k128_byteWidth, k112_byteWidthViewport, k1_ColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */ + (_g289_championPortraitOrdinal & 0x0007) << 5, (_g289_championPortraitOrdinal >> 3) * 29, + k128_byteWidth, k112_byteWidthViewport, k1_ColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */ } T0107031: return L0096_B_IsAlcove; @@ -2646,18 +2650,17 @@ void DisplayMan::f129_blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *des warning(false, "MISSING CODE: No palette change takes place in f129_blitToBitmapShrinkWithPalChange"); - // HACK if (destPixelWidth % 2) destPixelWidth++; // Loop through drawing output lines - for (uint32 destY = 0, scaleYCtr = 0; destY < destHeight; ++destY, scaleYCtr += scaleY) { + for (uint32 destY = 0, scaleYCtr = 0; destY < (uint32)destHeight; ++destY, scaleYCtr += scaleY) { const byte *srcLine = &srcBitmap[(scaleYCtr / SCALE_THRESHOLD) * srcPixelWidth]; byte *destLine = &destBitmap[destY * destPixelWidth]; // Loop through drawing the pixels of the row - for (uint32 destX = 0, xCtr = 0, scaleXCtr = 0; destX < destPixelWidth; ++destX, ++xCtr, scaleXCtr += scaleX) { + for (uint32 destX = 0, xCtr = 0, scaleXCtr = 0; destX < (uint32)destPixelWidth; ++destX, ++xCtr, scaleXCtr += scaleX) { destLine[xCtr] = srcLine[scaleXCtr / SCALE_THRESHOLD]; } } |