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

Merge pull request #10 from s1lentq/checkmeplz

Fixed context data for nested hookchain forwards, added member natives
This commit is contained in:
s1lentq 2016-06-08 05:45:26 +06:00
commit 848bb10907
19 changed files with 1528 additions and 252 deletions

View File

@ -107,6 +107,38 @@ native any:GetHookChainReturn(any:...);
*/
native SetHookChainArg(number, AType:type, any:...);
/*
* Check if the rehlds is available
*
* @return 1/0
*
*/
native bool:is_rehlds();
/*
* Check if the regamedll is available
*
* @return 1/0
*
*/
native bool:is_regamedll();
/*
* Check if the reunion is available
*
* @return 1/0
*
*/
native bool:has_reunion();
/*
* Check if the vtc is available
*
* @return 1/0
*
*/
native bool:has_vtc();
/*
* This is the callback from the module that gives major/minor versions for verifying compatibility reapi API versions
* If will be amxx plugin a failure, then you do need to upgrade to the latest version of the module reapi or do update files included for amxx plugins

View File

@ -18,6 +18,18 @@ native set_entvar(const index, const EntVars:var, any:...);
*/
native any:get_entvar(const index, const EntVars:var, any:...);
/*
* Sets usercmd data.
* Use the ucmd_* UCmd enum
*/
native set_ucmd(const ucmd, const UCmd:var, any:...);
/*
* Returns entvar data from an entity.
* Use the ucmd_* UCmd enum
*/
native any:get_ucmd(const ucmd, const UCmd:var, any:...);
/*
* Set name of the map
*

View File

@ -13,7 +13,7 @@ enum EngineFunc
* Description: -
* Params: (const recipients, const entity, const channel, const sample[], const volume, Float:attenuation, const fFlags, const pitch)
*/
RH_SV_StartSound = 0,
RH_SV_StartSound = 0 * 1024,
/*
* Description: -
@ -45,7 +45,7 @@ enum EntVars
* Get params: get_entvar(index, EntVars:var, dest[], const lenght);
* Set params: set_entvar(index, EntVars:var, const source[]);
*/
var_classname = 5120,
var_classname = 5 * 1024,
/*
* Description: -
@ -1024,4 +1024,101 @@ enum EntVars
var_euser4
};
enum UCmd
{
/*
* Description: -
* Member type: short
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_lerp_msec = 8 * 1024,
/*
* Description: -
* Member type: byte
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_msec,
/*
* Description: -
* Member type: vec3_t
* Get params: get_ucmd(const ucmd, UserCmd:var, Float:output[3]);
* Set params: set_ucmd(const ucmd, UserCmd:var, Float:dest[3]);
*/
ucmd_viewangles,
/*
* Description: -
* Member type: float
* Get params: Float:get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, Float:value);
*/
ucmd_forwardmove,
/*
* Description: -
* Member type: float
* Get params: Float:get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, Float:value);
*/
ucmd_sidemove,
/*
* Description: -
* Member type: float
* Get params: Float:get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, Float:value);
*/
ucmd_upmove,
/*
* Description: -
* Member type: byte
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_lightlevel,
/*
* Description: -
* Member type: unsigned short
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_buttons,
/*
* Description: -
* Member type: byte
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_impulse,
/*
* Description: -
* Member type: byte
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_weaponselect,
/*
* Description: -
* Member type: int
* Get params: get_ucmd(const ucmd, UserCmd:var);
* Set params: set_ucmd(const ucmd, UserCmd:var, value);
*/
ucmd_impact_index,
/*
* Description: -
* Member type: vec3_t
* Get params: get_ucmd(const ucmd, UserCmd:var, Float:output[3]);
* Set params: set_ucmd(const ucmd, UserCmd:var, Float:dest[3]);
*/
ucmd_impact_position
};

View File

