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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/**
* d_a_obj_crystal.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_crystal.h"
#include "d/d_com_inf_game.h"
#include "f_pc/f_pc_name.h"
#include <cstring>
static int CheckCreateHeap(fopAc_ac_c* i_this) {
return static_cast<daObjCrystal_c*>(i_this)->CreateHeap();
}
void daObjCrystal_c::initBaseMtx() {
mpModel[0]->setBaseScale(scale);
mpModel[1]->setBaseScale(scale);
setBaseMtx();
}
void daObjCrystal_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::ZXYrotM(shape_angle);
mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::get());
mpModel[1]->setBaseTRMtx(mDoMtx_stack_c::get());
}
static char* l_arcName = "H_Suisho";
int daObjCrystal_c::Create() {
initBaseMtx();
fopAcM_SetMtx(this, mpModel[0]->getBaseTRMtx());
mpEmitter = dComIfGp_particle_set(0x8BED, ¤t.pos, &home.angle, &scale, 255, NULL, -1,
NULL, NULL, NULL);
mJointID = 0xFFFF;
JUTNameTab* joint_name = mpModel[0]->getModelData()->getJointTree().getJointName();
for (u16 i = 0; i < mpModel[0]->getModelData()->getJointNum(); i++) {
if (strcmp(joint_name->getName(i), "polySurface1") == 0) {
mJointID = i;
}
}
mpModel[0]->calc();
if (mpEmitter != NULL) {
mpEmitter->setGlobalRTMatrix(mpModel[0]->getAnmMtx(mJointID));
}
return 1;
}
int daObjCrystal_c::CreateHeap() {
static int const l_bmd[] = {4, 7};
static u32 const l_diff_flag[] = {0, 0x80000};
static u32 const l_flag[] = {0x19000084, 0x11000084};
for (int i = 0; i < 2; i++) {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, l_bmd[i]);
mpModel[i] = mDoExt_J3DModel__create(modelData, l_diff_flag[i], l_flag[i]);
if (mpModel[i] == NULL) {
return 0;
}
}
return 1;
}
int daObjCrystal_c::create() {
fopAcM_ct(this, daObjCrystal_c);
int phase = dComIfG_resLoad(&mPhase, l_arcName);
if (phase == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x4000)) {
return cPhs_ERROR_e;
}
if (!Create()) {
return cPhs_ERROR_e;
}
}
return phase;
}
int daObjCrystal_c::execute() {
setBaseMtx();
return 1;
}
int daObjCrystal_c::draw() {
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
for (int i = 0; i < 2; i++) {
g_env_light.setLightTevColorType_MAJI(mpModel[i], &tevStr);
mDoExt_modelUpdateDL(mpModel[i]);
}
return 1;
}
int daObjCrystal_c::_delete() {
if (mpEmitter != NULL) {
mpEmitter->becomeInvalidEmitter();
mpEmitter->quitImmortalEmitter();
mpEmitter = NULL;
}
dComIfG_resDelete(&mPhase, l_arcName);
return 1;
}
static int daObjCrystal_Draw(daObjCrystal_c* i_this) {
return i_this->draw();
}
static int daObjCrystal_Execute(daObjCrystal_c* i_this) {
return i_this->execute();
}
static int daObjCrystal_Delete(daObjCrystal_c* i_this) {
return i_this->_delete();
}
static int daObjCrystal_Create(daObjCrystal_c* i_this) {
return i_this->create();
}
static actor_method_class l_daObjCrystal_Method = {
(process_method_func)daObjCrystal_Create, (process_method_func)daObjCrystal_Delete,
(process_method_func)daObjCrystal_Execute, (process_method_func)NULL,
(process_method_func)daObjCrystal_Draw,
};
actor_process_profile_definition g_profile_Obj_Crystal = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 7,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Crystal_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daObjCrystal_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Crystal_e,
/* Actor SubMtd */ &l_daObjCrystal_Method,
/* Status */ fopAcStts_UNK_0x40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|