Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
gbi_custom.h
Go to the documentation of this file.
1
#ifndef _GBI_CUSTOM_H_
2
#define _GBI_CUSTOM_H_
3
4
#include "
ultra64.h
"
5
6
#define gDPScrollMultiTile2_4b(pkt, timg, fmt, width, height, \
7
uls, ult, lrs, lrt, pal, \
8
cms, cmt, masks, maskt, shifts, shiftt,\
9
scrolls, scrollt) \
10
{ \
11
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width)>>1), timg); \
12
gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \
13
(((((lrs)-(uls)+1)>>1)+7)>>3), 0, \
14
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
15
shifts); \
16
gDPLoadSync(pkt); \
17
gDPLoadTile( pkt, G_TX_LOADTILE, \
18
(uls)<<(G_TEXTURE_IMAGE_FRAC-1), \
19
(ult)<<(G_TEXTURE_IMAGE_FRAC), \
20
(lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \
21
(lrt)<<(G_TEXTURE_IMAGE_FRAC)); \
22
gDPPipeSync(pkt); \
23
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
24
(((((lrs)-(uls)+1)>>1)+7)>>3), 0, \
25
G_TX_RENDERTILE + 1, 0, cmt, maskt, shiftt, cms, masks, \
26
shifts); \
27
gDPSetTileSize(pkt, G_TX_RENDERTILE + 1, \
28
(uls + scrolls)<<G_TEXTURE_IMAGE_FRAC, \
29
(ult + scrollt)<<G_TEXTURE_IMAGE_FRAC, \
30
(lrs + scrolls)<<G_TEXTURE_IMAGE_FRAC, \
31
(lrt + scrollt)<<G_TEXTURE_IMAGE_FRAC) \
32
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
33
(((((lrs)-(uls)+1)>>1)+7)>>3), 0, \
34
G_TX_RENDERTILE + 0, 1, cmt, maskt, shiftt, cms, masks, \
35
shifts); \
36
}
37
38
39
#define gDPScrollTextureTile_4b(pkt, timg, fmt, width, height, \
40
uls, ult, lrs, lrt, pal, \
41
cms, cmt, masks, maskt, shifts, shiftt, \
42
scrolls, scrollt) \
43
\
44
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width)>>1), timg); \
45
gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \
46
(((((lrs)-(uls)+1)>>1)+7)>>3), 0, \
47
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
48
shifts); \
49
gDPLoadSync(pkt); \
50
gDPLoadTile( pkt, G_TX_LOADTILE, \
51
(uls)<<(G_TEXTURE_IMAGE_FRAC-1), \
52
(ult)<<(G_TEXTURE_IMAGE_FRAC), \
53
(lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \
54
(lrt)<<(G_TEXTURE_IMAGE_FRAC)); \
55
gDPPipeSync(pkt); \
56
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
57
(((((lrs)-(uls)+1)>>1)+7)>>3), 0, \
58
G_TX_RENDERTILE, 0, cmt, maskt, shiftt, cms, masks, \
59
shifts); \
60
gDPSetTileSize(pkt, G_TX_RENDERTILE, \
61
(uls + scrolls)<<G_TEXTURE_IMAGE_FRAC, \
62
(ult + scrollt)<<G_TEXTURE_IMAGE_FRAC, \
63
(lrs + scrolls)<<G_TEXTURE_IMAGE_FRAC, \
64
(lrt + scrollt)<<G_TEXTURE_IMAGE_FRAC) \
65
66
67
#define gDPScrollTextureBlock_4b(pkt, timg, fmt, width, height, \
68
pal, cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt) \
69
{ \
70
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \
71
gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \
72
cmt, maskt, shiftt, cms, masks, shifts); \
73
gDPLoadSync(pkt); \
74
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \
75
(((width)*(height)+3)>>2)-1, \
76
CALC_DXT_4b(width)); \
77
gDPPipeSync(pkt); \
78
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \
79
G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \
80
shifts); \
81
gDPSetTileSize(pkt, G_TX_RENDERTILE,\
82
(scrolls) << G_TEXTURE_IMAGE_FRAC,\
83
(scrollt) << G_TEXTURE_IMAGE_FRAC, \
84
((width)-1 + scrolls) << G_TEXTURE_IMAGE_FRAC, \
85
((height)-1 + scrollt) << G_TEXTURE_IMAGE_FRAC) \
86
}
87
88
#define gDPScrollMultiTile_4b(pkt, timg, tmem, rtile, fmt, width, height, \
89
uls, ult, lrs, lrt, pal, \
90
cms, cmt, masks, maskt, shifts, shiftt,\
91
scrolls, scrollt) \
92
{ \
93
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width)>>1), timg); \
94
gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \
95
(((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \
96
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
97
shifts); \
98
gDPLoadSync(pkt); \
99
gDPLoadTile( pkt, G_TX_LOADTILE, \
100
(uls)<<(G_TEXTURE_IMAGE_FRAC-1), \
101
(ult)<<(G_TEXTURE_IMAGE_FRAC), \
102
(lrs)<<(G_TEXTURE_IMAGE_FRAC-1), \
103
(lrt)<<(G_TEXTURE_IMAGE_FRAC)); \
104
gDPPipeSync(pkt); \
105
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
106
(((((lrs)-(uls)+1)>>1)+7)>>3), tmem, \
107
rtile, pal, cmt, maskt, shiftt, cms, masks, \
108
shifts); \
109
gDPSetTileSize(pkt, rtile, \
110
((uls)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
111
((ult)<<G_TEXTURE_IMAGE_FRAC) + scrollt, \
112
((lrs)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
113
((lrt)<<G_TEXTURE_IMAGE_FRAC) + scrollt); \
114
}
115
116
#define gDPScrollMultiTile(pkt, timg, tmem, rtile, fmt, siz, width, height,\
117
uls, ult, lrs, lrt, pal, \
118
cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt) \
119
{ \
120
gDPSetTextureImage(pkt, fmt, siz, width, timg); \
121
gDPSetTile(pkt, fmt, siz, \
122
(((((lrs)-(uls)+1) * siz##_TILE_BYTES)+7)>>3), tmem, \
123
G_TX_LOADTILE, 0 , cmt, maskt, shiftt, cms, masks, \
124
shifts); \
125
gDPLoadSync(pkt); \
126
gDPLoadTile( pkt, G_TX_LOADTILE, \
127
(uls)<<G_TEXTURE_IMAGE_FRAC, \
128
(ult)<<G_TEXTURE_IMAGE_FRAC, \
129
(lrs)<<G_TEXTURE_IMAGE_FRAC, \
130
(lrt)<<G_TEXTURE_IMAGE_FRAC); \
131
gDPPipeSync(pkt); \
132
gDPSetTile(pkt, fmt, siz, \
133
(((((lrs)-(uls)+1) * siz##_LINE_BYTES)+7)>>3), tmem, \
134
rtile, pal, cmt, maskt, shiftt, cms, masks, \
135
shifts); \
136
gDPSetTileSize(pkt, rtile, \
137
((uls)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
138
((ult)<<G_TEXTURE_IMAGE_FRAC) + scrollt, \
139
((lrs)<<G_TEXTURE_IMAGE_FRAC) + scrolls, \
140
((lrt)<<G_TEXTURE_IMAGE_FRAC) + scrollt); \
141
}
142
143
#define gDPScrollTextureBlockHalfHeight(pkt, timg, fmt, siz, width, height, \
144
pal, cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt, shifts2, shiftt2) \
145
{ \
146
gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \
147
gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \
148
0 , cmt, maskt, shiftt, cms, masks, shifts); \
149
gDPLoadSync(pkt); \
150
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \
151
(((width)*(height) + siz##_INCR) >> siz##_SHIFT) -1, \
152
CALC_DXT(width, siz##_BYTES)); \
153
gDPPipeSync(pkt); \
154
gDPSetTile(pkt, fmt, siz, \
155
(((width) * siz##_LINE_BYTES)+7)>>3, 0, \
156
G_TX_RENDERTILE, pal, cmt, maskt - 1, shiftt, cms, masks, \
157
shifts); \
158
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \
159
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
160
(((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) \
161
gDPSetTile(pkt, fmt, siz, \
162
(((width) * siz##_LINE_BYTES)+7)>>3, \
163
(((width) * ((height) >> 1) * siz##_LINE_BYTES)+7)>>3, \
164
G_TX_RENDERTILE + 1, pal, cmt, maskt - 1, shiftt2, cms, masks, \
165
shifts2); \
166
gDPSetTileSize(pkt, G_TX_RENDERTILE + 1, \
167
(scrolls),\
168
(scrollt), \
169
(((width)-1) << G_TEXTURE_IMAGE_FRAC) + (scrolls), \
170
((((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) + (scrollt) ); \
171
}
172
173
#define gDPScrollTextureBlockHalfHeight_4b(pkt, timg, fmt, width, height, \
174
pal, cms, cmt, masks, maskt, shifts, shiftt, scrolls, scrollt, shifts2, shiftt2) \
175
{ \
176
gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \
177
gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \
178
cmt, maskt, shiftt, cms, masks, shifts); \
179
gDPLoadSync(pkt); \
180
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \
181
(((width)*(height)+3)>>2)-1, \
182
CALC_DXT_4b(width)); \
183
gDPPipeSync(pkt); \
184
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, ((((width)>>1)+7)>>3), 0, \
185
G_TX_RENDERTILE, pal, cmt, maskt - 1, shiftt, cms, masks, \
186
shifts); \
187
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \
188
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
189
(((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) \
190
gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \
191
(((width)>>1)+7)>>3, \
192
(((width) * ((height) >> 1) / 2)+7)>>3, \
193
G_TX_RENDERTILE + 1, pal, cmt, maskt - 1, shiftt2, cms, masks, \
194
shifts2); \
195
gDPSetTileSize(pkt, G_TX_RENDERTILE + 1, \
196
scrolls,\
197
scrollt, \
198
(((width)-1) << G_TEXTURE_IMAGE_FRAC) + scrolls, \
199
((((height) >> 1)-1) << G_TEXTURE_IMAGE_FRAC) + scrollt) \
200
}
201
202
#endif
ultra64.h
include
gbi_custom.h
Generated by
1.10.0