@@ -57,6 +57,7 @@ DataHandler* g_dataHandler = nullptr;
57
57
BSAudioManager* g_audioManager = nullptr ;
58
58
GameTimeGlobals* g_gameTimeGlobals = nullptr ;
59
59
StatsMenu* g_statsMenu = nullptr ;
60
+ NiTPointerMap<TESForm>* g_mapAllForms = nullptr ;
60
61
UInt8 recalculateStatFilters = 0 ;
61
62
Sky** g_currentSky = nullptr ;
62
63
void (__thiscall* OriginalBipedModelUpdateWeapon)(ValidBip01Names*, TESObjectWEAP*, int ) = (void (__thiscall*)(ValidBip01Names*, TESObjectWEAP*, int )) 0x4AB400 ;
@@ -429,20 +430,35 @@ namespace hk_BarterHook {
429
430
430
431
431
432
template <uintptr_t a_addr>
432
- class hk_SleepOneInterCall {
433
+ class hk_QuestObjectiveIsDisplayedCall {
433
434
private:
434
- static inline uintptr_t hookCall = a_addr ;
435
+ static inline uintptr_t hPreviousAddressHook = 0 ;
435
436
public:
436
- static uintptr_t __cdecl hk_SleepOneInterCallHook () {
437
- auto res = CdeclCall<uintptr_t >(hookCall);
438
- Sleep (1 );
439
- return res;
440
- }
441
- hk_SleepOneInterCall () {
442
- uintptr_t hk_hookPoint = hookCall;
443
- hookCall = *(uintptr_t *)(hk_hookPoint + 1 );
444
- SafeWrite32 ((hk_hookPoint + 1 ), (uintptr_t )hk_SleepOneInterCallHook);
437
+ static uintptr_t __thiscall hookObjectiveDisplayed (BGSQuestObjective* pObjective) {
438
+ DWORD result = 0 ;
439
+ if (hPreviousAddressHook)
440
+ {
441
+ result = ThisStdCall<uintptr_t >(hPreviousAddressHook, pObjective);
442
+ }
443
+ if (result)
444
+ {
445
+ result = pObjective->status & BGSQuestObjective::eQObjStatus_displayed;
446
+ auto questObjectiveDisplayStr = pObjective->displayText .CStr ();
447
+ auto questDisplayStr = pObjective->quest ->GetFullName ()->name .CStr ();
448
+ if (!(questObjectiveDisplayStr && questDisplayStr && *questObjectiveDisplayStr && *questDisplayStr))
449
+ {
450
+ result = 0 ;
451
+ }
452
+ }
445
453
454
+ return result;
455
+ }
456
+ hk_QuestObjectiveIsDisplayedCall () {
457
+ if (*(char *)a_addr == 0xE9 ) // there's a jump here, so detour it
458
+ {
459
+ hPreviousAddressHook = GetRelJumpAddr (a_addr);
460
+ }
461
+ WriteRelJump ((a_addr), (uintptr_t )hookObjectiveDisplayed);
446
462
}
447
463
448
464
};
@@ -1637,6 +1653,11 @@ bool __cdecl IsCurrentFurnitureRefHook(TESObjectREFR* apRef, void* apComparedRef
1637
1653
return true ;
1638
1654
}
1639
1655
1656
+
1657
+
1658
+
1659
+
1660
+
1640
1661
void HandleFixes () {
1641
1662
// use available ammo in inventory instead of NULL when default ammo isn't present
1642
1663
WriteRelJump (0x70809E , (UInt32)InventoryAmmoHook);
@@ -1721,6 +1742,7 @@ void HandleFixes() {
1721
1742
NPCAccuracy::CreateHook ();
1722
1743
hk_DialogueTopicResponseManageHook::InitHooks ();
1723
1744
hk_EmotionOverrideUndo< 0x0617D59 >();
1745
+ hk_QuestObjectiveIsDisplayedCall<0x05A5E70 >();
1724
1746
}
1725
1747
1726
1748
void HandleIniOptions () {
0 commit comments