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
|
/**
* d_a_swtact.cpp
* Object - Wind Crest (Wind's Requiem blue floor decoration)
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_swtact.h"
#include "res/Object/Itact.h"
#include "f_op/f_op_actor_mng.h"
#include "d/d_com_inf_game.h"
#include "d/actor/d_a_player.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_mtx.h"
#include "JSystem/JUtility/JUTAssert.h"
const char * daSwTact_c::m_arcname = "Itact";
const f32 daSwTact_c::mDefaultR = 50.0f;
const f32 daSwTact_c::mDefaultRwM = 100.0f;
const u32 daSwTact_c::m_heapsize = 0x3000;
/* 00000078-000000AC .text _delete__10daSwTact_cFv */
bool daSwTact_c::_delete() {
dComIfG_resDelete(&mPhs, m_arcname);
return true;
}
/* 000000AC-000000CC .text CheckCreateHeap__FP10fopAc_ac_c */
static BOOL CheckCreateHeap(fopAc_ac_c* i_ac) {
return ((daSwTact_c *)i_ac)->CreateHeap();
}
/* 000000CC-00000194 .text CreateHeap__10daSwTact_cFv */
BOOL daSwTact_c::CreateHeap() {
J3DModelData * modelData = (J3DModelData *)dComIfG_getObjectRes(m_arcname, dRes_INDEX_ITACT_BDL_ITACT_e);
JUT_ASSERT(0xe1, modelData != NULL);
model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022);
if (model == NULL)
return FALSE;
return TRUE;
}
/* 00000194-0000024C .text CreateInit__10daSwTact_cFv */
void daSwTact_c::CreateInit() {
static const f32 cull_size[] = {
-120.0f, -10.0f, -120.0f,
120.0f, 10.0f, 120.0f,
};
mSwitchNo = daSwTact_prm::getSwitchNo(this);
mAnswer = daSwTact_prm::getAnswer(this);
if (daSwTact_prm::getModel(this) == 1) {
fopAcM_SetMtx(this, model->getBaseTRMtx());
f32 scaleZ = scale.z;
f32 scaleX = scale.x;
fopAcM_setCullSizeBox(this, cull_size[0] * scaleX, cull_size[1], cull_size[2] * scaleZ, cull_size[3] * scaleX, cull_size[4], cull_size[5] * scaleZ);
mRadius = 100.0f;
} else {
mRadius = 50.0f;
}
}
/* 0000024C-000002CC .text set_mtx__10daSwTact_cFv */
void daSwTact_c::set_mtx() {
if (daSwTact_prm::getModel(this) == 1) {
model->setBaseScale(scale);
mDoMtx_stack_c::transS(current.pos);
model->setBaseTRMtx(mDoMtx_stack_c::get());
}
}
/* 000002CC-0000038C .text _create__10daSwTact_cFv */
cPhs_State daSwTact_c::_create() {
fopAcM_ct(this, daSwTact_c);
s32 result = cPhs_COMPLEATE_e;
if (daSwTact_prm::getModel(this) == 1) {
result = dComIfG_resLoad(&mPhs, m_arcname);
if (result == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, m_heapsize)) {
return cPhs_ERROR_e;
}
}
}
if (result == cPhs_COMPLEATE_e) {
CreateInit();
}
return result;
}
/* 0000038C-00000410 .text getAnswer__10daSwTact_cFv */
s32 daSwTact_c::getAnswer() {
switch (mAnswer) {
case 0:
return 0;
case 1:
return 1;
case 2:
return 5;
case 3:
return 2;
case 4:
return 3;
case 5:
return 4;
case 0xFF:
default:
return -1;
}
}
/* 00000410-000006AC .text _execute__10daSwTact_cFv */
bool daSwTact_c::_execute() {
daPy_py_c * player = daPy_getPlayerActorClass();
u32 stts1 = dComIfGp_checkPlayerStatus1(0, daPyStts1_WIND_WAKER_CONDUCT_e);
if (player == NULL || dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e))
return true;
f32 dist = (player->current.pos - current.pos).absXZ();
if (dist <= getR()) {
if (mPlayerStatus != stts1 && stts1 != 0) {
player->setTactZev(fopAcM_GetID(this), getAnswer(), NULL);
}
s32 tactMusic = player->getTactMusic();
switch (mAnswer) {
case 0:
if (tactMusic == 0)
mTrigger = true;
break;
case 1:
if (tactMusic == 1)
mTrigger = true;
break;
case 2:
if (tactMusic == 5)
mTrigger = true;
break;
case 3:
if (tactMusic == 2)
mTrigger = true;
break;
case 4:
if (tactMusic == 3)
mTrigger = true;
break;
case 5:
if (tactMusic == 4)
mTrigger = true;
break;
case 0xFF:
if (tactMusic == 0 || tactMusic == 1 || tactMusic == 2 || tactMusic == 3 || tactMusic == 4 || tactMusic == 5)
mTrigger = true;
break;
}
}
if (mTrigger != 0 && !dComIfGp_event_runCheck()) {
fopAcM_onSwitch(this, mSwitchNo);
mTrigger = 0;
}
mPlayerStatus = stts1;
set_mtx();
return true;
}
/* 000006AC-00000720 .text _draw__10daSwTact_cFv */
bool daSwTact_c::_draw() {
if (daSwTact_prm::getModel(this) == 0)
return TRUE;
g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType(model, &tevStr);
mDoExt_modelUpdateDL(model);
return TRUE;
}
/* 00000720-00000740 .text daSwTact_Create__FPv */
static cPhs_State daSwTact_Create(void* i_ac) {
return ((daSwTact_c *)i_ac)->_create();
}
/* 00000740-00000764 .text daSwTact_Delete__FPv */
static BOOL daSwTact_Delete(void* i_ac) {
return ((daSwTact_c*)i_ac)->_delete();
}
/* 00000764-00000788 .text daSwTact_Draw__FPv */
static BOOL daSwTact_Draw(void* i_ac) {
return ((daSwTact_c*)i_ac)->_draw();
}
/* 00000788-000007AC .text daSwTact_Execute__FPv */
static BOOL daSwTact_Execute(void* i_ac) {
return ((daSwTact_c*)i_ac)->_execute();
}
/* 000007AC-000007B4 .text daSwTact_IsDelete__FPv */
static BOOL daSwTact_IsDelete(void* i_ac) {
return TRUE;
}
static actor_method_class daSwTactMethodTable = {
(process_method_func)daSwTact_Create,
(process_method_func)daSwTact_Delete,
(process_method_func)daSwTact_Execute,
(process_method_func)daSwTact_IsDelete,
(process_method_func)daSwTact_Draw,
};
actor_process_profile_definition g_profile_SW_TACT = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0007,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_SW_TACT_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daSwTact_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_SW_TACT_e,
/* Actor SubMtd */ &daSwTactMethodTable,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|