aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-07-31 11:01:08 +0530
committerEugene Sandulenko2019-09-03 17:17:30 +0200
commita9e65176a15d17ad68c68392614e7a5ed7382e5d (patch)
treef4c2ecb695f644236e838a63ecf4007dcd1278de
parent0fb3ad7ba05983fe64cc5f64294d58fa394935d1 (diff)
downloadscummvm-rg350-a9e65176a15d17ad68c68392614e7a5ed7382e5d.tar.gz
scummvm-rg350-a9e65176a15d17ad68c68392614e7a5ed7382e5d.tar.bz2
scummvm-rg350-a9e65176a15d17ad68c68392614e7a5ed7382e5d.zip
HDB: Add more Platform-specific Constants
-rw-r--r--engines/hdb/ai-init.cpp5
-rw-r--r--engines/hdb/hdb.cpp3
-rw-r--r--engines/hdb/lua-script.cpp39
-rw-r--r--engines/hdb/lua-script.h9
-rw-r--r--engines/hdb/map.cpp49
-rw-r--r--engines/hdb/map.h18
6 files changed, 76 insertions, 47 deletions
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp
index 70146ec891..1e6336e252 100644
--- a/engines/hdb/ai-init.cpp
+++ b/engines/hdb/ai-init.cpp
@@ -956,7 +956,10 @@ AI::AI() {
memset(_waypointGfx, 0, sizeof(_waypointGfx));
_debugQMark = NULL;
- _youGotY = g_hdb->_screenHeight - 16;
+ if (g_hdb->isPPC())
+ _youGotY = 306;
+ else
+ _youGotY = g_hdb->_screenHeight - 16;
}
AI::~AI() {
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index d243224ffb..6e42ae025f 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -49,13 +49,14 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
_screenHeight = 320;
_screenDrawWidth = 240;
_screenDrawHeight = 320;
+ _progressY = 280;
} else {
_screenWidth = 640;
_screenHeight = 480;
_screenDrawWidth = _screenWidth - 160;
_screenDrawHeight = 480;
+ _progressY = _screenHeight - 64;
}
- _progressY = _screenHeight - 64;
_format = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
_systemInit = false;
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index f2552b44e0..a34028cfa6 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -98,6 +98,15 @@ struct ScriptPatch {
};
LuaScript::LuaScript() {
+
+ if (g_hdb->isPPC()) {
+ _cameraXOff = 0;
+ _cameraYOff = 0;
+ } else {
+ _cameraXOff = (32 * 3 + 24); // 3.75 Tiles Extra
+ _cameraYOff = (32 * 2 + 16); // 2.50 Tiles Extra
+ }
+
_state = NULL;
_systemInit = false;
}
@@ -520,8 +529,8 @@ static int cineDrawPic(lua_State *L) {
g_hdb->_lua->checkParameters("cineDrawPic", 4);
- x += kCameraXOff;
- y += kCameraYOff;
+ x += g_hdb->_lua->_cameraXOff;
+ y += g_hdb->_lua->_cameraYOff;
lua_pop(L, 4);
g_hdb->_ai->cineDrawPic(id, pic, (int)x, (int)y);
@@ -537,8 +546,8 @@ static int cineDrawMaskedPic(lua_State *L) {
g_hdb->_lua->checkParameters("cineDrawMaskedPic", 4);
- x += kCameraXOff;
- y += kCameraYOff;
+ x += g_hdb->_lua->_cameraXOff;
+ y += g_hdb->_lua->_cameraYOff;
lua_pop(L, 4);
g_hdb->_ai->cineDrawMaskedPic(id, pic, (int)x, (int)y);
@@ -557,10 +566,10 @@ static int cineMovePic(lua_State *L) {
g_hdb->_lua->checkParameters("cineMovePic", 7);
- x1 += kCameraXOff;
- y1 += kCameraYOff;
- x2 += kCameraXOff;
- y2 += kCameraYOff;
+ x1 += g_hdb->_lua->_cameraXOff;
+ y1 += g_hdb->_lua->_cameraYOff;
+ x2 += g_hdb->_lua->_cameraXOff;
+ y2 += g_hdb->_lua->_cameraYOff;
lua_pop(L, 7);
@@ -580,10 +589,10 @@ static int cineMoveMaskedPic(lua_State *L) {
g_hdb->_lua->checkParameters("cineMoveMaskedPic", 7);
- x1 += kCameraXOff;
- y1 += kCameraYOff;
- x2 += kCameraXOff;
- y2 += kCameraYOff;
+ x1 += g_hdb->_lua->_cameraXOff;
+ y1 += g_hdb->_lua->_cameraYOff;
+ x2 += g_hdb->_lua->_cameraXOff;
+ y2 += g_hdb->_lua->_cameraYOff;
lua_pop(L, 7);
@@ -687,8 +696,8 @@ static int cineTextOut(lua_State *L) {
g_hdb->_lua->checkParameters("cineTextOut", 4);
- x += kCameraXOff;
- y += kCameraYOff;
+ x += g_hdb->_lua->_cameraXOff;
+ y += g_hdb->_lua->_cameraYOff;
lua_pop(L, 4);
g_hdb->_ai->cineTextOut(string, (int)x, (int)y, (int)timer);
@@ -702,7 +711,7 @@ static int cineCenterTextOut(lua_State *L) {
g_hdb->_lua->checkParameters("cineCenterTextOut", 3);
- y += kCameraYOff;
+ y += g_hdb->_lua->_cameraYOff;
lua_pop(L, 3);
g_hdb->_ai->cineCenterTextOut(string, (int)y, (int)timer);
diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h
index 3e1ab50106..a239aa212a 100644
--- a/engines/hdb/lua-script.h
+++ b/engines/hdb/lua-script.h
@@ -27,11 +27,6 @@ struct lua_State;
namespace HDB {
-enum {
- kCameraXOff = (32 * 3 + 24), // 3.75 Tiles Extra
- kCameraYOff = (32 * 2 + 16) // 2.50 Tiles Extra
-};
-
struct Global {
char global[32]; // name of global variable
int valueOrString; // value = 0, string = 1
@@ -79,6 +74,10 @@ public:
return _systemInit;
}
+ // Platform-specific Constants
+ int _cameraXOff;
+ int _cameraYOff;
+
private:
lua_State *_state;
int _pcallErrorhandlerRegistryIndex;
diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index 2c9bbd5af0..9f008262c0 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -29,6 +29,19 @@
namespace HDB {
Map::Map() {
+
+ if (g_hdb->isPPC()) {
+ _screenXTiles = 9;
+ _screenYTiles = 11;
+ _screenTileWidth = 8;
+ _screenTileHeight = 10;
+ } else {
+ _screenXTiles = 17;
+ _screenYTiles = 16;
+ _screenTileWidth = 16;
+ _screenTileHeight = 16;
+ }
+
_mapLoaded = false;
_animCycle = 0;
@@ -836,8 +849,8 @@ void Map::draw() {
when we're at the very bottom of the map.
*/
- int maxTileX = (_mapTileXOff >= -8) ? kScreenXTiles - 1 : kScreenXTiles;
- int maxTileY = (!_mapTileYOff) ? kScreenYTiles - 1 : kScreenYTiles;
+ int maxTileX = (_mapTileXOff >= -8) ? g_hdb->_map->_screenXTiles - 1 : g_hdb->_map->_screenXTiles;
+ int maxTileY = (!_mapTileYOff) ? g_hdb->_map->_screenYTiles - 1 : g_hdb->_map->_screenYTiles;
if (matrixY + (maxTileY - 1)*_width > _height * _width) {
return;
@@ -933,7 +946,7 @@ void Map::draw() {
}
void Map::drawEnts() {
- g_hdb->_ai->drawEnts(_mapX, _mapY, kScreenXTiles * kTileWidth, kScreenYTiles * kTileHeight);
+ g_hdb->_ai->drawEnts(_mapX, _mapY, g_hdb->_map->_screenXTiles * kTileWidth, g_hdb->_map->_screenYTiles * kTileHeight);
}
void Map::drawGratings() {
@@ -952,6 +965,12 @@ void Map::drawForegrounds() {
debug(8, "Foregrounds Count: %d", _numForegrounds);
}
+bool Map::onScreen(int x, int y) {
+ if ((x >= _mapX / kTileWidth) && (x < (_mapX / kTileWidth) + g_hdb->_map->_screenXTiles) && (y >= _mapY / kTileHeight) && (y < (_mapY / kTileHeight) + g_hdb->_map->_screenYTiles))
+ return true;
+ return false;
+}
+
uint32 Map::getMapBGTileFlags(int x, int y) {
if (x < 0 || x >= _width || y < 0 || y >= _height) {
return 0;
@@ -1113,39 +1132,39 @@ void Map::centerMapXY(int x, int y) {
int minx, miny, maxx, maxy;
// Scan from centerX to right edge
- maxx = (_width - (kScreenTileWidth / 2)) * kTileWidth;
- for (int i = checkx + 1; i <= checkx + (kScreenTileWidth / 2); i++) {
+ maxx = (_width - (g_hdb->_map->_screenTileWidth / 2)) * kTileWidth;
+ for (int i = checkx + 1; i <= checkx + (g_hdb->_map->_screenTileWidth / 2); i++) {
if (!getMapBGTileIndex(i, checky)) {
- maxx = (i - (kScreenTileWidth / 2)) * kTileWidth;
+ maxx = (i - (g_hdb->_map->_screenTileWidth / 2)) * kTileWidth;
break;
}
}
// Scan from centerX to left edge
minx = 0;
- for (int i = checkx - 1; i >= checkx - (kScreenTileWidth / 2); i--) {
+ for (int i = checkx - 1; i >= checkx - (g_hdb->_map->_screenTileWidth / 2); i--) {
if (!getMapBGTileIndex(i, checky)) {
// +1 because we don't want to see one whole tile
- minx = (1 + i + (kScreenTileWidth / 2)) * kTileWidth;
+ minx = (1 + i + (g_hdb->_map->_screenTileWidth / 2)) * kTileWidth;
break;
}
}
// Scan from centerY to bottom edge
- maxy = (_height - (kScreenTileHeight / 2)) * kTileHeight;
- for (int i = checky + 1; i <= checky + (kScreenTileHeight / 2); i++) {
+ maxy = (_height - (g_hdb->_map->_screenTileHeight / 2)) * kTileHeight;
+ for (int i = checky + 1; i <= checky + (g_hdb->_map->_screenTileHeight / 2); i++) {
if (!getMapBGTileIndex(checkx, i)) {
- maxy = (i - (kScreenTileHeight / 2)) * kTileHeight;
+ maxy = (i - (g_hdb->_map->_screenTileHeight / 2)) * kTileHeight;
break;
}
}
// Scan from centerY to top edge
miny = 0;
- for (int i = checky - 1; i >= checky - (kScreenTileHeight / 2); i--) {
+ for (int i = checky - 1; i >= checky - (g_hdb->_map->_screenTileHeight / 2); i--) {
if (!getMapBGTileIndex(checkx, i)) {
// +1 because we don't want to see one whole tile
- miny = (1 + i + (kScreenTileHeight / 2)) * kTileHeight;
+ miny = (1 + i + (g_hdb->_map->_screenTileHeight / 2)) * kTileHeight;
break;
}
}
@@ -1169,11 +1188,11 @@ void Map::centerMapXY(int x, int y) {
}
bool Map::checkEntOnScreen(AIEntity *e) {
- return ((e->x > _mapX - 32) && (e->x < _mapX + kScreenXTiles * kTileWidth) && (e->y > _mapY - 32) && (e->y < kScreenYTiles * kTileHeight));
+ return ((e->x > _mapX - 32) && (e->x < _mapX + g_hdb->_map->_screenXTiles * kTileWidth) && (e->y > _mapY - 32) && (e->y < g_hdb->_map->_screenYTiles * kTileHeight));
}
bool Map::checkXYOnScreen(int x, int y) {
- return ((x > _mapX - 32) && (x < _mapX + kScreenXTiles * kTileWidth) && (y > _mapY - 32) && (y < kScreenYTiles * kTileHeight));
+ return ((x > _mapX - 32) && (x < _mapX + g_hdb->_map->_screenXTiles * kTileWidth) && (y > _mapY - 32) && (y < g_hdb->_map->_screenYTiles * kTileHeight));
}
bool Map::checkOneTileExistInRange(int tileIndex, int count) {
diff --git a/engines/hdb/map.h b/engines/hdb/map.h
index 89b9b86e18..8341985287 100644
--- a/engines/hdb/map.h
+++ b/engines/hdb/map.h
@@ -26,12 +26,8 @@
namespace HDB {
enum {
- kScreenXTiles = 17,
- kScreenYTiles = 16,
- kScreenTileWidth = 16,
- kScreenTileHeight = 16,
kMaxGratings = 250,
- kMaxForegrounds = 250
+ kMaxForegrounds = 250,
};
struct MSMIcon {
@@ -90,11 +86,7 @@ public:
return _mapLoaded;
}
- bool onScreen(int x, int y) {
- if ((x >= _mapX / kTileWidth) && (x < (_mapX / kTileWidth) + kScreenXTiles) && (y >= _mapY / kTileHeight) && (y < (_mapY / kTileHeight) + kScreenYTiles))
- return true;
- return false;
- }
+ bool onScreen(int x, int y);
int mapPixelWidth() {
return _width * kTileWidth;
}
@@ -146,6 +138,12 @@ public:
memset(_mapLaserBeams, 0, _width * _height);
}
+ // Platform-specific Constants;
+ int _screenXTiles;
+ int _screenYTiles;
+ int _screenTileWidth;
+ int _screenTileHeight;
+
uint16 _width, _height;
int _mapX, _mapY; // Coordinates of Map
int _mapTileX, _mapTileY; // Tile Coordinates of Map