Moved the code of MultiHexFix to Bugs.cpp, and removed it from ddraw.ini.

Optimized AnimationsAtOnceLimit.cpp using Crafty's method, which made the DLL about 10KB less in size.
This commit is contained in:
NovaRain
2016-02-18 15:25:56 +08:00
parent 7bd3bd4128
commit 56009e1634
5 changed files with 239 additions and 318 deletions
+1 -4
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.7a
;v3.7b
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -429,9 +429,6 @@ RemoveCriticalTimelimits=0
;Set to 1 to enable party members with level 6 protos to reach level 6
NPCStage6Fix=0
;Set to 1 to fix the problem with melee weapon equiped npcs being unable to attack multi-hex critters
MultiHexPathingFix=1
;Change the colour of the font used on the main menu for the Fallout/sfall version number
;It's the last byte ('3c' by default,) that picks the colour used. The first byte supplies additional flags
;MainMenuFontColour=0x0600003c
File diff suppressed because it is too large Load Diff
+33
View File
@@ -560,6 +560,32 @@ static void __declspec(naked) op_wield_obj_critter_adjust_ac_hook() {
}
}
static const DWORD MultiHexFix1End = 0x429024;
static const DWORD MultiHexFix2End = 0x429175;
static void __declspec(naked) MultiHexFix1() {
__asm {
xor ecx,ecx; // argument value for make_path_func: ecx=0 (unknown arg)
test byte ptr ds:[ebx+0x25],0x08; // is target multihex?
mov ebx,dword ptr ds:[ebx+0x4]; // argument value for make_path_func: target's tilenum (end_tile)
je end; // skip if not multihex
inc ebx; // otherwise, increase tilenum by 1
end:
jmp MultiHexFix1End; // call make_path_func
}
}
static void __declspec(naked) MultiHexFix2() {
__asm {
xor ecx,ecx; // argument for make_path_func: ecx=0 (unknown arg)
test byte ptr ds:[ebx+0x25],0x08; // is target multihex?
mov ebx,dword ptr ds:[ebx+0x4]; // argument for make_path_func: target's tilenum (end_tile)
je end; // skip if not multihex
inc ebx; // otherwise, increase tilenum by 1
end:
jmp MultiHexFix2End; // call make_path_func
}
}
//checks if an attacked object is a critter before attempting dodge animation
static void __declspec(naked) action_melee_hack() {
__asm {
@@ -839,6 +865,13 @@ void BugsInit()
dlogr(" Done", DL_INIT);
//}
//if(GetPrivateProfileIntA("Misc", "MultiHexPathingFix", 1, ini)) {
dlog("Applying MultiHex Pathing Fix.", DL_INIT);
MakeCall(0x42901F, &MultiHexFix1, true);
MakeCall(0x429170, &MultiHexFix2, true);
dlogr(" Done", DL_INIT);
//}
//if (GetPrivateProfileIntA("Misc", "DodgyDoorsFix", 1, ini)) {
dlog("Applying Dodgy Door Fix.", DL_INIT);
MakeCall(0x4113D6, &action_melee_hack, true);
-33
View File
@@ -627,32 +627,6 @@ static void __declspec(naked) NPCStage6Fix2() {
}
}
static const DWORD MultiHexFix1End = 0x429024;
static const DWORD MultiHexFix2End = 0x429175;
static void __declspec(naked) MultiHexFix1() {
__asm {
xor ecx,ecx; // argument value for make_path_func: ecx=0 (unknown arg)
test byte ptr ds:[ebx+0x25],0x08; // is target multihex?
mov ebx,dword ptr ds:[ebx+0x4]; // argument value for make_path_func: target's tilenum (end_tile)
je end; // skip if not multihex
inc ebx; // otherwise, increase tilenum by 1
end:
jmp MultiHexFix1End; // call make_path_func
}
}
static void __declspec(naked) MultiHexFix2() {
__asm {
xor ecx,ecx; // argument for make_path_func: ecx=0 (unknown arg)
test byte ptr ds:[ebx+0x25],0x08; // is target multihex?
mov ebx,dword ptr ds:[ebx+0x4]; // argument for make_path_func: target's tilenum (end_tile)
je end; // skip if not multihex
inc ebx; // otherwise, increase tilenum by 1
end:
jmp MultiHexFix2End; // call make_path_func
}
}
static const DWORD FastShotTraitFixEnd1 = 0x478E7F;
static const DWORD FastShotTraitFixEnd2 = 0x478E7B;
static void __declspec(naked) FastShotTraitFix() {
@@ -1450,13 +1424,6 @@ static void DllMain2() {
dlogr(" Done", DL_INIT);
}
if(GetPrivateProfileIntA("Misc", "MultiHexPathingFix", 1, ini)) {
dlog("Applying MultiHex Pathing Fix.", DL_INIT);
MakeCall(0x42901F, &MultiHexFix1, true);
MakeCall(0x429170, &MultiHexFix2, true);
dlogr(" Done", DL_INIT);
}
switch(GetPrivateProfileIntA("Misc", "FastShotFix", 1, ini)) {
case 1:
dlog("Applying Fast Shot Trait Fix.", DL_INIT);
+4 -4
View File
@@ -1,6 +1,6 @@
/*
* sfall
* Copyright (C) 2008 - 2015 The sfall team
* Copyright (C) 2008-2016 The sfall team
*
* 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
@@ -22,12 +22,12 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 7
#define VERSION_BUILD 1
#define VERSION_BUILD 2
#define VERSION_REV 0
#ifdef WIN2K
#define VERSION_STRING "3.7a win2k"
#define VERSION_STRING "3.7b win2k"
#else
#define VERSION_STRING "3.7a"
#define VERSION_STRING "3.7b"
#endif
#define CHECK_VAL (4)