mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 16:03:05 +00:00
HDB: Add more Platform-specific Constants
This commit is contained in:
parent
0fb3ad7ba0
commit
a9e65176a1
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user