KINGDOM: Move character death (repetitive) code to separate function

This commit is contained in:
Strangerke 2019-06-17 23:13:04 +02:00 committed by Eugene Sandulenko
parent c4e54246a7
commit 19386a50d5
3 changed files with 23 additions and 38 deletions

View File

@ -115,12 +115,8 @@ void Logic::GPL4_991() {
_vm->playMovie(194);
_vm->_noIFScreen = true;
_vm->fShowPic(107);
_currMap = 3;
dsAll();
_pouch = false;
_vm->playSound(1);
memset(_inventory, -1, 19);
_statPlay = 994;
characterDeath();
} else {
_vm->_bTimer = 36;
while(_vm->_bTimer) {
@ -167,12 +163,8 @@ void Logic::GPL4_992() {
_vm->playMovie(194);
_vm->_noIFScreen = true;
_vm->fShowPic(107);
_currMap = 3;
dsAll();
_pouch = false;
_vm->playSound(1);
memset(_inventory, -1, 19);
_statPlay = 994;
characterDeath();
} else {
_vm->_bTimer = 36;
while(_vm->_bTimer != 0) {
@ -216,12 +208,8 @@ void Logic::GPL4_992_demo() {
_vm->playMovie(194);
_vm->_noIFScreen = true;
_vm->fShowPic(107);
_currMap = 3;
dsAll();
_pouch = false;
_vm->playSound(1);
memset(_inventory, -1, 19);
_statPlay = 994;
characterDeath();
} else {
_vm->_bTimer = 36;
while(_vm->_bTimer != 0) {
@ -264,12 +252,8 @@ void Logic::GPL4_993() {
_vm->playMovie(194);
_vm->_noIFScreen = true;
_vm->fShowPic(107);
_currMap = 3;
dsAll();
_pouch = false;
_vm->playSound(1);
memset(_inventory, -1, 19);
_statPlay = 994;
characterDeath();
} else {
_vm->_bTimer = 36;
while (_vm->_bTimer != 0) {
@ -317,12 +301,8 @@ void Logic::GPL4_993_demo() {
_vm->playMovie(194);
_vm->_noIFScreen = true;
_vm->fShowPic(107);
_currMap = 3;
dsAll();
_pouch = false;
_vm->playSound(1);
memset(_inventory, -1, 19);
_statPlay = 994;
characterDeath();
} else {
_vm->_bTimer = 36;
while (_vm->_bTimer != 0) {

View File

@ -152,8 +152,7 @@ void Logic::initOpcodes() {
if (_vm->isDemo())
initOpcodesDemo();
else
initOpcodesFull();
initOpcodesFull();
}
void Logic::initOpcodesDemo() {
@ -404,12 +403,8 @@ void Logic::endCredits() {
_vm->drawRect(4, 17, 228, 161, 0);
_vm->playMovie(201);
_vm->fShowPic(125);
_currMap = 3;
dsAll();
_pouch = false;
memset(_inventory, 0xFF, 19);
_statPlay = 994;
_vm->_loopFlag = true;
characterDeath();
}
void Logic::gameHelp_Sub43C() {
@ -566,6 +561,15 @@ void Logic::switchAS() {
_vm->_iconsClosed = _vm->_oldIconsClosed;
}
void Logic::characterDeath() {
_currMap = 3;
dsAll();
_pouch = false;
memset(_inventory, -1, 19);
_statPlay = 994;
_vm->_loopFlag = true;
}
void Logic::executeOpcode() {
if (_opCodes.contains(_statPlay)) {
Opcode op = _opCodes[_statPlay];

View File

@ -294,6 +294,7 @@ public:
void executeOpcode();
void initPlay();
void switchAS();
void characterDeath();
void synchronize(Common::Serializer &s);
};
}