mirror of
https://github.com/zeldaret/tp
synced 2026-09-07 03:10:11 -04:00
Fix a bunch of compiler warnings and document several more bugs (#3130)
This commit is contained in:
@@ -15712,7 +15712,7 @@ int daAlink_c::procMoveTurnInit(int param_0) {
|
||||
dComIfGp_setPlayerStatus0(0, 0x800);
|
||||
|
||||
if (param_0 != 0) {
|
||||
mProcVar3.field_0x300e = (mpHIO->mMove.m.mMaxTurnAngle * 4) + 19030;
|
||||
mProcVar3.field_0x300e = (s16)((mpHIO->mMove.m.mMaxTurnAngle * 4) + 19030);
|
||||
mProcVar4.field_0x3010 = mpHIO->mMove.m.mMaxTurnAngle * 2;
|
||||
mProcVar1.field_0x300a = 2;
|
||||
current.angle.y = mMoveAngle;
|
||||
|
||||
@@ -1872,7 +1872,7 @@ static void demo_camera(b_bq_class* i_this) {
|
||||
spFC.set(BREG_F(5) + -30.0f, 0.0f, BREG_F(6) + 1938.0f);
|
||||
}
|
||||
|
||||
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&spFC, BREG_S(5) + 0x8000, 0);
|
||||
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&spFC, (s16)(BREG_S(5) + 0x8000), 0);
|
||||
|
||||
if (i_this->field_0x5c8 != 0) {
|
||||
i_this->field_0x5cc.y += i_this->field_0x5d8;
|
||||
|
||||
@@ -1325,6 +1325,7 @@ void daB_MGN_c::executeDash() {
|
||||
}
|
||||
|
||||
if (mMoveMode == 11) {
|
||||
// @bug - parenthesis should not be on the condition
|
||||
if (abs((s16)(angle - field_0xa90) < 0x1800) != 0) {
|
||||
if ((s16)(angle - field_0xa90) < 0) {
|
||||
angle = field_0xa90 - 0x1800;
|
||||
|
||||
@@ -881,7 +881,7 @@ void daBgObj_c::setParticle() {
|
||||
for (; partNum != 0; partNum--) {
|
||||
u32 flags = *partBlockItems++;
|
||||
u16 res_id = *partBlockItems;
|
||||
*partBlockItems++;
|
||||
partBlockItems++;
|
||||
|
||||
GXColor prmColor = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
GXColor envColor = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
@@ -254,7 +254,7 @@ BOOL daBdoor_c::checkArea() {
|
||||
if (fabsf(vec.z) > 100.0f) {
|
||||
return false;
|
||||
}
|
||||
return (s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000 ? 1 : 0;
|
||||
return (s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000 ? 1 : 0;
|
||||
}
|
||||
|
||||
BOOL daBdoor_c::checkFront() {
|
||||
|
||||
@@ -825,7 +825,7 @@ int daBdoorL1_c::checkArea() {
|
||||
if (fabsf(local_48.z) > 100.0f) {
|
||||
return 0;
|
||||
}
|
||||
if ((s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000) {
|
||||
if ((s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -348,7 +348,7 @@ int daBdoorL5_c::checkArea() {
|
||||
if (fabsf(local_48.z) > 100.0f) {
|
||||
return 0;
|
||||
}
|
||||
if ((s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000) {
|
||||
if ((s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -1318,7 +1318,7 @@ int daMBdoorL1_c::checkArea() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((s16)fabs(angle - 0x7fff - player->current.angle.y) > 0x4000) {
|
||||
if ((s16)fabs((f64)(angle - 0x7fff - player->current.angle.y)) > 0x4000) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
|
||||
@@ -1934,7 +1934,13 @@ int daE_HZ_c::CreateHeap() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
|
||||
// string in this TU's .data section, but comparing against a string literal is still UB.
|
||||
#if AVOID_UB
|
||||
if (strcmp(mpName, "E_hzp") == 0) {
|
||||
#else
|
||||
if (mpName == "E_hzp") {
|
||||
#endif
|
||||
modelData = (J3DModelData*)dComIfG_getObjectRes(mpName, 3);
|
||||
} else {
|
||||
modelData = (J3DModelData*)dComIfG_getObjectRes(mpName, 3);
|
||||
|
||||
@@ -496,6 +496,7 @@ static s8 e_kr_path_move(e_kr_class* i_this) {
|
||||
if (totalDiff < 10.0f * TREG_F(10) + 300.0f) {
|
||||
point = &i_this->field_0x6e4->m_points[i_this->field_0x6e2];
|
||||
u8 pointArg1 = point->mArg1;
|
||||
// !@bug Comparison of u8 with -1 will always evaluate to false
|
||||
if (pointArg1 == -1) {
|
||||
i_this->field_0x684 = 50.0f * 1.2f;
|
||||
} else {
|
||||
|
||||
@@ -370,7 +370,7 @@ static void e_mm_mt_drop(e_mm_mt_class* i_this) {
|
||||
i_this->enemy.speed.y += -5.0f;
|
||||
i_this->enemy.eyePos = i_this->enemy.current.pos;
|
||||
i_this->enemy.attention_info.position = i_this->enemy.current.pos;
|
||||
cLib_addCalcAngleS2(&i_this->m_rotation.z, (TREG_S(6)+0x10000)-0x8000, 1, 0x1000);
|
||||
cLib_addCalcAngleS2(&i_this->m_rotation.z, (s16)((TREG_S(6) + 0x10000) - 0x8000), 1, 0x1000);
|
||||
cLib_onBit<u32>(i_this->enemy.attention_info.flags, fopAc_AttnFlag_CARRY_e);
|
||||
i_this->enemy.attention_info.distances[fopAc_attn_CARRY_e] = 7;
|
||||
i_this->m_rotation.y += i_this->m_spin;
|
||||
|
||||
@@ -724,7 +724,13 @@ void daE_OC_c::damage_check() {
|
||||
} else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_40)) {
|
||||
S16_ADD(health, 10);
|
||||
} else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) {
|
||||
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
|
||||
// string in this TU's .data section, but comparing against a string literal is still UB.
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
S16_SUB(health, 5);
|
||||
if (health < 0) {
|
||||
health = 0;
|
||||
@@ -855,7 +861,12 @@ void daE_OC_c::setDashSound() {
|
||||
} else if (mpMorf->checkFrame(8.5f)) {
|
||||
mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1);
|
||||
}
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
mSound.startCreatureSoundLevel(Z2SE_EN_OC_CLUB_DAGGLE, 0, -1);
|
||||
} else {
|
||||
mSound.startCreatureSoundLevel(Z2SE_EN_OC_NATA_DAGGLE, 0, -1);
|
||||
@@ -1421,7 +1432,12 @@ void daE_OC_c::executeAttack() {
|
||||
} else if (mpMorf->checkFrame(12.5f)) {
|
||||
mSound.startCreatureSound(Z2SE_EN_OC_ATTACK_B, 0, -1);
|
||||
} else if (mpMorf->checkFrame(19.0f)) {
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
mSound.startCreatureSound(Z2SE_EN_OC_CLUB_HIT, 0, -1);
|
||||
} else {
|
||||
mSound.startCreatureSound(Z2SE_EN_OC_NATA_HIT, 0, -1);
|
||||
@@ -1843,7 +1859,12 @@ void daE_OC_c::executeDeath() {
|
||||
case 2:
|
||||
cLib_chaseF(&speedF, 0.0f, 1.0f);
|
||||
if (field_0x6c0 == 0) {
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
fopAcM_createDisappear(this, ¤t.pos, 10, 0, 4);
|
||||
} else {
|
||||
fopAcM_createDisappear(this, ¤t.pos, 10, 0, 0x34);
|
||||
@@ -1917,7 +1938,12 @@ void daE_OC_c::executeWaterDeath() {
|
||||
}
|
||||
|
||||
if (mpMorf->isStop()) {
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
fopAcM_createDisappear(this, ¤t.pos, 10, 0, 4);
|
||||
} else {
|
||||
fopAcM_createDisappear(this, ¤t.pos, 10, 0, 0x34);
|
||||
@@ -2741,7 +2767,12 @@ cPhs_Step daE_OC_c::create() {
|
||||
mAcchCir.SetWallH(70.0f);
|
||||
}
|
||||
mAcchCir.SetWallR(100.0f);
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
field_0x560 = health = 40;
|
||||
} else {
|
||||
field_0x560 = health = 220;
|
||||
@@ -2756,7 +2787,12 @@ cPhs_Step daE_OC_c::create() {
|
||||
mSphs_at[0].SetStts(&mStts);
|
||||
mSphs_at[1].Set(E_OC_n::at_sph_src);
|
||||
mSphs_at[1].SetStts(&mStts);
|
||||
// See comment in damage_check
|
||||
#if AVOID_UB
|
||||
if (strcmp(mName, "E_OC") == 0) {
|
||||
#else
|
||||
if (mName == "E_OC") {
|
||||
#endif
|
||||
mSphs_at[0].SetAtAtp(1);
|
||||
mSphs_at[1].SetAtAtp(1);
|
||||
fopAcM_OnStatus(this, fopAcStts_UNK_0x10000_e);
|
||||
|
||||
@@ -2155,7 +2155,7 @@ static void e_rdy_damage(e_rdy_class* i_this) {
|
||||
|
||||
case 1:
|
||||
if (i_this->mAcch.ChkWallHit() && i_this->mTimer[0] == 0) {
|
||||
if (check = kado_check(i_this)) {
|
||||
if ((check = kado_check(i_this))) {
|
||||
OS_REPORT(" ..KADO KABE ..%x\n", check);
|
||||
if (check == 2) {
|
||||
i_this->field_0xac6 = 0x1000;
|
||||
@@ -4721,7 +4721,7 @@ static int daE_RDY_Execute(e_rdy_class* i_this) {
|
||||
}
|
||||
MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(JNT_HAND_R), *calc_mtx);
|
||||
MtxTrans(20.0f + NREG_F(0), 5.0f + NREG_F(1), -10.0f + NREG_F(2), 1);
|
||||
cMtx_XrotM(*calc_mtx, NREG_S(0) + 0x8000);
|
||||
cMtx_XrotM(*calc_mtx, (s16)(NREG_S(0) + 0x8000));
|
||||
cMtx_YrotM(*calc_mtx, NREG_S(1) + ang_y + -0x15cd);
|
||||
cMtx_ZrotM(*calc_mtx, NREG_S(2) + 0x28cd);
|
||||
i_this->mpHawkGrassModel->setBaseTRMtx(*calc_mtx);
|
||||
|
||||
@@ -1100,7 +1100,7 @@ static void e_wb_f_run(e_wb_class* i_this) {
|
||||
} else {
|
||||
e_rd_class* local_90 = (e_rd_class*)fopAcM_SearchByID(i_this->rd_id);
|
||||
int saku;
|
||||
if (saku = e_wb_saku_check(i_this)) {
|
||||
if ((saku = e_wb_saku_check(i_this))) {
|
||||
i_this->field_0x6d4 = 60;
|
||||
if ((saku & 2) != 0) {
|
||||
i_this->field_0x6d6 = 0x3000;
|
||||
|
||||
@@ -1235,7 +1235,7 @@ static int daE_YG_Execute(e_yg_class* i_this) {
|
||||
MTXCopy(daPy_getLinkPlayerActorClass()->getWolfMouthMatrix(), mDoMtx_stack_c::get());
|
||||
mDoMtx_stack_c::multVecZero(&actor->current.pos);
|
||||
mDoMtx_stack_c::YrotM(KREG_S(0));
|
||||
mDoMtx_stack_c::XrotM(KREG_S(1) + 0x8000);
|
||||
mDoMtx_stack_c::XrotM((s16)(KREG_S(1) + 0x8000));
|
||||
mDoMtx_stack_c::ZrotM(KREG_S(2) + 2500);
|
||||
mDoMtx_stack_c::transM(KREG_F(0) + 10.0f, KREG_F(1) + -60.0f, KREG_F(2) + -20.0f);
|
||||
model->setBaseTRMtx(mDoMtx_stack_c::get());
|
||||
|
||||
@@ -1930,7 +1930,7 @@ static void eff_set(e_yh_class* i_this) {
|
||||
dComIfGp_particle_set(i_this->mParticleIds2[2], dPa_RM(ID_ZI_S_YD_YODAHIT_A),
|
||||
&a_this->current.pos, 0, NULL);
|
||||
{
|
||||
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleIds[5]);
|
||||
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleIds2[2]);
|
||||
if (emitter != NULL) {
|
||||
MTXCopy(model->getAnmMtx(1), *calc_mtx);
|
||||
emitter->setGlobalRTMatrix(*calc_mtx);
|
||||
|
||||
@@ -516,7 +516,7 @@ void daE_YMB_c::checkWaterPos() {
|
||||
field_0x6cc = wtr_pos;
|
||||
field_0x69c.y = wtr_pos + 1000.0f + l_HIO.fly_height_adjust;
|
||||
|
||||
std::fabsf(field_0x6cc - current.pos.y);
|
||||
UNUSED(std::fabsf(field_0x6cc - current.pos.y));
|
||||
if (current.pos.y < (200.0f + field_0x6cc)) {
|
||||
if (field_0x715 == 0) {
|
||||
setWaterEffect1();
|
||||
|
||||
@@ -542,7 +542,7 @@ bool daE_ZH_c::mBallBgLineCheck() {
|
||||
bool daE_ZH_c::mSearchMove(u8 param_1) {
|
||||
if (mS_Ball == NULL) {
|
||||
setActionMode(ACTION_EXECUTE_FLY_DELETE, 0);
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
cXyz sp50, sp5c;
|
||||
|
||||
@@ -51,9 +51,10 @@
|
||||
#define ANM_HS_WALK_FAST 34
|
||||
#define ANM_HS_WALK_SLOW 35
|
||||
|
||||
static f32* strippedFunc() {
|
||||
f32 v[3] = {};
|
||||
return v;
|
||||
static void strippedFunc() {
|
||||
extern void F(f32*);
|
||||
f32 v[3] = {0.0f};
|
||||
F(v);
|
||||
}
|
||||
|
||||
static char const l_arcName[] = "Horse";
|
||||
|
||||
@@ -2977,8 +2977,8 @@ static void hook_set(dmg_rod_class* i_this, cXyz* param_1, int param_2) {
|
||||
mDoMtx_stack_c::XrotM(-0x4000);
|
||||
|
||||
if (param_2 == 1 && (i_this->action <= ACTION_LURE_STANDBY || (i_this->lure_type != MG_LURE_SP && i_this->action == ACTION_LURE_CATCH))) {
|
||||
sp38.x = fabsf(hook->field_0x18.y);
|
||||
sp38.z = fabsf(hook->field_0x18.x - 0x4000);
|
||||
sp38.x = fabsf((f32)hook->field_0x18.y);
|
||||
sp38.z = fabsf((f32)(hook->field_0x18.x - 0x4000));
|
||||
|
||||
f32 var_f31 = JMAFastSqrt(SQUARE(sp38.x) + SQUARE(sp38.z));
|
||||
if (var_f31 > 7000.0f) {
|
||||
|
||||
@@ -986,7 +986,7 @@ BOOL daNbomb_c::procWait() {
|
||||
speedF *= player->getBombBoundRate();
|
||||
current.angle.y = (mAcchCir.GetWallAngleY() * 2) - (current.angle.y + 0x8000);
|
||||
} else if (mAcch.ChkGroundLanding() && speedF > 5.0f && cM_deg2s(50.0f) <= field_0xb5a) {
|
||||
if ((f32)fabs(var_r28) >= (f32)0x4000) {
|
||||
if ((f32)fabs((f64)var_r28) >= (f32)0x4000) {
|
||||
speedF *= player->getBombBoundRate();
|
||||
current.angle.y = (var_r27 * 2) - (current.angle.y + 0x8000);
|
||||
mAcch.ClrGroundLanding();
|
||||
|
||||
@@ -544,7 +544,7 @@ 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 == (fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e)) {
|
||||
} else if (mFlowID >= 0 && attention_info.flags == (fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e)) {
|
||||
eventInfo.onCondition(1);
|
||||
if (param_0 != 0) {
|
||||
fopAcM_orderSpeakEvent(this, 0, 0);
|
||||
|
||||
@@ -635,7 +635,7 @@ void daNpc_Bou_c::action() {
|
||||
|
||||
hit_actor = field_0xba0.getActorP();
|
||||
if (hit_actor != NULL) {
|
||||
abs( (s16)(fopAcM_searchPlayerAngleY(this) - mCurAngle.y) );
|
||||
UNUSED(abs((s16)(fopAcM_searchPlayerAngleY(this) - mCurAngle.y)));
|
||||
switch (((daTag_Push_c*) hit_actor)->getId()) {
|
||||
case 7: {
|
||||
mEvtNo = 8;
|
||||
|
||||
@@ -2628,7 +2628,7 @@ BOOL daNpcChat_c::setAttention(int param_1) {
|
||||
cXyz(0.0f, 10.0f, 0.0f),
|
||||
};
|
||||
|
||||
int jointNo = isM_() ? JNTM_HEAD : JNTW_HEAD;
|
||||
int jointNo = isM_() ? (int)JNTM_HEAD : (int)JNTW_HEAD;
|
||||
mDoMtx_stack_c::copy(mAnm_p->getModel()->getAnmMtx(jointNo));
|
||||
mDoMtx_stack_c::multVec(&a_eyeOfsTbl[param_1], &eyePos);
|
||||
mBaseAttnPos.set(current.pos.x, current.pos.y + AtnOfs(param_1), current.pos.z);
|
||||
|
||||
@@ -517,8 +517,7 @@ BOOL daNpcChPath_c::setPath(int path_index, int room_no, cXyz& i_vec, bool param
|
||||
mCurrentID = path_index;
|
||||
mPntIndex = 0;
|
||||
|
||||
// Is this really what the Nintendo devs wrote?? The debug ROM suggests as such.
|
||||
if (param_4 && &i_vec) {
|
||||
if (param_4 && IS_REF_NONNULL(i_vec)) {
|
||||
f32 fVar1 = G_CM3D_F_INF;
|
||||
for (int pnt_index = 0; pnt_index < mpPath->m_num; pnt_index++) {
|
||||
dPnt* pnt = dPath_GetPnt(mpPath, pnt_index);
|
||||
@@ -534,8 +533,7 @@ BOOL daNpcChPath_c::setPath(int path_index, int room_no, cXyz& i_vec, bool param
|
||||
|
||||
field_0x8 = G_CM3D_F_INF;
|
||||
|
||||
// ditto.
|
||||
if (&i_vec) {
|
||||
if (IS_REF_NONNULL(i_vec)) {
|
||||
field_0x4 = &i_vec;
|
||||
cXyz targetPoint;
|
||||
getTargetPoint(targetPoint);
|
||||
|
||||
@@ -343,10 +343,13 @@ BOOL daNpc_grA_c::create() {
|
||||
mType = getTypeFromParam();
|
||||
mMode = getMode();
|
||||
mSwBit = getSwBit();
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
field_0x146C = home.angle.x;
|
||||
mFlowID = home.angle.x;
|
||||
} else{
|
||||
field_0x146C = -1;
|
||||
mFlowID = -1;
|
||||
}
|
||||
if (isDelete()) {
|
||||
return cPhs_ERROR_e;
|
||||
@@ -2146,7 +2149,7 @@ BOOL daNpc_grA_c::ECut_talkSpa(int i_staffID) {
|
||||
setLookMode(5);
|
||||
break;
|
||||
case 1:
|
||||
initTalk(field_0x146C, arr);
|
||||
initTalk(mFlowID, arr);
|
||||
break;
|
||||
case 2:
|
||||
if (daNpcF_chkEvtBit(6) && daNpcF_chkEvtBit(0x3e) == FALSE) {
|
||||
@@ -3020,7 +3023,7 @@ BOOL daNpc_grA_c::ECut_rollRockCrash(int i_staffID) {
|
||||
break;
|
||||
case 0x14: {
|
||||
setLookMode(0);
|
||||
initTalk(field_0x146C, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
cXyz c(200.0f, 100.0f, 0.0f);
|
||||
mDoMtx_stack_c::YrotS(home.angle.y);
|
||||
mDoMtx_stack_c::multVec(&c, &c);
|
||||
@@ -3588,7 +3591,7 @@ BOOL daNpc_grA_c::waitSpaWater(void*) {
|
||||
}
|
||||
setLookMode(0);
|
||||
mTurnMode = 0;
|
||||
field_0x146C = 0x28;
|
||||
mFlowID = 0x28;
|
||||
field_0x1472 = 2;
|
||||
field_0x9ea = 1;
|
||||
// fallthrough
|
||||
@@ -3968,7 +3971,7 @@ BOOL daNpc_grA_c::talk(void*) {
|
||||
setGateWalk();
|
||||
}
|
||||
} else {
|
||||
r27 = field_0x146C;
|
||||
r27 = mFlowID;
|
||||
}
|
||||
initTalk(r27, NULL);
|
||||
field_0x1484 = fopAcM_searchPlayerAngleY(this);
|
||||
|
||||
@@ -308,6 +308,9 @@ cPhs_Step daNpc_grC_c::create() {
|
||||
mTwilight = dKy_darkworld_check();
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -172,6 +172,9 @@ int daNpc_Grd_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -396,6 +396,9 @@ cPhs_Step daNpc_grO_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mMsgNo = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -264,6 +264,9 @@ cPhs_Step daNpc_grR_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -138,10 +138,13 @@ int daNpc_grS_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
field_0xe0c = home.angle.x;
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
field_0xe0c = -1;
|
||||
mFlowID = -1;
|
||||
}
|
||||
|
||||
if (isDelete()) {
|
||||
@@ -856,7 +859,7 @@ int daNpc_grS_c::selectAction() {
|
||||
mpNextActionFn = &daNpc_grS_c::test;
|
||||
}
|
||||
else {
|
||||
(int)mType;
|
||||
UNUSED((int)mType);
|
||||
mpNextActionFn = &daNpc_grS_c::wait;
|
||||
}
|
||||
|
||||
@@ -936,7 +939,7 @@ int daNpc_grS_c::doEvent() {
|
||||
if (eventInfo.checkCommandDemoAccrpt() && mEventIdx != -1 &&
|
||||
eventManager->endCheck(mEventIdx))
|
||||
{
|
||||
(int)mOrderEvtNo;
|
||||
UNUSED((int)mOrderEvtNo);
|
||||
dComIfGp_event_reset();
|
||||
mOrderEvtNo = 0;
|
||||
mEventIdx = -1;
|
||||
@@ -1157,7 +1160,7 @@ int daNpc_grS_c::talk(void* param_0) {
|
||||
daNpcF_offTmpBit(11);
|
||||
}
|
||||
|
||||
unkInt1 = field_0xe0c;
|
||||
unkInt1 = mFlowID;
|
||||
mIsSpeaking = false;
|
||||
initTalk(unkInt1, NULL);
|
||||
mTurnMode = 0;
|
||||
|
||||
@@ -455,6 +455,9 @@ cPhs_Step daNpc_Grz_c::create() {
|
||||
mType = getTypeFromParam();
|
||||
mSwNo = fopAcM_GetParam(this) >> 16;
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mMsgNo = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -291,10 +291,13 @@ cPhs_Step daNpc_GWolf_c::create() {
|
||||
|
||||
mExitId = fopAcM_GetParam(this) >> 24;
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
field_0xe08 = home.angle.x;
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
field_0xe08 = -1;
|
||||
mFlowID = -1;
|
||||
}
|
||||
|
||||
swBit = getSwBitFromParam();
|
||||
@@ -1817,7 +1820,7 @@ BOOL daNpc_GWolf_c::talk(void* param_1) {
|
||||
break;
|
||||
}
|
||||
|
||||
int msgNo = field_0xe08;
|
||||
int msgNo = mFlowID;
|
||||
mOrderSpeakEvt = false;
|
||||
initTalk(msgNo, NULL);
|
||||
mTurnMode = 0;
|
||||
|
||||
@@ -4961,11 +4961,11 @@ int daNpc_Kn_c::setPrtcl() {
|
||||
// cXyz* pos = mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mPos : NULL;
|
||||
|
||||
mParticleMngr[i].mManager.setEffectCenter(&tevStr, &mParticleMngr[i].mPos, check, sp_0x18,
|
||||
mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mPos : NULL,
|
||||
mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mAngle : NULL,
|
||||
mParticleMngr[i].field_0x00 == true ? &mParticleMngr[i].mPos : NULL,
|
||||
mParticleMngr[i].field_0x00 == true ? &mParticleMngr[i].mAngle : NULL,
|
||||
0, fopAcM_GetRoomNo(this), 0.0f, speedF);
|
||||
|
||||
if (mParticleMngr[i].mpModel != false) {
|
||||
if (mParticleMngr[i].field_0x00 != false) {
|
||||
emitter = mParticleMngr[i].mManager.getCenterEmitter(0, 0);
|
||||
if (emitter != NULL) {
|
||||
switch (i) {
|
||||
@@ -4984,7 +4984,7 @@ int daNpc_Kn_c::setPrtcl() {
|
||||
}
|
||||
}
|
||||
|
||||
mParticleMngr[i].mpModel = NULL;
|
||||
mParticleMngr[i].field_0x00 = false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -4996,21 +4996,21 @@ int daNpc_Kn_c::setSlipPrtcl() {
|
||||
mParticleMngr[0].mPos.y -= 20.0f;
|
||||
mParticleMngr[0].mAngle = current.angle;
|
||||
ANGLE_SUB_2(mParticleMngr[0].mAngle.y, 0x8000);
|
||||
mParticleMngr[0].mpModel = true;
|
||||
mParticleMngr[0].field_0x00 = true;
|
||||
|
||||
mDoMtx_stack_c::copy(mpModelMorf[0]->getModel()->getAnmMtx(0x1b));
|
||||
mDoMtx_stack_c::multVecZero(&mParticleMngr[1].mPos);
|
||||
mParticleMngr[1].mPos.y -= 20.0f;
|
||||
mParticleMngr[1].mAngle = current.angle;
|
||||
ANGLE_SUB_2(mParticleMngr[1].mAngle.y, 0x8000);
|
||||
mParticleMngr[1].mpModel = true;
|
||||
mParticleMngr[1].field_0x00 = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int daNpc_Kn_c::setLandingPrtcl() {
|
||||
mParticleMngr[2].mPos = current.pos;
|
||||
mParticleMngr[2].mAngle = mCurAngle;
|
||||
mParticleMngr[2].mpModel = true;
|
||||
mParticleMngr[2].field_0x00 = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,13 @@ static int daNpc_Ks_Draw(npc_ks_class* i_this) {
|
||||
|
||||
fopAc_ac_c* actor = &i_this->actor;
|
||||
J3DModel* model = i_this->model->getModel();
|
||||
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
|
||||
// string in this TU's .data section, but comparing against a string literal is still UB.
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->res_name, "Npc_kst") == 0) {
|
||||
#else
|
||||
if (i_this->res_name == "Npc_kst") {
|
||||
#endif
|
||||
g_env_light.settingTevStruct(4, &actor->current.pos, &actor->tevStr);
|
||||
} else {
|
||||
g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr);
|
||||
|
||||
@@ -189,10 +189,13 @@ int daNpc_myna2_c::create() {
|
||||
mType = getTypeFromParam();
|
||||
field_0xe0d = (fopAcM_GetParam(this) & 0xFF00) >> 8;
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
field_0xe04 = home.angle.x;
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
field_0xe04 = -1;
|
||||
mFlowID = -1;
|
||||
}
|
||||
|
||||
if (isDelete()) {
|
||||
@@ -928,7 +931,7 @@ int daNpc_myna2_c::talk(void* param_0) {
|
||||
switch (mMode) {
|
||||
case 0:
|
||||
if (!mIsDamaged) {
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
mTurnMode = 0;
|
||||
mAnm_p->setPlaySpeed(1.0f);
|
||||
mMode = 2;
|
||||
@@ -1014,7 +1017,7 @@ int daNpc_myna2_c::ECut_firstTalk(int i_staffId) {
|
||||
case 10:
|
||||
break;
|
||||
case 20:
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1063,7 +1066,7 @@ int daNpc_myna2_c::ECut_gameFailure(int i_staffId) {
|
||||
case 20:
|
||||
break;
|
||||
case 10:
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1121,7 +1124,7 @@ int daNpc_myna2_c::ECut_gameGoal(int i_staffId) {
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
break;
|
||||
case 20:
|
||||
break;
|
||||
@@ -1183,7 +1186,7 @@ int daNpc_myna2_c::ECut_gameGoalSuccess(int i_staffId) {
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
break;
|
||||
case 20: {
|
||||
int itemNo = 0;
|
||||
@@ -1193,7 +1196,7 @@ int daNpc_myna2_c::ECut_gameGoalSuccess(int i_staffId) {
|
||||
break;
|
||||
}
|
||||
case 25:
|
||||
initTalk(field_0xe04, NULL);
|
||||
initTalk(mFlowID, NULL);
|
||||
break;
|
||||
case 30:
|
||||
break;
|
||||
|
||||
+58
-12
@@ -135,7 +135,13 @@ static int daNpc_Ne_Draw(npc_ne_class* i_this) {
|
||||
}
|
||||
|
||||
J3DModel* model = i_this->mpMorf->getModel();
|
||||
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
|
||||
// string in this TU's .data section, but comparing against a string literal is still UB.
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
if (!dComIfGs_wolfeye_effect_check()) {
|
||||
return 1;
|
||||
}
|
||||
@@ -426,7 +432,12 @@ static void npc_ne_wait(npc_ne_class* i_this) {
|
||||
daPy_py_c* player = static_cast<daPy_py_c*>(dComIfGp_getPlayer(0));
|
||||
cLib_addCalc0(&_this->speedF, 1.0f, 1.3f);
|
||||
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
switch (i_this->mMode) {
|
||||
case 0:
|
||||
i_this->mTargetAngleY = cM_rndF(0x10000);
|
||||
@@ -2173,7 +2184,12 @@ static void action(npc_ne_class* i_this) {
|
||||
|
||||
_this->gravity = -7.0f;
|
||||
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
i_this->mDistToTarget = 10000.0f;
|
||||
} else {
|
||||
i_this->mDistToTarget = i_this->mDistScale * fopAcM_searchPlayerDistance(_this);
|
||||
@@ -2298,9 +2314,15 @@ static void action(npc_ne_class* i_this) {
|
||||
break;
|
||||
}
|
||||
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") != 0) {
|
||||
#else
|
||||
if (i_this->mResName != "Npc_net") {
|
||||
if (i_this->mMessageState == 1 && daPy_py_c::checkNowWolf()
|
||||
&& i_this->mDistToTarget < 300.0f) {
|
||||
#endif
|
||||
if (i_this->mMessageState == 1 &&
|
||||
daPy_py_c::checkNowWolf() &&
|
||||
i_this->mDistToTarget < 300.0f) {
|
||||
i_this->mAction = npc_ne_class::ACT_MESSAGE;
|
||||
i_this->mMode = 0;
|
||||
bird_check = false;
|
||||
@@ -2846,8 +2868,15 @@ static void demo_camera(npc_ne_class* i_this) {
|
||||
}
|
||||
|
||||
static int message(npc_ne_class* i_this) {
|
||||
if (i_this->mResName == "Npc_net" && !dComIfGs_wolfeye_effect_check()) {
|
||||
i_this->mMessageState = 0;
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
if (!dComIfGs_wolfeye_effect_check()) {
|
||||
i_this->mMessageState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (i_this->mIsTalking) {
|
||||
@@ -2872,7 +2901,12 @@ static int message(npc_ne_class* i_this) {
|
||||
!fopAcM_otherBgCheck(daPy_getLinkPlayerActorClass(), i_this)) {
|
||||
fopAcM_OnStatus(i_this, 0);
|
||||
cLib_onBit<u32>(i_this->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e);
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
cLib_onBit<u32>(i_this->attention_info.flags, fopAc_AttnFlag_UNK_0x800000 | fopAc_AttnFlag_UNK_0x400000);
|
||||
}
|
||||
i_this->eventInfo.onCondition(dEvtCnd_CANTALK_e);
|
||||
@@ -2978,14 +3012,21 @@ static int daNpc_Ne_Execute(npc_ne_class* i_this) {
|
||||
message(i_this);
|
||||
demo_camera(i_this);
|
||||
|
||||
if (i_this->mResName == "Npc_net" && !dComIfGs_wolfeye_effect_check()) {
|
||||
static u16 e_name[2] = {0x8497, 0x8498};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
i_this->mParticle[i] = dComIfGp_particle_set(i_this->mParticle[i], e_name[i],
|
||||
&i_this->eyePos, NULL, NULL);
|
||||
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticle[i]);
|
||||
if (emitter != NULL) {
|
||||
emitter->setGlobalAlpha(!dComIfGs_wolfeye_effect_check() ? 0xff : 0);
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(i_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (i_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
if (!dComIfGs_wolfeye_effect_check()) {
|
||||
static u16 e_name[2] = {0x8497, 0x8498};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
i_this->mParticle[i] = dComIfGp_particle_set(i_this->mParticle[i], e_name[i],
|
||||
&i_this->eyePos, NULL, NULL);
|
||||
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticle[i]);
|
||||
if (emitter != NULL) {
|
||||
emitter->setGlobalAlpha(!dComIfGs_wolfeye_effect_check() ? 0xff : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3231,7 +3272,12 @@ static cPhs_Step daNpc_Ne_Create(fopAc_ac_c* i_this) {
|
||||
_this->mAcchCir.SetWall(_this->mBaseScale.y * 30.0f, _this->mBaseScale.z * 35.0f);
|
||||
_this->mDistScale = cM_rndFX(0.2f) + 1.0f;
|
||||
_this->mGroundY = i_this->current.pos.y;
|
||||
// See comment in daNpc_Ne_Draw
|
||||
#if AVOID_UB
|
||||
if (strcmp(_this->mResName, "Npc_net") == 0) {
|
||||
#else
|
||||
if (_this->mResName == "Npc_net") {
|
||||
#endif
|
||||
_this->mAction = npc_ne_class::ACT_WAIT;
|
||||
_this->mMode = 0;
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,7 @@ int daNpc_Pachi_Maro_c::wait(void* param_1) {
|
||||
}
|
||||
|
||||
if (mJntAnm.getMode() == 0) {
|
||||
(s32)mType;
|
||||
UNUSED((int)mType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1464,7 +1464,7 @@ int daNpc_Pachi_Taro_c::wait(void* param_1) {
|
||||
|
||||
// ???
|
||||
if (mJntAnm.getMode() == 0) {
|
||||
(int)mType;
|
||||
UNUSED((int)mType);
|
||||
}
|
||||
|
||||
if (field_0x1004 == 0) {
|
||||
|
||||
@@ -696,7 +696,7 @@ BOOL daNpc_Post_c::checkChangeEvt() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
(int)mType;
|
||||
UNUSED((int)mType);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -206,6 +206,9 @@ cPhs_Step daNpc_SoldierA_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mMsgNo = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -171,6 +171,9 @@ cPhs_Step daNpc_SoldierB_c::create() {
|
||||
|
||||
mType = getTypeFromParam();
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xFFFF) {
|
||||
mMsgNo = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -244,6 +244,9 @@ cPhs_Step daNpcTheB_c::create() {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
// !@bug The return value (an s16) is promoted to a 32-bit signed
|
||||
// integer prior to being compared, so the compared value can
|
||||
// never exceed SHORT_MAX and the condition always passes.
|
||||
if (getMessageNo() != 0xFFFF) {
|
||||
mMsgNo = getMessageNo();
|
||||
} else {
|
||||
|
||||
@@ -2219,8 +2219,8 @@ bool daNpcWrestler_c::sumouReady(void* param_1) {
|
||||
// fallthrough
|
||||
case 2:
|
||||
field_0xe5e += field_0xbd8->field_0xac;
|
||||
field_0xe54 -= fabsf(field_0xbd8->field_0xac);
|
||||
if (field_0xe54 < fabsf(field_0xbd8->field_0xac)) {
|
||||
field_0xe54 -= fabsf((f32)field_0xbd8->field_0xac);
|
||||
if (field_0xe54 < fabsf((f32)field_0xbd8->field_0xac)) {
|
||||
field_0xe80 = 1;
|
||||
field_0xe84++;
|
||||
}
|
||||
|
||||
@@ -493,6 +493,9 @@ cPhs_Step daNpc_zrA_c::create() {
|
||||
fopAcM_ct(this, daNpc_zrA_c);
|
||||
|
||||
mType = getTypeFromArgument();
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -222,6 +222,9 @@ cPhs_Step daNpc_zrC_c::create() {
|
||||
fopAcM_ct(this, daNpc_zrC_c);
|
||||
|
||||
mType = getTypeFromParam();
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -203,6 +203,9 @@ cPhs_Step daNpc_zrZ_c::create() {
|
||||
mSwitch1 = home.angle.z & 0xff;
|
||||
mSwitch2 = (home.angle.z >> 8) & 0xff;
|
||||
mSwitch3 = fopAcM_GetParam(this) >> 0x18;
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.x != 0xffff) {
|
||||
mFlowID = home.angle.x;
|
||||
} else {
|
||||
|
||||
@@ -666,8 +666,8 @@ static void obj_brg_move(obj_brg_class* i_this) {
|
||||
if ((i_this->mType & 1) == 1) {
|
||||
i_this->mBr[i].field_0x0e0 = 1.0f;
|
||||
} else {
|
||||
var_f27 = ( f32(i) / (i_this->field_0xb1ea - 1)) * M_PI;
|
||||
i_this->mBr[i].field_0x0e0 = fabsf(sin(var_f27));
|
||||
var_f27 = ((f32)i / (i_this->field_0xb1ea - 1)) * M_PI;
|
||||
i_this->mBr[i].field_0x0e0 = fabsf(sinf(var_f27));
|
||||
}
|
||||
|
||||
i_this->mBr[i].field_0x704 = i_this->mBr[i].field_0x705 = 3;
|
||||
@@ -994,11 +994,11 @@ static int daObj_Brg_Execute(obj_brg_class* i_this) {
|
||||
f32 dbg_0x5c;
|
||||
for (int i = 0; i < i_this->field_0xb1ea; i++, part++) {
|
||||
if (i_this->field_0xb1ed == 2) {
|
||||
dbg_0x5c = f32(i) / f32(i_this->field_0xb1ea - 1) * M_PI;
|
||||
var_f26 = (-300.0f + WREG_F(15)) * f32(sin(dbg_0x5c));
|
||||
dbg_0x5c = (f32)i / (f32)(i_this->field_0xb1ea - 1) * M_PI;
|
||||
var_f26 = (-300.0f + WREG_F(15)) * (f32)sin(dbg_0x5c);
|
||||
} else if (i_this->field_0xb1ed == 1) {
|
||||
dbg_0x5c = f32(i) / f32(i_this->field_0xb1ea - 1) * M_PI;
|
||||
var_f26 = (-100.0f + WREG_F(13)) * f32(sin(dbg_0x5c));
|
||||
dbg_0x5c = (f32)i / (f32)(i_this->field_0xb1ea - 1) * M_PI;
|
||||
var_f26 = (-100.0f + WREG_F(13)) * (f32)sin(dbg_0x5c);
|
||||
}
|
||||
|
||||
MtxTrans(part->field_0x0bc.x, part->field_0x0bc.y, part->field_0x0bc.z, 0);
|
||||
@@ -1795,7 +1795,7 @@ static int daObj_Brg_Create(fopAc_ac_c* i_this) {
|
||||
};
|
||||
|
||||
for (brno = 0; brno < a_this->field_0xb1ea; brno++) {
|
||||
a_this->mBr[brno].field_0x098[2] = brg_init_pos[brno];
|
||||
a_this->mBr[brno].field_0x0b0 = brg_init_pos[brno];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,6 +333,10 @@ void daObjCwall_c::getChainBasePos(cXyz* pBasePos) {
|
||||
void daObjCwall_c::setChainMtx() {
|
||||
chain_s* pChain = mChains;
|
||||
s16 sVar7 = home.angle.y;
|
||||
|
||||
// !@bug The variable is promoted to a 32-bit signed integer prior
|
||||
// to being compared to 0xC000, so the compared value can never
|
||||
// exceed SHORT_MAX and the subcondition fails.
|
||||
if (sVar7 == 0x4000 || sVar7 == 0xc000) {
|
||||
sVar7 += 0x4000;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,10 @@ cPhs_Step daObj_GrA_c::create() {
|
||||
}
|
||||
}
|
||||
|
||||
field_0x848 = ((int)home.angle.x == 0xFFFF) ? -1 : home.angle.x;
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always fails.
|
||||
mFlowID = home.angle.x == 0xFFFF ? -1 : home.angle.x;
|
||||
|
||||
field_0x1fe8 = (fopAcM_GetParam(this) & 0xC0000000) >> 30;
|
||||
field_0xa7f = home.angle.z & 0xFF;
|
||||
@@ -1435,7 +1438,7 @@ int daObj_GrA_c::talk(void* param_1) {
|
||||
int iVar1, iVar2;
|
||||
int rv = 0;
|
||||
int iVar3;
|
||||
int iVar4 = field_0x848;
|
||||
int iVar4 = mFlowID;
|
||||
s16 sVar1;
|
||||
switch (field_0xa7c) {
|
||||
case 0:
|
||||
@@ -2013,7 +2016,7 @@ int daObj_GrA_c::face999(int param_1) {
|
||||
}
|
||||
|
||||
int daObj_GrA_c::evtcutTalk(int param_1, int param_2) {
|
||||
s32 sVar1 = field_0x848;
|
||||
s32 sVar1 = mFlowID;
|
||||
if (param_2 != 0) {
|
||||
mMsgFlow.init(this, sVar1, 0, NULL);
|
||||
field_0xaa0 = 0;
|
||||
|
||||
@@ -768,7 +768,7 @@ int daObj_GrA_c::rollDemo(void* param_1) {
|
||||
field_0x91a.y = current.angle.y;
|
||||
|
||||
if (mDemoCamMode >= 5) {
|
||||
field_0x848 = 4;
|
||||
mFlowID = 4;
|
||||
evtcutTalk(-1, 1);
|
||||
field_0x2000 = 0;
|
||||
}
|
||||
@@ -1169,7 +1169,7 @@ int daObj_GrA_c::rollAttacked(void* param_1) {
|
||||
|
||||
case 2:
|
||||
if (mDemoCamMode >= 5) {
|
||||
field_0x848 = 5;
|
||||
mFlowID = 5;
|
||||
evtcutTalk(-1, 1);
|
||||
field_0x2018 = 3;
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ void daObjMarm_c::calcHimo() {
|
||||
|
||||
getRopeStartPos(&offset1);
|
||||
getFpartsOffset(&offset2);
|
||||
fabs(offset1.y - offset2.y);
|
||||
UNUSED(fabs(offset1.y - offset2.y));
|
||||
|
||||
cXyz* line_mat1_pos = mpRope1->getPos(0);
|
||||
*line_mat1_pos = offset1;
|
||||
|
||||
@@ -288,8 +288,9 @@ int daObj_Pumpkin_c::Execute() {
|
||||
if (field_0xBAE) {
|
||||
int item_table_no = getItemTableNo();
|
||||
if (item_table_no >= 0 && mItemProcId == fpcM_ERROR_PROCESS_ID_e) {
|
||||
mItemProcId = fopAcM_createItemFromTable(¤t.pos, item_table_no, -1, fopAcM_GetRoomNo(this),
|
||||
NULL, 0, NULL, NULL, NULL, NULL);
|
||||
mItemProcId = fopAcM_createItemFromTable(¤t.pos, item_table_no, -1,
|
||||
fopAcM_GetRoomNo(this), NULL, 0, NULL, NULL,
|
||||
NULL, false);
|
||||
}
|
||||
|
||||
if (mItemProcId == fpcM_ERROR_PROCESS_ID_e || fopAcM_IsExecuting(mItemProcId)) {
|
||||
|
||||
@@ -112,7 +112,9 @@ int daObj_SekiDoor_c::Execute(Mtx** i_mtx) {
|
||||
|
||||
if (mOpening != 0) {
|
||||
if (mDestroyed != 0) {
|
||||
if(!dComIfGp_event_runCheck){
|
||||
// !@bug Missing parentheses - the function is not callled and
|
||||
// this always evaluates to false.
|
||||
if (!dComIfGp_event_runCheck) {
|
||||
fopAcM_delete(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,9 +1008,14 @@ bool daObj_Sekizoa_c::afterSetMotionAnm(int i_frame, int i_mode, f32 i_morf, int
|
||||
if (mBtkAnm.getBtkAnm() == anm_text) {
|
||||
mAnmFlags |= ANM_PLAY_BTK;
|
||||
} else {
|
||||
if (setBtkAnm(anm_text, mpMorf[0]->getModel()->getModelData(), 1.0f,
|
||||
btkAnmData[4].field_0x4))
|
||||
{
|
||||
#if AVOID_UB
|
||||
// negative attribute values are ignored in favor of the animation's default value
|
||||
if (setBtkAnm(anm_text, mpMorf[0]->getModel()->getModelData(), 1.0f, -1)) {
|
||||
#else
|
||||
// !@bug Out-of-bounds array read, in practice this ends up reading from a jump table
|
||||
// positioned immediately after btkAnmData in .data.
|
||||
if (setBtkAnm(anm_text, mpMorf[0]->getModel()->getModelData(), 1.0f, btkAnmData[4].field_0x4)) {
|
||||
#endif
|
||||
if (frame_1 == 3) {
|
||||
mBtkAnm.setPlaySpeed(0.0f);
|
||||
}
|
||||
@@ -1032,8 +1037,15 @@ bool daObj_Sekizoa_c::afterSetMotionAnm(int i_frame, int i_mode, f32 i_morf, int
|
||||
if (mBrkAnm.getBrkAnm() == anm_tev) {
|
||||
mAnmFlags |= ANM_PLAY_BRK;
|
||||
} else {
|
||||
frame_1 = setBrkAnm(anm_tev, mpMorf[0]->getModel()->getModelData(), 1.0,
|
||||
// !@bug OoB index into brkAnmData ends up indexing into btkAnmData instead.
|
||||
// This was probably supposed to use brkAnmData[5] instead.
|
||||
#if AVOID_UB
|
||||
frame_1 = setBrkAnm(anm_tev, mpMorf[0]->getModel()->getModelData(), 1.0f,
|
||||
btkAnmData[0].field_0x4);
|
||||
#else
|
||||
frame_1 = setBrkAnm(anm_tev, mpMorf[0]->getModel()->getModelData(), 1.0f,
|
||||
brkAnmData[6].field_0x4);
|
||||
#endif
|
||||
if (frame_1 != 0) {
|
||||
if (frame_2 == 5) {
|
||||
mBrkAnm.setPlaySpeed(0.0f);
|
||||
|
||||
@@ -384,6 +384,7 @@ int daObj_SSDrink_c::chkEvent() {
|
||||
}
|
||||
|
||||
int daObj_SSDrink_c::orderEvent() {
|
||||
// !@bug Comparison of u16 (getFlowNodeNum()) with -1 always evaluates to false
|
||||
if (!daPy_py_c::checkNowWolf() && field_0xb0c != 0x60 && getFlowNodeNum() != -1) {
|
||||
attention_info.flags = fopAc_AttnFlag_TALKREAD_e | fopAc_AttnFlag_SPEAK_e;
|
||||
} else {
|
||||
|
||||
@@ -168,6 +168,7 @@ int daTag_Evt_c::isDelete() {
|
||||
if (field_0x5DD == 0xFF ||
|
||||
(field_0x5DD != 0xFF && dComIfGs_isSwitch(field_0x5DD, fopAcM_GetRoomNo(this)) != 0))
|
||||
{
|
||||
// !@bug Comparison of u8 field with 0xFFF will always evaluate to false
|
||||
if (field_0x5DE != 0xFFF) {
|
||||
return dComIfGs_isSwitch(field_0x5DE, fopAcM_GetRoomNo(this));
|
||||
} else {
|
||||
|
||||
@@ -36,6 +36,9 @@ int daTag_EvtMsg_c::create() {
|
||||
scale.y *= 100.0f;
|
||||
scale.z = scale.x;
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.z != 0xFFFF) {
|
||||
mFlowID = home.angle.z;
|
||||
} else {
|
||||
|
||||
@@ -126,6 +126,9 @@ void daTag_Lantern_c::initialize() {
|
||||
mpHIO->entryHIO("カンテラチェックタグ");
|
||||
#endif
|
||||
|
||||
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
|
||||
// to being compared, so the compared value can never exceed
|
||||
// SHORT_MAX and the condition always passes.
|
||||
if (home.angle.z != 0xFFFF) {
|
||||
mFlowIndex = home.angle.z;
|
||||
} else {
|
||||
|
||||
@@ -163,7 +163,7 @@ static int daTagRestart_Execute(daTagRestart_c* i_this) {
|
||||
}
|
||||
|
||||
static int daTagRestart_Delete(daTagRestart_c* i_this) {
|
||||
("Delete -> TagRestart( =%d)\n", fopAcM_GetID(i_this));
|
||||
fopAcM_RegisterDeleteID(i_this, "TagRestart");
|
||||
return i_this->_delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ int daTag_SSDrink_c::chkEvent() {
|
||||
if (!dComIfGp_getEvent()->isOrderOK()) {
|
||||
retVal = 0;
|
||||
if (eventInfo.checkCommandTalk()) {
|
||||
if (!checkProcess(&daTag_SSDrink_c::talk) == 0) {
|
||||
if (checkProcess(&daTag_SSDrink_c::talk) != 0) {
|
||||
retVal = (this->*mProcessFunc)(0);
|
||||
} else {
|
||||
if (dComIfGp_event_chkTalkXY() == 0 || dComIfGp_evmng_ChkPresentEnd() != 0) {
|
||||
|
||||
@@ -23,6 +23,7 @@ int daTagTheBHint_c::execute() {
|
||||
if (fopAcM_searchPlayerDistanceXZ2(this) < field_0x568) {
|
||||
daNpcTheB_c* the_b = (daNpcTheB_c*)fpcM_SearchByName(fpcNm_NPC_THEB_e);
|
||||
if (the_b) {
|
||||
// !@bug Comparison of s8 (getRoomNo) with 0xFF always evaluates to false
|
||||
int roomNo = getRoomNo() == 0xff ? fopAcM_GetRoomNo(this) : getRoomNo();
|
||||
|
||||
the_b->setHintEvent(getMessageNo(), getLinkID(), roomNo);
|
||||
|
||||
@@ -1719,7 +1719,7 @@ JUtility::TColor get_color(JUtility::TColor color) {
|
||||
JUtility::TColor(0x80, 0x80, 0xFF, 0xFF),
|
||||
};
|
||||
|
||||
(void)(u32)color;
|
||||
UNUSED((u32)color);
|
||||
int var_r30 = 1;
|
||||
|
||||
if (var_r30 && (u32)color < 9) {
|
||||
|
||||
+19
-1
@@ -14,6 +14,24 @@
|
||||
s16 dDemo_c::m_branchId = -1;
|
||||
|
||||
namespace {
|
||||
class jstudio_tAdaptor_message : public JStudio::TAdaptor_message {
|
||||
public:
|
||||
typedef JStudio::TObject_message ObjectType;
|
||||
|
||||
jstudio_tAdaptor_message() {}
|
||||
|
||||
virtual ~jstudio_tAdaptor_message();
|
||||
virtual void adaptor_do_MESSAGE(JStudio::data::TEOperationData, const void*, u32);
|
||||
};
|
||||
|
||||
class jstudio_tCreateObject_message : public JStudio::TCreateObject {
|
||||
public:
|
||||
jstudio_tCreateObject_message() {}
|
||||
|
||||
virtual ~jstudio_tCreateObject_message();
|
||||
virtual bool create(JStudio::TObject**, const JStudio::stb::data::TParse_TBlock_object&);
|
||||
};
|
||||
|
||||
jstudio_tAdaptor_message::~jstudio_tAdaptor_message() {}
|
||||
|
||||
void jstudio_tAdaptor_message::adaptor_do_MESSAGE(JStudio::data::TEOperationData iType,
|
||||
@@ -168,7 +186,7 @@ JStudio_JAudio2::TCreateObject* dDemo_c::m_audio;
|
||||
|
||||
dDemo_particle_c* dDemo_c::m_particle;
|
||||
|
||||
jstudio_tCreateObject_message* dDemo_c::m_message;
|
||||
JStudio::TCreateObject* dDemo_c::m_message;
|
||||
|
||||
JStudio::TFactory* dDemo_c::m_factory;
|
||||
|
||||
|
||||
@@ -1820,7 +1820,7 @@ int dDlst_list_c::set(dDlst_base_c**& p_start, dDlst_base_c**& p_end, dDlst_base
|
||||
return 0;
|
||||
}
|
||||
*p_start = p_newDlst;
|
||||
*p_start++;
|
||||
UNUSED(*p_start++);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2160,7 +2160,7 @@ bool dCamera_c::gameOverEvCamera() {
|
||||
mViewCache.mEye = sp230;
|
||||
gover_p->field_0x0++;
|
||||
mViewCache.mFovy = 75.0f;
|
||||
bVar9 = 75.0f;
|
||||
bVar9 = true;
|
||||
}
|
||||
// fallthrough intentional.
|
||||
case 4: {
|
||||
|
||||
+12
-12
@@ -10483,7 +10483,7 @@ BOOL dKy_camera_water_in_status_check() {
|
||||
|
||||
u8 dKy_pol_efftype_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10513,7 +10513,7 @@ u8 dKy_pol_efftype_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
|
||||
u8 dKy_pol_efftype2_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10543,7 +10543,7 @@ u8 dKy_pol_efftype2_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
|
||||
u8 dKy_pol_sound_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10574,7 +10574,7 @@ u8 dKy_pol_sound_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
|
||||
u8 dKy_pol_argument_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10599,7 +10599,7 @@ u8 dKy_pol_argument_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
u8 dKy_pol_eff_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
u8 eff_id = 0;
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10636,7 +10636,7 @@ u8 dKy_pol_eff_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
u8 dKy_pol_eff_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
u8 eff_id = 0;
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10673,7 +10673,7 @@ u8 dKy_pol_eff_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
u8 dKy_pol_eff2_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
u8 eff_id = 0;
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10710,7 +10710,7 @@ u8 dKy_pol_eff2_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p)
|
||||
u8 dKy_pol_eff2_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
u8 eff_id = 0;
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || out_color_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10748,7 +10748,7 @@ u8 dKy_pol_eff_alpha_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
int z0;
|
||||
u8 eff_id = 0;
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10785,7 +10785,7 @@ f32 dKy_pol_eff_ratio_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
u8 eff_id;
|
||||
f32 ratio = 0.0f;
|
||||
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -10822,7 +10822,7 @@ u8 dKy_pol_eff2_alpha_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
int z0;
|
||||
u8 retval = 0;
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
@@ -10858,7 +10858,7 @@ f32 dKy_pol_eff2_ratio_get(const cBgS_PolyInfo* polyinfo_p) {
|
||||
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
|
||||
f32 ratio = 0.0f;
|
||||
|
||||
if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) {
|
||||
if (polyinfo_p == NULL || IS_REF_NULL(dComIfG_Bgsp())) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ u8 STControl::checkTrigger() {
|
||||
f32 stickValue = getValueStick();
|
||||
s16 stickAngle = getAngleStick();
|
||||
u8 var_r6 = 0;
|
||||
s16 temp_r7 = 0x2000 - field_0x26 >> 1;
|
||||
s16 temp_r7 = (0x2000 - field_0x26) >> 1;
|
||||
|
||||
if (!cM3d_IsZero(stickValue)) {
|
||||
if (stickAngle < field_0x22 - 0x7000 + temp_r7) {
|
||||
|
||||
@@ -199,10 +199,10 @@ void dMapInfo_n::getRoomMinMaxXZ(int i_roomNo, f32* i_roomLeftX, f32* i_roomInne
|
||||
|
||||
void dMapInfo_n::getFloorParameter(f32 param_0, s8* i_floorNo, f32* param_2, f32* param_3,
|
||||
f32* param_4, f32* param_5) {
|
||||
f32 gap_level = dStage_stagInfo_GetGapLevel(dComIfGp_getStageStagInfo());
|
||||
f32 range_up = fabsf(dStage_stagInfo_GetRangeUp(dComIfGp_getStageStagInfo()));
|
||||
f32 range_down = fabsf(dStage_stagInfo_GetRangeDown(dComIfGp_getStageStagInfo()));
|
||||
s8 floorNo = (f32)floor(param_0 / gap_level);
|
||||
f32 gap_level = (f32)dStage_stagInfo_GetGapLevel(dComIfGp_getStageStagInfo());
|
||||
f32 range_up = fabsf((f32)dStage_stagInfo_GetRangeUp(dComIfGp_getStageStagInfo()));
|
||||
f32 range_down = fabsf((f32)dStage_stagInfo_GetRangeDown(dComIfGp_getStageStagInfo()));
|
||||
s8 floorNo = (s8)(f32)floor(param_0 / gap_level);
|
||||
|
||||
if (i_floorNo != NULL) {
|
||||
*i_floorNo = floorNo;
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "d/d_lib.h"
|
||||
|
||||
#if VERSION == VERSION_GCN_JPN
|
||||
#define LINE_MAX 9
|
||||
#define D_MENU_LETTER_LINE_MAX 9
|
||||
#else
|
||||
#define LINE_MAX 12
|
||||
#define D_MENU_LETTER_LINE_MAX 12
|
||||
#endif
|
||||
|
||||
typedef void (dMenu_Letter_c::*initFunc)();
|
||||
@@ -258,8 +258,8 @@ void dMenu_Letter_c::_draw() {
|
||||
uVar10 = (J2DTextBox*)field_0x2f4[i]->getPanePtr();
|
||||
}
|
||||
J2DTextBox* uVar18 = (J2DTextBox*)field_0x2ec[i]->getPanePtr();
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(dVar1), field_0x3e3 - 1, LINE_MAX,
|
||||
uVar18, uVar10, NULL, NULL, 0);
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(dVar1), field_0x3e3 - 1,
|
||||
D_MENU_LETTER_LINE_MAX, uVar18, uVar10, NULL, NULL, 0);
|
||||
}
|
||||
mpString->drawOutFont((J2DTextBox*)field_0x2ec[1]->getPanePtr(), -1.0f);
|
||||
if (mProcess == 4) {
|
||||
@@ -491,10 +491,10 @@ void dMenu_Letter_c::read_open_init() {
|
||||
text1 = (J2DTextBox*)field_0x2f4[i]->getPanePtr();
|
||||
}
|
||||
J2DTextBox* text2 = (J2DTextBox*)field_0x2ec[i]->getPanePtr();
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(idx), field_0x3e3 - 1, LINE_MAX, text2, text1,
|
||||
0, NULL, NULL);
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(idx), field_0x3e3 - 1,
|
||||
D_MENU_LETTER_LINE_MAX, text2, text1, NULL, NULL, 0);
|
||||
}
|
||||
field_0x3e2 = mpString->getPageMax(LINE_MAX);
|
||||
field_0x3e2 = mpString->getPageMax(D_MENU_LETTER_LINE_MAX);
|
||||
if (field_0x3e2 > 1) {
|
||||
char acStack_30[20];
|
||||
sprintf(acStack_30, "%d/%d", field_0x3e3, field_0x3e2);
|
||||
@@ -642,7 +642,8 @@ void dMenu_Letter_c::read_next_fadein_init() {
|
||||
text1 = (J2DTextBox*)field_0x2f4[i]->getPanePtr();
|
||||
}
|
||||
J2DTextBox* text2 = (J2DTextBox*)field_0x2ec[i]->getPanePtr();
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(idx), field_0x3e3 - 1, LINE_MAX, text2, text1, 0, NULL, NULL);
|
||||
mpString->getStringPage(dMenu_Letter::getLetterText(idx), field_0x3e3 - 1,
|
||||
D_MENU_LETTER_LINE_MAX, text2, text1, NULL, NULL, 0);
|
||||
}
|
||||
char acStack_30[10];
|
||||
sprintf(acStack_30, "%d/%d", field_0x3e3, field_0x3e2);
|
||||
|
||||
@@ -1503,6 +1503,8 @@ void dMenu_Ring_c::setSelectItem(int i_idx, u8 i_itemNo) {
|
||||
} else {
|
||||
field_0x6be[i_idx] = 0;
|
||||
}
|
||||
// !@bug Out-of-bounds access into mpSelectItemTexBuf
|
||||
// (innermost dimension is 2, we take index 2 which is invalid)
|
||||
field_0x686[i_idx] = dMeter2Info_readItemTexture(
|
||||
i_itemNo, mpSelectItemTexBuf[i_idx][field_0x6be[i_idx]][0], mpSelectItemTex[i_idx][0],
|
||||
mpSelectItemTexBuf[i_idx][field_0x6be[i_idx]][1], mpSelectItemTex[i_idx][1],
|
||||
|
||||
+10
-1
@@ -1602,7 +1602,16 @@ u8 dMsgObject_c::isSend() {
|
||||
}
|
||||
|
||||
void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) {
|
||||
#if AVOID_UB
|
||||
// largest possible value msgGroup appears to be 99, but just in case
|
||||
// we leave enough space to fit INT_MAX
|
||||
static char arcName[32];
|
||||
#else
|
||||
// We write at least 23 bytes into this which causes an overflow,
|
||||
// but in practice arcName is followed by two bytes of padding
|
||||
// at the end of .bss which mitigates the problem.
|
||||
static char arcName[22];
|
||||
#endif
|
||||
|
||||
int msgGroup = dStage_stagInfo_GetMsgGroup(dComIfGp_getStage()->getStagInfo());
|
||||
#if REGION_PAL
|
||||
@@ -2133,7 +2142,7 @@ u16 dMsgObject_c::getSmellTypeMessageIDLocal() {
|
||||
if (smell < dItemNo_SMELL_MEDICINE_e + 1 && smell >= dItemNo_SMELL_YELIA_POUCH_e) {
|
||||
msgId = smell + 0x165;
|
||||
} else {
|
||||
if (dComIfGs_getCollectSmell() != -1) {
|
||||
if (dComIfGs_getCollectSmell() != 0xFF) {
|
||||
OS_REPORT("smell type ====> %d\n", dComIfGs_getCollectSmell());
|
||||
JUT_WARN(4858, "smell type no entry!");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,16 @@
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "Z2AudioLib/Z2WolfHowlMgr.h"
|
||||
|
||||
// POSIX already defines a macro with this name, but we know that this specific name is
|
||||
// used in TP based on assertion messages. This redefinition is scoped to this TU which
|
||||
// is unlikely to ever actually need the POSIX define, so we can just redefine it.
|
||||
#if defined(LINE_MAX)
|
||||
#undef LINE_MAX
|
||||
#endif
|
||||
#define LINE_MAX 30
|
||||
//TODO: This is likely an enum value based on its name
|
||||
#define PLOT_BUFFER_MAX_e 0x300
|
||||
|
||||
typedef void (dMsgScrnHowl_c::*dMsgScrnHowl_cFunc)();
|
||||
|
||||
static dMsgScrnHowl_cFunc init_proc[5] = {
|
||||
|
||||
@@ -506,7 +506,7 @@ bool dPa_modelEcallBack::model_c::set(J3DModelData* i_modelData, dKy_tevstr_c co
|
||||
field_0x8.field_0x344 = param_1.field_0x344;
|
||||
typedef struct Arr{
|
||||
int field_0x0[2];
|
||||
};
|
||||
} Arr;
|
||||
*(Arr*)&field_0x8.AmbCol = *(Arr*)¶m_1.AmbCol;
|
||||
*(Arr*)&field_0x8.FogCol = *(Arr*)¶m_1.FogCol;
|
||||
*(Arr*)&field_0x8.TevColor = *(Arr*)¶m_1.TevColor;
|
||||
@@ -838,11 +838,11 @@ u32 dPa_simpleEcallBack::set(cXyz const* i_pos, dKy_tevstr_c const* param_2, u8
|
||||
GXColor local_60;
|
||||
GXColor local_64 = {0xff, 0xff, 0xff, 0xff};
|
||||
GXColor local_68 = {0xff, 0xff, 0xff, 0xff};
|
||||
if (¶m_5 != NULL) {
|
||||
if (IS_REF_NONNULL(param_5)) {
|
||||
local_64 = param_5;
|
||||
}
|
||||
|
||||
if (¶m_4 != NULL) {
|
||||
if (IS_REF_NONNULL(param_4)) {
|
||||
local_68 = param_4;
|
||||
}
|
||||
|
||||
@@ -859,11 +859,11 @@ u32 dPa_simpleEcallBack::set(cXyz const* i_pos, dKy_tevstr_c const* param_2, u8
|
||||
GXColor local_70;
|
||||
GXColor local_74 = {0xff, 0xff, 0xff, 0xff};
|
||||
GXColor local_78 = {0xff, 0xff, 0xff, 0xff};
|
||||
if (¶m_5 != NULL) {
|
||||
if (IS_REF_NONNULL(param_5)) {
|
||||
local_74 = param_5;
|
||||
}
|
||||
|
||||
if (¶m_4 != NULL) {
|
||||
if (IS_REF_NONNULL(param_4)) {
|
||||
local_78 = param_4;
|
||||
}
|
||||
|
||||
@@ -881,13 +881,13 @@ u32 dPa_simpleEcallBack::set(cXyz const* i_pos, dKy_tevstr_c const* param_2, u8
|
||||
pData->field_0x10.g = local_6c.g;
|
||||
pData->field_0x10.b = local_6c.b;
|
||||
} else {
|
||||
if (¶m_4 != NULL) {
|
||||
if (IS_REF_NONNULL(param_4)) {
|
||||
pData->field_0x0c.r = param_4.r;
|
||||
pData->field_0x0c.g = param_4.g;
|
||||
pData->field_0x0c.b = param_4.b;
|
||||
}
|
||||
|
||||
if (¶m_5 != NULL) {
|
||||
if (IS_REF_NONNULL(param_5)) {
|
||||
pData->field_0x10.r = param_5.r;
|
||||
pData->field_0x10.g = param_5.g;
|
||||
pData->field_0x10.b = param_5.b;
|
||||
|
||||
+7
-7
@@ -1790,7 +1790,7 @@ int dSv_info_c::memory_to_card(char* card_ptr, int dataNum) {
|
||||
OS_REPORT("(dSv_reserve_c) size %d\n", sizeof(dSv_reserve_c));
|
||||
OS_REPORT("(dSv_MiniGame_c) size %d\n", sizeof(dSv_MiniGame_c));
|
||||
OS_REPORT("セーブ全体情報(dSv_save_c) size %d\n", sizeof(dSv_save_c));
|
||||
printf("Write size:%d\n", card_ptr - var_r29);
|
||||
printf("Write size:%d\n", (int)(card_ptr - var_r29));
|
||||
|
||||
// Now that we've saved, reset events if needed
|
||||
if (lantern_not_recovered == true) {
|
||||
@@ -1809,11 +1809,11 @@ int dSv_info_c::memory_to_card(char* card_ptr, int dataNum) {
|
||||
}
|
||||
|
||||
if (card_ptr - var_r29 > (QUEST_LOG_SIZE - 8)) {
|
||||
printf("SAVE size over(%d/%d)\n", (QUEST_LOG_SIZE - 8), card_ptr - var_r29);
|
||||
printf("SAVE size over(%d/%d)\n", (QUEST_LOG_SIZE - 8), (int)(card_ptr - var_r29));
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("SAVE size:%d\n", card_ptr - var_r29);
|
||||
printf("SAVE size:%d\n", (int)(card_ptr - var_r29));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1859,11 +1859,11 @@ int dSv_info_c::card_to_memory(char* i_cardPtr, int i_dataNum) {
|
||||
|
||||
OS_REPORT("########### save stage ====> %s\n", dMeter2Info_getSaveStageName());
|
||||
if (i_cardPtr - var_r30 > (QUEST_LOG_SIZE - 8)) {
|
||||
printf("LOAD size over(%d/%d)\n", (QUEST_LOG_SIZE - 8), i_cardPtr - var_r30);
|
||||
printf("LOAD size over(%d/%d)\n", (QUEST_LOG_SIZE - 8), (int)(i_cardPtr - var_r30));
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("LOAD size:%d\n", i_cardPtr - var_r30);
|
||||
printf("LOAD size:%d\n", (int)(i_cardPtr - var_r30));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1880,11 +1880,11 @@ int dSv_info_c::initdata_to_card(char* i_cardPtr, int i_dataNum) {
|
||||
i_cardPtr += sizeof(dSv_save_c);
|
||||
|
||||
if (i_cardPtr - var_r30 > (QUEST_LOG_SIZE - 8)) {
|
||||
printf("INIT size over %d/%d\n", (QUEST_LOG_SIZE - 8), i_cardPtr - var_r30);
|
||||
printf("INIT size over %d/%d\n", (QUEST_LOG_SIZE - 8), (int)(i_cardPtr - var_r30));
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("INIT size:%d\n", i_cardPtr - var_r30);
|
||||
printf("INIT size:%d\n", (int)(i_cardPtr - var_r30));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1459,9 +1459,8 @@ bool dShopSystem_c::searchItemActor() {
|
||||
for (int i = 0; i < dShopSystem_sellItemMax; i++) {
|
||||
u32 processId = dShopSystem_itemActor[i]->getProcessID();
|
||||
mItemCtrl.setItemIndex(i, processId);
|
||||
mItemCtrl.setMessageIndex(i, (u16)dShopSystem_itemActor[i]->home.angle.x != 0xFFFF ?
|
||||
(u16)dShopSystem_itemActor[i]->home.angle.x :
|
||||
-1);
|
||||
int itemFlowId = dShopSystem_itemActor[i]->getFlowNodeNum();
|
||||
mItemCtrl.setMessageIndex(i, itemFlowId);
|
||||
|
||||
if (processId + 0x10000 == 0xFFFF) {
|
||||
onFlag(i);
|
||||
|
||||
Reference in New Issue
Block a user