diff options
| author | Leonid Kapitonov <Feacur@gmail.com> | 2024-12-07 20:27:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-07 12:27:42 -0700 |
| commit | 8e5451997741a70edf39d7840074f262005b0988 (patch) | |
| tree | 4c6aaf584d484897d91777e2be7d1e07a19dc540 | |
| parent | 7c055329a7a71f8652587cb7dc779ac3eb69f5d4 (diff) | |
`ac_house_goki` OK (#229)
* prepare unknown size
* move `.data` to the C side
* remove redundant headers
* aHG_actor_ct OK
* func_80A83770_jp OK (rename to `aHG_actor_dt`)
* aHG_actor_move OK
- fix `mCoBG_CheckResult` description and comments
- extend `MyRoomClip` and fix offsets in comments
* func_80A83780_jp OK
* func_80A83930_jp OK
* func_80A83994_jp OK
* func_80A83A00_jp OK
* func_80A8401C_jp OK
* func_80A8409C_jp OK (rename to `aHG_setup_action`)
* aHG_actor_draw OK
* func_80A83D4C_jp OK
* func_80A83A24_jp OK
* name HG models
* put static HG data into the functions
* func_80A837C4_jp OK
* add notes and clean up a bit
* apply a suggestion by @hensldm
* remove ASM pragmas
* extract assets
| -rw-r--r-- | include/m_clip.h | 15 | ||||
| -rw-r--r-- | include/m_collision_bg.h | 58 | ||||
| -rw-r--r-- | include/tables/dmatables/dmadata_table_jp.h | 2 | ||||
| -rw-r--r-- | include/tables/object_table.h | 2 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_assets.txt | 7 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_overlays.txt | 10 | ||||
| -rw-r--r-- | linker_scripts/jp/undefined_syms.ld | 3 | ||||
| -rw-r--r-- | src/objects/act_house_goki/act_house_goki.c | 10 | ||||
| -rw-r--r-- | src/objects/act_house_goki/act_house_goki.h | 13 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_House_Goki/ac_house_goki.c | 357 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_House_Goki/ac_house_goki.h | 14 | ||||
| -rw-r--r-- | src/overlays/actors/player_actor/m_player.c | 2 | ||||
| -rw-r--r-- | tools/profiles.txt | 2 | ||||
| -rw-r--r-- | yamls/jp/assets.yaml | 21 | ||||
| -rw-r--r-- | yamls/jp/overlays.yaml | 2 |
15 files changed, 456 insertions, 62 deletions
diff --git a/include/m_clip.h b/include/m_clip.h index b825c24..2c5d2ac 100644 --- a/include/m_clip.h +++ b/include/m_clip.h @@ -121,18 +121,21 @@ typedef void (*Clip_unk_080_unk_24)(void); typedef s32 (*Clip_unk_080_unk_28)(struct Game* game, u16 ftr, s32 res,s32 utX, s32 utZ, u16 rotation, s32 squareOffs, s32 layer); typedef UNK_RET (*Clip_unk_080_unk_34)(struct FurnitureActor* furnitureActor, struct Actor* myHouseActor, struct Game_Play* game_play, f32 arg0, f32 arg1); -typedef s32 (*Clip_unk_080_unk_54)(struct xyz_t* pos); +typedef s32 (*Clip_unk_080_unk_5C)(struct xyz_t* pos); +typedef s32 (*Clip_unk_080_unk_68)(struct xyz_t* pos); typedef struct MyRoomClip { /* 0x00 */ UNK_TYPE1 unk_00[0x4]; /* 0x04 */ Clip_unk_080_unk_04 unk_04; - /* 0x08 */ UNK_TYPE1 unk_08[0x1C]; + /* 0x08 */ UNK_TYPE1 unk_08[0x24 - 0x08]; /* 0x24 */ Clip_unk_080_unk_24 unk_24; /* 0x28 */ Clip_unk_080_unk_28 unk_28; - /* 0x2C */ UNK_TYPE1 unk_2C[0x8]; + /* 0x2C */ UNK_TYPE1 unk_2C[0x34 - 0x2C]; /* 0x34 */ Clip_unk_080_unk_34 unk_34; // open close proc - /* 0x38 */ s8 unk_38[0x24]; - /* 0x54 */ Clip_unk_080_unk_54 unk_54; -} MyRoomClip; // size >= 0x54 + /* 0x38 */ s8 unk_38[0x5C - 0x38]; + /* 0x5C */ Clip_unk_080_unk_5C unk_5C; + /* 0x60 */ UNK_TYPE1 unk_60[0x68 - 0x60]; + /* 0x68 */ Clip_unk_080_unk_68 unk_68; +} MyRoomClip; // size >= 0x6C typedef struct StructureClipOverlayInfo { /* 0x00 */ s8* overlayPointer; diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h index 91f0209..1cb0f4e 100644 --- a/include/m_collision_bg.h +++ b/include/m_collision_bg.h @@ -41,30 +41,48 @@ typedef struct mCoBG_WallInfo { /* 0x2 */ s16 type; } mCoBG_WallInfo; // size = 0x4 -// collision bg result data +/* collision bg result data + * + * bits allocation: + * | 0x0 0x1 0x2 0x3 | offset | name + * | X_______ ________ ________ ________ | 0x00 | onGround + * | _XXXXX__ ________ ________ ________ | 0x01 | unk1 + * | ______XX XXX_____ ________ ________ | 0x06 | hitWall + * | ________ ___XXX__ ________ ________ | 0x0B | unk3 + * | ________ ______X_ ________ ________ | 0x0E | unk4 + * | ________ _______X XXXXX___ ________ | 0x0F | unk5 + * | ________ ________ _____X__ ________ | 0x15 | unk6 + * | ________ ________ ______X_ ________ | 0x16 | inWater + * | ________ ________ _______X ________ | 0x17 | unk8 + * | ________ ________ ________ X_______ | 0x18 | unk9 + * | ________ ________ ________ _X______ | 0x19 | unk10 + * | ________ ________ ________ __X_____ | 0x1A | unk11 + * | ________ ________ ________ ___X____ | 0x1B | unk12 + * | ________ ________ ________ ____XXXX | 0x1C | unk13 + */ typedef struct mCoBG_CheckResult { - u32 onGround:1; // [31] on_ground - u32 unk1:5; // [30:25] hit_attribute_wall - u32 hitWall:5; // [25:20] hit_wall - u32 unk3:3; // [20:17] hit_wall_count - u32 unk4:1; // [17:16] unk_flag0 - u32 unk5:6; // [16:10] unit_attribute - u32 unk6:1; // [10] is_on_move_bg_obj - u32 inWater:1; // [9] is_in_water - u32 unk8:1; // [8] unk_flag1 - u32 unk9:1; // [7] unk_flag2 - u32 unk10:1; // [6] unk_flag3 - u32 unk11:1; // [5] unk_flag4 - u32 unk12:1; // [4] unk_flag5 - u32 unk13:4; // [3:0] unk_flag6 + u32 onGround : 1; // on_ground + u32 unk1 : 5; // hit_attribute_wall + u32 hitWall : 5; // hit_wall + u32 unk3 : 3; // hit_wall_count + u32 unk4 : 1; // unk_flag0 + u32 unk5 : 6; // unit_attribute + u32 unk6 : 1; // is_on_move_bg_obj + u32 inWater : 1; // is_in_water + u32 unk8 : 1; // unk_flag1 + u32 unk9 : 1; // unk_flag2 + u32 unk10 : 1; // unk_flag3 + u32 unk11 : 1; // unk_flag4 + u32 unk12 : 1; // unk_flag5 + u32 unk13 : 4; // unk_flag6 } mCoBG_CheckResult; typedef struct mCoBG_Check{ /* 0x00 */ u8 unk0[0x11]; - /* 0x11 */ mCoBG_CheckResult colResult; - /* 0x14 */ u8 unk14[0xC]; - /* 0x20 */ mCoBG_WallInfo wallInfo[2]; - /* 0x2C */ s16 unk20; + /* 0x14 */ mCoBG_CheckResult colResult; + /* 0x18 */ u8 unk18[0xC]; + /* 0x24 */ mCoBG_WallInfo wallInfo[2]; + /* 0x2C */ s16 unk2C; }mCoBG_Check; // size = 0x30 // void func_80067430_jp(); @@ -314,7 +332,7 @@ s32 func_80076358_jp(u32 attribute); // void func_8007648C_jp(); // void func_800764CC_jp(); void mCoBG_BgCheckControll(xyz_t*, struct Actor*, f32, f32, s32, s32, s32); -// void func_80076778_jp(); +void func_80076778_jp(s32, struct Actor*, f32, f32, s32, s32); // void func_800768C8_jp(); // void func_80076A04_jp(); diff --git a/include/tables/dmatables/dmadata_table_jp.h b/include/tables/dmatables/dmadata_table_jp.h index 31b8917..733798b 100644 --- a/include/tables/dmatables/dmadata_table_jp.h +++ b/include/tables/dmatables/dmadata_table_jp.h @@ -2283,7 +2283,7 @@ DEFINE_DMA_ENTRY(object_01135000, "object_01135000") DEFINE_DMA_ENTRY(segment_01136000, "segment_01136000") DEFINE_DMA_ENTRY(glider, "glider") DEFINE_DMA_ENTRY(object_0113D000, "object_0113D000") -DEFINE_DMA_ENTRY(object_01147000, "object_01147000") +DEFINE_DMA_ENTRY(act_house_goki, "act_house_goki") DEFINE_DMA_ENTRY(segment_01148000, "segment_01148000") DEFINE_DMA_ENTRY(segment_0114A000, "segment_0114A000") DEFINE_DMA_ENTRY(segment_01188000, "segment_01188000") diff --git a/include/tables/object_table.h b/include/tables/object_table.h index 75ed685..0f920a3 100644 --- a/include/tables/object_table.h +++ b/include/tables/object_table.h @@ -379,7 +379,7 @@ /* 0x16E */ DEFINE_OBJECT(object_010F0000, OBJECT_366) /* 0x16F */ DEFINE_OBJECT(object_01011000, OBJECT_367) /* 0x170 */ DEFINE_OBJECT(object_01014000, OBJECT_368) -/* 0x171 */ DEFINE_OBJECT(object_01147000, OBJECT_369) +/* 0x171 */ DEFINE_OBJECT(act_house_goki, OBJECT_ACT_HOUSE_GOKI) /* 0x172 */ DEFINE_OBJECT(tol_npcsao_1, OBJECT_TOL_NPCSAO_1) /* 0x173 */ DEFINE_OBJECT(tol_kamicup, OBJECT_TOL_KAMICUP) /* 0x174 */ DEFINE_OBJECT(object_00F41000, OBJECT_372) diff --git a/linker_scripts/jp/symbol_addrs_assets.txt b/linker_scripts/jp/symbol_addrs_assets.txt index 4ad3bd9..16a412b 100644 --- a/linker_scripts/jp/symbol_addrs_assets.txt +++ b/linker_scripts/jp/symbol_addrs_assets.txt @@ -1263,6 +1263,13 @@ tol_hata_01_evw_anime = 0x60003F0; // segment:tol_hata_01 rom:0x11303F0 glider_v = 0x6000000; // segment:glider rom:0x113C000 size:0xB0 glider_model = 0x60000B0; // segment:glider rom:0x113C0B0 +act_house_goki_vtx_1 = 0x6000000; // segment:act_house_goki rom:0x1147000 size:0x60 +act_house_goki_vtx_2 = 0x6000060; // segment:act_house_goki rom:0x1147060 size:0x60 +act_house_goki_model_1 = 0x60000C0; // segment:act_house_goki rom:0x11470C0 +act_house_goki_model_2 = 0x6000188; // segment:act_house_goki rom:0x1147188 +act_house_goki_pal = 0x6000250; // segment:act_house_goki rom:0x1147250 +act_house_goki_tex = 0x6000270; // segment:act_house_goki rom:0x1147270 + act_bee_v = 0x6000000; // segment:act_bee rom:0x11F4000 size:0x3A0 act_bee_C_model = 0x60003A0; // segment:act_bee rom:0x11F43A0 act_bee_B_model = 0x60004B8; // segment:act_bee rom:0x11F44B8 diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt index 493db2a..1277f88 100644 --- a/linker_scripts/jp/symbol_addrs_overlays.txt +++ b/linker_scripts/jp/symbol_addrs_overlays.txt @@ -19474,7 +19474,7 @@ D_80A8365C_jp = 0x80A8365C; // // .text aHG_actor_ct = 0x80A836C0; // type:func -func_80A83770_jp = 0x80A83770; // type:func +aHG_actor_dt = 0x80A83770; // type:func func_80A83780_jp = 0x80A83780; // type:func func_80A837C4_jp = 0x80A837C4; // type:func func_80A83930_jp = 0x80A83930; // type:func @@ -19483,16 +19483,16 @@ func_80A83A00_jp = 0x80A83A00; // type:func func_80A83A24_jp = 0x80A83A24; // type:func func_80A83D4C_jp = 0x80A83D4C; // type:func func_80A8401C_jp = 0x80A8401C; // type:func -func_80A8409C_jp = 0x80A8409C; // type:func +aHG_setup_action = 0x80A8409C; // type:func aHG_actor_move = 0x80A840E8; // type:func aHG_actor_draw = 0x80A84480; // type:func // .data House_Goki_Profile = 0x80A845A0; // -D_80A845C4_jp = 0x80A845C4; // -D_80A845D0_jp = 0x80A845D0; // -D_80A845DC_jp = 0x80A845DC; // +init_process = 0x80A845C4; // +process = 0x80A845D0; // allow_duplicated:true +aHG_models = 0x80A845DC; // // .rodata diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld index e07480f..61812c4 100644 --- a/linker_scripts/jp/undefined_syms.ld +++ b/linker_scripts/jp/undefined_syms.ld @@ -4739,7 +4739,8 @@ D_6000E60 = 0x06000E60; // ovl_House_Goki -D_60000C0 = 0x060000C0; +aHG_model_1 = 0x060000C0; +aHG_model_2 = 0x06000188; // ovl__00944930 diff --git a/src/objects/act_house_goki/act_house_goki.c b/src/objects/act_house_goki/act_house_goki.c new file mode 100644 index 0000000..028ab05 --- /dev/null +++ b/src/objects/act_house_goki/act_house_goki.c @@ -0,0 +1,10 @@ +#include "act_house_goki.h" + +#include "assets/jp/objects/act_house_goki/act_house_goki_vtx_1.vtx.inc.c" +#include "assets/jp/objects/act_house_goki/act_house_goki_vtx_2.vtx.inc.c" +#include "assets/jp/objects/act_house_goki/act_house_goki_model_1.gfx.inc.c" +#include "assets/jp/objects/act_house_goki/act_house_goki_model_2.gfx.inc.c" +#include "assets/jp/objects/act_house_goki/act_house_goki_pal.palette.inc.c" +u8 act_house_goki_tex[] = { +#include "assets/jp/objects/act_house_goki/act_house_goki_tex.ci4.inc.c" +}; diff --git a/src/objects/act_house_goki/act_house_goki.h b/src/objects/act_house_goki/act_house_goki.h new file mode 100644 index 0000000..f04e01b --- /dev/null +++ b/src/objects/act_house_goki/act_house_goki.h @@ -0,0 +1,13 @@ +#ifndef OBJECT_ACT_HOUSE_GOKI_H +#define OBJECT_ACT_HOUSE_GOKI_H + +#include "gbi.h" + +extern Vtx act_house_goki_vtx_1[]; +extern Vtx act_house_goki_vtx_2[]; +extern Gfx act_house_goki_model_1[]; +extern Gfx act_house_goki_model_2[]; +extern u16 act_house_goki_pal[]; +extern u8 act_house_goki_tex[]; + +#endif diff --git a/src/overlays/actors/ovl_House_Goki/ac_house_goki.c b/src/overlays/actors/ovl_House_Goki/ac_house_goki.c index ecd688b..cea1227 100644 --- a/src/overlays/actors/ovl_House_Goki/ac_house_goki.c +++ b/src/overlays/actors/ovl_House_Goki/ac_house_goki.c @@ -2,50 +2,371 @@ #include "m_actor_dlftbls.h" #include "m_object.h" #include "overlays/gamestates/ovl_play/m_play.h" +#include "m_actor_shadow.h" +#include "src/overlays/actors/player_actor/m_player.h" +#include "m_player_lib.h" +#include "audio.h" +#include "m_cockroach.h" +#include "m_collision_bg.h" +#include "m_rcp.h" +#include "m_field_info.h" +#include "macros.h" + +#include "objects/act_house_goki/act_house_goki.h" void aHG_actor_ct(Actor* thisx, Game_Play* game_play); -void func_80A83770_jp(Actor* thisx, Game_Play* game_play); +void aHG_actor_dt(Actor* thisx, Game_Play* game_play); void aHG_actor_move(Actor* thisx, Game_Play* game_play); void aHG_actor_draw(Actor* thisx, Game_Play* game_play); -#if 0 +void func_80A83930_jp(House_Goki* this, Game_Play* game_play); +void func_80A83994_jp(House_Goki* this, Game_Play* game_play); +void func_80A83A00_jp(House_Goki* this, Game_Play* game_play); + +void func_80A83A24_jp(House_Goki* this, Game_Play* game_play); +void func_80A83D4C_jp(House_Goki* this, Game_Play* game_play); +void func_80A8401C_jp(House_Goki* this, Game_Play* game_play); + +void aHG_setup_action(House_Goki* this, s32 processIndex, Game_Play* game_play); + ActorProfile House_Goki_Profile = { /* */ ACTOR_HOUSE_GOKI, /* */ ACTOR_PART_4, /* */ ACTOR_FLAG_10, /* */ 0x0000, - /* */ OBJECT_369, + /* */ OBJECT_ACT_HOUSE_GOKI, /* */ sizeof(House_Goki), /* */ aHG_actor_ct, - /* */ func_80A83770_jp, + /* */ aHG_actor_dt, /* */ aHG_actor_move, /* */ aHG_actor_draw, /* */ NULL, }; -#endif -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/aHG_actor_ct.s") +void aHG_actor_ct(Actor* thisx, Game_Play* game_play) { + House_Goki* this = (House_Goki*)thisx; + this->unk_190 = 0x1E; + if (this->actor.params <= 0) { + this->actor.params = 0; + this->unk_190 = 0xFF; + } + this->actor.scale.x = 0.01f; + this->actor.scale.y = 0.01f; + this->actor.scale.z = 0.01f; + Shape_Info_init(&this->actor, 0, mAc_ActorShadowCircle, 6.0f, 6.0f); + xyz_t_move(&this->actor.home.pos, &this->actor.world.pos); + this->actor.update = aHG_actor_move; + this->actor.gravity = -2.0f; + aHG_setup_action(this, 1, game_play); +} + +void aHG_actor_dt(Actor* thisx UNUSED, Game_Play* game_play UNUSED) { +} + +void func_80A83780_jp(House_Goki* this) { + this->unk_198 += 1.0f; + if (this->unk_198 >= 2.0f) { + this->unk_198 -= 2.0f; + } +} + +s16 func_80A837C4_jp(House_Goki* this) { + Actor* thisx = &this->actor; + s16 result = 777; + s16 angles[2]; + s16 index; + + this->unk_184 = 0; + + if (thisx->xzDistToPlayer > 20.0f) { + angles[0] = 777; + angles[1] = 777; + if (thisx->colCheck.colResult.hitWall & 2) { + angles[0] = DEG_TO_BINANG(-90); + angles[1] = DEG_TO_BINANG(90); + } + + if ((thisx->colCheck.colResult.hitWall & 4) || (thisx->colCheck.colResult.hitWall & 8)) { + if (angles[0] == 777) { + angles[0] = 0x8000 - thisx->world.rot.y; + if (angles[0] > 0) { + angles[0] = 0x10000 - thisx->world.rot.y; + } + } else { + angles[0] = thisx->colCheck.colResult.hitWall & 4 ? DEG_TO_BINANG(90) : DEG_TO_BINANG(-90); + } + return angles[0]; + } + + index = 0; + if (angles[0] != 777) { + result = (s16)ABS((s16)(angles[0] - thisx->yawTowardsPlayer)); + } + if (angles[1] != 777) { + if (result < (s16)ABS((s16)(angles[1] - thisx->yawTowardsPlayer))) { + index = 1; + } + } + result = angles[index]; + } + + return result; +} + +void func_80A83930_jp(House_Goki* this, Game_Play* game_play UNUSED) { + this->unk_180 = (s32)fqrand() * 20 + 20; + this->unk_184 = 0; + this->unk_188 = 0; + this->unk_195 = 0; + this->unk_198 = 0.0f; + this->actor.speed = 8.0f; +} + +void func_80A83994_jp(House_Goki* this, Game_Play* game_play UNUSED) { + this->actor.speed = 0.0f; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000; + this->unk_198 = 0.0f; + this->unk_188 = 0; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_180 = (s32)fqrand() * 20 + 20; +} + +void func_80A83A00_jp(House_Goki* this, Game_Play* game_play UNUSED) { + this->unk_188 = 0xFF; + this->unk_180 = 40; + this->actor.speed = 0.0f; +} + +void func_80A83A24_jp(House_Goki* this, Game_Play* game_play) { + Player* player = get_player_actor_withoutCheck(game_play); + UNUSED void* pad = &this->actor.world.pos; + u16* unitFG; + s16 rotY; + s32 chance; + + if (this->actor.world.pos.y == this->actor.home.pos.y) { + if (this->unk_195 == 1) { + this->unk_195 = 0; + this->actor.speed = 8.0f; + this->unk_198 = 0.0f; + } + if (this->unk_180 > 0) { + this->unk_180 -= 1; + } + if ((this->unk_180 == 0) && (this->unk_18C == 0) && + ((player->actor.speed == 0.0f) || (this->actor.xzDistToPlayer > 60.0f))) { + aHG_setup_action(this, 1, game_play); + return; + } + } + + if (this->unk_184 > 0) { + this->unk_184 -= 1; + } + + if (this->unk_195 == 1) { + func_80A83780_jp(this); + if (this->actor.velocity.y < 0.0f) { + this->actor.gravity = -7.0f; + } + } + + unitFG = mFI_GetUnitFG(this->actor.world.pos); + if ((unitFG != NULL) && (*unitFG == 0x1F3F)) { + this->unk_18C = 1; + this->actor.shape.rot.y = -0x8000; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_184 = (s32)(fqrand() * 4.0f) + 4; + } else { + this->unk_18C = 0; + if ((this->unk_184 == 0) && (this->actor.colCheck.colResult.hitWall != 0)) { + rotY = func_80A837C4_jp(this); + chance = 20; + if (rotY != 777) { + this->actor.world.rot.y += rotY; + this->actor.world.rot.y &= 0xC000; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->unk_184 = (s32)(fqrand() * 5.0f) + 5; + } else { + chance = 50; + } + + if (this->unk_195 == 0 && (s32)(fqrand() * 100.0f) < chance) { + rotY = (s32)fqrand(); + rotY = 0x1000 - (rotY << 0xD); + this->actor.shape.rot.y = rotY + this->actor.yawTowardsPlayer; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_195 = 1; + this->actor.velocity.y = 17.0f; + this->actor.gravity = -2.0f; + this->actor.speed = 5.0f; + sAdo_OngenTrgStart(0x132, &this->actor.world.pos); + } + } else if ((this->unk_195 == 0) && (this->unk_184 == 0)) { + this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; + this->actor.shape.rot.y = this->actor.world.rot.y; + } + } + sAdo_OngenPos((uintptr_t)this, 0x28, &this->actor.world.pos); +} + +void func_80A83D4C_jp(House_Goki* this, Game_Play* game_play) { + Player* player = get_player_actor_withoutCheck(game_play); + u16* unitFG; + UNUSED s32 pad[2]; + xyz_t pos; + + if (this->unk_194 == 0 || (player->actor.speed != 0.0f && this->actor.xzDistToPlayer < 60.0f)) { + this->unk_194 = 1; + aHG_setup_action(this, 0, game_play); + return; + } + + if (this->actor.speed != 0.0f) { + sAdo_OngenPos((uintptr_t)this, 0x28, &this->actor.world.pos); + if ((this->actor.colCheck.colResult.hitWall & 2) || (this->actor.colCheck.colResult.unk1 & 2) || + (this->actor.colCheck.colResult.hitWall & 4) || (this->actor.colCheck.colResult.unk1 & 4) || + (this->actor.colCheck.colResult.hitWall & 8) || (this->actor.colCheck.colResult.unk1 & 8)) { + if (this->unk_188 == 0) { + this->actor.shape.rot.y += 0x8000; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->unk_188 = 1; + } + } else { + unitFG = mFI_GetUnitFG(this->actor.world.pos); + if ((unitFG != NULL) && (*unitFG == 0x1F3F)) { + this->unk_188 = 0; + this->unk_180 = (s32)(fqrand() * 5.0f) + 5; + this->actor.shape.rot.y = -0x8000; + this->actor.world.rot.y = this->actor.shape.rot.y; + } else { + this->unk_188 = 0; + } + } + } + + if (this->unk_180 > 0) { + this->unk_180 -= 1; + return; + } + + this->unk_180 = (s32)(fqrand() * 5.0f) + 5; + this->actor.speed = 0; + if (((game_play->unk_1EA0 % 100) < 0x15) && !(fqrand() < 0.5f)) { + if (!(this->actor.xzDistToPlayer < 60.0f)) { + xyz_t_move(&pos, &this->actor.world.pos); + pos.x += 80.0f - (fqrand() * 160.0f); + pos.z += 80.0f - (fqrand() * 160.0f); + this->actor.shape.rot.y = search_position_angleY(&this->actor.world.pos, &pos); + this->unk_195 = 0; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actor.speed = 4; + } + } +} + +void func_80A8401C_jp(House_Goki* this, Game_Play* game_play UNUSED) { + this->unk_190 = this->unk_188; + + this->unk_180 -= 1; + if ((this->unk_180 & 2) == 0) { + this->unk_190 = 0; + } + + this->unk_188 -= 5; + if (this->unk_188 < 0) { + this->unk_188 = 0; + } + + this->actor.shape.shadowAlphaRate = (f32)this->unk_188 * 0.0015f; + if (this->unk_180 <= 0) { + Actor_delete(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83770_jp.s") +void aHG_setup_action(House_Goki* this, s32 processIndex, Game_Play* game_play) { + static House_GokiActionFunc init_process[] = { func_80A83930_jp, func_80A83994_jp, func_80A83A00_jp }; + static House_GokiActionFunc process[] = { func_80A83A24_jp, func_80A83D4C_jp, func_80A8401C_jp }; + this->processIndex = processIndex; + this->process = process[processIndex]; + init_process[processIndex](this, game_play); +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83780_jp.s") +void aHG_actor_move(Actor* thisx, Game_Play* game_play) { + House_Goki* this = (House_Goki*)thisx; + Player* player = get_player_actor_withoutCheck(game_play); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A837C4_jp.s") + if (this->processIndex != 2 && this->unk_190 != 0xFF) { + this->unk_190 += 7; + if (this->unk_190 >= 0x100) { + this->unk_190 = 0xFF; + } + } else if (common_data.clip.myRoomClip != NULL) { + if (this->processIndex != 2 && this->unk_190 == 0xFF) { + if (common_data.clip.myRoomClip->unk_68(&this->actor.world.pos)) { + common_data.clip.unk_090->unk_00(0x5F, this->actor.world.pos, 1, 0, game_play, 0, 0, 0); + mCkRh_CalcCanLookGokiCount(-1); + sAdo_OngenTrgStart(0x5B, &this->actor.world.pos); + aHG_setup_action(this, 2, game_play); + return; + } + } + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83930_jp.s") + this->actor.velocity.x = sin_s(this->actor.world.rot.y) * this->actor.speed; + this->actor.velocity.z = cos_s(this->actor.world.rot.y) * this->actor.speed; + this->actor.velocity.y += this->actor.gravity; + Actor_position_move(&this->actor); + func_80076778_jp(0, &this->actor, 15.0f, 0.0f, 0, 0); + if (this->actor.world.pos.y < this->actor.home.pos.y) { + this->actor.world.pos.y = this->actor.home.pos.y; + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83994_jp.s") + if (this->unk_190 == 0xFF && this->processIndex != 2) { + if (this->actor.colCheck.colResult.unk9 || this->actor.colCheck.colResult.unk10) { + common_data.clip.unk_090->unk_00(0x5F, this->actor.world.pos, 1, 0, game_play, 0, 0, 0); + mCkRh_CalcCanLookGokiCount(-1); + sAdo_OngenTrgStart(0x5B, &this->actor.world.pos); + aHG_setup_action(this, 2, game_play); + return; + } + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83A00_jp.s") + if (this->unk_190 != 0xFF && this->actor.params == 2) { + this->actor.params = 1; + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83A24_jp.s") + if (this->processIndex != 2) { + if (this->actor.params == 2 || + (this->unk_190 == 0xFF && player->actor.speed != 0.0f && this->actor.xzDistToPlayer < 9.0f && + this->actor.world.pos.y == this->actor.home.pos.y)) { + common_data.clip.unk_090->unk_00(0x5F, this->actor.world.pos, 1, 0, game_play, 0, 0, 0); + mCkRh_CalcCanLookGokiCount(-1); + sAdo_OngenTrgStart(0x5B, &this->actor.world.pos); + aHG_setup_action(this, 2, game_play); + } + } + this->process(this, game_play); +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A83D4C_jp.s") +void aHG_actor_draw(Actor* thisx, Game_Play* game_play) { + static Gfx* aHG_models[] = { act_house_goki_model_1, act_house_goki_model_2 }; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A8401C_jp.s") + GraphicsContext* gfxCtx = game_play->state.gfxCtx; + House_Goki* this = (House_Goki*)thisx; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/func_80A8409C_jp.s") + Matrix_push(); + _texture_z_light_fog_prim_xlu(gfxCtx); + Matrix_translate(this->actor.world.pos.x, this->actor.world.pos.y + 2.0f, this->actor.world.pos.z, 0U); + Matrix_scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1U); + Matrix_RotateX(this->actor.shape.rot.x, MTXMODE_APPLY); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/aHG_actor_move.s") + OPEN_POLY_XLU_DISP(gfxCtx); + gSPMatrix(__polyXlu++, _Matrix_to_Mtx_new(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetEnvColor(__polyXlu++, 0xFF, 0xFF, 0xFF, this->unk_190); + gSPDisplayList(__polyXlu++, aHG_models[(s32)this->unk_198]); + CLOSE_POLY_XLU_DISP(sp3C); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_House_Goki/ac_house_goki/aHG_actor_draw.s") + Matrix_pull(); +} diff --git a/src/overlays/actors/ovl_House_Goki/ac_house_goki.h b/src/overlays/actors/ovl_House_Goki/ac_house_goki.h index 81ef9ab..f68c5b2 100644 --- a/src/overlays/actors/ovl_House_Goki/ac_house_goki.h +++ b/src/overlays/actors/ovl_House_Goki/ac_house_goki.h @@ -1,7 +1,6 @@ #ifndef AC_HOUSE_GOKI_H #define AC_HOUSE_GOKI_H -#include "ultra64.h" #include "m_actor.h" #include "unk.h" @@ -12,7 +11,18 @@ typedef void (*House_GokiActionFunc)(struct House_Goki*, struct Game_Play*); typedef struct House_Goki { /* 0x000 */ Actor actor; - /* 0x174 */ UNK_TYPE1 unk_174[0x28]; + /* 0x174 */ House_GokiActionFunc process; + /* 0x178 */ UNK_TYPE1 unk_178[4]; + /* 0x17C */ s32 processIndex; + /* 0x180 */ s32 unk_180; + /* 0x184 */ s32 unk_184; + /* 0x188 */ s32 unk_188; + /* 0x18C */ s32 unk_18C; + /* 0x190 */ u32 unk_190; + /* 0x194 */ u8 unk_194; + /* 0x195 */ u8 unk_195; + /* 0x196 */ UNK_TYPE1 unk_196[2]; + /* 0x198 */ f32 unk_198; } House_Goki; // size = 0x19C #endif diff --git a/src/overlays/actors/player_actor/m_player.c b/src/overlays/actors/player_actor/m_player.c index 77c348e..b1a7b98 100644 --- a/src/overlays/actors/player_actor/m_player.c +++ b/src/overlays/actors/player_actor/m_player.c @@ -1015,7 +1015,7 @@ void Player_actor_main_Wade_other_func1(UNUSED Actor* actor, UNUSED Game* game) void Player_actor_main_Sitdown_wait_other_func2(Actor* actor, UNUSED Game* game) { if (common_data.clip.myRoomClip != NULL) { - common_data.clip.myRoomClip->unk_54(&actor->world.pos); + common_data.clip.myRoomClip->unk_5C(&actor->world.pos); } } diff --git a/tools/profiles.txt b/tools/profiles.txt index ed5c734..9a9ccf1 100644 --- a/tools/profiles.txt +++ b/tools/profiles.txt @@ -994,7 +994,7 @@ asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944844 80A845 asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944848 80A845A8 */ .word 0x00000171 asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 94484C 80A845AC */ .word 0x0000019C asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944850 80A845B0 */ .word aHG_actor_ct -asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944854 80A845B4 */ .word func_80A83770_jp +asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944854 80A845B4 */ .word aHG_actor_dt asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944858 80A845B8 */ .word aHG_actor_move asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 94485C 80A845BC */ .word aHG_actor_draw asm/jp/data/overlays/actors/ovl_House_Goki/ac_house_goki.data.s-/* 944860 80A845C0 */ .word 0x00000000 diff --git a/yamls/jp/assets.yaml b/yamls/jp/assets.yaml index 856f76c..065bdd6 100644 --- a/yamls/jp/assets.yaml +++ b/yamls/jp/assets.yaml @@ -6979,16 +6979,27 @@ # - [0x113D000, data, assets/objects/object_0113D000/object_0113D000] - [0x1146950] - - name: object_01147000 - dir: objects - type: bin # code + - name: act_house_goki + dir: objects/act_house_goki + type: code start: 0x1147000 vram: 0x06000000 exclusive_ram_id: segment_06 compress: True align: 0x1000 - # subsegments: - # - [0x1147000, data, assets/objects/object_01147000/object_01147000] + symbol_name_format: $VRAM_$ROM + subsegments: + - [auto, c, act_house_goki] + - start: 0x1147000 + type: .data + name: act_house_goki + subsegments: + - [0x1147000, vtx, act_house_goki_vtx_1] + - [0x1147060, vtx, act_house_goki_vtx_2] + - [0x11470C0, af_gfx, act_house_goki_model_1] + - [0x1147188, af_gfx, act_house_goki_model_2] + - [0x1147250, af_palette, act_house_goki_pal] + - [0x1147270, ci4, act_house_goki_tex, 16, 64, act_house_goki_pal] - [0x1147470] - name: segment_01148000 diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index eb003f3..9a28677 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -14567,7 +14567,7 @@ bss_size: 0x0 subsegments: - [0x943960, c, overlays/actors/ovl_House_Goki/ac_house_goki] - - [0x944840, data, overlays/actors/ovl_House_Goki/ac_house_goki] + - [0x944840, .data, overlays/actors/ovl_House_Goki/ac_house_goki] - [0x944890, .rodata, overlays/actors/ovl_House_Goki/ac_house_goki] - name: ovl_House_Goki_reloc type: code |
