#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
void F7087_CopyChampionProperty(GAME* P3760_ps_SourceGame, GAME* P3761_ps_DestinationGame, int16_t P3762_i_ChampionIndex, unsigned int16_t P3763_ui_)
{
        long L4028_l_;
        char* L4029_pc_;
        long L4030_l_;


        if ((P3763_ui_ == 7) || (P3763_ui_ == 8)) {
                return;
        }
        L4028_l_ = F7067_GetChampionInfo(P3760_ps_SourceGame, P3762_i_ChampionIndex, P3763_ui_);
        L4029_pc_ = (char*)L4028_l_;
        L4030_l_ = F7067_GetChampionInfo(P3761_ps_DestinationGame, P3762_i_ChampionIndex, P3763_ui_);
        switch (P3763_ui_) {
                case C01_CHAMPION_INFO_NAME:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 8L);
                        break;
                case C02_CHAMPION_INFO_TITLE:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 20L);
                        break;
                case 7:
                case 8:
                        break;
                case C09_CHAMPION_INFO_SYMBOLS:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 6L);
                        break;
                case C26_CHAMPION_INFO_STATISTICS:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 21L);
                        break;
                case C27_CHAMPION_INFO_SKILLS:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 120L);
                        break;
                case C28_CHAMPION_INFO_SLOTS:
                        F7317_MAIN_CopyBytes_Alt((char*)L4029_pc_, (char*)L4030_l_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, 60L);
                        break;
                case C31_CHAMPION_INFO_PORTRAIT:
                        break;
                default:
                /* case C03_CHAMPION_INFO_DIRECTION:
                case C04_CHAMPION_INFO_CELL:
                case C05_CHAMPION_INFO_ACTIONINDEX:
                case C06_CHAMPION_INFO_SYMBOLSTEP:
                case C10_CHAMPION_INFO_DIRECTIONMAXIMUMDAMAGERECEIVED:
                case C11_CHAMPION_INFO_MAXIMUMDAMAGERECEIVED:
                case C12_CHAMPION_INFO_POISONEVENTCOUNT:
                case C13_CHAMPION_INFO_ENABLEACTIONEVENTINDEX:
                case C14_CHAMPION_INFO_HIDEDAMAGERECEIVEDEVENTINDEX:
                case C15_CHAMPION_INFO_ATTRIBUTES:
                case C16_CHAMPION_INFO_WOUNDS:
                case C17_CHAMPION_INFO_CURRENTHEALTH:
                case C18_CHAMPION_INFO_MAXIMUMHEALTH:
                case C19_CHAMPION_INFO_CURRENTSTAMINA:
                case C20_CHAMPION_INFO_MAXIMUMSTAMINA:
                case C21_CHAMPION_INFO_CURRENTMANA:
                case C22_CHAMPION_INFO_MAXIMUMMANA:
                case C23_CHAMPION_INFO_ACTIONDEFENSE:
                case C24_CHAMPION_INFO_FOOD:
                case C25_CHAMPION_INFO_WATER:
                case C29_CHAMPION_INFO_LOAD:
                case C30_CHAMPION_INFO_SHIELDDEFENSE: */
                        F7068_SetChampionInfo(P3761_ps_DestinationGame, P3762_i_ChampionIndex, P3763_ui_, L4028_l_);
        }
}

