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

#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_eff.h"
#include "d/d_com_inf_game.h"

const GXColor daObjEff::BarrelSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF};


/* 000000EC-00000140       .text __ct__Q28daObjEff13BarrelSmokeCBFv */
daObjEff::BarrelSmokeCB::BarrelSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) {
    field_0x20 = 0x3c;
}

/* 00000140-000001CC       .text execute__Q28daObjEff13BarrelSmokeCBFP14JPABaseEmitter */
void daObjEff::BarrelSmokeCB::execute(JPABaseEmitter *i_emitter) {
    field_0x20 -= 1;
    if (field_0x20 <= 0) {
        end();
    } else if (field_0x20 < 0x32) {
        i_emitter->setGlobalAlpha(field_0x20 * 3.6f);
    }
}

const GXColor daObjEff::StoolSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF};
/* 000001CC-00000220       .text __ct__Q28daObjEff12StoolSmokeCBFv */
daObjEff::StoolSmokeCB::StoolSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) {
    field_0x20 = 0x3c;
}

/* 00000220-000002AC       .text execute__Q28daObjEff12StoolSmokeCBFP14JPABaseEmitter */
void daObjEff::StoolSmokeCB::execute(JPABaseEmitter *i_emitter) {
    field_0x20 -= 1;
    if (field_0x20 <= 0) {
        end();
    } else if (field_0x20 < 0x32) {
        i_emitter->setGlobalAlpha(field_0x20 * 3.6f);
    }
}

const GXColor daObjEff::SkullSmokeCB::original_color = {0xA0, 0xA0, 0x80, 0xFF};
/* 000002AC-00000300       .text __ct__Q28daObjEff12SkullSmokeCBFv */
daObjEff::SkullSmokeCB::SkullSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) {
    field_0x20 = 0x3c;
}

/* 00000300-0000038C       .text execute__Q28daObjEff12SkullSmokeCBFP14JPABaseEmitter */
void daObjEff::SkullSmokeCB::execute(JPABaseEmitter *i_emitter) {
    field_0x20 -= 1;
    if (field_0x20 <= 0) {
        end();
    } else if (field_0x20 < 0x32) {
        i_emitter->setGlobalAlpha(field_0x20 * 3.6f);
    }
}

/* 0000038C-000003CC       .text __ct__Q28daObjEff11LandSmokeCBFv */
daObjEff::LandSmokeCB::LandSmokeCB() : dPa_smokeEcallBack(0) {
}

const GXColor daObjEff::PineconeSmokeCB::original_color = {0x96, 0x78, 0x3C, 0xFF};
/* 000003CC-00000420       .text __ct__Q28daObjEff15PineconeSmokeCBFv */
daObjEff::PineconeSmokeCB::PineconeSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) {
    field_0x20 = 0x3c;
}

/* 00000420-000004AC       .text execute__Q28daObjEff15PineconeSmokeCBFP14JPABaseEmitter */
void daObjEff::PineconeSmokeCB::execute(JPABaseEmitter *i_emitter) {
    field_0x20 -= 1;
    if (field_0x20 <= 0) {
        end();
    } else if (field_0x20 < 0x32) {
        i_emitter->setGlobalAlpha(field_0x20 * 3.6f);
    }
}

const GXColor daObjEff::WoodBoxSmokeCB::original_color = {0xAF, 0x96, 0x64, 0xFF};
/* 000004AC-00000500       .text __ct__Q28daObjEff14WoodBoxSmokeCBFv */
daObjEff::WoodBoxSmokeCB::WoodBoxSmokeCB() : dPa_smokeEcallBack(original_color, NULL, 0) {
    field_0x20 = 0x3c;
}

/* 00000500-0000058C       .text execute__Q28daObjEff14WoodBoxSmokeCBFP14JPABaseEmitter */
void daObjEff::WoodBoxSmokeCB::execute(JPABaseEmitter *i_emitter) {
    field_0x20 -= 1;
    if (field_0x20 <= 0) {
        end();
    } else if (field_0x20 < 0x32) {
        i_emitter->setGlobalAlpha(field_0x20 * 3.6f);
    }
}

