Skip to content

Commit

Permalink
Update ReSDK API to latest version (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkshine committed Aug 25, 2018
1 parent ce14df0 commit f822cc6
Show file tree
Hide file tree
Showing 23 changed files with 896 additions and 313 deletions.
2 changes: 1 addition & 1 deletion modules/cstrike/cstrike/CstrikeItemsInfos.cpp
Expand Up @@ -17,7 +17,7 @@
#include <resdk/mod_regamedll_api.h>

CsItemInfo ItemsManager;
ItemInfo WeaponsList[MAX_WEAPONS];
ItemInfos WeaponsList[MAX_WEAPONS];

#define PSTATE_ALIASES_TYPE 0
#define PSTATE_ALIASES_ALIAS 1
Expand Down
8 changes: 4 additions & 4 deletions modules/cstrike/cstrike/CstrikeItemsInfos.h
Expand Up @@ -20,12 +20,12 @@
#include <amtl/am-string.h>
#include <sm_stringhashmap.h>

struct ItemInfo
struct ItemInfos
{
ItemInfo() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0)
ItemInfos() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0)
{}

ItemInfo &operator = (ItemInfo &other)
ItemInfos &operator = (ItemInfos &other)
{
name = other.name;
ammoIndex1 = other.ammoIndex1;
Expand Down Expand Up @@ -133,7 +133,7 @@ class CsItemInfo : public ITextListener_SMC
int m_EquipmentsPrice[static_cast<size_t>(Equipments::Count)];
};

extern ItemInfo WeaponsList[MAX_WEAPONS];
extern ItemInfos WeaponsList[MAX_WEAPONS];
extern CsItemInfo ItemsManager;

#endif // _CSTRIKE_WEAPONS_INFOS_H_
2 changes: 1 addition & 1 deletion modules/cstrike/cstrike/CstrikeUserMessages.cpp
Expand Up @@ -22,7 +22,7 @@ bool ShouldBlock;
bool ShouldBlockHLTV;
bool ShouldDisableHooks;
bool RetrieveWeaponList;
ItemInfo CurrentWeaponList;
ItemInfos CurrentWeaponList;
int ArgPosition;

