#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA767_AU2E
extern HAMSTRUCT G3882_[20];


extern unsigned char G3879_;
extern unsigned char G3880_;
extern char G3881_;
extern char* G3878_pc_EmptyString;
extern int16_t G3877_i_HintOracleTextCount;
extern char* G3875_pc_HintOracleTextData;
extern char** G3876_ppc_HintOracleTexts;


void F2027_(char* P5953_, long P5954_) {
        register unsigned char L5900_;
        unsigned long L5901_;


        for (L5901_ = 0; L5901_ < P5954_ - 1; L5901_++) {
                L5900_ = P5953_[L5901_];
                if (L5900_ == '\0') {
                        break;
                }
                if ((L5900_ < G3879_) || (L5900_ > G3880_)) {
                        P5953_[L5901_] = G3881_;
                }
        }
        P5953_[L5901_] = '\0';
}

void F2028_LoadHintOracleTexts(
)
{
        register char* L5902_;
        register char** L5903_;
        register int16_t L5904_;
        register int16_t L5905_i_TextCount;
        register unsigned int16_t L5906_ui_TextByteCount;
        char** L5907_;
        int16_t L5908_;
        int16_t L5909_;


        L5906_ui_TextByteCount = F2026_GetGraphicByteCount(C4_HINT_GRAPHIC_TEXTS);
        G3875_pc_HintOracleTextData = L5902_ = (char*)F1886_Memory(-1, C14_ALLOCATE, (long)(L5906_ui_TextByteCount = F2026_GetGraphicByteCount(C4_HINT_GRAPHIC_TEXTS)));
        F1878_LoadGraphic(L5902_, C4_HINT_GRAPHIC_TEXTS);
        L5905_i_TextCount = 0;
        for (L5904_ = 0; L5904_ < L5906_ui_TextByteCount; L5904_++) {
                if (*L5902_++ == '\0') {
                        L5905_i_TextCount++;
                }
        }
        G3877_i_HintOracleTextCount = L5905_i_TextCount;
        G3876_ppc_HintOracleTexts = L5903_ = (char**)F1886_Memory(-1, C14_ALLOCATE, (long)(L5905_i_TextCount * 4));
        L5909_ = L5905_i_TextCount;
        L5902_ = G3875_pc_HintOracleTextData;
        *L5903_++ = L5902_;
        while (--L5905_i_TextCount > 0) {
                while (*L5902_++ != '\0');
                *L5903_++ = L5902_;
        }
        L5904_ = 0;
        for (;;) {
                L5907_ = G3882_[L5904_].ppc_0;
                if (L5907_ == NULL) {
                        break;
                }
                L5908_ = G3882_[L5904_].i_4;
                if (L5908_ <= L5909_) {
                        *L5907_ = G3876_ppc_HintOracleTexts[L5908_];
                }
                L5904_++;
        }
}

char* F2029_GetHintOracleText_Unreferenced(int16_t P5952_i_TextIndex) {
        return ((P5952_i_TextIndex < 0) || (P5952_i_TextIndex >= G3877_i_HintOracleTextCount)) ? G3878_pc_EmptyString : G3876_ppc_HintOracleTexts[P5952_i_TextIndex];
}

void F2030_FreeHintOracleTexts(
)
{
        if (G3875_pc_HintOracleTextData) {
                F1886_Memory(-1, C20_FREE, G3875_pc_HintOracleTextData);
        }
        if (G3876_ppc_HintOracleTexts) {
                F1886_Memory(-1, C20_FREE, G3876_ppc_HintOracleTexts);
        }
}
#endif
