mirror of
https://github.com/zeldaret/tp
synced 2026-06-07 03:57:56 -04:00
d_a_npc cleanup (#2466)
* d_a_npc first cleanup pass * more d_a_npc cleanup
This commit is contained in:
+542
-3220
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,677 @@
|
||||
#include "d/actor/d_a_npc.h"
|
||||
|
||||
static s32 daBaseNpc_chkPnt(cXyz param_0, dPnt* param_1, u16 param_2, u16 param_3, int param_4, int param_5);
|
||||
static u16 daBaseNpc_putNurbs(dPnt* i_CPnts, int i_CPntNum, int i_maxPntNum, dPnt* o_curve_p, BOOL i_isClosed);
|
||||
static s16 daBaseNpc_getGroundAngle(cBgS_PolyInfo* param_0, s16 param_1);
|
||||
|
||||
/* 8014D538-8014D584 147E78 004C+00 2/2 0/0 0/0 .text daBaseNpc_addIdx__FiiPUsi */
|
||||
static int daBaseNpc_addIdx(int i_step, int i_num, u16* i_idx, BOOL i_closed) {
|
||||
BOOL new_idx = *i_idx;
|
||||
BOOL ret;
|
||||
|
||||
ret = FALSE;
|
||||
new_idx += i_step;
|
||||
|
||||
if (i_num <= new_idx) {
|
||||
if (i_closed) {
|
||||
new_idx -= i_num * (new_idx / i_num);
|
||||
} else {
|
||||
new_idx = i_num != 0 ? i_num - 1 : 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*i_idx = (u16)new_idx;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8014D584-8014D5C4 147EC4 0040+00 2/2 0/0 0/0 .text daBaseNpc_subIdx__FiiPUsi */
|
||||
static BOOL daBaseNpc_subIdx(int i_step, int i_num, u16* i_idx, BOOL i_closed) {
|
||||
int new_idx = *i_idx;
|
||||
BOOL ret;
|
||||
|
||||
ret = FALSE;
|
||||
new_idx -= i_step;
|
||||
|
||||
if (new_idx <= 0) {
|
||||
if (i_closed) {
|
||||
new_idx += i_num * (new_idx / i_num + 1);
|
||||
} else {
|
||||
new_idx = 0;
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*i_idx = (u16)new_idx;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8014D5C4-8014D620 147F04 005C+00 2/2 0/0 0/0 .text daBaseNpc_incIdx__FiPUsii */
|
||||
static void daBaseNpc_incIdx(int i_pathNo, u16* i_pathIdx, BOOL i_pathClosed, int i_pathDirection) {
|
||||
if (i_pathDirection < 0) {
|
||||
daBaseNpc_subIdx(1, i_pathNo, i_pathIdx, i_pathClosed);
|
||||
} else {
|
||||
daBaseNpc_addIdx(1, i_pathNo, i_pathIdx, i_pathClosed);
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014D620-8014D67C 147F60 005C+00 1/1 0/0 0/0 .text daBaseNpc_decIdx__FiPUsii */
|
||||
static void daBaseNpc_decIdx(int i_pathNo, u16* i_pathIdx, BOOL i_pathClosed, int i_pathDirection) {
|
||||
if (i_pathDirection < 0) {
|
||||
daBaseNpc_addIdx(1, i_pathNo, i_pathIdx, i_pathClosed);
|
||||
} else {
|
||||
daBaseNpc_subIdx(1, i_pathNo, i_pathIdx, i_pathClosed);
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014D67C-8014D804 147FBC 0188+00 1/1 0/0 0/0 .text daNpcBase_BBasis__FiiiPi */
|
||||
static f32 daNpcBase_BBasis(int i_deg, int i_pntNo, int i_knotNo, int* i_knotVector_p) {
|
||||
f32 basis;
|
||||
|
||||
if (i_deg != 0) {
|
||||
f32 var_f31 = (f32)(i_knotVector_p[i_pntNo + i_deg + 1] - i_knotVector_p[i_pntNo + 1]);
|
||||
if (var_f31 != 0.0f) {
|
||||
var_f31 = ((f32)(i_knotVector_p[i_pntNo + i_deg + 1] - i_knotNo) / var_f31) * daNpcBase_BBasis(i_deg - 1, i_pntNo + 1, i_knotNo, i_knotVector_p);
|
||||
}
|
||||
|
||||
f32 var_f30 = (f32)(i_knotVector_p[i_pntNo + i_deg] - i_knotVector_p[i_pntNo]);
|
||||
if (var_f30 != 0.0f) {
|
||||
var_f30 = ((f32)(i_knotNo - i_knotVector_p[i_pntNo]) / var_f30) * daNpcBase_BBasis(i_deg - 1, i_pntNo, i_knotNo, i_knotVector_p);
|
||||
}
|
||||
|
||||
basis = var_f31 + var_f30;
|
||||
} else if (i_knotVector_p[i_pntNo] <= i_knotNo && i_knotNo <= i_knotVector_p[i_pntNo + 1]) {
|
||||
basis = 1.0f;
|
||||
} else {
|
||||
basis = 0.0f;
|
||||
}
|
||||
|
||||
return basis;
|
||||
}
|
||||
|
||||
/* 8014D804-8014D81C 148144 0018+00 0/0 0/0 1/1 .text __ct__18daBaseNpc_acMngr_cFv */
|
||||
daBaseNpc_acMngr_c::daBaseNpc_acMngr_c() {
|
||||
mActorId = fpcM_ERROR_PROCESS_ID_e;
|
||||
}
|
||||
|
||||
/* 8014D81C-8014D838 14815C 001C+00 0/0 0/0 9/9 .text entry__18daBaseNpc_acMngr_cFP10fopAc_ac_c */
|
||||
void daBaseNpc_acMngr_c::entry(fopAc_ac_c* i_ActorP) {
|
||||
mActorId = fopAcM_GetID(i_ActorP);
|
||||
}
|
||||
|
||||
/* 8014D838-8014D884 148178 004C+00 0/0 0/0 6/6 .text getActor__18daBaseNpc_acMngr_cFv */
|
||||
fopAc_ac_c* daBaseNpc_acMngr_c::getActor() {
|
||||
fopAc_ac_c* ret = NULL;
|
||||
if (fopAcM_SearchByID(mActorId, &ret) && ret != NULL) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 8014D884-8014D998 1481C4 0114+00 1/0 0/0 0/0 .text calc__18daBaseNpc_matAnm_cCFP11J3DMaterial
|
||||
*/
|
||||
void daBaseNpc_matAnm_c::calc(J3DMaterial* i_material) const {
|
||||
J3DMaterialAnm::calc(i_material);
|
||||
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (getTexMtxAnm(i).getAnmFlag()) {
|
||||
J3DTexMtxInfo* curr_mtx_info =
|
||||
&i_material->getTexGenBlock()->getTexMtx(i)->getTexMtxInfo();
|
||||
|
||||
if (mMorfFrm != 0) {
|
||||
f32 var_f31 = 1.0f / (mMorfFrm + 1);
|
||||
curr_mtx_info->mSRT.mTranslationX = field_0xF4 * (1.0f - var_f31) + curr_mtx_info->mSRT.mTranslationX * var_f31;
|
||||
curr_mtx_info->mSRT.mTranslationY = field_0xF8 * (1.0f - var_f31) + curr_mtx_info->mSRT.mTranslationY * var_f31;
|
||||
} else if (mEyeMoveFlg != 0) {
|
||||
curr_mtx_info->mSRT.mTranslationX = mNowOffsetX;
|
||||
curr_mtx_info->mSRT.mTranslationY = mNowOffsetY;
|
||||
}
|
||||
|
||||
field_0xF4 = curr_mtx_info->mSRT.mTranslationX;
|
||||
field_0xF8 = curr_mtx_info->mSRT.mTranslationY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014D998-8014D9A8 1482D8 0010+00 0/0 0/0 1/1 .text __ct__16daBaseNpc_path_cFv */
|
||||
daBaseNpc_path_c::daBaseNpc_path_c() {}
|
||||
|
||||
/* 8014D9A8-8014D9BC 1482E8 0014+00 1/1 0/0 4/4 .text isPath__16daBaseNpc_path_cFv */
|
||||
BOOL daBaseNpc_path_c::isPath() {
|
||||
return mPathInfo != NULL;
|
||||
}
|
||||
|
||||
/* 8014D9BC-8014DA48 1482FC 008C+00 0/0 0/0 1/1 .text setPathInfo__16daBaseNpc_path_cFUcScSc */
|
||||
int daBaseNpc_path_c::setPathInfo(u8 i_pathIdx, s8 i_roomNo, s8 i_direction) {
|
||||
mPathInfo = NULL;
|
||||
mIdx = 0;
|
||||
mDirection = i_direction;
|
||||
|
||||
if (i_pathIdx != 0xFF) {
|
||||
mPathInfo = dPath_GetRoomPath(i_pathIdx, i_roomNo);
|
||||
if (mPathInfo == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mCurvePntNum = daBaseNpc_putNurbs(mPathInfo->m_points, mPathInfo->m_num, 160,
|
||||
mCurvePnts, dPath_ChkClose(mPathInfo));
|
||||
}
|
||||
|
||||
return isPath();
|
||||
}
|
||||
|
||||
/* 8014DA48-8014DA64 148388 001C+00 0/0 0/0 1/1 .text reverseDir__16daBaseNpc_path_cFv */
|
||||
void daBaseNpc_path_c::reverseDir() {
|
||||
s8 direction;
|
||||
if (mDirection > 0) {
|
||||
direction = -1;
|
||||
} else {
|
||||
direction = 1;
|
||||
}
|
||||
|
||||
mDirection = direction;
|
||||
}
|
||||
|
||||
/* 8014DA64-8014DAC4 1483A4 0060+00 0/0 0/0 3/3 .text chkPnt__16daBaseNpc_path_cF4cXyz */
|
||||
s32 daBaseNpc_path_c::chkPnt(cXyz i_pos) {
|
||||
return daBaseNpc_chkPnt(i_pos, mPathInfo->m_points, mIdx, mPathInfo->m_num,
|
||||
dPath_ChkClose(mPathInfo), mDirection);
|
||||
}
|
||||
|
||||
/* 8014DAC4-8014DB04 148404 0040+00 0/0 0/0 3/3 .text setNextPnt__16daBaseNpc_path_cFv */
|
||||
void daBaseNpc_path_c::setNextPnt() {
|
||||
daBaseNpc_incIdx(mPathInfo->m_num, &mIdx, dPath_ChkClose(mPathInfo), mDirection);
|
||||
}
|
||||
|
||||
/* 8014DB04-8014DB0C 148444 0008+00 0/0 0/0 3/3 .text getIdx__16daBaseNpc_path_cFv */
|
||||
u16 daBaseNpc_path_c::getIdx() {
|
||||
return mIdx;
|
||||
}
|
||||
|
||||
/* 8014DB0C-8014DB14 -00001 0008+00 0/0 0/0 0/0 .text setIdx__16daBaseNpc_path_cFUs */
|
||||
void daBaseNpc_path_c::setIdx(u16 i_idx) {
|
||||
mIdx = i_idx;
|
||||
}
|
||||
|
||||
/* 8014DB14-8014DB40 148454 002C+00 0/0 0/0 4/4 .text getPntPos__16daBaseNpc_path_cFUs */
|
||||
Vec daBaseNpc_path_c::getPntPos(u16 iIdx) {
|
||||
JUT_ASSERT(676, 0 <= iIdx && iIdx < mPathInfo->m_num);
|
||||
return mPathInfo->m_points[iIdx].m_position;
|
||||
}
|
||||
|
||||
/* 8014DB40-8014DBB4 148480 0074+00 1/1 0/0 0/0 .text limitter__18daBaseNpc_lookat_cFsPsss */
|
||||
void daBaseNpc_lookat_c::limitter(s16 i_value, s16* o_value_p, s16 i_max, s16 i_min) {
|
||||
int tmp = i_value;
|
||||
int tmp2 = tmp + *o_value_p;
|
||||
|
||||
if (i_max < tmp2) {
|
||||
if (tmp < i_max) {
|
||||
*o_value_p -= tmp2 - i_max;
|
||||
} else {
|
||||
*o_value_p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
tmp += *o_value_p;
|
||||
|
||||
if (tmp >= (s16)i_min) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (i_min < i_value) {
|
||||
*o_value_p -= (int)(tmp - i_min);
|
||||
return;
|
||||
}
|
||||
|
||||
*o_value_p = 0;
|
||||
}
|
||||
|
||||
/* 8014DBB4-8014E634 1484F4 0A80+00 0/0 0/0 1/1 .text
|
||||
* calc__18daBaseNpc_lookat_cFP10fopAc_ac_cPA4_fs */
|
||||
// regalloc, equivalent ?
|
||||
void daBaseNpc_lookat_c::calc(fopAc_ac_c* param_0, Mtx param_1, s16 param_2) {
|
||||
if (mpAttnPos == NULL) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
f32 sp28 = mRot[i].x;
|
||||
f32 sp24 = mRot[i].y;
|
||||
f32 sp20 = mRot[i].z;
|
||||
|
||||
cLib_addCalc2(&sp28, 0.0f, 0.25f, 0x800 / (i + 1));
|
||||
cLib_addCalc2(&sp24, 0.0f, 0.25f, 0x800 / (i + 1));
|
||||
cLib_addCalc2(&sp20, 0.0f, 0.25f, 0x800 / (i + 1));
|
||||
|
||||
mRot[i].set(sp28, sp24, sp20);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cXyz sp140[4];
|
||||
Mtx sp110;
|
||||
Mtx spE0;
|
||||
csXyz spC8[4];
|
||||
f32 spB8[4];
|
||||
cXyz spAC;
|
||||
|
||||
cMtx_copy(param_1, sp110);
|
||||
sp110[0][3] = sp110[1][3] = sp110[2][3] = 0.0f;
|
||||
|
||||
mDoMtx_stack_c::copy(sp110);
|
||||
mDoMtx_stack_c::inverse();
|
||||
cMtx_copy(mDoMtx_stack_c::get(), sp110);
|
||||
mDoMtx_stack_c::transS(param_0->current.pos);
|
||||
mDoMtx_stack_c::concat(sp110);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
spAC = mJntPos[i] - param_0->current.pos;
|
||||
mDoMtx_stack_c::multVec(&spAC, &sp140[i]);
|
||||
}
|
||||
|
||||
cXyz spA0(*mpAttnPos);
|
||||
spAC = spA0 - param_0->current.pos;
|
||||
mDoMtx_stack_c::multVec(&spAC, &spA0);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
spAC = sp140[i + 1] - sp140[i];
|
||||
|
||||
spC8[i].set(0, 0, 0);
|
||||
spC8[i].x = -cM_atan2s(spAC.y, spAC.absXZ());
|
||||
|
||||
if (fabsf(cM_ssin(spC8[i].x)) < 0.8f) {
|
||||
spC8[i].y = cM_atan2s(spAC.x, spAC.z);
|
||||
} else {
|
||||
spC8[i].y = 0;
|
||||
}
|
||||
|
||||
spB8[i] = spAC.abs();
|
||||
}
|
||||
|
||||
csXyz sp2C;
|
||||
cXyz sp94;
|
||||
cXyz sp88;
|
||||
|
||||
for (int i = 2; i >= -1; i--) {
|
||||
sp2C = csXyz::Zero;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
mDoMtx_stack_c::XYZrotS(spC8[j]);
|
||||
cMtx_copy(mDoMtx_stack_c::get(), spE0);
|
||||
mDoMtx_stack_c::transS(sp140[j]);
|
||||
|
||||
sp2C.x += field_0x64[j].x;
|
||||
sp2C.y += field_0x64[j].y;
|
||||
|
||||
mDoMtx_stack_c::ZXYrotM(sp2C);
|
||||
mDoMtx_stack_c::concat(spE0);
|
||||
spAC.set(0.0f, 0.0f, spB8[j]);
|
||||
mDoMtx_stack_c::multVec(&spAC, &sp140[j + 1]);
|
||||
}
|
||||
|
||||
if (i == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (param_2 == 0) {
|
||||
field_0x94[i] = 0;
|
||||
}
|
||||
|
||||
if (field_0x94[i] == 0) {
|
||||
sp94 = spA0 - sp140[i];
|
||||
if (!sp94.isZero()) {
|
||||
sp94.normalize();
|
||||
sp88 = sp140[3] - sp140[i];
|
||||
|
||||
if (!sp88.isZero()) {
|
||||
sp88.normalize();
|
||||
s16 sp16, sp14, sp12, sp10;
|
||||
sp16 = -cM_atan2s(sp94.y, sp94.absXZ());
|
||||
sp12 = cM_atan2s(sp94.x, sp94.z);
|
||||
sp14 = -cM_atan2s(sp88.y, sp88.absXZ());
|
||||
sp10 = cM_atan2s(sp88.x, sp88.z);
|
||||
|
||||
s16 spE = sp16 - sp14;
|
||||
s16 spC = sp12 - sp10;
|
||||
field_0x64[i].x += spE;
|
||||
field_0x64[i].y += spC;
|
||||
|
||||
limitter(spC8[i].x, &field_0x64[i].x, mMaxJntLmt[i].x, mMinJntLmt[i].x);
|
||||
limitter(spC8[i].y, &field_0x64[i].y, mMaxJntLmt[i].y, mMinJntLmt[i].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((param_2 > 0 && field_0x64[i].y < 0) || (param_2 < 0 && field_0x64[i].y > 0)) {
|
||||
field_0x94[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sp2C = csXyz::Zero;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sp2C += field_0x64[i];
|
||||
mRot[i] = sp2C;
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014E634-8014E658 148F74 0024+00 0/0 0/0 1/1 .text setMaxJntLmt__18daBaseNpc_lookat_cF5csXyzi
|
||||
*/
|
||||
void daBaseNpc_lookat_c::setMaxJntLmt(csXyz i_max, int i_no) {
|
||||
mMaxJntLmt[i_no] = i_max;
|
||||
}
|
||||
|
||||
/* 8014E658-8014E67C 148F98 0024+00 0/0 0/0 1/1 .text setMinJntLmt__18daBaseNpc_lookat_cF5csXyzi
|
||||
*/
|
||||
void daBaseNpc_lookat_c::setMinJntLmt(csXyz i_min, int i_no) {
|
||||
mMinJntLmt[i_no] = i_min;
|
||||
}
|
||||
|
||||
/* 8014E67C-8014E6A0 148FBC 0024+00 0/0 0/0 1/1 .text setJntPos__18daBaseNpc_lookat_cF4cXyzi */
|
||||
void daBaseNpc_lookat_c::setJntPos(cXyz i_pos, int i_no) {
|
||||
mJntPos[i_no] = i_pos;
|
||||
}
|
||||
|
||||
/* 8014E6A0-8014E6AC 148FE0 000C+00 0/0 0/0 1/1 .text setAttnPos__18daBaseNpc_lookat_cFP4cXyz */
|
||||
int daBaseNpc_lookat_c::setAttnPos(cXyz* i_pos) {
|
||||
mpAttnPos = i_pos;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8014E6AC-8014E6C8 148FEC 001C+00 0/0 0/0 1/1 .text getRot__18daBaseNpc_lookat_cFi */
|
||||
csXyz daBaseNpc_lookat_c::getRot(int i_no) {
|
||||
return mRot[i_no];
|
||||
}
|
||||
|
||||
/* 8014E6C8-8014E89C 149008 01D4+00 1/1 0/0 0/0 .text __ct__11daBaseNpc_cFv */
|
||||
daBaseNpc_c::daBaseNpc_c() {}
|
||||
|
||||
/* 8014E89C-8014EAD0 1491DC 0234+00 2/1 0/0 2/2 .text __dt__11daBaseNpc_cFv */
|
||||
daBaseNpc_c::~daBaseNpc_c() {}
|
||||
|
||||
/* 8014EAD0-8014EC50 149410 0180+00 2/0 0/0 2/0 .text execute__11daBaseNpc_cFv */
|
||||
int daBaseNpc_c::execute() {
|
||||
setParam();
|
||||
mainProc();
|
||||
|
||||
fopAcM_posMoveF(this, mCcStts.GetCCMoveP());
|
||||
mAcch.CrrPos(dComIfG_Bgsp());
|
||||
field_0x9d4 = mAcch.m_gnd;
|
||||
|
||||
mGroundY = mAcch.GetGroundH();
|
||||
if (mGroundY != -1000000000.0f) {
|
||||
field_0x918 = daBaseNpc_getGroundAngle(&field_0x9d4, field_0x91a.y);
|
||||
setEnvTevColor();
|
||||
setRoomNo();
|
||||
}
|
||||
|
||||
allAnmPlay();
|
||||
adjustShapeAngle();
|
||||
setMtx(0);
|
||||
setCollisions();
|
||||
setAttnPos();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8014EC50-8014EE3C 149590 01EC+00 2/0 0/0 2/0 .text draw__11daBaseNpc_cFf */
|
||||
int daBaseNpc_c::draw(f32 param_0) {
|
||||
J3DModel* model_p = mpModelMorf->getModel();
|
||||
J3DModelData* modelData_p = model_p->getModelData();
|
||||
|
||||
if (dKy_darkworld_check()) {
|
||||
g_env_light.settingTevStruct(4, ¤t.pos, &tevStr);
|
||||
} else {
|
||||
g_env_light.settingTevStruct(0, ¤t.pos, &tevStr);
|
||||
}
|
||||
|
||||
g_env_light.setLightTevColorType_MAJI(model_p, &tevStr);
|
||||
|
||||
if (!dbgDraw()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x40)) {
|
||||
mBtp.entry(modelData_p);
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x80)) {
|
||||
mBtk.entry(modelData_p);
|
||||
}
|
||||
|
||||
if (dKy_darkworld_check()) {
|
||||
dComIfGd_setListDark();
|
||||
mpModelMorf->entryDL();
|
||||
dComIfGd_setList();
|
||||
} else {
|
||||
mpModelMorf->entryDL();
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x40)) {
|
||||
mBtp.remove(modelData_p);
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x80)) {
|
||||
mBtk.remove(modelData_p);
|
||||
}
|
||||
|
||||
mShadowId = dComIfGd_setShadow(mShadowId, 1, model_p, ¤t.pos, param_0, 20.0f, current.pos.y, mGroundY, field_0x9d4, &tevStr, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex());
|
||||
drawOtherMdls();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8014EE3C-8014EE44 14977C 0008+00 2/0 0/0 1/0 .text getResName__11daBaseNpc_cFv */
|
||||
const char* daBaseNpc_c::getResName() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 8014EE44-8014EE80 149784 003C+00 0/0 0/0 2/2 .text getTrnsfrmKeyAnmP__11daBaseNpc_cFPci */
|
||||
J3DAnmTransform* daBaseNpc_c::getTrnsfrmKeyAnmP(char* i_arcName, int i_resIdx) {
|
||||
return (J3DAnmTransform*)dComIfG_getObjectRes(i_arcName, i_resIdx);
|
||||
}
|
||||
|
||||
/* 8014EE80-8014EEE4 1497C0 0064+00 0/0 0/0 1/1 .text
|
||||
* setMcaMorfAnm__11daBaseNpc_cFP18J3DAnmTransformKeyffiii */
|
||||
int daBaseNpc_c::setMcaMorfAnm(J3DAnmTransformKey* i_anm, f32 i_speed, f32 i_morf,
|
||||
int i_mode, int i_start, int i_end) {
|
||||
mpModelMorf->setAnm(i_anm, i_mode, i_morf, i_speed, i_start, i_end);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8014EEE4-8014EF28 149824 0044+00 0/0 0/0 1/1 .text
|
||||
* setBckAnm__11daBaseNpc_cFP15J3DAnmTransformfiiib */
|
||||
void daBaseNpc_c::setBckAnm(J3DAnmTransform* i_anm, f32 i_speed, int i_mode, int i_start,
|
||||
int i_end, bool i_modify) {
|
||||
mBck.init(i_anm, TRUE, i_mode, i_speed, i_start, i_end, i_modify);
|
||||
}
|
||||
|
||||
/* 8014EF28-8014EF64 149868 003C+00 0/0 0/0 1/1 .text getTexPtrnAnmP__11daBaseNpc_cFPci
|
||||
*/
|
||||
J3DAnmTransform* daBaseNpc_c::getTexPtrnAnmP(char* i_arcName, int i_resIdx) {
|
||||
return (J3DAnmTransform*)dComIfG_getObjectRes(i_arcName, i_resIdx);
|
||||
}
|
||||
|
||||
/* 8014EF64-8014EFA4 1498A4 0040+00 0/0 0/0 1/1 .text
|
||||
* setBtpAnm__11daBaseNpc_cFP16J3DAnmTexPatternP12J3DModelDatafi */
|
||||
void daBaseNpc_c::setBtpAnm(J3DAnmTexPattern* i_anm, J3DModelData* i_modelData, f32 i_speed,
|
||||
int i_mode) {
|
||||
mBtp.init(i_modelData, i_anm, TRUE, i_mode, i_speed, 0, -1);
|
||||
}
|
||||
|
||||
/* 8014EFA4-8014EFF0 1498E4 004C+00 2/0 0/0 2/0 .text attnSttsOn__11daBaseNpc_cFii */
|
||||
void daBaseNpc_c::attnSttsOn(int param_0, int param_1) {
|
||||
u32 attn_flags;
|
||||
|
||||
if (dComIfGp_getLinkPlayer()->checkWolf()) {
|
||||
if (param_1 != 0) {
|
||||
attn_flags = 10;
|
||||
} else {
|
||||
attn_flags = 1;
|
||||
}
|
||||
} else if (param_0 != 0) {
|
||||
attn_flags = 10;
|
||||
} else {
|
||||
attn_flags = 1;
|
||||
}
|
||||
|
||||
attention_info.flags = attn_flags;
|
||||
}
|
||||
|
||||
/* 8014EFF0-8014EFF4 149930 0004+00 2/0 0/0 1/0 .text setParam__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::setParam() {}
|
||||
|
||||
/* 8014EFF4-8014F09C 149934 00A8+00 0/0 0/0 1/1 .text orderEvent__11daBaseNpc_cFiPc */
|
||||
void daBaseNpc_c::orderEvent(int param_0, char* i_evtName) {
|
||||
if (i_evtName != NULL) {
|
||||
mEvtIdx = dComIfGp_getEventManager().getEventIdx(this, i_evtName, -1);
|
||||
fopAcM_orderOtherEventId(this, mEvtIdx, 0xFF, 0xFFFF, 0, 1);
|
||||
} else if (field_0x848 >= 0 && attention_info.flags == 10) {
|
||||
eventInfo.onCondition(1);
|
||||
if (param_0 != 0) {
|
||||
fopAcM_orderSpeakEvent(this, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014F09C-8014F0A0 1499DC 0004+00 2/0 0/0 1/0 .text mainProc__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::mainProc() {}
|
||||
|
||||
/* 8014F0A0-8014F0FC 1499E0 005C+00 1/1 0/0 2/2 .text setEnvTevColor__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::setEnvTevColor() {
|
||||
tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(field_0x9d4);
|
||||
tevStr.room_no = dComIfG_Bgsp().GetRoomId(field_0x9d4);
|
||||
}
|
||||
|
||||
/* 8014F0FC-8014F140 149A3C 0044+00 1/1 0/0 2/2 .text setRoomNo__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::setRoomNo() {
|
||||
s32 room_id = dComIfG_Bgsp().GetRoomId(field_0x9d4);
|
||||
fopAcM_SetRoomNo(this, room_id);
|
||||
mCcStts.SetRoomId(room_id);
|
||||
}
|
||||
|
||||
/* 8014F140-8014F148 149A80 0008+00 2/0 0/0 2/0 .text btkCtrl__11daBaseNpc_cFv */
|
||||
BOOL daBaseNpc_c::btkCtrl() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 8014F148-8014F1C8 149A88 0080+00 1/1 0/0 0/0 .text checkEndAnm__11daBaseNpc_cFf */
|
||||
int daBaseNpc_c::checkEndAnm(f32 param_0) {
|
||||
switch (mpModelMorf->getPlayMode()) {
|
||||
case J3DFrameCtrl::EMode_LOOP:
|
||||
return mpModelMorf->isLoop();
|
||||
case J3DFrameCtrl::EMode_NONE:
|
||||
case J3DFrameCtrl::EMode_RESET:
|
||||
return mpModelMorf->isStop() && param_0 != mpModelMorf->getPlaySpeed();
|
||||
case J3DFrameCtrl::EMode_REVERSE:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 8014F1C8-8014F228 149B08 0060+00 1/1 0/0 0/0 .text checkEndAnm__11daBaseNpc_cFP12J3DFrameCtrl
|
||||
*/
|
||||
int daBaseNpc_c::checkEndAnm(J3DFrameCtrl* i_framectrl) {
|
||||
switch (i_framectrl->getAttribute()) {
|
||||
case J3DFrameCtrl::EMode_LOOP:
|
||||
return i_framectrl->checkState(2);
|
||||
case J3DFrameCtrl::EMode_NONE:
|
||||
case J3DFrameCtrl::EMode_RESET:
|
||||
return i_framectrl->checkState(1) || i_framectrl->getRate() == 0.0f;
|
||||
case J3DFrameCtrl::EMode_REVERSE:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 8014F228-8014F38C 149B68 0164+00 2/0 0/0 2/0 .text allAnmPlay__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::allAnmPlay() {
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x10) && !cLib_checkBit<u16>(field_0x840, 1)) {
|
||||
f32 temp_f31 = mpModelMorf->getPlaySpeed();
|
||||
mpModelMorf->play(0, 0);
|
||||
|
||||
if (checkEndAnm(temp_f31)) {
|
||||
field_0x842++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x80) && !cLib_checkBit<u16>(field_0x840, 8) && !btkCtrl()) {
|
||||
mBtk.play();
|
||||
}
|
||||
|
||||
if (!cLib_checkBit<u16>(field_0x840, 0x100)) {
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x20) && !cLib_checkBit<u16>(field_0x840, 2)) {
|
||||
mBck.play();
|
||||
}
|
||||
|
||||
if (cLib_checkBit<u16>(field_0x840, 0x40) && !cLib_checkBit<u16>(field_0x840, 4)) {
|
||||
mBtp.getFrame();
|
||||
mBtp.play();
|
||||
|
||||
if (mBtp.getFrameCtrl()->getAttribute() == 2) {
|
||||
if (checkEndAnm(mBtp.getFrameCtrl())) {
|
||||
field_0x838 = cLib_getRndValue<int>(60, 100);
|
||||
mBtp.setPlaySpeed(0.0f);
|
||||
}
|
||||
} else {
|
||||
field_0x838 = 0;
|
||||
}
|
||||
|
||||
if (cLib_calcTimer<s16>(&field_0x838) == 0) {
|
||||
mBtp.setPlaySpeed(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cLib_offBit<u16>(field_0x840, 0x10F);
|
||||
}
|
||||
|
||||
/* 8014F38C-8014F390 149CCC 0004+00 2/0 0/0 1/0 .text adjustShapeAngle__11daBaseNpc_cFv
|
||||
*/
|
||||
void daBaseNpc_c::adjustShapeAngle() {}
|
||||
|
||||
/* 8014F390-8014F4A0 149CD0 0110+00 2/0 0/0 1/0 .text setMtx__11daBaseNpc_cFi */
|
||||
void daBaseNpc_c::setMtx(int param_0) {
|
||||
J3DModel* model = mpModelMorf->getModel();
|
||||
J3DModelData* modelData = model->getModelData();
|
||||
|
||||
mDoMtx_stack_c::transS(current.pos);
|
||||
mDoMtx_stack_c::ZXYrotM(field_0x91a);
|
||||
mDoMtx_stack_c::scaleM(scale);
|
||||
|
||||
model->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
|
||||
if (param_0) {
|
||||
model->setUserArea((u32)this);
|
||||
} else {
|
||||
model->setUserArea(0);
|
||||
}
|
||||
|
||||
if ((field_0x840 & 0x10) && field_0x83c) {
|
||||
u16 tmp = 0;
|
||||
while (field_0x83c[tmp] != 0xFFFF) {
|
||||
mBck.entryJoint(modelData, field_0x83c[tmp], mBck.getFrame());
|
||||
tmp++;
|
||||
}
|
||||
|
||||
mpModelMorf->modelCalc();
|
||||
|
||||
u16 tmp2 = 0;
|
||||
while (field_0x83c[tmp2] != 0xFFFF) {
|
||||
mBck.removeJoint(modelData, field_0x83c[tmp2]);
|
||||
tmp2++;
|
||||
}
|
||||
} else {
|
||||
mpModelMorf->modelCalc();
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014F4A0-8014F4A4 149DE0 0004+00 2/0 0/0 1/0 .text setCollisions__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::setCollisions() {}
|
||||
|
||||
/* 8014F4A4-8014F4A8 149DE4 0004+00 2/0 0/0 1/0 .text setAttnPos__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::setAttnPos() {}
|
||||
|
||||
/* 8014F4A8-8014F4AC 149DE8 0004+00 2/0 0/0 1/0 .text drawOtherMdls__11daBaseNpc_cFv */
|
||||
void daBaseNpc_c::drawOtherMdls() {}
|
||||
|
||||
/* 8014F4AC-8014F4B4 149DEC 0008+00 2/0 0/0 1/0 .text dbgDraw__11daBaseNpc_cFv */
|
||||
bool daBaseNpc_c::dbgDraw() {
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
#include "d/actor/d_a_npc.h"
|
||||
#include "d/d_bg_w.h"
|
||||
|
||||
static void daBaseNpc_incIdx(int i_pathNo, u16* i_pathIdx, int i_pathClosed, int i_pathDirection);
|
||||
static void daBaseNpc_decIdx(int i_pathNo, u16* i_pathIdx, int i_pathClosed, int i_pathDirection);
|
||||
static f32 daNpcBase_BBasis(int i_deg, int i_pntNo, int i_knotNo, int* i_knotVector_p);
|
||||
|
||||
/* 8014F4B4-8014F4F8 149DF4 0044+00 0/0 0/0 1/1 .text __ct__23daBaseNpc_moveBgActor_cFv
|
||||
*/
|
||||
daBaseNpc_moveBgActor_c::daBaseNpc_moveBgActor_c() {
|
||||
mpBgw = 0;
|
||||
}
|
||||
|
||||
/* 8014F4F8-8014F518 149E38 0020+00 1/1 0/0 0/0 .text CheckCreateHeap__FP10fopAc_ac_c */
|
||||
static int CheckCreateHeap(fopAc_ac_c* i_this) {
|
||||
return ((daBaseNpc_moveBgActor_c*)i_this)->MoveBGCreateHeap();
|
||||
}
|
||||
|
||||
/* 80450FE0-80450FE4 0004E0 0004+00 2/2 0/0 0/0 .sbss m_name__23daBaseNpc_moveBgActor_c
|
||||
*/
|
||||
const char* daBaseNpc_moveBgActor_c::m_name;
|
||||
|
||||
/* 80450FE4-80450FE8 0004E4 0004+00 2/2 0/0 0/0 .sbss m_dzb_id__23daBaseNpc_moveBgActor_c
|
||||
*/
|
||||
int daBaseNpc_moveBgActor_c::m_dzb_id;
|
||||
|
||||
/* 80450FE8-80450FEC 0004E8 0004+00 2/2 0/0 0/0 .sbss m_set_func__23daBaseNpc_moveBgActor_c */
|
||||
MoveBGActor_SetFunc daBaseNpc_moveBgActor_c::m_set_func;
|
||||
|
||||
/* 8014F518-8014F60C 149E58 00F4+00 1/1 0/0 0/0 .text
|
||||
* MoveBGCreateHeap__23daBaseNpc_moveBgActor_cFv */
|
||||
int daBaseNpc_moveBgActor_c::MoveBGCreateHeap() {
|
||||
if (!CreateHeap()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_dzb_id == -1) {
|
||||
mpBgw = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mpBgw = new dBgW();
|
||||
|
||||
if (mpBgw != NULL && !mpBgw->Set((cBgD_t*)dComIfG_getObjectRes(m_name, m_dzb_id), 1, &mBgMtx)) {
|
||||
if (m_set_func != NULL) {
|
||||
mpBgw->SetCrrFunc(m_set_func);
|
||||
}
|
||||
} else {
|
||||
mpBgw = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 8014F60C-8014F6FC 149F4C 00F0+00 0/0 0/0 1/1 .text
|
||||
* MoveBGCreate__23daBaseNpc_moveBgActor_cFPCciPFP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz_vUl
|
||||
*/
|
||||
int daBaseNpc_moveBgActor_c::MoveBGCreate(char const* i_arcName, int i_dzbId, MoveBGActor_SetFunc i_setFunc,
|
||||
u32 i_heapSize) {
|
||||
mDoMtx_stack_c::transS(current.pos);
|
||||
mDoMtx_stack_c::YrotM(shape_angle.y);
|
||||
mDoMtx_stack_c::scaleM(scale);
|
||||
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
|
||||
|
||||
m_name = i_arcName;
|
||||
m_dzb_id = i_dzbId;
|
||||
m_set_func = i_setFunc;
|
||||
|
||||
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, i_heapSize)) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mpBgw != NULL && mpBgw->ChkUsed() && mDoCPd_c::isConnect(PAD_3)) {
|
||||
JUT_WARN(2019, "%s", "dBgS_MoveBgActor::MoveBGCreate() Don't Regist CreateHeap\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mpBgw != NULL && dComIfG_Bgsp().Regist(mpBgw, this)) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
// return Create() ? cPhs_COMPLEATE_e : cPhs_ERROR_e; // using enums here changes code gen
|
||||
return Create() ? 4 : 5;
|
||||
}
|
||||
|
||||
/* 8014F6FC-8014F770 14A03C 0074+00 0/0 0/0 1/1 .text MoveBGDelete__23daBaseNpc_moveBgActor_cFv */
|
||||
int daBaseNpc_moveBgActor_c::MoveBGDelete() {
|
||||
int rt = Delete();
|
||||
if (mpBgw != NULL && mpBgw->ChkUsed() && dComIfG_Bgsp().Release(mpBgw)) {
|
||||
OS_REPORT("Release Error\n");
|
||||
}
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
/* 8014F770-8014F81C 14A0B0 00AC+00 0/0 0/0 2/2 .text MoveBGExecute__23daBaseNpc_moveBgActor_cFv
|
||||
*/
|
||||
int daBaseNpc_moveBgActor_c::MoveBGExecute() {
|
||||
Mtx* sp8 = NULL;
|
||||
int rt = Execute(&sp8);
|
||||
|
||||
if (sp8 == NULL) {
|
||||
mDoMtx_stack_c::transS(current.pos);
|
||||
mDoMtx_stack_c::YrotM(shape_angle.y);
|
||||
mDoMtx_stack_c::scaleM(scale);
|
||||
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
|
||||
} else {
|
||||
MTXCopy(*sp8, mBgMtx);
|
||||
}
|
||||
|
||||
if (mpBgw != NULL) {
|
||||
mpBgw->Move();
|
||||
}
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
/* 8014F81C-8014F8C4 14A15C 00A8+00 1/1 0/0 0/0 .text
|
||||
* daBaseNpc_PntVsLineSegmentLengthSquare2D__FffffffPfPfPf */
|
||||
static int daBaseNpc_PntVsLineSegmentLengthSquare2D(f32 param_0, f32 param_1, f32 param_2,
|
||||
f32 param_3, f32 param_4, f32 param_5,
|
||||
f32* param_6, f32* param_7, f32* param_8) {
|
||||
int var_r31 = 0;
|
||||
|
||||
f32 temp_f31 = param_4 - param_2;
|
||||
f32 temp_f30 = param_5 - param_3;
|
||||
f32 temp_f28 = (temp_f31 * temp_f31) + (temp_f30 * temp_f30);
|
||||
if (temp_f28 == 0.0f) {
|
||||
*param_8 = 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 temp_f29 = ((temp_f31 * (param_0 - param_2)) + (temp_f30 * (param_1 - param_3))) / temp_f28;
|
||||
if (0.0f <= temp_f29 && temp_f29 <= 1.0f) {
|
||||
var_r31 = 1;
|
||||
}
|
||||
|
||||
*param_6 = param_2 + (temp_f31 * temp_f29);
|
||||
*param_7 = param_3 + (temp_f30 * temp_f29);
|
||||
*param_8 = ((*param_6 - param_0) * (*param_6 - param_0)) + ((*param_7 - param_1) * (*param_7 - param_1));
|
||||
return var_r31;
|
||||
}
|
||||
|
||||
/* 8014F8C4-8014FB28 14A204 0264+00 1/1 0/0 0/0 .text daBaseNpc_putNurbs__FP4dPntiiP4dPnti */
|
||||
static u16 daBaseNpc_putNurbs(dPnt* i_CPnts, int i_CPntNum, int i_maxPntNum, dPnt* o_curve_p, BOOL i_isClosed) {
|
||||
int knotVector[daBaseNpc_path_c::MAXNUMCONTROLPNT_e + 4];
|
||||
int weights[daBaseNpc_path_c::MAXNUMCONTROLPNT_e];
|
||||
|
||||
int i;
|
||||
int aDeg = 2; // curve degree
|
||||
int aMaxNumCPnt; // max control points
|
||||
if (i_isClosed) {
|
||||
aMaxNumCPnt = i_CPntNum + 1;
|
||||
} else {
|
||||
aMaxNumCPnt = i_CPntNum;
|
||||
}
|
||||
|
||||
JUT_ASSERT(2190, aDeg < aMaxNumCPnt && aMaxNumCPnt < daBaseNpc_path_c::MAXNUMCONTROLPNT_e);
|
||||
JUT_ASSERT(2191, aDeg == 2 || aDeg == 3);
|
||||
|
||||
// create knot vector
|
||||
for (i = 0; i < aDeg + aMaxNumCPnt + 1; i++) {
|
||||
if (aMaxNumCPnt < i) {
|
||||
knotVector[i] = knotVector[i - 1];
|
||||
} else if (aDeg < i) {
|
||||
knotVector[i] = knotVector[i - 1] + 10;
|
||||
} else {
|
||||
knotVector[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize weights
|
||||
for (i = 0; i < aMaxNumCPnt; i++) {
|
||||
weights[i] = 1;
|
||||
}
|
||||
|
||||
int cur_knot;
|
||||
u16 out_pnt_no;
|
||||
for (out_pnt_no = 0, cur_knot = knotVector[aDeg]; cur_knot < knotVector[aDeg + aMaxNumCPnt]; cur_knot += 2, out_pnt_no++) {
|
||||
if (i_maxPntNum <= out_pnt_no) {
|
||||
break;
|
||||
}
|
||||
|
||||
o_curve_p[out_pnt_no].m_position.x = 0.0f;
|
||||
o_curve_p[out_pnt_no].m_position.z = 0.0f;
|
||||
|
||||
f32 total_weight = 0.0f;
|
||||
for (i = 0; i < aMaxNumCPnt; i++) {
|
||||
f32 basis = daNpcBase_BBasis(aDeg, i, cur_knot, knotVector);
|
||||
if (i == i_CPntNum) {
|
||||
o_curve_p[out_pnt_no].m_position.x += i_CPnts[0].m_position.x * basis;
|
||||
o_curve_p[out_pnt_no].m_position.z += i_CPnts[0].m_position.z * basis;
|
||||
} else {
|
||||
o_curve_p[out_pnt_no].m_position.x += i_CPnts[i].m_position.x * basis;
|
||||
o_curve_p[out_pnt_no].m_position.z += i_CPnts[i].m_position.z * basis;
|
||||
}
|
||||
|
||||
total_weight += basis * weights[i];
|
||||
}
|
||||
|
||||
o_curve_p[out_pnt_no].m_position.x /= total_weight;
|
||||
o_curve_p[out_pnt_no].m_position.z /= total_weight;
|
||||
}
|
||||
|
||||
// add final point for open curves
|
||||
if (!i_isClosed) {
|
||||
o_curve_p[out_pnt_no].m_position.x = i_CPnts[i_CPntNum - 1].m_position.x;
|
||||
o_curve_p[out_pnt_no].m_position.z = i_CPnts[i_CPntNum - 1].m_position.z;
|
||||
out_pnt_no++;
|
||||
}
|
||||
|
||||
return out_pnt_no;
|
||||
}
|
||||
|
||||
/* 8014FB28-80150230 14A468 0708+00 1/1 0/0 0/0 .text daBaseNpc_chkPnt__F4cXyzP4dPntUsUsii */
|
||||
static s32 daBaseNpc_chkPnt(cXyz param_0, dPnt* param_1, u16 param_2, u16 param_3, int param_4,
|
||||
int param_5) {
|
||||
u16 sp12, sp10;
|
||||
sp10 = param_2;
|
||||
sp12 = param_2;
|
||||
daBaseNpc_incIdx(param_3, &sp10, param_4, 1);
|
||||
daBaseNpc_decIdx(param_3, &sp12, param_4, 1);
|
||||
|
||||
cXyz sp70;
|
||||
cXyz sp64(param_1[sp12].m_position.x, param_1[sp12].m_position.y, param_1[sp12].m_position.z);
|
||||
cXyz sp58(param_1[param_2].m_position.x, param_1[param_2].m_position.y, param_1[param_2].m_position.z);
|
||||
cXyz sp4C(param_1[sp10].m_position.x, param_1[sp10].m_position.y, param_1[sp10].m_position.z);
|
||||
|
||||
f32 sp24;
|
||||
if (sp12 == param_2 && param_2 == sp10) {
|
||||
JUT_ASSERT(2288, 0);
|
||||
} else if (sp12 < param_2 && param_2 < sp10) {
|
||||
sp24 = (sp4C - sp64).absXZ();
|
||||
s16 temp_r31 = cM_atan2s(sp4C.x - sp64.x, sp4C.z - sp64.z);
|
||||
|
||||
sp70 = sp64;
|
||||
sp64.x = sp70.x + (-1.0f * sp24 * cM_ssin(temp_r31));
|
||||
sp64.z = sp70.z + (-1.0f * sp24 * cM_scos(temp_r31));
|
||||
sp4C.x = sp70.x + (2.0f * sp24 * cM_ssin(temp_r31));
|
||||
sp4C.z = sp70.z + (2.0f * sp24 * cM_scos(temp_r31));
|
||||
} else if (sp12 < param_2) {
|
||||
sp24 = (sp58 - sp64).absXZ();
|
||||
s16 temp_r31_2 = cM_atan2s(sp58.x - sp64.x, sp58.z - sp64.z);
|
||||
|
||||
sp70 = sp58;
|
||||
sp64.x = sp70.x + (-2.0f * sp24 * cM_ssin(temp_r31_2));
|
||||
sp64.z = sp70.z + (-2.0f * sp24 * cM_scos(temp_r31_2));
|
||||
sp4C.x = sp70.x + (2.0f * sp24 * cM_ssin(temp_r31_2));
|
||||
sp4C.z = sp70.z + (2.0f * sp24 * cM_scos(temp_r31_2));
|
||||
} else if (param_2 < sp10) {
|
||||
sp24 = (sp4C - sp58).absXZ();
|
||||
s16 temp_r31_3 = cM_atan2s(sp4C.x - sp58.x, sp4C.z - sp58.z);
|
||||
|
||||
sp70 = sp58;
|
||||
sp64.x = sp70.x + (-2.0f * sp24 * cM_ssin(temp_r31_3));
|
||||
sp64.z = sp70.z + (-2.0f * sp24 * cM_scos(temp_r31_3));
|
||||
sp4C.x = sp70.x + (2.0f * sp24 * cM_ssin(temp_r31_3));
|
||||
sp4C.z = sp70.z + (2.0f * sp24 * cM_scos(temp_r31_3));
|
||||
} else {
|
||||
JUT_ASSERT(2322, 0);
|
||||
}
|
||||
|
||||
f32 sp20;
|
||||
f32 sp1C;
|
||||
f32 sp18;
|
||||
f32 sp14;
|
||||
|
||||
daBaseNpc_PntVsLineSegmentLengthSquare2D(param_0.x, param_0.z, sp64.x, sp64.z, sp4C.x, sp4C.z, &sp20, &sp1C, &sp24);
|
||||
|
||||
if (cM3d_IsZero(sp24)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
daBaseNpc_PntVsLineSegmentLengthSquare2D(sp58.x, sp58.z, sp64.x, sp64.z, sp4C.x, sp4C.z, &sp18, &sp14, &sp24);
|
||||
|
||||
s16 var_r31;
|
||||
if (param_5 < 0) {
|
||||
var_r31 = cM_atan2s(sp64.x - sp4C.x, sp64.z - sp4C.z);
|
||||
} else {
|
||||
var_r31 = cM_atan2s(sp4C.x - sp64.x, sp4C.z - sp64.z);
|
||||
}
|
||||
|
||||
return 0x4000 - (u16)abs((s16)(var_r31 - cM_atan2s(sp18 - sp20, sp14 - sp1C))) < 0;
|
||||
}
|
||||
|
||||
/* 80150230-801502EC 14AB70 00BC+00 1/1 0/0 0/0 .text daBaseNpc_getGroundAngle__FP13cBgS_PolyInfos
|
||||
*/
|
||||
static s16 daBaseNpc_getGroundAngle(cBgS_PolyInfo* param_0, s16 param_1) {
|
||||
if (dComIfG_Bgsp().ChkPolySafe(*param_0)) {
|
||||
cM3dGPla spC;
|
||||
if (!dComIfG_Bgsp().GetTriPla(*param_0, &spC) || !cBgW_CheckBGround(spC.mNormal.y)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return fopAcM_getPolygonAngle(&spC, param_1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -372,11 +372,11 @@ int daNpc_FairySeirei_c::talk(int param_0) {
|
||||
}
|
||||
int itemNo;
|
||||
if ((int)mFlow.getEventId(&itemNo) == 1) {
|
||||
if (mItemId == -1) {
|
||||
mItemId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1, -1, NULL,
|
||||
if (mItemPartnerId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemPartnerId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1, -1, NULL,
|
||||
NULL);
|
||||
}
|
||||
if (fopAcM_IsExecuting(mItemId)) {
|
||||
if (fopAcM_IsExecuting(mItemPartnerId)) {
|
||||
mTalking = TRUE;
|
||||
evtChange();
|
||||
}
|
||||
|
||||
@@ -1306,7 +1306,7 @@ int daNpc_Hanjo_c::cutPursuitBee(int param_1) {
|
||||
break;
|
||||
case 3:
|
||||
mJntAnm.lookNone(0);
|
||||
if (field_0x10e8.getDstPosH(current.pos, &cStack_6c, field_0x10e8.mpRoomPath->m_num, 4)) {
|
||||
if (field_0x10e8.getDstPosH(current.pos, &cStack_6c, field_0x10e8.mPathInfo->m_num, 4)) {
|
||||
rv = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ void daNpc_Uri_c::reset() {
|
||||
cStack_44 = mPath.getPntPos(1);
|
||||
setPos(acStack_38);
|
||||
cStack_a0.y = cLib_targetAngleY(&acStack_38, &cStack_44);
|
||||
mPath.setNextIdx(mPath.mpRoomPath->m_num);
|
||||
mPath.setNextIdx(mPath.mPathInfo->m_num);
|
||||
}
|
||||
if (daNpcT_chkEvtBit(0x20) != 0 || daNpcT_chkEvtBit(0x1e) != 0 ||
|
||||
daNpcT_chkEvtBit(0x92) != 0)
|
||||
@@ -955,7 +955,7 @@ int daNpc_Uri_c::getTutorialCond(cXyz param_1) {
|
||||
cXyz local_50;
|
||||
cXyz cStack_5c;
|
||||
|
||||
local_44 = mPath.getPntPos(mPath.mpRoomPath->m_num - 1);
|
||||
local_44 = mPath.getPntPos(mPath.mPathInfo->m_num - 1);
|
||||
if (local_44.absXZ(param_1) < daNpc_Uri_Param_c::m.field_0x98) {
|
||||
return 9;
|
||||
}
|
||||
@@ -1137,7 +1137,7 @@ int daNpc_Uri_c::cutEndCarryTutorial(int param_1) {
|
||||
break;
|
||||
case 2:
|
||||
initTalk(19, NULL);
|
||||
mItemId = -1;
|
||||
mItemPartnerId = fpcM_ERROR_PROCESS_ID_e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1154,11 +1154,11 @@ int daNpc_Uri_c::cutEndCarryTutorial(int param_1) {
|
||||
if (talkProc(NULL, 0, NULL, 0) && mFlow.checkEndFlow() &&
|
||||
(s32)mFlow.getEventId(&local_48) == 1)
|
||||
{
|
||||
if (mItemId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemId =
|
||||
if (mItemPartnerId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemPartnerId =
|
||||
fopAcM_createItemForPresentDemo(¤t.pos, local_48, 0, -1, -1, NULL, NULL);
|
||||
}
|
||||
if (fopAcM_IsExecuting(mItemId)) {
|
||||
if (fopAcM_IsExecuting(mItemPartnerId)) {
|
||||
daNpcT_offTmpBit(7);
|
||||
daNpcT_offTmpBit(10);
|
||||
daNpcT_offTmpBit(0x20);
|
||||
@@ -1385,7 +1385,7 @@ int daNpc_Uri_c::krun(void* param_0) {
|
||||
mJntAnm.lookNone(0);
|
||||
if (field_0xfec == 0) {
|
||||
cXyz cStack_58;
|
||||
int iVar2 = mPath.getDstPosH(current.pos, &cStack_58, mPath.mpRoomPath->m_num, 4);
|
||||
int iVar2 = mPath.getDstPosH(current.pos, &cStack_58, mPath.mPathInfo->m_num, 4);
|
||||
|
||||
calcSpeedAndAngle(cStack_58, iVar2, 6, 0x800);
|
||||
if (iVar2 != 0 && cM3d_IsZero(speedF)) {
|
||||
@@ -1616,7 +1616,7 @@ int daNpc_Uri_c::walk(void* param_0) {
|
||||
}
|
||||
if (!mStagger.checkStagger()) {
|
||||
cXyz cStack_84;
|
||||
int iVar2 = mPath.getDstPosH(current.pos, &cStack_84, mPath.mpRoomPath->m_num, 4);
|
||||
int iVar2 = mPath.getDstPosH(current.pos, &cStack_84, mPath.mPathInfo->m_num, 4);
|
||||
if (iVar2) {
|
||||
bVar = TRUE;
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ BOOL daNpc_zrA_Path_c::getDstPosDstXZ(cXyz i_pos, cXyz& o_pnt) {
|
||||
/* 80B78CA0-80B78CFC 000880 005C+00 1/1 0/0 0/0 .text chkPassedChase__16daNpc_zrA_Path_cFUs4cXyz
|
||||
*/
|
||||
BOOL daNpc_zrA_Path_c::chkPassedChase(u16 i_idx, cXyz i_pos) {
|
||||
return daNpcF_chkPassed(i_pos, (dPnt*)mpRoomPath->m_points, i_idx,
|
||||
mpRoomPath->m_num, mIsClosed, mIsReversed);
|
||||
return daNpcF_chkPassed(i_pos, (dPnt*)mPathInfo->m_points, i_idx,
|
||||
mPathInfo->m_num, mIsClosed, mIsReversed);
|
||||
}
|
||||
|
||||
/* 80B78CFC-80B78E08 0008DC 010C+00 1/1 0/0 0/0 .text
|
||||
@@ -253,7 +253,7 @@ int daNpc_zrA_Path_c::getDstPosChase(u16 i_idx, cXyz i_pos, cXyz& o_pnt) {
|
||||
/* 80B78E08-80B7956C 0009E8 0764+00 1/1 0/0 0/0 .text chkPassDst__16daNpc_zrA_Path_cFUs4cXyz */
|
||||
f32 daNpc_zrA_Path_c::chkPassDst(u16 i_idx, cXyz i_pos) {
|
||||
u16 prev_idx, next_idx;
|
||||
dPnt* points = mpRoomPath->m_points;
|
||||
dPnt* points = mPathInfo->m_points;
|
||||
u16 idx = mIdx;
|
||||
u8 reversed = mIsReversed;
|
||||
mIdx = i_idx;
|
||||
|
||||
@@ -940,12 +940,12 @@ int dShopSystem_c::seq_start(fopAc_ac_c* actor, dMsgFlow_c* i_flow) {
|
||||
if (i_flow->doFlow(actor, NULL, 0)) {
|
||||
int itemNo;
|
||||
if (mFlow.getEventId(&itemNo) == 1) {
|
||||
if (mItemId == -1) {
|
||||
mItemId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1,
|
||||
if (mItemPartnerId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemPartnerId = fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1,
|
||||
-1, NULL, NULL);
|
||||
}
|
||||
|
||||
if (fpcEx_IsExist(mItemId)) {
|
||||
if (fpcEx_IsExist(mItemPartnerId)) {
|
||||
mEvtNo = 1;
|
||||
evtChange();
|
||||
return 1;
|
||||
@@ -1244,12 +1244,12 @@ int dShopSystem_c::seq_decide_yes(fopAc_ac_c* actor, dMsgFlow_c* i_flow) {
|
||||
int itemNo;
|
||||
if (mFlow.getEventId(&itemNo) == 1) {
|
||||
if (i_flow->doFlow(actor, NULL, 0)) {
|
||||
if (mItemId == -1) {
|
||||
mItemId =
|
||||
if (mItemPartnerId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemPartnerId =
|
||||
fopAcM_createItemForPresentDemo(¤t.pos, itemNo, 0, -1, -1, NULL, NULL);
|
||||
}
|
||||
|
||||
if (fpcEx_IsExist(mItemId)) {
|
||||
if (fpcEx_IsExist(mItemPartnerId)) {
|
||||
offFlag(8);
|
||||
setSoldOutItemHide();
|
||||
mEvtNo = 1;
|
||||
|
||||
Reference in New Issue
Block a user