summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2020-03-23 20:21:50 -0400
committerGitHub <noreply@github.com>2020-03-23 20:21:50 -0400
commit5160cc1954ef87be00a00dae787bed2455a3bc30 (patch)
treeab7b666cb1adef13789dc5eb2267799b96cafbc3 /src
parent875d962b4cca028429bbacd5d8fc2056d48bce43 (diff)
parent4bbbdc39fd5e5a44511d8c21012013692f805ec4 (diff)
Merge pull request #31 from pixel-stuck/master
fix final non-matching in fault_drawer.c
Diffstat (limited to 'src')
-rw-r--r--src/code/fault_drawer.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c
index b17679d35..ef7a784ae 100644
--- a/src/code/fault_drawer.c
+++ b/src/code/fault_drawer.c
@@ -94,30 +94,32 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col
}
}
-#ifdef NON_MATCHING
-// regalloc and minor ordering differences
void FaultDrawer_DrawChar(char c) {
u16* fb;
s32 x, y;
u32* dataPtr;
+ u32 data;
s32 cursorX = sFaultDrawerStruct.cursorX;
s32 cursorY = sFaultDrawerStruct.cursorY;
+ u32** fontData = &sFaultDrawerStruct.fontData;
+ s32 shift = c % 4;
- dataPtr = &sFaultDrawerStruct.fontData[((c & 4) >> 2) + ((c / 8) * 16)];
- fb = sFaultDrawerStruct.fb + sFaultDrawerStruct.w * cursorY + cursorX;
+ dataPtr = &fontData[0][(((c / 8) * 16) + ((c & 4) >> 2))];
+ fb = sFaultDrawerStruct.fb + (sFaultDrawerStruct.w * cursorY) + cursorX;
if ((sFaultDrawerStruct.xStart <= cursorX) &&
((sFaultDrawerStruct.charW + cursorX - 1) <= sFaultDrawerStruct.xEnd) &&
(sFaultDrawerStruct.yStart <= cursorY) &&
((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) {
for (y = 0; y < sFaultDrawerStruct.charH; y++) {
- u32 mask = 0x10000000 << (c % 4);
- u32 data = *dataPtr;
+ u32 mask = 0x10000000 << shift;
+ data = *dataPtr;
for (x = 0; x < sFaultDrawerStruct.charW; x++) {
- if (mask & data)
+ if (mask & data) {
fb[x] = sFaultDrawerStruct.foreColor;
- else if (sFaultDrawerStruct.backColor & 1)
+ } else if (sFaultDrawerStruct.backColor & 1) {
fb[x] = sFaultDrawerStruct.backColor;
+ }
mask >>= 4;
}
fb += sFaultDrawerStruct.w;
@@ -125,9 +127,6 @@ void FaultDrawer_DrawChar(char c) {
}
}
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawChar.s")
-#endif
s32 FaultDrawer_ColorToPrintColor(u16 color) {
s32 i;