mirror of
https://github.com/zeldaret/tww.git
synced 2026-09-07 11:01:40 -04:00
d_envse OK
This commit is contained in:
+138
-4
@@ -5,8 +5,11 @@
|
||||
|
||||
#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"
|
||||
|
||||
class dEnvSe_c : public kankyo_class {
|
||||
@@ -23,13 +26,144 @@ BOOL dEnvSe_Draw(dEnvSe_c* i_this) {
|
||||
}
|
||||
|
||||
/* 8017D4C8-8017D700 .text dEnvSe_getNearPathPos__FP4cXyzP4cXyzP5dPath */
|
||||
void dEnvSe_getNearPathPos(cXyz*, cXyz*, dPath*) {
|
||||
/* Nonmatching */
|
||||
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;
|
||||
dPath__Point* point = r26->mpPnt;
|
||||
cM3dGLin lin;
|
||||
|
||||
for (i = 0; i < r26->m_num; point++, i++) {
|
||||
sp8 = r31->abs2(point->mPos);
|
||||
if (f31 > sp8) {
|
||||
f31 = sp8;
|
||||
nearIdx = i;
|
||||
}
|
||||
}
|
||||
|
||||
point = &r26->mpPnt[nearIdx];
|
||||
if (nearIdx != 0) {
|
||||
lin.set(point[-1].mPos, point[0].mPos);
|
||||
spc[0] = cM3d_Len3dSqPntAndSegLine(&lin, r31, &sp30[0], &sp8);
|
||||
}
|
||||
if (nearIdx != r26->m_num-1) {
|
||||
lin.set(point[0].mPos, point[1].mPos);
|
||||
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].mPos;;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 8017D700-8017DAE0 .text execute__8dEnvSe_cFv */
|
||||
BOOL dEnvSe_c::execute() {
|
||||
/* Nonmatching */
|
||||
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 */
|
||||
@@ -61,7 +195,7 @@ kankyo_method_class l_dEnvSe_Method = {
|
||||
(process_method_func)dEnvSe_Draw,
|
||||
};
|
||||
|
||||
kankyo_process_profile_definition g_profile_EnvSe = {
|
||||
kankyo_process_profile_definition g_profile_ENVSE = {
|
||||
fpcLy_CURRENT_e,
|
||||
2,
|
||||
fpcPi_CURRENT_e,
|
||||
|
||||
Reference in New Issue
Block a user