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
|
//
// Generated by dtk
// Translation Unit: d_envse.cpp
//
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_envse.h"
#include "f_op/f_op_kankyo.h"
#include "f_op/f_op_kankyo_mng.h"
#include "f_op/f_op_camera.h"
#include "d/d_stage.h"
#include "d/d_path.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_audio.h"
/* 8017D4C0-8017D4C8 .text dEnvSe_Draw__FP8dEnvSe_c */
static BOOL dEnvSe_Draw(dEnvSe_c* i_this) {
return TRUE;
}
/* 8017D4C8-8017D700 .text dEnvSe_getNearPathPos__FP4cXyzP4cXyzP5dPath */
void dEnvSe_getNearPathPos(cXyz* r30, cXyz* r31, dPath* r26) {
int i;
int nearIdx = 0;
BOOL spc[2] = {FALSE, FALSE};
cXyz sp30[2];
f32 sp8;
f32 f31 = FLOAT_MAX;
dPnt* point = r26->m_points;
cM3dGLin lin;
for (i = 0; i < r26->m_num; point++, i++) {
sp8 = r31->abs2(point->m_position);
if (f31 > sp8) {
f31 = sp8;
nearIdx = i;
}
}
point = &r26->m_points[nearIdx];
if (nearIdx != 0) {
lin.set(point[-1].m_position, point[0].m_position);
spc[0] = cM3d_Len3dSqPntAndSegLine(&lin, r31, &sp30[0], &sp8);
}
if (nearIdx != r26->m_num-1) {
lin.set(point[0].m_position, point[1].m_position);
spc[1] = cM3d_Len3dSqPntAndSegLine(&lin, r31, &sp30[1], &sp8);
}
if (spc[0]) {
if (spc[1]) {
if (sp30[1].abs2(*r31) > sp8) {
*r30 = sp30[0];
} else {
*r30 = sp30[1];
}
} else {
*r30 = sp30[0];
}
} else {
if (spc[1]) {
*r30 = sp30[1];
} else {
*r30 = point[0].m_position;
}
}
}
/* 8017D700-8017DAE0 .text execute__8dEnvSe_cFv */
BOOL dEnvSe_c::execute() {
int roomNo = dComIfGp_roomControl_getStayNo();
dStage_roomDt_c* fili_p = dComIfGp_roomControl_getStatusRoomDt(roomNo);
if (fili_p == NULL) {
return TRUE;
}
dStage_SoundInfo_c* soundInf = fili_p->getSoundInf();
if (soundInf == NULL) {
return TRUE;
}
int i = soundInf->num;
stage_sound_data* sound_data = soundInf->m_entries;
cXyz sp2c = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0))->mCamera.Eye();
for (; i != 0; sound_data++, i--) {
dPath* path;
if (sound_data->field_0x17 == 0) {
mDoAud_initSeaEnvPos();
path = dPath_GetRoomPath(sound_data->field_0x18, roomNo);
while (path != NULL) {
dEnvSe_getNearPathPos(&mPos, &sp2c, path);
mDoAud_registSeaEnvPos(&mPos);
path = dPath_GetNextRoomPath(path, roomNo);
}
mDoAud_seaEnvSePlay(sound_data->field_0x14);
} else if (sound_data->field_0x17 == 1) {
f32 f31 = FLOAT_MAX;
int r27;
mPos = sp2c;
path = dPath_GetRoomPath(sound_data->field_0x18, roomNo);
while (path != NULL) {
cXyz sp20;
dEnvSe_getNearPathPos(&sp20, &sp2c, path);
f32 f1 = sp20.abs2(sp2c);
if (f1 < f31) {
f31 = f1;
r27 = path->mArg0;
mPos = sp20;
}
path = dPath_GetNextRoomPath(path, roomNo);
}
if (field_0xf8 == 0) {
mDoAud_startSeaShoreSE(&mPos, r27);
field_0xfc = r27;
} else {
mDoAud_continueSeaShoreSE(&mPos, field_0xfc);
}
dComIfGp_setWaveFrame(field_0xf8);
if (field_0xf8 == 99) {
field_0xf8 = 0;
} else {
field_0xf8++;
}
} else if (sound_data->field_0x17 == 2) {
mDoAud_initRiverPos();
path = dPath_GetRoomPath(sound_data->field_0x18, roomNo);
while (path != NULL) {
dEnvSe_getNearPathPos(&mPos, &sp2c, path);
mDoAud_registRiverPos(&mPos);
path = dPath_GetNextRoomPath(path, roomNo);
}
mDoAud_riverSePlay(sound_data->field_0x14, dComIfGp_getReverb(roomNo));
} else if (sound_data->field_0x17 == 3) {
f32 f31 = FLOAT_MAX;
mPos = sp2c;
path = dPath_GetRoomPath(sound_data->field_0x18, roomNo);
while (path != NULL) {
cXyz sp14;
dEnvSe_getNearPathPos(&sp14, &sp2c, path);
f32 f1 = sp14.abs2(sp2c);
if (f1 < f31) {
f31 = f1;
mPos = sp14;
}
path = dPath_GetNextRoomPath(path, roomNo);
}
mDoAud_waterfallSePlay(sound_data->field_0x14, &mPos, dComIfGp_getReverb(roomNo));
} else if (sound_data->field_0x17 == 4) {
mDoAud_initWindowPos();
path = dPath_GetRoomPath(sound_data->field_0x18, roomNo);
while (path != NULL) {
dEnvSe_getNearPathPos(&mPos, &sp2c, path);
mDoAud_registWindowPos(&mPos);
path = dPath_GetNextRoomPath(path, roomNo);
}
}
}
return TRUE;
}
/* 8017DAE0-8017DB00 .text dEnvSe_Execute__FP8dEnvSe_c */
static BOOL dEnvSe_Execute(dEnvSe_c* i_this) {
return i_this->execute();
}
/* 8017DB00-8017DB08 .text dEnvSe_IsDelete__FP8dEnvSe_c */
static BOOL dEnvSe_IsDelete(dEnvSe_c* i_this) {
return TRUE;
}
/* 8017DB08-8017DB38 .text dEnvSe_Delete__FP8dEnvSe_c */
static BOOL dEnvSe_Delete(dEnvSe_c* i_this) {
mDoAud_seDeleteObject(&i_this->mPos);
return TRUE;
}
/* 8017DB38-8017DB40 .text dEnvSe_Create__FP12kankyo_class */
static cPhs_State dEnvSe_Create(kankyo_class*) {
return cPhs_COMPLEATE_e;
}
static kankyo_method_class l_dEnvSe_Method = {
(process_method_func)dEnvSe_Create,
(process_method_func)dEnvSe_Delete,
(process_method_func)dEnvSe_Execute,
(process_method_func)dEnvSe_IsDelete,
(process_method_func)dEnvSe_Draw,
};
kankyo_process_profile_definition g_profile_ENVSE = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0002,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_ENVSE_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(dEnvSe_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopKy_Method,
/* Draw Prio */ fpcDwPi_ENVSE_e,
/* Kankyo SubMtd */ &l_dEnvSe_Method,
};
|