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
|
/**
* d_a_obj_web0.cpp
* Spider Web (Wall)
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_web0.h"
#include "SSystem/SComponent/c_math.h"
#include "d/actor/d_a_player.h"
#include "d/d_bg_w.h"
#include "d/d_s_play.h"
#include "f_op/f_op_actor_mng.h"
#include "global.h"
/* 80D3452C-80D34544 0000EC 0018+00 1/1 0/0 0/0 .text __ct__16daObj_Web0_HIO_cFv */
daObj_Web0_HIO_c::daObj_Web0_HIO_c() {
field_0x4 = -1;
}
/* 80D34544-80D345C0 000104 007C+00 1/0 0/0 0/0 .text daObj_Web0_Draw__FP14obj_web0_class
*/
static int daObj_Web0_Draw(obj_web0_class* i_this) {
g_env_light.settingTevStruct(16, &i_this->current.pos, &i_this->tevStr);
g_env_light.setLightTevColorType_MAJI(i_this->mpModel, &i_this->tevStr);
i_this->mpBrk->entry(i_this->mpModel->getModelData());
mDoExt_modelUpdateDL(i_this->mpModel);
return 1;
}
/* 80D345C0-80D34794 000180 01D4+00 1/1 0/0 0/0 .text damage_check__FP14obj_web0_class */
static void damage_check(obj_web0_class* i_this) {
i_this->mStts.Move();
if (i_this->mHitTimer != 0) {
return;
}
if (i_this->mSphCc.ChkTgHit()) {
i_this->mHitTimer = 6;
if (i_this->mSphCc.GetTgHitObj()->ChkAtType(AT_TYPE_IRON_BALL)) {
i_this->mDeleteTimer = 41;
return;
}
if (i_this->mSphCc.GetTgHitObj()->ChkAtType(AT_TYPE_LANTERN_SWING) &&
i_this->mSphCc.GetTgHitGObj()->GetAtMtrl() != dCcD_MTRL_FIRE) {
return;
}
if (i_this->mSphCc.GetTgHitObj()->ChkAtType(AT_TYPE_BOMB) ||
i_this->mSphCc.GetTgHitGObj()->GetAtMtrl() == dCcD_MTRL_FIRE) {
i_this->mDeleteTimer = 1;
return;
}
i_this->mReboundTimer = 20;
fopAcM_seStart(i_this, Z2SE_OBJ_WEB_BOUND_L, 0);
}
if (i_this->mSphCc.ChkCoHit()) {
i_this->mReboundTimer = 10;
}
if (daPy_getPlayerActorClass()->checkFrontRollCrash() &&
fopAcM_searchPlayerDistanceXZ(i_this) < i_this->scale.x * 260.0f) {
i_this->mReboundTimer = 20;
fopAcM_seStart(i_this, Z2SE_OBJ_WEB_BOUND_L, 0);
}
}
/* 80D34794-80D34B24 000354 0390+00 2/1 0/0 0/0 .text daObj_Web0_Execute__FP14obj_web0_class */
static int daObj_Web0_Execute(obj_web0_class* i_this) {
fopAc_ac_c* base_p = i_this;
fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0);
i_this->field_0x57c++;
for (int i = 0; i < 2; i++) {
if (i_this->field_0x584[i] != 0) {
i_this->field_0x584[i]--;
}
}
if (i_this->mHitTimer != 0) {
i_this->mHitTimer--;
}
if (i_this->mDeleteTimer != 0) {
if (i_this->mDeleteTimer == 1) {
cXyz sp20(base_p->scale);
sp20.z = 1.0f;
dComIfGp_particle_set(0x840C, &base_p->current.pos, &base_p->shape_angle, &sp20);
i_this->mpBrk->setPlaySpeed(1.0f);
} else if (i_this->mDeleteTimer == 41) {
i_this->mpBrk->setPlaySpeed(1.0f);
}
fopAcM_seStartLevel(base_p, Z2SE_OBJ_WEB_BURN, 0);
if (i_this->mDeleteTimer == 40 || i_this->mDeleteTimer == 80) {
u32 sp0C = (fopAcM_GetParam(base_p) & 0xff000000) >> 24;
dComIfGs_onSwitch(sp0C, fopAcM_GetRoomNo(base_p));
fopAcM_delete(base_p);
}
i_this->mDeleteTimer++;
} else {
damage_check(i_this);
}
mDoMtx_stack_c::transS(base_p->current.pos.x, base_p->current.pos.y, base_p->current.pos.z);
mDoMtx_stack_c::YrotM((s16)base_p->shape_angle.y);
mDoMtx_stack_c::ZrotM((s16)base_p->shape_angle.z);
mDoMtx_stack_c::scaleM(base_p->scale.x, base_p->scale.y, base_p->scale.z);
i_this->mpBrk->play();
i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
if (i_this->mReboundTimer != 0) {
i_this->mReboundTimer--;
}
base_p->scale.z =
i_this->mReboundTimer * cM_ssin(i_this->mReboundTimer * 0x1900) * (0.075f + TREG_F(0));
s16 var_r28 = fopAcM_searchPlayerAngleY(base_p);
s16 sp08 = (var_r28 + 0x4000) - base_p->shape_angle.y;
if (sp08 < 0) {
mDoMtx_stack_c::YrotM(-0x8000);
}
MTXCopy(mDoMtx_stack_c::get(), i_this->mMtx);
i_this->mpBgW->Move();
cXyz sp14(base_p->current.pos);
if (i_this->field_0x57c & 1) {
sp14.y -= base_p->scale.x * 70.0f;
}
var_r28 = base_p->shape_angle.y;
if (sp08 < 0) {
var_r28 += (s16) -0x8000;
}
var_r28 -= player->shape_angle.y;
if ((var_r28 < 20000 && var_r28 > -20000) || i_this->mHitTimer != 0) {
sp14.x += 20000.0f;
}
i_this->mSphCc.SetC(sp14);
i_this->mSphCc.SetR((150.0f + TREG_F(2)) * base_p->scale.x);
dComIfG_Ccsp()->Set(&i_this->mSphCc);
return 1;
}
/* 80D34B24-80D34B2C 0006E4 0008+00 1/0 0/0 0/0 .text daObj_Web0_IsDelete__FP14obj_web0_class */
static int daObj_Web0_IsDelete(obj_web0_class* i_this) {
return 1;
}
/* 80D35290-80D35294 000008 0004+00 2/2 0/0 0/0 .bss None */
static u8 data_80D35290;
/* 80D34B2C-80D34B94 0006EC 0068+00 1/0 0/0 0/0 .text daObj_Web0_Delete__FP14obj_web0_class */
static int daObj_Web0_Delete(obj_web0_class* i_this) {
dComIfG_resDelete(&i_this->mPhase, "Obj_web0");
if (i_this->field_0x739) {
data_80D35290 = 0;
}
dComIfG_Bgsp().Release(i_this->mpBgW);
return 1;
}
/* 80D34B94-80D34D44 000754 01B0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */
static int useHeapInit(fopAc_ac_c* i_this) {
obj_web0_class* _this = static_cast<obj_web0_class*>(i_this);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Obj_web0", 5);
_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (_this->mpModel == NULL) {
return 0;
}
_this->mpBrk = new mDoExt_brkAnm();
if (_this->mpBrk == NULL) {
return 0;
}
J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Obj_web0", 8);
if (!_this->mpBrk->init(_this->mpModel->getModelData(), brk, TRUE, 0, 1.0f, 0,
-1)) {
return 0;
}
_this->mpBrk->setPlaySpeed(0.0f);
_this->mpBgW = new dBgW();
if (_this->mpBgW == NULL) {
return 0;
}
cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes("Obj_web0", 11);
if (_this->mpBgW->Set(dzb, 1, &_this->mMtx) == 1) {
return 0;
}
_this->mpBgW->SetCrrFunc(dBgS_MoveBGProc_Typical);
return 1;
}
/* 80D352A0-80D352A8 000018 0008+00 2/2 0/0 0/0 .bss l_HIO */
static daObj_Web0_HIO_c l_HIO;
/* 80D34D8C-80D35054 00094C 02C8+00 1/0 0/0 0/0 .text daObj_Web0_Create__FP10fopAc_ac_c
*/
static int daObj_Web0_Create(fopAc_ac_c* i_this) {
fopAcM_ct(i_this, obj_web0_class);
obj_web0_class* _this = static_cast<obj_web0_class*>(i_this);
static dCcD_SrcSph cc_sph_src = {
{
{0, {{0, 0, 0}, {0xD8FBFFFF, 3}, 0}},
{dCcD_SE_NONE, 0, 0, 0, {0}},
{dCcD_SE_HARD_BODY, 0, 0, 0, {3}},
{0},
},
{
{
{0.0f, 0.0f, 0.0f},
40.0f,
},
}
};
int phase = dComIfG_resLoad(&_this->mPhase, "Obj_web0");
if (phase == cPhs_COMPLEATE_e) {
int switchNo = fopAcM_GetParam(_this) >> 0x18;
if (switchNo != 0xFF && dComIfGs_isSwitch(switchNo, fopAcM_GetRoomNo(_this))) {
return cPhs_ERROR_e;
}
_this->mPrm0 = fopAcM_GetParam(_this);
if (_this->mPrm0 == 0xFF) {
_this->mPrm0 = 0;
}
_this->mScaleXY = fopAcM_GetParam(_this) >> 8;
if (!fopAcM_entrySolidHeap(_this, (heapCallbackFunc)useHeapInit, 0xA20)) {
return cPhs_ERROR_e;
}
if (_this->mpBgW != NULL && dComIfG_Bgsp().Regist(_this->mpBgW, _this)) {
return cPhs_ERROR_e;
}
if (!data_80D35290) {
_this->field_0x739 = 1;
data_80D35290 = true;
l_HIO.field_0x4 = -1;
}
fopAcM_SetMtx(_this, _this->mpModel->getBaseTRMtx());
fopAcM_SetMin(_this, -1000.0f, -1000.0f, -1000.0f);
fopAcM_SetMax(_this, 1000.0f, 1000.0f, 1000.0f);
_this->health = 30;
_this->field_0x560 = 30;
_this->mStts.Init(250, 0, _this);
_this->mSphCc.Set(cc_sph_src);
_this->mSphCc.SetStts(&_this->mStts);
_this->mSphCc.OnTgNoHitMark();
if (_this->mScaleXY != 0xFF && _this->mScaleXY != 0) {
_this->scale.x = _this->mScaleXY;
_this->scale.y = _this->mScaleXY;
}
_this->eyePos = _this->current.pos;
daObj_Web0_Execute(_this);
}
return phase;
}
/* 80D35208-80D35228 -00001 0020+00 1/0 0/0 0/0 .data l_daObj_Web0_Method */
static actor_method_class l_daObj_Web0_Method = {
(process_method_func)daObj_Web0_Create, (process_method_func)daObj_Web0_Delete,
(process_method_func)daObj_Web0_Execute, (process_method_func)daObj_Web0_IsDelete,
(process_method_func)daObj_Web0_Draw,
};
/* 80D35228-80D35258 -00001 0030+00 0/0 0/0 1/0 .data g_profile_OBJ_WEB0 */
extern actor_process_profile_definition g_profile_OBJ_WEB0 = {
fpcLy_CURRENT_e,
3,
fpcPi_CURRENT_e,
PROC_OBJ_WEB0,
&g_fpcLf_Method.base,
sizeof(obj_web0_class),
0,
0,
&g_fopAc_Method.base,
47,
&l_daObj_Web0_Method,
0x40100,
fopAc_ACTOR_e,
fopAc_CULLBOX_CUSTOM_e,
};
|