diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/m_actor.c | 12 | ||||
| -rw-r--r-- | src/code/m_field_info.c | 35 |
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") |
