2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-29 08:05:36 +03:00

Added new members from CSPlayer

This commit is contained in:
s1lentq 2016-06-15 17:47:03 +07:00
parent bc6383fce4
commit 559b6b88bd
7 changed files with 96 additions and 5 deletions

View File

@ -33,7 +33,8 @@ enum members_tables_e
mt_playermove, mt_playermove,
mt_movevars, mt_movevars,
mt_usercmd, mt_usercmd,
mt_pmtrace mt_pmtrace,
mt_csplayer
}; };
#define MAX_REGION_RANGE 1024 #define MAX_REGION_RANGE 1024

View File

@ -1184,7 +1184,31 @@ enum CSGameRules_Members
* Get params: get_member_game(member); * Get params: get_member_game(member);
* Set params: set_member_game(member, value); * Set params: set_member_game(member, value);
*/ */
m_bSkipSpawn m_bSkipSpawn,
/*
* Description: -
* Member type: bool
* Get params: get_member_game(member);
* Set params: set_member_game(member, value);
*/
m_bSkipShowMenu,
/*
* Description: -
* Member type: bool
* Get params: get_member_game(member);
* Set params: set_member_game(member, value);
*/
m_bNeededPlayers,
/*
* Description: -
* Member type: float
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flEscapeRatio
}; };
// CBaseEntity // CBaseEntity
@ -3835,3 +3859,23 @@ enum PMTrace
*/ */
pmt_hitgroup pmt_hitgroup
}; };
// CCSPlayer
enum CCSPlayer_Members
{
/*
* Description: -
* Member type: char [32]
* Get params: get_member(index, member, dest[], const lenght);
* Set params: set_member(index, member, const source[]);
*/
m_szModel = BEGIN_MEMBER_REGION(csplayer),
/*
* Description: -
* Member type: bool
* Get params: get_member(index, member);
* Set params: set_member(index, member, value);
*/
m_bForceShowMenu,
};

View File

@ -426,8 +426,12 @@ public:
virtual bool IsBombPlanted() = 0; virtual bool IsBombPlanted() = 0;
public: public:
bool ShouldSkipShowMenu() const { return m_bSkipShowMenu; }
void MarkShowMenuSkipped() { m_bSkipShowMenu = false; }
bool ShouldSkipSpawn() const { return m_bSkipSpawn; } bool ShouldSkipSpawn() const { return m_bSkipSpawn; }
void MarkSpawnSkipped() { m_bSkipSpawn = false; } void MarkSpawnSkipped() { m_bSkipSpawn = false; }
float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; } float TimeRemaining() { return m_iRoundTimeSecs - gpGlobals->time + m_fRoundCount; }
bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); } bool IsMatchStarted() { return (m_fTeamCount != 0.0f || m_fCareerRoundMenuTime != 0.0f || m_fCareerMatchMenuTime != 0.0f); }
@ -522,6 +526,7 @@ public:
bool m_bSkipSpawn; bool m_bSkipSpawn;
// custom // custom
bool m_bSkipShowMenu;
bool m_bNeededPlayers; bool m_bNeededPlayers;
float m_flEscapeRatio; float m_flEscapeRatio;
}; };

View File

@ -51,7 +51,7 @@ class CCSArmoury: public CCSEntity {};
class CCSPlayer: public CCSMonster { class CCSPlayer: public CCSMonster {
public: public:
CCSPlayer() CCSPlayer() : m_bForceShowMenu(false)
{ {
m_szModel[0] = '\0'; m_szModel[0] = '\0';
} }
@ -90,6 +90,7 @@ public:
CBasePlayer *BasePlayer() const; CBasePlayer *BasePlayer() const;
public: public:
char m_szModel[32]; char m_szModel[32];
bool m_bForceShowMenu;
}; };
class CAPI_Bot: public CCSPlayer {}; class CAPI_Bot: public CCSPlayer {};

View File

