diff options
author | Joseph-Eugene Winzer | 2017-08-11 21:55:09 +0200 |
---|---|---|
committer | Thierry Crozat | 2018-01-23 01:19:02 +0000 |
commit | 8a766b5b48dd82f426dd443d6ec5f8589bd13ec4 (patch) | |
tree | eaa5f0bf5de97e082a3d3d6a2043d523cc6a6f13 | |
parent | 830f983d837dabd27ff026dabfc4199f7846835d (diff) | |
download | scummvm-rg350-8a766b5b48dd82f426dd443d6ec5f8589bd13ec4.tar.gz scummvm-rg350-8a766b5b48dd82f426dd443d6ec5f8589bd13ec4.tar.bz2 scummvm-rg350-8a766b5b48dd82f426dd443d6ec5f8589bd13ec4.zip |
SUPERNOVA: Adds code for remaining game logic
-rw-r--r-- | engines/supernova/state.cpp | 220 | ||||
-rw-r--r-- | engines/supernova/state.h | 22 |
2 files changed, 230 insertions, 12 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp index 90ca7ab74f..26c9c91578 100644 --- a/engines/supernova/state.cpp +++ b/engines/supernova/state.cpp @@ -73,6 +73,7 @@ Object *Inventory::get(ObjectID id) const { return const_cast<Object *>(&Object::nullObject); } + GuiElement::GuiElement() : _text("") , _isHighlighted(false) @@ -228,7 +229,7 @@ void GameManager::initState() { _state.eventTime = 0xffffffff; _state.shipEnergy = 2135; _state.landingModuleEnergy = 923; - _state.greatF = 0; + _state.greatFlag = 0; _state.timeRobot = 0; _state.money = 0; _state.coins = 0; @@ -516,22 +517,141 @@ void GameManager::drawImage(int section) { } while (section != 0); } -bool GameManager::isHelmetOff() { - Object *helmet = _inventory.get(HELMET); - if (helmet && helmet->hasProperty(WORN)) { - _vm->renderMessage("Irgendwie ist ein Raumhelm|beim Essen unpraktisch."); - return false; +void GameManager::corridorOnEntrance() { + if (_state.corridorSearch) + busted(0); +} + +void busted(int i) { + // STUB +} + +void GameManager::telomat(int number) { + // STUB +} + +void GameManager::startSearch() { + if ((_currentRoom >= _rooms[CORRIDOR1]) && (_currentRoom <= _rooms[BCORRIDOR])) + busted(0); + + _state.corridorSearch = true; +} + +void GameManager::search(int time) { + _state.eventTime = _vm->getDOSTicks() + time; +// *event = &search_start; +} + +void GameManager::guardNoticed() { + // STUB +} + +void GameManager::busted(int i) { + if (i > 0) + drawImage(i); + if (i == 0) { + if ((_currentRoom >= _rooms[OFFICE_L1]) && (_currentRoom <= _rooms[OFFICE_R2])) { + if (_currentRoom < _rooms[OFFICE_R1]) + i = 10; + else + i = 5; + if (!_currentRoom->getObject(0)->hasProperty(OPENED)) { + drawImage(i - 1); + _vm->playSound(kAudioDoorOpen); + wait2(2); + } + drawImage(i); + wait2(3); + drawImage(i + 3); + _vm->playSound(kAudioVoiceHalt); + drawImage(i); + wait2(5); + if (_currentRoom == _rooms[OFFICE_L2]) + i = 13; + drawImage(i + 1); + wait2(3); + drawImage(i + 2); + shot(0, 0); + } else if (_currentRoom == _rooms[BCORRIDOR]) { + drawImage(21); + } else { + if (_currentRoom->isSectionVisible(4)) + drawImage(32); // below + else if (_currentRoom->isSectionVisible(2)) + drawImage(30); // right + else if (_currentRoom->isSectionVisible(1)) + drawImage(31); // left + else + drawImage(33); // above + } } + _vm->playSound(kAudioVoiceHalt); + wait2(3); + shot(0, 0); +} - return true; +void GameManager::guardReturned() { + if (_currentRoom == _rooms[GUARD]) + busted(-1); + else if ((_currentRoom == _rooms[CORRIDOR9]) && (_currentRoom->isSectionVisible(27))) + busted(0); + + _rooms[GUARD]->setSectionVisible(1, false); + _rooms[GUARD]->getObject(3)->_click = 0; + _rooms[GUARD]->setSectionVisible(6, false); + _rooms[GUARD]->getObject(2)->disableProperty(OPENED); + _rooms[GUARD]->setSectionVisible(7, false); + _rooms[GUARD]->getObject(5)->_click = 255; + _rooms[CORRIDOR9]->setSectionVisible(27, false); + _rooms[CORRIDOR9]->setSectionVisible(28, true); + _rooms[CORRIDOR9]->getObject(1)->disableProperty(OPENED); +} + +void GameManager::taxi() { + if (_currentRoom == _rooms[SIGN]) { + changeRoom(STATION); + } + + drawImage(1); + drawImage(2); + _vm->playSound(kAudioRocks); + screenShake(); + drawImage(9); + _currentRoom->getObject(1)->setProperty(OPENED); + drawImage(1); + _currentRoom->setSectionVisible(2, false); + drawImage(3); + for (int i = 4; i <= 8; i++) { + wait2(2); + drawImage(invertSection(i - 1)); + drawImage(i); + } + _rooms[SIGN]->setSectionVisible(2, false); + _rooms[SIGN]->setSectionVisible(3, true); +} + +void GameManager::outro() { + _state.benOverlay = 3; +// load_overlay(); +// title = 2; + _vm->playSoundMod(49); +// title = 0; + _state.benOverlay = 0; + _vm->paletteFadeOut(); + _vm->renderImage(55, 0); + _vm->paletteFadeIn(); + getInput(); + _vm->paletteFadeOut(); + // TODO: render info file +// longjmp(termination,1); } void GameManager::great(uint number) { - if (number && (_state.greatF & (1 << number))) + if (number && (_state.greatFlag & (1 << number))) return; _vm->playSound(kAudioUndef7); - _state.greatF |= 1 << number; + _state.greatFlag |= 1 << number; } bool GameManager::airless() { @@ -543,6 +663,31 @@ bool GameManager::airless() { ); } +void GameManager::shipStart() { + // STUB +} + +void GameManager::removeSentence(int sentence, int number) { + // STUB +} + +void GameManager::addSentence(int sentence, int number) { + // STUB +} + +void GameManager::say(const char *text) { + // STUB +} + +void GameManager::reply(const char *text, int aus1, int aus2) { + // STUB +} + +int GameManager::dialog(int num, byte *rowLength[], const char **text[6], int number) { + // STUB + return 0; +} + void GameManager::turnOff() { if (_state.powerOff) return; @@ -612,7 +757,11 @@ uint16 GameManager::getKeyInput(bool blockForPrintChar) { _key.keycode == Common::KEYCODE_DELETE || _key.keycode == Common::KEYCODE_RETURN || _key.keycode == Common::KEYCODE_SPACE || - _key.keycode == Common::KEYCODE_ESCAPE) { + _key.keycode == Common::KEYCODE_ESCAPE || + _key.keycode == Common::KEYCODE_UP || + _key.keycode == Common::KEYCODE_DOWN || + _key.keycode == Common::KEYCODE_LEFT || + _key.keycode == Common::KEYCODE_RIGHT) { if (_key.flags & Common::KBD_SHIFT) return toupper(_key.ascii); else @@ -663,7 +812,10 @@ void GameManager::roomBrightness() { } void GameManager::loadTime() { - // STUB + _state.timeStarting += _state.time; + if (_state.eventTime != 1) + _state.eventTime += _state.time; + _state.timeAlarmSystem = _state.timeAlarm + _state.timeStarting; } void GameManager::saveTime() { @@ -848,6 +1000,42 @@ void GameManager::loadOverlayStart() { // STUB } +void GameManager::shot(int a, int b) { + if (a) + drawImage(a); + _vm->playSound(kAudioGunShot); + wait2(2); + if (b) + drawImage(b); + wait2(2); + if (a) + drawImage(a); + _vm->playSound(kAudioGunShot); + wait2(2); + if (b) + drawImage(b); + + death("Der Axacussaner hat dich erwischt."); +} + +void GameManager::takeMoney(int amount) { + _state.money += amount; + if (amount > 0) + great(0); + // TODO: kmaxobject - 1? +// _rooms[OFFICE_R1]->getObject(5)->_name = _rooms[OFFICE_R1]->getObject(kMaxObject - 1); +// raumz[OFFICE_R1]->object[5].name = &(raumz[OFFICE_R1]->object[MAX_OBJECT-1]); +// strcpy(raumz[OFFICE_R1]->object[5].name,ltoa((long)_state.money)); +// strcat(raumz[OFFICE_R1]->object[5].name," Xa"); + + if (_state.money) { + if (!_rooms[OFFICE_R1]->getObject(5)->hasProperty(CARRIED)) + takeObject(*_rooms[OFFICE_R1]->getObject(5)); + } else { + _inventory.remove(*_rooms[OFFICE_R1]->getObject(5)); + } +} + void GameManager::drawStatus() { int index = static_cast<int>(_inputVerb); _vm->renderBox(0, 140, 320, 9, kColorWhite25); @@ -907,6 +1095,7 @@ void GameManager::death(const char *message) { initGui(); _inventory.clear(); changeRoom(INTRO); + _vm->renderRoom(*_currentRoom); _vm->paletteFadeIn(); _guiEnabled = true; @@ -921,6 +1110,15 @@ int GameManager::invertSection(int section) { return section; } +bool GameManager::isHelmetOff() { + Object *helmet = _inventory.get(HELMET); + if (helmet && helmet->hasProperty(WORN)) { + _vm->renderMessage("Irgendwie ist ein Raumhelm|beim Essen unpraktisch."); + return false; + } + + return true; +} bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) { Room *r; diff --git a/engines/supernova/state.h b/engines/supernova/state.h index 48499d7869..ad43ff57b2 100644 --- a/engines/supernova/state.h +++ b/engines/supernova/state.h @@ -37,7 +37,7 @@ struct GameState { int32 eventTime; int32 shipEnergy; int32 landingModuleEnergy; - uint16 greatF; + uint16 greatFlag; int16 timeRobot; int16 money; byte coins; @@ -181,6 +181,26 @@ public: void handleTime(); void setAnimationTimer(int ticks); void death(const char *message); + int dialog(int num, byte *rowLength[6], const char **text[6], int number); + void sentence(int number, bool brightness); + void removeSentence(int sentence, int number); + void addSentence(int sentence, int number); + void say(const char *text); + void reply(const char *text, int aus1, int aus2); + void shipStart(); + void inventorySeize(); + void shot(int a, int b); + void takeMoney(int amount); + void search(int time); + void startSearch(); + void guardNoticed(); + void guardReturned(); + void busted(int i); + void corridorOnEntrance(); + void event(int time); + void telomat(int number); + void taxi(); + void outro(); }; } |