#include "CFESEditPlayer.h"
#include "CBall.h"
#include "CBallProj.h"
#include "CFE.h"
#include "CFE3DPlayer.h"
#include "CFEKeyboard.h"
#include "CFESShopHelper.h"
#include "CFTTCamera.h"
#include "CFTTTextureCache.h"
#include "CFTTTextureManager.h"
#include "CGFXSpec.h"
#include "CGfxCharacter.h"
#include "CGfxPlayer.h"
#include "CGfxPostProcess.h"
#include "CGfxShadowMapManager.h"
#include "CGfxSubBoard.h"
#include "CGraphicsTexLoadOptions.h"
#include "CMessageBoxHandler.h"
#include "CPlayerManager.h"
#include "CPlayerShader.h"
#include "CStageManager.h"
#include "CStoryCore.h"
#include "CUIMsgShopButton.h"
#include "CUITileItemSelector.h"
#include "FESU.h"
#include "FREE.h"
#include "GFXCAMERA.h"
#include "GFXRENDER.h"
#include "GM.h"
#include "GU.h"
#include "LOCstring.h"
#include "Matrix.h"
#include "SNDFE.h"
#include "SYSCORE.h"
#include "TStoryConfig.h"

#include "CFTTBatchModelManager.h"
#include "memctrl.h"

CFTTVector32 s_vCamTarget[6];  // 00350770

float s_fCamDist[6] = {3.75, 1.5, 1.5, 1.75, 1.5, 2.0};     // 003362E4
float s_fCamTilt[6] = {0.08, 0.08, 0.08, 0.3, 0.08, 0.08};  // 00336314
float s_fCamRot[6] = {0.3, 0.75, 0.3, 0.3, 0.3, 0.3};       // 003362FC

bool CFESEditPlayer::ms_bCancelChanges;     // 003507BC
CFEKeyboard* CFESEditPlayer::ms_pKeyboard;  // 003507B8

// 003363E0
int m_iHairColourPosition[] = {0, 2, 1, 4, 3, 5, 6, 7};

// 00336390
int m_iHairStylePosition[] = {0,  2, 5, 6,  10, 12, 18, 19, 1, 3,
                              13, 7, 9, 17, 11, 4,  14, 15, 16};

// 00336400
int m_iFacialHairPosition[] = {1, 6, 3, 2, 7, 4, 5};

// 00336420
int m_iBootsColour[] = {0, 9, 11, 1, 10, 6, 2, 7, 3, 5, 8, 4};

// 0033637C
int m_iUnlockText[] = {0x85, 0x133, 0x131, 0x134, 0x132};

static uint unk_2FE208[13] = {0xFF000000, 0xFFFFFFFF, 0xFFDBA83F, 0xFFED1F24,
                              0xFF0E70A1, 0xFFFD2357, 0xFFE2F41F, 0xFFE2F41F,
                              0xFFFA5D1A, 0xFF34287A, 0xFF4F2819, 0xFF73E407,
                              0xFF737373};
// 002FE238
static int unk_2FE238[] = {20, 20, 2, 2, 2, 9, 13};
// 002FE254
static int unk_2FE254[] = {0, -8192, 6553, 6553, 2048, 0, 32};

// 002FE270
static float unk_2FE270[] = {0.10000000149011612f,
                             0.10000000149011612f,
                             0.20000000298023224f,
                             0.20000000298023224f,
                             0.10000000149011612f,
                             0.10000000149011612f,
                             0.0f};

static const int dword_2FE1F0[6] = {1, 2, 4, 5, 7, 8};

// 0033632C
int s_iPlayerRot[6] = {0, 0, 0, 0, 0x2000, 0x2000};

//-------------------------------------------------------------------------------------------------
// 00128200 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
CFESEditPlayer::~CFESEditPlayer() {}
//-------------------------------------------------------------------------------------------------
// 00129A5C //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
typedef void (*CFESEditPlayer_CancelChanges)();
void CFESEditPlayer::CancelChanges() {
  CFESEditPlayer::ms_bCancelChanges = true;
}
//-------------------------------------------------------------------------------------------------
// 00128118 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
CFESEditPlayer::CFESEditPlayer(void) {
  this->field_12C = 0;
  this->m_p3DPlayer_98 = 0;
  this->m_tTextures_9C.pCTeam_0 = 0;
  this->m_tTextures_9C.filed_4 = -1;
  this->m_tTextures_9C.pTexture_8 = 0;
  this->m_tTextures_9C.pTexture_C = 0;
  this->m_tTextures_9C.pTexture_10 = 0;
  this->m_tTextures_9C.pTexture_14 = 0;

  s_vCamTarget[5].float_4 = 1.100000023841858;  // 40
  s_vCamTarget[5].float_8 = 0;                  // 44

  s_vCamTarget[2].float_8 = 0;  // 20
  s_vCamTarget[3].float_0 = 0;  // 24
  s_vCamTarget[3].float_4 = 0;  // 28
  s_vCamTarget[3].float_8 = 0;  // 2C

  s_vCamTarget[4].float_0 = 0;    // 30
  s_vCamTarget[4].float_4 = 1.5;  // 34
  s_vCamTarget[4].float_8 = 0;    // 38
  s_vCamTarget[5].float_0 = 0;    // 3C

  s_vCamTarget[0].float_0 = 0;  // 0
  s_vCamTarget[0].float_4 = 1;  // 4
  s_vCamTarget[0].float_8 = 0;  // 8
  s_vCamTarget[1].float_0 = 0;  // C

  s_vCamTarget[1].float_4 = 1.7000000476837158;  // 10
  s_vCamTarget[1].float_8 = 0;                   // 14
  s_vCamTarget[2].float_0 = 0;                   // 18
  s_vCamTarget[2].float_4 = 1.7000000476837158;  // 1C

  this->field_B4 = 0;
  this->field_B8 = 0;
  this->field_BC = 0;
  this->field_C0 = 0;
  this->field_C4 = 1;
  this->field_C8 = 1;
  this->field_CC = 1;
  this->field_154 = -1;
  this->field_158 = -1;
  this->field_15C = 0;
  GFXCAMERA_UpdateMatrices();
}
//-------------------------------------------------------------------------------------------------
// 00129C54 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::CheckUnlocked(int i1, int i2) {
  // 00129C54
  int r1_i = i1;
  int lr_i = 32 - i2;
  //    int r3_i = i2 - 32;
  uint64 r6r5_ull = CStoryProfile::m_tData.field_210[i1];
  uint32 r5_ui = (r6r5_ull >> 32u);
  uint32 r6_ui = r6r5_ull;
  uint r12 = 1;
  int r4_i = (1u >> lr_i);
  // 00129C66
  if (i2 >= 32) {
    // 00129C78
    r4_i = (1u << (uint)(i2 - 32));
  }
  int r3_i = r5_ui & r4_i;
  r5_ui = r12 << (uint)i2;
  /*
  * 此处这个IT判断前几条代码没有发现CMP或者ADDS之类的开头，所以猜测是和上一个CMP一致（if( r3_i >= 0)），省略写法，是不是这样？
  * 原始汇编：IT GE
             MOVGE           R5, #0
    自己汇编：IT GT
             MOVGT           R4, #0
  */
  // 00129C84
  if (i2 >= 32) {
    // 00129C86
    r5_ui = 0;
  }
  int r6_i = r6_ui & r5_ui;
  r3_i = r3_i | r6_i;
  // 00129C8A
  if (r3_i != 0) {
    // 00129C8E
    this->field_154 = -1;
    this->field_158 = -1;
    r1_i = 0;
  } else {
    // loc_129C9A
    this->field_154 = r1_i;
    this->field_158 = i2;
    r1_i = STY_tConfig.PlayerCustomisationNumber_54D4[r1_i][i2];
  }
  // loc_129CB2
  CUIMsgShopButton* r2_pMsgShopButton = this->m_pMsgShopButton_130;
  this->field_15C = r1_i;
  if (r2_pMsgShopButton != 0) {
    // 00129CC2
    r2_pMsgShopButton->SetCost(r1_i);
  }
  // locret_129CC6
  return;
}
//-------------------------------------------------------------------------------------------------
// 00129514 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
int CFESEditPlayer::ApplyToProfile() {
  // 00129514
  int r6_i = this->field_B4;
  int r0_i = MP_cMyProfile.GetHairStyle();
  // 0012952A
  if (r6_i == r0_i) {
    // 0012952E
    r6_i = this->field_B8;
    r0_i = MP_cMyProfile.GetFacialHair();
    // 00129538
    if (r6_i == r0_i) {
      // 0012953C
      r6_i = this->field_BC;
      r0_i = MP_cMyProfile.GetHairColour();
      // 00129546
      if (r6_i == r0_i) {
        // 0012954A
        r6_i = this->field_C0;
        r0_i = MP_cMyProfile.GetBootColour();
        // 00129554
        if (r6_i == r0_i) {
          // 00129558
          r6_i = this->field_C4;
          r0_i = MP_cMyProfile.GetShirtLength();
          // 00129562
          if (r6_i == r0_i) {
            // 00129566
            r6_i = this->field_C8;
            r0_i = MP_cMyProfile.GetBodyType();
            // 00129570
            if (r6_i == r0_i) {
              // 00129576
              r6_i = this->field_CC;
              r0_i = MP_cMyProfile.GetShirtNumber();
              // 0012957E
              if (r6_i == r0_i) {
                // 00129582
                const wchar_t* r1_pwc = MP_cMyProfile.GetPlayerName();
                if (xstrcmp(this->m_pName_D0, r1_pwc) == 0) {
                  // loc_129646
                  return 0;
                }
              }
              // loc_129596
            }
            // loc_129596
          }
          // loc_129596
        }
        // loc_129596
      }
      // loc_129596
    }
    // loc_129596
  }
  // loc_129596
  MP_cMyProfile.SetHairStyle(this->field_B4);
  MP_cMyProfile.SetFacialHair(this->field_B8);
  MP_cMyProfile.SetHairColour(this->field_BC);
  MP_cMyProfile.SetBootColour(this->field_C0);
  MP_cMyProfile.SetShirtLength(this->field_C4);
  MP_cMyProfile.SetBodyType(this->field_C8);
  MP_cMyProfile.SetShirtNumber(this->field_CC);
  const wchar_t* r1_pwc = CFESEditPlayer::ms_pKeyboard->GetString();
  wchar_t var_32[17];
  xstrlcpy(var_32, r1_pwc, 17);
  r1_pwc = MP_cMyProfile.GetPlayerName();
  r0_i = xstrcmp(this->m_pName_D0, r1_pwc);
  // 00129606
  if (r0_i != 0) {
    // 0012960A
    r0_i = CFESEditPlayer::HaveEasterEggName(this->m_pName_D0);
    // 0012960E
    if (r0_i != 0) {
      // 00129612
      r1_pwc = MP_cMyProfile.GetPlayerName();
      xstrlcpy(this->m_pName_D0, r1_pwc, 17);
      this->SetupPlayer();
    } else {
      // loc_129628
      FESU_WordsStartWithCapital(this->m_pName_D0);
      MP_cMyProfile.SetPlayerName(this->m_pName_D0);
    }
  }
  // loc_129636
  CStoryCore::m_tStageManager.InitTeams();
  return 1;
}
//-------------------------------------------------------------------------------------------------
// 00129658 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::Exit() {
  // 00129658
  FREE_RenderShutdown();
  // 00129668
  if (CFESEditPlayer::ms_pKeyboard != 0) {
    // 0012966E
    delete CFESEditPlayer::ms_pKeyboard;
    CFESEditPlayer::ms_pKeyboard = NULL;
  }
  // loc_129676
  if (this->m_p3DPlayer_98 != 0) {
    // 00129676
    this->m_p3DPlayer_98->Shutdown();
    // 00129684
    if (this->m_p3DPlayer_98 != NULL) {
      // 00129686
      delete this->m_p3DPlayer_98;
    }
    // loc_12968E
    this->m_p3DPlayer_98 = 0;
  }
  // loc_129694
  if (this->m_pHeroScene_160 != 0) {
    // 0012969A
    delete this->m_pHeroScene_160;
    this->m_pHeroScene_160 = 0;
  }
  // loc_1296A8
  CGfxKits::FreeKitTeamTextures(&this->m_tTextures_9C);
  int r1_i = this->field_164;
  int r0_i = r1_i + 1;
  // 001296B4
  if (r0_i != 0) {
    // 001296B8
    FTT_pTex->ReleaseTexture(r1_i);
    this->field_164 = -1;
  }
  // locret_1296CC
}
//-------------------------------------------------------------------------------------------------
// 001297B8 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
int CFESEditPlayer::HaveEasterEggName(wchar_t* pwc1) {
  // 001297B8
  char var_31[17];
  UnicodeToUTF8(var_31, pwc1, 17);
  uint r0_i = FTTHash(var_31);
  uint r6_i = r0_i ^ 0x3A8F05C5;
  int r4_i = 0;
  // loc_129816
  while (r4_i <= 2) {
    // loc_1297FC
    r0_i = STY_tConfig.EEListRecordc_677c[r4_i].name;
    // 00129800
    if (r0_i == r6_i) {
      // 00129804
      int r5_i = STY_tConfig.EEListRecordc_677c[r4_i].ID;
      r0_i = MP_cMyProfile.EasterEggAlreadyFound(r5_i);
      // 00129810
      if (r0_i == 0) {
        // loc_12981E
        MP_cMyProfile.FoundEasterEgg(r5_i);
        r0_i = STY_tConfig.EEListRecordc_677c[r4_i].Credits;
        CCurrency::AddCredits(r0_i, false, 0, true, true, false);
        return r4_i;
      }
    }
    // loc_129812
    r4_i++;
  }
  // 0012981A
  r4_i = 0;
  return r4_i;
}
//-------------------------------------------------------------------------------------------------
// 00128210 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::Init(void) {
  // 0012821C
  if (CFE::m_eLastFlowDirection != 2) {
    // 0012821E
    FREE_RenderInit();
    this->field_F4 = -1;
    this->field_F8 = 0;
    this->vector32_FC = s_vCamTarget[0];
    this->field_108 = s_fCamDist[0];
    this->field_10C = s_fCamRot[0];
    this->field_110 = s_fCamTilt[0];

    this->vector32_114.float_0 = 0;
    this->vector32_114.float_4 = 0;
    this->vector32_114.float_8 = 0;
    this->field_120 = 0;

    this->field_124 = 0;

    // 4B7B56 - 0x4B7B40 = 16
    int r6_i = CStoryProfile::m_tData.field_16.filed_0;
    int r5_i = CStoryProfile::m_tData.field_16.filed_2;
    TStorySeason* r0_season = CStoryCore::STORY_GetSeason(r5_i);
    int r1_i = r0_season->StageCount_d0;
    int r0_i = r1_i * r5_i + r6_i;
    // 00128288
    if (r0_season->StageCount_d0 != r6_i) {
      // 00128290
      r0_i = r0_i + 1;
    }
    // 00128292
    CStoryCore::SetupStage(r0_i);
    CStoryCore::m_cProfile.ApplyUserPlayer(&this->m_tPlayerInfo_14);
    this->RevertToProfile();
    CFEKeyboard* r0_keyboard =
        new CFEKeyboard(0, this->m_pName_D0, EKeyboardType_0, -1, 1);
    CFESEditPlayer::ms_pKeyboard = r0_keyboard;
    CFESEditPlayer::ms_pKeyboard->SetMaxNumChars(17);
    CFESEditPlayer::ms_pKeyboard->HideTextField();

    CGfxKits::LoadKitTeamTextures(&tGame.CTeam_2C60[0], &this->m_tTextures_9C,
                                  g_tGlobalTexLoadOptions.mTexLoadOptions_4,
                                  0x200);
    CGfxKits::BeginBuildKit(0);
    CFTTTexture* r0_texutre = CGfxKits::GetTexture(
        this->field_164, &this->m_tTextures_9C, 1, EKitTextureType_0, NULL);
    CGfxKits::EndBuildKit();
    this->m_p3DPlayer_98 = NULL;
    this->SetupPlayer();
    this->SetupEditMode(-1);
    this->m_pHeroScene_160 = new CFEHeroScene(this->field_164);
  }
  // locret_128344
}
//-------------------------------------------------------------------------------------------------
// 0012A0A0 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::PreRender3D(void) {
  this->SetupCamera(true);
  CPlayerShader::s_tInstance.SetCinematic(EPlayerShader_Cinematic_2);
  // 0x3FA00000, 0x3ECCCCCD, 0x40000000, 0x3FE00000
  CFTTVector32x4 var_28;
  var_28.my[0] = 1.25;
  var_28.my[1] = 0.4000000059604645;
  var_28.my[2] = 2;
  var_28.my[3] = 1.75;
  CPlayerShader::s_tInstance.SetCinematicLightingCloth(var_28);
  // 0x40000000, 0x3F19999A, 0x3F800000, 0x3F800000
  var_28.my[0] = 2;
  var_28.my[1] = 0.6000000238418579;
  var_28.my[2] = 1;
  var_28.my[3] = 1;
  CPlayerShader::s_tInstance.SetCinematicLightingSkin(var_28);
  CPlayerShader::s_tInstance.SetQuality(EPlayerShader_Quality_2);
  CGfxCharacter* var_2C = this->m_p3DPlayer_98->pGfxCharacter_0;
  CFTTVector32 var_38;
  var_38.float_0 = -0.5;
  var_38.float_4 = 0.699999988079071;
  var_38.float_8 = -0.30000001192092896;
  CFTTVector32 vector32_28 = Normalize(var_38);
  this->m_p3DPlayer_98->RenderSetup();
  CGfxShadowMapManager::ms_pManager->MapPlayer(&var_2C, &this->m_p3DPlayer_98,
                                               1, vector32_28, 0);
  this->m_p3DPlayer_98->PreRender();
  CFTTCamera::SetViewport(CFE::s_fUniformWidth, CFE::s_fUniformHeight, 0);
  this->SetupCamera(true);
  this->m_pHeroScene_160->PreRender(*this);  //->m_tPostProcessRender_10
  CPlayerShader::s_tInstance.SetCinematic(EPlayerShader_Cinematic_0);
  CPlayerShader::s_tInstance.SetQuality(
      GFXSPEC_pSpecification->ePlayerLightingQuality_44);
}
//-------------------------------------------------------------------------------------------------
// 001296D8 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 001296D8
void CFESEditPlayer::ProcessPlayer(void) {
  // 001296D8
  CFE3DPlayer* r5_player = this->m_p3DPlayer_98;
  r5_player->tPlayer_10.SetPos(0, 0, 0);
  float s16_f = r5_player->tPlayer_10.ballPosPrev_4.point_0.dy_4;
  float s18_f = r5_player->tPlayer_10.ballPosPrev_4.dz_8;
  float s20_f = r5_player->tPlayer_10.ballPosPrev_4.point_0.dx_0;
  this->m_p3DPlayer_98->SetScale(1);
  float s2_f = -3.0518e-5;
  float s0_f = 3.0518e-5;
  float s4_f = 2.0e-2;
  s2_f = s20_f * s2_f;
  s4_f = s4_f + s18_f * s0_f;
  s0_f = s16_f * s0_f;
  this->m_p3DPlayer_98->SetPos(s2_f, s4_f, s0_f, SCR_HEI, -1);

  s2_f = 3.1416;
  s0_f = r5_player->tPlayer_10.u_0.s_2_0.s_2 + 0x3000;
  // s0_f = s0_f*3.1416;
  s0_f = (float)((float)s0_f * s2_f);
  s2_f = 0.00012207f;
  s0_f = s0_f * s2_f;
  this->m_p3DPlayer_98->SetYRot(s0_f);
  this->m_p3DPlayer_98->UpdateBlinking();
  this->m_p3DPlayer_98->Process();
}
//-------------------------------------------------------------------------------------------------
// 00129EC4 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::Render2D(void) { this->m_pUITileManager_4->Render(); }
//-------------------------------------------------------------------------------------------------
// 0012A314 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::Render2DHUD(void) {
  // 0012A314
  this->m_pUITileManager_4->RenderHUD();
  // 0012A326
  if (this->ms_pKeyboard != NULL) {
    // 0012A328
    this->ms_pKeyboard->Render();
  }
  // loc_12A32C
  this->m_pHeroScene_160->RenderHUD();
}
//-------------------------------------------------------------------------------------------------
// 0012A1DC //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::Render3D(void) { GFXRENDER_pPostProcess->Render(*this); }
//-------------------------------------------------------------------------------------------------
// 00128374 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::RevertToProfile(void) {
  xstrlcpy(this->m_pName_D0, this->m_tPlayerInfo_14.field_24, 17);
  this->field_B4 = MP_cMyProfile.GetHairStyle();
  this->field_B8 = MP_cMyProfile.GetFacialHair();
  this->field_BC = MP_cMyProfile.GetHairColour();
  this->field_C0 = MP_cMyProfile.GetBootColour();
  this->field_C4 = MP_cMyProfile.GetShirtLength();
  this->field_C8 = MP_cMyProfile.GetBodyType();
  this->field_CC = MP_cMyProfile.GetShirtNumber();
}
//-------------------------------------------------------------------------------------------------
// 00128904 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetUpdateMovement(void) {
  // 00128904
  float s10_f = 2.0e1;
  int r1_i = this->field_F8;
  float s4_f = this->field_108;
  float s0_f = this->vector32_FC.float_0;
  float s2_f = this->vector32_FC.float_4;
  float s6_f = this->vector32_FC.float_8;
  float s8_f = s_fCamDist[r1_i];
  s4_f = s8_f - s4_f;
  // int r2_i =  r1_i*3;
  s4_f = s4_f / s10_f;
  s8_f = s_vCamTarget[r1_i].float_0;
  float s12_f = s_vCamTarget[r1_i].float_4;
  float s14_f = s_vCamTarget[r1_i].float_8;
  this->field_120 = s4_f;
  s2_f = s12_f - s2_f;
  s4_f = s_fCamRot[r1_i];
  s0_f = s8_f - s0_f;
  s4_f = s4_f - s6_f;
  s6_f = this->field_110;
  s2_f = s2_f / s10_f;

  s4_f = s4_f / s10_f;
  this->field_124 = s4_f;
  s4_f = s_fCamTilt[r1_i];
  r1_i = 0;
  s0_f = s0_f / s10_f;
  s4_f = s4_f - s6_f;
  this->vector32_114.float_4 = s2_f;
  this->vector32_114.float_0 = s0_f;

  s4_f = s4_f / s10_f;
  this->field_128 = s4_f;
  s0_f = this->vector32_FC.float_8;
  this->field_12C = r1_i;
  s0_f = s14_f - s0_f;
  s0_f = s0_f / s10_f;
  this->vector32_114.float_8 = s0_f;
}
//-------------------------------------------------------------------------------------------------
// 001289CC //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupHighlight(void) {
  switch (this->field_F4) {
    case 1: {
      // loc_1289E0
      int r1_i = 0;
      int v = r1_i;
      // loc_128A04
      while (r1_i <= 63) {
        // loc_1289F2
        if (this->field_CC ==
            STY_tConfig.PlayerCustomisationShirtNumbers_59E8[r1_i]) {
          // loc_128A0A
          v = r1_i;
          break;
        }
        r1_i++;
      }
      // loc_128A0A
      return CUITileItemSelector::SetHighlightSelection(v);
      break;
    }
    default: {
      // def_1289D6
      return CUITileItemSelector::SetHighlightSelection(-1);
    }
    case 2: {
      // loc_128A1C
      return CUITileItemSelector::SetHighlightSelection(this->field_B4);
    }
    case 3: {
      // loc_128A24
      return CUITileItemSelector::SetHighlightSelection(this->field_BC);
    }
    case 4: {
      // loc_128A2C
      return CUITileItemSelector::SetHighlightSelection(this->field_B8);
    }
    case 5: {
      // loc_128A34
      int r1_i = this->field_C4;
      int r0_i = this->field_C8;
      r0_i = r0_i * 3;
      r0_i = r0_i + r1_i;
      return CUITileItemSelector::SetHighlightSelection(r0_i);
    }

    case 6: {
      // loc_128A42
      return CUITileItemSelector::SetHighlightSelection(this->field_C0);
    }
  }
  return;
}
//-------------------------------------------------------------------------------------------------
// 001283D8 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupPlayer(void) {
  int r0_i = MP_cMyProfile.GetSkinColour();
  int r1_i = this->field_B4;
  int r2_i = this->field_B8;
  int r3_i = this->field_BC;
  int r7_i = this->field_C0;
  int r6_i = this->field_C4;
  int r5_i = this->field_C8;
  int r12_i = this->field_CC;
  this->m_tPlayerInfo_14.field_4F = r0_i;
  this->m_tPlayerInfo_14.field_4E = r1_i;
  this->m_tPlayerInfo_14.field_4C = r2_i;
  this->m_tPlayerInfo_14.field_4D = r3_i;
  this->m_tPlayerInfo_14.field_81 = r7_i;
  this->m_tPlayerInfo_14.field_60 = r6_i;
  this->m_tPlayerInfo_14.field_61 = r5_i;
  this->m_tPlayerInfo_14.shirtNum_5F = r12_i;
  xstrlcpy(this->m_tPlayerInfo_14.field_24, this->m_pName_D0, 17);
  if (this->m_p3DPlayer_98 != NULL) {
    this->m_p3DPlayer_98->UpdatePlayerAtlas(&this->m_tPlayerInfo_14, 0);
  } else {
    // loc_128438
    r7_i = CStoryCore::m_tStageManager.IsInternational(
        CStoryCore::m_tStageManager.tStoryStage_0.t_0.TournamentType_70);
    CFE3DPlayer* r6_p3dPlayer = new CFE3DPlayer;
    this->m_p3DPlayer_98 = r6_p3dPlayer;
    if (r7_i != 0) {
      r0_i = CStoryCore::GetNationalTeam();
    } else {
      // loc_128466
      r0_i = CStoryCore::GetClubTeam();
    }

    r6_p3dPlayer->Init(r0_i, 0, &this->m_tPlayerInfo_14, EPlayerKitID_0, 0,
                       &this->m_tTextures_9C, 2);
    CPlayer* r5_player = &this->m_p3DPlayer_98->tPlayer_10;
    r5_player->SetAnim(27);
    r5_player->Update();
    r5_player->SetRot(0, true);
  }
  // loc_1284A6
  this->SetupHighlight();
}
//-------------------------------------------------------------------------------------------------
// 0012907C //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupEditMode_SLEEVELENGTH(void) {
  // 0012907C
  int r7_i = 0;
  this->field_F8 = 0;
  // loc_129160
  while (r7_i != 6) {
    // loc_1290C0
    int r9_i = SCR_WID;
    int r8_i = SCR_SAFE_BOTTOM;
    int r10_i = CUITileManager::UITILE_ADBAR_H;
    char var_128[256];
    snprintf(var_128, 256, "shirt%i.png", r7_i);
    CUITileItemSelector* r4_selector = new CUITileItemSelector(
        96, 96, -8355712, var_128, EUITileAction_62, dword_2FE1F0[r7_i]);

    int r0_i = ((uint)r7_i * 128) & 0x80u;
    r0_i = r0_i + r8_i;
    r0_i = r0_i - r10_i / 2;
    int r1_i = ((uint)r7_i * 64) & 0xFFFFFF80u;
    r0_i = r0_i - 304;
    r1_i = r1_i + r9_i / 2;
    r1_i = r1_i - 128;
    float s0_f = r1_i;
    float s2_f = r0_i;
    this->m_pUITileManager_4->AddTile(s0_f, s2_f, r4_selector, 1, -1,
                                      EHUDPosition_0);
    r7_i++;
  }
}
//-------------------------------------------------------------------------------------------------
// 00128A84
void CFESEditPlayer::SetupEditMode_NUMBER(void) {
  // var1dc = r0
  this->field_F8 = 5;
  int r10_i = 0;
  float s16_f = -280.0f;
  // r3 = STY_tConfig
  // var1e0 = adbar
  // var1e4 = safe
  // var1e8 = scr_wid
  // var1ec = ai
  // loc_128BF0
  int r1_i;
  while (r10_i < STY_tConfig.PlayerCustomisationNumberCount_59D4[0]) {
    // loc_128AC6
    wchar_t var_B0[64];
    int r9_i = CUITileManager::UITILE_ADBAR_H;
    int r5_i = SCR_SAFE_BOTTOM;
    int r4_i = SCR_WID;
    xsnprintf(var_B0, 64, L"%i",
              STY_tConfig.PlayerCustomisationShirtNumbers_59E8[r10_i]);
    LOGE("STY_tConfig.PlayerCustomisationShirtNumbers_59E8[r10_i]=%x",STY_tConfig.PlayerCustomisationShirtNumbers_59E8[r10_i]);
    TUITBText var_1D8(var_B0, -1, 0, 1.25, EFontAlign_2, 32, 12, 0, 55, 0);
    // r1_i = 63;
    //  1f8 = r1,r10
    CUITileItemSelector* r7_selector = new CUITileItemSelector(
        64, 64, -12566464, var_1D8, EUITileAction_63, r10_i);

    r1_i = r10_i & 0x7;
    float r3_f = -1;
    r4_i = 1;
    int r0_i = SCR_WID / 2;
    r1_i = r1_i * 5;
    float s0_f = r0_i;
    r0_i = (uint)r10_i >> 3u;
    r1_i = (uint)r1_i << 4;
    r0_i = r0_i * 5;
    float s2_f = r1_i;
    r0_i = r5_i + r0_i * 16;
    r0_i = r0_i - r9_i / 2;
    r0_i = r0_i - 0x1D8;
    float s4_f = r0_i;
    s0_f = s0_f + s16_f;
    s0_f = s0_f + s2_f;
    this->m_pUITileManager_4->AddTile(s0_f, s4_f, r7_selector, r4_i, r3_f,
                                      EHUDPosition_0);
    r1_i = 32 - r10_i;
    int r2_i = r10_i - 32;
    r1_i = (uint)r4_i >> (uint)r1_i;
    int* pr0r3 = (int*)&CStoryProfile::m_tData.field_210[0];
    if (r2_i >= 0) {
      r1_i = (uint)r4_i << (uint)r2_i;
    }
    r2_i = (uint)r4_i << (uint)r10_i;
    r1_i = r1_i & pr0r3[1];
    if (r10_i >= 0x0) {
      r2_i = 0;
    }
    r0_i = pr0r3[0] & r2_i;
    r0_i = r0_i | r1_i;
    if (r0_i == 0) {
      r0_i = STY_tConfig.PlayerCustomisationNumber_54D4[0][r10_i];
      // r7_selector->358 = r0
      r7_selector->m_i_358=r0_i;
    }
    // loc_128BEA
    r10_i++;
  }
}
//-------------------------------------------------------------------------------------------------
// 00128A50 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupEditMode_NAME(void) {
  // 00128A50
  this->field_F8 = 4;
  CFESEditPlayer::ms_pKeyboard->HideTextField();
  CFESEditPlayer::ms_pKeyboard->SetString(this->m_pName_D0);
  CFESEditPlayer::ms_pKeyboard->Show();
  this->field_150 = false;
}
//-------------------------------------------------------------------------------------------------
// 00128798 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
CUITileItemSelector* CFESEditPlayer::GetCustomiseTile(int i1) {
  // 00128798
  int r5_i = i1;
  int r4_i = -15177552;
  switch (r5_i) {
    case 0: {
      // loc_1287BA
      char var_98[128];
      strlcpy(var_98, "shirtname.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 0);
      return r0_pTitleItemSelector;
      break;
    }
    default: {
      // def_1287AE
      char var_98[128];
      strlcpy(var_98, "boot.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, r5_i);
      return r0_pTitleItemSelector;
      break;
    }
    case 1: {
      // loc_128804
      char var_98[128];
      strlcpy(var_98, "shirtnum.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 1);
      return r0_pTitleItemSelector;
      break;
    }
    case 2: {
      // loc_128822
      char var_98[128];
      snprintf(var_98, 128, "H%i.png", 6);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 2);
      return r0_pTitleItemSelector;
      break;
    }
    case 3: {
      // loc_128842
      char var_98[128];
      strlcpy(var_98, "haircol.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 3);
      return r0_pTitleItemSelector;
      break;
    }
    case 4: {
      // loc_128860
      char var_98[128];
      snprintf(var_98, 128, "B%i.png", 5);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 4);
      return r0_pTitleItemSelector;
      break;
    }
    case 5: {
      // loc_128880
      char var_98[128];
      strlcpy(var_98, "sleevelength.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 5);
      return r0_pTitleItemSelector;
      break;
    }
    case 6: {
      // loc_12889E
      char var_98[128];
      strlcpy(var_98, "boot.png", 128);
      CUITileItemSelector* r0_pTitleItemSelector = new CUITileItemSelector(
          96, 96, -15177552, var_98, EUITileAction_55, 6);
      return r0_pTitleItemSelector;
      break;
    }
  }
  // 001288D6
}
//-------------------------------------------------------------------------------------------------
// 00128DBC //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupEditMode_HAIRCOLOUR(void) {
  this->field_F8 = 1;
  int r11_i = 0;
  // loc_128EDA
  while (r11_i != 8) {
    // loc_128E0C
    int r4_i = SCR_WID;
    int r9_i = SCR_SAFE_BOTTOM;
    int r8_i = CUITileManager::UITILE_ADBAR_H;
    int r7_i = m_iHairColourPosition[r11_i];

    CUITileItemSelector* r5_pTileItemSelector = new CUITileItemSelector(
        96, 96, s_uHairColours[r7_i], EUITileAction_60, r7_i);
    /*
     * 此处应该被转换成等价操作
     * 原始汇编：   MOV             R0, #0xFFFFFF80
                   AND.W           R0, R0, R11,LSL#5 ...
                   ADD.W           R11, R11, #1
     * 自己汇编：    BIC.W           R0, R10, #0x7F
                    ADD             R0, R6 ...
                    ADD.W           R10, R10, #0x20
     */
    // int r0_i = -128;
    int r0_i = ((uint)r11_i * 32u) & 0xFFFFFF80;
    int r2_i = ((uint)r11_i * 128u) & 0x180;
    r0_i = r0_i + r9_i;
    r0_i = r0_i - r8_i / 2;
    r0_i = r0_i - 304;
    int r1_i = r2_i + r4_i / 2;
    r1_i = r1_i - 192;

    CUITileManager* r0_pTitleManager = this->m_pUITileManager_4;
    r0_pTitleManager->AddTile(r1_i, r0_i, r5_pTileItemSelector, true, -1,
                              EHUDPosition_0);
    r0_i = 32 - r7_i;
    r1_i = r7_i - 32;
    r0_i = 1u << r0_i;
    uint64 r2r3_ull = CStoryProfile::m_tData.field_210[2];
    // 00128EA8
    if (r7_i - 32 >= 0) {
      // 00128EAC
      r0_i = 1u << r1_i;
    }
    r1_i = 1u << m_iHairColourPosition[r11_i];
    r0_i = r0_i & (r2r3_ull >> 32u);
    // 00128EB8
    if (r7_i - 32 >= 0) {
      // 00128EBA
      r1_i = 0;
    }
    r1_i = r1_i & r2r3_ull;
    r0_i = r0_i | r1_i;
    // 00128EBE
    if (r0_i == 0) {
      // 00128EC2
      r5_pTileItemSelector->m_i_358 =
          STY_tConfig
              .PlayerCustomisationNumber_54D4[2][m_iHairColourPosition[r11_i]];
    }
    // loc_128ED2
    r11_i++;
  }
  // 00128EE0
}
//-------------------------------------------------------------------------------------------------
// 00128C40 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupEditMode_HAIRSTYLE(void) {
  // 00128C40
  uint r6_i = 1;
  uchar r11_i = 0;
  this->field_F8 = 1;
  // loc_128D7A
  while (r11_i != 20) {
    // loc_128C86
    int r8_i = SCR_WID;
    int r10_i = SCR_SAFE_BOTTOM;
    int r9_i = CUITileManager::UITILE_ADBAR_H;
    int r7_i = m_iHairStylePosition[r11_i];
    char var_128[256];
    snprintf(var_128, 256, "H%i.png", r7_i);
    CUITileItemSelector* r4_pTileItemSelector = new CUITileItemSelector(
        80, 80, -8355712, var_128, EUITileAction_58, r7_i);

    uint r0_i = r11_i / 5u;
    int r1_i = r0_i * 3;
    r0_i = r0_i * 5;
    char r0_c = r11_i - r0_i;
    r1_i = r10_i + r1_i * 32;

    r1_i = r1_i - r9_i / 2;
    r0_i = (uint)r0_c << 7u;
    r0_i = r0_i + r8_i / 2;
    r0_i = r0_i - 256;
    float s0_f = r0_i;
    r0_i = r1_i - 432;
    float s2_f = r0_i;
    this->m_pUITileManager_4->AddTile(s0_f, s2_f, r4_pTileItemSelector, r6_i,
                                      -1, EHUDPosition_0);
    r1_i = 32 - r7_i;
    int r2_i = r7_i - 32;
    r1_i = r6_i >> r1_i;
    uint* pr0r3 = (uint*)&CStoryProfile::m_tData.field_210[1];
    /*
     * 此处原汇编比较的是r2,自己这边比较的是r7
     * 原始汇编：CMP             R2, #0
     * 自己汇编：CMP             R7, #0x1F
     */
    if (r2_i >= 0) {
      r1_i = (uint)r6_i << (uint)r2_i;
    }
    r2_i = r6_i << (uint)r7_i;
    r1_i = r1_i & (pr0r3[1]);
    if (r7_i >= 0x20) {
      r2_i = 0;
    }
    r0_i = pr0r3[0] & r2_i;
    r0_i = r0_i | r1_i;
    if (r0_i == 0) {
      r4_pTileItemSelector->m_i_358 =
          STY_tConfig.PlayerCustomisationNumber_54D4[1][r7_i];
    }
    // loc_128D76
    r11_i++;
  }
}
//-------------------------------------------------------------------------------------------------
// 00128F08 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: loc_129032,loc_12903A,0012901E,loc_129032,loc_12903A,00129040
void CFESEditPlayer::SetupEditMode_FACIALHAIR(void) {
  // 00128F08
  int r10_i = 0;
  this->field_F8 = 2;
  // loc_12903A
  while (r10_i != 8) {
    // loc_12903A
    int r7_i = m_iFacialHairPosition[r10_i];
    int r8_i = SCR_WID;
    int r5_i = SCR_SAFE_BOTTOM;
    int r6_i = CUITileManager::UITILE_ADBAR_H;
    char var_128[256];
    snprintf(var_128, 256, "B%i.png", r7_i);
    CUITileItemSelector* r4_pTileItemSelector = new CUITileItemSelector(
        96, 96, -8355712, var_128, EUITileAction_59, r7_i);
    int r2_i = (r10_i * 128) & 0x180;
    // int r0_i  =-128;
    int r0_i = (r10_i * 32) & 0xFFFFFF80;
    r0_i = r0_i + r5_i;
    r0_i = r0_i - r6_i / 2;
    r0_i = r0_i - 304;
    int r1_i = r2_i + r8_i / 2;
    r1_i = r1_i - 192;
    bool r5_b = 1u;
    this->m_pUITileManager_4->AddTile(r1_i, r0_i, r4_pTileItemSelector, r5_b,
                                      -1, EHUDPosition_0);

    r1_i = 32 - r7_i;
    r2_i = r7_i - 32;
    r1_i = r5_b >> (uint)r1_i;
    /*
     * 此处原汇编比较的是r2,自己这边比较的是r7
     * 原始汇编：CMP             R2, #0
     * 自己汇编：CMP             R7, #0x1F
     */
    // 00128FFE
    if (r7_i - 32 >= 0) {
      // 00129008
      r1_i = r5_b << (uint)r2_i;
    }
    r2_i = r5_b << (uint)r7_i;
    r1_i = r1_i & (CStoryProfile::m_tData.field_210[3] >> 32u);
    if (r7_i - 32 >= 0) {
      // 00129016
      r2_i = 0;
    }
    r0_i = CStoryProfile::m_tData.field_210[3] & r2_i;
    r0_i = r0_i | r1_i;
    if (r0_i == 0) {
      // 0012901E
      r4_pTileItemSelector->m_i_358 =
          STY_tConfig.PlayerCustomisationNumber_54D4[3][r7_i];
    }
    // loc_129032
    r10_i++;
  }
  // 00129040
}
//-------------------------------------------------------------------------------------------------
// 00129198 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏,换鞋
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: loc_1291E2,00129298,loc_1292AC,001292BA
void CFESEditPlayer::SetupEditMode_BOOTS(void) {
  // 00129198
  uint r11_i = 1;
  int r8_i = 0;
  this->field_F8 = 3;
  // loc_1292B4
  while (r8_i != 12) {
    // loc_1291E2
    int r4_i = m_iBootsColour[r8_i];
    int r7_i = SCR_WID;
    int r9_i = SCR_SAFE_BOTTOM;
    int r6_i = CUITileManager::UITILE_ADBAR_H;
    CUITileItemSelector* r5_pTileItemSelector = new CUITileItemSelector(
        96, 96, unk_2FE208[r4_i], EUITileAction_61, r4_i);
    int r0_i = (r8_i * 32) & 0xFFFFFF80;
    int r2_i = (r8_i * 128) & 0x180;
    r0_i = r0_i + r9_i;
    r0_i = r0_i - r6_i / 2;
    r0_i = r0_i - 432;
    int r1_i = r2_i + r7_i / 2;
    r1_i = r1_i - 192;
    this->m_pUITileManager_4->AddTile(r1_i, r0_i, r5_pTileItemSelector, r11_i,
                                      -1, EHUDPosition_0);
    r0_i = 32 - r4_i;
    r1_i = r4_i - 32;
    r0_i = (uint)r11_i >> r0_i;
    uint64 r2r3_ull = CStoryProfile::m_tData.field_210[4];
    // 0012927E
    if (r4_i - 32 >= 0) {
      // 00129282
      r0_i = r11_i << (uint)r1_i;
    }
    r1_i = r11_i << r4_i;
    r0_i = r0_i & (r2r3_ull >> 32u);
    if (r4_i - 32 >= 0) {
      // 00129290
      r1_i = 0;
    }
    r1_i = r1_i & r2r3_ull;
    r0_i = r0_i | r1_i;
    // 00129294
    if (r0_i == 0) {
      // 00129298
      r5_pTileItemSelector->m_i_358 =
          STY_tConfig.PlayerCustomisationNumber_54D4[4][r4_i];
    }
    // loc_1292AC
    r8_i++;
  }
  // 001292BA
}
//-------------------------------------------------------------------------------------------------
// 00129A6C //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::Process() {
  // 00129A6C
  GFXRENDER_Set60FPSDesirable();
  int var_18;
  int r5_i = this->m_pUITileManager_4->Process(0, &var_18);
  // 00129A82
  if (r5_i != 1) {
    this->ProcessPlayer();
    // 00129A90
    if (r5_i == 13 || CFESEditPlayer::ms_bCancelChanges != 0) {
      // loc_129A9C
      this->RevertToProfile();
      this->SetupEditMode(-1);
      this->SetupPlayer();
      SNDFE_PlaySFX(3, 0, 1);
      CFESEditPlayer::ms_bCancelChanges = 0;
    }
    // loc_129AC2
    if (r5_i == 14) {
      // 00129AC6
      int r0_i = this->field_154;
      r0_i = r0_i + 1;
      // 00129ACA
      if (r0_i != 0) {
        // 00129ACE
        wchar_t* r5_pwc = LOCstring(6190);
        int r1_i = this->field_154;
        r0_i = m_iUnlockText[r1_i];
        wchar_t* r3_pwc = LOCstring(r0_i);
        wchar_t var_118[128];
        xsnprintf(var_118, 128, r5_pwc, r3_pwc, this->field_15C);

        CMessageBoxHandler::NewMessageBox(CFESEditPlayer::ConfirmUnlockCB, this,
                                          EMessageBoxType_1, var_118, 0, 0, 128,
                                          1, 1, 0, 0, 0, 1, 1);
        // loc_129B8A
        this->ProcessEditMode(14);
        // def_129B3C
        this->UpdatePosition();
        this->field_12C++;
        return;
      }
      // loc_129B5A
    } else {
      // loc_129B2A
      this->ProcessEditMode(r5_i);
      switch (r5_i) {
        case 58: {
          // loc_129B46
          this->field_B4 = var_18;
          this->SetupPlayer();
          this->CheckUnlocked(1, var_18);
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        case 59: {
          // loc_129B94
          this->field_B8 = var_18;
          this->SetupPlayer();
          this->CheckUnlocked(3, var_18);
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        case 60: {
          // loc_129BA8
          this->field_BC = var_18;
          this->SetupPlayer();
          this->CheckUnlocked(2, var_18);
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        case 61: {
          // loc_129BBC
          this->field_C0 = var_18;
          this->SetupPlayer();
          this->CheckUnlocked(4, var_18);
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        case 62: {
          // loc_129BD0
          int r0_i = var_18 / 3;
          int r1_i = r0_i + r0_i * 2;
          this->field_C4 = var_18 - r1_i;
          this->field_C8 = r0_i;
          this->SetupPlayer();
          this->field_154 = -1;
          this->field_158 = -1;
          this->field_15C = 0;
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        case 63: {
          // loc_129BFA
          this->field_CC =
              STY_tConfig.PlayerCustomisationShirtNumbers_59E8[var_18];
          this->SetupPlayer();
          this->CheckUnlocked(0, var_18);
          SNDFE_PlaySFX(7, 0, 1);
          this->UpdatePosition();
          this->field_12C++;
          return;
          break;
        }
        default: {
          // def_129B3C
          this->UpdatePosition();
          this->field_12C++;
          return;
        }
      }
    }
    // loc_129B5A
    this->ApplyToProfile();
    this->SetupEditMode(-1);
    this->SetupPlayer();
    SNDFE_PlaySFX(1, 0, 1);
    SYSCORE_DeleteFile("profileHead.png", 1);
    CFTTTextureCache::EmptyCache();
    // loc_129B8A
    this->ProcessEditMode(14);
    this->UpdatePosition();
    this->field_12C++;
    return;
  }
  // loc_129C3C
}
//-------------------------------------------------------------------------------------------------
// 00129CD0 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::RenderLines(void) {
  // 00129CD0
  int r0_i = this->field_F4;
  r0_i = r0_i + 1;
  if (r0_i == 0) {
    CFTTVector32 var_74;
    CFTTCamera::GetPosition(var_74);
    CFTTVector32 var_80;
    CFTTCamera::GetForwardDirection(var_80);
    TPoint3D var_8C;
    CFTTVector32 var_98;

    // loc_129E98
    for (int r8_i = 0; r8_i != 7; r8_i++) {
      // loc_129D1E
      CUITileItemSelector* r11_i = this->m_pTileItemSelectors_134[r8_i];
      // oc_129D1E
      this->m_p3DPlayer_98->tPlayer_10.GetBonePosition(unk_2FE238[r8_i],
                                                       &var_8C);
      float s0_f = var_8C.point_0.dx_0;
      float s2_f = var_8C.point_0.dy_4;
      float s4_f = unk_2FE254[r8_i] + var_8C.dz_8;
      var_8C.dz_8 = unk_2FE254[r8_i] + var_8C.dz_8;

      float s22_f = s0_f * (float)-3.0518e-5 - var_74.float_0;
      float s28_f = var_80.float_0;
      float s30_f = var_80.float_4;
      float s26_f = s2_f * (float)3.0518e-5 - var_74.float_8;
      float s17_f = var_80.float_8;
      float s24_f = s4_f * (float)3.0518e-5 - var_74.float_4;

      var_98.float_0 = s22_f;
      var_98.float_8 = s26_f;
      var_98.float_4 = s24_f;
      CFTTVector32 var_A4 = Normalize(var_98);

      s0_f = s24_f * s30_f;
      CFTTVector32 var_B0;
      s2_f = unk_2FE270[r8_i];
      TPoint var_B8;
      s0_f = s0_f + s22_f * s28_f;
      s0_f = s0_f + s26_f * s17_f;
      s22_f = s2_f + s0_f;
      s0_f = (var_74.float_8 + (float)s22_f * var_A4.float_8) * (float)3.2768e4;
      s2_f =
          -(var_74.float_0 + (float)s22_f * var_A4.float_0) * (float)3.2768e4;
      s4_f = (var_74.float_4 + (float)s22_f * var_A4.float_4) * (float)3.2768e4;
      var_8C.point_0.dx_0 = s2_f;
      var_8C.point_0.dy_4 = s0_f;
      var_8C.dz_8 = s4_f;
      s0_f = r11_i->f_130;
      s2_f = r11_i->f_134;

      var_B8.dx_0 = s0_f;
      var_B8.dy_4 = s2_f;
      GFXCAMERA_ScreenToWorldRay(&var_B8, var_98, var_B0);
      TPoint3D var_C4;
      s2_f = (float)var_B0.float_0 * var_80.float_0 +
             (float)var_B0.float_4 * var_80.float_4 +
             (float)var_B0.float_8 * var_80.float_8;
      s0_f = s22_f / s2_f;

      s4_f = var_B0.float_0 * s0_f;
      s2_f = var_B0.float_8 * s0_f;
      s0_f = var_B0.float_4 * s0_f;

      var_C4.point_0.dx_0 = -(s4_f + var_98.float_0) * (float)3.2768e4;
      var_C4.point_0.dy_4 = (s2_f + var_98.float_8) * (float)3.2768e4;
      var_C4.dz_8 = (s0_f + var_98.float_4) * (float)3.2768e4;

      var_B0.float_0 = s4_f;
      var_B0.float_4 = s0_f;
      var_B0.float_8 = s2_f;
      FREE_RenderEditPlayerLine(var_C4, var_8C);
    }
  }
  // loc_129EA0
}
//-------------------------------------------------------------------------------------------------
// 0012A1F4 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::RenderScene(EGfxRenderPass e1) {
  // 0012A1F4
  this->SetupCamera(0);
  g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, 1);
  // 0012A216
  if (e1 == EGfxRenderPass_2) {
    // 0012A21A
    GFXRENDER_pPostProcess->ReflectCamera();
    GFXPLAYER_pBatch->Begin();
    this->m_p3DPlayer_98->Render(1, EEnvMapOverride_3);
    GFXPLAYER_pBatch->End();
    this->m_pHeroScene_160->RenderEnvironment(1);
  } else {
    // loc_12A250
    this->m_pHeroScene_160->RenderEnvironment(0);
    GFXPLAYER_pBatch->Begin();
    this->m_p3DPlayer_98->Render(1, EEnvMapOverride_3);
    GFXPLAYER_pBatch->End();
  }

  // loc_12A278
  g_pGraphicsDevice->setDepthTest(EFTTDepthTest_8, 1);
  GFXPLAYER_pBatch->Flush(1, 1, 0);
  GFXPLAYER_pBatch->Flush(2, 1, 0);
  GFXPLAYER_pBatch->Flush(5, 1, 0);
  GFXPLAYER_pBatch->Flush(0, 1, 0);
  CGfxPlayer::RenderPlayerAlphaTested(1);
  CGfxPlayer::RenderPlayerTranslucent(1);
  GFXPLAYER_pBatch->Flush(-1, 1, 0);
  // 0012A2D6
  /*
   * 此处分支顺序发生变化，与自己正好相反。经过反复观察，逻辑应该是一致的。差这么一点点，不太完美，但整不一致
   * 原始汇编：CMP             R5, #1
              BEQ             locret_12A2E4
   * 自己汇编：CMP             R5, #1
              BNE             loc_12D46
   */
  if (e1 != EGfxRenderPass_1) {
    // 0012A2DA
    this->m_pHeroScene_160->RenderGlows();
    // 0012A2E2
    if (e1 == EGfxRenderPass_0) {
      // 0012A2E8
      this->RenderLines();
      // return;
    }
  }
  // locret_12A2E4
  // return;
}
//-------------------------------------------------------------------------------------------------
// 00129ECC //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::SetupCamera(bool b1) {
  // 00129ECC
  float r4_f = 0;
  CFTTVector32 var_24;
  var_24.float_4 = 1;
  var_24.float_0 = 0;
  var_24.float_8 = 0;
  CFTTVector32 var_30;
  CFTTVector32 var_40;
  CFTTVector32 var_50;

  TPoint3D tPoint3D_90;
  float d16_low = this->vector32_FC.float_0;
  float d16_high = this->vector32_FC.float_4;
  float r0_f = this->vector32_FC.float_8;
  var_40.float_8 = r0_f;
  var_40.float_0 = d16_low;
  var_40.float_4 = d16_high;
  this->m_p3DPlayer_98->tPlayer_10.GetBonePosition(2, &tPoint3D_90);
  float s6_f = tPoint3D_90.point_0.dx_0;
  float s2_f = tPoint3D_90.point_0.dy_4;
  float s4_f = tPoint3D_90.dz_8;
  float s0_f = -1.72;
  int r0_i = this->field_F8;
  s0_f = s0_f + s4_f * (float)3.0518e-5;
  s4_f = s6_f * (float)-3.0518e-5;
  s2_f = s2_f * (float)3.0518e-5;
  // 00129F28
  if (r0_i == 3) {
    // 00129F2A
    s2_f = s2_f * (float)1.5e-1;
    s0_f = s0_f * (float)1.5e-1;
    s4_f = s4_f * (float)1.5e-1;
  }
  float s8_f = var_40.float_4;
  s6_f = var_40.float_0;
  float s10_f = var_40.float_8;
  s4_f = s4_f + s6_f;
  s0_f = s0_f + s8_f;
  s2_f = s2_f + s10_f;
  var_40.float_0 = s4_f;
  var_40.float_4 = s0_f;
  var_40.float_8 = s2_f;
  var_50.float_0 = var_40.float_0;
  var_50.float_4 = var_40.float_4;
  var_50.float_8 = -this->field_108;
  CFTTMatrix32 var_90 = MakeXRotationMatrix32(this->field_110);
  VectorMatrixMultiply(&var_50, &var_90);
  CFTTMatrix32 var_D0 = MakeYRotationMatrix32(this->field_10C);
  VectorMatrixMultiply(&var_30, &var_50, &var_D0);
  CFTTCamera::SetPosition(var_30);
  CFTTCamera::LookAt(var_40, &var_24);
  CFTTCamera::SetFOV(0.7062374949455261);
  CFTTCamera::SetNearAndFarPlanes(0.5, 100);
  CFTTCamera::ApplyCameraSettings();

  GFXCAMERA_fYOffset = r4_f;
  /*
   * 此处赋值的方式有点不一样，原始的有VLDR D16, 自已的是LDRD.W  R0,
   * R5，很难掌握为什么， 也拆分写能不同形式，但也不是可以完全一致。伤脑筋
   */

  GFXCAMERA_vPos = var_30;
  GFXCAMERA_vTarget = var_40;

  s2_f = (float)(var_40.float_4 - var_30.float_4) *
             (var_40.float_4 - var_30.float_4) +
         (float)(var_40.float_8 - var_30.float_8) *
             (var_40.float_8 - var_30.float_8) +
         (float)(var_40.float_0 - var_30.float_0) *
             (var_40.float_0 - var_30.float_0);
  // 00129FD0
  if (b1) {
    // 0012A000
    GFXCAMERA_UpdateMatrices();
  }
  s0_f = sqrtf(s2_f);
  s0_f = s0_f * (float)6.0e-1;
  s2_f = s0_f + s0_f;
  GFXRENDER_pPostProcess->SetDOFValues(1, s0_f, s2_f, true, 4);
}
//-------------------------------------------------------------------------------------------------
// 001284C0 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏,换服饰
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 001284CC,001284D2,0012851A,loc_1285E4,loc_128638,0012869E
void CFESEditPlayer::SetupEditMode(int i1) {
  // 001284CC
  if (i1 >= -1) {
    // 001284D2
    this->field_F4 = i1;
  }
  CFESEditPlayer::ms_pKeyboard->Hide();
  int r7_i = 1;
  this->m_pUITileManager_4->Reset(1);
  this->m_pUITileManager_4->uy_13D = 0;
  this->m_pUITileManager_4->b_13E = false;
  int r0_i = this->field_F4;
  this->m_pMsgShopButton_130 = 0;
  this->m_pTileItemSelectors_134[0] = 0;
  this->m_pTileItemSelectors_134[1] = 0;
  this->m_pTileItemSelectors_134[2] = 0;
  this->m_pTileItemSelectors_134[3] = 0;
  this->m_pTileItemSelectors_134[4] = 0;
  this->m_pTileItemSelectors_134[5] = 0;
  this->m_pTileItemSelectors_134[6] = 0;
  r0_i = r0_i + 1;
  // 0012851A
  if (r0_i != 0) {
    // 0012851E
    int r6_i = 1;
    SNDFE_PlaySFX(1, 0, 1);
    this->m_pUITileManager_4->ull_90 =
        this->m_pUITileManager_4->ull_90 & 0xFFFFFFFFFFFFFFFD;
    // 00128540
    if (this->field_F4 != 0) {
      // 00128546
      this->m_pUITileManager_4->ull_90 =
          this->m_pUITileManager_4->ull_90 | 0x2000;
      this->m_pUITileManager_4->ull_98 =
          this->m_pUITileManager_4->ull_98 & 0xFFFFFFFFFFFFDFFF;
      CUIMsgShopButton* r5_pMsgShopButton = new CUIMsgShopButton(116, 76);
      r7_i = 2;
      this->m_pMsgShopButton_130 = r5_pMsgShopButton;
      r0_i = SCR_WID;
      int r1_i = SCR_SAFE_BOTTOM;
      r0_i = r0_i - 66;
      float s0_f = r0_i;
      r0_i = r1_i - 46;
      float s2_f = r0_i;
      this->m_pUITileManager_4->AddTile(s0_f, s2_f, r5_pMsgShopButton, r6_i, -1,
                                        EHUDPosition_2);
      r0_i = this->field_F4;
      r1_i = -1;
      this->field_154 = -1;
      switch (r0_i) {
        case 0: {
          // loc_128700
          this->SetupEditMode_NAME();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 1: {
          // 001285DC
          this->SetupEditMode_NUMBER();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 2: {
          // loc_12871E
          this->SetupEditMode_HAIRSTYLE();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 3: {
          // loc_128726
          this->SetupEditMode_HAIRCOLOUR();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 4: {
          // loc_12872E
          this->SetupEditMode_FACIALHAIR();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 5: {
          // loc_128736
          this->SetupEditMode_SLEEVELENGTH();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        case 6: {
          // loc_12873E
          this->SetupEditMode_BOOTS();
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
        default: {
          // def_1285D0
          this->SetupHighlight();
          this->SetUpdateMovement();
          return;
          break;
        }
      }
    }
    // loc_1286F8
  } else {
    // loc_1285E4
    float s16_f = 1.0;
    int r5_i = 0;
    float var_70[14];
    var_70[0] = -0.699999988079071;
    var_70[1] = -0.30000001192092896;
    var_70[2] = -0.699999988079071;
    var_70[3] = -5.877471754111438e-39;

    var_70[4] = -0.699999988079071;
    var_70[5] = -0.6000000238418579;
    var_70[6] = 0.699999988079071;
    var_70[7] = -0.6000000238418579;

    float s18_f = 5.0e-1;
    var_70[8] = 0.699999988079071;
    var_70[9] = -0.30000001192092896;
    var_70[10] = 0.699999988079071;
    var_70[11] = 0;

    var_70[13] = 0.699999988079071;
    var_70[12] = 0.6000000238418579;
    float r11_f = -1;
    // loc_12869A
    while (r5_i != 7) {
      // loc_128638
      CUITileItemSelector* r3_pUITitleItemSelector =
          CFESEditPlayer::GetCustomiseTile(r5_i);
      this->m_pTileItemSelectors_134[r5_i] = r3_pUITitleItemSelector;
      float s0_f = var_70[r5_i * 2];
      float s2_f = var_70[r5_i * 2 + 1];
      float s4_f = SCR_WID;
      s0_f = s0_f + s16_f;
      float s6_f = SCR_HEI;
      s2_f = s2_f + s16_f;
      s0_f = s0_f * s4_f;
      s2_f = s2_f * s6_f;
      s0_f = s0_f * s18_f;
      s2_f = s2_f * s18_f;
      int var_80 = r7_i;
      r7_i = 1;
      this->m_pUITileManager_4->AddTile(s0_f, s2_f, r3_pUITitleItemSelector,
                                        var_80, -1, EHUDPosition_0);
      r5_i++;
    }
    // 0012869E
    this->field_F8 = 0;
    this->SetUpdateMovement();
    this->m_pUITileManager_4->ull_90 =
        this->m_pUITileManager_4->ull_90 & (uint64)0xFFFFFFFFFFFFDFFF;
    this->m_pUITileManager_4->ull_90 =
        this->m_pUITileManager_4->ull_90 & (uint64)0xFFFFFFFFFFFFBFFF;
    this->m_pUITileManager_4->ull_98 =
        this->m_pUITileManager_4->ull_98 & (uint64)0xFFFFFFFFFFFFFFFD;
    this->m_pUITileManager_4->ull_90 = this->m_pUITileManager_4->ull_90 | 0x2;
    this->SetupHighlight();
    return;
  }
  // loc_1286F8
  this->field_154 = -1;
  // loc_128700
  this->SetupEditMode_NAME();
  // def_1285D0
  this->SetupHighlight();
  this->SetUpdateMovement();
  return;
}
//-------------------------------------------------------------------------------------------------
// 00191AB0 //^_-
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,检测到日志输出
//测试分支: 00191AB0
void AddBoard(CFTTVector32* pVector0, CFTTVector32* pVector1, float* pf2,
              int& i3, ushort* pus4, int& i5, int i6, int i7, int i8, int i9,
              float& f10, float f11) {
  // 00191AB0
  CFTTVector32 var_74;
  CFTTVector32 var_80;
  CFTTVector32 var_8C;
  CFTTVector32 var_98;
  float s26_f = 0.0;
  float s24_f = f11;
  int r0_i = i3;
  float r11_f = 0;
  float s16_f = (float)i6 * (float)-0.000030518;
  float s18_f = (float)i8 * (float)-0.000030518;
  int var_9C = i3;
  float s20_f = (float)i7 * (float)0.000030518;
  var_80.float_4 = r11_f;
  float s22_f = (float)i9 * (float)0.000030518;
  float s0_f = s26_f;
  float s28_f = s18_f - s16_f;
  float s30_f = s22_f - s20_f;
  s0_f = s0_f + s28_f * s28_f;
  var_80.float_0 = s28_f;
  var_80.float_8 = s30_f;

  s0_f = s0_f + s30_f * s30_f;
  float s2_f = sqrtf(s0_f);
  // loc_191B54
  s0_f = s2_f * s24_f;
  s0_f = s0_f + s0_f;
  float r8_f = XMATH_RoundFloatToNearestInt(s0_f);
  var_74 = Normalize(var_80);
  s0_f = -s30_f;

  s30_f = var_74.float_0;
  float s17_f = var_74.float_4;
  float s19_f = var_74.float_8;
  var_74.float_4 = r11_f;
  var_74.float_0 = s0_f;
  var_74.float_8 = s28_f;

  var_8C = Normalize(var_74);
  float s23_f = var_8C.float_4;
  float s25_f = var_8C.float_8;
  s2_f = (float)s23_f * (float)0.0625;
  s28_f = (float)s17_f * (float)0.5;
  s17_f = var_8C.float_0;
  s30_f = (float)s30_f * (float)0.5;
  s19_f = (float)s19_f * (float)0.5;
  float s4_f = (float)s17_f * (float)0.0625;
  s0_f = (float)s25_f * (float)0.0625;
  s2_f = (float)s2_f * (float)0.5;
  float s6_f = s23_f - s28_f;
  float s8_f = s17_f - s30_f;
  float s10_f = s25_f - s19_f;
  s4_f = (float)s4_f * (float)0.5;
  s0_f = (float)s0_f * (float)0.5;
  var_74.float_4 = s2_f;
  s6_f = (float)s6_f + (float)0.5;
  s8_f = s8_f + s26_f;
  s10_f = s10_f + s26_f;
  var_74.float_0 = s4_f;
  var_74.float_8 = s0_f;

  var_98.float_4 = s6_f;
  var_98.float_0 = s8_f;
  var_98.float_8 = s10_f;
  var_8C = Normalize(var_98);

  s2_f = s30_f + s17_f;
  s0_f = s28_f + s23_f;
  s4_f = s19_f + s25_f;
  s28_f = var_8C.float_0;
  s30_f = var_8C.float_4;
  s17_f = var_8C.float_8;
  s2_f = s2_f + s26_f;
  s0_f = s0_f + 0.5;
  s4_f = s4_f + s26_f;
  var_98.float_4 = s0_f;
  var_98.float_0 = s2_f;
  var_98.float_8 = s4_f;
  var_8C = Normalize(var_98);

  r0_i = i3;
  // s6_f = r8_f;
  float r1_f = (float)f10;
  s8_f = (float)-s30_f;
  s0_f = var_8C.float_0;
  s24_f = (float)f10 + (float)r8_f * (float)0.5;
  s2_f = var_8C.float_4;
  // s6_f = (float)- s28_f;
  s4_f = var_8C.float_8;
  s10_f = (float)-s17_f;

  /*
   * 此处原始汇编是通过i3++这种形式增加的，自己汇编被优化成了+4，+8，这种形式。整个看起来就变化比较大。不知道有没有办法控制
   * 原始汇编：    LDR             R1, [R4] ...
   *              ADDS            R0, R1, #1
   *              STR             R0, [R4]
   * 自已汇编：    MOVS            R1, #4 ...
   *              MOVS            R1, #8
   */
  pf2[r0_i * 2] = f10;
  float s12_f = -s4_f;

  int r1_i = i3;
  float s14_f = -s2_f;
  float s1_f = -s0_f;
  r0_i = r1_i + 1;
  i3 = r0_i;
  float s5_f = s18_f + s26_f;
  pf2[r1_i * 2 + 1] = r11_f;

  r1_i = i3;
  pf2[r1_i * 2] = s24_f;
  r1_i = i3;
  int r2_i = r1_i + 1;
  i3 = r2_i;
  pf2[r1_i * 2 + 1] = r11_f;
  r1_i = i3;
  pf2[r1_i * 2] = s24_f;

  r1_i = i3;
  r2_i = r1_i + 1;
  i3 = r2_i;
  pf2[r1_i * 2 + 1] = 1.0;

  r1_i = i3;
  float r3_f = f10;
  pf2[r1_i * 2] = r3_f;

  r1_i = i3;
  int r3_i = r1_i + 1;
  i3 = r3_i;
  pf2[r1_i * 2 + 1] = 1.0;
  r1_i = i3;
  pf2[r1_i * 2] = s24_f;

  r1_i = i3;
  r3_i = r1_i + 1;
  i3 = r3_i;
  pf2[r1_i * 2 + 1] = r11_f;
  r1_i = i3;
  r3_f = f10;
  pf2[r1_i * 2] = r3_f;

  r1_i = i3;
  r3_i = r1_i + 1;
  i3 = r3_i;
  pf2[r1_i * 2 + 1] = r11_f;
  r1_i = i3;
  r3_f = f10;
  pf2[r1_i * 2] = r3_f;

  r1_i = i3;
  r3_i = r1_i + 1;
  i3 = r3_i;
  pf2[r1_i * 2 + 1] = 1.0;
  r1_i = i3;
  pf2[r1_i * 2] = s24_f;

  // r1_i  = i3;
  r1_i = var_9C;
  r0_i = r1_i + 1;
  pf2[i3 * 2 + 1] = 1.0;

  i3 = r0_i;
  pVector1[r1_i].float_0 = -s28_f;
  pVector1[r1_i].float_4 = -s30_f;
  pVector1[r1_i].float_8 = -s17_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = -s28_f;
  pVector1[r2_i].float_4 = -s30_f;
  pVector1[r2_i].float_8 = -s17_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = -s0_f;
  pVector1[r2_i].float_4 = -s2_f;
  pVector1[r2_i].float_8 = -s4_f;
  s12_f = s22_f + s26_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = -s28_f;
  s6_f = s16_f + s26_f;
  pVector1[r2_i].float_4 = -s30_f;
  s8_f = s20_f + s26_f;
  pVector1[r2_i].float_8 = -s17_f;

  r2_i = i3;
  s10_f = 6.7664e-1;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = s28_f;
  pVector1[r2_i].float_4 = s30_f;
  pVector1[r2_i].float_8 = s17_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = s0_f;
  pVector1[r2_i].float_4 = s2_f;
  pVector1[r2_i].float_8 = s4_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = s0_f;
  pVector1[r2_i].float_4 = s2_f;
  pVector1[r2_i].float_8 = s4_f;

  r2_i = i3;
  r3_i = r2_i + 1;
  i3 = r3_i;
  pVector1[r2_i].float_0 = s28_f;
  pVector1[r2_i].float_4 = s30_f;
  pVector1[r2_i].float_8 = s17_f;

  s0_f = var_74.float_0;
  s4_f = var_74.float_8;
  s2_f = var_74.float_4;
  float s3_f = s6_f - s0_f;
  s14_f = s8_f - s4_f;

  i3 = r0_i;
  s1_f = s10_f - s2_f;
  float s7_f = s12_f - s4_f;
  float s9_f = s5_f - s0_f;
  s8_f = s8_f + s4_f;
  s10_f = s2_f + s10_f;
  pVector0[r1_i].float_0 = s3_f;
  s3_f = s22_f - s4_f;
  s6_f = s6_f + s0_f;
  pVector0[r1_i].float_4 = s1_f;
  s12_f = s12_f + s4_f;
  pVector0[r1_i].float_8 = s14_f;

  r0_i = i3;
  s14_f = 9.9792e-3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s9_f;
  s9_f = s18_f - s0_f;
  pVector0[r0_i].float_4 = s1_f;
  s1_f = s20_f - s4_f;
  pVector0[r0_i].float_8 = s7_f;
  s7_f = s14_f - s2_f;

  r0_i = i3;
  s2_f = s2_f + s14_f;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s9_f;
  pVector0[r0_i].float_4 = s7_f;
  pVector0[r0_i].float_8 = s3_f;
  s3_f = s16_f - s0_f;

  r0_i = i3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s3_f;
  pVector0[r0_i].float_4 = s7_f;
  pVector0[r0_i].float_8 = s1_f;

  r0_i = i3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s6_f;
  s6_f = s22_f + s4_f;
  pVector0[r0_i].float_4 = s10_f;
  s4_f = s20_f + s4_f;
  pVector0[r0_i].float_8 = s8_f;
  s8_f = s5_f + s0_f;

  r0_i = i3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s8_f;
  s8_f = s18_f + s0_f;
  pVector0[r0_i].float_4 = s10_f;
  s0_f = s16_f - s0_f;
  pVector0[r0_i].float_8 = s12_f;

  r0_i = i3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s8_f;
  pVector0[r0_i].float_4 = s2_f;
  pVector0[r0_i].float_8 = s6_f;

  r0_i = i3;
  r1_i = r0_i + 1;
  i3 = r1_i;
  pVector0[r0_i].float_0 = s0_f;
  pVector0[r0_i].float_4 = s2_f;
  pVector0[r0_i].float_8 = s4_f;
  f10 = s24_f;
}
//-------------------------------------------------------------------------------------------------
// 001292E0 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::ProcessEditMode(int i1) {
  // 001292E6
  switch (this->field_F4) {
    case -1: {
      // loc_1292F4
      this->m_p3DPlayer_98->field_20C = 0;
      // 001292FA
      if (i1 == 55) {
        // 00129308
        switch (this->m_pUITileManager_4->field_A4) {
          case 0: {
            // loc_12931A
            this->SetupEditMode(0);
            break;
          }
          case 1: {
            // loc_129332
            this->SetupEditMode(1);
            break;
          }
          case 2: {
            // loc_129338
            this->SetupEditMode(2);
            break;
          }
          case 3: {
            // loc_12933E
            this->SetupEditMode(3);
            break;
          }
          case 4: {
            // loc_129344
            this->SetupEditMode(4);
            break;
          }
          case 5: {
            // loc_12934A
            this->SetupEditMode(5);
            break;
          }
          case 6: {
            // loc_129350
            this->SetupEditMode(6);
            break;
          }
        }
        // def_1292EA
      }
      // def_1292EA
      break;
    }
    case 0: {
      // loc_129322
      this->ProcessEditMode_NAME();
      break;
    }
    case 2: {
      // loc_129326
      this->ProcessEditMode_HAIRSTYLE();
      break;
    }
    case 3: {
      // loc_12932A
      this->ProcessEditMode_HAIRCOLOUR();
      break;
    }
    case 4: {
      // loc_12932E
      this->ProcessEditMode_FACIALHAIR();
      break;
    }
    default: {
      // def_1292EA
      break;
    }
  }
}
//-------------------------------------------------------------------------------------------------
// 00129860 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::UpdatePosition() {
  // 00129868
  if (this->field_12C <= 19) {
    // 0012986C
    this->vector32_FC += this->vector32_114;
    float s0_f = this->field_108;
    float s6_f = this->field_120;
    float s2_f = this->field_10C;
    float s8_f = this->field_124;
    s0_f = s0_f + s6_f;
    float s4_f = this->field_110;
    float s10_f = this->field_128;
    s2_f = s2_f + s8_f;
    s4_f = s4_f + s10_f;
    this->field_108 = s0_f;
    this->field_10C = s2_f;
    this->field_110 = s4_f;
  }
  // loc_1298A8
  int r1_i = this->field_F8;
  CFE3DPlayer* r2_p3DPlayer = this->m_p3DPlayer_98;
  uint r0_i = r2_p3DPlayer->tPlayer_10.u_0.s_2_0.s_2;
  int r4_i = s_iPlayerRot[r1_i];
  r1_i = r4_i + 0x2000;
  r0_i = r1_i - r0_i;
  r0_i = r0_i & 0x3FFF;
  r1_i = 0x2000 - r0_i;
  // 001298D0
  if ((uint)r0_i >= 0x2000) {
    // 001298D6
    r1_i = r0_i - 0x2000;
  }
  // 001298DA
  if (r1_i > 0x1800) {
    // loc_1298FA
    r1_i = 17;
    // loc_1298FA
    r2_p3DPlayer->tPlayer_10.SetAnim(r1_i);
  } else {
    // loc_1298E6
    if (r1_i >= 3414) {
      // 001298EE
      if (r0_i > 0x2000) {
        // 001298F6
        r1_i = 13;
        r2_p3DPlayer->tPlayer_10.SetAnim(r1_i);
      } else {
        // 001298F4
        r1_i = 14;
        r2_p3DPlayer->tPlayer_10.SetAnim(r1_i);
      }
      // loc_1298FA
      // r2_p3DPlayer->tPlayer_10.SetAnim(r1_i);
    }
  }

  // loc_1298FE
  r2_p3DPlayer->tPlayer_10.SetFace(r4_i);
  return;
}
//-------------------------------------------------------------------------------------------------
// 00129944 //^_^
//单元测试等级:目测游戏表现
//测试内容：启动游戏到第6关传球射门
//测试结果: 游戏表现正常无崩溃且无明显变化,未检测到日志输出
//测试分支: 无
void CFESEditPlayer::ConfirmUnlockCB(int i0, void* p1) {
  CFESEditPlayer* r4_player = (CFESEditPlayer*)p1;
  // 00129948
  if (i0 != 0) {
    // 0012994A
    return;
  }
  // loc_12994C
  int r1_i = r4_player->field_15C;
  // 00129958
  if (r1_i > CCurrency::s_iCredits) {
    // 00129964
    CFESShopHelper::ms_eTrigger = 4;
    return CFE::ShowShop(true);
  }
  // loc_129970
  r4_player->CompleteUnlock();
  r4_player->ApplyToProfile();
  MP_cMyProfile.Save(ESaveMode_1);
  r4_player->SetupEditMode(-1);
  return;
}
//-------------------------------------------------------------------------------------------------
// 001299C0
void CFESEditPlayer::CompleteUnlock() {
  int r3_i = this->field_158;
  wchar_t var_28[8];
  xsnprintf(var_28, 8, L"%i", r3_i);
  int r8_i = this->field_154;
  int r0_i = this->field_158;
  int r1_i = 32 - r0_i;
  int r2_i = 1;
  r3_i = r0_i - 32;
  r1_i = (uint)r2_i >> (uint)r1_i;
  if (r0_i >= 32) {
    r1_i = (uint)r2_i << (uint)r1_i;
  }
  r0_i = (uint)r2_i << (uint)r0_i;
  uint64 r5r7_ull = CStoryProfile::m_tData.field_210[r8_i];
  r1_i = r1_i | r5r7_ull;
  if (r0_i >= 32) {
    r0_i = 0;
  }
  r0_i = r0_i | (r5r7_ull >> 32u);
  CStoryProfile::m_tData.field_210[r8_i] = ((uint64)r1_i << 32u) | r0_i;
  CCurrency::SubtractCredits(this->field_15C, ETrigger_4, false);
  this->field_158 = -1;
  SNDFE_PlaySFX(8, 0, 1);
  r0_i = r8_i - 1;
  if (r0_i <= 2) {
    SYSCORE_DeleteFile("profileHead.png", true);
    CFTTTextureCache::EmptyCache();
  }
  // locret_129A4A
  return;
}
//-------------------------------------------------------------------------------------------------

// 00129358
void CFESEditPlayer::ProcessEditMode_NAME() {
  LOGX("ProcessEditMode_NAME %p", this);
}
//-------------------------------------------------------------------------------------------------
// 0012944C
void CFESEditPlayer::ProcessEditMode_NUMBER() {
  LOGX("ProcessEditMode_NUMBER %p", this);
}
//-------------------------------------------------------------------------------------------------
// 0012944E
void CFESEditPlayer::ProcessEditMode_HAIRSTYLE() {
  LOGX("ProcessEditMode_HAIRSTYLE %p", this);
}
//-------------------------------------------------------------------------------------------------
// 0012946E
void CFESEditPlayer::ProcessEditMode_HAIRCOLOUR() {
  LOGX("ProcessEditMode_HAIRCOLOUR %p", this);
}
//-------------------------------------------------------------------------------------------------
// 0012948E
void CFESEditPlayer::ProcessEditMode_FACIALHAIR() {
  LOGX("ProcessEditMode_FACIALHAIR %p", this);
}
//-------------------------------------------------------------------------------------------------
// 001294AE
void CFESEditPlayer::ProcessEditMode_SLEEVELENGTH() {
  LOGX("ProcessEditMode_SLEEVELENGTH %p", this);
}
//-------------------------------------------------------------------------------------------------
// 001294B0
void CFESEditPlayer::ProcessEditMode_BOOTS() {
  LOGX("ProcessEditMode_BOOTS %p", this);
}