Nihon + Silent Hills Groundwork

Currently doesn't build due to a weird error

```
rgbasm -hL -Q8 -P includes.asm -Weverything -Wnumeric-string=2 -Wtruncation=1  -o data/maps/map_data.o data/maps/map_data.asm
error: data/maps/map_data.asm(3) -> data/maps/maps.asm(544) -> macros/asserts.as
m::assert_table_length(14):
    Expected constant expression: 'NUM_SILENT_HILLS_MAP' is not constant at asse
mbly time
error: data/maps/map_data.asm(3) -> data/maps/maps.asm(544) -> macros/asserts.as
m::assert_table_length(16):
    Assertion failed: MapGroup_SilentHills: expected 0 entries, each 9 bytes
error: Assembly aborted (2 errors)!
make: *** [Makefile:119: data/maps/map_data.o] Error 1
```
This commit is contained in:
Llinos Evans 2023-10-20 06:23:47 +01:00
parent 26bb9fbc7b
commit a8546f60c9
22 changed files with 155 additions and 4 deletions

View file

@ -17,6 +17,8 @@ DEF PHONE_DISPLAY_HEIGHT EQU 4
const POKEGEARSTATE_JOHTOMAPJOYPAD ; 4
const POKEGEARSTATE_KANTOMAPINIT ; 5
const POKEGEARSTATE_KANTOMAPJOYPAD ; 6
const POKEGEARSTATE_NIHONMAPINIT ; 5
const POKEGEARSTATE_NIHONMAPJOYPAD ; 6
const POKEGEARSTATE_PHONEINIT ; 7
const POKEGEARSTATE_PHONEJOYPAD ; 8
const POKEGEARSTATE_MAKEPHONECALL ; 9
@ -324,6 +326,8 @@ InitPokegearTilemap:
.Map:
ld a, [wPokegearMapPlayerIconLandmark]
cp NIHON_LANDMARK
jr z, .nihon
cp LANDMARK_FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
@ -334,6 +338,10 @@ InitPokegearTilemap:
.kanto
ld e, 1
jr .ok
.nihon
ld e, 2
.ok
farcall PokegearMap
ld a, $07
@ -443,6 +451,8 @@ PokegearJumptable:
dw PokegearMap_JohtoMap
dw PokegearMap_Init
dw PokegearMap_KantoMap
dw PokegearMap_Init
dw PokegearMap_NihonMap
dw PokegearPhone_Init
dw PokegearPhone_Joypad
dw PokegearPhone_MakePhoneCall
@ -530,6 +540,8 @@ Pokegear_UpdateClock:
PokegearMap_CheckRegion:
ld a, [wPokegearMapPlayerIconLandmark]
cp NIHON_LANDMARK
jr z, .nihon
cp LANDMARK_FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
@ -541,6 +553,11 @@ PokegearMap_CheckRegion:
.kanto
ld a, POKEGEARSTATE_KANTOMAPINIT
jr .done
ret
.nihon
ld a, POKEGEARSTATE_NIHONMAPINIT
.done
ld [wJumptableIndex], a
call ExitPokegearRadio_HandleMusic
@ -564,6 +581,10 @@ PokegearMap_KantoMap:
call TownMap_GetKantoLandmarkLimits
jr PokegearMap_ContinueMap
PokegearMap_NihonMap:
call TownMap_GetNihonLandmarkLimits
jr PokegearMap_ContinueMap
PokegearMap_JohtoMap:
ld d, LANDMARK_SILVER_CAVE
ld e, LANDMARK_NEW_BARK_TOWN
@ -740,6 +761,12 @@ TownMap_GetKantoLandmarkLimits:
ld e, LANDMARK_VICTORY_ROAD
ret
TownMap_GetNihonLandmarkLimits:
ld a, [wStatusFlags]
ld d, LANDMARK_SILENT_HILLS
ld e, LANDMARK_SILENT_HILLS ; Gonna need another map.
ret
PokegearRadio_Init:
call InitPokegearTilemap
depixel 4, 10, 4, 4
@ -1547,7 +1574,7 @@ RadioChannels:
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
; kanto
; kanto or nihon
and a
ret
@ -1809,6 +1836,8 @@ _TownMap:
.dmg
ld a, [wTownMapPlayerIconLandmark]
cp NIHON_LANDMARK
jr nc, .nihon
cp KANTO_LANDMARK
jr nc, .kanto
ld d, KANTO_LANDMARK - 1
@ -1820,6 +1849,10 @@ _TownMap:
call TownMap_GetKantoLandmarkLimits
call .loop
.nihon
call TownMap_GetNihonLandmarkLimits
call .loop
.resume
pop af
ld [wVramState], a
@ -1892,6 +1925,8 @@ _TownMap:
.InitTilemap:
ld a, [wTownMapPlayerIconLandmark]
cp NIHON_LANDMARK
jr nc, .nihon2
cp KANTO_LANDMARK
jr nc, .kanto2
ld e, JOHTO_REGION
@ -1899,6 +1934,9 @@ _TownMap:
.kanto2
ld e, KANTO_REGION
jr .okay_tilemap
.nihon2
ld e, NIHON_REGION
.okay_tilemap
farcall PokegearMap
ld a, $07
@ -2269,6 +2307,8 @@ FlyMap:
; The first 46 locations are part of Johto. The rest are in Kanto.
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
cp NIHON_LANDMARK
jr nc, .NihonFlyMap
; Johto fly map
; Note that .NoKanto should be modified in tandem with this branch
push af
@ -2311,6 +2351,33 @@ FlyMap:
call TownMapPlayerIcon
ret
.NihonFlyMap:
; The event that there are no flypoints enabled in a map is not
; accounted for. As a result, if you attempt to select a flypoint
; when there are none enabled, the game will crash. Additionally,
; the flypoint selection has a default starting point that
; can be flown to even if none are enabled.
; To prevent both of these things from happening when the player
; enters Kanto, fly access is restricted until Indigo Plateau is
; visited and its flypoint enabled.
push af
ld c, SPAWN_SILENT_HILLS
call HasVisitedSpawn
and a
jr z, .NoKanto
; Kanto's map is only loaded if we've visited Indigo Plateau
ld a, NIHON_FLYPOINT ; first Kanto flypoint
ld [wStartFlypoint], a
ld a, NUM_FLYPOINTS - 1 ; last Kanto flypoint
ld [wEndFlypoint], a
ld [wTownMapPlayerIconLandmark], a ; last one is default (Indigo Plateau)
; Fill out the map
call FillNihonMap
call .MapHud
pop af
call TownMapPlayerIcon
ret
.NoKanto:
; If Indigo Plateau hasn't been visited, we use Johto's map instead
ld a, JOHTO_FLYPOINT ; first Johto flypoint
@ -2644,6 +2711,10 @@ FillJohtoMap:
FillKantoMap:
ld de, KantoMap
jr FillTownMap
FillNihonMap:
ld de, NihonMap
FillTownMap:
hlcoord 0, 0
.loop
@ -2794,6 +2865,9 @@ INCBIN "gfx/pokegear/johto.bin"
KantoMap:
INCBIN "gfx/pokegear/kanto.bin"
NihonMap:
INCBIN "gfx/pokegear/nihon.bin"
PokedexNestIconGFX:
INCBIN "gfx/pokegear/dexmap_nest_icon.2bpp"
FlyMapLabelBorderGFX: