Obj_ghaka OK (#171)

* getting ghaka started

* two more matching funcs

* functions all match, but no OK...yet....

* some clean up stuff

* uhhh lets try this?

* fixing save context stuff

* z_obj_ghaka OK

* fixing small changes

* adding in new suggestions

* fixing error
This commit is contained in:
Parker Burnett 2021-06-10 07:55:21 -04:00 committed by GitHub
parent 9102481fc2
commit aae3c6f895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 181 additions and 22 deletions

View File

@ -928,11 +928,14 @@ typedef struct {
/* 0x11F10 */ s32 unk11F10;
/* 0x11F11 */ UNK_TYPE1 pad11F11[0xD];
/* 0x11F22 */ u8 unk11F22;
/* 0x11F23 */ UNK_TYPE1 pad11F23[0xFD];
/* 0x11F23 */ u8 unk11F23;
/* 0x11F24 */ UNK_TYPE1 pad11F24[0xFC];
/* 0x12020 */ u8 unk12020;
/* 0x12021 */ u8 unk12021;
/* 0x12022 */ u8 choiceIndex;
/* 0x12023 */ UNK_TYPE1 pad12023[0x7];
/* 0x12023 */ UNK_TYPE1 unk12023;
/* 0x12024 */ s8 unk12024;
/* 0x12025 */ UNK_TYPE1 unk12025[0x6];
/* 0x1202A */ u16 unk1202A;
/* 0x1202C */ UNK_TYPE1 pad1202B[0x18];
/* 0x12044 */ s16 unk12044;

View File

@ -129,7 +129,7 @@ typedef struct Actor {
/* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data"
/* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank"
/* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on
/* 0x020 */ u16 unk20;
/* 0x020 */ s16 unk20;
/* 0x024 */ PosRot world; // Position/rotation in the world
/* 0x038 */ s8 cutscene;
/* 0x039 */ s8 unk39;

View File

@ -6843,9 +6843,9 @@ SECTIONS
ovl_Obj_Ghaka : AT(RomLocation)
{
build/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.o(.text)
build/asm/overlays/ovl_Obj_Ghaka_data.o(.data)
build/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.o(.data)
build/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.o(.rodata)
build/asm/overlays/ovl_Obj_Ghaka_rodata.o(.rodata)
build/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -389,8 +389,13 @@ D_06001C60 = 0x06001C60;
D_06000D78 = 0x06000D78;
D_06000C80 = 0x06000C80;
/* z_obj_ghaka */
D_06001A20 = 0x06001A20;
D_06001980 = 0x06001980;
D_06003CD0 = 0x06003CD0;
/* z_obj_kibako */
D_05007890 = 0x05007890;
D_05007980 = 0x05007980;
D_06001180 = 0x06001180;
D_06001A70 = 0x06001A70;
D_06001A70 = 0x06001A70;

View File

@ -234,7 +234,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) {
this->curTextId = 0x464; // Hey, relax! It doesn't leave any marks
break;
case 0x464: // Hey, relax! It doesn't leave any marks
globalCtx->msgCtx.pad11F23[0] = 0x44;
globalCtx->msgCtx.unk11F23 = 0x44;
EnGinkoMan_SetupStamp(this); // stamp player
break;
case 0x465: // "There! Now I'll know you when I see you!"

View File

@ -1,3 +1,9 @@
/*
* File z_obj_ghaka.c
* Overlay: ovl_obj_ghaka
* Description: Darmani's Gravestone
*/
#include "z_obj_ghaka.h"
#define FLAGS 0x00000029
@ -9,7 +15,14 @@ void ObjGhaka_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjGhaka_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjGhaka_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80B3C260(ObjGhaka* this);
void func_80B3C29C(ObjGhaka* this);
void func_80B3C2B0(ObjGhaka* this);
void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx);
void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx);
void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx);
void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx);
const ActorInit Obj_Ghaka_InitVars = {
ACTOR_OBJ_GHAKA,
ACTORCAT_PROP,
@ -21,26 +34,160 @@ const ActorInit Obj_Ghaka_InitVars = {
(ActorFunc)ObjGhaka_Update,
(ActorFunc)ObjGhaka_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C260.asm")
static Vec3f D_80B3C960 = { 0.0f, 0.0f, 0.0f };
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C29C.asm")
static InitChainEntry D_80B3C96C[] = {
ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C2B0.asm")
extern Gfx D_06001A20[];
extern Gfx D_06001980[];
extern CollisionHeader D_06003CD0;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C2C4.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C39C.asm")
void func_80B3C260(ObjGhaka* this) {
if (gSaveContext.weekEventReg[20] & 0x20) {
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + 100.0f;
}
this->actionFunc = func_80B3C39C;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C4E0.asm")
void func_80B3C29C(ObjGhaka* this) {
this->actionFunc = func_80B3C4E0;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/func_80B3C624.asm")
void func_80B3C2B0(ObjGhaka* this) {
this->actionFunc = func_80B3C624;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/ObjGhaka_Init.asm")
void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx) {
if (!(gSaveContext.weekEventReg[20] & 0x20)) {
Actor_SpawnWithParentAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0,
0, 0, this->dyna.actor.cutscene, this->dyna.actor.unk20, 0);
} else {
Actor_SpawnWithParentAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0,
0, 1, -1, this->dyna.actor.unk20, 0);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/ObjGhaka_Destroy.asm")
void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) {
ActorPlayer* player = PLAYER;
s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/ObjGhaka_Update.asm")
if (func_800B84D0(&this->dyna.actor, globalCtx)) {
func_80B3C29C(this);
} else if (this->dyna.actor.xzDistToPlayer < 100.0f || this->dyna.actor.isTargeted) {
if (distDiff <= -0x5556 || distDiff >= 0x5556) {
func_800B863C(&this->dyna.actor, globalCtx);
if (player->unk14B == 1) {
this->dyna.actor.textId = 0xCF3;
} else {
this->dyna.actor.textId = 0xCF2;
}
}
}
if (this->dyna.unk148 < 0.0f && !(gSaveContext.weekEventReg[20] & 0x20) && player->unk14B == 1) {
func_80B3C2B0(this);
} else {
player->unkA70 &= ~0x10;
this->dyna.unk148 = 0.0f;
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Ghaka_0x80B3C260/ObjGhaka_Draw.asm")
void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx) {
s32 temp_v0 = func_80152498(&globalCtx->msgCtx);
if (temp_v0 == 5) {
if (func_80147624(globalCtx)) {
globalCtx->msgCtx.unk11F23 = 0x43;
globalCtx->msgCtx.unk12024 = 4;
func_80B3C260(this);
}
// Could be fake, but helps match
} else if ((temp_v0 & 0xFFFFFFFF) == 4) {
if (func_80147624(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
case 0:
func_8019F208();
this->dyna.actor.textId = 0xCF5;
func_801518B0(globalCtx, this->dyna.actor.textId, &this->dyna.actor);
break;
case 1:
func_8019F208();
this->dyna.actor.textId = 0xCF7;
func_801518B0(globalCtx, this->dyna.actor.textId, &this->dyna.actor);
break;
case 2:
func_8019F230();
globalCtx->msgCtx.unk11F23 = 0x43;
globalCtx->msgCtx.unk12024 = 4;
func_80B3C260(this);
}
}
}
}
void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) {
ActorPlayer* player = PLAYER;
u8 stepTemp = Math_StepToS(&this->unk_168, 0x64, 1);
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + this->unk_168;
if (stepTemp) {
player->unkA70 &= ~0x10;
this->dyna.unk148 = 0.0f;
func_80B3C2C4(this, globalCtx);
gSaveContext.weekEventReg[20] |= 0x20;
func_80B3C260(this);
func_8019F1C0(&D_80B3C960, 0x2835);
} else {
func_8019F1C0(&D_80B3C960, 0x200A);
}
}
void ObjGhaka_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjGhaka* this = THIS;
s32 pad;
CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, D_80B3C96C);
Actor_SetScale(&this->dyna.actor, 0.1f);
BcCheck3_BgActorInit(&this->dyna, 1);
BgCheck_RelocateMeshHeader(&D_06003CD0, &colHeader);
this->dyna.bgId = BgCheck_AddActorMesh(globalCtx, &globalCtx->colCtx.dyna, &this->dyna, colHeader);
func_800B78B8(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
if (this->dyna.actor.floorPoly == 0) {
Actor_MarkForDeath(&this->dyna.actor);
}
if (gSaveContext.weekEventReg[20] & 0x20) {
func_80B3C2C4(this, globalCtx);
}
func_80B3C260(this);
}
void ObjGhaka_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ObjGhaka* this = THIS;
BgCheck_RemoveActorMesh(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
void ObjGhaka_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjGhaka* this = THIS;
this->actionFunc(this, globalCtx);
thisx->focus.pos.x = thisx->world.pos.x;
thisx->focus.pos.y = thisx->world.pos.y + 60.0f;
thisx->focus.pos.z = thisx->world.pos.z;
}
void ObjGhaka_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06001A20);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06001980);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -5,9 +5,13 @@
struct ObjGhaka;
typedef void (*ObjGhakaActionFunc)(struct ObjGhaka*, GlobalContext*);
typedef struct ObjGhaka {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x28];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ ObjGhakaActionFunc actionFunc;
/* 0x160 */ char unk160[0x8];
/* 0x168 */ s16 unk_168;
} ObjGhaka; // size = 0x16C
extern const ActorInit Obj_Ghaka_InitVars;