en_scopecoin OK (#67)

* Initial scopecoin work

* Scopecoin OK

* Updated submodules

* Fixed newline on macros.h, fixed a few minor details in scopecoin.c

* Made requested minor adjustments

* merge
This commit is contained in:
kyleburnette 2021-03-16 21:22:23 -07:00 committed by GitHub
parent 22cb3c4b27
commit 61fd3e0282
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 145 additions and 64 deletions

View File

@ -26,12 +26,19 @@
#define SQ(x) ((x)*(x))
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
extern GraphicsContext* oGfxCtx;
extern GraphicsContext* __gfxCtx;
#define OPEN_DISPS(gfxCtx) \
{ \
GraphicsContext* oGfxCtx; \
oGfxCtx = gfxCtx; \
#define WORK_DISP __gfxCtx->work.p
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
#define OVERLAY_DISP __gfxCtx->overlay.p
// __gfxCtx shouldn't be used directly.
// Use the DISP macros defined above when writing to display buffers.
#define OPEN_DISPS(gfxCtx) \
{ \
GraphicsContext* __gfxCtx = gfxCtx; \
s32 __dispPad; \
#define CLOSE_DISPS(gfxCtx) \
} \

View File

@ -18,4 +18,13 @@ extern AnimatedTexture object_ikana_obj_001228[];
extern Gfx object_fu_kaiten_0005D0[];
extern BgMeshHeader object_fu_kaiten_002D30;
extern UNK_PTR D_04061FC0[];
extern UNK_PTR D_04061FE0[];
extern UNK_PTR D_04062000[];
extern UNK_PTR D_04062040[];
extern UNK_PTR D_04062020[];
extern UNK_PTR D_04062060[];
extern UNK_PTR D_04062000[];
extern Gfx D_040622C0[];
#endif

View File

@ -8581,9 +8581,10 @@ SECTIONS
ovl_En_Scopecoin : AT(RomLocation)
{
build/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.o(.text)
build/asm/overlays/ovl_En_Scopecoin_data.o(.data)
build/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.o(.data)
build/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.o(.rodata)
build/asm/overlays/ovl_En_Scopecoin_rodata.o(.rodata)
build/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.o(.rodata)
build/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -2,6 +2,15 @@ D_04029CB0 = 0x04029CB0;
D_04029CF0 = 0x04029CF0;
D_040008D0 = 0x040008D0;
D_04061FC0 = 0x04061FC0;
D_04061FE0 = 0x04061FE0;
D_04062000 = 0x04062000;
D_04062040 = 0x04062040;
D_04062020 = 0x04062020;
D_04062060 = 0x04062060;
D_04062000 = 0x04062000;
D_040622C0 = 0x040622C0;
object_ikana_obj_001100 = 0x06001100;
object_ikana_obj_001228 = 0x06001228;
@ -84,3 +93,4 @@ D_0600AB90 = 0x0600AB90;
D_06007750 = 0x06007750;
D_0600A390 = 0x0600A390;
D_0600A490 = 0x0600A490;

View File

@ -21,7 +21,7 @@ const ActorInit En_Dy_Extra_InitVars = {
(ActorFunc)EnDyExtra_Init,
(ActorFunc)EnDyExtra_Destroy,
(ActorFunc)EnDyExtra_Update,
(ActorFunc)EnDyExtra_Draw
(ActorFunc)EnDyExtra_Draw,
};
extern Vtx D_0600DD40[];
@ -109,23 +109,20 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
}
{
s32 pad2;
OPEN_DISPS(gfxCtx);
OPEN_DISPS(gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(oGfxCtx->polyXlu.p++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1,
globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10));
gDPPipeSync(oGfxCtx->polyXlu.p++);
gSPMatrix(oGfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0x80, D_80A61740[this->type].red, D_80A61740[this->type].green,
D_80A61740[this->type].blue, 255);
gDPSetEnvColor(oGfxCtx->polyXlu.p++, D_80A61754[this->type].red, D_80A61754[this->type].green,
D_80A61754[this->type].blue, 128);
gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600DEF0);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1,
globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10));
gDPPipeSync(POLY_XLU_DISP++);
gSPMatrix(POLY_XLU_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].red, D_80A61740[this->type].green,
D_80A61740[this->type].blue, 255);
gDPSetEnvColor(POLY_XLU_DISP++, D_80A61754[this->type].red, D_80A61754[this->type].green,
D_80A61754[this->type].blue, 128);
gSPDisplayList(POLY_XLU_DISP++, D_0600DEF0);
CLOSE_DISPS(gfxCtx);
}
CLOSE_DISPS(gfxCtx);
}

View File

