[Scummvm-git-logs] scummvm master -> 00442a193c59f117b197209aaac6a643e4693777

sev- sev at scummvm.org
Thu Jun 11 08:55:46 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b54ba7c7e7 KINGDOM: Switched _finalFrameTable to byte for better readability
b7e878f0de KINGDOM: Got rid of global constructors
00442a193c KINGDOM: Simplified drawHotSpot()


Commit: b54ba7c7e7d43c2976ef56d4bc0035c78fd20181
    https://github.com/scummvm/scummvm/commit/b54ba7c7e7d43c2976ef56d4bc0035c78fd20181
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-11T10:28:26+02:00

Commit Message:
KINGDOM: Switched _finalFrameTable to byte for better readability

Changed paths:
    engines/kingdom/constants.cpp
    engines/kingdom/kingdom.h


diff --git a/engines/kingdom/constants.cpp b/engines/kingdom/constants.cpp
index cba9410f53..b06cee94b4 100644
--- a/engines/kingdom/constants.cpp
+++ b/engines/kingdom/constants.cpp
@@ -24,28 +24,18 @@
 
 namespace Kingdom {
 
-bool _finalFrameTable[] = {
-    false, false, true, false, true, false, true, true, true, false,
-    false, true, true, true, false, true, true, true, true, false,
-    true, true, true, true, true, true, true, false, true, true,
-    false, false, false, true, true, true, true, true, true, true,
-    true, true, true, false, true, false, false, true, true, true,
-    false, true, true, true, false, true, true, true, true, false,
-    false, true, true, true, true, true, true, true, false, false,
-    false, true, false, false, false, false, true, true, false, true,
-    true, true, true, true, true, true, true, true, true, false,
-    true, true, false, false, false, false, true, true, true, false,
-    true, true, true, true, false, false, false, true, false, false,
-    true, true, true, true, true, true, true, false, true, true,
-    false, true, true, true, true, false, true, true, true, true,
-    true, true, true, true, false, true, false, false, false, true,
-    true, true, false, true, true, false, true, true, false, true,
-    true, true, true, false, true, false, false, true, true, true,
-    true, true, false, true, true, true, false, false, false, true,
-    false, true, true, true, true, true, true, false, false, true,
-    true, true, false, false, false, false, true, true, false, true,
-    true, true, true, true, false, false, false, false, false, false,
-    false, false, true, false, false, false, false, false, false, true
+byte _finalFrameTable[] = {
+	0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0,
+	1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0,
+	0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0,
+	1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+	0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1,
+	1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1,
+	1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1,
+	1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+	0, 0, 1, 0, 0, 0, 0, 0, 0, 1
 };
 
 const char *_rezNames[] = {
@@ -664,7 +654,7 @@ int _zoomTable[81][9][2] = {
 	{{   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}, {   0, 0x0A}},
 	{{0x64, 0x48}, {0x5C, 0x0A}, {0x36, 0x0A}, {0x0F, 0x0A}, {0x0A, 0x0A}, {   7, 0x0A}, {   4, 0x0A}, {   3, 0x0A}, {   1, 0x0A}},
 	{{   0, 0x0A}, {0x3C, 0x0A}, {0x15, 0x0A}, {0x0B, 0x0A}, {   8, 0x0A}, {   5, 0x0A}, {   4, 0x0A}, {   2, 0x0A}, {   1, 0x0A}},
-	{{   0, 0x0A}, {0x3A, 0x0A}, {0x12, 0x24}, {0x0B, 0x0A}, {   8, 0x0A}, {   5, 0x0A}, {   4, 0x0A}, {   2, 0x0A}, {   1, 0x0A}} 
+	{{   0, 0x0A}, {0x3A, 0x0A}, {0x12, 0x24}, {0x0B, 0x0A}, {   8, 0x0A}, {   5, 0x0A}, {   4, 0x0A}, {   2, 0x0A}, {   1, 0x0A}}
 };
 
 int _iconActTable[82][7] = {
@@ -749,7 +739,7 @@ int _iconActTable[82][7] = {
 	{ 3, 18, 17,  2,  0, 18,  1},
 	{ 3, 18, 18, 18, 18, 18, 18},
 	{ 3, 18,  2,  4, 18,  1, 18},
-	{ 3, 18, 18, 18,  0, 18, 18} 
+	{ 3, 18, 18, 18,  0, 18, 18}
 };
 
 int _teaSeq[6][2] = {
diff --git a/engines/kingdom/kingdom.h b/engines/kingdom/kingdom.h
index 4da68b0ebe..3adc9870b7 100644
--- a/engines/kingdom/kingdom.h
+++ b/engines/kingdom/kingdom.h
@@ -56,7 +56,7 @@ namespace Kingdom {
 		int16 _mouseValue;
 	};
 
-	extern bool _finalFrameTable[];
+	extern byte _finalFrameTable[];
 	extern const char *_rezNames[];
 	extern const char *_movieNames[];
 	extern int _mapExit[];


Commit: b7e878f0de5eddc785cd2a32c786549c2ba31987
    https://github.com/scummvm/scummvm/commit/b7e878f0de5eddc785cd2a32c786549c2ba31987
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-11T10:53:00+02:00

Commit Message:
KINGDOM: Got rid of global constructors

Changed paths:
    engines/kingdom/constants.cpp
    engines/kingdom/kingdom.cpp
    engines/kingdom/kingdom.h


diff --git a/engines/kingdom/constants.cpp b/engines/kingdom/constants.cpp
index b06cee94b4..424c4fddc8 100644
--- a/engines/kingdom/constants.cpp
+++ b/engines/kingdom/constants.cpp
@@ -758,8 +758,8 @@ int _hgaSeq[4][2] = {
 	{50, 0}
 };
 
-#define INITHOTSPOT(x1, x2, y1, y2, id)  { Common::Rect(x1, y1, x2, y2), id }
-#define DUMMYHOTSPOT(id) { Common::Rect(0, 0, 0, 0), id }
+#define INITHOTSPOT(x1, x2, y1, y2, id)  { x1, y1, x2, y2, id }
+#define DUMMYHOTSPOT(id) { 0, 0, 0, 0, id }
 HotSpot _mouseMapMSFull[51] = {
 	INITHOTSPOT( 11,  35, 178, 197, 0x181),
 	INITHOTSPOT( 38,  62, 178, 197, 0x182),
diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp
index 68d80bfbeb..50567c9df2 100644
--- a/engines/kingdom/kingdom.cpp
+++ b/engines/kingdom/kingdom.cpp
@@ -645,20 +645,20 @@ void KingdomGame::drawRect(uint minX, uint minY, uint maxX, uint maxY, int color
 	g_system->updateScreen();
 }
 
-void KingdomGame::drawEmptyRect(Common::Rect rect, int color) {
+void KingdomGame::drawHotSpot(const HotSpot &hs, int color) {
 	::Graphics::Surface *screen = g_system->lockScreen();
 
-	for (int curX = rect.left; curX < rect.right; curX++) {
-		byte *dst = (byte *)screen->getBasePtr(curX, rect.top);
+	for (int curX = hs.x1; curX < hs.x2; curX++) {
+		byte *dst = (byte *)screen->getBasePtr(curX, hs.y1);
 		*dst = color;
-		dst = (byte *)screen->getBasePtr(curX, rect.bottom);
+		dst = (byte *)screen->getBasePtr(curX, hs.y2);
 		*dst = color;
 	}
 
-	for (int curY = rect.top; curY < rect.bottom; curY++) {
-		byte *dst = (byte *)screen->getBasePtr(rect.left, curY);
+	for (int curY = hs.y1; curY < hs.y2; curY++) {
+		byte *dst = (byte *)screen->getBasePtr(hs.x1, curY);
 		*dst = color;
-		dst = (byte *)screen->getBasePtr(rect.right, curY);
+		dst = (byte *)screen->getBasePtr(hs.x2, curY);
 		*dst = color;
 	}
 
@@ -1526,7 +1526,7 @@ void KingdomGame::cursorType() {
 					return;
 				} else
 					_mouseValue = tmpVal;
-			} else if (mouseMapMS[startId + i]._area.contains(_cursorPos)) {
+			} else if (mouseMapMS[startId + i].contains(_cursorPos)) {
 				_mouseValue = mouseMapMS[startId + i]._mouseValue;
 				break;
 			}
@@ -1655,7 +1655,7 @@ int KingdomGame::checkMouseMapAS() {
 		curSceneHotspots = _mouseMapASFull[_logic->_currMap];
 
 	for (int i = 0; i < 16; i++) {
-		if (curSceneHotspots[i]._area.contains(_cursorPos))
+		if (curSceneHotspots[i].contains(_cursorPos))
 			return curSceneHotspots[i]._mouseValue;
 	}
 
@@ -1668,7 +1668,7 @@ int KingdomGame::checkMouseMapAS() {
 		curSceneHotspots = _mouseMapASFull[12];
 
 	for (int i = 0; i < 16; i++) {
-		if (curSceneHotspots[i]._area.contains(_cursorPos))
+		if (curSceneHotspots[i].contains(_cursorPos))
 			return curSceneHotspots[i]._mouseValue;
 	}
 
@@ -1684,8 +1684,8 @@ void KingdomGame::displayDebugHotSpots() {
 		int hotspotCount = _logic->_statPlay == 901 ? 35 : 16;
 		HotSpot *mouseMapMS = isDemo() ? _mouseMapMSDemo : _mouseMapMSFull;
 		for (int i = 0; i < hotspotCount; i++) {
-			if (mouseMapMS[startId + i]._area != Common::Rect(0, 0, 0, 0))
-				drawEmptyRect(mouseMapMS[startId + i]._area, 0xDF);
+			if (!mouseMapMS[startId + i].dummy())
+				drawHotSpot(mouseMapMS[startId + i], 0xDF);
 		}
 	}
 
@@ -1696,8 +1696,8 @@ void KingdomGame::displayDebugHotSpots() {
 		curSceneHotspots = _mouseMapASFull[_logic->_currMap];
 
 	for (int i = 0; i < 16; i++) {
-		if (curSceneHotspots[i]._area != Common::Rect(0,0,0,0))
-			drawEmptyRect(curSceneHotspots[i]._area, 0xFF);
+		if (!curSceneHotspots[i].dummy())
+			drawHotSpot(curSceneHotspots[i], 0xFF);
 	}
 
 	if (_logic->_currMap != 11)
@@ -1709,8 +1709,8 @@ void KingdomGame::displayDebugHotSpots() {
 		curSceneHotspots = _mouseMapASFull[12];
 
 	for (int i = 0; i < 16; i++) {
-		if (curSceneHotspots[i]._area != Common::Rect(0, 0, 0, 0))
-			drawEmptyRect(curSceneHotspots[i]._area, 0xFF);
+		if (!curSceneHotspots[i].dummy())
+			drawHotSpot(curSceneHotspots[i], 0xFF);
 	}
 }
 
diff --git a/engines/kingdom/kingdom.h b/engines/kingdom/kingdom.h
index 3adc9870b7..4452a69583 100644
--- a/engines/kingdom/kingdom.h
+++ b/engines/kingdom/kingdom.h
@@ -52,8 +52,16 @@ namespace Kingdom {
 	};
 
 	struct HotSpot {
-		Common::Rect _area;
+		int x1, y1, x2, y2;
 		int16 _mouseValue;
+
+		bool contains(const Common::Point &p) {
+			return (x1 <= p.x) && (p.x < x2) && (y1 <= p.y) && (p.y < y2);
+		}
+
+		bool dummy() {
+			return !(x1 || x2 || y1 || y2);
+		}
 	};
 
 	extern byte _finalFrameTable[];
@@ -196,7 +204,7 @@ namespace Kingdom {
 		void restoreAS(); // TODO: Rename later as restoreVideoBackground
 		void drawHelpScreen();
 		void drawRect(uint minX, uint minY, uint maxX, uint maxY, int color);
-		void drawEmptyRect(Common::Rect rect, int color);
+		void drawHotSpot(const HotSpot &hs, int color);
 		void drawInventory();
 		void playSound(int idx);
 		void eraseCursor();


Commit: 00442a193c59f117b197209aaac6a643e4693777
    https://github.com/scummvm/scummvm/commit/00442a193c59f117b197209aaac6a643e4693777
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-06-11T10:55:28+02:00

Commit Message:
KINGDOM: Simplified drawHotSpot()

Changed paths:
    engines/kingdom/kingdom.cpp


diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp
index 50567c9df2..4a371a6c15 100644
--- a/engines/kingdom/kingdom.cpp
+++ b/engines/kingdom/kingdom.cpp
@@ -648,19 +648,7 @@ void KingdomGame::drawRect(uint minX, uint minY, uint maxX, uint maxY, int color
 void KingdomGame::drawHotSpot(const HotSpot &hs, int color) {
 	::Graphics::Surface *screen = g_system->lockScreen();
 
-	for (int curX = hs.x1; curX < hs.x2; curX++) {
-		byte *dst = (byte *)screen->getBasePtr(curX, hs.y1);
-		*dst = color;
-		dst = (byte *)screen->getBasePtr(curX, hs.y2);
-		*dst = color;
-	}
-
-	for (int curY = hs.y1; curY < hs.y2; curY++) {
-		byte *dst = (byte *)screen->getBasePtr(hs.x1, curY);
-		*dst = color;
-		dst = (byte *)screen->getBasePtr(hs.x2, curY);
-		*dst = color;
-	}
+	screen->frameRect(Common::Rect(hs.x1, hs.y1, hs.x2, hs.y2), color);
 
 	g_system->unlockScreen();
 	g_system->updateScreen();




More information about the Scummvm-git-logs mailing list