summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinspectredc <78732756+inspectredc@users.noreply.github.com>2024-04-16 00:19:43 +0100
committerGitHub <noreply@github.com>2024-04-15 16:19:43 -0700
commit7f426967efd07046bfbe791ed4e64808ae5a26e2 (patch)
tree51014dee003a4e30ac6db96c640c66db13dc6d3f
parent4ab3a1d9dcb76d80fe745dcbe79f3e925b8fac7e (diff)
ac_ball OK and documented (#173)
* ac_ball OK * hopefully format * address warnings * Apply suggestions from code review Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com> * suggestions pt2 --------- Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com>
-rw-r--r--include/6F2150.h20
-rw-r--r--include/m_actor.h6
-rw-r--r--include/m_clip.h10
-rw-r--r--include/m_collision_bg.h26
-rw-r--r--include/m_common_data.h4
-rw-r--r--include/m_field_info.h10
-rw-r--r--include/m_quest.h5
-rw-r--r--include/macros.h1
-rw-r--r--include/segment_symbols.h4
-rw-r--r--include/sys_math3d.h2
-rw-r--r--include/tables/dmatables/dmadata_table_jp.h6
-rw-r--r--linker_scripts/jp/symbol_addrs_assets.txt20
-rw-r--r--linker_scripts/jp/symbol_addrs_code.txt42
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt40
-rw-r--r--src/code/m_field_info.c10
-rw-r--r--src/code/m_scene.c4
-rw-r--r--src/objects/act_ball_b/act_ball_b.c9
-rw-r--r--src/objects/act_ball_b/act_ball_b.h12
-rw-r--r--src/objects/act_ball_d/act_ball_d.c15
-rw-r--r--src/objects/act_ball_d/act_ball_d.h14
-rw-r--r--src/objects/act_ball_s/act_ball_s.c9
-rw-r--r--src/objects/act_ball_s/act_ball_s.h12
-rw-r--r--src/overlays/actors/ovl_Ball/ac_ball.c786
-rw-r--r--src/overlays/actors/ovl_Ball/ac_ball.h31
-rw-r--r--yamls/jp/assets.yaml62
-rw-r--r--yamls/jp/overlays.yaml4
26 files changed, 1041 insertions, 123 deletions
diff --git a/include/6F2150.h b/include/6F2150.h
index 3faf751..4b2c0a1 100644
--- a/include/6F2150.h
+++ b/include/6F2150.h
@@ -3,17 +3,17 @@
#include "ultra64.h"
-// void func_800CE4B0_jp();
-// void func_800CE4F4_jp();
-// void func_800CE554_jp();
-// void func_800CE694_jp();
-// void func_800CE7E4_jp();
-// void func_800CE874_jp();
-// void func_800CE8F0_jp();
-// void func_800CE9C4_jp();
-// void func_800CEB1C_jp();
+void mRlib_spdXZ_to_spdF_Angle(xyz_t*, f32*, s16*);
+void mRlib_spdF_Angle_to_spdXZ(xyz_t*, f32*, s16*);
+void mRlib_position_move_for_sloop(struct Actor*, s_xyz*);
+void mRlib_Get_norm_Clif(struct Actor*, xyz_t*);
+void mRlib_Roll_Matrix_to_s_xyz(struct Actor*, void*, s16);
+s16 mRlib_Get_HitWallAngleY(struct Actor*);
+void mRlib_Station_step_modify_to_wall(struct Actor*);
+s32 mRlib_Set_Position_Check(struct Actor*);
+s32 mRlib_HeightGapCheck_And_ReversePos(void);
// void func_800CEC30_jp();
-// void func_800CEC98_jp();
+s32 mRlib_Get_ground_norm_inHole(struct Actor*, xyz_t*, f32*, s16*, s16*, f32);
// void func_800CEE24_jp();
// void func_800CEED4_jp();
// void func_800CF05C_jp();
diff --git a/include/m_actor.h b/include/m_actor.h
index 5a1c59e..bb52865 100644
--- a/include/m_actor.h
+++ b/include/m_actor.h
@@ -3,6 +3,7 @@
#include "ultra64.h"
#include "m_collision_obj.h"
+#include "m_collision_bg.h"
#include "z64math.h"
#include "unk.h"
@@ -110,8 +111,9 @@ typedef struct Actor {
/* 0x074 */ f32 speed;
/* 0x078 */ f32 gravity;
/* 0x07C */ f32 terminalVelocity;
- /* 0x080 */ UNK_TYPE1 unk_080[0x34];
- /* 0x0B4 */ UNK_TYPE1 unk_0B4[0x1];
+ /* 0x080 */ UNK_TYPE1 unk_080[0x18];
+ /* 0x098 */ mCoBG_CheckResult colResult;
+ /* 0x09C */ UNK_TYPE1 unk_09C[0x19];
/* 0x0B5 */ u8 isDrawn;
/* 0x0B6 */ s16 yawTowardsPlayer;
/* 0x0B8 */ f32 xyzDistToPlayerSq;
diff --git a/include/m_clip.h b/include/m_clip.h
index 3f58ad1..844ee70 100644
--- a/include/m_clip.h
+++ b/include/m_clip.h
@@ -16,6 +16,7 @@ struct ShadowData;
struct FurnitureActor;
struct WeatherClip;
struct ObjectExchangeBank;
+struct xyz_t;
typedef UNK_RET (*Clip_unk_040_unk_04)(struct ActorOverlay*, const u8*, size_t, s32);
typedef UNK_RET (*Clip_unk_040_unk_08)(void);
@@ -133,9 +134,11 @@ typedef struct Clip_unk_08C {
/* 0x86C */ UNK_TYPE unk_86C;
} Clip_unk_08C; // size >= 0x870
+typedef void (*Clip_unk_090_unk_00)(s8, struct xyz_t, s32, s32, struct Game_Play*, s32, s32, s32);
typedef void (*Clip_unk_090_unk_30)(Color_RGBA8, s16,s16,s32);
typedef struct Clip_unk_090 {
- /* 0x00 */ UNK_TYPE1 unk_00[0x30];
+ /* 0x00 */ Clip_unk_090_unk_00 unk_00;
+ /* 0x04 */ UNK_TYPE1 unk_04[0x2C];
/* 0x30 */ Clip_unk_090_unk_30 unk_30;
} Clip_unk_090; // size >= 0x34
@@ -153,9 +156,12 @@ typedef struct Clip_unk_0A4 {
} Clip_unk_0A4;
typedef UNK_RET (*Clip_unk_0A8_unk_4)(void*);
+typedef void (*Clip_unk_0A8_unk_C)(struct xyz_t*, f32, UNK_TYPE);
typedef struct Clip_unk_0A8 {
/* 0x00 */ UNK_TYPE1 unk_00[0x04];
- /* 0x04 */ Clip_unk_0A8_unk_4 unk_4;
+ /* 0x04 */ Clip_unk_0A8_unk_4 unk_04;
+ /* 0x08 */ UNK_TYPE1 unk_08[0x04];
+ /* 0x0C */ Clip_unk_0A8_unk_C unk_0C;
} Clip_unk_0A8; // size >= 0x8
typedef void (*Clip_unk_0B4_unk_4)(void);
diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h
index b231c38..c3463b6 100644
--- a/include/m_collision_bg.h
+++ b/include/m_collision_bg.h
@@ -35,6 +35,24 @@ typedef union mCoBG_unkStructUnion {
u32 raw;
} mCoBG_unkStructUnion;
+// collision bg result data
+typedef struct mCoBG_CheckResult {
+ u32 onGround:1; // [31] on_ground
+ u32 unk1:5; // [30:25] hit_attribute_wall
+ u32 hitWall:5; // [25:20] hit_wall
+ u32 unk3:3; // [20:17] hit_wall_count
+ u32 unk4:1; // [17:16] unk_flag0
+ u32 unk5:6; // [16:10] unit_attribute
+ u32 unk6:1; // [10] is_on_move_bg_obj
+ u32 inWater:1; // [9] is_in_water
+ u32 unk8:1; // [8] unk_flag1
+ u32 unk9:1; // [7] unk_flag2
+ u32 unk10:1; // [6] unk_flag3
+ u32 unk11:1; // [5] unk_flag4
+ u32 unk12:1; // [4] unk_flag5
+ u32 unk13:4; // [3:0] unk_flag6
+} mCoBG_CheckResult;
+
// void func_80067430_jp();
// void func_800674B0_jp();
// void func_800674D8_jp();
@@ -202,7 +220,7 @@ f32 mCoBG_GetBgY_AngleS_FromWpos(s_xyz* angleToGround, xyz_t wpos, f32 offsetY);
// void func_80071A08_jp();
// void func_80071AB8_jp();
f32 mCoBG_GetBgY_OnlyCenter_FromWpos2(xyz_t arg0, f32 arg1);
-// void func_80071C1C_jp();
+void mCoBG_GetBgNorm_FromWpos(xyz_t*, xyz_t);
// void func_80071DB4_jp();
// void func_800721C8_jp();
// void func_800721E4_jp();
@@ -269,19 +287,19 @@ void mCoBG_SetPluss5PointOffset_file(xyz_t pos, mCoBG_unkStruct2 arg1, char* fil
// void func_80075A10_jp();
// void func_80075AB4_jp();
// void func_80075B28_jp();
-// void func_80075EA0_jp();
+f32 mCoBG_GetWaterHeight_File(xyz_t, char*, s32);
// void func_8007620C_jp();
// void func_80076248_jp();
// void func_80076270_jp();
// void func_80076280_jp();
-// void func_80076290_jp();
+void mCoBG_GetWaterFlow(xyz_t*, u32);
s32 func_80076358_jp(u32 attribute);
// void func_8007638C_jp();
// void func_800763F0_jp();
// void func_800763FC_jp();
// void func_8007648C_jp();
// void func_800764CC_jp();
-// void func_800765AC_jp();
+void mCoBG_BgCheckControll(xyz_t*, struct Actor*, f32, f32, s32, s32, s32);
// void func_80076778_jp();
// void func_800768C8_jp();
// void func_80076A04_jp();
diff --git a/include/m_common_data.h b/include/m_common_data.h
index affa1b0..b872666 100644
--- a/include/m_common_data.h
+++ b/include/m_common_data.h
@@ -171,7 +171,9 @@ typedef struct CommonData {
/* 0x10A3C */ UNK_TYPE1 unk_10A3C[0x2C];
/* 0x10A68 */ u8 unk_10A68;
/* 0x10A69 */ UNK_TYPE1 unk_10A69[0x3];
- /* 0x10A6C */ UNK_TYPE1 unk_10A6C[0x14];
+ /* 0x10A6C */ xyz_t unk_10A6C;
+ /* 0x10A78 */ u8 unk_10A78;
+ /* 0x10A79 */ UNK_TYPE1 unk_10A79[0x7];
/* 0x10A80 */ UNK_TYPE1 unk_10A80[0x2];
/* 0x10A82 */ s16 unk_10A82;
/* 0x10A84 */ UNK_TYPE1 unk_10A84[0x2C];
diff --git a/include/m_field_info.h b/include/m_field_info.h
index 8f74895..e2b4e5e 100644
--- a/include/m_field_info.h
+++ b/include/m_field_info.h
@@ -46,8 +46,8 @@ u16 mFI_GetFieldId(void);
// void func_80087D30_jp();
// void func_80087DC8_jp();
// void func_80087E14_jp();
-// void func_80087E58_jp();
-// void func_80087E94_jp();
+s32 mFI_GetBlockXMax(void);
+s32 mFI_GetBlockZMax(void);
// void func_80087ED0_jp();
// void func_80088018_jp();
// void func_80088160_jp();
@@ -71,7 +71,7 @@ s32 mFI_Wpos2BkandUtNuminBlock(s32*,s32*, s32* ,s32* ,xyz_t);
// void func_80088B3C_jp();
void mFI_UtNum2PosXZInBk(f32*, f32*, s32,s32);
// void func_80088BFC_jp();
-// void func_80088C74_jp();
+void mFI_BkandUtNum2CenterWpos(xyz_t*, s32, s32, s32, s32);
// void func_80088CBC_jp();
// void func_80088CD0_jp();
// void func_80088CE4_jp();
@@ -93,7 +93,7 @@ u8 mFI_BkNum2BlockType(s32,s32);
// void func_8008930C_jp();
// void func_80089348_jp();
// void func_800893C8_jp();
-// void func_80089404_jp();
+s32 mFI_CheckBlockKind_OR(s32, s32, s32);
void mFI_BlockKind2BkNum(s32*,s32*,s32);
// void func_800894D0_jp();
mCoBG_unkStructUnion* mFI_GetBkNum2ColTop(s32 arg0, s32 arg1);
@@ -165,7 +165,7 @@ s32 func_8008BE00_jp(struct FieldMakeMoveActor*, s32);
// void func_8008BFC4_jp();
// void func_8008C058_jp();
s32 mFI_CheckPlayerWade(s32);
-// void func_8008C120_jp();
+s32 mFI_GetPlayerWade(void);
// void func_8008C130_jp();
u16* mFI_GetDepositP(s32,s32);
// void func_8008C344_jp();
diff --git a/include/m_quest.h b/include/m_quest.h
index 84732b2..352eba6 100644
--- a/include/m_quest.h
+++ b/include/m_quest.h
@@ -5,6 +5,7 @@
#include "lb_rtc.h"
#include "m_private_internals.h"
#include "m_npc_base.h"
+#include "m_actor.h"
typedef struct QuestBase {
/* 0x00 */ u32 questType:2; /* type, 0 = delivery, 1 = errand, 2 = contest, 3 = none */
@@ -114,8 +115,8 @@ QuestErrand* mQst_GetFirstJobData(void);
// void func_800BC394_jp();
s32 mQst_GetRandom(s32);
// void func_800BC454_jp();
-// void func_800BC528_jp();
-// void func_800BC5D4_jp();
+s32 mQst_CheckSoccerTarget(Actor*);
+void mQst_NextSoccer(Actor*);
// void func_800BC6B0_jp();
// void func_800BC724_jp();
// void func_800BC830_jp();
diff --git a/include/macros.h b/include/macros.h
index b855eb3..05c5990 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -22,6 +22,7 @@
#define SEGMENTED_TO_K0(addr) (void*)((gSegments[SEGMENT_NUMBER(addr)] + K0BASE) + SEGMENT_OFFSET(addr))
#define ABS(x) (((x) >= 0) ? (x): -(x))
+#define ABS_F(x) ((x) >= 0.0f) ? (x) : -(x)
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
diff --git a/include/segment_symbols.h b/include/segment_symbols.h
index 26d7801..68d00d4 100644
--- a/include/segment_symbols.h
+++ b/include/segment_symbols.h
@@ -112,6 +112,10 @@ DECLARE_SEGMENT(segment_00E02000);
DECLARE_SEGMENT(segment_00E03000);
DECLARE_SEGMENT(segment_00E04000);
DECLARE_SEGMENT(segment_00E0D000);
+
+DECLARE_SEGMENT(act_ball_b);
+DECLARE_SEGMENT(act_ball_d);
+DECLARE_SEGMENT(act_ball_s);
DECLARE_SEGMENT(segment_01408000);
DECLARE_SEGMENT(segment_01409000);
diff --git a/include/sys_math3d.h b/include/sys_math3d.h
index 58e1405..b80c42d 100644
--- a/include/sys_math3d.h
+++ b/include/sys_math3d.h
@@ -27,7 +27,7 @@ typedef struct Pipe {
/* 0x6 */ s_xyz pos;
} Pipe; // size = 0xC
-// void Math3d_normalizeXyz_t();
+f32 Math3d_normalizeXyz_t(xyz_t*);
// void func_800DA028_jp();
// void func_800DA148_jp();
// void Math3D_lineVsPosSuisenCross();
diff --git a/include/tables/dmatables/dmadata_table_jp.h b/include/tables/dmatables/dmadata_table_jp.h
index cbe1dcd..dc07943 100644
--- a/include/tables/dmatables/dmadata_table_jp.h
+++ b/include/tables/dmatables/dmadata_table_jp.h
@@ -2231,9 +2231,9 @@ DEFINE_DMA_ENTRY(object_010EE000, "object_010EE000")
DEFINE_DMA_ENTRY(object_010F0000, "object_010F0000")
DEFINE_DMA_ENTRY(object_010F2000, "object_010F2000")
DEFINE_DMA_ENTRY(segment_010F4000, "segment_010F4000")
-DEFINE_DMA_ENTRY(segment_01100000, "segment_01100000")
-DEFINE_DMA_ENTRY(segment_01101000, "segment_01101000")
-DEFINE_DMA_ENTRY(segment_01102000, "segment_01102000")
+DEFINE_DMA_ENTRY(act_ball_b, "act_ball_b")
+DEFINE_DMA_ENTRY(act_ball_d, "act_ball_d")
+DEFINE_DMA_ENTRY(act_ball_s, "act_ball_s")
DEFINE_DMA_ENTRY(object_01103000, "object_01103000")
DEFINE_DMA_ENTRY(object_01106000, "object_01106000")
DEFINE_DMA_ENTRY(tol_umb_01, "tol_umb_01")
diff --git a/linker_scripts/jp/symbol_addrs_assets.txt b/linker_scripts/jp/symbol_addrs_assets.txt
index 3cc697d..9b11c49 100644
--- a/linker_scripts/jp/symbol_addrs_assets.txt
+++ b/linker_scripts/jp/symbol_addrs_assets.txt
@@ -874,6 +874,26 @@ cKF_ba_r_obj_w_windmill = 0x06092A24; // segment:object_00D5E000 rom:0xDF0A24
cKF_je_r_obj_w_windmill = 0x06092A38; // segment:object_00D5E000 rom:0xDF0A38
cKF_bs_r_obj_w_windmill = 0x06092A74; // segment:object_00D5E000 rom:0xDF0A74
+act_ball_b_v = 0x6000000; // segment:act_ball_b rom:0x1100000 size:0x1A0
+act_ball_b_modelT = 0x60001A0; // segment:act_ball_b rom:0x11001A0
+act_ball_b_model = 0x60001A8; // segment:act_ball_b rom:0x11001A8
+act_ball_b_pal = 0x6000318; // segment:act_ball_b rom:0x1100318
+act_ball_b_1_tex = 0x6000338; // segment:act_ball_b rom:0x1100338
+
+act_ball_d_v = 0x6000000; // segment:act_ball_d rom:0x1101000 size:0x360
+act_ball_d_modelT = 0x6000360; // segment:act_ball_d rom:0x1101360
+act_ball_d_model = 0x6000368; // segment:act_ball_d rom:0x1101368
+act_ball_d_pal = 0x60005C8; // segment:act_ball_d rom:0x11015C8
+act_ball_d_1_tex = 0x60005E8; // segment:act_ball_d rom:0x11015E8
+act_ball_d_2_tex = 0x6000668; // segment:act_ball_d rom:0x1101668
+act_ball_d_3_tex = 0x60006E8; // segment:act_ball_d rom:0x11016E8
+
+act_ball_s_v = 0x6000000; // segment:act_ball_s rom:0x1102000 size:0x700
+act_ball_s_modelT = 0x6000700; // segment:act_ball_s rom:0x1102700
+act_ball_s_model = 0x6000708; // segment:act_ball_s rom:0x1102708
+act_ball_s_pal = 0x60008B8; // segment:act_ball_s rom:0x11028B8
+act_ball_s_5_tex = 0x60008D8; // segment:act_ball_s rom:0x11028D8
+
tol_umb_01_v = 0x6000000; // segment:tol_umb_01 rom:0x1107000 size:0x380
kasa_umb01_model = 0x6000380; // segment:tol_umb_01 rom:0x1107380
e_umb01_model = 0x6000448; // segment:tol_umb_01 rom:0x1107448
diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt
index 30576ac..8acac57 100644
--- a/linker_scripts/jp/symbol_addrs_code.txt
+++ b/linker_scripts/jp/symbol_addrs_code.txt
@@ -771,7 +771,7 @@ mCoBG_GetBgY_AngleS_FromWpos = 0x80071884; // type:func
func_80071A08_jp = 0x80071A08; // type:func
func_80071AB8_jp = 0x80071AB8; // type:func
mCoBG_GetBgY_OnlyCenter_FromWpos2 = 0x80071B78; // type:func
-func_80071C1C_jp = 0x80071C1C; // type:func
+mCoBG_GetBgNorm_FromWpos = 0x80071C1C; // type:func
func_80071DB4_jp = 0x80071DB4; // type:func
func_800721C8_jp = 0x800721C8; // type:func
func_800721E4_jp = 0x800721E4; // type:func
@@ -838,19 +838,19 @@ func_80075954_jp = 0x80075954; // type:func
func_80075A10_jp = 0x80075A10; // type:func
func_80075AB4_jp = 0x80075AB4; // type:func
func_80075B28_jp = 0x80075B28; // type:func
-func_80075EA0_jp = 0x80075EA0; // type:func
+mCoBG_GetWaterHeight_File = 0x80075EA0; // type:func
func_8007620C_jp = 0x8007620C; // type:func
func_80076248_jp = 0x80076248; // type:func
func_80076270_jp = 0x80076270; // type:func
func_80076280_jp = 0x80076280; // type:func
-func_80076290_jp = 0x80076290; // type:func
+mCoBG_GetWaterFlow = 0x80076290; // type:func
func_80076358_jp = 0x80076358; // type:func
func_8007638C_jp = 0x8007638C; // type:func
func_800763F0_jp = 0x800763F0; // type:func
func_800763FC_jp = 0x800763FC; // type:func
func_8007648C_jp = 0x8007648C; // type:func
func_800764CC_jp = 0x800764CC; // type:func
-func_800765AC_jp = 0x800765AC; // type:func
+mCoBG_BgCheckControll = 0x800765AC; // type:func
func_80076778_jp = 0x80076778; // type:func
func_800768C8_jp = 0x800768C8; // type:func
func_80076A04_jp = 0x80076A04; // type:func
@@ -1303,8 +1303,8 @@ func_80087C9C_jp = 0x80087C9C; // type:func
func_80087D30_jp = 0x80087D30; // type:func
func_80087DC8_jp = 0x80087DC8; // type:func
func_80087E14_jp = 0x80087E14; // type:func
-func_80087E58_jp = 0x80087E58; // type:func
-func_80087E94_jp = 0x80087E94; // type:func
+mFI_GetBlockXMax = 0x80087E58; // type:func
+mFI_GetBlockZMax = 0x80087E94; // type:func
func_80087ED0_jp = 0x80087ED0; // type:func
func_80088018_jp = 0x80088018; // type:func
func_80088160_jp = 0x80088160; // type:func
@@ -1328,7 +1328,7 @@ func_80088A58_jp = 0x80088A58; // type:func
func_80088B3C_jp = 0x80088B3C; // type:func
mFI_UtNum2PosXZInBk = 0x80088BC0; // type:func
func_80088BFC_jp = 0x80088BFC; // type:func
-func_80088C74_jp = 0x80088C74; // type:func
+mFI_BkandUtNum2CenterWpos = 0x80088C74; // type:func
func_80088CBC_jp = 0x80088CBC; // type:func
func_80088CD0_jp = 0x80088CD0; // type:func
func_80088CE4_jp = 0x80088CE4; // type:func
@@ -1350,7 +1350,7 @@ func_800892CC_jp = 0x800892CC; // type:func
func_8008930C_jp = 0x8008930C; // type:func
func_80089348_jp = 0x80089348; // type:func
func_800893C8_jp = 0x800893C8; // type:func
-func_80089404_jp = 0x80089404; // type:func
+mFI_CheckBlockKind_OR = 0x80089404; // type:func
mFI_BlockKind2BkNum = 0x80089440; // type:func
func_800894D0_jp = 0x800894D0; // type:func
mFI_GetBkNum2ColTop = 0x80089538; // type:func
@@ -1422,7 +1422,7 @@ func_8008BF34_jp = 0x8008BF34; // type:func
func_8008BFC4_jp = 0x8008BFC4; // type:func
func_8008C058_jp = 0x8008C058; // type:func
mFI_CheckPlayerWade = 0x8008C0FC; // type:func
-func_8008C120_jp = 0x8008C120; // type:func
+mFI_GetPlayerWade = 0x8008C120; // type:func
func_8008C130_jp = 0x8008C130; // type:func
mFI_GetDepositP = 0x8008C1E0; // type:func
func_8008C344_jp = 0x8008C344; // type:func
@@ -2851,8 +2851,8 @@ func_800BC368_jp = 0x800BC368; // type:func
func_800BC394_jp = 0x800BC394; // type:func
mQst_GetRandom = 0x800BC414; // type:func
func_800BC454_jp = 0x800BC454; // type:func
-func_800BC528_jp = 0x800BC528; // type:func
-func_800BC5D4_jp = 0x800BC5D4; // type:func
+mQst_CheckSoccerTarget = 0x800BC528; // type:func
+mQst_NextSoccer = 0x800BC5D4; // type:func
func_800BC6B0_jp = 0x800BC6B0; // type:func
func_800BC724_jp = 0x800BC724; // type:func
func_800BC830_jp = 0x800BC830; // type:func
@@ -3247,17 +3247,17 @@ func_800CE110_jp = 0x800CE110; // type:func
func_800CE120_jp = 0x800CE120; // type:func
func_800CE1CC_jp = 0x800CE1CC; // type:func
func_800CE328_jp = 0x800CE328; // type:func
-func_800CE4B0_jp = 0x800CE4B0; // type:func
-func_800CE4F4_jp = 0x800CE4F4; // type:func
-func_800CE554_jp = 0x800CE554; // type:func
-func_800CE694_jp = 0x800CE694; // type:func
-func_800CE7E4_jp = 0x800CE7E4; // type:func
-func_800CE874_jp = 0x800CE874; // type:func
-func_800CE8F0_jp = 0x800CE8F0; // type:func
-func_800CE9C4_jp = 0x800CE9C4; // type:func
-func_800CEB1C_jp = 0x800CEB1C; // type:func
+mRlib_spdXZ_to_spdF_Angle = 0x800CE4B0; // type:func
+mRlib_spdF_Angle_to_spdXZ = 0x800CE4F4; // type:func
+mRlib_position_move_for_sloop = 0x800CE554; // type:func
+mRlib_Get_norm_Clif = 0x800CE694; // type:func
+mRlib_Roll_Matrix_to_s_xyz = 0x800CE7E4; // type:func
+mRlib_Get_HitWallAngleY = 0x800CE874; // type:func
+mRlib_Station_step_modify_to_wall = 0x800CE8F0; // type:func
+mRlib_Set_Position_Check = 0x800CE9C4; // type:func
+mRlib_HeightGapCheck_And_ReversePos = 0x800CEB1C; // type:func
func_800CEC30_jp = 0x800CEC30; // type:func
-func_800CEC98_jp = 0x800CEC98; // type:func
+mRlib_Get_ground_norm_inHole = 0x800CEC98; // type:func
func_800CEE24_jp = 0x800CEE24; // type:func
func_800CEED4_jp = 0x800CEED4; // type:func
func_800CF05C_jp = 0x800CF05C; // type:func
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 3a1cdb8..cb67799 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -8673,38 +8673,38 @@ jtbl_80968840_jp = 0x80968840; // type:jtbl
// .text
-func_80968A10_jp = 0x80968A10; // type:func
+aBALL_secure_bank_area = 0x80968A10; // type:func
func_80968AF4_jp = 0x80968AF4; // type:func
-func_80968B9C_jp = 0x80968B9C; // type:func
+aBALL_Random_pos_set = 0x80968B9C; // type:func
aBALL_actor_ct = 0x80968D08; // type:func
aBALL_actor_dt = 0x80968F98; // type:func
-func_80969040_jp = 0x80969040; // type:func
-func_80969114_jp = 0x80969114; // type:func
-func_809693EC_jp = 0x809693EC; // type:func size:0x414
-func_80969800_jp = 0x80969800; // type:func
-func_8096983C_jp = 0x8096983C; // type:func
-func_809698E8_jp = 0x809698E8; // type:func
-func_80969998_jp = 0x80969998; // type:func
-func_809699D8_jp = 0x809699D8; // type:func
-func_80969DE8_jp = 0x80969DE8; // type:func
-func_80969FBC_jp = 0x80969FBC; // type:func
-func_80969FD8_jp = 0x80969FD8; // type:func
-func_8096A0CC_jp = 0x8096A0CC; // type:func
-func_8096A0EC_jp = 0x8096A0EC; // type:func
-func_8096A23C_jp = 0x8096A23C; // type:func
-func_8096A334_jp = 0x8096A334; // type:func
-func_8096A3D8_jp = 0x8096A3D8; // type:func
+aBALL_position_move = 0x80969040; // type:func
+aBALL_BGcheck = 0x80969114; // type:func
+aBALL_OBJcheck = 0x809693EC; // type:func size:0x414
+aBALL_House_Tree_Rev_Check = 0x80969800; // type:func
+aBALL_process_air_init = 0x8096983C; // type:func
+aBALL_process_air = 0x809698E8; // type:func
+aBALL_process_ground_init = 0x80969998; // type:func
+aBALL_process_ground = 0x809699D8; // type:func
+aBALL_set_spd_relations_in_water = 0x80969DE8; // type:func
+aBALL_process_air_water_init = 0x80969FBC; // type:func
+aBALL_process_air_water = 0x80969FD8; // type:func
+aBALL_process_ground_water_init = 0x8096A0CC; // type:func
+aBALL_process_ground_water = 0x8096A0EC; // type:func
+aBALL_calc_axis = 0x8096A23C; // type:func
+aBALL_player_angle_distance_check = 0x8096A334; // type:func
+aBALL_status_check = 0x8096A3D8; // type:func
aBALL_actor_move = 0x8096A678; // type:func
aBALL_actor_draw = 0x8096A77C; // type:func
func_8096A86C_jp = 0x8096A86C; // type:func
// .data
-D_8096A8B0_jp = 0x8096A8B0; //
+ball_model_tbl = 0x8096A8B0; //
Ball_Profile = 0x8096A8BC; //
aBALL_CoInfoData = 0x8096A8E0; //
aBALL_StatusData = 0x8096A8F0; //
-D_8096A8FC_jp = 0x8096A8FC; // type:s16
+angl_add_table = 0x8096A8FC; // type:s16
// .rodata
diff --git a/src/code/m_field_info.c b/src/code/m_field_info.c
index 906ed63..e48824d 100644
--- a/src/code/m_field_info.c
+++ b/src/code/m_field_info.c
@@ -19,9 +19,9 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80087E14_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80087E58_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_GetBlockXMax.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80087E94_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_GetBlockZMax.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80087ED0_jp.s")
@@ -69,7 +69,7 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088BFC_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088C74_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_BkandUtNum2CenterWpos.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088CBC_jp.s")
@@ -113,7 +113,7 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_800893C8_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80089404_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_CheckBlockKind_OR.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_BlockKind2BkNum.s")
@@ -257,7 +257,7 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_CheckPlayerWade.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008C120_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_GetPlayerWade.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008C130_jp.s")
diff --git a/src/code/m_scene.c b/src/code/m_scene.c
index e29fa0c..8c5ba7a 100644
--- a/src/code/m_scene.c
+++ b/src/code/m_scene.c
@@ -399,8 +399,8 @@ void mSc_dmacopy_all_exchange_bank(ObjectExchangeBank* exchange) {
}
}
if (common_data.clip.unk_0A8 != NULL) {
- if (common_data.clip.unk_0A8->unk_4 != NULL) {
- common_data.clip.unk_0A8->unk_4(exchange);
+ if (common_data.clip.unk_0A8->unk_04 != NULL) {
+ common_data.clip.unk_0A8->unk_04(exchange);
}
}
diff --git a/src/objects/act_ball_b/act_ball_b.c b/src/objects/act_ball_b/act_ball_b.c
new file mode 100644
index 0000000..595a7f5
--- /dev/null
+++ b/src/objects/act_ball_b/act_ball_b.c
@@ -0,0 +1,9 @@
+#include "act_ball_b.h"
+
+#include "assets/jp/objects/act_ball_b/act_ball_b_v.vtx.inc.c"
+#include "assets/jp/objects/act_ball_b/act_ball_b_modelT.gfx.inc.c"
+#include "assets/jp/objects/act_ball_b/act_ball_b_model.gfx.inc.c"
+#include "assets/jp/objects/act_ball_b/act_ball_b_pal.palette.inc.c"
+u8 act_ball_b_1_tex[] = {
+#include "assets/jp/objects/act_ball_b/act_ball_b_1_tex.ci4.inc.c"
+};
diff --git a/src/objects/act_ball_b/act_ball_b.h b/src/objects/act_ball_b/act_ball_b.h
new file mode 100644
index 0000000..f583673
--- /dev/null
+++ b/src/objects/act_ball_b/act_ball_b.h
@@ -0,0 +1,12 @@
+#ifndef OBJECT_ACT_BALL_B_H
+#define OBJECT_ACT_BALL_B_H
+
+#include "gbi.h"
+
+extern Vtx act_ball_b_v[];
+extern Gfx act_ball_b_modelT[];
+extern Gfx act_ball_b_model[];
+extern u16 act_ball_b_pal[];
+extern u8 act_ball_b_1_tex[];
+
+#endif
diff --git a/src/objects/act_ball_d/act_ball_d.c b/src/objects/act_ball_d/act_ball_d.c
new file mode 100644
index 0000000..fe9284c
--- /dev/null
+++ b/src/objects/act_ball_d/act_ball_d.c
@@ -0,0 +1,15 @@
+#include "act_ball_d.h"
+
+#include "assets/jp/objects/act_ball_d/act_ball_d_v.vtx.inc.c"
+#include "assets/jp/objects/act_ball_d/act_ball_d_modelT.gfx.inc.c"
+#include "assets/jp/objects/act_ball_d/act_ball_d_model.gfx.inc.c"
+#include "assets/jp/objects/act_ball_d/act_ball_d_pal.palette.inc.c"
+u8 act_ball_d_1_tex[] = {
+#include "assets/jp/objects/act_ball_d/act_ball_d_1_tex.ci4.inc.c"
+};
+u8 act_ball_d_2_tex[] = {
+#include "assets/jp/objects/act_ball_d/act_ball_d_2_tex.ci4.inc.c"
+};
+u8 act_ball_d_3_tex[] = {
+#include "assets/jp/objects/act_ball_d/act_ball_d_3_tex.ci4.inc.c"
+};
diff --git a/src/objects/act_ball_d/act_ball_d.h b/src/objects/act_ball_d/act_ball_d.h
new file mode 100644
index 0000000..46ff2ac
--- /dev/null
+++ b/src/objects/act_ball_d/act_ball_d.h
@@ -0,0 +1,14 @@
+#ifndef OBJECT_ACT_BALL_D_H
+#define OBJECT_ACT_BALL_D_H
+
+#include "gbi.h"
+
+extern Vtx act_ball_d_v[];
+extern Gfx act_ball_d_modelT[];
+extern Gfx act_ball_d_model[];
+extern u16 act_ball_d_pal[];
+extern u8 act_ball_d_1_tex[];
+extern u8 act_ball_d_2_tex[];
+extern u8 act_ball_d_3_tex[];
+
+#endif
diff --git a/src/objects/act_ball_s/act_ball_s.c b/src/objects/act_ball_s/act_ball_s.c
new file mode 100644
index 0000000..3aa2e73
--- /dev/null
+++ b/src/objects/act_ball_s/act_ball_s.c
@@ -0,0 +1,9 @@
+#include "act_ball_s.h"
+
+#include "assets/jp/objects/act_ball_s/act_ball_s_v.vtx.inc.c"
+#include "assets/jp/objects/act_ball_s/act_ball_s_modelT.gfx.inc.c"
+#include "assets/jp/objects/act_ball_s/act_ball_s_model.gfx.inc.c"
+#include "assets/jp/objects/act_ball_s/act_ball_s_pal.palette.inc.c"
+u8 act_ball_s_5_tex[] = {
+#include "assets/jp/objects/act_ball_s/act_ball_s_5_tex.ci4.inc.c"
+};
diff --git a/src/objects/act_ball_s/act_ball_s.h b/src/objects/act_ball_s/act_ball_s.h
new file mode 100644
index 0000000..914e424
--- /dev/null
+++ b/src/objects/act_ball_s/act_ball_s.h
@@ -0,0 +1,12 @@
+#ifndef OBJECT_ACT_BALL_S_H
+#define OBJECT_ACT_BALL_S_H
+
+#include "gbi.h"
+
+extern Vtx act_ball_s_v[];
+extern Gfx act_ball_s_modelT[];
+extern Gfx act_ball_s_model[];
+extern u16 act_ball_s_pal[];
+extern u8 act_ball_s_5_tex[];
+
+#endif
diff --git a/src/overlays/actors/ovl_Ball/ac_ball.c b/src/overlays/actors/ovl_Ball/ac_ball.c
index 059cde6..31feda4 100644
--- a/src/overlays/actors/ovl_Ball/ac_ball.c
+++ b/src/overlays/actors/ovl_Ball/ac_ball.c
@@ -1,14 +1,47 @@
#include "ac_ball.h"
#include "m_actor_dlftbls.h"
#include "m_object.h"
+#include "m_actor_shadow.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#include "overlays/actors/player_actor/m_player.h"
+#include "libc/math.h"
+#include "m_npc.h"
+#include "audio.h"
+#include "6F2150.h"
+#include "m_field_info.h"
+#include "sys_math_atan.h"
+#include "m_player_lib.h"
+#include "macros.h"
+#include "segment_symbols.h"
+
+#include "objects/act_ball_b/act_ball_b.h"
+#include "objects/act_ball_d/act_ball_d.h"
+#include "objects/act_ball_s/act_ball_s.h"
+
+#define THIS ((Ball*)thisx)
void aBALL_actor_ct(Actor* thisx, Game_Play* game_play);
void aBALL_actor_dt(Actor* thisx, Game_Play* game_play);
void aBALL_actor_move(Actor* thisx, Game_Play* game_play);
void aBALL_actor_draw(Actor* thisx, Game_Play* game_play);
-#if 0
+void func_8096A86C_jp(void);
+void aBALL_process_air(Ball* this, Game_Play* game_play);
+void aBALL_process_ground(Ball* this, Game_Play* game_play);
+void aBALL_process_ground_init(Ball* this, Game_Play* game_play);
+void aBALL_process_air_water_init(Ball* this, Game_Play* game_play);
+void aBALL_process_air_water(Ball* this, Game_Play* game_play);
+void aBALL_process_ground_water_init(Ball* this, Game_Play* game_play);
+void aBALL_process_ground_water(Ball* this, Game_Play* game_play);
+
+static Ball* Global_Actor_p;
+
+Gfx* ball_model_tbl[3] = {
+ act_ball_b_model,
+ act_ball_d_model,
+ act_ball_s_model,
+};
+
ActorProfile Ball_Profile = {
/* */ ACTOR_BALL,
/* */ ACTOR_PART_4,
@@ -22,63 +55,752 @@ ActorProfile Ball_Profile = {
/* */ aBALL_actor_draw,
/* */ NULL,
};
-#endif
-extern ClObjPipe_Init aBALL_CoInfoData;
-extern CollisionCheck_Status_Init aBALL_StatusData;
+ClObjPipe_Init aBALL_CoInfoData = {
+ { OC1_1 | OC1_TYPE_8 | OC1_TYPE_10 | OC1_TYPE_20, OC2_TYPE_20, COLSHAPE_PIPE },
+ { ELEM_FLAG_1 },
+ { { 0xD, 0x1E, -0xA, { 0, 0, 0 } } },
+};
+
+CollisionCheck_Status_Init aBALL_StatusData = {
+ 0, 0xD, 0x1E, -0xA, 100,
+};
+
+// Original name unknown.
+s32 aBALL_secure_bank_area(Ball* this, Game_Play* game_play, s32 type) {
+ size_t romSize;
+ s32 bank;
+
+ bank = game_play->objectExchangeBank.num;
+ switch (type) {
+ case BALL_TYPE_B:
+ romSize = SEGMENT_ROM_SIZE(act_ball_b);
+ break;
+ case BALL_TYPE_D:
+ romSize = SEGMENT_ROM_SIZE(act_ball_d);
+ break;
+ case BALL_TYPE_S:
+ romSize = SEGMENT_ROM_SIZE(act_ball_s);
+ break;
+ default:
+ romSize = SEGMENT_ROM_SIZE(act_ball_b);
+ break;
+ }
+
+ if (mSc_secure_exchange_keep_bank(&game_play->objectExchangeBank, 0, romSize)) {
+ this->segment = game_play->objectExchangeBank.status[bank].segment;
+ return true;
+ }
+ return false;
+}
+
+// Original name unknown.
+void func_80968AF4_jp(Ball* this, s32 type) {
+ RomOffset romStart;
+ RomOffset romEnd;
+
+ switch (type) {
+ case BALL_TYPE_B:
+ romStart = SEGMENT_ROM_START(act_ball_b);
+ romEnd = SEGMENT_ROM_END(act_ball_b);
+ break;
+ case BALL_TYPE_D:
+ romStart = SEGMENT_ROM_START(act_ball_d);
+ romEnd = SEGMENT_ROM_END(act_ball_d);
+ break;
+ case BALL_TYPE_S:
+ romStart = SEGMENT_ROM_START(act_ball_s);
+ romEnd = SEGMENT_ROM_END(act_ball_s);
+ break;
+ default:
+ romStart = SEGMENT_ROM_START(act_ball_b);
+ romEnd = SEGMENT_ROM_END(act_ball_b);
+ break;
+ }
+ if ((romStart != NULL) && (romEnd != NULL)) {
+ DmaMgr_RequestSyncDebug(this->segment, romStart, romEnd - romStart, "../ac_ball.c", 0x11D);
+ }
+}
+
+s32 aBALL_Random_pos_set(xyz_t* pos) {
+ s32 xMax;
+ s32 zMax;
+ s32 utX;
+ s32 utZ;
+ s32 xIncrement;
+ s32 zIncrement;
+ s32 x;
+ s32 z;
+ s32 i;
+ s32 j;
+
+ xMax = mFI_GetBlockXMax();
+ zMax = mFI_GetBlockZMax();
+ x = RANDOM_F(xMax);
+ z = RANDOM_F(zMax);
+
+ for (i = 0; i < xMax; i++) {
+ for (j = 0; j < zMax; j++) {
+ if (!mFI_CheckBlockKind_OR(x, z, 0x8023) && mNpc_GetMakeUtNuminBlock_hard_area(&utX, &utZ, x, z, 2) == 1) {
+ mFI_BkandUtNum2CenterWpos(pos, x, z, utX, utZ);
+ return true;
+ }
+
+ zIncrement = z + 1;
+ z = zMax;
+
+ if (z == zIncrement) {
+ z = 0;
+ } else {
+ z = zIncrement;
+ }
+ }
+
+ xIncrement = x + 1;
+ x = xMax;
+
+ if (x == xIncrement) {
+ x = 0;
+ } else {
+ x = xIncrement;
+ }
+ }
+
+ return false;
+}
+
+void aBALL_actor_ct(Actor* thisx, Game_Play* game_play) {
+ Ball* this = THIS;
+ UNUSED UNK_TYPE1 pad[0x4];
+
+ Global_Actor_p = this;
+ if ((common_data.unk_10A6C.x == 0.0f) && (common_data.unk_10A6C.y == 0.0f) && (common_data.unk_10A6C.z == 0.0f)) {
+
+ if (!aBALL_Random_pos_set(&this->actor.world.pos)) {
+ this->actor.world.pos = this->actor.home.pos;
+ }
+ common_data.unk_10A78 = RANDOM_F(3);
+ common_data.unk_10A6C = this->actor.world.pos;
+ this->type = common_data.unk_10A78;
+ } else {
+ this->actor.world.pos = common_data.unk_10A6C;
+ this->type = common_data.unk_10A78;
+ }
+ aBALL_secure_bank_area(this, game_play, this->type);
+ func_80968AF4_jp(this, this->type);
+ common_data.clip.unk_0D0 = func_8096A86C_jp;
+ Shape_Info_init(&this->actor, 0.0f, mAc_ActorShadowEllipse, 9.0f, 17.0f);
+ ClObjPipe_ct(game_play, &this->collider);
+ ClObjPipe_set5(game_play, &this->collider, &this->actor, &aBALL_CoInfoData);
+ CollisionCheck_Status_set3(&this->actor.colStatus, &aBALL_StatusData);
+ this->bounceTimer = 3;
+ aBALL_process_ground_init(this, game_play);
+ this->colliderActor = 0;
+ this->actor.terminalVelocity = -20.0f;
+ this->actor.gravity = 0.6f;
+ this->actor.speed = 0.0f;
+ this->maxSpeed = 0.0f;
+ this->acceleration = 0.12f;
+ this->actor.scale.x = 0.01f;
+ this->actor.scale.y = 0.01f;
+ this->actor.scale.z = 0.01f;
+ this->speed = 0.0f;
+ this->unk_20A = 0;
+}
+
+void aBALL_actor_dt(Actor* thisx, Game_Play* game_play) {
+ Ball* this = THIS;
+
+ if ((this->unk_208 & BALL_208_FLAG_1) || (this->unk_208 & BALL_208_FLAG_2) ||
+ !mRlib_Set_Position_Check(&this->actor)) {
+ common_data.unk_10A6C = ZeroVec;
+ } else {
+ common_data.unk_10A6C = this->actor.world.pos;
+ }
+ common_data.clip.unk_0D0 = NULL;
+ ClObjPipe_dt(game_play, &this->collider);
+}
+
+void aBALL_position_move(Ball* this) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ s_xyz slopeAngle;
+
+ mCoBG_GetBgY_AngleS_FromWpos(&slopeAngle, this->actor.world.pos, 0.0f);
+
+ if (this->actor.colResult.onGround || this->actor.colResult.inWater) {
+ chase_f(&this->actor.speed, this->maxSpeed, this->acceleration);
+ }
+
+ if (!(this->unk_208 & BALL_208_FLAG_2)) {
+ mRlib_spdF_Angle_to_spdXZ(&this->actor.velocity, &this->actor.speed, &this->actor.world.rot.y);
+ chase_f(&this->actor.velocity.y, this->actor.terminalVelocity, this->actor.gravity);
+ mRlib_position_move_for_sloop(&this->actor, &slopeAngle);
+ if (this->actor.world.pos.z < 840.0f) {
+ this->actor.world.pos.z = 840.0f;
+ }
+ }
+}
+
+void aBALL_BGcheck(Ball* this) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ f32 yVelocity;
+ s32 hitWall;
+ s16 wallAngle;
+ s16 rot;
+ xyz_t velocity;
+ f32 sin;
+ f32 cos;
+ f32 sinCos;
+ f32 speed;
+ f32 adjustedSpeed;
+ s32 rotMagnitude;
+
+ yVelocity = this->actor.velocity.y;
+
+ if ((this->process == aBALL_process_air_water) || (this->process == aBALL_process_ground_water) ||
+ (this->actor.colResult.unk5 == 0xB)) {
+ mCoBG_BgCheckControll(&this->bgPos, &this->actor, 12.0f, -12.0f, 0, 1, 0);
+ this->actor.world.pos.x += this->bgPos.x;
+ this->actor.world.pos.z += this->bgPos.z;
+ } else {
+ mCoBG_BgCheckControll(&this->bgPos, &this->actor, 12.0f, -12.0f, 0, 0, 0);
+ mRlib_Station_step_modify_to_wall(&this->actor);
+ }
+
+ if (((this->process == aBALL_process_air) || (this->process == aBALL_process_air_water)) &&
+ this->actor.colResult.onGround) {
+ if (this->bounceTimer < 3) {
+ do {
+ this->bounceTimer++;
+ } while (0);
+
+ if (this->actor.colResult.inWater) {
+ this->actor.velocity.y = 0.2f;
+ } else {
+ this->actor.velocity.y = -yVelocity * 0.7f;
+ }
+ }
+ }
+
+ hitWall = this->actor.colResult.hitWall;
+ if (hitWall & 1) {
+ wallAngle = mRlib_Get_HitWallAngleY(&this->actor);
+ rot = this->actor.world.rot.y - wallAngle - 0x8000;
+ rotMagnitude = ABS(rot);
+ if (rotMagnitude < 0x4000) {
+ velocity = this->actor.velocity;
+ sin = sin_s(wallAngle);
+ cos = cos_s(wallAngle);
+ sinCos = sin * cos;
+ speed = -((velocity.z * cos) + (velocity.x * sin));
+ adjustedSpeed = (speed * 0.07f) + 1.2f;
+ if (speed > 1.0f) {
+ sAdo_OngenTrgStartSpeed(0x26, &this->actor.world.pos, speed);
+ }
+ this->actor.velocity.z =
+ ((1.0f - (adjustedSpeed * cos * cos)) * velocity.z) - (velocity.x * adjustedSpeed * sinCos);
+ this->actor.velocity.x =
+ (-velocity.z * adjustedSpeed * sinCos) + (velocity.x * (1.0f - (adjustedSpeed * sin * sin)));
+ mRlib_spdXZ_to_spdF_Angle(&this->actor.velocity, &this->actor.speed, &this->actor.world.rot.y);
+ }
+ }
+}
+
+void aBALL_OBJcheck(Ball* this) {
+ s32 playerWade;
+ Actor* colliderActor;
+ s16 collidingAngle;
+ f32 totalMomentum;
+ f32 ballSpeed;
+ f32 colliderSpeed;
+ f32 colliderMomentum;
+ f32 cos;
+ UNUSED UNK_TYPE1 pad[0x4];
+ f32 sin;
+
+ playerWade = mFI_GetPlayerWade();
+
+ if (this->collider.base.prop.ocFlags1 & OC1_2) {
+ xyz_t colliderVelocity;
+ f32 xVelocityDiff;
+ f32 zVelocityDiff;
+ f32 newXVelocity;
+ f32 newZVelocity;
+ UNUSED UNK_TYPE1 pad2[0x4];
+
+ this->collider.base.prop.ocFlags1 &= ~OC1_2;
+
+ colliderActor = this->collider.base.oc;
+ if (mQst_CheckSoccerTarget(this->colliderActor)) {
+
+ mQst_NextSoccer(this->colliderActor);
+ this->actor.speed = 0.0f;
+ this->actor.velocity = ZeroVec;
+ } else if ((colliderActor != NULL) && (!(this->unk_208 & BALL_208_FLAG_2)) &&
+ ((playerWade != 1) && (playerWade != 2))) {
+
+ if (colliderActor != this->colliderActor) {
-#if 0
-ClObjPipe_Init aBALL_CoInfoData = { { OC1_1 | OC1_TYPE_8 | OC1_TYPE_10 | OC1_TYPE_20, OC2_TYPE_20, COLSHAPE_PIPE }, { ELEM_FLAG_1 }, { { 0xD, 0x1E, -0xA, { 0, 0, 0 } } }, };
-CollisionCheck_Status_Init aBALL_StatusData = { 0, 0xD, 0x1E, -0xA, 100, };
-#endif
+ colliderVelocity = colliderActor->velocity;
+ this->colliderActor = colliderActor;
+ collidingAngle = atans_table(this->actor.world.pos.z - colliderActor->world.pos.z,
+ this->actor.world.pos.x - colliderActor->world.pos.x);
+ sin = sin_s(collidingAngle);
+ cos = cos_s(collidingAngle);
+ ballSpeed = (this->actor.velocity.x * sin) + (cos * this->actor.velocity.z);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80968A10_jp.s")
+ colliderSpeed = sqrtf(SQ(colliderVelocity.x) + SQ(colliderVelocity.z));
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80968AF4_jp.s")
+ xyz_t_mult_v(&colliderVelocity, (24.0f / 180.0f) * colliderSpeed * 0.9f + 0.1f);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80968B9C_jp.s")
+ colliderMomentum = (sin * colliderVelocity.x) + (cos * colliderVelocity.z);
+ totalMomentum = ABS_F(ballSpeed + colliderMomentum);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/aBALL_actor_ct.s")
+ xVelocityDiff = sin_s(collidingAngle) * totalMomentum;
+ zVelocityDiff = cos_s(collidingAngle) * totalMomentum;
+ newXVelocity = this->actor.velocity.x + xVelocityDiff;
+ newZVelocity = this->actor.velocity.z + zVelocityDiff;
+ ballSpeed = sqrtf(SQ(newXVelocity) + SQ(newZVelocity));
+ ballSpeed = CLAMP_MAX(ballSpeed, 11.0f);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/aBALL_actor_dt.s")
+ if (this->actor.colResult.onGround) {
+ f32 speedFactor;
+ s16 verticalAngle;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969040_jp.s")
+ if (this->actor.speed == 0.0f) {
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969114_jp.s")
+ speedFactor = ballSpeed / 11.0f;
+ verticalAngle =
+ DEG_TO_BINANG_ALT3(((fqrand2() * (35.0f * speedFactor)) + (90.0f * speedFactor)));
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_809693EC_jp.s")
+ this->actor.speed = cos_s(verticalAngle) * ballSpeed;
+ this->actor.velocity.y = sin_s(verticalAngle) * ballSpeed;
+ } else {
+ this->actor.speed = ballSpeed * 0.75f;
+ }
+ } else {
+ this->actor.speed = ballSpeed * 0.75f;
+ }
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969800_jp.s")
+ this->actor.world.rot.y = atans_table(newZVelocity, newXVelocity);
+ this->actor.speed *= 0.9f;
+ sAdo_OngenTrgStartSpeed(0x25, &this->actor.world.pos, this->actor.speed);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096983C_jp.s")
+ } else {
+ xyz_t newVelocity;
+ xyz_t displacement;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_809698E8_jp.s")
+ displacement = this->actor.colStatus.displacement;
+ xyz_t_add(&this->actor.velocity, &displacement, &newVelocity);
+ if ((playerWade != 1) && (playerWade != 2)) {
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969998_jp.s")
+ this->actor.speed = sqrtf(SQ(newVelocity.x) + SQ(newVelocity.z));
+ this->actor.speed = CLAMP_MAX(this->actor.speed, 11.0f);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_809699D8_jp.s")
+ this->actor.world.rot.y = atans_table(newVelocity.z, newVelocity.x);
+ }
+ }
+ } else {
+ this->colliderActor = NULL;
+ }
+ } else {
+ this->colliderActor = NULL;
+ }
+}
+
+void aBALL_House_Tree_Rev_Check(Ball* this) {
+ if (mRlib_HeightGapCheck_And_ReversePos() != 1) {
+ this->unk_208 |= BALL_208_FLAG_1;
+ Actor_delete(&this->actor);
+ }
+}
+
+void aBALL_process_air_init(Ball* this, UNUSED Game_Play* game_play) {
+ xyz_t* pos;
+ f32 slopeAngle;
+
+ pos = &this->actor.world.pos;
+ slopeAngle = mCoBG_GetBgY_AngleS_FromWpos(NULL, this->actor.world.pos, 0.0f);
+ this->actor.shape.drawShadow = 1;
+ if ((this->process == aBALL_process_ground) && ((this->actor.world.pos.y - slopeAngle) > 20.0f)) {
+ sAdo_OngenTrgStart(0x43D, pos);
+ }
+ this->process = aBALL_process_air;
+}
+
+void aBALL_process_air(Ball* this, Game_Play* game_play) {
+
+ this->acceleration = 0.0f;
+ add_calc0(&this->height, 0.5f, 100.0f);
+ this->actor.terminalVelocity = -20.0f;
+ this->actor.gravity = 0.6f;
+ this->speed = this->actor.speed;
+ if (this->actor.colResult.onGround) {
+ if (this->actor.colResult.inWater) {
+ aBALL_process_ground_water_init(this, game_play);
+ } else {
+ aBALL_process_ground_init(this, game_play);
+ }
+ } else if (this->actor.colResult.inWater) {
+ aBALL_process_air_water_init(this, game_play);
+ }
+}
+
+void aBALL_process_ground_init(Ball* this, UNUSED Game_Play* game_play) {
+ this->actor.shape.drawShadow = 1;
+ if (this->actor.velocity.y > 0.0f) {
+ this->process = aBALL_process_air;
+ } else {
+ this->process = aBALL_process_ground;
+ }
+}
+
+void aBALL_process_ground(Ball* this, Game_Play* game_play) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ xyz_t bgNorm;
+ f32 distance;
+ s16 angleRate;
+ s16 yAngle;
+ s32 var_v0;
+ f32 xSpeed;
+ f32 zSpeed;
+
+ mCoBG_GetBgNorm_FromWpos(&bgNorm, this->actor.world.pos);
+ if (mRlib_Get_ground_norm_inHole(&this->actor, &bgNorm, &distance, &yAngle, &angleRate, 1.0f)) {
+ f32 targetHeight;
+
+ targetHeight = (distance - 40.0f) - 5.0f;
+ if (!(targetHeight < 0)) {
+ targetHeight = 0;
+ }
+ targetHeight *= 25.0f;
+ add_calc(&this->height, targetHeight, 0.5f, 200.0f, 5.0f);
+ this->actor.velocity.x *= 0.7f;
+ this->actor.velocity.z *= 0.7f;
+ if (distance < 1.0f) {
+ xSpeed = ABS_F(this->actor.velocity.x);
+
+ if (xSpeed < 1.0f) {
+ zSpeed = ABS_F(this->actor.velocity.z);
+
+ if (zSpeed < 1.0f) {
+ this->unk_208 |= BALL_208_FLAG_2;
+ this->collider.attribute.dim.unk_2 = 0x14;
+ this->collider.attribute.dim.radius = 0x12;
+ this->actor.colStatus.mass = 0xFE;
+ this->actor.speed = 0.0f;
+ return;
+ }
+ }
+ }
+ } else {
+ mRlib_Get_norm_Clif(&this->actor, &bgNorm);
+ add_calc0(&this->height, 0.5f, 100.0f);
+ }
+
+ if (!(fabsf(bgNorm.x) < 0.008f) || !(fabsf(bgNorm.z) < 0.008f)) {
+ if (Math3d_normalizeXyz_t(&bgNorm)) {
+ this->actor.velocity.x += 1.35f * bgNorm.x;
+ this->actor.velocity.z += 1.35f * bgNorm.z;
+ mRlib_spdXZ_to_spdF_Angle(&this->actor.velocity, &this->maxSpeed, &this->actor.world.rot.y);
+ if (this->maxSpeed < 8.0f) {
+ this->maxSpeed = this->maxSpeed;
+ } else {
+ this->maxSpeed = 8.0f;
+ }
+ this->acceleration = 0.1f;
+ }
+ } else {
+ this->maxSpeed = 0.0f;
+ this->acceleration = 0.12f;
+ }
+
+ this->actor.terminalVelocity = -20.0f;
+ this->actor.gravity = 0.6f;
+ this->speed = this->actor.speed;
+ if (this->actor.colResult.inWater || this->actor.colResult.unk5 == 0xB) {
+ if (this->actor.colResult.onGround) {
+ aBALL_process_ground_water_init(this, game_play);
+ } else {
+ this->bounceTimer = 0;
+ aBALL_process_air_water_init(this, game_play);
+ }
+ } else if (!this->actor.colResult.onGround) {
+ this->bounceTimer = 0;
+ aBALL_process_air_init(this, game_play);
+ return;
+ }
+
+ if (!(game_play->state.frameCounter & 7) && this->actor.colResult.unk5 == 9) {
+ if (this->actor.speed > 1.0f) {
+
+ if (this->actor.speed > 4.0f) {
+ var_v0 = 1;
+ } else {
+ var_v0 = 0;
+ }
+
+ common_data.clip.unk_090->unk_00(0x33, this->actor.world.pos, 1, this->actor.world.rot.y, game_play,
+ this->actor.fgName, 0, var_v0);
+ }
+ }
+}
// TODO: this function includes an unreferenced float. It was forced to be in this function to
// be able to build and match the file. It needs to be figured out where to put this float and
// how to handle this when this file gets decompiled.
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969DE8_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969FBC_jp.s")
+// RO_FLT_8096A96C_jp 0.200000003
+
+s16 angl_add_table[2] = {
+ 0x100,
+ 0x400,
+};
+
+void aBALL_set_spd_relations_in_water(Ball* this, Game_Play* game_play) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ xyz_t flowPos;
+ s16 yRot;
+ f32 waterHeight;
+ s32 yDiffAngle;
+
+ waterHeight = mCoBG_GetWaterHeight_File(this->actor.world.pos, "../ac_ball.c", 949);
+ add_calc0(&this->height, 0.5f, 100.0f);
+ mCoBG_GetWaterFlow(&flowPos, this->actor.colResult.unk5);
+ yRot = atans_table(flowPos.z, flowPos.x);
+ yDiffAngle = ABS((s16)(this->actor.world.rot.y - yRot));
+
+ chase_angle(&this->actor.world.rot.y, yRot, angl_add_table[((yDiffAngle > 0x4000))]);
+ if (this->actor.world.pos.y < waterHeight) {
+ this->actor.terminalVelocity = 1.0f;
+ } else {
+ this->actor.terminalVelocity = -1.0f;
+ }
+
+ if (this->waterTimer < 0x20) {
+ if ((!(game_play->state.frameCounter & 3) && (this->waterTimer < 0x10)) ||
+ !(game_play->state.frameCounter & 7)) {
+ common_data.clip.unk_090->unk_00(0x45, this->actor.world.pos, 1, this->actor.world.rot.y, game_play,
+ this->actor.fgName, 1, 0);
+ }
+ this->waterTimer++;
+ }
+ this->actor.gravity = 0.2f;
+ this->acceleration = 0.2f;
+ this->maxSpeed = 1.0f;
+}
+
+void aBALL_process_air_water_init(Ball* this, UNUSED Game_Play* game_play) {
+ this->actor.shape.drawShadow = 0;
+ this->process = aBALL_process_air_water;
+}
+
+void aBALL_process_air_water(Ball* this, Game_Play* game_play) {
+
+ aBALL_set_spd_relations_in_water(this, game_play);
+ add_calc0(&this->height, 0.5f, 100.0f);
+
+ // Perhaps a macro?
+ {
+ f32 speed = this->speed;
+ speed -= 0.5f;
+ speed = CLAMP_MIN(speed, 0.0f);
+ this->speed = speed;
+ }
+
+ if (common_data.clip.unk_0A8 != NULL) {
+ common_data.clip.unk_0A8->unk_0C(&this->actor.world.pos, 20.0f, 1);
+ }
+
+ if (this->actor.colResult.onGround) {
+ if (this->actor.colResult.inWater) {
+ aBALL_process_ground_water_init(this, game_play);
+ } else if (this->actor.colResult.unk5 != 0xB) {
+ aBALL_process_ground_init(this, game_play);
+ }
+ } else if (!this->actor.colResult.inWater) {
+ aBALL_process_air_init(this, game_play);
+ }
+}
+
+void aBALL_process_ground_water_init(Ball* this, UNUSED Game_Play* game_play) {
+ this->actor.shape.drawShadow = 0;
+ this->waterTimer = 0;
+ this->process = aBALL_process_ground_water;
+}
+
+void aBALL_process_ground_water(Ball* this, Game_Play* game_play) {
+ f32 height;
+ u32 unitAttribute;
+ xyz_t* bgPos;
+
+ unitAttribute = this->actor.colResult.unk5;
+
+ aBALL_set_spd_relations_in_water(this, game_play);
+ this->speed = this->actor.speed;
+
+ if (common_data.clip.unk_0A8 != NULL) {
+ common_data.clip.unk_0A8->unk_0C(&this->actor.world.pos, 20.0f, 1);
+ }
+ if (this->actor.colResult.onGround) {
+ if (!this->actor.colResult.inWater && (unitAttribute != 0xB) && (unitAttribute != 0x16)) {
+ aBALL_process_ground_init(this, game_play);
+ }
+ } else if (!this->actor.colResult.inWater) {
+ aBALL_process_air_init(this, game_play);
+ } else {
+ aBALL_process_air_water_init(this, game_play);
+ }
+
+ if ((unitAttribute == 0xB) || (unitAttribute == 0x16)) {
+ bgPos = &this->bgPos;
+ this->actor.world.pos.y += (0.5f * bgPos->y);
+
+ if (unitAttribute == 0x16) {
+ height = ABS(bgPos->y);
+
+ if (height < 1.0f) {
+ aBALL_process_ground_init(this, game_play);
+ }
+ }
+ }
+}
+
+void aBALL_calc_axis(Ball* this) {
+ f32 yVelocityFactor;
+ s16 angle;
+
+ angle = this->actor.speed * 869.63904f;
+ if ((this->process == aBALL_process_air_water) || (this->process == aBALL_process_ground_water)) {
+ yVelocityFactor = ((-1.0f) - this->actor.velocity.y) / (-2.0f);
+ angle *= sin_s(DEG_TO_BINANG((60.0f * yVelocityFactor) + 30.0f));
+ }
+ mRlib_Roll_Matrix_to_s_xyz(&this->actor, &this->ballRot, angle);
+}
+
+s32 aBALL_player_angle_distance_check(Ball* this, Player* player) {
+ f32 distance;
+ s16 yRot;
+
+ distance = search_position_distance(&this->actor.world.pos, &player->actor.world.pos);
+ yRot = player->actor.shape.rot.y - search_position_angleY(&player->actor.world.pos, &this->actor.world.pos);
+ if (distance < 60.0f) {
+
+ if (ABS(yRot) < 0x2000) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void aBALL_status_check(Ball* this, Game_Play* game_play) {
+ s32 i;
+
+ if (this->unk_208 & BALL_208_FLAG_4) {
+ Player* player;
+ player = get_player_actor_withoutCheck(game_play);
+ this->unk_208 &= ~BALL_208_FLAG_4;
+ if ((aBALL_player_angle_distance_check(this, player)) || (fabsf(this->actor.speed) < 0.008f)) {
+ this->actor.world.rot.y = player->actor.shape.rot.y;
+ this->actor.speed = 2.0f;
+ this->actor.velocity.y = 4.5f;
+ if (this->unk_208 & BALL_208_FLAG_2) {
+ this->collider.attribute.dim.unk_2 = 0x1E;
+ this->collider.attribute.dim.radius = 0xD;
+ this->unk_208 &= ~BALL_208_FLAG_2;
+ this->actor.colStatus.mass = 0x64;
+ }
+ }
+ }
+ if (this->unk_208 & BALL_208_FLAG_8) {
+ this->unk_208 &= ~BALL_208_FLAG_8;
+ if (!(this->unk_208 & BALL_208_FLAG_2)) {
+ Player* player;
+ player = get_player_actor_withoutCheck(game_play);
+ if ((aBALL_player_angle_distance_check(this, player)) || (fabsf(this->actor.speed) < 0.008f)) {
+ this->actor.world.rot.y = player->actor.shape.rot.y + 0x2000;
+ this->actor.speed = 4.5f;
+ this->actor.velocity.y = 3.0f;
+ }
+ }
+ }
+ if (!(this->unk_208 & BALL_208_FLAG_1)) {
+ if (this->actor.colResult.inWater) {
+ sAdo_OngenTrgStart(0x27, &this->actor.world.pos);
+ this->unk_208 |= BALL_208_FLAG_1;
+ if (common_data.clip.unk_0A8 != NULL) {
+ common_data.clip.unk_0A8->unk_0C(&this->actor.world.pos, 20.0f, 0);
+ }
+ this->collider.attribute.dim.unk_2 = 0xA;
+ common_data.clip.unk_090->unk_00(0x3A, this->actor.world.pos, 1, 0, game_play, this->actor.fgName, 1, 0);
+
+ for (i = 2; i < 6; i++) {
+ common_data.clip.unk_090->unk_00(0x3B, this->actor.world.pos, 1, this->actor.world.rot.y, game_play,
+ this->actor.fgName, 0, i | 0x3000);
+ }
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_80969FD8_jp.s")
+void aBALL_actor_move(Actor* thisx, Game_Play* game_play) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ Ball* this = THIS;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A0CC_jp.s")
+ aBALL_House_Tree_Rev_Check(this);
+ if (!((this->actor.flags) & ACTOR_FLAG_40)) {
+ if ((this->actor.colResult.inWater) || (this->unk_208 & BALL_208_FLAG_2)) {
+ Actor_delete(&this->actor);
+ }
+ if (this->actor.speed == 0.0f) {
+ return;
+ }
+ }
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A0EC_jp.s")
+ common_data.unk_10A6C = this->actor.world.pos;
+ aBALL_position_move(this);
+ this->process(this, game_play);
+ aBALL_BGcheck(this);
+ aBALL_OBJcheck(this);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A23C_jp.s")
+ CollisionCheck_Uty_ActorWorldPosSetPipeC(&this->actor, &this->collider);
+ CollisionCheck_setOC(game_play, &game_play->unk_2138, &this->collider.base);
+ aBALL_calc_axis(this);
+ aBALL_status_check(this, game_play);
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A334_jp.s")
+#define OPEN_CUSTOM_POLY_OPA() \
+ { \
+ Gfx* __polyOpa = __gfxCtx->polyOpa.p; \
+ int __opa_opened = 0; \
+ do { \
+ } while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A3D8_jp.s")
+#define CLOSE_CUSTOM_POLY_OPA() \
+ __gfxCtx->polyOpa.p = __polyOpa; \
+ (void)__opa_opened; \
+ } \
+ do { \
+ } while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/aBALL_actor_move.s")
+void aBALL_actor_draw(Actor* thisx, Game_Play* game_play) {
+ GraphicsContext* gfxCtx = game_play->state.gfxCtx;
+ Ball* this = THIS;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/aBALL_actor_draw.s")
+ OPEN_DISPS(gfxCtx);
+ OPEN_CUSTOM_POLY_OPA();
+ gSPSegment(__polyOpa++, 0x06, this->segment);
+ Matrix_translate(0.0f, this->height, 0.0f, 1);
+ Matrix_rotateXYZ(this->ballRot.x, this->ballRot.y, this->ballRot.z, MTXMODE_APPLY);
+ gDPPipeSync(__polyOpa++);
+ gSPMatrix(__polyOpa++, _Matrix_to_Mtx_new(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(__polyOpa++, ball_model_tbl[this->type]);
+ CLOSE_CUSTOM_POLY_OPA();
+ CLOSE_DISPS(gfxCtx);
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Ball/ac_ball/func_8096A86C_jp.s")
+// Original name unknown.
+void func_8096A86C_jp(void) {
+ if ((common_data.clip.unk_0D0 != NULL) && (Global_Actor_p != NULL)) {
+ func_80968AF4_jp(Global_Actor_p, Global_Actor_p->type);
+ }
+}
diff --git a/src/overlays/actors/ovl_Ball/ac_ball.h b/src/overlays/actors/ovl_Ball/ac_ball.h
index d94cd2e..4e62164 100644
--- a/src/overlays/actors/ovl_Ball/ac_ball.h
+++ b/src/overlays/actors/ovl_Ball/ac_ball.h
@@ -5,16 +5,43 @@
#include "m_actor.h"
#include "m_collision_obj.h"
#include "unk.h"
+#include "c_keyframe.h"
struct Game_Play;
struct Ball;
+#define BALL_208_FLAG_1 (1 << 0)
+#define BALL_208_FLAG_2 (1 << 1)
+#define BALL_208_FLAG_4 (1 << 2)
+#define BALL_208_FLAG_8 (1 << 3)
+
+typedef enum BallType {
+ BALL_TYPE_B,
+ BALL_TYPE_D,
+ BALL_TYPE_S,
+} BallType;
+
typedef void (*BallActionFunc)(struct Ball*, struct Game_Play*);
typedef struct Ball {
/* 0x000 */ Actor actor;
/* 0x174 */ ClObjPipe collider;
- /* 0x180 */ UNK_TYPE1 unk_180[0x8C];
-} Ball; // size = 0x20C
+ /* 0x190 */ UNK_TYPE1 unk_190[0x40];
+ /* 0x1D0 */ xyz_t bgPos;
+ /* 0x1DC */ Actor* colliderActor;
+ /* 0x1E0 */ BallActionFunc process;
+ /* 0x1E4 */ void* segment;
+ /* 0x1E8 */ f32 height;
+ /* 0x1EC */ f32 maxSpeed;
+ /* 0x1F0 */ f32 acceleration;
+ /* 0x1F4 */ f32 speed;
+ /* 0x1F8 */ s32 type;
+ /* 0x1FC */ s16 waterTimer;
+ /* 0x1FE */ UNK_TYPE1 unk_1FE[0x2];
+ /* 0x200 */ s_xyz ballRot;
+ /* 0x206 */ s16 bounceTimer;
+ /* 0x208 */ s16 unk_208;
+ /* 0x20A */ s16 unk_20A;
+} Ball; // size 0x20C
#endif
diff --git a/yamls/jp/assets.yaml b/yamls/jp/assets.yaml
index e7561a7..824a17f 100644
--- a/yamls/jp/assets.yaml
+++ b/yamls/jp/assets.yaml
@@ -5418,28 +5418,72 @@
align: 0x1000
- [0x10FF1A0]
- - name: segment_01100000
- type: bin
+ - name: act_ball_b
+ dir: objects/act_ball_b
+ type: code
start: 0x1100000
- # vram:
+ vram: 0x06000000
+ exclusive_ram_id: segment_06
compress: True
align: 0x1000
+ symbol_name_format: $VRAM_$ROM
+ subsegments:
+ - [auto, c, act_ball_b]
+ - start: 0x1100000
+ type: .data
+ name: act_ball_b
+ subsegments:
+ - [0x1100000, vtx, act_ball_b_v]
+ - [0x11001A0, af_gfx, act_ball_b_modelT]
+ - [0x11001A8, af_gfx, act_ball_b_model]
+ - [0x1100318, af_palette, act_ball_b_pal]
+ - [0x1100338, ci4, act_ball_b_1_tex, 16, 16, act_ball_b_pal]
- [0x11003C0]
- - name: segment_01101000
- type: bin
+ - name: act_ball_d
+ dir: objects/act_ball_d
+ type: code
start: 0x1101000
- # vram:
+ vram: 0x06000000
+ exclusive_ram_id: segment_06
compress: True
align: 0x1000
+ symbol_name_format: $VRAM_$ROM
+ subsegments:
+ - [auto, c, act_ball_d]
+ - start: 0x1101000
+ type: .data
+ name: act_ball_d
+ subsegments:
+ - [0x1101000, vtx, act_ball_d_v]
+ - [0x1101360, af_gfx, act_ball_d_modelT]
+ - [0x1101368, af_gfx, act_ball_d_model]
+ - [0x11015C8, af_palette, act_ball_d_pal]
+ - [0x11015E8, ci4, act_ball_d_1_tex, 16, 16, act_ball_d_pal]
+ - [0x1101668, ci4, act_ball_d_2_tex, 16, 16, act_ball_d_pal]
+ - [0x11016E8, ci4, act_ball_d_3_tex, 16, 16, act_ball_d_pal]
- [0x1101770]
- - name: segment_01102000
- type: bin
+ - name: act_ball_s
+ dir: objects/act_ball_s
+ type: code
start: 0x1102000
- # vram:
+ vram: 0x06000000
+ exclusive_ram_id: segment_06
compress: True
align: 0x1000
+ symbol_name_format: $VRAM_$ROM
+ subsegments:
+ - [auto, c, act_ball_s]
+ - start: 0x1102000
+ type: .data
+ name: act_ball_s
+ subsegments:
+ - [0x1102000, vtx, act_ball_s_v]
+ - [0x1102700, af_gfx, act_ball_s_modelT]
+ - [0x1102708, af_gfx, act_ball_s_model]
+ - [0x11028B8, af_palette, act_ball_s_pal]
+ - [0x11028D8, ci4, act_ball_s_5_tex, 16, 32, act_ball_s_pal]
- [0x11029E0]
- name: object_01103000
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index d4c2cdf..2780829 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -1723,9 +1723,9 @@
bss_size: 0x10
subsegments:
- [0x85D660, c, overlays/actors/ovl_Ball/ac_ball]
- - [0x85F500, data, overlays/actors/ovl_Ball/ac_ball]
+ - [0x85F500, .data, overlays/actors/ovl_Ball/ac_ball]
- [0x85F550, .rodata, overlays/actors/ovl_Ball/ac_ball]
- - { start: 0x85F5D0, type: bss, vram: 0x8096A980, name: overlays/actors/ovl_Ball/ac_ball }
+ - { start: 0x85F5D0, type: .bss, vram: 0x8096A980, name: overlays/actors/ovl_Ball/ac_ball }
- name: ovl_Ball_reloc
type: code
start: 0x85F5D0