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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
/**
* d_a_obj_auzu.cpp
* Object - Big Octo/Jabun's cave whirlpool
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_auzu.h"
#include "d/actor/d_a_kytag01.h"
#include "d/actor/d_a_player_main.h"
#include "d/actor/d_a_ship.h"
#include "res/Object/Auzu.h"
namespace daObjAuzu {
namespace {
f32 L_radius = 2500.0f;
};
const char Act_c::M_arcname[] = "Auzu";
const Attr_c Act_c::M_attr[2] = {
{
/* mRadiusMult */ 1.5f,
/* mOuterActivationMult */ 1.5f,
/* mInnerActivationMult */ 1.3f,
/* mAnmSpeed */ 0.5f
},
{
/* mRadiusMult */ 2.0f,
/* mOuterActivationMult */ 2.0f,
/* mInnerActivationMult */ 2.0f,
/* mAnmSpeed */ 1.0f
}
};
};
/* 00000078-0000009C .text solidHeapCB__Q29daObjAuzu5Act_cFP10fopAc_ac_c */
BOOL daObjAuzu::Act_c::solidHeapCB(fopAc_ac_c* i_this) {
return ((Act_c*)i_this)->create_heap();
}
/* 0000009C-000001F8 .text create_heap__Q29daObjAuzu5Act_cFv */
bool daObjAuzu::Act_c::create_heap() {
bool create_result = false;
J3DModelData* mdl_data = static_cast<J3DModelData *>(dComIfG_getObjectRes(M_arcname, dRes_INDEX_AUZU_BDL_AUZU_e));
JUT_ASSERT(226, mdl_data != NULL);
mpModel = mDoExt_J3DModel__create(mdl_data, 0x80000, 0x11000222);
J3DAnmTextureSRTKey* btk_data = static_cast<J3DAnmTextureSRTKey *>(dComIfG_getObjectRes(M_arcname, dRes_INDEX_AUZU_BTK_AUZU_e));
JUT_ASSERT(236, btk_data != NULL);
int init_result = mBtkAnm.init(
mdl_data, btk_data, TRUE,
J3DFrameCtrl::EMode_LOOP, attr().mAnmSpeed,
0, -1, false, FALSE
);
if (mpModel && init_result != 0) {
create_result = true;
}
return create_result;
}
/* 000001F8-000003B8 .text _create__Q29daObjAuzu5Act_cFv */
cPhs_State daObjAuzu::Act_c::_create() {
cPhs_State state = cPhs_ERROR_e;
mType = prm_get_type();
fopAcM_ct(this, daObjAuzu::Act_c);
mbIsExist = is_exist();
if (mbIsExist != 0) {
state = dComIfG_resLoad(&mPhs, M_arcname);
if (state == cPhs_COMPLEATE_e) {
if (fopAcM_entrySolidHeap(this, solidHeapCB, 3456)) {
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
init_mtx();
f32 cull_xz = attr().mRadiusMult * 3000.0f;
fopAcM_setCullSizeBox(this,
-cull_xz, -30.0f, -cull_xz,
cull_xz, 30.0f, cull_xz
);
mbToAppear = false;
if (prm_get_appear() == 1) {
mScaleAnimFactor = 0.0f;
} else {
if (fopAcM_isSwitch(this, prm_get_swSave())) {
mScaleAnimFactor = 0.0f;
} else {
mScaleAnimFactor = 1.0f;
}
}
mbBgmStarted = false;
mKytagPcId = fpcM_ERROR_PROCESS_ID_e;
set_state_map();
} else {
state = cPhs_ERROR_e;
}
}
}
return state;
}
/* 0000045C-00000498 .text _delete__Q29daObjAuzu5Act_cFv */
bool daObjAuzu::Act_c::_delete() {
if (mbIsExist != 0) {
dComIfG_resDeleteDemo(&mPhs, M_arcname);
}
return true;
}
/* 00000498-000004E8 .text is_exist__Q29daObjAuzu5Act_cCFv */
bool daObjAuzu::Act_c::is_exist() const {
if (mType == 0) {
return dComIfGs_isEventBit(dSv_event_flag_c::ENDLESS_NIGHT);
}
return true;
}
/* 000004E8-00000554 .text set_mtx__Q29daObjAuzu5Act_cFv */
void daObjAuzu::Act_c::set_mtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::ZXYrotM(shape_angle);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
/* 00000554-000005B8 .text init_mtx__Q29daObjAuzu5Act_cFv */
void daObjAuzu::Act_c::init_mtx() {
mpModel->setBaseScale(
cXyz(
scale.x * attr().mRadiusMult,
scale.y,
scale.z * attr().mRadiusMult
)
);
set_mtx();
}
/* 000005B8-00000624 .text set_state_map__Q29daObjAuzu5Act_cFv */
void daObjAuzu::Act_c::set_state_map() {
if (prm_get_appear() != 1) {
if (is_appear()) {
fopAcM_OnStatus(this, fopAcStts_SHOWMAP_e);
} else {
fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e);
}
}
}
/* 00000624-00000788 .text ship_whirl__Q29daObjAuzu5Act_cFv */
void daObjAuzu::Act_c::ship_whirl() {
daShip_c* ship_p = dComIfGp_getShipActor();
if (ship_p && fopAcM_GetName(ship_p) == fpcNm_SHIP_e) {
f32 sqr_mag_xz = fopAcM_searchActorDistanceXZ2(this, ship_p);
#if VERSION > VERSION_DEMO
f32 inner_activation = SQUARE(daObjAuzu::L_radius * attr().mInnerActivationMult);
f32 outer_activation = SQUARE(daObjAuzu::L_radius * attr().mOuterActivationMult);
#else
f32 outer_activation = SQUARE(daObjAuzu::L_radius * attr().mOuterActivationMult);
f32 inner_activation = SQUARE(daObjAuzu::L_radius * attr().mInnerActivationMult);
#endif
if (sqr_mag_xz < outer_activation) {
if (mScaleAnimFactor > 0.01f) {
bgm_start();
if (sqr_mag_xz < inner_activation) {
ship_p->onWhirlFlg(fopAcM_GetID(this), prm_get_linkID());
} else {
ship_p->onWhirlFlgDirect(fopAcM_GetID(this), prm_get_linkID());
}
} else {
ship_p->offWhirlFlg();
}
}
}
}
/* 00000788-000007DC .text bgm_start__Q29daObjAuzu5Act_cFv */
void daObjAuzu::Act_c::bgm_start() {
if (mType == 0 && !mbBgmStarted) {
mbBgmStarted = true;
mDoAud_subBgmStart(JA_BGM_DIOCTA_BATTLE);
}
}
/* 000007DC-00000AF8 .text _execute__Q29daObjAuzu5Act_cFv */
bool daObjAuzu::Act_c::_execute() {
#if VERSION > VERSION_JPN
set_mtx();
#endif
if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e)) {
ship_whirl();
} else {
if (DEMO_SELECT(true, mScaleAnimFactor > 0.01f)) {
daPy_lk_c* link_p = daPy_getPlayerLinkActorClass();
fopAcM_searchActorDistanceXZ2(this, daPy_getPlayerLinkActorClass());
if (
fopAcM_searchActorDistanceXZ2(this, link_p) < SQUARE(daObjAuzu::L_radius * attr().mOuterActivationMult)
) {
link_p->setWhirlId(fopAcM_GetID(this));
}
}
}
mBtkAnm.play();
f32 scale_target;
if (prm_get_appear() == 1) {
if (mbToAppear) {
scale_target = 1.0f;
} else {
scale_target = 0.0f;
}
} else {
if (fopAcM_isSwitch(this, prm_get_swSave())) {
scale_target = 0.0f;
} else {
scale_target = 1.0f;
}
}
cLib_chaseF(&mScaleAnimFactor, scale_target, 0.02f);
s8 param = s8(100.0f * mScaleAnimFactor);
fopAcM_seStart(this, JA_SE_ATM_SWIRL, param);
if (mScaleAnimFactor > 0.0f && fpcM_IsErrorID(mKytagPcId)) {
cXyz scaleXZ;
scaleXZ.x = (mScaleAnimFactor * (daObjAuzu::L_radius * attr().mRadiusMult)) / 5000.0f;
scaleXZ.z = (mScaleAnimFactor * ((daObjAuzu::L_radius + 500.0f) * attr().mRadiusMult)) / 5000.0f;
mKytagPcId = fopAcM_create(
fpcNm_KYTAG01_e, -1, ¤t.pos,
tevStr.mRoomNo, ¤t.angle, &scaleXZ
);
} else if (mScaleAnimFactor > 0.0f && fpcM_IsErrorID(mKytagPcId) == FALSE) {
kytag01_class* kytag01_p = (kytag01_class *) fopAcM_SearchByID(mKytagPcId);
if (kytag01_p){
kytag01_p->mWaveInfo.mInnerRadius = mScaleAnimFactor * (daObjAuzu::L_radius * attr().mRadiusMult);
kytag01_p->mWaveInfo.mOuterRadius = mScaleAnimFactor * ((daObjAuzu::L_radius + 500.0f) * attr().mRadiusMult);
}
} else if (mScaleAnimFactor == 0.0f && fpcM_IsErrorID(mKytagPcId) == FALSE) {
kytag01_class* kytag01_p = (kytag01_class *) fopAcM_SearchByID(mKytagPcId);
if (kytag01_p){
fopAcM_delete(&kytag01_p->actor);
}
}
set_state_map();
return true;
}
/* 00000AF8-00000B88 .text set_material__Q29daObjAuzu5Act_cFP11J3DMaterialUc */
void daObjAuzu::Act_c::set_material(J3DMaterial* i_materialP, u8 i_alphaVal) {
while (i_materialP != NULL) {
if (i_alphaVal == 0) {
i_materialP->getShape()->hide();
} else {
i_materialP->getShape()->show();
i_materialP->getTevKColor(3)->mColor.a = i_alphaVal;
}
i_materialP = i_materialP->getNext();
}
}
/* 00000B88-00000C38 .text _draw__Q29daObjAuzu5Act_cFv */
bool daObjAuzu::Act_c::_draw() {
g_env_light.settingTevStruct(TEV_TYPE_BG1, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType(mpModel, &tevStr);
mBtkAnm.entry(mpModel->getModelData());
J3DModelData* model_data_p = mpModel->getModelData();
u8 alpha = u8(mScaleAnimFactor * 255.5f) & 0xFF;
set_material(
model_data_p->getJointNodePointer(AUZU_JNT_AUZU_e)->getMesh(),
alpha
);
mDoExt_modelUpdateDL(mpModel);
return true;
}
namespace daObjAuzu {
namespace {
/* 00000C38-00000C58 .text Mthd_Create__Q29daObjAuzu26@unnamed@d_a_obj_auzu_cpp@FPv */
cPhs_State Mthd_Create(void* i_this) {
return ((daObjAuzu::Act_c*)i_this)->_create();
}
/* 00000C58-00000C7C .text Mthd_Delete__Q29daObjAuzu26@unnamed@d_a_obj_auzu_cpp@FPv */
BOOL Mthd_Delete(void* i_this) {
return ((daObjAuzu::Act_c*)i_this)->_delete();
}
/* 00000C7C-00000CA0 .text Mthd_Execute__Q29daObjAuzu26@unnamed@d_a_obj_auzu_cpp@FPv */
BOOL Mthd_Execute(void* i_this) {
return ((daObjAuzu::Act_c*)i_this)->_execute();
}
/* 00000CA0-00000CC4 .text Mthd_Draw__Q29daObjAuzu26@unnamed@d_a_obj_auzu_cpp@FPv */
BOOL Mthd_Draw(void* i_this) {
return ((daObjAuzu::Act_c*)i_this)->_draw();
}
/* 00000CC4-00000CCC .text Mthd_IsDelete__Q29daObjAuzu26@unnamed@d_a_obj_auzu_cpp@FPv */
BOOL Mthd_IsDelete(void*) {
return TRUE;
}
static actor_method_class Mthd_Table = {
(process_method_func)Mthd_Create,
(process_method_func)Mthd_Delete,
(process_method_func)Mthd_Execute,
(process_method_func)Mthd_IsDelete,
(process_method_func)Mthd_Draw,
};
}; // namespace
}; // namespace daObjAuzu
actor_process_profile_definition g_profile_Obj_Auzu = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0007,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Auzu_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daObjAuzu::Act_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Auzu_e,
/* Actor SubMtd */ &daObjAuzu::Mthd_Table,
/* Status */ 0x06 | fopAcStts_CULL_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|