@ -13,6 +13,7 @@
#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_) #define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_)
#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_) #define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_)
#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_) #define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_)
#define CSPL_MEMBERS(mx) CLASS_MEMBERS(CCSPlayer, mx,)
inline MType getMemberType(float*) { return MEMBER_FLOAT; } inline MType getMemberType(float*) { return MEMBER_FLOAT; }
inline MType getMemberType(float) { return MEMBER_FLOAT; } inline MType getMemberType(float) { return MEMBER_FLOAT; }
@ -166,6 +167,9 @@ member_t memberlist_gamerules[] = {
GM_MEMBERS(m_iRoundWinDifference), GM_MEMBERS(m_iRoundWinDifference),
GM_MEMBERS(m_fCareerMatchMenuTime), GM_MEMBERS(m_fCareerMatchMenuTime),
GM_MEMBERS(m_bSkipSpawn), GM_MEMBERS(m_bSkipSpawn),
GM_MEMBERS(m_bSkipShowMenu),
GM_MEMBERS(m_bNeededPlayers),
GM_MEMBERS(m_flEscapeRatio),
}; };
member_t memberlist_base[] = { member_t memberlist_base[] = {
@ -659,6 +663,10 @@ member_t memberlist_pmtrace[] = {
PMTRACE_MEMBERS(hitgroup) PMTRACE_MEMBERS(hitgroup)
}; };
member_t memberlist_csplayer[] = {
CSPL_MEMBERS(m_szModel),
CSPL_MEMBERS(m_bForceShowMenu),
};
memberlist_t memberlist; memberlist_t memberlist;
@ -680,6 +688,7 @@ member_t *memberlist_t::operator[](size_t members) const
CASE(movevars) CASE(movevars)
CASE(usercmd) CASE(usercmd)
CASE(pmtrace) CASE(pmtrace)
CASE(csplayer)
} }
return nullptr; return nullptr;

View File

@ -49,7 +49,8 @@ struct memberlist_t
mt_playermove, mt_playermove,
mt_movevars, mt_movevars,
mt_usercmd, mt_usercmd,
mt_pmtrace mt_pmtrace,
mt_csplayer
}; };
}; };
@ -142,7 +143,10 @@ enum CSGameRules_Members
m_iCareerMatchWins, m_iCareerMatchWins,
m_iRoundWinDifference, m_iRoundWinDifference,
m_fCareerMatchMenuTime, m_fCareerMatchMenuTime,
m_bSkipSpawn m_bSkipSpawn,
m_bSkipShowMenu,
m_bNeededPlayers,
m_flEscapeRatio,
}; };
// CBaseEntity // CBaseEntity
@ -658,3 +662,10 @@ enum PMTrace
pmt_deltavelocity, pmt_deltavelocity,
pmt_hitgroup pmt_hitgroup
}; };
// CCSPlayer
enum CSPlayer_Members
{
m_szModel = BEGIN_MEMBER_REGION(csplayer),
m_bForceShowMenu,
};

View File

@ -20,6 +20,16 @@ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
cell* value = getAmxAddr(amx, params[arg_value]); cell* value = getAmxAddr(amx, params[arg_value]);
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0; size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
const auto table = memberlist_t::members_tables_e(params[arg_member] / MAX_REGION_RANGE);
if (table == memberlist_t::mt_csplayer) {
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(indexOfEdict(pEdict));
if (!pPlayer || !pPlayer->CSPlayer()) {
return FALSE;
}
return set_member(pPlayer->CSPlayer(), member, element, value);
}
return set_member(pEdict->pvPrivateData, member, element, value); return set_member(pEdict->pvPrivateData, member, element, value);
} }
@ -64,6 +74,16 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
element = 0; element = 0;
} }
const auto table = memberlist_t::members_tables_e(params[arg_member] / MAX_REGION_RANGE);
if (table == memberlist_t::mt_csplayer) {
CBasePlayer *pPlayer = g_ReGameFuncs->UTIL_PlayerByIndex(indexOfEdict(pEdict));
if (!pPlayer || !pPlayer->CSPlayer()) {
return FALSE;
}
return get_member(pPlayer->CSPlayer(), member, element, dest);
}
return get_member(pEdict->pvPrivateData, member, element, dest); return get_member(pEdict->pvPrivateData, member, element, dest);
} }