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

#include "d/actor/d_a_bomb.h"
#include "d/actor/d_a_bomb2.h"
#include "JSystem/JUtility/JUTAssert.h"

#define L_daBomb_Version 1

s16 daBomb_c::getBombRestTime() {
    _prm_chk_version();

    return mRestTime;
}

s16 daBomb_c::getBombCheck_Flag() {
    _prm_chk_version();

    return field_0x6F1;
}

void daBomb_c::setBombCheck_Flag() {
    _prm_chk_version();

    field_0x6F1 = true;
}

void daBomb_c::setBombFire_ON() {
    _prm_chk_version();

    field_0x6F2 = true;
}

void daBomb_c::setBombNoHit() {
    _prm_chk_version();

    mSph.GetObjTg().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjCo().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjAt().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjAt().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);

    field_0x6F3 = true;
}

void daBomb_c::setBombOffCoSet() {
    _prm_chk_version();

    mSph.GetObjCo().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
}

void daBomb_c::setBombOnCoSet() {
    _prm_chk_version();

    mSph.GetObjCo().OnSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
}

void daBomb_c::setBombNoEff() {
    _prm_chk_version();

    if(mSmoke.mpEmitter) {
        mSmoke.mpEmitter->mpEmitterCallBack = 0;
        mSmoke.mpEmitter->becomeInvalidEmitter();
    }
    mSmoke.mpEmitter = 0;

    if(mSparks.mpEmitter) {
        mSparks.mpEmitter->mpEmitterCallBack = 0;
        mSparks.mpEmitter->becomeInvalidEmitter();
    }
    mSparks.mpEmitter = 0;
}

void daBomb_c::setBombRestTime(s16 time) {
    _prm_chk_version();

    mRestTime = time;
}

void daBomb_c::setNoGravityTime(s16 time) {
    _prm_chk_version();

    mNoGravityTime = time;
}

int daBomb_c::prm_make(daBomb_c::State_e state, bool param_1, bool param_2) {
    return (((param_2 ? 1 : 0) << 17) | (state | ((param_1 ? 1 : 0) << 16))) | 0x80000000;
}

bool daBomb_c::chk_state(daBomb_c::State_e state) const {
    _prm_chk_version();

    return state == prm_get_state();
}

void daBomb_c::change_state(daBomb_c::State_e new_state) {
    mBase.mParameters = (mBase.mParameters & ~(((1 << PRM_STATE_W) - 1) << PRM_STATE_S)) | (new_state << PRM_STATE_S); // & 0xFF000000

    _prm_chk_version();
}

int daBomb_c::prm_get_state() const {
    _prm_chk_version();

    return daObj::PrmAbstract(this, PRM_STATE_W, PRM_STATE_S);
}

bool daBomb_c::get_explode_instant() const {
    return field_0x784 == true;
}

bool daBomb_c::prm_get_cheapEff() const {
    _prm_chk_version();

    return daObj::PrmAbstract(this, PRM_CHEAP_EFF_W, PRM_CHEAP_EFF_S);
}

bool daBomb_c::prm_get_angXZero() const {
    _prm_chk_version();

    return daObj::PrmAbstract(this, PRM_ANGXZERO_W, PRM_ANGXZERO_S);
}

int daBomb_c::prm_get_version() const {
    return daObj::PrmAbstract(this, PRM_VERSION_W, PRM_VERSION_S);
}

void daBomb_c::_prm_chk_version() const {
    int ver = prm_get_version();
    JUT_ASSERT(0xCE, ver == L_daBomb_Version);
}

void daBomb2::Act_c::remove_fuse_effect() {
    mSmoke.deleteCallBack();
    mSparks.deleteCallBack();
}

void daBomb2::Act_c::set_time(int time) {
    field_0x738 = time;
}

int daBomb2::Act_c::get_time() const {
    return field_0x738;
}

bool daBomb2::Act_c::chk_eat() const {
    return field_0x745;
}

void daBomb2::Act_c::set_eat() {
    field_0x745 = true;
}

void daBomb2::Act_c::set_no_hit() {
    mSph.GetObjTg().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjCo().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjAt().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
    mSph.GetObjAt().OffSPrmBit(cCcD_ObjCommonBase::CO_SPRM_SET);
}

bool daBomb2::Act_c::chk_explode() {
    return field_0x694 == 2;
}
