Merge pull request #396 from DizzyEggg/attempt

Match some functions
This commit is contained in:
Marcus Huderle 2018-11-26 16:58:19 -06:00 committed by GitHub
commit 382ff45452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1347 additions and 2382 deletions

View File

@ -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);

View File

@ -446,7 +446,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);

1195
src/bg.c

File diff suppressed because it is too large Load Diff

View File

@ -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)
@ -3123,134 +3073,134 @@ NAKED
u8 sub_80B8F98(void)
{
asm_unified("push {r4-r7,lr}\n\
mov r7, r8\n\
push {r7}\n\
ldr r0, =gFieldEffectObjectTemplatePointers\n\
adds r0, 0x90\n\
ldr r0, [r0]\n\
movs r2, 0x18\n\
negs r2, r2\n\
movs r1, 0x78\n\
movs r3, 0x1\n\
bl CreateSprite\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
lsls r1, r0, 4\n\
add r1, r8\n\
lsls r1, 2\n\
ldr r0, =gSprites\n\
adds r1, r0\n\
ldrb r2, [r1, 0x5]\n\
movs r0, 0xD\n\
negs r0, r0\n\
ands r0, r2\n\
movs r2, 0x4\n\
orrs r0, r2\n\
movs r2, 0xF\n\
ands r0, r2\n\
movs r2, 0x40\n\
orrs r0, r2\n\
strb r0, [r1, 0x5]\n\
movs r2, 0\n\
strh r2, [r1, 0x2E]\n\
strh r2, [r1, 0x30]\n\
strh r2, [r1, 0x32]\n\
ldr r0, =0x0000ffff\n\
strh r0, [r1, 0x34]\n\
ldrh r0, [r1, 0x22]\n\
strh r0, [r1, 0x36]\n\
strh r2, [r1, 0x38]\n\
ldr r1, =0x00003e41\n\
movs r0, 0x50\n\
bl SetGpuReg\n\
ldr r1, =0x00000e0e\n\
movs r0, 0x52\n\
bl SetGpuReg\n\
ldr r1, =0x00003f3f\n\
movs r0, 0x48\n\
bl SetGpuReg\n\
ldr r0, =gUnknown_0855B610\n\
movs r1, 0xC0\n\
movs r2, 0x20\n\
bl LoadPalette\n\
movs r0, 0x12\n\
movs r1, 0x78\n\
bl SetGpuReg\n\
movs r4, 0x3\n\
ldr r7, =0x0600f800\n\
ldr r0, =0x0000bff4\n\
adds r6, r0, 0\n\
mov r7, r8\n\
push {r7}\n\
ldr r0, =gFieldEffectObjectTemplatePointers\n\
adds r0, 0x90\n\
ldr r0, [r0]\n\
movs r2, 0x18\n\
negs r2, r2\n\
movs r1, 0x78\n\
movs r3, 0x1\n\
bl CreateSprite\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
lsls r1, r0, 4\n\
add r1, r8\n\
lsls r1, 2\n\
ldr r0, =gSprites\n\
adds r1, r0\n\
ldrb r2, [r1, 0x5]\n\
movs r0, 0xD\n\
negs r0, r0\n\
ands r0, r2\n\
movs r2, 0x4\n\
orrs r0, r2\n\
movs r2, 0xF\n\
ands r0, r2\n\
movs r2, 0x40\n\
orrs r0, r2\n\
strb r0, [r1, 0x5]\n\
movs r2, 0\n\
strh r2, [r1, 0x2E]\n\
strh r2, [r1, 0x30]\n\
strh r2, [r1, 0x32]\n\
ldr r0, =0x0000ffff\n\
strh r0, [r1, 0x34]\n\
ldrh r0, [r1, 0x22]\n\
strh r0, [r1, 0x36]\n\
strh r2, [r1, 0x38]\n\
ldr r1, =0x00003e41\n\
movs r0, 0x50\n\
bl SetGpuReg\n\
ldr r1, =0x00000e0e\n\
movs r0, 0x52\n\
bl SetGpuReg\n\
ldr r1, =0x00003f3f\n\
movs r0, 0x48\n\
bl SetGpuReg\n\
ldr r0, =gUnknown_0855B610\n\
movs r1, 0xC0\n\
movs r2, 0x20\n\
bl LoadPalette\n\
movs r0, 0x12\n\
movs r1, 0x78\n\
bl SetGpuReg\n\
movs r4, 0x3\n\
ldr r7, =0x0600f800\n\
ldr r0, =0x0000bff4\n\
adds r6, r0, 0\n\
_080B901A:\n\
movs r2, 0xC\n\
lsls r0, r4, 1\n\
lsls r5, r4, 5\n\
adds r0, r4\n\
lsls r3, r0, 1\n\
movs r2, 0xC\n\
lsls r0, r4, 1\n\
lsls r5, r4, 5\n\
adds r0, r4\n\
lsls r3, r0, 1\n\
_080B9024:\n\
adds r0, r5, r2\n\
lsls r0, 1\n\
adds r0, r7\n\
adds r1, r2, r6\n\
adds r1, r3, r1\n\
adds r1, 0x1\n\
strh r1, [r0]\n\
adds r0, r2, 0x1\n\
lsls r0, 24\n\
lsrs r2, r0, 24\n\
cmp r2, 0x11\n\
bls _080B9024\n\
adds r0, r4, 0x1\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
cmp r4, 0xE\n\
bls _080B901A\n\
movs r0, 0\n\
ldr r5, =gUnknown_0855B630\n\
adds r0, r5, r2\n\
lsls r0, 1\n\
adds r0, r7\n\
adds r1, r2, r6\n\
adds r1, r3, r1\n\
adds r1, 0x1\n\
strh r1, [r0]\n\
adds r0, r2, 0x1\n\
lsls r0, 24\n\
lsrs r2, r0, 24\n\
cmp r2, 0x11\n\
bls _080B9024\n\
adds r0, r4, 0x1\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
cmp r4, 0xE\n\
bls _080B901A\n\
movs r0, 0\n\
ldr r5, =gUnknown_0855B630\n\
_080B904A:\n\
movs r4, 0\n\
adds r7, r0, 0x1\n\
lsls r6, r0, 5\n\
movs r4, 0\n\
adds r7, r0, 0x1\n\
lsls r6, r0, 5\n\
_080B9050:\n\
lsls r1, r4, 2\n\
adds r1, r6, r1\n\
ldr r0, =0x06008020\n\
adds r3, r1, r0\n\
adds r0, r1, 0x1\n\
adds r0, r5\n\
ldrb r2, [r0]\n\
lsls r2, 8\n\
adds r0, r1, r5\n\
ldrb r0, [r0]\n\
adds r0, r2\n\
strh r0, [r3]\n\
ldr r0, =0x06008022\n\
adds r3, r1, r0\n\
adds r0, r1, 0x3\n\
adds r0, r5\n\
ldrb r2, [r0]\n\
lsls r2, 8\n\
adds r1, 0x2\n\
adds r1, r5\n\
ldrb r0, [r1]\n\
adds r0, r2\n\
strh r0, [r3]\n\
adds r0, r4, 0x1\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
cmp r4, 0x7\n\
bls _080B9050\n\
lsls r0, r7, 24\n\
lsrs r0, 24\n\
cmp r0, 0x59\n\
bls _080B904A\n\
mov r0, r8\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
.pool");
lsls r1, r4, 2\n\
adds r1, r6, r1\n\
ldr r0, =0x06008020\n\
adds r3, r1, r0\n\
adds r0, r1, 0x1\n\
adds r0, r5\n\
ldrb r2, [r0]\n\
lsls r2, 8\n\
adds r0, r1, r5\n\
ldrb r0, [r0]\n\
adds r0, r2\n\
strh r0, [r3]\n\
ldr r0, =0x06008022\n\
adds r3, r1, r0\n\
adds r0, r1, 0x3\n\
adds r0, r5\n\
ldrb r2, [r0]\n\
lsls r2, 8\n\
adds r1, 0x2\n\
adds r1, r5\n\
ldrb r0, [r1]\n\
adds r0, r2\n\
strh r0, [r3]\n\
adds r0, r4, 0x1\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
cmp r4, 0x7\n\
bls _080B9050\n\
lsls r0, r7, 24\n\
lsrs r0, 24\n\
cmp r0, 0x59\n\
bls _080B904A\n\
mov r0, r8\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
.pool");
}
#endif // NONMATCHING

View File

@ -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]++;
}
@ -1676,102 +1595,102 @@ static void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
NAKED void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
{
asm_unified("push {r4-r7,lr}\n\
adds r6, r0, 0\n\
adds r0, r1, 0\n\
lsls r0, 24\n\
lsrs r0, 24\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r1, r6, 0\n\
bl SetObjectSubpriorityByZCoord\n\
movs r7, 0\n\
adds r6, r0, 0\n\
adds r0, r1, 0\n\
lsls r0, 24\n\
lsrs r0, 24\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r1, r6, 0\n\
bl SetObjectSubpriorityByZCoord\n\
movs r7, 0\n\
_08156212:\n\
lsls r0, r7, 3\n\
adds r0, r7\n\
lsls r0, 2\n\
ldr r1, =gEventObjects\n\
adds r4, r0, r1\n\
ldrb r0, [r4]\n\
lsls r0, 31\n\
cmp r0, 0\n\
beq _081562B4\n\
ldrb r0, [r4, 0x5]\n\
bl GetEventObjectGraphicsInfo\n\
ldrb r1, [r4, 0x4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r1, =gSprites\n\
adds r5, r0, r1\n\
adds r0, r6, 0\n\
adds r0, 0x28\n\
movs r2, 0\n\
ldrsb r2, [r0, r2]\n\
ldrh r0, [r6, 0x20]\n\
adds r1, r0, r2\n\
subs r0, r2\n\
lsls r0, 16\n\
lsrs r4, r0, 16\n\
lsls r1, 16\n\
asrs r1, 16\n\
movs r0, 0x20\n\
ldrsh r2, [r5, r0]\n\
cmp r1, r2\n\
bge _081562B4\n\
lsls r0, r4, 16\n\
asrs r0, 16\n\
cmp r0, r2\n\
ble _081562B4\n\
adds r0, r5, 0\n\
adds r0, 0x29\n\
movs r3, 0\n\
ldrsb r3, [r0, r3]\n\
ldrh r2, [r5, 0x22]\n\
adds r2, r3\n\
ldrh r4, [r5, 0x22]\n\
adds r0, r6, 0\n\
adds r0, 0x29\n\
movs r1, 0\n\
ldrsb r1, [r0, r1]\n\
ldrh r0, [r6, 0x22]\n\
subs r0, r1\n\
lsls r0, 16\n\
asrs r0, 16\n\
adds r3, r0, r3\n\
lsls r2, 16\n\
asrs r2, 16\n\
lsls r3, 16\n\
asrs r3, 16\n\
cmp r2, r3\n\
blt _0815628C\n\
cmp r2, r0\n\
bge _081562B4\n\
lsls r0, r7, 3\n\
adds r0, r7\n\
lsls r0, 2\n\
ldr r1, =gEventObjects\n\
adds r4, r0, r1\n\
ldrb r0, [r4]\n\
lsls r0, 31\n\
cmp r0, 0\n\
beq _081562B4\n\
ldrb r0, [r4, 0x5]\n\
bl GetEventObjectGraphicsInfo\n\
ldrb r1, [r4, 0x4]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r1, =gSprites\n\
adds r5, r0, r1\n\
adds r0, r6, 0\n\
adds r0, 0x28\n\
movs r2, 0\n\
ldrsb r2, [r0, r2]\n\
ldrh r0, [r6, 0x20]\n\
adds r1, r0, r2\n\
subs r0, r2\n\
lsls r0, 16\n\
lsrs r4, r0, 16\n\
lsls r1, 16\n\
asrs r1, 16\n\
movs r0, 0x20\n\
ldrsh r2, [r5, r0]\n\
cmp r1, r2\n\
bge _081562B4\n\
lsls r0, r4, 16\n\
asrs r0, 16\n\
cmp r0, r2\n\
ble _081562B4\n\
adds r0, r5, 0\n\
adds r0, 0x29\n\
movs r3, 0\n\
ldrsb r3, [r0, r3]\n\
ldrh r2, [r5, 0x22]\n\
adds r2, r3\n\
ldrh r4, [r5, 0x22]\n\
adds r0, r6, 0\n\
adds r0, 0x29\n\
movs r1, 0\n\
ldrsb r1, [r0, r1]\n\
ldrh r0, [r6, 0x22]\n\
subs r0, r1\n\
lsls r0, 16\n\
asrs r0, 16\n\
adds r3, r0, r3\n\
lsls r2, 16\n\
asrs r2, 16\n\
lsls r3, 16\n\
asrs r3, 16\n\
cmp r2, r3\n\
blt _0815628C\n\
cmp r2, r0\n\
bge _081562B4\n\
_0815628C:\n\
lsls r0, r4, 16\n\
asrs r0, 16\n\
cmp r0, r3\n\
ble _081562B4\n\
adds r2, r6, 0\n\
adds r2, 0x43\n\
adds r0, r5, 0\n\
adds r0, 0x43\n\
ldrb r1, [r0]\n\
ldrb r0, [r2]\n\
cmp r0, r1\n\
bhi _081562B4\n\
adds r0, r1, 0x2\n\
strb r0, [r2]\n\
b _081562BE\n\
.pool\n\
lsls r0, r4, 16\n\
asrs r0, 16\n\
cmp r0, r3\n\
ble _081562B4\n\
adds r2, r6, 0\n\
adds r2, 0x43\n\
adds r0, r5, 0\n\
adds r0, 0x43\n\
ldrb r1, [r0]\n\
ldrb r0, [r2]\n\
cmp r0, r1\n\
bhi _081562B4\n\
adds r0, r1, 0x2\n\
strb r0, [r2]\n\
b _081562BE\n\
.pool\n\
_081562B4:\n\
adds r0, r7, 0x1\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
cmp r7, 0xF\n\
bls _08156212\n\
adds r0, r7, 0x1\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
cmp r7, 0xF\n\
bls _08156212\n\
_081562BE:\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0");
pop {r4-r7}\n\
pop {r0}\n\
bx r0");
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -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);
}

