summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorkuchenmitsahne <25233413+kuchenmitsahne@users.noreply.github.com>2024-11-27 13:46:58 -0500
committerGitHub <noreply@github.com>2024-11-27 11:46:58 -0700
commit7c055329a7a71f8652587cb7dc779ac3eb69f5d4 (patch)
tree0d91e8452b99087ccb0762be26946119ea6fbde6 /src/code
parentd38ac6a9d32e9b5c0e3caafbfc8d311a0f8f51f4 (diff)
ac_hanami_npc1 OK (#228)
* Rename symbols * First pass on struct Hanami_Npc1 * Actor funcs (ct, save, dt, init, draw) OK * Add trailing member to struct_809AEFA4 * Update Clip_unk_040_unk_E4 typedef to ActorFunc signature in order to unify *_actor_draw signatures * All talk functions and proc functions (minus aHM1_think_main_proc.s) OK * mFI_GetPuleIdx (func_8008930C_jp) OK; rename symbols (m_field_info) * aHM1_set_animation OK * aHM1_actor_move OK; update *_actor_move function signature to ActorFunc across project * aHM1_set_request_act, aHM1_check_moveRange OK * aHM1_check_inBlock OK; fix style in aHM1_check_moveRange * aHM1_turn, aHM1_walk, aHM1_set_spd_info OK * aHM1_think_init_proc OK * aHM1_revise_moveRange OK with fake (all functions matching) * Remove extraneous prototypes * Fix aHM1_think_main_proc signature * Import data * Fix aHM1_revise_moveRange signature * Standardize actor accesses * Improve define usage * Name blockX and blockZ members in Actor struct * Remove extraneous comments * mFI_BkNum2WposXZ OK (m_field_info) * Add defines to m_field_info * Formatting pass * Remove extraneous comments * Fix unk_18 type in struct_809AEFA4 --------- Co-authored-by: emilybrooks <emilybrooksemilybrooks@gmail.com>
Diffstat (limited to 'src/code')
-rw-r--r--src/code/m_actor.c12
-rw-r--r--src/code/m_field_info.c35
2 files changed, 37 insertions, 10 deletions
diff --git a/src/code/m_actor.c b/src/code/m_actor.c
index 53c22f9..8995617 100644
--- a/src/code/m_actor.c
+++ b/src/code/m_actor.c
@@ -322,11 +322,11 @@ void Actor_delete_check(Actor* actor, Game_Play* game_play) {
return;
}
- if ((actor->unk_008 < 0) || (actor->unk_009 < 0)) {
+ if ((actor->blockX < 0) || (actor->blockZ < 0)) {
return;
}
- if ((actor->unk_008 == game_play->unk_00E4) && (actor->unk_009 == game_play->unk_00E5)) {
+ if ((actor->blockX == game_play->unk_00E4) && (actor->blockZ == game_play->unk_00E5)) {
return;
}
@@ -761,7 +761,7 @@ s32 Actor_malloc_actor_class(Actor** actorP, ActorProfile* profile, ActorOverlay
}
void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* overlayEntry, Game_Play* game_play,
- s32 arg4, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 argB, s8 argC, s16 argD,
+ s32 arg4, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s8 blockX, s8 blockZ, s16 argD,
u16 fgName, s16 params) {
mem_clear((u8*)actor, profile->instanceSize, 0);
@@ -789,8 +789,8 @@ void Actor_init_actor_class(Actor* actor, ActorProfile* profile, ActorOverlay* o
actor->home.rot.y = rotY;
actor->home.rot.z = rotZ;
- actor->unk_008 = argB;
- actor->unk_009 = argC;
+ actor->blockX = blockX;
+ actor->blockZ = blockZ;
actor->unk_00A = argD;
actor->fgName = fgName;
}
@@ -861,7 +861,7 @@ void restore_fgdata(Actor* actor, Game_Play* game_play UNUSED) {
return;
}
- if ((actor->unk_008 < 0) || (actor->unk_009 < 0)) {
+ if ((actor->blockX < 0) || (actor->blockZ < 0)) {
return;
}
diff --git a/src/code/m_field_info.c b/src/code/m_field_info.c
index a005e5b..9277fa6 100644
--- a/src/code/m_field_info.c
+++ b/src/code/m_field_info.c
@@ -3,6 +3,9 @@
#include "m_collision_bg.h"
#include "libc64/qrand.h"
+s32 mFI_GetPuleTypeIdx(u8 type);
+s32 mFI_BlockCheck(s32 blockX, s32 blockZ);
+
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_ClearFieldData.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_CheckFieldData.s")
@@ -31,7 +34,7 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008819C_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_800881AC_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_BlockCheck.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088270_jp.s")
@@ -63,7 +66,19 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088A58_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80088B3C_jp.s")
+s32 mFI_BkNum2WposXZ(f32* worldPosX, f32* worldPosZ, s32 blockX, s32 blockZ) {
+ s32 result;
+
+ *worldPosX = (f32)(blockX * FI_BK_WORLDSIZE_X);
+ *worldPosZ = (f32)(blockZ * FI_BK_WORLDSIZE_Z);
+ result = FALSE;
+
+ if (mFI_CheckFieldData() == TRUE) {
+ result = mFI_BlockCheck(blockX, blockZ);
+ }
+
+ return result;
+}
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_UtNum2PosXZInBk.s")
@@ -105,9 +120,21 @@
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_BkNum2BlockType.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_800892CC_jp.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/mFI_GetPuleTypeIdx.s")
+
+s32 mFI_GetPuleIdx(void) {
+ u32 mask = (1 << 15); // TODO: make an enum/define
+ s32 blockX;
+ s32 blockZ;
+ u8 type;
+ s32 result;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_8008930C_jp.s")
+ mFI_BlockKind2BkNum(&blockX, &blockZ, mask);
+ type = mFI_BkNum2BlockType(blockX, blockZ);
+ result = mFI_GetPuleTypeIdx(type);
+
+ return result;
+}
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/m_field_info/func_80089348_jp.s")