From e289c2c6798ead370f8a5a014bf425f315df41b6 Mon Sep 17 00:00:00 2001 From: JustAnotherGuid <46401660+JustAnotherGuid@users.noreply.github.com> Date: Sat, 6 Apr 2019 19:57:02 +0200 Subject: [PATCH] ForceQuests [bin exact] (#838) --- Source/quests.cpp | 46 +++++++++++++++++++++++----------------------- Source/quests.h | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/quests.cpp b/Source/quests.cpp index 2aaaeed84..e9b6b0a4b 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -210,33 +210,33 @@ LABEL_29: // 679660: using guessed type char gbMaxPlayers; // 69BE90: using guessed type int qline; -BOOLEAN __cdecl ForceQuests() +BOOL __cdecl ForceQuests() { - QuestStruct *v0; // eax - int v1; // esi - int v2; // edi - int v3; // edx + int i, j, qx, qy, ql; - if (gbMaxPlayers != 1) - return 0; - v0 = (QuestStruct *)((char *)quests + 12); - while (v0 == (QuestStruct *)&quests[15]._qslvl || currlevel != v0[-1]._qslvl || !v0->_qlevel) { - LABEL_10: - ++v0; - if ((signed int)v0 >= (signed int)&quests[MAXQUESTS]._qslvl) /* fix */ - return 0; + if (gbMaxPlayers != 1) { + return FALSE; } - v1 = *(_DWORD *)&v0[-1]._qvar2; - v2 = v0[-1]._qlog; - v3 = 0; - while (v1 + questxoff[v3] != cursmx || v2 + questyoff[v3] != cursmy) { - if (++v3 >= 7) - goto LABEL_10; + + for (i = 0; i < MAXQUESTS; i++) { + + if (i != QTYPE_VB && currlevel == quests[i]._qlevel && quests[i]._qslvl != 0) { + ql = quests[quests[i]._qidx]._qslvl - 1; + qx = quests[i]._qtx; + qy = quests[i]._qty; + + for (j = 0; j < 7; j++) { + if (qx + questxoff[j] == cursmx && qy + questyoff[j] == cursmy) { + sprintf(infostr, "To %s", questtrigstr[ql]); + cursmx = qx; + cursmy = qy; + return TRUE; + } + } + } } - sprintf(infostr, "To %s", questtrigstr[(unsigned char)quests[(unsigned char)v0->_qtype]._qslvl - 1]); - cursmx = v1; - cursmy = v2; - return 1; + + return FALSE; } // 679660: using guessed type char gbMaxPlayers; diff --git a/Source/quests.h b/Source/quests.h index 0dbbdb22c..d043dae9e 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -18,7 +18,7 @@ extern int ReturnLvl; // idb void __cdecl InitQuests(); void __cdecl CheckQuests(); -BOOLEAN __cdecl ForceQuests(); +BOOL __cdecl ForceQuests(); BOOL __fastcall QuestStatus(int i); void __fastcall CheckQuestKill(int m, BOOL sendmsg); void __cdecl DrawButcher();