deobfuscate some encounter asm

This commit is contained in:
yenatch 2013-08-26 19:47:42 -04:00
parent 17725d7af1
commit 9cf90f6c7b

View File

@ -2743,7 +2743,7 @@ Function184a: ; 184a
Function1852: ; 1852 Function1852: ; 1852
ld a, [StandingTile] ld a, [StandingTile]
call GetTileCollision call GetTileCollision
sub $1 sub 1
ret z ret z
and a and a
ret ret
@ -35345,11 +35345,12 @@ SECTION "bankA",ROMX,BANK[$A]
INCBIN "baserom.gbc", $28000, $2a0e7 - $28000 INCBIN "baserom.gbc", $28000, $2a0e7 - $28000
Function2a0e7: ; 2a0e7 Function2a0e7: ; 2a0e7
; Try to trigger a wild encounter.
call Function2a103 call Function2a103
jr nc, .asm_2a0f8 jr nc, .asm_2a0f8
call Function2a14f call Function2a14f
jr nz, .asm_2a0f8 jr nz, .asm_2a0f8
call $61df call Function2a1df
jr nc, .asm_2a0f8 jr nc, .asm_2a0f8
xor a xor a
ret ret
@ -35375,19 +35376,20 @@ Function2a103: ; 2a103
Function2a111: ; 2a111 Function2a111: ; 2a111
ld hl, $d25a ld hl, $d25a
call Function1852 call Function1852
ld a, $3 ld a, 3
jr z, .asm_2a11e jr z, .asm_2a11e
ld a, [TimeOfDay] ld a, [TimeOfDay]
.asm_2a11e .asm_2a11e
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld b, [hl] ld b, [hl]
ret ret
; 2a124 ; 2a124
Function2a124: ; 2a124 Function2a124: ; 2a124
; Pokemon March and Ruins of Alph signal double encounter rate.
; Pokemon Lullaby halves encounter rate.
ld a, [CurMusic] ld a, [CurMusic]
cp MUSIC_POKEMON_MARCH cp MUSIC_POKEMON_MARCH
jr z, .asm_2a135 jr z, .asm_2a135
@ -35404,17 +35406,18 @@ Function2a124: ; 2a124
; 2a138 ; 2a138
Function2a138: ; 2a138 Function2a138: ; 2a138
; Cleanse Tag halves encounter rate.
ld hl, PartyMon1Item ld hl, PartyMon1Item
ld de, $0030 ld de, PartyMon2 - PartyMon1
ld a, [PartyCount] ld a, [PartyCount]
ld c, a ld c, a
.asm_2a142 .next
ld a, [hl] ld a, [hl]
cp $5e cp CLEANSE_TAG
jr z, .asm_2a14c jr z, .asm_2a14c
add hl, de add hl, de
dec c dec c
jr nz, .asm_2a142 jr nz, .next
ret ret
.asm_2a14c .asm_2a14c
@ -35424,9 +35427,10 @@ Function2a138: ; 2a138
Function2a14f: ; 2a14f Function2a14f: ; 2a14f
call Function2a200 call Function2a200
jp nc, $61c1 jp nc, .asm_2a1c1
call Function2a2ce call Function2a2ce
jp c, $61c9 jp c, .asm_2a1c9
inc hl inc hl
inc hl inc hl
inc hl inc hl
@ -35436,7 +35440,7 @@ Function2a14f: ; 2a14f
inc hl inc hl
inc hl inc hl
ld a, [TimeOfDay] ld a, [TimeOfDay]
ld bc, $000e ld bc, $e
call AddNTimes call AddNTimes
ld de, $61cb ld de, $61cb
@ -35444,7 +35448,7 @@ Function2a14f: ; 2a14f
push hl push hl
.asm_2a175 .asm_2a175
call RNG call RNG
cp $64 cp 100
jr nc, .asm_2a175 jr nc, .asm_2a175
inc a inc a
ld b, a ld b, a
@ -35459,24 +35463,25 @@ Function2a14f: ; 2a14f
.asm_2a187 .asm_2a187
ld c, [hl] ld c, [hl]
ld b, $0 ld b, 0
pop hl pop hl
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld b, a ld b, a
call Function1852 call Function1852
jr nz, .asm_2a1aa jr nz, .asm_2a1aa
call RNG call RNG
cp $59 cp 89
jr c, .asm_2a1aa jr c, .asm_2a1aa
inc b inc b
cp $a5 cp 165
jr c, .asm_2a1aa jr c, .asm_2a1aa
inc b inc b
cp $d8 cp 216
jr c, .asm_2a1aa jr c, .asm_2a1aa
inc b inc b
cp $f2 cp 242
jr c, .asm_2a1aa jr c, .asm_2a1aa
inc b inc b
@ -35486,9 +35491,11 @@ Function2a14f: ; 2a14f
ld b, [hl] ld b, [hl]
call Function2a4a0 call Function2a4a0
jr c, .asm_2a1c1 jr c, .asm_2a1c1
ld a, b ld a, b
cp $c9 cp UNOWN
jr nz, .asm_2a1bf jr nz, .asm_2a1bf
ld a, [UnlockedUnowns] ld a, [UnlockedUnowns]
and a and a
jr z, .asm_2a1c1 jr z, .asm_2a1c1
@ -35497,25 +35504,29 @@ Function2a14f: ; 2a14f
jr .asm_2a1c5 jr .asm_2a1c5
.asm_2a1c1 .asm_2a1c1
ld a, $1 ld a, 1
and a and a
ret ret
.asm_2a1c5 .asm_2a1c5
ld a, b ld a, b
ld [$d22e], a ld [$d22e], a
.asm_2a1c9
xor a xor a
ret ret
; 2a1cb ; 2a1cb
INCBIN "baserom.gbc", $2a1cb, $2a1df - $2a1cb INCBIN "baserom.gbc", $2a1cb, $2a1df - $2a1cb
Function2a1df: ; 2a1df Function2a1df: ; 2a1df
ld a, [$dca1] ld a, [$dca1]
and a and a
jr z, .asm_2a1fe jr z, .asm_2a1fe
ld hl, PartyMon1CurHP ld hl, PartyMon1CurHP
ld bc, $002f ld bc, PartyMon2 - PartyMon1 - 1
.asm_2a1eb .asm_2a1eb
ld a, [hli] ld a, [hli]
or [hl] or [hl]
@ -35524,10 +35535,12 @@ Function2a1df: ; 2a1df
jr .asm_2a1eb jr .asm_2a1eb
.asm_2a1f2 .asm_2a1f2
; to PartyMonLevel
dec hl dec hl
dec hl dec hl
dec hl dec hl
dec hl dec hl
ld a, [CurPartyLevel] ld a, [CurPartyLevel]
cp [hl] cp [hl]
jr nc, .asm_2a1fe jr nc, .asm_2a1fe
@ -35544,25 +35557,26 @@ Function2a200: ; 2a200
jr z, .asm_2a21d jr z, .asm_2a21d
ld hl, WildMons5 ld hl, WildMons5
ld bc, $002f ld bc, $002f
call $623d call .asm_2a23d
ret c ret c
ld hl, WildMons1 ld hl, WildMons1
ld de, WildMons3 ld de, WildMons3
call $6235 call .asm_2a235
ld bc, $002f ld bc, $002f
jr .asm_2a27a jr .asm_2a27a
.asm_2a21d .asm_2a21d
ld hl, WildMons6 ld hl, WildMons6
ld bc, $0009 ld bc, $0009
call $623d call .asm_2a23d
ret c ret c
ld hl, WildMons2 ld hl, WildMons2
ld de, WildMons4 ld de, WildMons4
call $6235 call .asm_2a235
ld bc, $0009 ld bc, $0009
jr .asm_2a27a jr .asm_2a27a
.asm_2a235
call Function2f17 call Function2f17
and a and a
ret z ret z
@ -35570,7 +35584,8 @@ Function2a200: ; 2a200
ld l, e ld l, e
ret ret
call $627f .asm_2a23d
call Function2a27f
push hl push hl
ld hl, $dc20 ld hl, $dc20
bit 2, [hl] bit 2, [hl]
@ -35582,7 +35597,7 @@ Function2a200: ; 2a200
ld a, [$dfcd] ld a, [$dfcd]
cp e cp e
jr nz, .asm_2a25c jr nz, .asm_2a25c
call $6288 call Function2a288
jr nc, .asm_2a278 jr nc, .asm_2a278
scf scf
ret ret
@ -35599,7 +35614,7 @@ Function2a200: ; 2a200
ld a, [$dc5b] ld a, [$dc5b]
cp e cp e
jr nz, .asm_2a278 jr nz, .asm_2a278
call $6288 call Function2a288
jr nc, .asm_2a278 jr nc, .asm_2a278
scf scf
ret ret
@ -35609,16 +35624,19 @@ Function2a200: ; 2a200
ret ret
.asm_2a27a .asm_2a27a
call $627f call Function2a27f
jr .asm_2a288 jr Function2a288
; 2a27f
Function2a27f: ; 2a27f
ld a, [MapGroup] ld a, [MapGroup]
ld d, a ld d, a
ld a, [MapNumber] ld a, [MapNumber]
ld e, a ld e, a
ret ret
; 2a288
.asm_2a288 Function2a288: ; 2a288
push hl push hl
ld a, [hl] ld a, [hl]
inc a inc a
@ -35634,7 +35652,7 @@ Function2a200: ; 2a200
.asm_2a296 .asm_2a296
pop hl pop hl
add hl, bc add hl, bc
jr .asm_2a288 jr Function2a288
.asm_2a29a .asm_2a29a
pop hl pop hl
@ -35647,6 +35665,7 @@ Function2a200: ; 2a200
ret ret
; 2a2a0 ; 2a2a0
SpecialRoamMons: ; 2a2a0 SpecialRoamMons: ; 2a2a0
; initialize RoamMon structs ; initialize RoamMon structs
; include commented-out parts from the gs function ; include commented-out parts from the gs function
@ -35697,17 +35716,17 @@ Function2a2ce: ; 2a2ce
push hl push hl
call Function1852 call Function1852
jr z, .asm_2a30a jr z, .asm_2a30a
call $627f call Function2a27f
call RNG call RNG
cp $64 cp 100
jr nc, .asm_2a30a jr nc, .asm_2a30a
and $3 and 3
jr z, .asm_2a30a jr z, .asm_2a30a
dec a dec a
ld hl, RoamMon1MapGroup ld hl, RoamMon1MapGroup
ld c, a ld c, a
ld b, $0 ld b, 0
ld a, $7 ld a, 7
call AddNTimes call AddNTimes
ld a, d ld a, d
cp [hl] cp [hl]
@ -35723,7 +35742,7 @@ Function2a2ce: ; 2a2ce
ld [$d22e], a ld [$d22e], a
ld a, [hl] ld a, [hl]
ld [CurPartyLevel], a ld [CurPartyLevel], a
ld a, $5 ld a, BATTLETYPE_ROAMING
ld [BattleType], a ld [BattleType], a
pop hl pop hl
scf scf