[Scummvm-git-logs] scummvm master -> 8f6028c43deb84c2cda0a370f501a4966185de90
bluegr
noreply at scummvm.org
Wed Nov 30 21:30:29 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8f6028c43d KINGDOM: Reduce the size of the static data and make it const
Commit: 8f6028c43deb84c2cda0a370f501a4966185de90
https://github.com/scummvm/scummvm/commit/8f6028c43deb84c2cda0a370f501a4966185de90
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-11-30T23:30:25+02:00
Commit Message:
KINGDOM: Reduce the size of the static data and make it const
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 ce50f381a3b..465250d1f1a 100644
--- a/engines/kingdom/constants.cpp
+++ b/engines/kingdom/constants.cpp
@@ -23,7 +23,7 @@
namespace Kingdom {
-byte _finalFrameTable[] = {
+const 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,
@@ -37,7 +37,7 @@ byte _finalFrameTable[] = {
0, 0, 1, 0, 0, 0, 0, 0, 0, 1
};
-const char *_rezNames[] = {
+const char * const _rezNames[] = {
"",
"KMAP001.lbm",
"KMAP002.lbm",
@@ -550,7 +550,7 @@ const char *_rezNames[] = {
"KLF209.lbm",
};
-int _mapExit[] = {
+const uint16 _mapExit[] = {
100, 90, 50, 420, 550, 110, 70, 80, 180, 190,
200, 210, 230, 240, 300, 290, 330, 360, 310, 370,
390, 60, 570, 30, 40, 340, 640, 520, 510, 500,
@@ -560,7 +560,7 @@ int _mapExit[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-int _emlTable[] = {
+const uint8 _emlTable[] = {
0, 0, 0, 65, 66, 69, 0, 59, 0, 60,
61, 63, 0, 0, 62, 0, 0, 0, 58, 0,
63, 67, 67, 0, 70, 75, 0, 77, 0, 72,
@@ -571,7 +571,7 @@ int _emlTable[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-int _zoomTable[81][9][2] = {
+const uint8 _zoomTable[81][9][2] = {
// The first array is a dummy one used to fix an stupid trick on the index in the original
{{ 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}},
{{ 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 0, 0x0A}, { 8, 0x0A}, { 4, 0x0A}, { 2, 0x0A}, { 1, 0x0A}, { 0, 0x0A}},
@@ -656,7 +656,7 @@ int _zoomTable[81][9][2] = {
{{ 0, 0x0A}, {0x3A, 0x0A}, {0x12, 0x24}, {0x0B, 0x0A}, { 8, 0x0A}, { 5, 0x0A}, { 4, 0x0A}, { 2, 0x0A}, { 1, 0x0A}}
};
-int _iconActTable[82][7] = {
+const uint8 _iconActTable[82][7] = {
{18, 18, 18, 18, 18, 18, 18},
{18, 18, 18, 18, 18, 18, 18},
{18, 18, 18, 18, 18, 18, 18},
@@ -741,7 +741,7 @@ int _iconActTable[82][7] = {
{ 3, 18, 18, 18, 0, 18, 18}
};
-int _teaSeq[6][2] = {
+const uint8 _teaSeq[6][2] = {
{138, 24},
{139, 3},
{138, 12},
@@ -750,7 +750,7 @@ int _teaSeq[6][2] = {
{141, 2}
};
-int _hgaSeq[4][2] = {
+const uint8 _hgaSeq[4][2] = {
{47, 0},
{48, 0},
{49, 0},
@@ -759,7 +759,7 @@ int _hgaSeq[4][2] = {
#define INITHOTSPOT(x1, x2, y1, y2, id) { x1, y1, x2, y2, id }
#define DUMMYHOTSPOT(id) { 0, 0, 0, 0, id }
-HotSpot _mouseMapMSFull[51] = {
+const HotSpot _mouseMapMSFull[51] = {
INITHOTSPOT( 11, 35, 178, 197, 0x181),
INITHOTSPOT( 38, 62, 178, 197, 0x182),
INITHOTSPOT( 65, 89, 178, 197, 0x183),
@@ -813,7 +813,7 @@ HotSpot _mouseMapMSFull[51] = {
DUMMYHOTSPOT(0)
};
-HotSpot _mouseMapMSDemo[51] = {
+const HotSpot _mouseMapMSDemo[51] = {
INITHOTSPOT( 11, 35, 178, 197, 0x181),
INITHOTSPOT( 38, 62, 178, 197, 0x182),
INITHOTSPOT( 65, 89, 178, 197, 0x183),
@@ -867,7 +867,7 @@ HotSpot _mouseMapMSDemo[51] = {
DUMMYHOTSPOT(0)
};
-int _cursorTable[96] = {
+const uint8 _cursorTable[96] = {
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
@@ -880,7 +880,7 @@ int _cursorTable[96] = {
0, 0, 0, 0, 0, 0
};
-HotSpot _mouseMapASFull[128][16] = {
+const HotSpot _mouseMapASFull[128][16] = {
{
INITHOTSPOT( 15, 110, 48, 62, 0x240),
INITHOTSPOT( 61, 176, 30, 44, 0x241),
@@ -3187,7 +3187,7 @@ HotSpot _mouseMapASFull[128][16] = {
}
};
-HotSpot _mouseMapASDemo[128][16] = {
+const HotSpot _mouseMapASDemo[128][16] = {
{
INITHOTSPOT(15, 110, 48, 62, 0x240),
INITHOTSPOT(61, 176, 30, 44, 0x241),
diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp
index 5b9d063dea3..f682f5c20d1 100644
--- a/engines/kingdom/kingdom.cpp
+++ b/engines/kingdom/kingdom.cpp
@@ -1507,7 +1507,7 @@ void KingdomGame::cursorType() {
if (_logic->_currMap != 1 && _logic->_statPlay >= 30) {
int startId = _logic->_statPlay == 901 ? 16 : 0;
int hotspotCount = _logic->_statPlay == 901 ? 35 : 16;
- HotSpot *mouseMapMS = isDemo() ? _mouseMapMSDemo : _mouseMapMSFull;
+ const HotSpot *mouseMapMS = isDemo() ? _mouseMapMSDemo : _mouseMapMSFull;
for (int i = 0; i < hotspotCount + 1; i++) {
if (i == hotspotCount) {
int tmpVal = checkMouseMapAS();
@@ -1638,7 +1638,7 @@ void KingdomGame::cursorTypeExit() {
}
int KingdomGame::checkMouseMapAS() {
- HotSpot *curSceneHotspots;
+ const HotSpot *curSceneHotspots;
if (isDemo())
curSceneHotspots = _mouseMapASDemo[_logic->_currMap];
else
@@ -1672,14 +1672,14 @@ void KingdomGame::displayDebugHotSpots() {
if (_logic->_currMap != 1 && _logic->_statPlay >= 30) {
int startId = _logic->_statPlay == 901 ? 16 : 0;
int hotspotCount = _logic->_statPlay == 901 ? 35 : 16;
- HotSpot *mouseMapMS = isDemo() ? _mouseMapMSDemo : _mouseMapMSFull;
+ const HotSpot *mouseMapMS = isDemo() ? _mouseMapMSDemo : _mouseMapMSFull;
for (int i = 0; i < hotspotCount; i++) {
if (!mouseMapMS[startId + i].dummy())
drawHotSpot(mouseMapMS[startId + i], 0xDF);
}
}
- HotSpot *curSceneHotspots;
+ const HotSpot *curSceneHotspots;
if (isDemo())
curSceneHotspots = _mouseMapASDemo[_logic->_currMap];
else
diff --git a/engines/kingdom/kingdom.h b/engines/kingdom/kingdom.h
index c76c82cd9bd..892fae0e6c9 100644
--- a/engines/kingdom/kingdom.h
+++ b/engines/kingdom/kingdom.h
@@ -51,32 +51,31 @@ namespace Kingdom {
};
struct HotSpot {
- int x1, y1, x2, y2;
+ uint16 x1, y1, x2, y2;
int16 _mouseValue;
- bool contains(const Common::Point &p) {
+ bool contains(const Common::Point &p) const {
return (x1 <= p.x) && (p.x < x2) && (y1 <= p.y) && (p.y < y2);
}
- bool dummy() {
+ bool dummy() const {
return !(x1 || x2 || y1 || y2);
}
};
- extern byte _finalFrameTable[];
- extern const char *_rezNames[];
- extern const char *_movieNames[];
- extern int _mapExit[];
- extern int _emlTable[];
- extern int _zoomTable[81][9][2];
- extern int _iconActTable[82][7];
- extern int _cursorTable[96];
- extern int _teaSeq[6][2];
- extern int _hgaSeq[4][2];
- extern HotSpot _mouseMapMSFull[51];
- extern HotSpot _mouseMapMSDemo[51];
- extern HotSpot _mouseMapASFull[128][16];
- extern HotSpot _mouseMapASDemo[128][16];
+ extern const byte _finalFrameTable[];
+ extern const char * const _rezNames[];
+ extern const uint16 _mapExit[];
+ extern const uint8 _emlTable[];
+ extern const uint8 _zoomTable[81][9][2];
+ extern const uint8 _iconActTable[82][7];
+ extern const uint8 _cursorTable[96];
+ extern const uint8 _teaSeq[6][2];
+ extern const uint8 _hgaSeq[4][2];
+ extern const HotSpot _mouseMapMSFull[51];
+ extern const HotSpot _mouseMapMSDemo[51];
+ extern const HotSpot _mouseMapASFull[128][16];
+ extern const HotSpot _mouseMapASDemo[128][16];
struct KingdomSavegameHeader {
uint32 _signature;
More information about the Scummvm-git-logs
mailing list