aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-07-14 04:54:22 +0530
committerEugene Sandulenko2019-09-03 17:17:20 +0200
commit6aa054fcacfd8f7c68e3131d8ef5905ee8478150 (patch)
tree22704a413096f1b569108b2df268fc19384f1386
parented60dcd50607ecdd6c10eaedc477f4954c4361eb (diff)
downloadscummvm-rg350-6aa054fcacfd8f7c68e3131d8ef5905ee8478150.tar.gz
scummvm-rg350-6aa054fcacfd8f7c68e3131d8ef5905ee8478150.tar.bz2
scummvm-rg350-6aa054fcacfd8f7c68e3131d8ef5905ee8478150.zip
HDB: Unstub the TRY AGAIN screen
-rw-r--r--engines/hdb/hdb.cpp2
-rw-r--r--engines/hdb/input.cpp15
-rw-r--r--engines/hdb/window.cpp30
-rw-r--r--engines/hdb/window.h20
4 files changed, 63 insertions, 4 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 3c1930c038..b0065b855c 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -940,7 +940,7 @@ Common::Error HDBGame::run() {
_window->drawInventory();
_window->drawMessageBar();
_window->drawDeliveries();
- debug(9, "STUB: Draw Try Again");
+ _window->drawTryAgain();
_window->drawPanicZone();
_window->drawTextOut();
_window->drawPause();
diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp
index 35346f50c5..aef6ecf6e3 100644
--- a/engines/hdb/input.cpp
+++ b/engines/hdb/input.cpp
@@ -92,7 +92,13 @@ void Input::setButtons(uint16 b) {
if (g_hdb->getGameState() == GAME_PLAY) {
// Is Player Dead? Click on TRY AGAIN
if (g_hdb->_ai->playerDead()) {
- warning("STUB: TRY AGAIN is onscreen");
+ // TRY AGAIN is onscreen...
+ if (_buttons & kButtonB) {
+ if (g_hdb->loadGameState(kAutoSaveSlot).getCode() == Common::kNoError) {
+ g_hdb->_window->clearTryAgain();
+ g_hdb->setGameState(GAME_PLAY);
+ }
+ }
return;
}
@@ -144,7 +150,12 @@ void Input::stylusDown(int x, int y) {
case GAME_PLAY:
// Is Player Dead? Click on TRY AGAIN
if (g_hdb->_ai->playerDead()) {
- warning("STUB: TRY AGAIN is onscreen");
+ if (y >= kTryRestartY && y <= kTryRestartY + 24) {
+ if (g_hdb->loadGameState(kAutoSaveSlot).getCode() == Common::kNoError) {
+ g_hdb->_window->clearTryAgain();
+ g_hdb->setGameState(GAME_PLAY);
+ }
+ }
return;
}
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp
index 486f9809d1..2b1941b4e6 100644
--- a/engines/hdb/window.cpp
+++ b/engines/hdb/window.cpp
@@ -1201,6 +1201,36 @@ void Window::checkDlvSelect(int x, int y) {
}
}
+void Window::drawTryAgain() {
+ if (!g_hdb->_ai->playerDead())
+ return;
+
+ if (NULL == _gfxTry) {
+ _gfxTry = g_hdb->_gfx->loadPic(GAME_TRY);
+ _gfxAgain = g_hdb->_gfx->loadPic(GAME_AGAIN);
+ _gfxLevelRestart = g_hdb->_gfx->loadPic(GAME_TA_LEVELRESTART);
+
+ _tryAgainInfo.y1 = kTryY1;
+ _tryAgainInfo.y2 = kTryY2;
+ _tryAgainInfo.x1 = 480 / 2 - _gfxTry->_width / 2;;
+ _tryAgainInfo.x2 = 480 / 2 - _gfxAgain->_width / 2;
+ }
+
+ int xv = g_hdb->_rnd->getRandomNumber(3) - 2, yv = g_hdb->_rnd->getRandomNumber(3) - 2;
+
+ _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);
+}
+
+void Window::clearTryAgain() {
+ _gfxTry->free();
+ _gfxAgain->free();
+ _gfxLevelRestart->free();
+
+ _gfxTry = _gfxAgain = _gfxLevelRestart = NULL;
+}
+
void Window::loadPanicZoneGfx() {
_pzInfo.gfxPanic = g_hdb->_gfx->loadPic(PANIC_PANIC);
_pzInfo.gfxZone = g_hdb->_gfx->loadPic(PANIC_ZONE);
diff --git a/engines/hdb/window.h b/engines/hdb/window.h
index 5bc95fa916..e11b443ad7 100644
--- a/engines/hdb/window.h
+++ b/engines/hdb/window.h
@@ -45,7 +45,10 @@ enum {
kPanicZoneFaceY = 5,
kNumCrazy = 37,
kTextOutCenterX = ((kScreenWidth - kTileWidth * 5) / 2),
- kPauseY = (kScreenHeight / 2 - 64)
+ kPauseY = (kScreenHeight / 2 - 64),
+ kTryY1 = (kScreenHeight >> 2), // TRY
+ kTryY2 = (kTryY1 + 32), // AGAIN
+ kTryRestartY = ((kScreenHeight >> 2) * 3) // (ok)
};
enum PZValue {
@@ -164,6 +167,15 @@ struct PanicZone {
}
};
+struct TryAgainInfo {
+ double y1, y2;
+ double yv1, yv2;
+ double yv1v, yv2v;
+ double x1, x2;
+
+ TryAgainInfo() : y1(0), y2(0), yv1(0), yv2(0), yv1v(0), yv2v(0), x1(0), x2(0) {}
+};
+
struct TOut {
char text[128];
int x, y;
@@ -255,6 +267,10 @@ public:
}
void checkDlvSelect(int x, int y);
+ // Try Again Functions
+ void drawTryAgain();
+ void clearTryAgain();
+
// Panic Zone Functions
void loadPanicZoneGfx();
void drawPanicZone();
@@ -292,6 +308,8 @@ private:
Common::Array<TOut *> _textOutList;
DlvsInfo _dlvsInfo;
+ TryAgainInfo _tryAgainInfo;
+
char _msgQueueStr[kMaxMsgQueue][128];
int _msgQueueWait[kMaxMsgQueue];
int _numMsgQueue;