Added inventory size check to "Take All" button (from Mr.Stalin)

Added additional note to CritterInvSizeLimitMode in ddraw.ini, and changed CritterInvSizeLimit to its default value.
This commit is contained in:
NovaRain
2018-09-20 09:41:49 +08:00
parent c6f3dbfcf6
commit 76ea3ed383
2 changed files with 25 additions and 2 deletions
+2 -2
View File
@@ -470,10 +470,10 @@ BoostScriptDialogLimit=0
;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check ;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check
;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters ;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters
;Only the PC uses CritterInvSizeLimit. Other critters will use the extra unused stat (STAT_unused = 10) ;Only the PC uses CritterInvSizeLimit. Other critters will use the unused stat (STAT_unused = 10) or have the size limit of 100 if the stat is not set
;Add 4 to the mode to limit the weight check to used items only ;Add 4 to the mode to limit the weight check to used items only
CritterInvSizeLimitMode=0 CritterInvSizeLimitMode=0
CritterInvSizeLimit=200 CritterInvSizeLimit=100
;Some bit flags to alter behaviour of the motion sensor ;Some bit flags to alter behaviour of the motion sensor
;1 - Allow sensor use on automap when motion sensor is in pack rather than hands ;1 - Allow sensor use on automap when motion sensor is in pack rather than hands
+23
View File
@@ -229,6 +229,26 @@ fail:
} }
} }
static __declspec(naked) void loot_container_hook_btn() {
__asm {
push ecx;
push edx; // source current weight
mov edx, eax; // target
mov ecx, [esp + 0x150 - 0x1C + 12]; // source
call BarterAttemptTransaction;
pop edx;
pop ecx;
test eax, eax;
jz fail;
mov eax, ebp; // target
jmp fo::funcoffs::item_total_weight_;
fail:
mov eax, edx;
inc eax; // weight + 1
retn;
}
}
static char InvenFmt[32]; static char InvenFmt[32];
static const char* InvenFmt1 = "%s %d/%d %s %d/%d"; static const char* InvenFmt1 = "%s %d/%d %s %d/%d";
static const char* InvenFmt2 = "%s %d/%d"; static const char* InvenFmt2 = "%s %d/%d";
@@ -765,6 +785,9 @@ void Inventory::init() {
SafeWrite16(0x474C7A, 0x9090); SafeWrite16(0x474C7A, 0x9090);
MakeJump(0x474C7C, barter_attempt_transaction_hack_pc); MakeJump(0x474C7C, barter_attempt_transaction_hack_pc);
// Check player's capacity when using "Take All" button
HookCall(0x47410B, loot_container_hook_btn);
// Display total weight/size on the inventory screen // Display total weight/size on the inventory screen
MakeJump(0x4725E0, display_stats_hack); MakeJump(0x4725E0, display_stats_hack);
SafeWrite32(0x4725FF, (DWORD)&InvenFmt); SafeWrite32(0x4725FF, (DWORD)&InvenFmt);