mirror of https://github.com/zeldaret/tp.git
d_a_obj_fallobj debug work + dVibration_c alignment (#3048)
* d_a_obj_fallobj debug * fix dVibration_c alignment * fix * pr comments
This commit is contained in:
parent
87a3705039
commit
1817d3123f
|
|
@ -44,9 +44,11 @@ public:
|
|||
int Draw();
|
||||
int Delete();
|
||||
|
||||
u32 getTime() { return fopAcM_GetParamBit(this, 8, 8); }
|
||||
u32 getPos() { return fopAcM_GetParamBit(this, 0x14, 8); }
|
||||
static BOOL checkFallStart(fopAc_ac_c* actor) { return actor->speed.y != 0.0f; }
|
||||
u8 getTime() { return fopAcM_GetParamBit(this, 8, 8); }
|
||||
u8 getPos() { return fopAcM_GetParamBit(this, 0x14, 8); }
|
||||
bool checkFallStart() {
|
||||
return this->speed.y != 0.0f;
|
||||
};
|
||||
|
||||
private:
|
||||
/* 0x5A0 */ request_of_phase_process_class mPhaseReq;
|
||||
|
|
|
|||
|
|
@ -940,11 +940,11 @@ public:
|
|||
/* 0x03F90 */ dEvt_control_c mEvent;
|
||||
/* 0x040C0 */ dEvent_manager_c mEvtManager;
|
||||
/* 0x04780 */ dAttention_c mAttention;
|
||||
#if PLATFORM_WII || VERSION == VERSION_SHIELD
|
||||
/* 0x04C9C */ u8 unk_0x4c9c[8];
|
||||
#endif
|
||||
/* 0x04C9C */ dVibration_c mVibration;
|
||||
/* 0x04D2C */ u8 field_0x4d2c[4];
|
||||
#if PLATFORM_WII || VERSION == VERSION_SHIELD
|
||||
/* 0x04D38 */ u8 unk_0x4d38[8];
|
||||
#endif
|
||||
/* 0x04D30 */ JKRArchive* mFieldMapArchive2;
|
||||
/* 0x04D34 */ JKRArchive* mMsgArchive[11];
|
||||
/* 0x04D60 */ JKRArchive* mDemoMsgArchive;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,15 @@
|
|||
#include "d/d_bg_w.h"
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "d/d_procname.h"
|
||||
#include "d/d_s_play.h"
|
||||
|
||||
|
||||
static char* l_arcName = "K_drock00";
|
||||
|
||||
static cull_box l_cull_box = {
|
||||
{-200.0f, -10000.0f, -200.0f},
|
||||
{200.0f, 600.0f, 200.0f},
|
||||
};
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
|
@ -34,7 +43,6 @@ void daObjFallObj_HIO_c::genMessage(JORMContext* ctx) {
|
|||
}
|
||||
|
||||
static daObjFallObj_HIO_c l_HIO;
|
||||
|
||||
#endif
|
||||
|
||||
void daObjFallObj_c::initBaseMtx() {
|
||||
|
|
@ -52,13 +60,6 @@ void daObjFallObj_c::setBaseMtx() {
|
|||
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
|
||||
}
|
||||
|
||||
static char* l_arcName = "K_drock00";
|
||||
|
||||
static cull_box l_cull_box = {
|
||||
{-200.0f, -10000.0f, -200.0f},
|
||||
{200.0f, 600.0f, 200.0f},
|
||||
};
|
||||
|
||||
int daObjFallObj_c::Create() {
|
||||
u8 uVar1 = field_0x5d8 - 1;
|
||||
if (uVar1 != 0) {
|
||||
|
|
@ -82,7 +83,7 @@ int daObjFallObj_c::Create() {
|
|||
}
|
||||
|
||||
s16 daObjFallObj_c::getFallTime() {
|
||||
u32 time = getTime();
|
||||
u8 time = getTime();
|
||||
if (time == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -95,27 +96,32 @@ s16 daObjFallObj_c::getFallTime() {
|
|||
}
|
||||
|
||||
f32 daObjFallObj_c::getFallHeight() {
|
||||
u32 pos = getPos();
|
||||
u8 pos = getPos();
|
||||
f32 ret;
|
||||
if (pos == 0xff) {
|
||||
return 450.0f;
|
||||
ret = 450.0f;
|
||||
} else {
|
||||
ret = pos * 50.0f + 300.0f;
|
||||
}
|
||||
|
||||
return pos * 50.0f + 300.0f;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int daObjFallObj_c::CreateHeap() {
|
||||
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4);
|
||||
JUT_ASSERT(260, modelData != NULL);
|
||||
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
|
||||
return mpModel != NULL ? TRUE : FALSE;
|
||||
if (mpModel == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int daObjFallObj_c::create1st() {
|
||||
field_0x5d8 = 1;
|
||||
int phase = dComIfG_resLoad(&mPhaseReq, l_arcName);
|
||||
cPhs__Step phase = (cPhs__Step) dComIfG_resLoad(&mPhaseReq, l_arcName);
|
||||
if (phase == cPhs_COMPLEATE_e) {
|
||||
phase =
|
||||
MoveBGCreate(l_arcName, 7, dBgS_MoveBGProc_Typical, 0x2700, NULL);
|
||||
(cPhs__Step) MoveBGCreate(l_arcName, 7, dBgS_MoveBGProc_Typical, 0x2700, NULL);
|
||||
if (phase == cPhs_ERROR_e) {
|
||||
return phase;
|
||||
}
|
||||
|
|
@ -128,8 +134,9 @@ int daObjFallObj_c::create1st() {
|
|||
return phase;
|
||||
}
|
||||
|
||||
// TODO: Debug Nonmatching / Fakematch (bVar1)
|
||||
int daObjFallObj_c::Execute(Mtx** i_mtx) {
|
||||
cXyz cStack_d8(0.0f, 150.0f, 160.0f);
|
||||
cXyz cStack_d8(0.0f, 150.0f, 160.0f + KREG_F(0));
|
||||
|
||||
mDoMtx_stack_c::transS(current.pos);
|
||||
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
||||
|
|
@ -140,7 +147,7 @@ int daObjFallObj_c::Execute(Mtx** i_mtx) {
|
|||
|
||||
daPy_py_c* player = daPy_getPlayerActorClass();
|
||||
|
||||
f32 dVar12 = fabsf(player->current.pos.y - cStack_d8.y);
|
||||
f32 dVar12 = std::fabs(player->current.pos.y - cStack_d8.y);
|
||||
f32 dVar13 = cStack_d8.absXZ(player->current.pos);
|
||||
f32 dVar14 = player->current.pos.abs(cStack_d8);
|
||||
|
||||
|
|
@ -148,18 +155,37 @@ int daObjFallObj_c::Execute(Mtx** i_mtx) {
|
|||
linChk.Set(&player->eyePos, &attention_info.position, this);
|
||||
|
||||
bool bVar1 = false;
|
||||
if (!dComIfG_Bgsp().LineCross(&linChk) && !checkHang2() && dVar12 < dVar13 && dVar14 < 2150.0f && mAction == ACTION_WAIT) {
|
||||
|
||||
#if DEBUG
|
||||
int check3 = 0;
|
||||
int check2 = 0;
|
||||
int check1 = 0;
|
||||
if (!dComIfG_Bgsp().LineCross(&linChk) && !checkHang2()) {
|
||||
check1 = 1;
|
||||
}
|
||||
if (check1 && dVar12 - KREG_F(4) < dVar13) {
|
||||
check2 = 1;
|
||||
}
|
||||
if (check2 && dVar14 < 2150.0f - KREG_F(5)) {
|
||||
check3 = 1;
|
||||
}
|
||||
if (check3 && mAction == ACTION_WAIT) {
|
||||
bVar1 = true;
|
||||
}
|
||||
#else
|
||||
if (!dComIfG_Bgsp().LineCross(&linChk) && !checkHang2() && dVar12 - KREG_F(4) < dVar13 && dVar14 < 2150.0f - KREG_F(5) && mAction == ACTION_WAIT) {
|
||||
bVar1 = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bVar1) {
|
||||
if (((bool) bVar1) != 0) {
|
||||
attention_info.distances[fopAc_attn_BATTLE_e] = 0x22;
|
||||
attention_info.flags |= fopAc_AttnFlag_BATTLE_e;
|
||||
} else {
|
||||
attention_info.distances[fopAc_attn_BATTLE_e] = 0x0;
|
||||
attention_info.flags &= ~fopAc_AttnFlag_BATTLE_e;
|
||||
}
|
||||
|
||||
|
||||
field_0x5e0 += 1;
|
||||
action();
|
||||
*i_mtx = &mBgMtx;
|
||||
|
|
@ -203,20 +229,23 @@ void daObjFallObj_c::action() {
|
|||
}
|
||||
|
||||
bool daObjFallObj_c::action_wait(bool param_1) {
|
||||
if (param_1) {
|
||||
bool cond = param_1;
|
||||
if (cond) {
|
||||
mTimer = 10;
|
||||
mAction = ACTION_FALL_START;
|
||||
}
|
||||
|
||||
if (parentActorID != fpcM_ERROR_PROCESS_ID_e) {
|
||||
fopAc_ac_c* parent = fopAcM_SearchByID(parentActorID);
|
||||
if (parent != NULL && checkFallStart(parent)) {
|
||||
daObjFallObj_c* parent = (daObjFallObj_c*) fopAcM_SearchByID(parentActorID);
|
||||
if (parent != NULL && parent->checkFallStart()) {
|
||||
mAction = ACTION_FOLLOW_FALL;
|
||||
}
|
||||
}
|
||||
return param_1;
|
||||
return cond;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool daObjFallObj_c::action_fallStart() {
|
||||
cLib_calcTimer(&mTimer);
|
||||
if (mTimer >= 8) {
|
||||
|
|
@ -243,9 +272,15 @@ bool daObjFallObj_c::action_fallStart() {
|
|||
}
|
||||
|
||||
void daObjFallObj_c::action_countdown() {
|
||||
bool bVar1 = true;
|
||||
bool noFall = false;
|
||||
#if DEBUG
|
||||
if (l_HIO.mNoFall) {
|
||||
noFall = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
daPy_py_c* player = daPy_getPlayerActorClass();
|
||||
if (bVar1) {
|
||||
if (!noFall) {
|
||||
speed.y = -(getFallHeight() - 50.0f) / getFallTime();
|
||||
current.pos.y += speed.y;
|
||||
mSoundObj.startLevelSound(Z2SE_OBJ_POLE_FALLING, 0, -1);
|
||||
|
|
@ -257,17 +292,23 @@ void daObjFallObj_c::action_countdown() {
|
|||
}
|
||||
|
||||
if (player->getSpeedF() != 0.0f) {
|
||||
#if DEBUG
|
||||
field_0x5de = l_HIO.mMovementShake;
|
||||
} else {
|
||||
field_0x5de = l_HIO.mStaticShake;
|
||||
#else
|
||||
field_0x5de = 0;
|
||||
} else {
|
||||
field_0x5de = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
cLib_chaseS(&field_0x5dc, field_0x5de, 0x32);
|
||||
shape_angle.x = field_0x5dc * cM_scos(field_0x5e0 * 1500);
|
||||
shape_angle.z = field_0x5dc * cM_ssin(field_0x5e0 * 2000);
|
||||
shape_angle.x = field_0x5dc * cM_scos(field_0x5e0 * (KREG_S(2) + 1500));
|
||||
shape_angle.z = field_0x5dc * cM_ssin(field_0x5e0 * (KREG_S(4) + 2000));
|
||||
if (parentActorID != fpcM_ERROR_PROCESS_ID_e) {
|
||||
fopAc_ac_c* parent = fopAcM_SearchByID(parentActorID);
|
||||
if (parent != NULL && checkFallStart(parent)) {
|
||||
daObjFallObj_c* parent = (daObjFallObj_c*) fopAcM_SearchByID(parentActorID);
|
||||
if (parent != NULL && parent->checkFallStart()) {
|
||||
mAction = ACTION_FOLLOW_FALL;
|
||||
}
|
||||
}
|
||||
|
|
@ -280,7 +321,7 @@ void daObjFallObj_c::action_fall() {
|
|||
}
|
||||
|
||||
current.pos.y += speed.y;
|
||||
if (fabsf(home.pos.y - current.pos.y) > 10000.0f) {
|
||||
if (std::fabs(home.pos.y - current.pos.y) > 10000.0f) {
|
||||
fopAcM_delete(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -294,7 +335,7 @@ void daObjFallObj_c::action_follow_fall() {
|
|||
current.pos.y += parent->speed.y;
|
||||
}
|
||||
|
||||
if (fabsf(home.pos.y - current.pos.y) > 10000.0f) {
|
||||
if (std::fabs(home.pos.y - current.pos.y) > 10000.0f) {
|
||||
fopAcM_delete(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -303,7 +344,9 @@ void daObjFallObj_c::action_follow_fall() {
|
|||
bool daObjFallObj_c::checkHang() {
|
||||
bool rv = false;
|
||||
daPy_py_c* player = daPy_getPlayerActorClass();
|
||||
if (dComIfGp_checkPlayerStatus1(0, 0x2000000) && fopAcM_searchPlayerDistanceXZ(this) < 250.0f &&
|
||||
|
||||
u32 status = dComIfGp_checkPlayerStatus1(0, 0x2000000);
|
||||
if (status && fopAcM_searchPlayerDistanceXZ(this) < 250.0f &&
|
||||
player->current.pos.y > current.pos.y - 100.0f &&
|
||||
player->current.pos.y < current.pos.y + 300.0f)
|
||||
{
|
||||
|
|
@ -401,7 +444,7 @@ static int daObjFallObj_MoveBGExecute(daObjFallObj_c* i_this) {
|
|||
}
|
||||
|
||||
static int daObjFallObj_MoveBGDraw(daObjFallObj_c* i_this) {
|
||||
return i_this->Draw();
|
||||
return i_this->MoveBGDraw();
|
||||
}
|
||||
|
||||
static actor_method_class daObjFallObj_METHODS = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue