From a62e68ebc198a0ceec42cf7c36cf34a70201882b Mon Sep 17 00:00:00 2001 From: Alejo Date: Thu, 4 Jan 2024 00:41:17 -0300 Subject: [PATCH] add iteminfo --- reapi/src/hook_callback.h | 4 +++- reapi/src/member_list.cpp | 1 + reapi/src/member_list.h | 2 ++ reapi/src/natives/natives_hookchains.cpp | 2 ++ reapi/src/natives/natives_members.cpp | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 54e99540..2af83e88 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -22,7 +22,8 @@ enum AType : uint8 ATYPE_EVARS, ATYPE_BOOL, ATYPE_VECTOR, - ATYPE_TRACE + ATYPE_TRACE, + ATYPE_ITEMINFO, }; struct retval_t @@ -55,6 +56,7 @@ inline AType getApiType(bool) { return ATYPE_BOOL; } inline AType getApiType(Vector) { return ATYPE_VECTOR; } inline AType getApiType(ENTITYINIT) { return ATYPE_INTEGER; } inline AType getApiType(TraceResult*) { return ATYPE_TRACE; } +inline AType getApiType(ItemInfo*) { return ATYPE_ITEMINFO; } template inline AType getApiType(T *) { return ATYPE_INTEGER; } diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index 43b5c4d1..91aded09 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -117,6 +117,7 @@ inline MType getMemberType(SecondaryAtkState) { return MEMBER_INTEGER; } inline MType getMemberType(netadrtype_t) { return MEMBER_INTEGER; } inline MType getMemberType(TraceResult) { return MEMBER_TRACERESULT; } +inline MType getMemberType(ItemInfo) { return MEMBER_ITEMINFO; } inline MType getMemberType(short) { return MEMBER_SHORT; } inline MType getMemberType(unsigned short) { return MEMBER_SHORT; } diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index a3a379f1..98d149a0 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -26,6 +26,7 @@ enum MType MEMBER_PMTRACE, // struct pmtrace_t MEBMER_USERCMD, // struct usercmd_s MEMBER_TRACERESULT, // struct TraceResult + MEMBER_ITEMINFO, // struct ItemInfo }; struct memberlist_t @@ -122,6 +123,7 @@ struct member_t case MEMBER_PMTRACE: return "pmtrace"; case MEBMER_USERCMD: return "usercmd"; case MEMBER_TRACERESULT: return "TraceResult"; + case MEMBER_ITEMINFO: return "ItemInfo"; default: { static char string[16]; diff --git a/reapi/src/natives/natives_hookchains.cpp b/reapi/src/natives/natives_hookchains.cpp index 87c8c0f0..ab752bbb 100644 --- a/reapi/src/natives/natives_hookchains.cpp +++ b/reapi/src/natives/natives_hookchains.cpp @@ -325,6 +325,8 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params) case ATYPE_TRACE: **(TraceResult **)destAddr = *(TraceResult *)(*srcAddr); break; + case ATYPE_ITEMINFO: + **(ItemInfo **)destAddr = *(ItemInfo *)(*srcAddr); default: return FALSE; } diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index b80dbf42..90f89ec0 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -989,6 +989,7 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size case MEBMER_REBUYSTRUCT: case MEMBER_PMTRACE: case MEBMER_USERCMD: + case MEMBER_ITEMINFO: AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: member type %s (%s) is not supported", __FUNCTION__, member_t::getTypeString(member->type), member->name); return FALSE; default: break; @@ -1125,6 +1126,8 @@ cell get_member(AMX *amx, void* pdata, const member_t *member, cell* dest, size_ return (cell)get_member_direct(pdata, member->offset, element); case MEBMER_USERCMD: return (cell)get_member_direct(pdata, member->offset, element); + case MEMBER_ITEMINFO: + return (cell)get_member_direct(pdata, member->offset, element); default: break; }