e_rd, npc_ks dbg work (#3029)

* Partial e_rd, npc_ks dbg work

* More e_rd matching

* e_rd fixes and dbg ctor matched

* obj_ita dbg equiv

* e_st dbg almost equiv

* Some obj_ladder dbg work

* dbg e_rd PR comments

* Further e_rd dbg clangd fixes
This commit is contained in:
YunataSavior
2026-01-11 19:49:05 -08:00
committed by GitHub
parent 6a59c5231f
commit 24c08d322e
16 changed files with 1390 additions and 1000 deletions
+878 -655
View File
File diff suppressed because it is too large Load Diff
+128 -91
View File
@@ -241,6 +241,18 @@ daE_ST_HIO_c::daE_ST_HIO_c() {
field_0x20 = -1.0f;
}
#if DEBUG
void daE_ST_HIO_c::genMessage(JORMContext* ctext) {
// "stalchura" - a.k.a. skultula
ctext->genLabel(" スタルチュラ", 0x80000001, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
ctext->genSlider("基本サイズ", &basic_size, 0.0f, 5.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
ctext->genSlider("PL認識距離", &pl_recognize_dist, 0.0f, 5000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
ctext->genSlider("戦闘開始距離", &combat_start_dist, 0.0f, 1000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
ctext->genSlider("攻撃前間", &time_before_attack, 0, 50, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
ctext->genSlider("ダウン時間", &down_time, 0, 300, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24);
}
#endif
static void anm_init(e_st_class* i_this, int i_index, f32 i_morf, u8 i_attr, f32 i_rate) {
i_this->mpModelMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_st", i_index), i_attr, i_morf, i_rate, 0.0f, -1.0f);
i_this->mAnm = i_index;
@@ -248,29 +260,31 @@ static void anm_init(e_st_class* i_this, int i_index, f32 i_morf, u8 i_attr, f32
static int nodeCallBack(J3DJoint* i_joint, int param_2) {
if (param_2 == 0) {
int jntNo = i_joint->getJntNo();
J3DJoint* my_joint = i_joint;
int jntNo = my_joint->getJntNo();
J3DModel* model = j3dSys.getModel();
e_st_class* i_this = (e_st_class*)model->getUserArea();
fopAc_ac_c* sp_0x10 = &i_this->actor;
if (i_this != NULL) {
MTXCopy(model->getAnmMtx(jntNo), *calc_mtx);
if (jntNo >= JNT_LLEGA_1 && jntNo <= JNT_LLEGA_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[0].mAngles[jntNo - 2]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[0].mAngles[jntNo - JNT_LLEGA_1]);
} else if (jntNo >= JNT_LLEGB_1 && jntNo <= JNT_LLEGB_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[0].mAngles[jntNo + 7]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[1].mAngles[jntNo - JNT_LLEGB_1]);
} else if (jntNo >= JNT_LLEGC_1 && jntNo <= JNT_LLEGC_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[1].mAngles[jntNo + 4]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[2].mAngles[jntNo - JNT_LLEGC_1]);
} else if (jntNo >= JNT_LLEGD_1 && jntNo <= JNT_LLEGD_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[2].mAngles[jntNo + 1]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[3].mAngles[jntNo - JNT_LLEGD_1]);
} else if (jntNo >= JNT_RLEGA_1 && jntNo <= JNT_RLEGA_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[3].mAngles[jntNo - 2]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[4].mAngles[jntNo - JNT_RLEGA_1]);
} else if (jntNo >= JNT_RLEGB_1 && jntNo <= JNT_RLEGB_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[3].mAngles[jntNo + 7]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[5].mAngles[jntNo - JNT_RLEGB_1]);
} else if (jntNo >= JNT_RLEGC_1 && jntNo <= JNT_RLEGC_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[4].mAngles[jntNo + 4]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[6].mAngles[jntNo - JNT_RLEGC_1]);
} else if (jntNo >= JNT_RLEGD_1 && jntNo <= JNT_RLEGD_3) {
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[5].mAngles[jntNo + 1]);
cMtx_ZrotM(*calc_mtx, i_this->mStFeet[7].mAngles[jntNo - JNT_RLEGD_1]);
}
if (jntNo == TREG_S(0)) {
@@ -371,9 +385,9 @@ static BOOL pl_check(e_st_class* i_this, f32 i_distance) {
if (player->current.pos.y - a_this->current.pos.y >= 750.0f || dComIfGp_event_runCheck()) {
return FALSE;
}
if (i_this->mPlayerDistance < i_distance) {
player = (fopAc_ac_c*)dComIfGp_getPlayer(0);
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
pos_delta = player->current.pos - a_this->current.pos;
cMtx_XrotS(*calc_mtx, -i_this->field_0x69c.x);
cMtx_YrotM(*calc_mtx, -i_this->field_0x69c.y);
@@ -497,9 +511,9 @@ static void damage_check(e_st_class* i_this) {
static int move_bg_check(e_st_class* i_this) {
dBgS_LinChk lin_chk;
int rv = 0;
cXyz spa0, spac;
int rv = 0;
lin_chk.Set(&i_this->field_0x6bc, &i_this->field_0x6c8, NULL);
if (dComIfG_Bgsp().LineCross(&lin_chk)) {
rv = 1;
@@ -671,7 +685,6 @@ static void e_st_wait(e_st_class* i_this) {
i_this->mAction = ACTION_MOVE;
i_this->mActionPhase = PHASE_INIT;
}
break;
}
if (i_this->mTimers[1] == 0 && pl_check(i_this, l_HIO.pl_recognize_dist)) {
@@ -821,8 +834,7 @@ static void e_st_pl_search(e_st_class* i_this) {
}
if (move_bg_check(i_this)) {
target = 0.0f;
a_this->speedF = 0.0f;
a_this->speedF = target = 0.0f;
i_this->mAction = ACTION_WAIT;
i_this->mActionPhase = PHASE_INIT;
}
@@ -868,7 +880,8 @@ static void e_st_shoot(e_st_class* i_this) {
break;
}
case SHOOT_PHASE_WAIT02:
case SHOOT_PHASE_WAIT02: {
int _; // needed to force b statement at end of case in dbg asm
if (i_this->mTimers[0] == 0) {
if (daPy_getPlayerActorClass()->getStCaught() && fopAcM_GetParam(a_this) == 1) {
i_this->mAction = ACTION_JUMP_ATTACK;
@@ -880,6 +893,7 @@ static void e_st_shoot(e_st_class* i_this) {
}
}
break;
}
}
cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mAngleFromPlayer, 4, 0x1000);
@@ -1002,7 +1016,8 @@ static void e_st_jump_attack(e_st_class* i_this) {
pos = i_this->field_0x5bc - a_this->current.pos;
f32 fVar2 = pos.abs();
i_this->field_0x71c = cM_ssin((s16)((fVar2 / fVar1) * 32768.0f)) * 100.0f;
s16 sp_0xa = fVar2 / fVar1 * 32768.0f;
i_this->field_0x71c = cM_ssin(sp_0xa) * 100.0f;
if (unk_flag == 1) {
cLib_addCalcAngleS2(&i_this->field_0x69c.y, 0, 4, 0x800);
@@ -1020,6 +1035,7 @@ static void e_st_jump_attack(e_st_class* i_this) {
}
static void roof_line_calc(e_st_class* i_this) {
fopAc_ac_c* a_this = &i_this->actor;
cXyz sp40, sp4c;
sp40 = (i_this->field_0x744 - i_this->field_0x710) * (1.0f / 19.0f);
@@ -1036,9 +1052,9 @@ static void roof_line_calc(e_st_class* i_this) {
i_this->mAction = ACTION_HANG_DROP;
i_this->mActionPhase = PHASE_INIT;
def_se_set(&i_this->mSound, i_this->mLineCyl.GetTgHitObj(), 0x21, NULL);
pos_p = i_this->mLineCyl.GetTgHitPosP();
cXyz* tg_hit_pos_p = i_this->mLineCyl.GetTgHitPosP();
i_this->field_0x750 = i_this->field_0x744;
i_this->field_0x750.y = pos_p->y;
i_this->field_0x750.y = tg_hit_pos_p->y;
i_this->field_0x764 = i_this->field_0x750.y - i_this->field_0x710.y;
if (i_this->field_0x764 < 0.0f) {
@@ -1062,6 +1078,7 @@ static void roof_line_calc(e_st_class* i_this) {
}
static void roof_line_calc2(e_st_class* i_this) {
fopAc_ac_c* a_this = &i_this->actor;
cXyz sp50, sp5c;
sp50 = (i_this->field_0x744 - i_this->field_0x750) * 0.05263158f;
@@ -1163,8 +1180,10 @@ static void e_st_hang(e_st_class* i_this) {
cLib_addCalcAngleS2(&a_this->current.angle.y, fopAcM_searchPlayerAngleY(a_this), 0x10, 0x200);
if (i_this->arg1 == 0 && i_this->mTimers[1] == 0) {
int _;
if (!daPy_getPlayerActorClass()->getStCaught() && fopAcM_searchPlayerDistanceXZ(a_this) < 300.0f && a_this->current.pos.y - player->current.pos.y > 0.0f) {
if (a_this->current.pos.y - dComIfGp_getPlayer(0)->current.pos.y > 1000.0f) {
fopAc_ac_c* pla_2_p = dComIfGp_getPlayer(0);
if (a_this->current.pos.y - pla_2_p->current.pos.y > 1000.0f) {
i_this->mAction = ACTION_HANG_DROP;
i_this->field_0x750 = i_this->field_0x710;
i_this->field_0x720 = 2;
@@ -1308,9 +1327,7 @@ static void e_st_hang_drop(e_st_class* i_this) {
cLib_addCalcAngleS2(&i_this->field_0x69c.x, 0, 1, 0x1000);
if (i_this->mpModelMorf->isStop()) {
i_this->field_0x69c.y = 0;
i_this->field_0x69c.x = 0;
a_this->current.angle.x = 0;
a_this->current.angle.x =i_this->field_0x69c.x = i_this->field_0x69c.y = 0;
i_this->mAction = ACTION_G_NORMAL;
i_this->mActionPhase = PHASE_INIT;
i_this->arg0 = 2;
@@ -1371,7 +1388,7 @@ static s8 e_st_hang_2(e_st_class* i_this) {
pos.set(a_this->current.pos.x, a_this->current.pos.y, a_this->current.pos.z);
if (fopAcM_gc_c::gndCheck(&pos)) {
pos.y = TREG_F(7) + fopAcM_gc_c::getGroundY() + 120.0f + 20.0f;
pos.y = fopAcM_gc_c::getGroundY() + 120.0f + TREG_F(7) + 20.0f;
if (i_this->mBgPos.y < pos.y) {
i_this->mBgPos.y = pos.y;
@@ -1566,8 +1583,7 @@ static void e_st_damage(e_st_class* i_this) {
MtxPosition(&sp54, &a_this->speed);
}
i_this->field_0x6a2 = 0;
i_this->field_0x6a4 = 0;
i_this->field_0x6a4 = i_this->field_0x6a2 = 0;
i_this->mTimers[2] = 10;
break;
@@ -1634,10 +1650,8 @@ static void e_st_damage(e_st_class* i_this) {
}
f32 fVar2 = i_this->mTimers[1] * (TREG_F(14) + 150.0f);
f32 fVar3 = cM_ssin(i_this->mTimers[1] * 4000);
s16 target = fVar2 * fVar3 + 32768.0f;
cLib_addCalcAngleS2(&a_this->current.angle.x, target, 4, maxStep);
cLib_addCalcAngleS2(&a_this->current.angle.z, (s16)(fVar2 * cM_scos(i_this->mTimers[1] * 3000)), 4, maxStep);
cLib_addCalcAngleS2(&a_this->current.angle.x, fVar2 * cM_ssin(i_this->mTimers[1] * 4000) + 32768.0f, 4, maxStep);
cLib_addCalcAngleS2(&a_this->current.angle.z, fVar2 * cM_scos(i_this->mTimers[1] * 3000), 4, maxStep);
if (i_this->mActionPhase == DAMAGE_PHASE_4) {
cLib_addCalc0(&i_this->field_0x7f4, 1.0f, 0.1f);
@@ -1653,7 +1667,6 @@ static void e_st_damage(e_st_class* i_this) {
if (i_this->mActionPhase >= DAMAGE_PHASE_4) {
cLib_addCalcAngleS2(&i_this->field_0x7d4, 0, 1, 0x50);
}
break;
}
cLib_addCalcAngleS2(&i_this->field_0x69c.y, 0, 4, maxStep);
@@ -1670,6 +1683,7 @@ static void e_st_damage(e_st_class* i_this) {
static void e_st_water(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz pos_delta, sp58;
f32 reg_f30 = 0.0f;
pos_delta = a_this->home.pos - a_this->current.pos;
@@ -1692,7 +1706,8 @@ static void e_st_water(e_st_class* i_this) {
}
if (i_this->mTimers[0] == 0) {
fopAcM_createDisappear(a_this, &a_this->current.pos, l_HIO.basic_size * 10.0f, 0, 6);
u8 size = l_HIO.basic_size * 10.0f;
fopAcM_createDisappear(a_this, &a_this->current.pos, size, 0, 6);
fopAcM_delete(a_this);
if (i_this->mSwBit != 0xFF) {
@@ -1736,7 +1751,11 @@ static BOOL water_check(e_st_class* i_this) {
i_this->mGroundCross = dComIfG_Bgsp().GroundCross(&gnd_chk_spl);
}
return i_this->mGroundCross > a_this->current.pos.y + 10.0f + WREG_F(11) ? TRUE : FALSE;
if (i_this->mGroundCross > a_this->current.pos.y + 10.0f + WREG_F(11)) {
return TRUE;
} else {
return FALSE;
}
}
static BOOL gr_check(e_st_class* i_this) {
@@ -1748,7 +1767,8 @@ static BOOL gr_check(e_st_class* i_this) {
pos.z = a_this->current.pos.z;
gnd_chk.SetPos(&pos);
if (a_this->current.pos.y - dComIfG_Bgsp().GroundCross(&gnd_chk) > 200.0f) {
f32 gnd_cross = dComIfG_Bgsp().GroundCross(&gnd_chk);
if (a_this->current.pos.y - gnd_cross > 200.0f) {
return TRUE;
}
@@ -1759,6 +1779,8 @@ static void e_st_g_normal(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz pos, sp58;
f32 target = 0.0f;
f32 reg_f30 = 1.0f;
s16 angle_delta;
switch (i_this->mActionPhase) {
case PHASE_INIT:
@@ -1772,16 +1794,15 @@ static void e_st_g_normal(e_st_class* i_this) {
if (i_this->mTimers[0] == 0) {
i_this->mActionPhase = G_NORMAL_PHASE_TURN;
pos.x = a_this->home.pos.x + cM_rndFX(700.0f);
f32 rndValue = cM_rndFX(700.0f);
pos.z = a_this->home.pos.z + rndValue;
pos.z = a_this->home.pos.z + cM_rndFX(700.0f);
pos.x -= a_this->current.pos.x;
pos.z -= a_this->current.pos.z;
i_this->mAngleFromPlayer = cM_atan2s(pos.x, pos.z);
i_this->mAngleFromPlayer = cM_atan2s(pos.x, pos.z);
}
break;
case G_NORMAL_PHASE_TURN: {
s16 angle_delta = i_this->mAngleFromPlayer - a_this->current.angle.y;
angle_delta = i_this->mAngleFromPlayer - a_this->current.angle.y;
if (angle_delta < 0x800 && angle_delta > -0x800) {
anm_init(i_this, BCK_ST_MOVE, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f);
i_this->mActionPhase = G_NORMAL_PHASE_MOVE;
@@ -1801,7 +1822,7 @@ static void e_st_g_normal(e_st_class* i_this) {
break;
}
cLib_addCalc2(&a_this->speedF, target, 1.0f, 1.0f);
cLib_addCalc2(&a_this->speedF, target, 1.0f, reg_f30);
cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mAngleFromPlayer, 2, 0x100);
if (pl_check(i_this, l_HIO.pl_recognize_dist)) {
@@ -1815,6 +1836,7 @@ static s8 e_st_g_fight(e_st_class* i_this) {
cXyz sp64, sp70;
int frame = i_this->mpModelMorf->getFrame();
f32 target = 0.0f;
f32 reg_f29 = 2.0f;
s16 maxStep = 0x200;
s8 isStop = false;
s8 isPreparingAttack = false;
@@ -1885,7 +1907,7 @@ static s8 e_st_g_fight(e_st_class* i_this) {
break;
}
cLib_addCalc2(&a_this->speedF, target, 1.0f, 2.0f);
cLib_addCalc2(&a_this->speedF, target, 1.0f, reg_f29);
cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mAngleFromPlayer, 2, maxStep);
if (isPreparingAttack && i_this->mPlayerDistance > combat_start_dist + 100.0f) {
@@ -1899,7 +1921,8 @@ static s8 e_st_g_fight(e_st_class* i_this) {
}
if (i_this->mAtSph.ChkAtHit()) {
fopAc_ac_c* actor_p = dCc_GetAc(i_this->mAtSph.GetAtHitObj()->GetAc());
cCcD_Obj* at_hit_obj_p = i_this->mAtSph.GetAtHitObj();
fopAc_ac_c* actor_p = dCc_GetAc(at_hit_obj_p->GetAc());
if (actor_p != NULL && fopAcM_GetName(actor_p) == PROC_ALINK) {
dComIfGp_getVibration().StartShock(VIBMODE_S_POWER4, 31, cXyz(0.0f, 1.0f, 0.0f));
}
@@ -1911,6 +1934,9 @@ static s8 e_st_g_fight(e_st_class* i_this) {
static s8 e_st_g_def(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
cXyz sp48, sp54;
f32 reg_f31 = 0.0f;
f32 reg_f30 = 2.0f;
s8 rv = 1;
i_this->field_0xcf4 = 1;
@@ -1920,7 +1946,7 @@ static s8 e_st_g_def(e_st_class* i_this) {
i_this->mSound.startCreatureVoice(Z2SE_EN_ST_V_DEFENSE, -1);
i_this->mActionPhase = G_DEF_PHASE_DEFENSE;
break;
case G_DEF_PHASE_DEFENSE:
if (i_this->mpModelMorf->isStop()) {
i_this->mAction = ACTION_G_FIGHT;
@@ -1929,16 +1955,18 @@ static s8 e_st_g_def(e_st_class* i_this) {
break;
}
cLib_addCalc2(&a_this->speedF, 0.0f, 1.0f, 2.0f);
return 1;
cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, reg_f30);
return rv;
}
static void e_st_g_damage(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
f32 reg_f31 = 0.0f;
f32 reg_f30 = 2.0f;
switch (i_this->mActionPhase) {
case PHASE_INIT:
if ((i_this->mHorizHitDir & 1) != 0) {
if ((s8(i_this->mHorizHitDir) & 1) != 0) {
anm_init(i_this, BCK_ST_HITL, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f);
} else {
anm_init(i_this, BCK_ST_HITR, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f);
@@ -1948,7 +1976,7 @@ static void e_st_g_damage(e_st_class* i_this) {
i_this->mHorizHitDir++;
i_this->mActionPhase = G_DAMAGE_PHASE_HIT;
break;
case G_DAMAGE_PHASE_HIT:
if (i_this->mpModelMorf->isStop()) {
i_this->mAction = ACTION_G_FIGHT;
@@ -1957,11 +1985,13 @@ static void e_st_g_damage(e_st_class* i_this) {
break;
}
cLib_addCalc2(&a_this->speedF, 0.0f, 1.0f, 2.0f);
cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, reg_f30);
}
static void e_st_g_s_damage(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
f32 reg_f31 = 0.0f;
f32 reg_f30 = 2.0f;
switch (i_this->mActionPhase) {
case PHASE_INIT:
@@ -1969,7 +1999,7 @@ static void e_st_g_s_damage(e_st_class* i_this) {
anm_init(i_this, BCK_ST_DAMAGE, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f);
i_this->mSound.startCreatureVoice(Z2SE_EN_ST_V_NODAMAGE, -1);
break;
case G_S_DAMAGE_PHASE_NODAMAGE:
if (i_this->mpModelMorf->isStop()) {
i_this->mAction = ACTION_G_FIGHT;
@@ -1978,7 +2008,7 @@ static void e_st_g_s_damage(e_st_class* i_this) {
break;
}
cLib_addCalc2(&a_this->speedF, 0.0f, 1.0f, 2.0f);
cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, reg_f30);
}
static void e_st_g_wind(e_st_class* i_this) {
@@ -2004,8 +2034,11 @@ static void e_st_g_wind(e_st_class* i_this) {
}
static void e_st_g_chance(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
fopAc_ac_c* a_this = &i_this->actor;
fopEn_enemy_c* enemy_a_this = (fopEn_enemy_c*) a_this;
cXyz sp3c, sp48;
f32 reg_f31 = 0.0f;
f32 reg_f30 = 4.0f;
i_this->field_0xcf4 = 2;
@@ -2014,7 +2047,7 @@ static void e_st_g_chance(e_st_class* i_this) {
anm_init(i_this, BCK_ST_DAWNA, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f);
i_this->mSound.startCreatureVoice(Z2SE_EN_ST_V_DAWNA, -1);
i_this->mActionPhase = G_CHANCE_PHASE_DAWNA;
a_this->onDownFlg();
enemy_a_this->onDownFlg();
break;
case G_CHANCE_PHASE_DAWNA:
@@ -2029,7 +2062,7 @@ static void e_st_g_chance(e_st_class* i_this) {
i_this->mTimers[0] = l_HIO.down_time;
}
break;
case G_CHANCE_PHASE_DAWNB:
if (i_this->mAnm == BCK_ST_DAWNC && i_this->mpModelMorf->isStop()) {
anm_init(i_this, BCK_ST_DAWNB, 3.0f, J3DFrameCtrl::EMode_LOOP, 1.0f);
@@ -2046,19 +2079,19 @@ static void e_st_g_chance(e_st_class* i_this) {
if (i_this->mpModelMorf->isStop()) {
i_this->mAction = ACTION_G_FIGHT;
i_this->mActionPhase = PHASE_INIT;
a_this->offDownFlg();
enemy_a_this->offDownFlg();
}
break;
}
cLib_addCalc2(&a_this->speedF, 0.0f, 1.0f, 4.0f);
a_this->setDownPos(&a_this->current.pos);
cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, reg_f30);
enemy_a_this->setDownPos(&a_this->current.pos);
if (a_this->checkCutDownHitFlg()) {
if (enemy_a_this->checkCutDownHitFlg()) {
i_this->mAction = ACTION_G_END;
i_this->mActionPhase = PHASE_INIT;
a_this->offCutDownHitFlg();
a_this->offDownFlg();
enemy_a_this->offCutDownHitFlg();
enemy_a_this->offDownFlg();
i_this->mDeathFlag = 1;
daPy_getPlayerActorClass()->onEnemyDead();
}
@@ -2066,11 +2099,13 @@ static void e_st_g_chance(e_st_class* i_this) {
static s8 e_st_g_end(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
fopAc_ac_c* base_a_this = a_this;
cXyz sp58, sp64;
f32 reg_f31 = 0.0f;
f32 reg_f30 = 4.0f;
s8 rv = 1;
i_this->mDefTimer = 10;
i_this->mInvulnerabilityTimer = 10;
i_this->mInvulnerabilityTimer = i_this->mDefTimer = 10;
switch (i_this->mActionPhase) {
case PHASE_INIT:
@@ -2078,14 +2113,15 @@ static s8 e_st_g_end(e_st_class* i_this) {
i_this->mSound.startCreatureVoice(Z2SE_EN_ST_V_DEATH2, -1);
i_this->mActionPhase = G_END_PHASE_DEATH2;
break;
case G_END_PHASE_DEATH2:
if (i_this->mpModelMorf->checkFrame(36.5f)) {
i_this->mSound.startCreatureSound(Z2SE_CM_BODYFALL_S, 0, -1);
}
if (i_this->mpModelMorf->isStop()) {
fopAcM_createDisappear(a_this, &a_this->current.pos, l_HIO.basic_size * 10.0f, 0, 6);
u8 size = l_HIO.basic_size * 10.0f;
fopAcM_createDisappear(a_this, &a_this->current.pos, size, 0, 6);
fopAcM_delete(a_this);
if (i_this->mSwBit != 0xFF) {
@@ -2108,7 +2144,8 @@ static s8 e_st_g_end(e_st_class* i_this) {
}
if (i_this->mpModelMorf->isStop()) {
fopAcM_createDisappear(a_this, &a_this->current.pos, l_HIO.basic_size * 10.0f, 0, 6);
u8 size = l_HIO.basic_size * 10.0f;
fopAcM_createDisappear(a_this, &a_this->current.pos, size, 0, 6);
fopAcM_delete(a_this);
if (i_this->mSwBit != 0xFF) {
@@ -2122,7 +2159,7 @@ static s8 e_st_g_end(e_st_class* i_this) {
a_this->speedF = 0.0f;
}
cLib_addCalc2(&a_this->speedF, 0.0f, 1.0f, 4.0f);
cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, reg_f30);
return rv;
}
@@ -2196,7 +2233,7 @@ static void damage_check_g(e_st_class* i_this) {
def_se_set(&i_this->mSound, i_this->mDefSph.GetTgHitObj(), 0x34, NULL);
dScnPly_c::setPauseTimer(4);
i_this->mDefTimer = 10;
cMtx_YrotS(*calc_mtx, a_this->shape_angle.y);
cMtx_YrotS(*calc_mtx, s16(a_this->shape_angle.y));
sp24.x = KREG_F(0);
sp24.y = KREG_F(1) + 100.0f;
sp24.z = KREG_F(2) + 50.0f;
@@ -2215,15 +2252,16 @@ static void damage_check_g(e_st_class* i_this) {
static void ground_angle_set(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
dComIfGp_getPlayer(0);
fopAc_ac_c* player = dComIfGp_getPlayer(0); // unused
s16 sVar1 = 0;
s16 sVar2 = 0;
Vec spbc;
cXyz spc8, spd4;
dBgS_GndChk gnd_chk;
f32 scale = (VREG_F(11) + 58.0f) * l_HIO.basic_size;
f32 reg_f31, reg_f29, reg_f28;
if (i_this->mBgc.GetGroundH() != -1e9f) {
Vec spbc;
spbc.x = a_this->current.pos.x;
spbc.y = a_this->current.pos.y + 100.0f;
spbc.z = a_this->current.pos.z + scale;
@@ -2231,7 +2269,9 @@ static void ground_angle_set(e_st_class* i_this) {
spbc.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if (spbc.y != -1e9f) {
sVar2 = -cM_atan2s(spbc.y - a_this->current.pos.y, spbc.z - a_this->current.pos.z);
reg_f31 = spbc.y - a_this->current.pos.y;
reg_f28 = spbc.z - a_this->current.pos.z;
sVar2 = -cM_atan2s(reg_f31, reg_f28);
if (sVar2 > 0x2000 || sVar2 < -0x2000) {
sVar2 = 0;
}
@@ -2244,7 +2284,9 @@ static void ground_angle_set(e_st_class* i_this) {
spbc.y = dComIfG_Bgsp().GroundCross(&gnd_chk);
if (spbc.y != -1e9f) {
sVar1 = (s16)cM_atan2s(spbc.y - a_this->current.pos.y, spbc.x - a_this->current.pos.x);
reg_f31 = spbc.y - a_this->current.pos.y;
reg_f29 = spbc.x - a_this->current.pos.x;
sVar1 = (s16)cM_atan2s(reg_f31, reg_f29);
if (sVar1 > 0x2000 || sVar1 < -0x2000) {
sVar1 = 0;
}
@@ -2279,8 +2321,7 @@ static BOOL foot_control(e_st_class* i_this, st_foot* foot_p) {
foot_p->mAngles[1] = foot_p->field_0x0 * l_HIO.field_0x1c;
foot_p->mAngles[2] = foot_p->field_0x0 * l_HIO.field_0x20;
} else {
foot_p->mAngles[2] = 0;
foot_p->mAngles[1] = 0;
foot_p->mAngles[1] = foot_p->mAngles[2] = 0;
}
return rv;
@@ -2543,7 +2584,7 @@ static void action(e_st_class* i_this) {
if (dComIfG_Bgsp().LineCross(&lin_chk)) {
sp9c.x = 0.0f;
sp9c.y = 0.0f;
sp9c.z = TREG_F(11) + fabsf(a_this->speedF) + 30.0f;
sp9c.z = fabsf(a_this->speedF) + 30.0f + TREG_F(11);
MtxPosition(&sp9c, &spa8);
a_this->current.pos += spa8;
}
@@ -2687,11 +2728,7 @@ static int daE_ST_Execute(e_st_class* i_this) {
cMtx_YrotS(*calc_mtx, i_this->field_0x7f2);
pos.x = 0.0f;
pos.y = 0.0f;
#if VERSION == VERSION_WII_USA_R0
pos.z = i_this->field_0x7ec * -cM_ssin(i_this->field_0x7f0 * (TREG_S(4) + 900));
#else
pos.z = i_this->field_0x7ec * -cM_ssin(i_this->field_0x7f0 * (TREG_F(4) + 900));
#endif
MtxPosition(&pos, &offset);
i_this->field_0x7f0++;
cLib_addCalc0(&i_this->field_0x7ec, 1.0f, 0.1f);
@@ -2841,17 +2878,19 @@ static int daE_ST_Execute(e_st_class* i_this) {
return 1;
}
static int daE_ST_IsDelete(e_st_class* i_this) {
static int daE_ST_IsDelete(e_st_class*) {
return 1;
}
static int daE_ST_Delete(e_st_class* i_this) {
fopEn_enemy_c* a_this = (fopEn_enemy_c*)&i_this->actor;
fopAcM_RegisterDeleteID(i_this, "E_ST");
dComIfG_resDelete(&i_this->mPhase, "E_st");
if (i_this->mIsFirstSpawn) {
hio_set = false;
mDoHIO_DELETE_CHILD(l_HIO.id);
}
if (a_this->heap != NULL) {
@@ -2899,7 +2938,7 @@ static int useHeapInit(fopAc_ac_c* a_this) {
}
J3DModel* model = i_this->mpModelMorf->getModel();
model->setUserArea((uintptr_t)a_this);
model->setUserArea((uintptr_t)i_this);
for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) {
model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack);
@@ -2968,7 +3007,7 @@ static BOOL roof_initial_pos_set(e_st_class* i_this) {
static cPhs__Step daE_ST_Create(fopAc_ac_c* a_this) {
e_st_class* i_this = (e_st_class*)a_this;
fopAcM_ct(a_this, e_st_class);
fopAcM_ct(&i_this->actor, e_st_class);
cPhs__Step phase = (cPhs__Step)dComIfG_resLoad(&i_this->mPhase, "E_st");
if (phase == cPhs_COMPLEATE_e) {
@@ -2983,17 +3022,17 @@ static cPhs__Step daE_ST_Create(fopAc_ac_c* a_this) {
i_this->arg1 = 0;
}
i_this->arg2 = fopAcM_GetParam(a_this) >> 8;
i_this->arg2 = (fopAcM_GetParam(a_this) & 0xFF00) >> 8;
if (i_this->arg2 == 0xFF) {
i_this->arg2 = 0;
}
i_this->arg3 = fopAcM_GetParam(a_this) >> 16;
i_this->arg3 = (fopAcM_GetParam(a_this) & 0xFF0000) >> 16;
if (i_this->arg3 == 0xFF) {
i_this->arg3 = 0;
}
i_this->mSwBit = fopAcM_GetParam(a_this) >> 24;
i_this->mSwBit = (fopAcM_GetParam(a_this) & 0xFF000000) >> 24;
if (i_this->mSwBit != 0xFF) {
if (dComIfGs_isSwitch(i_this->mSwBit, fopAcM_GetRoomNo(a_this))) {
return cPhs_ERROR_e;
@@ -3049,9 +3088,9 @@ static cPhs__Step daE_ST_Create(fopAc_ac_c* a_this) {
if (!hio_set) {
i_this->mIsFirstSpawn = true;
hio_set = true;
l_HIO.id = -1;
l_HIO.id = mDoHIO_CREATE_CHILD("スタルチュラ", &l_HIO);
}
a_this->attention_info.flags = fopAc_AttnFlag_BATTLE_e;
fopAcM_SetMtx(a_this, i_this->mpModelMorf->getModel()->getBaseTRMtx());
fopAcM_SetMin(a_this, -200.0f, -4000.0f, -200.0f);
@@ -3141,11 +3180,9 @@ static cPhs__Step daE_ST_Create(fopAc_ac_c* a_this) {
i_this->mAcchCir.SetWall(60.0f, 60.0f);
if (small) {
a_this->health = 0;
a_this->field_0x560 = 0;
a_this->field_0x560 = a_this->health = 0;
} else {
a_this->health = 80;
a_this->field_0x560 = 80;
a_this->field_0x560 = a_this->health = 80;
}
i_this->mFrameCounter = cM_rndF(65535.0f);
+1 -1
View File
@@ -3884,7 +3884,7 @@ static void demo_camera(e_wb_class* i_this) {
i_this->field_0x1714 = 55.0f + KREG_F(7);
i_this->field_0x16a0 = 0;
s16 sp16 = local_194->actor.shape_angle.y +
(local_194->field_0xa0e - local_194->actor.shape_angle.y) / 2;
(local_194->field_0xa0c.y - local_194->actor.shape_angle.y) / 2;
mDoMtx_stack_c::YrotS(sp16);
local_3c.x = NREG_F(0);
local_3c.y = NREG_F(1) + 500.0f;
+86 -89
View File
@@ -326,29 +326,11 @@ static void* s_b_sub(void* i_actor, void* i_data) {
static int target_bgc[10];
// FIXME: possible fakematch?
#if DEBUG
// fakematch to get proper casting
#define NPC_KS_18DEG_ROT (s16) 0x800
#define NPC_KS_36DEG_ROT (s16) 0x1600
#define NPC_KS_45DEG_ROT (s16) 0x2000
#define NPC_KS_90DEG_ROT (s16) 0x4000
#define NPC_KS_180DEG_ROT (s16) 0x8000
#define NPC_KS_NEG_180DEG_ROT (s16) -0x8000
#define NPC_KS_FABSF fabsf
#else
#define NPC_KS_18DEG_ROT 0x800
#define NPC_KS_36DEG_ROT 0x1600
#define NPC_KS_45DEG_ROT 0x2000
#define NPC_KS_90DEG_ROT 0x4000
#define NPC_KS_180DEG_ROT 0x8000
#define NPC_KS_NEG_180DEG_ROT -0x8000
#define NPC_KS_FABSF std::fabsf
#endif
static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) {
@@ -706,7 +688,7 @@ static int npc_ks_ori(npc_ks_class* i_this) {
if (i_this->timer[0] == 1) {
anm_init(i_this, 32, 2.0f, 0, 1.0f);
if (fopAcM_GetRoomNo(actor) == 11) {
actor->current.angle.y += NPC_KS_36DEG_ROT;
ADD_ANGLE_2(actor->current.angle.y, 0x1600);
}
}
@@ -854,7 +836,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) {
break;
case 2:
sVar1 += NPC_KS_NEG_180DEG_ROT;
ADD_ANGLE_2(sVar1, -0x8000);
if (i_this->timer[0] == 0) {
if (cage_p->partBreak()) {
anm_init(i_this, 22, 5.0f, 2, 1.0f);
@@ -926,7 +908,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) {
case 6:
i_this->field_0x5fc = 0;
fVar1 = -20.0f;
sVar1 += NPC_KS_45DEG_ROT;
ADD_ANGLE_2(sVar1, 0x2000);
if (i_this->model->isStop()) {
anm_init(i_this, 33, 1.0f, 0, 1.0f);
actor->speedF = 40.0f;
@@ -941,7 +923,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) {
case 7:
i_this->field_0x5fc = 0;
sVar1 += NPC_KS_90DEG_ROT;
ADD_ANGLE_2(sVar1, 0x4000);
actor->gravity = -5.0f;
break;
@@ -1115,7 +1097,7 @@ static path move_path_02[5] = {
static int npc_ks_demo_02(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_p = dComIfGp_getPlayer(0);
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
cXyz mae, ato;
f32 speed = 0.0f;
int rv = 1;
@@ -2187,7 +2169,7 @@ static void npc_ks_hang_s(npc_ks_class* i_this) {
s16 sVar2 = i_this->field_0x602;
cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000);
i_this->field_0x604 = i_this->field_0x602 - sVar2;
i_this->field_0x5fa += NPC_KS_18DEG_ROT;
ADD_ANGLE_2(i_this->field_0x5fa, 0x800);
actor->current.angle.z = -(i_this->field_0x602 / 4);
if (i_this->field_0x620 != 2) {
@@ -2267,7 +2249,7 @@ static void npc_ks_e_hang(npc_ks_class* i_this) {
actor->current.pos = sw_p->field_0x920[i_this->field_0x630];
cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000);
i_this->field_0x5fa += NPC_KS_18DEG_ROT;
ADD_ANGLE_2(i_this->field_0x5fa, 0x800);
actor->current.angle.z = -(i_this->field_0x602 / 4);
cLib_addCalc0(&i_this->field_0x60c, 0.5f, 100.0f + TREG_F(3));
}
@@ -3229,8 +3211,10 @@ static void demo_camera(npc_ks_class* i_this) {
if (midna_p->checkShadowReturnEnd() != 0) {
i_this->demo_mode = 100;
}
break;
}
// fallthrough intentional
default:
break;
case 300:
if (!actor->eventInfo.checkCommandDemoAccrpt()) {
@@ -3439,14 +3423,15 @@ static void demo_camera(npc_ks_class* i_this) {
i_this->msg_flow.doFlow(actor, NULL, 0);
break;
case 363:
case 363: {
int _; // force b asm at end of case in dbg asm
cam_3d_morf(i_this, 0.1f + BREG_F(17));
cLib_addCalc2(&i_this->field_0xbc4, 0.3f + BREG_F(18), 1.0f, 0.01f + BREG_F(19));
if (i_this->msg_flow.doFlow(actor, NULL, 0) != 0) {
i_this->demo_mode = 100;
}
break;
}
}
if (i_this->demo_mode == 99 || i_this->demo_mode == 98) {
@@ -3899,7 +3884,7 @@ static int npc_ks_option(npc_ks_class* i_this) {
case 30:
target_speed = l_HIO.holding_speed_h;
i_this->current_angle.y += NPC_KS_180DEG_ROT;
ADD_ANGLE_2(i_this->current_angle.y, 0x8000);
if (fVar2 > 400.0f) {
i_this->mode = 31;
anm_init(i_this, 51, 5.0f, 2, 1.0f);
@@ -3920,8 +3905,7 @@ static int npc_ks_option(npc_ks_class* i_this) {
anm_init(i_this, 39, 5.0f, 2, 1.0f);
i_this->mode = 41;
i_this->timer[0] = cM_rndF(80.0f) + 100.0f;
// ditto.
i_this->current_angle.y += NPC_KS_180DEG_ROT;
ADD_ANGLE_2(i_this->current_angle.y, 0x8000);
break;
case 41:
@@ -4247,7 +4231,7 @@ static int npc_ks_guide_00(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (i_this->dis > 700.0f || guide_path_00[i_this->path_no].field_0x0 < 0) {
if (i_this->dis > 700.0f + YREG_F(16) || guide_path_00[i_this->path_no].field_0x0 < 0) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -4285,7 +4269,7 @@ static int npc_ks_guide_00(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle;
}
if (i_this->dis < 550.0f && guide_path_00[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 550.0f + YREG_F(17) && guide_path_00[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
} else {
if (i_this->dis < 150.0f && i_this->res_id != 51) {
@@ -4301,7 +4285,7 @@ static int npc_ks_guide_00(npc_ks_class* i_this) {
mae.y = player->current.pos.y - (i_this->child_no->field_0x904[0].y - 450.0f);
mae.z = player->current.pos.z - i_this->child_no->field_0x904[0].z;
if (mae.abs() < 300.0f) {
if (mae.abs() < 300.0f + YREG_F(11)) {
i_this->field_0xbd9 = 1;
i_this->action = 20;
i_this->mode = 0;
@@ -4390,6 +4374,7 @@ static int npc_ks_guide_00(npc_ks_class* i_this) {
static int npc_ks_guide_00_2(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
cXyz mae, ato;
int rv = 1;
int frame = i_this->model->getFrame();
@@ -4402,7 +4387,7 @@ static int npc_ks_guide_00_2(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (i_this->dis > 900.0f || guide_path_00_2[i_this->path_no].field_0x0 < 0) {
if (i_this->dis > 900.0f + YREG_F(16) || guide_path_00_2[i_this->path_no].field_0x0 < 0) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -4444,7 +4429,7 @@ static int npc_ks_guide_00_2(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle + 0x8000;
}
if (i_this->dis < 750.0f && guide_path_00_2[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 750.0f + YREG_F(17) && guide_path_00_2[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
}
}
@@ -4468,6 +4453,8 @@ static int npc_ks_guide_00_2(npc_ks_class* i_this) {
static int npc_ks_guide_00_3(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
cXyz mae, ato;
int rv = 1;
int frame = i_this->model->getFrame();
@@ -4480,7 +4467,7 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (i_this->dis > 500.0f || guide_path_00_3[i_this->path_no].field_0x0 < 0) {
if (i_this->dis > 500.0f + YREG_F(16) || guide_path_00_3[i_this->path_no].field_0x0 < 0) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -4505,7 +4492,7 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) {
mae.x = i_this->guide_path.x - actor->current.pos.x;
mae.z = i_this->guide_path.z - actor->current.pos.z;
i_this->current_angle.y = cM_atan2s(mae.x, mae.z);
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) {
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * (1.2f + JREG_F(12))) {
i_this->path_no++;
i_this->mode = 1;
}
@@ -4518,7 +4505,7 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle;
}
if (i_this->dis < 400.0f && guide_path_00_3[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 400.0f + YREG_F(17) && guide_path_00_3[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
} else {
if (i_this->dis < 150.0f && i_this->res_id != 51) {
@@ -4599,6 +4586,7 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) {
static int npc_ks_guide_01(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
cXyz mae, ato;
int rv = 1;
int frame = i_this->model->getFrame();
@@ -4617,7 +4605,7 @@ static int npc_ks_guide_01(npc_ks_class* i_this) {
// fallthrough
case 1:
case 101:
if (i_this->mode == 1 && (i_this->dis > 900.0f || guide_path_01[i_this->path_no].field_0x0 < 0)) {
if (i_this->mode == 1 && (i_this->dis > 900.0f + YREG_F(16) || guide_path_01[i_this->path_no].field_0x0 < 0)) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -4651,7 +4639,7 @@ static int npc_ks_guide_01(npc_ks_class* i_this) {
rv = 2;
if (i_this->res_id == 32 && i_this->model->isStop()) {
anm_init(i_this, 33, 1.0f, 0, 1.0f);
actor->speedF = 40.0f;
actor->speedF = 40.0f + TREG_F(9);
i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1);
@@ -4687,7 +4675,7 @@ static int npc_ks_guide_01(npc_ks_class* i_this) {
}
if (guide_path_01[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 600.0f) {
if (i_this->dis < 600.0f + YREG_F(17)) {
i_this->mode = 1;
}
@@ -4703,7 +4691,7 @@ static int npc_ks_guide_01(npc_ks_class* i_this) {
} else if (i_this->dis < 150.0f) {
i_this->action = 100;
i_this->mode = 0;
return 1;
return rv;
}
break;
@@ -4871,7 +4859,8 @@ static int npc_ks_guide_02(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle + 0x8000;
}
if (((player->current.pos.y - actor->current.pos.y) > 10.0f || i_this->dis < (fVar1 - 150.0f)) && guide_path_02[i_this->path_no].field_0x0 >= 0) {
if (((player->current.pos.y - actor->current.pos.y) > 10.0f || i_this->dis < (fVar1 - 150.0f + YREG_F(7)))
&& guide_path_02[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
}
@@ -4937,6 +4926,7 @@ static path guide_path_22[6] = {
static int npc_ks_guide_22(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
i_this->dis = fopAcM_searchPlayerDistance(actor);
cXyz mae, ato;
int rv = 1;
@@ -4950,7 +4940,7 @@ static int npc_ks_guide_22(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (i_this->dis > 500.0f || guide_path_22[i_this->path_no].field_0x0 < 0) {
if (i_this->dis > 500.0f + YREG_F(16) || guide_path_22[i_this->path_no].field_0x0 < 0) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -5008,7 +4998,7 @@ static int npc_ks_guide_22(npc_ks_class* i_this) {
mae.z = i_this->guide_path.z - actor->current.pos.z;
i_this->current_angle.y = cM_atan2s(mae.x, mae.z);
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) {
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * (1.2f + JREG_F(12))) {
i_this->path_no++;
i_this->mode = 1;
}
@@ -5021,7 +5011,7 @@ static int npc_ks_guide_22(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle;
}
if (i_this->dis < 300.0f && guide_path_22[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 300.0f + YREG_F(17) && guide_path_22[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
}
@@ -5121,7 +5111,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
cXyz mae, ato;
int rv = 1;
int frame = i_this->model->getFrame();
f32 fVar1 = 0.0f;
f32 fVar1 = 0.0f; // used but not changed
switch (i_this->mode) {
case 0:
@@ -5131,7 +5121,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (i_this->dis > 900.0f || guide_path_09[i_this->path_no].field_0x0 < 0) {
if (i_this->dis > 900.0f + YREG_F(16) || guide_path_09[i_this->path_no].field_0x0 < 0) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -5166,7 +5156,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
rv = 2;
if (i_this->res_id == 32 && i_this->model->isStop()) {
anm_init(i_this, 33, 1.0f, 0, 1.0f);
actor->speedF = 40.0f;
actor->speedF = 40.0f + TREG_F(9);
i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1);
@@ -5202,14 +5192,14 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
}
if (guide_path_09[i_this->path_no].field_0x0 >= 0) {
if (i_this->dis < 600.0f) {
if (i_this->dis < 600.0f + YREG_F(17)) {
i_this->mode = 1;
}
} else {
if (i_this->dis < 150.0f && i_this->res_id != 51) {
anm_init(i_this, 51, 5.0f, 2, 1.0f);
}
if (i_this->res_id == 51) {
i_this->field_0x5fc = 1;
}
@@ -5249,7 +5239,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
}
}
cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800);
cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800);
if (checkDoorDemo()) {
i_this->action = 100;
@@ -5266,7 +5256,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
}
if (i_this->mode >= 40 && i_this->mode <= 41) {
fopAc_ac_c* enemy_p = enemy_check(i_this, 700.0f);
fopAc_ac_c* enemy_p = enemy_check(i_this, 700.0f + fVar1);
if (enemy_p == NULL) {
i_this->mode = 42;
i_this->timer[0] = 30;
@@ -5275,7 +5265,7 @@ static int npc_ks_guide_09(npc_ks_class* i_this) {
mae.z = enemy_p->current.pos.z - actor->current.pos.z;
i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000;
}
} else if (enemy_view_check(i_this, 600.0f) != NULL) {
} else if (enemy_view_check(i_this, 600.0f + fVar1) != NULL) {
i_this->mode = 40;
actor->speedF = 0.0f;
}
@@ -5299,6 +5289,7 @@ static int npc_ks_demo_12(npc_ks_class* i_this) {
cXyz mae, ato;
int rv = 1;
int frame = i_this->model->getFrame();
f32 reg_f31 = 0.0f; // unused
switch (i_this->mode) {
case 0:
@@ -5337,7 +5328,7 @@ static int npc_ks_demo_12(npc_ks_class* i_this) {
rv = 2;
if (i_this->res_id == 32 && i_this->model->isStop()) {
anm_init(i_this, 33, 1.0f, 0, 1.0f);
actor->speedF = 40.0f;
actor->speedF = 40.0f + TREG_F(9);
i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1);
i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1);
@@ -5399,7 +5390,7 @@ static path guide_path_0409[5] = {
static int npc_ks_guide_0409(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* player = dComIfGp_getPlayer(0);
cXyz mae;
cXyz mae, unused_vec;
int rv = 1;
int frame = i_this->model->getFrame();
@@ -5411,7 +5402,8 @@ static int npc_ks_guide_0409(npc_ks_class* i_this) {
actor->speedF = 0.0f;
// fallthrough
case 1:
if (player->current.pos.z > actor->current.pos.z && (i_this->dis > 700.0f || guide_path_0409[i_this->path_no].field_0x0 < 0)) {
if (player->current.pos.z > actor->current.pos.z
&& (i_this->dis > 700.0f + YREG_F(16) || guide_path_0409[i_this->path_no].field_0x0 < 0)) {
if ((call_pt & 1) != 0) {
anm_init(i_this, 8, 5.0f, 2, 1.0f);
} else {
@@ -5451,7 +5443,7 @@ static int npc_ks_guide_0409(npc_ks_class* i_this) {
i_this->current_angle.y = i_this->target_angle;
}
if ((i_this->dis < 550.0f || player->current.pos.z < actor->current.pos.z)
if ((i_this->dis < 550.0f + YREG_F(17) || player->current.pos.z < actor->current.pos.z)
&& guide_path_0409[i_this->path_no].field_0x0 >= 0) {
i_this->mode = 1;
} else {
@@ -5492,7 +5484,8 @@ static int path_search(npc_ks_class* i_this) {
while (path_index < 255) {
dPath* path_p = dPath_GetRoomPath(path_index, fopAcM_GetRoomNo(actor));
if (path_p != NULL) {
cXyz sp28 = actor->current.pos - path_p->m_points->m_position;
dPnt* pnt_p = path_p->m_points;
cXyz sp28 = actor->current.pos - pnt_p->m_position;
if (sp28.abs() < 200.0f) {
OS_REPORT(" サルがが%d番のレール発見しました。\n", path_index);
i_this->field_0xc18 = path_p;
@@ -5524,7 +5517,7 @@ static int npc_ks_mori(npc_ks_class* i_this) {
if (!dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[226])) {
i_this->mode = 302;
i_this->field_0xc17 = 3;
dComIfGp_setItemOilCount(-(dComIfGs_getMaxOil() & 0xFFFF));
dComIfGp_setItemOilCount(-dComIfGs_getMaxOil());
}
} else {
i_this->field_0xaec = 1;
@@ -5546,7 +5539,7 @@ static int npc_ks_mori(npc_ks_class* i_this) {
mae.set(-27426.0f, player->current.pos.y, -20000.0f);
mae -= player->current.pos;
if (mae.abs() < 7500.0f) {
if (mae.abs() < 7500.0f + NREG_F(17)) {
i_this->mode = 1;
i_this->timer[0] = 10;
}
@@ -5571,8 +5564,8 @@ static int npc_ks_mori(npc_ks_class* i_this) {
case 2:
cMtx_YrotS(*calc_mtx, player->shape_angle.y);
mae.x = i_this->field_0xbb4;
mae.y = 0.0f;
mae.z = 100.0f;
mae.y = AREG_F(1);
mae.z = 100.0f + AREG_F(2);
MtxPosition(&mae, &ato);
actor->current.pos = player->current.pos + ato;
actor->current.angle.y = player->shape_angle.y - 0x4000;
@@ -5681,7 +5674,7 @@ static int npc_ks_mori(npc_ks_class* i_this) {
mae.x = -30900.0f - player->current.pos.x;
mae.z = -15756.0f - player->current.pos.z;
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 1300.0f || i_this->dis < fVar1) {
if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 1300.0f + YREG_F(13) || i_this->dis < fVar1) {
i_this->demo_mode = 300;
i_this->mode = 300;
}
@@ -5879,7 +5872,7 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) {
if (i_this->path_no == 0) {
anm_init(i_this, 45, 3.0f, 0, 1.0f);
i_this->mode = 3;
i_this->current_angle.y += 0x8000;
ADD_ANGLE_2(i_this->current_angle.y, 0x8000);
actor->speedF = 0.0f;
} else {
i_this->mode = 1;
@@ -5892,7 +5885,7 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) {
case 3:
if (i_this->model->isStop()) {
i_this->current_angle.y += 0x8000;
ADD_ANGLE_2(i_this->current_angle.y, 0x8000);
i_this->mode = 1;
}
break;
@@ -5941,9 +5934,10 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) {
i_this->mode = 22;
i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1);
}
break;
}
// falthrough intentional
default:
break;
case 22:
sVar1 = 0x800;
@@ -6025,6 +6019,8 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) {
static void npc_ks_kago(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* unused_pla_p = dComIfGp_getPlayer(0);
cXyz unused_xyz_0, unused_xyz_1;
i_this->field_0x5fc = 0;
@@ -6179,7 +6175,7 @@ static void anm_se_set(npc_ks_class* i_this) {
}
} else if (i_this->res_id == 34) {
if (i_this->model->checkFrame(1.0f)) {
f32 fVar1 = i_this->dis * 0.0215f;
f32 fVar1 = i_this->dis * (0.0215f + XREG_F(17));
if (fVar1 > 127.0f) {
fVar1 = 127.0f;
}
@@ -6599,6 +6595,7 @@ static void action(npc_ks_class* i_this) {
}
static void* s_kago_sub(void* i_actor, void* i_data) {
UNUSED(i_data);
if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_OBJ_KAGO) {
if (((daObj_Kago_c*)i_actor)->getType() == 0) {
return i_actor;
@@ -6715,9 +6712,9 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
f32 fVar1 = mae.abs();
mae = i_this->field_0x91c - actor->current.pos;
f32 fVar2 = mae.abs();
f32 fVar3 = fVar1 * 0.2f;
if (fVar3 > 200.0f) {
fVar3 = 200.0f;
f32 fVar3 = fVar1 * (0.2f + BREG_F(19));
if (fVar3 > 200.0f + BREG_F(18)) {
fVar3 = 200.0f + BREG_F(18);
}
i_this->field_0x908 = fVar3 * cM_ssin((fVar2 / fVar1) * 32768.0f);
i_this->field_0x90c = 0;
@@ -6726,8 +6723,8 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
}
mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y + i_this->field_0x908, actor->current.pos.z);
mDoMtx_stack_c::YrotM(actor->shape_angle.y);
mDoMtx_stack_c::XrotM(actor->shape_angle.x);
mDoMtx_stack_c::YrotM(s16(actor->shape_angle.y));
mDoMtx_stack_c::XrotM(s16(actor->shape_angle.x));
mDoMtx_stack_c::ZrotM(actor->shape_angle.z);
mDoMtx_stack_c::transM(0.0f, i_this->field_0x928, 0.0f);
mDoMtx_stack_c::scaleM(l_HIO.basic_size, l_HIO.basic_size, l_HIO.basic_size);
@@ -6749,13 +6746,13 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
daObj_Kago_c* kago = (daObj_Kago_c*)fpcM_Search(s_kago_sub, i_this);
if (kago != NULL) {
MTXCopy(i_this->model->getModel()->getAnmMtx(14), mDoMtx_stack_c::get());
mDoMtx_stack_c::YrotM(-2000);
mDoMtx_stack_c::XrotM(-0x3638);
mDoMtx_stack_c::ZrotM(-0x2E68);
mDoMtx_stack_c::transM(-60.0f, 0.0f, 0.0f);
mDoMtx_stack_c::YrotM(0);
mDoMtx_stack_c::XrotM(0);
mDoMtx_stack_c::ZrotM(0);
mDoMtx_stack_c::YrotM(VREG_S(0) - 2000);
mDoMtx_stack_c::XrotM(VREG_S(1) - 13880);
mDoMtx_stack_c::ZrotM(VREG_S(2) - 11880);
mDoMtx_stack_c::transM(-60.0f + VREG_F(7), VREG_F(8), VREG_F(9));
mDoMtx_stack_c::YrotM(s16(VREG_S(3)));
mDoMtx_stack_c::XrotM(s16(VREG_S(4)));
mDoMtx_stack_c::ZrotM(s16(VREG_S(5)));
kago->setMtx(mDoMtx_stack_c::get());
if (fopAcM_checkHawkCarryNow(kago) != 0) {
@@ -6780,11 +6777,11 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
}
MTXCopy(model->getAnmMtx(10), *calc_mtx);
mae.set(30.0f, 0.0f, 0.0f);
mae.set(30.0f + BREG_F(0), BREG_F(1), BREG_F(2));
MtxPosition(&mae, &i_this->field_0x614);
MTXCopy(model->getAnmMtx(14), *calc_mtx);
mae.set(30.0f, -0.0f, 0.0f);
mae.set(30.0f + BREG_F(0), -BREG_F(1), BREG_F(2));
MtxPosition(&mae, &ato);
i_this->field_0x614 += (ato - i_this->field_0x614) * 0.5f;
@@ -6797,7 +6794,7 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
mae.z = obj_pos.z - i_this->field_0x614.z;
if ((mae.x * mae.x + mae.z * mae.z) <= 15.0f) {
i_this->field_0x620 = 2;
i_this->field_0x621 = 10;
i_this->field_0x621 = 10 + AREG_S(9);
leader->field_0x92c = 0;
dComIfGp_getVibration().StartShock(2, 31, cXyz(0.0f, 1.0f, 0.0f));
}
@@ -6808,7 +6805,7 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
}
i_this->field_0x638 += i_this->field_0x634;
i_this->field_0x634 += -3.0f;
i_this->field_0x634 += -3.0f + BREG_F(11);
if (i_this->field_0x638 < 0.0f) {
i_this->field_0x638 = 0.0f;
@@ -6828,10 +6825,10 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) {
}
player->changeDemoParam0(1);
cLib_addCalcAngleS2(&i_this->field_0x610, i_this->field_0x602 << 1, 1, 4000);
cLib_addCalcAngleS2(&i_this->field_0x610, i_this->field_0x602 << 1, 1, 4000 + TREG_S(7));
} else {
player->changeDemoParam0(0);
cLib_addCalcAngleS2(&i_this->field_0x610, 10000, 4, 4000);
cLib_addCalcAngleS2(&i_this->field_0x610, 10000 + TREG_S(6), 4, 4000 + TREG_S(7));
}
if (i_this->field_0x620 != 0) {
+11 -9
View File
@@ -411,13 +411,12 @@ static void action(obj_hb_class* i_this) {
if (cc_move_p != NULL) {
a_this->current.pos.x += cc_move_p->x * 0.5f;
a_this->current.pos.z += cc_move_p->z * 0.5f;
if (fabsf(cc_move_p->x) >= 2.0f || fabsf(cc_move_p->z) >= 2.0f) {
cLib_addCalc2(&i_this->field_0x688, NREG_F(5) + 1000.0f, 0.1f, NREG_F(6) + 200.0f);
s16 target = fopAcM_searchPlayerAngleY(a_this);
s16 angle_delta = i_this->field_0x676.y - target;
if (angle_delta > 0x4000 || angle_delta < -0x4000) {
target -= 0x8000;
ADD_ANGLE(target, 0x8000);
}
cLib_addCalcAngleS2(&i_this->field_0x676.y, target, 4, 0x100);
}
@@ -427,7 +426,7 @@ static void action(obj_hb_class* i_this) {
i_this->mBgc.CrrPos(dComIfG_Bgsp());
sVar1 = 1;
break;
case ACTION_FLOAT:
obj_hb_float(i_this);
i_this->mBgc.CrrPos(dComIfG_Bgsp());
@@ -449,8 +448,9 @@ static void action(obj_hb_class* i_this) {
i_this->field_0x6b0 = 0;
if (i_this->mAtInfo.mHitType == HIT_TYPE_LINK_NORMAL_ATTACK) {
if (daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_TURN_RIGHT || daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_UNK_9) {
a_this->speedF = WREG_F(16) + cM_rndF(10.0f) + 40.0f;
if (daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_TURN_RIGHT
|| daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_UNK_9) {
a_this->speedF = cM_rndF(10.0f) + 40.0f + WREG_F(16);
i_this->field_0x690 = cM_rndF(2000.0f) + 5500.0f;
i_this->field_0x688 = (s16)(cM_rndF(1000.0f) + 5000.0f);
} else {
@@ -477,8 +477,8 @@ static void action(obj_hb_class* i_this) {
cLib_addCalcAngleS2(&i_this->field_0x68e, 0, 8, 0x100);
cLib_addCalcAngleS2(&i_this->field_0x690, 0, 1, WREG_S(6) + 0x96);
} else {
i_this->field_0x68c = i_this->field_0x688 * cM_ssin(i_this->field_0x650 * (NREG_F(3) + 3000));
i_this->field_0x68e = i_this->field_0x688 * cM_ssin(i_this->field_0x650 * (NREG_F(4) + 4000));
i_this->field_0x68c = i_this->field_0x688 * cM_ssin(i_this->field_0x650 * (NREG_S(3) + 3000));
i_this->field_0x68e = i_this->field_0x688 * cM_ssin(i_this->field_0x650 * (NREG_S(4) + 4000));
cLib_addCalc0(&i_this->field_0x688, 0.1f, NREG_F(1) + 50.0f);
cLib_addCalcAngleS2(&i_this->field_0x690, 0, 1, WREG_S(5) + 0x32);
}
@@ -503,7 +503,8 @@ static void action(obj_hb_class* i_this) {
}
a_this->speedF = 0.0f;
cXyz scale(a_this->scale.x, a_this->scale.x, a_this->scale.x);
f32 val_scale = a_this->scale.x;
cXyz scale(val_scale, val_scale, val_scale);
cXyz pos(a_this->current.pos);
pos.y = i_this->mGroundCross;
@@ -522,7 +523,8 @@ static void action(obj_hb_class* i_this) {
if (i_this->field_0x6a4 != 0) {
i_this->field_0x6a4--;
if (i_this->field_0x6a4 != 0) {
cLib_addCalc2(&a_this->scale.x, i_this->field_0x6a4 * (BREG_F(2) + 0.01f) * cM_ssin(i_this->field_0x6a4 * (KREG_S(3) + 15000)) + 1.0f, 1.0f, 0.2f);
f32 reg_f30 = i_this->field_0x6a4 * (BREG_F(2) + 0.01f);
cLib_addCalc2(&a_this->scale.x, reg_f30 * cM_ssin(i_this->field_0x6a4 * (KREG_S(3) + 15000)) + 1.0f, 1.0f, 0.2f);
} else {
a_this->scale.x = 1.0f;
}
+37 -26
View File
@@ -15,13 +15,7 @@ public:
daObj_ITA_HIO_c();
virtual ~daObj_ITA_HIO_c() {}
void genMessage(JORMContext* ctx) {
ctx->genLabel("ヒメクジ", 0x80000001, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("サーチエリア", &search_area, 0.0f, 2000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("飛ばし方向スピード", &launch_dir_spd, 0.0f, -100.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("飛ばし方向Yスピード", &launch_dir_y_spd, 0.0f, 100.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("重力設定", &gravity_settings, 0.0f, -20.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
}
void genMessage(JORMContext* ctx);
/* ヒメクジ */
/* 0x04 */ s8 id;
@@ -31,8 +25,6 @@ public:
/* 0x14 */ f32 gravity_settings;
};
static char* l_arcName = "M_Ita";
daObj_ITA_HIO_c::daObj_ITA_HIO_c() {
id = -1;
search_area = 600.0f;
@@ -41,6 +33,18 @@ daObj_ITA_HIO_c::daObj_ITA_HIO_c() {
gravity_settings = -9.0f;
}
#if DEBUG
void daObj_ITA_HIO_c::genMessage(JORMContext* ctx) {
ctx->genLabel("ヒメクジ", 0x80000001, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("サーチエリア", &search_area, 0.0f, 2000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("飛ばし方向スピード", &launch_dir_spd, 0.0f, -100.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("飛ばし方向Yスピード", &launch_dir_y_spd, 0.0f, 100.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("重力設定", &gravity_settings, 0.0f, -20.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
}
#endif
static char* l_arcName = "M_Ita";
static f32 dummy() {
return 0.0f;
}
@@ -59,16 +63,15 @@ namespace {
} // namespace
void daObjIta_c::Search_Ymb() {
f32 zero = 0.0f;
f32 speed_f = 0.0f;
cXyz pos(e_ymb_Pos->x - current.pos.x, e_ymb_Pos->y - current.pos.y, e_ymb_Pos->z - current.pos.z);
mDoMtx_stack_c::YrotS(-shape_angle.y);
mDoMtx_stack_c::multVec(&pos, &pos);
if (pos.x < BREG_F(0) + 750.0f && pos.x > -750.0f - BREG_F(0) && pos.z < 450.0f + BREG_F(1) && pos.z > -450.0f - BREG_F(1) && pos.y < BREG_F(7) + 600.0f) {
f32 speed_f = fopAcM_GetSpeedF(e_ymb);
zero = 0.0f;
if (speed_f > zero) {
speed_f = fopAcM_GetSpeedF(e_ymb);
if (speed_f > 0.0f) {
field_0x5b0 = speed_f * (BREG_F(6) + 16.0f) + 256.0f;
e_ymb->setHitBoardSe();
field_0x5a0 = speed_f * (BREG_F(5) + 31.0f);
@@ -98,15 +101,21 @@ void daObjIta_c::Search_Ymb() {
BOOL daObjIta_c::Check_RideOn() {
daPy_py_c* player = daPy_getPlayerActorClass();
cXyz& pos = fopAcM_GetPosition(player);
f32 speed_f = 0.0f;
int reg_r26 = 0; // unused
field_0x6c0 = 1;
cXyz vecTrans(pos.x - current.pos.x, pos.y - current.pos.y, pos.z - current.pos.z);
mDoMtx_stack_c::YrotS(-shape_angle.y);
mDoMtx_stack_c::multVec(&vecTrans, &vecTrans);
if (vecTrans.x < 1000.0f && vecTrans.x > -1000.0f && vecTrans.z < 700.0f && vecTrans.z > -700.0f && fopAcM_GetSpeedF(player) > 0.0f) {
cLib_addCalcAngleS(&field_0x5b0, 0x150, 11, 0x100, 0);
field_0x5c8 = 0x400;
if (vecTrans.x < 1000.0f && vecTrans.x > -1000.0f && vecTrans.z < 700.0f && vecTrans.z > -700.0f) {
f32 reg_f30 = 0.0f;
speed_f = fopAcM_GetSpeedF(player);
if (speed_f > 0.0f) {
cLib_addCalcAngleS(&field_0x5b0, 0x150, 11, 0x100, 0);
field_0x5c8 = 0x400;
}
}
return FALSE;
@@ -123,16 +132,18 @@ void daObjIta_c::setBaseMtx() {
mDoMtx_stack_c::XrotM(shape_angle.z);
mDoMtx_stack_c::ZrotM(shape_angle.x);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
cMtx_copy(mDoMtx_stack_c::get(), mBgMtx);
}
static void rideCallBack(dBgW* param_1, fopAc_ac_c* a_this, fopAc_ac_c* i_player) {
UNUSED(param_1);
(void) a_this; // it is used, but this is needed for dbg matching
daObjIta_c* i_this = (daObjIta_c*)a_this;
if (fopAcM_GetName(i_player) == PROC_ALINK) {
daPy_py_c* player = daPy_getPlayerActorClass();
if (i_this->field_0x5ac < 0.0f) {
i_this->field_0x5a8 = i_this->field_0x5ac * 0.8f;
i_this->field_0x5a8 = (0.8f + HREG_F(2)) * i_this->field_0x5ac;
i_this->field_0x5ac = 0.0f;
}
@@ -148,20 +159,19 @@ static int daObjIta_Execute(daObjIta_c* i_this) {
return i_this->MoveBGExecute();
}
static int daObjIta_IsDelete(daObjIta_c* i_this) {
static int daObjIta_IsDelete(daObjIta_c*) {
return 1;
}
static int daObjIta_Delete(daObjIta_c* i_this) {
fpc_ProcID id = fopAcM_GetID(i_this);
fopAcM_RegisterDeleteID(i_this, "Obj_Ita");
i_this->MoveBGDelete();
return 1;
}
static int daObjIta_Create(fopAc_ac_c* a_this) {
daObjIta_c* i_this = (daObjIta_c*)a_this;
fpc_ProcID id = fopAcM_GetID(a_this);
return i_this->create();
static int daObjIta_Create(fopAc_ac_c* i_this) {
fopAcM_RegisterCreateID(daObjIta_c, i_this, "Obj_Ita");
return a_this->create();
}
int daObjIta_c::CreateHeap() {
@@ -196,7 +206,7 @@ cPhs__Step daObjIta_c::create() {
cXyz pos(current.pos.x, current.pos.y + 300.0f, current.pos.z);
if (fopAcM_wt_c::waterCheck(&pos)) {
current.pos.y = oREG_F(0) + HREG_F(0) + fopAcM_wt_c::getWaterY() + 50.0f;
current.pos.y = fopAcM_wt_c::getWaterY() + 50.0f + HREG_F(0) + oREG_F(0);
}
return phase;
@@ -218,6 +228,7 @@ int daObjIta_c::Execute(Mtx** mtx) {
}
daPy_py_c* player = daPy_getPlayerActorClass();
cXyz& unused_pos = fopAcM_GetPosition(player);
cXyz& playerSpeed = fopAcM_GetSpeed(player);
if (fopAcM_SearchByName(PROC_E_YMB, (fopAc_ac_c**)&e_ymb) != 0 && e_ymb != NULL) {
@@ -242,7 +253,7 @@ int daObjIta_c::Execute(Mtx** mtx) {
}
cLib_addCalc(&current.pos.y, field_0x5d4 + (posY + 60.0f + field_0x5a8 * (HREG_F(0) + 5.0f) + cM_ssin(field_0x5cc) * 20.0f), 0.1f, 15.0f, 0.1f);
cLib_addCalcAngleS(&shape_angle.x, field_0x5ce.x + (nREG_F(0) + 1.0f) * field_0x5b0 * cM_ssin(field_0x5ca + oREG_F(1) + 0x2000), 2, 0x1000, 1);
cLib_addCalcAngleS(&shape_angle.x, field_0x5ce.x + (nREG_F(0) + 1.0f) * field_0x5b0 * cM_ssin(field_0x5ca + oREG_S(1) + 0x2000), 2, 0x1000, 1);
cLib_addCalcAngleS(&shape_angle.z, field_0x5ce.z + (nREG_F(1) + 1.0f) * field_0x5b0 * cM_ssin(field_0x5cc), 2, 0x1000, 1);
cLib_addCalc(&field_0x5a4, field_0x5c8, HREG_F(13) + 0.05f, 100.0f, 0.0f);
cLib_addCalc2(&field_0x5a8, 0.0f, HREG_F(1) + 0.1f, 10.0f);
+187 -65
View File
@@ -10,40 +10,50 @@
#include "SSystem/SComponent/c_math.h"
#include "d/d_com_inf_game.h"
#include "d/d_bg_s.h"
#include "d/d_bg_w.h"
#include "f_op/f_op_actor_mng.h"
namespace daObjLadder {
namespace {
struct Attr {
/* 0x00 */ f32 field_0x00;
/* 0x04 */ f32 field_0x04;
/* 0x08 */ f32 field_0x08;
/* 0x0C */ f32 field_0x0c;
/* 0x10 */ u8 field_0x10;
/* 0x11 */ u8 field_0x11;
/* 0x12 */ u8 field_0x12;
/* 0x13 */ u8 field_0x13;
/* 0x14 */ u8 field_0x14;
/* 0x16 */ s16 field_0x16;
/* 0x18 */ s16 field_0x18;
/* 0x1A */ s16 vibrationTimer;
/* 0x1C */ f32 field_0x1c;
/* 0x20 */ f32 field_0x20;
struct Attr_c {
/* 0x00 */ f32 gravity;
/* 0x04 */ f32 viscous_resistance;
/* 0x08 */ f32 inertia_resistance;
/* 0x0C */ f32 reflectance;
/* 0x10 */ u8 num_of_bounces;
/* 0x11 */ u8 bound_vol_0;
/* 0x12 */ u8 bound_vol_1;
/* 0x13 */ u8 bound_vol_2;
/* 0x14 */ u8 bound_vol_3;
/* 0x16 */ s16 vibration_speed_x;
/* 0x18 */ s16 vibration_speed_y;
/* 0x1A */ s16 vibration_timer;
/* 0x1C */ f32 vibration_amp_x;
/* 0x20 */ f32 vibration_amp_y;
};
static Attr const L_attr = {
-3.0f, 0.005f, 0.0005f,
0.5f, 0x03, 0x4B, 0x32, 0x2D, 0x28, 0x4E20,
0x3CC3, 0x0F, 2.0f, 1.0f,
static Attr_c const L_attr = {
-3.0f,
0.005f,
0.0005f,
0.5f,
//
3,
75,
50,
45,
40,
//
20000,
15555,
15,
2.0f,
1.0f,
};
inline static const Attr& attr() {
inline static const Attr_c& attr() {
return L_attr;
}
char const Act_c::M_arcname[5] = "Mhsg";
struct AttrType {
/* 0x0 */ s16 field_0x0;
/* 0x2 */ s16 field_0x2;
@@ -59,10 +69,110 @@ static AttrType L_attr_type[6] = {
{ 0x06, 0x0E, 300.0f},
};
static inline const AttrType& attr_type(Act_c::Type_e type) {
static inline const AttrType& attr_type(Type_e type) {
return L_attr_type[type];
}
#if DEBUG
class Hio_c : public JORReflexible {
public:
Hio_c();
virtual ~Hio_c() {}
void default_set();
void ct();
void dt();
void listenPropertyEvent(const JORPropertyEvent*);
void genMessage(JORMContext*);
Attr_c attr;
int mCount;
bool field_0x2c;
bool field_0x2d;
};
Hio_c::Hio_c() {
mCount = 0;
field_0x2c = false;
field_0x2d = false;
default_set();
}
void Hio_c::default_set() {
attr = L_attr;
}
void Hio_c::ct() {
if (mCount++ == 0) {
// ladder
daObj::HioVarious_c::init(this, "はしご");
}
}
void Hio_c::dt() {
if (--mCount == 0) {
daObj::HioVarious_c::clean(this);
}
}
void Hio_c::genMessage(JORMContext* ctx) {
// ladder
ctx->genLabel("§ はしご §\n", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// reset to initial position
ctx->genButton("初期位置に", 1, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
// attack
ctx->genButton("アタック", 2, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
// gravity
ctx->genSlider("重力", &attr.gravity, -30.0f, 0.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// viscous resistance
ctx->genSlider("粘性抵抗", &attr.viscous_resistance, 0.0f, 0.1f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// inertia resistance
ctx->genSlider("慣性抵抗", &attr.inertia_resistance, 0.0f, 0.1f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// reflectance
ctx->genSlider("反射率", &attr.reflectance, 0.0f, 1.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
//
// number of bounces
ctx->genSlider("バウンド回数", &attr.num_of_bounces, 0, 10, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// Bound Vol_0, 1, 2, 3
ctx->genSlider("バウンド Vol_0", &attr.bound_vol_0, 0, 100, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
ctx->genSlider("バウンド Vol_1", &attr.bound_vol_1, 0, 100, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
ctx->genSlider("バウンド Vol_2", &attr.bound_vol_2, 0, 100, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
ctx->genSlider("バウンド Vol_3", &attr.bound_vol_3, 0, 100, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
//
// vibration speed x, y
ctx->genSlider("vib 速度 x", &attr.vibration_speed_x, 0, 0x7fff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
ctx->genSlider("vib 速度 y", &attr.vibration_speed_y, 0, 0x7fff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// vibration time
ctx->genSlider("vib 時間", &attr.vibration_timer, 0, 50, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
// vibration amplitude x, y
ctx->genSlider("vib 振幅 x", &attr.vibration_amp_x, 0.0f, 5.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
ctx->genSlider("vib 振幅 y", &attr.vibration_amp_y, 0.0f, 5.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18);
}
void Hio_c::listenPropertyEvent(const JORPropertyEvent* property) {
JORReflexible::listenPropertyEvent(property);
switch ((u32)property->id) {
case 1: {
field_0x2c = true;
break;
}
case 2: {
field_0x2d = true;
break;
}
}
// TODO.
}
Hio_c L_hio;
#endif
}
char const Act_c::M_arcname[5] = "Mhsg";
int Act_c::CreateHeap() {
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, attr_type(mType).field_0x0);
JUT_ASSERT(382, model_data != NULL);
@@ -94,7 +204,12 @@ int Act_c::Create() {
} else {
mode_wait_init();
}
if (mHeight <= -G_CM3D_F_INF) {
// "The ladder is falling <%s %d>\n"
OS_REPORT_ERROR("はしごは落ちる<%s %d>\n", "d_a_obj_ladder.cpp", 459);
}
return 1;
}
@@ -106,6 +221,9 @@ int Act_c::Mthd_Create() {
phase_state = MoveBGCreate(M_arcname, attr_type(mType).field_0x2,
dBgS_MoveBGProc_Trans, 0xcb0, NULL);
JUT_ASSERT(486, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e));
#if DEBUG
L_hio.ct();
#endif
}
return phase_state;
}
@@ -115,6 +233,9 @@ int Act_c::Delete() {
}
int Act_c::Mthd_Delete() {
#if DEBUG
L_hio.dt();
#endif
int rv = MoveBGDelete();
dComIfG_resDelete(&mPhase, M_arcname);
return rv;
@@ -161,17 +282,17 @@ void Act_c::mode_demoreq() {
}
void Act_c::mode_vib_init() {
mVibrationTimer = attr().vibrationTimer;
mVibrationTimer = attr().vibration_timer;
field_0x610 = 0;
field_0x612 = 0;
mMode = MODE_VIB;
}
void Act_c::mode_vib() {
field_0x610 += attr().field_0x16;
field_0x612 += attr().field_0x18;
field_0x614 = cM_scos(field_0x610) * attr().field_0x1c;
field_0x618 = cM_scos(field_0x612) * attr().field_0x20;
field_0x610 += attr().vibration_speed_x;
field_0x612 += attr().vibration_speed_y;
field_0x614 = cM_scos(field_0x610) * attr().vibration_amp_x;
field_0x618 = cM_scos(field_0x612) * attr().vibration_amp_y;
if (--mVibrationTimer <= 0) {
mode_drop_init();
}
@@ -180,27 +301,27 @@ void Act_c::mode_vib() {
void Act_c::mode_drop_init() {
gravity = -5.0f;
speed.set(cXyz::Zero);
field_0x5b6 = attr().field_0x10;
field_0x5b6 = attr().num_of_bounces;
mMode = MODE_DROP;
}
void Act_c::mode_drop() {
daObj::posMoveF_stream(this, NULL, &cXyz::Zero, attr().field_0x04, attr().field_0x08);
daObj::posMoveF_stream(this, NULL, &cXyz::Zero, attr().viscous_resistance, attr().inertia_resistance);
if (current.pos.y < mHeight) {
if (field_0x5b6 == attr().field_0x10) {
if (field_0x5b6 == attr().num_of_bounces) {
fopAcM_seStart(this, Z2SE_SY_DUMMY, dComIfG_Bgsp().GetMtrlSndId(mGndChk));
dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f));
} else {
int uVar7;
int iVar5 = attr().field_0x10 - field_0x5b6;
int iVar5 = attr().num_of_bounces - field_0x5b6;
if (iVar5 == 1) {
uVar7 = attr().field_0x11;
uVar7 = attr().bound_vol_0;
} else if (iVar5 == 2) {
uVar7 = attr().field_0x12;
uVar7 = attr().bound_vol_1;
} else if (iVar5 == 3) {
uVar7 = attr().field_0x13;
uVar7 = attr().bound_vol_2;
} else {
uVar7 = attr().field_0x14;
uVar7 = attr().bound_vol_3;
}
fopAcM_seStart(this, Z2SE_SY_DUMMY, uVar7);
}
@@ -263,35 +384,36 @@ int Act_c::Draw() {
return 1;
}
static int Mthd_Create(void* i_this) {
return ((Act_c*)i_this)->Mthd_Create();
namespace {
static int Mthd_Create(void* i_this) {
return ((Act_c*)i_this)->Mthd_Create();
}
static int Mthd_Delete(void* i_this) {
return ((Act_c*)i_this)->Mthd_Delete();
}
static int Mthd_Execute(void* i_this) {
return ((Act_c*)i_this)->MoveBGExecute();
}
static int Mthd_Draw(void* i_this) {
return ((Act_c*)i_this)->MoveBGDraw();
}
static int Mthd_IsDelete(void* i_this) {
return ((Act_c*)i_this)->MoveBGIsDelete();
}
static actor_method_class Mthd_Table = {
(process_method_func)Mthd_Create,
(process_method_func)Mthd_Delete,
(process_method_func)Mthd_Execute,
(process_method_func)Mthd_IsDelete,
(process_method_func)Mthd_Draw,
};
}
static int Mthd_Delete(void* i_this) {
return ((Act_c*)i_this)->Mthd_Delete();
}
static int Mthd_Execute(void* i_this) {
return ((Act_c*)i_this)->MoveBGExecute();
}
static int Mthd_Draw(void* i_this) {
return ((Act_c*)i_this)->MoveBGDraw();
}
static int Mthd_IsDelete(void* i_this) {
return ((Act_c*)i_this)->MoveBGIsDelete();
}
static actor_method_class Mthd_Table = {
(process_method_func)Mthd_Create,
(process_method_func)Mthd_Delete,
(process_method_func)Mthd_Execute,
(process_method_func)Mthd_IsDelete,
(process_method_func)Mthd_Draw,
};
}
}
actor_process_profile_definition g_profile_Obj_Ladder = {