2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-16 08:38:10 +03:00

Better hitbox tracking

This commit is contained in:
dreamstalker 2015-07-11 21:07:51 +04:00
parent 08e95e00e3
commit 39179e694b
5 changed files with 17 additions and 3 deletions

View File

@ -59,6 +59,7 @@ r_studiocache_t rgStudioCache[STUDIO_CACHE_SIZE];
int nCurrentHull;
int nCurrentPlane;
int r_cachecurrent;
int g_studio_numhulls;
int studio_hull_hitgroup[STUDIO_NUM_HULLS];
hull_t studio_hull[STUDIO_NUM_HULLS];
@ -704,6 +705,8 @@ hull_t *R_StudioHull(model_t *pModel, float frame, int sequence, const vec_t *an
}
*pNumHulls = (bSkipShield == 1) ? pstudiohdr->numhitboxes - 1 : pstudiohdr->numhitboxes;
g_studio_numhulls = *pNumHulls;
if (r_cachestudio.value != 0)
{
#ifdef SWDS

View File

@ -105,3 +105,6 @@ void R_StudioAccumulateBoneVerts(vec_t *mins, vec_t *maxs, int *vertcount, vec_t
int R_StudioComputeBounds(unsigned char *pBuffer, float *mins, float *maxs);
int R_GetStudioBounds(const char *filename, float *mins, float *maxs);
void R_ResetSvBlending(void);
extern int g_studio_numhulls;

View File

@ -199,7 +199,7 @@ struct RehldsFuncs_t {
void(*MSG_WriteBitVec3Coord)(const float *fa);
void(*MSG_EndBitWriting)(sizebuf_t *buf);
void*(*SZ_GetSpace)(sizebuf_t *buf, int length);
bool(*GetHitboxCorners)(int hitboxId, float* /* [8*3] */ corners);
bool(*GetHitboxCorners)(int hitboxId, float* /* [8*3] */ corners, int* pGroupId);
};
class IRehldsApi {

View File

@ -65,7 +65,11 @@ DLL_FUNCTIONS* EXT_FUNC GetEntityInterface_api() {
return &gEntityInterface;
}
bool EXT_FUNC GetHitboxCorners(int hitboxId, float* /* [8*3] */ corners) {
bool EXT_FUNC GetHitboxCorners(int hitboxId, float* /* [8*3] */ corners, int* pGroupId) {
if (hitboxId < 0 || hitboxId >= g_studio_numhulls) {
return false;
}
mplane_t* right = &studio_planes[hitboxId * 6 + 0 * 2 + 0];
mplane_t* left = &studio_planes[hitboxId * 6 + 0 * 2 + 1];
mplane_t* rear = &studio_planes[hitboxId * 6 + 1 * 2 + 0];
@ -108,6 +112,10 @@ bool EXT_FUNC GetHitboxCorners(int hitboxId, float* /* [8*3] */ corners) {
return false;
corners[7 * 3 + 0] = p[0]; corners[7 * 3 + 1] = p[1]; corners[7 * 3 + 2] = p[2];
if (pGroupId) {
*pGroupId = studio_hull_hitgroup[hitboxId];
}
return true;
}

View File

@ -31,7 +31,7 @@
#include "rehlds_api.h"
#include "rehlds_interfaces_impl.h"
extern bool GetHitboxCorners(int hitboxId, float* /* [8*3] */ corners);
extern bool GetHitboxCorners(int hitboxId, float* /* [8*3] */ corners, int* pGroupId);
//Steam_NotifyClientConnect
typedef IHookChainImpl<qboolean, IGameClient*, const void*, unsigned int> CRehldsHook_Steam_NotifyClientConnect;