summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-08-14 18:35:04 -0400
committerGitHub <noreply@github.com>2023-08-14 15:35:04 -0700
commitf19df74c6ee597f01c3d7def1fdef105d9bdef92 (patch)
tree0e9eef519791ed6612c05295a4e077f7667da199
parentbdb8ef6d5b33c24580d7861c4ccf8d937caac8fb (diff)
`m_actor.c` with 1 NON_MATCHING (#49)
* C file * drafts * Actor_info_ct and Actor_info_dt * Actor_info_make_actor draft * new_var = &argC; * func_80057940_jp * Actor_free_overlay_area, actor_free_check, Actor_get_overlay_area, func_80057940_jp, Actor_data_bank_regist_check * Shape_Info_init * Actor struct's size confirmed, Actor_malloc_actor_class and Actor_init_actor_class * func_80056380_jp, Actor_info_part_new, restore_fgdata, Actor_info_delete * Actor_info_draw_actor * Actor_data_bank_dma_end_check, Actor_draw_actor_no_culling_check, Actor_draw_actor_no_culling_check2, Actor_cull_check, Actor_delete_check, Actor_info_make_child_actor, restore_fgdata_all, Actor_info_save_actor * gSegments * Actor_world_to_eye, Actor_position_speed_set, Actor_position_moveF and func_80057B70_jp * Actor_player_look_direction_check * Actor_position_move * find m_kankyo file split * Actor_ct * fgName * projection_pos_set, Actor_display_position_set * Actor_info_call_actor * func_80057A8C_jp * import data and bss * cleanups * more cleanup * format * and even more cleanup * hilite funcs * Part_Break_init * and more cleanup * Actor_draw * fake stuff * Part_Break stuff from OoT * a * fix * fix fake symbol * fix * fix
-rw-r--r--Makefile2
-rw-r--r--include/6BA500.h54
-rw-r--r--include/6D2720.h2
-rw-r--r--include/6E9650.h17
-rw-r--r--include/6F5550.h2
-rw-r--r--include/code_variables.h16
-rw-r--r--include/fault.h2
-rw-r--r--include/game.h4
-rw-r--r--include/gfx.h4
-rw-r--r--include/libc/math.h6
-rw-r--r--include/loadfragment.h3
-rw-r--r--include/m_actor.h315
-rw-r--r--include/m_collision_bg.h3
-rw-r--r--include/m_collision_obj.h (renamed from include/69A7E0.h)19
-rw-r--r--include/m_common_data.h71
-rw-r--r--include/m_event.h2
-rw-r--r--include/m_field_info.h12
-rw-r--r--include/m_kankyo.h77
-rw-r--r--include/m_lib.h11
-rw-r--r--include/m_lights.h23
-rw-r--r--include/m_npc.h11
-rw-r--r--include/m_play.h11
-rw-r--r--include/m_player_lib.h6
-rw-r--r--include/m_scene.h14
-rw-r--r--include/m_skin_matrix.h2
-rw-r--r--include/macros.h5
-rw-r--r--include/ovlmgr.h5
-rw-r--r--include/unknown_structs.h18
-rw-r--r--include/z64math.h7
-rw-r--r--include/z_std_dma.h2
-rw-r--r--lib/ultralib/include/PR/gbi.h4
-rw-r--r--linker_scripts/jp/symbol_addrs_code.txt46
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt11
-rw-r--r--relocs/reloc_addrs.jp.txt8
-rw-r--r--src/boot/O2/loadfragment2.c6
-rw-r--r--src/boot/ovlmgr.c10
-rw-r--r--src/code/c_keyframe.c30
-rw-r--r--src/code/game.c6
-rw-r--r--src/code/m_actor.c1143
-rw-r--r--src/overlays/actors/ovl_player_actor/m_player.h13
-rw-r--r--src/overlays/gamestates/ovl_play/m_play.h45
-rw-r--r--tools/permuter_settings.toml6
-rw-r--r--yamls/jp/code.yaml16
43 files changed, 1819 insertions, 251 deletions
diff --git a/Makefile b/Makefile
index f63b900..a00ebfc 100644
--- a/Makefile
+++ b/Makefile
@@ -118,7 +118,7 @@ else
endif
# Check code syntax with host compiler
-CHECK_WARNINGS := -Wall -Wextra -Wimplicit-fallthrough -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare -Wno-uninitialized
+CHECK_WARNINGS := -Wall -Wextra -Wimplicit-fallthrough -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare -Wno-uninitialized -Wno-unused-label
# Have CC_CHECK pretend to be a MIPS compiler
MIPS_BUILTIN_DEFS := -DMIPSEB -D_MIPS_FPSET=16 -D_MIPS_ISA=2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZPTR=32
ifneq ($(RUN_CC_CHECK),0)
diff --git a/include/6BA500.h b/include/6BA500.h
index 88e1b17..e6c00ba 100644
--- a/include/6BA500.h
+++ b/include/6BA500.h
@@ -9,59 +9,5 @@
// void func_80096B4C_jp();
// void func_80096B64_jp();
// void func_80096BF0_jp();
-// void func_80096C90_jp();
-// void func_80096CA0_jp();
-// void func_80096CDC_jp();
-// void func_80096D60_jp();
-// void func_80096F5C_jp();
-// void func_80097048_jp();
-// void func_800970D4_jp();
-// void func_80097108_jp();
-// void func_800971B4_jp();
-// void func_80097510_jp();
-// void func_800976BC_jp();
-// void func_80097738_jp();
-// void func_800978EC_jp();
-// void func_80097AE8_jp();
-// void func_80097BB0_jp();
-// void func_80097C54_jp();
-// void func_80097D40_jp();
-// void func_80097F88_jp();
-// void func_80097FB4_jp();
-// void func_8009802C_jp();
-// void func_800980C0_jp();
-// void func_80098158_jp();
-// void func_800981B8_jp();
-// void func_8009836C_jp();
-// void func_800983F0_jp();
-// void func_800984CC_jp();
-// void func_80098558_jp();
-// void func_8009867C_jp();
-// void func_80098794_jp();
-// void func_8009895C_jp();
-// void func_80098980_jp();
-// void func_80098990_jp();
-// void func_80098A90_jp();
-// void func_80098B50_jp();
-// void func_80098CCC_jp();
-// void func_80098D88_jp();
-// void func_80098DE0_jp();
-// void func_80098EE4_jp();
-// void func_80098F68_jp();
-// void func_80098FF0_jp();
-// void func_800990A8_jp();
-// void func_8009915C_jp();
-// void func_800991EC_jp();
-// void func_800992C8_jp();
-// void func_80099378_jp();
-// void func_8009944C_jp();
-// void func_8009949C_jp();
-// void func_80099594_jp();
-// void func_800996CC_jp();
-// void mEnv_GetShadowPrimColor_Light();
-// void func_80099718_jp();
-// void func_80099728_jp();
-// void func_80099770_jp();
-// void func_800998AC_jp();
#endif
diff --git a/include/6D2720.h b/include/6D2720.h
index 7007c19..f271c77 100644
--- a/include/6D2720.h
+++ b/include/6D2720.h
@@ -8,7 +8,7 @@
// void func_800AEB9C_jp();
// void func_800AEBC8_jp();
// void func_800AEC74_jp();
-// void func_800AED08_jp();
+// void mNPS_schedule_manager();
// void func_800AED68_jp();
// void func_800AEDD0_jp();
// void func_800AEE38_jp();
diff --git a/include/6E9650.h b/include/6E9650.h
index df21faa..86db5f5 100644
--- a/include/6E9650.h
+++ b/include/6E9650.h
@@ -3,6 +3,9 @@
#include "ultra64.h"
+struct PlayState;
+struct PlayState_unk_0110;
+
// void func_800C59B0_jp();
// void func_800C5A08_jp();
// void func_800C5A60_jp();
@@ -17,21 +20,21 @@
// void func_800C5EA0_jp();
// void func_800C5F0C_jp();
// void func_800C5F64_jp();
-// void mSc_bank_regist_check();
-// void func_800C6144_jp();
-// void mSc_regist_initial_exchange_bank();
+s32 mSc_bank_regist_check(struct PlayState_unk_0110* arg0, s16 arg1);
+void func_800C6144_jp(struct PlayState_unk_0110* arg0, s16 arg1);
+void mSc_regist_initial_exchange_bank(struct PlayState* play);
// void func_800C62C4_jp();
// void func_800C639C_jp();
-// void func_800C65E4_jp();
-// void func_800C6678_jp();
+// void mSc_data_bank_ct();
+// void mSc_decide_exchange_bank();
// void func_800C6690_jp();
-// void func_800C68C8_jp();
+// void Scene_ct();
// void func_800C6960_jp();
// void func_800C69F4_jp();
// void func_800C6A28_jp();
// void func_800C6A5C_jp();
// void func_800C6A90_jp();
-// void func_800C6AC4_jp();
+// void Door_info_ct();
// void func_800C6AD0_jp();
// void func_800C6AE0_jp();
// void func_800C6B50_jp();
diff --git a/include/6F5550.h b/include/6F5550.h
index 4572163..8ab3fd3 100644
--- a/include/6F5550.h
+++ b/include/6F5550.h
@@ -65,7 +65,7 @@
// void func_800D2334_jp();
// void func_800D2354_jp();
// void func_800D2360_jp();
-// void func_800D236C_jp();
+// void sAdo_RoomType();
// void func_800D2394_jp();
// void func_800D23B4_jp();
// void func_800D2438_jp();
diff --git a/include/code_variables.h b/include/code_variables.h
index 7f866c7..246c9bd 100644
--- a/include/code_variables.h
+++ b/include/code_variables.h
@@ -3,6 +3,7 @@
#include "ultra64.h"
#include "unknown_structs.h"
+#include "z64math.h"
@@ -14,7 +15,6 @@
// extern UNK_TYPE D_80100C60_jp;
// extern UNK_TYPE D_80100C64_jp;
// extern UNK_TYPE D_80100C68_jp;
-// extern UNK_TYPE D_80100C70_jp;
// extern UNK_TYPE D_801025C0_jp;
// extern UNK_TYPE D_FLT_801025C8_jp;
@@ -827,7 +827,7 @@ extern vs32 D_8010EFB0_jp; // TODO: Determine where this goes
// extern UNK_TYPE D_8010F4C0_jp;
// extern UNK_TYPE D_8010FCC0_jp;
// extern UNK_TYPE D_8010FCD0_jp;
-// extern UNK_TYPE MtxF_clear;
+extern MtxF MtxF_clear;
// extern UNK_TYPE D_8010FD50_jp;
// extern UNK_TYPE D_8010FD54_jp;
// extern UNK_TYPE D_8010FD58_jp;
@@ -1724,7 +1724,6 @@ extern s32 zurumode_flag;
// extern UNK_TYPE B_8011B830_jp;
// extern UNK_TYPE B_8011B83C_jp;
-// extern UNK_TYPE B_8011B850_jp;
// extern UNK_TYPE B_8011B8B0_jp;
// extern UNK_TYPE B_8011B8B4_jp;
@@ -1828,8 +1827,6 @@ extern s32 zurumode_flag;
// extern UNK_TYPE B_80126E74_jp;
// extern UNK_TYPE B_80126E9C_jp;
-// extern UNK_TYPE common_data;
-
// extern UNK_TYPE B_80137960_jp;
// extern UNK_TYPE B_80137C40_jp;
// extern UNK_TYPE B_80137C48_jp;
@@ -2010,12 +2007,9 @@ extern s32 zurumode_flag;
// extern UNK_TYPE B_80145880_jp;
// extern UNK_TYPE B_80145898_jp;
// extern UNK_TYPE B_8014589C_jp;
-// extern UNK_TYPE B_801458A0_jp;
-// extern UNK_TYPE B_801458B0_jp;
-// extern UNK_TYPE B_801458B8_jp;
-// extern UNK_TYPE B_801458E0_jp;
-// extern UNK_TYPE B_801458EC_jp;
-// extern UNK_TYPE B_801458F0_jp;
+
+extern uintptr_t gSegments[NUM_SEGMENTS];
+
// extern UNK_TYPE B_80145D70_jp;
// extern UNK_TYPE B_80145D80_jp;
// extern UNK_TYPE B_80145DB8_jp;
diff --git a/include/fault.h b/include/fault.h
index b11f03c..b24f732 100644
--- a/include/fault.h
+++ b/include/fault.h
@@ -78,7 +78,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2);
// void FaultDrawer_SetBackColor();
void FaultDrawer_SetFontColor(u16 color);
void FaultDrawer_SetCharPad(s8 padW, s8 padH);
-// void FaultDrawer_SetCursor();
+void FaultDrawer_SetCursor(s32 arg0, s32 arg1);
// void FaultDrawer_FillScreen();
// void FaultDrawer_PrintCallback();
// void FaultDrawer_VPrintf();
diff --git a/include/game.h b/include/game.h
index 4ffa403..46edae3 100644
--- a/include/game.h
+++ b/include/game.h
@@ -53,7 +53,9 @@ typedef struct GameState {
/* 0x74 */ s32 unk_74;
/* 0x78 */ TwoHeadArena heap;
/* 0x88 */ GameAlloc alloc;
- /* 0x9C */ UNK_TYPE1 unk_9C[0x3];
+ /* 0x9C */ u8 unk_9C;
+ /* 0x9D */ u8 unk_9D;
+ /* 0x9E */ UNK_TYPE1 unk_9E[0x1];
/* 0x9F */ u8 running;
/* 0xA0 */ s32 unk_A0;
/* 0xA4 */ UNK_TYPE1 unk_A4[0x4];
diff --git a/include/gfx.h b/include/gfx.h
index 3d693fe..bda4a82 100644
--- a/include/gfx.h
+++ b/include/gfx.h
@@ -20,7 +20,7 @@ typedef struct GraphicsContext {
/* 0x2A0 */ TwoHeadGfxArena polyXlu;
/* 0x2B0 */ TwoHeadGfxArena unk_2B0;
/* 0x2C0 */ TwoHeadGfxArena unk_2C0;
- /* 0x2D0 */ TwoHeadGfxArena unk_2D0;
+ /* 0x2D0 */ TwoHeadGfxArena light;
/* 0x2E0 */ UNK_TYPE1 unk_2E0[0x4];
/* 0x2E4 */ s32 unk_2E4;
/* 0x2E8 */ UNK_TYPE1 unk_2E8[0x4];
@@ -39,7 +39,7 @@ typedef struct GraphicsContext {
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
#define UNK_2B0_DISP __gfxCtx->unk_2B0.p
#define UNK_2C0_DISP __gfxCtx->unk_2C0.p
-#define UNK_2D0_DISP __gfxCtx->unk_2D0.p
+#define LIGHT_DISP __gfxCtx->light.p
// __gfxCtx shouldn't be used directly.
// Use the DISP macros defined above when writing to display buffers.
diff --git a/include/libc/math.h b/include/libc/math.h
index 3258a1c..0098d3a 100644
--- a/include/libc/math.h
+++ b/include/libc/math.h
@@ -1,7 +1,11 @@
#ifndef MATH_H
#define MATH_H
-#include "PR/ultratypes.h"
+#define M_SQRT2 1.41421356237309504880f
+#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
+#define FLT_MAX 340282346638528859811704183484516925440.0f
+#define SHT_MAX 32767.0f
+#define SHT_MINV (1.0f / SHT_MAX)
float fabsf(float f);
#pragma intrinsic(fabsf)
diff --git a/include/loadfragment.h b/include/loadfragment.h
index 37a747c..487f042 100644
--- a/include/loadfragment.h
+++ b/include/loadfragment.h
@@ -2,6 +2,7 @@
#define LOADFRAGMENT_H
#include "ultra64.h"
+#include "other_types.h"
extern s32 gOverlayLogSeverity;
@@ -33,6 +34,6 @@ typedef struct OverlayRelocationSection {
/* 0x14 */ u32 relocations[1]; // size is nRelocations
} OverlayRelocationSection; // size >= 0x18
-s32 Overlay_Load(void *vromStart, void *vromEnd, void *ovlStart, void *ovlEnd, void *vramStart, void *vramEnd, void *allocatedRamAddr, OverlayRelocationSection *ovlRelocs);
+s32 Overlay_Load(RomOffset vromStart, RomOffset vromEnd, void *ovlStart, void *ovlEnd, void *vramStart, void *vramEnd, void *allocatedRamAddr, OverlayRelocationSection *ovlRelocs);
#endif
diff --git a/include/m_actor.h b/include/m_actor.h
index 6f53ec2..2bcf1a6 100644
--- a/include/m_actor.h
+++ b/include/m_actor.h
@@ -2,63 +2,270 @@
#define M_ACTOR_H
#include "ultra64.h"
+#include "m_collision_obj.h"
+#include "z64math.h"
+#include "unk.h"
+
+struct Actor;
+struct PlayState;
+struct ActorEntry;
+struct ActorOverlay;
+struct struct_801161E8_jp;
+struct Lights;
+struct GraphicsContext;
typedef enum AllocType {
- /* 0 */ ALLOCTYPE_NORMAL
+ /* 0 */ ALLOCTYPE_NORMAL,
+ /* 1 */ ALLOCTYPE_ABSOLUTE,
+ /* 2 */ ALLOCTYPE_PERMANENT
} AllocType;
-// void func_80056380_jp();
-// void projection_pos_set();
-// void Actor_world_to_eye();
-// void Actor_position_move();
-// void Actor_position_speed_set();
-// void Actor_position_moveF();
-// void Actor_player_look_direction_check();
-// void Actor_display_position_set();
-// void Actor_data_bank_dma_end_check();
-// void Shape_Info_init();
-// void Actor_foot_shadow_pos_set();
-// void Actor_delete();
-// void Actor_ct();
-// void Actor_dt();
-// void Actor_draw();
-// void Actor_draw_actor_no_culling_check();
-// void Actor_draw_actor_no_culling_check2();
-// void Actor_cull_check();
-// void Actor_delete_check();
-// void Actor_info_ct();
-// void Actor_info_dt();
-// void Actor_info_call_actor();
-// void Actor_info_draw_actor();
-// void Actor_info_part_new();
-// void Actor_info_part_delete();
-// void Actor_free_overlay_area();
-// void actor_free_check();
-// void Actor_get_overlay_area();
-// void func_80057940_jp();
-// void func_80057A8C_jp();
-// void func_80057B70_jp();
-// void Actor_data_bank_regist_check();
-// void Actor_malloc_actor_class();
-// void Actor_init_actor_class();
-// void Actor_info_make_actor();
-// void Actor_info_make_child_actor();
-// void restore_fgdata();
-// void restore_fgdata_one();
-// void restore_fgdata_all();
-// void Actor_info_save_actor();
-// void Actor_info_delete();
-// void Actor_info_name_search_sub();
-// void Actor_info_name_search();
-// void Actor_info_fgName_search_sub();
-// void Actor_info_fgName_search();
-// void Part_Break_init();
-// void HiliteReflect_new();
-// void HiliteReflect_init();
-// void HiliteReflect_xlu_init();
-// void HiliteReflect_light_init();
-// void Setpos_HiliteReflect_init();
-// void Setpos_HiliteReflect_xlu_init();
-// void Setpos_HiliteReflect_light_init();
+typedef enum ActorPart {
+ /* 0 */ ACTOR_PART_0,
+ /* 1 */ ACTOR_PART_1,
+ /* 2 */ ACTOR_PART_PLAYER,
+ /* 3 */ ACTOR_PART_NPC,
+ /* 4 */ ACTOR_PART_4,
+ /* 5 */ ACTOR_PART_5,
+ /* 6 */ ACTOR_PART_6,
+ /* 7 */ ACTOR_PART_7,
+ /* 8 */ ACTOR_PART_MAX
+} ActorPart;
+
+typedef enum ActorFootIndex {
+ /* 0 */ FOOT_LEFT,
+ /* 1 */ FOOT_RIGHT,
+ /* 2 */ FOOT_MAX
+} ActorFootIndex;
+
+// TODO: figure out if those values make sense as an enum or if they should be changed to defines
+typedef enum FgNameF000 {
+ /* 0x0 */ FGNAME_F000_0 = 0x0,
+ /* 0x5 */ FGNAME_F000_5 = 0x5,
+ /* 0x8 */ FGNAME_F000_8 = 0x8,
+ /* 0xD */ FGNAME_F000_D = 0xD,
+ /* 0xE */ FGNAME_F000_E
+} FgNameF000;
+
+typedef void (*ActorFunc)(struct Actor* this, struct PlayState* play);
+
+// a.k.a. ActorInit
+typedef struct ActorProfile {
+ /* 0x00 */ s16 name;
+ /* 0x02 */ u8 part;
+ /* 0x04 */ u32 flags;
+ /* 0x08 */ s16 unk_08;
+ /* 0x0A */ s16 objectId;
+ /* 0x0C */ size_t instanceSize;
+ /* 0x10 */ ActorFunc ct;
+ /* 0x14 */ ActorFunc dt;
+ /* 0x18 */ ActorFunc update;
+ /* 0x1C */ ActorFunc draw;
+ /* 0x20 */ ActorFunc save;
+} ActorProfile; // size = 0x24
+
+typedef struct PosRot {
+ /* 0x00 */ Vec3f pos;
+ /* 0x0C */ Vec3s rot;
+} PosRot; // size = 0x14
+
+typedef void (*Shape_Info_unk_0C)(struct Actor*, struct Lights*, struct PlayState*);
+
+typedef struct Shape_Info {
+ /* 0x00 */ Vec3s rot;
+ /* 0x08 */ f32 unk_08;
+ /* 0x0C */ Shape_Info_unk_0C unk_0C;
+ /* 0x10 */ f32 unk_10;
+ /* 0x14 */ f32 unk_14;
+ /* 0x18 */ f32 unk_18;
+ /* 0x1C */ f32 unk_1C;
+ /* 0x20 */ s32 unk_20;
+ /* 0x24 */ Vec3f* unk_24; // maybe PosRot*
+ /* 0x28 */ s32 unk_28;
+ /* 0x2C */ s8 unk_2C;
+ /* 0x2D */ s8 unk_2D;
+ /* 0x2E */ s8 unk_2E;
+ /* 0x2F */ UNK_TYPE1 unk_2F[0x1];
+ /* 0x30 */ Vec3f feetPos[FOOT_MAX];
+} Shape_Info; // size = 0x48
+
+typedef struct Actor {
+ /* 0x000 */ s16 name; // id
+ /* 0x002 */ u8 part; // category
+ /* 0x003 */ u8 unk_003; // If set to 1 then fgdata will be restored independently of the actor's part
+ /* 0x004 */ u16 unk_004;
+ /* 0x006 */ u16 fgName;
+ /* 0x008 */ s8 unk_008;
+ /* 0x008 */ s8 unk_009;
+ /* 0x008 */ s16 unk_00A;
+ /* 0x00C */ PosRot home;
+ /* 0x020 */ u32 flags;
+ /* 0x024 */ s16 params;
+ /* 0x026 */ s16 unk_026; // objBankIndex
+ /* 0x028 */ PosRot world;
+ /* 0x03C */ Vec3f prevPos;
+ /* 0x048 */ PosRot eye; // focus
+ /* 0x05C */ Vec3f scale;
+ /* 0x068 */ Vec3f velocity;
+ /* 0x074 */ f32 speed;
+ /* 0x078 */ f32 gravity;
+ /* 0x07C */ f32 terminalVelocity;
+ /* 0x080 */ UNK_TYPE1 unk_080[0x34];
+ /* 0x0B4 */ UNK_TYPE1 unk_0B4[0x1];
+ /* 0x0B5 */ u8 isDrawn;
+ /* 0x0B6 */ s16 yawTowardsPlayer;
+ /* 0x0B8 */ f32 xyzDistToPlayerSq;
+ /* 0x0BC */ f32 xzDistToPlayer;
+ /* 0x0C0 */ f32 playerHeightRel;
+ /* 0x0C4 */ CollisionCheck_Status colStatus; // made-up name
+ /* 0x0DC */ Shape_Info shape;
+ /* 0x124 */ Vec3f projectedPos;
+ /* 0x130 */ f32 projectedW;
+ /* 0x134 */ f32 uncullZoneScale;
+ /* 0x138 */ f32 uncullZoneDownward;
+ /* 0x13C */ f32 unk_13C;
+ /* 0x140 */ f32 unk_140;
+ /* 0x144 */ f32 unk_144;
+ /* 0x148 */ u8 unk_148;
+ /* 0x149 */ u8 unk_149;
+ /* 0x14A */ UNK_TYPE1 unk_14A[0x2];
+ /* 0x14C */ struct Actor* parent;
+ /* 0x150 */ struct Actor* child;
+ /* 0x154 */ struct Actor* prev;
+ /* 0x158 */ struct Actor* next;
+ /* 0x15C */ ActorFunc ct;
+ /* 0x160 */ ActorFunc dt;
+ /* 0x164 */ ActorFunc update;
+ /* 0x168 */ ActorFunc draw;
+ /* 0x16C */ ActorFunc save;
+ /* 0x170 */ struct ActorOverlay* overlayEntry;
+} Actor; // size = 0x174
+
+// Guessed from OoT's BodyBreak
+typedef struct Part_Break {
+ /* 0x00 */ MtxF* matrices;
+ /* 0x04 */ s16* objectIds;
+ /* 0x08 */ s16 count;
+ /* 0x0C */ Gfx** dLists;
+ /* 0x10 */ s32 val;
+ /* 0x14 */ s32 prevLimbIndex;
+} Part_Break; // size = 0x18
+
+typedef struct ActorListEntry {
+ /* 0x0 */ s32 unk_0;
+ /* 0x4 */ Actor* head;
+} ActorListEntry; // size = 0x8
+
+// a.k.a. ActorContext
+typedef struct ActorInfo {
+ /* 0x00 */ s32 unk_00;
+ /* 0x00 */ ActorListEntry actorLists[ACTOR_PART_MAX];
+} ActorInfo; // size = 0x44
+
+//
+#define ACTOR_FLAG_1 (1 << 0)
+//
+#define ACTOR_FLAG_2 (1 << 1)
+//
+#define ACTOR_FLAG_4 (1 << 2)
+//
+#define ACTOR_FLAG_8 (1 << 3)
+//
+#define ACTOR_FLAG_10 (1 << 4)
+//
+#define ACTOR_FLAG_20 (1 << 5)
+//
+#define ACTOR_FLAG_40 (1 << 6)
+//
+#define ACTOR_FLAG_80 (1 << 7)
+//
+#define ACTOR_FLAG_100 (1 << 8)
+//
+#define ACTOR_FLAG_200 (1 << 9)
+//
+#define ACTOR_FLAG_400 (1 << 10)
+//
+#define ACTOR_FLAG_800 (1 << 11)
+//
+#define ACTOR_FLAG_1000 (1 << 12)
+//
+#define ACTOR_FLAG_2000 (1 << 13)
+//
+#define ACTOR_FLAG_4000 (1 << 14)
+//
+#define ACTOR_FLAG_8000 (1 << 15)
+//
+#define ACTOR_FLAG_10000 (1 << 16)
+//
+#define ACTOR_FLAG_20000 (1 << 17)
+//
+#define ACTOR_FLAG_40000 (1 << 18)
+//
+#define ACTOR_FLAG_80000 (1 << 19)
+//
+#define ACTOR_FLAG_100000 (1 << 20)
+//
+#define ACTOR_FLAG_200000 (1 << 21)
+//
+#define ACTOR_FLAG_400000 (1 << 22)
+//
+#define ACTOR_FLAG_800000 (1 << 23)
+//
+#define ACTOR_FLAG_1000000 (1 << 24)
+//
+#define ACTOR_FLAG_2000000 (1 << 25)
+//
+#define ACTOR_FLAG_4000000 (1 << 26)
+//
+#define ACTOR_FLAG_8000000 (1 << 27)
+//
+#define ACTOR_FLAG_10000000 (1 << 28)
+//
+#define ACTOR_FLAG_20000000 (1 << 29)
+//
+#define ACTOR_FLAG_40000000 (1 << 30)
+//
+#define ACTOR_FLAG_80000000 (1 << 31)
+
+#define ACTOR_FGNAME_GET_F000(fgName) (((fgName) & 0xF000) >> 12)
+
+void projection_pos_set(struct PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW);
+void Actor_world_to_eye(Actor* actor, f32 arg1);
+void Actor_position_move(Actor* actor);
+void Actor_position_speed_set(Actor* actor);
+void Actor_position_moveF(Actor* actor);
+s32 Actor_player_look_direction_check(Actor* actor, s16 maxAngleDiff, struct PlayState* play);
+void Actor_display_position_set(struct PlayState* play, Actor* actor, s16* x, s16* y);
+void Shape_Info_init(Actor* actor, f32 arg1, Shape_Info_unk_0C arg2, f32 arg3, f32 arg4);
+void Actor_foot_shadow_pos_set(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos);
+void Actor_delete(Actor* actor);
+s32 Actor_draw_actor_no_culling_check(Actor* actor);
+s32 Actor_draw_actor_no_culling_check2(Actor* actor, Vec3f* arg1, f32 arg2);
+void Actor_cull_check(Actor* actor);
+void Actor_delete_check(Actor* actor, struct PlayState* play);
+void Actor_info_ct(struct PlayState* play2, ActorInfo* actorInfo, struct ActorEntry* actorEntry);
+void Actor_info_dt(ActorInfo* actorInfo, struct PlayState* play);
+void Actor_info_call_actor(struct PlayState* play, ActorInfo* actorInfo);
+void Actor_info_draw_actor(struct PlayState* play, ActorInfo* actorInfo);
+void Actor_free_overlay_area(struct ActorOverlay* overlayEntry);
+void Actor_get_overlay_area(struct ActorOverlay* overlayEntry, const struct struct_801161E8_jp* arg1, size_t overlaySize);
+void Actor_init_actor_class(Actor* actor, ActorProfile* profile, struct ActorOverlay* overlayEntry, struct PlayState* play, s32 arg4, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 argB, s8 argC, s16 argD, u16 fgName, s16 params);
+Actor* Actor_info_make_actor(ActorInfo* actorInfo, struct PlayState* play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 arg9, s8 argA, s16 argB, u16 fgName, s16 params, s8 argE, s32 argF);
+Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, struct PlayState* play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s16 argA, u16 fgName, s16 params, s32 argD);
+void restore_fgdata(Actor* actor, struct PlayState* play);
+void restore_fgdata_one(Actor* actor, struct PlayState* play);
+void restore_fgdata_all(struct PlayState* play);
+void Actor_info_save_actor(struct PlayState* play);
+Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, struct PlayState* play);
+Actor* Actor_info_name_search(ActorInfo* actorInfo, s16 name, ActorPart part);
+Actor* Actor_info_fgName_search(ActorInfo* actorInfo, u16 fgName, ActorPart part);
+void Part_Break_init(Part_Break* partBreak, s32 count, UNK_TYPE arg2);
+Gfx* HiliteReflect_new(Vec3f* object, Vec3f* eye, Vec3f* lightDir, struct GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite);
+Hilite* HiliteReflect_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, struct GraphicsContext* gfxCtx);
+Hilite* HiliteReflect_xlu_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, struct GraphicsContext* gfxCtx);
+Hilite* HiliteReflect_light_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, struct GraphicsContext* gfxCtx);
+Hilite* Setpos_HiliteReflect_init(Vec3f* object, struct PlayState* play);
+Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, struct PlayState* play);
+Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, struct PlayState* play);
#endif
diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h
index 79aed29..d7bdf4d 100644
--- a/include/m_collision_bg.h
+++ b/include/m_collision_bg.h
@@ -2,6 +2,7 @@
#define M_COLLISION_BG_H
#include "ultra64.h"
+#include "z64math.h"
// void func_80067430_jp();
// void func_800674B0_jp();
@@ -169,7 +170,7 @@
// void func_80071884_jp();
// void func_80071A08_jp();
// void func_80071AB8_jp();
-// void mCoBG_GetBgY_OnlyCenter_FromWpos2();
+f32 mCoBG_GetBgY_OnlyCenter_FromWpos2(Vec3f arg0, f32 arg1);
// void func_80071C1C_jp();
// void func_80071DB4_jp();
// void func_800721C8_jp();
diff --git a/include/69A7E0.h b/include/m_collision_obj.h
index f3041cf..e4335e2 100644
--- a/include/69A7E0.h
+++ b/include/m_collision_obj.h
@@ -1,7 +1,16 @@
-#ifndef C_69A7E0_H
-#define C_69A7E0_H
+#ifndef M_COLLISION_OBJ_H
+#define M_COLLISION_OBJ_H
#include "ultra64.h"
+#include "z64math.h"
+#include "unk.h"
+
+
+typedef struct CollisionCheck_Status {
+ /* 0x00 */ Vec3f displacement;
+ /* 0x0C */ UNK_TYPE1 unk_0C[0xC];
+} CollisionCheck_Status; // size >= 0x18
+
// void func_80076B40_jp();
// void func_80076BA4_jp();
@@ -62,9 +71,9 @@
// void func_8007872C_jp();
// void func_80078748_jp();
// void func_800787E8_jp();
-// void CollisionCheck_Status_ct();
-// void CollisionCheck_Status_Clear();
-// void func_80078948_jp();
+void CollisionCheck_Status_ct(CollisionCheck_Status* status);
+void CollisionCheck_Status_Clear(CollisionCheck_Status* status);
+// void CollisionCheck_Status_set3();
// void CollisionCheck_Uty_ActorWorldPosSetPipeC();
// void func_800789BC_jp();
diff --git a/include/m_common_data.h b/include/m_common_data.h
index 1c74775..719f850 100644
--- a/include/m_common_data.h
+++ b/include/m_common_data.h
@@ -2,19 +2,78 @@
#define M_COMMON_DATA_H
#include "ultra64.h"
+#include "unk.h"
+
+struct Actor;
+struct ActorOverlay;
+struct struct_801161E8_jp;
+struct PlayState_unk_0110;
+struct CommonData_unk_1004C_unk_14_arg0;
+
+
+typedef UNK_RET (*CommonData_unk_1004C_unk_04)(struct ActorOverlay*, const struct struct_801161E8_jp*, size_t, s32);
+typedef UNK_RET (*CommonData_unk_1004C_unk_08)(void);
+
+// TODO: figure out if this is a generic memory allocation or if it is Actor specific
+typedef UNK_PTR (*CommonData_unk_1004C_unk_0C)(size_t, const struct struct_801161E8_jp*, s32);
+
+typedef UNK_RET (*CommonData_unk_1004C_unk_10)(struct Actor*);
+typedef UNK_RET (*CommonData_unk_1004C_unk_14)(struct CommonData_unk_1004C_unk_14_arg0*, u16);
+
+typedef UNK_RET (*CommonData_unk_1004C_unk_EC)(struct PlayState_unk_0110*, s16, s16);
+typedef UNK_RET (*CommonData_unk_1004C_unk_F0)(struct PlayState_unk_0110*, struct Actor*);
+typedef s32 (*CommonData_unk_1004C_unk_F4)(struct PlayState_unk_0110*, struct Actor*);
+
+typedef struct CommonData_unk_1004C {
+ /* 0x00 */ UNK_TYPE1 unk_00[0x4];
+ /* 0x04 */ CommonData_unk_1004C_unk_04 unk_04;
+ /* 0x08 */ CommonData_unk_1004C_unk_08 unk_08;
+ /* 0x0C */ CommonData_unk_1004C_unk_0C unk_0C;
+ /* 0x10 */ CommonData_unk_1004C_unk_10 unk_10;
+ /* 0x14 */ CommonData_unk_1004C_unk_14 unk_14;
+ /* 0x18 */ UNK_TYPE1 unk_18[0xD4];
+ /* 0xEC */ CommonData_unk_1004C_unk_EC unk_EC;
+ /* 0xF0 */ CommonData_unk_1004C_unk_F0 unk_F0;
+ /* 0xF4 */ CommonData_unk_1004C_unk_F4 unk_F4;
+} CommonData_unk_1004C; // size >= 0xF8
+
+typedef UNK_RET (*CommonData_unk_10098_unk_4)(struct ActorOverlay*, size_t);
+typedef UNK_RET (*CommonData_unk_10098_unk_8)(void);
+
+// TODO: figure out if this is a generic memory allocation or if it is Actor specific
+typedef UNK_PTR (*CommonData_unk_10098_unk_0C)(void);
+
+typedef UNK_RET (*CommonData_unk_10098_unk_10)(struct Actor*);
+
+typedef struct CommonData_unk_10098 {
+ /* 0x00 */ UNK_TYPE1 unk_00[0x4];
+ /* 0x04 */ CommonData_unk_10098_unk_4 unk_4;
+ /* 0x08 */ CommonData_unk_10098_unk_8 unk_08;
+ /* 0x0C */ CommonData_unk_10098_unk_0C unk_0C;
+ /* 0x10 */ CommonData_unk_10098_unk_10 unk_10;
+} CommonData_unk_10098; // size >= 0x10
+
typedef struct CommonData {
- /* 0x00000 */ u8 unk_00000[0x10000];
+ /* 0x00000 */ UNK_TYPE1 unk_00000[0x10000];
/* 0x10000 */ u8 unk_10000; // named "game_started" in AC GCN decomp
- /* 0x10001 */ u8 unk_10001[0x3];
+ /* 0x10001 */ UNK_TYPE1 unk_10001[0x3];
/* 0x10004 */ s32 unk_10004; // named "last_scene_no" in AC GCN decomp
- /* 0x10008 */ u8 unk_10008[0x143];
+ /* 0x10008 */ UNK_TYPE1 unk_10008[0x44];
+ /* 0x1004C */ CommonData_unk_1004C *unk_1004C;
+ /* 0x10050 */ UNK_TYPE1 unk_10050[0x48];
+ /* 0x10098 */ CommonData_unk_10098 *unk_10098;
+ /* 0x1009C */ UNK_TYPE1 unk_1009C[0xAC];
+ /* 0x10148 */ UNK_TYPE1 unk_10148[0x3];
/* 0x1014B */ u8 unk_1014B; // named "wipeType" in AC GCN decomp
- /* 0x1014C */ u8 unk_1014C[0x66A];
+ /* 0x1014C */ UNK_TYPE1 unk_1014C[0x2];
+ /* 0x1014E */ s16 unk_1014E;
+ /* 0x10150 */ UNK_TYPE1 unk_10150[0x664];
+ /* 0x107B4 */ UNK_TYPE1 unk_107B4[0x2];
/* 0x107B6 */ s16 unk_107B6; // named "demo_profile" in AC GCN decomp (though it's an array of two s16s in that game)
- /* 0x107B8 */ u8 unk_107B8[0x2F8];
+ /* 0x107B8 */ UNK_TYPE1 unk_107B8[0x2F8];
/* 0x10AB0 */ u8 unk_10AB0; // named "pad_connected" in AC GCN decomp
- /* 0x10AB1 */ u8 unk_10AB1[0x7];
+ /* 0x10AB1 */ UNK_TYPE1 unk_10AB1[0x7];
} CommonData; // size = 0x10AB8
void common_data_reinit(void);
diff --git a/include/m_event.h b/include/m_event.h
index 03a59a1..78de237 100644
--- a/include/m_event.h
+++ b/include/m_event.h
@@ -31,7 +31,7 @@
// void func_8007D59C_jp();
// void func_8007D5D4_jp();
// void func_8007D650_jp();
-// void mEv_CheckFirstJob();
+s32 mEv_CheckFirstJob(void);
// void func_8007D734_jp();
// void func_8007D784_jp();
// void func_8007D7BC_jp();
diff --git a/include/m_field_info.h b/include/m_field_info.h
index a007926..bae4419 100644
--- a/include/m_field_info.h
+++ b/include/m_field_info.h
@@ -2,8 +2,10 @@
#define M_FIELD_INFO_H
#include "ultra64.h"
+#include "z64math.h"
struct CommonData;
+struct PlayState;
// void func_80087C30_jp();
// void func_80087C40_jp();
@@ -92,7 +94,7 @@ struct CommonData;
// void func_8008A74C_jp();
// void func_8008A81C_jp();
// void func_8008A960_jp();
-// void mFI_SetFG_common();
+UNK_TYPE mFI_SetFG_common(u16 fgName, Vec3f arg1, s32 arg2);
// void func_8008AA98_jp();
// void func_8008AB14_jp();
// void func_8008AC74_jp();
@@ -109,8 +111,8 @@ struct CommonData;
// void func_8008B2D0_jp();
// void func_8008B300_jp();
// void func_8008B318_jp();
-// void mFI_SetBearActor();
-// void func_8008B3E8_jp();
+void mFI_SetBearActor(struct PlayState* play, Vec3f arg1, s32 arg2);
+s32 func_8008B3E8_jp(Vec3f* arg0, UNK_TYPE arg1);
// void func_8008B4C0_jp();
// void func_8008B598_jp();
// void func_8008B66C_jp();
@@ -187,7 +189,7 @@ struct CommonData;
// void func_8008DF04_jp();
// void func_8008E058_jp();
// void func_8008E514_jp();
-// void func_8008E5F4_jp();
+void func_8008E5F4_jp(Vec3f arg0);
// void mFI_PrintNowBGNum();
// void mFI_PrintFgAttr();
// void func_8008E8E0_jp();
@@ -205,7 +207,7 @@ struct CommonData;
// void func_8008EEE8_jp();
// void func_8008EF0C_jp();
// void mFRm_CheckSaveData();
-void mFRm_ClearSaveCheckData(CommonData* common_data);
+void mFRm_ClearSaveCheckData(struct CommonData* common_data);
// void func_8008EFDC_jp();
// void func_8008F020_jp();
// void func_8008F040_jp();
diff --git a/include/m_kankyo.h b/include/m_kankyo.h
new file mode 100644
index 0000000..490796e
--- /dev/null
+++ b/include/m_kankyo.h
@@ -0,0 +1,77 @@
+#ifndef M_KANKYO_H
+#define M_KANKYO_H
+
+#include "ultra64.h"
+#include "unk.h"
+
+struct Actor;
+
+typedef void (*Kankyo_unk_C0)(struct Actor*);
+
+typedef struct Kankyo {
+ /* 0x00 */ UNK_TYPE1 unk_00[0x2];
+ /* 0x02 */ s8 unk_02;
+ /* 0x03 */ s8 unk_03;
+ /* 0x04 */ s8 unk_04;
+ /* 0x05 */ UNK_TYPE1 unk_05[0x3];
+ /* 0x08 */ UNK_TYPE1 unk_08[0xB8];
+ /* 0xC0 */ Kankyo_unk_C0 unk_C0;
+ /* 0xC4 */ UNK_TYPE1 unk_C4[0x4];
+} Kankyo; // size = 0xC8
+
+// void mEnv_regist_nature();
+// void func_80096CA0_jp();
+// void func_80096CDC_jp();
+// void func_80096D60_jp();
+// void func_80096F5C_jp();
+// void func_80097048_jp();
+// void mEnv_RoomTypeLightSet();
+// void Global_kankyo_ct();
+// void mEnv_MakeShadowInfo();
+// void mEnv_set_time();
+// void func_800976BC_jp();
+// void func_80097738_jp();
+// void func_800978EC_jp();
+// void func_80097AE8_jp();
+// void func_80097BB0_jp();
+// void func_80097C54_jp();
+// void func_80097D40_jp();
+// void func_80097F88_jp();
+// void func_80097FB4_jp();
+// void func_8009802C_jp();
+// void func_800980C0_jp();
+// void func_80098158_jp();
+// void func_800981B8_jp();
+// void func_8009836C_jp();
+// void func_800983F0_jp();
+// void func_800984CC_jp();
+// void func_80098558_jp();
+// void func_8009867C_jp();
+// void func_80098794_jp();
+// void func_8009895C_jp();
+// void func_80098980_jp();
+// void func_80098990_jp();
+// void func_80098A90_jp();
+// void func_80098B50_jp();
+// void func_80098CCC_jp();
+// void func_80098D88_jp();
+// void func_80098DE0_jp();
+// void mEnv_NowWeather();
+// void func_80098F68_jp();
+// void func_80098FF0_jp();
+// void func_800990A8_jp();
+// void func_8009915C_jp();
+// void func_800991EC_jp();
+// void func_800992C8_jp();
+// void func_80099378_jp();
+// void func_8009944C_jp();
+// void func_8009949C_jp();
+// void func_80099594_jp();
+// void func_800996CC_jp();
+// void mEnv_GetShadowPrimColor_Light();
+// void func_80099718_jp();
+// void func_80099728_jp();
+// void mEnv_MakeWindowLightAlpha();
+// void func_800998AC_jp();
+
+#endif
diff --git a/include/m_lib.h b/include/m_lib.h
index 4cc2b2f..3747eca 100644
--- a/include/m_lib.h
+++ b/include/m_lib.h
@@ -2,15 +2,16 @@
#define M_LIB_H
#include "ultra64.h"
+#include "z64math.h"
// void mem_copy();
-// void mem_clear();
+s32 mem_clear(void* ptr, size_t size, u8 value);
// void mem_cmp();
f32 cos_s(s16 angle);
f32 sin_s(s16 angle);
// void chase_angle();
// void chase_s();
-// void chase_f();
+s32 chase_f(f32* arg0, f32 arg1, f32 arg2);
// void chase_angle2();
// void chase_s2();
// void chase_s3();
@@ -20,7 +21,7 @@ f32 sin_s(s16 angle);
// void stick_ratio_set();
// void get_random_timer();
// void get_random_pattern_timer();
-// void xyz_t_move();
+void xyz_t_move(Vec3f* dst, Vec3f* src);
// void xyz_t_move_s_xyz();
// void xyz_t_add();
// void xyz_t_sub();
@@ -28,9 +29,9 @@ f32 sin_s(s16 angle);
// void xyz_t_mult_v();
// void search_position_distance();
// void search_position_distance2();
-// void search_position_distanceXZ();
+f32 search_position_distanceXZ(Vec3f* arg0, Vec3f* arg1);
// void search_position_high();
-// void search_position_angleY();
+s16 search_position_angleY(Vec3f* arg0, Vec3f* arg1);
// void search_position_angleX();
// void ValueSet_process();
// void ValueSet__s_char();
diff --git a/include/m_lights.h b/include/m_lights.h
index edee343..4b71bfa 100644
--- a/include/m_lights.h
+++ b/include/m_lights.h
@@ -2,6 +2,19 @@
#define M_LIGHTS_H
#include "ultra64.h"
+#include "z64math.h"
+#include "unk.h"
+
+struct GraphicsContext;
+struct PlayState;
+
+typedef struct Lights {
+ /* 0x00 */ UNK_TYPE1 unk_00[0x80];
+} Lights; // size = 0x80
+
+typedef struct LightContext {
+ /* 0x0 */ UNK_TYPE4 unk_0;
+} LightContext; // size >= 0x4
// void func_8009B1E0_jp();
// void func_8009B23C_jp();
@@ -9,24 +22,24 @@
// void func_8009B308_jp();
// void func_8009B33C_jp();
// void func_8009B394_jp();
-// void LightsN_disp();
+void LightsN_disp(Lights* light, struct GraphicsContext* gfxCtx);
// void func_8009B504_jp();
// void func_8009B534_jp();
// void func_8009B72C_jp();
// void func_8009B81C_jp();
-// void func_8009B884_jp();
+void LightsN_list_check(Lights* light, UNK_TYPE4 arg1, Vec3f* arg2);
// void func_8009B954_jp();
// void func_8009B9E0_jp();
-// void func_8009BA28_jp();
+// void Global_light_ct();
// void func_8009BA94_jp();
// void func_8009BAC0_jp();
-// void Global_light_read();
+Lights* Global_light_read(LightContext* lightCtx, struct GraphicsContext* gfxCtx);
// void func_8009BB34_jp();
// void func_8009BB40_jp();
// void func_8009BB8C_jp();
// void func_8009BBEC_jp();
// void func_8009BC48_jp();
// void func_8009BD90_jp();
-// void Light_list_point_draw();
+void Light_list_point_draw(struct PlayState* play);
#endif
diff --git a/include/m_npc.h b/include/m_npc.h
index 4ef8e81..9e5ece4 100644
--- a/include/m_npc.h
+++ b/include/m_npc.h
@@ -2,6 +2,15 @@
#define M_NPC_H
#include "ultra64.h"
+#include "m_actor.h"
+#include "unk.h"
+
+typedef struct Npc {
+ /* 0x000 */ Actor actor;
+ /* 0x174 */ UNK_TYPE1 unk_174[0x594];
+ /* 0x708 */ s32 unk_708;
+} Npc; // size >= 0x70C
+
// void func_800A6810_jp();
// void func_800A6920_jp();
@@ -117,7 +126,7 @@
// void func_800AB054_jp();
// void func_800AB09C_jp();
// void mNpc_SetNpcList();
-// void mNpc_SetNpcinfo();
+void mNpc_SetNpcinfo(struct Actor* actor, s8 arg1);
// void func_800AB498_jp();
// void func_800AB62C_jp();
// void func_800AB6C8_jp();
diff --git a/include/m_play.h b/include/m_play.h
deleted file mode 100644
index afae92c..0000000
--- a/include/m_play.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef M_PLAY_H
-#define M_PLAY_H
-
-#include "ultra64.h"
-#include "game.h"
-
-typedef struct PlayState {
- /* 0x00000 */ GameState state;
-} PlayState; // size = ??
-
-#endif
diff --git a/include/m_player_lib.h b/include/m_player_lib.h
index e205d08..ccbf3e2 100644
--- a/include/m_player_lib.h
+++ b/include/m_player_lib.h
@@ -3,6 +3,10 @@
#include "ultra64.h"
+struct Player;
+struct PlayState;
+
+
// void func_800B1160_jp();
// void func_800B11B0_jp();
// void func_800B11F8_jp();
@@ -36,7 +40,7 @@
// void func_800B1B6C_jp();
// void func_800B1BB8_jp();
// void func_800B1BE8_jp();
-// void get_player_actor_withoutCheck();
+struct Player* get_player_actor_withoutCheck(struct PlayState* play);
// void func_800B1C90_jp();
// void func_800B1CBC_jp();
// void func_800B1CE0_jp();
diff --git a/include/m_scene.h b/include/m_scene.h
new file mode 100644
index 0000000..e0154bc
--- /dev/null
+++ b/include/m_scene.h
@@ -0,0 +1,14 @@
+#ifndef M_SCENE_H
+#define M_SCENE_H
+
+#include "ultra64.h"
+#include "z64math.h"
+
+typedef struct ActorEntry {
+ /* 0x0 */ s16 id;
+ /* 0x2 */ Vec3s pos;
+ /* 0x8 */ Vec3s rot;
+ /* 0xE */ s16 params;
+} ActorEntry; // size = 0x10
+
+#endif
diff --git a/include/m_skin_matrix.h b/include/m_skin_matrix.h
index 5c2c7f6..224a8f5 100644
--- a/include/m_skin_matrix.h
+++ b/include/m_skin_matrix.h
@@ -4,7 +4,7 @@
#include "ultra64.h"
#include "z64math.h"
-// void Skin_Matrix_PrjMulVector();
+void Skin_Matrix_PrjMulVector(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest);
// void Skin_Matrix_MulVector();
void Skin_Matrix_MulMatrix(MtxF* mfB, MtxF* mfA, MtxF* dest);
// void Skin_Matrix_getUnitMatrixPointer();
diff --git a/include/macros.h b/include/macros.h
index bdfb477..0c88af1 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -10,7 +10,12 @@
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
+#define PROJECTED_TO_SCREEN_X(projectedPos, invW) ((projectedPos).x * (invW) * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2))
+#define PROJECTED_TO_SCREEN_Y(projectedPos, invW) ((projectedPos).y * (invW) * (-SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2))
+
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
+#define ABS(x) (((x) >= 0) ? (x): -(x))
+
#endif
diff --git a/include/ovlmgr.h b/include/ovlmgr.h
index c0b6596..345b1ee 100644
--- a/include/ovlmgr.h
+++ b/include/ovlmgr.h
@@ -2,12 +2,13 @@
#define OVLMGR_H
#include "ultra64.h"
+#include "other_types.h"
#include "unk.h"
struct OverlayRelocationSection;
-void ovlmgr_LoadImpl(void* vromStart, UNK_TYPE arg1, void* vramStart, void* vramEnd, void* allocatedRamAddr, struct OverlayRelocationSection* ovl, size_t size);
-void ovlmgr_Load(void* vromStart, UNK_TYPE arg1, void* vramStart, void* vramEnd, void* allocatedRamAddr);
+void ovlmgr_LoadImpl(RomOffset vromStart, RomOffset vromEndUnused, void* vramStart, void* vramEnd, void* allocatedRamAddr, struct OverlayRelocationSection* ovl, size_t size);
+void ovlmgr_Load(RomOffset vromStart, RomOffset vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr);
#endif
diff --git a/include/unknown_structs.h b/include/unknown_structs.h
index a10218f..9b9403c 100644
--- a/include/unknown_structs.h
+++ b/include/unknown_structs.h
@@ -6,5 +6,23 @@
#include "libc/stdbool.h"
#include "unk.h"
+typedef struct struct_801161E8_jp {
+ /* 0x0 */ UNK_TYPE1 unk_0[0x8];
+} struct_801161E8_jp; // size <= 0x8
+
+typedef struct CommonData_unk_1004C_unk_14_arg0 {
+ /* 0x00 */ s16 unk_00;
+ /* 0x00 */ s16 unk_02;
+ /* 0x04 */ UNK_TYPE1 unk_04[0x60];
+} CommonData_unk_1004C_unk_14_arg0; // size >= 0x64, maybe less, guessed from stack usage
+
+typedef struct PlayState_unk_0110 {
+ /* 0x00 */ s16 unk_00;
+ /* 0x02 */ UNK_TYPE1 unk_02[0x2];
+ /* 0x04 */ void* segment;
+ /* 0x08 */ UNK_TYPE1 unk_08[0x48];
+ /* 0x50 */ s16 unk_50;
+ /* 0x52 */ UNK_TYPE1 unk_52[0x2];
+} PlayState_unk_0110; // size = 0x54
#endif
diff --git a/include/z64math.h b/include/z64math.h
index 25f2c42..33bab3a 100644
--- a/include/z64math.h
+++ b/include/z64math.h
@@ -58,8 +58,6 @@ typedef union {
// Calculate the floating point remainder of x / y.
#define FMOD(x, y) ((x) - ((s32)((x) * (1.0f / (y))) * (f32)(y)))
-#define ABS(x) (x >= 0.0f) ? x : -x;
-
// Casting a float to an integer, when the float value is larger than what the integer type can hold,
// leads to undefined behavior. For example (f32)0x8000 doesn't fit in a s16, so it cannot be cast to s16.
// This isn't an issue with IDO, but is one with for example GCC.
@@ -83,4 +81,9 @@ typedef union {
#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * (f32)M_PI)
#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * (f32)M_PI) / 0x8000)
+// Angle arithmetic macros
+#define BINANG_ROT180(angle) ((s16)(angle + 0x8000))
+#define BINANG_SUB(a, b) ((s16)(a - b))
+#define BINANG_ADD(a, b) ((s16)(a + b))
+
#endif
diff --git a/include/z_std_dma.h b/include/z_std_dma.h
index 9927304..bd337e5 100644
--- a/include/z_std_dma.h
+++ b/include/z_std_dma.h
@@ -28,7 +28,7 @@ void DmaMgr_RequestSync(void* ram, void* vrom, size_t size);
// void func_80026BC0_jp();
// void func_80026C00_jp();
// void func_80026C28_jp();
-s32 func_80026C4C_jp(void* vromStart, void* vromEnd, void* ovlStart, void* ovlEnd);
+s32 func_80026C4C_jp(RomOffset vromStart, RomOffset* vromEnd, void* ovlStart, void* ovlEnd);
void func_80026CAC_jp(void);
void func_80026DA0_jp(void);
// void func_80026DCC_jp();
diff --git a/lib/ultralib/include/PR/gbi.h b/lib/ultralib/include/PR/gbi.h
index 206fe6c..a4d5a49 100644
--- a/lib/ultralib/include/PR/gbi.h
+++ b/lib/ultralib/include/PR/gbi.h
@@ -2677,8 +2677,8 @@ _DW({ \
#define gSPLookAt(pkt, la) \
_DW({ \
- gSPLookAtX(pkt,la) \
- gSPLookAtY(pkt,(char *)(la)+16) \
+ gSPLookAtX(pkt,la); \
+ gSPLookAtY(pkt,(char *)(la)+16); \
})
#define gsSPLookAt(la) \
gsSPLookAtX(la), \
diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt
index 3dd3881..a6a76a6 100644
--- a/linker_scripts/jp/symbol_addrs_code.txt
+++ b/linker_scripts/jp/symbol_addrs_code.txt
@@ -915,7 +915,7 @@ func_80078748_jp = 0x80078748; // type:func
func_800787E8_jp = 0x800787E8; // type:func
CollisionCheck_Status_ct = 0x800788DC; // type:func
CollisionCheck_Status_Clear = 0x8007891C; // type:func
-func_80078948_jp = 0x80078948; // type:func
+CollisionCheck_Status_set3 = 0x80078948; // type:func
CollisionCheck_Uty_ActorWorldPosSetPipeC = 0x80078978; // type:func
func_800789BC_jp = 0x800789BC; // type:func
common_data_reinit = 0x80078A10; // type:func
@@ -1710,16 +1710,16 @@ func_80096B2C_jp = 0x80096B2C; // type:func
func_80096B4C_jp = 0x80096B4C; // type:func
func_80096B64_jp = 0x80096B64; // type:func
func_80096BF0_jp = 0x80096BF0; // type:func
-func_80096C90_jp = 0x80096C90; // type:func
+mEnv_regist_nature = 0x80096C90; // type:func
func_80096CA0_jp = 0x80096CA0; // type:func
func_80096CDC_jp = 0x80096CDC; // type:func
func_80096D60_jp = 0x80096D60; // type:func
func_80096F5C_jp = 0x80096F5C; // type:func
func_80097048_jp = 0x80097048; // type:func
-func_800970D4_jp = 0x800970D4; // type:func
-func_80097108_jp = 0x80097108; // type:func
-func_800971B4_jp = 0x800971B4; // type:func
-func_80097510_jp = 0x80097510; // type:func
+mEnv_RoomTypeLightSet = 0x800970D4; // type:func
+Global_kankyo_ct = 0x80097108; // type:func
+mEnv_MakeShadowInfo = 0x800971B4; // type:func
+mEnv_set_time = 0x80097510; // type:func
func_800976BC_jp = 0x800976BC; // type:func
func_80097738_jp = 0x80097738; // type:func
func_800978EC_jp = 0x800978EC; // type:func
@@ -1747,7 +1747,7 @@ func_80098B50_jp = 0x80098B50; // type:func
func_80098CCC_jp = 0x80098CCC; // type:func
func_80098D88_jp = 0x80098D88; // type:func
func_80098DE0_jp = 0x80098DE0; // type:func
-func_80098EE4_jp = 0x80098EE4; // type:func
+mEnv_NowWeather = 0x80098EE4; // type:func
func_80098F68_jp = 0x80098F68; // type:func
func_80098FF0_jp = 0x80098FF0; // type:func
func_800990A8_jp = 0x800990A8; // type:func
@@ -1762,7 +1762,7 @@ func_800996CC_jp = 0x800996CC; // type:func
mEnv_GetShadowPrimColor_Light = 0x800996F8; // type:func
func_80099718_jp = 0x80099718; // type:func
func_80099728_jp = 0x80099728; // type:func
-func_80099770_jp = 0x80099770; // type:func
+mEnv_MakeWindowLightAlpha = 0x80099770; // type:func
func_800998AC_jp = 0x800998AC; // type:func
mem_copy = 0x800998C0; // type:func
mem_clear = 0x8009992C; // type:func
@@ -1837,10 +1837,10 @@ func_8009B504_jp = 0x8009B504; // type:func
func_8009B534_jp = 0x8009B534; // type:func
func_8009B72C_jp = 0x8009B72C; // type:func
func_8009B81C_jp = 0x8009B81C; // type:func
-func_8009B884_jp = 0x8009B884; // type:func
+LightsN_list_check = 0x8009B884; // type:func
func_8009B954_jp = 0x8009B954; // type:func
func_8009B9E0_jp = 0x8009B9E0; // type:func
-func_8009BA28_jp = 0x8009BA28; // type:func
+Global_light_ct = 0x8009BA28; // type:func
func_8009BA94_jp = 0x8009BA94; // type:func
func_8009BAC0_jp = 0x8009BAC0; // type:func
Global_light_read = 0x8009BAFC; // type:func
@@ -2441,7 +2441,7 @@ func_800AEB50_jp = 0x800AEB50; // type:func
func_800AEB9C_jp = 0x800AEB9C; // type:func
func_800AEBC8_jp = 0x800AEBC8; // type:func
func_800AEC74_jp = 0x800AEC74; // type:func
-func_800AED08_jp = 0x800AED08; // type:func
+mNPS_schedule_manager = 0x800AED08; // type:func
func_800AED68_jp = 0x800AED68; // type:func
func_800AEDD0_jp = 0x800AEDD0; // type:func
func_800AEE38_jp = 0x800AEE38; // type:func
@@ -3093,16 +3093,16 @@ func_800C6144_jp = 0x800C6144; // type:func
mSc_regist_initial_exchange_bank = 0x800C61CC; // type:func
func_800C62C4_jp = 0x800C62C4; // type:func
func_800C639C_jp = 0x800C639C; // type:func
-func_800C65E4_jp = 0x800C65E4; // type:func
-func_800C6678_jp = 0x800C6678; // type:func
+mSc_data_bank_ct = 0x800C65E4; // type:func
+mSc_decide_exchange_bank = 0x800C6678; // type:func
func_800C6690_jp = 0x800C6690; // type:func
-func_800C68C8_jp = 0x800C68C8; // type:func
+Scene_ct = 0x800C68C8; // type:func
func_800C6960_jp = 0x800C6960; // type:func
func_800C69F4_jp = 0x800C69F4; // type:func
func_800C6A28_jp = 0x800C6A28; // type:func
func_800C6A5C_jp = 0x800C6A5C; // type:func
func_800C6A90_jp = 0x800C6A90; // type:func
-func_800C6AC4_jp = 0x800C6AC4; // type:func
+Door_info_ct = 0x800C6AC4; // type:func
func_800C6AD0_jp = 0x800C6AD0; // type:func
func_800C6AE0_jp = 0x800C6AE0; // type:func
func_800C6B50_jp = 0x800C6B50; // type:func
@@ -3378,7 +3378,7 @@ func_800D2314_jp = 0x800D2314; // type:func
func_800D2334_jp = 0x800D2334; // type:func
func_800D2354_jp = 0x800D2354; // type:func
func_800D2360_jp = 0x800D2360; // type:func
-func_800D236C_jp = 0x800D236C; // type:func
+sAdo_RoomType = 0x800D236C; // type:func
func_800D2394_jp = 0x800D2394; // type:func
func_800D23B4_jp = 0x800D23B4; // type:func
func_800D2438_jp = 0x800D2438; // type:func
@@ -4186,7 +4186,7 @@ D_80100C5C_jp = 0x80100C5C; //
D_80100C60_jp = 0x80100C60; //
D_80100C64_jp = 0x80100C64; //
D_80100C68_jp = 0x80100C68; //
-D_80100C70_jp = 0x80100C70; //
+restore_flag = 0x80100C70; // size:0x20
actor_dlftbls = 0x80100C90; // size:0x1920
actor_dlftbls_num = 0x801025B0; // size:0x4
@@ -4955,7 +4955,7 @@ D_8010DD80_jp = 0x8010DD80; //
D_8010DDAC_jp = 0x8010DDAC; // type:s16
D_8010DDBC_jp = 0x8010DDBC; // type:s16
D_8010DDD0_jp = 0x8010DDD0; //
-D_8010EAA0_jp = 0x8010EAA0; // type:s8
+scene_data_status = 0x8010EAA0; // type:s8
D_8010ED60_jp = 0x8010ED60; //
D_8010EDA0_jp = 0x8010EDA0; //
D_8010EDA4_jp = 0x8010EDA4; //
@@ -5196,7 +5196,7 @@ RO_FLT_80116154_jp = 0x80116154; // type:f32
RO_STR_80116160_jp = 0x80116160; // type:asciz
RO_STR_80116184_jp = 0x80116184; // type:asciz
RO_STR_801161B0_jp = 0x801161B0; // type:asciz
-RO_801161C4_jp = 0x801161C4; //
+RO_STR_801161C4_jp = 0x801161C4; // type:asciz force_migration:True
RO_STR_801161C8_jp = 0x801161C8; // type:asciz
RO_STR_801161DC_jp = 0x801161DC; // type:asciz
RO_801161E8_jp = 0x801161E8; //
@@ -5288,7 +5288,7 @@ RO_FLT_80116444_jp = 0x80116444; // type:f32
RO_FLT_80116448_jp = 0x80116448; // type:f32
RO_FLT_8011644C_jp = 0x8011644C; // type:f32
RO_STR_80116450_jp = 0x80116450; // type:asciz
-RO_80116464_jp = 0x80116464; //
+RO_80116464_jp = 0x80116464; // size:0xC
RO_STR_80116470_jp = 0x80116470; // type:asciz
RO_FLT_80116484_jp = 0x80116484; // type:f32
RO_801164B4_jp = 0x801164B4; //
@@ -6080,7 +6080,7 @@ B_801407C0_jp = 0x801407C0; //
B_80141390_jp = 0x80141390; //
B_80141DE0_jp = 0x80141DE0; //
B_80141DE4_jp = 0x80141DE4; // type:s8
-B_80141DE8_jp = 0x80141DE8; // type:s16
+B_80141DE8_jp = 0x80141DE8; // type:s16 size:0x6
B_80141DF0_jp = 0x80141DF0; //
B_FLT_80141DF4_jp = 0x80141DF4; // type:f32
B_FLT_80141DF8_jp = 0x80141DF8; // type:f32
@@ -6208,9 +6208,7 @@ B_80145860_jp = 0x80145860; //
B_80145880_jp = 0x80145880; //
B_80145898_jp = 0x80145898; //
B_8014589C_jp = 0x8014589C; //
-B_801458A0_jp = 0x801458A0; //
-B_801458B0_jp = 0x801458B0; //
-B_801458B8_jp = 0x801458B8; //
+gSegments = 0x801458A0; // size:0x40
padmgr_class = 0x801458E0; // size:0x480
B_80145D70_jp = 0x80145D70; //
B_80145D80_jp = 0x80145D80; //
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 6287ea3..4596d7f 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -211,9 +211,9 @@ func_80803F48_jp = 0x80803F48; // type:func
func_8080407C_jp = 0x8080407C; // type:func
func_80804138_jp = 0x80804138; // type:func
func_808041A4_jp = 0x808041A4; // type:func
-func_808041C4_jp = 0x808041C4; // type:func
-func_80804240_jp = 0x80804240; // type:func
-func_80804288_jp = 0x80804288; // type:func
+Gameplay_Scene_Init = 0x808041C4; // type:func
+mPl_SceneNo2SoundRoomType = 0x80804240; // type:func
+Gameplay_Scene_Read = 0x80804288; // type:func
// .data
@@ -8710,7 +8710,7 @@ func_80968F98_jp = 0x80968F98; // type:func
func_80969040_jp = 0x80969040; // type:func
func_80969114_jp = 0x80969114; // type:func
func_809693EC_jp = 0x809693EC; // type:func
-D_80969690_jp = 0x80969690; // type:s16
+D_80969690_jp = 0x80969690; // type:s16 FAKE
func_80969800_jp = 0x80969800; // type:func
func_8096983C_jp = 0x8096983C; // type:func
func_809698E8_jp = 0x809698E8; // type:func
@@ -13630,8 +13630,7 @@ func_80A04AA4_jp = 0x80A04AA4; // type:func
// .data
-_008D2440_Profile = 0x80A04C00; //
-D_80A04C04_jp = 0x80A04C04; //
+_008D2440_Profile = 0x80A04C00; // size:0x24
D_80A04C24_jp = 0x80A04C24; //
D_80A04C38_jp = 0x80A04C38; //
D_80A04C54_jp = 0x80A04C54; //
diff --git a/relocs/reloc_addrs.jp.txt b/relocs/reloc_addrs.jp.txt
index d2aa6cf..89490c6 100644
--- a/relocs/reloc_addrs.jp.txt
+++ b/relocs/reloc_addrs.jp.txt
@@ -60,6 +60,14 @@ rom:0x6F6590 symbol:segment_027130_ROM_END reloc:MIPS_LO16
rom:0x82D48C symbol:D_80100C30_jp reloc:MIPS_HI16 addend:-0x7D04
rom:0x82D4A0 symbol:D_80100C30_jp reloc:MIPS_LO16 addend:-0x7D04
+// ovl__008681F0 tries to load a from an address in the middle of a
+// function of another overlay.
+// It is suspected to be a negative addend to an unknown symbol.
+// Use the first data symbol of this overlay in the meanwhile
+// Commented out because it would need a newer version of spimdisasm
+// rom:0x875080 symbol:D_80981940_jp reloc:MIPS_HI16 addend:-0x182B0
+// rom:0x875088 symbol:D_80981940_jp reloc:MIPS_LO16 addend:-0x182B0
+
// ovl__008ADF40 tries to load a branch target from another overlay.
// It is suspected to be a negative addend to an unknown symbol.
// Use the first data symbol of this overlay in the meanwhile
diff --git a/src/boot/O2/loadfragment2.c b/src/boot/O2/loadfragment2.c
index 42a826d..f9fe629 100644
--- a/src/boot/O2/loadfragment2.c
+++ b/src/boot/O2/loadfragment2.c
@@ -13,15 +13,15 @@
void DoRelocation(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart);
// Unknown original name
-s32 Overlay_Load(void* vromStart, void* vromEnd, void* ovlStart, void* ovlEnd, void* vramStart, void* vramEnd,
+s32 Overlay_Load(RomOffset vromStart, RomOffset vromEnd, void* ovlStart, void* ovlEnd, void* vramStart, void* vramEnd,
void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs) {
OverlayRelocationSection* ovl = ovlRelocs;
- s32 vromSize = (uintptr_t)vromEnd - (uintptr_t)vromStart;
+ s32 vromSize = vromEnd - vromStart;
s32 ovlSize = (uintptr_t)ovlEnd - (uintptr_t)ovlStart;
s32 vramSize = (uintptr_t)vramEnd - (uintptr_t)vramStart;
void* end = (void*)((uintptr_t)allocatedRamAddr + vromSize);
- DmaMgr_RequestSync(allocatedRamAddr, vromStart, vromSize);
+ DmaMgr_RequestSync(allocatedRamAddr, (void*)vromStart, vromSize);
DmaMgr_RequestSync(ovl, ovlStart, ovlSize);
DoRelocation(allocatedRamAddr, ovl, vramStart);
diff --git a/src/boot/ovlmgr.c b/src/boot/ovlmgr.c
index 6a82ed1..c63e40a 100644
--- a/src/boot/ovlmgr.c
+++ b/src/boot/ovlmgr.c
@@ -28,9 +28,9 @@ void ovlmgr_Free(void* ptr) {
}
}
-void ovlmgr_LoadImpl(void* vromStart, UNUSED UNK_TYPE arg1, void* vramStart, void* vramEnd, void* allocatedRamAddr,
- struct OverlayRelocationSection* ovl, size_t size) {
- void* vromEnd;
+void ovlmgr_LoadImpl(RomOffset vromStart, UNUSED RomOffset vromEndUnused, void* vramStart, void* vramEnd,
+ void* allocatedRamAddr, struct OverlayRelocationSection* ovl, size_t size) {
+ RomOffset vromEnd;
void* ovlStart;
void* ovlEnd;
size_t ovlSize;
@@ -58,6 +58,6 @@ void ovlmgr_LoadImpl(void* vromStart, UNUSED UNK_TYPE arg1, void* vramStart, voi
}
}
-void ovlmgr_Load(void* vromStart, UNK_TYPE arg1, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
- ovlmgr_LoadImpl(vromStart, arg1, vramStart, vramEnd, allocatedRamAddr, NULL, 0);
+void ovlmgr_Load(RomOffset vromStart, RomOffset vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
+ ovlmgr_LoadImpl(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr, NULL, 0);
}
diff --git a/src/code/c_keyframe.c b/src/code/c_keyframe.c
index 9df0986..352eac5 100644
--- a/src/code/c_keyframe.c
+++ b/src/code/c_keyframe.c
@@ -38,12 +38,10 @@
#include "z64math.h"
#include "m_lib.h"
#include "gfx.h"
-#include "m_play.h"
#include "libc64/fp.h"
#include "sys_matrix.h"
#include "sys_math3d.h"
-
-UNK_PTR* B_801458A0_jp[4];
+#include "overlays/gamestates/ovl_play/m_play.h"
void cKF_FrameControl_zeroClear(FrameControl* frameControl) {
bzero(frameControl, sizeof(FrameControl));
@@ -719,13 +717,13 @@ void cKF_SkeletonInfo_R_init_reverse_setspeedandmorphandmode(SkeletonInfoR* skel
void func_80053384_jp(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, UNK_PTR* arg6, UNK_PTR* arg7,
UNK_PTR* arg8) {
if (arg3 != 0) {
- B_801458A0_jp[arg0] = OS_PHYSICAL_TO_K0(arg6);
+ gSegments[arg0] = (uintptr_t)OS_K0_TO_PHYSICAL(arg6);
}
if (arg4 != 0) {
- B_801458A0_jp[arg1] = OS_PHYSICAL_TO_K0(arg7);
+ gSegments[arg1] = (uintptr_t)OS_K0_TO_PHYSICAL(arg7);
}
if (arg5 != 0) {
- B_801458A0_jp[arg2] = OS_PHYSICAL_TO_K0(arg8);
+ gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg8);
}
}
@@ -888,14 +886,14 @@ s32 cKF_SkeletonInfo_R_combine_play(SkeletonInfoR* skeletonInfo1, SkeletonInfoR*
joint = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable;
if (arg4 != 0) {
- sp44 = OS_PHYSICAL_TO_K0(B_801458A0_jp[arg2]);
- B_801458A0_jp[arg2] = OS_PHYSICAL_TO_K0(arg4);
+ sp44 = OS_PHYSICAL_TO_K0(gSegments[arg2]);
+ gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg4);
cKF_SkeletonInfo_R_combine_work_set(&combine3, skeletonInfo1);
}
if (arg5 != 0) {
- sp40 = OS_PHYSICAL_TO_K0(B_801458A0_jp[arg3]);
- B_801458A0_jp[arg3] = OS_PHYSICAL_TO_K0(arg5);
+ sp40 = OS_PHYSICAL_TO_K0(gSegments[arg3]);
+ gSegments[arg3] = (uintptr_t)OS_K0_TO_PHYSICAL(arg5);
cKF_SkeletonInfo_R_combine_work_set(&combine2, skeletonInfo2);
cKF_SkeletonInfo_R_combine_work_set(&combine1, skeletonInfo2);
}
@@ -966,18 +964,18 @@ void cKF_SkeletonInfo_R_T_combine_play(s32* arg0, s32* arg1, s32* arg2, Skeleton
spAC = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable;
if (arg9 != 0) {
- sp48 = OS_PHYSICAL_TO_K0(B_801458A0_jp[arg6]);
- B_801458A0_jp[arg6] = OS_PHYSICAL_TO_K0(arg9);
+ sp48 = OS_PHYSICAL_TO_K0(gSegments[arg6]);
+ gSegments[arg6] = (uintptr_t)OS_K0_TO_PHYSICAL(arg9);
cKF_SkeletonInfo_R_combine_work_set(&sp4C, skeletonInfo1);
}
if (argA != 0) {
- sp44 = OS_PHYSICAL_TO_K0(B_801458A0_jp[arg7]);
- B_801458A0_jp[arg7] = OS_PHYSICAL_TO_K0(argA);
+ sp44 = OS_PHYSICAL_TO_K0(gSegments[arg7]);
+ gSegments[arg7] = (uintptr_t)OS_K0_TO_PHYSICAL(argA);
cKF_SkeletonInfo_R_combine_work_set(&sp6C, skeletonInfo2);
}
if (argB != 0) {
- sp40 = OS_PHYSICAL_TO_K0(B_801458A0_jp[arg8]);
- B_801458A0_jp[arg8] = OS_PHYSICAL_TO_K0(argB);
+ sp40 = OS_PHYSICAL_TO_K0(gSegments[arg8]);
+ gSegments[arg8] = (uintptr_t)OS_K0_TO_PHYSICAL(argB);
cKF_SkeletonInfo_R_combine_work_set(&sp8C, skeletonInfo3);
}
diff --git a/src/code/game.c b/src/code/game.c
index ac01008..1c634ba 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -145,9 +145,9 @@ void game_draw_first(GraphicsContext* gfxCtx) {
gSPSegment(UNK_2C0_DISP++, 0x0F, gfxCtx->unk_2E4);
gSPSegment(UNK_2C0_DISP++, 0x0E, temp_v0);
- gSPSegment(UNK_2D0_DISP++, 0x00, NULL);
- gSPSegment(UNK_2D0_DISP++, 0x0F, gfxCtx->unk_2E4);
- gSPSegment(UNK_2D0_DISP++, 0x0E, temp_v0);
+ gSPSegment(LIGHT_DISP++, 0x00, NULL);
+ gSPSegment(LIGHT_DISP++, 0x0F, gfxCtx->unk_2E4);
+ gSPSegment(LIGHT_DISP++, 0x0E, temp_v0);
CLOSE_DISPS(gfxCtx);
}
diff --git a/src/code/m_actor.c b/src/code/m_actor.c
new file mode 100644
index 0000000..f5c2091
--- /dev/null
+++ b/src/code/m_actor.c
@@ -0,0 +1,1143 @@
+#include "m_actor.h"
+#include "m_actor_dlftbls.h"
+#include "m_collision_bg.h"
+#include "m_collision_obj.h"
+#include "m_common_data.h"
+#include "m_debug.h"
+#include "m_event.h"
+#include "m_field_info.h"
+#include "m_lights.h"
+#include "m_malloc.h"
+#include "m_lib.h"
+#include "m_skin_matrix.h"
+#include "m_player_lib.h"
+#include "m_npc.h"
+#include "m_scene.h"
+#include "libc/math.h"
+#include "fault.h"
+#include "sys_matrix.h"
+#include "ovlmgr.h"
+#include "gfx.h"
+#include "6E9650.h"
+#include "unknown_structs.h"
+#include "code_variables.h"
+#include "macros.h"
+#include "overlays/gamestates/ovl_play/m_play.h"
+#include "overlays/actors/ovl_player_actor/m_player.h"
+
+void func_80056380_jp(void* arg0, void* arg1 UNUSED) {
+ Actor* actor = arg0;
+ const char* name;
+
+ if ((actor == NULL) || (actor->overlayEntry == NULL)) {
+ //! @bug this will be overriden by the next printf
+ FaultDrawer_SetCursor(48, 24);
+ FaultDrawer_Printf("ACTOR NAME is NULL");
+ }
+
+ FaultDrawer_SetCursor(48, 24);
+ name = "";
+ FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name);
+}
+
+void projection_pos_set(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) {
+ Skin_Matrix_PrjMulVector(&play->viewProjectionMtxF, worldPos, projectedPos, invW);
+
+ *invW = (*invW < 1.0f) ? 1.0f : (1.0f / *invW);
+}
+
+void Actor_world_to_eye(Actor* actor, f32 arg1) {
+ actor->eye.pos.x = actor->world.pos.x;
+ actor->eye.pos.y = actor->world.pos.y + arg1;
+ actor->eye.pos.z = actor->world.pos.z;
+ actor->eye.rot.x = actor->world.rot.x;
+ actor->eye.rot.y = actor->world.rot.y;
+ actor->eye.rot.z = actor->world.rot.z;
+}
+
+void Actor_position_move(Actor* actor) {
+ Kankyo* kankyo = &((PlayState*)gamePT)->kankyo;
+ f32 speedRate;
+
+ speedRate = game_GameFrame_2F;
+
+ kankyo->unk_C0(actor);
+
+ actor->world.pos.x += actor->velocity.x * speedRate + actor->colStatus.displacement.x;
+ actor->world.pos.y += actor->velocity.y * speedRate + actor->colStatus.displacement.y;
+ actor->world.pos.z += actor->velocity.z * speedRate + actor->colStatus.displacement.z;
+}
+
+void Actor_position_speed_set(Actor* actor) {
+ actor->velocity.x = sin_s(actor->world.rot.y) * actor->speed;
+ actor->velocity.z = cos_s(actor->world.rot.y) * actor->speed;
+
+ chase_f(&actor->velocity.y, actor->terminalVelocity, actor->gravity);
+}
+
+void Actor_position_moveF(Actor* actor) {
+ Actor_position_speed_set(actor);
+ Actor_position_move(actor);
+}
+
+s32 Actor_player_look_direction_check(Actor* actor, s16 maxAngleDiff, PlayState* play) {
+ s16 yawDiff = BINANG_ROT180(actor->yawTowardsPlayer) - get_player_actor_withoutCheck(play)->actor.shape.rot.y;
+
+ return ABS(yawDiff) < maxAngleDiff;
+}
+
+void Actor_display_position_set(PlayState* play, Actor* actor, s16* x, s16* y) {
+ Vec3f projectedPos;
+ f32 invW;
+
+ projection_pos_set(play, &actor->world.pos, &projectedPos, &invW);
+
+ // Explicit cast to avoid implicit cast from f32 to s16
+ *x = (s32)PROJECTED_TO_SCREEN_X(projectedPos, invW);
+ *y = (s32)PROJECTED_TO_SCREEN_Y(projectedPos, invW);
+}
+
+s32 Actor_data_bank_dma_end_check(Actor* actor, PlayState* play) {
+ s32 var_v1;
+
+ switch (ACTOR_FGNAME_GET_F000(actor->fgName)) {
+ case FGNAME_F000_D:
+ case FGNAME_F000_E:
+ var_v1 = common_data.unk_1004C->unk_F4(play->unk_0110, actor);
+ break;
+
+ default:
+ var_v1 = play->unk_0110[actor->unk_026].unk_00 > 0;
+ break;
+ }
+
+ return var_v1;
+}
+
+void Shape_Info_init(Actor* actor, f32 arg1, Shape_Info_unk_0C arg2, f32 arg3, f32 arg4) {
+ actor->shape.unk_08 = arg1;
+ actor->shape.unk_0C = arg2;
+ actor->shape.unk_10 = arg3;
+ actor->shape.unk_14 = arg4;
+ actor->shape.unk_2C = 1;
+ actor->shape.unk_20 = 0;
+ actor->shape.unk_18 = 1.0f;
+ actor->shape.unk_1C = 1.0f;
+ actor->shape.unk_2E = 0;
+ actor->shape.unk_24 = &actor->world.pos;
+ actor->shape.unk_28 = -1;
+ actor->shape.unk_2D = 0;
+}
+
+void Actor_foot_shadow_pos_set(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex,
+ Vec3f* rightFootPos) {
+ if (limbIndex == leftFootIndex) {
+ Matrix_Position(leftFootPos, &actor->shape.feetPos[FOOT_LEFT]);
+ } else if (limbIndex == rightFootIndex) {
+ Matrix_Position(rightFootPos, &actor->shape.feetPos[FOOT_RIGHT]);
+ }
+}
+
+void Actor_delete(Actor* actor) {
+ if (actor != NULL) {
+ actor->update = NULL;
+ actor->draw = NULL;
+ }
+}
+
+void Actor_ct(Actor* actor, PlayState* play) {
+ s32 pad[2] UNUSED;
+ PlayState_unk_0110* temp;
+ Npc* npc;
+ CommonData_unk_1004C_unk_14_arg0 sp34;
+ PlayState_unk_0110* temp_a0;
+
+ temp_a0 = play->unk_0110;
+
+ temp = temp_a0;
+ temp += actor->unk_026;
+ temp->unk_50++;
+
+ if (actor->part == ACTOR_PART_NPC) {
+ npc = (Npc*)actor;
+
+ common_data.unk_1004C->unk_14(&sp34, npc->actor.fgName);
+ npc->unk_708 = mSc_bank_regist_check(temp_a0, sp34.unk_02);
+ temp_a0[npc->unk_708].unk_50++;
+ }
+
+ actor->world = actor->home;
+ actor->shape.rot = actor->world.rot;
+
+ Actor_world_to_eye(actor, 0.0f);
+ xyz_t_move(&actor->prevPos, &actor->world.pos);
+
+ actor->scale.x = 0.01f;
+ actor->scale.y = 0.01f;
+ actor->scale.z = 0.01f;
+
+ actor->terminalVelocity = -20.0f;
+ actor->xyzDistToPlayerSq = FLT_MAX;
+
+ actor->uncullZoneScale = 350.0f;
+ actor->uncullZoneDownward = 700.0f;
+
+ actor->shape.unk_18 = 1.0f;
+ actor->shape.unk_1C = 1.0f;
+
+ actor->unk_13C = 1000.0f;
+ actor->unk_140 = 350.0f;
+ actor->unk_144 = 55.0f;
+
+ CollisionCheck_Status_ct(&actor->colStatus);
+ Shape_Info_init(actor, 0.0f, NULL, 0.0f, 0.0f);
+
+ if (Actor_data_bank_dma_end_check(actor, play) == 1) {
+ gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0[actor->unk_026].segment);
+ actor->ct(actor, play);
+ actor->ct = NULL;
+ }
+}
+
+#ifdef NON_MATCHING
+void Actor_dt(Actor* actor, PlayState* play) {
+ PlayState_unk_0110* temp_v0_6;
+ s32 new_var;
+
+ if (actor->save != NULL) {
+ actor->save(actor, play);
+ actor->save = NULL;
+ }
+
+ if (actor->dt != NULL) {
+ actor->dt(actor, play);
+ actor->dt = NULL;
+ }
+
+ if ((actor->child != NULL) && (actor == actor->child->parent)) {
+ actor->child->parent = NULL;
+ }
+
+ if ((actor->parent != NULL) && (actor == actor->parent->child)) {
+ actor->parent->child = NULL;
+ }
+
+ temp_v0_6 = play->unk_0110;
+ if (0) {}
+
+ switch ((actor->fgName & 0xF000) >> 0xC) {
+ case 0xD:
+ case 0xE:
+ common_data.unk_1004C->unk_F0(temp_v0_6, actor);
+ break;
+
+ default:
+ new_var = play->unk_190C;
+
+ if (actor->unk_026 >= new_var) {
+ temp_v0_6 = &temp_v0_6[(void)0, actor->unk_026];
+ if (temp_v0_6->unk_50 > 0) {
+ actor->unk_026 = -1;
+ temp_v0_6->unk_50--;
+ }
+ }
+ break;
+ }
+}
+#else
+void Actor_dt(Actor* actor, struct PlayState* play);
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_actor/Actor_dt.s")
+#endif
+
+void Actor_draw(PlayState* play, Actor* actor) {
+ FaultClient faultClient;
+ Lights* light;
+
+ Fault_AddClient(&faultClient, func_80056380_jp, actor, "Actor_draw");
+
+ //! FAKE
+ if (1) {}
+ if (1) {}
+ if (1) {}
+ if (1) {}
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ light = Global_light_read(&play->lightCtx, play->state.gfxCtx);
+ LightsN_list_check(light, play->lightCtx.unk_0, (actor->flags & ACTOR_FLAG_400000) ? NULL : &actor->world.pos);
+ LightsN_disp(light, play->state.gfxCtx);
+
+ Matrix_softcv3_load(actor->world.pos.x, actor->world.pos.y + actor->shape.unk_08 * actor->scale.y,
+ actor->world.pos.z, &actor->shape.rot);
+ Matrix_scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
+
+ {
+ void* segment = play->unk_0110[(void)0, actor->unk_026].segment;
+
+ gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment);
+
+ gSPSegment(POLY_OPA_DISP++, 0x06, segment);
+ gSPSegment(POLY_XLU_DISP++, 0x06, segment);
+ gSPSegment(UNK_2C0_DISP++, 0x06, segment);
+ }
+
+ actor->draw(actor, play);
+
+ if (actor->shape.unk_0C != NULL) {
+ actor->shape.unk_0C(actor, light, play);
+ }
+
+ CLOSE_DISPS(play->state.gfxCtx);
+
+ Fault_RemoveClient(&faultClient);
+}
+
+s32 Actor_draw_actor_no_culling_check(Actor* actor) {
+ return Actor_draw_actor_no_culling_check2(actor, &actor->projectedPos, actor->projectedW);
+}
+
+s32 Actor_draw_actor_no_culling_check2(Actor* actor, Vec3f* arg1, f32 arg2) {
+ s32 ret = 0;
+
+ if ((-actor->unk_140 < arg1->z) && (arg1->z < (actor->unk_13C + actor->unk_140))) {
+ f32 var_fa1;
+
+ if (arg2 < 1.0f) {
+ var_fa1 = 1.0f;
+ } else {
+ var_fa1 = 1.0f / arg2;
+ }
+
+ if (((fabsf(arg1->x) - actor->uncullZoneScale) * var_fa1) < 1.0f) {
+ if (((arg1->y + actor->uncullZoneDownward) * var_fa1) > -1.0f) {
+ if (((arg1->y - actor->unk_140) * var_fa1) < 1.0f) {
+ ret = 1;
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+void Actor_cull_check(Actor* actor) {
+ if (Actor_draw_actor_no_culling_check(actor) == 1) {
+ actor->flags |= ACTOR_FLAG_40;
+ } else {
+ actor->flags &= ~ACTOR_FLAG_40;
+ }
+}
+
+void Actor_delete_check(Actor* actor, PlayState* play) {
+ if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_20 | ACTOR_FLAG_10)) || (actor->fgName == 0)) {
+ return;
+ }
+
+ if ((actor->unk_008 < 0) || (actor->unk_009 < 0)) {
+ return;
+ }
+
+ if ((actor->unk_008 == play->unk_00E4) && (actor->unk_009 == play->unk_00E5)) {
+ return;
+ }
+
+ Actor_delete(actor);
+}
+
+void Actor_info_ct(PlayState* play2, ActorInfo* actorInfo, ActorEntry* actorEntry) {
+ PlayState* play = play2;
+ Actor* temp_v0;
+ ActorOverlay* var_v0;
+ ActorEntry* var_s0_2;
+ s16* var_s0;
+ s32 var_s1;
+
+ bzero(actorInfo, sizeof(ActorInfo));
+
+ actor_dlftbls_init();
+ Matrix_copy_MtxF(&play->billboardMtxF, &MtxF_clear);
+ Matrix_copy_MtxF(&play->viewProjectionMtxF, &MtxF_clear);
+
+ var_v0 = actor_dlftbls;
+ for (var_s1 = 0; var_s1 < 0xC9; var_s1++) {
+ var_v0->loadedRamAddr = NULL;
+ var_v0->numLoaded = 0;
+ var_v0++;
+ }
+
+ if (mEv_CheckFirstJob() == 1) {
+ common_data.unk_107B6 = 0x5B;
+ }
+
+ if (common_data.unk_107B6 != 0xC9) {
+ Actor_info_make_actor(actorInfo, play, common_data.unk_107B6, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
+ -1);
+ }
+ common_data.unk_107B6 = 0xC9;
+
+label:
+
+ temp_v0 = Actor_info_make_actor(actorInfo, play, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y,
+ actorEntry->pos.z, actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, -1, -1,
+ -1, 0, actorEntry->params, -1, -1);
+ if (temp_v0 != NULL) {
+ temp_v0->world.pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(temp_v0->world.pos, 0.0f);
+ mFI_SetBearActor(play, temp_v0->world.pos, 0);
+ }
+
+ if (common_data.unk_1014E != 0) {
+ Actor_info_make_actor(actorInfo, play, common_data.unk_1014E, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
+ -1);
+ }
+
+ if (play->unk_1EA6 != 0) {
+ var_s0 = play->unk_1EB0;
+
+ for (var_s1 = 0; var_s1 < play->unk_1EA6; var_s1++) {
+ Actor_info_make_actor(&play->actorInfo, play, *var_s0, 0.0f, 0.0f, 0.0f, 0, 0, 0, -1, -1, -1, 0, -1, -1,
+ -1);
+ var_s0 += 1;
+ }
+ play->unk_1EA6 = 0;
+ }
+
+ mSc_regist_initial_exchange_bank(play);
+
+ if (play->unk_1EA5 != 0) {
+ var_s0_2 = play->unk_1EAC;
+ for (var_s1 = 0; var_s1 < play->unk_1EA5; var_s1++) {
+ Actor_info_make_actor(&play->actorInfo, play, var_s0_2->id, var_s0_2->pos.x, var_s0_2->pos.y,
+ var_s0_2->pos.z, var_s0_2->rot.x, var_s0_2->rot.y, var_s0_2->rot.z, -1, -1, -1, 0,
+ var_s0_2->params, -1, -1);
+ var_s0_2 += 1;
+ }
+ play->unk_1EA5 = 0;
+ }
+}
+
+void Actor_info_dt(ActorInfo* actorInfo, PlayState* play) {
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(actorInfo->actorLists); i++) {
+ Actor* actor = actorInfo->actorLists[i].head;
+
+ while (actor != NULL) {
+ Actor_info_delete(actorInfo, actor, play);
+ actor = actorInfo->actorLists[i].head;
+ }
+ }
+
+ actor_dlftbls_cleanup();
+}
+
+void Actor_info_call_actor(PlayState* play, ActorInfo* actorInfo) {
+ s32 pad[1] UNUSED;
+ ActorPart part;
+ Player* player;
+
+ player = get_player_actor_withoutCheck(play);
+ func_8008E5F4_jp(player->actor.world.pos);
+
+ for (part = 0; part < ACTOR_PART_MAX; part++) {
+ Actor* actor;
+ Actor* next;
+
+ for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = next) {
+ play->state.unk_9C = actor->name;
+ play->state.unk_9D = 0x97;
+
+ if (actor->world.pos.y < -25000.0f) {
+ actor->world.pos.y = -25000.0f;
+ }
+
+ if (actor->ct != NULL) {
+ if (Actor_data_bank_dma_end_check(actor, play) == 1) {
+ gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_0110[actor->unk_026].segment);
+
+ play->state.unk_9D = 0x98;
+ actor->ct(actor, play);
+ play->state.unk_9D = 0x99;
+ actor->ct = NULL;
+ }
+ next = actor->next;
+ } else if (Actor_data_bank_dma_end_check(actor, play) == 0) {
+ play->state.unk_9D = 0x9A;
+ Actor_delete(actor);
+ play->state.unk_9D = 0x9B;
+ next = actor->next;
+ } else if (actor->update == NULL) {
+ if (!actor->isDrawn) {
+ play->state.unk_9D = 0x9C;
+ next = Actor_info_delete(&play->actorInfo, actor, play);
+ play->state.unk_9D = 0x9D;
+ } else {
+ play->state.unk_9D = 0x9E;
+ Actor_dt(actor, play);
+ play->state.unk_9D = 0x9F;
+ next = actor->next;
+ }
+ } else {
+ play->state.unk_9D = 0xA0;
+ xyz_t_move(&actor->prevPos, &actor->world.pos);
+
+ actor->xzDistToPlayer = search_position_distanceXZ(&actor->world.pos, &player->actor.world.pos);
+ actor->playerHeightRel = player->actor.world.pos.y - actor->world.pos.y;
+
+ actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->playerHeightRel);
+ actor->yawTowardsPlayer = search_position_angleY(&actor->world.pos, &player->actor.world.pos);
+
+ actor->flags &= ~ACTOR_FLAG_1000000;
+ if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_10)) || (actor->part == ACTOR_PART_NPC)) {
+ gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_0110[actor->unk_026].segment);
+ play->state.unk_9D = 0xA1;
+ actor->update(actor, play);
+ play->state.unk_9D = 0xA2;
+ }
+
+ CollisionCheck_Status_Clear(&actor->colStatus);
+ next = actor->next;
+ }
+ }
+ }
+
+ play->state.unk_9D = 0xA3;
+}
+
+void Actor_info_draw_actor(PlayState* play, ActorInfo* actorInfo) {
+ PlayState_unk_2208 temp_s4 = play->unk_2208;
+ ActorListEntry* actorEntry = actorInfo->actorLists;
+ ActorPart part = 0;
+
+ if (1) {}
+
+ for (; part < ACTOR_PART_MAX; part++, actorEntry++) {
+ Actor* actor;
+
+ for (actor = actorEntry->head; actor != NULL; actor = actor->next) {
+ s32 temp;
+
+ Skin_Matrix_PrjMulVector(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos,
+ &actor->projectedW);
+ Actor_cull_check(actor);
+
+ temp = temp_s4(actor, play);
+ actor->isDrawn = false;
+
+ if (temp != 0) {
+ continue;
+ }
+
+ if ((actor->ct != NULL) || (actor->draw == NULL)) {
+ continue;
+ }
+
+ if (actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_20)) {
+ if (!(actor->flags & ACTOR_FLAG_80) && (actor->unk_148 == 0) && (actor->unk_149 == 0)) {
+ Actor_draw(play, actor);
+ actor->isDrawn = true;
+ }
+ } else {
+ Actor_delete_check(actor, play);
+ }
+ }
+ }
+
+ if (debug_mode->r[0x380] == 0) {
+ Light_list_point_draw(play);
+ }
+}
+
+void Actor_info_part_new(ActorInfo* actorInfo, Actor* actor, u8 category) {
+ Actor* temp_v1;
+
+ actor->part = category;
+
+ actorInfo->unk_00++;
+
+ actorInfo->actorLists[category].unk_0++;
+ temp_v1 = actorInfo->actorLists[category].head;
+ if (temp_v1 != NULL) {
+ temp_v1->prev = actor;
+ }
+
+ actorInfo->actorLists[category].head = actor;
+ actor->next = temp_v1;
+}
+
+Actor* Actor_info_part_delete(ActorInfo* actorInfo, Actor* actor) {
+ Actor* newHead;
+
+ actorInfo->unk_00--;
+
+ actorInfo->actorLists[actor->part].unk_0--;
+
+ if (actor->prev != NULL) {
+ actor->prev->next = actor->next;
+ } else {
+ actorInfo->actorLists[actor->part].head = actor->next;
+ }
+
+ newHead = actor->next;
+ if (newHead != NULL) {
+ newHead->prev = actor->prev;
+ }
+
+ actor->prev = NULL;
+ actor->next = NULL;
+
+ return newHead;
+}
+
+void Actor_free_overlay_area(ActorOverlay* overlayEntry) {
+ if (!(overlayEntry->allocType & ALLOCTYPE_PERMANENT)) {
+ if (overlayEntry->allocType & ALLOCTYPE_ABSOLUTE) {
+ overlayEntry->loadedRamAddr = NULL;
+ } else {
+ zelda_free(overlayEntry->loadedRamAddr);
+ overlayEntry->loadedRamAddr = NULL;
+ }
+ }
+}
+
+void actor_free_check(ActorOverlay* overlayEntry, u16 fgName) {
+ if ((overlayEntry->numLoaded == 0) && (overlayEntry->loadedRamAddr != NULL)) {
+ switch (ACTOR_FGNAME_GET_F000(fgName)) {
+ case FGNAME_F000_D:
+ case FGNAME_F000_E:
+ common_data.unk_1004C->unk_08();
+ break;
+
+ case FGNAME_F000_5:
+ common_data.unk_10098->unk_08();
+ break;
+
+ default:
+ Actor_free_overlay_area(overlayEntry);
+ break;
+ }
+ }
+}
+
+void Actor_get_overlay_area(ActorOverlay* overlayEntry, const struct_801161E8_jp* arg1 UNUSED, size_t overlaySize) {
+ if (overlayEntry->allocType & ALLOCTYPE_PERMANENT) {
+ overlayEntry->loadedRamAddr = zelda_malloc_r(overlaySize);
+ } else {
+ overlayEntry->loadedRamAddr = zelda_malloc(overlaySize);
+ }
+}
+
+s32 func_80057940_jp(ActorProfile** profileP, ActorOverlay* overlayEntry, const struct_801161E8_jp* arg2,
+ size_t overlaySize, u16 fgName) {
+ if (overlayEntry->vramStart == NULL) {
+ *profileP = overlayEntry->profile;
+ } else {
+ if (overlayEntry->loadedRamAddr == NULL) {
+ switch (ACTOR_FGNAME_GET_F000(fgName)) {
+ case FGNAME_F000_D:
+ case FGNAME_F000_E:
+ if (common_data.unk_1004C != NULL) {
+ common_data.unk_1004C->unk_04(overlayEntry, arg2, overlaySize, fgName);
+ } else {
+ overlayEntry->loadedRamAddr = NULL;
+ }
+ break;
+
+ case FGNAME_F000_5:
+ if (common_data.unk_10098 != NULL) {
+ common_data.unk_10098->unk_4(overlayEntry, overlaySize);
+ }
+ break;
+
+ default:
+ Actor_get_overlay_area(overlayEntry, arg2, overlaySize);
+ break;
+ }
+
+ if (overlayEntry->loadedRamAddr == NULL) {
+ return 0;
+ }
+
+ ovlmgr_Load(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd,
+ overlayEntry->loadedRamAddr);
+ overlayEntry->numLoaded = 0;
+ }
+
+ *profileP = (void*)(uintptr_t)((overlayEntry->profile != NULL)
+ ? (void*)((uintptr_t)overlayEntry->profile -
+ (intptr_t)((uintptr_t)overlayEntry->vramStart -
+ (uintptr_t)overlayEntry->loadedRamAddr))
+ : NULL);
+ }
+
+ return 1;
+}
+
+// this function may be Actor_data_bank_regist_check_npc
+s32 func_80057A8C_jp(s32* arg0, ActorProfile* profile UNUSED, ActorOverlay* overlayEntry, PlayState* play, u16 fgName) {
+ s32 pad UNUSED;
+ s16 sp92;
+ s16 sp90;
+ s32 temp_v0;
+ s32 ret;
+
+ ret = 1;
+
+ {
+ CommonData_unk_1004C_unk_14_arg0 sp24;
+
+ common_data.unk_1004C->unk_14(&sp24, fgName);
+
+ sp92 = sp24.unk_00;
+ sp90 = sp24.unk_02;
+ }
+
+ *arg0 = mSc_bank_regist_check(play->unk_0110, sp92);
+ temp_v0 = mSc_bank_regist_check(play->unk_0110, sp90);
+
+ if ((*arg0 < 0) || (temp_v0 < 0)) {
+ if (*arg0 >= 0) {
+ sp92 = 0;
+ }
+ if (temp_v0 >= 0) {
+ sp90 = 0;
+ }
+ common_data.unk_1004C->unk_EC(play->unk_0110, sp92, sp90);
+ actor_free_check(overlayEntry, fgName);
+ ret = 0;
+ }
+ return ret;
+}
+
+s32 func_80057B70_jp(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play, u16 fgName) {
+ s32 pad UNUSED;
+ s32 ret = 1;
+
+ *arg0 = mSc_bank_regist_check(play->unk_0110, profile->objectId);
+
+ if (*arg0 == -1) {
+ func_800C6144_jp(play->unk_0110, profile->objectId);
+ actor_free_check(overlayEntry, fgName);
+ ret = 0;
+ }
+
+ return ret;
+}
+
+s32 Actor_data_bank_regist_check(s32* arg0, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play,
+ u16 fgName) {
+ s32 var_v1 = 1;
+
+ if (*arg0 == -1) {
+ if (profile->part == ACTOR_PART_NPC) {
+ var_v1 = func_80057A8C_jp(arg0, profile, overlayEntry, play, fgName);
+ } else {
+ var_v1 = func_80057B70_jp(arg0, profile, overlayEntry, play, fgName);
+ }
+ }
+ return var_v1;
+}
+
+s32 Actor_malloc_actor_class(Actor** actorP, ActorProfile* profile, ActorOverlay* overlayEntry,
+ const struct_801161E8_jp* arg3, u16 fgName) {
+ CommonData_unk_1004C_unk_14_arg0 sp24;
+
+ switch (ACTOR_FGNAME_GET_F000(fgName)) {
+ case FGNAME_F000_D:
+ case FGNAME_F000_E:
+ *actorP = common_data.unk_1004C->unk_0C(profile->instanceSize, arg3, 1);
+
+ //! FAKE
+ if ((profile != NULL) && (profile != NULL) && (profile != NULL)) {}
+
+ common_data.unk_1004C->unk_14(&sp24, fgName);
+ break;
+
+ case FGNAME_F000_5:
+ *actorP = common_data.unk_10098->unk_0C();
+ break;
+
+ default:
+ *actorP = zelda_malloc(profile->instanceSize);
+ break;
+ }
+
+ if (*actorP == NULL) {
+ actor_free_check(overlayEntry, fgName);
+ return 0;
+ }
+ return 1;
+}
+
+void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* overlayEntry, PlayState* play, s32 arg4,
+ f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 argB, s8 argC, s16 argD, u16 fgName,
+ s16 params) {
+ mem_clear(actor, profile->instanceSize, 0);
+
+ actor->overlayEntry = overlayEntry;
+
+ actor->name = profile->name;
+ actor->flags = profile->flags;
+
+ actor->unk_026 = arg4;
+
+ actor->ct = profile->ct;
+ actor->dt = profile->dt;
+ actor->update = profile->update;
+ actor->draw = profile->draw;
+ actor->save = profile->save;
+
+ actor->params = params;
+
+ actor->unk_004 = play->unk_00E0;
+
+ actor->home.pos.x = x;
+ actor->home.pos.y = y;
+ actor->home.pos.z = z;
+ actor->home.rot.x = rotX;
+ actor->home.rot.y = rotY;
+ actor->home.rot.z = rotZ;
+
+ actor->unk_008 = argB;
+ actor->unk_009 = argC;
+ actor->unk_00A = argD;
+ actor->fgName = fgName;
+}
+
+extern const struct_801161E8_jp RO_801161E8_jp;
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_actor/RO_801161E8_jp.s")
+
+Actor* Actor_info_make_actor(ActorInfo* actorInfo, PlayState* play, s16 actorId, f32 x, f32 y, f32 z, s16 rotX,
+ s16 rotY, s16 rotZ, s8 arg9, s8 argA, s16 argB, u16 fgName, s16 params, s8 argE,
+ s32 argF) {
+ u16* new_var = &fgName;
+ Actor* sp68;
+ ActorProfile* profile;
+ ActorOverlay* temp_s0 = &actor_dlftbls[actorId];
+ size_t size = (uintptr_t)temp_s0->vramEnd - (uintptr_t)temp_s0->vramStart;
+
+ if (actorInfo->unk_00 >= 0xC9) {
+ return NULL;
+ }
+
+ if (func_80057940_jp(&profile, temp_s0, &RO_801161E8_jp, size, *new_var) == 0) {
+ return NULL;
+ }
+ if (Actor_data_bank_regist_check(&argF, profile, temp_s0, play, fgName) == 0) {
+ return NULL;
+ }
+ if (Actor_malloc_actor_class(&sp68, profile, temp_s0, &RO_801161E8_jp, fgName) == 0) {
+ return NULL;
+ }
+
+ temp_s0->numLoaded++;
+ Actor_init_actor_class(sp68, profile, temp_s0, play, argF, x, y, z, rotX, rotY, rotZ, arg9, argA, argB, fgName,
+ params);
+
+ Actor_info_part_new(actorInfo, sp68, profile->part);
+
+ mNpc_SetNpcinfo(sp68, argE);
+
+ {
+ uintptr_t segmentTemp;
+
+ segmentTemp = gSegments[6];
+ Actor_ct(sp68, play);
+ gSegments[6] = segmentTemp;
+ }
+
+ return sp68;
+}
+
+Actor* Actor_info_make_child_actor(ActorInfo* actorInfo, Actor* arg1, PlayState* play, s16 actorId, f32 x, f32 y, f32 z,
+ s16 rotX, s16 rotY, s16 rotZ, s16 argA, u16 fgName, s16 params, s32 argD) {
+ Actor* temp_v0 = Actor_info_make_actor(actorInfo, play, actorId, x, y, z, rotX, rotY, rotZ, -1, -1, argA, fgName,
+ params, -1, argD);
+
+ if (temp_v0 != NULL) {
+ arg1->child = temp_v0;
+ temp_v0->parent = arg1;
+ }
+
+ return temp_v0;
+}
+
+void restore_fgdata(Actor* actor, PlayState* play UNUSED) {
+ Vec3f sp34;
+
+ if ((actor->fgName == 0) || (actor->unk_00A != -1)) {
+ return;
+ }
+
+ if ((actor->unk_008 < 0) || (actor->unk_009 < 0)) {
+ return;
+ }
+
+ switch (ACTOR_FGNAME_GET_F000(actor->fgName)) {
+ case FGNAME_F000_8:
+ xyz_t_move(&sp34, &actor->home.pos);
+ if (func_8008B3E8_jp(&sp34, 0) == 1) {
+ mFI_SetFG_common(actor->fgName, sp34, 0);
+ }
+ break;
+
+ default:
+ mFI_SetFG_common(actor->fgName, actor->home.pos, 0);
+ break;
+ }
+}
+
+s32 restore_flag[ACTOR_PART_MAX] = {
+ 1, // ACTOR_PART_0
+ 1, // ACTOR_PART_1
+ 0, // ACTOR_PART_PLAYER
+ 0, // ACTOR_PART_NPC
+ 0, // ACTOR_PART_4
+ 0, // ACTOR_PART_5
+ 0, // ACTOR_PART_6
+ 0, // ACTOR_PART_7
+};
+
+void restore_fgdata_one(Actor* actor, PlayState* play) {
+ if (restore_flag[actor->part] == 1) {
+ restore_fgdata(actor, play);
+ } else if (actor->unk_003 == 1) {
+ restore_fgdata(actor, play);
+ }
+}
+
+void restore_fgdata_all(PlayState* play) {
+ ActorInfo* actorInfo = &play->actorInfo;
+ ActorPart part;
+
+ for (part = 0; part < ACTOR_PART_MAX; part++) {
+ Actor* actor;
+
+ if (restore_flag[part] == 1) {
+ for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
+ restore_fgdata(actor, play);
+ }
+ } else {
+ for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
+ if (actor->unk_003 == 1) {
+ restore_fgdata(actor, play);
+ }
+ }
+ }
+ }
+}
+
+void Actor_info_save_actor(PlayState* play) {
+ ActorInfo* actorInfo = &play->actorInfo;
+ ActorPart part;
+
+ for (part = 0; part < ACTOR_PART_MAX; part++) {
+ Actor* actor;
+
+ for (actor = actorInfo->actorLists[part].head; actor != NULL; actor = actor->next) {
+ if (actor->save != NULL) {
+ actor->save(actor, play);
+ actor->save = NULL;
+ }
+ }
+ }
+
+ restore_fgdata_all(play);
+}
+
+Actor* Actor_info_delete(ActorInfo* actorInfo, Actor* actor, PlayState* play) {
+ Actor* newHead;
+ s32 pad UNUSED;
+ ActorOverlay* overlayEntry;
+ s32 fgName = actor->fgName;
+
+ overlayEntry = actor->overlayEntry;
+
+ restore_fgdata_one(actor, play);
+ Actor_dt(actor, play);
+
+ newHead = Actor_info_part_delete(actorInfo, actor);
+
+ switch (ACTOR_FGNAME_GET_F000(fgName)) {
+ case FGNAME_F000_D:
+ case FGNAME_F000_E:
+ common_data.unk_1004C->unk_10(actor);
+ break;
+
+ case FGNAME_F000_5:
+ common_data.unk_10098->unk_10(actor);
+ break;
+
+ default:
+ zelda_free(actor);
+ break;
+ }
+
+ if (overlayEntry->vramStart != NULL) {
+ overlayEntry->numLoaded--;
+ actor_free_check(overlayEntry, actor->fgName);
+ }
+
+ return newHead;
+}
+
+Actor* Actor_info_name_search_sub(Actor* actor, s16 name) {
+ for (; actor != NULL; actor = actor->next) {
+ if (name == actor->name) {
+ break;
+ }
+ }
+ return actor;
+}
+
+Actor* Actor_info_name_search(ActorInfo* actorInfo, s16 name, ActorPart part) {
+ Actor* head = actorInfo->actorLists[part].head;
+
+ if (head != NULL) {
+ return Actor_info_name_search_sub(head, name);
+ }
+ return NULL;
+}
+
+Actor* Actor_info_fgName_search_sub(Actor* actor, u16 fgName) {
+ for (; actor != NULL; actor = actor->next) {
+ if (actor->fgName == fgName) {
+ break;
+ }
+ }
+
+ return actor;
+}
+
+Actor* Actor_info_fgName_search(ActorInfo* actorInfo, u16 fgName, ActorPart part) {
+ Actor* head = actorInfo->actorLists[part].head;
+
+ if (head != NULL) {
+ return Actor_info_fgName_search_sub(head, fgName);
+ }
+ return NULL;
+}
+
+// unused
+void Part_Break_init(Part_Break* partBreak, s32 count, s32 arg2 UNUSED) {
+ size_t matricesSize;
+ size_t dListsSize;
+ size_t objectIdsSize;
+
+ matricesSize = (count + 1) * sizeof(MtxF);
+ partBreak->matrices = zelda_malloc(matricesSize);
+ if (partBreak->matrices == NULL) {
+ goto cleanup;
+ }
+
+ dListsSize = (count + 1) * sizeof(Gfx*);
+ partBreak->dLists = zelda_malloc(dListsSize);
+ if (partBreak->dLists == NULL) {
+ goto cleanup;
+ }
+
+ objectIdsSize = (count + 1) * sizeof(s16);
+ partBreak->objectIds = zelda_malloc(objectIdsSize);
+ if (partBreak->objectIds == NULL) {
+ goto cleanup;
+ }
+
+ mem_clear(partBreak->matrices, matricesSize, 0);
+ mem_clear(partBreak->dLists, dListsSize, 0);
+ mem_clear(partBreak->objectIds, objectIdsSize, 0);
+
+ partBreak->val = 1;
+ return;
+
+cleanup:
+ if (partBreak->matrices != NULL) {
+ zelda_free(partBreak->matrices);
+ }
+ if (partBreak->dLists != NULL) {
+ zelda_free(partBreak->dLists);
+ }
+ if (partBreak->objectIds != NULL) {
+ zelda_free(partBreak->objectIds);
+ }
+}
+
+Mtx B_8011B850_jp;
+
+Gfx* HiliteReflect_new(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite) {
+ LookAt* sp64 = GRAPH_ALLOC(gfxCtx, sizeof(LookAt));
+ f32 var_fa1 = ((eye->x == object->x) && (eye->z == object->z)) ? (eye->x + 0.001f) : eye->x;
+
+ *hilite = GRAPH_ALLOC(gfxCtx, sizeof(Hilite));
+
+ guLookAtHilite(&B_8011B850_jp, sp64, *hilite, var_fa1, eye->y, eye->z, object->x, object->y, object->z, 0.0f, 1.0f,
+ 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 0x10, 0x10);
+
+ gSPLookAt(gfx++, sp64);
+
+ gDPPipeSync(gfx++);
+ gDPSetHilite1Tile(gfx++, 1, *hilite, 0x10, 0x10);
+
+ return gfx;
+}
+
+Hilite* HiliteReflect_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
+ Hilite* hilite;
+
+ OPEN_DISPS(gfxCtx);
+
+ POLY_OPA_DISP = HiliteReflect_new(object, eye, lightDir, gfxCtx, POLY_OPA_DISP, &hilite);
+
+ CLOSE_DISPS(gfxCtx);
+
+ return hilite;
+}
+
+Hilite* HiliteReflect_xlu_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
+ Hilite* hilite;
+
+ OPEN_DISPS(gfxCtx);
+
+ POLY_XLU_DISP = HiliteReflect_new(object, eye, lightDir, gfxCtx, POLY_XLU_DISP, &hilite);
+
+ CLOSE_DISPS(gfxCtx);
+
+ return hilite;
+}
+
+Hilite* HiliteReflect_light_init(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) {
+ Hilite* hilite;
+
+ OPEN_DISPS(gfxCtx);
+
+ LIGHT_DISP = HiliteReflect_new(object, eye, lightDir, gfxCtx, LIGHT_DISP, &hilite);
+
+ CLOSE_DISPS(gfxCtx);
+
+ return hilite;
+}
+
+Hilite* Setpos_HiliteReflect_init(Vec3f* object, PlayState* play) {
+ Vec3f sp24;
+
+ sp24.x = play->kankyo.unk_02;
+ sp24.y = play->kankyo.unk_03;
+ sp24.z = play->kankyo.unk_04;
+ return HiliteReflect_init(object, &play->unk_1960, &sp24, play->state.gfxCtx);
+}
+
+Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, PlayState* play) {
+ Vec3f sp24;
+
+ sp24.x = play->kankyo.unk_02;
+ sp24.y = play->kankyo.unk_03;
+ sp24.z = play->kankyo.unk_04;
+ return HiliteReflect_xlu_init(object, &play->unk_1960, &sp24, play->state.gfxCtx);
+}
+
+Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, PlayState* play) {
+ Vec3f sp24;
+
+ sp24.x = play->kankyo.unk_02;
+ sp24.y = play->kankyo.unk_03;
+ sp24.z = play->kankyo.unk_04;
+ return HiliteReflect_xlu_init(object, &play->unk_1960, &sp24, play->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_player_actor/m_player.h b/src/overlays/actors/ovl_player_actor/m_player.h
new file mode 100644
index 0000000..898def3
--- /dev/null
+++ b/src/overlays/actors/ovl_player_actor/m_player.h
@@ -0,0 +1,13 @@
+#ifndef M_PLAYER_H
+#define M_PLAYER_H
+
+#include "ultra64.h"
+#include "m_actor.h"
+#include "unk.h"
+
+typedef struct Player {
+ /* 0x0000 */ Actor actor;
+ /* 0x0174 */ UNK_TYPE1 unk_0174[0x1164];
+} Player; // size = 0x12D8
+
+#endif
diff --git a/src/overlays/gamestates/ovl_play/m_play.h b/src/overlays/gamestates/ovl_play/m_play.h
index 9cc4c11..4b2545e 100644
--- a/src/overlays/gamestates/ovl_play/m_play.h
+++ b/src/overlays/gamestates/ovl_play/m_play.h
@@ -3,11 +3,52 @@
#include "ultra64.h"
#include "game.h"
+#include "m_actor.h"
+#include "m_kankyo.h"
+#include "m_lights.h"
+#include "z64math.h"
+#include "unknown_structs.h"
#include "unk.h"
+struct Actor;
+struct ActorEntry;
+struct PlayState;
+
+typedef void (*PlayState_unk_1C58)(struct Actor*);
+typedef UNK_RET (*PlayState_unk_2208)(struct Actor*, struct PlayState*);
+
typedef struct PlayState {
- /* 0x00 */ GameState state;
- /* 0xE0 */ UNK_TYPE1 unk_00[0x2410 - 0xE0];
+ /* 0x0000 */ GameState state;
+ /* 0x00E0 */ s16 unk_00E0;
+ /* 0x00E2 */ UNK_TYPE1 unk_00E2[0x2];
+ /* 0x00E4 */ s8 unk_00E4;
+ /* 0x00E5 */ s8 unk_00E5;
+ /* 0x00E6 */ UNK_TYPE1 unk_00E6[0x2];
+ /* 0x00E8 */ UNK_TYPE1 unk_00E8[0x28];
+ /* 0x0110 */ PlayState_unk_0110 unk_0110[UNK_SIZE];
+ /* 0x0164 */ UNK_TYPE1 unk_0164[0x17A8];
+ /* 0x190C */ s32 unk_190C;
+ /* 0x1910 */ UNK_TYPE1 unk_1910[0x50];
+ /* 0x1960 */ Vec3f unk_1960;
+ /* 0x196C */ UNK_TYPE1 unk_196C[0x22C];
+ /* 0x1B98 */ Kankyo kankyo;
+ /* 0x1C60 */ LightContext lightCtx;
+ /* 0x1C64 */ UNK_TYPE1 unk_1C64[0x14];
+ /* 0x1C78 */ ActorInfo actorInfo;
+ /* 0x1CBC */ UNK_TYPE1 unk_1CBC[0x160];
+ /* 0x1E1C */ MtxF viewProjectionMtxF;
+ /* 0x1E5C */ MtxF billboardMtxF;
+ /* 0x1E9C */ UNK_TYPE1 unk_1E9C[0x8];
+ /* 0x1EA4 */ UNK_TYPE1 unk_1EA4[0x1];
+ /* 0x1EA5 */ u8 unk_1EA5;
+ /* 0x1EA6 */ u8 unk_1EA6;
+ /* 0x1EA7 */ UNK_TYPE1 unk_1EA7[0x1];
+ /* 0x1EA8 */ UNK_TYPE1 unk_1EA8[0x4];
+ /* 0x1EAC */ struct ActorEntry *unk_1EAC;
+ /* 0x1EB0 */ s16 *unk_1EB0;
+ /* 0x1EB4 */ UNK_TYPE1 unk_1EB4[0x354];
+ /* 0x2208 */ PlayState_unk_2208 unk_2208;
+ /* 0x220C */ UNK_TYPE1 unk_220C[0x204];
} PlayState; // size = 0x2410
void play_init(GameState *thisx);
diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml
index f91c9cb..3964bdb 100644
--- a/tools/permuter_settings.toml
+++ b/tools/permuter_settings.toml
@@ -11,6 +11,12 @@ NULL = "int"
"G_[AC]C.*" = "int"
OPEN_DISPS = "void"
CLOSE_DISPS = "void"
+OVERLAY_DISP = "int"
+POLY_OPA_DISP = "int"
+POLY_XLU_DISP = "int"
+UNK_2B0_DISP = "int"
+UNK_2C0_DISP = "int"
+LIGHT_DISP = "int"
[decompme.compilers]
"tools/ido/linux/7.1/cc" = "ido7.1"
diff --git a/yamls/jp/code.yaml b/yamls/jp/code.yaml
index 40d7d58..4bd2177 100644
--- a/yamls/jp/code.yaml
+++ b/yamls/jp/code.yaml
@@ -9,7 +9,7 @@
- [0x675720, c, code/c_keyframe]
- [0x678660, asm, code/evw_anime]
- [0x6792F0, asm, code/6792F0]
- - [0x67A020, asm, code/m_actor]
+ - [0x67A020, c, code/m_actor]
- [0x67C6B0, c, code/m_actor_dlftbls]
- [0x67C890, asm, code/m_actor_shadow]
- [0x67D890, asm, code/67D890]
@@ -19,7 +19,7 @@
- [0x68AAF0, asm, code/68AAF0]
- [0x68AB30, asm, code/68AB30]
- [0x68B0D0, asm, code/m_collision_bg]
- - [0x69A7E0, asm, code/69A7E0]
+ - [0x69A7E0, asm, code/m_collision_obj]
- [0x69C6B0, c, code/m_common_data]
- [0x69C770, c, code/m_controller]
- [0x69CB30, asm, code/69CB30]
@@ -42,6 +42,7 @@
- [0x6B8F20, asm, code/6B8F20]
- [0x6BA3B0, asm, code/m_item_name]
- [0x6BA500, asm, code/6BA500]
+ - [0x6BA930, asm, code/m_kankyo]
- [0x6BD560, asm, code/m_lib]
- [0x6BEE80, asm, code/m_lights]
- [0x6BFC60, c, code/m_malloc]
@@ -131,6 +132,7 @@
- [0x723010, data, code/rsp/723010]
- [0x7248D0, data, code/7248D0]
+ - [0x724910, .data, code/m_actor]
- [0x724930, .data, code/m_actor_dlftbls]
- [0x726260, data, code/m_actor_shadow]
- [0x7262C0, data, code/7262C0]
@@ -149,8 +151,7 @@
- [0x739DB0, .rodata, code/c_keyframe]
- [0x739E00, rodata, code/739E00]
- - [0x739E50, rodata, code/m_actor]
- - [0x739E90, rodata, code/739E90]
+ - [0x739E50, .rodata, code/m_actor]
- [0x739EA0, .rodata, code/m_actor_dlftbls]
- [0x739EF0, rodata, code/739EF0]
- [0x739F20, rodata, code/739F20]
@@ -158,7 +159,7 @@
- [0x739FA0, rodata, code/739FA0]
- [0x73A080, rodata, code/73A080]
- [0x73A0F0, rodata, code/73A0F0]
- - [0x73A480, rodata, code/73A480]
+ - [0x73A480, rodata, code/m_collision_obj]
- [0x73A490, .rodata, code/m_controller]
- [0x73A4A0, rodata, code/73A4A0]
- [0x73A4D0, rodata, code/73A4D0]
@@ -177,7 +178,7 @@
- [0x73AD40, rodata, code/73AD40]
- [0x73AD50, rodata, code/73AD50]
- [0x73AD70, rodata, code/73AD70]
- - [0x73AD90, rodata, code/73AD90]
+ - [0x73AD90, rodata, code/m_kankyo]
- [0x73AED0, rodata, code/m_lib]
- [0x73AEE0, rodata, code/m_lights]
- [0x73AEF0, rodata, code/m_msg_main]
@@ -231,6 +232,7 @@
- [0x73CEE0, rodata, code/73CEE0]
- { start: 0x73F4D0, type: bss, vram: 0x8011B830, name: code/8011B830 }
+ - { start: 0x73F4D0, type: .bss, vram: 0x8011B850, name: code/m_actor }
- { start: 0x73F4D0, type: .bss, vram: 0x8011B890, name: code/m_actor_dlftbls }
- { start: 0x73F4D0, type: bss, vram: 0x8011B8B0, name: code/8011B8B0 }
- { start: 0x74AB40, type: .bss, vram: 0x80126EA0, name: code/m_common_data }
@@ -247,8 +249,6 @@
- { start: 0x73F4D0, type: bss, vram: 0x80143910, name: code/80143910 }
- { start: 0x73F4D0, type: .bss, vram: 0x80145390, name: code/irqmgr }
- { start: 0x73F4D0, type: bss, vram: 0x80145620, name: code/80145620}
- - { start: 0x73F4D0, type: .bss, vram: 0x801458A0, name: code/c_keyframe }
- - { start: 0x73F4D0, type: bss, vram: 0x801458B0, name: code/801458B0 }
- { start: 0x73F4D0, type: .bss, vram: 0x801462B0, name: code/sys_matrix }
- { start: 0x73F4D0, type: bss, vram: 0x801462C0, name: code/801462C0 }
- { start: 0x73F4D0, type: .bss, vram: 0x801492C0, name: code/zurumode }