d_envse OK

This commit is contained in:
LagoLunatic
2024-02-04 20:33:51 -05:00
parent 946172442e
commit 0d899b50f5
8 changed files with 192 additions and 14 deletions
+1 -1
View File
@@ -448,7 +448,7 @@ config.libs = [
Object(NonMatching, "d/d_auction_screen.cpp"),
Object(Matching, "d/d_place_name.cpp"),
Object(NonMatching, "d/d_camera.cpp"),
Object(NonMatching, "d/d_envse.cpp"),
Object(Matching, "d/d_envse.cpp"),
Object(NonMatching, "d/d_file_error.cpp"),
Object(NonMatching, "d/d_file_select.cpp"),
Object(NonMatching, "d/d_gameover.cpp"),
+4 -1
View File
@@ -23,6 +23,10 @@ public:
mStart = start;
mEnd = end;
}
void set(const Vec& start, const Vec& end) {
mStart = start;
mEnd = end;
}
void CalcPos(Vec*, f32) const { /* TODO */ }
void CalcVec(Vec* pOut) const { VECSubtract(&this->mEnd, &this->mStart, pOut); }
void SetEnd(const cXyz& pos) { mEnd = pos; }
@@ -35,7 +39,6 @@ public:
const cXyz& GetEnd() const { return mEnd; }
cXyz& GetEnd() { return mEnd; }
void GetLen() const { /* TODO */ }
void set(const Vec&, const Vec&) { /* TODO */ }
}; // Size = 0x1C
STATIC_ASSERT(0x1C == sizeof(cM3dGLin));
+1 -1
View File
@@ -404,7 +404,7 @@ public:
void CStickUse() {}
void CStickUseless() {}
void Eye() {}
cXyz Eye() { return mEye + mEyeShake; }
void StickUse() {}
void StickUseless() {}
void clrFlag(u32) {}
-4
View File
@@ -1806,10 +1806,6 @@ inline dBgW* dComIfGp_roomControl_getBgW(int i_roomNo) {
return g_dComIfG_gameInfo.play.getRoomControl()->getBgW(i_roomNo);
}
inline void dComIfGp_roomControl_setBgW(int i_roomNo, dBgW * i_bgw) {
dStage_roomControl_c::setBgW(i_roomNo, i_bgw);
}
inline s32 dComIfGp_roomControl_getZoneNo(int i_roomNo) {
return g_dComIfG_gameInfo.play.getRoomControl()->getZoneNo(i_roomNo);
}
+1 -1
View File
@@ -25,7 +25,7 @@ class camera_class : public camera_process_class {
public:
/* 0x23C */ int field_0x23c;
/* 0x240 */ int field_0x244;
/* 0x244 */ dCamera_c mCamera;
/* 0x244 */ dCamera_c mCamera;
};
struct camera_process_profile_definition {
+45
View File
@@ -3,6 +3,7 @@
#include "JAZelAudio/JAIZelBasic.h"
#include "JAZelAudio/JAIZelInst.h"
#include "SSystem/SComponent/c_xyz.h"
class mDoAud_zelAudio_c : public JAIZelBasic {
public:
@@ -266,4 +267,48 @@ inline bool mDoAud_checkAllWaveLoadStatus() {
return mDoAud_zelAudio_c::getInterface()->checkAllWaveLoadStatus();
}
inline void mDoAud_initSeaEnvPos() {
mDoAud_zelAudio_c::getInterface()->initSeaEnvPos();
}
inline void mDoAud_registSeaEnvPos(Vec* param_0) {
mDoAud_zelAudio_c::getInterface()->registSeaEnvPos(param_0);
}
inline void mDoAud_seaEnvSePlay(u32 param_0) {
mDoAud_zelAudio_c::getInterface()->seaEnvSePlay(param_0, 0);
}
inline void mDoAud_startSeaShoreSE(Vec* param_0, u32 param_1) {
mDoAud_zelAudio_c::getInterface()->seaShoreSE(param_1, param_0, 0, 0);
}
inline void mDoAud_continueSeaShoreSE(Vec* param_0, u32 param_1) {
mDoAud_zelAudio_c::getInterface()->seaShoreSE(param_1, param_0, 1, 0);
}
inline void mDoAud_initRiverPos() {
mDoAud_zelAudio_c::getInterface()->initRiverPos();
}
inline void mDoAud_registRiverPos(cXyz* param_0) {
mDoAud_zelAudio_c::getInterface()->registRiverPos(param_0);
}
inline void mDoAud_riverSePlay(u8 param_0, s8 param_1) {
mDoAud_zelAudio_c::getInterface()->riverSePlay(param_0, param_1);
}
inline void mDoAud_waterfallSePlay(u8 param_0, cXyz* param_1, s8 param_2) {
mDoAud_zelAudio_c::getInterface()->waterfallSePlay(param_0, param_1, param_2);
}
inline void mDoAud_initWindowPos() {
mDoAud_zelAudio_c::getInterface()->initWindowPos();
}
inline void mDoAud_registWindowPos(Vec* param_0) {
mDoAud_zelAudio_c::getInterface()->registWindowPos(param_0);
}
#endif /* M_DO_AUDIO_H */
+2 -2
View File
@@ -208,7 +208,7 @@ BOOL daBg_c::createHeap() {
return FALSE;
if (bgw->Set(dzb, cBgW::GLOBAL_e, NULL))
return FALSE;
dComIfGp_roomControl_setBgW(roomNo, bgw);
dStage_roomControl_c::setBgW(roomNo, bgw);
bgw->mWallCorrectPriority = 0;
} else {
bgw = NULL;
@@ -223,7 +223,7 @@ daBg_c::~daBg_c() {
if (heap != NULL && bgw != NULL) {
dComIfG_Bgsp()->Release(bgw);
dComIfGp_roomControl_setBgW(roomNo, NULL);
dStage_roomControl_c::setBgW(roomNo, NULL);
}
if (dComIfGp_getMagma() != NULL)
dComIfGp_getMagma()->deleteRoom(roomNo);
+138 -4
View File
@@ -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,