/* 0000058C-000005B0       .text solidHeapCB__Q28daObjEff5Act_cFP10fopAc_ac_c */
BOOL daObjEff::Act_c::solidHeapCB(fopAc_ac_c *i_this) {
    return static_cast<Act_c *>(i_this)->create_heap();
}

/* 000005B0-00000600       .text create_heap_barrel_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_barrel_smoke() {
    BarrelSmokeCB *barrel_smoke_cb = new BarrelSmokeCB();
    mParticleCallback = barrel_smoke_cb;
    return mParticleCallback != NULL;
}

/* 00000600-00000650       .text create_heap_stool_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_stool_smoke() {
    StoolSmokeCB *stool_smoke_cb = new StoolSmokeCB();
    mParticleCallback = stool_smoke_cb;
    return mParticleCallback != NULL;
}

/* 00000650-000006A0       .text create_heap_skull_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_skull_smoke() {
    SkullSmokeCB *skull_smoke_cb = new SkullSmokeCB();
    mParticleCallback = skull_smoke_cb;
    return mParticleCallback != NULL;
}

/* 000006A0-000006F0       .text create_heap_land_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_land_smoke() {
    LandSmokeCB *land_smoke_cb = new LandSmokeCB();
    mParticleCallback = land_smoke_cb;
    return mParticleCallback != NULL;
}

/* 000006F0-00000740       .text create_heap_pinecone_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_pinecone_smoke() {
    PineconeSmokeCB *pinecone_smoke_cb = new PineconeSmokeCB();
    mParticleCallback = pinecone_smoke_cb;
    return mParticleCallback != NULL;
}

/* 00000740-00000790       .text create_heap_woodBox_smoke__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap_woodBox_smoke() {
    WoodBoxSmokeCB *woodbox_smoke_cb = new WoodBoxSmokeCB();
    mParticleCallback = woodbox_smoke_cb;
    return mParticleCallback != NULL;
}

/* 00000790-00000898       .text create_heap__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::create_heap() {
    static CreateHeapProc proc[] = {
        &Act_c::create_heap_barrel_smoke,
        &Act_c::create_heap_stool_smoke,
        &Act_c::create_heap_skull_smoke,
        &Act_c::create_heap_land_smoke,
        &Act_c::create_heap_pinecone_smoke,
        &Act_c::create_heap_woodBox_smoke
    };

    bool ret = false;
    if ((this->*proc[mType])()) {
        ret = true;
    }

    return ret;
}

/* 00000898-00000998       .text eff_set_barrel_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_barrel_smoke() {
    static cXyz particle_scl(2.5f, 2.5f, 1.0f);
    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_JT_ELEMENTSMOKE01, &current.pos, NULL,  NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl);
    if (emitter != NULL) {
        emitter->setVolumeSize(0x28);
        emitter->setRate(20.0f);
        emitter->setMaxFrame(1);
        emitter->setAwayFromCenterSpeed(15.0f);
        emitter->setAwayFromAxisSpeed(10.0f);
        return true;
    }

    return false;
}

/* 000009D4-00000AD0       .text eff_set_stool_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_stool_smoke() {
    static cXyz particle_scl(2.5f, 2.5f, 1.0f);
    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_JT_ELEMENTSMOKE01, &current.pos,
                                                        NULL,  NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl);
    if (emitter != NULL) {
        emitter->setVolumeSize(0x1E);
        emitter->setRate(15.0f);
        emitter->setMaxFrame(1);
        emitter->setAwayFromCenterSpeed(15.0f);
        emitter->setAwayFromAxisSpeed(10.0f);
        return true;
    }

    return FALSE;
}

/* 00000AD0-00000BC0       .text eff_set_skull_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_skull_smoke() {
    static cXyz particle_scl(1.6f, 1.6f, 1.0f);
    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_JT_ELEMENTSMOKE01, &current.pos,
                                                        NULL,  NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl);
    if (emitter != NULL) {
        emitter->setRate(10.0f);
        emitter->setMaxFrame(1);
        emitter->setAwayFromCenterSpeed(8.0f);
        return true;
    }

    return FALSE;
}

/* 00000BC0-00000D24       .text eff_set_land_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_land_smoke() {
    int ret;
    cXyz pScale;
    pScale.x = scale.x;
    pScale.y = scale.y;
    pScale.z = scale.z;

    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_JT_ELEMENTSMOKE01, &current.pos,
                                                        NULL,  &pScale, 0xB4, mParticleCallback, -1, NULL, NULL, NULL);
    if (emitter != NULL) {
        emitter->setVolumeSize(0x1E);
        emitter->setLifeTime(0x23);
        emitter->setRate(20.0f);
        emitter->setMaxFrame(1);
        emitter->setAwayFromCenterSpeed(10.0f);
        static JGeometry::TVec3<f32> em_scl(1.0f, 0.0f, 1.0f);
        emitter->setEmitterScale(em_scl);
        static JGeometry::TVec3<f32> em_trans(0.0f, 5.0f, 0.0f);
        emitter->setEmitterTranslation(em_trans);
        ret = true;
    } else {
        ret = false;
    }

    return ret;
}

/* 00000D24-00000D98       .text eff_set_pinecone_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_pinecone_smoke() {
    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_IT_ST_BOKKURI_SMOKE00, &current.pos,
                                                        NULL,  NULL, 0xB4, mParticleCallback, -1, NULL, NULL, NULL);
    return emitter != NULL;
}

/* 00000D98-00000E80       .text eff_set_woodBox_smoke__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set_woodBox_smoke() {
    static cXyz particle_scl(2.5f, 2.5f, 1.0f);
    JPABaseEmitter *emitter = dComIfGp_particle_setToon(dPa_name::ID_AK_JT_ELEMENTSMOKE01, &current.pos,
                                                        NULL,  NULL, 0xB4, mParticleCallback, -1, NULL, NULL, &particle_scl);
    if (emitter != NULL) {
        emitter->setRate(30.0f);
        emitter->setMaxFrame(1);
        return true;
    }

    return false;
}

/* 00000E80-00000F6C       .text eff_set__Q28daObjEff5Act_cFv */
BOOL daObjEff::Act_c::eff_set() {
    static SetProc proc[] = {
        &Act_c::eff_set_barrel_smoke,
        &Act_c::eff_set_stool_smoke,
        &Act_c::eff_set_skull_smoke,
        &Act_c::eff_set_land_smoke,
        &Act_c::eff_set_pinecone_smoke,
        &Act_c::eff_set_woodBox_smoke
    };

    return (this->*proc[mType])();
}

