summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkuchenmitsahne <25233413+kuchenmitsahne@users.noreply.github.com>2024-11-03 11:12:54 -0500
committerGitHub <noreply@github.com>2024-11-03 09:12:54 -0700
commit9576a6909f4c7ad82f50e042229810bb243a2df3 (patch)
tree1e78c2851e267e9a2108a562fbdd189880a1a9e1
parent943287ddfa1bc36685c541eab209b01f75078c52 (diff)
ac_goza OK (#225)
* aGOZ_actor_move OK * aGOZ_actor_init OK * Make style more consistent (aGOZ_actor_init). * aGOZ_actor_dt, aGOZ_wait OK * aGOZ_setup_action OK (with temporary extern) * aGOZ_actor_ct OK * aGOZ_actor_draw OK (unused-parameter warning introduced) * Replace magic numbers with macros, rename symbols. * aGOZ_set_bgOffset OK (all functions matching). * ac_goza OK (data import complete). * Replace hex with decimal where appropriate * Finish renaming symbols * Style/formatting tweaks * Remove extraneous whitespace * Fix warning * Fix warning properly
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt24
-rw-r--r--linker_scripts/jp/undefined_syms.ld4
-rw-r--r--src/overlays/actors/ovl_Goza/ac_goza.c152
-rw-r--r--src/overlays/actors/ovl_Goza/ac_goza.h4
-rw-r--r--yamls/jp/overlays.yaml2
5 files changed, 157 insertions, 29 deletions
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 16d8a57..9747958 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -18780,24 +18780,24 @@ RO_FLT_80A76064_jp = 0x80A76064; // type:f32
// .text
aGOZ_actor_ct = 0x80A761D0; // type:func
-func_80A76208_jp = 0x80A76208; // type:func
-func_80A76294_jp = 0x80A76294; // type:func
-func_80A76494_jp = 0x80A76494; // type:func
-func_80A764A4_jp = 0x80A764A4; // type:func
-func_80A764C0_jp = 0x80A764C0; // type:func
+aGOZ_actor_dt = 0x80A76208; // type:func
+aGOZ_set_bgOffset = 0x80A76294; // type:func
+aGOZ_wait = 0x80A76494; // type:func
+aGOZ_setup_action = 0x80A764A4; // type:func
+aGOZ_actor_move = 0x80A764C0; // type:func
aGOZ_actor_init = 0x80A765A8; // type:func
aGOZ_actor_draw = 0x80A76610; // type:func
// .data
Goza_Profile = 0x80A76770; //
-D_80A76794_jp = 0x80A76794; //
-D_80A767AC_jp = 0x80A767AC; //
-D_80A767C0_jp = 0x80A767C0; //
-D_80A76800_jp = 0x80A76800; //
-D_FLT_80A76808_jp = 0x80A76808; // type:f32
-D_FLT_80A76814_jp = 0x80A76814; // type:f32
-D_80A76820_jp = 0x80A76820; //
+aGOZ_shadow_vtx_fix_flg_table = 0x80A76794; //
+aGOZ_shadow_data = 0x80A767AC; //
+height_table_ct = 0x80A767C0; // allow_duplicated:true
+height_table = 0x80A76800; // allow_duplicated:true
+addX = 0x80A76808; // type:f32 allow_duplicated:true
+addZ = 0x80A76814; // type:f32 allow_duplicated:true
+process = 0x80A76820; // allow_duplicated:true
// .rodata
diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld
index cca06da..7d65c8c 100644
--- a/linker_scripts/jp/undefined_syms.ld
+++ b/linker_scripts/jp/undefined_syms.ld
@@ -4275,8 +4275,8 @@ D_6015F38 = 0x06015F38;
// ovl_Goza
-D_60011D8 = 0x060011D8;
-D_6015218 = 0x06015218;
+obj_e_goza_shadow_v = 0x060011D8;
+obj_e_goza_shadowT_model = 0x06001358;
// ovl_Radio
diff --git a/src/overlays/actors/ovl_Goza/ac_goza.c b/src/overlays/actors/ovl_Goza/ac_goza.c
index 686c39f..59adcc8 100644
--- a/src/overlays/actors/ovl_Goza/ac_goza.c
+++ b/src/overlays/actors/ovl_Goza/ac_goza.c
@@ -1,14 +1,27 @@
+#include "global.h"
#include "ac_goza.h"
#include "m_actor_dlftbls.h"
#include "m_object.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#include "overlays/actors/player_actor/m_player.h"
+#include "m_player_lib.h"
+#include "m_field_info.h"
+#include "m_demo.h"
+#include "m_rcp.h"
+#include "macros.h"
+#include "gfx.h"
+
+#include "objects/object_00D5E000/obj_e_goza/obj_e_goza.h"
+
+#define THIS ((Goza*)thisx)
void aGOZ_actor_ct(Actor* thisx, Game_Play* game_play);
-void func_80A76208_jp(Actor* thisx, Game_Play* game_play);
+void aGOZ_actor_dt(Actor* thisx, Game_Play* game_play);
void aGOZ_actor_init(Actor* thisx, Game_Play* game_play);
void aGOZ_actor_draw(Actor* thisx, Game_Play* game_play);
+void aGOZ_set_bgOffset(Goza* this, s32 heightTableIndex);
+void aGOZ_setup_action(Goza* this, s32 processIndex);
-#if 0
ActorProfile Goza_Profile = {
/* */ ACTOR_GOZA,
/* */ ACTOR_PART_0,
@@ -17,25 +30,140 @@ ActorProfile Goza_Profile = {
/* */ GAMEPLAY_KEEP,
/* */ sizeof(Goza),
/* */ aGOZ_actor_ct,
- /* */ func_80A76208_jp,
+ /* */ aGOZ_actor_dt,
/* */ aGOZ_actor_init,
/* */ aGOZ_actor_draw,
/* */ NULL,
};
-#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/aGOZ_actor_ct.s")
+extern Vtx obj_e_goza_shadow_v[];
+extern Gfx obj_e_goza_shadowT_model[];
+u8 aGOZ_shadow_vtx_fix_flg_table[] = { 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1 };
+ShadowData aGOZ_shadow_data = { 24, aGOZ_shadow_vtx_fix_flg_table, 60.0f, obj_e_goza_shadow_v,
+ obj_e_goza_shadowT_model };
+
+void aGOZ_actor_ct(Actor* thisx, Game_Play* game_play UNUSED) {
+ Goza* this = THIS;
+
+ aGOZ_setup_action(this, 0);
+ aGOZ_set_bgOffset(this, 1);
+}
+
+void aGOZ_actor_dt(Actor* thisx, Game_Play* game_play UNUSED) {
+ Goza* this = THIS;
+
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->objectSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->objectSegmentTable),
+ STRUCTURE_TYPE_GOZA, &this->structureActor.actor);
+
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->paletteSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->paletteSegmentTable),
+ STRUCTURE_PALETTE_GOZA, &this->structureActor.actor);
+
+ common_data.clip.structureClip->removeInstanceProc(common_data.clip.structureClip->shadowSegmentTable,
+ ARRAY_COUNT(common_data.clip.structureClip->shadowSegmentTable),
+ STRUCTURE_TYPE_GOZA, &this->structureActor.actor);
+}
+
+void aGOZ_set_bgOffset(Goza* this, s32 heightTableIndex) {
+ // clang-format off
+ static mCoBG_unkStruct2 height_table_ct[] = {
+ { 0x64, 0, 0, 0, 0, 0, 0 },
+ { 0x64, 0, 0, 0, 0, 0, 0 },
+ { 0x64, 0, 0, 0, 0, 0, 0 },
+ { 0x64, 2, 2, 2, 2, 2, 0 },
+ { 0x64, 2, 2, 2, 2, 2, 0 },
+ { 0x64, 2, 2, 2, 2, 2, 0 },
+ { 0x64, 0, 0, 0, 0, 0, 0 },
+ { 0x64, 0, 0, 0, 0, 0, 0 },
+ { 0x64, 0, 0, 0, 0, 0, 0 }
+ };
+ // clang-format on
+ static mCoBG_unkStruct2* height_table[] = { height_table_ct, height_table_ct };
+ static f32 addX[] = { -40.0f, 0.0f, 40.0f };
+ static f32 addZ[] = { -40.0f, 0.0f, 40.0f };
+
+ s32 i;
+ xyz_t pos;
+ mCoBG_unkStruct2* offsetTable = height_table[heightTableIndex];
+
+ for (i = 0; i < ARRAY_COUNT(addZ); i++) {
+ pos.z = addZ[i] + this->structureActor.actor.home.pos.z;
+
+ pos.x = addX[0] + this->structureActor.actor.home.pos.x;
+ mCoBG_SetPluss5PointOffset_file(pos, *offsetTable, "../ac_goza_move.c_inc", 93);
+ offsetTable++;
+ pos.x = addX[1] + this->structureActor.actor.home.pos.x;
+ mCoBG_SetPluss5PointOffset_file(pos, *offsetTable, "../ac_goza_move.c_inc", 97);
+ offsetTable++;
+ pos.x = addX[2] + this->structureActor.actor.home.pos.x;
+ mCoBG_SetPluss5PointOffset_file(pos, *offsetTable, "../ac_goza_move.c_inc", 101);
+ offsetTable++;
+ }
+}
+
+void aGOZ_wait(Goza* this UNUSED, Game_Play* game_play UNUSED) {
+}
+
+void aGOZ_setup_action(Goza* this, s32 processIndex) {
+ static GozaActionFunc process[] = { aGOZ_wait };
+
+ this->structureActor.process = process[processIndex];
+}
+
+void aGOZ_actor_move(Actor* thisx, Game_Play* game_play) {
+ Goza* this = THIS;
+ StructureActor* goza = &this->structureActor;
+ Player* player = get_player_actor_withoutCheck(game_play);
+ s32 gozaBlockX;
+ s32 gozaBlockZ;
+ s32 playerBlockX;
+ s32 playerBlockZ;
+
+ mFI_Wpos2BlockNum(&gozaBlockX, &gozaBlockZ, goza->actor.world.pos);
+ mFI_Wpos2BlockNum(&playerBlockX, &playerBlockZ, player->actor.world.pos);
+
+ if (!mDemo_Check(1, &player->actor) && !mDemo_Check(5, &player->actor) &&
+ ((gozaBlockX != playerBlockX) || (gozaBlockZ != playerBlockZ))) {
+ Actor_delete(&goza->actor);
+ } else {
+ ((GozaActionFunc)goza->process)(this, game_play);
+ }
+}
+
+void aGOZ_actor_init(Actor* thisx, Game_Play* game_play) {
+ Goza* this = THIS;
+ StructureActor* goza = &this->structureActor;
+
+ mFI_SetFG_common(0xF0F4, goza->actor.home.pos, FALSE);
+ aGOZ_actor_move(&goza->actor, game_play);
+ goza->actor.update = aGOZ_actor_move;
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/func_80A76208_jp.s")
+void aGOZ_actor_draw(Actor* thisx UNUSED, Game_Play* game_play) {
+ GraphicsContext* gfxCtx = game_play->state.gfxCtx;
+ u32 object = common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_GOZA);
+ u16* palette = common_data.clip.structureClip->getPalSegment(STRUCTURE_PALETTE_GOZA);
+ Mtx* mtx = _Matrix_to_Mtx_new(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/func_80A76294_jp.s")
+ _texture_z_light_fog_prim_shadow(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/func_80A76494_jp.s")
+ OPEN_SHADOW_DISP(gfxCtx);
+ gSPSegment(__shadow_gfx++, G_MWO_SEGMENT_8, palette);
+ gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object);
+ gSPSegment(__shadow_gfx++, G_MWO_SEGMENT_6, object);
+ gDPSetPrimColor(__shadow_gfx++, 0, 0x80, 255, 255, 255, 255);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/func_80A764A4_jp.s")
+ mtx = _Matrix_to_Mtx_new(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/func_80A764C0_jp.s")
+ if (mtx != NULL) {
+ gSPMatrix(__shadow_gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(__shadow_gfx++, goza_DL_model);
+ }
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/aGOZ_actor_init.s")
+ CLOSE_SHADOW_DISP(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Goza/ac_goza/aGOZ_actor_draw.s")
+ if (mtx != NULL) {
+ common_data.clip.unk_074->unk_04(game_play, &aGOZ_shadow_data, STRUCTURE_TYPE_GOZA);
+ }
+}
diff --git a/src/overlays/actors/ovl_Goza/ac_goza.h b/src/overlays/actors/ovl_Goza/ac_goza.h
index 6b14a9d..4be1ffe 100644
--- a/src/overlays/actors/ovl_Goza/ac_goza.h
+++ b/src/overlays/actors/ovl_Goza/ac_goza.h
@@ -4,6 +4,7 @@
#include "ultra64.h"
#include "m_actor.h"
#include "unk.h"
+#include "overlays/actors/ovl_Structure/ac_structure.h"
struct Game_Play;
struct Goza;
@@ -11,8 +12,7 @@ struct Goza;
typedef void (*GozaActionFunc)(struct Goza*, struct Game_Play*);
typedef struct Goza {
- /* 0x000 */ Actor actor;
- /* 0x174 */ UNK_TYPE1 unk_174[0x164];
+ /* 0x000 */ StructureActor structureActor;
} Goza; // size = 0x2D8
#endif
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index 21754fc..080b4c0 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -13147,7 +13147,7 @@
bss_size: 0x0
subsegments:
- [0x936470, c, overlays/actors/ovl_Goza/ac_goza]
- - [0x936A10, data, overlays/actors/ovl_Goza/ac_goza]
+ - [0x936A10, .data, overlays/actors/ovl_Goza/ac_goza]
- [0x936AD0, .rodata, overlays/actors/ovl_Goza/ac_goza]
- name: ovl_Goza_reloc
type: code