Excluded barter mode for ItemCounterDefaultMax

Minor edits to document/code.
This commit is contained in:
NovaRain
2019-07-10 10:47:25 +08:00
parent 8d1b959f20
commit 9a5ea216c4
4 changed files with 23 additions and 12 deletions
+2 -2
View File
@@ -633,7 +633,7 @@ StackEmptyWeapons=0
;If the amount of ammo boxes in the inventory is less than or equal to the reserve, only one box will be used
ReloadReserve=-1
;Set to 1 to change the counter in the 'Move Items' window to start at the maximum number of items
;Set to 1 to change the counter in the 'Move Items' window to start with maximum number except in the barter screen
ItemCounterDefaultMax=0
;Set to 1 to leave the music playing in dialogue with talking heads
@@ -688,7 +688,7 @@ PartyMemberExtraInfo=0
;that overrides First Aid/Doctor functions has very limited usefulness
PartyMemberSkillFix=0
;Set to 1 to skip loading game settings from a saved game, except for the game/combat difficulty settings
;Set to 1 to skip loading all game settings except the game/combat difficulty from a saved game
;Set to 2 to also skip loading the game/combat difficulty settings
SkipLoadingGameSettings=0
+8 -6
View File
@@ -65,12 +65,13 @@ static DDSURFACEDESC surfaceDesc;
static DDSURFACEDESC movieDesc;
static DWORD palette[256];
//static bool paletteInit = false;
static DWORD gWidth;
static DWORD gHeight;
static int ScrollWindowKey;
static bool windowIsInit;
static bool windowInit = false;
static DWORD windowLeft = 0;
static DWORD windowTop = 0;
@@ -305,7 +306,8 @@ static void Present() {
if (ScrollWindowKey != 0 && ((ScrollWindowKey > 0 && KeyDown((BYTE)ScrollWindowKey))
|| (ScrollWindowKey == -1 && (KeyDown(DIK_LCONTROL) || KeyDown(DIK_RCONTROL)))
|| (ScrollWindowKey == -2 && (KeyDown(DIK_LMENU) || KeyDown(DIK_RMENU)))
|| (ScrollWindowKey == -3 && (KeyDown(DIK_LSHIFT) || KeyDown(DIK_RSHIFT))))) {
|| (ScrollWindowKey == -3 && (KeyDown(DIK_LSHIFT) || KeyDown(DIK_RSHIFT)))))
{
int winx, winy;
GetMouse(&winx, &winy);
windowLeft += winx;
@@ -533,7 +535,7 @@ public:
HRESULT _stdcall Initialize(LPDIRECTDRAW, DWORD, LPPALETTEENTRY) { UNUSEDFUNCTION; }
HRESULT _stdcall SetEntries(DWORD, DWORD b, DWORD c, LPPALETTEENTRY destPal) {
if (!windowIsInit || c == 0 || b + c > 256) return DDERR_INVALIDPARAMS;
if (!windowInit || c == 0 || b + c > 256) return DDERR_INVALIDPARAMS;
CopyMemory(&palette[b], destPal, c * 4);
if (Graphics::GPUBlt) {
@@ -547,8 +549,8 @@ public:
} else {
for (DWORD i = b; i < b + c; i++) { // swap color R <> B
//palette[i]&=0x00ffffff;
BYTE clr = *(BYTE*)((DWORD)&palette[i]);
*(BYTE*)((DWORD)&palette[i]) = *(BYTE*)((DWORD)&palette[i] + 2);
BYTE clr = *(BYTE*)((DWORD)&palette[i]); // B
*(BYTE*)((DWORD)&palette[i]) = *(BYTE*)((DWORD)&palette[i] + 2); // R
*(BYTE*)((DWORD)&palette[i] + 2) = clr;
}
}
@@ -968,7 +970,7 @@ HRESULT _stdcall FakeDirectDrawCreate2_Init(void*, IDirectDraw** b, void*) {
static __declspec(naked) void game_init_hook() {
__asm {
mov windowIsInit, 1;
mov windowInit, 1;
jmp fo::funcoffs::palette_init_;
}
}
+11 -2
View File
@@ -22,7 +22,6 @@
#include "..\FalloutEngine\Fallout2.h"
#include "..\InputFuncs.h"
#include "PartyControl.h"
//#include "HookScripts.h"
#include "LoadGameHook.h"
#include "Inventory.h"
@@ -651,6 +650,16 @@ end:
}
}
static void __declspec(naked) do_move_timer_hack() {
__asm {
mov ebx, 1;
call GetLoopFlags;
test eax, BARTER;
cmovz ebx, ebp; // set max when not in barter
retn;
}
}
static int invenApCost, invenApCostDef;
static char invenApQPReduction;
static const DWORD inven_ap_cost_Ret = 0x46E812;
@@ -774,7 +783,7 @@ void Inventory::init() {
}
if (GetConfigInt("Misc", "ItemCounterDefaultMax", 0)) {
BlockCall(0x4768A3); // mov ebx, 1
MakeCall(0x4768A3, do_move_timer_hack);
}
// Move items from bag/backpack to the main inventory list by dragging them on the character portrait (similar to Fallout 1 behavior)
+2 -2
View File
@@ -143,7 +143,7 @@ notItem:
pop edx;
pop ecx;
end:
xor edi, edi; // fix: don't set "Used" flag for critter objects
xor edi, edi; // fix: don't set "Used" flag for non-item objects
retn;
}
}
@@ -208,7 +208,7 @@ void Objects::init() {
// Fix mapper bug by reassigning object IDs to critters (for unvisited maps)
MakeCall(0x482E6B, map_load_file_hack);
SafeWrite8(0x482E71, 0x85); // jz > jnz
// Additionally fix object IDs for queue events
// Additionally fix object IDs for queued events
MakeCall(0x4A25BA, queue_add_hack);
}