@ -21,7 +21,7 @@ const ActorInit En_Ending_Hero_InitVars = {
(ActorFunc)EnEndingHero_Init,
(ActorFunc)EnEndingHero_Destroy,
(ActorFunc)EnEndingHero_Update,
(ActorFunc)EnEndingHero_Draw
(ActorFunc)EnEndingHero_Draw,
};
extern SkeletonHeader D_0600B0CC;
@ -82,22 +82,19 @@ void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnEndingHero* this = THIS;
s32 index = 0;
{
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Lib_PtrSegToVirt(D_80C1E970[this->unk242]));
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_80C1E970[this->unk242]));
if (this->unk242 < 3) {
index = this->unk242;
}
gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Lib_PtrSegToVirt(D_80C1E984[index]));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
0, 0, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
if (this->unk242 < 3) {
index = this->unk242;
}
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_PtrSegToVirt(D_80C1E984[index]));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, 0, 0,
&this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -21,7 +21,7 @@ const ActorInit En_Ending_Hero5_InitVars = {
(ActorFunc)EnEndingHero5_Init,
(ActorFunc)EnEndingHero5_Destroy,
(ActorFunc)EnEndingHero5_Update,
(ActorFunc)EnEndingHero5_Draw
(ActorFunc)EnEndingHero5_Draw,
};
extern SkeletonHeader D_0600A850;
@ -75,7 +75,7 @@ void func_80C23A30(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
OPEN_DISPS(globalCtx->state.gfxCtx);
if (limbIndex == 15) {
gSPDisplayList(oGfxCtx->polyOpa.p++, D_80C23BF0[this->unk25C]);
gSPDisplayList(POLY_OPA_DISP++, D_80C23BF0[this->unk25C]);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
@ -90,19 +90,19 @@ void EnEndingHero5_Draw(Actor* thisx, GlobalContext* globalCtx) {
switch (this->unk25C) {
case 0:
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 170, 10, 70, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255);
break;
case 1:
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 170, 200, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255);
break;
case 2:
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 230, 70, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255);
break;
case 3:
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 200, 0, 150, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255);
break;
case 4:
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 245, 155, 0, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255);
break;
}

View File

@ -95,11 +95,8 @@ void EnRsn_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnRsn* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C5B0(globalCtx->state.gfxCtx);
if (1) { // debug define?
s32 pad;
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Lib_PtrSegToVirt(D_06005458));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
EnRsn_OverrideLimbDraw, EnRsn_PostLimbDraw, &this->actor);
}
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_06005458));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
EnRsn_OverrideLimbDraw, EnRsn_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -9,7 +9,9 @@ void EnScopecoin_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnScopecoin_Update(Actor* thisx, GlobalContext* globalCtx);
void EnScopecoin_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80BFCFA0(EnScopecoin* this, GlobalContext* globalCtx);
void func_80BFCFB8(EnScopecoin* this, GlobalContext* globalCtx);
const ActorInit En_Scopecoin_InitVars = {
ACTOR_EN_SCOPECOIN,
ACTORCAT_NPC,
@ -21,16 +23,73 @@ const ActorInit En_Scopecoin_InitVars = {
(ActorFunc)EnScopecoin_Update,
(ActorFunc)EnScopecoin_Draw
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/func_80BFCFA0.asm")
void func_80BFCFA0(EnScopecoin* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += 500;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/func_80BFCFB8.asm")
void func_80BFCFB8(EnScopecoin* this, GlobalContext* globalCtx) {
if (Actor_GetCollectibleFlag(globalCtx, (this->actor.params & 0x7F0) >> 4)) {
func_800A7730(globalCtx, &this->actor.world, 2);
Actor_MarkForDeath(&this->actor);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/EnScopecoin_Init.asm")
void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) {
EnScopecoin* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/EnScopecoin_Destroy.asm")
Actor_SetScale(&this->actor, 0.01f);
Actor_SetDrawParams(&this->actor.shape, 0, func_800B3FC0, 10.0f);
this->unk148 = (this->actor.params & 0xF);
if (this->unk148 < 0 || this->unk148 >= 8) {
this->unk148 = 0;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/EnScopecoin_Update.asm")
if (globalCtx->actorCtx.unk5 & 2) {
if (this->unk148 == 2 || this->unk148 == 6) {
if (Actor_GetCollectibleFlag(globalCtx, (this->actor.params & 0x7F0) >> 4)) {
Actor_MarkForDeath(&this->actor);
return;
}
}
this->actor.shape.yOffset = 700.0f;
this->actionFunc = func_80BFCFA0;
return;
}
if (this->unk148 == 2 || this->unk148 == 6) {
if (Actor_GetCollectibleFlag(globalCtx, (this->actor.params & 0x7F0) >> 4)) {
Actor_MarkForDeath(&this->actor);
} else {
this->actor.draw = NULL;
this->actionFunc = func_80BFCFB8;
}
} else {
Actor_MarkForDeath(&this->actor);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Scopecoin_0x80BFCFA0/EnScopecoin_Draw.asm")
void EnScopecoin_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void EnScopecoin_Update(Actor* thisx, GlobalContext* globalCtx) {
EnScopecoin* this = THIS;
this->actionFunc(this, globalCtx);
}
static UNK_PTR D_80BFD280[] = {D_04061FC0, D_04061FE0, D_04062000, D_04062040, D_04062020, D_04062060, D_04062000};
void EnScopecoin_Draw(Actor *thisx, GlobalContext *globalCtx) {
EnScopecoin* this = THIS;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
func_8012C28C(globalCtx->state.gfxCtx);
func_800B8050(&this->actor, globalCtx, 0);
OPEN_DISPS(gfxCtx);
gSPMatrix(POLY_OPA_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_80BFD280[this->unk148]));
gSPDisplayList(POLY_OPA_DISP++, D_040622C0);
CLOSE_DISPS(gfxCtx);
}

View File

@ -5,9 +5,13 @@
struct EnScopecoin;
typedef void (*EnScopecoinActionFunc)(struct EnScopecoin*, GlobalContext*);
typedef struct EnScopecoin {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x8];
/* 0x144 */ EnScopecoinActionFunc actionFunc;
/* 0x148 */ s16 unk148;
/* 0x14A */ s16 unk14A;
} EnScopecoin; // size = 0x14C
extern const ActorInit En_Scopecoin_InitVars;