mirror of https://github.com/zeldaret/mm.git
Fbdemo_triforce OK with documentation (#1053)
* close to done * OK and doc'd * PR feedback * 4mat * PR feedback round 2 * fixed engineers comment
This commit is contained in:
parent
cdee1fc45b
commit
b4adfb0a22
|
@ -0,0 +1,8 @@
|
|||
<Root>
|
||||
<File Name="ovl_fbdemo_triforce" BaseAddress="0x80AC5070" RangeStart="0x5C0" RangeEnd="0x690">
|
||||
<DList Name="sTriforceWipeDL" Offset="0x5C0"/>
|
||||
<Array Name="sTriforceWipeVtx" Count="10" Offset="0x5F0">
|
||||
<Vtx/>
|
||||
</Array>
|
||||
</File>
|
||||
</Root>
|
|
@ -200,7 +200,7 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags);
|
|||
OSIntMask osSetIntMask(OSIntMask im);
|
||||
// OSIntMask osGetIntMask(void);
|
||||
// void osVoiceSetWord(void);
|
||||
// void guScale(void);
|
||||
void guScale(Mtx* mtx, f32 x, f32 y, f32 z);
|
||||
f32 sinf(f32 __x);
|
||||
s16 sins(u16 x);
|
||||
OSTask* _VirtualToPhysicalTask(OSTask* intp);
|
||||
|
@ -383,7 +383,7 @@ u32 osAiGetLength(void);
|
|||
s32 osEPiWriteIo(OSPiHandle* pihandle, u32 devAddr, u32 data);
|
||||
void osMapTLBRdb(void);
|
||||
void osYieldThread(void);
|
||||
// void guTranslate(void);
|
||||
void guTranslate(Mtx* mtx, f32 x, f32 y, f32 z);
|
||||
u32 __osGetCause(void);
|
||||
s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force);
|
||||
s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data);
|
||||
|
|
3
spec
3
spec
|
@ -3228,8 +3228,7 @@ beginseg
|
|||
name "ovl_fbdemo_triforce"
|
||||
compress
|
||||
include "build/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.o"
|
||||
include "build/data/ovl_fbdemo_triforce/ovl_fbdemo_triforce.data.o"
|
||||
include "build/data/ovl_fbdemo_triforce/ovl_fbdemo_triforce.reloc.o"
|
||||
include "build/src/overlays/fbdemos/ovl_fbdemo_triforce/ovl_fbdemo_triforce_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_fbdemo_triforce.h"
|
||||
#include "assets/objects/object_fbdemo_triforce/ovl_fbdemo_triforce.c"
|
||||
|
||||
void* TransitionTriforce_Init(void* thisx);
|
||||
void TransitionTriforce_Destroy(void* thisx);
|
||||
|
@ -15,35 +16,132 @@ void TransitionTriforce_SetType(void* thisx, s32 type);
|
|||
void TransitionTriforce_SetColor(void* thisx, u32 color);
|
||||
s32 TransitionTriforce_IsDone(void* thisx);
|
||||
|
||||
#if 0
|
||||
const TransitionInit TransitionTriforce_InitVars = {
|
||||
TransitionTriforce_Init,
|
||||
TransitionTriforce_Destroy,
|
||||
TransitionTriforce_Update,
|
||||
TransitionTriforce_Draw,
|
||||
TransitionTriforce_Start,
|
||||
TransitionTriforce_SetType,
|
||||
TransitionTriforce_SetColor,
|
||||
NULL,
|
||||
TransitionTriforce_Init, TransitionTriforce_Destroy, TransitionTriforce_Update, TransitionTriforce_Draw,
|
||||
TransitionTriforce_Start, TransitionTriforce_SetType, TransitionTriforce_SetColor, NULL,
|
||||
TransitionTriforce_IsDone,
|
||||
};
|
||||
|
||||
#endif
|
||||
void TransitionTriforce_Start(void* thisx) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Start.s")
|
||||
switch (this->state) {
|
||||
case STATE_SPIRAL_IN_SLOW:
|
||||
case STATE_SPIRAL_IN_FAST:
|
||||
this->transPos = 1.0f;
|
||||
return;
|
||||
}
|
||||
this->transPos = 0.03f;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Init.s")
|
||||
void* TransitionTriforce_Init(void* thisx) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Destroy.s")
|
||||
bzero(this, sizeof(TransitionTriforce));
|
||||
guOrtho(&this->projection, -SCREEN_WIDTH / 2, SCREEN_WIDTH / 2, -SCREEN_HEIGHT / 2, SCREEN_HEIGHT / 2, -1000.0f,
|
||||
1000.0f, 1.0f);
|
||||
this->transPos = 1.0f;
|
||||
this->state = STATE_SPIRAL_IN_FAST;
|
||||
this->step = 0.015f;
|
||||
this->fadeType = TYPE_TRANSPARENT_TRIFORCE;
|
||||
return this;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Update.s")
|
||||
void TransitionTriforce_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_SetColor.s")
|
||||
void TransitionTriforce_Update(void* thisx, s32 updateRate) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_SetType.s")
|
||||
for (i = updateRate; i > 0; i--) {
|
||||
if (this->state == STATE_SPIRAL_IN_SLOW) {
|
||||
this->transPos = CLAMP_MIN(this->transPos * (1.0f - this->step), 0.03f);
|
||||
} else if (this->state == STATE_SPIRAL_IN_FAST) {
|
||||
this->transPos = CLAMP_MIN(this->transPos - this->step, 0.03f);
|
||||
} else if (this->state == STATE_SPIRAL_OUT_SLOW) {
|
||||
this->transPos = CLAMP_MAX(this->transPos / (1.0f - this->step), 1.0f);
|
||||
} else if (this->state == STATE_SPIRAL_OUT_FAST) {
|
||||
this->transPos = CLAMP_MAX(this->transPos + this->step, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/func_80AC5280.s")
|
||||
void TransitionTriforce_SetColor(void* thisx, u32 color) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Draw.s")
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_IsDone.s")
|
||||
void TransitionTriforce_SetType(void* thisx, s32 type) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
this->fadeType = type;
|
||||
}
|
||||
|
||||
void TransitionTriforce_SetState(void* thisx, s32 state) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView;
|
||||
s32 pad[2];
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
f32 rotation = this->transPos * 360.0f;
|
||||
|
||||
modelView = this->modelView[this->frame];
|
||||
this->frame ^= 1;
|
||||
guScale(&modelView[0], this->transPos * 0.625f, this->transPos * 0.625f, 1.0f);
|
||||
guRotate(&modelView[1], rotation, 0.0f, 0.0f, 1.0f);
|
||||
guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f);
|
||||
gDPPipeSync(gfx++);
|
||||
gSPDisplayList(gfx++, sTriforceWipeDL);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba);
|
||||
gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||
gSPMatrix(gfx++, &this->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
gSPVertex(gfx++, &sTriforceWipeVtx, ARRAY_COUNT(sTriforceWipeVtx), 0);
|
||||
if (!TransitionTriforce_IsDone(this)) {
|
||||
switch (this->fadeType) {
|
||||
case TYPE_TRANSPARENT_TRIFORCE:
|
||||
gSP2Triangles(gfx++, 0, 4, 5, 0, 4, 1, 3, 0);
|
||||
gSP1Triangle(gfx++, 5, 3, 2, 0);
|
||||
break;
|
||||
|
||||
case TYPE_FILLED_TRIFORCE:
|
||||
gSP2Triangles(gfx++, 3, 4, 5, 0, 0, 2, 6, 0);
|
||||
gSP2Triangles(gfx++, 0, 6, 7, 0, 1, 0, 7, 0);
|
||||
gSP2Triangles(gfx++, 1, 7, 8, 0, 1, 8, 9, 0);
|
||||
gSP2Triangles(gfx++, 1, 9, 2, 0, 2, 9, 6, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (this->fadeType) {
|
||||
case TYPE_TRANSPARENT_TRIFORCE:
|
||||
break;
|
||||
|
||||
case TYPE_FILLED_TRIFORCE:
|
||||
gSP1Quadrangle(gfx++, 6, 7, 8, 9, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
s32 TransitionTriforce_IsDone(void* thisx) {
|
||||
TransitionTriforce* this = (TransitionTriforce*)thisx;
|
||||
|
||||
if ((this->state == STATE_SPIRAL_IN_SLOW) || (this->state == STATE_SPIRAL_IN_FAST)) {
|
||||
return this->transPos <= 0.03f;
|
||||
} else if ((this->state == STATE_SPIRAL_OUT_SLOW) || (this->state == STATE_SPIRAL_OUT_FAST)) {
|
||||
return (this->transPos >= 1.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,29 @@
|
|||
|
||||
#include "global.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ STATE_NONE,
|
||||
/* 1 */ STATE_SPIRAL_IN_SLOW,
|
||||
/* 2 */ STATE_SPIRAL_IN_FAST,
|
||||
/* 3 */ STATE_SPIRAL_OUT_SLOW,
|
||||
/* 4 */ STATE_SPIRAL_OUT_FAST
|
||||
} FbTriforceState;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TYPE_NONE,
|
||||
/* 1 */ TYPE_TRANSPARENT_TRIFORCE,
|
||||
/* 2 */ TYPE_FILLED_TRIFORCE
|
||||
} TriforceFadeType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ char unk_0[0x1E0];
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ f32 transPos;
|
||||
/* 0x008 */ f32 step;
|
||||
/* 0x00C */ s32 state;
|
||||
/* 0x010 */ s32 fadeType;
|
||||
/* 0x018 */ Mtx projection;
|
||||
/* 0x058 */ s32 frame;
|
||||
/* 0x060 */ Mtx modelView[2][3];
|
||||
} TransitionTriforce; // size = 0x1E0
|
||||
|
||||
extern const TransitionInit TransitionTriforce_InitVars;
|
||||
|
|
|
@ -11956,7 +11956,7 @@
|
|||
0x80AC5154:("TransitionTriforce_Update",),
|
||||
0x80AC5268:("TransitionTriforce_SetColor",),
|
||||
0x80AC5274:("TransitionTriforce_SetType",),
|
||||
0x80AC5280:("func_80AC5280",),
|
||||
0x80AC5280:("TransitionTriforce_SetState",),
|
||||
0x80AC528C:("TransitionTriforce_Draw",),
|
||||
0x80AC559C:("TransitionTriforce_IsDone",),
|
||||
0x80AC57B0:("TransitionWipe1_Start",),
|
||||
|
|
|
@ -12926,8 +12926,8 @@
|
|||
0x80AC4F60:("D_80AC4F60","f32","",0x4),
|
||||
0x80AC4F64:("D_80AC4F64","f32","",0x4),
|
||||
0x80AC5060:("D_80AC5060","UNK_TYPE1","",0x1),
|
||||
0x80AC5630:("D_80AC5630","UNK_TYPE1","",0x1),
|
||||
0x80AC5660:("D_80AC5660","UNK_TYPE1","",0x1),
|
||||
0x80AC5630:("sTriforceWipeDL","UNK_TYPE1","",0x1),
|
||||
0x80AC5660:("sTriforceWipeVtx","UNK_TYPE1","",0x1),
|
||||
0x80AC5700:("TransitionTriforce_InitVars","UNK_PTR","",0x4),
|
||||
0x80AC5730:("D_80AC5730","f32","",0x4),
|
||||
0x80AC5734:("D_80AC5734","f32","",0x4),
|
||||
|
|
Loading…
Reference in New Issue