Obj_moon_stone Matching (#154)

* most all matching, just one func left

* forgot about the object script

* Moon's Tear OK

* fixing suggestions

* fixing actor pointers
This commit is contained in:
Parker Burnett 2021-05-20 17:43:27 -04:00 committed by GitHub
parent e17b05b8fa
commit cb89346c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 141 additions and 17 deletions

View File

@ -8764,9 +8764,9 @@ SECTIONS
ovl_Obj_Moon_Stone : AT(RomLocation)
{
build/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.o(.text)
build/asm/overlays/ovl_Obj_Moon_Stone_data.o(.data)
build/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.o(.data)
build/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.o(.rodata)
build/asm/overlays/ovl_Obj_Moon_Stone_rodata.o(.rodata)
build/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -251,3 +251,8 @@ D_0401C430 = 0x0401C430;
D_04048DF0 = 0x04048DF0;
D_04057B10 = 0x04057B10;
D_04089070 = 0x04089070;
/* z_obj_moon_stone */
D_06001C60 = 0x06001C60;
D_06000D78 = 0x06000D78;
D_06000C80 = 0x06000C80;

View File

@ -1,3 +1,9 @@
/*
* File z_obj_moon_stone.c
* Overlay: ovl_obj_moon_stone
* Description: Moon's Tear
*/
#include "z_obj_moon_stone.h"
#define FLAGS 0x00100010
@ -9,7 +15,15 @@ void ObjMoonStone_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80C0662C(ObjMoonStone* this);
void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx);
void func_80C066F8(ObjMoonStone* this);
void func_80C0670C(ObjMoonStone* this, GlobalContext* globalCtx);
void func_80C0673C(ObjMoonStone* this);
void func_80C06768(ObjMoonStone* this, GlobalContext* globalCtx);
void func_80C0685C(ObjMoonStone* this);
void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx);
const ActorInit Obj_Moon_Stone_InitVars = {
ACTOR_OBJ_MOON_STONE,
ACTORCAT_PROP,
@ -21,28 +35,129 @@ const ActorInit Obj_Moon_Stone_InitVars = {
(ActorFunc)ObjMoonStone_Update,
(ActorFunc)ObjMoonStone_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/ObjMoonStone_Init.asm")
extern AnimatedMaterial D_06001C60;
extern Gfx D_06000D78[];
extern Gfx D_06000C80[];
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/ObjMoonStone_Destroy.asm")
void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjMoonStone* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C0662C.asm")
Actor_SetScale(&this->actor, 0.3f);
this->unk194 = (this->actor.params & 0xF000) >> 0xC;
this->actor.targetMode = 0;
this->actor.shape.yOffset = 25.0f;
this->actor.focus.pos.y += 10.0f;
if (this->unk194 == 0) {
this->actor.colChkInfo.health = 0;
this->actor.flags |= 9;
func_80C0662C(this);
} else {
if ((gSaveContext.perm.weekEventReg[74] & 0x40) == 0) {
if ((gSaveContext.perm.weekEventReg[74] & 0x80)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, 0, 0, 0, -1);
}
this->actor.flags &= ~1;
func_80C0673C(this);
} else {
Actor_MarkForDeath(&this->actor);
}
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C06640.asm")
void ObjMoonStone_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C066F8.asm")
void func_80C0662C(ObjMoonStone* this) {
this->actionFunc = func_80C06640;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C0670C.asm")
void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx) {
ActorPlayer* player = PLAYER;
s16 sp1A = this->actor.yawTowardsPlayer - 0x8000;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C0673C.asm")
sp1A -= player->base.shape.rot.y;
if (func_800B84D0(&this->actor, globalCtx)) {
this->actor.colChkInfo.health = 1;
func_801518B0(globalCtx, 0x5E3U, &this->actor);
func_80C066F8(this);
} else {
s32 phi_v0 = ABS_ALT(sp1A);
if (phi_v0 < 0x1555) {
func_800B8614(&this->actor, globalCtx, 80.0f);
}
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C06768.asm")
void func_80C066F8(ObjMoonStone* this) {
this->actionFunc = func_80C0670C;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C0685C.asm")
void func_80C0670C(ObjMoonStone* this, GlobalContext* globalCtx) {
if (func_800B867C(&this->actor, globalCtx) != 0) {
this->actor.colChkInfo.health = 0;
func_80C0662C(this);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/func_80C06870.asm")
void func_80C0673C(ObjMoonStone* this) {
if ((gSaveContext.perm.weekEventReg[74] & 0x80) == 0) {
this->actor.draw = NULL;
}
this->actionFunc = func_80C06768;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/ObjMoonStone_Update.asm")
void func_80C06768(ObjMoonStone* this, GlobalContext* globalCtx) {
if ((gSaveContext.perm.weekEventReg[74] & 0x80)) {
if (this->actor.draw == 0) {
this->actor.draw = ObjMoonStone_Draw;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, 0, 0, 0, -1);
}
}
if (this->actor.draw) {
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL;
this->actor.draw = NULL;
func_80C0685C(this);
} else if (this->actor.xzDistToPlayer < 25.0f) {
func_800B8A1C(&this->actor, globalCtx, 0x96, 100.0f, 30.0f);
}
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Moon_Stone_0x80C06510/ObjMoonStone_Draw.asm")
void func_80C0685C(ObjMoonStone* this) {
this->actionFunc = func_80C06870;
}
void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) {
if (func_80152498(&globalCtx->msgCtx) == 6 && func_80147624(globalCtx)) {
gSaveContext.perm.weekEventReg[74] |= 0x40;
Actor_MarkForDeath(&this->actor);
}
}
void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjMoonStone* this = THIS;
ActorPlayer* player = PLAYER;
if ((player->stateFlags1 & 0x10000282) == 0) {
this->actionFunc(this, globalCtx);
}
}
void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_06001C60));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000D78);
SysMatrix_NormalizeXYZ(&globalCtx->unk187FC);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06000C80);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -5,9 +5,13 @@
struct ObjMoonStone;
typedef void (*ObjMoonStoneActionFunc)(struct ObjMoonStone*, GlobalContext*);
typedef struct ObjMoonStone {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x54];
/* 0x144 */ char unk_144[0x4C];
/* 0x190 */ ObjMoonStoneActionFunc actionFunc;
/* 0x194 */ s16 unk194;
} ObjMoonStone; // size = 0x198
extern const ActorInit Obj_Moon_Stone_InitVars;