Skip to content

Commit

Permalink
xrGame/CustomZone.h|cpp: load SOC configs correctly (OpenXRay#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY authored and GermanAizek committed Mar 1, 2023
1 parent 7a73eed commit eb9f052
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/xrGame/CustomZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ void CCustomZone::Load(LPCSTR section)
if (m_zone_flags.test(eIdleLight))
{
m_fIdleLightRange = pSettings->r_float(section, "idle_light_range");
m_fIdleLightRangeDelta = pSettings->read_if_exists<float>(section, "idle_light_range_delta", 0.25f);
LPCSTR light_anim = pSettings->r_string(section, "idle_light_anim");
m_pIdleLAnim = LALib.FindItem(light_anim);
m_fIdleLightHeight = pSettings->r_float(section, "idle_light_height");
m_zone_flags.set(eIdleLightVolumetric, pSettings->r_bool(section, "idle_light_volumetric"));
m_zone_flags.set(eIdleLightShadow, pSettings->r_bool(section, "idle_light_shadow"));
m_zone_flags.set(eIdleLightR1, pSettings->r_bool(section, "idle_light_r1"));
m_zone_flags.set(eIdleLightVolumetric, pSettings->read_if_exists<bool>(section, "idle_light_volumetric", false));
m_zone_flags.set(eIdleLightShadow, pSettings->read_if_exists<bool>(section, "idle_light_shadow", true));
m_zone_flags.set(eIdleLightR1, pSettings->read_if_exists<bool>(section, "idle_light_r1", true));
}

bool use = !!READ_IF_EXISTS(pSettings, r_bool, section, "use_secondary_hit", false);
Expand Down Expand Up @@ -318,7 +319,7 @@ bool CCustomZone::net_Spawn(CSE_Abstract* DC)
if (m_zone_flags.test(eIdleLight) && render_ver_allowed)
{
m_pIdleLight = GEnv.Render->light_create();
m_pIdleLight->set_shadow(!!m_zone_flags.test(eIdleLightShadow));
m_pIdleLight->set_shadow(m_zone_flags.test(eIdleLightShadow));

if (m_zone_flags.test(eIdleLightVolumetric))
{
Expand Down Expand Up @@ -708,7 +709,7 @@ void CCustomZone::UpdateIdleLight()
Fcolor fclr;
fclr.set((float)color_get_B(clr) / 255.f, (float)color_get_G(clr) / 255.f, (float)color_get_R(clr) / 255.f, 1.f);

float range = m_fIdleLightRange + 0.25f * ::Random.randF(-1.f, 1.f);
float range = m_fIdleLightRange + m_fIdleLightRangeDelta * ::Random.randF(-1.f, 1.f);
m_pIdleLight->set_range(range);
m_pIdleLight->set_color(fclr);

Expand Down
1 change: 1 addition & 0 deletions src/xrGame/CustomZone.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class CCustomZone : public CSpaceRestrictor, public Feel::Touch
ref_light m_pIdleLight;
Fcolor m_IdleLightColor;
float m_fIdleLightRange;
float m_fIdleLightRangeDelta;
float m_fIdleLightHeight;
CLAItem* m_pIdleLAnim;

Expand Down

0 comments on commit eb9f052

Please sign in to comment.