mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-06 11:37:25 -04:00
205 lines
6.4 KiB
C++
205 lines
6.4 KiB
C++
//
|
|
// Generated by dtk
|
|
// Translation Unit: d_envse.cpp
|
|
//
|
|
|
|
#include "d/d_envse.h"
|
|
#include "d/d_priority.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_procname.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;
|
|
}
|
|
|
|
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 = {
|
|
/* LayerID */ fpcLy_CURRENT_e,
|
|
/* ListID */ 0x0002,
|
|
/* ListPrio */ fpcPi_CURRENT_e,
|
|
/* ProcName */ PROC_ENVSE,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(dEnvSe_c),
|
|
/* SizeOther */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopKy_Method,
|
|
/* Priority */ PRIO_ENVSE,
|
|
/* Actor SubMtd */ &l_dEnvSe_Method,
|
|
};
|