<commit_before>#include "Runtime/World/CWorldTransManager.hpp"

#include "Runtime/CGameState.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/Camera/CCameraManager.hpp"
#include "Runtime/Character/CActorLights.hpp"
#include "Runtime/Character/CAnimPlaybackParms.hpp"
#include "Runtime/Character/CAssetFactory.hpp"
#include "Runtime/Character/CCharacterFactory.hpp"
#include "Runtime/Character/CSkinRules.hpp"
#include "Runtime/Character/IAnimReader.hpp"
#include "Runtime/Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
#include "Runtime/GuiSys/CStringTable.hpp"

#include <hecl/CVarManager.hpp>

namespace urde {

int CWorldTransManager::GetSuitCharIdx() {
  CPlayerState& state = *g_GameState->GetPlayerState();
  if (state.IsFusionEnabled()) {
    switch (state.x20_currentSuit) {
    case CPlayerState::EPlayerSuit::Power:
      return 4;
    case CPlayerState::EPlayerSuit::Gravity:
      return 6;
    case CPlayerState::EPlayerSuit::Varia:
      return 7;
    case CPlayerState::EPlayerSuit::Phazon:
      return 8;
    default:
      break;
    }
  }
  return int(state.x20_currentSuit);
}

CWorldTransManager::SModelDatas::SModelDatas(const CAnimRes& samusRes) : x0_samusRes(samusRes) {
  x1a0_lights.reserve(8);
}

void CWorldTransManager::UpdateLights(float dt) {
  if (!x4_modelData)
    return;

  x4_modelData->x1a0_lights.clear();
  zeus::CVector3f lightPos(0.f, 10.f, 0.f);
  CLight spot = CLight::BuildSpot(lightPos, zeus::skBack, zeus::skWhite, 90.f);
  spot.SetAttenuation(1.f, 0.f, 0.f);

  CLight s1 = spot;
  s1.SetPosition(lightPos + zeus::CVector3f{0.f, 0.f, 2.f * x18_bgOffset - x1c_bgHeight});

  float z = 1.f;
  float delta = x1c_bgHeight - x18_bgOffset;
  if (!x44_26_goingUp && delta < 2.f)
    z = delta * 0.5f;
  else if (x44_26_goingUp && x18_bgOffset < 2.f)
    z = x18_bgOffset * 0.5f;

  if (z < 1.f) {
    CLight s2 = spot;
    float pos = x44_26_goingUp ? x1c_bgHeight : -x1c_bgHeight;
    s2.SetPosition(lightPos + zeus::CVector3f{0.f, 0.f, pos});
    s2.SetColor(zeus::CColor::lerp(zeus::skBlack, zeus::skWhite, 1.f - z));
    x4_modelData->x1a0_lights.push_back(std::move(s2));<commit_msg>CWorldTransManager: Mark lightPos as constexpr in UpdateLights()<commit_after>#include "Runtime/World/CWorldTransManager.hpp"

#include "Runtime/CGameState.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/Camera/CCameraManager.hpp"
#include "Runtime/Character/CActorLights.hpp"
#include "Runtime/Character/CAnimPlaybackParms.hpp"
#include "Runtime/Character/CAssetFactory.hpp"
#include "Runtime/Character/CCharacterFactory.hpp"
#include "Runtime/Character/CSkinRules.hpp"
#include "Runtime/Character/IAnimReader.hpp"
#include "Runtime/Graphics/CBooRenderer.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
#include "Runtime/GuiSys/CStringTable.hpp"

#include <hecl/CVarManager.hpp>

namespace urde {

int CWorldTransManager::GetSuitCharIdx() {
  CPlayerState& state = *g_GameState->GetPlayerState();
  if (state.IsFusionEnabled()) {
    switch (state.x20_currentSuit) {
    case CPlayerState::EPlayerSuit::Power:
      return 4;
    case CPlayerState::EPlayerSuit::Gravity:
      return 6;
    case CPlayerState::EPlayerSuit::Varia:
      return 7;
    case CPlayerState::EPlayerSuit::Phazon:
      return 8;
    default:
      break;
    }
  }
  return int(state.x20_currentSuit);
}

CWorldTransManager::SModelDatas::SModelDatas(const CAnimRes& samusRes) : x0_samusRes(samusRes) {
  x1a0_lights.reserve(8);
}

void CWorldTransManager::UpdateLights(float dt) {
  if (!x4_modelData) {
    return;
  }

  x4_modelData->x1a0_lights.clear();
  constexpr zeus::CVector3f lightPos(0.f, 10.f, 0.f);
  CLight spot = CLight::BuildSpot(lightPos, zeus::skBack, zeus::skWhite, 90.f);
  spot.SetAttenuation(1.f, 0.f, 0.f);

  CLight s1 = spot;
  s1.SetPosition(lightPos + zeus::CVector3f{0.f, 0.f, 2.f * x18_bgOffset - x1c_bgHeight});

  float z = 1.f;
  float delta = x1c_bgHeight - x18_bgOffset;
  if (!x44_26_goingUp && delta < 2.f)
    z = delta * 0.5f;
  else if (x44_26_goingUp && x18_bgOffset < 2.f)
    z = x18_bgOffset * 0.5f;

  if (z < 1.f) {
    CLight s2 = spot;
    float pos = x44_26_goingUp ? x1c_bgHeight : -x1c_bgHeight;
    s2.SetPosition(lightPos + zeus::CVector3f{0.f, 0.f, pos});
    s2.SetColor(zeus::CColor::lerp(zeus::skBlack, zeus::skWhite, 1.f - z));
    x4_modelData->x1a0_lights.push_back(std::move(s2));
{'fraction_non_alphanumeric': 0.13909855510028035, 'fraction_numerical': 0.03234850118611171, 'mean_word_length': 4.81203007518797, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3813795', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1794, 'n_words': 288}