summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-09-07 16:16:17 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-09-07 16:16:17 -0400
commita42fd39a9f85b86d593158bf7ba0a6b78a48ddd0 (patch)
treefe033eb935b899aede93a1f72bf6cdf537a29825 /src
parentba203cc5fb87abea3399406f3848355fa7ecaf96 (diff)
d_a_att OK, d_a_bgn header work
fixes #89
Diffstat (limited to 'src')
-rw-r--r--src/d/actor/d_a_andsw0.cpp6
-rw-r--r--src/d/actor/d_a_att.cpp216
-rw-r--r--src/d/actor/d_a_bgn.cpp4
3 files changed, 210 insertions, 16 deletions
diff --git a/src/d/actor/d_a_andsw0.cpp b/src/d/actor/d_a_andsw0.cpp
index ad600418..bba802cd 100644
--- a/src/d/actor/d_a_andsw0.cpp
+++ b/src/d/actor/d_a_andsw0.cpp
@@ -186,11 +186,11 @@ static void* bk_s_sub3(void* i_this, void*) {
}
/* 0000055C-000005D4 .text bb_s_sub__FPvPv */
-static void* bb_s_sub(void* i_this, void*) {
- if(fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == PROC_BB) {
+static void* bb_s_sub(void* search, void*) {
+ if(fopAcM_IsActor(search) && fopAcM_GetName(search) == PROC_BB) {
s32 count = check_count; //regswaps without this
if(count < 7) {
- ac[check_count] = i_this;
+ ac[check_count] = search;
check_count++;
}
diff --git a/src/d/actor/d_a_att.cpp b/src/d/actor/d_a_att.cpp
index 87e85b73..2734f643 100644
--- a/src/d/actor/d_a_att.cpp
+++ b/src/d/actor/d_a_att.cpp
@@ -5,35 +5,227 @@
#include "d/actor/d_a_att.h"
#include "d/d_procname.h"
+#include "d/d_com_inf_game.h"
+#include "f_op/f_op_actor_mng.h"
+#include "d/actor/d_a_bgn.h"
+
+// Needed for the .data section to match.
+static Vec dummy_2100 = {1.0f, 1.0f, 1.0f};
+static Vec dummy_2080 = {1.0f, 1.0f, 1.0f};
+static u8 dummy_1811[] = {0x02, 0x00, 0x02, 0x01};
+static f64 dummy4[2] = {3.0, 0.5};
+
+static bgn_class* boss;
+static cXyz non_pos(-30000.0f, -30000.0f, -30000.0f);
/* 000000EC-000000F4 .text daAtt_Draw__FP9att_class */
-static BOOL daAtt_Draw(att_class*) {
- /* Nonmatching */
+static BOOL daAtt_Draw(att_class* i_this) {
+ return TRUE;
}
/* 000000F4-00000140 .text boss_s_sub__FPvPv */
-void boss_s_sub(void*, void*) {
- /* Nonmatching */
+static void* boss_s_sub(void* search, void*) {
+ if (fopAcM_IsActor(search) && fopAcM_GetName(search) == PROC_BGN) {
+ return search;
+ }
+ return NULL;
}
/* 00000140-0000052C .text daAtt_Execute__FP9att_class */
-static BOOL daAtt_Execute(att_class*) {
- /* Nonmatching */
+static BOOL daAtt_Execute(att_class* i_this) {
+ if (i_this->m2B5 == 101) {
+ i_this->attention_info.position = i_this->eyePos = i_this->current.pos;
+ fopAcM_OffStatus(i_this, 0);
+ i_this->attention_info.flags = 0;
+ i_this->mSph.SetC(i_this->current.pos);
+ dComIfG_Ccsp()->Set(&i_this->mSph);
+ }
+ if (i_this->m2B5 == 100) {
+ i_this->attention_info.position = i_this->eyePos = i_this->current.pos;
+ } else {
+ boss = (bgn_class*)fpcM_Search(&boss_s_sub, i_this);
+ if (boss == NULL) {
+ return TRUE;
+ }
+ int r30 = i_this->m2B5;
+
+ if (i_this->m550 != 0) {
+ i_this->m550--;
+ }
+
+ if (i_this->m550 == 0 && (i_this->mCyl.ChkTgHit() || i_this->mSph.ChkTgHit())) {
+ i_this->m550 = 10;
+ boss->mAAA8[r30].m308--;
+ if (boss->mAAA8[r30].m308 <= 0) {
+ boss->mAAA8[r30].m2D0 = 1;
+ boss->mAAA8[r30].m304 = 6000.0f;
+ mDoAud_seStart(JA_SE_LK_W_WEP_HIT, NULL, 0x21, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)));
+ if (r30 <= 1) {
+ if (boss->mAAA8[1-r30].m2D0 != 0) {
+ boss->mC7B0 = 600;
+ }
+ }
+ } else {
+ boss->mAAA8[r30].m300 = 15;
+ mDoAud_seStart(JA_SE_CM_BGN_D_STRING_PLINK, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)));
+ }
+ }
+
+ i_this->current.pos = boss->mC33C[r30];
+ cXyz sp08 = i_this->current.pos;
+
+ if (
+ boss->m02B5 == 0
+ &&
+ (boss->mC748 != 0 || boss->mC74C != 0 || r30 != 7)
+ &&
+ (boss->mAAA8[r30].m2D0 == 0 && boss->mAAA8[r30].m2EC < 1.0f)
+ ) {
+ i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e;
+ i_this->mCyl.SetR(200.0f);
+ i_this->mCyl.SetC(sp08);
+ sp08.y += 1000.0f;
+ i_this->mSph.SetC(sp08);
+ i_this->eyePos = sp08;
+ i_this->attention_info.position = sp08;
+ } else {
+ fopAcM_OffStatus(i_this, 0);
+ i_this->attention_info.flags = 0;
+ i_this->mCyl.SetC(non_pos);
+ i_this->mSph.SetC(non_pos);
+ }
+
+ dComIfG_Ccsp()->Set(&i_this->mCyl);
+ dComIfG_Ccsp()->Set(&i_this->mSph);
+ }
+ return TRUE;
}
/* 00000568-00000570 .text daAtt_IsDelete__FP9att_class */
-static BOOL daAtt_IsDelete(att_class*) {
- /* Nonmatching */
+static BOOL daAtt_IsDelete(att_class* i_this) {
+ return TRUE;
}
/* 00000570-00000578 .text daAtt_Delete__FP9att_class */
-static BOOL daAtt_Delete(att_class*) {
- /* Nonmatching */
+static BOOL daAtt_Delete(att_class* i_this) {
+ return TRUE;
}
/* 00000578-00000768 .text daAtt_Create__FP10fopAc_ac_c */
-static s32 daAtt_Create(fopAc_ac_c*) {
- /* Nonmatching */
+static s32 daAtt_Create(fopAc_ac_c* i_this) {
+ static dCcD_SrcSph sita_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ 0,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ AT_SPRM_SET | AT_SPRM_VS_PLAYER,
+ /* SrcObjTg Type */ AT_TYPE_HOOKSHOT,
+ /* SrcObjTg SPrm */ TG_SPRM_SET | TG_SPRM_IS_ENEMY,
+ /* SrcObjCo SPrm */ 0,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ 0,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {
+ /* Center */ 0.0f, 0.0f, 0.0f,
+ /* Radius */ 90.0f,
+ },
+ };
+ static dCcD_SrcCyl cc_cyl_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ 0,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ 0,
+ /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
+ /* SrcObjTg SPrm */ TG_SPRM_SET | TG_SPRM_IS_ENEMY,
+ /* SrcObjCo SPrm */ CO_SPRM_SET | CO_SPRM_IS_UNK4 | CO_SPRM_VSGRP,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ 0,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGCylS
+ {
+ /* Center */ 0.0f, 0.0f, 0.0f,
+ /* Radius */ 200.0f,
+ /* Height */ 2000.0f,
+ },
+ };
+ static dCcD_SrcSph bm_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ 0,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ AT_SPRM_SET | AT_SPRM_VS_PLAYER,
+ /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
+ /* SrcObjTg SPrm */ TG_SPRM_SET | TG_SPRM_IS_ENEMY,
+ /* SrcObjCo SPrm */ 0,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ 0,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {
+ /* Center */ 0.0f, 0.0f, 0.0f,
+ /* Radius */ 200.0f,
+ },
+ };
+
+ att_class* a_this = (att_class*)i_this;
+ fopAcM_SetupActor(i_this, att_class);
+
+ a_this->m2B5 = fopAcM_GetParam(a_this) & 0xFF;
+ a_this->attention_info.distances[fopAc_Attn_TYPE_BATTLE_e] = 4;
+
+ if (a_this->m2B5 == 101) {
+ fopAcM_OnStatus(a_this, fopAcStts_UNK10000000_e);
+ a_this->mStts.Init(0xFF, 0xFF, a_this);
+
+ a_this->mSph.Set(sita_sph_src);
+ a_this->mSph.SetStts(&a_this->mStts);
+ }
+
+ if (a_this->m2B5 < 10) {
+ boss = NULL;
+
+ a_this->mStts.Init(0xFF, 0xFF, a_this);
+
+ a_this->mCyl.Set(cc_cyl_src);
+ a_this->mCyl.SetStts(&a_this->mStts);
+
+ a_this->mSph.Set(bm_sph_src);
+ a_this->mSph.SetStts(&a_this->mStts);
+ }
+
+ return cPhs_COMPLEATE_e;
}
static actor_method_class l_daAtt_Method = {
diff --git a/src/d/actor/d_a_bgn.cpp b/src/d/actor/d_a_bgn.cpp
index 1f436566..a5fe94ba 100644
--- a/src/d/actor/d_a_bgn.cpp
+++ b/src/d/actor/d_a_bgn.cpp
@@ -7,6 +7,7 @@
#include "d/actor/d_a_bgn2.h"
#include "d/actor/d_a_bgn3.h"
#include "d/d_procname.h"
+#include "f_op/f_op_actor_mng.h"
/* 000000EC-000003F0 .text __ct__11daBgn_HIO_cFv */
daBgn_HIO_c::daBgn_HIO_c() {
@@ -269,8 +270,9 @@ static BOOL useHeapInit(fopAc_ac_c*) {
}
/* 0000B9DC-0000CA80 .text daBgn_Create__FP10fopAc_ac_c */
-static s32 daBgn_Create(fopAc_ac_c*) {
+static s32 daBgn_Create(fopAc_ac_c* i_this) {
/* Nonmatching */
+ fopAcM_SetupActor(i_this, bgn_class);
}
static actor_method_class l_daBgn_Method = {