sub_8124288

This commit is contained in:
PikalaxALT 2017-10-31 19:40:35 -04:00
parent 9f03434a13
commit 7d7c8e8ba6
3 changed files with 51 additions and 130 deletions

View File

@ -5,129 +5,6 @@
.text
thumb_func_start sub_8124288
sub_8124288: @ 8124288
push {r4-r6,lr}
sub sp, 0x28
lsls r0, 16
lsls r1, 16
lsrs r1, 16
ldr r2, =gUnknown_085A084C
str r2, [sp, 0x18]
movs r2, 0x80
add r6, sp, 0x18
lsrs r3, r0, 16
orrs r0, r2
str r0, [r6, 0x4]
ldr r0, =gUnknown_085A082C
str r0, [sp, 0x20]
ldr r2, =0xffff0000
add r4, sp, 0x20
ldr r0, [r4, 0x4]
ands r0, r2
orrs r0, r1
str r0, [r4, 0x4]
mov r0, sp
movs r5, 0
strh r3, [r0]
strh r1, [r0, 0x2]
ldr r0, =gUnknown_085A1C20
str r0, [sp, 0x4]
ldr r0, =gUnknown_085A1C30
str r0, [sp, 0x8]
str r5, [sp, 0xC]
ldr r0, =gDummySpriteAffineAnimTable
str r0, [sp, 0x10]
ldr r0, =SpriteCallbackDummy
str r0, [sp, 0x14]
ldr r0, =gMapHeader
ldrb r0, [r0, 0x14]
bl sub_8124668
cmp r0, 0
beq _08124304
ldr r0, =gRegionMap
ldr r0, [r0]
str r5, [r0, 0x20]
b _081243A4
.pool
_08124304:
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r0, [r0, 0x8]
cmp r0, 0x1
bne _08124316
ldr r0, =gUnknown_085A08EC
str r0, [sp, 0x18]
ldr r0, =gUnknown_085A08CC
str r0, [sp, 0x20]
_08124316:
adds r0, r6, 0
bl LoadSpriteSheet
adds r0, r4, 0
bl LoadSpritePalette
mov r0, sp
movs r1, 0
movs r2, 0
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r0, 24
ldr r1, =gRegionMap
ldr r2, [r1]
lsls r1, r0, 4
adds r1, r0
lsls r1, 2
ldr r0, =gSprites
adds r1, r0
str r1, [r2, 0x20]
adds r0, r2, 0
adds r0, 0x78
ldrb r0, [r0]
cmp r0, 0
bne _08124384
adds r0, r2, 0
adds r0, 0x74
ldrh r0, [r0]
lsls r0, 3
adds r0, 0x4
strh r0, [r1, 0x20]
ldr r1, [r2, 0x20]
adds r0, r2, 0
adds r0, 0x76
ldrh r0, [r0]
lsls r0, 3
adds r0, 0x4
strh r0, [r1, 0x22]
ldr r1, [r2, 0x20]
ldr r0, =sub_81244EC
b _081243A2
.pool
_08124384:
adds r0, r2, 0
adds r0, 0x74
ldrh r0, [r0]
lsls r0, 4
subs r0, 0x30
strh r0, [r1, 0x20]
ldr r1, [r2, 0x20]
adds r0, r2, 0
adds r0, 0x76
ldrh r0, [r0]
lsls r0, 4
subs r0, 0x42
strh r0, [r1, 0x22]
ldr r1, [r2, 0x20]
ldr r0, =sub_812445C
_081243A2:
str r0, [r1, 0x1C]
_081243A4:
add sp, 0x28
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8124288
thumb_func_start sub_81243B0
sub_81243B0: @ 81243B0
push {lr}

View File

@ -258,8 +258,8 @@ struct RegionMap {
/*0x06e*/ u16 unk_06e;
/*0x070*/ u16 playerIconTileTag;
/*0x072*/ u16 playerIconPaletteTag;
/*0x074*/ u16 unk_074;
/*0x076*/ u16 unk_076;
/*0x074*/ u16 playerIconSpritePosX;
/*0x076*/ u16 playerIconSpritePosY;
/*0x078*/ bool8 zoomed;
/*0x079*/ u8 initStep;
/*0x07a*/ s8 cursorMovementFrameCounter;
@ -305,8 +305,9 @@ void InitRegionMap(struct RegionMap *regionMap, u8 argument);
u8 sub_81230AC(void);
void FreeRegionMapIconResources(void);
u16 sub_8123E9C(u16 x, u16 y);
void GetMapName(u8 *, u16, u16);
void sub_8124288(u16 x, u16 y);
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag);
bool32 sub_8124668(u16 mapSecId);
void GetMapName(u8 *, u16, u16);
#endif //GUARD_REGION_MAP_H

View File

@ -59,6 +59,8 @@ static bool8 sub_8124038(u16 y);
static void sub_8124238(void);
void sub_81243B0(void);
void sub_81243DC(void);
void sub_812445C(struct Sprite *sprite);
void sub_81244EC(struct Sprite *sprite);
// .rodata
@ -69,6 +71,10 @@ extern const u8 gUnknown_0859F77C[];
extern const u8 gUnknown_085A04E0[];
extern const u8 gUnknown_085A096C[];
extern const struct RegionMapLocation gRegionMapEntries[];
extern const u8 gUnknown_085A084C[];
extern const u16 gUnknown_085A082C[];
extern const u16 gUnknown_085A08CC[];
extern const u8 gUnknown_085A08EC[];
extern const u16 gUnknown_085A1B24[][2];
extern const u16 gUnknown_085A1B84[];
extern const u16 gUnknown_085A1B8A[];
@ -76,6 +82,8 @@ extern const struct UCoords16 gUnknown_085A1BAC[];
extern const u8 gUnknown_085A1BCC[];
extern const struct SpritePalette gUnknown_085A1C00;
extern const struct SpriteTemplate gUnknown_085A1C08;
extern const struct OamData gUnknown_085A1C20;
extern const union AnimCmd *const gUnknown_085A1C30[];
// .text
@ -111,8 +119,8 @@ void sub_8122D88(struct RegionMap *regionMap)
{
gRegionMap = regionMap;
sub_81238AC();
gRegionMap->unk_074 = gRegionMap->cursorPosX;
gRegionMap->unk_076 = gRegionMap->cursorPosY;
gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX;
gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY;
}
bool8 sub_8122DB0(void)
@ -156,8 +164,8 @@ bool8 sub_8122DB0(void)
break;
case 5:
sub_81238AC();
gRegionMap->unk_074 = gRegionMap->cursorPosX;
gRegionMap->unk_076 = gRegionMap->cursorPosY;
gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX;
gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY;
gRegionMap->mapSecId = sub_8123EB4(gRegionMap->mapSecId);
gRegionMap->iconDrawType = get_flagnr_blue_points(gRegionMap->mapSecId);
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
@ -1044,3 +1052,38 @@ void sub_8124278(void)
{
gRegionMap->cursorSprite->data3 = FALSE;
}
void sub_8124288(u16 tileTag, u16 paletteTag)
{
u8 spriteId;
struct SpriteSheet sheet = {gUnknown_085A084C, 0x80, tileTag};
struct SpritePalette palette = {gUnknown_085A082C, paletteTag};
struct SpriteTemplate template = {tileTag, paletteTag, &gUnknown_085A1C20, gUnknown_085A1C30, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
if (sub_8124668(gMapHeader.regionMapSectionId))
{
gRegionMap->playerIconSprite = NULL;
return;
}
if (gSaveBlock2Ptr->playerGender == FEMALE)
{
sheet.data = gUnknown_085A08EC;
palette.data = gUnknown_085A08CC;
}
LoadSpriteSheet(&sheet);
LoadSpritePalette(&palette);
spriteId = CreateSprite(&template, 0, 0, 1);
gRegionMap->playerIconSprite = &gSprites[spriteId];
if (!gRegionMap->zoomed)
{
gRegionMap->playerIconSprite->pos1.x = gRegionMap->playerIconSpritePosX * 8 + 4;
gRegionMap->playerIconSprite->pos1.y = gRegionMap->playerIconSpritePosY * 8 + 4;
gRegionMap->playerIconSprite->callback = sub_81244EC;
}
else
{
gRegionMap->playerIconSprite->pos1.x = gRegionMap->playerIconSpritePosX * 16 - 0x30;
gRegionMap->playerIconSprite->pos1.y = gRegionMap->playerIconSpritePosY * 16 - 0x42;
gRegionMap->playerIconSprite->callback = sub_812445C;
}
}