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

API: Added new API funcs #1008

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
109 changes: 109 additions & 0 deletions regamedll/dlls/API/CAPI_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,96 @@ CGrenade *EXT_FUNC SpawnGrenade_api(WeaponIdType weaponId, entvars_t *pevOwner,
return nullptr;
}

int EXT_FUNC UTIL_SharedRandomLong_api(unsigned int seed, int low, int high)
{
return UTIL_SharedRandomLong(seed, low, high);
}

float EXT_FUNC UTIL_SharedRandomFloat_api(unsigned int seed, float low, float high)
{
return UTIL_SharedRandomFloat(seed, low, high);
}

void EXT_FUNC UTIL_SetGroupTrace_api(int groupmask, int op)
{
UTIL_SetGroupTrace(groupmask, op);
}

void EXT_FUNC UTIL_UnsetGroupTrace_api()
{
UTIL_UnsetGroupTrace();
}

int EXT_FUNC UTIL_EntitiesInBox_api(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask)
{
return UTIL_EntitiesInBox(pList, listMax, mins, maxs, flagMask);
}

CBaseEntity* EXT_FUNC UTIL_FindEntityInSphere_api(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius)
{
return UTIL_FindEntityInSphere(pStartEntity, vecCenter, flRadius);
}

void EXT_FUNC UTIL_ScreenShake_api(const Vector &center, float amplitude, float frequency, float duration, float radius)
{
UTIL_ScreenShake(center, amplitude, frequency, duration, radius);
}

void EXT_FUNC UTIL_ScreenFadeAll_api(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags)
{
UTIL_ScreenFadeAll(color, fadeTime, fadeHold, alpha, flags);
}

void EXT_FUNC UTIL_ScreenFade_api(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags)
{
UTIL_ScreenFade(pEntity, color, fadeTime, fadeHold, alpha, flags);
}

void EXT_FUNC UTIL_SetSize_api(entvars_t *pev, const Vector &vecMin, const Vector &vecMax)
{
UTIL_SetSize(pev, vecMin, vecMax);
}

void EXT_FUNC UTIL_SetOrigin_api(entvars_t *pev, const Vector &vecOrigin)
{
UTIL_SetOrigin(pev, vecOrigin);
}

int EXT_FUNC UTIL_PointContents_api(const Vector &vec)
{
return UTIL_PointContents(vec);
}

float EXT_FUNC UTIL_WaterLevel_api(const Vector &position, float minz, float maxz)
{
return UTIL_WaterLevel(position, minz, maxz);
}

void EXT_FUNC UTIL_Bubbles_api(Vector mins, Vector maxs, int count)
{
UTIL_Bubbles(mins, maxs, count);
}

void EXT_FUNC UTIL_BubbleTrail_api(Vector from, Vector to, int count)
{
UTIL_BubbleTrail(from, to, count);
}

char EXT_FUNC UTIL_TextureHit_api(TraceResult *ptr, Vector vecSrc, Vector vecEnd)
{
return UTIL_TextureHit(ptr, vecSrc, vecEnd);
}

int EXT_FUNC UTIL_CountEntities_api(const char *szName)
{
return UTIL_CountEntities(szName);
}

bool EXT_FUNC UTIL_IsSpawnPointOccupied_api(CBaseEntity *pSpot)
{
return UTIL_IsSpawnPointOccupied(pSpot);
}

ReGameFuncs_t g_ReGameApiFuncs = {
CREATE_NAMED_ENTITY,

Expand Down Expand Up @@ -176,6 +266,25 @@ ReGameFuncs_t g_ReGameApiFuncs = {
TextureTypePlaySound_api,
CreateWeaponBox_api,
SpawnGrenade_api,

UTIL_SharedRandomLong_api,
UTIL_SharedRandomFloat_api,
UTIL_SetGroupTrace_api,
UTIL_UnsetGroupTrace_api,
UTIL_EntitiesInBox_api,
UTIL_FindEntityInSphere_api,
UTIL_ScreenShake_api,
UTIL_ScreenFadeAll_api,
UTIL_ScreenFade_api,
UTIL_SetSize_api,
UTIL_SetOrigin_api,
UTIL_PointContents_api,
UTIL_WaterLevel_api,
UTIL_Bubbles_api,
UTIL_BubbleTrail_api,
UTIL_TextureHit_api,
UTIL_CountEntities_api,
UTIL_IsSpawnPointOccupied_api,
};

GAMEHOOK_REGISTRY(CBasePlayer_Spawn);
Expand Down
18 changes: 18 additions & 0 deletions regamedll/public/regamedll/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,24 @@ struct ReGameFuncs_t {
void (*TextureTypePlaySound)(TraceResult *ptr, Vector vecSrc, Vector vecEnd, int iBulletType);
class CWeaponBox *(*CreateWeaponBox)(CBasePlayerItem *pItem, CBasePlayer *pPlayerOwner, const char *modelName, Vector &origin, Vector &angles, Vector &velocity, float lifeTime, bool packAmmo);
class CGrenade *(*SpawnGrenade)(WeaponIdType weaponId, entvars_t *pevOwner, Vector &vecSrc, Vector &vecThrow, float time, int iTeam, unsigned short usEvent);
int (*UTIL_SharedRandomLong)(unsigned int seed, int low, int high);
float (*UTIL_SharedRandomFloat)(unsigned int seed, float low, float high);
void (*UTIL_SetGroupTrace)(int groupmask, int op);
void (*UTIL_UnsetGroupTrace)();
int (*UTIL_EntitiesInBox)(CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask);
class CBaseEntity *(*UTIL_FindEntityInSphere)(CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius);
void (*UTIL_ScreenShake)(const Vector &center, float amplitude, float frequency, float duration, float radius);
void (*UTIL_ScreenFadeAll)(const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
void (*UTIL_ScreenFade)(CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags);
void (*UTIL_SetSize)(entvars_t *pev, const Vector &vecMin, const Vector &vecMax);
void (*UTIL_SetOrigin)(entvars_t *pev, const Vector &vecOrigin);
int (*UTIL_PointContents)(const Vector &vec);
float (*UTIL_WaterLevel)(const Vector &position, float minz, float maxz);
void (*UTIL_Bubbles)(Vector mins, Vector maxs, int count);
void (*UTIL_BubbleTrail)(Vector from, Vector to, int count);
char (*UTIL_TextureHit)(TraceResult *ptr, Vector vecSrc, Vector vecEnd);
int (*UTIL_CountEntities)(const char *szName);
bool (*UTIL_IsSpawnPointOccupied)(CBaseEntity *pSpot);
};

class IReGameApi {
Expand Down
Loading