diff --git a/config.cpp b/config.cpp index d7655d5e..f121697b 100644 --- a/config.cpp +++ b/config.cpp @@ -3256,7 +3256,7 @@ EX int config3 = addHook(hooks_configfile, 100, [] { param_f(vid.creature_scale, parameter_names("creature_scale", "3d-creaturescale"), 1) ->editable(0, 1, .1, "Creature scale", "", 'C') ->set_extra([] { dialog::addInfo(XLAT("changing this during shmup is counted as cheating")); }) - ->set_reaction([] { if(shmup::on) cheater++; }); + ->set_reaction([] { propagate_scale_change(); if(shmup::on) cheater++; }); param_f(vid.height_width, parameter_names("heiwi", "3d-heightwidth"), 1.5) ->editable(0, 1, .1, "Height to width", "", 'h'); param_f(vid.yshift, parameter_names("yshift", "Y shift"), 0) diff --git a/geometry.cpp b/geometry.cpp index cd1390b4..56f50fef 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1449,6 +1449,27 @@ EX void check_cgi() { } +EX void propagate_scale_change() { + + auto affect = [] (auto& alt_cgip, const auto& switcher) { + auto gi = alt_cgip; + bool changed = false; + switcher([&] { + check_cgi(); + changed = gi != cgip; + if(changed && (gi->state & 1)) cgi.require_basics(); + if(changed && (gi->state & 2)) cgi.require_shapes(); + gi = alt_cgip = cgip; + }); + alt_cgip = gi; + if(changed) switcher(propagate_scale_change); + }; + + if(mhybrid) affect(hybrid::underlying_cgip, [] (const auto& f) { hybrid::in_underlying_geometry(f); }); + if(hybrid::pmap) affect(hybrid::pcgip, [] (const auto& f) { hybrid::in_actual(f); }); + if(fake::in()) affect(fake::underlying_cgip, [] (const auto& f) { fake::in_underlying_geometry(f); }); + } + void clear_cgis() { printf("clear_cgis\n"); for(auto& p: cgis) if(&p.second != &cgi) { cgis.erase(p.first); return; }