Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers update, rename m_bHasSecondaryAttack, CSPlayer member additions #293

Merged
merged 6 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions reapi/extra/amxmodx/scripting/include/cssdk_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1479,3 +1479,14 @@ enum GameEventType
EVENT_HOSTAGE_CALLED_FOR_HELP, // tell bots the hostage is talking (argumens: 1 = listener, 2 = NULL)
NUM_GAME_EVENTS,
};

/**
* Weapon secondary attack states
* For CCSPlayerWeapon::m_iStateSecondaryAttack
*/
enum SecondaryAtkState
{
WEAPON_SECONDARY_ATTACK_NONE = 0,
WEAPON_SECONDARY_ATTACK_SET,
WEAPON_SECONDARY_ATTACK_BLOCK
};
59 changes: 55 additions & 4 deletions reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4816,6 +4816,54 @@ enum CCSPlayer_Members
* Set params: set_member(index, member, bool:value);
*/
m_bSpawnProtectionEffects,

/*
* Description: Player vertical jump height
* Member type: float
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flJumpHeight,

/*
* Description: Player vertical jump height with longjump
* Member type: float
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flLongJumpHeight,

/*
* Description: Player horizontal jump height with longjump
* Member type: float
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flLongJumpForce,

/*
* Description: Player crouch maxspeed multiplier
* Member type: float
* Get params: Float:get_member(index, member);
* Set params: set_member(index, member, Float:value);
*/
m_flDuckSpeedMultiplier,

/*
* Description: How many unanswered kills this player has been dealt by each other player (0-31)
* Member type: int [32]
* Get params: get_member(index, member, element);
* Set params: set_member(index, member, value, element);
*/
m_iNumKilledByUnanswered,

/*
* Description: Array of state per other player whether player is dominating other players (0-31)
* Member type: bool [32]
* Get params: get_member(index, member, element);
* Set params: set_member(index, member, value, element);
*/
m_bPlayerDominated,
};

/**
Expand Down Expand Up @@ -6238,12 +6286,12 @@ enum CMapInfo_Members
enum CCSPlayerWeapon_Members
{
/*
* Description: Can the weapon have secondary attack
* Member type: bool
* Description: Weapon secondary attack state
* Member type: enum SecondaryAtkState
* Get params: get_member(index, member);
* Set params: set_member(index, member, bool:value);
* Set params: set_member(index, member, SecondaryAtkState:value);
*/
m_Weapon_bHasSecondaryAttack = BEGIN_MEMBER_REGION(csplayerweapon),
m_Weapon_iStateSecondaryAttack = BEGIN_MEMBER_REGION(csplayerweapon),

/*
* Description: Basic damage that weapon deals before any multiplier, such as hitgroup, armor, distance and bullet penetration
Expand All @@ -6254,6 +6302,9 @@ enum CCSPlayerWeapon_Members
m_Weapon_flBaseDamage,
};

// API compatibility
#define m_Weapon_bHasSecondaryAttack m_Weapon_iStateSecondaryAttack

/**
* CGib Members
*/
Expand Down
5 changes: 4 additions & 1 deletion reapi/include/cssdk/dlls/API/CSEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CCSEntity
CCSEntity() :
m_pContainingEntity(nullptr)
{
m_ucDmgPenetrationLevel = 0;
}

virtual ~CCSEntity() {}
Expand All @@ -45,12 +46,14 @@ class CCSEntity

public:
CBaseEntity *m_pContainingEntity;
unsigned char m_ucDmgPenetrationLevel; // penetration level of the damage caused by the inflictor

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

virtual void func_reserve1() {};
virtual void func_reserve2() {};
virtual void func_reserve3() {};
Expand Down
37 changes: 31 additions & 6 deletions reapi/include/cssdk/dlls/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <API/CSPlayerItem.h>
#include <API/CSPlayerWeapon.h>
#include <utlarray.h>

