#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
#ifdef MEDIA772_SU1E
#undef Fopen
#define Fopen(a, b)                        (int16_t)R0057_TOS_CallGEMDOS(0x3D, a, b)
#endif


BOOLEAN F7076_AreAllChampionNamesUnique(
)
{
#ifdef MEDIA772_SU1E
        register char* L3998_pc_;
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
        REGISTER unsigned char* L3998_pc_;
        REGISTER unsigned char* L3999_ps_;
#endif
        REGISTER int16_t L4001_i_;
        REGISTER int16_t L4000_i_ChampionIndex;


        for (L4001_i_ = 0; L4001_i_ < G7114_LoadedChampionCount; L4001_i_++) {
#ifdef MEDIA772_SU1E
                L3998_pc_ = G7111_Games[C0_GAME_SOURCE].Party.Champions[L4001_i_].Name;
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
                L3998_pc_ = (unsigned char*)F7067_GetChampionInfo(&G7111_Games[C0_GAME_SOURCE], L4001_i_, C01_CHAMPION_INFO_NAME);
#endif
                if (*L3998_pc_ == '\0') {
                        loc_155E0:
#ifdef MEDIA772_SU1E
                        F7072_GetDialogChoiceOrdinal(G7081_EACH_CHAMPION_MUST_HAVE_A_UNIQUE_FIRST_NAME, C08_COLOR_RED, G7060_OK, &G2263_s_Input_Dialog1Choice);
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
                        F7074_DrawDialogErrorMessage(G7081_EACH_CHAMPION_MUST_HAVE_A_UNIQUE_FIRST_NAME, C08_COLOR_RED);
#endif
                        return C0_FALSE;
                }
                for (L4000_i_ChampionIndex = L4001_i_ + 1; L4000_i_ChampionIndex < G7114_LoadedChampionCount; L4000_i_ChampionIndex++) {
#ifdef MEDIA772_SU1E
                        if (F0087_strcmp(L3998_pc_, G7111_Games[C0_GAME_SOURCE].Party.Champions[L4000_i_ChampionIndex].Name) == 0) {
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
                        L3999_ps_ = (unsigned char*)F7067_GetChampionInfo(&G7111_Games[C0_GAME_SOURCE], L4000_i_ChampionIndex, C01_CHAMPION_INFO_NAME);
                        if (F0087_strcmp(L3998_pc_, L3999_ps_) == 0) {
#endif
                                goto loc_155E0;
                        }
                }
        }
        return C1_TRUE;
}

#ifdef MEDIA773_SU1E_AU1E
BOOLEAN F1994_(int16_t P5906_, char* P5907_pc_FileName) {
        int16_t L5765_;
#ifdef MEDIA762_AU1E
        FILE_HANDLE L6179_ps_FileHandle;
#endif


        do {
                loc_EE2:
                if (P5906_ == 0) {
                        L5765_ = F7072_GetDialogChoiceOrdinal(G3758_PUT_A_BLANK_DISK_IN, C15_COLOR_WHITE | MASK0x8000_INVERT_BOX, G3759_MAKE_NEW_ADVENTURE_FORMAT_CANCEL, &G3760_);
                } else {
                        L5765_ = F7072_GetDialogChoiceOrdinal((P5906_ == 1) ? G3761_PLEASE_PUT_A_SAVE_GAME_DISK_IN : G3762_PUT_PORTRAIT_DISK_IN, C15_COLOR_WHITE | MASK0x8000_INVERT_BOX, G3763_SAVE_FORMAT_CANCEL, &G2254_s_Input_Dialog3ChoicesB);
                }
                if (L5765_ == 3) {
                        return C0_FALSE;
                }
                if (F1991_(1) > 0) {
#ifdef MEDIA772_SU1E
                        F7072_GetDialogChoiceOrdinal(G3764_THAT_S_THE_CHAOS_STRIKES_BACK_UTILITY_DISK, C08_COLOR_RED | MASK0x8000_INVERT_BOX, G7060_OK, &G2263_s_Input_Dialog1Choice);
#endif
#ifdef MEDIA762_AU1E
                        F7074_DrawDialogErrorMessage(G3764_THAT_S_THE_CHAOS_STRIKES_BACK_UTILITY_DISK, C08_COLOR_RED | MASK0x8000_UNKNOWN);
#endif
                        goto loc_EE2;
                }
                if (L5765_ == 2) {
                        F0453_FLOPPY_IsFormatDiskSuccessful();
                        goto loc_EE2;
                }
#ifdef MEDIA772_SU1E
                if (Fopen(P5907_pc_FileName, C0_READ_ONLY) < 0) {
#endif
#ifdef MEDIA762_AU1E
                if ((L6179_ps_FileHandle = F0770_FILE_Open(P5907_pc_FileName)) == NULL) {
#endif
                        break;
                }
#ifdef MEDIA762_AU1E
                F0771_FILE_Close(L6179_ps_FileHandle);
#endif
        } while (F7072_GetDialogChoiceOrdinal((P5906_ <= 1) ? G3765_REPLACE_EXISTING_SAVED_GAME : G3766_REPLACE_PORTRAIT, C08_COLOR_RED | MASK0x8000_INVERT_BOX, G3768_YES_NO, &G2264_s_Input_Dialog2Choices) != 1);
        return C1_TRUE;
}
#endif
#endif
