diff options
author | Nipun Garg | 2019-07-31 10:26:17 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:30 +0200 |
commit | 0fb3ad7ba05983fe64cc5f64294d58fa394935d1 (patch) | |
tree | 0007f5d15ee58e4ebc328cace36185997942117e /engines/hdb | |
parent | 6e357d9d9749f399c5c1a347d4e8d6f7881ce081 (diff) | |
download | scummvm-rg350-0fb3ad7ba05983fe64cc5f64294d58fa394935d1.tar.gz scummvm-rg350-0fb3ad7ba05983fe64cc5f64294d58fa394935d1.tar.bz2 scummvm-rg350-0fb3ad7ba05983fe64cc5f64294d58fa394935d1.zip |
HDB: Make Platform specific constants into variables
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/ai-init.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/ai-waypoint.cpp | 4 | ||||
-rw-r--r-- | engines/hdb/ai.h | 4 | ||||
-rw-r--r-- | engines/hdb/gfx.cpp | 56 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 29 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 15 | ||||
-rw-r--r-- | engines/hdb/input.cpp | 24 | ||||
-rw-r--r-- | engines/hdb/map.cpp | 4 | ||||
-rw-r--r-- | engines/hdb/menu.cpp | 56 | ||||
-rw-r--r-- | engines/hdb/menu.h | 10 | ||||
-rw-r--r-- | engines/hdb/window.cpp | 71 | ||||
-rw-r--r-- | engines/hdb/window.h | 18 |
13 files changed, 166 insertions, 129 deletions
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp index dcaf057f17..70146ec891 100644 --- a/engines/hdb/ai-init.cpp +++ b/engines/hdb/ai-init.cpp @@ -955,6 +955,8 @@ AI::AI() { memset(_waypointGfx, 0, sizeof(_waypointGfx)); _debugQMark = NULL; + + _youGotY = g_hdb->_screenHeight - 16; } AI::~AI() { diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 9eb91ebd7c..85fde5e731 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -272,7 +272,7 @@ void AI::printYouGotMsg(const char *name) { return; sprintf(_youGotBuffer, "Got %s", name); - g_hdb->_window->textOut(_youGotBuffer, kYouGotX, kYouGotY, 120); + g_hdb->_window->textOut(_youGotBuffer, kYouGotX, g_hdb->_ai->_youGotY, 120); } void AI::newDelivery(const char *itemTextName, const char *itemGfxName, const char *destTextName, const char *destGfxName, const char *id) { diff --git a/engines/hdb/ai-waypoint.cpp b/engines/hdb/ai-waypoint.cpp index cbeb246859..702e41b243 100644 --- a/engines/hdb/ai-waypoint.cpp +++ b/engines/hdb/ai-waypoint.cpp @@ -429,8 +429,8 @@ void AI::drawWayPoints() { int x = _waypoints[i].x * kTileWidth; int y = _waypoints[i].y * kTileHeight; - if (x > mapX - 32 && (x < (mapX + kScreenWidth)) && - y > mapY - 32 && (y < (mapY + kScreenHeight))) + if (x > mapX - 32 && (x < (mapX + g_hdb->_screenWidth)) && + y > mapY - 32 && (y < (mapY + g_hdb->_screenHeight))) _waypointGfx[anim]->drawMasked(x - mapX, y - mapY, alpha); } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 6bf3af88b2..bd418904a5 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -57,7 +57,6 @@ enum { kRunToggleDelay = 2, kMsgDelay = 3, kYouGotX = -1, - kYouGotY = (kScreenHeight - 16), kNumSaveSlots = 8, kAutoSaveSlot = 0 }; @@ -1095,6 +1094,9 @@ public: return _gatePuddles; } + // Platform-Specific Constants + int _youGotY; + // Player Variables bool _playerDead; bool _playerInvisible; // While on RailRider for example diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 6c743ea55e..987a567e3c 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -38,7 +38,7 @@ Gfx::Gfx() { _tLookupArray = NULL; _starsInfo.active = false; _gfxCache = new Common::Array<GfxCache *>; - _globalSurface.create(kScreenWidth, kScreenHeight, g_hdb->_format); + _globalSurface.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); _pointerDisplayable = 1; _sines = new Common::SineTable(360); _cosines = new Common::CosineTable(360); @@ -87,9 +87,9 @@ bool Gfx::init() { setCursor(0, 0); _eLeft = 0; - _eRight = kScreenWidth; + _eRight = g_hdb->_screenWidth; _eTop = 0; - _eBottom = kScreenHeight; + _eBottom = g_hdb->_screenHeight; // Load Game Font if (!loadFont("normalprop")) @@ -234,7 +234,7 @@ double Gfx::getCos(int index) { } void Gfx::fillScreen(uint32 color) { - _globalSurface.fillRect(Common::Rect(kScreenWidth, kScreenHeight), color); + _globalSurface.fillRect(Common::Rect(g_hdb->_screenWidth, g_hdb->_screenHeight), color); g_system->fillScreen(color); } @@ -246,10 +246,10 @@ void Gfx::updateVideo() { g_hdb->checkProgress(); - int left = kScreenWidth / 2 - g_hdb->_progressGfx->_width / 2; + int left = g_hdb->_screenWidth / 2 - g_hdb->_progressGfx->_width / 2; Common::Rect clip(g_hdb->_progressGfx->getSurface()->getBounds()); - clip.moveTo(left, kProgressY); + clip.moveTo(left, g_hdb->_progressY); clip.clip(g_hdb->_gfx->_globalSurface.getBounds()); if (!clip.isEmpty()) { g_system->copyRectToScreen(g_hdb->_gfx->_globalSurface.getBasePtr(clip.left, clip.top), g_hdb->_gfx->_globalSurface.pitch, clip.left, clip.top, clip.width(), clip.height()); @@ -304,8 +304,8 @@ void Gfx::updateFade() { return; Graphics::ManagedSurface fadeBuffer1, fadeBuffer2; - fadeBuffer1.create(kScreenWidth, kScreenHeight, g_hdb->_format); - fadeBuffer2.create(kScreenWidth, kScreenHeight, g_hdb->_format); + fadeBuffer1.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); + fadeBuffer2.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); fadeBuffer2.blitFrom(_globalSurface); @@ -320,9 +320,9 @@ void Gfx::updateFade() { if (!_fadeInfo.isBlack) { // Black Fade - for (int y = 0; y < kScreenHeight; y++) { + for (int y = 0; y < g_hdb->_screenHeight; y++) { ptr = (uint16 *)fadeBuffer1.getBasePtr(0, y); - for (int x = 0; x < kScreenWidth; x++) { + for (int x = 0; x < g_hdb->_screenWidth; x++) { value = *ptr; if (value) { g_hdb->_format.colorToRGB(value, r, g, b); @@ -337,9 +337,9 @@ void Gfx::updateFade() { } else { // White Fade - for (int y = 0; y < kScreenHeight; y++) { + for (int y = 0; y < g_hdb->_screenHeight; y++) { ptr = (uint16 *)fadeBuffer1.getBasePtr(0, y); - for (int x = 0; x < kScreenWidth; x++) { + for (int x = 0; x < g_hdb->_screenWidth; x++) { value = *ptr; g_hdb->_format.colorToRGB(value, r, g, b); r += (255 - r) * (256 - _fadeInfo.curStep) / 256; @@ -400,8 +400,8 @@ void Gfx::updateFade() { void Gfx::turnOnSnow() { _snowInfo.active = true; for (int i = 0; i < MAX_SNOW; i++) { - _snowInfo.x[i] = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1); - _snowInfo.y[i] = g_hdb->_rnd->getRandomNumber(kScreenHeight - 1); + _snowInfo.x[i] = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1); + _snowInfo.y[i] = g_hdb->_rnd->getRandomNumber(g_hdb->_screenHeight - 1); _snowInfo.yv[i] = g_hdb->_rnd->getRandomNumber(2) + 1; _snowInfo.xvindex[i] = g_hdb->_rnd->getRandomNumber(MAX_SNOW_XV - 1); } @@ -642,8 +642,8 @@ void Gfx::setSky(int skyIndex) { void Gfx::setup3DStars() { for (int i = 0; i < kNum3DStars; i++) { - _stars3D[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1); - _stars3D[i].y = g_hdb->_rnd->getRandomNumber(kScreenHeight - 1); + _stars3D[i].x = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1); + _stars3D[i].y = g_hdb->_rnd->getRandomNumber(g_hdb->_screenHeight - 1); _stars3D[i].speed = g_hdb->_rnd->getRandomNumber(255); _stars3D[i].speed >>= 1; _stars3D[i].color = _stars3D[i].speed / 64; @@ -652,8 +652,8 @@ void Gfx::setup3DStars() { void Gfx::setup3DStarsLeft() { for (int i = 0; i < kNum3DStars; i++) { - _stars3DSlow[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1); - _stars3DSlow[i].y = g_hdb->_rnd->getRandomNumber(kScreenHeight - 1); + _stars3DSlow[i].x = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1); + _stars3DSlow[i].y = g_hdb->_rnd->getRandomNumber(g_hdb->_screenHeight - 1); _stars3DSlow[i].speed = ((double) (1 + g_hdb->_rnd->getRandomNumber(4))) / 6.0; _stars3DSlow[i].color = (int) (_stars3DSlow[i].speed * 4.00); } @@ -664,7 +664,7 @@ void Gfx::draw3DStars() { for (int i = 0; i < kNum3DStars; i++) { _starField[_stars3D[i].color]->drawMasked((int)_stars3D[i].x, (int)_stars3D[i].y); _stars3D[i].y += (_stars3D[i].speed >> 5) + 1; - if (_stars3D[i].y > kScreenHeight) { + if (_stars3D[i].y > g_hdb->_screenHeight) { _stars3D[i].y = 0; } } @@ -676,7 +676,7 @@ void Gfx::draw3DStarsLeft() { _starField[_stars3DSlow[i].color]->drawMasked((int)_stars3DSlow[i].x, (int)_stars3DSlow[i].y); _stars3DSlow[i].x -= _stars3DSlow[i].speed; if (_stars3DSlow[i].x < 0) { - _stars3DSlow[i].x = kScreenWidth - 1; + _stars3DSlow[i].x = g_hdb->_screenWidth - 1; } } } @@ -690,8 +690,8 @@ void Gfx::drawSky() { draw3DStarsLeft(); } else if (tile == _tileSkyClouds) { static int offset = 0, wait = 0; - for (int j = -64; j < kScreenHeight; j += 64) { - for (int i = -64; i < kScreenWidth; i += 64) { + for (int j = -64; j < g_hdb->_screenHeight; j += 64) { + for (int i = -64; i < g_hdb->_screenWidth; i += 64) { if (_skyClouds) _skyClouds->draw(i + offset, j + offset); } @@ -719,8 +719,8 @@ void Gfx::drawSnow() { if (_snowInfo.xvindex[i] == MAX_SNOW_XV) _snowInfo.xvindex[i] = 0; if (_snowInfo.x[i] < 0) - _snowInfo.x[i] = kScreenWidth - 1; - if (_snowInfo.y[i] > kScreenHeight - 1) + _snowInfo.x[i] = g_hdb->_screenWidth - 1; + if (_snowInfo.y[i] > g_hdb->_screenHeight - 1) _snowInfo.y[i] = 0; } } @@ -848,10 +848,10 @@ void Gfx::drawText(const char *string) { // Advance the cursor _cursorX += width + _fontHeader.kerning + kFontIncrement; - if (_cursorX > kScreenWidth) { + if (_cursorX > g_hdb->_screenWidth) { _cursorX = 0; _cursorY += _fontHeader.height + _fontHeader.leading; - if (_cursorY + _fontHeader.height > kScreenHeight) + if (_cursorY + _fontHeader.height > g_hdb->_screenHeight) _cursorY = 0; } } @@ -926,7 +926,7 @@ void Gfx::centerPrint(const char *string) { totalWidth += _charInfoBlocks[string[i]]->width; } - setCursor(kScreenWidth / 2 - totalWidth / 2, _cursorX); + setCursor(g_hdb->_screenWidth / 2 - totalWidth / 2, _cursorX); drawText(string); } @@ -1037,7 +1037,7 @@ void Gfx::drawBonusStars() { void Gfx::drawDebugInfo(Tile *_debugLogo, int fps) { char buff[64]; - _debugLogo->drawMasked(kScreenWidth - 32, 0); + _debugLogo->drawMasked(g_hdb->_screenWidth - 32, 0); // Draw FPS setCursor(0, 0); diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index f4c46dfc63..d243224ffb 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -44,6 +44,19 @@ namespace HDB { HDBGame* g_hdb; HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { + if (isPPC()) { + _screenWidth = 240; + _screenHeight = 320; + _screenDrawWidth = 240; + _screenDrawHeight = 320; + } else { + _screenWidth = 640; + _screenHeight = 480; + _screenDrawWidth = _screenWidth - 160; + _screenDrawHeight = 480; + } + _progressY = _screenHeight - 64; + _format = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); _systemInit = false; g_hdb = this; @@ -330,9 +343,9 @@ void HDBGame::paint() { // if the graphic has never been loaded, load it now and leave it in memory if (!_logoGfx) _logoGfx = _gfx->loadPic(TITLELOGO); - _logoGfx->drawMasked(kScreenWidth / 2 - _logoGfx->_width / 2, 10); + _logoGfx->drawMasked(_screenWidth / 2 - _logoGfx->_width / 2, 10); - int x = kScreenWidth / 2 - _progressGfx->_width / 2; + int x = _screenWidth / 2 - _progressGfx->_width / 2; int pixels = _progressGfx->_width - _progressMarkGfx->_width; _progressXOffset = (int)(((double)pixels / _progressMax) * (double)_progressCurrent) + x; break; @@ -342,7 +355,7 @@ void HDBGame::paint() { if (_debugFlag == 1) { _gfx->drawDebugInfo(_debugLogo, _frames.size()); } else if (_debugFlag == 2) { - _debugLogo->drawMasked(kScreenWidth - 32, 0); + _debugLogo->drawMasked(_screenWidth - 32, 0); } _gfx->updateVideo(); @@ -799,11 +812,11 @@ void HDBGame::checkProgress() { if (!_progressActive) return; - x = kScreenWidth / 2 - _progressGfx->_width / 2; - _progressGfx->drawMasked(x, kProgressY); + x = _screenWidth / 2 - _progressGfx->_width / 2; + _progressGfx->drawMasked(x, g_hdb->_progressY); for (i = x; i < _progressXOffset; i += _progressMarkGfx->_width) - _progressMarkGfx->drawMasked(i, kProgressY); - _progressMarkGfx->drawMasked(_progressXOffset, kProgressY); + _progressMarkGfx->drawMasked(i, g_hdb->_progressY); + _progressMarkGfx->drawMasked(_progressXOffset, g_hdb->_progressY); } void HDBGame::drawLoadingScreen() { @@ -873,7 +886,7 @@ Common::Error HDBGame::run() { } // Initializes Graphics - initGraphics(kScreenWidth, kScreenHeight, &_format); + initGraphics(_screenWidth, _screenHeight, &_format); start(); diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index 57a493c9b3..3535d452fc 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -49,10 +49,6 @@ class Sound; class Window; enum { - kScreenWidth = 640, - kScreenHeight = 480, - kScreenDrawWidth = (kScreenWidth - 160), // visible pixels wide - kScreenDrawHeight = 480, kTileWidth = 32, kTileHeight = 32, kMaxSkies = 10, @@ -63,8 +59,7 @@ enum { kAnimFrameDelay = kGameFPS / 30, kAnimSlowFrames = kAnimFrameDelay * 10, kAnimMediumFrames = kAnimFrameDelay * 6, - kAnimFastFrames = kAnimFrameDelay * 2, - kProgressY = (kScreenHeight - 64) + kAnimFastFrames = kAnimFrameDelay * 2 }; } @@ -160,6 +155,14 @@ public: bool isPPC() const; bool isHandango() const; + // Platform-Specific Constants + + int _screenWidth; + int _screenHeight; + int _screenDrawWidth; // visible pixels wide + int _screenDrawHeight; + int _progressY; + /* Game System Pointers */ diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp index 51f31a4bdf..e6a0e9c91b 100644 --- a/engines/hdb/input.cpp +++ b/engines/hdb/input.cpp @@ -48,8 +48,8 @@ bool Input::init() { if (g_hdb->isPPC()) return true; - _mouseX = kScreenWidth / 2; - _mouseY = kScreenHeight / 2; + _mouseX = g_hdb->_screenWidth / 2; + _mouseY = g_hdb->_screenHeight / 2; _mouseLButton = _mouseMButton = _mouseRButton = 0; @@ -155,7 +155,7 @@ void Input::stylusDown(int x, int y) { { // Is Player Dead? Click on TRY AGAIN if (g_hdb->_ai->playerDead()) { - if (y >= kTryRestartY && y <= kTryRestartY + 24) { + if (y >= g_hdb->_window->_tryRestartY && y <= g_hdb->_window->_tryRestartY + 24) { if (g_hdb->loadGameState(kAutoSaveSlot).getCode() == Common::kNoError) { g_hdb->_window->clearTryAgain(); g_hdb->setGameState(GAME_PLAY); @@ -208,7 +208,7 @@ void Input::stylusDown(int x, int y) { worldY = ((worldY + y) / kTileHeight) * kTileHeight; // Don't allow a click into INV/DELIVERIES area to go into the world - if (x >= (kScreenWidth - 32 * 5)) + if (x >= (g_hdb->_screenWidth - 32 * 5)) return; // Toggle Walk Speed if we clicked Player @@ -221,9 +221,9 @@ void Input::stylusDown(int x, int y) { lastRunning = g_system->getMillis() + 1000 * kRunToggleDelay; g_hdb->_ai->togglePlayerRunning(); if (g_hdb->_ai->playerRunning()) - g_hdb->_window->centerTextOut("Running Speed", kScreenHeight - 32, kRunToggleDelay * kGameFPS); + g_hdb->_window->centerTextOut("Running Speed", g_hdb->_screenHeight - 32, kRunToggleDelay * kGameFPS); else - g_hdb->_window->centerTextOut("Walking Speed", kScreenHeight - 32, kRunToggleDelay * kGameFPS); + g_hdb->_window->centerTextOut("Walking Speed", g_hdb->_screenHeight - 32, kRunToggleDelay * kGameFPS); g_hdb->_sound->playSound(SND_SWITCH_USE); } @@ -267,13 +267,13 @@ void Input::updateMouse(int newX, int newY) { if (_mouseX < 0) _mouseX = 0; - else if (_mouseX >= kScreenWidth) - _mouseX = kScreenWidth - 1; + else if (_mouseX >= g_hdb->_screenWidth) + _mouseX = g_hdb->_screenWidth - 1; if (_mouseY < 0) _mouseY = 0; - else if (_mouseY >= kScreenHeight) - _mouseY = kScreenHeight - 1; + else if (_mouseY >= g_hdb->_screenHeight) + _mouseY = g_hdb->_screenHeight - 1; // Turn Cursor back on? if (!g_hdb->_gfx->getPointer()) { @@ -298,9 +298,9 @@ void Input::updateMouseButtons(int l, int m, int r) { // Check if LButton has been pressed // Check if LButton has been lifted if (_mouseLButton) { - if (_mouseX > (kScreenWidth - 32 * 5) && _mouseY < 240) { + if (_mouseX > (g_hdb->_screenWidth - 32 * 5) && _mouseY < 240) { g_hdb->_window->checkInvSelect(_mouseX, _mouseY); - } else if (_mouseX > (kScreenWidth - 32 * 5) && _mouseY >= 240) { + } else if (_mouseX > (g_hdb->_screenWidth - 32 * 5) && _mouseY >= 240) { g_hdb->_window->checkDlvSelect(_mouseX, _mouseY); } else { if (g_hdb->getPause() && g_hdb->getGameState() == GAME_PLAY) { diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp index 8c2de33e54..2c9bbd5af0 100644 --- a/engines/hdb/map.cpp +++ b/engines/hdb/map.cpp @@ -1162,8 +1162,8 @@ void Map::centerMapXY(int x, int y) { y = maxy; } - x -= (kScreenDrawWidth / 2); - y -= (kScreenDrawHeight / 2); + x -= (g_hdb->_screenDrawWidth / 2); + y -= (g_hdb->_screenDrawHeight / 2); setMapXY(x, y); } diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index 8516d0c54d..b93b1b7e94 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -125,6 +125,10 @@ Menu::Menu() { _versionGfx = NULL; _warpGfx = NULL; + + _menuExitY = g_hdb->_screenHeight - 80; + _backoutY = g_hdb->_screenHeight - 32; + _warpBackoutY = _backoutY; } Menu::~Menu() { @@ -343,7 +347,7 @@ void Menu::startMenu() { if (!_fStars[0].y) { for (int i = 0; i < kMaxStars; i++) { _fStars[i].y = -30; - _fStars[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1); + _fStars[i].x = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1); _fStars[i].speed = g_hdb->_rnd->getRandomNumber(4) + 1; _fStars[i].anim = g_hdb->_rnd->getRandomNumber(2); _fStars[i].delay = 5; @@ -357,7 +361,7 @@ void Menu::startMenu() { g_hdb->_gfx->setup3DStars(); // setup the star info _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1); - _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10; + _nebulaX = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1) + 10; _nebulaY = -20; _nebulaYVel = g_hdb->_rnd->getRandomNumber(9) + 2; } @@ -401,10 +405,10 @@ void Menu::drawMenu() { drawRocketAndSelections(); // draw version # - _versionGfx->drawMasked(kScreenWidth - 6 * 8, kScreenHeight - 8); + _versionGfx->drawMasked(g_hdb->_screenWidth - 6 * 8, g_hdb->_screenHeight - 8); if (g_hdb->isDemo()) { - _demoPlaqueGfx->drawMasked(kScreenWidth / 2 - _demoPlaqueGfx->_width / 2, 2); + _demoPlaqueGfx->drawMasked(g_hdb->_screenWidth / 2 - _demoPlaqueGfx->_width / 2, 2); } // @@ -415,7 +419,7 @@ void Menu::drawMenu() { _rocketX += -_optionsXV; _oBannerY += _optionsXV / 3; _optionsXV += 3; - if (_optionsScrollX > kScreenWidth + 10) { + if (_optionsScrollX > g_hdb->_screenWidth + 10) { switch (_nextScreen) { case 0: _optionsActive = true; break; case 1: _gamefilesActive = 1; break; @@ -468,7 +472,7 @@ void Menu::drawMenu() { // Draw WARP // if (g_hdb->getCheatingOn() && _warpGfx) - _warpGfx->drawMasked(0, kScreenHeight - _warpGfx->_height); + _warpGfx->drawMasked(0, g_hdb->_screenHeight - _warpGfx->_height); //#endif } else if (_newgameActive) { //------------------------------------------------------------------- @@ -521,7 +525,7 @@ void Menu::drawMenu() { // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); - _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); + _menuBackoutGfx->drawMasked(kBackoutX, g_hdb->_menu->_backoutY); } } else if (_optionsActive) { //------------------------------------------------------------------- @@ -585,7 +589,7 @@ void Menu::drawMenu() { // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); - _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); + _menuBackoutGfx->drawMasked(kBackoutX, g_hdb->_menu->_backoutY); // Ignore Controls Screen Button //_controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), kMControlsY); @@ -630,7 +634,7 @@ void Menu::drawMenu() { _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); // CHOOSE SLOT screen _modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY); - _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); + _menuBackoutGfx->drawMasked(kBackoutX, g_hdb->_menu->_backoutY); if (_saveGames[kAutoSaveSlot].seconds) _vortexian[anim]->drawMasked(kVortSaveX, kVortSaveY); @@ -655,7 +659,7 @@ void Menu::drawMenu() { _slotGfx->drawMasked(kSaveSlotX - 8, i * 32 + (kSaveSlotY - 4)); if (seconds || _saveGames[i].mapName[0]) { - g_hdb->_gfx->setTextEdges(0, kScreenWidth + 60, 0, kScreenHeight); + g_hdb->_gfx->setTextEdges(0, g_hdb->_screenWidth + 60, 0, g_hdb->_screenHeight); g_hdb->_gfx->setCursor(kSaveSlotX, i * 32 + kSaveSlotY); g_hdb->_gfx->drawText(_saveGames[i].mapName); @@ -675,7 +679,7 @@ void Menu::drawMenu() { drawWarpScreen(); // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); - _menuBackoutGfx->drawMasked(kWarpBackoutX, kWarpBackoutY); + _menuBackoutGfx->drawMasked(kWarpBackoutX, g_hdb->_menu->_warpBackoutY); char string[32]; for (int i = 0; i < 10; i++) { @@ -712,7 +716,7 @@ void Menu::drawMenu() { _quitScreen->drawMasked(kQuitX, kQuitY); } else if (_quitActive == 2) { // XXXX _screenshots1gfx->drawMasked(kQuitX, kQuitY); - _screenshots2gfx->drawMasked(kQuitX, kScreenHeight - _screenshots2gfx->_height); + _screenshots2gfx->drawMasked(kQuitX, g_hdb->_screenHeight - _screenshots2gfx->_height); } else if (_quitActive == 1) { _screenshots1agfx->drawMasked(kQuitX, kQuitY); } @@ -935,9 +939,9 @@ void Menu::drawTitle() { // draw nebula _nebulaGfx[_nebulaWhich]->draw(_nebulaX, _nebulaY); _nebulaY += _nebulaYVel; - if (_nebulaY > kScreenHeight + (kScreenHeight / 2)) { + if (_nebulaY > g_hdb->_screenHeight + (g_hdb->_screenHeight / 2)) { _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1); - _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10; + _nebulaX = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1) + 10; _nebulaY = -11 * 8; _nebulaYVel = g_hdb->_rnd->getRandomNumber(3) + 1; if (_nebulaWhich > 4) // galaxy? @@ -1035,13 +1039,13 @@ void Menu::drawTitle() { g_hdb->_gfx->fillScreen(0); { _titleCycle++; - _rocketY = kScreenHeight; // ycoord + _rocketY = g_hdb->_screenHeight; // ycoord _rocketYVel = -1; // yspeed _rocketEx = 0; // exhaust toggle g_hdb->_gfx->setup3DStars(); // setup the star info _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1); - _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10; + _nebulaX = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1) + 10; _nebulaY = -11 * 8; _nebulaYVel = g_hdb->_rnd->getRandomNumber(9) + 2; if (_nebulaWhich > 4) // galaxy? @@ -1192,7 +1196,7 @@ void Menu::processInput(int x, int y) { if (!g_hdb->getCheatingOn()) open = (x >= _nebulaX && x < _nebulaX + 16 && y >= _nebulaY && y < _nebulaY + 16); else - open = (y > kMenuExitY && x < kMenuExitXLeft); + open = (y > g_hdb->_menu->_menuExitY && x < kMenuExitXLeft); if (open) { @@ -1208,7 +1212,7 @@ void Menu::processInput(int x, int y) { //------------------------------------------------------------------- int xit = getMenuKey(); - if (y >= kMenuExitY || y < kMenuExitYTop || xit) { + if (y >= g_hdb->_menu->_menuExitY || y < kMenuExitYTop || xit) { _optionsScrolling = true; _optionsXV = -5; g_hdb->_sound->playSound(SND_MENU_BACKOUT); @@ -1221,7 +1225,7 @@ void Menu::processInput(int x, int y) { _newgameActive = false; g_hdb->changeGameState(); // that's it! the Game Loop takes over from here... - } else if (y >= kModeActionY - 10 && y <= kMenuExitY) { + } else if (y >= kModeActionY - 10 && y <= g_hdb->_menu->_menuExitY) { // ACTION MODE area g_hdb->setActionMode(1); g_hdb->_sound->playSound(SND_MENU_ACCEPT); @@ -1277,11 +1281,11 @@ void Menu::processInput(int x, int y) { g_hdb->_sound->setVoiceStatus(value); g_hdb->_sound->playSound(SND_GUI_INPUT); } - } else if (y >= kMenuExitY || y < kMenuExitYTop || xit) { + } else if (y >= g_hdb->_menu->_menuExitY || y < kMenuExitYTop || xit) { g_hdb->_sound->playSound(SND_MENU_BACKOUT); _optionsScrolling = true; _optionsXV = -5; - } else if (x >= (kScreenWidth / 2 - _controlButtonGfx->_width / 2) && x < (kScreenWidth / 2 + _controlButtonGfx->_width / 2) && + } else if (x >= (g_hdb->_screenWidth / 2 - _controlButtonGfx->_width / 2) && x < (g_hdb->_screenWidth / 2 + _controlButtonGfx->_width / 2) && y >= kMControlsY && y < kMControlsY + _controlButtonGfx->_height) { // CONTROLS BUTTON! @@ -1296,7 +1300,7 @@ void Menu::processInput(int x, int y) { //------------------------------------------------------------------- int xit = getMenuKey(); - if (y >= kMenuExitY + 15 || y < kMenuExitYTop || xit) { + if (y >= g_hdb->_menu->_menuExitY + 15 || y < kMenuExitYTop || xit) { _optionsScrolling = true; _optionsXV = -5; g_hdb->_sound->playSound(SND_MENU_BACKOUT); @@ -1353,7 +1357,7 @@ void Menu::processInput(int x, int y) { //------------------------------------------------------------------- int xit = getMenuKey(); - if ((y >= kMenuExitY && x < kMenuExitXLeft) || xit) { + if ((y >= g_hdb->_menu->_menuExitY && x < kMenuExitXLeft) || xit) { _menuActive = true; _warpActive = false; g_hdb->_sound->playSound(SND_MENU_BACKOUT); @@ -1443,9 +1447,9 @@ void Menu::drawNebula() { _nebulaGfx[_nebulaWhich]->draw(_nebulaX, _nebulaY); _nebulaY += _nebulaYVel; - if (_nebulaY > kScreenHeight + (kScreenHeight / 2)) { + if (_nebulaY > g_hdb->_screenHeight + (g_hdb->_screenHeight / 2)) { _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount - 1); - _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth - 1) + 10; + _nebulaX = g_hdb->_rnd->getRandomNumber(g_hdb->_screenWidth - 1) + 10; _nebulaY = -11 * 8; _nebulaYVel = g_hdb->_rnd->getRandomNumber(3) + 1; if (_nebulaWhich > 4) // galaxy? @@ -1457,7 +1461,7 @@ void Menu::drawNebula() { // for (int i = 0; i < kMaxStars; i++) { _fStars[i].y += _fStars[i].speed; - if (_fStars[i].y > kScreenHeight) { + if (_fStars[i].y > g_hdb->_screenHeight) { _fStars[i].y = (g_hdb->_rnd->getRandomNumber(29) + 30) * -1; _fStars[i].speed = g_hdb->_rnd->getRandomNumber(4) + 1; } diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h index 84a4042943..319b51ff79 100644 --- a/engines/hdb/menu.h +++ b/engines/hdb/menu.h @@ -49,7 +49,7 @@ namespace HDB { #define TITLE_DELAY2 0.5 // time to spend doing OOH OOH #define TITLE_DELAY3 1 // time to wait before ending title -#define centerPic(x) (kScreenWidth / 2 - x->_width / 2) +#define centerPic(x) (g_hdb->_screenWidth / 2 - x->_width / 2) enum { kStarRedX = 70, @@ -71,7 +71,6 @@ enum { kMLoadY = 48 * 1, kMControlsY = 270, - kMenuExitY = kScreenHeight - 80, kMenuExitXLeft = 60, kMenuExitYTop = 48, kMenuVortSaveY = 220, @@ -131,10 +130,8 @@ enum { kAssignY = kControlY + 150, kBackoutX = 0, - kBackoutY = kScreenHeight - 32, kWarpBackoutX = kBackoutX, - kWarpBackoutY = kBackoutY, kWarpX = 214, kWarpY = 160, @@ -192,6 +189,11 @@ public: return _menuKey; } + // Platform-specific Constants + int _menuExitY; + int _backoutY; + int _warpBackoutY; + Save _saveGames[kNumSaveSlots + 1]; int _starWarp; diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index 57bf9cc730..d206372b9f 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -33,6 +33,15 @@ namespace HDB { +Window::Window() { + _dlvItemTextY = (g_hdb->_screenHeight - 30); + _textOutCenterX = ((g_hdb->_screenWidth - kTileWidth * 5) / 2); + _pauseY = (g_hdb->_screenHeight / 2 - 64); + _tryY1 = (g_hdb->_screenHeight >> 2); // TRY + _tryY2 = (_tryY1 + 32); // AGAIN + _tryRestartY = ((g_hdb->_screenHeight >> 2) * 3); // (ok) +} + Window::~Window() { delete _gfxTL; delete _gfxTM; @@ -135,13 +144,13 @@ bool Window::init() { warning("FIXME: Fully separate the PC and PPC versions of Window"); if (!g_hdb->isPPC()) - _invWinInfo.x = kScreenWidth - _gfxInfobar->_width + 16; + _invWinInfo.x = g_hdb->_screenWidth - _gfxInfobar->_width + 16; _invWinInfo.y = 40; _dlvsInfo.width = kInvItemSpaceX * 3; _dlvsInfo.height = kInvItemSpaceY * 4; if (!g_hdb->isPPC()) - _dlvsInfo.x = (kScreenWidth - _gfxInfobar->_width) + 16; + _dlvsInfo.x = (g_hdb->_screenWidth - _gfxInfobar->_width) + 16; _dlvsInfo.y = 272; _gemGfx = NULL; @@ -446,11 +455,11 @@ void Window::setInfobarDark(int value) { void Window::drawPause() { if (g_hdb->getPause()) - _gfxPausePlaque->drawMasked(480 / 2 - _gfxPausePlaque->_width / 2, kPauseY); + _gfxPausePlaque->drawMasked(480 / 2 - _gfxPausePlaque->_width / 2, g_hdb->_window->_pauseY); } void Window::checkPause(int x, int y) { - if (x >= 480 / 2 - _gfxPausePlaque->_width / 2 && 480 / 2 + _gfxPausePlaque->_width / 2 > x && y >= kPauseY && y < kPauseY + _gfxPausePlaque->_height) { + if (x >= 480 / 2 - _gfxPausePlaque->_width / 2 && 480 / 2 + _gfxPausePlaque->_width / 2 > x && y >= g_hdb->_window->_pauseY && y < g_hdb->_window->_pauseY + _gfxPausePlaque->_height) { g_hdb->togglePause(); g_hdb->_sound->playSound(SND_POP); } @@ -528,10 +537,10 @@ void Window::openDialog(const char *title, int tileIndex, const char *string, in int px, py; g_hdb->_ai->getPlayerXY(&px, &py); - if (py < (kScreenHeight >> 1) - 16) - _dialogInfo.y = (kScreenHeight >> 1) + 16; + if (py < (g_hdb->_screenHeight >> 1) - 16) + _dialogInfo.y = (g_hdb->_screenHeight >> 1) + 16; else - _dialogInfo.y = (kScreenHeight >> 1) - (_dialogInfo.height + 64); + _dialogInfo.y = (g_hdb->_screenHeight >> 1) - (_dialogInfo.height + 64); if (_dialogInfo.y < 16) _dialogInfo.y = 16; @@ -596,11 +605,11 @@ void Window::drawDialog() { int e1, e2, e3, e4; g_hdb->_gfx->getTextEdges(&e1, &e2, &e3, &e4); - g_hdb->_gfx->setTextEdges(_dialogInfo.x + 10, 480, 0, kScreenHeight); + g_hdb->_gfx->setTextEdges(_dialogInfo.x + 10, 480, 0, g_hdb->_screenHeight); g_hdb->_gfx->setCursor(0, _dialogInfo.y - 7); if (_dialogInfo.title) g_hdb->_gfx->drawText(_dialogInfo.title); - g_hdb->_gfx->setTextEdges(_dialogInfo.x + 16, _dialogInfo.x + _dialogInfo.width - 16, 0, kScreenHeight); + g_hdb->_gfx->setTextEdges(_dialogInfo.x + 16, _dialogInfo.x + _dialogInfo.width - 16, 0, g_hdb->_screenHeight); g_hdb->_gfx->setCursor(0, _dialogInfo.y + 16); if (_dialogInfo.string) g_hdb->_gfx->drawText(_dialogInfo.string); @@ -751,7 +760,7 @@ void Window::openDialogChoice(const char *title, const char *text, const char *f _dialogChoiceInfo.titleWidth = titleWidth; _dialogChoiceInfo.x = (480 >> 1) - (_dialogChoiceInfo.width >> 1); - _dialogChoiceInfo.y = (kScreenHeight >> 1) - ((_dialogChoiceInfo.height >> 1) + 32); + _dialogChoiceInfo.y = (g_hdb->_screenHeight >> 1) - ((_dialogChoiceInfo.height >> 1) + 32); if (_dialogChoiceInfo.y < 0) _dialogChoiceInfo.y = 0; @@ -951,7 +960,7 @@ void Window::nextMsgQueued() { _msgInfo.width = width + 32; _msgInfo.x = (480 >> 1) - (_msgInfo.width >> 1); - _msgInfo.y = (kScreenHeight >> 2) - (_msgInfo.height >> 1); + _msgInfo.y = (g_hdb->_screenHeight >> 2) - (_msgInfo.height >> 1); for (xx = 0; xx < _numMsgQueue - 1; xx++) { @@ -979,7 +988,7 @@ void Window::drawInventory() { if (_infobarDimmed > 1) return; - _gfxInfobar->draw(kScreenWidth - _gfxInfobar->_width, 0); + _gfxInfobar->draw(g_hdb->_screenWidth - _gfxInfobar->_width, 0); baseX = drawX = _invWinInfo.x; drawY = _invWinInfo.y; @@ -1037,7 +1046,7 @@ void Window::drawInventory() { _gfxInvSelect->drawMasked(drawX, drawY); if (sel) { - int centerX = baseX - 4 + (kScreenWidth - baseX) / 2; + int centerX = baseX - 4 + (g_hdb->_screenWidth - baseX) / 2; drawY = _invWinInfo.y + (kInvItemSpaceY * 4) + 16; g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength(sel->printedName) / 2, drawY); g_hdb->_gfx->drawText(sel->printedName); @@ -1159,7 +1168,7 @@ void Window::drawDeliveries() { // Draw Delivery Items int inv = 0; for (; inv < g_hdb->_ai->getDeliveriesAmount(); inv++) { - int centerX = baseX + (kScreenWidth - baseX) / 2; + int centerX = baseX + (g_hdb->_screenWidth - baseX) / 2; DlvEnt *d = g_hdb->_ai->getDeliveryItem(inv); if (_dlvsInfo.animate && inv == g_hdb->_ai->getDeliveriesAmount() - 1) { if (_dlvsInfo.go1) { @@ -1169,7 +1178,7 @@ void Window::drawDeliveries() { if (d->itemGfx) d->itemGfx->drawMasked(drawX, drawY); - g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength(d->itemTextName) / 2, kDlvItemTextY); + g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength(d->itemTextName) / 2, g_hdb->_window->_dlvItemTextY); g_hdb->_gfx->drawText(d->itemTextName); if (!_dlvsInfo.go2) { _dlvsInfo.go2 = true; @@ -1183,7 +1192,7 @@ void Window::drawDeliveries() { // Draw TO _gfxArrowTo->drawMasked(_dlvsInfo.x + kDlvItemSpaceX * _dlvsInfo.selected + 8, drawY + kTileHeight); - g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength("to") / 2, kDlvItemTextY + 12); + g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength("to") / 2, g_hdb->_window->_dlvItemTextY + 12); g_hdb->_gfx->drawText("to"); if (!_dlvsInfo.go3) { _dlvsInfo.go3 = true; @@ -1199,7 +1208,7 @@ void Window::drawDeliveries() { if (d->destGfx) d->destGfx->drawMasked(drawX, drawY + kTileHeight + 16); - g_hdb->_gfx->setCursor(centerX - (g_hdb->_gfx->stringLength(d->destTextName) + g_hdb->_gfx->stringLength("to")) / 2, kDlvItemTextY + 12); + g_hdb->_gfx->setCursor(centerX - (g_hdb->_gfx->stringLength(d->destTextName) + g_hdb->_gfx->stringLength("to")) / 2, g_hdb->_window->_dlvItemTextY + 12); g_hdb->_gfx->drawText("to "); g_hdb->_gfx->drawText(d->destTextName); @@ -1219,15 +1228,15 @@ void Window::drawDeliveries() { d->destGfx->drawMasked(drawX, drawY + kTileHeight + 16); if (!_dlvsInfo.animate && inv == _dlvsInfo.selected) { - g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength(d->itemTextName)/2, kDlvItemTextY); + g_hdb->_gfx->setCursor(centerX - g_hdb->_gfx->stringLength(d->itemTextName)/2, g_hdb->_window->_dlvItemTextY); g_hdb->_gfx->drawText(d->itemTextName); - g_hdb->_gfx->setCursor(centerX - (g_hdb->_gfx->stringLength(d->destTextName) + g_hdb->_gfx->stringLength("to ")) / 2, kDlvItemTextY + 12); + g_hdb->_gfx->setCursor(centerX - (g_hdb->_gfx->stringLength(d->destTextName) + g_hdb->_gfx->stringLength("to ")) / 2, g_hdb->_window->_dlvItemTextY + 12); g_hdb->_gfx->drawText("to "); g_hdb->_gfx->drawText(d->destTextName); } drawX += kDlvItemSpaceX; - if (drawX >= kScreenWidth) { + if (drawX >= g_hdb->_screenWidth) { drawX = baseX; drawY += kDlvItemSpaceY + 8; } @@ -1249,8 +1258,8 @@ void Window::drawDeliveries() { // If the infobar is dimmed out, this where we dim the whole thing if (_infobarDimmed) { - for (int j = 0; j < kScreenHeight; j += kTileHeight) { - for (int i = (kScreenWidth - _gfxInfobar->_width); i < kScreenWidth; i += kTileWidth) + for (int j = 0; j < g_hdb->_screenHeight; j += kTileHeight) { + for (int i = (g_hdb->_screenWidth - _gfxInfobar->_width); i < g_hdb->_screenWidth; i += kTileWidth) _gfxDarken->drawMasked(i, j); } } @@ -1286,8 +1295,8 @@ void Window::drawTryAgain() { _gfxAgain = g_hdb->_gfx->loadPic(GAME_AGAIN); _gfxLevelRestart = g_hdb->_gfx->loadPic(GAME_TA_LEVELRESTART); - _tryAgainInfo.y1 = kTryY1; - _tryAgainInfo.y2 = kTryY2; + _tryAgainInfo.y1 = g_hdb->_window->_tryY1; + _tryAgainInfo.y2 = g_hdb->_window->_tryY2; _tryAgainInfo.x1 = 480 / 2 - _gfxTry->_width / 2;; _tryAgainInfo.x2 = 480 / 2 - _gfxAgain->_width / 2; } @@ -1296,7 +1305,7 @@ void Window::drawTryAgain() { _gfxTry->drawMasked((int)_tryAgainInfo.x1 + xv, (int)_tryAgainInfo.y1 + yv); _gfxAgain->drawMasked((int)_tryAgainInfo.x2 + yv, (int)_tryAgainInfo.y2 + xv); - _gfxLevelRestart->drawMasked((int)(480 / 2 - _gfxLevelRestart->_width + xv), kTryRestartY + yv); + _gfxLevelRestart->drawMasked((int)(480 / 2 - _gfxLevelRestart->_width + xv), g_hdb->_window->_tryRestartY + yv); } void Window::clearTryAgain() { @@ -1375,7 +1384,7 @@ void Window::drawPanicZone() { _pzInfo.gfxPanic->drawMasked(_pzInfo.x1 + xx, _pzInfo.y1 + yy); _pzInfo.gfxZone->drawMasked(_pzInfo.x2 + yy, _pzInfo.y2 + xx); if (_pzInfo.y1 < -_pzInfo.gfxPanic->_height && - _pzInfo.y2 > kScreenHeight) { + _pzInfo.y2 > g_hdb->_screenHeight) { g_hdb->_sound->playSound(SND_PANIC_COUNT); _pzInfo.sequence++; _pzInfo.timer = 30 + g_hdb->getTime(); @@ -1420,9 +1429,9 @@ void Window::startPanicZone() { loadPanicZoneGfx(); _pzInfo.x1 = -(_pzInfo.gfxPanic->_width + 5); - _pzInfo.y1 = (kScreenHeight / 4) - (_pzInfo.gfxPanic->_height >> 1); + _pzInfo.y1 = (g_hdb->_screenHeight / 4) - (_pzInfo.gfxPanic->_height >> 1); _pzInfo.x2 = 480 + (_pzInfo.gfxZone->_width >> 1); - _pzInfo.y2 = (kScreenHeight / 4) * 3 - (_pzInfo.gfxZone->_height >> 1); + _pzInfo.y2 = (g_hdb->_screenHeight / 4) * 3 - (_pzInfo.gfxZone->_height >> 1); _pzInfo.xv = 10; // horizontal speed _pzInfo.yv = -12; // vertical speed _pzInfo.timer = 30; // 30 seconds to get out! @@ -1443,7 +1452,7 @@ void Window::textOut(const char *text, int x, int y, int timer) { if (x < 0) { int pw, lines; g_hdb->_gfx->getDimensions(t->text, &pw, &lines); - t->x = kTextOutCenterX - pw / 2; + t->x = g_hdb->_window->_textOutCenterX - pw / 2; } _textOutList.push_back(t); @@ -1452,7 +1461,7 @@ void Window::textOut(const char *text, int x, int y, int timer) { void Window::centerTextOut(const char *text, int y, int timer) { int width, lines; g_hdb->_gfx->getDimensions(text, &width, &lines); - textOut(text, kTextOutCenterX - ((width - 8) >> 1), y, timer); + textOut(text, g_hdb->_window->_textOutCenterX - ((width - 8) >> 1), y, timer); } void Window::drawTextOut() { @@ -1461,7 +1470,7 @@ void Window::drawTextOut() { int e1, e2, e3, e4; g_hdb->_gfx->getTextEdges(&e1, &e2, &e3, &e4); - g_hdb->_gfx->setTextEdges(0, 480, 0, kScreenHeight); + g_hdb->_gfx->setTextEdges(0, 480, 0, g_hdb->_screenHeight); uint32 time = g_system->getMillis(); diff --git a/engines/hdb/window.h b/engines/hdb/window.h index 672cae5e09..0597437a37 100644 --- a/engines/hdb/window.h +++ b/engines/hdb/window.h @@ -39,16 +39,10 @@ enum { kDlvItemSpaceX = 48, kDlvItemSpaceY = (kTileHeight * 2 + 16), kDlvItemPerLine = 3, - kDlvItemTextY = (kScreenHeight - 30), kPanicXStop = 480 / 3, kPanicZoneFaceX = 480 - 32, kPanicZoneFaceY = 5, - kNumCrazy = 37, - kTextOutCenterX = ((kScreenWidth - kTileWidth * 5) / 2), - kPauseY = (kScreenHeight / 2 - 64), - kTryY1 = (kScreenHeight >> 2), // TRY - kTryY2 = (kTryY1 + 32), // AGAIN - kTryRestartY = ((kScreenHeight >> 2) * 3) // (ok) + kNumCrazy = 37 }; enum PZValue { @@ -188,7 +182,7 @@ struct TOut { class Window { public: - + Window(); ~Window(); bool init(); @@ -291,6 +285,14 @@ public: } void closeTextOut(); + // Platform-specific Constants + int _dlvItemTextY; + int _textOutCenterX; + int _pauseY; + int _tryY1; // TRY + int _tryY2; // AGAIN + int _tryRestartY; // (ok) + Tile *getGemGfx() { return _gemGfx; } |