mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 15:04:31 +00:00
Match gfxprint.c (#520)
* Match gfxprint.c * Review changes Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
parent
d4e16bbacf
commit
51b204f8e1
3 changed files with 9 additions and 598 deletions
|
@ -132,15 +132,13 @@ u8 sGfxPrintFontData[(16 * 256) / 2] = {
|
|||
};
|
||||
|
||||
#define gDPSetPrimColorMod(pkt, m, l, rgba) \
|
||||
_DW({ \
|
||||
{ \
|
||||
Gfx* _g = (Gfx*)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
|
||||
_g->words.w1 = (rgba); \
|
||||
})
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc and minor ordering differences
|
||||
void GfxPrint_InitDlist(GfxPrint* this) {
|
||||
s32 width = 16;
|
||||
s32 height = 256;
|
||||
|
@ -181,7 +179,7 @@ void GfxPrint_InitDlist(GfxPrint* this) {
|
|||
gDPLoadSync(this->dlist++);
|
||||
gDPLoadTile(this->dlist++, G_TX_LOADTILE, 0, 0, 2, 28);
|
||||
gDPPipeSync(this->dlist++);
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, 1, 0, 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD,
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD);
|
||||
gDPSetTileSize(this->dlist++, 1, 0, 0, 4, 28);
|
||||
|
||||
|
@ -193,9 +191,6 @@ void GfxPrint_InitDlist(GfxPrint* this) {
|
|||
gDPSetTileSize(this->dlist++, i * 2 + 1, 0, 0, 4, 28);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_InitDlist.s")
|
||||
#endif
|
||||
|
||||
void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) {
|
||||
this->color.r = r;
|
||||
|
@ -220,9 +215,9 @@ void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) {
|
|||
this->baseY = y << 2;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc and ordering differences
|
||||
void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
|
||||
u32 tile = (c & 0xFF) * 2;
|
||||
|
||||
if (this->flag & GFXPRINT_UPDATE_MODE) {
|
||||
this->flag &= ~GFXPRINT_UPDATE_MODE;
|
||||
|
||||
|
@ -245,10 +240,10 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
|
|||
|
||||
if (this->flag & GFXPRINT_FLAG64) {
|
||||
gSPTextureRectangle(this->dlist++, (this->posX + 4) << 1, (this->posY + 4) << 1, (this->posX + 4 + 32) << 1,
|
||||
(this->posY + 4 + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
|
||||
(this->posY + 4 + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
|
||||
} else {
|
||||
gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
|
||||
c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
}
|
||||
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
|
@ -256,17 +251,14 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
|
|||
|
||||
if (this->flag & GFXPRINT_FLAG64) {
|
||||
gSPTextureRectangle(this->dlist++, (this->posX) << 1, (this->posY) << 1, (this->posX + 32) << 1,
|
||||
(this->posY + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
|
||||
(this->posY + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
|
||||
} else {
|
||||
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, c * 2,
|
||||
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile,
|
||||
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
}
|
||||
|
||||
this->posX += 32;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_PrintCharImpl.s")
|
||||
#endif
|
||||
|
||||
void GfxPrint_PrintChar(GfxPrint* this, u8 c) {
|
||||
u8 charParam = c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue