From f38fc784ffab00c11b9818d18f55be34cc8aa130 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 21 Jun 2025 14:46:10 +0100 Subject: Abstract over con_var layout changes from OE to NE This doesn't allow us to support OE in and of itself but is part of the groundwork necessary to do so in the future. --- src/fov.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/fov.c') diff --git a/src/fov.c b/src/fov.c index bfef858..2ef13e9 100644 --- a/src/fov.c +++ b/src/fov.c @@ -24,7 +24,6 @@ #include "ent.h" #include "event.h" #include "feature.h" -#include "gametype.h" #include "hook.h" #include "intdefs.h" #include "langext.h" @@ -88,8 +87,10 @@ INIT { if_cold (!cmd_fov) return FEAT_INCOMPAT; // shouldn't happen, but who knows! if (real_fov_desired = con_findvar("fov_desired")) { // latest steampipe already goes up to 120 fov - if (real_fov_desired->parent->maxval == 120) return FEAT_SKIP; - real_fov_desired->parent->maxval = 120; + struct con_var *p = con_getvarcommon(real_fov_desired)->parent; + struct con_var_common *c = con_getvarcommon(p); + if (c->maxval == 120) return FEAT_SKIP; + c->maxval = 120; } else { if (!has_ent) return FEAT_INCOMPAT; @@ -109,7 +110,7 @@ INIT { // we might not be using our cvar but simpler to do this unconditionally fov_desired->cb = &fovcb; - fov_desired->parent->base.flags &= ~CON_HIDDEN; + fov_desired->base.flags &= ~CON_HIDDEN; // hide the original fov command since we've effectively broken it anyway :) cmd_fov->base.flags |= CON_DEVONLY; return FEAT_OK; @@ -118,10 +119,10 @@ INIT { END { if_hot (!sst_userunloaded) return; if (real_fov_desired && real_fov_desired != fov_desired) { - real_fov_desired->parent->maxval = 90; - if (con_getvarf(real_fov_desired) > 90) { - con_setvarf(real_fov_desired, 90); // blegh. - } + struct con_var *p = con_getvarcommon(real_fov_desired)->parent; + struct con_var_common *c = con_getvarcommon(p); + c->maxval = 90; + if (c->fval > 90) con_setvarf(real_fov_desired, 90); // blegh. } else { void *player = ent_get(1); // also singleplayer only -- cgit v1.2.3-54-g00ecf