/* 00000F6C-00001030       .text _create__Q28daObjEff5Act_cFv */
cPhs_State daObjEff::Act_c::_create() {
    static const u32 heap_size[] = {
        0x00000040,
        0x00000040,
        0x00000040,
        0x00000020,
        0x00000040,
        0x00000040,
    };

    mType = prm_get_type();
    fopAcM_ct(this, daObjEff::Act_c);
    int phase = cPhs_COMPLEATE_e;
    if (fopAcM_entrySolidHeap(this, &solidHeapCB, heap_size[mType])) {
        if ((u8) eff_set() != 0) {
            fopAcM_offDraw(this);
        } else {
            phase = cPhs_ERROR_e;
        }
    } else {
        phase = cPhs_ERROR_e;
    }

    return phase;
}

/* 00001030-00001068       .text remove_barrel_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_barrel_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 00001068-000010A0       .text remove_stool_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_stool_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 000010A0-000010D8       .text remove_skull_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_skull_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 000010D8-00001110       .text remove_land_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_land_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 00001110-00001148       .text remove_pinecone_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_pinecone_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 00001148-00001180       .text remove_woodBox_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove_woodBox_smoke() {
    if (mParticleCallback != NULL) {
        (mParticleCallback)->remove();
    }
}

/* 00001180-0000126C       .text remove__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::remove() {
    static RemoveProc proc[] = {
        &Act_c::remove_barrel_smoke,
        &Act_c::remove_stool_smoke,
        &Act_c::remove_skull_smoke,
        &Act_c::remove_land_smoke,
        &Act_c::remove_pinecone_smoke,
        &Act_c::remove_woodBox_smoke
    };
    (this->*proc[mType])();
}

/* 0000126C-00001290       .text _delete__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::_delete() {
    remove();
    return TRUE;
}

/* 00001290-000012C0       .text die_barrel_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_barrel_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 000012C0-000012F0       .text die_stool_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_stool_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 000012F0-00001320       .text die_skull_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_skull_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 00001320-00001350       .text die_land_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_land_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 00001350-00001380       .text die_pinecone_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_pinecone_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 00001380-000013B0       .text die_woodBox_smoke__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die_woodBox_smoke() {
    if (mParticleCallback->isEnd()) {
        fopAcM_delete(this);
    }
}

/* 000013B0-0000149C       .text die__Q28daObjEff5Act_cFv */
void daObjEff::Act_c::die() {
    static DieProc proc[] = {
        &Act_c::die_barrel_smoke,
        &Act_c::die_stool_smoke,
        &Act_c::die_skull_smoke,
        &Act_c::die_land_smoke,
        &Act_c::die_pinecone_smoke,
        &Act_c::die_woodBox_smoke
    };

    (this->*proc[mType])();
}

