mirror of https://github.com/zeldaret/mm.git
fbdemo wipe 3 Matching (#1254)
* OK * PR fixes * someone please add clang-format-11 to the AUR thanks * Add outname * Update z_fbdemo_wipe3.c * ARRAY_COUNTU
This commit is contained in:
parent
51cd9df591
commit
f8ac9d2e9a
|
@ -0,0 +1,13 @@
|
|||
<Root>
|
||||
<File Name="ovl_fbdemo_wipe3" BaseAddress="0x80AC6740" RangeStart="0x520" RangeEnd="0x1C10">
|
||||
<Texture Name="fbdemo_tex_000520" OutName="tex_000520" Format="i8" Width="16" Height="64" Offset="0x520"/>
|
||||
<Texture Name="fbdemo_tex_000920" OutName="tex_000920" Format="i8" Width="16" Height="64" Offset="0x920"/>
|
||||
<Texture Name="fbdemo_tex_000D20" OutName="tex_000D20" Format="i8" Width="16" Height="64" Offset="0xD20"/>
|
||||
<Texture Name="fbdemo_tex_001120" OutName="tex_001120" Format="i8" Width="16" Height="64" Offset="0x1120"/>
|
||||
<Texture Name="fbdemo_tex_001520" OutName="tex_001520" Format="i8" Width="16" Height="64" Offset="0x1520"/>
|
||||
<Array Name="sTransWipe3Vtx" Count="34" Offset="0x1920">
|
||||
<Vtx/>
|
||||
</Array>
|
||||
<DList Name="sTransWipe3DL" Offset="0x1B40"/>
|
||||
</File>
|
||||
</Root>
|
3
spec
3
spec
|
@ -3195,8 +3195,7 @@ beginseg
|
|||
name "ovl_fbdemo_wipe3"
|
||||
compress
|
||||
include "build/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.o"
|
||||
include "build/data/ovl_fbdemo_wipe3/ovl_fbdemo_wipe3.data.o"
|
||||
include "build/data/ovl_fbdemo_wipe3/ovl_fbdemo_wipe3.reloc.o"
|
||||
include "build/src/overlays/fbdemos/ovl_fbdemo_wipe3/ovl_fbdemo_wipe3_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "global.h"
|
||||
#include "z_fbdemo_wipe3.h"
|
||||
|
||||
#define THIS ((TransitionWipe3*)thisx)
|
||||
|
||||
void* TransitionWipe3_Init(void* thisx);
|
||||
void TransitionWipe3_Destroy(void* thisx);
|
||||
void TransitionWipe3_Update(void* thisx, s32 updateRate);
|
||||
|
@ -17,37 +19,159 @@ void TransitionWipe3_SetColor(void* thisx, u32 color);
|
|||
void TransitionWipe3_SetEnvColor(void* thisx, u32 color);
|
||||
s32 TransitionWipe3_IsDone(void* thisx);
|
||||
|
||||
#if 0
|
||||
TransitionInit TransitionWipe3_InitVars = {
|
||||
TransitionWipe3_Init,
|
||||
TransitionWipe3_Destroy,
|
||||
TransitionWipe3_Update,
|
||||
TransitionWipe3_Draw,
|
||||
TransitionWipe3_Start,
|
||||
TransitionWipe3_SetType,
|
||||
TransitionWipe3_SetColor,
|
||||
TransitionWipe3_SetEnvColor,
|
||||
TransitionWipe3_IsDone,
|
||||
#include "assets/overlays/ovl_fbdemo_wipe3/ovl_fbdemo_wipe3.c"
|
||||
|
||||
TexturePtr sTransWipe3Textures[] = {
|
||||
fbdemo_tex_000520, fbdemo_tex_000920, fbdemo_tex_000D20, fbdemo_tex_001120,
|
||||
fbdemo_tex_001520, fbdemo_tex_000520, fbdemo_tex_000520, fbdemo_tex_000520,
|
||||
};
|
||||
|
||||
#endif
|
||||
TransitionInit TransitionWipe3_InitVars = {
|
||||
TransitionWipe3_Init, TransitionWipe3_Destroy, TransitionWipe3_Update,
|
||||
TransitionWipe3_Draw, TransitionWipe3_Start, TransitionWipe3_SetType,
|
||||
TransitionWipe3_SetColor, TransitionWipe3_SetEnvColor, TransitionWipe3_IsDone,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_Start.s")
|
||||
#define TRANS3_GET_SPEED(type) (type & 1)
|
||||
#define TRANS3_GET_TEX_INDEX(type) ((type >> 1) & 7)
|
||||
#define TRANS3_GET_COLOR(type) ((type >> 4) & 3)
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_Init.s")
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_WIPE3_DIR_IN,
|
||||
/* 1 */ TRANS_WIPE3_DIR_OUT
|
||||
} TransitionWipe3Direction;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_Destroy.s")
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_WIPE3_SPEED_SLOW,
|
||||
/* 1 */ TRANS_WIPE3_SPEED_FAST
|
||||
} TransitionWipe3Speed;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/func_80AC68B4.s")
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_WIPE3_COLOR_BLACK,
|
||||
/* 1 */ TRANS_WIPE3_COLOR_WHITE,
|
||||
/* 2 */ TRANS_WIPE3_COLOR_GRAY
|
||||
} TransitionWipe3Color;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_Update.s")
|
||||
void TransitionWipe3_Start(void* thisx) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_Draw.s")
|
||||
this->isDone = false;
|
||||
this->curTexture = sTransWipe3Textures[this->texIndex % ARRAY_COUNTU(sTransWipe3Textures)];
|
||||
if (this->speedType == TRANS_WIPE3_SPEED_SLOW) {
|
||||
this->wipeSpeed = 20;
|
||||
} else {
|
||||
this->wipeSpeed = 10;
|
||||
}
|
||||
if (this->colorType == TRANS_WIPE3_COLOR_BLACK) {
|
||||
this->color.rgba = RGBA8(0, 0, 0, 255);
|
||||
} else if (this->colorType == TRANS_WIPE3_COLOR_WHITE) {
|
||||
this->color.rgba = RGBA8(255, 255, 255, 255);
|
||||
} else {
|
||||
this->color.rgba = RGBA8(160, 160, 160, 255);
|
||||
}
|
||||
if (this->dir != TRANS_WIPE3_DIR_IN) {
|
||||
this->scrollY = 0;
|
||||
} else {
|
||||
this->scrollY = 500;
|
||||
if (this->texIndex == 2) {
|
||||
func_8019F128(NA_SE_OC_SECRET_WARP_OUT);
|
||||
}
|
||||
}
|
||||
guPerspective(&this->projection, &this->normal, 60.0f, 4.0f / 3.0f, 10.0f, 12800.0f, 1.0f);
|
||||
guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_IsDone.s")
|
||||
void* TransitionWipe3_Init(void* thisx) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_SetType.s")
|
||||
bzero(this, sizeof(TransitionWipe3));
|
||||
return this;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_SetColor.s")
|
||||
void TransitionWipe3_Destroy(void* thisx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe3/TransitionWipe3_SetEnvColor.s")
|
||||
void TransitionWipe3_UpdateScrollY(void* thisx, f32 scroll) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
this->scrollY = (s32)(500.0f * scroll);
|
||||
}
|
||||
|
||||
void TransitionWipe3_Update(void* thisx, s32 updateRate) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
if (this->dir != TRANS_WIPE3_DIR_IN) {
|
||||
if ((this->scrollY == 0) && (this->texIndex == 2)) {
|
||||
func_8019F128(NA_SE_OC_SECRET_WARP_IN);
|
||||
}
|
||||
this->scrollY += (this->wipeSpeed * 3) / updateRate;
|
||||
if (this->scrollY >= 500) {
|
||||
this->scrollY = 500;
|
||||
this->isDone = true;
|
||||
}
|
||||
} else {
|
||||
this->scrollY -= (this->wipeSpeed * 3) / updateRate;
|
||||
if (this->scrollY <= 0) {
|
||||
this->scrollY = 0;
|
||||
this->isDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransitionWipe3_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView = &THIS->modelView[THIS->frame];
|
||||
f32 scale = 14.8f;
|
||||
Gfx* texScroll;
|
||||
|
||||
THIS->frame ^= 1;
|
||||
gDPPipeSync(gfx++);
|
||||
texScroll = Gfx_BranchTexScroll(&gfx, THIS->scrollX, THIS->scrollY, 16, 64);
|
||||
gSPSegment(gfx++, 0x09, texScroll);
|
||||
gSPSegment(gfx++, 0x08, THIS->curTexture);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, THIS->color.rgba);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, THIS->color.rgba);
|
||||
gSPMatrix(gfx++, &THIS->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPPerspNormalize(gfx++, THIS->normal);
|
||||
gSPMatrix(gfx++, &THIS->lookAt, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
||||
|
||||
if (scale != 1.0f) {
|
||||
guScale(modelView, scale, scale, 1.0f);
|
||||
gSPMatrix(gfx++, modelView, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
gSPDisplayList(gfx++, sTransWipe3DL);
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
||||
|
||||
s32 TransitionWipe3_IsDone(void* thisx) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
return this->isDone;
|
||||
}
|
||||
|
||||
void TransitionWipe3_SetType(void* thisx, s32 type) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
if (type & TRANS_TYPE_SET_PARAMS) {
|
||||
this->speedType = TRANS3_GET_SPEED(type);
|
||||
this->texIndex = TRANS3_GET_TEX_INDEX(type);
|
||||
this->colorType = TRANS3_GET_COLOR(type);
|
||||
} else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) {
|
||||
this->dir = TRANS_WIPE3_DIR_OUT;
|
||||
} else {
|
||||
this->dir = TRANS_WIPE3_DIR_IN;
|
||||
}
|
||||
}
|
||||
|
||||
void TransitionWipe3_SetColor(void* thisx, u32 color) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
this->color.rgba = color;
|
||||
}
|
||||
|
||||
void TransitionWipe3_SetEnvColor(void* thisx, u32 color) {
|
||||
TransitionWipe3* this = THIS;
|
||||
|
||||
this->envColor.rgba = color;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,22 @@
|
|||
#include "color.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ char unk_0[0x120];
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x008 */ Color_RGBA8_u32 envColor;
|
||||
/* 0x004 */ u32 scrollX;
|
||||
/* 0x00C */ s32 scrollY;
|
||||
/* 0x010 */ s32 wipeSpeed;
|
||||
/* 0x014 */ u8 dir;
|
||||
/* 0x015 */ u8 colorType;
|
||||
/* 0x016 */ u8 speedType;
|
||||
/* 0x017 */ u8 texIndex;
|
||||
/* 0x018 */ u8 isDone;
|
||||
/* 0x019 */ u8 frame;
|
||||
/* 0x01A */ u16 normal;
|
||||
/* 0x01C */ TexturePtr curTexture;
|
||||
/* 0x020 */ Mtx projection;
|
||||
/* 0x060 */ Mtx lookAt;
|
||||
/* 0x0A0 */ Mtx modelView[2];
|
||||
} TransitionWipe3; // size = 0x120
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11971,7 +11971,7 @@
|
|||
0x80AC6740:("TransitionWipe3_Start",),
|
||||
0x80AC687C:("TransitionWipe3_Init",),
|
||||
0x80AC68A8:("TransitionWipe3_Destroy",),
|
||||
0x80AC68B4:("func_80AC68B4",),
|
||||
0x80AC68B4:("TransitionWipe3_UpdateScrollY",),
|
||||
0x80AC68E0:("TransitionWipe3_Update",),
|
||||
0x80AC69F8:("TransitionWipe3_Draw",),
|
||||
0x80AC6BE4:("TransitionWipe3_IsDone",),
|
||||
|
|
|
@ -12850,15 +12850,14 @@
|
|||
0x80AC65B0:("D_80AC65B0","UNK_TYPE1","",0x1),
|
||||
0x80AC66A8:("TransitionWipe1_InitVars","UNK_PTR","",0x4),
|
||||
0x80AC66D0:("D_80AC66D0","f32","",0x4),
|
||||
0x80AC6C60:("D_80AC6C60","UNK_TYPE1","",0x1),
|
||||
0x80AC7060:("D_80AC7060","UNK_TYPE1","",0x1),
|
||||
0x80AC7460:("D_80AC7460","UNK_TYPE1","",0x1),
|
||||
0x80AC7860:("D_80AC7860","UNK_TYPE1","",0x1),
|
||||
0x80AC7C60:("D_80AC7C60","UNK_TYPE1","",0x1),
|
||||
0x80AC8060:("D_80AC8060","UNK_TYPE1","",0x1),
|
||||
0x80AC8250:("D_80AC8250","UNK_TYPE1","",0x1),
|
||||
0x80AC8280:("D_80AC8280","UNK_TYPE1","",0x1),
|
||||
0x80AC8350:("D_80AC8350","UNK_PTR","",0x4),
|
||||
0x80AC6C60:("fbdemo_tex_000520","UNK_TYPE1","",0x1),
|
||||
0x80AC7060:("fbdemo_tex_000920","UNK_TYPE1","",0x1),
|
||||
0x80AC7460:("fbdemo_tex_000D20","UNK_TYPE1","",0x1),
|
||||
0x80AC7860:("fbdemo_tex_001120","UNK_TYPE1","",0x1),
|
||||
0x80AC7C60:("fbdemo_tex_001520","UNK_TYPE1","",0x1),
|
||||
0x80AC8060:("sTransWipe3Vtx","UNK_TYPE1","",0x1),
|
||||
0x80AC8280:("sTransWipe3DL","UNK_TYPE1","",0x1),
|
||||
0x80AC8350:("sTransWipe3Textures","TexturePtr[]","8",0x4),
|
||||
0x80AC8370:("TransitionWipe3_InitVars","UNK_PTR","",0x4),
|
||||
0x80AC83A0:("D_80AC83A0","f32","",0x4),
|
||||
0x80AC8650:("TransitionWipe4_InitVars","UNK_PTR","",0x4),
|
||||
|
|
Loading…
Reference in New Issue