summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPrakxo <87568477+Prakxo@users.noreply.github.com>2024-07-29 18:30:20 +0200
committerGitHub <noreply@github.com>2024-07-29 09:30:20 -0700
commitc3164cd99c3eb764a63171253af14126be77b1e7 (patch)
treedb45ee4dd937216502352110d875b93e7fea2157 /src
parentc7d98021c3e6105479a2c2429234f3308ba0cbbc (diff)
ac_mikuji OK (#206)
* ac_mikuji OK * jenkins
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Mikanbox/ac_mikanbox.c12
-rw-r--r--src/overlays/actors/ovl_Mikuji/ac_mikuji.c151
-rw-r--r--src/overlays/actors/ovl_Mikuji/ac_mikuji.h14
3 files changed, 148 insertions, 29 deletions
diff --git a/src/overlays/actors/ovl_Mikanbox/ac_mikanbox.c b/src/overlays/actors/ovl_Mikanbox/ac_mikanbox.c
index ec9842a..52aea2b 100644
--- a/src/overlays/actors/ovl_Mikanbox/ac_mikanbox.c
+++ b/src/overlays/actors/ovl_Mikanbox/ac_mikanbox.c
@@ -3,8 +3,8 @@
#include "m_object.h"
#include "overlays/gamestates/ovl_play/m_play.h"
-void func_805b3010(Actor* thisx, Game_Play* game_play);
-void aMIK_actor_dt(Actor* thisx, Game_Play* game_play);
+void func_80AA3BA0_jp(Actor* thisx, Game_Play* game_play);
+void func_80AA3C78_jp(Actor* thisx, Game_Play* game_play);
void func_805b3e58(Actor* thisx, Game_Play* game_play);
void func_805b4054(Actor* thisx, Game_Play* game_play);
void aMIK_actor_save(Actor* thisx, Game_Play* game_play);
@@ -17,17 +17,17 @@ ActorProfile Mikanbox_Profile = {
/* */ 0x5841,
/* */ GAMEPLAY_KEEP,
/* */ sizeof(Mikanbox),
- /* */ func_805b3010,
- /* */ aMIK_actor_dt,
+ /* */ func_80AA3BA0_jp,
+ /* */ func_80AA3C78_jp,
/* */ func_805b3e58,
/* */ func_805b4054,
/* */ aMIK_actor_save,
};
#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikanbox/ac_mikanbox/func_805b3010.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikanbox/ac_mikanbox/func_80AA3BA0_jp.s")
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikanbox/ac_mikanbox/aMIK_actor_dt.s")
+#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikanbox/ac_mikanbox/func_80AA3C78_jp.s")
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikanbox/ac_mikanbox/func_80AA3D08_jp.s")
diff --git a/src/overlays/actors/ovl_Mikuji/ac_mikuji.c b/src/overlays/actors/ovl_Mikuji/ac_mikuji.c
index 886bb5d..2504af7 100644
--- a/src/overlays/actors/ovl_Mikuji/ac_mikuji.c
+++ b/src/overlays/actors/ovl_Mikuji/ac_mikuji.c
@@ -1,14 +1,21 @@
#include "ac_mikuji.h"
#include "m_actor_dlftbls.h"
#include "m_object.h"
+#include "m_player_lib.h"
+#include "overlays/actors/player_actor/m_player.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#include "69E2C0.h"
+#include "gfx.h"
+#include "m_field_info.h"
+#include "m_rcp.h"
+#include "macros.h"
+#include "code_variables.h"
-void func_805b414c(Actor* thisx, Game_Play* game_play);
-void func_80A82638_jp(Actor* thisx, Game_Play* game_play);
-void func_805b437c(Actor* thisx, Game_Play* game_play);
-void func_805b43f4(Actor* thisx, Game_Play* game_play);
+void aMIK_actor_ct(Actor* actor, Game_Play* game_play);
+void aMIK_actor_dt(Actor* actor, Game_Play* game_play);
+void aMIK_actor_init(Actor* actor, Game_Play* play);
+void aMIK_actor_draw(Actor* thisx, Game_Play* play);
-#if 0
ActorProfile Mikuji_Profile = {
/* */ ACTOR_MIKUJI,
/* */ ACTOR_PART_0,
@@ -16,26 +23,134 @@ ActorProfile Mikuji_Profile = {
/* */ 0x5830,
/* */ GAMEPLAY_KEEP,
/* */ sizeof(Mikuji),
- /* */ func_805b414c,
- /* */ func_80A82638_jp,
- /* */ func_805b437c,
- /* */ func_805b43f4,
+ /* */ aMIK_actor_ct,
+ /* */ aMIK_actor_dt,
+ /* */ aMIK_actor_init,
+ /* */ aMIK_actor_draw,
/* */ NULL,
};
-#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_805b414c.s")
+extern Vtx obj_e_mikuji_shadow_v[];
+extern Gfx obj_e_mikuji_shadow_model[];
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_80A82638_jp.s")
+u8 aMIK_shadow_vtx_fix_flg_table[] = { 1, 0, 0, 1, 0, 1, 1, 0 };
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_80A826C4_jp.s")
+ShadowData aMIK_shadow_data = {
+ 8, aMIK_shadow_vtx_fix_flg_table, 60.0f, obj_e_mikuji_shadow_v, obj_e_mikuji_shadow_model,
+};
+
+extern Gfx mikuji_DL_model[];
+
+void aMIK_set_bgOffset(Mikuji* mikuji, s32 offs);
+void aMIK_setup_action(Mikuji* mikuji, s32 action);
+
+void aMIK_actor_ct(Actor* actor, UNUSED Game_Play* play) {
+ Mikuji* mikuji = (Mikuji*)actor;
+ aMIK_setup_action(mikuji, MIKUJI_ACTION_WAIT);
+ aMIK_set_bgOffset(mikuji, 1);
+}
+
+void aMIK_actor_dt(Actor* actor, UNUSED Game_Play* play) {
+ Mikuji* mikuji = (Mikuji*)actor;
+
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->objectSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->objectSegmentTable),
+ STRUCTURE_TYPE_MIKUJI, &mikuji->structureActor.actor);
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->paletteSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->paletteSegmentTable),
+ STRUCTURE_PALETTE_MIKUJI, &mikuji->structureActor.actor);
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->shadowSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->shadowSegmentTable),
+ STRUCTURE_TYPE_MIKUJI, &mikuji->structureActor.actor);
+}
+
+void aMIK_set_bgOffset(Mikuji* mikuji, s32 offs) {
+ static mCoBG_unkStruct2 height_table_ct[] = {
+ { 0x64, 2, 0, 2, 2, 2, 1 },
+ { 0x64, 6, 6, 6, 6, 0, 1 },
+ { 0x64, 2, 2, 0, 2, 2, 1 },
+ { 0x64, 2, 2, 2, 0, 2, 1 },
+ };
+ static mCoBG_unkStruct2* height_table[] = { height_table_ct, height_table_ct };
+ static f32 addX[] = { 0.0f, 40.0f };
+ static f32 addZ[] = { 40.0f, 80.0f };
+
+ mCoBG_unkStruct2* offset;
+ xyz_t pos;
+ s32 i;
+
+ offset = height_table[offs];
+
+ for (i = 0; i < 2; i++) {
+ pos.z = mikuji->structureActor.actor.home.pos.z + addZ[i];
+ pos.x = mikuji->structureActor.actor.home.pos.x + addX[0];
+ mCoBG_SetPluss5PointOffset_file(pos, *offset, "../ac_mikuji_move.c_inc", 79);
+ offset++;
+ pos.x = mikuji->structureActor.actor.home.pos.x + addX[1];
+ mCoBG_SetPluss5PointOffset_file(pos, *offset, "../ac_mikuji_move.c_inc", 83);
+ offset++;
+ }
+}
+
+void aMIK_wait(UNUSED Mikuji* mikuji, UNUSED Game_Play* play) {
+}
+
+void aMIK_setup_action(Mikuji* mikuji, s32 action) {
+ static MikujiActionFunc process[] = {
+ aMIK_wait,
+ };
+ mikuji->structureActor.process = process[action];
+ mikuji->structureActor.unk_2B8 = action;
+}
+
+void aMIK_actor_move(Actor* actor, Game_Play* play) {
+ Mikuji* mikuji = (Mikuji*)actor;
+ UNUSED s32 pad;
+
+ Player* player = get_player_actor_withoutCheck(play);
+ s32 worldBx;
+ s32 worldBz;
+ s32 playerBx;
+ s32 playerBz;
+
+ mFI_Wpos2BlockNum(&worldBx, &worldBz, actor->world.pos);
+ mFI_Wpos2BlockNum(&playerBx, &playerBz, player->actor.world.pos);
+
+ if (mDemo_Check(1, &player->actor) == FALSE && mDemo_Check(5, &player->actor) == FALSE &&
+ (worldBx != playerBx || worldBz != playerBz)) {
+ Actor_delete(actor);
+ } else {
+ ((MikujiActionFunc)(mikuji->structureActor.process))(mikuji, play);
+ }
+}
+
+void aMIK_actor_init(Actor* actor, Game_Play* play) {
+ mFI_SetFG_common(0xF0F9, actor->home.pos, 0);
+ aMIK_actor_move(actor, play);
+ actor->update = &aMIK_actor_move;
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_80A82848_jp.s")
+void aMIK_actor_draw(UNUSED Actor* actor, Game_Play* play) {
+ GraphicsContext* graph = play->state.gfxCtx;
+ s32 obj;
+ u16* pal;
+ Mtx* cur;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_80A82858_jp.s")
+ obj = common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_MIKUJI);
+ pal = common_data.clip.structureClip->getPalSegment(STRUCTURE_PALETTE_MIKUJI);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_80A82878_jp.s")
+ cur = _Matrix_to_Mtx_new(graph);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_805b437c.s")
+ if (cur != NULL) {
+ _texture_z_light_fog_prim_npc(graph);
+ OPEN_POLY_OPA_DISP(graph);
+ gSPSegment(__polyOpa++, G_MWO_SEGMENT_8, pal);
+ gSegments[6] = OS_K0_TO_PHYSICAL(obj);
+ gSPSegment(__polyOpa++, G_MWO_SEGMENT_6, obj);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Mikuji/ac_mikuji/func_805b43f4.s")
+ gSPMatrix(__polyOpa++, cur, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(__polyOpa++, mikuji_DL_model);
+ CLOSE_POLY_OPA_DISP(graph);
+ common_data.clip.unk_074->unk_04(play, &aMIK_shadow_data, 32);
+ }
+}
diff --git a/src/overlays/actors/ovl_Mikuji/ac_mikuji.h b/src/overlays/actors/ovl_Mikuji/ac_mikuji.h
index 7290a9b..c44111f 100644
--- a/src/overlays/actors/ovl_Mikuji/ac_mikuji.h
+++ b/src/overlays/actors/ovl_Mikuji/ac_mikuji.h
@@ -3,16 +3,20 @@
#include "ultra64.h"
#include "m_actor.h"
-#include "unk.h"
+#include "overlays/actors/ovl_Structure/ac_structure.h"
struct Game_Play;
struct Mikuji;
-typedef void (*MikujiActionFunc)(struct Mikuji*, struct Game_Play*);
-
typedef struct Mikuji {
- /* 0x000 */ Actor actor;
- /* 0x174 */ UNK_TYPE1 unk_174[0x164];
+ /* 0x000 */ StructureActor structureActor;
} Mikuji; // size = 0x2D8
+typedef void (*MikujiActionFunc)(struct Mikuji*, struct Game_Play*);
+
+typedef enum Mikuji_Action {
+ /* 0 */ MIKUJI_ACTION_WAIT,
+ /* 1 */ MIKUJI_ACTION_MAX
+} Mikuji_Action;
+
#endif