Open hamad12a opened 1 year ago
Could someone hint about increasing the zoom range of weapons besides sniper rifles? there is an option in misc but how do we increase the range using the related source code?
fov
@JannesBonk Conceptually, is the zoom option in misc equivalent to increasing FOV?
@JannesBonk Conceptually, is the zoom option in misc equivalent to increasing FOV?
dont rly think so, but you can increase the zoom by decreasing your fov
@JannesBonk I see two objects or functions in the source code that change FOV; localPlayer.get().fov()
and visualsConfig.fov
. I'm not sure which one is suitable for making zoom levels as in sniper rifles.
Now, I have to make a code in the sense zoom key switches levels and disables zoom. However, I ended up with an issue which is the game loop that executes the code multiple times because of the frames leading to FOV fluctuations.
Here is my code:
void Visuals::applyZoom(csgo::FrameStage stage) noexcept
{
if (zoom && localPlayer) {
if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 90 || localPlayer.get().fovStart() == 90)) {
if (visualsConfig.zoomKey.isToggled()) {
localPlayer.get().fov() = 40;
localPlayer.get().fovStart() = 40;
}
}
else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 40 || localPlayer.get().fovStart() == 40)) {
if (!visualsConfig.zoomKey.isToggled()) {
localPlayer.get().fov() = 20;
localPlayer.get().fovStart() = 20;
}
}
else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 20 || localPlayer.get().fovStart() == 20)) {
if (visualsConfig.zoomKey.isToggled()) {
localPlayer.get().fov() = 90;
localPlayer.get().fovStart() = 90;
}
}
}
}
@JannesBonk I see two objects or functions in the source code that change FOV;
localPlayer.get().fov()
andvisualsConfig.fov
. I'm not sure which one is suitable for making zoom levels as in sniper rifles. Now, I have to make a code in the sense zoom key switches levels and disables zoom. However, I ended up with an issue which is the game loop that executes the code multiple times because of the frames leading to FOV fluctuations. Here is my code:void Visuals::applyZoom(csgo::FrameStage stage) noexcept { if (zoom && localPlayer) { if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 90 || localPlayer.get().fovStart() == 90)) { if (visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 40; localPlayer.get().fovStart() = 40; } } else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 40 || localPlayer.get().fovStart() == 40)) { if (!visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 20; localPlayer.get().fovStart() = 20; } } else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 20 || localPlayer.get().fovStart() == 20)) { if (visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 90; localPlayer.get().fovStart() = 90; } } } }
the localPlayer.get().fov()
function sets the desired fov, if u wanna increase or decrease then use += or -=. You can also ofc use the fov from the config but i think its better to use the first option
@JannesBonk I see two objects or functions in the source code that change FOV;
localPlayer.get().fov()
andvisualsConfig.fov
. I'm not sure which one is suitable for making zoom levels as in sniper rifles. Now, I have to make a code in the sense zoom key switches levels and disables zoom. However, I ended up with an issue which is the game loop that executes the code multiple times because of the frames leading to FOV fluctuations. Here is my code:void Visuals::applyZoom(csgo::FrameStage stage) noexcept { if (zoom && localPlayer) { if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 90 || localPlayer.get().fovStart() == 90)) { if (visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 40; localPlayer.get().fovStart() = 40; } } else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 40 || localPlayer.get().fovStart() == 40)) { if (!visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 20; localPlayer.get().fovStart() = 20; } } else if (stage == csgo::FrameStage::RENDER_START && (localPlayer.get().fov() == 20 || localPlayer.get().fovStart() == 20)) { if (visualsConfig.zoomKey.isToggled()) { localPlayer.get().fov() = 90; localPlayer.get().fovStart() = 90; } } } }
the
localPlayer.get().fov()
function sets the desired fov, if u wanna increase or decrease then use += or -=. You can also ofc use the fov from the config but i think its better to use the first option
But as you can see this code snippet doesn't reproduce the desired behavior of zoom. It allows only for one zoom level; fov=40. how do we make the three cases in the code work? Once toggled off fov returns to default values instead of checking the if statements indicated in the snippet. I wonder if isToggle is the appropriate attribute should be used?
Could someone hint about increasing the zoom range of weapons besides sniper rifles? there is an option in misc but how do we increase the range using the related source code?