diff options
author | 2025-06-21 14:46:10 +0100 | |
---|---|---|
committer | 2025-06-21 14:50:00 +0100 | |
commit | f38fc784ffab00c11b9818d18f55be34cc8aa130 (patch) | |
tree | a6370ebb95506003ae6b984f724d42369efae366 /src/fov.c | |
parent | ac7e7d0f21978afc70fe3ef76db69d575742b974 (diff) | |
download | sst-f38fc784ffab00c11b9818d18f55be34cc8aa130.tar.gz sst-f38fc784ffab00c11b9818d18f55be34cc8aa130.zip |
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.
Diffstat (limited to 'src/fov.c')
-rw-r--r-- | src/fov.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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 |