@ -45,6 +45,24 @@ native set_member(const index, any:member, any:...);
*/
native any:get_member(const index, any:member, any:...);
/*
* Sets a playermove vars
*
* @param var The specified playermove, look at the enum's PlayerMove
*
* @return 1 on success.
*/
native set_pmove(const PlayerMove:var, any:...);
/*
* Returns a playermove vars
*
* @param var The specified playermove var, look at the enum's PlayerMove
*
* @return If an integer or boolean or one byte, array or everything else is passed via 3rd argument and more, look at argument list for specified mvar
*/
native any:get_pmove(const PlayerMove:var, any:...);
/*
* Sets a movevars value to an playermove
*
@ -63,6 +81,24 @@ native set_movevar(const MoveVars:var, any:...);
*/
native any:get_movevar(const MoveVars:var, any:...);
/*
* Sets a pmtrace vars
*
* @param var The specified mvar, look at the enum's PMTrace
*
* @return 1 on success.
*/
native set_pmtrace(const PMTrace:var, any:...);
/*
* Returns a pmtrace vars
*
* @param var The specified mvar, look at the enum's PMTrace
*
* @return If an integer or boolean or one byte, array or everything else is passed via 3rd argument and more, look at argument list for specified mvar
*/
native any:get_pmtrace(const PMTrace:var, any:...);
/*
* Assign the number of the player animations.
*

View File

@ -138,7 +138,7 @@ enum GamedllFunc
* Return type: int
* Params: (const pObserver)
*/
RG_GetForceCamera = 1024,
RG_GetForceCamera = 1 * 1024,
/*
* Description: -
@ -210,7 +210,7 @@ enum GamedllFunc_CBaseAnimating
* Description: -
* Params: (const this)
*/
RG_CBaseAnimating_ResetSequenceInfo = 2048,
RG_CBaseAnimating_ResetSequenceInfo = 2 * 1024,
// [...]
RG_CBaseAnimating_End
@ -222,7 +222,7 @@ enum GamedllFunc_CBasePlayer
* Description: -
* Params: (const this)
*/
RG_CBasePlayer_Spawn = 3072,
RG_CBasePlayer_Spawn = 3 * 1024,
/*
* Description: -
@ -414,7 +414,7 @@ enum GamedllFunc_CSGameRules
* Description: -
* Params: (const index, const weapon)
*/
RG_CSGameRules_FShouldSwitchWeapon = 4096,
RG_CSGameRules_FShouldSwitchWeapon = 4 * 1024,
/*
* Description: -
@ -555,7 +555,7 @@ enum CSGameRules_Members
* Get params: get_member_game(member);
* Set params: set_member_game(member, value);
*/
m_bFreezePeriod = 0,
m_bFreezePeriod = 0 * 1024,
/*
* Description: -
@ -1200,7 +1200,7 @@ enum CBaseEntity_Members
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
currentammo = 1024,
currentammo = 1 * 1024,
/*
* Description: -
@ -1404,7 +1404,7 @@ enum CBaseAnimating_Members
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flFrameRate = 2048,
m_flFrameRate = 2 * 1024,
/*
* Description: -
@ -1448,7 +1448,7 @@ enum CBaseMonster_Members
* Get params: get_member(index, member);
* Set params: set_member(index, member, value);
*/
m_Activity = 3072,
m_Activity = 3 * 1024,
/*
* Description: -
@ -1580,7 +1580,7 @@ enum CBasePlayer_Members
* Get params: get_member(index, member);
* Set params: set_member(index, member, value);
*/
random_seed = 4096,
random_seed = 4 * 1024,
/*
* Description: -
@ -3071,6 +3071,489 @@ enum CBasePlayer_Members
m_flLastCommandTime
};
enum PlayerMove
{
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_player_index = 6 * 1024,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_server,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_multiplayer,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(const MoveVars:var);
* Set params: set_pmove(const MoveVars:var, Float:value);
*/
pm_time,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(const MoveVars:var);
* Set params: set_pmove(const MoveVars:var, Float:value);
*/
pm_frametime,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_forward,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_right,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_up,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_origin,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_angles,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_oldangles,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_velocity,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_movedir,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_basevelocity,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_view_ofs,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_flDuckTime,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_bInDuck,
/*
* Description: -
* Member type: bool
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_flTimeStepSound,
/*
* Description: -
* Member type: bool
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_iStepLeft,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_flFallVelocity,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_punchangle,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_flSwimTime,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_flNextPrimaryAttack,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_effects,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_flags,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_usehull,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_gravity,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_friction,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_oldbuttons,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_waterjumptime,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_dead,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_deadflag,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_spectator,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_movetype,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_onground,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_waterlevel,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_watertype,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_oldwaterlevel,
/*
* Description: -
* Member type: char [256]
* Get params: get_member(const PlayerMove:var, dest[], const lenght);
* Set params: set_member(const PlayerMove:var, const source[]);
*/
pm_sztexturename,
/*
* Description: -
* Member type: char
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_chtexturetype,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_maxspeed,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_clientmaxspeed,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_iuser1,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_iuser2,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_iuser3,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_iuser4,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_fuser1,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_fuser2,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_fuser3,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, Float:value);
*/
pm_fuser4,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_vuser1,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_vuser2,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_vuser3,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmove(const PlayerMove:var, Float:output[3]);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3]);
*/
pm_vuser4,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_numphysent,
/*
* Description: -
* Member type: struct usercmd_s *
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_cmd,
/*
* Description: -
* Member type: int
* Get params: get_pmove(member);
* Set params: set_pmove(const PlayerMove:var, value);
*/
pm_numtouch,
/*
* Description: -
* Member type: char [256]
* Get params: get_member(const PlayerMove:var, dest[], const lenght);
* Set params: set_member(const PlayerMove:var, const source[]);
*/
pm_physinfo,
/*
* Description: -
* Member type: vec3_t [4]
* Get params: get_pmove(const PlayerMove:var, Float:output[3], index);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3], index);
*/
pm_player_mins,
/*
* Description: -
* Member type: vec3_t [4]
* Get params: get_pmove(const PlayerMove:var, Float:output[3], index);
* Set params: set_pmove(const PlayerMove:var, Float:dest[3], index);
*/
pm_player_maxs
};
enum MoveVars
{
/*
@ -3079,7 +3562,7 @@ enum MoveVars
* Get params: Float:get_mvar(const MoveVars:var);
* Set params: set_mvar(const MoveVars:var, Float:value);
*/
mv_gravity = 6144,
mv_gravity = 7 * 1024,
/*
* Description: -
@ -3281,3 +3764,78 @@ enum MoveVars
*/
mv_skyvec_z
};
enum PMTrace
{
/*
* Description: -
* Member type: qboolean
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_allsolid = 9 * 1024,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_startsolid,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_inopen,
/*
* Description: -
* Member type: qboolean
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_inwater,
/*
* Description: -
* Member type: float
* Get params: Float:get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, Float:value);
*/
pmt_fraction,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmtrace(const tr, const PMTrace:var, Float:output[3]);
* Set params: set_pmtrace(const tr, const PMTrace:var, Float:dest[3]);
*/
pmt_endpos,
/*
* Description: -
* Member type: int
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_ent,
/*
* Description: -
* Member type: vec3_t
* Get params: get_pmtrace(const tr, const PMTrace:var, Float:output[3]);
* Set params: set_pmtrace(const tr, const PMTrace:var, Float:dest[3]);
*/
pmt_deltavelocity,
/*
* Description: -
* Member type: int
* Get params: get_pmtrace(const tr, const PMTrace:var);
* Set params: set_pmtrace(const tr, const PMTrace:var, value);
*/
pmt_hitgroup
};

View File

