mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
More SSE optimizations.
This commit is contained in:
parent
6df2bd1a2a
commit
591ee6b490
@ -263,14 +263,15 @@ float (*LittleFloat)(float l);
|
|||||||
|
|
||||||
int LongSwap(int l)
|
int LongSwap(int l)
|
||||||
{
|
{
|
||||||
byte b1, b2, b3, b4;
|
/*byte b1, b2, b3, b4;
|
||||||
|
|
||||||
b1 = l & 0xFF;
|
b1 = l & 0xFF;
|
||||||
b2 = (l >> 8) & 0xFF;
|
b2 = (l >> 8) & 0xFF;
|
||||||
b3 = (l >> 16) & 0xFF;
|
b3 = (l >> 16) & 0xFF;
|
||||||
b4 = (l >> 24) & 0xFF;
|
b4 = (l >> 24) & 0xFF;
|
||||||
|
|
||||||
return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
|
return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;*/
|
||||||
|
return _byteswap_ulong(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LongNoSwap(int l)
|
int LongNoSwap(int l)
|
||||||
@ -280,12 +281,16 @@ int LongNoSwap(int l)
|
|||||||
|
|
||||||
short ShortSwap(short l)
|
short ShortSwap(short l)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
return _byteswap_ushort(l); // xchg
|
||||||
|
#else
|
||||||
byte b1, b2;
|
byte b1, b2;
|
||||||
|
|
||||||
b1 = l & 0xFF;
|
b1 = l & 0xFF;
|
||||||
b2 = (l >> 8) & 0xFF;
|
b2 = (l >> 8) & 0xFF;
|
||||||
|
|
||||||
return (b1 << 8) + b2;
|
return (b1 << 8) + b2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
short ShortNoSwap(short l)
|
short ShortNoSwap(short l)
|
||||||
@ -295,7 +300,7 @@ short ShortNoSwap(short l)
|
|||||||
|
|
||||||
float FloatSwap(float f)
|
float FloatSwap(float f)
|
||||||
{
|
{
|
||||||
union
|
/*union
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
byte b[4];
|
byte b[4];
|
||||||
@ -307,7 +312,9 @@ float FloatSwap(float f)
|
|||||||
dat2.b[2] = dat1.b[1];
|
dat2.b[2] = dat1.b[1];
|
||||||
dat2.b[3] = dat1.b[0];
|
dat2.b[3] = dat1.b[0];
|
||||||
|
|
||||||
return dat2.f;
|
return dat2.f;*/
|
||||||
|
unsigned long u = _byteswap_ulong(*(unsigned long *)&f);
|
||||||
|
return *(float *)&u;
|
||||||
}
|
}
|
||||||
|
|
||||||
float FloatNoSwap(float f)
|
float FloatNoSwap(float f)
|
||||||
@ -443,7 +450,7 @@ void MSG_WriteUsercmd(sizebuf_t *buf, usercmd_t *to, usercmd_t *from)
|
|||||||
{
|
{
|
||||||
delta_t **ppdesc;
|
delta_t **ppdesc;
|
||||||
|
|
||||||
ppdesc = (delta_t **)DELTA_LookupRegistration("usercmd_t");
|
ppdesc = DELTA_LookupRegistration("usercmd_t");
|
||||||
MSG_StartBitWriting(buf);
|
MSG_StartBitWriting(buf);
|
||||||
DELTA_WriteDelta((byte *)from, (byte *)to, 1, *ppdesc, 0);
|
DELTA_WriteDelta((byte *)from, (byte *)to, 1, *ppdesc, 0);
|
||||||
MSG_EndBitWriting(buf);
|
MSG_EndBitWriting(buf);
|
||||||
|
@ -37,6 +37,24 @@ vec3_t vec3_origin;
|
|||||||
//short int old_cw;
|
//short int old_cw;
|
||||||
//DLONG dlong;
|
//DLONG dlong;
|
||||||
|
|
||||||
|
// aligned vec4_t
|
||||||
|
typedef ALIGN16 vec4_t avec4_t;
|
||||||
|
|
||||||
|
// conversion multiplier
|
||||||
|
const avec4_t deg2rad =
|
||||||
|
{
|
||||||
|
M_PI / 180.f,
|
||||||
|
M_PI / 180.f,
|
||||||
|
M_PI / 180.f,
|
||||||
|
M_PI / 180.f
|
||||||
|
};
|
||||||
|
|
||||||
|
// save 4d xmm to 3d vector. we can't optimize many simple vector3 functions because saving back to 3d is slow.
|
||||||
|
void xmm2vec(vec_t *v, const __m128 m)
|
||||||
|
{
|
||||||
|
_mm_store_ss(v, m);
|
||||||
|
_mm_storel_pi((__m64*)(v + 1), _mm_shuffle_ps(m, m, _MM_SHUFFLE(3, 2, 2, 1)));
|
||||||
|
}
|
||||||
|
|
||||||
/* <46ebf> ../engine/mathlib.c:14 */
|
/* <46ebf> ../engine/mathlib.c:14 */
|
||||||
float anglemod(float a)
|
float anglemod(float a)
|
||||||
@ -126,19 +144,6 @@ NOBODY int InvertMatrix(const float *m, float *out);
|
|||||||
// float *r3; // 161
|
// float *r3; // 161
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
|
||||||
void SinCos(float radians, float *sine, float *cosine)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
fld dword ptr [radians];
|
|
||||||
fsincos;
|
|
||||||
fstp dword ptr [cosine];
|
|
||||||
fstp dword ptr [sine];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // REHLDS_FIXES
|
|
||||||
|
|
||||||
/* <47067> ../engine/mathlib.c:267 */
|
/* <47067> ../engine/mathlib.c:267 */
|
||||||
void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up)
|
void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up)
|
||||||
{
|
{
|
||||||
@ -149,9 +154,16 @@ void AngleVectors(const vec_t *angles, vec_t *forward, vec_t *right, vec_t *up)
|
|||||||
#endif // SWDS
|
#endif // SWDS
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
SinCos(DEG2RAD(angles[YAW]), &sy, &cy);
|
// convert to radians
|
||||||
SinCos(DEG2RAD(angles[PITCH]), &sp, &cp);
|
avec4_t rad_angles;
|
||||||
SinCos(DEG2RAD(angles[ROLL]), &sr, &cr);
|
_mm_store_ps(rad_angles, _mm_mul_ps(_mm_loadu_ps(angles), _mm_load_ps(deg2rad)));
|
||||||
|
|
||||||
|
sy = sin(rad_angles[YAW]);
|
||||||
|
cy = cos(rad_angles[YAW]);
|
||||||
|
sp = sin(rad_angles[PITCH]);
|
||||||
|
cp = cos(rad_angles[PITCH]);
|
||||||
|
sr = sin(rad_angles[ROLL]);
|
||||||
|
cr = cos(rad_angles[ROLL]);
|
||||||
#else
|
#else
|
||||||
float angle;
|
float angle;
|
||||||
angle = (float)(angles[YAW] * (M_PI * 2 / 360));
|
angle = (float)(angles[YAW] * (M_PI * 2 / 360));
|
||||||
@ -191,9 +203,16 @@ void AngleVectorsTranspose(const vec_t *angles, vec_t *forward, vec_t *right, ve
|
|||||||
float sr, sp, sy, cr, cp, cy;
|
float sr, sp, sy, cr, cp, cy;
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
SinCos(DEG2RAD(angles[YAW]), &sy, &cy);
|
// convert to radians
|
||||||
SinCos(DEG2RAD(angles[PITCH]), &sp, &cp);
|
avec4_t rad_angles;
|
||||||
SinCos(DEG2RAD(angles[ROLL]), &sr, &cr);
|
_mm_store_ps(rad_angles, _mm_mul_ps(_mm_loadu_ps(angles), _mm_load_ps(deg2rad)));
|
||||||
|
|
||||||
|
sy = sin(rad_angles[YAW]);
|
||||||
|
cy = cos(rad_angles[YAW]);
|
||||||
|
sp = sin(rad_angles[PITCH]);
|
||||||
|
cp = cos(rad_angles[PITCH]);
|
||||||
|
sr = sin(rad_angles[ROLL]);
|
||||||
|
cr = cos(rad_angles[ROLL]);
|
||||||
#else
|
#else
|
||||||
float angle;
|
float angle;
|
||||||
angle = (float)(angles[YAW] * (M_PI * 2 / 360));
|
angle = (float)(angles[YAW] * (M_PI * 2 / 360));
|
||||||
@ -233,9 +252,16 @@ void AngleMatrix(const vec_t *angles, float(*matrix)[4])
|
|||||||
float sr, sp, sy, cr, cp, cy;
|
float sr, sp, sy, cr, cp, cy;
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
SinCos(DEG2RAD(angles[ROLL]), &sy, &cy);
|
// convert to radians
|
||||||
SinCos(DEG2RAD(angles[YAW]), &sp, &cp);
|
avec4_t rad_angles;
|
||||||
SinCos(DEG2RAD(angles[PITCH]), &sr, &cr);
|
_mm_store_ps(rad_angles, _mm_mul_ps(_mm_loadu_ps(angles), _mm_load_ps(deg2rad)));
|
||||||
|
|
||||||
|
sy = sin(rad_angles[ROLL]);
|
||||||
|
cy = cos(rad_angles[ROLL]);
|
||||||
|
sp = sin(rad_angles[YAW]);
|
||||||
|
cp = cos(rad_angles[YAW]);
|
||||||
|
sr = sin(rad_angles[PITCH]);
|
||||||
|
cr = cos(rad_angles[PITCH]);
|
||||||
#else
|
#else
|
||||||
float angle;
|
float angle;
|
||||||
angle = (float)(angles[ROLL] * (M_PI * 2 / 360));
|
angle = (float)(angles[ROLL] * (M_PI * 2 / 360));
|
||||||
@ -321,11 +347,11 @@ int VectorCompare(const vec_t *v1, const vec_t *v2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* <47524> ../engine/mathlib.c:476 */
|
/* <47524> ../engine/mathlib.c:476 */
|
||||||
void VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc)
|
void VectorMA(const vec_t *veca, float scale, const vec_t *vecm, vec_t *out)
|
||||||
{
|
{
|
||||||
vecc[0] = scale * vecb[0] + veca[0];
|
out[0] = scale * vecm[0] + veca[0];
|
||||||
vecc[1] = scale * vecb[1] + veca[1];
|
out[1] = scale * vecm[1] + veca[1];
|
||||||
vecc[2] = scale * vecb[2] + veca[2];
|
out[2] = scale * vecm[2] + veca[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef REHLDS_FIXES
|
#ifndef REHLDS_FIXES
|
||||||
@ -337,7 +363,6 @@ long double _DotProduct(const vec_t *v1, const vec_t *v2)
|
|||||||
#else // REHLDS_FIXES
|
#else // REHLDS_FIXES
|
||||||
float _DotProduct(const vec_t *v1, const vec_t *v2)
|
float _DotProduct(const vec_t *v1, const vec_t *v2)
|
||||||
{
|
{
|
||||||
#ifdef REHLDS_FIXES
|
|
||||||
// _mm_loadu_ps - load xmm from unaligned address
|
// _mm_loadu_ps - load xmm from unaligned address
|
||||||
// _mm_cvtss_f32 - return low float value of xmm
|
// _mm_cvtss_f32 - return low float value of xmm
|
||||||
// _mm_dp_ps - dot product
|
// _mm_dp_ps - dot product
|
||||||
@ -345,7 +370,6 @@ float _DotProduct(const vec_t *v1, const vec_t *v2)
|
|||||||
// dpps isn't binary compatible with separate sse2 instructions (max difference is about 0.0002f, but usually < 0.00001f)
|
// dpps isn't binary compatible with separate sse2 instructions (max difference is about 0.0002f, but usually < 0.00001f)
|
||||||
if (cpuinfo.sse4_1)
|
if (cpuinfo.sse4_1)
|
||||||
return _mm_cvtss_f32(_mm_dp_ps(_mm_loadu_ps(v1), _mm_loadu_ps(v2), 0x71));
|
return _mm_cvtss_f32(_mm_dp_ps(_mm_loadu_ps(v1), _mm_loadu_ps(v2), 0x71));
|
||||||
#endif // REHLDS_FIXES
|
|
||||||
|
|
||||||
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
||||||
}
|
}
|
||||||
@ -372,9 +396,18 @@ NOBODY void _VectorCopy(vec_t *in, vec_t *out);
|
|||||||
/* <47679> ../engine/mathlib.c:510 */
|
/* <47679> ../engine/mathlib.c:510 */
|
||||||
void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross)
|
void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross)
|
||||||
{
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
__m128 a = _mm_loadu_ps(v1), b = _mm_loadu_ps(v2);
|
||||||
|
__m128 m = _mm_sub_ps( _mm_mul_ps(b, _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1))),
|
||||||
|
_mm_mul_ps(a, _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)))
|
||||||
|
);
|
||||||
|
|
||||||
|
xmm2vec(cross, _mm_shuffle_ps(m, m, _MM_SHUFFLE(3, 0, 2, 1)));
|
||||||
|
#else // REHLDS_FIXES
|
||||||
cross[0] = v2[2] * v1[1] - v1[2] * v2[1];
|
cross[0] = v2[2] * v1[1] - v1[2] * v2[1];
|
||||||
cross[1] = v1[2] * v2[0] - v1[0] * v2[2];
|
cross[1] = v1[2] * v2[0] - v1[0] * v2[2];
|
||||||
cross[2] = v1[0] * v2[1] - v2[0] * v1[1];
|
cross[2] = v1[0] * v2[1] - v2[0] * v1[1];
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <476d8> ../engine/mathlib.c:519 */
|
/* <476d8> ../engine/mathlib.c:519 */
|
||||||
@ -383,9 +416,7 @@ float Length(const vec_t *v)
|
|||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
// based on dot product
|
// based on dot product
|
||||||
if (cpuinfo.sse4_1)
|
if (cpuinfo.sse4_1)
|
||||||
{
|
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(_mm_loadu_ps(v), _mm_loadu_ps(v), 0x71)));
|
||||||
return _mm_cvtss_f32(_mm_sqrt_ps(_mm_dp_ps(_mm_loadu_ps(v), _mm_loadu_ps(v), 0x71)));
|
|
||||||
}
|
|
||||||
#endif // REHLDS_FIXES
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
float length;
|
float length;
|
||||||
@ -398,6 +429,17 @@ float Length(const vec_t *v)
|
|||||||
return sqrt(length);
|
return sqrt(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Length2D(const vec_t *v)
|
||||||
|
{
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
// based on dot product
|
||||||
|
if (cpuinfo.sse4_1)
|
||||||
|
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(_mm_loadu_ps(v), _mm_loadu_ps(v), 0x31))); // 0b00110001
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
|
return sqrt(v[0] * v[0] + v[1] * v[1]);
|
||||||
|
}
|
||||||
|
|
||||||
/* <47722> ../engine/mathlib.c:532 */
|
/* <47722> ../engine/mathlib.c:532 */
|
||||||
float VectorNormalize(vec3_t v)
|
float VectorNormalize(vec3_t v)
|
||||||
{
|
{
|
||||||
@ -457,7 +499,7 @@ NOBODY void VectorMatrix(vec_t *forward, vec_t *right, vec_t *up);
|
|||||||
/* <4794e> ../engine/mathlib.c:597 */
|
/* <4794e> ../engine/mathlib.c:597 */
|
||||||
void VectorAngles(const vec_t *forward, vec_t *angles)
|
void VectorAngles(const vec_t *forward, vec_t *angles)
|
||||||
{
|
{
|
||||||
float tmp, yaw, pitch;
|
float length, yaw, pitch;
|
||||||
|
|
||||||
if (forward[1] == 0 && forward[0] == 0)
|
if (forward[1] == 0 && forward[0] == 0)
|
||||||
{
|
{
|
||||||
@ -473,8 +515,13 @@ void VectorAngles(const vec_t *forward, vec_t *angles)
|
|||||||
if (yaw < 0)
|
if (yaw < 0)
|
||||||
yaw += 360;
|
yaw += 360;
|
||||||
|
|
||||||
tmp = sqrt((double)(forward[0] * forward[0] + forward[1] * forward[1]));
|
#ifdef REHLDS_FIXES
|
||||||
pitch = (atan2((double)forward[2], (double)tmp) * 180.0 / M_PI);
|
length = Length2D(forward);
|
||||||
|
#else // REHLDS_FIXES
|
||||||
|
length = sqrt((double)(forward[0] * forward[0] + forward[1] * forward[1]));
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
|
pitch = atan2((double)forward[2], (double)length) * 180.0 / M_PI;
|
||||||
if (pitch < 0)
|
if (pitch < 0)
|
||||||
pitch += 360;
|
pitch += 360;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ NOBODY void NormalizeAngles(float *angles);
|
|||||||
NOBODY void InterpolateAngles(float *start, float *end, float *output, float frac);
|
NOBODY void InterpolateAngles(float *start, float *end, float *output, float frac);
|
||||||
void VectorTransform(const vec_t *in1, float *in2, vec_t *out);
|
void VectorTransform(const vec_t *in1, float *in2, vec_t *out);
|
||||||
int VectorCompare(const vec_t *v1, const vec_t *v2);
|
int VectorCompare(const vec_t *v1, const vec_t *v2);
|
||||||
void VectorMA(const vec_t *veca, float scale, const vec_t *vecb, vec_t *vecc);
|
void VectorMA(const vec_t *veca, float scale, const vec_t *vecm, vec_t *out);
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
float _DotProduct(const vec_t *v1, const vec_t *v2); // with sse support
|
float _DotProduct(const vec_t *v1, const vec_t *v2); // with sse support
|
||||||
#else // REHLDS_FIXES
|
#else // REHLDS_FIXES
|
||||||
@ -81,6 +81,7 @@ void _VectorAdd(vec_t *veca, vec_t *vecb, vec_t *out);
|
|||||||
NOBODY void _VectorCopy(vec_t *in, vec_t *out);
|
NOBODY void _VectorCopy(vec_t *in, vec_t *out);
|
||||||
void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross);
|
void CrossProduct(const vec_t *v1, const vec_t *v2, vec_t *cross);
|
||||||
float Length(const vec_t *v);
|
float Length(const vec_t *v);
|
||||||
|
float Length2D(const vec_t *v);
|
||||||
float VectorNormalize(vec_t *v);
|
float VectorNormalize(vec_t *v);
|
||||||
NOBODY void VectorInverse(vec_t *v);
|
NOBODY void VectorInverse(vec_t *v);
|
||||||
void VectorScale(const vec_t *in, float scale, vec_t *out);
|
void VectorScale(const vec_t *in, float scale, vec_t *out);
|
||||||
|
@ -99,7 +99,7 @@ mleaf_t *Mod_PointInLeaf(vec_t *p, model_t *model)
|
|||||||
{
|
{
|
||||||
plane = node->plane;
|
plane = node->plane;
|
||||||
if (plane->type >= 3u)
|
if (plane->type >= 3u)
|
||||||
d = plane->normal[2] * p[2] + plane->normal[1] * p[1] + plane->normal[0] * p[0] - plane->dist;
|
d = _DotProduct(plane->normal, p) - plane->dist;
|
||||||
else
|
else
|
||||||
d = p[plane->type] - plane->dist;
|
d = p[plane->type] - plane->dist;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ qboolean IsCZPlayerModel(uint32 crc, const char * filename)
|
|||||||
model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
||||||
{
|
{
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
char tmpName[260];
|
char tmpName[MAX_PATH];
|
||||||
int length;
|
int length;
|
||||||
CRC32_t currentCRC;
|
CRC32_t currentCRC;
|
||||||
|
|
||||||
@ -282,11 +282,11 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
|||||||
while (*(p++) == '/')
|
while (*(p++) == '/')
|
||||||
;
|
;
|
||||||
|
|
||||||
strncpy(tmpName, p, 259);
|
strncpy(tmpName, p, sizeof(tmpName) - 1);
|
||||||
tmpName[259] = 0;
|
tmpName[sizeof(tmpName) - 1] = '\0';
|
||||||
|
|
||||||
strncpy(mod->name, tmpName, 63);
|
strncpy(mod->name, tmpName, sizeof(mod->name) - 1);
|
||||||
mod->name[63] = 0;
|
mod->name[sizeof(mod->name) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = COM_LoadFileForMe(mod->name, &length);
|
buf = COM_LoadFileForMe(mod->name, &length);
|
||||||
@ -383,7 +383,7 @@ void Mod_AdInit(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
char *s;
|
||||||
static char filename[260];
|
static char filename[MAX_PATH];
|
||||||
|
|
||||||
tested = 1;
|
tested = 1;
|
||||||
i = COM_CheckParm("-ad");
|
i = COM_CheckParm("-ad");
|
||||||
@ -392,7 +392,7 @@ void Mod_AdInit(void)
|
|||||||
s = com_argv[i + 1];
|
s = com_argv[i + 1];
|
||||||
if (s && *s)
|
if (s && *s)
|
||||||
{
|
{
|
||||||
_snprintf(filename, 0x104u, "%s", s);
|
_snprintf(filename, MAX_PATH, "%s", s);
|
||||||
if (FS_FileSize(filename) > 0)
|
if (FS_FileSize(filename) > 0)
|
||||||
{
|
{
|
||||||
Sys_Error("Mod_Init(): reverse me");
|
Sys_Error("Mod_Init(): reverse me");
|
||||||
|
@ -50,10 +50,10 @@ float PM_TraceModel(physent_t *pEnt, vec_t *start, vec_t *end, trace_t *trace)
|
|||||||
pmove->usehull = 2;
|
pmove->usehull = 2;
|
||||||
pHull = PM_HullForBsp(pEnt, offset);
|
pHull = PM_HullForBsp(pEnt, offset);
|
||||||
pmove->usehull = saveHull;
|
pmove->usehull = saveHull;
|
||||||
start_l[0] = *start - offset[0];
|
start_l[0] = start[0] - offset[0];
|
||||||
start_l[1] = start[1] - offset[1];
|
start_l[1] = start[1] - offset[1];
|
||||||
start_l[2] = start[2] - offset[2];
|
start_l[2] = start[2] - offset[2];
|
||||||
end_l[0] = *end - offset[0];
|
end_l[0] = end[0] - offset[0];
|
||||||
end_l[1] = end[1] - offset[1];
|
end_l[1] = end[1] - offset[1];
|
||||||
end_l[2] = end[2] - offset[2];
|
end_l[2] = end[2] - offset[2];
|
||||||
SV_RecursiveHullCheck(pHull, pHull->firstclipnode, 0.0, 1.0, start_l, end_l, trace);
|
SV_RecursiveHullCheck(pHull, pHull->firstclipnode, 0.0, 1.0, start_l, end_l, trace);
|
||||||
@ -127,14 +127,13 @@ int PM_HullPointContents(hull_t *hull, int num, vec_t *p)
|
|||||||
if (num < hull->firstclipnode || num > hull->lastclipnode)
|
if (num < hull->firstclipnode || num > hull->lastclipnode)
|
||||||
Sys_Error("PM_HullPointContents: bad node number");
|
Sys_Error("PM_HullPointContents: bad node number");
|
||||||
node = &hull->clipnodes[num];
|
node = &hull->clipnodes[num];
|
||||||
plane = &hull->planes[hull->clipnodes[num].planenum];
|
plane = &hull->planes[node->planenum];
|
||||||
|
|
||||||
double tmpDist;
|
|
||||||
if (plane->type >= 3)
|
if (plane->type >= 3)
|
||||||
tmpDist = plane->normal[2] * p[2] + plane->normal[1] * p[1] + plane->normal[0] * *p;
|
d = _DotProduct(p, plane->normal) - plane->dist;
|
||||||
else
|
else
|
||||||
tmpDist = p[plane->type];
|
d = p[plane->type] - plane->dist;
|
||||||
d = (float)(tmpDist - plane->dist);
|
|
||||||
if (d >= 0.0)
|
if (d >= 0.0)
|
||||||
num = node->children[0];
|
num = node->children[0];
|
||||||
else
|
else
|
||||||
@ -331,13 +330,13 @@ int _PM_TestPlayerPosition(vec_t *pos, pmtrace_t *ptrace, int(*pfnIgnore)(physen
|
|||||||
test[2] = pos[2] - offset[2];
|
test[2] = pos[2] - offset[2];
|
||||||
if (pe->solid == 4 && (pe->angles[0] != 0.0 || pe->angles[1] != 0.0 || pe->angles[2] != 0.0))
|
if (pe->solid == 4 && (pe->angles[0] != 0.0 || pe->angles[1] != 0.0 || pe->angles[2] != 0.0))
|
||||||
{
|
{
|
||||||
vec3_t forward, right, up, temp;
|
vec3_t forward, right, up;
|
||||||
|
|
||||||
AngleVectors(pe->angles, forward, right, up);
|
AngleVectors(pe->angles, forward, right, up);
|
||||||
temp[0] = test[0]; temp[1] = test[1]; temp[2] = test[2];
|
|
||||||
test[0] = forward[2] * test[2] + forward[1] * test[1] + forward[0] * test[0];
|
vec3_t temp = {test[0], test[1], test[2]};
|
||||||
test[1] = -(right[0] * temp[0] + right[2] * test[2] + right[1] * test[1]);
|
test[0] = _DotProduct(forward, temp);
|
||||||
test[2] = up[1] * temp[1] + up[0] * temp[0] + up[2] * test[2];
|
test[1] = -_DotProduct(right, temp);
|
||||||
|
test[2] = _DotProduct(up, temp);
|
||||||
}
|
}
|
||||||
if (numhulls != 1)
|
if (numhulls != 1)
|
||||||
{
|
{
|
||||||
@ -480,18 +479,20 @@ pmtrace_t _PM_PlayerTrace(vec_t *start, vec_t *end, int traceFlags, int numphyse
|
|||||||
|
|
||||||
if (pe->solid == SOLID_BSP && (pe->angles[0] != 0.0 || pe->angles[1] != 0.0 || pe->angles[2] != 0.0))
|
if (pe->solid == SOLID_BSP && (pe->angles[0] != 0.0 || pe->angles[1] != 0.0 || pe->angles[2] != 0.0))
|
||||||
{
|
{
|
||||||
vec3_t temp, forward, right, up;
|
vec3_t forward, right, up;
|
||||||
rotated = true;
|
|
||||||
AngleVectors(pe->angles, forward, right, up);
|
AngleVectors(pe->angles, forward, right, up);
|
||||||
temp[0] = start_l[0]; temp[1] = start_l[1]; temp[2] = start_l[2];
|
|
||||||
start_l[0] = forward[2] * start_l[2] + forward[1] * start_l[1] + forward[0] * start_l[0];
|
|
||||||
start_l[1] = -(right[0] * temp[0] + right[2] * start_l[2] + right[1] * start_l[1]);
|
|
||||||
start_l[2] = up[1] * temp[1] + up[0] * temp[0] + up[2] * start_l[2];
|
|
||||||
|
|
||||||
temp[0] = end_l[0]; temp[1] = end_l[1]; temp[2] = end_l[2];
|
vec3_t temp_start = {start_l[0], start_l[1], start_l[2]};
|
||||||
end_l[0] = forward[2] * end_l[2] + forward[1] * end_l[1] + forward[0] * end_l[0];
|
start_l[0] = _DotProduct(forward, temp_start);
|
||||||
end_l[1] = -(right[0] * temp[0] + right[2] * end_l[2] + right[1] * end_l[1]);
|
start_l[1] = -_DotProduct(right, temp_start);
|
||||||
end_l[2] = up[1] * temp[1] + up[0] * temp[0] + up[2] * end_l[2];
|
start_l[2] = _DotProduct(up, temp_start);
|
||||||
|
|
||||||
|
vec3_t temp_end = {end_l[0], end_l[1], end_l[2]};
|
||||||
|
end_l[0] = _DotProduct(forward, temp_end);
|
||||||
|
end_l[1] = -_DotProduct(right, temp_end);
|
||||||
|
end_l[2] = _DotProduct(up, temp_end);
|
||||||
|
|
||||||
|
rotated = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -550,13 +551,13 @@ pmtrace_t _PM_PlayerTrace(vec_t *start, vec_t *end, int traceFlags, int numphyse
|
|||||||
{
|
{
|
||||||
if (rotated)
|
if (rotated)
|
||||||
{
|
{
|
||||||
vec3_t temp, forward, right, up;
|
vec3_t forward, right, up;
|
||||||
AngleVectorsTranspose(pe->angles, forward, right, up);
|
AngleVectorsTranspose(pe->angles, forward, right, up);
|
||||||
|
|
||||||
temp[0] = total.plane.normal[0]; temp[1] = total.plane.normal[1]; temp[2] = total.plane.normal[2];
|
vec3_t temp = {total.plane.normal[0], total.plane.normal[1], total.plane.normal[2]};
|
||||||
total.plane.normal[0] = forward[2] * total.plane.normal[2] + forward[1] * total.plane.normal[1] + forward[0] * total.plane.normal[0];
|
total.plane.normal[0] = _DotProduct(forward, temp);
|
||||||
total.plane.normal[1] = right[2] * total.plane.normal[2] + right[1] * total.plane.normal[1] + right[0] * temp[0];
|
total.plane.normal[1] = _DotProduct(right, temp);
|
||||||
total.plane.normal[2] = up[2] * total.plane.normal[2] + up[1] * temp[1] + up[0] * temp[0];
|
total.plane.normal[2] = _DotProduct(up, temp);
|
||||||
}
|
}
|
||||||
total.endpos[0] = (end[0] - start[0]) * total.fraction + start[0];
|
total.endpos[0] = (end[0] - start[0]) * total.fraction + start[0];
|
||||||
total.endpos[1] = (end[1] - start[1]) * total.fraction + start[1];
|
total.endpos[1] = (end[1] - start[1]) * total.fraction + start[1];
|
||||||
@ -601,21 +602,13 @@ struct pmtrace_s *PM_TraceLine(float *start, float *end, int flags, int usehull,
|
|||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
if (flags == 1)
|
if (flags == 1)
|
||||||
{
|
|
||||||
tr = _PM_PlayerTrace(start, end, 0, pmove->numvisent, pmove->visents, ignore_pe, 0);
|
tr = _PM_PlayerTrace(start, end, 0, pmove->numvisent, pmove->visents, ignore_pe, 0);
|
||||||
pmove->usehull = oldhull;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pmove->usehull = oldhull;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tr = _PM_PlayerTrace(start, end, 0, pmove->numphysent, pmove->physents, ignore_pe, 0);
|
tr = _PM_PlayerTrace(start, end, 0, pmove->numphysent, pmove->physents, ignore_pe, 0);
|
||||||
pmove->usehull = oldhull;
|
|
||||||
}
|
}
|
||||||
|
pmove->usehull = oldhull;
|
||||||
return &tr;
|
return &tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,15 +622,13 @@ struct pmtrace_s *PM_TraceLineEx(float *start, float *end, int flags, int usehul
|
|||||||
pmove->usehull = usehull;
|
pmove->usehull = usehull;
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
tr = _PM_PlayerTrace(start, end, 0, pmove->numvisent, pmove->visents, -1, pfnIgnore);
|
tr = _PM_PlayerTrace(start, end, 0, pmove->numvisent, pmove->visents, -1, pfnIgnore);
|
||||||
pmove->usehull = oldhull;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tr = PM_PlayerTraceEx(start, end, 0, pfnIgnore);
|
tr = PM_PlayerTraceEx(start, end, 0, pfnIgnore);
|
||||||
pmove->usehull = oldhull;
|
|
||||||
}
|
}
|
||||||
|
pmove->usehull = oldhull;
|
||||||
return &tr;
|
return &tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,4 +945,4 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // REHLDS_OPT_PEDANTIC
|
#endif // REHLDS_OPT_PEDANTIC
|
@ -459,8 +459,8 @@ msurface_t *SurfaceAtPoint(model_t *pModel, mnode_t *node, vec_t *start, vec_t *
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
plane = node->plane;
|
plane = node->plane;
|
||||||
front = start[2] * plane->normal[2] + plane->normal[0] * start[0] + start[1] * plane->normal[1] - plane->dist;
|
front = _DotProduct(start, plane->normal) - plane->dist;
|
||||||
back = plane->normal[0] * end[0] + plane->normal[2] * end[2] + plane->normal[1] * end[1] - plane->dist;
|
back = _DotProduct(end, plane->normal) - plane->dist;
|
||||||
s = (front < 0.0f) ? 1 : 0;
|
s = (front < 0.0f) ? 1 : 0;
|
||||||
t = (back < 0.0f) ? 1 : 0;
|
t = (back < 0.0f) ? 1 : 0;
|
||||||
if (t == s)
|
if (t == s)
|
||||||
@ -481,8 +481,8 @@ msurface_t *SurfaceAtPoint(model_t *pModel, mnode_t *node, vec_t *start, vec_t *
|
|||||||
{
|
{
|
||||||
surf = &pModel->surfaces[node->firstsurface + i];
|
surf = &pModel->surfaces[node->firstsurface + i];
|
||||||
tex = surf->texinfo;
|
tex = surf->texinfo;
|
||||||
ds = (int)(mid[2] * tex->vecs[0][2] + mid[1] * tex->vecs[0][1] + mid[0] * tex->vecs[0][0] + tex->vecs[0][3]);
|
ds = (int)_DotProduct(mid, tex->vecs[0]);
|
||||||
dt = (int)(mid[2] * tex->vecs[1][2] + mid[1] * tex->vecs[1][1] + mid[0] * tex->vecs[1][0] + tex->vecs[1][3]);
|
dt = (int)_DotProduct(mid, tex->vecs[1]);
|
||||||
if (ds >= surf->texturemins[0])
|
if (ds >= surf->texturemins[0])
|
||||||
{
|
{
|
||||||
if (dt >= surf->texturemins[1])
|
if (dt >= surf->texturemins[1])
|
||||||
@ -532,14 +532,14 @@ const char *TraceTexture(edict_t *pTextureEntity, const float *v1, const float *
|
|||||||
AngleVectors(pTextureEntity->v.angles, forward, right, up);
|
AngleVectors(pTextureEntity->v.angles, forward, right, up);
|
||||||
|
|
||||||
temp[0] = start[0]; temp[1] = start[1]; temp[2] = start[2];
|
temp[0] = start[0]; temp[1] = start[1]; temp[2] = start[2];
|
||||||
start[0] = forward[2] * start[2] + forward[1] * start[1] + forward[0] * start[0];
|
start[0] = _DotProduct(forward, temp);
|
||||||
start[1] = -(right[0] * temp[0] + right[2] * start[2] + right[1] * start[1]);
|
start[1] = -_DotProduct(right, temp);
|
||||||
start[2] = up[1] * temp[1] + up[0] * temp[0] + up[2] * start[2];
|
start[2] = _DotProduct(up, temp);
|
||||||
|
|
||||||
temp[0] = end[0]; temp[1] = end[1]; temp[2] = end[2];
|
temp[0] = end[0]; temp[1] = end[1]; temp[2] = end[2];
|
||||||
end[0] = forward[2] * end[2] + forward[1] * end[1] + forward[0] * end[0];
|
end[0] = _DotProduct(forward, temp);
|
||||||
end[1] = -(right[0] * temp[0] + right[2] * end[2] + right[1] * end[1]);
|
end[1] = -_DotProduct(right, temp);
|
||||||
end[2] = up[1] * temp[1] + up[0] * temp[0] + up[2] * end[2];
|
end[2] = _DotProduct(up, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1933,10 +1933,10 @@ edict_t *PF_CreateFakeClient_I(const char *netname)
|
|||||||
ent->v.pContainingEntity = ent;
|
ent->v.pContainingEntity = ent;
|
||||||
ent->v.flags = FL_FAKECLIENT | FL_CLIENT;
|
ent->v.flags = FL_FAKECLIENT | FL_CLIENT;
|
||||||
|
|
||||||
Info_SetValueForKey(fakeclient->userinfo, "name", netname, 256);
|
Info_SetValueForKey(fakeclient->userinfo, "name", netname, MAX_INFO_STRING);
|
||||||
Info_SetValueForKey(fakeclient->userinfo, "model", "gordon", 256);
|
Info_SetValueForKey(fakeclient->userinfo, "model", "gordon", MAX_INFO_STRING);
|
||||||
Info_SetValueForKey(fakeclient->userinfo, "topcolor", "1", 256);
|
Info_SetValueForKey(fakeclient->userinfo, "topcolor", "1", MAX_INFO_STRING);
|
||||||
Info_SetValueForKey(fakeclient->userinfo, "bottomcolor", "1", 256);
|
Info_SetValueForKey(fakeclient->userinfo, "bottomcolor", "1", MAX_INFO_STRING);
|
||||||
fakeclient->sendinfo = 1;
|
fakeclient->sendinfo = 1;
|
||||||
SV_ExtractFromUserinfo(fakeclient);
|
SV_ExtractFromUserinfo(fakeclient);
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ int ClipVelocity(vec_t *in, vec_t *normal, vec_t *out, float overbounce)
|
|||||||
if (normal[2] == 0.0)
|
if (normal[2] == 0.0)
|
||||||
blocked |= 2u;
|
blocked |= 2u;
|
||||||
|
|
||||||
float backoff = (in[0] * normal[0] + in[1] * normal[1] + normal[2] * in[2]) * overbounce;
|
float backoff = _DotProduct(in, normal) * overbounce;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
float tmp = normal[i] * backoff;
|
float tmp = normal[i] * backoff;
|
||||||
@ -231,7 +231,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
|||||||
|
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
end[i] = time * ent->v.velocity[i] + ent->v.origin[i];
|
VectorMA(ent->v.origin, time, ent->v.velocity, end);
|
||||||
|
|
||||||
trace_t trace = SV_Move(ent->v.origin, ent->v.mins, ent->v.maxs, end, 0, ent, monsterClip);
|
trace_t trace = SV_Move(ent->v.origin, ent->v.mins, ent->v.maxs, end, 0, ent, monsterClip);
|
||||||
if (trace.allsolid)
|
if (trace.allsolid)
|
||||||
@ -314,7 +314,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
|||||||
if (j == i)
|
if (j == i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (new_velocity[2] * planes[j][2] + new_velocity[0] * planes[j][0] + new_velocity[1] * planes[j][1] < 0.0f)
|
if (_DotProduct(new_velocity, planes[j]) < 0.0f)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j == numplanes)
|
if (j == numplanes)
|
||||||
@ -326,8 +326,8 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
|||||||
return blocked;
|
return blocked;
|
||||||
|
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
CrossProduct((const vec_t *)planes, planes[1], dir);
|
CrossProduct(planes[0], planes[1], dir);
|
||||||
float vscale = dir[2] * ent->v.velocity[2] + dir[0] * ent->v.velocity[0] + dir[1] * ent->v.velocity[1];
|
float vscale = _DotProduct(dir, ent->v.velocity);
|
||||||
VectorScale(dir, vscale, ent->v.velocity);
|
VectorScale(dir, vscale, ent->v.velocity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -337,9 +337,7 @@ int SV_FlyMove(edict_t *ent, float time, trace_t *steptrace)
|
|||||||
ent->v.velocity[0] = new_velocity[0];
|
ent->v.velocity[0] = new_velocity[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (original_velocity[2] * ent->v.velocity[2]
|
if (_DotProduct(original_velocity, ent->v.velocity) <= 0.0f)
|
||||||
+ original_velocity[0] * ent->v.velocity[0]
|
|
||||||
+ original_velocity[1] * ent->v.velocity[1] <= 0.0f)
|
|
||||||
{
|
{
|
||||||
ent->v.velocity[0] = vec3_origin[0];
|
ent->v.velocity[0] = vec3_origin[0];
|
||||||
ent->v.velocity[1] = vec3_origin[1];
|
ent->v.velocity[1] = vec3_origin[1];
|
||||||
@ -417,7 +415,7 @@ trace_t SV_PushEntity(edict_t *ent, vec_t *push)
|
|||||||
vec3_t end; // 518
|
vec3_t end; // 518
|
||||||
int moveType;
|
int moveType;
|
||||||
|
|
||||||
end[0] = ent->v.origin[0] + push[0];
|
end[0] = push[0] + ent->v.origin[0];
|
||||||
end[1] = push[1] + ent->v.origin[1];
|
end[1] = push[1] + ent->v.origin[1];
|
||||||
end[2] = push[2] + ent->v.origin[2];
|
end[2] = push[2] + ent->v.origin[2];
|
||||||
|
|
||||||
@ -637,7 +635,7 @@ int SV_PushRotate(edict_t *pusher, float movetime)
|
|||||||
Sys_Error("Out of edicts in simulator!\n");
|
Sys_Error("Out of edicts in simulator!\n");
|
||||||
|
|
||||||
vec3_t start, end, push, move;
|
vec3_t start, end, push, move;
|
||||||
float start_off2;
|
|
||||||
if (check->v.movetype == MOVETYPE_PUSHSTEP)
|
if (check->v.movetype == MOVETYPE_PUSHSTEP)
|
||||||
{
|
{
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
@ -646,24 +644,23 @@ int SV_PushRotate(edict_t *pusher, float movetime)
|
|||||||
org[2] = (check->v.absmax[2] + check->v.absmin[2]) * 0.5f;
|
org[2] = (check->v.absmax[2] + check->v.absmin[2]) * 0.5f;
|
||||||
start[0] = org[0] - pusher->v.origin[0];
|
start[0] = org[0] - pusher->v.origin[0];
|
||||||
start[1] = org[1] - pusher->v.origin[1];
|
start[1] = org[1] - pusher->v.origin[1];
|
||||||
start_off2 = org[2];
|
start[2] = org[2] - pusher->v.origin[2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start[0] = check->v.origin[0] - pusher->v.origin[0];
|
start[0] = check->v.origin[0] - pusher->v.origin[0];
|
||||||
start[1] = check->v.origin[1] - pusher->v.origin[1];
|
start[1] = check->v.origin[1] - pusher->v.origin[1];
|
||||||
start_off2 = check->v.origin[2];
|
start[2] = check->v.origin[2] - pusher->v.origin[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
start[2] = start_off2 - pusher->v.origin[2];
|
|
||||||
pusher->v.solid = SOLID_NOT;
|
pusher->v.solid = SOLID_NOT;
|
||||||
|
|
||||||
move[0] = forward[2] * start[2] + forward[1] * start[1] + forward[0] * start[0];
|
move[0] = _DotProduct(forward, start);
|
||||||
move[1] = -(right[2] * start[2] + right[1] * start[1] + right[0] * start[0]);
|
move[1] = -_DotProduct(right, start);
|
||||||
move[2] = up[2] * start[2] + up[1] * start[1] + up[0] * start[0];
|
move[2] = _DotProduct(up, start);
|
||||||
end[0] = forwardNow[2] * move[2] + forwardNow[1] * move[1] + forwardNow[0] * move[0];
|
end[0] = _DotProduct(forwardNow, move);
|
||||||
end[1] = rightNow[2] * move[2] + rightNow[1] * move[1] + rightNow[0] * move[0];
|
end[1] = _DotProduct(rightNow, move);
|
||||||
end[2] = upNow[2] * move[2] + upNow[1] * move[1] + upNow[0] * move[0];
|
end[2] = _DotProduct(upNow, move);
|
||||||
push[0] = end[0] - start[0];
|
push[0] = end[0] - start[0];
|
||||||
push[1] = end[1] - start[1];
|
push[1] = end[1] - start[1];
|
||||||
push[2] = end[2] - start[2];
|
push[2] = end[2] - start[2];
|
||||||
@ -1113,12 +1110,13 @@ void SV_Physics_Toss(edict_t *ent)
|
|||||||
ent->v.groundentity = trace.ent;
|
ent->v.groundentity = trace.ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (move[2] * move[2] + move[1] * move[1] + move[0] * move[0] >= 900.0f)
|
if (_DotProduct(move, move) >= 900.0f)
|
||||||
{
|
{
|
||||||
if (ent->v.movetype == MOVETYPE_BOUNCE || ent->v.movetype == MOVETYPE_BOUNCEMISSILE)
|
if (ent->v.movetype == MOVETYPE_BOUNCE || ent->v.movetype == MOVETYPE_BOUNCEMISSILE)
|
||||||
{
|
{
|
||||||
VectorScale(ent->v.velocity, (float)((1.0 - trace.fraction) * host_frametime * 0.9f), move);
|
float scale = (1.0 - trace.fraction) * host_frametime * 0.9f;
|
||||||
VectorMA(move, (float)((1.0 - trace.fraction) * host_frametime * 0.9f), ent->v.basevelocity, move);
|
VectorScale(ent->v.velocity, scale, move);
|
||||||
|
VectorMA(move, scale, ent->v.basevelocity, move);
|
||||||
SV_PushEntity(ent, move);
|
SV_PushEntity(ent, move);
|
||||||
SV_CheckWaterTransition(ent);
|
SV_CheckWaterTransition(ent);
|
||||||
return;
|
return;
|
||||||
@ -1154,10 +1152,10 @@ void PF_WaterMove(edict_t *pSelf)
|
|||||||
if (pSelf->v.health < 0.0)
|
if (pSelf->v.health < 0.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drownlevel = (pSelf->v.deadflag) ? 1.0f : 3.0f;
|
drownlevel = pSelf->v.deadflag ? 1.0f : 3.0f;
|
||||||
flags = pSelf->v.flags;
|
|
||||||
waterlevel = pSelf->v.waterlevel;
|
waterlevel = pSelf->v.waterlevel;
|
||||||
watertype = pSelf->v.watertype;
|
watertype = pSelf->v.watertype;
|
||||||
|
flags = pSelf->v.flags;
|
||||||
if (!(flags & (FL_IMMUNE_WATER | FL_GODMODE)))
|
if (!(flags & (FL_IMMUNE_WATER | FL_GODMODE)))
|
||||||
{
|
{
|
||||||
if (flags & FL_SWIM && (waterlevel < drownlevel)
|
if (flags & FL_SWIM && (waterlevel < drownlevel)
|
||||||
|
@ -95,6 +95,7 @@
|
|||||||
#define STDCALL __stdcall
|
#define STDCALL __stdcall
|
||||||
#define HIDDEN
|
#define HIDDEN
|
||||||
#define NOINLINE __declspec(noinline)
|
#define NOINLINE __declspec(noinline)
|
||||||
|
#define ALIGN16 __declspec(align(16))
|
||||||
|
|
||||||
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
|
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
|
||||||
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); }
|
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); }
|
||||||
@ -129,6 +130,7 @@
|
|||||||
#define STDCALL __attribute__ ((stdcall))
|
#define STDCALL __attribute__ ((stdcall))
|
||||||
#define HIDDEN __attribute__((visibility("hidden")))
|
#define HIDDEN __attribute__((visibility("hidden")))
|
||||||
#define NOINLINE __attribute__((noinline))
|
#define NOINLINE __attribute__((noinline))
|
||||||
|
#define ALIGN16 __attribute__((aligned(16)))
|
||||||
|
|
||||||
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
|
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
|
||||||
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); }
|
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); }
|
||||||
|
Loading…
Reference in New Issue
Block a user