<commit_before>#include "CSlideShow.hpp"
#include "GameGlobalObjects.hpp"
#include "Editor/ProjectManager.hpp"

namespace urde {

CSlideShow::CSlideShow() : CIOWin("SlideShow"), x5c_slideA(*this), x90_slideB(*this) {
  x130_ = g_tweakSlideShow->GetX54();
  x134_24_ = true;
  x134_30_ = true;
  x135_24_ = true;

  const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont());
  if (font) {
    CGuiTextProperties propsA(false, true, EJustification::Center, EVerticalJustification::Bottom);
    xc4_textA = std::make_unique<CGuiTextSupport>(font->id, propsA, g_tweakSlideShow->GetFontColor(),
                                                  g_tweakSlideShow->GetOutlineColor(), zeus::skWhite, 640, 480,
                                                  g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha);

    CGuiTextProperties propsB(false, true, EJustification::Right, EVerticalJustification::Bottom);
    xc8_textB = std::make_unique<CGuiTextSupport>(font->id, propsB, g_tweakSlideShow->GetFontColor(),
                                                  g_tweakSlideShow->GetOutlineColor(), zeus::skWhite, 640, 480,
                                                  g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha);
  }

  xf8_stickTextures.reserve(18);
  x108_buttonTextures.reserve(8);
  SObjectTag txtrTag(FOURCC('TXTR'), 0);
  for (const ITweakPlayerRes::ResId lStickId : g_tweakPlayerRes->x24_lStick) {
    txtrTag.id = lStickId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId cStickId : g_tweakPlayerRes->x4c_cStick) {
    txtrTag.id = cStickId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId lTriggerId : g_tweakPlayerRes->x74_lTrigger) {
    txtrTag.id = lTriggerId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId rTriggerId : g_tweakPlayerRes->x80_rTrigger) {
    txtrTag.id = rTriggerId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId bButtonId : g_tweakPlayerRes->xa4_bButton) {
    txtrTag.id = bButtonId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId yButtonId : g_tweakPlayerRes->xbc_yButton) {
    txtrTag.id = yButtonId;
    xf8_stickTextures.push_back(g_SimplePool->GetObj(txtrTag));
  }
}

bool CSlideShow::LoadTXTRDep(std::string_view name) {
  const SObjectTag* dgrpTag = g_ResFactory->GetResourceIdByName(name);
  if (dgrpTag && dgrpTag->type == FOURCC('DGRP')) {
    x18_galleryTXTRDeps.push_back(g_SimplePool->GetObj(*dgrpTag));
    return true;
  }
  return false;
}

bool CSlideShow::AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
  for (const TLockedToken<CDependencyGroup>& token : deps) {
    if (!token.IsLoaded())
      return false;
  }
  return true;
}

CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
  switch (msg.GetType()) {
  case EArchMsgType::TimerTick: {
    if (x134_29_)
      return EMessageReturn::RemoveIOWinAndExit;

    // float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;

    switch (x14_phase) {
    case Phase::Zero: {
      // if (!g_resLoader->AreAllPaksLoaded())
      //{
      //    g_resLoader->AsyncIdlePakLoading();
      //    return EMessageReturn::Exit;
      //}
      x14_phase = Phase::One;
      [[fallthrough]];
    }<commit_msg>CSlideShow: Use emplace_back where applicable<commit_after>#include "CSlideShow.hpp"
#include "GameGlobalObjects.hpp"
#include "Editor/ProjectManager.hpp"

namespace urde {

CSlideShow::CSlideShow() : CIOWin("SlideShow"), x5c_slideA(*this), x90_slideB(*this) {
  x130_ = g_tweakSlideShow->GetX54();
  x134_24_ = true;
  x134_30_ = true;
  x135_24_ = true;

  const SObjectTag* font = g_ResFactory->GetResourceIdByName(g_tweakSlideShow->GetFont());
  if (font) {
    CGuiTextProperties propsA(false, true, EJustification::Center, EVerticalJustification::Bottom);
    xc4_textA = std::make_unique<CGuiTextSupport>(font->id, propsA, g_tweakSlideShow->GetFontColor(),
                                                  g_tweakSlideShow->GetOutlineColor(), zeus::skWhite, 640, 480,
                                                  g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha);

    CGuiTextProperties propsB(false, true, EJustification::Right, EVerticalJustification::Bottom);
    xc8_textB = std::make_unique<CGuiTextSupport>(font->id, propsB, g_tweakSlideShow->GetFontColor(),
                                                  g_tweakSlideShow->GetOutlineColor(), zeus::skWhite, 640, 480,
                                                  g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha);
  }

  xf8_stickTextures.reserve(18);
  x108_buttonTextures.reserve(8);
  SObjectTag txtrTag(FOURCC('TXTR'), 0);
  for (const ITweakPlayerRes::ResId lStickId : g_tweakPlayerRes->x24_lStick) {
    txtrTag.id = lStickId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId cStickId : g_tweakPlayerRes->x4c_cStick) {
    txtrTag.id = cStickId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId lTriggerId : g_tweakPlayerRes->x74_lTrigger) {
    txtrTag.id = lTriggerId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId rTriggerId : g_tweakPlayerRes->x80_rTrigger) {
    txtrTag.id = rTriggerId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId bButtonId : g_tweakPlayerRes->xa4_bButton) {
    txtrTag.id = bButtonId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
  for (const ITweakPlayerRes::ResId yButtonId : g_tweakPlayerRes->xbc_yButton) {
    txtrTag.id = yButtonId;
    xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag));
  }
}

bool CSlideShow::LoadTXTRDep(std::string_view name) {
  const SObjectTag* dgrpTag = g_ResFactory->GetResourceIdByName(name);
  if (dgrpTag && dgrpTag->type == FOURCC('DGRP')) {
    x18_galleryTXTRDeps.emplace_back(g_SimplePool->GetObj(*dgrpTag));
    return true;
  }
  return false;
}

bool CSlideShow::AreAllDepsLoaded(const std::vector<TLockedToken<CDependencyGroup>>& deps) {
  for (const TLockedToken<CDependencyGroup>& token : deps) {
    if (!token.IsLoaded())
      return false;
  }
  return true;
}

CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
  switch (msg.GetType()) {
  case EArchMsgType::TimerTick: {
    if (x134_29_)
      return EMessageReturn::RemoveIOWinAndExit;

    // float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;

    switch (x14_phase) {
    case Phase::Zero: {
      // if (!g_resLoader->AreAllPaksLoaded())
      //{
      //    g_resLoader->AsyncIdlePakLoading();
      //    return EMessageReturn::Exit;
      //}
      x14_phase = Phase::One;
      [[fallthrough]];
    }
{'fraction_non_alphanumeric': 0.12176495545184557, 'fraction_numerical': 0.020082025173242823, 'mean_word_length': 3.900900900900901, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4522220', 'n_tokens_mistral': 2603, 'n_tokens_neox': 2497, 'n_words': 342}