/* 0000149C-000014C0       .text _execute__Q28daObjEff5Act_cFv */
bool daObjEff::Act_c::_execute() {
    die();
    return TRUE;
}

namespace daObjEff {
    namespace {
        /* 000014C0-000014E0       .text Mthd_Create__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */
        cPhs_State Mthd_Create(void *i_this) {
            return ((Act_c *) i_this)->_create();
        }

        /* 000014E0-00001504       .text Mthd_Delete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */
        BOOL Mthd_Delete(void *i_this) {
            return ((Act_c *) i_this)->_delete();
        }

        /* 00001504-00001528       .text Mthd_Execute__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */
        BOOL Mthd_Execute(void *i_this) {
            return ((Act_c *) i_this)->_execute();
        }

        /* 00001528-00001530       .text Mthd_Draw__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */
        BOOL Mthd_Draw(void *) {
            return TRUE;
        }

        /* 00001530-00001538       .text Mthd_IsDelete__Q28daObjEff25@unnamed@d_a_obj_eff_cpp@FPv */
        BOOL Mthd_IsDelete(void *) {
            return TRUE;
        }

        static actor_method_class Mthd_Table = {
            static_cast<process_method_func>(Mthd_Create),
            static_cast<process_method_func>(Mthd_Delete),
            static_cast<process_method_func>(Mthd_Execute),
            static_cast<process_method_func>(Mthd_IsDelete),
            static_cast<process_method_func>(Mthd_Draw),
        };
    }; // namespace
}; // namespace daObjEff

actor_process_profile_definition g_profile_Obj_Eff = {
    /* Layer ID     */ fpcLy_CURRENT_e,
    /* List ID      */ 0x0009,
    /* List Prio    */ fpcPi_CURRENT_e,
    /* Proc Name    */ fpcNm_Obj_Eff_e,
    /* Proc SubMtd  */ &g_fpcLf_Method.base,
    /* Size         */ sizeof(daObjEff::Act_c),
    /* Size Other   */ 0,
    /* Parameters   */ 0,
    /* Leaf SubMtd  */ &g_fopAc_Method.base,
    /* Draw Prio    */ fpcDwPi_Obj_Eff_e,
    /* Actor SubMtd */ &daObjEff::Mthd_Table,
    /* Status       */ fopAcStts_UNK40000_e,
    /* Group        */ fopAc_ACTOR_e,
    /* Cull Type    */ fopAc_CULLBOX_0_e,
};