enum WeaponInfiniteAmmoMode
{
Expand All @@ -52,9 +53,21 @@ class CCSPlayer: public CCSMonster
m_bAutoBunnyHopping(false),
m_bMegaBunnyJumping(false),
m_bPlantC4Anywhere(false),
m_bSpawnProtectionEffects(false)
m_bSpawnProtectionEffects(false),
m_flJumpHeight(0),
m_flLongJumpHeight(0),
m_flLongJumpForce(0),
m_flDuckSpeedMultiplier(0),
m_iUserID(-1)
{
m_szModel[0] = '\0';

// Resets the kill history for this player
for (int i = 0; i < MAX_CLIENTS; i++)
{
m_iNumKilledByUnanswered[i] = 0;
m_bPlayerDominated[i] = false;
}
}

virtual bool IsConnected() const = 0;
Expand Down Expand Up @@ -106,11 +119,6 @@ class CCSPlayer: public CCSMonster
virtual void OnSpawnEquip(bool addDefault = true, bool equipGame = true) = 0;
virtual void SetScoreboardAttributes(CBasePlayer *destination = nullptr) = 0;

void ResetVars();

void OnSpawn();
void OnKilled();

CBasePlayer *BasePlayer() const;

public:
Expand Down Expand Up @@ -138,6 +146,23 @@ class CCSPlayer: public CCSMonster
bool m_bMegaBunnyJumping;
bool m_bPlantC4Anywhere;
bool m_bSpawnProtectionEffects;
double m_flJumpHeight;
double m_flLongJumpHeight;
double m_flLongJumpForce;
double m_flDuckSpeedMultiplier;

int m_iUserID;
struct CDamageRecord_t
{
float flDamage = 0.0f;
float flFlashDurationTime = 0.0f;
int userId = -1;
};
using DamageList_t = CUtlArray<CDamageRecord_t, MAX_CLIENTS>;
DamageList_t m_DamageList; // A unified array of recorded damage that includes giver and taker in each entry
DamageList_t &GetDamageList() { return m_DamageList; }
int m_iNumKilledByUnanswered[MAX_CLIENTS]; // [0-31] how many unanswered kills this player has been dealt by each other player
bool m_bPlayerDominated[MAX_CLIENTS]; // [0-31] array of state per other player whether player is dominating other players
};

// Inlines
Expand Down
1 change: 1 addition & 0 deletions reapi/include/cssdk/dlls/API/CSPlayerItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CCSPlayerItem: public CCSAnimating
}

virtual void SetItemInfo(ItemInfo *pInfo) = 0;
virtual int GetItemInfo(ItemInfo *pInfo) = 0;

CBasePlayerItem *BasePlayerItem() const;

Expand Down
18 changes: 16 additions & 2 deletions reapi/include/cssdk/dlls/API/CSPlayerWeapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,33 @@

#pragma once

enum SecondaryAtkState : uint8_t
{
WEAPON_SECONDARY_ATTACK_NONE = 0,
WEAPON_SECONDARY_ATTACK_SET,
WEAPON_SECONDARY_ATTACK_BLOCK
};

class CBasePlayerWeapon;
class CCSPlayerWeapon: public CCSPlayerItem
{
DECLARE_CLASS_TYPES(CCSPlayerWeapon, CCSPlayerItem);
public:
CCSPlayerWeapon() :
m_bHasSecondaryAttack(false)
m_iStateSecondaryAttack(WEAPON_SECONDARY_ATTACK_NONE)
{
}

virtual BOOL DefaultDeploy(char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal = 0) = 0;
virtual int DefaultReload(int iClipSize, int iAnim, float fDelay) = 0;
virtual bool DefaultShotgunReload(int iAnim, int iStartAnim, float fDelay, float fStartDelay, const char *pszReloadSound1 = nullptr, const char *pszReloadSound2 = nullptr) = 0;
virtual void KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) = 0;
virtual void SendWeaponAnim(int iAnim, int skiplocal = 0) = 0;

CBasePlayerWeapon *BasePlayerWeapon() const;

public:
bool m_bHasSecondaryAttack;
SecondaryAtkState m_iStateSecondaryAttack;
float m_flBaseDamage;
};

Expand Down
11 changes: 11 additions & 0 deletions reapi/include/cssdk/dlls/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,14 @@ typedef IHookChainRegistryClass<void, CBasePlayerWeapon, float, float, float, fl
typedef IHookChainClass<void, CBasePlayerWeapon, int, int> IReGameHook_CBasePlayerWeapon_SendWeaponAnim;
typedef IHookChainRegistryClass<void, CBasePlayerWeapon, int, int> IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim;

// CHalfLifeMultiplay::SendDeathMessage hook
typedef IHookChain<void, class CBaseEntity *, class CBasePlayer *, class CBasePlayer *, struct entvars_s *, const char *, int, int> IReGameHook_CSGameRules_SendDeathMessage;
typedef IHookChainRegistry<void, class CBaseEntity *, class CBasePlayer *, class CBasePlayer *, struct entvars_s *, const char *, int, int> IReGameHookRegistry_CSGameRules_SendDeathMessage;

// CBasePlayer::PlayerDeathThink hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_PlayerDeathThink;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_PlayerDeathThink;

class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
Expand Down Expand Up @@ -771,6 +779,9 @@ class IReGameHookchains {
virtual IReGameHookRegistry_CBasePlayerWeapon_ItemPostFrame *CBasePlayerWeapon_ItemPostFrame() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_KickBack *CBasePlayerWeapon_KickBack() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_SendWeaponAnim *CBasePlayerWeapon_SendWeaponAnim() = 0;
virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage() = 0;

virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0;
};

struct ReGameFuncs_t {
Expand Down
Loading