Miscellaneous updates and corrections

This commit is contained in:
Rangi 2020-04-23 16:10:46 -04:00
parent 2d3a94b7c4
commit b50dd57cbb
7 changed files with 38 additions and 35 deletions

View File

@ -3327,7 +3327,7 @@ Sfx_DexFanfare170199_Ch8:
note B_, 16 note B_, 16
sound_ret sound_ret
db $fd db sound_loop_cmd
Sfx_DexFanfare200229: Sfx_DexFanfare200229:
channel_count 4 channel_count 4

View File

@ -617,7 +617,7 @@ And edit [engine/pokegear/radio.asm](https://github.com/pret/pokecrystal/blob/ma
add hl, bc add hl, bc
add hl, bc add hl, bc
+ add hl, bc + add hl, bc
+ b = bank + ; b = bank
+ ld a, BANK(PokedexDataPointerTable) + ld a, BANK(PokedexDataPointerTable)
+ call GetFarByte + call GetFarByte
+ ld b, a + ld b, a

View File

@ -6219,7 +6219,7 @@ LoadEnemyMon:
; Fill stats ; Fill stats
ld de, wEnemyMonMaxHP ld de, wEnemyMonMaxHP
ld b, FALSE ld b, FALSE
ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; wLinkBattleRNs + 7 ; ? ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1)
predef CalcMonStats predef CalcMonStats
; If we're in a trainer battle, ; If we're in a trainer battle,
@ -8401,7 +8401,7 @@ DisplayLinkBattleResult:
ld a, BANK(sLinkBattleStats) ld a, BANK(sLinkBattleStats)
call GetSRAMBank call GetSRAMBank
call AddLastMobileBattleToLinkRecord call AddLastLinkBattleToLinkRecord
call ReadAndPrintLinkBattleRecord call ReadAndPrintLinkBattleRecord
call CloseSRAM call CloseSRAM
@ -8442,6 +8442,9 @@ IsMobileBattle2:
cp LINK_MOBILE cp LINK_MOBILE
ret ret
LINK_BATTLE_RECORD_LENGTH EQUS "(sLinkBattleRecord1End - sLinkBattleRecord1)" ; 18
NUM_LINK_BATTLE_RECORDS EQUS "((sLinkBattleStatsEnd - sLinkBattleRecord) / LINK_BATTLE_RECORD_LENGTH)" ; 5
_DisplayLinkRecord: _DisplayLinkRecord:
ld a, BANK(sLinkBattleStats) ld a, BANK(sLinkBattleStats)
call GetSRAMBank call GetSRAMBank
@ -8467,7 +8470,7 @@ ReadAndPrintLinkBattleRecord:
call ClearSprites call ClearSprites
call .PrintBattleRecord call .PrintBattleRecord
hlcoord 0, 8 hlcoord 0, 8
ld b, 5 ld b, NUM_LINK_BATTLE_RECORDS
ld de, sLinkBattleRecord + 2 ld de, sLinkBattleRecord + 2
.loop .loop
push bc push bc
@ -8484,7 +8487,7 @@ ReadAndPrintLinkBattleRecord:
ld h, d ld h, d
ld l, e ld l, e
ld de, wd002 ld de, wd002
ld bc, 10 ld bc, NAME_LENGTH - 1
call CopyBytes call CopyBytes
ld a, "@" ld a, "@"
ld [de], a ld [de], a
@ -8521,7 +8524,7 @@ ReadAndPrintLinkBattleRecord:
call PlaceString call PlaceString
.next .next
pop hl pop hl
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
@ -8694,7 +8697,7 @@ GetRoamMonSpecies:
ld hl, wRoamMon3Species ld hl, wRoamMon3Species
ret ret
AddLastMobileBattleToLinkRecord: AddLastLinkBattleToLinkRecord:
ld hl, wOTPlayerID ld hl, wOTPlayerID
ld de, wStringBuffer1 ld de, wStringBuffer1
ld bc, 2 ld bc, 2
@ -8702,10 +8705,10 @@ AddLastMobileBattleToLinkRecord:
ld hl, wOTPlayerName ld hl, wOTPlayerName
ld bc, NAME_LENGTH - 1 ld bc, NAME_LENGTH - 1
call CopyBytes call CopyBytes
ld hl, sLinkBattleResults ld hl, sLinkBattleStats - (LINK_BATTLE_RECORD_LENGTH - 6)
call .StoreResult call .StoreResult
ld hl, sLinkBattleRecord ld hl, sLinkBattleRecord
ld d, 5 ld d, NUM_LINK_BATTLE_RECORDS
.loop .loop
push hl push hl
inc hl inc hl
@ -8716,17 +8719,17 @@ AddLastMobileBattleToLinkRecord:
and a and a
jr z, .copy jr z, .copy
push de push de
ld bc, 12 ld bc, LINK_BATTLE_RECORD_LENGTH - 6
ld de, wStringBuffer1 ld de, wStringBuffer1
call CompareBytesLong call CompareBytesLong
pop de pop de
pop hl pop hl
jr c, .done jr c, .done
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc add hl, bc
dec d dec d
jr nz, .loop jr nz, .loop
ld bc, -18 ld bc, -LINK_BATTLE_RECORD_LENGTH
add hl, bc add hl, bc
push hl push hl
@ -8734,7 +8737,7 @@ AddLastMobileBattleToLinkRecord:
ld d, h ld d, h
ld e, l ld e, l
ld hl, wStringBuffer1 ld hl, wStringBuffer1
ld bc, 12 ld bc, LINK_BATTLE_RECORD_LENGTH - 6
call CopyBytes call CopyBytes
ld b, 6 ld b, 6
xor a xor a
@ -8749,16 +8752,17 @@ AddLastMobileBattleToLinkRecord:
call .StoreResult call .StoreResult
call .FindOpponentAndAppendRecord call .FindOpponentAndAppendRecord
ret ret
.StoreResult: .StoreResult:
ld a, [wBattleResult] ld a, [wBattleResult]
and $f and $f
cp LOSE cp LOSE
ld bc, sLinkBattleWins + 1 - sLinkBattleResults ld bc, (sLinkBattleRecord1Wins - sLinkBattleRecord1) + 1
jr c, .okay ; WIN jr c, .okay ; WIN
ld bc, sLinkBattleLosses + 1 - sLinkBattleResults ld bc, (sLinkBattleRecord1Losses - sLinkBattleRecord1) + 1
jr z, .okay ; LOSE jr z, .okay ; LOSE
; DRAW ; DRAW
ld bc, sLinkBattleDraws + 1 - sLinkBattleResults ld bc, (sLinkBattleRecord1Draws - sLinkBattleRecord1) + 1
.okay .okay
add hl, bc add hl, bc
call .CheckOverflow call .CheckOverflow
@ -8780,8 +8784,8 @@ AddLastMobileBattleToLinkRecord:
ret ret
.FindOpponentAndAppendRecord: .FindOpponentAndAppendRecord:
ld b, 5 ld b, NUM_LINK_BATTLE_RECORDS
ld hl, sLinkBattleRecord + 17 ld hl, sLinkBattleRecord1End - 1
ld de, wd002 ld de, wd002
.loop3 .loop3
push bc push bc
@ -8799,7 +8803,7 @@ AddLastMobileBattleToLinkRecord:
ld a, c ld a, c
ld [de], a ld [de], a
inc de inc de
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
@ -8848,26 +8852,26 @@ AddLastMobileBattleToLinkRecord:
.done2 .done2
push bc push bc
ld a, b ld a, b
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
ld hl, sLinkBattleRecord ld hl, sLinkBattleRecord
call AddNTimes call AddNTimes
push hl push hl
ld de, wd002 ld de, wd002
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
call CopyBytes call CopyBytes
pop hl pop hl
pop bc pop bc
push hl push hl
ld a, c ld a, c
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
ld hl, sLinkBattleRecord ld hl, sLinkBattleRecord
call AddNTimes call AddNTimes
pop de pop de
push hl push hl
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
call CopyBytes call CopyBytes
ld hl, wd002 ld hl, wd002
ld bc, 18 ld bc, LINK_BATTLE_RECORD_LENGTH
pop de pop de
call CopyBytes call CopyBytes
ret ret

