Resolve s1 addresses in battle/core.asm

This commit is contained in:
PikalaxALT 2015-11-10 18:17:04 -05:00
parent d13fb46d40
commit b1e63485d8
2 changed files with 73 additions and 62 deletions

View File

@ -8831,43 +8831,47 @@ Function3f77c: ; 3f77c
callba CheckMobileBattleError callba CheckMobileBattleError
jp c, Function3f80f jp c, Function3f80f
call Function3f830 call Function3f830
jr nz, .asm_3f797 jr nz, .proceed
ld hl, wcd2a ld hl, wcd2a
bit 4, [hl] bit 4, [hl]
jr z, .asm_3f797 jr z, .proceed
callba Function2b930 callba Function2b930
.asm_3f797 .proceed
ld a, [wBattleResult] ld a, [wBattleResult]
and $f and $f
cp $1 cp $1
jr c, .asm_3f7ad jr c, .victory
jr z, .asm_3f7b8 jr z, .loss
callba MobileFn_106107 callba MobileFn_106107
ld de, .Draw ld de, .Draw
jr .asm_3f7c3 jr .store_result
.asm_3f7ad .victory
callba MobileFn_1060fb callba MobileFn_1060fb
ld de, .Win ld de, .Win
jr .asm_3f7c3 jr .store_result
.asm_3f7b8 .loss
callba MobileFn_106101 callba MobileFn_106101
ld de, .Lose ld de, .Lose
jr .asm_3f7c3 jr .store_result
.asm_3f7c3 .store_result
hlcoord 6, 8 hlcoord 6, 8
call PlaceString call PlaceString
callba BackupMobileEventIndex callba BackupMobileEventIndex
ld c, $c8 ld c, 200
call DelayFrames call DelayFrames
ld a, BANK(sLinkBattleStats) ld a, BANK(sLinkBattleStats)
call GetSRAMBank call GetSRAMBank
call Function3fa42 call Function3fa42
call Function3f85f call Function3f85f
call CloseSRAM call CloseSRAM
call Function3f830 call Function3f830
jr z, .asm_3f7ee jr z, .asm_3f7ee
call Functiona80 call Functiona80
@ -8875,7 +8879,7 @@ Function3f77c: ; 3f77c
ret ret
.asm_3f7ee .asm_3f7ee
ld c, $c8 ld c, 200
call DelayFrames call DelayFrames
call ClearTileMap call ClearTileMap
ret ret
@ -9178,16 +9182,16 @@ GetRoamMonSpecies: ; 3fa31
Function3fa42: ; 3fa42 Function3fa42: ; 3fa42
ld hl, wd276 ld hl, wd276
ld de, StringBuffer1 ld de, StringBuffer1
ld bc, $0002 ld bc, 2
call CopyBytes call CopyBytes
ld hl, wd26b ld hl, wd26b
ld bc, $000a ld bc, 10
call CopyBytes call CopyBytes
ld hl, $b254 ld hl, s1_b254
call Function3faa0 call Function3faa0
ld hl, $b266 ld hl, s1_b266
ld d, $5 ld d, 5
.asm_3fa62 .loop
push hl push hl
rept 2 rept 2
inc hl inc hl
@ -9197,38 +9201,38 @@ rept 2
dec hl dec hl
endr endr
and a and a
jr z, .asm_3fa85 jr z, .copy
push de push de
ld bc, $000c ld bc, 12
ld de, StringBuffer1 ld de, StringBuffer1
call CompareLong call CompareLong
pop de pop de
pop hl pop hl
jr c, .asm_3fa99 jr c, .done
ld bc, $0012 ld bc, 18
add hl, bc add hl, bc
dec d dec d
jr nz, .asm_3fa62 jr nz, .loop
ld bc, -18 ld bc, -18
add hl, bc add hl, bc
push hl push hl
.asm_3fa85 .copy
ld d, h ld d, h
ld e, l ld e, l
ld hl, StringBuffer1 ld hl, StringBuffer1
ld bc, $000c ld bc, 12
call CopyBytes call CopyBytes
ld b, $6 ld b, 6
xor a xor a
.asm_3fa93 .loop2
ld [de], a ld [de], a
inc de inc de
dec b dec b
jr nz, .asm_3fa93 jr nz, .loop2
pop hl pop hl
.asm_3fa99 .done
call Function3faa0 call Function3faa0
call Function3fac8 call Function3fac8
ret ret
@ -9238,13 +9242,13 @@ Function3faa0: ; 3faa0
ld a, [wBattleResult] ld a, [wBattleResult]
and $f and $f
cp $1 cp $1
ld bc, $000d ld bc, 13
jr c, .asm_3fab4 jr c, .okay
ld bc, $000f ld bc, 15
jr z, .asm_3fab4 jr z, .okay
ld bc, $0011 ld bc, 17
.asm_3fab4 .okay
add hl, bc add hl, bc
call Function3fabe call Function3fabe
ret nc ret nc
@ -9268,9 +9272,9 @@ Function3fabe: ; 3fabe
Function3fac8: ; 3fac8 Function3fac8: ; 3fac8
ld b, $5 ld b, $5
ld hl, $b277 ld hl, s1_b277
ld de, DefaultFlypoint ld de, DefaultFlypoint
.asm_3fad0 .loop
push bc push bc
push de push de
push hl push hl
@ -9286,14 +9290,14 @@ Function3fac8: ; 3fac8
ld a, c ld a, c
ld [de], a ld [de], a
inc de inc de
ld bc, $0012 ld bc, 18
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
jr nz, .asm_3fad0 jr nz, .loop
ld b, $0 ld b, $0
ld c, $1 ld c, $1
.asm_3faed .loop2
ld a, b ld a, b
rept 2 rept 2
add b add b
@ -9318,45 +9322,45 @@ endr
ld c, $3 ld c, $3
call StringCmp call StringCmp
pop bc pop bc
jr z, .asm_3fb10 jr z, .equal
jr nc, .asm_3fb1f jr nc, .done
.asm_3fb10 .equal
inc c inc c
ld a, c ld a, c
cp $5 cp $5
jr nz, .asm_3faed jr nz, .loop2
inc b inc b
ld c, b ld c, b
inc c inc c
ld a, b ld a, b
cp $4 cp $4
jr nz, .asm_3faed jr nz, .loop2
ret ret
.asm_3fb1f .done
push bc push bc
ld a, b ld a, b
ld bc, $0012 ld bc, 18
ld hl, $b266 ld hl, s1_b266
call AddNTimes call AddNTimes
push hl push hl
ld de, DefaultFlypoint ld de, DefaultFlypoint
ld bc, $0012 ld bc, 18
call CopyBytes call CopyBytes
pop hl pop hl
pop bc pop bc
push hl push hl
ld a, c ld a, c
ld bc, $0012 ld bc, 18
ld hl, $b266 ld hl, s1_b266
call AddNTimes call AddNTimes
pop de pop de
push hl push hl
ld bc, $0012 ld bc, 18
call CopyBytes call CopyBytes
ld hl, DefaultFlypoint ld hl, DefaultFlypoint
ld bc, $0012 ld bc, 18
pop de pop de
call CopyBytes call CopyBytes
ret ret
@ -9374,10 +9378,10 @@ Function3fb54: ; 3fb54
ld a, [hld] ld a, [hld]
adc b adc b
ld b, a ld b, a
jr nc, .asm_3fb63 jr nc, .okay
inc e inc e
.asm_3fb63 .okay
ld a, [hld] ld a, [hld]
add c add c
ld c, a ld c, a
@ -9439,14 +9443,17 @@ Function3fbd6: ; 3fbd6
push af push af
ld a, $6 ld a, $6
ld [rSVBK], a ld [rSVBK], a
ld hl, w6_d000 ld hl, w6_d000
ld bc, $400 ld bc, w6_d400 - w6_d000
ld a, $7f ld a, " "
call ByteFill call ByteFill
ld de, w6_d000 ld de, w6_d000
ld hl, VBGMap0 ld hl, VBGMap0
lb bc, BANK(Function3fbd6), $40 lb bc, BANK(Function3fbd6), $40
call Request2bpp call Request2bpp
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret

View File

@ -81,13 +81,17 @@ s1_ad0f:: ds 1
box sBox box sBox
; b160 ; b160
ds $100 ds $f4
s1_b254:: ds $c
sLinkBattleStats:: ; b260 sLinkBattleStats:: ; b260
sLinkBattleWins:: ds 2 sLinkBattleWins:: ds 2
sLinkBattleLosses:: ds 2 sLinkBattleLosses:: ds 2 ; b262
sLinkBattleDraws:: ds 2 sLinkBattleDraws:: ds 2 ; b264
ds 90 s1_b266::
ds 17
s1_b277::
ds 73
sLinkBattleStatsEnd:: sLinkBattleStatsEnd::
sHallOfFame:: ; b2c0 sHallOfFame:: ; b2c0