Skip to content

Commit

Permalink
Implemented CCSEntity members to export in AMXX headers (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
dystopm authored Nov 26, 2023
1 parent 4c1932c commit 5c38e6f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion reapi/extra/amxmodx/scripting/include/reapi.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ enum members_tables_e
mt_mapinfo,
mt_csplayerweapon,
mt_gib,
mt_netadr
mt_netadr,
mt_csentity
};

#define ReAPIFunc {EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc, GamedllFunc_CBasePlayerWeapon, GamedllFunc_CGib, GamedllFunc_CBaseEntity, GamedllFunc_CBotManager}
Expand Down
22 changes: 22 additions & 0 deletions reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6342,3 +6342,25 @@ enum CGib_Members
*/
m_Gib_lifeTime,
};

/**
* CCSEntity API Members
*/
enum CCSEntity_Members
{
/*
* Description: Penetration level of the damage caused by the inflictor
* Member type: unsigned char
* Get params: get_member(index, member);
* Set params: set_member(index, member, value);
*/
m_ucDmgPenetrationLevel = BEGIN_MEMBER_REGION(csplayerweapon),

/*
* Description: Cached inflictor passed inside TakeDamage to retrieve in Killed
* Member type: entvars_t *
* Get params: get_member(index, member);
* Set params: set_member(index, member, value);
*/
m_pevLastInflictor,
};
3 changes: 2 additions & 1 deletion reapi/include/cssdk/dlls/API/CSEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ class CCSEntity
public:
CBaseEntity *m_pContainingEntity;
unsigned char m_ucDmgPenetrationLevel; // penetration level of the damage caused by the inflictor
entvars_t *m_pevLastInflictor;

private:
#if defined(_MSC_VER)
#pragma region reserve_data_Region
#endif
char CCSEntity_Reserve[0x3FFF];
char CCSEntity_Reserve[0x3FF7];

virtual void func_reserve1() {};
virtual void func_reserve2() {};
Expand Down
7 changes: 7 additions & 0 deletions reapi/src/member_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#define MAPINFO_MEMBERS(mx) CLASS_MEMBERS_PREF(CMapInfo, mx, m_MapInfo_##mx, m_)
#define CSPLWPN_MEMBERS(mx) CLASS_MEMBERS_PREF(CCSPlayerWeapon, mx, m_Weapon_##mx, m_)
#define GIB_MEMBERS(mx) CLASS_MEMBERS_PREF(CGib, mx, m_Gib_##mx, m_)
#define CSENT_MEMBERS(mx) CLASS_MEMBERS(CCSEntity, mx, mx)

inline MType getMemberType(float*) { return MEMBER_FLOAT; }
inline MType getMemberType(float) { return MEMBER_FLOAT; }
Expand Down Expand Up @@ -1064,6 +1065,11 @@ member_t memberlist_netadr[] = {
NETADR_MEMBERS(port)
};

member_t memberlist_csentity[] = {
CSENT_MEMBERS(m_ucDmgPenetrationLevel),
CSENT_MEMBERS(m_pevLastInflictor),
};

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // #ifdef __GNUC__
Expand Down Expand Up @@ -1128,6 +1134,7 @@ member_t *memberlist_t::operator[](size_t members) const
CASE(csplayerweapon)
CASE(gib)
CASE(netadr)
CASE(csentity)
}

#undef CASE
Expand Down
9 changes: 8 additions & 1 deletion reapi/src/member_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ struct memberlist_t
mt_mapinfo,
mt_csplayerweapon,
mt_gib,
mt_netadr
mt_netadr,
mt_csentity
};
};

Expand Down Expand Up @@ -1088,3 +1089,9 @@ enum CGib_Members
m_Gib_material,
m_Gib_lifeTime,
};

enum CSEntity_Members
{
m_ucDmgPenetrationLevel = BEGIN_MEMBER_REGION(csentity),
m_pevLastInflictor,
};
1 change: 1 addition & 0 deletions reapi/src/natives/natives_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ void *get_pdata_custom(CBaseEntity *pEntity, cell member)
{
const auto table = memberlist_t::members_tables_e(member / MAX_REGION_RANGE);
switch (table) {
case memberlist_t::mt_csentity:
case memberlist_t::mt_csplayer:
case memberlist_t::mt_csplayerweapon: {
if (unlikely(pEntity->m_pEntity == nullptr)) {
Expand Down

0 comments on commit 5c38e6f

Please sign in to comment.