Set the valid range of NPCsTryToSpendExtraAP to be non-0 positive values, and removed a redundant/unused constant.

Changed the valid range of EncounterTableSize.
This commit is contained in:
phobos2077
2017-02-21 01:46:02 +07:00
parent 99d6ff332f
commit 214e405c32
+5 -3
View File
@@ -267,7 +267,6 @@ really_end:
} }
} }
static const DWORD RetryCombatRet = 0x422BA9;
static DWORD RetryCombatLastAP; static DWORD RetryCombatLastAP;
static DWORD RetryCombatMinAP; static DWORD RetryCombatMinAP;
static void __declspec(naked) RetryCombatHook() { static void __declspec(naked) RetryCombatHook() {
@@ -586,7 +585,7 @@ static void DllMain2() {
} }
RetryCombatMinAP = GetPrivateProfileIntA("Misc", "NPCsTryToSpendExtraAP", 0, ini); RetryCombatMinAP = GetPrivateProfileIntA("Misc", "NPCsTryToSpendExtraAP", 0, ini);
if (RetryCombatMinAP) { if (RetryCombatMinAP > 0) {
dlog("Applying retry combat patch.", DL_INIT); dlog("Applying retry combat patch.", DL_INIT);
HookCall(0x422B94, &RetryCombatHook); HookCall(0x422B94, &RetryCombatHook);
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
@@ -698,8 +697,10 @@ static void DllMain2() {
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
} }
if (tmp = GetPrivateProfileIntA("Misc", "EncounterTableSize", 0, ini) && tmp <= 127) { tmp = GetPrivateProfileIntA("Misc", "EncounterTableSize", 0, ini);
if (tmp > 40 && tmp <= 127) {
dlog("Applying EncounterTableSize patch.", DL_INIT); dlog("Applying EncounterTableSize patch.", DL_INIT);
SafeWrite8(0x4BDB17, (BYTE)tmp);
DWORD nsize = (tmp + 1) * 180 + 0x50; DWORD nsize = (tmp + 1) * 180 + 0x50;
for (int i = 0; i < sizeof(EncounterTableSize) / 4; i++) { for (int i = 0; i < sizeof(EncounterTableSize) / 4; i++) {
SafeWrite32(EncounterTableSize[i], nsize); SafeWrite32(EncounterTableSize[i], nsize);
@@ -708,6 +709,7 @@ static void DllMain2() {
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
} }
dlog("Initing main menu patches.", DL_INIT); dlog("Initing main menu patches.", DL_INIT);
MainMenuInit(); MainMenuInit();
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);