1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#include "transition_wipe.h"
#include "gfx.h"
#include "save.h"
#include "tex_len.h"
#include "transition_instances.h"
typedef enum TransitionWipeDirection {
/* 0 */ TRANS_WIPE_DIR_IN,
/* 1 */ TRANS_WIPE_DIR_OUT
} TransitionWipeDirection;
Vtx sTransWipeVtx[25] = {
#include "assets/code/fbdemo_wipe1/sTransWipeVtx.inc.c"
};
#define sTransWipeTex_WIDTH 64
#define sTransWipeTex_HEIGHT 64
u64 sTransWipeTex[TEX_LEN(u64, sTransWipeTex_WIDTH, sTransWipeTex_HEIGHT, 4)] = {
#include "assets/code/fbdemo_wipe1/sTransWipeTex.i4.inc.c"
};
Gfx sTransWipeDL[31] = {
#include "assets/code/fbdemo_wipe1/sTransWipeDL.inc.c"
};
// unused.
Gfx sTransWipeSyncDL[] = {
gsDPPipeSync(),
gsSPEndDisplayList(),
};
void TransitionWipe_Start(void* thisx) {
TransitionWipe* this = (TransitionWipe*)thisx;
this->isDone = false;
if (this->direction != TRANS_WIPE_DIR_IN) {
this->texY = (s32)(83.25f * (1 << 2));
} else {
this->texY = (s32)(153.0f * (1 << 2));
}
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);
}
void* TransitionWipe_Init(void* thisx) {
TransitionWipe* this = (TransitionWipe*)thisx;
bzero(this, sizeof(TransitionWipe));
return this;
}
void TransitionWipe_Destroy(void* thisx) {
}
void TransitionWipe_Update(void* thisx, s32 updateRate) {
TransitionWipe* this = (TransitionWipe*)thisx;
if (this->direction != TRANS_WIPE_DIR_IN) {
this->texY += (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate;
if (this->texY >= (s32)(153.0f * (1 << 2))) {
this->texY = (s32)(153.0f * (1 << 2));
this->isDone = true;
}
} else {
this->texY -= (((void)0, gSaveContext.transWipeSpeed) * 3) / updateRate;
if (this->texY <= (s32)(83.25f * (1 << 2))) {
this->texY = (s32)(83.25f * (1 << 2));
this->isDone = true;
}
}
}
void TransitionWipe_Draw(void* thisx, Gfx** gfxP) {
Gfx* gfx = *gfxP;
Mtx* modelView;
TransitionWipe* this = (TransitionWipe*)thisx;
Color_RGBA8_u32* color;
s32 pad[3];
Gfx* texScroll;
modelView = this->modelView[this->frame];
this->frame ^= 1;
guScale(&modelView[0], 0.56f, 0.56f, 1.0f);
guRotate(&modelView[1], 0.0f, 0.0f, 0.0f, 1.0f);
guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f);
gDPPipeSync(gfx++);
texScroll = Gfx_BranchTexScroll(&gfx, this->texX, this->texY, 0, 0);
gSPSegment(gfx++, 8, texScroll);
color = &this->color;
gDPSetPrimColor(gfx++, 0, 0x80, color->r, color->g, color->b, 255);
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);
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);
gSPDisplayList(gfx++, sTransWipeDL);
gDPPipeSync(gfx++);
*gfxP = gfx;
}
s32 TransitionWipe_IsDone(void* thisx) {
TransitionWipe* this = (TransitionWipe*)thisx;
return this->isDone;
}
void TransitionWipe_SetType(void* thisx, s32 type) {
TransitionWipe* this = (TransitionWipe*)thisx;
if (type == TRANS_INSTANCE_TYPE_FILL_OUT) {
this->direction = TRANS_WIPE_DIR_OUT;
} else {
this->direction = TRANS_WIPE_DIR_IN;
}
if (this->direction != TRANS_WIPE_DIR_IN) {
this->texY = (s32)(83.25f * (1 << 2));
} else {
this->texY = (s32)(153.0f * (1 << 2));
}
}
void TransitionWipe_SetColor(void* thisx, u32 color) {
TransitionWipe* this = (TransitionWipe*)thisx;
this->color.rgba = color;
}
void TransitionWipe_SetUnkColor(void* thisx, u32 color) {
TransitionWipe* this = (TransitionWipe*)thisx;
this->unkColor.rgba = color;
}
|