mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-02-28 14:21:16 +00:00
Weapon Scaling
Now working correctly Also implemented the height adjust (for seated play)
This commit is contained in:
parent
0389a33e5b
commit
ab47451b12
11 changed files with 55 additions and 29 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.rtcwquest"
|
||||
android:versionCode="3"
|
||||
android:versionName="0.3.0" android:installLocation="auto" >
|
||||
android:versionCode="4"
|
||||
android:versionName="0.4.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
|
|
@ -3586,7 +3586,7 @@ void CG_DrawActive( int stereoView ) {
|
|||
//Vertical Positional Movement
|
||||
if (!cg.cameraMode) {
|
||||
cg.refdef.vieworg[2] -= 64;
|
||||
cg.refdef.vieworg[2] += (cgVR->hmdposition[1] /*+ vr_height_adjust->value*/) * cg_worldScale.value;
|
||||
cg.refdef.vieworg[2] += (cgVR->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
}
|
||||
|
||||
cg.refdef.glfog.registered = 0; // make sure it doesn't use fog from another scene
|
||||
|
|
|
@ -1705,6 +1705,7 @@ extern vmCvar_t cg_thirdPerson;
|
|||
extern vmCvar_t cg_stereoSeparation;
|
||||
extern vmCvar_t cg_worldScale;
|
||||
extern vmCvar_t cg_weaponScale;
|
||||
extern vmCvar_t cg_heightAdjust;
|
||||
extern vmCvar_t cg_lagometer;
|
||||
extern vmCvar_t cg_drawAttacker;
|
||||
extern vmCvar_t cg_synchronousClients;
|
||||
|
|
|
@ -192,6 +192,7 @@ vmCvar_t cg_thirdPersonAngle;
|
|||
vmCvar_t cg_stereoSeparation;
|
||||
vmCvar_t cg_worldScale;
|
||||
vmCvar_t cg_weaponScale;
|
||||
vmCvar_t cg_heightAdjust;
|
||||
vmCvar_t cg_lagometer;
|
||||
vmCvar_t cg_drawAttacker;
|
||||
vmCvar_t cg_synchronousClients;
|
||||
|
@ -313,7 +314,8 @@ cvarTable_t cvarTable[] = {
|
|||
{ &cg_letterbox, "cg_letterbox", "0", CVAR_TEMP }, //----(SA) added
|
||||
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
|
||||
{ &cg_worldScale, "cg_worldScale", "37.5", CVAR_ARCHIVE },
|
||||
{ &cg_weaponScale, "cg_weaponScale", "1.0", CVAR_ARCHIVE },
|
||||
{ &cg_weaponScale, "cg_weaponScale", "0.62", CVAR_ARCHIVE },
|
||||
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
|
||||
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
|
||||
{ &cg_gibs, "cg_gibs", "1", CVAR_ARCHIVE },
|
||||
{ &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
|
||||
|
|
|
@ -1781,6 +1781,16 @@ void convertFromVR(vec3_t in, vec3_t offset, vec3_t out)
|
|||
}
|
||||
}
|
||||
|
||||
static void CG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles ) {
|
||||
|
||||
convertFromVR(cgVR->weaponoffset, cg.refdef.vieworg, origin);
|
||||
origin[2] -= 64;
|
||||
origin[2] += (cgVR->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
|
||||
VectorCopy(cgVR->weaponangles, angles);
|
||||
angles[YAW] = cg.refdefViewAngles[YAW] + (cgVR->weaponangles[YAW] - cgVR->hmdorientation[YAW]);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_CalculateWeaponPosition
|
||||
|
@ -1790,19 +1800,14 @@ CG_CalculateWeaponPosition
|
|||
|
||||
static void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles ) {
|
||||
|
||||
convertFromVR(cgVR->weaponoffset, cg.refdef.vieworg, origin);
|
||||
origin[2] -= 64;
|
||||
origin[2] += (cgVR->hmdposition[1] /*+ vr_height_adjust->value*/) * cg_worldScale.value;
|
||||
|
||||
VectorCopy(cgVR->weaponangles, angles);
|
||||
angles[YAW] = cg.refdefViewAngles[YAW] + (cgVR->weaponangles[YAW] - cgVR->hmdorientation[YAW]);
|
||||
CG_CalculateVRWeaponPosition(origin, angles);
|
||||
|
||||
//Now move weapon closer to proper origin
|
||||
vec3_t forward, right, up;
|
||||
AngleVectors( angles, forward, right, up );
|
||||
VectorMA( origin, -18, forward, origin );
|
||||
VectorMA( origin, 8, up, origin );
|
||||
VectorMA( origin, -8, right, origin );
|
||||
VectorMA( origin, -10, forward, origin );
|
||||
VectorMA( origin, 7, up, origin );
|
||||
VectorMA( origin, -6, right, origin );
|
||||
return;
|
||||
|
||||
float scale;
|
||||
|
@ -1925,7 +1930,15 @@ static void CG_FlamethrowerFlame( centity_t *cent, vec3_t origin ) {
|
|||
// if (cent->currentState.aiChar)
|
||||
// CG_FireFlameChunks( cent, origin, cent->lerpAngles, 650.0 / FLAMETHROWER_RANGE, qtrue, 0 ); // fixed length for AI
|
||||
// else
|
||||
CG_FireFlameChunks( cent, origin, cent->lerpAngles, 1.0, qtrue, 0 );
|
||||
|
||||
if (cent->currentState.aiChar) {
|
||||
CG_FireFlameChunks(cent, origin, cent->lerpAngles, 1.0, qtrue, 0);
|
||||
} else {
|
||||
vec3_t origin, angles;
|
||||
CG_CalculateVRWeaponPosition(origin, angles);
|
||||
|
||||
CG_FireFlameChunks(cent, origin, angles, 1.0, qtrue, 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2683,11 +2696,6 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
|
|||
}
|
||||
}
|
||||
|
||||
for ( i = 0; i < 3; i++ ) { // scale weapon back up so it doesn't pick up the adjusted scale of the character models.
|
||||
// this will affect any parts attached to the gun as well (barrel/bolt/flash/brass/etc.)
|
||||
VectorScale( gun.axis[i], cg_weaponScale.value, gun.axis[i] );
|
||||
}
|
||||
|
||||
// characters that draw their own special weapon model will not draw the standard ones
|
||||
if ( CG_DrawRealWeapons( cent ) ) {
|
||||
drawrealweap = qtrue;
|
||||
|
@ -3146,6 +3154,11 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
|||
hand.hModel = weapon->handsModel;
|
||||
hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT; //----(SA)
|
||||
|
||||
//scale the whole model (hand and weapon)
|
||||
for ( int i = 0; i < 3; i++ ) {
|
||||
VectorScale( hand.axis[i], cg_weaponScale.value, hand.axis[i] );
|
||||
}
|
||||
|
||||
// add everything onto the hand
|
||||
CG_AddPlayerWeapon( &hand, ps, &cg.predictedPlayerEntity );
|
||||
// Ridah
|
||||
|
@ -6090,13 +6103,9 @@ static qboolean CG_CalcMuzzlePoint( int entityNum, vec3_t muzzle ) {
|
|||
int anim;
|
||||
|
||||
if ( entityNum == cg.snap->ps.clientNum ) {
|
||||
convertFromVR(cgVR->weaponoffset, cg.refdef.vieworg, muzzle);
|
||||
muzzle[2] -= 64;
|
||||
muzzle[2] += (cgVR->hmdposition[1] /*+ vr_height_adjust->value*/) * cg_worldScale.value;
|
||||
|
||||
vec3_t angles;
|
||||
VectorCopy(cgVR->weaponangles, angles);
|
||||
angles[YAW] = cg.refdefViewAngles[YAW] + (cgVR->weaponangles[YAW] - cgVR->hmdorientation[YAW]);
|
||||
CG_CalculateVRWeaponPosition(muzzle, angles);
|
||||
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
VectorMA( muzzle, 14, forward, muzzle );
|
||||
return qtrue;
|
||||
|
|
|
@ -75,7 +75,7 @@ float Com_GetFlamethrowerRange( void );
|
|||
#define VOTE_TIME 30000 // 30 seconds before vote times out
|
||||
|
||||
#define DEAD_SINK_DURATION 12000
|
||||
#define DEAD_SINK_DEPTH 64
|
||||
#define DEAD_SINK_DEPTH 56
|
||||
|
||||
// Ridah, disabled these
|
||||
//#define MINS_Z -24
|
||||
|
|
|
@ -1189,7 +1189,7 @@ void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *va
|
|||
void trap_Cvar_Update( vmCvar_t *cvar );
|
||||
void trap_Cvar_Set( const char *var_name, const char *value );
|
||||
int trap_Cvar_VariableIntegerValue( const char *var_name );
|
||||
float trap_Cvar_VariableValue( const char *var_name );
|
||||
int trap_Cvar_VariableValue( const char *var_name, float *pValue );
|
||||
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
|
||||
void trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient );
|
||||
void trap_DropClient( int clientNum, const char *reason );
|
||||
|
|
|
@ -136,6 +136,7 @@ typedef enum {
|
|||
G_CVAR_UPDATE, // ( vmCvar_t *vmCvar );
|
||||
G_CVAR_SET, // ( const char *var_name, const char *value );
|
||||
G_CVAR_VARIABLE_INTEGER_VALUE, // ( const char *var_name );
|
||||
G_CVAR_VARIABLE_VALUE, //( const char *var_name, float *returnvalue );
|
||||
|
||||
G_CVAR_VARIABLE_STRING_BUFFER, // ( const char *var_name, char *buffer, int bufsize );
|
||||
|
||||
|
|
|
@ -122,6 +122,10 @@ int trap_Cvar_VariableIntegerValue( const char *var_name ) {
|
|||
return syscall( G_CVAR_VARIABLE_INTEGER_VALUE, var_name );
|
||||
}
|
||||
|
||||
int trap_Cvar_VariableValue( const char *var_name, float *value ) {
|
||||
return syscall( G_CVAR_VARIABLE_VALUE, var_name, value );
|
||||
}
|
||||
|
||||
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
|
||||
syscall( G_CVAR_VARIABLE_STRING_BUFFER, var_name, buffer, bufsize );
|
||||
}
|
||||
|
|
|
@ -1682,8 +1682,11 @@ void CalcMuzzlePoint( gentity_t *ent, int weapon, vec3_t forward, vec3_t right,
|
|||
else if (gVR != NULL)
|
||||
{
|
||||
float worldscale = trap_Cvar_VariableIntegerValue("cg_worldScale");
|
||||
float heightAdjust = 0;
|
||||
trap_Cvar_VariableValue("cg_heightAdjust", &heightAdjust);
|
||||
convertFromVR(worldscale, ent, gVR->weaponoffset, ent->r.currentOrigin, muzzlePoint);
|
||||
muzzlePoint[2] += (gVR->hmdposition[1] /*+ vr_height_adjust->value*/) * worldscale;
|
||||
muzzlePoint[2] -= 24; // mmmmmmm magic number (
|
||||
muzzlePoint[2] += (gVR->hmdposition[1] + heightAdjust) * worldscale;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1740,8 +1743,11 @@ void CalcMuzzlePointForActivate( gentity_t *ent, vec3_t forward, vec3_t right, v
|
|||
else if (gVR != NULL)
|
||||
{
|
||||
float worldscale = trap_Cvar_VariableIntegerValue("cg_worldScale");
|
||||
float heightAdjust = 0;
|
||||
trap_Cvar_VariableValue("cg_heightAdjust", &heightAdjust);
|
||||
convertFromVR(worldscale, ent, gVR->weaponoffset, ent->r.currentOrigin, muzzlePoint);
|
||||
muzzlePoint[2] += (gVR->hmdposition[1] /*+ vr_height_adjust->value*/) * worldscale;
|
||||
muzzlePoint[2] -= 24; // mmmmmmm magic number
|
||||
muzzlePoint[2] += (gVR->hmdposition[1] + heightAdjust) * worldscale;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -343,6 +343,9 @@ int SV_GameSystemCalls( int *args ) {
|
|||
return 0;
|
||||
case G_CVAR_VARIABLE_INTEGER_VALUE:
|
||||
return Cvar_VariableIntegerValue( (const char *)VMA( 1 ) );
|
||||
case G_CVAR_VARIABLE_VALUE:
|
||||
*((float*)(VMA( 2 ))) = Cvar_VariableValue( (const char *)VMA( 1 ) );
|
||||
return 0;
|
||||
case G_CVAR_VARIABLE_STRING_BUFFER:
|
||||
Cvar_VariableStringBuffer( VMA( 1 ), VMA( 2 ), args[3] );
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue