//
// Generated by dtk
// Translation Unit: d_ovlp_fade.cpp
//

#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_ovlp_fade.h"
#include "f_op/f_op_overlap.h"
#include "f_op/f_op_overlap_mng.h"
#include "f_pc/f_pc_manager.h"
#include "m_Do/m_Do_graphic.h"

BOOL (*dOvlpFd_execute_f)(overlap1_class*);

/* 802235CC-802235D4       .text dOvlpFd_Draw__FP14overlap1_class */
static BOOL dOvlpFd_Draw(overlap1_class* i_this) {
    return TRUE;
}

/* 802235D4-802236AC       .text dOvlpFd_FadeOut__FP14overlap1_class */
BOOL dOvlpFd_FadeOut(overlap1_class* i_this) {
    if (i_this->mFadeOutTime == 0) {
        if (fpcM_GetProfName(i_this) != fpcNm_OVERLAP6_e) {
            if (!JFWDisplay::getManager()->getFader()->startFadeIn(26))
                return TRUE;
            i_this->mFadeOutTime = 26;
        } else {
            if (!JFWDisplay::getManager()->getFader()->startFadeIn(0))
                return TRUE;
            i_this->mFadeOutTime = 1;
        }
    }

#if VERSION > VERSION_DEMO
    fopOvlpM_SceneIsStart();
#endif
    if (--i_this->mFadeOutTime == 0) {
        fopOvlpM_Done(i_this);
#if VERSION > VERSION_DEMO
        i_this->mFadeOutTime++;
#endif
    }

    return TRUE;
}

/* 802236AC-802236E4       .text dOvlpFd_Wait__FP14overlap1_class */
BOOL dOvlpFd_Wait(overlap1_class* i_this) {
    if (fopOvlpM_IsOutReq(i_this)) {
        dOvlpFd_execute_f = dOvlpFd_FadeOut;
#if VERSION == VERSION_DEMO
        fopOvlpM_SceneIsStart();
#endif
    }
    return TRUE;
}

/* 802236E4-802237A4       .text dOvlpFd_FadeIn__FP14overlap1_class */
BOOL dOvlpFd_FadeIn(overlap1_class* i_this) {
    if (i_this->mFadeInTime == 0) {
        i_this->mFadeInTime = 26;
        if (fpcM_GetProfName(i_this) == fpcNm_OVERLAP0_e || fpcM_GetProfName(i_this) == fpcNm_OVERLAP7_e) {
            mDoGph_gInf_c::startFadeOut(26);
        }
    }

    if (--i_this->mFadeInTime == 0) {
        dOvlpFd_execute_f = dOvlpFd_Wait;
        mDoGph_gInf_c::startFadeOut(0);
        fopOvlpM_Done(i_this);
    }

    return TRUE;
}

/* 802237A4-802237D0       .text dOvlpFd_Execute__FP14overlap1_class */
static BOOL dOvlpFd_Execute(overlap1_class* i_this) {
    dOvlpFd_execute_f(i_this);
    return TRUE;
}

/* 802237D0-802237D8       .text dOvlpFd_IsDelete__FP14overlap1_class */
static BOOL dOvlpFd_IsDelete(overlap1_class* i_this) {
    UNUSED(i_this);
    return TRUE;
}

/* 802237D8-802237E0       .text dOvlpFd_Delete__FP14overlap1_class */
static BOOL dOvlpFd_Delete(overlap1_class* i_this) {
    return TRUE;
}

/* 802237E0-802237F4       .text dOvlpFd_Create__FPv */
static cPhs_State dOvlpFd_Create(void* i_this) {
    dOvlpFd_execute_f = dOvlpFd_FadeIn;
#if VERSION == VERSION_DEMO
    return cPhs_NEXT_e;
#else
    return cPhs_COMPLEATE_e;
#endif
}

static overlap_method_class l_dOvlpFd_Method = {
    (process_method_func)dOvlpFd_Create,
    (process_method_func)dOvlpFd_Delete,
    (process_method_func)dOvlpFd_Execute,
    (process_method_func)dOvlpFd_IsDelete,
    (process_method_func)dOvlpFd_Draw,
};

overlap_process_profile_definition g_profile_OVERLAP0 = {
    /* Layer ID    */ fpcLy_ROOT_e,
    /* List ID     */ 0,
    /* List Prio   */ fpcPi_CURRENT_e,
    /* Proc Name   */ fpcNm_OVERLAP0_e,
    /* Proc SubMtd */ &g_fpcLf_Method.base,
    /* Size        */ sizeof(overlap1_class),
    /* Size Other  */ 0,
    /* Parameters  */ 0,
    /* Leaf SubMtd */ &g_fopOvlp_Method,
    /* Draw Prio   */ fpcDwPi_OVERLAP0_e,
    /* Ovlp SubMtd */ &l_dOvlpFd_Method,
};

overlap_process_profile_definition g_profile_OVERLAP1 = {
    /* Layer ID    */ fpcLy_ROOT_e,
    /* List ID     */ 0,
    /* List Prio   */ fpcPi_CURRENT_e,
    /* Proc Name   */ fpcNm_OVERLAP1_e,
    /* Proc SubMtd */ &g_fpcLf_Method.base,
    /* Size        */ sizeof(overlap1_class),
    /* Size Other  */ 0,
    /* Parameters  */ 0,
    /* Leaf SubMtd */ &g_fopOvlp_Method,
    /* Draw Prio   */ fpcDwPi_OVERLAP1_e,
    /* Ovlp SubMtd */ &l_dOvlpFd_Method,
};

overlap_process_profile_definition g_profile_OVERLAP6 = {
    /* Layer ID    */ fpcLy_ROOT_e,
    /* List ID     */ 0,
    /* List Prio   */ fpcPi_CURRENT_e,
    /* Proc Name   */ fpcNm_OVERLAP6_e,
    /* Proc SubMtd */ &g_fpcLf_Method.base,
    /* Size        */ sizeof(overlap1_class),
    /* Size Other  */ 0,
    /* Parameters  */ 0,
    /* Leaf SubMtd */ &g_fopOvlp_Method,
    /* Draw Prio   */ fpcDwPi_OVERLAP6_e,
    /* Ovlp SubMtd */ &l_dOvlpFd_Method,
};

overlap_process_profile_definition g_profile_OVERLAP7 = {
    /* Layer ID    */ fpcLy_ROOT_e,
    /* List ID     */ 0,
    /* List Prio   */ fpcPi_CURRENT_e,
    /* Proc Name   */ fpcNm_OVERLAP7_e,
    /* Proc SubMtd */ &g_fpcLf_Method.base,
    /* Size        */ sizeof(overlap1_class),
    /* Size Other  */ 0,
    /* Parameters  */ 0,
    /* Leaf SubMtd */ &g_fopOvlp_Method,
    /* Draw Prio   */ fpcDwPi_OVERLAP7_e,
    /* Ovlp SubMtd */ &l_dOvlpFd_Method,
};

overlap_process_profile_definition g_profile_OVERLAP8 = {
    /* Layer ID    */ fpcLy_ROOT_e,
    /* List ID     */ 0,
    /* List Prio   */ fpcPi_CURRENT_e,
    /* Proc Name   */ fpcNm_OVERLAP8_e,
    /* Proc SubMtd */ &g_fpcLf_Method.base,
    /* Size        */ sizeof(overlap1_class),
    /* Size Other  */ 0,
    /* Parameters  */ 0,
    /* Leaf SubMtd */ &g_fopOvlp_Method,
    /* Draw Prio   */ fpcDwPi_OVERLAP8_e,
    /* Ovlp SubMtd */ &l_dOvlpFd_Method,
};