View File

@ -238,6 +238,7 @@ link_battle_record: MACRO
\1Wins:: dw \1Wins:: dw
\1Losses:: dw \1Losses:: dw
\1Draws:: dw \1Draws:: dw
\1End::
ENDM ENDM
trademon: MACRO trademon: MACRO

View File

@ -125,13 +125,11 @@ SECTION "Active Box", SRAM
sBox:: box sBox sBox:: box sBox
; b160 ; b160
ds $f4 ds $100
SECTION "Link Battle Data", SRAM SECTION "Link Battle Data", SRAM
sLinkBattleResults:: ds $c
sLinkBattleStats:: sLinkBattleStats::
sLinkBattleWins:: dw ; b260 sLinkBattleWins:: dw ; b260
sLinkBattleLosses:: dw ; b262 sLinkBattleLosses:: dw ; b262

View File

@ -2851,15 +2851,15 @@ wCurMapData::
wVisitedSpawns:: flag_array NUM_SPAWNS ; dca5 wVisitedSpawns:: flag_array NUM_SPAWNS ; dca5
wDigWarpNumber:: db ; dcaa wDigWarpNumber:: db ; dca9
wDigMapGroup:: db ; dcab wDigMapGroup:: db ; dcaa
wDigMapNumber:: db ; dcac wDigMapNumber:: db ; dcab
; used on maps like second floor pokécenter, which are reused, so we know which ; used on maps like second floor pokécenter, which are reused, so we know which
; map to return to ; map to return to
wBackupWarpNumber:: db ; dcad wBackupWarpNumber:: db ; dcac
wBackupMapGroup:: db ; dcae wBackupMapGroup:: db ; dcad
wBackupMapNumber:: db ; dcaf wBackupMapNumber:: db ; dcae
ds 3 ds 3