Keep wGrassMons and wWaterMons together with a UNION

This commit is contained in:
Rangi 2020-11-28 17:11:12 -05:00
parent 47cd734276
commit 6adbaefde1
2 changed files with 25 additions and 22 deletions

View file

@ -2013,18 +2013,19 @@ DisplayBattleMenu::
.menuselected .menuselected
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID call DisplayTextBoxID
; handle menu input if it's not the old man tutorial
ld a, [wBattleType] ld a, [wBattleType]
dec a dec a
jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial jp nz, .handleBattleMenuInput
; the following happens for the old man tutorial ; the following happens for the old man tutorial
; Temporarily save the player name in wGrassRate, ; Temporarily save the player name in wLinkEnemyTrainerName.
; which is supposed to get overwritten when entering a ; Since wLinkEnemyTrainerName == wGrassRate, this affects wild encounters.
; map with wild Pokémon. ; The wGrassRate byte and following wGrassMons buffer are supposed
; Due to an oversight, the data may not get ; to get overwritten when entering a map with wild Pokémon,
; overwritten (on Cinnabar and Route 21) and the infamous ; but an oversight prevents this in Cinnabar and Route 21,
; Missingno. glitch can show up. ; so the infamous MissingNo. glitch can show up.
ld hl, wPlayerName ld hl, wPlayerName
ld de, wGrassRate ld de, wLinkEnemyTrainerName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyData call CopyData
ld hl, .oldManName ld hl, .oldManName

View file

@ -3035,31 +3035,33 @@ wSecondLockTrashCanIndex::
wEventFlags:: wEventFlags::
flag_array NUM_EVENTS flag_array NUM_EVENTS
UNION
wGrassRate:: db
wGrassMons::
ds 10 * 2
ds 8
wWaterRate:: db
wWaterMons::
ds 10 * 2
NEXTU
wLinkEnemyTrainerName:: wLinkEnemyTrainerName::
; linked game's trainer name ; linked game's trainer name
ds NAME_LENGTH
wGrassRate::
ds 1 ds 1
wGrassMons::
; ds 20
ds 11
; Overload wGrassMons
wSerialEnemyDataBlock:: wSerialEnemyDataBlock::
; ds $1a8
ds 9 ds 9
wEnemyPartyCount:: ds 1 wEnemyPartyCount:: ds 1
wEnemyPartyMons:: ds PARTY_LENGTH + 1 wEnemyPartyMons:: ds PARTY_LENGTH + 1
; Overload enemy party data
UNION
wWaterRate:: db
wWaterMons:: db
NEXTU
wEnemyMons:: wEnemyMons::
wEnemyMon1:: party_struct wEnemyMon1 wEnemyMon1:: party_struct wEnemyMon1
wEnemyMon2:: party_struct wEnemyMon2 wEnemyMon2:: party_struct wEnemyMon2