through GetMapName

This commit is contained in:
PikalaxALT 2017-10-31 21:51:11 -04:00
parent 2f1325416b
commit ef535b98b5
4 changed files with 46 additions and 86 deletions

View file

@ -5,90 +5,6 @@
.text
thumb_func_start sub_812454C
sub_812454C: @ 812454C
push {lr}
ldr r0, =gRegionMap
ldr r1, [r0]
adds r0, r1, 0
adds r0, 0x7F
ldrb r0, [r0]
cmp r0, 0
beq _08124562
adds r1, 0x7E
movs r0, 0x1
strb r0, [r1]
_08124562:
pop {r0}
bx r0
.pool
thumb_func_end sub_812454C
thumb_func_start GetMapName
@ u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
GetMapName: @ 812456C
push {r4,r5,lr}
adds r5, r0, 0
lsls r1, 16
lsrs r1, 16
lsls r2, 16
lsrs r4, r2, 16
cmp r1, 0x56
bne _08124584
bl GetSecretBaseMapName
adds r1, r0, 0
b _081245B2
_08124584:
cmp r1, 0xD4
bhi _081245A0
ldr r0, =gRegionMapEntries
lsls r1, 3
adds r0, 0x4
adds r1, r0
ldr r1, [r1]
adds r0, r5, 0
bl StringCopy
adds r1, r0, 0
b _081245B2
.pool
_081245A0:
cmp r4, 0
bne _081245A6
movs r4, 0x12
_081245A6:
adds r0, r5, 0
movs r1, 0
adds r2, r4, 0
bl StringFill
b _081245D6
_081245B2:
cmp r4, 0
beq _081245D4
subs r0, r1, r5
lsls r0, 16
lsrs r0, 16
cmp r0, r4
bcs _081245D0
movs r2, 0
_081245C2:
strb r2, [r1]
adds r1, 0x1
adds r0, 0x1
lsls r0, 16
lsrs r0, 16
cmp r0, r4
bcc _081245C2
_081245D0:
movs r0, 0xFF
strb r0, [r1]
_081245D4:
adds r0, r1, 0
_081245D6:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end GetMapName
thumb_func_start sub_81245DC
sub_81245DC: @ 81245DC
push {lr}

View file

@ -309,6 +309,6 @@ u16 GetRegionMapSectionIdAt(u16 x, u16 y);
void CreateRegionMapPlayerIcon(u16 x, u16 y);
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag);
bool32 sub_8124668(u16 mapSecId);
void GetMapName(u8 *, u16, u16);
u8 *GetMapName(u8 *, u16, u16);
#endif //GUARD_REGION_MAP_H

View file

@ -8,5 +8,6 @@
// Exported ROM declarations
void sub_80E9578(void);
void sub_80E980C(void);
u8 *GetSecretBaseMapName(u8 *dest);
#endif //GUARD_SECRET_BASE_H

View file

@ -11,6 +11,9 @@
#include "flags.h"
#include "event_data.h"
#include "rom6.h"
#include "secret_base.h"
#include "string_util.h"
#include "text.h"
#include "region_map.h"
#define MAP_WIDTH 28
@ -30,7 +33,7 @@ struct RegionMapLocation
{
u8 x, y;
u8 width, height;
const u8 *regionMapSectionId;
const u8 *name;
};
// Static RAM declarations
@ -1165,3 +1168,43 @@ static void RegionMapPlayerIconSpriteCallback(struct Sprite *sprite)
sprite->invisible = FALSE;
}
}
void sub_812454C(void)
{
if (gRegionMap->playerIsInCave)
{
gRegionMap->blinkPlayerIcon = TRUE;
}
}
u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
{
u8 *str;
u16 i;
if (regionMapId == MAPSEC_SECRET_BASE)
{
str = GetSecretBaseMapName(dest);
}
else if (regionMapId < MAPSEC_NONE)
{
str = StringCopy(dest, gRegionMapEntries[regionMapId].name);
}
else
{
if (padLength == 0)
{
padLength = 18;
}
return StringFill(dest, CHAR_SPACE, padLength);
}
if (padLength != 0)
{
for (i = str - dest; i < padLength; i ++)
{
*str++ = CHAR_SPACE;
}
*str = EOS;
}
return str;
}