Fixed loading savegame for "NPC turns into a container" bug fix

Added RadEffectsRemovalMsg option for radiation fixes.

Some code correction in Graphics.cpp.
This commit is contained in:
NovaRain
2020-03-31 21:54:49 +08:00
parent 1a17ac5ac8
commit 136404a723
4 changed files with 22 additions and 8 deletions
+5 -1
View File
@@ -528,7 +528,7 @@ BoostScriptDialogLimit=0
;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 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
;You can use line number 542/543 in proto.msg and line number 35 in inventry.msg to set up custom messages for item size
;You can use message number 542/543 in proto.msg and message number 35 in inventry.msg to set up custom messages for item size
CritterInvSizeLimitMode=0
CritterInvSizeLimit=100
@@ -654,6 +654,10 @@ DontTurnOffSneakIfYouRun=0
;Set to 0 to disable switching. (Default is 3)
UseWalkDistance=3
;Changes the message number in misc.msg used to display a message when you recover from radiation damage
;Default is 3003 ('You feel better' message line)
RadEffectsRemovalMsg=3003
;Set to 1 to display messages about radiation for the active geiger counter
ActiveGeigerMsgs=1
+5 -2
View File
@@ -1865,11 +1865,13 @@ fix:
}
}
static long radEffectsMsgNum = 3003; // "You feel better" for removing effects
static void __declspec(naked) process_rads_hook() {
__asm {
test ebp, ebp;
jg skip;
mov esi, 999; // msg number
mov esi, radEffectsMsgNum;
mov [esp + 0x20 - 0x20 + 4], esi;
skip:
jmp message_search_;
@@ -3114,6 +3116,7 @@ void BugFixesInit()
// Radiation fixes
MakeCall(0x42D6C3, process_rads_hack, 1); // prevents player's death if a stat is less than 1 when removing radiation effects
HookCall(0x42D67A, process_rads_hook); // fix for the same message being displayed when removing radiation effects
radEffectsMsgNum = GetConfigInt("Misc", "RadEffectsRemovalMsg", radEffectsMsgNum);
// Display messages about radiation for the active geiger counter
if (GetConfigInt("Misc", "ActiveGeigerMsgs", 1)) {
dlog("Applying active geiger counter messages patch.", DL_INIT);
@@ -3121,7 +3124,7 @@ void BugFixesInit()
SafeWrite8(0x42D444, 0x74);
dlogr(" Done", DL_INIT);
}
// Display a pop-up messages box about death from radiation
// Display a pop-up message box about death from radiation
HookCall(0x42D733, process_rads_hook_msg);
// Fix for AI not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
+7 -4
View File
@@ -77,6 +77,8 @@ static DWORD windowTop = 0;
static HWND window;
static DWORD windowStyle = WS_CAPTION | WS_BORDER | WS_MINIMIZEBOX;
static unsigned int windowData;
static DWORD ShaderVersion;
IDirect3D9* d3d9 = 0;
@@ -1221,9 +1223,9 @@ HRESULT _stdcall FakeDirectDrawCreate2(void*, IDirectDraw** b, void*) {
} else {
moveWindowKey[0] &= 0xFF;
}
int data = GetConfigInt("Graphics", "WindowData", 0);
windowLeft = data >> 16;
windowTop = data & 0xFFFF;
windowData = GetConfigInt("Graphics", "WindowData", 0);
windowLeft = windowData >> 16;
windowTop = windowData & 0xFFFF;
}
rcpres[0] = 1.0f / (float)gWidth;
@@ -1300,7 +1302,8 @@ void GraphicsInit() {
void GraphicsExit() {
if (GraphicsMode) {
if (GraphicsMode == 5) {
SetConfigInt("Graphics", "WindowData", windowTop | (windowLeft << 16));
unsigned int data = windowTop | (windowLeft << 16);
if (data != windowData) SetConfigInt("Graphics", "WindowData", data);
}
if (titlesBuffer) delete[] titlesBuffer;
CoUninitialize();
+5 -1
View File
@@ -111,11 +111,15 @@ skip:
static void __declspec(naked) queue_add_hack() {
__asm {
// engine code
mov [edx + 8], edi; // queue.object
mov [edx], esi; // queue.time
//
//---
cmp ds:[_loadingGame], 1; // don't change the object ID when loading a saved game (e.g. fix: NPC turns into a container)
je skip;
test edi, edi;
jnz fix;
skip:
retn;
fix:
mov eax, [edi + 0x64];