Fix Crash due to NaN origin

This commit is contained in:
Simon 2019-08-21 12:24:17 +01:00
parent 29eb944dad
commit 2d5d07ae7e
3 changed files with 28 additions and 14 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.quakequest"
android:versionCode="10"
android:versionName="1.4.1" android:installLocation="auto" >
android:versionName="1.4.2" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -3611,7 +3611,7 @@ static void M_Credits_Draw (void)
" QQQQQQQQ QQQQQQQQ ",
" QQQ QQQ ",
" Q Q ",
" Q Q v1.4.1 ");
" Q Q v1.4.2 ");
int i, l, linelength, firstline, lastline, lines;
for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_credits_message[i];i++)

View file

@ -2999,33 +2999,47 @@ void SV_Physics_ClientMove(void)
}
}
vec3_t origin_b, oldorigin_b;
vec3_t origin_b;
extern cvar_t cl_trackingmode;
static void SV_SetWeapon_ClientOrigin(prvm_edict_t *ent)
{
prvm_prog_t *prog = SVVM_prog;
//Backup origin
VectorCopy(PRVM_serveredictvector(ent, origin), origin_b);
VectorCopy(PRVM_serveredictvector(ent, oldorigin), oldorigin_b);
VectorCopy(gunorg, PRVM_serveredictvector(ent, origin));
VectorCopy(gunorg, PRVM_serveredictvector(ent, oldorigin));
if (cl_trackingmode.integer != 0) //6DoF
//Check gun origin validity
for (int i = 0; i < 3; ++i)
{
PRVM_serveredictvector(ent, origin)[2] -= 16.0f;
PRVM_serveredictvector(ent, oldorigin)[2] -= 16.0f;
} else { //3DoF
PRVM_serveredictvector(ent, origin)[2] -= 23.0f;
PRVM_serveredictvector(ent, oldorigin)[2] -= 23.0f;
//Check for valid number
if (PRVM_IS_NAN(gunorg[i]) || (fabsf(gunorg[i]) > 1000000.0f)) {
Con_Printf("Got a NaN origin for weapon on entity #%i (%s)\n", PRVM_NUM_FOR_EDICT(ent),
PRVM_GetString(prog, PRVM_serveredictstring(ent, classname)));
//Just drop out, normal origin will be used in this case
return;
}
}
vec3_t temp_gun_org;
VectorCopy(gunorg, temp_gun_org);
if (cl_trackingmode.integer != 0)
{ //6DoF
temp_gun_org[2] -= 16.0f;
}
else
{ //3DoF
temp_gun_org[2] -= 23.0f;
}
VectorCopy(temp_gun_org, PRVM_serveredictvector(ent, origin));
}
static void SV_Restore_ClientOrigin(prvm_edict_t *ent)
{
prvm_prog_t *prog = SVVM_prog;
VectorCopy(origin_b, PRVM_serveredictvector(ent, origin));
VectorCopy(oldorigin_b, PRVM_serveredictvector(ent, oldorigin));
}
static void SV_Physics_ClientEntity_PreThink(prvm_edict_t *ent)