mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
through UnhideRegionMapPlayerIcon
This commit is contained in:
parent
7d7c8e8ba6
commit
968ff8c3c8
@ -362,7 +362,7 @@ sub_813CD04: @ 813CD04
|
||||
adds r1, r3, 0
|
||||
bl get_mapheader_by_bank_and_number
|
||||
ldrb r0, [r0, 0x14]
|
||||
bl sub_8123F9C
|
||||
bl CorrectSpecialMapSecId
|
||||
ldr r2, [r4]
|
||||
movs r1, 0x88
|
||||
lsls r1, 1
|
||||
@ -653,7 +653,7 @@ _0813CF5A:
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
str r3, [sp]
|
||||
bl sub_8123E9C
|
||||
bl GetRegionMapSectionIdAt
|
||||
ldr r3, [sp]
|
||||
ldr r2, [r3]
|
||||
mov r7, r9
|
||||
@ -1338,11 +1338,11 @@ _0813D4F8:
|
||||
bl sub_8122D88
|
||||
movs r0, 0x1
|
||||
movs r1, 0x1
|
||||
bl sub_8124288
|
||||
bl CreateRegionMapPlayerIcon
|
||||
movs r1, 0x8
|
||||
negs r1, r1
|
||||
movs r0, 0
|
||||
bl sub_8123824
|
||||
bl PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs
|
||||
b _0813D584
|
||||
.pool
|
||||
_0813D520:
|
||||
|
@ -10991,7 +10991,7 @@ _081CC784:
|
||||
bne _081CC7AC
|
||||
movs r0, 0x4
|
||||
movs r1, 0x9
|
||||
bl sub_8124288
|
||||
bl CreateRegionMapPlayerIcon
|
||||
movs r0, 0x5
|
||||
movs r1, 0xA
|
||||
bl CreateRegionMapCursor
|
||||
|
@ -5,94 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81243B0
|
||||
sub_81243B0: @ 81243B0
|
||||
push {lr}
|
||||
ldr r3, =gRegionMap
|
||||
ldr r0, [r3]
|
||||
ldr r2, [r0, 0x20]
|
||||
cmp r2, 0
|
||||
beq _081243CE
|
||||
adds r2, 0x3E
|
||||
ldrb r0, [r2]
|
||||
movs r1, 0x4
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
ldr r0, [r3]
|
||||
ldr r1, [r0, 0x20]
|
||||
ldr r0, =SpriteCallbackDummy
|
||||
str r0, [r1, 0x1C]
|
||||
_081243CE:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81243B0
|
||||
|
||||
thumb_func_start sub_81243DC
|
||||
sub_81243DC: @ 81243DC
|
||||
push {lr}
|
||||
ldr r0, =gRegionMap
|
||||
ldr r3, [r0]
|
||||
ldr r1, [r3, 0x20]
|
||||
cmp r1, 0
|
||||
beq _08124452
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x78
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
bne _0812441C
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x74
|
||||
ldrh r0, [r0]
|
||||
lsls r0, 4
|
||||
subs r0, 0x30
|
||||
strh r0, [r1, 0x20]
|
||||
ldr r1, [r3, 0x20]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x76
|
||||
ldrh r0, [r0]
|
||||
lsls r0, 4
|
||||
subs r0, 0x42
|
||||
strh r0, [r1, 0x22]
|
||||
ldr r1, [r3, 0x20]
|
||||
ldr r0, =sub_812445C
|
||||
b _08124444
|
||||
.pool
|
||||
_0812441C:
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x74
|
||||
ldrh r0, [r0]
|
||||
lsls r0, 3
|
||||
adds r0, 0x4
|
||||
movs r2, 0
|
||||
strh r0, [r1, 0x20]
|
||||
ldr r1, [r3, 0x20]
|
||||
adds r0, r3, 0
|
||||
adds r0, 0x76
|
||||
ldrh r0, [r0]
|
||||
lsls r0, 3
|
||||
adds r0, 0x4
|
||||
strh r0, [r1, 0x22]
|
||||
ldr r0, [r3, 0x20]
|
||||
strh r2, [r0, 0x24]
|
||||
ldr r0, [r3, 0x20]
|
||||
strh r2, [r0, 0x26]
|
||||
ldr r1, [r3, 0x20]
|
||||
ldr r0, =sub_81244EC
|
||||
_08124444:
|
||||
str r0, [r1, 0x1C]
|
||||
adds r1, 0x3E
|
||||
ldrb r2, [r1]
|
||||
movs r0, 0x5
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
strb r0, [r1]
|
||||
_08124452:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81243DC
|
||||
|
||||
thumb_func_start sub_812445C
|
||||
sub_812445C: @ 812445C
|
||||
push {r4,lr}
|
||||
@ -521,7 +433,7 @@ _0812479C:
|
||||
bl CreateRegionMapCursor
|
||||
movs r0, 0x1
|
||||
movs r1, 0x1
|
||||
bl sub_8124288
|
||||
bl CreateRegionMapPlayerIcon
|
||||
ldr r0, [r4]
|
||||
ldrh r1, [r0, 0x8]
|
||||
strh r1, [r0, 0x6]
|
||||
|
@ -225,7 +225,7 @@ enum {
|
||||
struct RegionMap {
|
||||
/*0x000*/ u16 mapSecId;
|
||||
/*0x002*/ u8 iconDrawType;
|
||||
/*0x003*/ u8 unk_003;
|
||||
/*0x003*/ u8 posWithinMapSec;
|
||||
/*0x004*/ u8 mapSecName[0x14];
|
||||
/*0x018*/ u8 (*inputCallback)(void);
|
||||
/*0x01c*/ struct Sprite *cursorSprite;
|
||||
@ -303,9 +303,10 @@ bool8 sub_8122DB0(void);
|
||||
void UpdateRegionMapVideoRegs(void);
|
||||
void InitRegionMap(struct RegionMap *regionMap, u8 argument);
|
||||
u8 sub_81230AC(void);
|
||||
bool8 sub_8123514(void);
|
||||
void FreeRegionMapIconResources(void);
|
||||
u16 sub_8123E9C(u16 x, u16 y);
|
||||
void sub_8124288(u16 x, u16 y);
|
||||
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);
|
||||
|
@ -23,15 +23,15 @@ static EWRAM_DATA struct {
|
||||
u32 filler_004;
|
||||
struct RegionMap regionMap;
|
||||
u16 state;
|
||||
} *gUnknown_0203BCD0 = NULL;
|
||||
} *sFieldRegionMapHandler = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
static void sub_81701C4(void);
|
||||
static void sub_8170260(void);
|
||||
static void sub_8170274(void);
|
||||
static void sub_8170290(void);
|
||||
static void sub_8170428(void);
|
||||
static void MCB2_InitRegionMapRegisters(void);
|
||||
static void VBCB_FieldUpdateRegionMap(void);
|
||||
static void MCB2_FieldUpdateRegionMap(void);
|
||||
static void FieldUpdateRegionMap(void);
|
||||
static void PrintRegionMapSecName(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
@ -68,13 +68,13 @@ static const struct WindowTemplate gUnknown_085E5070[] = {
|
||||
void sub_817018C(MainCallback callback)
|
||||
{
|
||||
SetVBlankCallback(NULL);
|
||||
gUnknown_0203BCD0 = malloc(sizeof(*gUnknown_0203BCD0));
|
||||
gUnknown_0203BCD0->state = 0;
|
||||
gUnknown_0203BCD0->callback = callback;
|
||||
SetMainCallback2(sub_81701C4);
|
||||
sFieldRegionMapHandler = malloc(sizeof(*sFieldRegionMapHandler));
|
||||
sFieldRegionMapHandler->state = 0;
|
||||
sFieldRegionMapHandler->callback = callback;
|
||||
SetMainCallback2(MCB2_InitRegionMapRegisters);
|
||||
}
|
||||
|
||||
static void sub_81701C4(void)
|
||||
static void MCB2_InitRegionMapRegisters(void)
|
||||
{
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
|
||||
@ -93,37 +93,37 @@ static void sub_81701C4(void)
|
||||
DeactivateAllTextPrinters();
|
||||
sub_809882C(0, 0x27, 0xd0);
|
||||
clear_scheduled_bg_copies_to_vram();
|
||||
SetMainCallback2(sub_8170274);
|
||||
SetVBlankCallback(sub_8170260);
|
||||
SetMainCallback2(MCB2_FieldUpdateRegionMap);
|
||||
SetVBlankCallback(VBCB_FieldUpdateRegionMap);
|
||||
}
|
||||
|
||||
static void sub_8170260(void)
|
||||
static void VBCB_FieldUpdateRegionMap(void)
|
||||
{
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
static void sub_8170274(void)
|
||||
static void MCB2_FieldUpdateRegionMap(void)
|
||||
{
|
||||
sub_8170290();
|
||||
FieldUpdateRegionMap();
|
||||
AnimateSprites();
|
||||
BuildOamBuffer();
|
||||
UpdatePaletteFade();
|
||||
do_scheduled_bg_tilemap_copies_to_vram();
|
||||
}
|
||||
|
||||
void sub_8170290(void)
|
||||
static void FieldUpdateRegionMap(void)
|
||||
{
|
||||
u8 offset;
|
||||
|
||||
switch (gUnknown_0203BCD0->state)
|
||||
switch (sFieldRegionMapHandler->state)
|
||||
{
|
||||
case 0:
|
||||
InitRegionMap(&gUnknown_0203BCD0->regionMap, 0);
|
||||
sub_8124288(0, 0);
|
||||
InitRegionMap(&sFieldRegionMapHandler->regionMap, 0);
|
||||
CreateRegionMapPlayerIcon(0, 0);
|
||||
CreateRegionMapCursor(1, 1);
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
break;
|
||||
case 1:
|
||||
SetWindowBorderStyle(1, 0, 0x27, 0xd);
|
||||
@ -131,47 +131,47 @@ void sub_8170290(void)
|
||||
PrintTextOnWindow(1, 1, gText_Hoenn, offset, 1, 0, NULL);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
SetWindowBorderStyle(0, 0, 0x27, 0xd);
|
||||
sub_8170428();
|
||||
PrintRegionMapSecName();
|
||||
BeginNormalPaletteFade(-1, 0, 16, 0, 0);
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
break;
|
||||
case 2:
|
||||
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
|
||||
ShowBg(0);
|
||||
ShowBg(2);
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
break;
|
||||
case 3:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (sub_81230AC())
|
||||
{
|
||||
case INPUT_EVENT_MOVE_END:
|
||||
sub_8170428();
|
||||
PrintRegionMapSecName();
|
||||
break;
|
||||
case INPUT_EVENT_A_BUTTON:
|
||||
case INPUT_EVENT_B_BUTTON:
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
BeginNormalPaletteFade(-1, 0, 0, 16, 0);
|
||||
gUnknown_0203BCD0->state ++;
|
||||
sFieldRegionMapHandler->state ++;
|
||||
break;
|
||||
case 6:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
FreeRegionMapIconResources();
|
||||
SetMainCallback2(gUnknown_0203BCD0->callback);
|
||||
if (gUnknown_0203BCD0 != NULL)
|
||||
SetMainCallback2(sFieldRegionMapHandler->callback);
|
||||
if (sFieldRegionMapHandler != NULL)
|
||||
{
|
||||
free(gUnknown_0203BCD0);
|
||||
gUnknown_0203BCD0 = NULL;
|
||||
free(sFieldRegionMapHandler);
|
||||
sFieldRegionMapHandler = NULL;
|
||||
}
|
||||
FreeAllWindowBuffers();
|
||||
}
|
||||
@ -179,12 +179,12 @@ void sub_8170290(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8170428(void)
|
||||
static void PrintRegionMapSecName(void)
|
||||
{
|
||||
if (gUnknown_0203BCD0->regionMap.iconDrawType != 0)
|
||||
if (sFieldRegionMapHandler->regionMap.iconDrawType != MAPSECTYPE_NONE)
|
||||
{
|
||||
FillWindowPixelBuffer(0, 0x11);
|
||||
PrintTextOnWindow(0, 1, gUnknown_0203BCD0->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
PrintTextOnWindow(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
}
|
||||
else
|
||||
|
158
src/region_map.c
158
src/region_map.c
@ -45,20 +45,20 @@ static u8 MoveRegionMapCursor_Full(void);
|
||||
static u8 ProcessRegionMapInput_Zoomed(void);
|
||||
static u8 MoveRegionMapCursor_Zoomed(void);
|
||||
static void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, u16 f, u8 rotation);
|
||||
u16 GetRegionMapSectionIdAt(u16 x, u16 y);
|
||||
static void sub_812378C(s16 x, s16 y);
|
||||
static void sub_81238AC(void);
|
||||
static void sub_8123C00(void);
|
||||
static u16 GetRegionMapSectionIdAt_Internal(u16 x, u16 y);
|
||||
static void RegionMap_SetBG2XAndBG2Y(s16 x, s16 y);
|
||||
static void RegionMap_InitializeStateBasedOnPlayerLocation(void);
|
||||
static void RegionMap_InitializeStateBasedOnSSTidalLocation(void);
|
||||
static u8 get_flagnr_blue_points(u16 mapSecId);
|
||||
u16 sub_8123EB4(u16 mapSecId);
|
||||
static u16 sub_8123F04(void);
|
||||
static void sub_8123F30(u16 *x, u16 *y);
|
||||
static bool32 sub_8123F74(u8 mapSecId);
|
||||
static void sub_8123FB0(void);
|
||||
static bool8 sub_8124038(u16 y);
|
||||
static void sub_8124238(void);
|
||||
void sub_81243B0(void);
|
||||
void sub_81243DC(void);
|
||||
static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId);
|
||||
static u16 RegionMap_GetTerraCaveMapSecId(void);
|
||||
static void RegionMap_GetMarineCaveCoords(u16 *x, u16 *y);
|
||||
static bool32 RegionMap_IsPlayerInCave(u8 mapSecId);
|
||||
static void RegionMap_GetPositionOfCursorWithinMapSection(void);
|
||||
static bool8 RegionMap_IsMapSecIdInNextRow(u16 y);
|
||||
static void FreeRegionMapCursorSprite(void);
|
||||
static void HideRegionMapPlayerIcon(void);
|
||||
static void UnhideRegionMapPlayerIcon(void);
|
||||
void sub_812445C(struct Sprite *sprite);
|
||||
void sub_81244EC(struct Sprite *sprite);
|
||||
|
||||
@ -118,7 +118,7 @@ void sub_8122CF8(struct RegionMap *regionMap, struct BgTemplate *template, bool8
|
||||
void sub_8122D88(struct RegionMap *regionMap)
|
||||
{
|
||||
gRegionMap = regionMap;
|
||||
sub_81238AC();
|
||||
RegionMap_InitializeStateBasedOnPlayerLocation();
|
||||
gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX;
|
||||
gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY;
|
||||
}
|
||||
@ -163,10 +163,10 @@ bool8 sub_8122DB0(void)
|
||||
LZ77UnCompWram(gUnknown_0859F650, gRegionMap->cursorLargeImage);
|
||||
break;
|
||||
case 5:
|
||||
sub_81238AC();
|
||||
RegionMap_InitializeStateBasedOnPlayerLocation();
|
||||
gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX;
|
||||
gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY;
|
||||
gRegionMap->mapSecId = sub_8123EB4(gRegionMap->mapSecId);
|
||||
gRegionMap->mapSecId = CorrectSpecialMapSecId_Internal(gRegionMap->mapSecId);
|
||||
gRegionMap->iconDrawType = get_flagnr_blue_points(gRegionMap->mapSecId);
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
break;
|
||||
@ -185,7 +185,7 @@ bool8 sub_8122DB0(void)
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
sub_8123FB0();
|
||||
RegionMap_GetPositionOfCursorWithinMapSection();
|
||||
UpdateRegionMapVideoRegs();
|
||||
gRegionMap->cursorSprite = NULL;
|
||||
gRegionMap->playerIconSprite = NULL;
|
||||
@ -302,14 +302,14 @@ static u8 MoveRegionMapCursor_Full(void)
|
||||
{
|
||||
gRegionMap->cursorPosY --;
|
||||
}
|
||||
mapSecId = GetRegionMapSectionIdAt(gRegionMap->cursorPosX, gRegionMap->cursorPosY);
|
||||
mapSecId = GetRegionMapSectionIdAt_Internal(gRegionMap->cursorPosX, gRegionMap->cursorPosY);
|
||||
gRegionMap->iconDrawType = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gRegionMap->mapSecId)
|
||||
{
|
||||
gRegionMap->mapSecId = mapSecId;
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
}
|
||||
sub_8123FB0();
|
||||
RegionMap_GetPositionOfCursorWithinMapSection();
|
||||
gRegionMap->inputCallback = ProcessRegionMapInput_Full;
|
||||
return INPUT_EVENT_MOVE_END;
|
||||
}
|
||||
@ -365,7 +365,7 @@ static u8 MoveRegionMapCursor_Zoomed(void)
|
||||
|
||||
gRegionMap->scrollY += gRegionMap->zoomedCursorDeltaY;
|
||||
gRegionMap->scrollX += gRegionMap->zoomedCursorDeltaX;
|
||||
sub_812378C(gRegionMap->scrollX, gRegionMap->scrollY);
|
||||
RegionMap_SetBG2XAndBG2Y(gRegionMap->scrollX, gRegionMap->scrollY);
|
||||
gRegionMap->zoomedCursorMovementFrameCounter ++;
|
||||
if (gRegionMap->zoomedCursorMovementFrameCounter == 8)
|
||||
{
|
||||
@ -375,14 +375,14 @@ static u8 MoveRegionMapCursor_Zoomed(void)
|
||||
{
|
||||
gRegionMap->zoomedCursorPosX = x;
|
||||
gRegionMap->zoomedCursorPosY = y;
|
||||
mapSecId = GetRegionMapSectionIdAt(x, y);
|
||||
mapSecId = GetRegionMapSectionIdAt_Internal(x, y);
|
||||
gRegionMap->iconDrawType = get_flagnr_blue_points(mapSecId);
|
||||
if (mapSecId != gRegionMap->mapSecId)
|
||||
{
|
||||
gRegionMap->mapSecId = mapSecId;
|
||||
GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, 16);
|
||||
}
|
||||
sub_8123FB0();
|
||||
RegionMap_GetPositionOfCursorWithinMapSection();
|
||||
}
|
||||
gRegionMap->zoomedCursorMovementFrameCounter = 0;
|
||||
gRegionMap->inputCallback = ProcessRegionMapInput_Zoomed;
|
||||
@ -422,13 +422,13 @@ void sub_8123418(void)
|
||||
gRegionMap->unk_050 = 0x800;
|
||||
}
|
||||
gRegionMap->unk_06e = 0;
|
||||
sub_8124238();
|
||||
sub_81243B0();
|
||||
FreeRegionMapCursorSprite();
|
||||
HideRegionMapPlayerIcon();
|
||||
}
|
||||
|
||||
u8 sub_8123514(void)
|
||||
bool8 sub_8123514(void)
|
||||
{
|
||||
u8 r4;
|
||||
bool8 r4;
|
||||
|
||||
if (gRegionMap->unk_06e >= 16)
|
||||
{
|
||||
@ -445,8 +445,8 @@ u8 sub_8123514(void)
|
||||
gRegionMap->zoomed = !gRegionMap->zoomed;
|
||||
gRegionMap->inputCallback = (gRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed;
|
||||
CreateRegionMapCursor(gRegionMap->cursorTileTag, gRegionMap->cursorPaletteTag);
|
||||
sub_81243DC();
|
||||
r4 = 0;
|
||||
UnhideRegionMapPlayerIcon();
|
||||
r4 = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -481,7 +481,7 @@ u8 sub_8123514(void)
|
||||
gRegionMap->unk_050 = 0;
|
||||
}
|
||||
}
|
||||
r4 = 1;
|
||||
r4 = TRUE;
|
||||
}
|
||||
CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, gRegionMap->unk_04c >> 8, gRegionMap->unk_04c >> 8, 0);
|
||||
return r4;
|
||||
@ -510,7 +510,7 @@ static void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e,
|
||||
gRegionMap->needUpdateVideoRegs = TRUE;
|
||||
}
|
||||
|
||||
static void sub_812378C(s16 x, s16 y)
|
||||
static void RegionMap_SetBG2XAndBG2Y(s16 x, s16 y)
|
||||
{
|
||||
gRegionMap->bg2x = (x << 8) + 0x1c00;
|
||||
gRegionMap->bg2y = (y << 8) + 0x2400;
|
||||
@ -533,7 +533,7 @@ void UpdateRegionMapVideoRegs(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8123824(s16 x, s16 y)
|
||||
void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y)
|
||||
{
|
||||
CalcZoomScrollParams(x, y, 0x38, 0x48, 0x100, 0x100, 0);
|
||||
UpdateRegionMapVideoRegs();
|
||||
@ -544,7 +544,7 @@ void sub_8123824(s16 x, s16 y)
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetRegionMapSectionIdAt(u16 x, u16 y)
|
||||
static u16 GetRegionMapSectionIdAt_Internal(u16 x, u16 y)
|
||||
{
|
||||
if (y < MAPCURSOR_Y_MIN || y > MAPCURSOR_Y_MAX || x < MAPCURSOR_X_MIN || x > MAPCURSOR_X_MAX)
|
||||
{
|
||||
@ -555,7 +555,7 @@ u16 GetRegionMapSectionIdAt(u16 x, u16 y)
|
||||
return gUnknown_085A096C[x + y * MAP_WIDTH];
|
||||
}
|
||||
|
||||
static void sub_81238AC(void)
|
||||
static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||
{
|
||||
const struct MapHeader *mapHeader;
|
||||
u16 mapWidth;
|
||||
@ -571,7 +571,7 @@ static void sub_81238AC(void)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_ID_SS_TIDAL_LOWER_DECK
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_ID_SS_TIDAL_ROOMS))
|
||||
{
|
||||
sub_8123C00();
|
||||
RegionMap_InitializeStateBasedOnSSTidalLocation();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -639,7 +639,7 @@ static void sub_81238AC(void)
|
||||
mapHeader = get_mapheader_by_bank_and_number(r4->mapGroup, r4->mapNum);
|
||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||
}
|
||||
if (sub_8123F74(gRegionMap->mapSecId))
|
||||
if (RegionMap_IsPlayerInCave(gRegionMap->mapSecId))
|
||||
{
|
||||
gRegionMap->playerIsInCave = TRUE;
|
||||
}
|
||||
@ -723,14 +723,14 @@ static void sub_81238AC(void)
|
||||
}
|
||||
break;
|
||||
case MAPSEC_UNDERWATER_MARINE_CAVE:
|
||||
sub_8123F30(&gRegionMap->cursorPosX, &gRegionMap->cursorPosY);
|
||||
RegionMap_GetMarineCaveCoords(&gRegionMap->cursorPosX, &gRegionMap->cursorPosY);
|
||||
return;
|
||||
}
|
||||
gRegionMap->cursorPosX = gRegionMapEntries[gRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN;
|
||||
gRegionMap->cursorPosY = gRegionMapEntries[gRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN;
|
||||
}
|
||||
|
||||
static void sub_8123C00(void)
|
||||
static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
|
||||
{
|
||||
u16 y;
|
||||
u16 x;
|
||||
@ -829,12 +829,12 @@ static u8 get_flagnr_blue_points(u16 mapSecId)
|
||||
}
|
||||
}
|
||||
|
||||
u16 sub_8123E9C(u16 x, u16 y)
|
||||
u16 GetRegionMapSectionIdAt(u16 x, u16 y)
|
||||
{
|
||||
return GetRegionMapSectionIdAt(x, y);
|
||||
return GetRegionMapSectionIdAt_Internal(x, y);
|
||||
}
|
||||
|
||||
u16 sub_8123EB4(u16 mapSecId)
|
||||
static u16 CorrectSpecialMapSecId_Internal(u16 mapSecId)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
@ -842,7 +842,7 @@ u16 sub_8123EB4(u16 mapSecId)
|
||||
{
|
||||
if (gUnknown_085A1B84[i] == mapSecId)
|
||||
{
|
||||
return sub_8123F04();
|
||||
return RegionMap_GetTerraCaveMapSecId();
|
||||
}
|
||||
}
|
||||
for (i = 0; gUnknown_085A1B24[i][0] != MAPSEC_NONE; i ++)
|
||||
@ -855,7 +855,7 @@ u16 sub_8123EB4(u16 mapSecId)
|
||||
return mapSecId;
|
||||
}
|
||||
|
||||
static u16 sub_8123F04(void)
|
||||
static u16 RegionMap_GetTerraCaveMapSecId(void)
|
||||
{
|
||||
s16 idx;
|
||||
|
||||
@ -867,7 +867,7 @@ static u16 sub_8123F04(void)
|
||||
return gUnknown_085A1B8A[idx];
|
||||
}
|
||||
|
||||
static void sub_8123F30(u16 *x, u16 *y)
|
||||
static void RegionMap_GetMarineCaveCoords(u16 *x, u16 *y)
|
||||
{
|
||||
u16 idx;
|
||||
|
||||
@ -881,7 +881,7 @@ static void sub_8123F30(u16 *x, u16 *y)
|
||||
*y = gUnknown_085A1BAC[idx].y + MAPCURSOR_Y_MIN;
|
||||
}
|
||||
|
||||
static bool32 sub_8123F74(u8 mapSecId)
|
||||
static bool32 RegionMap_IsPlayerInCave(u8 mapSecId)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -895,20 +895,20 @@ static bool32 sub_8123F74(u8 mapSecId)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u16 sub_8123F9C(u16 mapSecId)
|
||||
u16 CorrectSpecialMapSecId(u16 mapSecId)
|
||||
{
|
||||
return sub_8123EB4(mapSecId);
|
||||
return CorrectSpecialMapSecId_Internal(mapSecId);
|
||||
}
|
||||
|
||||
static void sub_8123FB0(void)
|
||||
static void RegionMap_GetPositionOfCursorWithinMapSection(void)
|
||||
{
|
||||
u16 x;
|
||||
u16 y;
|
||||
u16 unk_003;
|
||||
u16 posWithinMapSec;
|
||||
|
||||
if (gRegionMap->mapSecId == MAPSEC_NONE)
|
||||
{
|
||||
gRegionMap->unk_003 = 0;
|
||||
gRegionMap->posWithinMapSec = 0;
|
||||
return;
|
||||
}
|
||||
if (!gRegionMap->zoomed)
|
||||
@ -921,12 +921,12 @@ static void sub_8123FB0(void)
|
||||
x = gRegionMap->zoomedCursorPosX;
|
||||
y = gRegionMap->zoomedCursorPosY;
|
||||
}
|
||||
unk_003 = 0;
|
||||
posWithinMapSec = 0;
|
||||
while (1)
|
||||
{
|
||||
if (x <= MAPCURSOR_X_MIN)
|
||||
{
|
||||
if (sub_8124038(y))
|
||||
if (RegionMap_IsMapSecIdInNextRow(y))
|
||||
{
|
||||
y --;
|
||||
x = MAPCURSOR_X_MAX + 1;
|
||||
@ -939,26 +939,26 @@ static void sub_8123FB0(void)
|
||||
else
|
||||
{
|
||||
x --;
|
||||
if (GetRegionMapSectionIdAt(x, y) == gRegionMap->mapSecId)
|
||||
if (GetRegionMapSectionIdAt_Internal(x, y) == gRegionMap->mapSecId)
|
||||
{
|
||||
unk_003 ++;
|
||||
posWithinMapSec ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
gRegionMap->unk_003 = unk_003;
|
||||
gRegionMap->posWithinMapSec = posWithinMapSec;
|
||||
}
|
||||
|
||||
static bool8 sub_8124038(u16 y)
|
||||
static bool8 RegionMap_IsMapSecIdInNextRow(u16 y)
|
||||
{
|
||||
u16 x;
|
||||
|
||||
if (y -- == 0)
|
||||
{
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
for (x = MAPCURSOR_X_MIN; x <= MAPCURSOR_X_MAX; x ++)
|
||||
{
|
||||
if (GetRegionMapSectionIdAt(x, y) == gRegionMap->mapSecId)
|
||||
if (GetRegionMapSectionIdAt_Internal(x, y) == gRegionMap->mapSecId)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -966,7 +966,7 @@ static bool8 sub_8124038(u16 y)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_8124088(struct Sprite *sprite)
|
||||
static void SpriteCallback_CursorFull(struct Sprite *sprite)
|
||||
{
|
||||
if (gRegionMap->cursorMovementFrameCounter != 0)
|
||||
{
|
||||
@ -976,7 +976,7 @@ static void sub_8124088(struct Sprite *sprite)
|
||||
}
|
||||
}
|
||||
|
||||
static void TaskDummy8(struct Sprite *sprite)
|
||||
static void SpriteCallback_CursorZoomed(struct Sprite *sprite)
|
||||
{
|
||||
|
||||
}
|
||||
@ -1000,13 +1000,13 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag)
|
||||
{
|
||||
sheet.data = gRegionMap->cursorSmallImage;
|
||||
sheet.size = sizeof(gRegionMap->cursorSmallImage);
|
||||
template.callback = sub_8124088;
|
||||
template.callback = SpriteCallback_CursorFull;
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet.data = gRegionMap->cursorLargeImage;
|
||||
sheet.size = sizeof(gRegionMap->cursorLargeImage);
|
||||
template.callback = TaskDummy8;
|
||||
template.callback = SpriteCallback_CursorZoomed;
|
||||
}
|
||||
LoadSpriteSheet(&sheet);
|
||||
LoadSpritePalette(&palette);
|
||||
@ -1033,7 +1033,7 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8124238(void)
|
||||
static void FreeRegionMapCursorSprite(void)
|
||||
{
|
||||
if (gRegionMap->cursorSprite != NULL)
|
||||
{
|
||||
@ -1053,7 +1053,7 @@ void sub_8124278(void)
|
||||
gRegionMap->cursorSprite->data3 = FALSE;
|
||||
}
|
||||
|
||||
void sub_8124288(u16 tileTag, u16 paletteTag)
|
||||
void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag)
|
||||
{
|
||||
u8 spriteId;
|
||||
struct SpriteSheet sheet = {gUnknown_085A084C, 0x80, tileTag};
|
||||
@ -1087,3 +1087,35 @@ void sub_8124288(u16 tileTag, u16 paletteTag)
|
||||
gRegionMap->playerIconSprite->callback = sub_812445C;
|
||||
}
|
||||
}
|
||||
|
||||
static void HideRegionMapPlayerIcon(void)
|
||||
{
|
||||
if (gRegionMap->playerIconSprite != NULL)
|
||||
{
|
||||
gRegionMap->playerIconSprite->invisible = TRUE;
|
||||
gRegionMap->playerIconSprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
||||
static void UnhideRegionMapPlayerIcon(void)
|
||||
{
|
||||
if (gRegionMap->playerIconSprite != NULL)
|
||||
{
|
||||
if (gRegionMap->zoomed == TRUE)
|
||||
{
|
||||
gRegionMap->playerIconSprite->pos1.x = gRegionMap->playerIconSpritePosX * 16 - 0x30;
|
||||
gRegionMap->playerIconSprite->pos1.y = gRegionMap->playerIconSpritePosY * 16 - 0x42;
|
||||
gRegionMap->playerIconSprite->callback = sub_812445C;
|
||||
gRegionMap->playerIconSprite->invisible = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gRegionMap->playerIconSprite->pos1.x = gRegionMap->playerIconSpritePosX * 8 + 4;
|
||||
gRegionMap->playerIconSprite->pos1.y = gRegionMap->playerIconSpritePosY * 8 + 4;
|
||||
gRegionMap->playerIconSprite->pos2.x = 0;
|
||||
gRegionMap->playerIconSprite->pos2.y = 0;
|
||||
gRegionMap->playerIconSprite->callback = sub_81244EC;
|
||||
gRegionMap->playerIconSprite->invisible = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user