diff --git a/Source/client/cstrike/defs.h b/Source/client/cstrike/defs.h index 50bd0b62..b077ce3e 100755 --- a/Source/client/cstrike/defs.h +++ b/Source/client/cstrike/defs.h @@ -81,6 +81,9 @@ struct float flCamFracSin; float flCamDelta; + int iZoomed; + float flZoomTime; + //Player fields entity ePlayer; vector vPlayerOrigin; diff --git a/Source/client/entry.c b/Source/client/entry.c index ad4fe486..6211ad51 100644 --- a/Source/client/entry.c +++ b/Source/client/entry.c @@ -20,6 +20,10 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) registercommand("+duck"); registercommand("-duck"); + /* Requested by Slacer */ + registercommand("+zoomin"); + registercommand("-zoomin"); + registercommand("slot1"); registercommand("slot2"); registercommand("slot3"); @@ -152,10 +156,24 @@ void CSQC_UpdateView(float w, float h, float focus) } else { setproperty(VF_VIEWENTITY, (float)player_localentnum); } - + + float oldzoom = pl.viewzoom; + if (pl.viewzoom == 1.0f) { + pl.viewzoom = 1.0 - (0.5 * pSeat->flZoomTime); + + /* +zoomin requested by Slacer */ + if (pSeat->iZoomed) { + pSeat->flZoomTime += frametime * 15; + } else { + pSeat->flZoomTime -= frametime * 15; + } + pSeat->flZoomTime = bound(0, pSeat->flZoomTime, 1); + } + setproperty(VF_AFOV, cvar("fov") * pl.viewzoom); setsensitivityscaler(pl.viewzoom); - + pl.viewzoom = oldzoom; + View_Stairsmooth(); // When Cameratime is active, draw on the forced coords instead @@ -476,6 +494,12 @@ float CSQC_ConsoleCommand(string sCMD) tokenize(sCMD); switch (argv(0)) { + case "+zoomin": + pSeat->iZoomed = TRUE; + break; + case "-zoomin": + pSeat->iZoomed = FALSE; + break; case "buildcubemaps": CMap_Build(); break; diff --git a/Source/client/valve/defs.h b/Source/client/valve/defs.h index deb8c21a..8b59528e 100644 --- a/Source/client/valve/defs.h +++ b/Source/client/valve/defs.h @@ -29,6 +29,9 @@ struct float flCamFracSin; float flCamDelta; + int iZoomed; + float flZoomTime; + //Player fields entity ePlayer; vector vPlayerOrigin;