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
|
/**
* d_a_esa.cpp
* Item - All-Purpose Bait
*/
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/actor/d_a_esa.h"
#include "d/actor/d_a_player.h"
#include "d/actor/d_a_sea.h"
#include "d/d_bg_s_gnd_chk.h"
#include "d/d_bg_s_lin_chk.h"
#include "d/d_s_play.h"
#include "d/d_com_inf_game.h"
#include "d/d_bg_s_func.h"
#include "res/Object/Link.h"
#include "f_op/f_op_actor_mng.h"
/* 800E7E60-800E7EA8 .text daEsa_Draw__FP9esa_class */
static BOOL daEsa_Draw(esa_class* i_this) {
g_env_light.setLightTevColorType(i_this->mpModel, &i_this->tevStr);
mDoExt_modelUpdateDL(i_this->mpModel);
return true;
}
/* 800E7EA8-800E849C .text bg_check__FP9esa_class */
void bg_check(esa_class* i_this) {
dBgS_GndChk gndChk;
Vec temp;
temp.x = i_this->current.pos.x;
temp.y = i_this->current.pos.y;
temp.z = i_this->current.pos.z;
temp.y += 100.0f;
gndChk.SetPos(&temp);
i_this->mGroundHeight = dComIfG_Bgsp()->GroundCross(&gndChk) + 5.0f;
s8 state = 1;
if(daSea_ChkArea(i_this->current.pos.x, i_this->current.pos.z)) {
f32 wave = daSea_calcWave(i_this->current.pos.x, i_this->current.pos.z);
if(i_this->mGroundHeight <= wave) {
i_this->mGroundHeight = wave;
state = 2;
}
}
cXyz sp6C;
cXyz sp60;
cXyz sp54 = i_this->current.pos;
sp54.y += 100.0f;
f32 waterHeight = dBgS_GetWaterHeight(sp54);
if(waterHeight != -G_CM3D_F_INF && i_this->mGroundHeight <= waterHeight) {
i_this->mGroundHeight = waterHeight;
state = 2;
}
if(i_this->speed.y <= 0.0f && i_this->current.pos.y <= i_this->mGroundHeight) {
i_this->current.pos.y = i_this->mGroundHeight;
i_this->mState = state;
}
else {
i_this->mState = 0;
}
dBgS_LinChk linChk;
cXyz sp48 = i_this->old.pos + (i_this->current.pos - i_this->old.pos) * 1.5f;
sp48.y = i_this->old.pos.y;
cXyz temp5 = i_this->old.pos - sp48;
if(temp5.abs() > 1.0f) {
linChk.Set(&i_this->old.pos, &sp48, i_this);
if(dComIfG_Bgsp()->LineCross(&linChk)) {
i_this->current.pos.x = i_this->old.pos.x;
i_this->current.pos.z = i_this->old.pos.z;
i_this->speedF *= 0.5f;
i_this->current.angle.y -= 0x8000;
sp6C.x = 0.0f;
sp6C.y = 0.0f;
sp6C.z = i_this->speedF;
cMtx_YrotS(*calc_mtx, i_this->current.angle.y);
MtxPosition(&sp6C, &sp60);
i_this->speed.x = sp60.x;
i_this->speed.z = sp60.z;
}
}
else {
fopAcM_OffStatus(i_this, fopAcStts_UNK4000_e);
}
}
/* 800E849C-800E88F8 .text esa_1_move__FP9esa_class */
void esa_1_move(esa_class* i_this) {
cXyz sp24;
switch(i_this->mActionState) {
case 0:
i_this->current.angle.y += (s16)cM_rndFX(4000.0f);
i_this->current.angle.z = cM_rndFX(0x8000);
sp24.x = 0.0f;
sp24.y = cM_rndF(8.0f) + 15.0f;
sp24.z = cM_rndF(5.0f) + 10.0f;
i_this->speedF = sp24.z;
cMtx_YrotS(*calc_mtx, i_this->current.angle.y);
MtxPosition(&sp24, &i_this->speed);
i_this->mActionState = 1;
case 1:
if(i_this->mState != 0) {
if(i_this->mState == 2) {
i_this->mTimer[0] = cM_rndF(50.0f) + 200.0f;
i_this->mActionState = 3;
if(i_this->field_0x2A4.getEmitter() == NULL) {
static cXyz ripple_scale(0.2f, 0.2f, 0.2f);
dComIfGp_particle_setShipTail(dPa_name::ID_AK_JN_HAMON00, &i_this->current.pos, 0, &ripple_scale, 0xFF, &i_this->field_0x2A4);
if(i_this->field_0x2A4.getEmitter()) {
i_this->field_0x2A4.setRate(0.4f);
}
}
}
else {
if(i_this->speed.y < 5.0f) {
i_this->speed.y *= -(cM_rndF(0.05f) + 0.15f);
i_this->current.angle.z = cM_rndFX(0x8000);
}
i_this->current.angle.y += (s16)cM_rndFX(8000.0f);
i_this->speedF *= cM_rndF(0.3f) + 0.3f;
sp24.x = 0.0f;
sp24.y = 0.0f;
sp24.z = i_this->speedF;
cMtx_YrotS(*calc_mtx, i_this->current.angle.y);
cXyz sp18;
MtxPosition(&sp24, &sp18);
i_this->speed.x = sp18.x;
i_this->speed.z = sp18.z;
if(i_this->speedF < 0.1f) {
i_this->mActionState = 2;
i_this->mTimer[0] = cM_rndF(50.0f) + 200.0f;
break;
}
}
}
i_this->current.pos.x += i_this->speed.x;
i_this->current.pos.y += i_this->speed.y;
i_this->current.pos.z += i_this->speed.z;
i_this->speed.y -= 3.0f;
bg_check(i_this);
break;
case 2:
if(i_this->mTimer[0] == 0) {
fopAcM_delete(i_this);
}
break;
case 3:
if(dComIfGp_evmng_startCheck("SO_ESA_XY")) {
i_this->mTimer[0] = 10000;
}
i_this->field_0x2A4.remove();
i_this->current.pos.y = daSea_calcWave(i_this->current.pos.x, i_this->current.pos.z);
if(i_this->mTimer[0] == 0) {
i_this->mTimer[0] = 10;
i_this->mActionState = 4;
}
if(i_this->field_0x298) {
i_this->mTimer[0] = 10;
i_this->mActionState = 4;
if(i_this->field_0x2A4.getEmitter() == NULL) {
static cXyz ripple_scale(0.2f, 0.2f, 0.2f);
dComIfGp_particle_setShipTail(dPa_name::ID_AK_JN_HAMON00, &i_this->current.pos, 0, &ripple_scale, 0xFF, &i_this->field_0x2A4);
if(i_this->field_0x2A4.getEmitter()) {
i_this->field_0x2A4.setRate(0.4f);
}
}
}
break;
case 4:
if(i_this->mTimer[0] == 0) {
fopAcM_delete(i_this);
}
break;
}
}
/* 800E88F8-800E89B8 .text daEsa_Execute__FP9esa_class */
static BOOL daEsa_Execute(esa_class* i_this) {
for(int i = 0; i < 2; i++) {
if(i_this->mTimer[i] != 0) {
i_this->mTimer[i]--;
}
}
esa_1_move(i_this);
MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false);
cMtx_YrotM(*calc_mtx, i_this->current.angle.y);
cMtx_XrotM(*calc_mtx, i_this->current.angle.x);
cMtx_ZrotM(*calc_mtx, i_this->current.angle.z);
i_this->mpModel->setBaseTRMtx(*calc_mtx);
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr);
return true;
}
/* 800E89B8-800E89C0 .text daEsa_IsDelete__FP9esa_class */
static BOOL daEsa_IsDelete(esa_class* i_this) {
return true;
}
/* 800E89C0-800E89E8 .text daEsa_Delete__FP9esa_class */
static BOOL daEsa_Delete(esa_class* i_this) {
i_this->field_0x2A4.remove();
return true;
}
/* 800E89E8-800E8AB0 .text daEsa_CreateHeap__FP10fopAc_ac_c */
static BOOL daEsa_CreateHeap(fopAc_ac_c* i_actor) {
esa_class* i_this = static_cast<esa_class*>(i_actor);
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes("Link", dRes_INDEX_LINK_BDL_ESA_e));
JUT_ASSERT(0x1E8, modelData != NULL);
i_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022);
if(i_this->mpModel == NULL) {
return false;
}
return true;
}
/* 800E8AB0-800E8CA4 .text daEsa_Create__FP10fopAc_ac_c */
static cPhs_State daEsa_Create(fopAc_ac_c* i_actor) {
daPy_py_c* player = daPy_getPlayerActorClass();
fopAcM_ct(i_actor, esa_class);
esa_class* i_this = static_cast<esa_class*>(i_actor);
i_this->field_0x2B9 = fopAcM_GetParam(i_this) & 0xFF;
i_this->field_0x2BA = fopAcM_GetParam(i_this) >> 8 & 0xFF;
if(REG0_S(0) != 0) {
i_this->field_0x2BA = 1;
}
if(!fopAcM_entrySolidHeap(i_this, daEsa_CreateHeap, 0x4C0)) {
return cPhs_ERROR_e;
}
if(i_this->field_0x2BA == 0) {
s8 num = i_this->field_0x2B9;
if(num > 0) {
for(int i = 0; i < num; i++) {
fopAcM_prm_class* params = fopAcM_CreateAppend();
cXyz pos = player->getLeftHandPos();
params->base.position = pos;
params->base.angle.x = 0;
params->base.angle.y = i_this->current.angle.y;
params->base.angle.z = cM_rndF(0x10000);
params->base.parameters = 0x000000FF;
fpcM_Create(fpcNm_ESA_e, 0, params);
}
}
}
f32 f2 = REG0_F(5) + 1.0f;
f32 temp = REG0_F(6) + 0.65f;
f32 scaleF = temp + cM_rndF(f2 - temp);
cXyz scale(scaleF, scaleF, scaleF);
i_this->mpModel->setBaseScale(scale);
fopAcM_SetMtx(i_this, i_this->mpModel->getBaseTRMtx());
return cPhs_COMPLEATE_e;
}
static actor_method_class l_daEsa_Method = {
(process_method_func)daEsa_Create,
(process_method_func)daEsa_Delete,
(process_method_func)daEsa_Execute,
(process_method_func)daEsa_IsDelete,
(process_method_func)daEsa_Draw,
};
actor_process_profile_definition g_profile_ESA = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0007,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_ESA_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(esa_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_ESA_e,
/* Actor SubMtd */ &l_daEsa_Method,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_0_e,
};
|