mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-17 01:22:32 +00:00
Added a Zoom Sensitivity Lock during fire sequence of ssg; removed unnecessary code
This commit is contained in:
parent
5fed216d5f
commit
b5403b8201
3 changed files with 47 additions and 178 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.144 2003/04/13 21:58:00 slicer
|
||||
// Added a Zoom Sensitivity Lock during fire sequence of ssg; removed unnecessary code
|
||||
//
|
||||
// Revision 1.143 2003/04/07 18:21:34 niceass
|
||||
// teamplay irvision
|
||||
//
|
||||
|
@ -934,6 +937,7 @@ typedef struct {
|
|||
|
||||
// zoom key
|
||||
qboolean zooming; //Slicer: flag to determine when to set zoomTime
|
||||
qboolean zoomSensLock; //Slicer: to lock sensitivity when firing
|
||||
qboolean zoomed; // Determines first-person weapon drawing
|
||||
int zoomLevel; // Zoom LEVEL! -- uses zoom bits like STAT_RQ3
|
||||
int lastZoomLevel; // Save last zoom state
|
||||
|
@ -2109,8 +2113,8 @@ void CG_SpecialWeapon_f(void);
|
|||
|
||||
void CG_RQ3_SyncZoom(void);
|
||||
void CG_RQ3_SaveZoomLevel();
|
||||
void CG_RQ3_Zoom(void); //Elder: just threw it in
|
||||
void CG_RQ3_Zoom1x();
|
||||
//void CG_RQ3_Zoom(void); //Elder: just threw it in
|
||||
//void CG_RQ3_Zoom1x();
|
||||
int CG_RQ3_GetGrenadeMode();
|
||||
void CG_RQ3_GrenadeMode();
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.32 2003/04/13 21:58:00 slicer
|
||||
// Added a Zoom Sensitivity Lock during fire sequence of ssg; removed unnecessary code
|
||||
//
|
||||
// Revision 1.31 2003/03/28 22:25:10 makro
|
||||
// no message
|
||||
//
|
||||
|
@ -602,165 +605,16 @@ static int CG_CalcFov(void)
|
|||
if (cg.predictedPlayerState.pm_type == PM_INTERMISSION) {
|
||||
fov_x = 90;
|
||||
}
|
||||
// if in intermission, use a fixed value
|
||||
|
||||
/*
|
||||
} else {
|
||||
// user selectable
|
||||
if ( cgs.dmflags & DF_FIXED_FOV ) {
|
||||
// dmflag to prevent wide fov for all clients
|
||||
fov_x = 90;
|
||||
} else {
|
||||
fov_x = cg_fov.value;
|
||||
if ( fov_x < 1 ) {
|
||||
fov_x = 1;
|
||||
} else if ( fov_x > 160 ) {
|
||||
fov_x = 160;
|
||||
}
|
||||
}
|
||||
|
||||
// account for zooms
|
||||
// zoomFov = cg_zoomFov.value;
|
||||
*/
|
||||
//Slicer - Let's always do a SyncZoom
|
||||
// if (cg_RQ3_ssgZoomAssist.integer == 0)
|
||||
// Slicer: Updates the cg.zoomLevel with the info sent by server
|
||||
CG_RQ3_SyncZoom();
|
||||
|
||||
//SSG3000 zoom handling
|
||||
/*
|
||||
// old code
|
||||
if ( cg.snap->ps.weapon == WP_SSG3000)
|
||||
{
|
||||
//switching zoom
|
||||
if (cg.zoomLevel != cg.lastZoomLevel)
|
||||
{
|
||||
fov_x = CG_RQ3_GetLastFov();
|
||||
//Get desired zoom FOV based on current FOV
|
||||
if (cg.zoomLevel == 0)
|
||||
{
|
||||
zoomFov = 90;
|
||||
cg.zoomed = qfalse;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ((int)fov_x)
|
||||
{
|
||||
case 20:
|
||||
zoomFov = 10;
|
||||
cg.zoomed = qtrue;
|
||||
break;
|
||||
case 45:
|
||||
zoomFov = 20;
|
||||
cg.zoomed = qtrue;
|
||||
break;
|
||||
case 90:
|
||||
zoomFov = 45;
|
||||
cg.zoomed = qtrue;
|
||||
break;
|
||||
case 10:
|
||||
default:
|
||||
zoomFov = 90;
|
||||
cg.zoomed = qfalse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
|
||||
if ( f > 1.0 )
|
||||
{
|
||||
//finished zoom switch
|
||||
cg.lastZoomLevel = cg.zoomLevel;
|
||||
fov_x = zoomFov;
|
||||
}
|
||||
else
|
||||
fov_x = fov_x + f * ( zoomFov - fov_x );
|
||||
}
|
||||
//Idle state or out of ammo
|
||||
else if (cg.snap->ps.weaponTime == 0 &&
|
||||
cg.snap->ps.stats[STAT_RELOADTIME] == 0)
|
||||
{
|
||||
fov_x = CG_RQ3_GetFov();
|
||||
if (fov_x == 90)
|
||||
cg.zoomed = qfalse;
|
||||
else
|
||||
cg.zoomed = qtrue;
|
||||
|
||||
//if (cg.snap->ps.ammo[WP_SSG3000] == 0)
|
||||
//cg.zoomFirstReturn = -1;
|
||||
//else
|
||||
if (cg.lowAmmoWarning)
|
||||
cg.zoomFirstReturn = ZOOM_OUTOFAMMO;
|
||||
else
|
||||
cg.zoomFirstReturn = ZOOM_IDLE;
|
||||
}
|
||||
//Zoom back in after a reload or fire or weapon switch
|
||||
else if (cg.snap->ps.weaponTime < ZOOM_TIME &&
|
||||
cg.snap->ps.stats[STAT_RELOADTIME] < ZOOM_TIME &&
|
||||
!(cg.snap->ps.stats[STAT_RQ3] & RQ3_FASTRELOADS))
|
||||
{
|
||||
if (cg.zoomFirstReturn == ZOOM_OUT ||
|
||||
cg.zoomFirstReturn == ZOOM_OUTOFAMMO && cg.snap->ps.stats[STAT_RELOADTIME] > 0)
|
||||
{
|
||||
cg.zoomTime = cg.time;
|
||||
cg.zoomFirstReturn = ZOOM_IDLE;
|
||||
}
|
||||
|
||||
fov_x = 90;
|
||||
zoomFov = CG_RQ3_GetFov();
|
||||
|
||||
if (zoomFov == 90)
|
||||
cg.zoomed = qfalse;
|
||||
else
|
||||
cg.zoomed = qtrue;
|
||||
|
||||
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
|
||||
if ( f > 1.0 || cg.zoomFirstReturn == ZOOM_OUTOFAMMO)
|
||||
fov_x = zoomFov;
|
||||
else
|
||||
fov_x = fov_x + f * ( zoomFov - fov_x );
|
||||
//fov_x = zoomFov + f * ( fov_x - zoomFov );
|
||||
}
|
||||
//first time after a shot or reload - zoom out
|
||||
else
|
||||
{
|
||||
if (cg.zoomFirstReturn == ZOOM_IDLE)
|
||||
{
|
||||
cg.zoomTime = cg.time;
|
||||
cg.zoomFirstReturn = ZOOM_OUT;
|
||||
}
|
||||
|
||||
fov_x = CG_RQ3_GetFov();
|
||||
|
||||
if (cg.zoomFirstReturn == ZOOM_OUTOFAMMO &&
|
||||
cg.snap->ps.stats[STAT_RELOADATTEMPTS] == 0)// &&
|
||||
//cg.snap->ps.weaponstate != WEAPON_RELOADING)
|
||||
zoomFov = fov_x;
|
||||
else
|
||||
zoomFov = 90;
|
||||
|
||||
//if (zoomFov == 90)
|
||||
//cg.zoomed = qfalse;
|
||||
//else
|
||||
//cg.zoomed = qtrue;
|
||||
|
||||
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
|
||||
if ( f > 1.0 )
|
||||
{
|
||||
fov_x = zoomFov;
|
||||
if (fov_x == 90)
|
||||
cg.zoomed = qfalse;
|
||||
else
|
||||
cg.zoomed = qtrue;
|
||||
}
|
||||
else
|
||||
fov_x = fov_x + f * ( zoomFov - fov_x );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//Slicer
|
||||
cg.zoomSensLock = qfalse;
|
||||
|
||||
if (cg.snap->ps.weapon == WP_SSG3000) {
|
||||
//switching zoom
|
||||
if (cg.zoomLevel != cg.lastZoomLevel) {
|
||||
|
||||
//Slicer
|
||||
if (!cg.zooming) { // If this is the first zooming attempt
|
||||
cg.zoomTime = cg.time; // Lets set the time
|
||||
|
@ -807,8 +661,9 @@ static int CG_CalcFov(void)
|
|||
//Idle state
|
||||
else if (cg.snap->ps.weaponTime == 0 && cg.snap->ps.weaponstate == WEAPON_READY) {
|
||||
fov_x = CG_RQ3_GetFov();
|
||||
if (fov_x == 90)
|
||||
if (fov_x == 90) {
|
||||
cg.zoomed = qfalse;
|
||||
}
|
||||
else
|
||||
cg.zoomed = qtrue;
|
||||
|
||||
|
@ -834,6 +689,7 @@ static int CG_CalcFov(void)
|
|||
fov_x = 90;
|
||||
zoomFov = CG_RQ3_GetFov();
|
||||
|
||||
|
||||
if (zoomFov == 90)
|
||||
cg.zoomed = qfalse;
|
||||
else
|
||||
|
@ -849,6 +705,9 @@ static int CG_CalcFov(void)
|
|||
//first time after a shot, reload, or weapon switch - zoom out
|
||||
else {
|
||||
fov_x = CG_RQ3_GetFov();
|
||||
//Slicer: if the weapon is about to go to firing sequence, lock the zoomSensitivity
|
||||
if(cg.snap->ps.weaponstate == WEAPON_FIRING)
|
||||
cg.zoomSensLock = qtrue;
|
||||
|
||||
if (cg.snap->ps.weaponstate == WEAPON_RELOADING && cg.zoomFirstReturn != ZOOM_OUT) {
|
||||
cg.zoomTime = cg.time;
|
||||
|
@ -884,6 +743,7 @@ static int CG_CalcFov(void)
|
|||
//Always at 90 degrees
|
||||
fov_x = 90;
|
||||
cg.zoomed = qfalse;
|
||||
cg.zoomSensLock = qfalse;
|
||||
}
|
||||
|
||||
x = cg.refdef.width / tan(fov_x / 360 * M_PI);
|
||||
|
@ -905,24 +765,26 @@ static int CG_CalcFov(void)
|
|||
// set it
|
||||
cg.refdef.fov_x = fov_x;
|
||||
cg.refdef.fov_y = fov_y;
|
||||
|
||||
if (!cg.zoomed) {
|
||||
//Slicer: Don't calculate new values for the zoomSensitivity when doing the firing sequence
|
||||
if(!cg.zoomSensLock) {
|
||||
if (!cg.zoomed ) {
|
||||
cg.zoomSensitivity = 1;
|
||||
} else {
|
||||
if (cg_RQ3_ssgSensitivityAuto.integer)
|
||||
cg.zoomSensitivity = cg.refdef.fov_y / 75.0;
|
||||
else {
|
||||
// Use user-defined sensitivites
|
||||
switch ((int) fov_x) {
|
||||
case 45:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity2x.value;
|
||||
break;
|
||||
case 20:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity4x.value;
|
||||
break;
|
||||
case 10:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity6x.value;
|
||||
break;
|
||||
} else {
|
||||
if (cg_RQ3_ssgSensitivityAuto.integer)
|
||||
cg.zoomSensitivity = cg.refdef.fov_y / 75.0;
|
||||
else {
|
||||
// Use user-defined sensitivites
|
||||
switch ((int) fov_x) {
|
||||
case 45:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity2x.value;
|
||||
break;
|
||||
case 20:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity4x.value;
|
||||
break;
|
||||
case 10:
|
||||
cg.zoomSensitivity = cg_RQ3_ssgSensitivity6x.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.116 2003/04/13 21:58:00 slicer
|
||||
// Added a Zoom Sensitivity Lock during fire sequence of ssg; removed unnecessary code
|
||||
//
|
||||
// Revision 1.115 2003/04/06 23:20:18 niceass
|
||||
// changes to what models 3rd person akimbos use
|
||||
//
|
||||
|
@ -2055,7 +2058,7 @@ void CG_RQ3_SaveZoomLevel()
|
|||
|
||||
//Elder: This should identical to the portion inside
|
||||
//the weapon function in g_cmds.c
|
||||
void CG_RQ3_Zoom(void)
|
||||
/*void CG_RQ3_Zoom(void)
|
||||
{
|
||||
//Elder: reworked SSG zoom
|
||||
if (cg.snap->ps.weapon == WP_SSG3000) {
|
||||
|
@ -2080,8 +2083,8 @@ void CG_RQ3_Zoom(void)
|
|||
cg.zoomTime = cg.time;
|
||||
}
|
||||
}
|
||||
|
||||
//Elder: reset locally and send server message
|
||||
*/
|
||||
/*//Elder: reset locally and send server message
|
||||
void CG_RQ3_Zoom1x()
|
||||
{
|
||||
if (cg_RQ3_ssgZoomAssist.integer) {
|
||||
|
@ -2090,7 +2093,7 @@ void CG_RQ3_Zoom1x()
|
|||
cg.zoomTime = cg.time;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
int CG_RQ3_GetGrenadeMode()
|
||||
{
|
||||
int grenMode = 0;
|
||||
|
|
Loading…
Reference in a new issue