Add support for Z axis ADSOfs, adjust zoom amounts

This commit is contained in:
Steam Deck User 2023-02-03 20:33:44 -05:00
parent d6599e343a
commit 0232a32c80
3 changed files with 95 additions and 33 deletions

View file

@ -1415,40 +1415,96 @@ int GetWeaponZoomAmmount (void)
{ {
switch (cl.stats[STAT_ACTIVEWEAPON]) switch (cl.stats[STAT_ACTIVEWEAPON])
{ {
case W_MP40:
case W_357:
case W_SAWNOFF:
case W_TRENCH:
case W_PANZER:
case W_RAY:
case W_THOMPSON:
case W_COLT: case W_COLT:
case W_PPSH:
case W_TYPE:
//case W_TESLA:
return 5;
break;
case W_STG:
case W_BROWNING:
return 10; return 10;
break; break;
case W_KAR: case W_KAR:
case W_GEWEHR: case W_ARMAGEDDON:
case W_M1: return 25;
case W_M1A1: break;
case W_BAR:
case W_FG:
case W_KAR_SCOPE: case W_KAR_SCOPE:
case W_PTRS: case W_HEADCRACKER:
//case W_HEADCRACKER: return 50;
//case W_PENETRATOR: break;
case W_THOMPSON:
case W_GIBS:
return 10;
break;
case W_TRENCH:
case W_GUT:
return 10;
break;
case W_357:
case W_KILLU:
return 5;
break;
case W_MG:
case W_BARRACUDA:
return 15;
break;
case W_DB:
case W_BORE:
case W_SAWNOFF:
return 10;
break;
case W_M1A1:
case W_WIDDER:
return 20; return 20;
break; break;
case W_BAR:
case W_WIDOW:
return 30;
break;
case W_FG:
case W_IMPELLER:
return 30;
break;
case W_GEWEHR:
case W_COMPRESSOR:
return 25;
break;
case W_PPSH:
case W_REAPER:
return 10;
break;
case W_MP40:
case W_AFTERBURNER:
return 10;
break;
case W_MP5:
case W_KOLLIDER:
return 10;
break;
case W_STG:
case W_SPATZ:
return 20;
break;
case W_M1:
case W_M1000:
return 25;
break;
case W_BROWNING:
case W_ACCELERATOR:
return 15;
break;
case W_PTRS:
case W_PENETRATOR:
return 50;
break;
case W_TYPE:
case W_SAMURAI:
return 10;
break;
case W_RAY:
case W_PORTER:
return 5;
break;
default: default:
return 5; return 5;
break; break;
} }
} }
float zoomin_time; float zoomin_time;
int original_fov; int original_fov;
int original_view_fov; int original_view_fov;

View file

@ -173,7 +173,7 @@ void VID_UnlockBuffer (void);
#define W_KILLU 29 //357 #define W_KILLU 29 //357
#define W_COMPRESSOR 30 // Gewehr #define W_COMPRESSOR 30 // Gewehr
#define W_M1000 31 //garand #define W_M1000 31 //garand
//#define W_KOLLIDER 32 #define W_KOLLIDER 32 // mp5
#define W_PORTER 33 // Ray #define W_PORTER 33 // Ray
#define W_WIDDER 34 // M1A1 #define W_WIDDER 34 // M1A1
#define W_FIW 35 //upgraded flamethrower #define W_FIW 35 //upgraded flamethrower

View file

@ -709,7 +709,7 @@ static float OldYawTheta;
static float OldPitchTheta; static float OldPitchTheta;
static vec2_t cADSOfs; static vec3_t cADSOfs;
void CalcGunAngle (void) void CalcGunAngle (void)
{ {
@ -1140,7 +1140,7 @@ void V_CalcRefdef (void)
//============================================================ Engine-Side Iron Sights ============================================================ //============================================================ Engine-Side Iron Sights ============================================================
AngleVectors (r_refdef.viewangles, temp_forward, temp_right, temp_up); AngleVectors (r_refdef.viewangles, temp_forward, temp_right, temp_up);
vec2_t ADSOffset; vec3_t ADSOffset;
if(cl.stats[STAT_ZOOM] == 1 || cl.stats[STAT_ZOOM] == 2) if(cl.stats[STAT_ZOOM] == 1 || cl.stats[STAT_ZOOM] == 2)
{ {
ADSOffset[0] = sv_player->v.ADS_Offset[0]; ADSOffset[0] = sv_player->v.ADS_Offset[0];
@ -1155,10 +1155,12 @@ void V_CalcRefdef (void)
{ {
ADSOffset[0] = 0; ADSOffset[0] = 0;
ADSOffset[1] = 0; ADSOffset[1] = 0;
ADSOffset[2] = 0;
} }
//Side offset //Side offset
cADSOfs [0] += (ADSOffset[0] - cADSOfs[0]) * 0.25; cADSOfs [0] += (ADSOffset[0] - cADSOfs[0]) * 0.25;
cADSOfs [1] += (ADSOffset[1] - cADSOfs[1]) * 0.25; cADSOfs [1] += (ADSOffset[1] - cADSOfs[1]) * 0.25;
cADSOfs [2] += (ADSOffset[2] - cADSOfs[2]) * 0.25;
temp_right[0] *= cADSOfs[0]; temp_right[0] *= cADSOfs[0];
temp_right[1] *= cADSOfs[0]; temp_right[1] *= cADSOfs[0];
@ -1168,9 +1170,13 @@ void V_CalcRefdef (void)
temp_up[1] *= cADSOfs[1]; temp_up[1] *= cADSOfs[1];
temp_up[2] *= cADSOfs[1]; temp_up[2] *= cADSOfs[1];
view->origin[0] +=(temp_right[0] + temp_up[0]); temp_forward[0] *= cADSOfs[2];
view->origin[1] +=(temp_right[1] + temp_up[1]); temp_forward[1] *= cADSOfs[2];
view->origin[2] +=(temp_right[2] + temp_up[2]); temp_forward[2] *= cADSOfs[2];
view->origin[0] +=(temp_forward[0] + temp_right[0] + temp_up[0]);
view->origin[1] +=(temp_forward[1] + temp_right[1] + temp_up[1]);
view->origin[2] +=(temp_forward[2] + temp_right[2] + temp_up[2]);
float speed = (0.2 + sqrt((cl.velocity[0] * cl.velocity[0]) + (cl.velocity[1] * cl.velocity[1]))); float speed = (0.2 + sqrt((cl.velocity[0] * cl.velocity[0]) + (cl.velocity[1] * cl.velocity[1])));
speed = speed/190; speed = speed/190;