DRAGONS: Work on mini game 2 and mini game 5

This commit is contained in:
Eric Fry 2019-12-05 22:47:01 +11:00 committed by Eugene Sandulenko
parent 633bbeb89c
commit e64a53a32b
7 changed files with 646 additions and 29 deletions

View file

@ -178,20 +178,18 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
loungealotLeftUpperArm = _vm->_actorManager->loadActor(0xb, 2, 0x7d, 199, 4);
uVar8 = _vm->_actorManager->loadActor(0xf,0,0x7d,199,4);
loungealotRightArm = _vm->_actorManager->loadActor(0x10, 0, 0x7d, 199, 4);
actorFrameData = loungealotLeftUpperArm->frame->frameDataOffset;
flickerArm = _vm->_actorManager->loadActor(9, (uint)(ushort)actorSequenceIdTbl[(uint)DAT_80093cb4 * 3 + (uint)DAT_80093cbc],
loungealotLeftUpperArm->x_pos - READ_LE_INT16(actorFrameData + 0xe),
loungealotLeftUpperArm->y_pos - READ_LE_INT16(actorFrameData + 0x10), 4);
loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e,
loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10, 4);
loungealotThumb = _vm->_actorManager->loadActor(0x12, (uint)(ushort)actorSequenceIdTbl[(uint)DAT_80093cb4 * 3 + (uint)DAT_80093cbc],
loungealotLeftUpperArm->x_pos - READ_LE_INT16(actorFrameData + 0xe),
loungealotLeftUpperArm->y_pos - READ_LE_INT16(actorFrameData + 0x10), 4);
actorFrameData = flickerArm->frame->frameDataOffset;
loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e,
loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10, 4);
uVar12 = _vm->_actorManager->loadActor(10, (uint)(ushort)actorSequenceIdTbl[(uint)DAT_80093cb8 * 3 + (uint)DAT_80093cc0],
flickerArm->x_pos - READ_LE_INT16(actorFrameData + 0xe),
flickerArm->y_pos - READ_LE_INT16(actorFrameData + 0x10), 4);
flickerArm->x_pos - flickerArm->frame->field_e,
flickerArm->y_pos - flickerArm->frame->field_10, 4);
uVar13 = _vm->_actorManager->loadActor(0x13, (uint)(ushort)actorSequenceIdTbl[(uint)DAT_80093cb8 * 3 + (uint)DAT_80093cc0],
flickerArm->x_pos - READ_LE_INT16(actorFrameData + 0xe),
flickerArm->y_pos - READ_LE_INT16(actorFrameData + 0x10), 4);
flickerArm->x_pos - flickerArm->frame->field_e,
flickerArm->y_pos - flickerArm->frame->field_10, 4);
uVar14 = _vm->_actorManager->loadActor(0x27,0,0x10,0xac,4);
uVar15 = _vm->_actorManager->loadActor(0x27,1,0x10,0x8c,4);
uVar5->setFlag(ACTOR_FLAG_100);
@ -242,16 +240,16 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
uVar5->setFlag(ACTOR_FLAG_400);
actorFrameData = loungealotLeftUpperArm->frame->frameDataOffset;
flickerArm->x_pos = loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e; //READ_LE_INT16(actorFrameData + 0xe);
flickerArm->y_pos = loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10; //READ_LE_INT16(actorFrameData + 0x10);
loungealotThumb->x_pos = loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e; //READ_LE_INT16(actorFrameData + 0xe);
loungealotThumb->y_pos = loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10; //READ_LE_INT16(actorFrameData + 0x10);
flickerArm->x_pos = loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e;
flickerArm->y_pos = loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10;
loungealotThumb->x_pos = loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e;
loungealotThumb->y_pos = loungealotLeftUpperArm->y_pos - loungealotLeftUpperArm->frame->field_10;
actorFrameData = flickerArm->frame->frameDataOffset;
uVar12->x_pos = loungealotLeftUpperArm->x_pos - flickerArm->frame->field_e; //READ_LE_INT16(actorFrameData + 0xe);
uVar12->y_pos = loungealotLeftUpperArm->y_pos - flickerArm->frame->field_10; //READ_LE_INT16(actorFrameData + 0x10);
uVar13->x_pos = loungealotLeftUpperArm->x_pos - flickerArm->frame->field_e; //READ_LE_INT16(actorFrameData + 0xe);
uVar13->y_pos = loungealotLeftUpperArm->y_pos - flickerArm->frame->field_10; //READ_LE_INT16(actorFrameData + 0x10);
_vm->waitForFrames(200);
uVar12->x_pos = loungealotLeftUpperArm->x_pos - flickerArm->frame->field_e;
uVar12->y_pos = loungealotLeftUpperArm->y_pos - flickerArm->frame->field_10;
uVar13->x_pos = loungealotLeftUpperArm->x_pos - flickerArm->frame->field_e;
uVar13->y_pos = loungealotLeftUpperArm->y_pos - flickerArm->frame->field_10;
_vm->waitForFrames(2);
// call_fade_related_1f();
LAB_80090188:
@ -274,6 +272,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
if (flicker->field_12 == 0) {
_vm->setVar(0xb, 1);
flicker->actorResourceId = 0xd2; //TODO is this correct?
_vm->_actorManager->loadActor(0xd2, flicker->actor->_actorID);
_vm->_dragonINIResource->getRecord(0x120)->sceneId = 0x17;
}
loungealotHeadActor->clearFlag(ACTOR_FLAG_40);
@ -297,7 +296,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
_vm->_scene->setSceneId(0x17);
flicker->sceneId = 0x17;
_vm->_scene->loadSceneData((uint)(0x17 | 0x8000),0);
_vm->setAllFlags(origEngineFlags & 0xfefdffff | _vm->getAllFlags() & 0x1000000 | 0x40);
_vm->setAllFlags((origEngineFlags & 0xfefdffff) | (_vm->getAllFlags() & 0x1000000) | 0x40);
// call_fade_related_1f();
}
return;
@ -342,46 +341,50 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
else {
DAT_80093cc4 = DAT_80093cc4 - 1;
}
/*
if (local_27a == 0) {
(&DAT_80083178)[(uint)uVar16 * 0xb] = (&DAT_80083178)[(uint)uVar16 * 0xb] & 0xfffe;
// TODO (&DAT_80083178)[(uint)uVar16 * 0xb] = (&DAT_80083178)[(uint)uVar16 * 0xb] & 0xfffe;
}
else {
/* TODO
(&DAT_8008316c)[(uint)uVar16 * 0xb] = local_27a + 0x27;
(&DAT_80083168)[(uint)uVar16 * 0xb] = local_27a + 0x27;
(&DAT_80083176)[(uint)uVar16 * 0xb] =
(ushort)(((int)((uint)local_27a - 1) >> 1) << 5) |
(ushort)(((int)(0x40 - (uint)local_27a) >> 1) << 10);
(&DAT_80083178)[(uint)uVar16 * 0xb] = (&DAT_80083178)[(uint)uVar16 * 0xb] | 1;
*/
}
if (local_278 == 0) {
(&DAT_80083178)[(uint)uVar17 * 0xb] = (&DAT_80083178)[(uint)uVar17 * 0xb] & 0xfffe;
//TODO (&DAT_80083178)[(uint)uVar17 * 0xb] = (&DAT_80083178)[(uint)uVar17 * 0xb] & 0xfffe;
if ((local_27a != 0) || (local_258 != 0)) goto LAB_800907c4;
}
else {
/*TODO
(&DAT_8008316c)[(uint)uVar17 * 0xb] = local_278 + 0x27;
(&DAT_80083168)[(uint)uVar17 * 0xb] = local_278 + 0x27;
(&DAT_80083176)[(uint)uVar17 * 0xb] =
(ushort)(((int)((uint)local_278 - 1) >> 1) << 5) |
(ushort)(((int)(0x40 - (uint)local_278) >> 1) << 10);
(&DAT_80083178)[(uint)uVar17 * 0xb] = (&DAT_80083178)[(uint)uVar17 * 0xb] | 1;
*/
LAB_800907c4:
if (!bVar4) {
FUN_8001a4e4_draw_dialogbox(4,0x14,0xd,0x16,1);
FUN_8001a4e4_draw_dialogbox(4,0x10,0xd,0x12,1);
//TODO FUN_8001a4e4_draw_dialogbox(4,0x14,0xd,0x16,1);
//TODO FUN_8001a4e4_draw_dialogbox(4,0x10,0xd,0x12,1);
uVar14->priorityLayer = 6;
uVar15->priorityLayer = 6;
bVar4 = true;
}
}
if ((((local_278 == 0) && (local_27a == 0)) && (local_258 == 0)) && (bVar4)) {
FUN_8001a7c4(4,0x14,0xd,0x16);
FUN_8001a7c4(4,0x10,0xd,0x12);
// TODO FUN_8001a7c4(4,0x14,0xd,0x16);
// TODO FUN_8001a7c4(4,0x10,0xd,0x12);
uVar14->priorityLayer = 0;
uVar15->priorityLayer = 0;
bVar4 = false;
}
*/
//DisableVSyncEvent();
loungealotThumb->x_pos = loungealotLeftUpperArm->x_pos - loungealotLeftUpperArm->frame->field_e;
flickerArm->x_pos = loungealotThumb->x_pos;

