Skip to content

Commit

Permalink
Allowed config-defined sun movement
Browse files Browse the repository at this point in the history
Just set dynamic_sun_dir to false
  • Loading branch information
Xottab-DUTY committed Nov 17, 2018
1 parent d149f41 commit 8d019a2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions res/gamedata/configs/system.ltx
Expand Up @@ -62,6 +62,8 @@
#include "localization.ltx"
#include "smart_cover.ltx"

[openxray]
dynamic_sun_dir = true

[zone_pick_dof]
near = -1500.0
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Config.hpp
Expand Up @@ -26,7 +26,5 @@
//#define FP_DEATH // first person death view
#define DEAD_BODY_COLLISION // restore collision with dead bodies (thanks malandrinus)

//#define CONFIG_SUN_MOVEMENT // With this defined sun will move as configured in weather ltx files

/* Debug: */
//#define USE_LOG_TIMING
2 changes: 2 additions & 0 deletions src/xrCore/xr_ini.h
Expand Up @@ -12,6 +12,8 @@
#include "xrCore/clsid.h"
#include "xrCommon/xr_vector.h"

constexpr pcstr OPENXRAY_INI_SECTION = "openxray";

// refs
class CInifile;
struct xr_token;
Expand Down
9 changes: 4 additions & 5 deletions src/xrEngine/Environment.cpp
Expand Up @@ -103,6 +103,9 @@ CEnvironment::CEnvironment() : CurrentEnv(0), m_ambients_config(0)

CInifile* config =
new CInifile(FS.update_path(file_name, "$game_config$", "environment" DELIMITER "environment.ltx"), TRUE, TRUE, FALSE);

useDynamicSunDir = READ_IF_EXISTS(pSettings, r_bool, OPENXRAY_INI_SECTION, "dynamic_sun_dir", true);

// params
p_var_alt = deg2rad(config->r_float("environment", "altitude"));
p_var_long = deg2rad(config->r_float("environment", "delta_longitude"));
Expand Down Expand Up @@ -473,13 +476,9 @@ void CEnvironment::OnFrame()
float current_weight;
lerp(current_weight);

//AVO: allow sun to move as defined in configs
#ifndef CONFIG_SUN_MOVEMENT
// Igor. Dynamic sun position.
if (!GEnv.Render->is_sun_static())
if (!GEnv.Render->is_sun_static() && useDynamicSunDir)
calculate_dynamic_sun_dir();
#endif
//-AVO

#ifndef MASTER_GOLD
if (CurrentEnv->sun_dir.y > 0)
Expand Down
2 changes: 2 additions & 0 deletions src/xrEngine/Environment.h
Expand Up @@ -349,6 +349,8 @@ class ENGINE_API CEnvironment
bool m_paused;
#endif // #ifdef _EDITOR

bool useDynamicSunDir;

CInifile* m_ambients_config;
CInifile* m_sound_channels_config;
CInifile* m_effects_config;
Expand Down

0 comments on commit 8d019a2

Please sign in to comment.