From 8e10d7c0e5171b5c6b4c5f6cfa983c2835a71890 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 25 Nov 2018 20:16:41 +0100 Subject: [PATCH] Match some functions --- include/bg.h | 4 +- include/pokemon.h | 1 - src/bg.c | 1203 ++++++++++++++---------------------- src/field_effect.c | 64 +- src/field_effect_helpers.c | 111 +--- src/map_name_popup.c | 234 +------ src/text.c | 673 ++++---------------- 7 files changed, 634 insertions(+), 1656 deletions(-) diff --git a/include/bg.h b/include/bg.h index f2d4e7948..a10abaa8d 100644 --- a/include/bg.h +++ b/include/bg.h @@ -70,14 +70,14 @@ void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset); void CopyBgTilemapBufferToVram(u8 bg); void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height); void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette); -void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2); +void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 unused, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, s16 palette1, s16 tileOffset); void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height); void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumDelta); u16 GetBgMetricTextMode(u8 bg, u8 whichMetric); u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric); u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32 screenHeight); -void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2); +void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2); u32 GetBgType(u8 bg); bool32 IsInvalidBg32(u8 bg); bool32 IsTileMapOutsideWram(u8 bg); diff --git a/include/pokemon.h b/include/pokemon.h index 3e69845e6..f9063db9e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -465,7 +465,6 @@ extern const u8 gUnknown_08329D2A[]; extern const u8 gStatStageRatios[][2]; extern const u16 gUnknown_08329D54[]; extern const struct SpriteTemplate gUnknown_08329D98[]; -extern const struct CompressedSpritePalette gMonPaletteTable[]; extern const s8 gNatureStatTable[][5]; void ZeroBoxMonData(struct BoxPokemon *boxMon); diff --git a/src/bg.c b/src/bg.c index 7c55410b1..35f3fd1cd 100644 --- a/src/bg.c +++ b/src/bg.c @@ -135,22 +135,22 @@ u16 GetBgControlAttribute(u8 bg, u8 attributeId) { switch (attributeId) { - case BG_CTRL_ATTR_VISIBLE: - return sGpuBgConfigs.configs[bg].visible; - case BG_CTRL_ATTR_CHARBASEINDEX: - return sGpuBgConfigs.configs[bg].charBaseIndex; - case BG_CTRL_ATTR_MAPBASEINDEX: - return sGpuBgConfigs.configs[bg].mapBaseIndex; - case BG_CTRL_ATTR_SCREENSIZE: - return sGpuBgConfigs.configs[bg].screenSize; - case BG_CTRL_ATTR_PALETTEMODE: - return sGpuBgConfigs.configs[bg].paletteMode; - case BG_CTRL_ATTR_PRIORITY: - return sGpuBgConfigs.configs[bg].priority; - case BG_CTRL_ATTR_MOSAIC: - return sGpuBgConfigs.configs[bg].mosaic; - case BG_CTRL_ATTR_WRAPAROUND: - return sGpuBgConfigs.configs[bg].wraparound; + case BG_CTRL_ATTR_VISIBLE: + return sGpuBgConfigs.configs[bg].visible; + case BG_CTRL_ATTR_CHARBASEINDEX: + return sGpuBgConfigs.configs[bg].charBaseIndex; + case BG_CTRL_ATTR_MAPBASEINDEX: + return sGpuBgConfigs.configs[bg].mapBaseIndex; + case BG_CTRL_ATTR_SCREENSIZE: + return sGpuBgConfigs.configs[bg].screenSize; + case BG_CTRL_ATTR_PALETTEMODE: + return sGpuBgConfigs.configs[bg].paletteMode; + case BG_CTRL_ATTR_PRIORITY: + return sGpuBgConfigs.configs[bg].priority; + case BG_CTRL_ATTR_MOSAIC: + return sGpuBgConfigs.configs[bg].mosaic; + case BG_CTRL_ATTR_WRAPAROUND: + return sGpuBgConfigs.configs[bg].wraparound; } } @@ -166,15 +166,15 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode) { switch (mode) { - case 0x1: - offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE; - break; - case 0x2: - offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE; - break; - default: - cursor = -1; - goto end; + case 0x1: + offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE; + break; + case 0x2: + offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE; + break; + default: + cursor = -1; + goto end; } offset = destOffset + offset; @@ -241,17 +241,17 @@ static void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispC switch (sGpuBgConfigs.bgVisibilityAndMode & 0x7) { - case 1: - if (bg != 2) - return; - break; - case 2: - if (bg < 2 || bg > 3) - return; - break; - case 0: - default: + case 1: + if (bg != 2) return; + break; + case 2: + if (bg < 2 || bg > 3) + return; + break; + case 0: + default: + return; } src.texX = srcCenterX; @@ -279,7 +279,8 @@ bool8 IsInvalidBg(u8 bg) { if (bg > 3) return TRUE; - return FALSE; + else + return FALSE; } int DummiedOutFireRedLeafGreenTileAllocFunc(int a1, int a2, int a3, int a4) @@ -434,7 +435,6 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset) return (u8)cursor; } -#ifdef NONMATCHING // Matches everything but r5 and r6 are flipped, rrr bool8 IsDma3ManagerBusyWithBgCopy(void) { u8 mod; @@ -462,60 +462,6 @@ bool8 IsDma3ManagerBusyWithBgCopy(void) return FALSE; } -#else -NAKED -bool8 IsDma3ManagerBusyWithBgCopy(void) -{ - asm("push {r4-r7,lr}\n\ - mov r5, #0\n\ - mov r7, #0x1\n\ - neg r7, r7\n\ -_08001ADC:\n\ - add r0, r5, #0\n\ - cmp r5, #0\n\ - bge _08001AE4\n\ - add r0, #0x1F\n\ -_08001AE4:\n\ - asr r0, #5\n\ - lsl r2, r0, #24\n\ - lsl r0, #5\n\ - sub r0, r5, r0\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - ldr r1, =sDmaBusyBitfield\n\ - lsr r2, #22\n\ - add r4, r2, r1\n\ - mov r6, #0x1\n\ - lsl r6, r0\n\ - ldr r0, [r4]\n\ - and r0, r6\n\ - cmp r0, #0\n\ - beq _08001B22\n\ - lsl r0, r5, #16\n\ - asr r0, #16\n\ - bl CheckForSpaceForDma3Request\n\ - lsl r0, #24\n\ - asr r0, #24\n\ - cmp r0, r7\n\ - bne _08001B1C\n\ - mov r0, #0x1\n\ - b _08001B2A\n\ - .pool\n\ -_08001B1C:\n\ - ldr r0, [r4]\n\ - bic r0, r6\n\ - str r0, [r4]\n\ -_08001B22:\n\ - add r5, #0x1\n\ - cmp r5, #0x7F\n\ - ble _08001ADC\n\ - mov r0, #0\n\ -_08001B2A:\n\ - pop {r4-r7}\n\ - pop {r1}\n\ - bx r1\n"); -} -#endif // NONMATCHING void ShowBg(u8 bg) { @@ -533,27 +479,27 @@ void SetBgAttribute(u8 bg, u8 attributeId, u8 value) { switch (attributeId) { - case 1: - SetBgControlAttributes(bg, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); - break; - case 2: - SetBgControlAttributes(bg, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); - break; - case 3: - SetBgControlAttributes(bg, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF); - break; - case 4: - SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF); - break; - case 7: - SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF); - break; - case 5: - SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF); - break; - case 6: - SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value); - break; + case 1: + SetBgControlAttributes(bg, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + break; + case 2: + SetBgControlAttributes(bg, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + break; + case 3: + SetBgControlAttributes(bg, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF); + break; + case 4: + SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF); + break; + case 7: + SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF); + break; + case 5: + SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF); + break; + case 6: + SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value); + break; } } @@ -561,36 +507,36 @@ u16 GetBgAttribute(u8 bg, u8 attributeId) { switch (attributeId) { - case 1: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX); - case 2: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX); - case 3: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); - case 4: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE); - case 7: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY); - case 5: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC); - case 6: - return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND); - case 8: - switch (GetBgType(bg)) - { - case 0: - return GetBgMetricTextMode(bg, 0) * 0x800; - case 1: - return GetBgMetricAffineMode(bg, 0) * 0x100; - default: - return 0; - } - case 9: - return GetBgType(bg); - case 10: - return sGpuBgConfigs2[bg].baseTile; - default: - return -1; + case 1: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX); + case 2: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX); + case 3: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); + case 4: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE); + case 7: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY); + case 5: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC); + case 6: + return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND); + case 8: + switch (GetBgType(bg)) + { + case 0: + return GetBgMetricTextMode(bg, 0) * 0x800; + case 1: + return GetBgMetricAffineMode(bg, 0) * 0x100; + default: + return 0; + } + case 9: + return GetBgType(bg); + case 10: + return sGpuBgConfigs2[bg].baseTile; + default: + return -1; } } @@ -607,58 +553,58 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op) switch (op) { - case 0: - default: - sGpuBgConfigs2[bg].bg_x = value; - break; - case 1: - sGpuBgConfigs2[bg].bg_x += value; - break; - case 2: - sGpuBgConfigs2[bg].bg_x -= value; - break; + case 0: + default: + sGpuBgConfigs2[bg].bg_x = value; + break; + case 1: + sGpuBgConfigs2[bg].bg_x += value; + break; + case 2: + sGpuBgConfigs2[bg].bg_x -= value; + break; } mode = GetBgMode(); switch (bg) { - case 0: - temp1 = sGpuBgConfigs2[0].bg_x >> 0x8; - SetGpuReg(REG_OFFSET_BG0HOFS, temp1); - break; - case 1: - temp1 = sGpuBgConfigs2[1].bg_x >> 0x8; - SetGpuReg(REG_OFFSET_BG1HOFS, temp1); - break; - case 2: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[2].bg_x >> 0x8; - SetGpuReg(REG_OFFSET_BG2HOFS, temp1); - } - else - { - temp1 = sGpuBgConfigs2[2].bg_x >> 0x10; - temp2 = sGpuBgConfigs2[2].bg_x & 0xFFFF; - SetGpuReg(REG_OFFSET_BG2X_H, temp1); - SetGpuReg(REG_OFFSET_BG2X_L, temp2); - } - break; - case 3: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[3].bg_x >> 0x8; - SetGpuReg(REG_OFFSET_BG3HOFS, temp1); - } - else if (mode == 2) - { - temp1 = sGpuBgConfigs2[3].bg_x >> 0x10; - temp2 = sGpuBgConfigs2[3].bg_x & 0xFFFF; - SetGpuReg(REG_OFFSET_BG3X_H, temp1); - SetGpuReg(REG_OFFSET_BG3X_L, temp2); - } - break; + case 0: + temp1 = sGpuBgConfigs2[0].bg_x >> 0x8; + SetGpuReg(REG_OFFSET_BG0HOFS, temp1); + break; + case 1: + temp1 = sGpuBgConfigs2[1].bg_x >> 0x8; + SetGpuReg(REG_OFFSET_BG1HOFS, temp1); + break; + case 2: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[2].bg_x >> 0x8; + SetGpuReg(REG_OFFSET_BG2HOFS, temp1); + } + else + { + temp1 = sGpuBgConfigs2[2].bg_x >> 0x10; + temp2 = sGpuBgConfigs2[2].bg_x & 0xFFFF; + SetGpuReg(REG_OFFSET_BG2X_H, temp1); + SetGpuReg(REG_OFFSET_BG2X_L, temp2); + } + break; + case 3: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[3].bg_x >> 0x8; + SetGpuReg(REG_OFFSET_BG3HOFS, temp1); + } + else if (mode == 2) + { + temp1 = sGpuBgConfigs2[3].bg_x >> 0x10; + temp2 = sGpuBgConfigs2[3].bg_x & 0xFFFF; + SetGpuReg(REG_OFFSET_BG3X_H, temp1); + SetGpuReg(REG_OFFSET_BG3X_L, temp2); + } + break; } return sGpuBgConfigs2[bg].bg_x; @@ -668,9 +614,10 @@ u32 GetBgX(u8 bg) { if (IsInvalidBg32(bg) != FALSE) return -1; - if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) + else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) return -1; - return sGpuBgConfigs2[bg].bg_x; + else + return sGpuBgConfigs2[bg].bg_x; } u32 ChangeBgY(u8 bg, u32 value, u8 op) @@ -686,58 +633,58 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op) switch (op) { - case 0: - default: - sGpuBgConfigs2[bg].bg_y = value; - break; - case 1: - sGpuBgConfigs2[bg].bg_y += value; - break; - case 2: - sGpuBgConfigs2[bg].bg_y -= value; - break; + case 0: + default: + sGpuBgConfigs2[bg].bg_y = value; + break; + case 1: + sGpuBgConfigs2[bg].bg_y += value; + break; + case 2: + sGpuBgConfigs2[bg].bg_y -= value; + break; } mode = GetBgMode(); switch (bg) { - case 0: - temp1 = sGpuBgConfigs2[0].bg_y >> 0x8; - SetGpuReg(REG_OFFSET_BG0VOFS, temp1); - break; - case 1: - temp1 = sGpuBgConfigs2[1].bg_y >> 0x8; - SetGpuReg(REG_OFFSET_BG1VOFS, temp1); - break; - case 2: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[2].bg_y >> 0x8; - SetGpuReg(REG_OFFSET_BG2VOFS, temp1); - } - else - { - temp1 = sGpuBgConfigs2[2].bg_y >> 0x10; - temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF; - SetGpuReg(REG_OFFSET_BG2Y_H, temp1); - SetGpuReg(REG_OFFSET_BG2Y_L, temp2); - } - break; - case 3: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[3].bg_y >> 0x8; - SetGpuReg(REG_OFFSET_BG3VOFS, temp1); - } - else if (mode == 2) - { - temp1 = sGpuBgConfigs2[3].bg_y >> 0x10; - temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF; - SetGpuReg(REG_OFFSET_BG3Y_H, temp1); - SetGpuReg(REG_OFFSET_BG3Y_L, temp2); - } - break; + case 0: + temp1 = sGpuBgConfigs2[0].bg_y >> 0x8; + SetGpuReg(REG_OFFSET_BG0VOFS, temp1); + break; + case 1: + temp1 = sGpuBgConfigs2[1].bg_y >> 0x8; + SetGpuReg(REG_OFFSET_BG1VOFS, temp1); + break; + case 2: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[2].bg_y >> 0x8; + SetGpuReg(REG_OFFSET_BG2VOFS, temp1); + } + else + { + temp1 = sGpuBgConfigs2[2].bg_y >> 0x10; + temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF; + SetGpuReg(REG_OFFSET_BG2Y_H, temp1); + SetGpuReg(REG_OFFSET_BG2Y_L, temp2); + } + break; + case 3: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[3].bg_y >> 0x8; + SetGpuReg(REG_OFFSET_BG3VOFS, temp1); + } + else if (mode == 2) + { + temp1 = sGpuBgConfigs2[3].bg_y >> 0x10; + temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF; + SetGpuReg(REG_OFFSET_BG3Y_H, temp1); + SetGpuReg(REG_OFFSET_BG3Y_L, temp2); + } + break; } return sGpuBgConfigs2[bg].bg_y; @@ -756,59 +703,59 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op) switch (op) { - case 0: - default: - sGpuBgConfigs2[bg].bg_y = value; - break; - case 1: - sGpuBgConfigs2[bg].bg_y += value; - break; - case 2: - sGpuBgConfigs2[bg].bg_y -= value; - break; + case 0: + default: + sGpuBgConfigs2[bg].bg_y = value; + break; + case 1: + sGpuBgConfigs2[bg].bg_y += value; + break; + case 2: + sGpuBgConfigs2[bg].bg_y -= value; + break; } mode = GetBgMode(); switch (bg) { - case 0: - temp1 = sGpuBgConfigs2[0].bg_y >> 0x8; - SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, temp1); - break; - case 1: - temp1 = sGpuBgConfigs2[1].bg_y >> 0x8; - SetGpuReg_ForcedBlank(REG_OFFSET_BG1VOFS, temp1); - break; - case 2: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[2].bg_y >> 0x8; - SetGpuReg_ForcedBlank(REG_OFFSET_BG2VOFS, temp1); + case 0: + temp1 = sGpuBgConfigs2[0].bg_y >> 0x8; + SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, temp1); + break; + case 1: + temp1 = sGpuBgConfigs2[1].bg_y >> 0x8; + SetGpuReg_ForcedBlank(REG_OFFSET_BG1VOFS, temp1); + break; + case 2: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[2].bg_y >> 0x8; + SetGpuReg_ForcedBlank(REG_OFFSET_BG2VOFS, temp1); - } - else - { - temp1 = sGpuBgConfigs2[2].bg_y >> 0x10; - temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF; - SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_H, temp1); - SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_L, temp2); - } - break; - case 3: - if (mode == 0) - { - temp1 = sGpuBgConfigs2[3].bg_y >> 0x8; - SetGpuReg_ForcedBlank(REG_OFFSET_BG3VOFS, temp1); - } - else if (mode == 2) - { - temp1 = sGpuBgConfigs2[3].bg_y >> 0x10; - temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF; - SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_H, temp1); - SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_L, temp2); - } - break; + } + else + { + temp1 = sGpuBgConfigs2[2].bg_y >> 0x10; + temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF; + SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_H, temp1); + SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_L, temp2); + } + break; + case 3: + if (mode == 0) + { + temp1 = sGpuBgConfigs2[3].bg_y >> 0x8; + SetGpuReg_ForcedBlank(REG_OFFSET_BG3VOFS, temp1); + } + else if (mode == 2) + { + temp1 = sGpuBgConfigs2[3].bg_y >> 0x10; + temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF; + SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_H, temp1); + SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_L, temp2); + } + break; } return sGpuBgConfigs2[bg].bg_y; @@ -818,9 +765,10 @@ u32 GetBgY(u8 bg) { if (IsInvalidBg32(bg) != FALSE) return -1; - if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) + else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) return -1; - return sGpuBgConfigs2[bg].bg_y; + else + return sGpuBgConfigs2[bg].bg_y; } void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle) @@ -842,57 +790,57 @@ u8 Unused_AdjustBgMosaic(u8 a1, u8 a2) switch (a2) { - case 0: - default: - test1 = a1 & 0xF; - test2 = a1 >> 0x4; - break; - case 1: - test1 = a1 & 0xF; - break; - case 2: - if ((test1 + a1) > 0xF) - { - test1 = 0xF; - } - else - { - test1 += a1; - } - break; - case 3: - if ((test1 - a1) < 0) - { - test1 = 0x0; - } - else - { - test1 -= a1; - } - break; - case 4: - test2 = a1 & 0xF; - break; - case 5: - if ((test2 + a1) > 0xF) - { - test2 = 0xF; - } - else - { - test2 += a1; - } - break; - case 6: - if ((test2 - a1) < 0) - { - test2 = 0x0; - } - else - { - test2 -= a1; - } - break; + case 0: + default: + test1 = a1 & 0xF; + test2 = a1 >> 0x4; + break; + case 1: + test1 = a1 & 0xF; + break; + case 2: + if ((test1 + a1) > 0xF) + { + test1 = 0xF; + } + else + { + test1 += a1; + } + break; + case 3: + if ((test1 - a1) < 0) + { + test1 = 0x0; + } + else + { + test1 -= a1; + } + break; + case 4: + test2 = a1 & 0xF; + break; + case 5: + if ((test2 + a1) > 0xF) + { + test2 = 0xF; + } + else + { + test2 += a1; + } + break; + case 6: + if ((test2 - a1) < 0) + { + test2 = 0x0; + } + else + { + test2 -= a1; + } + break; } result |= ((test2 << 0x4) & 0xF0); @@ -923,9 +871,10 @@ void* GetBgTilemapBuffer(u8 bg) { if (IsInvalidBg32(bg) != FALSE) return NULL; - if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) + else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0) return NULL; - return sGpuBgConfigs2[bg].tilemap; + else + return sGpuBgConfigs2[bg].tilemap; } void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset) @@ -933,13 +882,9 @@ void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset) if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE) { if (mode != 0) - { CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode); - } else - { LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2))); - } } } @@ -951,15 +896,15 @@ void CopyBgTilemapBufferToVram(u8 bg) { switch (GetBgType(bg)) { - case 0: - sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800; - break; - case 1: - sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100; - break; - default: - sizeToLoad = 0; - break; + case 0: + sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800; + break; + case 1: + sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100; + break; + default: + sizeToLoad = 0; + break; } LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2); } @@ -976,27 +921,27 @@ void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 wi { switch (GetBgType(bg)) { - case 0: - srcCopy = src; - for (destY16 = destY; destY16 < (destY + height); destY16++) - { - for (destX16 = destX; destX16 < (destX + width); destX16++) - { - ((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *((u16*)srcCopy)++; - } - } - break; - case 1: - srcCopy = src; - mode = GetBgMetricAffineMode(bg, 0x1); - for (destY16 = destY; destY16 < (destY + height); destY16++) - { - for (destX16 = destX; destX16 < (destX + width); destX16++) - { - ((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *((u8*)srcCopy)++; - } - } - break; + case 0: + srcCopy = src; + for (destY16 = destY; destY16 < (destY + height); destY16++) + { + for (destX16 = destX; destX16 < (destX + width); destX16++) + { + ((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *((u16*)srcCopy)++; + } + } + break; + case 1: + srcCopy = src; + mode = GetBgMetricAffineMode(bg, 0x1); + for (destY16 = destY; destY16 < (destY + height); destY16++) + { + for (destX16 = destX; destX16 < (destX + width); destX16++) + { + ((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *((u8*)srcCopy)++; + } + } + break; } } } @@ -1005,295 +950,49 @@ void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u { CopyRectToBgTilemapBufferRect(bg, src, 0, 0, rectWidth, rectHeight, destX, destY, rectWidth, rectHeight, palette, 0, 0); } -// Skipping for now, it probably uses structs passed by value -/* -void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) + +void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 unused, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, s16 palette1, s16 tileOffset) { - u16 attribute; - u16 mode; - u16 mode2; + u16 screenWidth, screenHeight, screenSize; + u16 var; + const void *srcPtr; + u16 i, j; - void* srcCopy; - u16 destX16; - u16 destY16; - - if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE) + if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg)) { - attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); - mode = GetBgMetricTextMode(bg, 0x1) * 0x20; - mode2 = GetBgMetricTextMode(bg, 0x2) * 0x20; + screenSize = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); + screenWidth = GetBgMetricTextMode(bg, 0x1) * 0x20; + screenHeight = GetBgMetricTextMode(bg, 0x2) * 0x20; switch (GetBgType(bg)) { - case 0: - srcCopy = src; - for (destY16 = destY; destY16 < (destY + rectHeight); destY16++) + case 0: + srcPtr = src + ((srcY * srcWidth) + srcX) * 2; + for (i = destX; i < (destX + rectWidth); i++) + { + for (j = srcHeight; j < (srcHeight + destY); j++) { - for (destX16 = destX; destX16 < (destX + rectWidth); destX16++) - { - CopyTileMapEntry(&((u16*)srcCopy)[(srcY * rectWidth) + srcX], &((u16*)sGpuBgConfigs2[bg].tilemap)[GetTileMapIndexFromCoords(destX16, destY16, attribute, mode, mode2)], palette1, tileOffset, palette2); - } + u16 index = GetTileMapIndexFromCoords(j, i, screenSize, screenWidth, screenHeight); + CopyTileMapEntry(srcPtr, sGpuBgConfigs2[bg].tilemap + (index * 2), rectHeight, palette1, tileOffset); + srcPtr += 2; } - break; - case 1: - srcCopy = src; - mode = GetBgMetricAffineMode(bg, 0x1); - for (destY16 = destY; destY16 < (destY + rectHeight); destY16++) + srcPtr += (srcWidth - destY) * 2; + } + break; + case 1: + srcPtr = src + ((srcY * srcWidth) + srcX); + var = GetBgMetricAffineMode(bg, 0x1); + for (i = destX; i < (destX + rectWidth); i++) + { + for (j = srcHeight; j < (srcHeight + destY); j++) { - for (destX16 = destX; destX16 < (destX + rectWidth); destX16++) - { - CopyTileMapEntry(&((u16*)srcCopy)[(srcY * rectWidth) + srcX], &((u16*)sGpuBgConfigs2[bg].tilemap)[GetTileMapIndexFromCoords(destX16, destY16, attribute, mode, mode2)], palette1, tileOffset, palette2); - } + *(u8*)(sGpuBgConfigs2[bg].tilemap + ((var * i) + j)) = *(u8*)(srcPtr) + palette1; + srcPtr++; } - break; + srcPtr += (srcWidth - destY); + } + break; } } -}*/ -NAKED -void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) -{ - asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x40\n\ - str r1, [sp, #0x8]\n\ - ldr r1, [sp, #0x60]\n\ - ldr r4, [sp, #0x68]\n\ - ldr r5, [sp, #0x6C]\n\ - ldr r6, [sp, #0x70]\n\ - ldr r7, [sp, #0x74]\n\ - mov r8, r7\n\ - ldr r7, [sp, #0x78]\n\ - mov r9, r7\n\ - ldr r7, [sp, #0x7C]\n\ - mov r10, r7\n\ - ldr r7, [sp, #0x80]\n\ - mov r12, r7\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - str r0, [sp, #0x4]\n\ - lsl r2, #24\n\ - lsr r2, #24\n\ - str r2, [sp, #0xC]\n\ - lsl r3, #24\n\ - lsr r3, #24\n\ - str r3, [sp, #0x10]\n\ - lsl r1, #24\n\ - lsr r7, r1, #24\n\ - lsl r4, #24\n\ - lsr r4, #24\n\ - str r4, [sp, #0x14]\n\ - lsl r5, #24\n\ - lsr r5, #24\n\ - lsl r6, #24\n\ - lsr r6, #24\n\ - str r6, [sp, #0x18]\n\ - mov r0, r8\n\ - lsl r0, #24\n\ - lsr r4, r0, #24\n\ - mov r1, r9\n\ - lsl r1, #24\n\ - lsr r1, #24\n\ - str r1, [sp, #0x1C]\n\ - mov r2, r10\n\ - lsl r2, #16\n\ - lsr r2, #16\n\ - str r2, [sp, #0x20]\n\ - mov r0, r12\n\ - lsl r0, #16\n\ - lsr r0, #16\n\ - str r0, [sp, #0x24]\n\ - ldr r0, [sp, #0x4]\n\ - bl IsInvalidBg32\n\ - cmp r0, #0\n\ - beq _08002592\n\ - b _080026EE\n\ -_08002592:\n\ - ldr r0, [sp, #0x4]\n\ - bl IsTileMapOutsideWram\n\ - cmp r0, #0\n\ - beq _0800259E\n\ - b _080026EE\n\ -_0800259E:\n\ - ldr r0, [sp, #0x4]\n\ - mov r1, #0x4\n\ - bl GetBgControlAttribute\n\ - lsl r0, #16\n\ - lsr r0, #16\n\ - str r0, [sp, #0x30]\n\ - ldr r0, [sp, #0x4]\n\ - mov r1, #0x1\n\ - bl GetBgMetricTextMode\n\ - lsl r0, #21\n\ - lsr r0, #16\n\ - str r0, [sp, #0x28]\n\ - ldr r0, [sp, #0x4]\n\ - mov r1, #0x2\n\ - bl GetBgMetricTextMode\n\ - lsl r0, #21\n\ - lsr r0, #16\n\ - str r0, [sp, #0x2C]\n\ - ldr r0, [sp, #0x4]\n\ - bl GetBgType\n\ - cmp r0, #0\n\ - beq _080025D8\n\ - cmp r0, #0x1\n\ - beq _08002674\n\ - b _080026EE\n\ -_080025D8:\n\ - ldr r1, [sp, #0x10]\n\ - add r0, r1, #0\n\ - mul r0, r7\n\ - ldr r2, [sp, #0xC]\n\ - add r0, r2\n\ - lsl r0, #1\n\ - ldr r1, [sp, #0x8]\n\ - add r6, r1, r0\n\ - add r0, r5, r4\n\ - cmp r5, r0\n\ - blt _080025F0\n\ - b _080026EE\n\ -_080025F0:\n\ - ldr r2, [sp, #0x18]\n\ - sub r2, r7, r2\n\ - str r2, [sp, #0x34]\n\ - str r0, [sp, #0x38]\n\ -_080025F8:\n\ - ldr r4, [sp, #0x14]\n\ - ldr r7, [sp, #0x18]\n\ - add r0, r4, r7\n\ - add r1, r5, #0x1\n\ - str r1, [sp, #0x3C]\n\ - cmp r4, r0\n\ - bge _0800265A\n\ - ldr r2, [sp, #0x4]\n\ - lsl r0, r2, #4\n\ - ldr r1, =sGpuBgConfigs2+4\n\ - add r0, r1\n\ - mov r10, r0\n\ - ldr r7, [sp, #0x20]\n\ - lsl r7, #16\n\ - mov r9, r7\n\ - ldr r1, [sp, #0x24]\n\ - lsl r0, r1, #16\n\ - asr r0, #16\n\ - mov r8, r0\n\ -_0800261E:\n\ - ldr r2, [sp, #0x2C]\n\ - str r2, [sp]\n\ - add r0, r4, #0\n\ - add r1, r5, #0\n\ - ldr r2, [sp, #0x30]\n\ - ldr r3, [sp, #0x28]\n\ - bl GetTileMapIndexFromCoords\n\ - lsl r0, #16\n\ - lsr r0, #15\n\ - mov r7, r10\n\ - ldr r1, [r7]\n\ - add r1, r0\n\ - mov r0, r8\n\ - str r0, [sp]\n\ - add r0, r6, #0\n\ - ldr r2, [sp, #0x1C]\n\ - mov r7, r9\n\ - asr r3, r7, #16\n\ - bl CopyTileMapEntry\n\ - add r6, #0x2\n\ - add r0, r4, #0x1\n\ - lsl r0, #16\n\ - lsr r4, r0, #16\n\ - ldr r1, [sp, #0x14]\n\ - ldr r2, [sp, #0x18]\n\ - add r0, r1, r2\n\ - cmp r4, r0\n\ - blt _0800261E\n\ -_0800265A:\n\ - ldr r5, [sp, #0x34]\n\ - lsl r0, r5, #1\n\ - add r6, r0\n\ - ldr r7, [sp, #0x3C]\n\ - lsl r0, r7, #16\n\ - lsr r5, r0, #16\n\ - ldr r0, [sp, #0x38]\n\ - cmp r5, r0\n\ - blt _080025F8\n\ - b _080026EE\n\ - .pool\n\ -_08002674:\n\ - ldr r1, [sp, #0x10]\n\ - add r0, r1, #0\n\ - mul r0, r7\n\ - ldr r2, [sp, #0xC]\n\ - add r0, r2\n\ - ldr r1, [sp, #0x8]\n\ - add r6, r1, r0\n\ - ldr r0, [sp, #0x4]\n\ - mov r1, #0x1\n\ - bl GetBgMetricAffineMode\n\ - lsl r0, #16\n\ - lsr r0, #16\n\ - mov r9, r0\n\ - add r0, r5, r4\n\ - cmp r5, r0\n\ - bge _080026EE\n\ - ldr r2, [sp, #0x18]\n\ - sub r2, r7, r2\n\ - str r2, [sp, #0x34]\n\ - str r0, [sp, #0x38]\n\ - ldr r7, =sGpuBgConfigs2+4\n\ - mov r10, r7\n\ - ldr r0, [sp, #0x4]\n\ - lsl r0, #4\n\ - mov r8, r0\n\ -_080026A8:\n\ - ldr r4, [sp, #0x14]\n\ - ldr r1, [sp, #0x18]\n\ - add r0, r4, r1\n\ - add r2, r5, #0x1\n\ - str r2, [sp, #0x3C]\n\ - cmp r4, r0\n\ - bge _080026DE\n\ - mov r3, r8\n\ - add r3, r10\n\ - mov r7, r9\n\ - mul r7, r5\n\ - mov r12, r7\n\ - add r2, r0, #0\n\ -_080026C2:\n\ - ldr r1, [r3]\n\ - mov r5, r12\n\ - add r0, r5, r4\n\ - add r1, r0\n\ - ldrb r0, [r6]\n\ - ldr r7, [sp, #0x20]\n\ - add r0, r7\n\ - strb r0, [r1]\n\ - add r6, #0x1\n\ - add r0, r4, #0x1\n\ - lsl r0, #16\n\ - lsr r4, r0, #16\n\ - cmp r4, r2\n\ - blt _080026C2\n\ -_080026DE:\n\ - ldr r0, [sp, #0x34]\n\ - add r6, r0\n\ - ldr r1, [sp, #0x3C]\n\ - lsl r0, r1, #16\n\ - lsr r5, r0, #16\n\ - ldr r2, [sp, #0x38]\n\ - cmp r5, r2\n\ - blt _080026A8\n\ -_080026EE:\n\ - add sp, #0x40\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n"); } void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height) @@ -1384,42 +1083,42 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric) switch (whichMetric) { + case 0: + switch (attribute) + { case 0: - switch (attribute) - { - case 0: - return 1; - case 1: - case 2: - return 2; - case 3: - return 4; - } - break; + return 1; case 1: - switch (attribute) - { - case 0: - return 1; - case 1: - return 2; - case 2: - return 1; - case 3: - return 2; - } - break; case 2: - switch (attribute) - { - case 0: - case 1: - return 1; - case 2: - case 3: - return 2; - } - break; + return 2; + case 3: + return 4; + } + break; + case 1: + switch (attribute) + { + case 0: + return 1; + case 1: + return 2; + case 2: + return 1; + case 3: + return 2; + } + break; + case 2: + switch (attribute) + { + case 0: + case 1: + return 1; + case 2: + case 3: + return 2; + } + break; } return 0; } @@ -1432,22 +1131,22 @@ u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric) switch (whichMetric) { + case 0: + switch (attribute) + { case 0: - switch (attribute) - { - case 0: - return 0x1; - case 1: - return 0x4; - case 2: - return 0x10; - case 3: - return 0x40; - } - break; + return 0x1; case 1: + return 0x4; case 2: - return 0x10 << attribute; + return 0x10; + case 3: + return 0x40; + } + break; + case 1: + case 2: + return 0x10 << attribute; } return 0; } @@ -1459,44 +1158,45 @@ u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32 switch (screenSize) { - case 0: - case 2: - break; - case 3: - if (y >= 0x20) - y += 0x20; - case 1: - if (x >= 0x20) - { - x -= 0x20; - y += 0x20; - } + case 0: + case 2: + break; + case 3: + if (y >= 0x20) + y += 0x20; + case 1: + if (x >= 0x20) + { + x -= 0x20; + y += 0x20; + } + break; } return (y * 0x20) + x; } #ifdef NONMATCHING // This one has some weird switch statement cases that refuse to cooperate -void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2) +void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2) { - u16 test; + u16 var; switch (palette1) { - default: - if (palette1 > 0x10 || palette1 < 0) - test = *src + tileOffset + (palette2 << 12); - else - test = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12); - break; - case 0x10: - test = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF); - break; + case 0 ... 16: + if (palette1 != 16) + var = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12); + else + var = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF); + break; + default: + var = *src + tileOffset + (palette2 << 12); + break; } - *dest = test; + *dest = var; } #else NAKED -void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2) +void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2) { asm("push {r4-r6,lr}\n\ add r4, r0, #0\n\ @@ -1550,41 +1250,38 @@ _08002B3C:\n\ u32 GetBgType(u8 bg) { - u8 mode; - - mode = GetBgMode(); - + u8 mode = GetBgMode(); switch (bg) { + case 0: + case 1: + switch (mode) + { case 0: case 1: - switch (mode) - { - case 0: - case 1: - return 0; - } - break; + return 0; + } + break; + case 2: + switch (mode) + { + case 0: + return 0; + case 1: case 2: - switch (mode) - { - case 0: - return 0; - case 1: - case 2: - return 1; - } - break; - case 3: - switch (mode) - { - case 0: - return 0; - case 2: - return 1; - } - break; + return 1; + } + break; + case 3: + switch (mode) + { + case 0: + return 0; + case 2: + return 1; + } + break; } return 0xFFFF; @@ -1594,14 +1291,16 @@ bool32 IsInvalidBg32(u8 bg) { if (bg > 3) return TRUE; - return FALSE; + else + return FALSE; } bool32 IsTileMapOutsideWram(u8 bg) { if (sGpuBgConfigs2[bg].tilemap > (void*)IWRAM_END) return TRUE; - if (sGpuBgConfigs2[bg].tilemap == 0x0) + else if (sGpuBgConfigs2[bg].tilemap == NULL) return TRUE; - return FALSE; + else + return FALSE; } diff --git a/src/field_effect.c b/src/field_effect.c index 2ec5edf1e..e40b3d2dd 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -32,6 +32,8 @@ #define subsprite_table(ptr) {.subsprites = ptr, .subspriteCount = (sizeof ptr) / (sizeof(struct Subsprite))} +extern struct CompressedSpritePalette gMonPaletteTable[]; // GF made a mistake and did not extern it as const. + EWRAM_DATA s32 gFieldEffectArguments[8] = {0}; // Static type declarations @@ -755,67 +757,15 @@ u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority) return CreateSprite(&gNewGameBirchObjectTemplate, x, y, subpriority); } -#ifdef NONMATCHING u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority) { - u16 spriteId = CreateMonPicSprite_HandleDeoxys(species, 0, 0x8000, 1, x, y, 0, gMonPaletteTable[species].tag); + s32 spriteId = CreateMonPicSprite_HandleDeoxys(species, 0, 0x8000, 1, x, y, 0, gMonPaletteTable[species].tag); PreservePaletteInWeather(IndexOfSpritePaletteTag(gMonPaletteTable[species].tag) + 0x10); if (spriteId == 0xFFFF) return MAX_SPRITES; - - return spriteId; + else + return spriteId; } -#else -NAKED -u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority) -{ - asm_unified("push {r4,r5,lr}\n\ - sub sp, 0x10\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - movs r3, 0x80\n\ - lsls r3, 8\n\ - lsls r1, 16\n\ - asrs r1, 16\n\ - str r1, [sp]\n\ - lsls r2, 16\n\ - asrs r2, 16\n\ - str r2, [sp, 0x4]\n\ - movs r1, 0\n\ - str r1, [sp, 0x8]\n\ - ldr r1, =gMonPaletteTable\n\ - lsls r4, r0, 3\n\ - adds r4, r1\n\ - ldrh r1, [r4, 0x4]\n\ - str r1, [sp, 0xC]\n\ - movs r1, 0\n\ - adds r2, r3, 0\n\ - movs r3, 0x1\n\ - bl CreateMonPicSprite_HandleDeoxys\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - ldrh r0, [r4, 0x4]\n\ - bl IndexOfSpritePaletteTag\n\ - adds r0, 0x10\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - bl PreservePaletteInWeather\n\ - ldr r0, =0x0000ffff\n\ - cmp r5, r0\n\ - beq _080B5FDC\n\ - lsls r0, r5, 24\n\ - lsrs r0, 24\n\ - b _080B5FDE\n\ - .pool\n\ -_080B5FDC:\n\ - movs r0, 0x40\n\ -_080B5FDE:\n\ - add sp, 0x10\n\ - pop {r4,r5}\n\ - pop {r1}\n\ - bx r1"); -} -#endif //NONMATCHING u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y, u8 subpriority) { @@ -824,8 +774,8 @@ u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y, u8 subprio PreservePaletteInWeather(IndexOfSpritePaletteTag(spritePalette->tag) + 0x10); if (spriteId == 0xFFFF) return 0x40; - - return spriteId; + else + return spriteId; } void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId) diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 856f7d5ef..64a37791e 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -142,7 +142,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) reflectionSprite->pos2.x = mainSprite->pos2.x; reflectionSprite->pos2.y = -mainSprite->pos2.y; reflectionSprite->coordOffsetEnabled = mainSprite->coordOffsetEnabled; - + if (eventObject->unk3_3 == TRUE) reflectionSprite->invisible = TRUE; @@ -1022,19 +1022,19 @@ static void SynchroniseSurfAnim(struct EventObject *eventObject, struct Sprite * StartSpriteAnimIfDifferent(sprite, surfBlobDirectionAnims[eventObject->movementDirection]); } -#ifdef NONMATCHING void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite) { - s16 x; - s16 y; u8 i; + s16 x = eventObject->currentCoords.x; + s16 y = eventObject->currentCoords.y; + s32 spriteY = sprite->pos2.y; - x = eventObject->currentCoords.x; - y = eventObject->currentCoords.y; - if (sprite->pos2.y == 0 && (x != sprite->data[6] || y != sprite->data[7])) + if (spriteY == 0 && (x != sprite->data[6] || y != sprite->data[7])) { - sprite->data[5] = sprite->pos2.y; - for (sprite->data[6] = x, sprite->data[7] = y, i = DIR_SOUTH; i <= DIR_EAST; i ++, x = sprite->data[6], y = sprite->data[7]) + sprite->data[5] = spriteY; + sprite->data[6] = x; + sprite->data[7] = y; + for (i = DIR_SOUTH; i <= DIR_EAST; i++, x = sprite->data[6], y = sprite->data[7]) { MoveCoords(i, &x, &y); if (MapGridGetZCoordAt(x, y) == 3) @@ -1045,87 +1045,6 @@ void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite) } } } -#else -NAKED void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite) -{ - asm_unified("push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - sub sp, 0x4\n\ - adds r4, r1, 0\n\ - ldrh r2, [r0, 0x10]\n\ - mov r1, sp\n\ - strh r2, [r1]\n\ - ldrh r1, [r0, 0x12]\n\ - mov r0, sp\n\ - adds r0, 0x2\n\ - strh r1, [r0]\n\ - movs r2, 0x26\n\ - ldrsh r3, [r4, r2]\n\ - mov r8, r0\n\ - cmp r3, 0\n\ - bne _08155770\n\ - mov r0, sp\n\ - movs r5, 0\n\ - ldrsh r2, [r0, r5]\n\ - movs r5, 0x3A\n\ - ldrsh r0, [r4, r5]\n\ - cmp r2, r0\n\ - bne _08155724\n\ - lsls r0, r1, 16\n\ - asrs r0, 16\n\ - movs r5, 0x3C\n\ - ldrsh r1, [r4, r5]\n\ - cmp r0, r1\n\ - beq _08155770\n\ -_08155724:\n\ - strh r3, [r4, 0x38]\n\ - strh r2, [r4, 0x3A]\n\ - mov r1, r8\n\ - movs r2, 0\n\ - ldrsh r0, [r1, r2]\n\ - strh r0, [r4, 0x3C]\n\ - movs r5, 0x1\n\ - mov r7, r8\n\ - mov r6, sp\n\ -_08155736:\n\ - adds r0, r5, 0\n\ - mov r1, sp\n\ - adds r2, r7, 0\n\ - bl MoveCoords\n\ - movs r1, 0\n\ - ldrsh r0, [r6, r1]\n\ - movs r2, 0\n\ - ldrsh r1, [r7, r2]\n\ - bl MapGridGetZCoordAt\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0x3\n\ - bne _0815575C\n\ - ldrh r0, [r4, 0x38]\n\ - adds r0, 0x1\n\ - strh r0, [r4, 0x38]\n\ - b _08155770\n\ -_0815575C:\n\ - adds r0, r5, 0x1\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - ldrh r0, [r4, 0x3A]\n\ - strh r0, [r6]\n\ - ldrh r0, [r4, 0x3C]\n\ - mov r1, r8\n\ - strh r0, [r1]\n\ - cmp r5, 0x4\n\ - bls _08155736\n\ -_08155770:\n\ - add sp, 0x4\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0"); -} -#endif static void CreateBobbingEffect(struct EventObject *eventObject, struct Sprite *linkedSprite, struct Sprite *sprite) { @@ -1450,7 +1369,7 @@ void sub_8155EA0(struct Sprite *sprite) bool8 sub_8155EA8(struct Sprite *sprite) { bool8 returnBool = FALSE; - + switch (sprite->data[7]) { case 0: @@ -1470,7 +1389,7 @@ bool8 sub_8155EA8(struct Sprite *sprite) sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); break; } - + SetGpuReg(REG_OFFSET_BG0HOFS, -sprite->pos2.x); if (++sprite->data[6] == 72) { @@ -1483,14 +1402,14 @@ bool8 sub_8155EA8(struct Sprite *sprite) sprite->pos2.x = 0; returnBool = TRUE; } - + return returnBool; } void sub_8155F80(struct Sprite *sprite) { u8 i, j; - + switch (sprite->data[2]) { case 0: @@ -1594,7 +1513,7 @@ void sub_8155F80(struct Sprite *sprite) FieldEffectStop(sprite, FLDEFF_64); break; } - + if (sprite->data[2] == 1) { if ((sprite->data[1] & 7) == 0) @@ -1603,7 +1522,7 @@ void sub_8155F80(struct Sprite *sprite) sprite->data[3] = -sprite->data[3]; sprite->data[1]++; } - + sprite->data[0]++; } diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 172fcc723..ab52cb37e 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -15,7 +15,6 @@ #include "task.h" #include "text.h" - // enums enum MapPopUp_Themes { @@ -33,7 +32,7 @@ static void ShowMapNamePopUpWindow(void); static void LoadMapNamePopUpWindowBg(void); // EWRAM -static EWRAM_DATA u8 mapNamePopupTaskId = 0; +static EWRAM_DATA u8 sPopupTaskId = 0; // .rodata static const u8 gMapPopUp_Table[][960] = @@ -202,7 +201,7 @@ bool8 sub_80D47D4(void) { HideStartMenu(); ShowMapNamePopup(); - return 1; + return TRUE; } void ShowMapNamePopup(void) @@ -211,16 +210,16 @@ void ShowMapNamePopup(void) { if (!FuncIsActiveTask(Task_MapNamePopUpWindow)) { - mapNamePopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90); + sPopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90); SetGpuReg(REG_OFFSET_BG0VOFS, 40); - gTasks[mapNamePopupTaskId].data[0] = 6; - gTasks[mapNamePopupTaskId].data[2] = 40; + gTasks[sPopupTaskId].data[0] = 6; + gTasks[sPopupTaskId].data[2] = 40; } else { - if (gTasks[mapNamePopupTaskId].data[0] != 2) - gTasks[mapNamePopupTaskId].data[0] = 2; - gTasks[mapNamePopupTaskId].data[3] = 1; + if (gTasks[sPopupTaskId].data[0] != 2) + gTasks[sPopupTaskId].data[0] = 2; + gTasks[sPopupTaskId].data[3] = 1; } } } @@ -246,7 +245,7 @@ static void Task_MapNamePopUpWindow(u8 taskId) { task->data[2] = 0; task->data[0] = 1; - gTasks[mapNamePopupTaskId].data[1] = 0; + gTasks[sPopupTaskId].data[1] = 0; } break; case 1: @@ -293,7 +292,7 @@ void HideMapNamePopUpWindow(void) sub_819746C(GetMapNamePopUpWindowId(), TRUE); RemoveMapNamePopUpWindow(); SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0); - DestroyTask(mapNamePopupTaskId); + DestroyTask(sPopupTaskId); } } @@ -304,9 +303,9 @@ static void ShowMapNamePopUpWindow(void) u8 x; const u8* mapDisplayHeaderSource; - if(InBattlePyramid()) + if (InBattlePyramid()) { - if(gMapHeader.mapLayoutId == 0x17A) + if (gMapHeader.mapLayoutId == 0x17A) { withoutPrefixPtr = &(mapDisplayHeader[3]); mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7]; @@ -333,220 +332,47 @@ static void ShowMapNamePopUpWindow(void) CopyWindowToVram(GetMapNamePopUpWindowId(), 3); } -#ifdef NONMATCHING static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused) { s32 i; - for(i=0; i<=11; i++) + for (i = 0; i < 12; i++) { - FillBgTilemapBufferRect(bg, 0x21D + i, x + i - 1, y - 1, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x21D + i, i - 1 + x, y - 1, 1, 1, 0xE); } - FillBgTilemapBufferRect(bg, 0x229 + i, x - 1, y, 1, 1, 0xE); - FillBgTilemapBufferRect(bg, 0x22A + i, deltaX + x, y, 1, 1, 0xE); - FillBgTilemapBufferRect(bg, 0x22B + i, x - 1, y + 1 , 1, 1, 0xE); - FillBgTilemapBufferRect(bg, 0x22C + i, deltaX + x, y + 1, 1, 1, 0xE); - FillBgTilemapBufferRect(bg, 0x22D + i, x - 1, y + 2, 1, 1, 0xE); - FillBgTilemapBufferRect(bg, 0x22E + i, deltaX + x, y + 2, 1, 1, 0xE); - for(i=0; i<=11; i++) + FillBgTilemapBufferRect(bg, 0x229, x - 1, y, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22A, deltaX + x, y, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22B, x - 1, y + 1 , 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22C, deltaX + x, y + 1, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22D, x - 1, y + 2, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22E, deltaX + x, y + 2, 1, 1, 0xE); + for (i = 0; i < 12; i++) { - FillBgTilemapBufferRect(bg, 0x22F + i, x + i - 1, y + deltaY, 1, 1, 0xE); + FillBgTilemapBufferRect(bg, 0x22F + i, i - 1 + x, y + deltaY, 1, 1, 0xE); } } -#else -NAKED -static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused) -{ - asm("\n\ - .syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x1C\n\ - ldr r4, [sp, 0x3C]\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - mov r10, r1\n\ - lsls r2, 24\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - str r3, [sp, 0x10]\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - str r4, [sp, 0x14]\n\ - movs r5, 0\n\ - lsls r0, r1, 24\n\ - asrs r1, r0, 24\n\ - lsrs r3, r2, 24\n\ - str r3, [sp, 0xC]\n\ - movs r6, 0xFF\n\ - lsls r6, 24\n\ - adds r6, r2\n\ - mov r8, r6\n\ - str r0, [sp, 0x18]\n\ - subs r4, r1, 0x1\n\ - _080D4AB4:\n\ - ldr r0, =0x0000021d\n\ - adds r1, r5, r0\n\ - lsls r1, 16\n\ - lsrs r1, 16\n\ - lsls r2, r4, 24\n\ - lsrs r2, 24\n\ - movs r3, 0x1\n\ - str r3, [sp]\n\ - str r3, [sp, 0x4]\n\ - movs r6, 0xE\n\ - mov r9, r6\n\ - str r6, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - mov r6, r8\n\ - lsrs r3, r6, 24\n\ - bl FillBgTilemapBufferRect\n\ - adds r4, 0x1\n\ - adds r5, 0x1\n\ - cmp r5, 0xB\n\ - ble _080D4AB4\n\ - ldr r1, =0x00000229\n\ - movs r0, 0x1\n\ - negs r0, r0\n\ - add r0, r10\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - mov r8, r0\n\ - movs r5, 0x1\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r2, r9\n\ - str r2, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - mov r2, r8\n\ - ldr r3, [sp, 0xC]\n\ - bl FillBgTilemapBufferRect\n\ - ldr r1, =0x0000022a\n\ - ldr r6, [sp, 0x10]\n\ - add r6, r10\n\ - lsls r6, 24\n\ - lsrs r6, 24\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r3, r9\n\ - str r3, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - adds r2, r6, 0\n\ - ldr r3, [sp, 0xC]\n\ - bl FillBgTilemapBufferRect\n\ - ldr r1, =0x0000022b\n\ - ldr r4, [sp, 0xC]\n\ - adds r4, 0x1\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r0, r9\n\ - str r0, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - mov r2, r8\n\ - adds r3, r4, 0\n\ - bl FillBgTilemapBufferRect\n\ - movs r1, 0x8B\n\ - lsls r1, 2\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r2, r9\n\ - str r2, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - adds r2, r6, 0\n\ - adds r3, r4, 0\n\ - bl FillBgTilemapBufferRect\n\ - ldr r1, =0x0000022d\n\ - ldr r4, [sp, 0xC]\n\ - adds r4, 0x2\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r3, r9\n\ - str r3, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - mov r2, r8\n\ - adds r3, r4, 0\n\ - bl FillBgTilemapBufferRect\n\ - ldr r1, =0x0000022e\n\ - str r5, [sp]\n\ - str r5, [sp, 0x4]\n\ - mov r0, r9\n\ - str r0, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - adds r2, r6, 0\n\ - adds r3, r4, 0\n\ - bl FillBgTilemapBufferRect\n\ - movs r5, 0\n\ - ldr r1, [sp, 0xC]\n\ - ldr r2, [sp, 0x14]\n\ - adds r0, r1, r2\n\ - lsls r4, r0, 24\n\ - movs r6, 0x1\n\ - _080D4B8A:\n\ - ldr r3, =0x0000022f\n\ - adds r1, r5, r3\n\ - lsls r1, 16\n\ - lsrs r1, 16\n\ - subs r0, r5, 0x1\n\ - ldr r3, [sp, 0x18]\n\ - asrs r2, r3, 24\n\ - adds r2, r0\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - str r6, [sp]\n\ - str r6, [sp, 0x4]\n\ - movs r0, 0xE\n\ - str r0, [sp, 0x8]\n\ - adds r0, r7, 0\n\ - lsrs r3, r4, 24\n\ - bl FillBgTilemapBufferRect\n\ - adds r5, 0x1\n\ - cmp r5, 0xB\n\ - ble _080D4B8A\n\ - add sp, 0x1C\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided"); -} -#endif // NONMATCHING static void LoadMapNamePopUpWindowBg(void) { - u8 popupWindowId; - u16 regionMapSectionId; u8 popUpThemeId; + u8 popupWindowId = GetMapNamePopUpWindowId(); + u16 regionMapSectionId = gMapHeader.regionMapSectionId; - popupWindowId = GetMapNamePopUpWindowId(); - regionMapSectionId = gMapHeader.regionMapSectionId; - if(regionMapSectionId > MAPSEC_DYNAMIC) + if (regionMapSectionId > MAPSEC_DYNAMIC) { - if(regionMapSectionId > MAPSEC_SPECIAL_AREA) + if (regionMapSectionId > MAPSEC_SPECIAL_AREA) regionMapSectionId -= (MAPSEC_SPECIAL_AREA - MAPSEC_DYNAMIC); else - regionMapSectionId = 0; //discard kanto region sections + regionMapSectionId = 0; // Discard kanto region sections; } popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId]; - LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D); + LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), gMapPopUp_Outline_Table[popUpThemeId], 0x400, 0x21D); CallWindowFunction(popupWindowId, sub_80D4A78); PutWindowTilemap(popupWindowId); if(gMapHeader.weather == WEATHER_BUBBLES) LoadPalette(&gUnknown_0857F444, 0xE0, 0x20); else - LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20); - BlitBitmapToWindow(popupWindowId, &(gMapPopUp_Table[popUpThemeId][0]), 0, 0, 80, 24); + LoadPalette(gMapPopUp_Palette_Table[popUpThemeId], 0xE0, 0x20); + BlitBitmapToWindow(popupWindowId, gMapPopUp_Table[popUpThemeId], 0, 0, 80, 24); } diff --git a/src/text.c b/src/text.c index 2380e3191..8c940b0b2 100644 --- a/src/text.c +++ b/src/text.c @@ -257,584 +257,169 @@ u32 RenderFont(struct TextPrinter *textPrinter) } } -#ifdef NONMATCHING void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { - u16* current = gFontHalfRowLookupTable; + u32 fg12, bg12, shadow12; + u32 fg8, bg8, shadow8; + u32 fg4, bg4, shadow4; + u32 temp; + + u16 *current = gFontHalfRowLookupTable; gLastTextBgColor = bgColor; gLastTextFgColor = fgColor; gLastTextShadowColor = shadowColor; - *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor; + bg12 = bgColor << 12; + fg12 = fgColor << 12; + shadow12 = shadowColor << 12; - *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor; + bg8 = bgColor << 8; + bg4 = bgColor << 4; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor; + temp = (bg8) | (bg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor; + fg8 = fgColor << 8; - *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor; + temp = (fg8) | (bg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor; + shadow8 = shadowColor << 8; - *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor; + temp = (shadow8) | (bg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor; + fg4 = fgColor << 4; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor; + temp = (bg8) | (fg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor; + temp = (fg8) | (fg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor; + temp = (shadow8) | (fg4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor; + shadow4 = shadowColor << 4; - *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor; + temp = (bg8) | (shadow4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor; + temp = (fg8) | (shadow4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor; + temp = (shadow8) | (shadow4) | bgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor; + temp = (bg8) | (bg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor; + temp = (fg8) | (bg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor; + temp = (shadow8) | (bg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor; + temp = (bg8) | (fg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor; + temp = (fg8) | (fg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor; + temp = (shadow8) | (fg4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor; + temp = (bg8) | (shadow4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor; + temp = (fg8) | (shadow4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor; + temp = (shadow8) | (shadow4) | fgColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor; + temp = (bg8) | (bg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor; + temp = (fg8) | (bg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; - *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor; - *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor; + temp = (shadow8) | (bg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bg8) | (fg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fg8) | (fg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadow8) | (fg4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (bg8) | (shadow4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (fg8) | (shadow4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; + + temp = (shadow8) | (shadow4) | shadowColor; + *(current++) = (bg12) | temp; + *(current++) = (fg12) | temp; + *(current++) = (shadow12) | temp; } -#else -NAKED -void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) -{ - asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x24\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - lsl r1, #24\n\ - lsr r1, #24\n\ - lsl r2, #24\n\ - lsr r2, #24\n\ - ldr r3, =gFontHalfRowLookupTable\n\ - ldr r4, =gLastTextBgColor\n\ - strh r1, [r4]\n\ - ldr r4, =gLastTextFgColor\n\ - strh r0, [r4]\n\ - ldr r4, =gLastTextShadowColor\n\ - strh r2, [r4]\n\ - lsl r5, r1, #12\n\ - lsl r6, r0, #12\n\ - lsl r4, r2, #12\n\ - mov r8, r4\n\ - lsl r7, r1, #8\n\ - str r7, [sp]\n\ - lsl r4, r1, #4\n\ - mov r9, r4\n\ - orr r7, r4\n\ - str r7, [sp, #0x4]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #8\n\ - mov r10, r7\n\ - mov r4, r10\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x8]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #8\n\ - mov r12, r7\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0xC]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #4\n\ - mov r9, r7\n\ - ldr r4, [sp]\n\ - orr r4, r7\n\ - str r4, [sp, #0x10]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r10\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x14]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r12\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x18]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #4\n\ - mov r9, r7\n\ - mov r4, r9\n\ - ldr r7, [sp]\n\ - orr r7, r4\n\ - str r7, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r9\n\ - mov r4, r10\n\ - orr r4, r7\n\ - str r4, [sp, #0x20]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x4]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x8]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0xC]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x10]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x14]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x18]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x1C]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x20]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r4, #0\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r0, [sp, #0x4]\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x8]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0xC]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x10]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x14]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x18]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x20]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - orr r7, r4\n\ - orr r5, r7\n\ - strh r5, [r3]\n\ - add r3, #0x2\n\ - orr r6, r7\n\ - strh r6, [r3]\n\ - orr r0, r7\n\ - strh r0, [r3, #0x2]\n\ - add sp, #0x24\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); -} -#endif void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor) {