ref: 9ce504f528a997b0d5bb1bd1c80fed91f9a8fa2a
parent: 9da5768b34316e5b6a68daa9e789c8163b31d4ad
parent: 849e5a7d0fe432944a2ad3722f72144b5f89cefa
author: Bryan Bishop <[email protected]>
date: Fri Aug 30 07:35:49 EDT 2013
Merge pull request #174 from yenatch/boxmons boxmons and related structs
--- a/main.asm
+++ b/main.asm
@@ -225,73 +225,24 @@
; 517
-IncGradGBPalTable_00: ; 517
- db %11111111 ; bgp
- db %11111111 ; obp1
- db %11111111 ; obp2
- ; and so on...
-IncGradGBPalTable_01: ; 51a
- db %11111110
- db %11111110
- db %11111110
-IncGradGBPalTable_02: ; 51d
- db %11111001
- db %11111001
- db %11111001
-IncGradGBPalTable_03: ; 520
- db %11100100
- db %11100100
- db %11100100
-IncGradGBPalTable_04: ; 523
- db %11100100
- db %11100100
- db %11100100
-IncGradGBPalTable_05: ; 526
- db %10010000
- db %10010000
- db %10010000
-IncGradGBPalTable_06: ; 529
- db %01000000
- db %01000000
- db %01000000
-IncGradGBPalTable_07: ; 52c
- db %00000000
- db %00000000
- db %00000000
-; 52f
-
-IncGradGBPalTable_08: ; 52f
- db %11111111
- db %11111111
- db %11111111
-IncGradGBPalTable_09: ; 532
- db %11111110
- db %11111110
- db %11111000
-IncGradGBPalTable_10: ; 535
- db %11111001
- db %11100100
- db %11100100
-IncGradGBPalTable_11: ; 538
- db %11100100
- db %11010000
- db %11100000
-IncGradGBPalTable_12: ; 53b
- db %11100100
- db %11010000
- db %11100000
-IncGradGBPalTable_13: ; 53e
- db %10010000
- db %10000000
- db %10010000
-IncGradGBPalTable_14: ; 541
- db %01000000
- db %01000000
- db %01000000
-IncGradGBPalTable_15: ; 544
- db %00000000
- db %00000000
- db %00000000
+; 517
+IncGradGBPalTable_00: db %11111111, %11111111, %11111111
+IncGradGBPalTable_01: db %11111110, %11111110, %11111110
+IncGradGBPalTable_02: db %11111001, %11111001, %11111001
+IncGradGBPalTable_03: db %11100100, %11100100, %11100100
+IncGradGBPalTable_04: db %11100100, %11100100, %11100100
+IncGradGBPalTable_05: db %10010000, %10010000, %10010000
+IncGradGBPalTable_06: db %01000000, %01000000, %01000000
+IncGradGBPalTable_07: db %00000000, %00000000, %00000000
+; bgp obp1 obp2
+IncGradGBPalTable_08: db %11111111, %11111111, %11111111
+IncGradGBPalTable_09: db %11111110, %11111110, %11111000
+IncGradGBPalTable_10: db %11111001, %11100100, %11100100
+IncGradGBPalTable_11: db %11100100, %11010000, %11100000
+IncGradGBPalTable_12: db %11100100, %11010000, %11100000
+IncGradGBPalTable_13: db %10010000, %10000000, %10010000
+IncGradGBPalTable_14: db %01000000, %01000000, %01000000
+IncGradGBPalTable_15: db %00000000, %00000000, %00000000
; 547
@@ -781,7 +732,7 @@
.asm_763
ld a, [hl]
ld [$ffcd], a
- call $078a
+ call Function78a
push bc
ld b, a
inc hl
@@ -829,9 +780,9 @@
ld a, [$ffcb]
cp $1
jr nz, .asm_7c0
- call $082b
+ call Function82b
jr z, .asm_7c0
- call $0825
+ call .asm_825
push hl
ld hl, $cf5c
inc [hl]
@@ -841,9 +792,9 @@
.asm_7b7
pop hl
- call $082b
+ call Function82b
jr nz, .asm_79b
- jp $0833
+ jp Function833
.asm_7c0
ld a, [rIE]
@@ -881,7 +832,7 @@
ld a, [$ffce]
cp $fe
ret nz
- call $082b
+ call Function82b
jr z, .asm_813
push hl
ld hl, $cf5c
@@ -894,8 +845,8 @@
.asm_80d
pop hl
- call $082b
- jr z, .asm_833
+ call Function82b
+ jr z, Function833
.asm_813
ld a, [rIE]
@@ -906,14 +857,17 @@
ld a, [hl]
ld [$ffcd], a
call DelayFrame
- jp $078a
+ jp Function78a
+.asm_825
ld a, $f
.asm_827
dec a
jr nz, .asm_827
ret
+; 82b
+Function82b: ; 82b
push hl
ld hl, $cf5b
ld a, [hli]
@@ -920,8 +874,9 @@
or [hl]
pop hl
ret
+; 833
-.asm_833
+Function833: ; 833
dec a
ld [$cf5b], a
ld [$cf5c], a
@@ -974,9 +929,9 @@
ld a, $ff
ld [$cf52], a
.asm_882
- call $08c1
+ call Function8c1
call DelayFrame
- call $082b
+ call Function82b
jr z, .asm_89e
push hl
ld hl, $cf5c
@@ -987,7 +942,7 @@
jr nz, .asm_89d
pop hl
xor a
- jp $0833
+ jp Function833
.asm_89d
pop hl
@@ -999,13 +954,13 @@
ld b, $a
.asm_8a6
call DelayFrame
- call $08c1
+ call Function8c1
dec b
jr nz, .asm_8a6
ld b, $a
.asm_8b1
call DelayFrame
- call $0908
+ call Function908
dec b
jr nz, .asm_8b1
ld a, [$cf52]
@@ -1027,7 +982,7 @@
ld b, $80
.asm_8d7
- call $08f3
+ call Function8f3
ld a, [$cf56]
add b
ld [$ffcd], a
@@ -1040,7 +995,7 @@
ld [rSC], a
.asm_8ee
- call $08f3
+ call Function8f3
pop bc
ret
; 8f3
@@ -1133,7 +1088,7 @@
ld a, $1
ld [hOAMUpdate], a
call WaitBGMap
- call $0a36
+ call Functiona36
pop af
ld [hOAMUpdate], a
ret
@@ -1184,7 +1139,7 @@
.asm_a8d
push hl
ld hl, $c606
- call $0b06
+ call Functionb06
pop hl
call Functiona57
ld a, [$ffa9]
@@ -4712,7 +4667,7 @@
Function2173: ; 2173
call Function217a
- call $0db1
+ call Functiondb1
ret
; 217a
@@ -6613,16 +6568,19 @@
call Function2bae
call Function1ad2
call Function1d7d
- call $0d90
- jr .asm_2b5c
+ call Functiond90
+ jr Function2b5c
+; 2b4c
+Function2b4c: ; 2b4c
call WhiteBGMap
call Function1d7d
call Function2bae
call Function1ad2
- call $0d90
+ call Functiond90
+; 2b5c
-.asm_2b5c
+Function2b5c: ; 2b5c
ld b, $9
call GetSGBLayout
ld a, $12
@@ -6670,7 +6628,7 @@
ld a, $5
ld hl, $4168
rst FarCall
- call $0e51
+ call Functione51
call Functione5f
ld a, [hROMBank]
push af
@@ -8237,6 +8195,8 @@
Function31cd: ; 31cd
ld a, [hROMBank]
+
+Function31cf: ; 31cf
ld [$d0e8], a
ld a, l
ld [$d0e9], a
@@ -15221,7 +15181,7 @@
ld [$ffde], a
call ClearTileMap
call Functione5f
- call $0e51
+ call Functione51
call Function1fbf
ret
; 5b54
@@ -15320,7 +15280,7 @@
call Function5ca6
ld a, $1
call GetSRAMBank
- ld hl, $ad10
+ ld hl, BoxCount
call Function5ca1
call CloseSRAM
ld hl, NumItems
@@ -15638,7 +15598,7 @@
; 5e48
Function5e48: ; 5e48
- call $06e3
+ call Function6e3
and $80
jr z, .asm_5e5b
ld a, $8
@@ -15677,7 +15637,7 @@
; 5e85
Function5e85: ; 5e85
- call $06e3
+ call Function6e3
and $80
jr z, .asm_5e93
ld de, $0408
@@ -15847,7 +15807,7 @@
ld a, $24
ld hl, $4672
rst FarCall
- call $04dd
+ call Function4dd
call ClearTileMap
ld de, MUSIC_ROUTE_30
@@ -16635,7 +16595,7 @@
ld a, $90
ld [hWY], a
call Function2e31
- call $0e51
+ call Functione51
ret
; 64db
@@ -18768,7 +18728,7 @@
call Function1b3f
ld a, [CurFruit]
dec a
- jr z, .asm_833b
+ jr z, Function833b
ld a, [$ffe0]
ld b, a
ld c, $0
@@ -18776,7 +18736,7 @@
call Function8341
call Function1b35
-.asm_833b
+Function833b
ld a, $47
call Function1b3f
ret
@@ -22862,39 +22822,41 @@
Functiondcb6: ; dcb6
+
ld a, b
- ld hl, $ad26
- ld bc, $0020
+ ld hl, BoxMons
+ ld bc, BoxMon2 - BoxMon1
call AddNTimes
ld b, h
ld c, l
- ld hl, $0017
+ ld hl, BoxMon1PP - BoxMon1
add hl, bc
push hl
push bc
ld de, TempMonPP
- ld bc, $0004
+ ld bc, NUM_MOVES
call CopyBytes
pop bc
- ld hl, $0002
+ ld hl, BoxMon1Moves - BoxMon1
add hl, bc
push hl
- ld de, TempMonMove1
- ld bc, $0004
+ ld de, TempMonMoves
+ ld bc, NUM_MOVES
call CopyBytes
pop hl
pop de
+
ld a, [$cfa9]
push af
ld a, [MonType]
push af
- ld b, $0
+ ld b, 0
.asm_dcec
ld a, [hli]
and a
jr z, .asm_dd18
ld [TempMonMove1], a
- ld a, $2
+ ld a, BOXMON
ld [MonType], a
ld a, b
ld [$cfa9], a
@@ -22916,7 +22878,7 @@
inc de
inc b
ld a, b
- cp $4
+ cp NUM_MOVES
jr c, .asm_dcec
.asm_dd18
@@ -22927,15 +22889,16 @@
ret
; dd21
+
INCBIN "baserom.gbc", $dd21, $de6e - $dd21
Functionde6e: ; de6e
- ld a, $1
+ ld a, 1 ; BANK(BoxCount)
call GetSRAMBank
- ld de, $ad10
+ ld de, BoxCount
ld a, [de]
- cp $14
+ cp 20
jp nc, Functiondf42
inc a
ld [de], a
@@ -22952,21 +22915,21 @@
inc a
jr nz, .asm_de85
call GetBaseData
- call Functiondf47
+ call ShiftBoxMon
ld hl, PlayerName
- ld de, $afa6
- ld bc, $000b
+ ld de, BoxMonOT
+ ld bc, BoxMon2OT - BoxMon1OT
call CopyBytes
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
- ld de, $b082
+ ld de, BoxMon1Nickname
ld hl, StringBuffer1
- ld bc, $000b
+ ld bc, BoxMon2Nickname - BoxMon1Nickname
call CopyBytes
- ld hl, EnemyMonSpecies
- ld de, $ad26
- ld bc, $0006
+ ld hl, EnemyMon
+ ld de, BoxMon1
+ ld bc, 6 ; species + item + moves
call CopyBytes
ld hl, PlayerID
ld a, [hli]
@@ -23022,9 +22985,9 @@
dec a
call SetSeenAndCaughtMon
ld a, [CurPartySpecies]
- cp $c9
+ cp UNOWN
jr nz, .asm_df20
- ld hl, $ad3b
+ ld hl, BoxMon1DVs
ld a, $2d
call Predef
ld hl, $7a18
@@ -23032,15 +22995,15 @@
rst FarCall
.asm_df20
- ld hl, $ad28
+ ld hl, BoxMon1Moves
ld de, TempMonMove1
- ld bc, $0004
+ ld bc, NUM_MOVES
call CopyBytes
- ld hl, $ad3d
+ ld hl, BoxMon1PP
ld de, TempMonPP
- ld bc, $0004
+ ld bc, NUM_MOVES
call CopyBytes
- ld b, $0
+ ld b, 0
call Functiondcb6
call CloseSRAM
scf
@@ -23053,18 +23016,23 @@
ret
; df47
-Functiondf47: ; df47
- ld hl, $afa6
- ld bc, $000b
- call $5f5f
- ld hl, $b082
- ld bc, $000b
- call $5f5f
- ld hl, $ad26
- ld bc, $0020
- ld a, [$ad10]
- cp $2
+ShiftBoxMon: ; df47
+ ld hl, BoxMonOT
+ ld bc, BoxMon2OT - BoxMon1OT
+ call .asm_df5f
+
+ ld hl, BoxMonNicknames
+ ld bc, BoxMon2Nickname - BoxMon1Nickname
+ call .asm_df5f
+
+ ld hl, BoxMons
+ ld bc, BoxMon2 - BoxMon1
+
+.asm_df5f
+ ld a, [BoxCount]
+ cp 2
ret c
+
push hl
call AddNTimes
dec hl
@@ -23071,19 +23039,21 @@
ld e, l
ld d, h
pop hl
- ld a, [$ad10]
+
+ ld a, [BoxCount]
dec a
call AddNTimes
dec hl
+
push hl
- ld a, [$ad10]
+ ld a, [BoxCount]
dec a
- ld hl, $0000
+ ld hl, 0
call AddNTimes
ld c, l
ld b, h
pop hl
-.asm_df83
+.loop
ld a, [hld]
ld [de], a
dec de
@@ -23090,7 +23060,7 @@
dec bc
ld a, c
or b
- jr nz, .asm_df83
+ jr nz, .loop
ret
; df8c
@@ -23187,13 +23157,16 @@
Functione039: ; e039
+
ld hl, PartyCount
+
ld a, [$d10b]
and a
jr z, .asm_e04a
- ld a, $1
+
+ ld a, 1 ; BANK(BoxCount)
call GetSRAMBank
- ld hl, $ad10
+ ld hl, BoxCount
.asm_e04a
ld a, [hl]
@@ -23201,7 +23174,7 @@
ld [hli], a
ld a, [CurPartyMon]
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
ld e, l
ld d, h
@@ -23217,7 +23190,7 @@
ld a, [$d10b]
and a
jr z, .asm_e06d
- ld hl, $afa6
+ ld hl, BoxMonOT
ld d, $13
.asm_e06d
@@ -23227,7 +23200,7 @@
cp d
jr nz, .asm_e07e
ld [hl], $ff
- jp $60f0
+ jp .asm_60f0
.asm_e07e
ld d, h
@@ -23238,17 +23211,17 @@
ld a, [$d10b]
and a
jr z, .asm_e090
- ld bc, $b082
-
+ ld bc, BoxMonNicknames
.asm_e090
call CopyDataUntil
- ld hl, PartyMon1Species
- ld bc, $0030
+
+ ld hl, PartyMons
+ ld bc, PartyMon2 - PartyMon1
ld a, [$d10b]
and a
jr z, .asm_e0a5
- ld hl, $ad26
- ld bc, $0020
+ ld hl, BoxMons
+ ld bc, BoxMon2 - BoxMon1
.asm_e0a5
ld a, [CurPartyMon]
@@ -23258,13 +23231,13 @@
ld a, [$d10b]
and a
jr z, .asm_e0bc
- ld bc, $0020
+ ld bc, BoxMon2 - BoxMon1
add hl, bc
- ld bc, $afa6
+ ld bc, BoxMonOT
jr .asm_e0c3
.asm_e0bc
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
add hl, bc
ld bc, PartyMon1OT
@@ -23274,24 +23247,26 @@
ld a, [$d10b]
and a
jr z, .asm_e0d2
- ld hl, $b082
+ ld hl, BoxMonNicknames
.asm_e0d2
- ld bc, $000b
+ ld bc, BoxMon2Nickname - BoxMon1Nickname
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
- ld bc, $000b
+ ld bc, BoxMon2Nickname - BoxMon1Nickname
add hl, bc
- ld bc, $de83
+ ld bc, PartyMonNicknamesEnd
ld a, [$d10b]
and a
jr z, .asm_e0ed
- ld bc, $b15e
+ ld bc, BoxMonNicknamesEnd
.asm_e0ed
call CopyDataUntil
+
+.asm_60f0
ld a, [$d10b]
and a
jp nz, CloseSRAM
@@ -24283,22 +24258,22 @@
push af
ld a, [MonType]
and a
- ld hl, PartyMon1Move1
- ld bc, $0030
+ ld hl, PartyMon1Moves
+ ld bc, PartyMon2 - PartyMon1
jr z, .asm_f91a
- ld hl, OTPartyMon1Move1
+ ld hl, OTPartyMon1Moves
dec a
jr z, .asm_f91a
- ld hl, TempMonMove1
+ ld hl, TempMonMoves
dec a
jr z, .asm_f915
- ld hl, TempMonMove1
+ ld hl, TempMonMoves
dec a
jr z, .asm_f915
- ld hl, BattleMonMove1
+ ld hl, BattleMonMoves
.asm_f915
- call $7969
+ call Function7969
jr .asm_f91d
.asm_f91a
@@ -24320,7 +24295,7 @@
push bc
ld bc, $0015
ld a, [MonType]
- cp $4
+ cp WILDMON
jr nz, .asm_f942
ld bc, $0006
@@ -24349,6 +24324,8 @@
Functionf963: ; f963
ld a, [CurPartyMon]
call AddNTimes
+
+Function7969: ; 7969
ld a, [$cfa9]
ld c, a
ld b, $0
@@ -25059,7 +25036,7 @@
Function11c51: ; 11c51
call ClearSprites
callab Function8cf53
- call $0e51
+ call Functione51
call Functione5f
ld de, $5e65
ld hl, $8eb0
@@ -25391,7 +25368,7 @@
call MenuFunc_1e7f
call .DrawBugContestStatus
call Function1ad2
- call $0d90
+ call Functiond90
call $2b5c
ret
; 126d3
@@ -25661,7 +25638,7 @@
jr c, .asm_12903
ld a, $4
ld hl, $760b
- call $31cf
+ call Function31cf
ld a, 4
ret
.asm_12903
@@ -27623,7 +27600,7 @@
; 140ae
Function140ae: ; 140ae
- call $06e3
+ call Function6e3
ld c, a
and $c0
jr nz, .asm_140c8
@@ -33031,7 +33008,7 @@
call Function2173
call Function321c
call Function1ad2
- call $0e51
+ call Functione51
ret
; 24547
@@ -47603,7 +47580,7 @@
; 414fb
Function414fb: ; 414fb
- call $0e51
+ call Functione51
ld hl, VTiles1
ld bc, $0800
.asm_41504
@@ -49606,7 +49583,7 @@
Function49e27: ; 49e27
- call $06e3
+ call Function6e3
and $80
jr nz, .asm_49e39
ld hl, $c5b8
@@ -49625,7 +49602,7 @@
ld a, [$cfcd]
and a
ret z
- call $06e3
+ call Function6e3
and $80
jp nz, Function49e75
call UpdateTime
@@ -49700,7 +49677,7 @@
ld [$ffde], a
call ClearTileMap
call Functione5f
- call $0e51
+ call Functione51
call Function1fbf
ret
; 49ee0
@@ -51980,7 +51957,7 @@
call ClearTileMap
call ClearSprites
call DisableLCD
- call $0e51
+ call Functione51
call $0e58
ld hl, VBGMap0
ld bc, VBlank5
@@ -52009,7 +51986,7 @@
call ClearTileMap
call ClearSprites
call DisableLCD
- call $0e51
+ call Functione51
call $0e58
ld hl, VBGMap0
ld bc, VBlank5
@@ -53665,9 +53642,9 @@
jr .asm_50905
.asm_508f1
- ld a, $1
+ ld a, 1 ; BANK(BoxSpecies)
call GetSRAMBank
- ld hl, $ad11
+ ld hl, BoxSpecies
call .asm_50905
call CloseSRAM
ret
@@ -53961,13 +53938,13 @@
jr z, .PartyMon
; 2: BoxMon
- ld hl, $ad26 + $15 ; BoxMon1DVs
- ld bc, $20 ; BoxMon2 - BoxMon1
+ ld hl, BoxMon1DVs
+ ld bc, BoxMon2 - BoxMon1
dec a
jr z, .BoxMon
; 3: Unknown
- ld hl, TempMonDVs ; DVBuffer
+ ld hl, TempMonDVs
dec a
jr z, .DVs
@@ -65776,8 +65753,8 @@
Functione4670: ; e4670
ld a, [$cf63]
ld e, a
- ld d, $0
- ld hl, $467f
+ ld d, 0
+ ld hl, .pointers
add hl, de
add hl, de
ld a, [hli]
@@ -65786,9 +65763,92 @@
jp [hl]
; e467f
-INCBIN "baserom.gbc", $e467f, $e48ac - $e467f
+.pointers
+ dw Functione468c
+ dw Functione468d
+ dw Functione46ba
+ dw Functione46dd
+; e4687
+Functione4687: ; e4687
+ ld hl, $cf63
+ inc [hl]
+ ret
+; e468c
+Functione468c: ; e468c
+ ret
+; e468d
+
+Functione468d: ; e468d
+ ld hl, $cf65
+ ld a, [hl]
+ cp $20
+ jr nc, .asm_e4697
+ inc [hl]
+ ret
+
+.asm_e4697
+ ld [hl], 0
+ ld hl, .GAME_FREAK
+ decoord 5, 10
+ ld bc, .end - .GAME_FREAK
+ call CopyBytes
+ call Functione4687
+ ld de, SFX_GAME_FREAK_PRESENTS
+ call StartSFX
+ ret
+; e46af
+
+.GAME_FREAK
+ ; G A M E _ F R E A K
+ db 0, 1, 2, 3, 13, 4, 5, 3, 1, 6
+.end
+ db "@"
+; e46ba
+
+Functione46ba: ; e46ba
+ ld hl, $cf65
+ ld a, [hl]
+ cp $40
+ jr nc, .asm_e46c4
+ inc [hl]
+ ret
+
+.asm_e46c4
+ ld [hl], 0
+ ld hl, .presents
+ decoord 7,11
+ ld bc, .end - .presents
+ call CopyBytes
+ call Functione4687
+ ret
+; e46d6
+
+.presents
+ db 7, 8, 9, 10, 11, 12
+.end
+ db "@"
+; e46dd
+
+Functione46dd: ; e46dd
+ ld hl, $cf65
+ ld a, [hl]
+ cp $80
+ jr nc, .asm_e46e7
+ inc [hl]
+ ret
+
+.asm_e46e7
+ ld hl, $cf63
+ set 7, [hl]
+ ret
+; e46ed
+
+
+INCBIN "baserom.gbc", $e46ed, $e48ac - $e46ed
+
+
Functione48ac: ; e48ac
ld a, [rSVBK]
push af
@@ -65799,6 +65859,8 @@
ld a, [$ff9e]
push af
call Functione4901
+
+Functione48bc: ; e48bc
call Functiona57
ld a, [$ffa9]
and $f
@@ -65809,7 +65871,7 @@
call Functione490f
callba Function8cf69
call DelayFrame
- jp $48bc
+ jp Functione48bc
.asm_e48db
ld de, $0000
@@ -71815,9 +71877,109 @@
db "Please wait…", $57
; 0x11ac3e
-INCBIN "baserom.gbc", $11ac3e, $11bc9e - $11ac3e
+INCBIN "baserom.gbc", $11ac3e, $11b98f - $11ac3e
+Function11b98f: ; 11b98f
+ ld hl, PartyCount
+ ld a, [hl]
+ ld e, a
+ inc [hl]
+ ld a, [BGMapBuffer]
+ ld l, a
+ ld a, [$cd21]
+ ld h, a
+ inc hl
+ ld bc, PartySpecies
+ ld d, e
+.asm_11b9a2
+ inc bc
+ dec d
+ jr nz, .asm_11b9a2
+ ld a, e
+ ld [CurPartyMon], a
+ ld a, [hl]
+ ld [bc], a
+ inc bc
+ ld a, $ff
+ ld [bc], a
+ ld hl, PartyMon1Species
+ ld bc, $0030
+ ld a, e
+ ld [$cd2a], a
+.asm_11b9ba
+ add hl, bc
+ dec a
+ and a
+ jr nz, .asm_11b9ba
+ ld e, l
+ ld d, h
+ ld a, [CreditsTimer]
+ ld l, a
+ ld a, [$cd23]
+ ld h, a
+ ld bc, $0030
+ call CopyBytes
+ ld hl, PartyMon1OT
+ ld bc, $000b
+ ld a, [$cd2a]
+.asm_11b9d8
+ add hl, bc
+ dec a
+ and a
+ jr nz, .asm_11b9d8
+ ld e, l
+ ld d, h
+ ld a, [$cd24]
+ ld l, a
+ ld a, [$cd25]
+ ld h, a
+ ld bc, $000a
+ call CopyBytes
+ ld a, $50
+ ld [de], a
+ ld hl, PartyMon1Nickname
+ ld bc, $000b
+ ld a, [$cd2a]
+.asm_11b9f9
+ add hl, bc
+ dec a
+ and a
+ jr nz, .asm_11b9f9
+ ld e, l
+ ld d, h
+ ld a, [$cd26]
+ ld l, a
+ ld a, [$cd27]
+ ld h, a
+ ld bc, $000a
+ call CopyBytes
+ ld a, $50
+ ld [de], a
+ ld hl, $a600
+ ld bc, $002f
+ ld a, [$cd2a]
+.asm_11ba1a
+ add hl, bc
+ dec a
+ and a
+ jr nz, .asm_11ba1a
+ ld a, $0
+ call GetSRAMBank
+ ld e, l
+ ld d, h
+ ld a, [$cd28]
+ ld l, a
+ ld a, [$cd29]
+ ld h, a
+ ld bc, $002f
+ call CopyBytes
+ call CloseSRAM
+ ret
+; 11ba38
+INCBIN "baserom.gbc", $11ba38, $11bc9e - $11ba38
+
+
SECTION "bank47",ROMX,BANK[$47]
Function11c000: ; 11c000
@@ -72947,7 +73109,7 @@
ld bc, $0310
xor a
call ByteFill
- call $0e51
+ call Functione51
call Functione5f
ld hl, $4b83
ld de, TileMap
@@ -73932,7 +74094,106 @@
INCLUDE "stats/battle_tower.asm"
; 1fb4b6
-INCBIN "baserom.gbc", $1fb4b6, $1fb8a8 - $1fb4b6
+
+GiveOddEgg: ; 1fb4b6
+
+; Figure out which egg to give.
+ call RNG
+ ld hl, .Probabilities
+ ld c, 0
+ ld b, c
+.next
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, d
+ cp $ff
+ jr nz, .first
+ ld a, e
+ cp $ff
+ jr z, .done
+.first
+ ld a, [hRandomSub]
+ cp d
+ jr c, .done
+ jr z, .second
+ jr .good
+.second
+ ld a, [hRandomAdd]
+ cp e
+ jr c, .done
+ jr z, .done
+.good
+ inc bc
+ jr .next
+.done
+
+ ld hl, OddEggs
+ ld a, OddEgg2 - OddEgg1
+ call AddNTimes
+ ld de, EnemyMoveAnimation
+ ld bc, $0046
+ call CopyBytes
+ ld a, EGG_TICKET
+ ld [CurItem], a
+ ld a, $1
+ ld [$d10c], a
+ ld a, $ff
+ ld [$d107], a
+ ld hl, NumItems
+ call Function2f53
+ ld a, EGG
+ ld [$cd2a], a
+ ld a, $29
+ ld [$cd20], a
+ ld a, $cd
+ ld [$cd21], a
+ ld a, $8
+ ld [$cd22], a
+ ld a, $c6
+ ld [$cd23], a
+
+ ld hl, .Odd
+ ld de, $cd2b
+ ld bc, $000b
+ call CopyBytes
+
+ ld a, $2b
+ ld [$cd24], a
+ ld a, $cd
+ ld [$cd25], a
+ ld a, $38
+ ld [$cd26], a
+ ld a, $c6
+ ld [$cd27], a
+ callba Function11b98f
+ ret
+; 1fb546
+
+.Odd
+ db "ODD@@@@@@@@@"
+
+.Probabilities
+ dw $147a ; 92% -> 8%
+ dw $170a ; 91% -> 1%
+ dw $3fff ; 75% -> 16%
+ dw $47ad ; 72% -> 3%
+ dw $70a3 ; 56% -> 16%
+ dw $7851 ; 53% -> 3%
+ dw $9c28 ; 39% -> 14%
+ dw $a147 ; 37% -> 2%
+ dw $bae0 ; 27% -> 10%
+ dw $bfff ; 25% -> 2%
+ dw $deb7 ; 13% -> 12%
+ dw $e3d6 ; 11% -> 2%
+ dw $fd6f ; 1% -> 10%
+ dw $ffff ; 0% -> 1%
+; 1fb56e
+
+OddEggs: ; 1fb56e
+ INCLUDE "stats/odd_eggs.asm"
+; 1fb8a8
SECTION "bank7F",ROMX,BANK[$7F]
--- /dev/null
+++ b/stats/odd_eggs.asm
@@ -1,0 +1,366 @@
+OddEgg1:
+ db PICHU
+ db NO_ITEM
+ db THUNDERSHOCK, CHARM, DIZZY_PUNCH, NONE
+ dw 02048 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 30, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 17 ; Max HP
+ bigdw 9 ; Atk
+ bigdw 6 ; Def
+ bigdw 11 ; Spd
+ bigdw 8 ; SAtk
+ bigdw 8 ; SDef
+ db "EGG@@@@@@@@"
+
+OddEgg2:
+ db PICHU
+ db NO_ITEM
+ db THUNDERSHOCK, CHARM, DIZZY_PUNCH, NONE
+ dw 00256 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 30, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 17 ; Max HP
+ bigdw 9 ; Atk
+ bigdw 7 ; Def
+ bigdw 12 ; Spd
+ bigdw 9 ; SAtk
+ bigdw 9 ; SDef
+ db "EGG@@@@@@@@"
+
+ db CLEFFA
+ db NO_ITEM
+ db POUND, CHARM, DIZZY_PUNCH, NONE
+ dw 04096 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 35, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 20 ; Max HP
+ bigdw 7 ; Atk
+ bigdw 7 ; Def
+ bigdw 6 ; Spd
+ bigdw 9 ; SAtk
+ bigdw 10 ; SDef
+ db "EGG@@@@@@@@"
+
+ db CLEFFA
+ db NO_ITEM
+ db POUND, CHARM, DIZZY_PUNCH, NONE
+ dw 00768 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 35, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 20 ; Max HP
+ bigdw 7 ; Atk
+ bigdw 8 ; Def
+ bigdw 7 ; Spd
+ bigdw 10 ; SAtk
+ bigdw 11 ; SDef
+ db "EGG@@@@@@@@"
+
+ db IGGLYBUFF
+ db NO_ITEM
+ db SING, CHARM, DIZZY_PUNCH, NONE
+ dw 04096 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 15, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 24 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 6 ; Def
+ bigdw 6 ; Spd
+ bigdw 9 ; SAtk
+ bigdw 7 ; SDef
+ db "EGG@@@@@@@@"
+
+ db IGGLYBUFF
+ db NO_ITEM
+ db SING, CHARM, DIZZY_PUNCH, NONE
+ dw 00768 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 15, 20, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 24 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 7 ; Def
+ bigdw 7 ; Spd
+ bigdw 10 ; SAtk
+ bigdw 8 ; SDef
+ db "EGG@@@@@@@@"
+
+ db SMOOCHUM
+ db NO_ITEM
+ db POUND, LICK, DIZZY_PUNCH, NONE
+ dw 03584 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 35, 30, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 6 ; Def
+ bigdw 11 ; Spd
+ bigdw 13 ; SAtk
+ bigdw 11 ; SDef
+ db "EGG@@@@@@@@"
+
+ db SMOOCHUM
+ db NO_ITEM
+ db POUND, LICK, DIZZY_PUNCH, NONE
+ dw 00512 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 35, 30, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 7 ; Def
+ bigdw 12 ; Spd
+ bigdw 14 ; SAtk
+ bigdw 12 ; SDef
+ db "EGG@@@@@@@@"
+
+ db MAGBY
+ db NO_ITEM
+ db EMBER, DIZZY_PUNCH, NONE, NONE
+ dw 02560 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 25, 10, 0, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 12 ; Atk
+ bigdw 8 ; Def
+ bigdw 13 ; Spd
+ bigdw 12 ; SAtk
+ bigdw 10 ; SDef
+ db "EGG@@@@@@@@"
+
+ db MAGBY
+ db NO_ITEM
+ db EMBER, DIZZY_PUNCH, NONE, NONE
+ dw 00512 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 25, 10, 0, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 12 ; Atk
+ bigdw 9 ; Def
+ bigdw 14 ; Spd
+ bigdw 13 ; SAtk
+ bigdw 11 ; SDef
+ db "EGG@@@@@@@@"
+
+ db ELEKID
+ db NO_ITEM
+ db QUICK_ATTACK, LEER, DIZZY_PUNCH, NONE
+ dw 03072 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 30, 30, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 11 ; Atk
+ bigdw 8 ; Def
+ bigdw 14 ; Spd
+ bigdw 11 ; SAtk
+ bigdw 10 ; SDef
+ db "EGG@@@@@@@@"
+
+ db ELEKID
+ db NO_ITEM
+ db QUICK_ATTACK, LEER, DIZZY_PUNCH, NONE
+ dw 00512 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 30, 30, 10, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 19 ; Max HP
+ bigdw 11 ; Atk
+ bigdw 9 ; Def
+ bigdw 15 ; Spd
+ bigdw 12 ; SAtk
+ bigdw 11 ; SDef
+ db "EGG@@@@@@@@"
+
+ db TYROGUE
+ db NO_ITEM
+ db TACKLE, DIZZY_PUNCH, NONE, NONE
+ dw 02560 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $0, $0 ; DVs
+ db 35, 10, 0, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 18 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 8 ; Def
+ bigdw 8 ; Spd
+ bigdw 8 ; SAtk
+ bigdw 8 ; SDef
+ db "EGG@@@@@@@@"
+
+ db TYROGUE
+ db NO_ITEM
+ db TACKLE, DIZZY_PUNCH, NONE, NONE
+ dw 00256 ; OT ID
+ dt 125 ; Exp
+ ; Stat exp
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ bigdw 0
+ db $2a, $aa ; DVs
+ db 35, 10, 0, 0 ; PP
+ db 20 ; Happiness
+ db 0, 0, 0 ; Pokerus, Caught data
+ db 5 ; Level
+ db 0, 0 ; Status
+ bigdw 0 ; HP
+ bigdw 18 ; Max HP
+ bigdw 8 ; Atk
+ bigdw 9 ; Def
+ bigdw 9 ; Spd
+ bigdw 9 ; SAtk
+ bigdw 9 ; SDef
+ db "EGG@@@@@@@@"
+
--- a/wram.asm
+++ b/wram.asm
@@ -1982,6 +1982,7 @@
ds 11
PartyMon6Nickname: ; de78
ds 11
+PartyMonNicknamesEnd
SECTION "Pokedex",WRAMX[$de99],BANK[1]
PokedexSeen: ; de99
@@ -2098,4 +2099,178 @@
ds $40
OBPals:
ds $40
+
+
+
+SECTION "SRAMBank1",SRAM,BANK[1]
+
+SECTION "BoxMons",SRAM[$ad10],BANK[1]
+BoxCount: ; ad10
+ ds 1
+BoxSpecies: ; ad11
+ ds 20
+ ds 1
+BoxMons:
+BoxMon1:
+BoxMon1Species: ; ad26
+ ds 1
+BoxMon1Item: ; ad27
+ ds 1
+BoxMon1Moves: ; ad28
+ ds 4
+BoxMon1ID: ; ad2c
+ ds 2
+BoxMon1Exp: ; ad2e
+ ds 3
+BoxMon1HPExp: ; ad31
+ ds 2
+BoxMon1AtkExp: ; ad33
+ ds 2
+BoxMon1DefExp: ; ad35
+ ds 2
+BoxMon1SpdExp: ; ad37
+ ds 2
+BoxMon1SpcExp: ; ad39
+ ds 2
+BoxMon1DVs: ; ad3b
+ ds 2
+BoxMon1PP: ; ad3d
+ ds 4
+BoxMon1Happiness: ; ad41
+ ds 1
+BoxMon1PokerusStatus: ; ad42
+ ds 1
+BoxMon1CaughtData:
+BoxMon1CaughtTime:
+BoxMon1CaughtLevel: ; ad43
+ ds 1
+BoxMon1CaughtGender:
+BoxMon1CaughtLocation: ; ad44
+ ds 1
+BoxMon1Level: ; ad45
+ ds 1
+
+BoxMon2: ; ad46
+ ds 32
+BoxMon3: ; ad66
+ ds 32
+BoxMon4: ; ad86
+ ds 32
+BoxMon5: ; ada6
+ ds 32
+BoxMon6: ; adc6
+ ds 32
+BoxMon7: ; ade6
+ ds 32
+BoxMon8: ; ae06
+ ds 32
+BoxMon9: ; ae26
+ ds 32
+BoxMon10: ; ae46
+ ds 32
+BoxMon11: ; ae66
+ ds 32
+BoxMon12: ; ae86
+ ds 32
+BoxMon13: ; aea6
+ ds 32
+BoxMon14: ; aec6
+ ds 32
+BoxMon15: ; aee6
+ ds 32
+BoxMon16: ; af06
+ ds 32
+BoxMon17: ; af26
+ ds 32
+BoxMon18: ; af46
+ ds 32
+BoxMon19: ; af66
+ ds 32
+BoxMon20: ; af86
+ ds 32
+
+BoxMonOT:
+BoxMon1OT: ; afa6
+ ds 11
+BoxMon2OT: ; afb1
+ ds 11
+BoxMon3OT: ; afbc
+ ds 11
+BoxMon4OT: ; afc7
+ ds 11
+BoxMon5OT: ; afd2
+ ds 11
+BoxMon6OT: ; afdd
+ ds 11
+BoxMon7OT: ; afe8
+ ds 11
+BoxMon8OT: ; aff3
+ ds 11
+BoxMon9OT: ; affe
+ ds 11
+BoxMon10OT: ; b009
+ ds 11
+BoxMon11OT: ; b014
+ ds 11
+BoxMon12OT: ; b01f
+ ds 11
+BoxMon13OT: ; b02a
+ ds 11
+BoxMon14OT: ; b035
+ ds 11
+BoxMon15OT: ; b040
+ ds 11
+BoxMon16OT: ; b04b
+ ds 11
+BoxMon17OT: ; b056
+ ds 11
+BoxMon18OT: ; b061
+ ds 11
+BoxMon19OT: ; b06c
+ ds 11
+BoxMon20OT: ; b077
+ ds 11
+
+BoxMonNicknames:
+BoxMon1Nickname: ; b082
+ ds 11
+BoxMon2Nickname: ; b08d
+ ds 11
+BoxMon3Nickname: ; b098
+ ds 11
+BoxMon4Nickname: ; b0a3
+ ds 11
+BoxMon5Nickname: ; b0ae
+ ds 11
+BoxMon6Nickname: ; b0b9
+ ds 11
+BoxMon7Nickname: ; b0c4
+ ds 11
+BoxMon8Nickname: ; b0cf
+ ds 11
+BoxMon9Nickname: ; b0da
+ ds 11
+BoxMon10Nickname: ; b0e5
+ ds 11
+BoxMon11Nickname: ; b0f0
+ ds 11
+BoxMon12Nickname: ; b0fb
+ ds 11
+BoxMon13Nickname: ; b106
+ ds 11
+BoxMon14Nickname: ; b111
+ ds 11
+BoxMon15Nickname: ; b11c
+ ds 11
+BoxMon16Nickname: ; b127
+ ds 11
+BoxMon17Nickname: ; b132
+ ds 11
+BoxMon18Nickname: ; b13d
+ ds 11
+BoxMon19Nickname: ; b148
+ ds 11
+BoxMon20Nickname: ; b153
+ ds 11
+BoxMonNicknamesEnd