@ -203,3 +203,103 @@ struct com_entvars
edict_t *euser3;
edict_t *euser4;
};
struct com_playermove
{
int player_index; // So we don't try to run the PM_CheckStuck nudging too quickly.
qboolean server; // For debugging, are we running physics code on server side?
qboolean multiplayer; // 1 == multiplayer server
float time; // realtime on host, for reckoning duck timing
float frametime; // Duration of this frame
vec3_t forward, right, up; // Vectors for angles
vec3_t origin; // Movement origin.
vec3_t angles; // Movement view angles.
vec3_t oldangles; // Angles before movement view angles were looked at.
vec3_t velocity; // Current movement direction.
vec3_t movedir; // For waterjumping, a forced forward velocity so we can fly over lip of ledge.
vec3_t basevelocity; // Velocity of the conveyor we are standing, e.g.
vec3_t view_ofs; // For ducking/dead
// Our eye position.
float flDuckTime; // Time we started duck
qboolean bInDuck; // In process of ducking or ducked already?
int flTimeStepSound; // For walking/falling
// Next time we can play a step sound
int iStepLeft;
float flFallVelocity;
vec3_t punchangle;
float flSwimTime;
float flNextPrimaryAttack;
int effects; // MUZZLE FLASH, e.g.
int flags; // FL_ONGROUND, FL_DUCKING, etc.
int usehull; // 0 = regular player hull, 1 = ducked player hull, 2 = point hull
float gravity; // Our current gravity and friction.
float friction;
int oldbuttons; // Buttons last usercmd
float waterjumptime; // Amount of time left in jumping out of water cycle.
qboolean dead; // Are we a dead player?
int deadflag;
int spectator; // Should we use spectator physics model?
int movetype; // Our movement type, NOCLIP, WALK, FLY
int onground; // -1 = in air, else pmove entity number
int waterlevel;
int watertype;
int oldwaterlevel;
char sztexturename[256];
char chtexturetype;
float maxspeed;
float clientmaxspeed;
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
int numphysent; // world state
// Number of entities to clip against.
physent_t physents[MAX_PHYSENTS];
int nummoveent; // Number of momvement entities (ladders)
physent_t moveents[MAX_MOVEENTS]; // just a list of ladders
int numvisent; // All things being rendered, for tracing against things you don't actually collide with
physent_t visents[MAX_PHYSENTS];
usercmd_t cmd; // input to run through physics.
int numtouch; // Trace results for objects we collided with.
pmtrace_t touchindex[MAX_PHYSENTS];
char physinfo[MAX_PHYSINFO_STRING]; // Physics info string
struct movevars_s *movevars;
Vector player_mins[4];
Vector player_maxs[4];
const char *(*PM_Info_ValueForKey)(const char *s, const char *key);
void(*PM_Particle)(float *origin, int color, float life, int zpos, int zvel);
int(*PM_TestPlayerPosition)(float *pos, pmtrace_t *ptrace);
void(*Con_NPrintf)(int idx, char *fmt, ...);
void(*Con_DPrintf)(char *fmt, ...);
void(*Con_Printf)(char *fmt, ...);
double(*Sys_FloatTime)();
void(*PM_StuckTouch)(int hitent, pmtrace_t *ptraceresult);
int(*PM_PointContents)(float *p, int *truecontents);
int(*PM_TruePointContents)(float *p);
int(*PM_HullPointContents)(struct hull_s *hull, int num, float *p);
pmtrace_t(*PM_PlayerTrace)(float *start, float *end, int traceFlags, int ignore_pe);
struct pmtrace_s *(*PM_TraceLine)(float *start, float *end, int flags, int usehulll, int ignore_pe);
int32(*RandomLong)(int32 lLow, int32 lHigh);
float(*RandomFloat)(float flLow, float flHigh);
int(*PM_GetModelType)(struct model_s *mod);
void(*PM_GetModelBounds)(struct model_s *mod, float *mins, float *maxs);
void *(*PM_HullForBsp)(physent_t *pe, float *offset);
float(*PM_TraceModel)(physent_t *pEnt, float *start, float *end, trace_t *trace);
int(*COM_FileSize)(char *filename);
byte *(*COM_LoadFile)(char *path, int usehunk, int *pLength);
void(*COM_FreeFile)(void *buffer);
char *(*memfgets)(byte *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize);
qboolean runfuncs;
void(*PM_PlaySound)(int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
const char *(*PM_TraceTexture)(int ground, float *vstart, float *vend);
void(*PM_PlaybackEventFull)(int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
};

View File

@ -274,10 +274,10 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer
{
auto original = [chain](int _pthis, int _iPlayerIndex, bool _bSameTeam)
{
return chain->callNext(_iPlayerIndex, _bSameTeam);
return indexOfEdict(chain->callNext(_iPlayerIndex, _bSameTeam)->pev);
};
return callForward<CBasePlayer *>(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam);
return getPrivate<CBasePlayer>(callForward<size_t>(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam));
}
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim)
@ -478,17 +478,17 @@ edict_t *CSGameRules_GetPlayerSpawnSpot(IReGameHook_CSGameRules_GetPlayerSpawnSp
{
auto original = [chain](int _pPlayer)
{
return chain->callNext(getPrivate<CBasePlayer>(_pPlayer));
return indexOfEdict(chain->callNext(getPrivate<CBasePlayer>(_pPlayer)));
};
return callForward<edict_t *>(RG_CSGameRules_GetPlayerSpawnSpot, original, indexOfEdict(pPlayer->pev));
return edictByIndexAmx(callForward<size_t>(RG_CSGameRules_GetPlayerSpawnSpot, original, indexOfEdict(pPlayer->pev)));
}
void CSGameRules_ClientUserInfoChanged(IReGameHook_CSGameRules_ClientUserInfoChanged *chain, CBasePlayer *pPlayer, char *infobuffer)
{
auto original = [chain](int _pPlayer, char *infobuffer)
auto original = [chain](int _pPlayer, char *_infobuffer)
{
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), infobuffer);
chain->callNext(getPrivate<CBasePlayer>(_pPlayer), _infobuffer);
};
callVoidForward(RG_CSGameRules_ClientUserInfoChanged, original, indexOfEdict(pPlayer->pev), infobuffer);

View File

@ -29,7 +29,7 @@ struct retval_t
{
char* _string;
float _float;
int _interger;
int _integer;
CBaseEntity* _classptr;
edict_t* _edict;
entvars_t* _pev;
@ -48,27 +48,53 @@ inline AType getApiType(entvars_t *) { return ATYPE_EVARS; }
template<typename T>
inline AType getApiType(T *) { return ATYPE_INTEGER; }
#define MAX_ARGS 12u
#define MAX_HOOKCHAIN_ARGS 12u
template<size_t current = 0>
void setupArgTypes(AType args_type[MAX_ARGS])
template<size_t current = 0, typename T1, typename T2, typename T3, typename T4, typename ...t_args>
void setupArgTypes(AType args_type[], T1, T2, T3, T4, t_args... args)
{
if (current + 4 <= MAX_HOOKCHAIN_ARGS)
*(uint32 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8) | (getApiType(T3()) << 16) | (getApiType(T4()) << 24);
if (sizeof...(args) && current + 4 < MAX_HOOKCHAIN_ARGS)
setupArgTypes<current + 4>(args_type, args...);
}
template<size_t current = 0, typename T, typename ...t_args>
void setupArgTypes(AType args_type[MAX_ARGS], T, t_args... args)
template<size_t current = 0, typename T1, typename T2, typename T3>
void setupArgTypes(AType args_type[], T1, T2, T3)
{
if (current + 3 <= MAX_HOOKCHAIN_ARGS)
*(uint32 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8) | (getApiType(T3()) << 16);
else
setupArgTypes(args_type, T1(), T2());
}
template<size_t current = 0, typename T1, typename T2>
void setupArgTypes(AType args_type[], T1, T2)
{
if (current + 2 <= MAX_HOOKCHAIN_ARGS)
*(uint16 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8);
else
setupArgTypes(args_type, T1());
}
template<size_t current = 0, typename T>
void setupArgTypes(AType args_type[], T)
{
if (current + 1 <= MAX_HOOKCHAIN_ARGS)
args_type[current] = getApiType(T());
if (sizeof...(args) && current + 1 < MAX_ARGS)
setupArgTypes<current + 1>(args_type, args...);
}
template<size_t current = 0>
void setupArgTypes(AType args_type[])
{
}
struct hookctx_t
{
template<typename ...t_args>
hookctx_t(size_t arg_count, t_args... args) : args_ptr()
hookctx_t(size_t arg_count, t_args... args)
{
args_count = min(arg_count, MAX_ARGS);
args_count = min(arg_count, MAX_HOOKCHAIN_ARGS);
setupArgTypes(args_type, args...);
}
@ -82,7 +108,7 @@ struct hookctx_t
retval_t retVal;
size_t args_count;
size_t args_ptr;
AType args_type[MAX_ARGS];
AType args_type[MAX_HOOKCHAIN_ARGS];
};
extern hookctx_t* g_hookCtx;
@ -90,10 +116,11 @@ extern hookctx_t* g_hookCtx;
template <typename original_t, typename ...f_args>
NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original, volatile f_args... args)
{
g_hookCtx->reset(size_t(&original) + sizeof(original));
auto hookCtx = g_hookCtx;
hookCtx->reset(size_t(&original) + sizeof(original));
int hc_state = HC_CONTINUE;
for (auto& fwd : hook->pre)
for (auto fwd : hook->pre)
{
if (fwd->GetState() == FSTATE_ENABLED)
{
@ -108,10 +135,13 @@ NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original
}
}
if (hc_state != HC_SUPERCEDE)
if (hc_state != HC_SUPERCEDE) {
g_hookCtx = nullptr;
original(args...);
g_hookCtx = hookCtx;
}
for (auto& fwd : hook->post) {
for (auto fwd : hook->post) {
if (fwd->GetState() == FSTATE_ENABLED) {
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
@ -124,9 +154,6 @@ NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original
template <typename original_t, typename ...f_args>
void callVoidForward(size_t func, original_t original, f_args... args)
{
#ifndef _WIN32
static
#endif
hookctx_t hookCtx(sizeof...(args), args...);
g_hookCtx = &hookCtx;
@ -137,26 +164,27 @@ void callVoidForward(size_t func, original_t original, f_args... args)
template <typename R, typename original_t, typename ...f_args>
NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volatile f_args... args)
{
auto& hookCtx = *g_hookCtx;
hookCtx.reset(size_t(&original) + sizeof(original), getApiType(R()));
auto hookCtx = g_hookCtx;
hookCtx->reset(size_t(&original) + sizeof(original), getApiType(R()));
int hc_state = HC_CONTINUE;
for (auto& fwd : hook->pre)
for (auto fwd : hook->pre)
{
if (fwd->GetState() == FSTATE_ENABLED)
{
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
if (ret == HC_CONTINUE)
if (ret == HC_CONTINUE) {
continue;
}
if (!hookCtx.retVal.set) {
if (!hookCtx->retVal.set) {
g_amxxapi.LogError(fwd->GetAmx(), AMX_ERR_CALLBACK, "%s", "can't suppress original function call without new return value set");
continue;
}
if (ret == HC_BREAK) {
return *(R *)&hookCtx.retVal._interger;
return *(R *)&hookCtx->retVal._integer;
}
if (ret > hc_state)
@ -166,12 +194,17 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
if (hc_state != HC_SUPERCEDE)
{
g_hookCtx = nullptr;
auto retVal = original(args...);
g_hookCtx = hookCtx;
if (hc_state != HC_OVERRIDE)
hookCtx.retVal._interger = *(int *)&retVal;
hookCtx->retVal._integer = *(int *)&retVal;
hookCtx->retVal.set = true;
}
for (auto& fwd : hook->post) {
for (auto fwd : hook->post) {
if (fwd->GetState() == FSTATE_ENABLED) {
auto ret = g_amxxapi.ExecuteForward(fwd->GetIndex(), args...);
@ -180,15 +213,12 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
}
}
return *(R *)&hookCtx.retVal._interger;
return *(R *)&hookCtx->retVal._integer;
}
template <typename R, typename original_t, typename ...f_args>
R callForward(size_t func, original_t original, f_args... args)
{
#ifndef _WIN32
static
#endif
hookctx_t hookCtx(sizeof...(args), args...);
g_hookCtx = &hookCtx;

View File

@ -47,7 +47,7 @@ struct regfunc
regfunc(R (*)(T, f_args...))
{
func = [](AMX *amx, const char *name) {
void(*func)(f_args...) = nullptr;
void (*func)(f_args...) = nullptr;
regargs<f_args...> args(func);
return g_amxxapi.RegisterSPForwardByName(amx, name, args);
};

View File

@ -1,6 +1,7 @@
#include "precompiled.h"
edict_t* g_pEdicts;
playermove_t* g_pMove;
char g_szMapName[32];
int gmsgSendAudio, gmsgTeamScore, gmsgStatusIcon, gmsgArmorType, gmsgTeamInfo, gmsgItemStatus;
@ -73,6 +74,7 @@ int DispatchSpawn(edict_t* pEntity)
g_szMapName[sizeof(g_szMapName) - 1] = '\0';
g_pEdicts = g_engfuncs.pfnPEntityOfEntIndex(0);
g_pMove = g_ReGameApi->GetPlayerMove();
g_pFunctionTable->pfnSpawn = nullptr;
RETURN_META_VALUE(MRES_IGNORED, 0);
}

View File

@ -2,6 +2,7 @@
extern char g_szMapName[32];
extern edict_t* g_pEdicts;
extern playermove_t* g_pMove;
extern int gmsgSendAudio;
extern int gmsgTeamScore;
extern int gmsgStatusIcon;

View File

@ -1,16 +1,18 @@
#include "precompiled.h"
#define CLASS_MEMBERS(cx, enmx, mx) ((!(enmx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (enmx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#enmx)
#define CLASS_MEMBERS_DEF(cx, mx) CLASS_MEMBERS(cx, mx, mx)
#define CLASS_MEMBERS(cx, mx, pref) ((!(pref##mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (pref##mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#mx)
#define GM_MEMBERS(mx) CLASS_MEMBERS_DEF(CHalfLifeMultiplay, mx)
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS_DEF(CVoiceGameMgr, mx)
#define BASE_MEMBERS(mx) CLASS_MEMBERS_DEF(CBaseEntity, mx)
#define ANIM_MEMBERS(mx) CLASS_MEMBERS_DEF(CBaseAnimating, mx)
#define MONST_MEMBERS(mx) CLASS_MEMBERS_DEF(CBaseMonster, mx)
#define PL_MEMBERS(mx) CLASS_MEMBERS_DEF(CBasePlayer, mx)
#define EVAR_MEMBERS(mx) CLASS_MEMBERS_DEF(com_entvars, mx)
#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, MoveVars::##mx, mx)
#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx,)
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CVoiceGameMgr, mx,)
#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx,)
#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx,)
#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx,)
#define PL_MEMBERS(mx) CLASS_MEMBERS(CBasePlayer, mx,)
#define EVAR_MEMBERS(mx) CLASS_MEMBERS(com_entvars, mx, var_)
#define PMOVE_MEMBERS(mx) CLASS_MEMBERS(com_playermove, mx, pm_)
#define MOVEVAR_MEMBERS(mx) CLASS_MEMBERS(movevars_t, mx, mv_)
#define UCMD_MEMBERS(mx) CLASS_MEMBERS(usercmd_s, mx, ucmd_)
#define PMTRACE_MEMBERS(mx) CLASS_MEMBERS(pmtrace_s, mx, pmt_)
inline MType getMemberType(float*) { return MEMBER_FLOAT; }
inline MType getMemberType(float) { return MEMBER_FLOAT; }
@ -55,6 +57,9 @@ inline MType getMemberType(bool) { return MEMBER_BOOL; }
inline MType getMemberType(CUnifiedSignals) { return MEMBER_SIGNALS; }
inline MType getMemberType(RebuyStruct) { return MEBMER_REBUYSTRUCT; }
inline MType getMemberType(pmtrace_t) { return MEMBER_PMTRACE; }
inline MType getMemberType(usercmd_s) { return MEBMER_USERCMD; }
template<typename T>
inline MType getMemberType(T) { static_assert(false, "Not implemented overload"); }
@ -534,6 +539,69 @@ member_t memberlist_entvars[] = {
EVAR_MEMBERS(euser4)
};
member_t memberlist_playermove[] = {
PMOVE_MEMBERS(player_index),
PMOVE_MEMBERS(server),
PMOVE_MEMBERS(multiplayer),
PMOVE_MEMBERS(time),
PMOVE_MEMBERS(frametime),
PMOVE_MEMBERS(forward),
PMOVE_MEMBERS(right),
PMOVE_MEMBERS(up),
PMOVE_MEMBERS(origin),
PMOVE_MEMBERS(angles),
PMOVE_MEMBERS(oldangles),
PMOVE_MEMBERS(velocity),
PMOVE_MEMBERS(movedir),
PMOVE_MEMBERS(basevelocity),
PMOVE_MEMBERS(view_ofs),
PMOVE_MEMBERS(flDuckTime),
PMOVE_MEMBERS(bInDuck),
PMOVE_MEMBERS(flTimeStepSound),
PMOVE_MEMBERS(iStepLeft),
PMOVE_MEMBERS(flFallVelocity),
PMOVE_MEMBERS(punchangle),
PMOVE_MEMBERS(flSwimTime),
PMOVE_MEMBERS(flNextPrimaryAttack),
PMOVE_MEMBERS(effects),
PMOVE_MEMBERS(flags),
PMOVE_MEMBERS(usehull),
PMOVE_MEMBERS(gravity),
PMOVE_MEMBERS(friction),
PMOVE_MEMBERS(oldbuttons),
PMOVE_MEMBERS(waterjumptime),
PMOVE_MEMBERS(dead),
PMOVE_MEMBERS(deadflag),
PMOVE_MEMBERS(spectator),
PMOVE_MEMBERS(movetype),
PMOVE_MEMBERS(onground),
PMOVE_MEMBERS(waterlevel),
PMOVE_MEMBERS(watertype),
PMOVE_MEMBERS(oldwaterlevel),
PMOVE_MEMBERS(sztexturename),
PMOVE_MEMBERS(chtexturetype),
PMOVE_MEMBERS(maxspeed),
PMOVE_MEMBERS(clientmaxspeed),
PMOVE_MEMBERS(iuser1),
PMOVE_MEMBERS(iuser2),
PMOVE_MEMBERS(iuser3),
PMOVE_MEMBERS(iuser4),
PMOVE_MEMBERS(fuser1),
PMOVE_MEMBERS(fuser2),
PMOVE_MEMBERS(fuser3),
PMOVE_MEMBERS(fuser4),
PMOVE_MEMBERS(vuser1),
PMOVE_MEMBERS(vuser2),
PMOVE_MEMBERS(vuser3),
PMOVE_MEMBERS(vuser4),
PMOVE_MEMBERS(numphysent),
PMOVE_MEMBERS(cmd),
PMOVE_MEMBERS(numtouch),
PMOVE_MEMBERS(physinfo),
PMOVE_MEMBERS(player_mins),
PMOVE_MEMBERS(player_maxs),
};
member_t memberlist_movevars[] = {
MOVEVAR_MEMBERS(gravity),
MOVEVAR_MEMBERS(stopspeed),
@ -563,6 +631,34 @@ member_t memberlist_movevars[] = {
MOVEVAR_MEMBERS(skyvec_z),
};
member_t memberlist_usercmd[] = {
UCMD_MEMBERS(lerp_msec),
UCMD_MEMBERS(msec),
UCMD_MEMBERS(viewangles),
UCMD_MEMBERS(forwardmove),
UCMD_MEMBERS(sidemove),
UCMD_MEMBERS(upmove),
UCMD_MEMBERS(lightlevel),
UCMD_MEMBERS(buttons),
UCMD_MEMBERS(impulse),
UCMD_MEMBERS(weaponselect),
UCMD_MEMBERS(impact_index),
UCMD_MEMBERS(impact_position)
};
member_t memberlist_pmtrace[] = {
PMTRACE_MEMBERS(allsolid),
PMTRACE_MEMBERS(startsolid),
PMTRACE_MEMBERS(inopen),
PMTRACE_MEMBERS(inwater),
PMTRACE_MEMBERS(fraction),
PMTRACE_MEMBERS(endpos),
PMTRACE_MEMBERS(ent),
PMTRACE_MEMBERS(deltavelocity),
PMTRACE_MEMBERS(hitgroup)
};
memberlist_t memberlist;
member_t *memberlist_t::operator[](size_t members) const
@ -579,7 +675,10 @@ member_t *memberlist_t::operator[](size_t members) const
CASE(basemonster)
CASE(player)
CASE(entvars)
CASE(playermove)
CASE(movevars)
CASE(usercmd)
CASE(pmtrace)
}
return nullptr;

View File

@ -22,6 +22,8 @@ enum MType
MEMBER_BOOL, // a bool
MEMBER_SIGNALS, // class CUnifiedSignals
MEBMER_REBUYSTRUCT, // struct RebuyStruct
MEMBER_PMTRACE, // struct pmtrace_t
MEBMER_USERCMD, // struct usercmd_s
};
struct member_t
@ -44,7 +46,10 @@ struct memberlist_t
ht_basemonster,
ht_player,
ht_entvars,
ht_movevars
ht_playermove,
ht_movevars,
ht_usercmd,
ht_pmtrace
};
};
@ -396,160 +401,259 @@ enum CBasePlayer_Members
// entvars
enum EntVars
{
classname = BEGIN_MEMBER_REGION(entvars),
globalname,
origin,
oldorigin,
velocity,
basevelocity,
clbasevelocity,
movedir,
angles,
avelocity,
punchangle,
v_angle,
endpos,
startpos,
impacttime,
starttime,
fixangle,
idealpitch,
pitch_speed,
ideal_yaw,
yaw_speed,
modelindex,
model,
viewmodel,
weaponmodel,
absmin,
absmax,
mins,
maxs,
size,
ltime,
nextthink,
movetype,
solid,
skin,
body,
effects,
gravity,
friction,
light_level,
sequence,
gaitsequence,
frame,
animtime,
framerate,
controller,
blending,
scale,
rendermode,
renderamt,
rendercolor,
renderfx,
health,
frags,
weapons,
takedamage,
deadflag,
view_ofs,
button,
impulse,
chain,
dmg_inflictor,
enemy,
aiment,
owner,
groundentity,
spawnflags,
flags,
colormap,
team,
max_health,
teleport_time,
armortype,
armorvalue,
waterlevel,
watertype,
target,
targetname,
netname,
message,
dmg_take,
dmg_save,
dmg,
dmgtime,
noise,
noise1,
noise2,
noise3,
speed,
air_finished,
pain_finished,
radsuit_finished,
pContainingEntity,
playerclass,
maxspeed,
fov,
weaponanim,
pushmsec,
bInDuck,
flTimeStepSound,
flSwimTime,
flDuckTime,
iStepLeft,
flFallVelocity,
gamestate,
oldbuttons,
groupinfo,
iuser1,
iuser2,
iuser3,
iuser4,
fuser1,
fuser2,
fuser3,
fuser4,
vuser1,
vuser2,
vuser3,
vuser4,
euser1,
euser2,
euser3,
euser4
var_classname = BEGIN_MEMBER_REGION(entvars),
var_globalname,
var_origin,
var_oldorigin,
var_velocity,
var_basevelocity,
var_clbasevelocity,
var_movedir,
var_angles,
var_avelocity,
var_punchangle,
var_v_angle,
var_endpos,
var_startpos,
var_impacttime,
var_starttime,
var_fixangle,
var_idealpitch,
var_pitch_speed,
var_ideal_yaw,
var_yaw_speed,
var_modelindex,
var_model,
var_viewmodel,
var_weaponmodel,
var_absmin,
var_absmax,
var_mins,
var_maxs,
var_size,
var_ltime,
var_nextthink,
var_movetype,
var_solid,
var_skin,
var_body,
var_effects,
var_gravity,
var_friction,
var_light_level,
var_sequence,
var_gaitsequence,
var_frame,
var_animtime,
var_framerate,
var_controller,
var_blending,
var_scale,
var_rendermode,
var_renderamt,
var_rendercolor,
var_renderfx,
var_health,
var_frags,
var_weapons,
var_takedamage,
var_deadflag,
var_view_ofs,
var_button,
var_impulse,
var_chain,
var_dmg_inflictor,
var_enemy,
var_aiment,
var_owner,
var_groundentity,
var_spawnflags,
var_flags,
var_colormap,
var_team,
var_max_health,
var_teleport_time,
var_armortype,
var_armorvalue,
var_waterlevel,
var_watertype,
var_target,
var_targetname,
var_netname,
var_message,
var_dmg_take,
var_dmg_save,
var_dmg,
var_dmgtime,
var_noise,
var_noise1,
var_noise2,
var_noise3,
var_speed,
var_air_finished,
var_pain_finished,
var_radsuit_finished,
var_pContainingEntity,
var_playerclass,
var_maxspeed,
var_fov,
var_weaponanim,
var_pushmsec,
var_bInDuck,
var_flTimeStepSound,
var_flSwimTime,
var_flDuckTime,
var_iStepLeft,
var_flFallVelocity,
var_gamestate,
var_oldbuttons,
var_groupinfo,
var_iuser1,
var_iuser2,
var_iuser3,
var_iuser4,
var_fuser1,
var_fuser2,
var_fuser3,
var_fuser4,
var_vuser1,
var_vuser2,
var_vuser3,
var_vuser4,
var_euser1,
var_euser2,
var_euser3,
var_euser4
};
// in order to avoid problems with redefinition enumerator
namespace MoveVars {
enum MoveVars
{
gravity = BEGIN_MEMBER_REGION(movevars),
stopspeed,
maxspeed,
spectatormaxspeed,
accelerate,
airaccelerate,
wateraccelerate,
friction,
edgefriction,
waterfriction,
entgravity,
bounce,
stepsize,
maxvelocity,
zmax,
waveHeight,
footsteps,
skyName,
rollangle,
rollspeed,
skycolor_r,
skycolor_g,
skycolor_b,
skyvec_x,
skyvec_y,
skyvec_z,
};
enum PlayerMove
{
pm_player_index = BEGIN_MEMBER_REGION(playermove),
pm_server,
pm_multiplayer,
pm_time,
pm_frametime,
pm_forward,
pm_right,
pm_up,
pm_origin,
pm_angles,
pm_oldangles,
pm_velocity,
pm_movedir,
pm_basevelocity,
pm_view_ofs,
pm_flDuckTime,
pm_bInDuck,
pm_flTimeStepSound,
pm_iStepLeft,
pm_flFallVelocity,
pm_punchangle,
pm_flSwimTime,
pm_flNextPrimaryAttack,
pm_effects,
pm_flags,
pm_usehull,
pm_gravity,
pm_friction,
pm_oldbuttons,
pm_waterjumptime,
pm_dead,
pm_deadflag,
pm_spectator,
pm_movetype,
pm_onground,
pm_waterlevel,
pm_watertype,
pm_oldwaterlevel,
pm_sztexturename,
pm_chtexturetype,
pm_maxspeed,
pm_clientmaxspeed,
pm_iuser1,
pm_iuser2,
pm_iuser3,
pm_iuser4,
pm_fuser1,
pm_fuser2,
pm_fuser3,
pm_fuser4,
pm_vuser1,
pm_vuser2,
pm_vuser3,
pm_vuser4,
pm_numphysent,
/* physent_t physents[MAX_PHYSENTS];
pm_nummoveent; // Number of momvement entities (ladders)
physent_t moveents[MAX_MOVEENTS]; // just a list of ladders
pm_numvisent; // All things being rendered, for tracing against things you don't actually collide with
physent_t visents[MAX_PHYSENTS];*/
pm_cmd,
pm_numtouch,
//pm_touchindex,
pm_physinfo,
//pm_movevars,
pm_player_mins,
pm_player_maxs
};
enum MoveVars
{
mv_gravity = BEGIN_MEMBER_REGION(movevars),
mv_stopspeed,
mv_maxspeed,
mv_spectatormaxspeed,
mv_accelerate,
mv_airaccelerate,
mv_wateraccelerate,
mv_friction,
mv_edgefriction,
mv_waterfriction,
mv_entgravity,
mv_bounce,
mv_stepsize,
mv_maxvelocity,
mv_zmax,
mv_waveHeight,
mv_footsteps,
mv_skyName,
mv_rollangle,
mv_rollspeed,
mv_skycolor_r,
mv_skycolor_g,
mv_skycolor_b,
mv_skyvec_x,
mv_skyvec_y,
mv_skyvec_z
};
enum UserCmd
{
ucmd_lerp_msec = BEGIN_MEMBER_REGION(usercmd),
ucmd_msec,
ucmd_viewangles,
ucmd_forwardmove,
ucmd_sidemove,
ucmd_upmove,
ucmd_lightlevel,
ucmd_buttons,
ucmd_impulse,
ucmd_weaponselect,
ucmd_impact_index,
ucmd_impact_position
};
enum PMTrace
{
pmt_allsolid = BEGIN_MEMBER_REGION(pmtrace),
pmt_startsolid,
pmt_inopen,
pmt_inwater,
pmt_fraction,
pmt_endpos,
pmt_ent,
pmt_deltavelocity,
pmt_hitgroup
};

View File

@ -27,7 +27,7 @@ cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
if (!hook->checkRequirements())
{
MF_LogError(amx, AMX_ERR_NATIVE, "%s: function (%s) is not available, %s required", __FUNCTION__, hook->func_name, hook->depend_name);
MF_LogError(amx, AMX_ERR_NATIVE, "%s: function (%s) is not available, %s required.", __FUNCTION__, hook->func_name, hook->depend_name);
return 0;
}
@ -130,7 +130,7 @@ cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
{
case ATYPE_INTEGER:
case ATYPE_FLOAT:
retVal._interger = *srcAddr;
retVal._integer = *srcAddr;
break;
case ATYPE_STRING:
@ -178,15 +178,21 @@ cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
}
enum args_e { arg_count, arg_value, arg_maxlen };
auto& retVal = g_hookCtx->retVal;
if (!retVal.set)
{
MF_LogError(amx, AMX_ERR_NATIVE, "%s: return value isn't set.", __FUNCTION__);
return FALSE;
}
cell* dstAddr = getAmxAddr(amx, params[arg_value]);
switch (retVal.type)
{
case ATYPE_INTEGER:
case ATYPE_FLOAT:
return retVal._interger;
return retVal._integer;
case ATYPE_STRING:
{
if (PARAMS_COUNT != 2)
@ -244,7 +250,7 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
return FALSE;
}
static char temp_strings[MAX_ARGS][1024];
static char temp_strings[MAX_HOOKCHAIN_ARGS][1024];
cell* srcAddr = getAmxAddr(amx, params[arg_value]);
size_t destAddr = g_hookCtx->args_ptr + number * sizeof(int);

View File

@ -210,6 +210,49 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params)
return get_member(&pEdict->v, member, element, dest);
}
// native set_pmove(const PlayerMove:pmove, any:...);
cell AMX_NATIVE_CALL set_pmove(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_var, arg_value, arg_elem };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* value = getAmxAddr(amx, params[arg_value]);
size_t element = (PARAMS_COUNT == 4) ? *getAmxAddr(amx, params[arg_elem]) : 0;
return set_member(g_pMove, member, element, value);
}
// native any:get_pmove(const PlayerMove:pmove, any:...);
cell AMX_NATIVE_CALL get_pmove(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_var, arg_2, arg_3 };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* dest;
size_t element;
if (PARAMS_COUNT == 3) {
dest = getAmxAddr(amx, params[arg_2]);
element = *getAmxAddr(amx, params[arg_3]);
}
else {
dest = nullptr;
element = 0;
}
return get_member(g_pMove, member, element, dest);
}
// native set_movevar(const MoveVars:var, any:...);
cell AMX_NATIVE_CALL set_movevar(AMX *amx, cell *params)
{
@ -221,14 +264,8 @@ cell AMX_NATIVE_CALL set_movevar(AMX *amx, cell *params)
return FALSE;
}
auto& movevars = g_ReGameApi->GetPlayerMove()->movevars;
if (movevars == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: movevars not initialized", __FUNCTION__);
return FALSE;
}
cell* value = getAmxAddr(amx, params[arg_value]);
return set_member(movevars, member, 0, value);
return set_member(g_pMove->movevars, member, 0, value);
}
// native any:get_movevar(const MoveVars:var, any:...);
@ -245,33 +282,116 @@ cell AMX_NATIVE_CALL get_movevar(AMX *amx, cell *params)
cell* dest;
size_t element;
auto& movevars = g_ReGameApi->GetPlayerMove()->movevars;
if (movevars == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: movevars not initialized", __FUNCTION__);
return FALSE;
}
if (PARAMS_COUNT == 3) {
dest = getAmxAddr(amx, params[arg_2]);
element = *getAmxAddr(amx, params[arg_3]);
}
else {
dest = nullptr;
element = 0;
}
return get_member(g_pMove->movevars, member, element, dest);
}
// native set_ucmd(const cmd, const UserCmd:var, any:...);
cell AMX_NATIVE_CALL set_ucmd(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_cmd, arg_var, arg_value };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* cmd = (cell *)params[arg_cmd];
cell* value = getAmxAddr(amx, params[arg_value]);
return set_member(cmd, member, 0, value);
}
// native any:get_ucmd(const cmd, const UserCmd:var, any:...);
cell AMX_NATIVE_CALL get_ucmd(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_cmd, arg_var, arg_3, arg_4 };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* dest;
size_t element;
if (PARAMS_COUNT == 3) {
dest = getAmxAddr(amx, params[arg_3]);
element = *getAmxAddr(amx, params[arg_4]);
}
else {
dest = (member->type != MEMBER_FLOAT) ? nullptr : getAmxAddr(amx, params[arg_3]);
element = 0;
}
return get_member(movevars, member, element, dest);
cell* cmd = (cell *)params[arg_cmd];
return get_member(cmd, member, element, dest);
}
AMX_NATIVE_INFO EntVars_Natives[] =
// native set_pmtrace(const tr, const PMTrace:var, any:...);
cell AMX_NATIVE_CALL set_pmtrace(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_tr, arg_var, arg_value };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* tr = (cell *)params[arg_tr];
cell* value = getAmxAddr(amx, params[arg_value]);
return set_member(tr, member, 0, value);
}
// native any:get_pmtrace(const tr, const PMTrace:var, any:...);
cell AMX_NATIVE_CALL get_pmtrace(AMX *amx, cell *params)
{
enum args_e { arg_count, arg_tr, arg_var, arg_3, arg_4 };
member_t *member = memberlist[params[arg_var]];
if (member == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE;
}
cell* dest;
size_t element;
if (PARAMS_COUNT == 3) {
dest = getAmxAddr(amx, params[arg_3]);
element = *getAmxAddr(amx, params[arg_4]);
}
else {
dest = nullptr;
element = 0;
}
cell* tr = (cell *)params[arg_tr];
return get_member(tr, member, element, dest);
}
AMX_NATIVE_INFO EngineVars_Natives[] =
{
{ "set_entvar", set_entvar },
{ "get_entvar", get_entvar },
{ "set_ucmd", set_ucmd },
{ "get_ucmd", get_ucmd },
{ nullptr, nullptr }
};
AMX_NATIVE_INFO Member_Natives[] =
AMX_NATIVE_INFO ReGameVars_Natives[] =
{
{ "set_member", set_member },
{ "get_member", get_member },
@ -279,18 +399,24 @@ AMX_NATIVE_INFO Member_Natives[] =
{ "set_member_game", set_member_game },
{ "get_member_game", get_member_game },
{ "set_pmove", set_pmove },
{ "get_pmove", get_pmove },
{ "set_movevar", set_movevar },
{ "get_movevar", get_movevar },
{ "set_pmtrace", set_pmtrace },
{ "get_pmtrace", get_pmtrace },
{ nullptr, nullptr }
};
void RegisterNatives_Members()
{
if (api_cfg.hasReGameDLL())
g_amxxapi.AddNatives(Member_Natives);
g_amxxapi.AddNatives(ReGameVars_Natives);
g_amxxapi.AddNatives(EntVars_Natives);
g_amxxapi.AddNatives(EngineVars_Natives);
}
BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value)
@ -321,8 +447,8 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
case MEMBER_VECTOR:
{
// native set_member(_index, any:_member, Float:_value[3], _elem);
Vector *pSource = (Vector *)value;
set_member<Vector>(pdata, member->offset, *pSource, element);
Vector& pSource = *(Vector *)value;
set_member<Vector>(pdata, member->offset, pSource, element);
return TRUE;
}
case MEMBER_STRING:
@ -349,7 +475,6 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
char *source = getAmxString(value);
string_t newstr = ALLOC_STRING(source);
set_member<string_t>(pdata, member->offset, newstr, element);
return TRUE;
}
case MEMBER_FLOAT:
@ -394,7 +519,11 @@ BOOL set_member(void* pdata, const member_t *member, size_t element, cell* value
case MEMBER_ENTITY:
case MEMBER_EVARS:
case MEBMER_REBUYSTRUCT:
case MEMBER_PMTRACE:
case MEBMER_USERCMD:
return FALSE;
default: break;
}
return FALSE;
@ -433,7 +562,7 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest)
if (!dest)
return 0;
*((Vector *)dest) = *(Vector *)get_member_direct<Vector>(pdata, member->offset, element);
*(Vector *)dest = get_member<Vector>(pdata, member->offset, element);
return 1;
}
case MEMBER_STRING:
@ -513,6 +642,15 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest)
case MEMBER_EVARS:
case MEBMER_REBUYSTRUCT:
return 0;
case MEMBER_PMTRACE:
// native any:get_member(_index, any:_member, element);
return (cell)get_member_direct<pmtrace_s>(pdata, member->offset, element);
case MEBMER_USERCMD:
// native any:get_member(_index, any:_member, element);
return (cell)get_member_direct<usercmd_s>(pdata, member->offset, element);
default: break;
}
return 0;
@ -530,6 +668,9 @@ bool isTypeReturnable(MType type)
case MEMBER_SHORT:
case MEMBER_BYTE:
case MEMBER_BOOL:
case MEMBER_EVARS:
case MEMBER_PMTRACE:
case MEBMER_USERCMD:
return true;
default:

View File

@ -1299,6 +1299,62 @@ AMX_NATIVE_INFO Misc_Natives_RH[] =
{ nullptr, nullptr }
};
/*
* Check if the rehlds is available
*
* @return 1/0
*
* native is_rehlds();
*/
cell AMX_NATIVE_CALL is_rehlds(AMX *amx, cell *params)
{
return (cell)api_cfg.hasReHLDS();
}
/*
* Check if the regamedll is available
*
* @return 1/0
*
* native is_regamedll();
*/
cell AMX_NATIVE_CALL is_regamedll(AMX *amx, cell *params)
{
return (cell)api_cfg.hasReGameDLL();
}
/*
* Check if the reunion is available
*
* @return 1/0
*
* native is_has_reunion();
*/
cell AMX_NATIVE_CALL has_reunion(AMX *amx, cell *params)
{
return (cell)api_cfg.hasReunion();
}
/*
* Check if the vtc is available
*
* @return 1/0
*
* native is_has_vtc();
*/
cell AMX_NATIVE_CALL has_vtc(AMX *amx, cell *params)
{
return (cell)api_cfg.hasVTC();
}
AMX_NATIVE_INFO Misc_Natives_Checks[] =
{
{ "is_rehlds", is_rehlds },
{ "is_regamedll", is_regamedll },
{ "has_reunion", has_reunion },
{ "has_vtc", has_vtc }
};
void RegisterNatives_Misc()
{
if (api_cfg.hasReGameDLL())
@ -1306,4 +1362,5 @@ void RegisterNatives_Misc()
if (api_cfg.hasReHLDS())
g_amxxapi.AddNatives(Misc_Natives_RH);
}
g_amxxapi.AddNatives(Misc_Natives_Checks);}

View File

@ -11,6 +11,7 @@
#include <extdll.h>
#include <cbase.h>
#include <pm_defs.h>
#include "com_progdefs.h"
#include "osdep.h" // win32 vsnprintf, etc

View File

@ -3,7 +3,7 @@
void __declspec(noreturn) UTIL_SysError(const char *fmt, ...)
{
va_list argptr;
static char string[8192];
char string[8192];
va_start(argptr, fmt);
vsnprintf(string, sizeof(string), fmt, argptr);
@ -32,7 +32,7 @@ char *UTIL_VarArgs(char *format, ...)
void UTIL_LogPrintf(const char *fmt, ...)
{
va_list argptr;
static char string[1024];
char string[1024];
va_start(argptr, fmt);
vsprintf(string, fmt, argptr);