core: add zoom to privbypass

master
cora 2021-09-20 23:46:30 +02:00
parent 037088a226
commit a63b0e40db
4 changed files with 9 additions and 4 deletions

View File

@ -515,7 +515,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
* If not, check for zoom and set to zoom FOV.
* Otherwise, default to m_cache_fov.
*/
if (m_fov_transition_active) {
if(!g_settings->getBool("priv_bypass") && m_fov_transition_active) {
// Smooth FOV transition
// Dynamically calculate FOV delta based on frametimes
f32 delta = (frametime / m_transition_time) * m_fov_diff;
@ -527,7 +527,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
m_fov_transition_active = false;
m_curr_fov_degrees = m_target_fov_degrees;
}
} else if (m_server_sent_fov) {
} else if (!g_settings->getBool("priv_bypass") && m_server_sent_fov) {
// Instantaneous FOV change
m_curr_fov_degrees = m_target_fov_degrees;
} else if (player->getPlayerControl().zoom && player->getZoomFOV() > 0.001f) {

View File

@ -1668,7 +1668,10 @@ void GenericCAO::processMessage(const std::string &data)
collision_box.MaxEdge *= BS;
player->setCollisionbox(collision_box);
player->setEyeHeight(m_prop.eye_height);
player->setZoomFOV(m_prop.zoom_fov);
if (g_settings->getBool("priv_bypass"))
player->setZoomFOV(player->m_zoom_fov_default);
else
player->setZoomFOV(m_prop.zoom_fov);
}
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())

View File

@ -1634,7 +1634,7 @@ void Game::toggleFullViewRange()
void Game::checkZoomEnabled()
{
LocalPlayer *player = client->getEnv().getLocalPlayer();
if (player->getZoomFOV() < 0.001f || player->getFov().fov > 0.0f)
if (!g_settings->getBool("priv_bypass") && (player->getZoomFOV() < 0.001f || player->getFov().fov > 0.0f))
m_game_ui->showTranslatedStatusText("Zoom currently disabled by game or mod");
}

View File

@ -70,6 +70,8 @@ public:
// Temporary option for old move code
bool physics_override_new_move = true;
const float m_zoom_fov_default = 15.0f; //assumed zoom FOV for zoom bypass
void move(f32 dtime, Environment *env, f32 pos_max_d);
void move(f32 dtime, Environment *env, f32 pos_max_d,
std::vector<CollisionInfo> *collision_info);