void F7088_CopyChampionPortraits(GAME* P3764_ps_, GAME* P3766_ps_)
{
        unsigned int16_t L4033_ui_;
        unsigned int16_t L4034_ui_;
        long L4031_l_;
        char* L4032_pc_;
        char L6033_ac_Unreferenced[6];


        if (P3764_ps_->ChampionFormat == P3766_ps_->ChampionFormat) {
                if ((P3764_ps_->ChampionDataByteCount == P3766_ps_->ChampionDataByteCount) && (P3764_ps_->PortraitFormat == P3766_ps_->PortraitFormat) && (P3764_ps_->PortraitByteCount == P3766_ps_->PortraitByteCount) && (P3764_ps_->PortraitCount == P3766_ps_->PortraitCount)) {
                        T7088001: /* ANOMALY_FMT Label required to disable optimization */
                        P3766_ps_->ChampionFormat = P3764_ps_->ChampionFormat;
                        P3766_ps_->PortraitFormat = P3764_ps_->PortraitFormat;
                        if (P3766_ps_->Champions) {
                                F7024_Free(P3766_ps_->Champions);
                        }
#ifdef MEDIA762_AU1E
                        P3766_ps_->Champions = (CHAMPION_EXCLUDING_PORTRAIT*)F2095_AllocateMemory((long)P3764_ps_->ChampionDataByteCount, MASK0x0400_MEMREQ, "player2"); /* BUG0_01 Coding error without consequence. Function call with wrong number of parameters. It should be called with 1 parameter. No consequence because additional parameters are ignored */
#endif
#ifdef MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E
                        P3766_ps_->Champions = (CHAMPION_EXCLUDING_PORTRAIT*)F7023_Alloc((long)P3764_ps_->ChampionDataByteCount, MASK0x0400_MEMREQ);
#endif
                        P3766_ps_->ChampionDataByteCount = P3764_ps_->ChampionDataByteCount;
                        F7317_MAIN_CopyBytes_Alt((char*)P3764_ps_->Champions, (char*)P3766_ps_->Champions, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, P3764_ps_->ChampionDataByteCount);
                        if (P3766_ps_->Portraits) {
                                F7024_Free(P3766_ps_->Portraits);
                        }
                        P3766_ps_->Portraits = NULL;
                        if (P3764_ps_->PortraitCount) {
#ifdef MEDIA762_AU1E
                                P3766_ps_->Portraits = F2095_AllocateMemory(P3764_ps_->PortraitByteCount * P3764_ps_->PortraitCount, MASK0x0400_MEMREQ, "mug2"); /* BUG0_01 Coding error without consequence. Function call with wrong number of parameters. It should be called with 1 parameter. No consequence because additional parameters are ignored */
#endif
#ifdef MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E
                                P3766_ps_->Portraits = F7023_Alloc(P3764_ps_->PortraitByteCount * P3764_ps_->PortraitCount, MASK0x0400_MEMREQ);
#endif
                                P3766_ps_->PortraitByteCount = P3764_ps_->PortraitByteCount;
                                P3766_ps_->PortraitCount = P3764_ps_->PortraitCount;
                                F7317_MAIN_CopyBytes_Alt((char*)P3764_ps_->Portraits, (char*)P3766_ps_->Portraits, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, P3764_ps_->PortraitByteCount * P3764_ps_->PortraitCount);
                        } else {
                                P3766_ps_->Portraits = NULL;
                                P3766_ps_->PortraitByteCount = 0;
                                P3766_ps_->PortraitCount = 0;
                        }
                }
        } else {
                if ((P3764_ps_->ChampionFormat == C1_CHAMPION_FORMAT_PORTRAITS_INCLUDED) && (P3766_ps_->ChampionFormat == C2_CHAMPION_FORMAT_PORTRAITS_EXCLUDED)) {
                        if (P3766_ps_->PortraitByteCount * P3766_ps_->PortraitCount == 4 * 464) {
                                L4032_pc_ = M772_CAST_PC(P3766_ps_->Portraits);
                                for (L4034_ui_ = 0; L4034_ui_ < 4; L4034_ui_++) {
                                        for (L4033_ui_ = 1; L4033_ui_ < 32; L4033_ui_++) {
                                                F7087_CopyChampionProperty(P3764_ps_, P3766_ps_, L4034_ui_, L4033_ui_);
                                        }
                                        L4031_l_ = F7067_GetChampionInfo(P3764_ps_, L4034_ui_, C31_CHAMPION_INFO_PORTRAIT);
                                        F7317_MAIN_CopyBytes_Alt((char*)L4031_l_, (char*)L4032_pc_, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, P3766_ps_->PortraitByteCount);
                                        L4032_pc_ += P3766_ps_->PortraitByteCount;
                                }
                        }
                }
        }
        F7066_LoadPortraits(P3766_ps_);
}
#endif