int MessageIdArmorType;
Expand Down
13 changes: 11 additions & 2 deletions modules/cstrike/cstrike/msvc12/cstrike.vcxproj
Expand Up @@ -165,9 +165,18 @@
<ClInclude Include="..\..\..\..\public\memtools\CDetour\detours.h" />
<ClInclude Include="..\..\..\..\public\memtools\MemoryUtils.h" />
<ClInclude Include="..\..\..\..\public\resdk\common\hookchains.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSEntity.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSInterfaces.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayer.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayerItem.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayerWeapon.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\regamedll_api.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\regamedll_const.h" />
<ClInclude Include="..\..\..\..\public\resdk\cstrike\regamedll_interfaces.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\cmd_rehlds.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\FlightRecorder.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\IObjectContainer.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\ObjectList.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\pr_dlls.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\rehlds_api.h" />
<ClInclude Include="..\..\..\..\public\resdk\engine\rehlds_interfaces.h" />
<ClInclude Include="..\..\..\..\public\resdk\mod_regamedll_api.h" />
Expand All @@ -188,4 +197,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
36 changes: 33 additions & 3 deletions modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
Expand Up @@ -39,6 +39,9 @@
<Filter Include="ReSDK\cstrike">
<UniqueIdentifier>{ba0b72ba-25d8-48c3-af84-c1d4d7436636}</UniqueIdentifier>
</Filter>
<Filter Include="ReSDK\cstrike\API">
<UniqueIdentifier>{67de85cb-b8e7-4cd6-b8cf-2ff7ed540c2b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CstrikeHacks.cpp">
Expand Down Expand Up @@ -127,9 +130,6 @@
<ClInclude Include="..\..\..\..\public\resdk\cstrike\regamedll_const.h">
<Filter>ReSDK\cstrike</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\regamedll_interfaces.h">
<Filter>ReSDK\cstrike</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\rehlds_api.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
Expand All @@ -142,6 +142,36 @@
<ClInclude Include="..\..\..\..\public\resdk\mod_rehlds_api.h">
<Filter>ReSDK</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSEntity.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSInterfaces.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayer.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayerItem.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\cstrike\API\CSPlayerWeapon.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\cmd_rehlds.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\FlightRecorder.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\IObjectContainer.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\ObjectList.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\public\resdk\engine\pr_dlls.h">
<Filter>ReSDK\engine</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\plugins\include\cstrike.inc">
Expand Down
9 changes: 6 additions & 3 deletions modules/fakemeta/msvc12/fakemeta.vcxproj
Expand Up @@ -120,11 +120,14 @@
<ClInclude Include="..\..\..\public\HLTypeConversion.h" />
<ClInclude Include="..\..\..\public\memtools\MemoryUtils.h" />
<ClInclude Include="..\..\..\public\resdk\common\hookchains.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSEntity.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSInterfaces.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayer.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayerItem.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayerWeapon.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\regamedll_api.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\regamedll_const.h" />
<ClInclude Include="..\..\..\public\resdk\cstrike\regamedll_interfaces.h" />
<ClInclude Include="..\..\..\public\resdk\mod_regamedll_api.h" />
<ClInclude Include="..\..\..\public\resdk\mod_rehlds_api.h" />
<ClInclude Include="..\fakemeta_amxx.h" />
<ClInclude Include="..\fm_tr.h" />
<ClInclude Include="..\dllfunc.h" />
Expand All @@ -148,4 +151,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
22 changes: 17 additions & 5 deletions modules/fakemeta/msvc12/fakemeta.vcxproj.filters
Expand Up @@ -45,6 +45,9 @@
<Filter Include="ReSDK\cstrike">
<UniqueIdentifier>{0d1c5025-071d-43aa-b19a-2eee0d34a906}</UniqueIdentifier>
</Filter>
<Filter Include="ReSDK\cstrike\API">
<UniqueIdentifier>{2800175e-06bf-42bf-b3c1-f86561471531}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\fakemeta_amxx.cpp">
Expand Down Expand Up @@ -145,14 +148,23 @@
<ClInclude Include="..\..\..\public\resdk\cstrike\regamedll_const.h">
<Filter>ReSDK\cstrike</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\cstrike\regamedll_interfaces.h">
<Filter>ReSDK\cstrike</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\mod_regamedll_api.h">
<Filter>ReSDK</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\mod_rehlds_api.h">
<Filter>ReSDK</Filter>
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSEntity.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSInterfaces.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayer.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayerItem.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\resdk\cstrike\API\CSPlayerWeapon.h">
<Filter>ReSDK\cstrike\API</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions public/engine_strucs.h
Expand Up @@ -516,4 +516,16 @@ typedef struct client_s

} client_t;

using cvar_callback_t = void (*)(const char *pszNewValue);

struct cvar_listener_t
{
cvar_listener_t(const char *var_name, cvar_callback_t handler) :
func(handler), name(var_name) {}

cvar_callback_t func;
const char *name;
};


#endif //_ENGINE_STRUCTS_H_
1 change: 1 addition & 0 deletions public/resdk/common/hookchains.h
Expand Up @@ -25,6 +25,7 @@
* version.
*
*/

#pragma once

template<typename t_ret, typename ...t_args>
Expand Down
65 changes: 65 additions & 0 deletions public/resdk/cstrike/API/CSEntity.h
@@ -0,0 +1,65 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/

#pragma once

class CBaseEntity;
class CCSEntity
{
public:
virtual ~CCSEntity() {}
virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker);
virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand);

public:
CBaseEntity *m_pContainingEntity;
};

class CCSDelay: public CCSEntity
{
public:

};

class CCSAnimating: public CCSDelay
{
public:

};

class CCSToggle: public CCSAnimating
{
public:

};

class CCSMonster: public CCSToggle
{
public:

};
Expand Up @@ -28,89 +28,17 @@

#pragma once

#include "regamedll_const.h"
#include "CSEntity.h"
#include "CSPlayer.h"

class CBaseEntity;
class CBasePlayer;

// Implementation wrapper
class CCSEntity {
public:
virtual ~CCSEntity() {}
virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker);
virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand);
public:
CBaseEntity *m_pContainingEntity;
};

class CCSDelay: public CCSEntity {};
class CCSAnimating: public CCSDelay {};
class CCSPlayerItem: public CCSAnimating {};
class CCSToggle: public CCSAnimating {};
class CCSMonster: public CCSToggle {};
class CCSWeaponBox: public CCSEntity {};
class CCSArmoury: public CCSEntity {};

class CCSPlayer: public CCSMonster {
public:
CCSPlayer() : m_bForceShowMenu(false)
{
m_szModel[0] = '\0';
}

virtual bool IsConnected() const;
virtual void SetAnimation(PLAYER_ANIM playerAnim);
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
virtual CBaseEntity *GiveNamedItem(const char *pszName);
virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
virtual void GiveDefaultItems();
virtual void GiveShield(bool bDeploy = true);
virtual void DropShield(bool bDeploy = true);
virtual void DropPlayerItem(const char *pszItemName);
virtual void RemoveShield();
virtual void RemoveAllItems(bool bRemoveSuit);
virtual bool RemovePlayerItem(const char* pszItemName);
virtual void SetPlayerModel(bool bHasC4);
virtual void SetPlayerModelEx(const char *modelName);
virtual void SetNewPlayerModel(const char *modelName);
virtual void ClientCommand(const char *cmd, const char *arg1 = nullptr, const char *arg2 = nullptr, const char *arg3 = nullptr);
virtual void SetProgressBarTime(int time);
virtual void SetProgressBarTime2(int time, float timeElapsed);
virtual struct edict_s *EntSelectSpawnPoint();
virtual void SetBombIcon(bool bFlash = false);
virtual void SetScoreAttrib(CBasePlayer *dest);
virtual void SendItemStatus();
virtual void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false);
virtual void Observer_SetMode(int iMode);
virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
virtual bool SwitchWeapon(CBasePlayerItem *pWeapon);
virtual void SwitchTeam();
virtual bool JoinTeam(TeamName team);
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
virtual void TeamChangeUpdate();
virtual void DropSecondary();
virtual void DropPrimary();
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
virtual bool HasNamedPlayerItem(const char *pszItemName);
virtual CBasePlayerItem *GetItemById(WeaponIdType weaponID);
virtual CBasePlayerItem *GetItemByName(const char *itemName);
virtual void Disappear();
virtual void MakeVIP();
virtual bool MakeBomber();

CBasePlayer *BasePlayer() const;
public:
char m_szModel[32];
bool m_bForceShowMenu;
};

class CAPI_Bot: public CCSPlayer {};
class CAPI_CSBot: public CAPI_Bot {};
class CCSShield: public CCSEntity {};
class CCSDeadHEV: public CCSMonster {};
class CCSSprayCan: public CCSEntity {};
class CCSBloodSplat: public CCSEntity {};
class CCSPlayerWeapon: public CCSPlayerItem {};
class CCSWorld: public CCSEntity {};
class CCSDecal: public CCSEntity {};
class CCSCorpse: public CCSEntity {};
Expand Down Expand Up @@ -297,7 +225,6 @@ class CCSTriggerChangeTarget: public CCSDelay {};
class CCSTriggerCamera: public CCSDelay {};
class CCSWeather: public CCSTrigger {};
class CCSClientFog: public CCSEntity {};

inline CBasePlayer *CCSPlayer::BasePlayer() const {
return reinterpret_cast<CBasePlayer *>(this->m_pContainingEntity);
}
class CCSTriggerSetOrigin: public CCSDelay {};
class CCSTriggerRandom: public CCSDelay {};
class CCSItemAirBox: public CCSArmoury {};

0 comments on commit f822cc6

Please sign in to comment.