Integrated fixes and minor features from Crafty's mod

1. bug fix for SpeedInterfaceCounterAnims
2. new Sharpshooter fix proposed by Slider2k
3. added StackEmptyWeapons
4. updated Credits
This commit is contained in:
NovaRain
2015-07-13 10:22:48 +08:00
parent 2f2d2e112f
commit 1b3017c470
6 changed files with 94 additions and 11 deletions
+3 -1
View File
@@ -539,8 +539,10 @@ DialogPanelAnimDelay=33
ControlCombat=0
;ControlCombatPIDList=62,89,97,107,160,161
;Set to 1 to stack empty identical weapons, no matter what type of ammo was loaded before
StackEmptyWeapons=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Debugging]
;extra sfall configuration settings that can be used by the modders version of sfall
;No options in this section have any effect in the standard version of sfall
+5 -1
View File
@@ -27,7 +27,7 @@ static DWORD CreditsLine=0;
static const char* ExtraLines[]={
"#SFALL " VERSION_STRING,
"",
"sfall is free software, licenced under the GPL",
"sfall is free software, licensed under the GPL",
"Copyright 2008-2015 The sfall team",
"",
"@Author",
@@ -49,6 +49,8 @@ static const char* ExtraLines[]={
"JimTheDinosaur",
"phobos2077",
"Tehnokrat",
"Crafty",
"Slider2k",
"",
"@Additional thanks to",
"Nirran",
@@ -56,6 +58,8 @@ static const char* ExtraLines[]={
"MIB88",
"Rain man",
"Continuum",
"Fakeman",
"Drobovik",
"Anyone who has used sfall in their own mods",
"The bug reporters and feature requesters",
""
+52
View File
@@ -566,6 +566,53 @@ skip:
}
}
static void __declspec(naked) SetDefaultAmmo() {
__asm {
push eax
push ebx
push edx
xchg eax, edx
mov ebx, eax
call item_get_type_
cmp eax, 3 // is it item_type_weapon?
jne end // no
cmp dword ptr [ebx+0x3C], 0 // is there any ammo in the weapon?
jne end // yes
sub esp, 4
mov edx, esp
mov eax, [ebx+0x64] // eax = weapon pid
call proto_ptr_
mov edx, [esp]
mov eax, [edx+0x5C] // eax = default ammo pid
mov [ebx+0x40], eax // set current ammo proto
add esp, 4
end:
pop edx
pop ebx
pop eax
retn
}
}
static const DWORD inven_action_cursor_hook_End = 0x4736CB;
static void __declspec(naked) inven_action_cursor_hook() {
__asm {
mov edx, [esp+0x1C]
call SetDefaultAmmo
cmp dword ptr [esp+0x18], 0
jmp inven_action_cursor_hook_End
}
}
static const DWORD item_add_force_ = 0x4772B8;
static void __declspec(naked) item_add_mult_hook() {
__asm {
call SetDefaultAmmo
call item_add_force_
retn
}
}
void InventoryInit() {
mode=GetPrivateProfileInt("Misc", "CritterInvSizeLimitMode", 0, ini);
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
@@ -612,6 +659,11 @@ void InventoryInit() {
}
ReloadWeaponKey = GetPrivateProfileInt("Input", "ReloadWeaponKey", 0, ini);
if(GetPrivateProfileIntA("Misc", "StackEmptyWeapons", 0, ini)) {
MakeCall(0x4736C6, &inven_action_cursor_hook, true);
HookCall(0x4772AA, &item_add_mult_hook);
}
}
void InventoryReset() {
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
+6
View File
@@ -98,6 +98,12 @@
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Trace|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Win2K|Win32'">false</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Win2K_Trace|Win32'">false</GenerateManifest>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\DXSDK\Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\DXSDK\Lib\x86;$(LibraryPath)</LibraryPath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\DXSDK\Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\DXSDK\Lib\x86;$(LibraryPath)</LibraryPath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Trace|Win32'">C:\DXSDK\Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Trace|Win32'">C:\DXSDK\Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
+25 -6
View File
@@ -581,7 +581,11 @@ static void __declspec(naked) IntfaceRotateNumbersHook() {
inc ebx;
jmp end;
greater:
mov ebx, ecx;
cmp ebx, 0;
jg skip;
xor ebx, ebx;
inc ebx;
skip:
dec ebx;
end:
jmp IntfaceRotateNumbersRet;
@@ -828,6 +832,24 @@ static void __declspec(naked) objCanSeeObj_ShootThru_Fix() {//(EAX *objStruct, E
}
}
static const DWORD stat_level_ = 0x4AEF48;
static const DWORD perk_level_ = 0x496B78;
static void __declspec(naked) SharpshooterFix() {
__asm {
call stat_level_ // Perception
cmp edi, ds:[0x6610B8] // _obj_dude
jne end
xchg ecx, eax
mov eax, edi // _obj_dude
mov edx, 14 // PERK_sharpshooter
call perk_level_ // Sharpshooter
shl eax, 1
add eax, ecx
end:
retn
}
}
static void DllMain2() {
//SafeWrite8(0x4B15E8, 0xc3);
@@ -1016,11 +1038,8 @@ static void DllMain2() {
//if(GetPrivateProfileIntA("Misc", "SharpshooterFix", 0, ini)) {
dlog("Applying sharpshooter patch.", DL_INIT);
if(*((DWORD*)0x00424533) != 0xc003C003) {
SafeWrite32(0x00424533, 0xc003c003);
SafeWrite32(0x00424537, 0x04244429);
SafeWrite32(0x0042453b, 0x90909090);
}
HookCall(0x4244AB, &SharpshooterFix);
SafeWrite8(0x424527, 0xEB);
dlogr(" Done", DL_INIT);
//}
+3 -3
View File
@@ -22,12 +22,12 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 6
#define VERSION_BUILD 0
#define VERSION_BUILD 3
#define VERSION_REV 0
#ifdef WIN2K
#define VERSION_STRING "3.6 win2k"
#define VERSION_STRING "3.6d win2k"
#else
#define VERSION_STRING "3.6"
#define VERSION_STRING "3.6d"
#endif
#define CHECK_VAL (4)