mirror of https://github.com/zeldaret/mm.git
Fbdemo_circle OK (#1024)
* some progress, nasty draw func only thing to do * pushing for engineer * matching with no warnings * fixes * minor names * PR feedback * fixes for PR * docs * PR comments * fixing format and found bit shift
This commit is contained in:
parent
4833c08364
commit
6c414889c9
|
|
@ -2420,15 +2420,16 @@ void* TransitionFade_Init(void* param_1);
|
|||
// void TransitionFade_IsDone(void);
|
||||
// void TransitionFade_SetColor(void);
|
||||
// void TransitionFade_SetType(void);
|
||||
// void TransitionCircle_Start(void);
|
||||
// void TransitionCircle_Init(void);
|
||||
// void TransitionCircle_Destroy(void);
|
||||
// void TransitionCircle_Update(void);
|
||||
// void TransitionCircle_SetColor(void);
|
||||
// void TransitionCircle_SetType(void);
|
||||
void func_80164C14(Gfx** arg0, TexturePtr* arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, f32 arg6);
|
||||
// void TransitionCircle_Draw(void);
|
||||
// void TransitionCircle_IsDone(void);
|
||||
void TransitionCircle_Start(void* thisx);
|
||||
void* TransitionCircle_Init(void* thisx);
|
||||
void TransitionCircle_Destroy(void* thisx);
|
||||
void TransitionCircle_Update(void* thisx);
|
||||
void TransitionCircle_SetColor(void* thisx, u32 color);
|
||||
void TransitionCircle_SetType(void* thisx, s32 type);
|
||||
void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
|
||||
f32 arg6);
|
||||
void TransitionCircle_Draw(void* thisx, Gfx** gfxp);
|
||||
s32 TransitionCircle_IsDone(void* thisx);
|
||||
// void func_801651B0(void);
|
||||
// void func_80165224(void);
|
||||
// void func_80165288(void);
|
||||
|
|
|
|||
|
|
@ -1472,7 +1472,7 @@ extern KaleidoMgrOverlay* gKaleidoMgrCurOvl;
|
|||
// extern UNK_TYPE1 D_801D0C80;
|
||||
// extern UNK_TYPE1 D_801D0CB0;
|
||||
extern const TransitionInit TransitionFade_InitVars;
|
||||
// extern UNK_TYPE1 D_801D0D00;
|
||||
extern Gfx D_801D0D00[];
|
||||
extern const TransitionInit TransitionCircle_InitVars;
|
||||
extern s32 gDbgCamEnabled;
|
||||
// extern UNK_TYPE1 D_801D0D54;
|
||||
|
|
@ -2703,7 +2703,7 @@ extern f32 D_801DE860;
|
|||
extern f32 D_801DE864;
|
||||
extern f32 D_801DE868;
|
||||
extern f32 D_801DE884;
|
||||
extern TexturePtr gCircleTex;
|
||||
extern TexturePtr gCircleTex[];
|
||||
extern f32 D_801DF090;
|
||||
extern f32 D_801DF094;
|
||||
extern f32 D_801DF0A0;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "ultra64.h"
|
||||
|
||||
#define TC_SET_PARAMS (1 << 7)
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* (*init)(void* transition);
|
||||
/* 0x04 */ void (*destroy)(void* transition);
|
||||
|
|
@ -21,8 +23,29 @@ typedef struct {
|
|||
|
||||
extern const TransitionInit TransitionFade_InitVars;
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TRANSITION_CIRCLE_IN,
|
||||
/* 1 */ TRANSITION_CIRCLE_OUT,
|
||||
} TransitionCircleDirection;
|
||||
|
||||
#define FBDEMO_CIRCLE_GET_MASK_TYPE(type) (type & 1)
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_0[0x20];
|
||||
/* 0x00 */ Color_RGBA8_u32 color;
|
||||
/* 0x04 */ f32 referenceRadius; // Reference for where to transition to
|
||||
/* 0x08 */ f32 stepValue; // How fast the Transition is
|
||||
/* 0x0C */ f32 startingRadius; // Radius value where transition will begin
|
||||
/* 0x10 */ f32 targetRadius; // Final radius of transition circle
|
||||
/* 0x14 */ u8 direction; // Direction the circle is transitioning ( In / Out )
|
||||
/* 0x15 */ u8 maskType; // Positive / Negative mask type. Value of 0 will create a black circle
|
||||
/* 0x16 */ u8 isDone; // Signals when Transition is done updating
|
||||
/* 0x17 */ UNK_TYPE1 pad_17; // struct padding
|
||||
/* 0x18 */ TexturePtr texture;
|
||||
/* 0x1C */ u8 masks;
|
||||
/* 0x1D */ u8 maskt;
|
||||
/* 0x1E */ s8 unk_1E; // Set to 4 and never used
|
||||
/* 0x1F */ s8 unk_1F; // Set to 0 and never used
|
||||
} TransitionCircle; // size = 0x20
|
||||
|
||||
extern const TransitionInit TransitionCircle_InitVars;
|
||||
|
|
|
|||
1
spec
1
spec
|
|
@ -554,7 +554,6 @@ beginseg
|
|||
include "build/data/code/z_fbdemo.data.o"
|
||||
include "build/src/code/z_fbdemo_fade.o"
|
||||
include "build/src/code/z_fbdemo_circle.o"
|
||||
include "build/data/code/z_fbdemo_circle.data.o"
|
||||
include "build/src/code/z_overlay.o"
|
||||
include "build/src/code/z_play.o"
|
||||
include "build/data/code/z_play.data.o"
|
||||
|
|
|
|||
|
|
@ -2609,7 +2609,8 @@ s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) {
|
|||
}
|
||||
|
||||
void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
|
||||
func_80164C14(gfxP, &gCircleTex, 4, 0, 6, 6, ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f);
|
||||
TransitionCircle_LoadAndSetTexture(gfxP, gCircleTex, 4, 0, 6, 6,
|
||||
((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f);
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
|
|
|
|||
|
|
@ -1,19 +1,144 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Start.s")
|
||||
Gfx D_801D0D00[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetOtherMode(G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | FORCE_BL |
|
||||
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)),
|
||||
gsDPSetPrimColor(0, 255, 0, 0, 0, 1),
|
||||
gsDPSetBlendColor(0, 0, 0, 1),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Init.s")
|
||||
//! @bug: TransitionCircle_Update should take an additional argument `s32 updateRate`
|
||||
const TransitionInit TransitionCircle_InitVars = {
|
||||
TransitionCircle_Init, TransitionCircle_Destroy, (void*)TransitionCircle_Update, TransitionCircle_Draw,
|
||||
TransitionCircle_Start, TransitionCircle_SetType, TransitionCircle_SetColor, NULL,
|
||||
TransitionCircle_IsDone,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Destroy.s")
|
||||
void TransitionCircle_Start(void* thisx) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Update.s")
|
||||
this->stepValue = 0.1f;
|
||||
if (this->direction == TRANSITION_CIRCLE_IN) {
|
||||
this->targetRadius = 0.0f;
|
||||
this->startingRadius = 1.0f;
|
||||
} else {
|
||||
this->startingRadius = 0.0f;
|
||||
this->targetRadius = 1.0f;
|
||||
}
|
||||
this->referenceRadius = this->startingRadius;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetColor.s")
|
||||
void* TransitionCircle_Init(void* thisx) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetType.s")
|
||||
bzero(this, sizeof(TransitionCircle));
|
||||
this->maskType = 1;
|
||||
this->texture = gCircleTex;
|
||||
this->masks = 6;
|
||||
this->maskt = 6;
|
||||
this->unk_1E = 4;
|
||||
this->unk_1F = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/func_80164C14.s")
|
||||
return this;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Draw.s")
|
||||
void TransitionCircle_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_IsDone.s")
|
||||
void TransitionCircle_Update(void* thisx) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
this->isDone = Math_StepToF(&this->referenceRadius, this->targetRadius, this->stepValue);
|
||||
}
|
||||
|
||||
void TransitionCircle_SetColor(void* thisx, u32 color) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionCircle_SetType(void* thisx, s32 type) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
if (type & TC_SET_PARAMS) {
|
||||
this->maskType = FBDEMO_CIRCLE_GET_MASK_TYPE(type);
|
||||
} else if (type == 1) {
|
||||
this->direction = TRANSITION_CIRCLE_OUT;
|
||||
} else {
|
||||
this->direction = TRANSITION_CIRCLE_IN;
|
||||
}
|
||||
}
|
||||
|
||||
void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
|
||||
f32 arg6) {
|
||||
Gfx* gfx = *gfxp;
|
||||
s32 xh = D_801FBBCC;
|
||||
s32 yh = D_801FBBCE;
|
||||
s32 width = 1 << masks;
|
||||
s32 height = 1 << maskt;
|
||||
f32 s;
|
||||
f32 t;
|
||||
s32 dtdy;
|
||||
s32 dsdx;
|
||||
|
||||
gDPLoadTextureBlock_4b(gfx++, texture, fmt, width, height, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP,
|
||||
masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gDPSetTileSize(gfx++, G_TX_RENDERTILE, ((SCREEN_WIDTH / 2) - width) << 2, ((SCREEN_HEIGHT / 2) - height) << 2,
|
||||
((SCREEN_WIDTH / 2) + (width - 1)) << 2, ((SCREEN_HEIGHT / 2) + (height - 1)) << 2);
|
||||
|
||||
s = ((1.0f - (1.0f / arg6)) * (SCREEN_WIDTH / 2)) + 70.0f;
|
||||
t = ((1.0f - (1.0f / arg6)) * (SCREEN_HEIGHT / 2)) + 50.0f;
|
||||
|
||||
if (s < -1023.0f) {
|
||||
s = -1023.0f;
|
||||
}
|
||||
if (t < -1023.0f) {
|
||||
t = -1023.0f;
|
||||
}
|
||||
|
||||
if ((s <= -1023.0f) || (t <= -1023.0f)) {
|
||||
dsdx = 0;
|
||||
dtdy = 0;
|
||||
} else {
|
||||
dsdx = ((SCREEN_WIDTH - (2.0f * s)) / gScreenWidth) * (1 << 10);
|
||||
dtdy = ((SCREEN_HEIGHT - (2.0f * t)) / gScreenHeight) * (1 << 10);
|
||||
}
|
||||
|
||||
gSPTextureRectangle(gfx++, 0, 0, xh << 2, yh << 2, G_TX_RENDERTILE, (s32)(s * (1 << 5)), (s32)(t * (1 << 5)), dsdx,
|
||||
dtdy);
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
*gfxp = gfx;
|
||||
}
|
||||
|
||||
void TransitionCircle_Draw(void* thisx, Gfx** gfxp) {
|
||||
Gfx* gfx = *gfxp;
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gSPDisplayList(gfx++, &D_801D0D00);
|
||||
gDPSetPrimColor(gfx++, 0, this->color.a, this->color.r, this->color.g, this->color.b, 1);
|
||||
if (this->maskType == 0) {
|
||||
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
|
||||
PRIM_LOD_FRAC, PRIMITIVE);
|
||||
} else {
|
||||
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, 1, TEXEL0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, 1, TEXEL0,
|
||||
PRIM_LOD_FRAC, PRIMITIVE);
|
||||
}
|
||||
TransitionCircle_LoadAndSetTexture(&gfx, this->texture, G_IM_FMT_I, 0, this->masks, this->maskt,
|
||||
this->referenceRadius);
|
||||
gDPPipeSync(gfx++);
|
||||
|
||||
*gfxp = gfx;
|
||||
}
|
||||
|
||||
s32 TransitionCircle_IsDone(void* thisx) {
|
||||
TransitionCircle* this = (TransitionCircle*)thisx;
|
||||
|
||||
return this->isDone;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue