Fixed the return value of obj_is_open function

* for containers with only one frame (e.g. shelves)

Minor edits to the previous commit.
This commit is contained in:
NovaRain
2021-10-07 13:46:30 +08:00
parent 4137e6e977
commit dfcc698c7a
4 changed files with 33 additions and 2 deletions
+25
View File
@@ -3129,6 +3129,28 @@ noObject:
}
}
static void __declspec(naked) obj_is_open_hack() {
__asm {
je checkMaxFrames; // curr.frame == 0
setnz al;
and eax, 0xFF;
retn;
checkMaxFrames:
push edx;
sub esp, 4;
mov eax, [eax + artFid];
mov edx, esp;
call art_ptr_lock_;
call art_frame_max_frame_;
add esp, 4;
cmp eax, 1;
pop edx;
setle al; // 1 - is open if frames == 1
and eax, 0xFF;
retn;
}
}
void BugFixes_OnGameLoad() {
dudeIsAnimDeath = false;
combat_ai_reset();
@@ -3953,4 +3975,7 @@ void BugFixes_Init()
// Fix to prevent the main menu music from stopping when entering the load game screen
BlockCall(0x480B25);
// Fix the return value of obj_is_open function for containers with only one frame (e.g. shelves)
MakeJump(0x49D2E8, obj_is_open_hack, 3);
}
+6
View File
@@ -64,9 +64,15 @@ FUNC(art_alias_fid_, 0x4199D4)
FUNC(art_alias_num_, 0x419998)
FUNC(art_exists_, 0x4198C8) // eax - frameID, used for critter FIDs
FUNC(art_flush_, 0x41927C)
FUNC(art_frame_action_frame_, 0x419778)
FUNC(art_frame_data_, 0x419870)
FUNC(art_frame_fps_, 0x419760)
FUNC(art_frame_hot_, 0x419820)
FUNC(art_frame_length_, 0x4197B8)
FUNC(art_frame_max_frame_, 0x41978C)
FUNC(art_frame_offset_, 0x41984C)
FUNC(art_frame_width_, 0x4197A0)
FUNC(art_frame_width_length_, 0x4197D4)
FUNC(art_get_code_, 0x419314)
FUNC(art_get_name_, 0x419428)
FUNC(art_id_, 0x419C88)
+1 -1
View File
@@ -31,7 +31,7 @@ static bool femaleCheck = false; // flag for check female dialog file
static DWORD format;
static bool cutsPatch = false;
static char sfallRes[13] = "sfall.dat"; // sfall_XX.dat filename length
static char sfallRes[14] = "sfall.dat"; // for sfall_XX.dat filename
static std::vector<int> savPrototypes;
void PlayerGenderCutsRestore() {
+1 -1
View File
@@ -409,7 +409,7 @@ static bool __stdcall SearchAlternativeFormats(const char* path, PlayType playTy
hasFile = true;
break;
}
soundsFiles.insert(std::make_pair(std::move(pathFile), (hasFile) ? wPath : L""));
soundsFiles.insert(std::pair<const std::string, std::wstring>(std::move(pathFile), (hasFile) ? wPath : L""));
return PrePlaySoundFile(playType, wPath, hasFile);
}