22 .combineModeIndex = 0,
23 .color1 = { .r = 200, .g = 191, .b = 164, .a = 255 },
24 .color2 = { .r = 128, .g = 128, .b = 128, .a = 255 }
29 .combineModeIndex = 1,
30 .color1 = { .r = 255, .g = 200, .b = 128, .a = 255 },
31 .color2 = { .r = 128, .g = 128, .b = 128, .a = 255 }
36 .combineModeIndex = 1,
37 .color1 = { .r = 232, .g = 196, .b = 77, .a = 255 },
38 .color2 = { .r = 163, .g = 123, .b = 0, .a = 255 }
43 .combineModeIndex = 1,
44 .color1 = { .r = 226, .g = 225, .b = 216, .a = 255 },
45 .color2 = { .r = 217, .g = 208, .b = 201, .a = 255 }
50 .combineModeIndex = 1,
51 .color1 = { .r = 61, .g = 74, .b = 188, .a = 255 },
52 .color2 = { .r = 0, .g = 25, .b = 28, .a = 255 }
57 .combineModeIndex = 1,
58 .color1 = { .r = 235, .g = 230, .b = 119, .a = 255 },
59 .color2 = { .r = 142, .g = 90, .b = 37, .a = 255 }
64 .combineModeIndex = 1,
65 .color1 = { .r = 235, .g = 230, .b = 119, .a = 255 },
66 .color2 = { .r = 142, .g = 99, .b = 37, .a = 255 }
71 .combineModeIndex = 1,
72 .color1 = { .r = 215, .g = 191, .b = 116, .a = 255 },
73 .color2 = { .r = 132, .g = 70, .b = 50, .a = 255 }
78 .combineModeIndex = 1,
79 .color1 = { .r = 215, .g = 191, .b = 116, .a = 255 },
80 .color2 = { .r = 132, .g = 70, .b = 50, .a = 255 }
85 .combineModeIndex = 1,
86 .color1 = { .r = 141, .g = 143, .b = 255, .a = 255 },
87 .color2 = { .r = 43, .g = 69, .b = 102, .a = 255 }
92 .combineModeIndex = 1,
93 .color1 = { .r = 141, .g = 143, .b = 255, .a = 255 },
94 .color2 = { .r = 43, .g = 69, .b = 102, .a = 255 }
99 .combineModeIndex = 1,
100 .color1 = { .r = 170, .g = 208, .b = 128, .a = 255 },
101 .color2 = { .r = 71, .g = 123, .b = 83, .a = 255 }
106 .combineModeIndex = 1,
107 .color1 = { .r = 170, .g = 208, .b = 128, .a = 255 },
108 .color2 = { .r = 71, .g = 123, .b = 83, .a = 255 }
113 .combineModeIndex = 1,
114 .color1 = { .r = 200, .g = 200, .b = 90, .a = 255 },
115 .color2 = { .r = 140, .g = 140, .b = 0, .a = 255 }
120 .combineModeIndex = 1,
121 .color1 = { .r = 200, .g = 200, .b = 90, .a = 255 },
122 .color2 = { .r = 140, .g = 140, .b = 0, .a = 255 }
127 .combineModeIndex = 1,
128 .color1 = { .r = 235, .g = 230, .b = 119, .a = 255 },
129 .color2 = { .r = 142, .g = 90, .b = 37, .a = 255 }
134 .combineModeIndex = 1,
135 .color1 = { .r = 142, .g = 212, .b = 236, .a = 255 },
136 .color2 = { .r = 67, .g = 98, .b = 69, .a = 255 }
141 .combineModeIndex = 1,
142 .color1 = { .r = 167, .g = 151, .b = 119, .a = 255 },
143 .color2 = { .r = 98, .g = 55, .b = 154, .a = 255 }
148 .combineModeIndex = 1,
149 .color1 = { .r = 17, .g = 151, .b = 29, .a = 255 },
150 .color2 = { .r = 8, .g = 55, .b = 14, .a = 255 }
155 .combineModeIndex = 1,
156 .color1 = { .r = 110, .g = 110, .b = 200, .a = 255 },
157 .color2 = { .r = 10, .g = 10, .b = 100, .a = 255 }
162 .combineModeIndex = 1,
163 .color1 = { .r = 181, .g = 60, .b = 60, .a = 255 },
164 .color2 = { .r = 76, .g = 10, .b = 0, .a = 255 }
169 .combineModeIndex = 1,
170 .color1 = { .r = 174, .g = 227, .b = 235, .a = 255 },
171 .color2 = { .r = 76, .g = 110, .b = 60, .a = 255 }
176 .combineModeIndex = 1,
177 .color1 = { .r = 126, .g = 125, .b = 216, .a = 255 },
178 .color2 = { .r = 217, .g = 108, .b = 201, .a = 255 }
338 u8 darkening, f32 scaleX, f32 scaleY, f32 rotX, f32 rotY, f32 rotZ,
339 void (*fpDrawContents)(s32, s32, s32, s32, s32, s32, s32),
void* drawContentsArg0,
Matrix4f rotScaleMtx,
340 s32 translateX, s32 translateY,
Matrix4f outMtx)
343 u8 primR, primG, primB, primA, envR, envG, envB, envA;
348 u32 bgWidth, bgHeight;
349 u32 cornerWidth, cornerHeight;
355 u32 bgScrollOffsetX, bgScrollOffsetY;
362 primR = defaultStyle->
color1.
r;
363 primG = defaultStyle->
color1.
g;
364 primB = defaultStyle->
color1.
b;
365 primA = defaultStyle->
color1.
a * opacity / 255;
398 bgFmt = background->
fmt;
399 cornersImage = corners->
imgData;
401 bgWidth = background->
width;
403 bgHeight = background->
height;
411 cornersFmt = corners->
fmt;
412 cornersBitDepth = corners->
bitDepth;
414 if (width <= 0 || height <= 0 || opacity == 0 || posX <= -768 || posY <= -768) {
422 if (posX + width >= 768 || posY + height >= 768 || posX + width <= 0 || posY + height <= 0) {
442 if (defaultStyle !=
nullptr) {
457 if (quads !=
nullptr) {
459 guFrustumF(mtx1, -80.0f, 80.0f, 60.0f, -60.0f, 160.0f, 480.0f, 1.0f);
463 guPositionF(mtx1, rotX, rotY, rotZ, 1.0f, posX + width / 2, posY + height / 2, posZ);
464 if (scaleX != 1.0f || scaleY != 1.0f) {
465 guScaleF(mtx2, scaleX, scaleY, 1.0f);
468 if (rotScaleMtx != 0) {
469 guTranslateF(mtx2, -translateX / 2, -translateY / 2, 0.0f);
474 for (i = 0; i < 4; i++) {
475 for (j = 0; j < 4; j++) {
476 outMtx[i][j] = mtx1[i][j];
482 gSPClearGeometryMode(
gMainGfxPos++, G_CULL_BOTH | G_LIGHTING);
494 gSPTexture(
gMainGfxPos++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
498 gDPSetPrimColor(
gMainGfxPos++, 0, 0, primR, primG, primB, primA);
499 gDPSetEnvColor(
gMainGfxPos++, envR, envG, envB, envA);
500 if (bgImage !=
nullptr) {
503 gDPLoadTextureTile_4b(
gMainGfxPos++, bgImage, bgFmt, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, bgMasks, bgMaskt, G_TX_NOLOD, G_TX_NOLOD);
506 gDPLoadTextureTile(
gMainGfxPos++, bgImage, bgFmt, G_IM_SIZ_8b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, bgMasks, bgMaskt, G_TX_NOLOD, G_TX_NOLOD);
509 gDPLoadTextureTile(
gMainGfxPos++, bgImage, bgFmt, G_IM_SIZ_16b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, bgMasks, bgMaskt, G_TX_NOLOD, G_TX_NOLOD);
512 gDPLoadTextureTile(
gMainGfxPos++, bgImage, bgFmt, G_IM_SIZ_32b, bgWidth, bgHeight, 0, 0, bgWidth - 1, bgHeight - 1, 0, G_TX_WRAP, G_TX_WRAP, bgMasks, bgMaskt, G_TX_NOLOD, G_TX_NOLOD);
518 bgScrollOffsetX = 511 - bgScrollOffsetY;
520 width / 2 * 4 + bgScrollOffsetX,
521 height / 2 * 4 + bgScrollOffsetY,
522 (width / 2 + bgWidth - 1) * 4 + bgScrollOffsetX,
523 (height / 2 + bgHeight - 1) * 4 + bgScrollOffsetY);
525 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, width / 2 * 4, height / 2 * 4,
526 (width / 2 + bgWidth - 1) * 4, (height / 2 + bgHeight - 1)* 4);
530 if (cornersImage !=
nullptr) {
531 for (idx = 0; idx < 4; idx++) {
532 cornerWidth = cornersSizes[idx].
x;
533 cornerHeight = cornersSizes[idx].
y;
537 switch (cornersBitDepth) {
539 gDPLoadMultiTile_4b(
gMainGfxPos++, cornersImage, tmem, 1, cornersFmt, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
540 cornersImage += cornerWidth * cornerHeight / 2;
543 gDPLoadMultiTile(
gMainGfxPos++, cornersImage, tmem, 1, cornersFmt, G_IM_SIZ_8b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
544 cornersImage += cornerWidth * cornerHeight;
547 gDPLoadMultiTile(
gMainGfxPos++, cornersImage, tmem, 1, cornersFmt, G_IM_SIZ_16b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
548 cornersImage += cornerWidth * cornerHeight * 2;
551 gDPLoadMultiTile(
gMainGfxPos++, cornersImage, tmem, 1, cornersFmt, G_IM_SIZ_32b, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
552 cornersImage += cornerWidth * cornerHeight * 4;
558 gDPSetTileSize(
gMainGfxPos++, 1, (width - cornerWidth) * 4, 0, (width - 1) * 4, (cornerHeight - 1) * 4);
561 gDPSetTileSize(
gMainGfxPos++, 1, 0, (height - cornerHeight) * 4, (cornerWidth - 1) * 4, (height - 1) * 4);
564 gDPSetTileSize(
gMainGfxPos++, 1, (width - cornerWidth) * 4, (height - cornerHeight) * 4, (width - 1) * 4, (height - 1) * 4);
568 if (quads !=
nullptr) {
571 quads[0].v.ob[0] = -width / 2;
572 quads[0].v.ob[1] = -height / 2;
573 quads[0].v.ob[2] = 0;
575 quads[1].v.ob[0] = 0;
576 quads[1].v.ob[1] = -height / 2;
577 quads[1].v.ob[2] = 0;
579 quads[2].v.ob[0] = -width / 2;
580 quads[2].v.ob[1] = 0;
581 quads[2].v.ob[2] = 0;
583 quads[3].v.ob[0] = 0;
584 quads[3].v.ob[1] = 0;
585 quads[3].v.ob[2] = 0;
587 quads[0].v.tc[0] = 0;
588 quads[0].v.tc[1] = 0;
590 quads[1].v.tc[0] = (width / 2) * 32;
591 quads[1].v.tc[1] = 0;
593 quads[2].v.tc[0] = 0;
594 quads[2].v.tc[1] = (height / 2) * 32;
596 quads[3].v.tc[0] = (width / 2) * 32;
597 quads[3].v.tc[1] = (height / 2) * 32;
600 quads[4].v.ob[0] = 0;
601 quads[4].v.ob[1] = -height / 2;
602 quads[4].v.ob[2] = 0;
604 quads[5].v.ob[0] = (-width / 2) + width;
605 quads[5].v.ob[1] = -height / 2;
606 quads[5].v.ob[2] = 0;
608 quads[6].v.ob[0] = 0;
609 quads[6].v.ob[1] = 0;
610 quads[6].v.ob[2] = 0;
612 quads[7].v.ob[0] = (-width / 2) + width;
613 quads[7].v.ob[1] = 0;
614 quads[7].v.ob[2] = 0;
616 quads[4].v.tc[0] = (width / 2) * 32;
617 quads[4].v.tc[1] = 0;
619 quads[5].v.tc[0] = width * 32;
620 quads[5].v.tc[1] = 0;
622 quads[6].v.tc[0] = (width / 2) * 32;
623 quads[6].v.tc[1] = (height / 2) * 32;
625 quads[7].v.tc[0] = width * 32;
626 quads[7].v.tc[1] = (height / 2) * 32;
633 quads[8].v.ob[0] = -width / 2;
634 quads[8].v.ob[1] = 0;
635 quads[8].v.ob[2] = 0;
637 quads[9].v.ob[0] = 0;
638 quads[9].v.ob[1] = 0;
639 quads[9].v.ob[2] = 0;
641 quads[10].v.ob[0] = -width / 2;
642 quads[10].v.ob[1] = height / 2;
643 quads[10].v.ob[2] = 0;
645 quads[11].v.ob[0] = 0;
646 quads[11].v.ob[1] = height / 2;
647 quads[11].v.ob[2] = 0;
649 quads[8].v.tc[0] = 0;
650 quads[8].v.tc[1] = (height / 2) * 32;
652 quads[9].v.tc[0] = (width / 2) * 32;
653 quads[9].v.tc[1] = (height / 2) * 32;
655 quads[10].v.tc[0] = 0;
656 quads[10].v.tc[1] = height * 32;
658 quads[11].v.tc[0] = (width / 2) * 32;
659 quads[11].v.tc[1] = height * 32;
666 quads[12].v.ob[0] = 0;
667 quads[12].v.ob[1] = 0;
668 quads[12].v.ob[2] = 0;
670 quads[13].v.ob[0] = (-width / 2) + width;
671 quads[13].v.ob[1] = 0;
672 quads[13].v.ob[2] = 0;
674 quads[14].v.ob[0] = 0;
675 quads[14].v.ob[1] = height / 2;
676 quads[14].v.ob[2] = 0;
678 quads[15].v.ob[0] = (-width / 2) + width;
679 quads[15].v.ob[1] = height / 2;
680 quads[15].v.ob[2] = 0;
682 quads[12].v.tc[0] = (width / 2) * 32;
683 quads[12].v.tc[1] = (height / 2) * 32;
685 quads[13].v.tc[0] = width * 32;
686 quads[13].v.tc[1] = (height / 2) * 32;
688 quads[14].v.tc[0] = (width / 2) * 32;
689 quads[14].v.tc[1] = height * 32;
691 quads[15].v.tc[0] = width * 32;
692 quads[15].v.tc[1] = height * 32;
704 gSP2Triangles(
gMainGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
708 gSPScisTextureRectangle(
gMainGfxPos++, posX * 4, posY * 4, (posX + width / 2) * 4, (posY + height / 2) * 4, G_TX_RENDERTILE, 0, 0, 0x400, 0x400);
711 gSPScisTextureRectangle(
gMainGfxPos++, (posX + width / 2) * 4, posY * 4, (posX + width) * 4, (posY + height / 2) * 4, G_TX_RENDERTILE, (width / 2) * 32, 0, 0x400, 0x400);
714 gSPScisTextureRectangle(
gMainGfxPos++, posX * 4, (posY + height / 2) * 4, (posX + width / 2) * 4, (posY + height) * 4, G_TX_RENDERTILE, 0, (height / 2) * 32, 0x400, 0x400);
717 gSPScisTextureRectangle(
gMainGfxPos++, (posX + width / 2) * 4, (posY + height / 2) * 4, (posX + width) * 4, (posY + height) * 4, G_TX_RENDERTILE, (width / 2) * 32, (height / 2) * 32, 0x400, 0x400);
724 }
else if (bgImage !=
nullptr) {
725 if (quads !=
nullptr) {
726 quads[0].v.ob[0] = -width / 2;
727 quads[0].v.ob[1] = -height / 2;
728 quads[0].v.ob[2] = 0;
730 quads[1].v.ob[0] = (-width / 2) + width;
731 quads[1].v.ob[1] = -height / 2;
732 quads[1].v.ob[2] = 0;
734 quads[2].v.ob[0] = -width / 2;
735 quads[2].v.ob[1] = height / 2;
736 quads[2].v.ob[2] = 0;
738 quads[3].v.ob[0] = (-width / 2) + width;
739 quads[3].v.ob[1] = height / 2;
740 quads[3].v.ob[2] = 0;
742 quads[0].v.tc[0] = 0;
743 quads[0].v.tc[1] = 0;
745 quads[1].v.tc[1] = 0;
746 quads[1].v.tc[0] = width * 32;
748 quads[2].v.tc[0] = 0;
749 quads[2].v.tc[1] = height * 32;
751 quads[3].v.tc[0] = width * 32;
752 quads[3].v.tc[1] = height * 32;
755 gSP2Triangles(
gMainGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
757 gSPScisTextureRectangle(
gMainGfxPos++, posX * 4, posY * 4, (posX + width) * 4, (posY + height) * 4, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
764 if(fpDrawContents !=
nullptr) {
765 if (quads !=
nullptr) {
767 if(mdl_address != 0) {
768 gDPSetColorImage(
gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, OS_K0_TO_PHYSICAL(mdl_address));
769 gDPSetScissor(
gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, width, height);
772 gDPSetRenderMode(
gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
773 gDPFillRectangle(
gMainGfxPos++, 0, 0, width - 1, height - 1);
775 gDPSetScissorFrac(
gMainGfxPos++, G_SC_NON_INTERLACE, 4, 4, (width - 1) * 4.0f, (height - 1) * 4.0f);
778 fpDrawContents((s32)drawContentsArg0, 0, 0, width, height, opacity, darkening);
784 gSPMatrix(
gMainGfxPos++, sp154, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
785 gSPTexture(
gMainGfxPos++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
788 gDPSetCombineMode(
gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
789 gDPSetRenderMode(
gMainGfxPos++, G_RM_CLD_SURF, G_RM_NOOP2);
797 for (idx = 0; idx < height / 6; idx++) {
798 s32 extraHeight, lineHeight;
799 if (idx == height / 6 - 1) {
801 if (height % 6 != 0) {
807 lineHeight = extraHeight + 5;
808 gDPLoadTextureTile(
gMainGfxPos++, OS_K0_TO_PHYSICAL(mdl_address), G_IM_FMT_RGBA, G_IM_SIZ_16b, width, 0,
809 0, idx * 6, width - 1, idx * 6 + lineHeight, 0,
810 G_TX_CLAMP, G_TX_CLAMP, 9, 3, G_TX_NOLOD, G_TX_NOLOD);
811 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, (160 - width / 2) * 4, 0, ((160 - width / 2) + width - 1) * 4, lineHeight * 4);
813 gSP2Triangles(
gMainGfxPos++, 0, 3, 1, 0, 0, 2, 3, 0);
819 fpDrawContents((s32)drawContentsArg0, posX, posY, width, height, opacity, darkening);
822 if (quads !=
nullptr) {