summaryrefslogtreecommitdiff
path: root/src/d/actor/d_a_obj_suisya.cpp
blob: f14ff36706e627035f1ed0cf4e609d1d6dc38574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
 * d_a_obj_suisya.cpp
 * Ordon Village Water Wheel
 */

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

#include "d/actor/d_a_obj_suisya.h"
#include "d/d_com_inf_game.h"
#include "f_pc/f_pc_name.h"

int daObj_Suisya_c::draw() {
    g_env_light.settingTevStruct(0x10, &current.pos, &tevStr);
    g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
    mDoExt_modelUpdateDL(mpModel);

    cXyz sp18;
    sp18.set(current.pos.x, current.pos.y + 100.0f, current.pos.z);

    mShadowKey = dComIfGd_setShadow(mShadowKey, 1, mpModel, &sp18, 400.0f, 0.0f, current.pos.y,
                                    mAcch.GetGroundH(), mAcch.m_gnd, &tevStr, 0, 1.0f,
                                    dDlst_shadowControl_c::getSimpleTex());
    return 1;
}

static int daObj_Suisya_Draw(daObj_Suisya_c* i_this) {
    return i_this->draw();
}

int daObj_Suisya_c::execute() {
    Z2GetAudioMgr()->seStartLevel(Z2SE_OBJ_WATERMILL_ROUND, &current.pos, 0, 0, 1.0f, 1.0f,
                                         -1.0f, -1.0f, 0);
    shape_angle.x += 25;

    mDoMtx_stack_c::transS(current.pos);
    mDoMtx_stack_c::ZXYrotM(shape_angle);
    mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
    return 1;
}

static int daObj_Suisya_Execute(daObj_Suisya_c* i_this) {
    return i_this->execute();
}

static int daObj_Suisya_IsDelete(daObj_Suisya_c* i_this) {
    return 1;
}

int daObj_Suisya_c::_delete() {
    dComIfG_resDelete(&mPhase, "Obj_sui");
    return 1;
}

static int daObj_Suisya_Delete(daObj_Suisya_c* i_this) {
    return i_this->_delete();
}

int daObj_Suisya_c::CreateHeap() {
    J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Obj_sui", 3);
    mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
    if (mpModel == NULL) {
        return 0;
    }

    return 1;
}

static int useHeapInit(fopAc_ac_c* i_this) {
    return static_cast<daObj_Suisya_c*>(i_this)->CreateHeap();
}

int daObj_Suisya_c::create() {
    fopAcM_ct(this, daObj_Suisya_c);

    int phase = dComIfG_resLoad(&mPhase, "Obj_sui");
    if (phase == cPhs_COMPLEATE_e) {
        if (!fopAcM_entrySolidHeap(this, useHeapInit, 0x800)) {
            return cPhs_ERROR_e;
        }

        attention_info.flags = 0;
        cullMtx = mpModel->getBaseTRMtx();
        fopAcM_SetMin(this, -200.0f, -500.0f, -500.0f);
        fopAcM_SetMax(this, 200.0f, 500.0, 500.0f);

        mAcch.Set(&current.pos, &old.pos, this, 1, &mAcchCir, &speed, NULL, NULL);
        mAcchCir.SetWall(0.0f, 0.0f);
        health = 60;
        field_0x560 = 60;

        daObj_Suisya_Execute(this);
    }

    return phase;
}

static int daObj_Suisya_Create(daObj_Suisya_c* i_this) {
    return i_this->create();
}

static actor_method_class l_daObj_Suisya_Method = {
    (process_method_func)daObj_Suisya_Create,  (process_method_func)daObj_Suisya_Delete,
    (process_method_func)daObj_Suisya_Execute, (process_method_func)daObj_Suisya_IsDelete,
    (process_method_func)daObj_Suisya_Draw,
};

actor_process_profile_definition g_profile_OBJ_SUISYA = {
    /* Layer ID     */ fpcLy_CURRENT_e,
    /* List ID      */ 7,
    /* List Prio    */ fpcPi_CURRENT_e,
    /* Proc Name    */ fpcNm_OBJ_SUISYA_e,
    /* Proc SubMtd  */ &g_fpcLf_Method.base,
    /* Size         */ sizeof(daObj_Suisya_c),
    /* Size Other   */ 0,
    /* Parameters   */ 0,
    /* Leaf SubMtd  */ &g_fopAc_Method.base,
    /* Draw Prio    */ fpcDwPi_OBJ_SUISYA_e,
    /* Actor SubMtd */ &l_daObj_Suisya_Method,
    /* Status       */ fopAcStts_UNK_0x40000_e | fopAcStts_CULL_e,
    /* Group        */ fopAc_ACTOR_e,
    /* Cull Type    */ fopAc_CULLBOX_CUSTOM_e,
};