Fixed item planting for non-biped critters with the "barter" flag set

(BGforgeNet/Fallout2_Unofficial_Patch#95)

Updated version number.
This commit is contained in:
NovaRain
2022-04-04 21:34:01 +08:00
parent 73e1faae92
commit e7e6175084
5 changed files with 41 additions and 8 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
;sfall configuration settings ;sfall configuration settings
;v3.8.33.2 ;v3.8.34
[Main] [Main]
;Set to 1 if you want to use command line arguments to tell sfall to use another ini file ;Set to 1 if you want to use command line arguments to tell sfall to use another ini file
@@ -182,10 +182,10 @@ WindowScrollKey=0
ToggleItemHighlightsKey=42 ToggleItemHighlightsKey=42
;Set to 1 to also highlight containers ;Set to 1 to also highlight containers
HighlightContainers=1 HighlightContainers=0
;Set to 1 to also highlight lootable corpses ;Set to 1 to also highlight lootable corpses
HighlightCorpses=1 HighlightCorpses=0
;Set the color of outlines, available colors: ;Set the color of outlines, available colors:
;1 - glowing red ;1 - glowing red
@@ -4,10 +4,10 @@
Key=42 Key=42
; Set to 1 to also highlight containers ; Set to 1 to also highlight containers
Containers=1 Containers=0
; Set to 1 to also highlight lootable corpses ; Set to 1 to also highlight lootable corpses
Corpses=1 Corpses=0
; Set to 1 to only highlight objects in the player's line-of-sight ; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=0 CheckLOS=0
+7
View File
@@ -653,6 +653,13 @@ enum AttackSubType : long
GUNS = 4 GUNS = 4
}; };
enum BodyType : long
{
Biped = 0,
Quadruped = 1,
Robotic = 2
};
enum KillType : long enum KillType : long
{ {
KILL_TYPE_men = 0, KILL_TYPE_men = 0,
+26
View File
@@ -3128,6 +3128,29 @@ noObject:
} }
} }
// returns 0 (biped) if the critter has the "barter" flag set
static long __fastcall BarterOverrideBodyType(fo::GameObject* critter) {
return (fo::util::GetProto(critter->protoId)->critter.critterFlags & fo::CritterFlags::Barter)
? fo::BodyType::Biped
: fo::BodyType::Quadruped;
}
static void __declspec(naked) item_add_mult_hook_body_type() {
__asm {
call fo::funcoffs::critter_body_type_;
test eax, eax;
jnz notBiped;
retn;
notBiped:
push edx;
push ecx;
call BarterOverrideBodyType; // ecx - critter
pop ecx;
pop edx;
retn;
}
}
// Missing game initialization // Missing game initialization
void BugFixes::OnBeforeGameInit() { void BugFixes::OnBeforeGameInit() {
Initialization(); Initialization();
@@ -3967,6 +3990,9 @@ void BugFixes::init()
// Fix incorrect value of the limit number of floating messages // Fix incorrect value of the limit number of floating messages
SafeWrite8(0x4B039F, 20); // text_object_create_ (was 19) SafeWrite8(0x4B039F, 20); // text_object_create_ (was 19)
// Fix for being unable to plant items on non-biped critters with the "Barter" flag set
HookCall(0x477183, item_add_mult_hook_body_type);
} }
} }
+3 -3
View File
@@ -24,7 +24,7 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_BUILD 33 #define VERSION_BUILD 34
#define VERSION_REV 2 #define VERSION_REV 0
#define VERSION_STRING "3.8.33.2" #define VERSION_STRING "3.8.34"