diff --git a/include/light/entities.hh b/include/light/entities.hh index c2ec07e9..01ec5559 100644 --- a/include/light/entities.hh +++ b/include/light/entities.hh @@ -75,7 +75,6 @@ public: lockable_bool_t bleed; lockable_vec3_t origin, color, mangle, projangle; lockable_string_t project_texture; - settingsdict_t settings; light_formula_t getFormula() const { return static_cast(formula.intValue()); } @@ -119,13 +118,16 @@ public: color { "color", 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }, mangle { "mangle", 0, 0, 0 }, // not transformed to vec projangle { "project_mangle", 20, 0, 0 }, // not transformed to vec - project_texture { "project_texture", "" }, - settings {{ + project_texture { "project_texture", "" } + {} + + settingsdict_t settings() { + return {{ &light, &atten, &formula, &spotangle, &spotangle2, &style, &bleed, &anglescale, &dirtscale, &dirtgain, &dirt, &deviance, &samples, &projfov, &origin, &color, &mangle, &projangle, &project_texture - }} - {} + }}; + } }; /* diff --git a/include/light/light.hh b/include/light/light.hh index 1742b63b..5e0c3417 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -258,17 +258,14 @@ enum class setting_source_t { class lockable_setting_t { protected: setting_source_t _source; - bool _registered; std::vector _names; lockable_setting_t(std::vector names) - : _source(setting_source_t::DEFAULT), _registered(false), _names(names) { + : _source(setting_source_t::DEFAULT), _names(names) { assert(_names.size() > 0); } bool changeSource(setting_source_t newSource) { - assert(_registered); - if (static_cast(newSource) >= static_cast(_source)) { _source = newSource; return true; @@ -293,9 +290,6 @@ public: case setting_source_t::COMMANDLINE: return "commandline"; } } - - bool isRegistered() { return _registered; } - void setRegistered() { _registered = true; } }; class lockable_bool_t : public lockable_setting_t { @@ -605,7 +599,6 @@ public: : _allsettings(settings) { for (lockable_setting_t *setting : settings) { - assert(!setting->isRegistered()); assert(setting->names().size() > 0); for (const auto &name : setting->names()) { @@ -613,8 +606,6 @@ public: _settingsmap[name] = setting; } - - setting->setRegistered(); } } @@ -667,7 +658,6 @@ public: lockable_vec_t minlight, shadow, shadowself, dirt, phong, phong_angle; lockable_string_t minlight_exclude; lockable_vec3_t minlight_color; - settingsdict_t settings; float getResolvedPhongAngle() const { const float s = phong_angle.floatValue(); @@ -692,12 +682,15 @@ public: phong { "phong", 0 }, phong_angle { "phong_angle", 0 }, minlight_exclude { "minlight_exclude", "" }, - minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }, - settings {{ + minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 } + {} + + settingsdict_t settings() { + return {{ &minlight, &shadow, &shadowself, &dirt, &phong, &phong_angle, &minlight_exclude, &minlight_color - }} - {} + }}; + } }; diff --git a/light/entities.cc b/light/entities.cc index 711e397b..0520fff6 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -891,7 +891,7 @@ LoadEntities(const bsp2_t *bsp) entity.epairs = &entdict; // populate settings - entity.settings.setSettings(*entity.epairs, false); + entity.settings().setSettings(*entity.epairs, false); if (entity.mangle.isChanged()) { vec_from_mangle(entity.spotvec, *entity.mangle.vec3Value()); diff --git a/light/light.cc b/light/light.cc index 2fa3a51e..0a8f46ca 100644 --- a/light/light.cc +++ b/light/light.cc @@ -399,7 +399,7 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride) modelname.c_str()); // apply settings - info->settings.setSettings(*entdict, false); + info->settings().setSettings(*entdict, false); /* Check if this model will cast shadows (shadow => shadowself) */ if (info->shadow.boolValue()) {