Skip to content

Commit c2c8a7d

Browse files
committed
fix Isaac.GetBuiltInCallbackState
1 parent 6539760 commit c2c8a7d

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

libzhl/functions/Isaac.zhl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ static __cdecl void* Isaac::GetRoomEntities(void* unk);
1515
"558bec8b55??83fa49":
1616
static __cdecl void Isaac::SetBuiltInCallbackState(int callbackid, bool enabled);
1717

18+
"558bec8b4d??83f949":
19+
static __cdecl bool Isaac::GetBuiltInCallbackState(int callbackid);
20+
1821
"558becff75??ff15????????83c4045dc3??????????????????????????????558bec83e4c0":
1922
static __cdecl void Isaac::free(void *block);
2023

repentogon/LuaInterfaces/CustomCallbacks.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ HOOK_STATIC(Isaac,SetBuiltInCallbackState, (const int callbackid, bool enable)->
3939
}
4040
}
4141

42+
HOOK_STATIC(Isaac, GetBuiltInCallbackState, (const int callbackid)-> bool, __cdecl) {
43+
size_t id = static_cast<size_t>(callbackid);
44+
45+
if (id < VanillaCallbackState.size())
46+
{
47+
return super(id);
48+
}
49+
50+
id = id - 1000;
51+
if (id < CallbackState.size())
52+
{
53+
return CallbackState.test(id);
54+
}
55+
return false;
56+
}
57+
4258
// MC_POST_TRIGGER_COLLECTIBLE_ADDED (1053)
4359
// (Runs for normal items, wisps, and innate collectibles)
4460
void CustomCallbacks::TriggerCollectibleAdded(Entity_Player& player, int collectibleID, bool firsttime, bool wispOrInnate) {

0 commit comments

Comments
 (0)