Add meaningful aliases for wd265

Introduce MONICON_* constants
Introduce BATTLEPLAYERACTION_* constants
This commit is contained in:
Rangi
2018-07-28 19:27:34 -04:00
parent 2ec900d96c
commit 9dec80b07e
83 changed files with 436 additions and 404 deletions

View File

@@ -149,13 +149,13 @@ Gen2ToGen1LinkComms:
ld a, [hli]
cp -1
jr z, .done_party
ld [wd265], a
ld [wTempSpecies], a
push hl
push de
callfar ConvertMon_1to2
pop de
pop hl
ld a, [wd265]
ld a, [wTempSpecies]
ld [de], a
inc de
jr .party_loop
@@ -651,13 +651,13 @@ Link_PrepPartyData_Gen1:
ld a, [hli]
cp -1
jr z, .done_party
ld [wd265], a
ld [wTempSpecies], a
push hl
push de
callfar ConvertMon_2to1
pop de
pop hl
ld a, [wd265]
ld a, [wTempSpecies]
ld [de], a
inc de
jr .loop2
@@ -692,11 +692,11 @@ Link_PrepPartyData_Gen1:
push de
push bc
ld a, [hl]
ld [wd265], a
ld [wTempSpecies], a
callfar ConvertMon_2to1
pop bc
pop de
ld a, [wd265]
ld a, [wTempSpecies]
ld [de], a
inc de
ld hl, MON_HP
@@ -976,11 +976,11 @@ Function2868a:
inc de
push bc
push de
ld [wd265], a
ld [wTempSpecies], a
callfar ConvertMon_1to2
pop de
pop bc
ld a, [wd265]
ld a, [wTempSpecies]
ld [bc], a
ld [wCurSpecies], a
ld hl, MON_HP
@@ -1461,7 +1461,7 @@ Function28926:
ld b, 0
add hl, bc
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
hlcoord 0, 12
ld b, 4
@@ -1619,7 +1619,7 @@ LinkTrade:
ld b, 0
add hl, bc
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wd004
@@ -1631,7 +1631,7 @@ LinkTrade:
ld b, 0
add hl, bc
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
@@ -2047,14 +2047,14 @@ CheckTimeCapsuleCompatibility:
jr .done
.mon_too_new
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld a, $1
jr .done
.move_too_new
push bc
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetMoveName
call CopyName1
pop bc
@@ -2079,7 +2079,7 @@ Function29c67:
ld hl, wPartyCount
add hl, bc
ld a, [hl]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ret
@@ -2146,13 +2146,13 @@ WaitForOtherPlayerToExit:
SetBitsForLinkTradeRequest:
ld a, LINK_TRADECENTER - 1
ld [wPlayerLinkAction], a
ld [wd265], a
ld [wChosenCableClubRoom], a
ret
SetBitsForBattleRequest:
ld a, LINK_COLOSSEUM - 1
ld [wPlayerLinkAction], a
ld [wd265], a
ld [wChosenCableClubRoom], a
ret
SetBitsForTimeCapsuleRequest:
@@ -2166,7 +2166,7 @@ SetBitsForTimeCapsuleRequest:
ld [rSC], a
xor a ; LINK_TIMECAPSULE - 1
ld [wPlayerLinkAction], a
ld [wd265], a
ld [wChosenCableClubRoom], a
ret
WaitForLinkedFriend:
@@ -2373,7 +2373,7 @@ Link_CheckCommunicationError:
ret
TryQuickSave:
ld a, [wd265]
ld a, [wChosenCableClubRoom]
push af
farcall Link_SaveGame
ld a, TRUE
@@ -2384,11 +2384,11 @@ TryQuickSave:
ld c, 30
call DelayFrames
pop af
ld [wd265], a
ld [wChosenCableClubRoom], a
ret
CheckBothSelectedSameRoom:
ld a, [wd265]
ld a, [wChosenCableClubRoom]
call Link_EnsureSync
push af
call LinkDataReceived
@@ -2396,10 +2396,10 @@ CheckBothSelectedSameRoom:
call LinkDataReceived
pop af
ld b, a
ld a, [wd265]
ld a, [wChosenCableClubRoom]
cp b
jr nz, .fail
ld a, [wd265]
ld a, [wChosenCableClubRoom]
inc a
ld [wLinkMode], a
xor a

View File

@@ -1430,7 +1430,7 @@ Function105688:
ld de, wMysteryGiftTrainerData
farcall Function8ac70
ld a, c
ld [wd265], a
ld [wDeciramBuffer], a
ld hl, Text_CardNotRegistered
jr c, PrintTextAndExit_JP
ld hl, Text_ListedCardAsNumber

View File

@@ -24,7 +24,7 @@ PrepMysteryGiftDataToSend:
call CountSetBits
pop de
pop bc
ld a, [wd265]
ld a, [wNumSetBits]
ld [de], a
inc de ; wc80f
call CloseSRAM

View File

@@ -122,7 +122,7 @@ PlaceTradePartnerNamesAndParty:
ld a, [de]
cp -1
ret z
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
push bc
push hl
push de

View File

@@ -1,8 +1,10 @@
ConvertMon_2to1:
; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265.
; Takes the Gen 2 Pokemon number stored in wTempSpecies,
; finds it in the Pokered_MonIndices table,
; and returns its index in wTempSpecies.
push bc
push hl
ld a, [wd265]
ld a, [wTempSpecies]
ld b, a
ld c, 0
ld hl, Pokered_MonIndices
@@ -12,23 +14,24 @@ ConvertMon_2to1:
cp b
jr nz, .loop
ld a, c
ld [wd265], a
ld [wTempSpecies], a
pop hl
pop bc
ret
ConvertMon_1to2:
; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265.
; Takes the Gen 1 Pokemon number stored in wTempSpecies
; and returns the corresponding value from Pokered_MonIndices in wTempSpecies.
push bc
push hl
ld a, [wd265]
ld a, [wTempSpecies]
dec a
ld hl, Pokered_MonIndices
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd265], a
ld [wTempSpecies], a
pop hl
pop bc
ret