#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA774_SU1E_AU1E_AU2E
void F1893_ColorPalette(int16_t P5706_, int16_t P5707_, ...) {
        int16_t L5568_;
        unsigned int16_t* L5569_;
        HINT_PALETTE L5572_;
        long L5573_;
        long L5574_l_SupervisorStack;


#ifdef MEDIA773_SU1E_AU1E
        F1966_DebugEnter(22, P5707_);
#endif
        switch (P5707_) {
                case C01_INITIALIZE:
#ifdef MEDIA772_SU1E
                        if (L5573_ = F1878_LoadGraphic(G3603_aui_Palette_HintOracle, C3_HINT_GRAPHIC_PALETTE)) {
                                F1956_EndProgram(P5706_, 18, 212L);
                        }
                        L5572_._i_0x00 = 13;
                        L5572_._pui_0x02_SourcePalette = NULL;
                        L5572_._pui_0x06_TargetPalette = G3682_aui_Palette_BeforeHintOracle;
                        F1893_ColorPalette(P5706_, C09_COPY_PALETTE, &L5572_);
#endif
                        break;
                case C02_UNINITIALIZE:
                case 39:
                        break;
                case C40_SET_COLOR:
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x00 != 13) {
                                F1956_EndProgram(P5706_, 18, 79L);
                        }
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette == 0) {
#ifdef MEDIA772_SU1E
                                L5568_ = ((unsigned int16_t*)0xFFFF8240)[(*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0E];
#endif
#ifdef MEDIA763_AU1E_AU2E
                                L5568_ = *(F2033_() + (*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0E);
#endif
                        } else {
                                L5568_ = *((*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0E + (*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette);
                        }
#ifdef MEDIA772_SU1E
                        ((unsigned int16_t*)0xFFFF8240)[(*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0C] = L5568_;
#endif
#ifdef MEDIA763_AU1E_AU2E
                        *(F2033_() + (*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0C) = L5568_;
                        F2035_();
#endif
                        break;
                case C09_COPY_PALETTE:
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x00 != 13) {
                                F1956_EndProgram(P5706_, 18, 80L);
                        }
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x02_SourcePalette == NULL) {
#ifdef MEDIA772_SU1E
                                L5569_ = (unsigned int16_t*)0xFFFF8240;
#endif
#ifdef MEDIA763_AU1E_AU2E
                                L5569_ = F2033_();
#endif
                        } else {
                                L5569_ = (*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x02_SourcePalette;
                        }
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette == NULL) {
#ifdef MEDIA772_SU1E
                                (*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette = (unsigned int16_t*)0xFFFF8240;
#endif
#ifdef MEDIA763_AU1E_AU2E
                                (*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette = F2033_();
#endif
                        }
#ifdef MEDIA772_SU1E
                        L5574_l_SupervisorStack = Super(0L);
#endif
                        for (L5568_ = 0; L5568_ < 16; L5568_++) {
                                ((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette)[L5568_] = L5569_[L5568_];
                        }
#ifdef MEDIA772_SU1E
                        Super(L5574_l_SupervisorStack);
#endif
                        break;
                case C38_SET_PALETTE:
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x00 != 13) {
                                F1956_EndProgram(P5706_, 18, 78L);
                        }
#ifdef MEDIA772_SU1E
                        Setpalette((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette);
#endif
#ifdef MEDIA763_AU1E_AU2E
                        F2034_((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette);
#endif
                        break;
                case C34_FADE_TO_PALETTE:
                        if ((*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x00 != 13) {
                                F1956_EndProgram(P5706_, 18, 77L);
                        }
#ifdef MEDIA772_SU1E
                        F1897_FadeToPalette((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette, (*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x02_SourcePalette, (*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0A, (*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0C, (*((HINT_PALETTE**)(&P5707_ + 1)))->_i_0x0E);
#endif
#ifdef MEDIA763_AU1E_AU2E
                        F2045_FadeToPalette((*((HINT_PALETTE**)(&P5707_ + 1)))->_pui_0x06_TargetPalette);
#endif
                        break;
                default:
                        F1956_EndProgram(P5706_, 18, 76L);
        }
#ifdef MEDIA773_SU1E_AU1E
        F1967_DebugExit(22, P5707_);
#endif
}
#endif
