From 7ad5cf9d30ca24ace6709b43fe4549897505c8ab Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 3 Aug 2019 10:42:07 +0530 Subject: HDB: Add new PPC-specific code --- engines/hdb/ai-funcs.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'engines/hdb/ai-funcs.cpp') diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index 7faa8880c3..73e0b8e203 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -784,6 +784,11 @@ void AI::killPlayer(Death method) { g_hdb->_window->closeDialogChoice(); g_hdb->_window->stopPanicZone(); + if (g_hdb->isPPC()) { + g_hdb->_window->closeDlvs(); + g_hdb->_window->closeInv(); + } + switch (method) { case DEATH_NORMAL: _player->state = STATE_DYING; @@ -811,8 +816,10 @@ void AI::killPlayer(Death method) { g_hdb->_sound->playSound(SND_PANIC_DEATH); break; case DEATH_PLUMMET: - _player->state = STATE_PLUMMET; - g_hdb->_sound->playSound(SND_GUY_PLUMMET); + if (!g_hdb->isDemo()) { + _player->state = STATE_PLUMMET; + g_hdb->_sound->playSound(SND_GUY_PLUMMET); + } break; } @@ -2312,6 +2319,15 @@ void AI::movePlayer(uint16 buttons) { // Just trying to put away a dialog? if (buttons & kButtonB) { + if (g_hdb->isPPC()) { + if (g_hdb->_window->deliveriesActive()) { + g_hdb->_window->closeDlvs(); + return; + } else if (g_hdb->_window->inventoryActive()) { + g_hdb->_window->closeInv(); + return; + } + } if (g_hdb->_window->dialogActive()) { g_hdb->_window->closeDialog(); return; @@ -2471,6 +2487,13 @@ void AI::movePlayer(uint16 buttons) { if (_player->touchpWait > kPlayerTouchPWait / 4) return; + if (g_hdb->isPPC()) { + // Are the Deliveries active? + if (g_hdb->_window->deliveriesActive()) + if (!g_hdb->_ai->cinematicsActive()) + return; + } + // Is a dialog active? if (g_hdb->_window->dialogActive()) { if (!cinematicsActive()) @@ -2483,6 +2506,13 @@ void AI::movePlayer(uint16 buttons) { return; } + if (g_hdb->isPPC()) { + // Is the Inventory active? + if (g_hdb->_window->inventoryActive()) + if (!g_hdb->_ai->cinematicsActive()) + return; + } + // In a cinematic? if (_playerLock || _numWaypoints) return; -- cgit v1.2.3