View file

@ -0,0 +1,548 @@
/* 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.
*
* 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 2
* of the License, or (at your option) any later version.
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "minigame5.h"
#include "actor.h"
#include "dragons.h"
#include "dragons/dragonini.h"
#include "dragons/talk.h"
#include "dragons/scene.h"
namespace Dragons {
#define DAT_80063a48 0x12d
#define DAT_80063a40 0x12f
#define DAT_80063bd0 0x133
#define DAT_8006393c 0x21BF0
#define DAT_80063938 0x21DAE
#define DAT_80063e38 0x21E3E
#define DAT_8006391c 0x475DA
Minigame5::Minigame5(DragonsEngine *vm) : _vm(vm), DAT_800633e6(0) {}
void Minigame5::run() {
ushort uVar1;
int iVar2;
byte *local_v0_7008;
void *local_v0_7256;
byte *uVar3;
uint uVar4;
ushort local_850;
uint16 auStack2120 [1000];
DragonINI*local_78;
uint16 local_76;
ushort local_74;
ushort local_72;
ushort local_70;
Actor *bombActor;
Actor *flickerActor;
Actor *pusherActor;
Actor *dustActor;
ushort local_66;
Actor *wheelsActor;
ushort local_62;
ushort local_60;
ushort local_5e;
short local_5c;
short local_5a;
ushort currentState;
short local_50;
Actor *local_4e;
uint16 local_4c;
uint16_t local_4a;
uint16 local_48;
int16_t local_46;
int16_t local_44;
short local_42;
uint16_t local_30 [4];
uint16_t uStack42;
uint16_t local_28 [10];
short local_10;
uint32 savedEngineFlags;
Common::File *fd = new Common::File();
if (!fd->open("arc5.bin")) {
error("Failed to open arc5.bin");
}
for (int i = 0; i < 4; i++) {
local_30[i] = fd->readUint16LE();
}
for (int i = 0; i < 10; i++) {
local_28[i] = fd->readUint16LE();
}
fd->close();
local_48 = 0;
local_76 = _vm->_scene->getSceneId();
local_78 = _vm->_dragonINIResource->getFlickerRecord();
local_78->actor->setFlag(ACTOR_FLAG_100);
local_78->actor->priorityLayer = 0;
savedEngineFlags = _vm->getMultipleFlags(ENGINE_FLAG_8 | ENGINE_FLAG_10 | ENGINE_FLAG_20 | ENGINE_FLAG_80);
_vm->clearFlags(ENGINE_FLAG_8);
_vm->clearFlags(ENGINE_FLAG_10);
_vm->clearFlags(ENGINE_FLAG_20);
_vm->clearFlags(ENGINE_FLAG_80);
_vm->_dragonINIResource->setFlickerRecord(_vm->_dragonINIResource->getRecord(DAT_80063a40 - 1));
flickerActor = _vm->_dragonINIResource->getFlickerRecord()->actor;
flickerActor->flags = flickerActor->flags | 0x380;
flickerActor->scale = 0x100;
flickerActor->priorityLayer = 4;
flickerActor->_sequenceID2 = -1;
flickerActor->updateSequence(0x19);
currentState = 0;
local_10 = 0;
local_850 = flickerActor->x_pos;
uVar1 = flickerActor->y_pos;
local_74 = 0;
// DisableVSyncEvent();
pusherActor = _vm->_actorManager->loadActor
(0x26,0,(int)(short)local_850,(int)(((uint)uVar1 + 5) * 0x10000) >> 0x10);
// EnableVSyncEvent();
if (pusherActor == NULL) {
error("Couldn't alloc pusher!");
}
pusherActor->flags = pusherActor->flags | 0x380;
pusherActor->x_pos = flickerActor->x_pos + -0xe;
pusherActor->y_pos = flickerActor->y_pos + 7;
pusherActor->scale = 0x100;
pusherActor->priorityLayer = 6;
// DisableVSyncEvent();
wheelsActor = _vm->_actorManager->loadActor(7,0x11,0,0);
// EnableVSyncEvent();
if (wheelsActor == NULL) {
error("Couldn't alloc wheels!");
}
wheelsActor->flags = wheelsActor->flags | 0x380;
wheelsActor->scale = 0x100;
wheelsActor->x_pos = flickerActor->x_pos;
wheelsActor->y_pos = flickerActor->y_pos;
wheelsActor->priorityLayer = 5;
wheelsActor->updateSequence(0x11);
local_62 = 0;
// DisableVSyncEvent();
bombActor = _vm->_actorManager->loadActor(7,0x1c,0,0);
// EnableVSyncEvent();
if (bombActor == NULL) {
error("Couldn't alloc bomb!");
}
bombActor->flags = bombActor->flags | 0x380;
bombActor->scale = 0x100;
bombActor->priorityLayer = 0;
// DisableVSyncEvent();
dustActor = _vm->_actorManager->loadActor(8,8,100,100,0);
// EnableVSyncEvent();
if (dustActor == NULL) {
error("Couldn't alloc dust sprite!");
}
dustActor->flags = dustActor->flags | 0x380;
dustActor->scale = 0x100;
local_4e = _vm->_dragonINIResource->getRecord(DAT_80063a48 + -1)->actor;
local_4c = 0;
local_4a = local_4e->field_c;
_vm->setFlags(ENGINE_FLAG_4000000);
currentState = 1;
local_66 = 0;
local_50 = 0;
while( true ) {
while( true ) {
do {
_vm->waitForFrames(1);
if ((uint)currentState - 1 < 8) {
switch(currentState) {
case 1:
if (local_66 != 8) {
local_66 = 0;
}
//iVar2 = IsButtonBeingPressed((uint)DAT_800728ac,0);
if (!_vm->isActionButtonPressed()) {
if (local_74 == 0) {
if ((((flickerActor->_sequenceID != 0) &&
(flickerActor->_sequenceID != 5)) &&
(flickerActor->_sequenceID != 6)) ||
((flickerActor->flags & 4) != 0)) {
flickerActor->updateSequence(0x19);
}
}
else {
local_66 = 1;
local_50 = 0;
pusherActor->updateSequence(1);
currentState = 2;
if (local_74 < 0x14) {
local_72 = 1;
}
else {
if (local_74 < 0x2d) {
local_72 = 2;
}
else {
if (local_74 < 0x169) {
local_72 = 3;
}
}
}
}
local_74 = 0;
}
else {
pusherActor->x_pos = flickerActor->x_pos + -0xe;
pusherActor->y_pos = flickerActor->y_pos + 7;
if (local_74 < 0x168) {
local_74 = local_74 + 1;
if (local_74 < 0x14) {
if (((pusherActor->_sequenceID != 4) &&
(pusherActor->_sequenceID != 2)) &&
(pusherActor->_sequenceID != 3)) {
pusherActor->updateSequence(4);
}
if (flickerActor->_sequenceID != 0x1a) {
flickerActor->updateSequence(0x1a);
_vm->playSound(2);
}
}
else {
if (local_74 < 0x2d) {
if (((pusherActor->_sequenceID != 5) &&
(pusherActor->_sequenceID != 2)) &&
(pusherActor->_sequenceID != 3)) {
pusherActor->updateSequence(5);
}
if (flickerActor->_sequenceID != 0x1e) {
flickerActor->updateSequence(0x1e);
_vm->playSound(3);
}
}
else {
if (local_74 < 0x169) {
if (((pusherActor->_sequenceID != 6) &&
(pusherActor->_sequenceID != 2)) &&
(pusherActor->_sequenceID != 3)) {
pusherActor->updateSequence(6);
}
if (flickerActor->_sequenceID != 0x1f) {
flickerActor->updateSequence(0x1f);
_vm->playSound(4);
}
}
}
}
}
else {
if (pusherActor->_sequenceID != 6) {
pusherActor->updateSequence(6);
}
if (flickerActor->_sequenceID != 0x1f) {
flickerActor->updateSequence(0x1f);
}
}
}
break;
case 2:
if (flickerActor->_sequenceID == 0x1b) {
if ((flickerActor->flags & 4) != 0) {
if ((((int)(uint)local_850 < (int)((local_30[0]) - 6)) ||
((uint)local_30[1] + 6 < (uint)local_850)) || (local_72 != local_30[2])) {
local_42 = 8;
}
else {
local_42 = 0;
}
local_5c = 0;
if ((local_42 != 8) && ((local_850 < local_30[0] || (local_30[1] < local_850)))) {
local_5c = (short)((int)(((local_30[0]) + 0x17) * 0x80) / 0x2a) -
(short)((int)((uint)local_850 << 7) / 0x2a);
}
local_60 = local_850 << 7;
bombActor->x_pos = local_850 & 0x1ff;
local_5e = 0x2d00;
local_5a = (local_72 + 3) * 0x80;
bombActor->y_pos = 0x5a;
local_70 = 0x100;
bombActor->scale = 0x100;
_vm->playSound(10);
bombActor->priorityLayer = 3;
flickerActor->updateSequence(8);
currentState = 3;
}
}
else {
flickerActor->updateSequence(0x1b);
_vm->playSound(1);
}
break;
case 3:
local_60 = local_60 + local_5c;
if ((uint)local_72 * 2 + 0xb4 < (uint)local_70) {
local_5e = local_5e - local_5a;
local_5a = local_5a - local_28[((uint)local_72 - 1) * 3];
if (local_5a < 0) {
local_5a = 0;
}
}
else {
if ((int)(uint)local_70 < (int)((uint)local_72 * -4 + 0xba)) {
local_5e = local_5e + local_5a;
local_5a = local_5a + local_28[((uint)local_72 - 1) * 3 + 2];
}
else {
local_5a = 0;
}
}
bombActor->x_pos = local_60 >> 7;
bombActor->y_pos = local_5e >> 7;
local_70 = local_70 - 3;
bombActor->scale = local_70;
if (local_70 == 0x7f) {
if (((local_60 >> 7 < local_30[0]) || (local_30[1] < local_60 >> 7)) ||
(local_72 != local_30[2])) {
local_42 = 8;
}
else {
local_42 = 0;
}
if (local_42 == 8) {
if ((((local_72 == 1) && (local_60 >> 7 < 0x10e)) ||
((local_72 == 2 &&
((((0x7f < local_60 >> 7 && (local_60 >> 7 < 0xad)) ||
((0x30 < local_60 >> 7 && (local_60 >> 7 < 0x4a)))) ||
((0xf8 < local_60 >> 7 && (local_60 >> 7 < 0x10f)))))))) ||
((local_72 == 3 &&
(((0x3c < local_60 >> 7 && (local_60 >> 7 < 0x46)) ||
((0x101 < local_60 >> 7 && (local_60 >> 7 < 0x10a)))))))) {
bombActor->priorityLayer = 0;
dustActor->priorityLayer = 4;
dustActor->x_pos = bombActor->x_pos;
dustActor->y_pos = bombActor->y_pos;
dustActor->updateSequence(9);
currentState = 4;
}
}
else {
local_4e->field_c = 2;
local_4c = 0x3c;
bombActor->priorityLayer = 0;
currentState = 8;
}
}
if (local_70 < 0x7f) {
bombActor->priorityLayer = 2;
}
if ((0xc < local_70) && (local_70 < 0x41)) {
bombActor->priorityLayer = 0;
}
if ((short)local_70 < 2) {
currentState = 5;
}
break;
case 4:
pusherActor->updateSequence(9);
_vm->waitForFrames(0x3c);
pusherActor->updateSequence(0xb);
if (DAT_800633e6 == 0) {
_vm->_talk->loadText(DAT_8006393c,auStack2120, 1000);
_vm->_talk->displayDialogAroundPoint(auStack2120,(int)(short)(local_850 >> 3),0xc,0,1,DAT_8006393c);
DAT_800633e6 = 1;
}
else {
_vm->_talk->loadText(DAT_80063938, auStack2120, 1000);
_vm->_talk->displayDialogAroundPoint(auStack2120,(int)(short)(local_850 >> 3),0xc,0,1, DAT_80063938);
}
_vm->waitForFrames(10);
local_10 = 1;
currentState = 6;
break;
case 5:
currentState = 4;
break;
case 6:
currentState = 7;
break;
case 7:
break;
case 8:
bombActor->priorityLayer = 0;
pusherActor->updateSequence(0);
_vm->_dragonINIResource->getRecord(DAT_80063bd0 + -1)->actor->updateSequence(2);
_vm->waitForFrames(0x12);
_vm->_talk->loadText(DAT_80063e38, auStack2120, 1000);
_vm->_talk->displayDialogAroundPoint(auStack2120,0xf,2,0x501,0,DAT_80063e38);
// TODO callMaybeResetData();
_vm->_dragonINIResource->getRecord(DAT_80063bd0 + -1)->actor->updateSequence(3);
_vm->_dragonINIResource->getRecord(DAT_80063bd0 + -1)->actor->waitUntilFlag8And4AreSet();
pusherActor->updateSequence(7);
_vm->_talk->loadText(DAT_8006391c, auStack2120, 1000);
_vm->_talk->displayDialogAroundPoint(auStack2120, (int)(short)(local_850 >> 3),0xc,0,1,DAT_8006391c);
pusherActor->flags = pusherActor->flags | 0x1000;
local_10 = 2;
local_48 = 1;
currentState = 6;
}
}
else {
debug("undefined state!");
currentState = 1;
bombActor->priorityLayer = 0;
}
if ((local_10 == 0) && (currentState != 2)) {
if (!_vm->isLeftKeyPressed() || (local_850 < 0x37)) {
if (!_vm->isRightKeyPressed() || (0x107 < local_850)) {
if ((pusherActor->_sequenceID != local_66) &&
(((pusherActor->_sequenceID != 4 && (pusherActor->_sequenceID != 5))
&& (pusherActor->_sequenceID != 6)))) {
pusherActor->updateSequence((uint)local_66);
if (local_50 == 0) {
pusherActor->x_pos = flickerActor->x_pos + -0xe;
pusherActor->y_pos = flickerActor->y_pos + 7;
}
else {
pusherActor->x_pos = flickerActor->x_pos + 2;
pusherActor->y_pos = flickerActor->y_pos;
}
}
}
else {
local_50 = 1;
local_66 = 8;
if (pusherActor->_sequenceID != 2) {
pusherActor->updateSequence(2);
}
local_850 = local_850 + 2;
if (local_850 < 0x109) {
if (local_850 < 0x36) {
local_850 = 0x36;
}
}
else {
local_850 = 0x108;
}
if (local_62 == 0) {
local_62 = 0xb;
}
else {
local_62 = local_62 - 1;
}
flickerActor->x_pos = local_850;
wheelsActor->x_pos = local_850;
if ((uint)wheelsActor->_sequenceID != (uint)local_62 / 3 + 0x11) {
wheelsActor->updateSequence((uint)local_62 / 3 + 0x11);
}
pusherActor->x_pos = flickerActor->x_pos + 2;
pusherActor->y_pos = flickerActor->y_pos;
}
}
else {
local_50 = 0;
local_66 = (ushort)(currentState != 1);
if (pusherActor->_sequenceID != 3) {
pusherActor->updateSequence(3);
}
local_850 = local_850 - 2;
if (local_850 < 0x109) {
if (local_850 < 0x36) {
local_850 = 0x36;
}
}
else {
local_850 = 0x108;
}
local_62 = (short)((uint)local_62 + 1) +
(short)((int)((uint)local_62 + 1) / 6 >> 1) * -0xc;
flickerActor->x_pos = local_850;
wheelsActor->x_pos = local_850;
if ((uint)wheelsActor->_sequenceID != (uint)local_62 / 3 + 0x11) {
wheelsActor->updateSequence((uint)local_62 / 3 + 0x11);
}
pusherActor->x_pos = flickerActor->x_pos + -2;
pusherActor->y_pos = flickerActor->y_pos;
}
}
} while (local_10 == 0);
if ((local_10 == 2) || (0x117 < flickerActor->x_pos)) break;
flickerActor->x_pos = flickerActor->x_pos + 2;
if (pusherActor->_sequenceID != 2) {
pusherActor->updateSequence(2);
}
pusherActor->x_pos = flickerActor->x_pos + 2;
pusherActor->y_pos = flickerActor->y_pos;
wheelsActor->x_pos = wheelsActor->x_pos + 2;
if (local_62 == 0) {
local_62 = 0xb;
}
else {
local_62 = local_62 - 1;
}
if ((uint)wheelsActor->_sequenceID != (uint)local_62 / 3 + 0x11) {
wheelsActor->updateSequence((uint)local_62 / 3 + 0x11);
}
}
if (local_10 == 1) break;
if (local_10 == 2) {
_vm->_dragonINIResource->getRecord(DAT_80063a40 + -1)->field_14 = 2;
pusherActor->updateSequence(7);
_vm->waitForFrames(0x3c);
pusherActor->updateSequence(1);
_vm->waitForFrames(0x1e);
_vm->_dragonINIResource->getRecord(DAT_80063a40 + -1)->actor->clearFlag(ACTOR_FLAG_100);
LAB_8009157c:
// callMaybeResetData();
flickerActor->updateSequence(0x15);
local_46 = 0;
local_44 = 0;
if (local_10 == 2) {
// DisableVSyncEvent();
local_46 = pusherActor->x_pos;
local_44 = pusherActor->y_pos;
pusherActor->reset_maybe();
// EnableVSyncEvent();
}
else {
// DisableVSyncEvent();
dustActor->reset_maybe();
bombActor->reset_maybe();
wheelsActor->reset_maybe();
pusherActor->reset_maybe();
// EnableVSyncEvent();
}
_vm->_dragonINIResource->setFlickerRecord(local_78);
if (local_10 == 2) {
local_78->actor->x_pos = local_46;
local_78->actor->setFlag(ACTOR_FLAG_100);
local_78->actor->priorityLayer = 5;
}
else {
local_78->actor->clearFlag(ACTOR_FLAG_100);
local_78->actor->priorityLayer = 2;
}
_vm->clearFlags(ENGINE_FLAG_4000000);
_vm->setFlags(savedEngineFlags);
return;
}
}
_vm->_dragonINIResource->getRecord(DAT_80063a40 + -1)->actor->clearFlag(ACTOR_FLAG_100);
_vm->_dragonINIResource->getRecord(DAT_80063a40 + -1)->field_14 = 0;
goto LAB_8009157c;
}
} // End of namespace Dragons

View file

@ -0,0 +1,43 @@
/* 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.
*
* 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 2
* of the License, or (at your option) any later version.
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef DRAGONS_MINIGAME5_H
#define DRAGONS_MINIGAME5_H
#include "common/system.h"
namespace Dragons {
class DragonsEngine;
class Minigame5 {
private:
DragonsEngine *_vm;
uint16 DAT_800633e6;
public:
Minigame5(DragonsEngine *vm);
void run();
};
} // End of namespace Dragons
#endif //DRAGONS_MINIGAME5_H

View file

@ -22,6 +22,7 @@ MODULE_OBJS := \
minigame2.o \
minigame3.o \
minigame4.o \
minigame5.o \
saveload.o \
scene.o \
screen.o \

View file

@ -218,7 +218,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
for(int i=0;i < _dragonINIResource->totalRecords(); i++) {
DragonINI *ini = _dragonINIResource->getRecord(i);
if (ini->sceneId == sceneId) {
if (ini->sceneId == sceneIdStripped) {
if (ini->field_1a_flags_maybe & 1) {
Actor *actor = _actorManager->loadActor(ini->actorResourceId, ini->sequenceId, ini->x, ini->y, 0);

View file

@ -38,6 +38,7 @@
#include "dragons/minigame2.h"
#include "dragons/minigame3.h"
#include "dragons/minigame4.h"
#include "dragons/minigame5.h"
namespace Dragons {
@ -99,6 +100,8 @@ void SpecialOpcodes::initOpcodes() {
OPCODE(0x1a, spcActivatePizzaMakerActor);
OPCODE(0x1b, spcDeactivatePizzaMakerActor);
OPCODE(0x1c, spcPizzaMakerActorStopWorking);
OPCODE(0x1d, spcDragonArrivesAtTournament);
OPCODE(0x1e, spcDragonCatapultMiniGame);
OPCODE(0x21, spcSetEngineFlag0x20000);
OPCODE(0x22, spcClearEngineFlag0x20000);
@ -188,6 +191,7 @@ void SpecialOpcodes::initOpcodes() {
OPCODE(0x82, spc82CallResetDataMaybe);
OPCODE(0x83, spcStopScreenShakeUpdater);
OPCODE(0x87, spc87SetScene1To0x17);
OPCODE(0x88, spc88SetScene1To0x16);
OPCODE(0x89, spcSetUnkFlag2);
OPCODE(0x8a, spcClearUnkFlag2);
@ -377,6 +381,17 @@ void SpecialOpcodes::spcPizzaMakerActorStopWorking() {
pizzaMakerStopWorking();
}
void SpecialOpcodes::spcDragonArrivesAtTournament() {
_vm->_dragonINIResource->getRecord(0x123)->actor->setFlag(ACTOR_FLAG_400);
_vm->_dragonINIResource->getRecord(0x124)->actor->setFlag(ACTOR_FLAG_400);
_vm->_dragonINIResource->getRecord(0)->actor->setFlag(ACTOR_FLAG_400);
}
void SpecialOpcodes::spcDragonCatapultMiniGame() {
Minigame5 minigame5(_vm);
minigame5.run();
}
void SpecialOpcodes::spcSetEngineFlag0x20000() {
_vm->setFlags(ENGINE_FLAG_20000);
}
@ -786,6 +801,10 @@ void SpecialOpcodes::spcStopScreenShakeUpdater() {
// screenShakeOffset = 0;
}
void SpecialOpcodes::spc87SetScene1To0x17() {
_vm->_sceneId1 = 0x17;
}
void SpecialOpcodes::spc88SetScene1To0x16() {
_vm->_sceneId1 = 0x16;
}

View file

@ -93,6 +93,8 @@ protected:
void spcActivatePizzaMakerActor(); // 0x1a
void spcDeactivatePizzaMakerActor(); // 0x1b
void spcPizzaMakerActorStopWorking(); // 0x1c
void spcDragonArrivesAtTournament(); // 0x1d
void spcDragonCatapultMiniGame(); // 0x1e
void spcSetEngineFlag0x20000(); // 0x21
void spcClearEngineFlag0x20000(); // 0x22
@ -181,6 +183,7 @@ protected:
void spc82CallResetDataMaybe(); // 0x82
void spcStopScreenShakeUpdater(); // 0x83
void spc87SetScene1To0x17(); //0x87
void spc88SetScene1To0x16(); //0x88
void spcSetUnkFlag2(); // 0x89
void spcClearUnkFlag2(); //0x8a