mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-10 11:14:07 +00:00
propagate_scale_change
This commit is contained in:
parent
157a6cf7e7
commit
8fe5b5bed2
@ -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)
|
||||
|
21
geometry.cpp
21
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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user