From 0232a32c80b60eaa92aa5c2836a82e55d527b981 Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Fri, 3 Feb 2023 20:33:44 -0500 Subject: [PATCH] Add support for Z axis ADSOfs, adjust zoom amounts --- source/gl_screen.c | 110 ++++++++++++++++++++++++++++++++++----------- source/quakedef.h | 2 +- source/view.c | 16 ++++--- 3 files changed, 95 insertions(+), 33 deletions(-) diff --git a/source/gl_screen.c b/source/gl_screen.c index a2b97d8..b2485ce 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -1415,40 +1415,96 @@ int GetWeaponZoomAmmount (void) { 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_PPSH: - case W_TYPE: - //case W_TESLA: - return 5; - break; - case W_STG: - case W_BROWNING: return 10; - break; - case W_KAR: - case W_GEWEHR: - case W_M1: - case W_M1A1: - case W_BAR: - case W_FG: - case W_KAR_SCOPE: - case W_PTRS: - //case W_HEADCRACKER: - //case W_PENETRATOR: - return 20; - break; + break; + case W_KAR: + case W_ARMAGEDDON: + return 25; + break; + case W_KAR_SCOPE: + case W_HEADCRACKER: + return 50; + 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; + 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: return 5; break; } } + float zoomin_time; int original_fov; int original_view_fov; diff --git a/source/quakedef.h b/source/quakedef.h index 78fc484..d755593 100644 --- a/source/quakedef.h +++ b/source/quakedef.h @@ -173,7 +173,7 @@ void VID_UnlockBuffer (void); #define W_KILLU 29 //357 #define W_COMPRESSOR 30 // Gewehr #define W_M1000 31 //garand -//#define W_KOLLIDER 32 +#define W_KOLLIDER 32 // mp5 #define W_PORTER 33 // Ray #define W_WIDDER 34 // M1A1 #define W_FIW 35 //upgraded flamethrower diff --git a/source/view.c b/source/view.c index a5b20ff..0c554af 100644 --- a/source/view.c +++ b/source/view.c @@ -709,7 +709,7 @@ static float OldYawTheta; static float OldPitchTheta; -static vec2_t cADSOfs; +static vec3_t cADSOfs; void CalcGunAngle (void) { @@ -1140,7 +1140,7 @@ void V_CalcRefdef (void) //============================================================ Engine-Side Iron Sights ============================================================ 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) { ADSOffset[0] = sv_player->v.ADS_Offset[0]; @@ -1155,10 +1155,12 @@ void V_CalcRefdef (void) { ADSOffset[0] = 0; ADSOffset[1] = 0; + ADSOffset[2] = 0; } //Side offset cADSOfs [0] += (ADSOffset[0] - cADSOfs[0]) * 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[1] *= cADSOfs[0]; @@ -1168,9 +1170,13 @@ void V_CalcRefdef (void) temp_up[1] *= cADSOfs[1]; temp_up[2] *= cADSOfs[1]; - view->origin[0] +=(temp_right[0] + temp_up[0]); - view->origin[1] +=(temp_right[1] + temp_up[1]); - view->origin[2] +=(temp_right[2] + temp_up[2]); + temp_forward[0] *= cADSOfs[2]; + temp_forward[1] *= cADSOfs[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]))); speed = speed/190;