From 3134b3ecd88c27bc630cab1703d5b3f5042c9d86 Mon Sep 17 00:00:00 2001 From: Celio Lozatto Date: Fri, 30 Aug 2024 10:08:32 -0300 Subject: [PATCH 1/2] implementation of funcs in regamedll --- regamedll/dlls/API/CAPI_Impl.cpp | 109 +++++++++++++++++++++ regamedll/public/regamedll/regamedll_api.h | 18 ++++ 2 files changed, 127 insertions(+) diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 41175c838..29deecb48 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -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 ¢er, 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, @@ -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); diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index d655ee656..06f29ec55 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -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 ¢er, 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 { From 97522f92bd6067d028de3a393419eb70122377e7 Mon Sep 17 00:00:00 2001 From: Celio Lozatto Date: Fri, 30 Aug 2024 10:08:32 -0300 Subject: [PATCH 2/2] implementation of funcs in regamedll --- regamedll/dlls/API/CAPI_Impl.cpp | 109 +++++++++++++++++++++ regamedll/public/regamedll/regamedll_api.h | 18 ++++ 2 files changed, 127 insertions(+) diff --git a/regamedll/dlls/API/CAPI_Impl.cpp b/regamedll/dlls/API/CAPI_Impl.cpp index 41175c838..29deecb48 100644 --- a/regamedll/dlls/API/CAPI_Impl.cpp +++ b/regamedll/dlls/API/CAPI_Impl.cpp @@ -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 ¢er, 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, @@ -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); diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index d655ee656..56d9978f2 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -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 ¢er, 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 {