Skip to content

Commit

Permalink
add iteminfo
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeperezz16 committed Jan 4, 2024
1 parent 3c4d219 commit a62e68e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ enum AType : uint8
ATYPE_EVARS,
ATYPE_BOOL,
ATYPE_VECTOR,
ATYPE_TRACE
ATYPE_TRACE,
ATYPE_ITEMINFO,
};

struct retval_t
Expand Down Expand Up @@ -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<typename T>
inline AType getApiType(T *) { return ATYPE_INTEGER; }
Expand Down
1 change: 1 addition & 0 deletions reapi/src/member_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 2 additions & 0 deletions reapi/src/member_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions reapi/src/natives/natives_hookchains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions reapi/src/natives/natives_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1125,6 +1126,8 @@ cell get_member(AMX *amx, void* pdata, const member_t *member, cell* dest, size_
return (cell)get_member_direct<pmtrace_s>(pdata, member->offset, element);
case MEBMER_USERCMD:
return (cell)get_member_direct<usercmd_s>(pdata, member->offset, element);
case MEMBER_ITEMINFO:
return (cell)get_member_direct<ItemInfo>(pdata, member->offset, element);
default: break;
}

Expand Down

0 comments on commit a62e68e

Please sign in to comment.