summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2024-09-04 19:22:59 +0200
committerGitHub <noreply@github.com>2024-09-04 19:22:59 +0200
commitfab309ae081c71b2faff994ad9a7237e10e7ef73 (patch)
tree6d9a0f7caa98d179937c5b2e350624e190352305 /src/code
parentc6d7cc7697c67989b1f018ae2bc934f6677c09b7 (diff)
[ntsc-1.2] Partially match gfxprint.c (#2101)
* [ntsc-1.2] Partially match gfxprint.c * yeet bss * fix * review
Diffstat (limited to 'src/code')
-rw-r--r--src/code/gfxprint.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c
index d6171aacc..ac4bb7ced 100644
--- a/src/code/gfxprint.c
+++ b/src/code/gfxprint.c
@@ -126,8 +126,10 @@ u8 sGfxPrintFontData[(16 * 256) / 2] = {
0x1B, 0xAA, 0x40, 0x21, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
+#if PLATFORM_GC
// Can be used to set GFXP_FLAG_ENLARGE by default
static u8 sDefaultSpecialFlags;
+#endif
void GfxPrint_Setup(GfxPrint* this) {
s32 width = 16;
@@ -210,6 +212,10 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
if (this->flags & GFXP_FLAG_SHADOW) {
gDPSetColor(this->dList++, G_SETPRIMCOLOR, 0);
+#if PLATFORM_N64
+ gSPTextureRectangle(this->dList++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
+ tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10);
+#else
if (this->flags & GFXP_FLAG_ENLARGE) {
gSPTextureRectangle(this->dList++, (this->posX + 4) << 1, (this->posY + 4) << 1, (this->posX + 4 + 32) << 1,
(this->posY + 4 + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 9,
@@ -218,10 +224,15 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
gSPTextureRectangle(this->dList++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10);
}
+#endif
gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba);
}
+#if PLATFORM_N64
+ gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile,
+ (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10);
+#else
if (this->flags & GFXP_FLAG_ENLARGE) {
gSPTextureRectangle(this->dList++, this->posX << 1, this->posY << 1, (this->posX + 32) << 1,
(this->posY + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 9, 1 << 9);
@@ -229,26 +240,32 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile,
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10);
}
+#endif
this->posX += GFX_CHAR_X_SPACING << 2;
}
void GfxPrint_PrintChar(GfxPrint* this, u8 c) {
+#if PLATFORM_N64
+#define CHAR_PARAM c
+#else
+#define CHAR_PARAM charParam
u8 charParam = c;
+#endif
if (c == ' ') {
this->posX += GFX_CHAR_X_SPACING << 2;
} else if (c > ' ' && c < 0x7F) {
- GfxPrint_PrintCharImpl(this, charParam);
+ GfxPrint_PrintCharImpl(this, c);
} else if (c >= 0xA0 && c < 0xE0) {
if (this->flags & GFXP_FLAG_HIRAGANA) {
if (c < 0xC0) {
- charParam = c - 0x20;
+ CHAR_PARAM = c - 0x20;
} else {
- charParam = c + 0x20;
+ CHAR_PARAM = c + 0x20;
}
}
- GfxPrint_PrintCharImpl(this, charParam);
+ GfxPrint_PrintCharImpl(this, CHAR_PARAM);
} else {
switch (c) {
case '\0':
@@ -325,11 +342,13 @@ void GfxPrint_Init(GfxPrint* this) {
this->flags |= GFXP_FLAG_SHADOW;
this->flags |= GFXP_FLAG_UPDATE;
+#if PLATFORM_GC
if (sDefaultSpecialFlags & GFXP_FLAG_ENLARGE) {
this->flags |= GFXP_FLAG_ENLARGE;
} else {
this->flags &= ~GFXP_FLAG_ENLARGE;
}
+#endif
}
void GfxPrint_Destroy(GfxPrint* this) {
@@ -341,7 +360,9 @@ void GfxPrint_Open(GfxPrint* this, Gfx* dList) {
this->dList = dList;
GfxPrint_Setup(this);
} else {
- PRINTF("gfxprint_open:2重オープンです\n");
+#if PLATFORM_N64 || OOT_DEBUG
+ osSyncPrintf("gfxprint_open:2重オープンです\n");
+#endif
}
}
@@ -349,7 +370,9 @@ Gfx* GfxPrint_Close(GfxPrint* this) {
Gfx* ret;
this->flags &= ~GFXP_FLAG_OPEN;
+#if PLATFORM_GC
gDPPipeSync(this->dList++);
+#endif
ret = this->dList;
this->dList = NULL;