2017-06-14 21:00:36 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2017-06-14 21:00:36 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-06-14 21:00:36 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "kingdom/kingdom.h"
|
2017-07-11 23:58:19 +00:00
|
|
|
#include "kingdom/logic.h"
|
2017-06-14 21:00:36 +00:00
|
|
|
|
|
|
|
namespace Kingdom {
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
void Logic::GPL4_900() {
|
|
|
|
if (_vm->_aTimer > 0) {
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->playSound(0);
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_aTimer = 133;
|
|
|
|
}
|
|
|
|
if (_vm->_asMode) {
|
|
|
|
_vm->switchMtoA();
|
|
|
|
_mapStat = 0;
|
|
|
|
_oldStatPlay--;
|
|
|
|
_vm->_asMode = false;
|
|
|
|
}
|
|
|
|
_vm->saveAS();
|
|
|
|
_vm->fadeToBlack2();
|
2017-06-14 21:00:36 +00:00
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
if (_health == 10 || _health == 6 || _health == 2) {
|
|
|
|
_vm->showPic(121);
|
|
|
|
_vm->_bTimer = 38;
|
|
|
|
_vm->readMouse();
|
|
|
|
while (_vm->_bTimer && !_vm->_mouseButton) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
_vm->readMouse();
|
2017-06-14 21:00:36 +00:00
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
if (_vm->_aTimer > 0)
|
|
|
|
_vm->setATimer();
|
2017-06-14 21:00:36 +00:00
|
|
|
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->_userInput = 0;
|
2017-07-23 22:07:48 +00:00
|
|
|
GPL4_901();
|
|
|
|
} else {
|
|
|
|
if (_vm->_aTimer > 0) {
|
|
|
|
_vm->setATimer();
|
|
|
|
_vm->_aTimer = 133;
|
2017-06-14 21:00:36 +00:00
|
|
|
}
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->showPic(120);
|
|
|
|
_statPlay = 901;
|
2017-06-14 21:00:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
void Logic::GPL4_901() {
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->setMouse();
|
|
|
|
_vm->eraseCursor();
|
|
|
|
_vm->fadeToBlack2();
|
|
|
|
_vm->showPic(106);
|
|
|
|
_vm->drawIcon(4, 0, 12 - _healthOld);
|
2017-07-05 19:39:05 +00:00
|
|
|
if (_tideCntl)
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->drawPic(178);
|
2017-06-14 21:00:36 +00:00
|
|
|
else
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->drawPic(179);
|
2017-07-23 22:07:48 +00:00
|
|
|
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->_iconRedraw = true;
|
|
|
|
if (_vm->_userInput == 0x2F1) {
|
|
|
|
_vm->_asMode = false;
|
|
|
|
_vm->restoreAS();
|
2017-07-05 05:58:18 +00:00
|
|
|
_statPlay = _oldStatPlay;
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->_loopFlag = true;
|
2017-06-14 21:00:36 +00:00
|
|
|
} else {
|
2017-07-11 23:58:19 +00:00
|
|
|
if (_health == 10 || _health == 6 || _health == 2 || _vm->_userInput < 0x400 || _vm->_userInput > 0x427) {
|
|
|
|
_vm->_asMode = false;
|
|
|
|
_vm->restoreAS();
|
2017-07-05 05:58:18 +00:00
|
|
|
_statPlay = _oldStatPlay;
|
2017-06-14 21:00:36 +00:00
|
|
|
} else {
|
2017-07-11 23:58:19 +00:00
|
|
|
_statPlay = _mapExit[_vm->_userInput - 0x400];
|
|
|
|
_vm->_userInput = 0;
|
2017-07-08 09:42:21 +00:00
|
|
|
wound();
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->playMovie(10);
|
2017-07-08 09:42:21 +00:00
|
|
|
inventoryDel(3);
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->_tsIconOnly = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-08 09:42:21 +00:00
|
|
|
switchAS();
|
2017-07-06 05:22:27 +00:00
|
|
|
_mapStat = 0;
|
2017-06-14 21:00:36 +00:00
|
|
|
}
|
2017-07-11 23:58:19 +00:00
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->_loopFlag = true;
|
2017-06-14 21:00:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
void Logic::GPL4_991() {
|
|
|
|
_currMap = 10;
|
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_health == 10 || _health == 6 || _health == 2)
|
|
|
|
_health -= 2;
|
|
|
|
else
|
|
|
|
_health -= 4;
|
|
|
|
|
|
|
|
if (_health == 0) {
|
|
|
|
_vm->playMovie(194);
|
|
|
|
_vm->_noIFScreen = true;
|
|
|
|
_vm->fShowPic(107);
|
2019-06-17 21:13:04 +00:00
|
|
|
|
|
|
|
characterDeath();
|
2017-07-23 22:07:48 +00:00
|
|
|
} else {
|
|
|
|
_vm->_bTimer = 36;
|
|
|
|
while(_vm->_bTimer) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_loopFlag = true;
|
|
|
|
|
2017-08-06 21:34:28 +00:00
|
|
|
if (_nodes[28] == 1) {
|
2017-07-30 14:50:23 +00:00
|
|
|
_nodes[28] = 0;
|
|
|
|
_nodes[48] = 0;
|
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_itemInhibit = false;
|
|
|
|
_tideCntl = false;
|
|
|
|
_vm->drawPic(179);
|
|
|
|
_vm->_skylarTimer = 0;
|
|
|
|
_vm->_skylarTimerFlag = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_mapEx = true;
|
|
|
|
_nodeNum = 5;
|
|
|
|
_vm->drawLocation();
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_nodes[5] > 0) {
|
|
|
|
_vm->playMovie(197);
|
|
|
|
_resurrect = true;
|
|
|
|
}
|
|
|
|
inventoryDel(12);
|
|
|
|
_statPlay = 50;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logic::GPL4_992() {
|
|
|
|
_currMap = 10;
|
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_health == 10 || _health == 6 || _health == 2)
|
|
|
|
_health -= 2;
|
|
|
|
else
|
|
|
|
_health -= 4;
|
|
|
|
|
|
|
|
if (_health == 0) {
|
|
|
|
_vm->playMovie(194);
|
|
|
|
_vm->_noIFScreen = true;
|
|
|
|
_vm->fShowPic(107);
|
2019-06-17 21:13:04 +00:00
|
|
|
|
|
|
|
characterDeath();
|
2017-07-23 22:07:48 +00:00
|
|
|
} else {
|
|
|
|
_vm->_bTimer = 36;
|
|
|
|
while(_vm->_bTimer != 0) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_loopFlag = true;
|
2017-08-06 16:30:27 +00:00
|
|
|
if (_nodes[28] == 1) {
|
|
|
|
_nodes[28] = 0;
|
|
|
|
_nodes[48] = 0;
|
2017-07-23 22:07:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_itemInhibit = false;
|
|
|
|
_tideCntl = false;
|
|
|
|
_vm->drawPic(179);
|
|
|
|
_vm->_skylarTimer = 0;
|
|
|
|
_vm->_skylarTimerFlag = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_mapEx = true;
|
|
|
|
_nodeNum = 27;
|
|
|
|
_vm->drawLocation();
|
|
|
|
_resurrect = true;
|
|
|
|
_vm->playSound(0);
|
|
|
|
_vm->playMovie(195);
|
|
|
|
inventoryDel(12);
|
|
|
|
_statPlay = 270;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-30 14:50:23 +00:00
|
|
|
void Logic::GPL4_992_demo() {
|
|
|
|
_currMap = 10;
|
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_health == 10 || _health == 6 || _health == 2)
|
|
|
|
_health -= 2;
|
|
|
|
else
|
|
|
|
_health -= 4;
|
|
|
|
|
|
|
|
if (_health == 0) {
|
|
|
|
_vm->playMovie(194);
|
|
|
|
_vm->_noIFScreen = true;
|
|
|
|
_vm->fShowPic(107);
|
2019-06-17 21:13:04 +00:00
|
|
|
|
|
|
|
characterDeath();
|
2017-07-30 14:50:23 +00:00
|
|
|
} else {
|
|
|
|
_vm->_bTimer = 36;
|
|
|
|
while(_vm->_bTimer != 0) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_loopFlag = true;
|
|
|
|
if (_nodes[28] == 1) {
|
|
|
|
_nodes[28] = 0;
|
|
|
|
_nodes[48] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_itemInhibit = false;
|
|
|
|
_tideCntl = false;
|
|
|
|
_vm->drawPic(179);
|
|
|
|
_vm->_skylarTimer = 0;
|
|
|
|
_vm->_skylarTimerFlag = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-30 14:50:23 +00:00
|
|
|
_nodeNum = 27;
|
|
|
|
_vm->drawLocation();
|
|
|
|
_resurrect = true;
|
|
|
|
_vm->playSound(0);
|
|
|
|
_vm->playMovie(195);
|
|
|
|
inventoryDel(12);
|
|
|
|
_statPlay = 270;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
void Logic::GPL4_993() {
|
|
|
|
_currMap = 10;
|
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_health == 10 || _health == 6 || _health == 2)
|
|
|
|
_health -= 2;
|
|
|
|
else
|
|
|
|
_health -= 4;
|
|
|
|
|
|
|
|
if (_health == 0) {
|
|
|
|
_vm->playMovie(194);
|
|
|
|
_vm->_noIFScreen = true;
|
|
|
|
_vm->fShowPic(107);
|
2019-06-17 21:13:04 +00:00
|
|
|
|
|
|
|
characterDeath();
|
2017-07-23 22:07:48 +00:00
|
|
|
} else {
|
|
|
|
_vm->_bTimer = 36;
|
|
|
|
while (_vm->_bTimer != 0) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_loopFlag = true;
|
2017-07-30 14:50:23 +00:00
|
|
|
|
2017-08-06 21:34:28 +00:00
|
|
|
if (_nodes[28] == 1) {
|
|
|
|
_nodes[28] = 0;
|
|
|
|
_nodes[48] = 0;
|
2017-07-23 22:07:48 +00:00
|
|
|
}
|
|
|
|
|
2017-08-06 21:34:28 +00:00
|
|
|
if (_nodes[67] == 1)
|
|
|
|
_nodes[67] = 0;
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_itemInhibit = false;
|
|
|
|
_tideCntl = false;
|
|
|
|
_vm->drawPic(179);
|
|
|
|
_vm->_skylarTimer = 0;
|
|
|
|
_vm->_skylarTimerFlag = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-23 22:07:48 +00:00
|
|
|
_vm->_mapEx = true;
|
|
|
|
_nodeNum = 52;
|
|
|
|
_vm->drawLocation();
|
|
|
|
_resurrect = true;
|
|
|
|
_vm->playSound(0);
|
|
|
|
_vm->playMovie(196);
|
|
|
|
inventoryDel(12);
|
|
|
|
_statPlay = 520;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-30 14:50:23 +00:00
|
|
|
void Logic::GPL4_993_demo() {
|
|
|
|
_currMap = 10;
|
|
|
|
_vm->_userInput = 0;
|
|
|
|
_vm->playSound(0);
|
|
|
|
if (_health == 10 || _health == 6 || _health == 2)
|
|
|
|
_health -= 2;
|
|
|
|
else
|
|
|
|
_health -= 4;
|
|
|
|
|
|
|
|
if (_health == 0) {
|
|
|
|
_vm->playMovie(194);
|
|
|
|
_vm->_noIFScreen = true;
|
|
|
|
_vm->fShowPic(107);
|
2019-06-17 21:13:04 +00:00
|
|
|
|
|
|
|
characterDeath();
|
2017-07-30 14:50:23 +00:00
|
|
|
} else {
|
|
|
|
_vm->_bTimer = 36;
|
|
|
|
while (_vm->_bTimer != 0) {
|
|
|
|
_vm->checkTimers();
|
|
|
|
_vm->refreshSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_loopFlag = true;
|
|
|
|
if (_nodes[28] == 1) {
|
|
|
|
_nodes[28] = 0;
|
|
|
|
_nodes[48] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_nodes[67] == 1)
|
|
|
|
_nodes[67] = 0;
|
|
|
|
|
|
|
|
_vm->_itemInhibit = false;
|
|
|
|
_tideCntl = false;
|
|
|
|
_vm->drawPic(179);
|
|
|
|
_vm->_skylarTimer = 0;
|
|
|
|
_vm->_skylarTimerFlag = false;
|
2020-06-10 22:23:14 +00:00
|
|
|
enableUIButtons();
|
2017-07-30 14:50:23 +00:00
|
|
|
_nodeNum = 52;
|
|
|
|
_vm->drawLocation();
|
|
|
|
_resurrect = true;
|
|
|
|
_vm->playSound(0);
|
|
|
|
_vm->playMovie(196);
|
|
|
|
inventoryDel(12);
|
|
|
|
_statPlay = 520;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-23 22:07:48 +00:00
|
|
|
void Logic::GPL4_994() {
|
|
|
|
switch(_vm->_userInput) {
|
|
|
|
case 0x190:
|
|
|
|
_vm->initPlay();
|
|
|
|
// TODO _QuitFlag = 1;
|
|
|
|
_vm->_quit = true;
|
|
|
|
break;
|
|
|
|
case 0x191:
|
|
|
|
// TODO _QuitFlag = 2;
|
|
|
|
_vm->_quit = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (_vm->_userInput)
|
2020-06-01 12:46:24 +00:00
|
|
|
warning("Skipped UserInput %d(0x%04X) for _StatPlay %d", _vm->_userInput, _vm->_userInput, _statPlay);
|
2017-07-23 22:07:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-14 21:00:36 +00:00
|
|
|
} // Namespace
|