View File

@ -257,584 +257,156 @@ u32 RenderFont(struct TextPrinter *textPrinter)
}
}
#ifdef NONMATCHING
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
u16* current = gFontHalfRowLookupTable;
u32 fg12, bg12, shadow12;
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;
temp = (bgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
*(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 = (fgColor << 8) | (bgColor << 4) | 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;
temp = (shadowColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
*(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 = (bgColor << 8) | (fgColor << 4) | 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;
temp = (fgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
*(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 = (shadowColor << 8) | (fgColor << 4) | 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;
temp = (bgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
*(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 = (fgColor << 8) | (shadowColor << 4) | 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 = (shadowColor << 8) | (shadowColor << 4) | 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 = (bgColor << 8) | (bgColor << 4) | fgColor;
*(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;
temp = (fgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
*(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 = (shadowColor << 8) | (bgColor << 4) | fgColor;
*(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 = (bgColor << 8) | (fgColor << 4) | fgColor;
*(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 = (fgColor << 8) | (fgColor << 4) | fgColor;
*(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 = (shadowColor << 8) | (fgColor << 4) | 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 = (bgColor << 8) | (shadowColor << 4) | 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 = (fgColor << 8) | (shadowColor << 4) | 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 = (shadowColor << 8) | (shadowColor << 4) | 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 = (bgColor << 8) | (bgColor << 4) | shadowColor;
*(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 = (fgColor << 8) | (bgColor << 4) | shadowColor;
*(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 = (shadowColor << 8) | (bgColor << 4) | shadowColor;
*(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 = (bgColor << 8) | (fgColor << 4) | shadowColor;
*(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 = (fgColor << 8) | (fgColor << 4) | shadowColor;
*(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 = (shadowColor << 8) | (fgColor << 4) | 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 = (bgColor << 8) | (shadowColor << 4) | 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 = (fgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (bg12) | temp;
*(current++) = (fg12) | temp;
*(current++) = (shadow12) | temp;
temp = (shadowColor << 8) | (shadowColor << 4) | 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)
{