From 77353d2db9fcb4171268239a01c64c87670bbb53 Mon Sep 17 00:00:00 2001 From: Vladimir Olteanu Date: Tue, 2 Aug 2022 21:50:45 +0300 Subject: [PATCH] Turn AmLine* into inline function --- Source/automap.cpp | 215 +++++++++++++++++++----------------------- Source/automap.h | 12 ++- test/automap_test.cpp | 60 ++++++------ 3 files changed, 132 insertions(+), 155 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index 0a62da1d9..ed0590045 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -86,57 +86,57 @@ std::array AutomapTypeTiles; void DrawDiamond(const Surface &out, Point center, uint8_t color) { - const Point left { center.x - AmLine16, center.y }; - const Point top { center.x, center.y - AmLine8 }; - const Point bottom { center.x, center.y + AmLine8 }; - - DrawMapLineNE(out, left, AmLine8, color); - DrawMapLineSE(out, left, AmLine8, color); - DrawMapLineSE(out, top, AmLine8, color); - DrawMapLineNE(out, bottom, AmLine8, color); + const Point left { center.x - AmLine(16), center.y }; + const Point top { center.x, center.y - AmLine(8) }; + const Point bottom { center.x, center.y + AmLine(8) }; + + DrawMapLineNE(out, left, AmLine(8), color); + DrawMapLineSE(out, left, AmLine(8), color); + DrawMapLineSE(out, top, AmLine(8), color); + DrawMapLineNE(out, bottom, AmLine(8), color); } void DrawMapVerticalDoor(const Surface &out, Point center, uint8_t colorBright, uint8_t colorDim) { - DrawMapLineNE(out, { center.x + AmLine8, center.y - AmLine4 }, AmLine4, colorDim); - DrawMapLineNE(out, { center.x - AmLine16, center.y + AmLine8 }, AmLine4, colorDim); + DrawMapLineNE(out, { center.x + AmLine(8), center.y - AmLine(4) }, AmLine(4), colorDim); + DrawMapLineNE(out, { center.x - AmLine(16), center.y + AmLine(8) }, AmLine(4), colorDim); DrawDiamond(out, center, colorBright); } void DrawMapHorizontalDoor(const Surface &out, Point center, uint8_t colorBright, uint8_t colorDim) { - DrawMapLineSE(out, { center.x - AmLine16, center.y - AmLine8 }, AmLine4, colorDim); - DrawMapLineSE(out, { center.x + AmLine8, center.y + AmLine4 }, AmLine4, colorDim); + DrawMapLineSE(out, { center.x - AmLine(16), center.y - AmLine(8) }, AmLine(4), colorDim); + DrawMapLineSE(out, { center.x + AmLine(8), center.y + AmLine(4) }, AmLine(4), colorDim); DrawDiamond(out, center, colorBright); } void DrawDirt(const Surface &out, Point center, uint8_t color) { out.SetPixel(center, color); - out.SetPixel({ center.x - AmLine8, center.y - AmLine4 }, color); - out.SetPixel({ center.x - AmLine8, center.y + AmLine4 }, color); - out.SetPixel({ center.x + AmLine8, center.y - AmLine4 }, color); - out.SetPixel({ center.x + AmLine8, center.y + AmLine4 }, color); - out.SetPixel({ center.x - AmLine16, center.y }, color); - out.SetPixel({ center.x + AmLine16, center.y }, color); - out.SetPixel({ center.x, center.y - AmLine8 }, color); - out.SetPixel({ center.x, center.y + AmLine8 }, color); - out.SetPixel({ center.x + AmLine8 - AmLine32, center.y + AmLine4 }, color); - out.SetPixel({ center.x - AmLine8 + AmLine32, center.y + AmLine4 }, color); - out.SetPixel({ center.x - AmLine16, center.y + AmLine8 }, color); - out.SetPixel({ center.x + AmLine16, center.y + AmLine8 }, color); - out.SetPixel({ center.x - AmLine8, center.y + AmLine16 - AmLine4 }, color); - out.SetPixel({ center.x + AmLine8, center.y + AmLine16 - AmLine4 }, color); - out.SetPixel({ center.x, center.y + AmLine16 }, color); + out.SetPixel({ center.x - AmLine(8), center.y - AmLine(4) }, color); + out.SetPixel({ center.x - AmLine(8), center.y + AmLine(4) }, color); + out.SetPixel({ center.x + AmLine(8), center.y - AmLine(4) }, color); + out.SetPixel({ center.x + AmLine(8), center.y + AmLine(4) }, color); + out.SetPixel({ center.x - AmLine(16), center.y }, color); + out.SetPixel({ center.x + AmLine(16), center.y }, color); + out.SetPixel({ center.x, center.y - AmLine(8) }, color); + out.SetPixel({ center.x, center.y + AmLine(8) }, color); + out.SetPixel({ center.x + AmLine(8) - AmLine(32), center.y + AmLine(4) }, color); + out.SetPixel({ center.x - AmLine(8) + AmLine(32), center.y + AmLine(4) }, color); + out.SetPixel({ center.x - AmLine(16), center.y + AmLine(8) }, color); + out.SetPixel({ center.x + AmLine(16), center.y + AmLine(8) }, color); + out.SetPixel({ center.x - AmLine(8), center.y + AmLine(16) - AmLine(4) }, color); + out.SetPixel({ center.x + AmLine(8), center.y + AmLine(16) - AmLine(4) }, color); + out.SetPixel({ center.x, center.y + AmLine(16) }, color); } void DrawStairs(const Surface &out, Point center, uint8_t color) { constexpr int NumStairSteps = 4; - const Displacement offset = { -AmLine8, AmLine4 }; - Point p = { center.x - AmLine8, center.y - AmLine8 - AmLine4 }; + const Displacement offset = { -AmLine(8), AmLine(4) }; + Point p = { center.x - AmLine(8), center.y - AmLine(8) - AmLine(4) }; for (int i = 0; i < NumStairSteps; ++i) { - DrawMapLineSE(out, p, AmLine16, color); + DrawMapLineSE(out, p, AmLine(16), color); p += offset; } } @@ -147,17 +147,17 @@ void DrawStairs(const Surface &out, Point center, uint8_t color) void DrawHorizontal(const Surface &out, Point center, AutomapTile tile, uint8_t colorBright, uint8_t colorDim) { if (!tile.HasFlag(AutomapTile::Flags::HorizontalPassage)) { - DrawMapLineSE(out, { center.x, center.y - AmLine16 }, AmLine16, colorDim); + DrawMapLineSE(out, { center.x, center.y - AmLine(16) }, AmLine(16), colorDim); return; } if (tile.HasFlag(AutomapTile::Flags::HorizontalDoor)) { - DrawMapHorizontalDoor(out, { center.x + AmLine16, center.y - AmLine8 }, colorBright, colorDim); + DrawMapHorizontalDoor(out, { center.x + AmLine(16), center.y - AmLine(8) }, colorBright, colorDim); } if (tile.HasFlag(AutomapTile::Flags::HorizontalGrate)) { - DrawMapLineSE(out, { center.x + AmLine16, center.y - AmLine8 }, AmLine8, colorDim); - DrawDiamond(out, { center.x, center.y - AmLine8 }, colorDim); + DrawMapLineSE(out, { center.x + AmLine(16), center.y - AmLine(8) }, AmLine(8), colorDim); + DrawDiamond(out, { center.x, center.y - AmLine(8) }, colorDim); } else if (tile.HasFlag(AutomapTile::Flags::HorizontalArch)) { - DrawDiamond(out, { center.x, center.y - AmLine8 }, colorDim); + DrawDiamond(out, { center.x, center.y - AmLine(8) }, colorDim); } } @@ -167,17 +167,17 @@ void DrawHorizontal(const Surface &out, Point center, AutomapTile tile, uint8_t void DrawVertical(const Surface &out, Point center, AutomapTile tile, uint8_t colorBright, uint8_t colorDim) { if (!tile.HasFlag(AutomapTile::Flags::VerticalPassage)) { - DrawMapLineNE(out, { center.x - AmLine32, center.y }, AmLine16, colorDim); + DrawMapLineNE(out, { center.x - AmLine(32), center.y }, AmLine(16), colorDim); return; } if (tile.HasFlag(AutomapTile::Flags::VerticalDoor)) { // two wall segments with a door in the middle - DrawMapVerticalDoor(out, { center.x - AmLine16, center.y - AmLine8 }, colorBright, colorDim); + DrawMapVerticalDoor(out, { center.x - AmLine(16), center.y - AmLine(8) }, colorBright, colorDim); } if (tile.HasFlag(AutomapTile::Flags::VerticalGrate)) { // right-facing half-wall - DrawMapLineNE(out, { center.x - AmLine32, center.y }, AmLine8, colorDim); - DrawDiamond(out, { center.x, center.y - AmLine8 }, colorDim); + DrawMapLineNE(out, { center.x - AmLine(32), center.y }, AmLine(8), colorDim); + DrawDiamond(out, { center.x, center.y - AmLine(8) }, colorDim); } else if (tile.HasFlag(AutomapTile::Flags::VerticalArch)) { // window or passable column - DrawDiamond(out, { center.x, center.y - AmLine8 }, colorDim); + DrawDiamond(out, { center.x, center.y - AmLine(8) }, colorDim); } } @@ -187,9 +187,9 @@ void DrawVertical(const Surface &out, Point center, AutomapTile tile, uint8_t co void DrawCaveHorizontal(const Surface &out, Point center, AutomapTile tile, uint8_t colorBright, uint8_t colorDim) { if (tile.HasFlag(AutomapTile::Flags::VerticalDoor)) { - DrawMapHorizontalDoor(out, { center.x - AmLine16, center.y + AmLine8 }, colorBright, colorDim); + DrawMapHorizontalDoor(out, { center.x - AmLine(16), center.y + AmLine(8) }, colorBright, colorDim); } else { - DrawMapLineSE(out, { center.x - AmLine32, center.y }, AmLine16, colorDim); + DrawMapLineSE(out, { center.x - AmLine(32), center.y }, AmLine(16), colorDim); } } @@ -199,9 +199,9 @@ void DrawCaveHorizontal(const Surface &out, Point center, AutomapTile tile, uint void DrawCaveVertical(const Surface &out, Point center, AutomapTile tile, uint8_t colorBright, uint8_t colorDim) { if (tile.HasFlag(AutomapTile::Flags::HorizontalDoor)) { - DrawMapVerticalDoor(out, { center.x + AmLine16, center.y + AmLine8 }, colorBright, colorDim); + DrawMapVerticalDoor(out, { center.x + AmLine(16), center.y + AmLine(8) }, colorBright, colorDim); } else { - DrawMapLineNE(out, { center.x, center.y + AmLine16 }, AmLine16, colorDim); + DrawMapLineNE(out, { center.x, center.y + AmLine(16) }, AmLine(16), colorDim); } } @@ -305,7 +305,7 @@ void DrawAutomapTile(const Surface &out, Point center, Point map) switch (tile.type) { case AutomapTile::Types::Diamond: // stand-alone column or other unpassable object - DrawDiamond(out, { center.x, center.y - AmLine8 }, colorDim); + DrawDiamond(out, { center.x, center.y - AmLine(8) }, colorDim); break; case AutomapTile::Types::Vertical: case AutomapTile::Types::FenceVertical: @@ -370,8 +370,8 @@ void SearchAutomapItem(const Surface &out, const Displacement &myPlayerOffset) int py = j - 2 * AutomapOffset.deltaY - ViewPosition.y; Point screen = { - (myPlayerOffset.deltaX * AutoMapScale / 100 / 2) + (px - py) * AmLine16 + gnScreenWidth / 2, - (myPlayerOffset.deltaY * AutoMapScale / 100 / 2) + (px + py) * AmLine8 + (gnScreenHeight - GetMainPanel().size.height) / 2 + (myPlayerOffset.deltaX * AutoMapScale / 100 / 2) + (px - py) * AmLine(16) + gnScreenWidth / 2, + (myPlayerOffset.deltaY * AutoMapScale / 100 / 2) + (px + py) * AmLine(8) + (gnScreenHeight - GetMainPanel().size.height) / 2 }; if (CanPanelsCoverView()) { @@ -380,7 +380,7 @@ void SearchAutomapItem(const Surface &out, const Displacement &myPlayerOffset) if (IsLeftPanelOpen()) screen.x += 160; } - screen.y -= AmLine8; + screen.y -= AmLine(8); DrawDiamond(out, screen, MapColorsItem); } } @@ -407,8 +407,8 @@ void DrawAutomapPlr(const Surface &out, const Displacement &myPlayerOffset, int playerOffset = GetOffsetForWalking(player.AnimInfo, player._pdir); Point base = { - ((playerOffset.deltaX + myPlayerOffset.deltaX) * AutoMapScale / 100 / 2) + (px - py) * AmLine16 + gnScreenWidth / 2, - ((playerOffset.deltaY + myPlayerOffset.deltaY) * AutoMapScale / 100 / 2) + (px + py) * AmLine8 + (gnScreenHeight - GetMainPanel().size.height) / 2 + ((playerOffset.deltaX + myPlayerOffset.deltaX) * AutoMapScale / 100 / 2) + (px - py) * AmLine(16) + gnScreenWidth / 2, + ((playerOffset.deltaY + myPlayerOffset.deltaY) * AutoMapScale / 100 / 2) + (px + py) * AmLine(8) + (gnScreenHeight - GetMainPanel().size.height) / 2 }; if (CanPanelsCoverView()) { @@ -417,56 +417,56 @@ void DrawAutomapPlr(const Surface &out, const Displacement &myPlayerOffset, int if (IsLeftPanelOpen()) base.x += gnScreenWidth / 4; } - base.y -= AmLine16; + base.y -= AmLine(16); switch (player._pdir) { case Direction::North: { - const Point point { base.x, base.y - AmLine16 }; - DrawVerticalLine(out, point, AmLine16, playerColor); - DrawMapLineSteepNE(out, { point.x - AmLine4, point.y + 2 * AmLine4 }, AmLine4, playerColor); - DrawMapLineSteepNW(out, { point.x + AmLine4, point.y + 2 * AmLine4 }, AmLine4, playerColor); + const Point point { base.x, base.y - AmLine(16) }; + DrawVerticalLine(out, point, AmLine(16), playerColor); + DrawMapLineSteepNE(out, { point.x - AmLine(4), point.y + 2 * AmLine(4) }, AmLine(4), playerColor); + DrawMapLineSteepNW(out, { point.x + AmLine(4), point.y + 2 * AmLine(4) }, AmLine(4), playerColor); } break; case Direction::NorthEast: { - const Point point { base.x + AmLine16, base.y - AmLine8 }; - DrawHorizontalLine(out, { point.x - AmLine8, point.y }, AmLine8, playerColor); - DrawMapLineNE(out, { point.x - 2 * AmLine8, point.y + AmLine8 }, AmLine8, playerColor); - DrawMapLineSteepSW(out, point, AmLine4, playerColor); + const Point point { base.x + AmLine(16), base.y - AmLine(8) }; + DrawHorizontalLine(out, { point.x - AmLine(8), point.y }, AmLine(8), playerColor); + DrawMapLineNE(out, { point.x - 2 * AmLine(8), point.y + AmLine(8) }, AmLine(8), playerColor); + DrawMapLineSteepSW(out, point, AmLine(4), playerColor); } break; case Direction::East: { - const Point point { base.x + AmLine16, base.y }; - DrawMapLineNW(out, point, AmLine4, playerColor); - DrawHorizontalLine(out, { point.x - AmLine16, point.y }, AmLine16, playerColor); - DrawMapLineSW(out, point, AmLine4, playerColor); + const Point point { base.x + AmLine(16), base.y }; + DrawMapLineNW(out, point, AmLine(4), playerColor); + DrawHorizontalLine(out, { point.x - AmLine(16), point.y }, AmLine(16), playerColor); + DrawMapLineSW(out, point, AmLine(4), playerColor); } break; case Direction::SouthEast: { - const Point point { base.x + AmLine16, base.y + AmLine8 }; - DrawMapLineSteepNW(out, point, AmLine4, playerColor); - DrawMapLineSE(out, { point.x - 2 * AmLine8, point.y - AmLine8 }, AmLine8, playerColor); - DrawHorizontalLine(out, { point.x - (AmLine8 + 1), point.y }, AmLine8 + 1, playerColor); + const Point point { base.x + AmLine(16), base.y + AmLine(8) }; + DrawMapLineSteepNW(out, point, AmLine(4), playerColor); + DrawMapLineSE(out, { point.x - 2 * AmLine(8), point.y - AmLine(8) }, AmLine(8), playerColor); + DrawHorizontalLine(out, { point.x - (AmLine(8) + 1), point.y }, AmLine(8) + 1, playerColor); } break; case Direction::South: { - const Point point { base.x, base.y + AmLine16 }; - DrawVerticalLine(out, { point.x, point.y - AmLine16 }, AmLine16, playerColor); - DrawMapLineSteepSW(out, { point.x + AmLine4, point.y - 2 * AmLine4 }, AmLine4, playerColor); - DrawMapLineSteepSE(out, { point.x - AmLine4, point.y - 2 * AmLine4 }, AmLine4, playerColor); + const Point point { base.x, base.y + AmLine(16) }; + DrawVerticalLine(out, { point.x, point.y - AmLine(16) }, AmLine(16), playerColor); + DrawMapLineSteepSW(out, { point.x + AmLine(4), point.y - 2 * AmLine(4) }, AmLine(4), playerColor); + DrawMapLineSteepSE(out, { point.x - AmLine(4), point.y - 2 * AmLine(4) }, AmLine(4), playerColor); } break; case Direction::SouthWest: { - const Point point { base.x - AmLine16, base.y + AmLine8 }; - DrawMapLineSteepNE(out, point, AmLine4, playerColor); - DrawMapLineSW(out, { point.x + 2 * AmLine8, point.y - AmLine8 }, AmLine8, playerColor); - DrawHorizontalLine(out, point, AmLine8 + 1, playerColor); + const Point point { base.x - AmLine(16), base.y + AmLine(8) }; + DrawMapLineSteepNE(out, point, AmLine(4), playerColor); + DrawMapLineSW(out, { point.x + 2 * AmLine(8), point.y - AmLine(8) }, AmLine(8), playerColor); + DrawHorizontalLine(out, point, AmLine(8) + 1, playerColor); } break; case Direction::West: { - const Point point { base.x - AmLine16, base.y }; - DrawMapLineNE(out, point, AmLine4, playerColor); - DrawHorizontalLine(out, point, AmLine16 + 1, playerColor); - DrawMapLineSE(out, point, AmLine4, playerColor); + const Point point { base.x - AmLine(16), base.y }; + DrawMapLineNE(out, point, AmLine(4), playerColor); + DrawHorizontalLine(out, point, AmLine(16) + 1, playerColor); + DrawMapLineSE(out, point, AmLine(4), playerColor); } break; case Direction::NorthWest: { - const Point point { base.x - AmLine16, base.y - AmLine8 }; - DrawMapLineNW(out, { point.x + 2 * AmLine8, point.y + AmLine8 }, AmLine8, playerColor); - DrawHorizontalLine(out, point, AmLine8 + 1, playerColor); - DrawMapLineSteepSE(out, point, AmLine4, playerColor); + const Point point { base.x - AmLine(16), base.y - AmLine(8) }; + DrawMapLineNW(out, { point.x + 2 * AmLine(8), point.y + AmLine(8) }, AmLine(8), playerColor); + DrawHorizontalLine(out, point, AmLine(8) + 1, playerColor); + DrawMapLineSteepSE(out, point, AmLine(4), playerColor); } break; } } @@ -562,21 +562,11 @@ bool AutomapActive; uint8_t AutomapView[DMAXX][DMAXY]; int AutoMapScale; Displacement AutomapOffset; -int AmLine64; -int AmLine32; -int AmLine16; -int AmLine8; -int AmLine4; void InitAutomapOnce() { AutomapActive = false; AutoMapScale = 50; - AmLine64 = 32; - AmLine32 = 16; - AmLine16 = 8; - AmLine8 = 4; - AmLine4 = 2; } void InitAutomap() @@ -630,11 +620,6 @@ void AutomapZoomIn() return; AutoMapScale += 5; - AmLine64 = (AutoMapScale * 64) / 100; - AmLine32 = AmLine64 / 2; - AmLine16 = AmLine32 / 2; - AmLine8 = AmLine16 / 2; - AmLine4 = AmLine8 / 2; } void AutomapZoomOut() @@ -643,11 +628,6 @@ void AutomapZoomOut() return; AutoMapScale -= 5; - AmLine64 = (AutoMapScale * 64) / 100; - AmLine32 = AmLine64 / 2; - AmLine16 = AmLine32 / 2; - AmLine8 = AmLine16 / 2; - AmLine4 = AmLine8 / 2; } void DrawAutomap(const Surface &out) @@ -689,19 +669,19 @@ void DrawAutomap(const Surface &out) (gnScreenHeight - GetMainPanel().size.height) / 2 }; if ((cells & 1) != 0) { - screen.x -= AmLine64 * ((cells - 1) / 2); - screen.y -= AmLine32 * ((cells + 1) / 2); + screen.x -= AmLine(64) * ((cells - 1) / 2); + screen.y -= AmLine(32) * ((cells + 1) / 2); } else { - screen.x -= AmLine64 * (cells / 2) - AmLine32; - screen.y -= AmLine32 * (cells / 2) + AmLine16; + screen.x -= AmLine(64) * (cells / 2) - AmLine(32); + screen.y -= AmLine(32) * (cells / 2) + AmLine(16); } if ((ViewPosition.x & 1) != 0) { - screen.x -= AmLine16; - screen.y -= AmLine8; + screen.x -= AmLine(16); + screen.y -= AmLine(8); } if ((ViewPosition.y & 1) != 0) { - screen.x += AmLine16; - screen.y -= AmLine8; + screen.x += AmLine(16); + screen.y -= AmLine(8); } screen.x += AutoMapScale * myPlayerOffset.deltaX / 100 / 2; @@ -722,17 +702,17 @@ void DrawAutomap(const Surface &out) Point tile1 = screen; for (int j = 0; j < cells; j++) { DrawAutomapTile(out, tile1, { map.x + j, map.y - j }); - tile1.x += AmLine64; + tile1.x += AmLine(64); } map.y++; - Point tile2 { screen.x - AmLine32, screen.y + AmLine16 }; + Point tile2 { screen.x - AmLine(32), screen.y + AmLine(16) }; for (int j = 0; j <= cells; j++) { DrawAutomapTile(out, tile2, { map.x + j, map.y - j }); - tile2.x += AmLine64; + tile2.x += AmLine(64); } map.x++; - screen.y += AmLine32; + screen.y += AmLine(32); } for (int playerId = 0; playerId < MAX_PLRS; playerId++) { @@ -833,11 +813,6 @@ void SetAutomapView(Point position, MapExplorationType explorer) void AutomapZoomReset() { AutomapOffset = { 0, 0 }; - AmLine64 = (AutoMapScale * 64) / 100; - AmLine32 = AmLine64 / 2; - AmLine16 = AmLine32 / 2; - AmLine8 = AmLine16 / 2; - AmLine4 = AmLine8 / 2; } } // namespace devilution diff --git a/Source/automap.h b/Source/automap.h index c5ec3b0f7..b2b1cb23d 100644 --- a/Source/automap.h +++ b/Source/automap.h @@ -35,11 +35,13 @@ extern uint8_t AutomapView[DMAXX][DMAXY]; /** Specifies the scale of the automap. */ extern DVL_API_FOR_TEST int AutoMapScale; extern DVL_API_FOR_TEST Displacement AutomapOffset; -extern DVL_API_FOR_TEST int AmLine64; -extern DVL_API_FOR_TEST int AmLine32; -extern DVL_API_FOR_TEST int AmLine16; -extern DVL_API_FOR_TEST int AmLine8; -extern DVL_API_FOR_TEST int AmLine4; + +inline int AmLine(int x) +{ + assert(x >= 4 && x <= 64); + assert((x & (x - 1)) == 0); + return AutoMapScale * x / 100; +} /** * @brief Initializes the automap. diff --git a/test/automap_test.cpp b/test/automap_test.cpp index 097c7225f..2a8c7b2a0 100644 --- a/test/automap_test.cpp +++ b/test/automap_test.cpp @@ -9,11 +9,11 @@ TEST(Automap, InitAutomap) InitAutomapOnce(); EXPECT_EQ(AutomapActive, false); EXPECT_EQ(AutoMapScale, 50); - EXPECT_EQ(AmLine64, 32); - EXPECT_EQ(AmLine32, 16); - EXPECT_EQ(AmLine16, 8); - EXPECT_EQ(AmLine8, 4); - EXPECT_EQ(AmLine4, 2); + EXPECT_EQ(AmLine(64), 32); + EXPECT_EQ(AmLine(32), 16); + EXPECT_EQ(AmLine(16), 8); + EXPECT_EQ(AmLine(8), 4); + EXPECT_EQ(AmLine(4), 2); } TEST(Automap, StartAutomap) @@ -65,11 +65,11 @@ TEST(Automap, AutomapZoomIn) AutoMapScale = 50; AutomapZoomIn(); EXPECT_EQ(AutoMapScale, 55); - EXPECT_EQ(AmLine64, 35); - EXPECT_EQ(AmLine32, 17); - EXPECT_EQ(AmLine16, 8); - EXPECT_EQ(AmLine8, 4); - EXPECT_EQ(AmLine4, 2); + EXPECT_EQ(AmLine(64), 35); + EXPECT_EQ(AmLine(32), 17); + EXPECT_EQ(AmLine(16), 8); + EXPECT_EQ(AmLine(8), 4); + EXPECT_EQ(AmLine(4), 2); } TEST(Automap, AutomapZoomIn_Max) @@ -78,11 +78,11 @@ TEST(Automap, AutomapZoomIn_Max) AutomapZoomIn(); AutomapZoomIn(); EXPECT_EQ(AutoMapScale, 200); - EXPECT_EQ(AmLine64, 128); - EXPECT_EQ(AmLine32, 64); - EXPECT_EQ(AmLine16, 32); - EXPECT_EQ(AmLine8, 16); - EXPECT_EQ(AmLine4, 8); + EXPECT_EQ(AmLine(64), 128); + EXPECT_EQ(AmLine(32), 64); + EXPECT_EQ(AmLine(16), 32); + EXPECT_EQ(AmLine(8), 16); + EXPECT_EQ(AmLine(4), 8); } TEST(Automap, AutomapZoomOut) @@ -90,11 +90,11 @@ TEST(Automap, AutomapZoomOut) AutoMapScale = 200; AutomapZoomOut(); EXPECT_EQ(AutoMapScale, 195); - EXPECT_EQ(AmLine64, 124); - EXPECT_EQ(AmLine32, 62); - EXPECT_EQ(AmLine16, 31); - EXPECT_EQ(AmLine8, 15); - EXPECT_EQ(AmLine4, 7); + EXPECT_EQ(AmLine(64), 124); + EXPECT_EQ(AmLine(32), 62); + EXPECT_EQ(AmLine(16), 31); + EXPECT_EQ(AmLine(8), 15); + EXPECT_EQ(AmLine(4), 7); } TEST(Automap, AutomapZoomOut_Min) @@ -103,11 +103,11 @@ TEST(Automap, AutomapZoomOut_Min) AutomapZoomOut(); AutomapZoomOut(); EXPECT_EQ(AutoMapScale, 50); - EXPECT_EQ(AmLine64, 32); - EXPECT_EQ(AmLine32, 16); - EXPECT_EQ(AmLine16, 8); - EXPECT_EQ(AmLine8, 4); - EXPECT_EQ(AmLine4, 2); + EXPECT_EQ(AmLine(64), 32); + EXPECT_EQ(AmLine(32), 16); + EXPECT_EQ(AmLine(16), 8); + EXPECT_EQ(AmLine(8), 4); + EXPECT_EQ(AmLine(4), 2); } TEST(Automap, AutomapZoomReset) @@ -119,9 +119,9 @@ TEST(Automap, AutomapZoomReset) EXPECT_EQ(AutomapOffset.deltaX, 0); EXPECT_EQ(AutomapOffset.deltaY, 0); EXPECT_EQ(AutoMapScale, 50); - EXPECT_EQ(AmLine64, 32); - EXPECT_EQ(AmLine32, 16); - EXPECT_EQ(AmLine16, 8); - EXPECT_EQ(AmLine8, 4); - EXPECT_EQ(AmLine4, 2); + EXPECT_EQ(AmLine(64), 32); + EXPECT_EQ(AmLine(32), 16); + EXPECT_EQ(AmLine(16), 8); + EXPECT_EQ(AmLine(8), 4); + EXPECT_EQ(AmLine(4), 2); }