mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
through CreateRegionMapCursor
This commit is contained in:
parent
853ced6687
commit
6cd0086bf9
252
asm/region_map.s
252
asm/region_map.s
@ -5,258 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8124038
|
||||
sub_8124038: @ 8124038
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 16
|
||||
ldr r1, =0xffff0000
|
||||
adds r0, r1
|
||||
lsrs r5, r0, 16
|
||||
ldr r0, =0x0000ffff
|
||||
cmp r5, r0
|
||||
bne _08124058
|
||||
b _0812407A
|
||||
.pool
|
||||
_08124054:
|
||||
movs r0, 0x1
|
||||
b _0812407C
|
||||
_08124058:
|
||||
movs r4, 0x1
|
||||
_0812405A:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl GetRegionMapSectionIdAt
|
||||
ldr r1, =gRegionMap
|
||||
ldr r1, [r1]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
ldrh r1, [r1]
|
||||
cmp r0, r1
|
||||
beq _08124054
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
cmp r4, 0x1C
|
||||
bls _0812405A
|
||||
_0812407A:
|
||||
movs r0, 0
|
||||
_0812407C:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8124038
|
||||
|
||||
thumb_func_start sub_8124088
|
||||
sub_8124088: @ 8124088
|
||||
push {r4,lr}
|
||||
adds r2, r0, 0
|
||||
ldr r0, =gRegionMap
|
||||
ldr r1, [r0]
|
||||
adds r3, r1, 0
|
||||
adds r3, 0x7A
|
||||
movs r0, 0
|
||||
ldrsb r0, [r3, r0]
|
||||
cmp r0, 0
|
||||
beq _081240C6
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7B
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
lsls r0, 1
|
||||
ldrh r4, [r2, 0x20]
|
||||
adds r0, r4
|
||||
strh r0, [r2, 0x20]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x7C
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
lsls r0, 1
|
||||
ldrh r1, [r2, 0x22]
|
||||
adds r0, r1
|
||||
strh r0, [r2, 0x22]
|
||||
ldrb r0, [r3]
|
||||
subs r0, 0x1
|
||||
strb r0, [r3]
|
||||
_081240C6:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8124088
|
||||
|
||||
thumb_func_start TaskDummy8
|
||||
TaskDummy8: @ 81240D0
|
||||
bx lr
|
||||
thumb_func_end TaskDummy8
|
||||
|
||||
thumb_func_start CreateRegionMapCursor
|
||||
CreateRegionMapCursor: @ 81240D4
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x28
|
||||
lsls r0, 16
|
||||
lsls r1, 16
|
||||
lsrs r6, r1, 16
|
||||
ldr r1, =gUnknown_085A1C00
|
||||
ldr r2, [r1, 0x4]
|
||||
ldr r1, [r1]
|
||||
str r1, [sp, 0x20]
|
||||
str r2, [sp, 0x24]
|
||||
mov r2, sp
|
||||
ldr r1, =gUnknown_085A1C08
|
||||
ldm r1!, {r3-r5}
|
||||
stm r2!, {r3-r5}
|
||||
ldm r1!, {r3-r5}
|
||||
stm r2!, {r3-r5}
|
||||
lsrs r3, r0, 16
|
||||
add r2, sp, 0x18
|
||||
ldrh r1, [r2, 0x4]
|
||||
orrs r1, r0
|
||||
str r1, [r2, 0x4]
|
||||
mov r0, sp
|
||||
strh r3, [r0]
|
||||
ldr r0, =gRegionMap
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x58
|
||||
strh r3, [r0]
|
||||
ldr r5, =0xffff0000
|
||||
add r1, sp, 0x20
|
||||
ldr r0, [r1, 0x4]
|
||||
ands r0, r5
|
||||
orrs r0, r6
|
||||
str r0, [r1, 0x4]
|
||||
mov r0, sp
|
||||
strh r6, [r0, 0x2]
|
||||
adds r3, r4, 0
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x5A
|
||||
strh r6, [r0]
|
||||
adds r0, 0x1E
|
||||
ldrb r0, [r0]
|
||||
adds r7, r1, 0
|
||||
cmp r0, 0
|
||||
bne _08124158
|
||||
movs r1, 0xC2
|
||||
lsls r1, 1
|
||||
adds r0, r3, r1
|
||||
str r0, [sp, 0x18]
|
||||
ldr r0, [r2, 0x4]
|
||||
ands r0, r5
|
||||
subs r1, 0x84
|
||||
orrs r0, r1
|
||||
str r0, [r2, 0x4]
|
||||
ldr r0, =sub_8124088
|
||||
b _0812416E
|
||||
.pool
|
||||
_08124158:
|
||||
movs r3, 0xA1
|
||||
lsls r3, 2
|
||||
adds r0, r4, r3
|
||||
str r0, [sp, 0x18]
|
||||
ldr r0, [r2, 0x4]
|
||||
ands r0, r5
|
||||
movs r1, 0xC0
|
||||
lsls r1, 3
|
||||
orrs r0, r1
|
||||
str r0, [r2, 0x4]
|
||||
ldr r0, =TaskDummy8
|
||||
_0812416E:
|
||||
str r0, [sp, 0x14]
|
||||
adds r0, r2, 0
|
||||
bl LoadSpriteSheet
|
||||
adds r0, r7, 0
|
||||
bl LoadSpritePalette
|
||||
mov r0, sp
|
||||
movs r1, 0x38
|
||||
movs r2, 0x48
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x40
|
||||
beq _08124228
|
||||
ldr r4, =gRegionMap
|
||||
ldr r2, [r4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, =gSprites
|
||||
adds r3, r0, r1
|
||||
str r3, [r2, 0x1C]
|
||||
adds r2, 0x78
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0x1
|
||||
bne _081241DC
|
||||
ldrb r1, [r3, 0x3]
|
||||
movs r0, 0x3F
|
||||
ands r0, r1
|
||||
movs r1, 0x80
|
||||
orrs r0, r1
|
||||
strb r0, [r3, 0x3]
|
||||
ldr r2, [r4]
|
||||
ldr r1, [r2, 0x1C]
|
||||
ldrh r0, [r1, 0x20]
|
||||
subs r0, 0x8
|
||||
strh r0, [r1, 0x20]
|
||||
ldr r1, [r2, 0x1C]
|
||||
ldrh r0, [r1, 0x22]
|
||||
subs r0, 0x8
|
||||
strh r0, [r1, 0x22]
|
||||
ldr r0, [r2, 0x1C]
|
||||
movs r1, 0x1
|
||||
bl StartSpriteAnim
|
||||
b _08124204
|
||||
.pool
|
||||
_081241DC:
|
||||
ldrb r1, [r3, 0x3]
|
||||
movs r0, 0x3F
|
||||
ands r0, r1
|
||||
movs r1, 0x40
|
||||
orrs r0, r1
|
||||
strb r0, [r3, 0x3]
|
||||
ldr r1, [r4]
|
||||
ldr r2, [r1, 0x1C]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x54
|
||||
ldrh r0, [r0]
|
||||
lsls r0, 3
|
||||
adds r0, 0x4
|
||||
strh r0, [r2, 0x20]
|
||||
ldr r2, [r1, 0x1C]
|
||||
adds r1, 0x56
|
||||
ldrh r0, [r1]
|
||||
lsls r0, 3
|
||||
adds r0, 0x4
|
||||
strh r0, [r2, 0x22]
|
||||
_08124204:
|
||||
ldr r4, =gRegionMap
|
||||
ldr r0, [r4]
|
||||
ldr r1, [r0, 0x1C]
|
||||
movs r0, 0x2
|
||||
strh r0, [r1, 0x30]
|
||||
adds r0, r6, 0
|
||||
bl IndexOfSpritePaletteTag
|
||||
ldr r1, [r4]
|
||||
ldr r2, [r1, 0x1C]
|
||||
lsls r0, 24
|
||||
lsrs r0, 20
|
||||
ldr r4, =0x00000101
|
||||
adds r0, r4
|
||||
strh r0, [r2, 0x32]
|
||||
ldr r1, [r1, 0x1C]
|
||||
movs r0, 0x1
|
||||
strh r0, [r1, 0x34]
|
||||
_08124228:
|
||||
add sp, 0x28
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end CreateRegionMapCursor
|
||||
|
||||
thumb_func_start sub_8124238
|
||||
sub_8124238: @ 8124238
|
||||
push {r4,lr}
|
||||
|
@ -307,6 +307,6 @@ 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 x, u16 y);
|
||||
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag);
|
||||
|
||||
#endif //GUARD_REGION_MAP_H
|
||||
|
@ -55,7 +55,7 @@ static u16 sub_8123F04(void);
|
||||
static void sub_8123F30(u16 *x, u16 *y);
|
||||
static bool32 sub_8123F74(u8 mapSecId);
|
||||
static void sub_8123FB0(void);
|
||||
bool8 sub_8124038(u16 y);
|
||||
static bool8 sub_8124038(u16 y);
|
||||
void sub_8124238(void);
|
||||
void sub_81243B0(void);
|
||||
void sub_81243DC(void);
|
||||
@ -74,6 +74,8 @@ extern const u16 gUnknown_085A1B84[];
|
||||
extern const u16 gUnknown_085A1B8A[];
|
||||
extern const struct UCoords16 gUnknown_085A1BAC[];
|
||||
extern const u8 gUnknown_085A1BCC[];
|
||||
extern const struct SpritePalette gUnknown_085A1C00;
|
||||
extern const struct SpriteTemplate gUnknown_085A1C08;
|
||||
|
||||
// .text
|
||||
|
||||
@ -937,3 +939,88 @@ static void sub_8123FB0(void)
|
||||
}
|
||||
gRegionMap->unk_003 = unk_003;
|
||||
}
|
||||
|
||||
static bool8 sub_8124038(u16 y)
|
||||
{
|
||||
u16 x;
|
||||
|
||||
if (y -- == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (x = MAPCURSOR_X_MIN; x <= MAPCURSOR_X_MAX; x ++)
|
||||
{
|
||||
if (GetRegionMapSectionIdAt(x, y) == gRegionMap->mapSecId)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_8124088(struct Sprite *sprite)
|
||||
{
|
||||
if (gRegionMap->cursorMovementFrameCounter != 0)
|
||||
{
|
||||
sprite->pos1.x += 2 * gRegionMap->cursorDeltaX;
|
||||
sprite->pos1.y += 2 * gRegionMap->cursorDeltaY;
|
||||
gRegionMap->cursorMovementFrameCounter --;
|
||||
}
|
||||
}
|
||||
|
||||
static void TaskDummy8(struct Sprite *sprite)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag)
|
||||
{
|
||||
u8 spriteId;
|
||||
struct SpriteTemplate template;
|
||||
struct SpritePalette palette;
|
||||
struct SpriteSheet sheet;
|
||||
|
||||
palette = gUnknown_085A1C00;
|
||||
template = gUnknown_085A1C08;
|
||||
sheet.tag = tileTag;
|
||||
template.tileTag = tileTag;
|
||||
gRegionMap->cursorTileTag = tileTag;
|
||||
palette.tag = paletteTag;
|
||||
template.paletteTag = paletteTag;
|
||||
gRegionMap->cursorPaletteTag = paletteTag;
|
||||
if (!gRegionMap->zoomed)
|
||||
{
|
||||
sheet.data = gRegionMap->cursorSmallImage;
|
||||
sheet.size = sizeof(gRegionMap->cursorSmallImage);
|
||||
template.callback = sub_8124088;
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet.data = gRegionMap->cursorLargeImage;
|
||||
sheet.size = sizeof(gRegionMap->cursorLargeImage);
|
||||
template.callback = TaskDummy8;
|
||||
}
|
||||
LoadSpriteSheet(&sheet);
|
||||
LoadSpritePalette(&palette);
|
||||
spriteId = CreateSprite(&template, 0x38, 0x48, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
gRegionMap->cursorSprite = &gSprites[spriteId];
|
||||
if (gRegionMap->zoomed == TRUE)
|
||||
{
|
||||
gRegionMap->cursorSprite->oam.size = 2;
|
||||
gRegionMap->cursorSprite->pos1.x -= 8;
|
||||
gRegionMap->cursorSprite->pos1.y -= 8;
|
||||
StartSpriteAnim(gRegionMap->cursorSprite, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gRegionMap->cursorSprite->oam.size = 1;
|
||||
gRegionMap->cursorSprite->pos1.x = 8 * gRegionMap->cursorPosX + 4;
|
||||
gRegionMap->cursorSprite->pos1.y = 8 * gRegionMap->cursorPosY + 4;
|
||||
}
|
||||
gRegionMap->cursorSprite->data1 = 2;
|
||||
gRegionMap->cursorSprite->data2 = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101;
|
||||
gRegionMap->cursorSprite->data3 = 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user