65 s32 fogR, fogG, fogB, fogA;
68 u16 blendedR, blendedG, blendedB;
71 f32 theta, sinTheta, cosTheta, scrollValue, f5, waveOffset;
89 BG_BLEND_SHOULD_LERP = 2,
90 BG_BLEND_SHOULD_BLEND = 4,
95 flags = BG_BLEND_HAS_FOG;
104 flags |= BG_BLEND_SHOULD_LERP;
111 if (!(r1 == 255 && g1 == 255 && b1 == 255 && r2 == 0 && g2 == 0 && b2 == 0)) {
112 flags |= BG_BLEND_SHOULD_BLEND;
121 case BG_BLEND_HAS_FOG:
124 case BG_BLEND_SHOULD_LERP:
131 case BG_BLEND_HAS_FOG | BG_BLEND_SHOULD_LERP:
133 fogR = (fogR * (255 - a1) + r1 * a1) / 255;
134 fogG = (fogG * (255 - a1) + g1 * a1) / 255;
135 fogB = (fogB * (255 - a1) + b1 * a1) / 255;
136 fogA = (fogA * (255 - a1) + a1 * a1) / 255;
138 case BG_BLEND_SHOULD_BLEND:
170 blendedB = (b2 >> 3) + ((
UNPACK_PAL_B(palColor) * b1 >> 3) >> 5);
171 blendedG = (g2 >> 3) + ((
UNPACK_PAL_G(palColor) * g1 >> 3) >> 5);
172 blendedR = (r2 >> 3) + ((
UNPACK_PAL_R(palColor) * r1 >> 3) >> 5);
174 if (blendedB > 0x1F) {
177 if (blendedG > 0x1F) {
180 if (blendedR > 0x1F) {
193 scrollValue = -f5 * 0.25f;
202 while (scrollValue < 0.0f) {
216 gDPSetCombineMode(
gMainGfxPos++, G_CC_DECALRGB, G_CC_DECALRGB);
217 gDPSetRenderMode(
gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
231 for (i = 0; i < numLines; i++) {
237 G_IM_FMT_CI, G_IM_SIZ_8b, bgMaxX, 6,
239 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
241 gSPTextureRectangle(
gMainGfxPos++, bgMinX * 4, (lineHeight * i + bgMinY) * 4,
242 (bgXOffset + bgMinX - 1) * 4, (lineHeight * i + lineHeight - 1 + bgMinY) * 4,
243 G_TX_RENDERTILE, (bgMaxX - bgXOffset) * 32, 0, 4096, 1024);
244 gSPTextureRectangle(
gMainGfxPos++, (bgXOffset + bgMinX) * 4, (lineHeight * i + bgMinY) * 4,
245 (bgMaxX + bgMinX - 1) * 4, (lineHeight * i + lineHeight - 1 + bgMinY) * 4,
246 G_TX_RENDERTILE, 0, 0, 4096, 1024);
248 if (extraHeight != 0) {
254 G_IM_FMT_CI, G_IM_SIZ_8b, bgMaxX, extraHeight,
255 0, 0, 295, extraHeight - 1, 0,
256 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
257 gSPTextureRectangle(
gMainGfxPos++, bgMinX * 4, (lineHeight * i + bgMinY) * 4,
258 (bgXOffset + bgMinX - 1) * 4, (bgMaxY - 1 + bgMinY) * 4,
259 G_TX_RENDERTILE, (bgMaxX - bgXOffset) * 32, 0, 4096, 1024);
260 gSPTextureRectangle(
gMainGfxPos++, (bgXOffset + bgMinX) * 4, (lineHeight * i + bgMinY) * 4,
261 (bgMaxX + bgMinX - 1) * 4, (bgMaxY - 1 + bgMinY) * 4,
262 G_TX_RENDERTILE, 0, 0, 4096, 1024);
269 for (i = 0; i < numLines; i++) {
277 G_IM_FMT_CI, G_IM_SIZ_8b, bgMaxX, 6,
279 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
281 gSPTextureRectangle(
gMainGfxPos++, bgMinX * 4, (lineHeight * i + bgMinY) * 4,
282 (2 * bgXOffset + (bgMinX - 1)) * 4, (lineHeight * i + lineHeight - 1 + bgMinY) * 4,
283 G_TX_RENDERTILE, bgMaxX * 32 - bgXOffset * 16, 0, 4096, 1024);
284 gSPTextureRectangle(
gMainGfxPos++, bgXOffset * 2 + bgMinX * 4, (lineHeight * i + bgMinY) * 4,
285 (bgMaxX + bgMinX - 1) * 4, (lineHeight * i + lineHeight - 1 + bgMinY) * 4,
286 G_TX_RENDERTILE, 0, 0, 4096, 1024);
288 if (extraHeight != 0) {
296 G_IM_FMT_CI, G_IM_SIZ_8b, bgMaxX, extraHeight,
297 0, 0, 295, extraHeight - 1, 0,
298 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
299 gSPTextureRectangle(
gMainGfxPos++, bgMinX * 4, (lineHeight * i + bgMinY) * 4,
300 (2 * bgXOffset + (bgMinX - 1)) * 4, (bgMaxY - 1 + bgMinY) * 4,
301 G_TX_RENDERTILE, bgMaxX * 32 - bgXOffset * 16, 0, 4096, 1024);
302 gSPTextureRectangle(
gMainGfxPos++, bgXOffset * 2 + bgMinX * 4, (lineHeight * i + bgMinY) * 4,
303 (bgMaxX + bgMinX - 1) * 4, (bgMaxY - 1 + bgMinY) * 4,
304 G_TX_RENDERTILE, 0, 0, 4096, 1024);