sprite.c
7.47 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*---------------------------------------------------------------------
Copyright (C) 1997, Nintendo.
File sprite.c
Coded by Yoshitaka Yasumoto. Mar 19, 1997.
Modified by
Comments
$Id: sprite.c,v 1.1.1.1 2002/05/02 03:27:17 blythe Exp $
---------------------------------------------------------------------*/
#include <ultra64.h>
#include <PR/gs2dex.h>
#include "texture.h"
extern u8 ut_gorogoro[];
extern u16 utPal_gorogoro[];
/*---------------------------------------------------------------------------*
* Background 構造体
*---------------------------------------------------------------------------*/
uObjBg objBg = {
0, 328<<2, 0<<2, 320<<2, /* imageX, imageW, frameX, frameW */
0, 240<<2, 0<<2, 240<<2, /* imageY, imageH, frameY, frameH */
0, /* imagePtr */
G_BGLT_LOADBLOCK, /* imageLoad */
G_IM_FMT_RGBA, /* imageFmt */
G_IM_SIZ_16b, /* imageSiz */
0, /* imagePal */
0 /* imageFlip */
};
/* CI8 TLUT ロード */
uObjTxtr objBgTLUT = {
G_OBJLT_TLUT, /* type */
(u64 *)L2_TV_pal, /* image */
GS_PAL_HEAD(1), /* phead */
GS_PAL_NUM(255), /* pnum */
0, /* zero */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/*---------------------------------------------------------------------------*
* 2D Object 構造体
*---------------------------------------------------------------------------*/
/* 格子 */
uObjSprite objRect[] = {{
0<<2, 1<<10, 32<<5, 0, /* objX, scaleX, imageW, paddingX */
0<<2, 1<<10, 32<<5, 0, /* objY, scaleY, imageH, paddingY */
GS_PIX2TMEM(32, G_IM_SIZ_16b), /* imageStride */
GS_PIX2TMEM(0, G_IM_SIZ_16b), /* imageAdrs */
G_IM_FMT_RGBA, /* imageFmt */
G_IM_SIZ_16b, /* imageSiz */
0, /* imagePal */
0 /* imageFlags */
},{
0<<2, 1<<10, 32<<5, 0, /* objX, scaleX, imageW, paddingX */
0<<2, 1<<10, 32<<5, 0, /* objY, scaleY, imageH, paddingY */
GS_PIX2TMEM(32, G_IM_SIZ_16b), /* imageStride */
GS_PIX2TMEM( 0, G_IM_SIZ_16b), /* imageAdrs */
G_IM_FMT_RGBA, /* imageFmt */
G_IM_SIZ_16b, /* imageSiz */
0, /* imagePal */
0 /* imageFlags */
}};
/*---------------------------------------------------------------------------*
* 2D Matrix 構造体
*---------------------------------------------------------------------------*/
uObjMtx objMtx[3] = {
{
0x10000, 0, /* A,B */
0, 0x10000, /* C,D */
0, 0, /* X,Y */
1<<10, 1<<10 /* BaseScaleX, BaseScaleY */
}, {
0x10000, 0, /* A,B */
0, 0x10000, /* C,D */
0, 0, /* X,Y */
1<<10, 1<<10 /* BaseScaleX, BaseScaleY */
}, {
0x10000, 0, /* A,B */
0, 0x10000, /* C,D */
0, 0, /* X,Y */
1<<10, 1<<10 /* BaseScaleX, BaseScaleY */
}
};
/*---------------------------------------------------------------------------*
* Texture ロード構造体
*---------------------------------------------------------------------------*/
/* LoadBlock による RGBA16 Texture ロード */
uObjTxtr objTxtrBlock_RGBA16 = {
G_OBJLT_TXTRBLOCK, /* type */
(u64 *)textureRGBA16, /* image */
GS_PIX2TMEM(0, G_IM_SIZ_16b), /* tmem */
GS_TB_TSIZE(32*32, G_IM_SIZ_16b), /* tsize */
GS_TB_TLINE(32, G_IM_SIZ_16b), /* tline */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/* LoadTile による RGBA16 Texture ロード */
uObjTxtr objTxtrTile_RGBA16 = {
G_OBJLT_TXTRTILE, /* type */
(u64 *)textureRGBA16, /* image */
GS_PIX2TMEM(0, G_IM_SIZ_16b), /* tmem */
GS_TT_TWIDTH(32, G_IM_SIZ_16b), /* twidth */
GS_TT_THEIGHT(32, G_IM_SIZ_16b), /* theight */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/* LoadBlock による CI4 Texture ロード */
uObjTxtr objTxtrBlock_CI4 = {
G_OBJLT_TXTRBLOCK, /* type */
(u64 *)textureCI4, /* image */
GS_PIX2TMEM(0, G_IM_SIZ_4b), /* tmem */
GS_TB_TSIZE(32*32, G_IM_SIZ_4b), /* tsize */
GS_TB_TLINE(32, G_IM_SIZ_4b), /* tline */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/* LoadTile による CI4 Texture ロード */
uObjTxtr objTxtrTile_CI4 = {
G_OBJLT_TXTRTILE, /* type */
(u64 *)textureCI4, /* image */
GS_PIX2TMEM(0, G_IM_SIZ_4b), /* tmem */
GS_TT_TWIDTH(32, G_IM_SIZ_4b), /* twidth */
GS_TT_THEIGHT(32, G_IM_SIZ_4b), /* theight */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/* CI4 TLUT ロード */
uObjTxtr objTLUT_CI4 = {
G_OBJLT_TLUT, /* type */
(u64 *)textureCI4pal, /* image */
GS_PAL_HEAD(0), /* phead */
GS_PAL_NUM(5), /* pnum */
0, /* zero */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/*---------------------------------------------------------------------------*
* TxSprite 構造体
*---------------------------------------------------------------------------*/
uObjTxSprite objBall[] = {
/* 1st part of Ball */
{{ G_OBJLT_TXTRBLOCK, /* type */
(u64 *)ut_gorogoro, /* image */
GS_PIX2TMEM(0, G_IM_SIZ_8b), /* tmem */
GS_TB_TSIZE(64*32, G_IM_SIZ_8b), /* tsize */
GS_TB_TLINE(64, G_IM_SIZ_8b), /* tline */
0, /* sid */
-1, /* flag */
0 /* mask */ },
{ 0<<2, 1<<10, 64<<5, 0, /* objX, scaleX, imageW, paddingX */
32<<2, 1<<10, 32<<5, 0, /* objY, scaleY, imageH, paddingY */
GS_PIX2TMEM(64, G_IM_SIZ_8b), /* imageStride */
GS_PIX2TMEM( 0, G_IM_SIZ_8b), /* imageAdrs */
G_IM_FMT_CI, /* imageFmt */
G_IM_SIZ_8b, /* imageSiz */
0, /* imagePal */
0 /* imageFlags */ }},
/* 2nd part of Ball for PointSample mode */
{{ G_OBJLT_TXTRBLOCK, /* type */
(u64 *)((u32)ut_gorogoro+64*32), /* image */
GS_PIX2TMEM(0, G_IM_SIZ_8b), /* tmem */
GS_TB_TSIZE(64*32, G_IM_SIZ_8b), /* tsize */
GS_TB_TLINE(64, G_IM_SIZ_8b), /* tline */
0, /* sid */
-1, /* flag */
0 /* mask */ },
{ 0<<2, 1<<10, 64<<5, 0, /* objX, scaleX, imageW, paddingX */
64<<2, 1<<10, 32<<5, 0, /* objY, scaleY, imageH, paddingY */
GS_PIX2TMEM(64, G_IM_SIZ_8b), /* imageStride */
GS_PIX2TMEM( 0, G_IM_SIZ_8b), /* imageAdrs */
G_IM_FMT_CI, /* imageFmt */
G_IM_SIZ_8b, /* imageSiz */
0, /* imagePal */
0 /* imageFlags */ }},
/* 3rd part of Ball for Bilerp mode */
{{ G_OBJLT_TXTRBLOCK, /* type */
(u64 *)((u32)ut_gorogoro+64*31), /* image */
GS_PIX2TMEM(0, G_IM_SIZ_8b), /* tmem */
GS_TB_TSIZE(64*32, G_IM_SIZ_8b), /* tsize */
GS_TB_TLINE(64, G_IM_SIZ_8b), /* tline */
0, /* sid */
-1, /* flag */
0 /* mask */ },
{ 0<<2, 1<<10, 64<<5, 0, /* objX, scaleX, imageW, paddingX */
63<<2, 1<<10, 32<<5, 0, /* objY, scaleY, imageH, paddingY */
GS_PIX2TMEM(64, G_IM_SIZ_8b), /* imageStride */
GS_PIX2TMEM( 0, G_IM_SIZ_8b), /* imageAdrs */
G_IM_FMT_CI, /* imageFmt */
G_IM_SIZ_8b, /* imageSiz */
0, /* imagePal */
0 /* imageFlags */ }}
};
/* CI8 TLUT ロード */
uObjTxtr objBallTLUT = {
G_OBJLT_TLUT, /* type */
(u64 *)utPal_gorogoro, /* image */
GS_PAL_HEAD(0), /* phead */
GS_PAL_NUM(256), /* pnum */
0, /* zero */
0, /* sid */
-1, /* flag */
0 /* mask */
};
/*======== End of sprite.c ========*/