From de33bb6a1d6225eed7089b26219e81cf6fa98da9 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Sun, 30 Apr 2006 07:37:31 +0000 Subject: [PATCH] Oh goodness, let the bugs begin... 1) New hookable GameDLL funcs: UpdateClientData, AddToFullPack, CmdStart, CmdEnd (at28754) 2) New GameDLL funcs that can be called via dllfunc: UpdateClientData, AddToFullPack, CmdStart, CmdEnd 3) New natives to read/write special data structures associated with the above GameDLL funcs: get/set_cd (ClientData), get/set_es (EntityState), get/set_uc (UserCmd) --- plugins/include/fakemeta.inc | 21 ++++ plugins/include/fakemeta_const.inc | 176 +++++++++++++++++++++++++++- plugins/include/fakemeta_stocks.inc | 14 ++- 3 files changed, 206 insertions(+), 5 deletions(-) diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index ab1f532f..3760823f 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -85,6 +85,27 @@ native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...); // keyvalues structure rather than changing the internal engine strings. native set_kvd(kvd_handle, KeyValueData:member, {Float,_}:...); +// These functions are used with the clientdata data structure (FM_UpdateClientData) +// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length +// Set: Use anything +// Use 0 for cd_handle to specify the global clientdata handle +native get_cd(cd_handle, ClientData:member, {Float,_}:...); +native set_cd(cd_handle, ClientData:member, {Float,_}:...); + +// These functions are used with the entity_state data structure (FM_AddToFullPack) +// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array +// Set: Use anything +// Use 0 for es_handle to specify the global entity_state handle +native get_es(es_handle, EntityState:member, {Float,_}:...); +native set_es(es_handle, EntityState:member, {Float,_}:...); + +// These functions are used with the usercmd data structure (FM_CmdStart) +// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector +// Set: Use anything +// Use 0 for uc_handle to specify the global usercmd handle +native get_uc(uc_handle, UserCmd:member, {Float,_}:...); +native set_uc(uc_handle, UserCmd:member, {Float,_}:...); + //NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset //In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half. //Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic. diff --git a/plugins/include/fakemeta_const.inc b/plugins/include/fakemeta_const.inc index 162d28f2..d5e4d373 100755 --- a/plugins/include/fakemeta_const.inc +++ b/plugins/include/fakemeta_const.inc @@ -158,9 +158,16 @@ enum // Create baselines for certain "unplaced" items. DLLFunc_CreateInstancedBaseline, // void ) ( void ); DLLFunc_pfnAllowLagCompensation, // int ) ( void ); - // I know this does not fit with DLLFUNC(), but I dont want another native just for it. + // I know this does not fit with DLLFUNC(), but I don't want another native just for it. MetaFunc_CallGameEntity, // bool ) (plid_t plid, const char *entStr,entvars_t *pev); - DLLFunc_ClientUserInfoChanged // void ) (idplayer) + DLLFunc_ClientUserInfoChanged, // void ) (idplayer) + // You can pass in 0 for global cd handle or another cd handle here + DLLFunc_UpdateClientData, // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd); + // You can pass in 0 for global entity state handle or another entity state handle here + DLLFunc_AddToFullPack, // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet); + // You can pass in 0 for global usercmd handle or another usercmd handle here + DLLFunc_CmdStart, // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed); + DLLFunc_CmdEnd // void ) (const edict_t *player); }; enum { @@ -504,7 +511,12 @@ enum { FM_ShouldCollide, //LATE ADDITIONS (v1.71) - FM_ClientUserInfoChanged //passes id only + FM_ClientUserInfoChanged, //passes id only + + FM_UpdateClientData, + FM_AddToFullPack, + FM_CmdStart, + FM_CmdEnd }; enum TraceResult @@ -529,3 +541,161 @@ enum KeyValueData KV_fHandled }; +enum ClientData +{ + CD_Origin, + CD_Velocity, + CD_ViewModel, + CD_PunchAngle, + CD_Flags, + CD_WaterLevel, + CD_WaterType, + CD_ViewOfs, + CD_Health, + CD_bInDuck, + CD_Weapons, + CD_flTimeStepSound, + CD_flDuckTime, + CD_flSwimTime, + CD_WaterJumpTime, + CD_MaxSpeed, + CD_FOV, + CD_WeaponAnim, + CD_ID, + CD_AmmoShells, + CD_AmmoNails, + CD_AmmoCells, + CD_AmmoRockets, + CD_flNextAttack, + CD_tfState, + CD_PushMsec, + CD_DeadFlag, + CD_PhysInfo, + CD_iUser1, + CD_iUser2, + CD_iUser3, + CD_iUser4, + CD_fUser1, + CD_fUser2, + CD_fUser3, + CD_fUser4, + CD_vUser1, + CD_vUser2, + CD_vUser3, + CD_vUser4 +}; + +enum EntityState +{ + // Fields which are filled in by routines outside of delta compression + ES_EntityType, + // Index into cl_entities array for this entity + ES_Number, + ES_MsgTime, + + // Message number last time the player/entity state was updated + ES_MessageNum, + + // Fields which can be transitted and reconstructed over the network stream + ES_Origin, + ES_Angles, + + ES_ModelIndex, + ES_Sequence, + ES_Frame, + ES_ColorMap, + ES_Skin, + ES_Solid, + ES_Effects, + ES_Scale, + ES_eFlags, + + // Render information + ES_RenderMode, + ES_RenderAmt, + ES_RenderColor, + ES_RenderFx, + + ES_MoveType, + ES_AnimTime, + ES_FrameRate, + ES_Body, + ES_Controller, + ES_Blending, + ES_Velocity, + + // Send bbox down to client for use during prediction + ES_Mins, + ES_Maxs, + + ES_AimEnt, + // If owned by a player, the index of that player (for projectiles) + ES_Owner, + + // Friction, for prediction + ES_Friction, + // Gravity multiplier + ES_Gravity, + + // PLAYER SPECIFIC + ES_Team, + ES_PlayerClass, + ES_Health, + ES_Spectator, + ES_WeaponModel, + ES_GaitSequence, + // If standing on conveyor, e.g. + ES_BaseVelocity, + // Use the crouched hull, or the regular player hull + ES_UseHull, + // Latched buttons last time state updated + ES_OldButtons, + // -1 = in air, else pmove entity number + ES_OnGround, + ES_iStepLeft, + // How fast we are falling + ES_flFallVelocity, + + ES_FOV, + ES_WeaponAnim, + + // Parametric movement overrides + ES_StartPos, + ES_EndPos, + ES_ImpactTime, + ES_StartTime, + + // For mods + ES_iUser1, + ES_iUser2, + ES_iUser3, + ES_iUser4, + ES_fUser1, + ES_fUser2, + ES_fUser3, + ES_fUser4, + ES_vUser1, + ES_vUser2, + ES_vUser3, + ES_vUser4 +}; + +enum UserCmd +{ + UC_LerpMsec, // Interpolation time on client + UC_Msec, // Duration in ms of command + UC_ViewAngles, // Command view angles + + // Intended velocities + UC_ForwardMove, // Forward velocity + UC_SideMove, // Sideways velocity + UC_UpMove, // Upward velocity + UC_LightLevel, // Light level at spot where we are standing + UC_Buttons, // Attack buttons + UC_Impulse, // Impulse command issued + UC_WeaponSelect, // Current weapon id + + // Experimental player impact stuff + UC_ImpactIndex, + UC_ImpactPosition +}; diff --git a/plugins/include/fakemeta_stocks.inc b/plugins/include/fakemeta_stocks.inc index e507c519..e7b99f3f 100755 --- a/plugins/include/fakemeta_stocks.inc +++ b/plugins/include/fakemeta_stocks.inc @@ -155,7 +155,7 @@ stock EF_PrecacheEvent(type, const STRING[]) return engfunc(EngFunc_PrecacheEvent, type, STRING) stock EF_PlaybackEvent(flags, const INVOKER, eventindex, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2) return engfunc(EngFunc_PlaybackEvent, flags, INVOKER, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2) -stock EF_CheckVisibility(const ENTITY, set[]) +stock EF_CheckVisibility(const ENTITY, set) return engfunc(EngFunc_CheckVisibility, ENTITY, set) stock EF_GetCurrentPlayer() @@ -248,4 +248,14 @@ stock DF_pfnAllowLagCompensation() stock DF_MetaFunc_CallGameEntity(const STRING[], const ENTITY) return dllfunc(MetaFunc_CallGameEntity, STRING, ENTITY) stock DF_ClientUserInfoChanged(const IDPLAYER) - return dllfunc(DLLFunc_ClientUserInfoChanged, IDPLAYER) \ No newline at end of file + return dllfunc(DLLFunc_ClientUserInfoChanged, IDPLAYER) + +stock DF_UpdateClientData(const ENTITY, sendweapons, const cd = 0) + return dllfunc(DLLFunc_UpdateClientData, ENTITY, sendweapons, cd) +stock DF_AddToFullPack(state = 0, e, ENT, HOST, hostflags, player, set) + return dllfunc(state, e, ENT, HOST, hostflags, player, set) +stock DF_CmdStart(const PLAYER, const CMD = 0, randomSeed) + return dllfunc(PLAYER, CMD, randomSeed) +stock DF_CmdEnd(const PLAYER) + return dllfunc(PLAYER) + \ No newline at end of file