Make level selection menu landmarks universal (#4) (#12)

This commit is contained in:
xCrystal
2023-08-20 12:08:24 +02:00
parent 222b46896c
commit fc2e757c57
11 changed files with 61 additions and 84 deletions

View File

@@ -218,7 +218,7 @@ GetCaughtLocation:
cp LANDMARK_GIFT
jr z, .fail
ld e, a
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
ld hl, wStringBuffer1
ld de, wSeerCaughtLocation
ld bc, 17

View File

@@ -86,7 +86,7 @@ LevelSelectionMenu_GetLandmarkPage:
pop hl
ret
LevelSelectionMenu_GetLandmarkCoords:
LevelSelectionMenu_GetLandmarkCoords::
; Return coordinates (d, e) of landmark e.
push hl
push bc
@@ -101,6 +101,35 @@ LevelSelectionMenu_GetLandmarkCoords:
pop hl
ret
LevelSelectionMenu_GetLandmarkName::
; Copy the name of landmark e to wStringBuffer1.
push hl
push de
push bc
ld hl, LevelSelectionMenu_Landmarks + $3
ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1
ld a, e
call AddNTimes
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wStringBuffer1
ld c, 18
.copy
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .copy
pop bc
pop de
pop hl
ret
INCLUDE "data/level_selection_menu.asm"
LevelSelectionMenuGFX:

View File

@@ -1,46 +0,0 @@
GetLandmarkCoords:
; Return coordinates (d, e) of landmark e.
push hl
ld l, e
ld h, 0
add hl, hl
add hl, hl
ld de, Landmarks
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
ret
GetLandmarkName::
; Copy the name of landmark e to wStringBuffer1.
push hl
push de
push bc
ld l, e
ld h, 0
add hl, hl
add hl, hl
ld de, Landmarks + 2
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wStringBuffer1
ld c, 18
.copy
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .copy
pop bc
pop de
pop hl
ret
INCLUDE "data/maps/landmarks.asm"

View File

@@ -1623,7 +1623,7 @@ Script_getcurlandmarkname:
ConvertLandmarkToText:
ld e, a
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
ld de, wStringBuffer1
jp GetStringBuffer

View File

@@ -679,7 +679,7 @@ GetCallerLocation:
push bc
call GetWorldMapLocation
ld e, a
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
pop bc
pop de
ret

View File

@@ -574,7 +574,7 @@ PokegearMap_InitPlayerIcon:
pop af
ld e, a
push bc
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -609,7 +609,7 @@ PokegearMap_UpdateLandmarkName:
pop af
ld e, a
push de
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
pop de
farcall TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
@@ -619,7 +619,7 @@ PokegearMap_UpdateLandmarkName:
PokegearMap_UpdateCursorPosition:
push bc
ld e, a
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -1986,7 +1986,7 @@ TownMapBubble:
ld de, Flypoints
add hl, de
ld e, [hl]
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
hlcoord 2, 1
ld de, wStringBuffer1
call PlaceString
@@ -2000,7 +2000,7 @@ GetMapCursorCoordinates:
ld de, Flypoints
add hl, de
ld e, [hl]
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
ld a, [wTownMapCursorCoordinates]
ld c, a
ld a, [wTownMapCursorCoordinates + 1]
@@ -2231,7 +2231,7 @@ Pokedex_GetArea:
push de
ld e, a
push hl
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
pop hl
; load into OAM
ld a, d
@@ -2261,7 +2261,7 @@ Pokedex_GetArea:
ret c
ld a, [wTownMapPlayerIconLandmark]
ld e, a
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
ld c, e
ld b, d
ld de, .PlayerOAM
@@ -2472,7 +2472,7 @@ TownMapPlayerIcon:
pop af
ld e, a
push bc
farcall GetLandmarkCoords
farcall LevelSelectionMenu_GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc

View File

@@ -266,7 +266,7 @@ endr
pop bc
call GetWorldMapLocation
ld e, a
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
ld hl, OPT_OakText1
call CopyRadioTextToRAM
ld a, OAKS_POKEMON_TALK_5
@@ -1249,7 +1249,7 @@ PeoplePlaces6: ; Places
ld c, [hl]
call GetWorldMapLocation
ld e, a
farcall GetLandmarkName
farcall LevelSelectionMenu_GetLandmarkName
ld hl, PnP_Text5
ld a, PLACES_AND_PEOPLE_7
jp NextRadioLine