DRAGONS: Fixed bug with sequence animations not reseting to the correct sequenceID. Fixed mem smashing bug with dialog menu

This commit is contained in:
Eric Fry 2019-08-22 12:09:09 +10:00 committed by Eugene Sandulenko
parent f65a55783d
commit 52c0f285a0
5 changed files with 36 additions and 9 deletions

View File

@ -69,7 +69,7 @@ Graphics::Surface *Font::render(uint16 *text, uint16 length, byte *palette) {
for (int i = 0; i < length; i++) {
byte *pixels = (byte *)surface->getPixels();
pixels += i * 8 * 2;
debug("char: %d size: %d %d", (text[i] - 0x20), _numChars, (30 + i));
// debug("char: %d size: %d %d", (text[i] - 0x20), _numChars, (30 + i));
byte *data = _pixels + mapChar(text[i]) * 64;
for (int y = 0; y < 8; y++) {
for (int x = 0; x < 8; x++) {

View File

@ -101,7 +101,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
((sceneIdStripped == 0x19 || ((sceneIdStripped == 0x34 || (sceneIdStripped == 0x1d)))
))) || (sceneIdStripped == 0x6)) {
// buf2048bytes = buf2048bytes + 0x1800;
error("0x8002f404"); //TODO do we need this logic?
// error("0x8002f404"); //TODO do we need this logic?
}
if (!(sceneId & 0x8000)) {

View File

@ -119,7 +119,8 @@ void ScriptOpcodes::initOpcodes() {
OPCODE(0x1A, opUnk1A);
OPCODE(0x1B, opUnk1B);
OPCODE(0x1C, opSetActorFlag0x1000);
OPCODE(0x1D, opUnk1DClearActorFlag0x400);
OPCODE(0x1E, opUnk1ESetActorFlag0x400);
OPCODE(0x1F, opPlayMusic);
OPCODE(0x20, opUnk20);
@ -672,8 +673,8 @@ void ScriptOpcodes::opUnkF(ScriptOpCall &scriptOpCall) {
if (field4 != field6) {
ini->actor->field_7c = field4;
ini->actor->updateSequence(field6 & 0x7fff);
}
ini->actor->updateSequence(field6 & 0x7fff);
}
}
@ -1103,6 +1104,30 @@ void ScriptOpcodes::opUnk1B(ScriptOpCall &scriptOpCall) {
}
}
void ScriptOpcodes::opUnk1DClearActorFlag0x400(ScriptOpCall &scriptOpCall) {
ARG_SKIP(2);
ARG_INT16(iniId);
if (scriptOpCall._field8 != 0) {
return;
}
DragonINI *ini = _vm->getINI(iniId - 1);
ini->actor->setFlag(ACTOR_FLAG_400);
}
void ScriptOpcodes::opUnk1ESetActorFlag0x400(ScriptOpCall &scriptOpCall) {
ARG_SKIP(2);
ARG_INT16(iniId);
if (scriptOpCall._field8 != 0) {
return;
}
DragonINI *ini = _vm->getINI(iniId - 1);
ini->actor->setFlag(ACTOR_FLAG_400);
}
void ScriptOpcodes::opSetActorFlag0x1000(ScriptOpCall &scriptOpCall) {
ARG_SKIP(2);
ARG_INT16(iniId);

View File

@ -109,6 +109,8 @@ protected:
void opUnk19(ScriptOpCall &scriptOpCall);
void opUnk1A(ScriptOpCall &scriptOpCall);
void opUnk1B(ScriptOpCall &scriptOpCall);
void opUnk1DClearActorFlag0x400(ScriptOpCall &scriptOpCall);
void opUnk1ESetActorFlag0x400(ScriptOpCall &scriptOpCall);
void opSetActorFlag0x1000(ScriptOpCall &scriptOpCall);
void opPlayMusic(ScriptOpCall &scriptOpCall);
void opUnk20(ScriptOpCall &scriptOpCall);

View File

@ -662,7 +662,7 @@ TalkDialogEntry *Talk::displayTalkDialogMenu() {
if ((talkDialogEntry->flags & 1) == 0) {
local_60 = local_60 + 1;
talkDialogEntry->yPosMaybe = '\0';
strcpy((char *)&local_390,(char *)talkDialogEntry);
strcpy((char *)&local_390,(char *)talkDialogEntry->dialogText);
UTF16ToUTF16Z(local_386, (uint16 *)(&talkDialogEntry->dialogText[10]));
DAT_80083104 = local_386;
if (*local_386 == 0x20) {
@ -752,10 +752,10 @@ TalkDialogEntry *Talk::displayTalkDialogMenu() {
if ((talkDialogEntry->flags & 1) == 0) {
sVar2 = local_50 + 1;
local_50 = sVar2;
UTF16ToUTF16Z(local_390, (uint16 *)(&talkDialogEntry->dialogText[10]));
DAT_80083104 = local_390;
if (*local_390 == 0x20) {
DAT_80083104 = &local_390[1];
UTF16ToUTF16Z(local_386, (uint16 *)(&talkDialogEntry->dialogText[10]));
DAT_80083104 = local_386;
if (local_386[0] == 0x20) {
DAT_80083104 = &local_386[1];
}
uVar4 = FindLastPositionOf5cChar(DAT_80083104);
uVar4 = FUN_80031c28(DAT_80083104,local_40,uVar4 & 0xffff,0x20);