Use linkerscript for bank $2e, disassemble some stuff after pics.

This commit is contained in:
entrpntr 2020-04-01 17:22:43 -04:00
parent 95d7d56581
commit 90cdd19ae8
18 changed files with 2069 additions and 184 deletions

View File

@ -102,6 +102,24 @@ NUM_WATERMON EQU 3
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
; treemon sets
; TreeMons indexes (see data/wild/treemons.asm)
const_def
const TREEMON_SET_NONE
const TREEMON_SET_FOREST
const TREEMON_SET_CANYON
const TREEMON_SET_ROCK
NUM_TREEMON_SETS EQU const_value
; last 2 are unused/ignored
const TREEMON_SET_UNUSED
const TREEMON_SET_CITY
; treemon scores
const_def
const TREEMON_SCORE_BAD ; 0
const TREEMON_SCORE_GOOD ; 1
const TREEMON_SCORE_RARE ; 2
; ChangeHappiness arguments (see data/happiness_changes.asm)
const_value = 1
const HAPPINESS_GAINLEVEL ; 01

View File

@ -3,90 +3,69 @@
const POKEDEX_SHOW ; $01
const POKEMON_MUSIC ; $02
const LUCKY_CHANNEL ; $03
const BUENAS_PASSWORD ; $04
const PLACES_AND_PEOPLE ; $05
const LETS_ALL_SING ; $06
const ROCKET_RADIO ; $07
const POKE_FLUTE_RADIO ; $08
const UNOWN_RADIO ; $09
const EVOLUTION_RADIO ; $0a
const OAKS_POKEMON_TALK_2 ; $0b
const OAKS_POKEMON_TALK_3 ; $0c
const OAKS_POKEMON_TALK_4 ; $0d
const OAKS_POKEMON_TALK_5 ; $0e
const OAKS_POKEMON_TALK_6 ; $0f
const OAKS_POKEMON_TALK_7 ; $10
const OAKS_POKEMON_TALK_8 ; $11
const OAKS_POKEMON_TALK_9 ; $12
const POKEDEX_SHOW_2 ; $13
const POKEDEX_SHOW_3 ; $14
const POKEDEX_SHOW_4 ; $15
const POKEDEX_SHOW_5 ; $16
const POKEMON_MUSIC_2 ; $17
const POKEMON_MUSIC_3 ; $18
const POKEMON_MUSIC_4 ; $19
const POKEMON_MUSIC_5 ; $1a
const POKEMON_MUSIC_6 ; $1b
const POKEMON_MUSIC_7 ; $1c
const LETS_ALL_SING_2 ; $1d
const LUCKY_NUMBER_SHOW_2 ; $1e
const LUCKY_NUMBER_SHOW_3 ; $1f
const LUCKY_NUMBER_SHOW_4 ; $20
const LUCKY_NUMBER_SHOW_5 ; $21
const LUCKY_NUMBER_SHOW_6 ; $22
const LUCKY_NUMBER_SHOW_7 ; $23
const LUCKY_NUMBER_SHOW_8 ; $24
const LUCKY_NUMBER_SHOW_9 ; $25
const LUCKY_NUMBER_SHOW_10 ; $26
const LUCKY_NUMBER_SHOW_11 ; $27
const LUCKY_NUMBER_SHOW_12 ; $28
const LUCKY_NUMBER_SHOW_13 ; $29
const LUCKY_NUMBER_SHOW_14 ; $2a
const LUCKY_NUMBER_SHOW_15 ; $2b
const PLACES_AND_PEOPLE_2 ; $2c
const PLACES_AND_PEOPLE_3 ; $2d
const PLACES_AND_PEOPLE_4 ; $2e
const PLACES_AND_PEOPLE_5 ; $2f
const PLACES_AND_PEOPLE_6 ; $30
const PLACES_AND_PEOPLE_7 ; $31
const ROCKET_RADIO_2 ; $32
const ROCKET_RADIO_3 ; $33
const ROCKET_RADIO_4 ; $34
const ROCKET_RADIO_5 ; $35
const ROCKET_RADIO_6 ; $36
const ROCKET_RADIO_7 ; $37
const ROCKET_RADIO_8 ; $38
const ROCKET_RADIO_9 ; $39
const ROCKET_RADIO_10 ; $3a
const OAKS_POKEMON_TALK_10 ; $3b
const OAKS_POKEMON_TALK_11 ; $3c
const OAKS_POKEMON_TALK_12 ; $3d
const OAKS_POKEMON_TALK_13 ; $3e
const OAKS_POKEMON_TALK_14 ; $3f
const BUENAS_PASSWORD_2 ; $40
const BUENAS_PASSWORD_3 ; $41
const BUENAS_PASSWORD_4 ; $42
const BUENAS_PASSWORD_5 ; $43
const BUENAS_PASSWORD_6 ; $44
const BUENAS_PASSWORD_7 ; $45
const BUENAS_PASSWORD_8 ; $46
const BUENAS_PASSWORD_9 ; $47
const BUENAS_PASSWORD_10 ; $48
const BUENAS_PASSWORD_11 ; $49
const BUENAS_PASSWORD_12 ; $4a
const BUENAS_PASSWORD_13 ; $4b
const BUENAS_PASSWORD_14 ; $4c
const BUENAS_PASSWORD_15 ; $4d
const BUENAS_PASSWORD_16 ; $4e
const BUENAS_PASSWORD_17 ; $4f
const BUENAS_PASSWORD_18 ; $50
const BUENAS_PASSWORD_19 ; $51
const BUENAS_PASSWORD_20 ; $52
const BUENAS_PASSWORD_21 ; $53
const RADIO_SCROLL ; $54
const POKEDEX_SHOW_6 ; $55
const POKEDEX_SHOW_7 ; $56
const POKEDEX_SHOW_8 ; $57
const PLACES_AND_PEOPLE ; $04
const LETS_ALL_SING ; $05
const ROCKET_RADIO ; $06
const POKE_FLUTE_RADIO ; $07
const UNOWN_RADIO ; $08
const EVOLUTION_RADIO ; $09
const OAKS_POKEMON_TALK_2 ; $0a
const OAKS_POKEMON_TALK_3 ; $0b
const OAKS_POKEMON_TALK_4 ; $0c
const OAKS_POKEMON_TALK_5 ; $0d
const OAKS_POKEMON_TALK_6 ; $0e
const OAKS_POKEMON_TALK_7 ; $0f
const OAKS_POKEMON_TALK_8 ; $10
const OAKS_POKEMON_TALK_9 ; $11
const POKEDEX_SHOW_2 ; $12
const POKEDEX_SHOW_3 ; $13
const POKEDEX_SHOW_4 ; $14
const POKEDEX_SHOW_5 ; $15
const POKEMON_MUSIC_2 ; $16
const POKEMON_MUSIC_3 ; $17
const POKEMON_MUSIC_4 ; $18
const POKEMON_MUSIC_5 ; $19
const POKEMON_MUSIC_6 ; $1a
const POKEMON_MUSIC_7 ; $1b
const LETS_ALL_SING_2 ; $1c
const LUCKY_NUMBER_SHOW_2 ; $1d
const LUCKY_NUMBER_SHOW_3 ; $1e
const LUCKY_NUMBER_SHOW_4 ; $1f
const LUCKY_NUMBER_SHOW_5 ; $20
const LUCKY_NUMBER_SHOW_6 ; $21
const LUCKY_NUMBER_SHOW_7 ; $22
const LUCKY_NUMBER_SHOW_8 ; $23
const LUCKY_NUMBER_SHOW_9 ; $24
const LUCKY_NUMBER_SHOW_10 ; $25
const LUCKY_NUMBER_SHOW_11 ; $26
const LUCKY_NUMBER_SHOW_12 ; $27
const LUCKY_NUMBER_SHOW_13 ; $28
const LUCKY_NUMBER_SHOW_14 ; $29
const LUCKY_NUMBER_SHOW_15 ; $2a
const PLACES_AND_PEOPLE_2 ; $2b
const PLACES_AND_PEOPLE_3 ; $2c
const PLACES_AND_PEOPLE_4 ; $2d
const PLACES_AND_PEOPLE_5 ; $2e
const PLACES_AND_PEOPLE_6 ; $2f
const PLACES_AND_PEOPLE_7 ; $30
const ROCKET_RADIO_2 ; $31
const ROCKET_RADIO_3 ; $32
const ROCKET_RADIO_4 ; $33
const ROCKET_RADIO_5 ; $34
const ROCKET_RADIO_6 ; $35
const ROCKET_RADIO_7 ; $36
const ROCKET_RADIO_8 ; $37
const ROCKET_RADIO_9 ; $38
const ROCKET_RADIO_10 ; $39
const OAKS_POKEMON_TALK_10 ; $3a
const OAKS_POKEMON_TALK_11 ; $3b
const OAKS_POKEMON_TALK_12 ; $3c
const OAKS_POKEMON_TALK_13 ; $3d
const OAKS_POKEMON_TALK_14 ; $3e
const RADIO_SCROLL ; $3f
const POKEDEX_SHOW_6 ; $40
const POKEDEX_SHOW_7 ; $41
const POKEDEX_SHOW_8 ; $42
const_def
const MAPRADIO_POKEMON_CHANNEL
@ -99,23 +78,9 @@
const MAPRADIO_LETS_ALL_SING
const MAPRADIO_ROCKET
const_def
const BUENA_MON
const BUENA_ITEM
const BUENA_MOVE
const BUENA_STRING
const_def
const BUENA_STARTERS
const BUENA_DRINKS
const BUENA_ITEMS
const BUENA_BALLS
const BUENA_MON1
const BUENA_MON2
const BUENA_TOWNS
const BUENA_TYPES
const BUENA_MOVES
const BUENA_XITEMS
const BUENA_STATIONS
NUM_PASSWORD_CATEGORIES EQU const_value
NUM_PASSWORDS_PER_CATEGORY EQU 3
; These tables in engine/pokegear/radio.asm are all sized to a power of 2
; so there's no need for a rejection sampling loop
NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs
NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives
NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives
NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives

View File

@ -0,0 +1,12 @@
RadioChannelSongs:
; entries correspond to radio channel ids
dw MUSIC_POKEMON_TALK
dw MUSIC_POKEMON_CENTER
dw MUSIC_TITLE
dw MUSIC_GAME_CORNER
dw MUSIC_VIRIDIAN_CITY
dw MUSIC_BICYCLE
dw MUSIC_ROCKET_OVERTURE
dw MUSIC_POKE_FLUTE_CHANNEL
dw MUSIC_RUINS_OF_ALPH_RADIO
dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO

View File

@ -0,0 +1,19 @@
; Oak's Pokémon Talk will list wild Pokémon on these maps.
OaksPKMNTalkRoutes:
map_id ROUTE_29
map_id ROUTE_46
map_id ROUTE_30
map_id ROUTE_32
map_id ROUTE_34
map_id ROUTE_35
map_id ROUTE_37
map_id ROUTE_38
map_id ROUTE_39
map_id ROUTE_42
map_id ROUTE_43
map_id ROUTE_44
map_id ROUTE_45
map_id ROUTE_36
map_id ROUTE_31
.End

View File

@ -0,0 +1,26 @@
; Places and People will not describe these trainers.
PnP_HiddenPeople:
db WILL
db BRUNO
db KAREN
db KOGA
db CHAMPION
; fallthrough
PnP_HiddenPeople_BeatE4:
db BROCK
db MISTY
db LT_SURGE
db ERIKA
db JANINE
db SABRINA
db BLAINE
db BLUE
; fallthrough
PnP_HiddenPeople_BeatKanto:
db RIVAL1
db POKEMON_PROF
db CAL
db RIVAL2
db RED
db -1

13
data/radio/pnp_places.asm Normal file
View File

@ -0,0 +1,13 @@
; Places and People will describe the landmarks of these maps.
PnP_Places:
map_id PALLET_TOWN ; PALLET_TOWN
map_id ROUTE_22 ; ROUTE_22
map_id PEWTER_CITY ; PEWTER_CITY
map_id CERULEAN_POLICE_STATION ; CERULEAN_CITY
map_id ROUTE_12 ; ROUTE_12
map_id ROUTE_11 ; ROUTE_11
map_id ROUTE_16 ; ROUTE_16
map_id ROUTE_14 ; ROUTE_14
map_id CINNABAR_POKECENTER_2F_BETA ; CINNABAR_ISLAND
.End

View File

@ -498,162 +498,162 @@ _OPT_MaryText1::
text "'s"
done
OPT_SweetAdorably::
_OPT_SweetAdorablyText::
text_start
line "sweet and adorably"
done
OPT_WigglySlickly::
_OPT_WigglySlicklyText::
text_start
line "wiggly and slickly"
done
OPT_AptlyNamed::
_OPT_AptlyNamedText::
text_start
line "aptly named and"
done
OPT_UndeniablyKindOf::
_OPT_UndeniablyKindOfText::
text_start
line "undeniably kind of"
done
OPT_Unbearably::
_OPT_UnbearablyText::
text_start
line "so, so unbearably"
done
OPT_WowImpressively::
_OPT_WowImpressivelyText::
text_start
line "wow, impressively"
done
OPT_AlmostPoisonously::
_OPT_AlmostPoisonouslyText::
text_start
line "almost poisonously"
done
OPT_Sensually::
_OPT_SensuallyText::
text_start
line "ooh, so sensually"
done
OPT_Mischievously::
_OPT_MischievouslyText::
text_start
line "so mischievously"
done
OPT_Topically::
_OPT_TopicallyText::
text_start
line "so very topically"
done
OPT_Addictively::
_OPT_AddictivelyText::
text_start
line "sure addictively"
done
OPT_LooksInWater::
_OPT_LooksInWaterText::
text_start
line "looks in water is"
done
OPT_EvolutionMustBe::
_OPT_EvolutionMustBeText::
text_start
line "evolution must be"
done
OPT_Provocatively::
_OPT_ProvocativelyText::
text_start
line "provocatively"
done
OPT_FlippedOut::
_OPT_FlippedOutText::
text_start
line "so flipped out and"
done
OPT_HeartMeltingly::
_OPT_HeartMeltinglyText::
text_start
line "heart-meltingly"
done
OPT_Cute::
_OPT_CuteText::
text_start
line "cute."
done
OPT_Weird::
_OPT_WeirdText::
text_start
line "weird."
done
OPT_Pleasant::
_OPT_PleasantText::
text_start
line "pleasant."
done
OPT_BoldSortOf::
_OPT_BoldSortOfText::
text_start
line "bold, sort of."
done
OPT_Frightening::
_OPT_FrighteningText::
text_start
line "frightening."
done
OPT_SuaveDebonair::
_OPT_SuaveDebonairText::
text_start
line "suave & debonair!"
done
OPT_Powerful::
_OPT_PowerfulText::
text_start
line "powerful."
done
OPT_Exciting::
_OPT_ExcitingText::
text_start
line "exciting."
done
OPT_Groovy::
_OPT_GroovyText::
text_start
line "now!"
done
OPT_Inspiring::
_OPT_InspiringText::
text_start
line "inspiring."
done
OPT_Friendly::
_OPT_FriendlyText::
text_start
line "friendly."
done
OPT_HotHotHot::
_OPT_HotHotHotText::
text_start
line "hot, hot, hot!"
done
OPT_Stimulating::
_OPT_StimulatingText::
text_start
line "stimulating."
done
OPT_Guarded::
_OPT_GuardedText::
text_start
line "guarded."
done
OPT_Lovely::
_OPT_LovelyText::
text_start
line "lovely."
done
OPT_Speedy::
_OPT_SpeedyText::
text_start
line "speedy."
done
@ -817,82 +817,82 @@ _PnP_Text4::
text_ram wStringBuffer1
db "@@"
_PnP_cute::
_PnP_CuteText::
text_start
line "is cute."
done
_PnP_lazy::
_PnP_LazyText::
text_start
line "is sort of lazy."
done
_PnP_happy::
_PnP_HappyText::
text_start
line "is always happy."
done
_PnP_noisy::
_PnP_NoisyText::
text_start
line "is quite noisy."
done
_PnP_precocious::
_PnP_PrecociousText::
text_start
line "is precocious."
done
_PnP_bold::
_PnP_BoldText::
text_start
line "is somewhat bold."
done
_PnP_picky::
_PnP_PickyText::
text_start
line "is too picky!"
done
_PnP_sortofok::
_PnP_SortOfOKText::
text_start
line "is sort of OK."
done
_PnP_soso::
_PnP_SoSoText::
text_start
line "is just so-so."
done
_PnP_great::
_PnP_GreatText::
text_start
line "is actually great."
done
_PnP_mytype::
_PnP_MyTypeText::
text_start
line "is just my type."
done
_PnP_cool::
_PnP_CoolText::
text_start
line "is so cool, no?"
done
_PnP_inspiring::
_PnP_InspiringText::
text_start
line "is inspiring!"
done
_PnP_weird::
_PnP_WeirdText::
text_start
line "is kind of weird."
done
_PnP_rightforme::
_PnP_RightForMeText::
text_start
line "is right for me?"
done
_PnP_odd::
_PnP_OddText::
text_start
line "is definitely odd!"
done

View File

@ -0,0 +1,48 @@
treemon_map: MACRO
map_id \1
db \2 ; treemon set
ENDM
TreeMonMaps:
treemon_map ROUTE_26, TREEMON_SET_FOREST
treemon_map ROUTE_27, TREEMON_SET_FOREST
treemon_map ROUTE_28, TREEMON_SET_NONE
treemon_map ROUTE_29, TREEMON_SET_CANYON
treemon_map ROUTE_30, TREEMON_SET_CANYON
treemon_map ROUTE_31, TREEMON_SET_CANYON
treemon_map ROUTE_32, TREEMON_SET_CANYON
treemon_map ROUTE_33, TREEMON_SET_CANYON
treemon_map ROUTE_34, TREEMON_SET_FOREST
treemon_map ROUTE_35, TREEMON_SET_FOREST
treemon_map ROUTE_36, TREEMON_SET_FOREST
treemon_map ROUTE_37, TREEMON_SET_FOREST
treemon_map ROUTE_38, TREEMON_SET_FOREST
treemon_map ROUTE_39, TREEMON_SET_FOREST
treemon_map ROUTE_40, TREEMON_SET_NONE
treemon_map ROUTE_41, TREEMON_SET_NONE
treemon_map ROUTE_42, TREEMON_SET_CANYON
treemon_map ROUTE_43, TREEMON_SET_CANYON
treemon_map ROUTE_44, TREEMON_SET_CANYON
treemon_map ROUTE_45, TREEMON_SET_CANYON
treemon_map ROUTE_46, TREEMON_SET_CANYON
treemon_map NEW_BARK_TOWN, TREEMON_SET_CITY
treemon_map CHERRYGROVE_CITY, TREEMON_SET_NONE
treemon_map VIOLET_CITY, TREEMON_SET_CITY
treemon_map AZALEA_TOWN, TREEMON_SET_FOREST
treemon_map CIANWOOD_CITY, TREEMON_SET_NONE
treemon_map GOLDENROD_CITY, TREEMON_SET_NONE
treemon_map OLIVINE_CITY, TREEMON_SET_NONE
treemon_map ECRUTEAK_CITY, TREEMON_SET_CITY
treemon_map MAHOGANY_TOWN, TREEMON_SET_CITY
treemon_map LAKE_OF_RAGE, TREEMON_SET_FOREST
treemon_map BLACKTHORN_CITY, TREEMON_SET_CITY
treemon_map SILVER_CAVE_OUTSIDE, TREEMON_SET_NONE
treemon_map ILEX_FOREST, TREEMON_SET_FOREST
db -1
RockMonMaps:
treemon_map CIANWOOD_CITY, TREEMON_SET_ROCK
treemon_map ROUTE_40, TREEMON_SET_ROCK
treemon_map DARK_CAVE_VIOLET_ENTRANCE, TREEMON_SET_ROCK
treemon_map SLOWPOKE_WELL_B1F, TREEMON_SET_ROCK
db -1

91
data/wild/treemons.asm Normal file
View File

@ -0,0 +1,91 @@
TreeMons:
; entries correspond to TREEMON_SET_* constants
dw TreeMonSet_None
dw TreeMonSet_Forest
dw TreeMonSet_Canyon
dw TreeMonSet_Rock
dw TreeMonSet_Unused
dw TreeMonSet_None
; Two tables each (common, rare).
; Structure:
; db %, species, level
TreeMonSet_None:
TreeMonSet_Unused:
; common
db 50, VENONAT, 15
db 30, VENONAT, 15
db 10, ABRA, 15
db 5, ABRA, 15
db 5, VENOMOTH, 15
db -1
; rare
db 50, VENONAT, 15
db 30, MAGNEMITE, 15
db 10, ABRA, 15
db 5, ABRA, 15
db 5, VENOMOTH, 15
db -1
TreeMonSet_Forest:
IF DEF(_GOLD)
; common
db 50, CATERPIE, 10
db 15, CATERPIE, 10
db 15, METAPOD, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, BUTTERFREE, 10
db -1
; rare
db 50, CATERPIE, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, BUTTERFREE, 10
db -1
ELIF DEF(_SILVER)
; common
db 50, WEEDLE, 10
db 15, WEEDLE, 10
db 15, KAKUNA, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, BEEDRILL, 10
db -1
; rare
db 50, WEEDLE, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, BEEDRILL, 10
db -1
ENDC
TreeMonSet_Canyon:
; common
db 50, SPEAROW, 10
db 15, SPEAROW, 10
db 15, SPEAROW, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
; rare
db 50, SPEAROW, 10
db 15, HERACROSS, 10
db 15, HERACROSS, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
TreeMonSet_Rock:
db 90, KRABBY, 15
db 10, SHUCKLE, 15
db -1

273
engine/events/treemons.asm Normal file
View File

@ -0,0 +1,273 @@
TreeMonEncounter:
xor a
ld [wTempWildMonSpecies], a
ld [wCurPartyLevel], a
ld hl, TreeMonMaps
call GetTreeMonSet
jr nc, .no_battle
call GetTreeMons
jr nc, .no_battle
call GetTreeMon
jr nc, .no_battle
ld a, BATTLETYPE_TREE
ld [wBattleType], a
ld a, 1
ld [wScriptVar], a
ret
.no_battle
xor a
ld [wScriptVar], a
ret
RockMonEncounter:
xor a
ld [wTempWildMonSpecies], a
ld [wCurPartyLevel], a
ld hl, RockMonMaps
call GetTreeMonSet
jr nc, .no_battle
call GetTreeMons
jr nc, .no_battle
; 40% chance of an encounter
ld a, 10
call RandomRange
cp 4
jr nc, .no_battle
call SelectTreeMon
jr nc, .no_battle
ret
.no_battle
xor a
ret
db $05 ; ????
GetTreeMonSet:
; Return carry and treemon set in a
; if the current map is in table hl.
ld a, [wMapNumber]
ld e, a
ld a, [wMapGroup]
ld d, a
.loop
ld a, [hli]
cp -1
jr z, .not_in_table
cp d
jr nz, .skip2
ld a, [hli]
cp e
jr nz, .skip1
jr .in_table
.skip2
inc hl
.skip1
inc hl
jr .loop
.not_in_table
xor a
ret
.in_table
ld a, [hl]
scf
ret
INCLUDE "data/wild/treemon_maps.asm"
GetTreeMons:
; Return the address of TreeMon table a in hl.
; Return nc if table a doesn't exist.
cp NUM_TREEMON_SETS
jr nc, .quit
and a
jr z, .quit
ld e, a
ld d, 0
ld hl, TreeMons
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
scf
ret
.quit
xor a
ret
INCLUDE "data/wild/treemons.asm"
GetTreeMon:
push hl
call GetTreeScore
pop hl
and a ; TREEMON_SCORE_BAD
jr z, .bad
cp TREEMON_SCORE_GOOD
jr z, .good
cp TREEMON_SCORE_RARE
jr z, .rare
ret
.bad
; 10% chance of an encounter
ld a, 10
call RandomRange
and a
jr nz, NoTreeMon
jr SelectTreeMon
.good
; 50% chance of an encounter
ld a, 10
call RandomRange
cp 5
jr nc, NoTreeMon
jr SelectTreeMon
.rare
; 80% chance of an encounter
ld a, 10
call RandomRange
cp 8
jr nc, NoTreeMon
jr .skip
.skip
ld a, [hli]
cp -1
jr nz, .skip
call SelectTreeMon
ret
SelectTreeMon:
; Read a TreeMons table and pick one monster at random.
ld a, 100
call RandomRange
.loop
sub [hl]
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
ld a, [hli]
cp -1
jr z, NoTreeMon
ld a, [hli]
ld [wTempWildMonSpecies], a
ld a, [hl]
ld [wCurPartyLevel], a
scf
ret
NoTreeMon:
xor a
ld [wTempWildMonSpecies], a
ld [wCurPartyLevel], a
ret
GetTreeScore:
call .CoordScore
ld [wBuffer1], a
call .OTIDScore
ld [wBuffer2], a
ld c, a
ld a, [wBuffer1]
sub c
jr z, .rare
jr nc, .ok
add 10
.ok
cp 5
jr c, .good
.bad
xor a ; TREEMON_SCORE_BAD
ret
.good
ld a, TREEMON_SCORE_GOOD
ret
.rare
ld a, TREEMON_SCORE_RARE
ret
.CoordScore:
call GetFacingTileCoord
ld hl, 0
ld c, e
ld b, 0
ld a, d
and a
jr z, .next
.loop
add hl, bc
dec a
jr nz, .loop
.next
add hl, bc
ld c, d
add hl, bc
ld a, h
ldh [hDividend], a
ld a, l
ldh [hDividend + 1], a
ld a, 5
ldh [hDivisor], a
ld b, 2
call Divide
ldh a, [hQuotient + 2]
ldh [hDividend], a
ldh a, [hQuotient + 3]
ldh [hDividend + 1], a
ld a, 10
ldh [hDivisor], a
ld b, 2
call Divide
ldh a, [hRemainder]
ret
.OTIDScore:
ld a, [wPlayerID]
ldh [hDividend], a
ld a, [wPlayerID + 1]
ldh [hDividend + 1], a
ld a, 10
ldh [hDivisor], a
ld b, 2
call Divide
ldh a, [hRemainder]
ret

View File

@ -451,28 +451,28 @@ InitializeWorld: ; 5d97 (1:5d97)
ret
LoadOrRegenerateLuckyIDNumber: ; 5da7 (1:5da7)
ld a, $0
ld a, 0
call OpenSRAM
ld a, [wCurDay]
inc a
ld b, a
ld a, [s0_ac68]
ld a, [sLuckyNumberDay]
cp b
ld a, [s0_ac6a]
ld a, [sLuckyIDNumber + 1]
ld c, a
ld a, [s0_ac69]
ld a, [sLuckyIDNumber]
jr z, .asm_5dc9
ld a, b
ld [s0_ac68], a
ld [sLuckyNumberDay], a
call Random
ld c, a
call Random
.asm_5dc9
ld [wd9e9], a
ld [s0_ac69], a
ld [wLuckyIDNumber], a
ld [sLuckyIDNumber], a
ld a, c
ld [wd9ea], a
ld [s0_ac6a], a
ld [wLuckyIDNumber + 1], a
ld [sLuckyIDNumber + 1], a
jp CloseSRAM
MainMenu_Continue:

1417
engine/pokegear/radio.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -675,9 +675,7 @@ UnownIFrontpic: INCBIN "gfx/pokemon/unown_i/front.2bpp.lz"
UnownRBackpic: INCBIN "gfx/pokemon/unown_r/back.2bpp.lz"
UnownRFrontpic: INCBIN "gfx/pokemon/unown_r/front.2bpp.lz"
dr $b99f2, $ba300
ELSE ; IF DEF(_SILVER)
ELIF DEF(_SILVER)
SECTION "Pic Pointers", ROMX
@ -1351,5 +1349,4 @@ UnownIFrontpic: INCBIN "gfx/pokemon/unown_i/front.2bpp.lz"
UnownRBackpic: INCBIN "gfx/pokemon/unown_r/back.2bpp.lz"
UnownRFrontpic: INCBIN "gfx/pokemon/unown_r/front.2bpp.lz"
dr $b9a43, $ba300
ENDC

View File

@ -270,7 +270,9 @@ RandomUnseenWildMon:
RandomPhoneWildMon:
dr $2aa6b, $2aab3
RandomPhoneMon:
dr $2aab3, $2c000
dr $2aab3, $2ab35
JohtoGrassWildMons:
dr $2ab35, $2c000
SECTION "bankb", ROMX, BANK[$b]
dr $2c000, $2c352
@ -649,7 +651,11 @@ MrChrono:
PrintHour:
dr $90b0f, $90b5e
PokeGear:
dr $90b5e, $9188a
dr $90b5e, $917ca
RadioMusicRestartDE:
dr $917ca, $917de
RadioMusicRestartPokemonChannel:
dr $917de, $9188a
Function9188a:
dr $9188a, $919c1
Function919c1:
@ -658,7 +664,9 @@ TownMap_:
dr $91a4f, $91c7f
Pokedex_GetArea::
dr $91c7f, $92c36
dr $91c7f, $92364
GetLandmarkName:
dr $92364, $92c36
Function92c36:
dr $92c36, $94000
@ -720,15 +728,12 @@ INCLUDE "data/maps/blocks.asm"
SECTION "bank2d", ROMX, BANK[$2d]
dr $b4000, $b8000
SECTION "bank2e", ROMX
SECTION "bank2e_2", ROMX
INCLUDE "engine/events/checkforhiddenitems.asm"
INCLUDE "engine/events/treemons.asm"
INCLUDE "engine/pokegear/radio.asm"
TreeMonEncounter:
dr $ba378, $ba3a1
RockMonEncounter:
dr $ba3a1, $baeca
ReadPartyMonMail:
dr $baeca, $bbaed
ItemIsMail:

View File

@ -148,8 +148,10 @@ ROMX $2d
org $4000
"bank2d"
ROMX $2e
org $4000
"Pics 14"
"bank2e"
org $6300
"bank2e_2"
ROMX $2f
org $4000
"bank2f"

View File

@ -148,8 +148,10 @@ ROMX $2d
org $4000
"bank2d"
ROMX $2e
org $4000
"Pics 14"
"bank2e"
org $6300
"bank2e_2"
ROMX $2f
org $4000
"bank2f"

View File

@ -545,9 +545,8 @@ s0_ac64:: ds 1 ; 0:ac64
s0_ac65:: ds 1 ; 0:ac65
s0_ac66:: ds 1 ; 0:ac66
s0_ac67:: ds 1 ; 0:ac67
s0_ac68:: ds 1 ; 0:ac68
s0_ac69:: ds 1 ; 0:ac69
s0_ac6a:: ds 1 ; 0:ac6a
sLuckyNumberDay:: db ; 0:ac68
sLuckyIDNumber:: dw ; 0:ac69
s0_ac6b:: ds 1 ; 0:ac6b
s0_ac6c:: ds 1 ; 0:ac6c
s0_ac6d:: ds 1 ; 0:ac6d

View File

@ -3650,8 +3650,7 @@ wd9e5:: ds 1 ; d9e5
wd9e6:: ds 1 ; d9e6
wLuckyNumberShowFlag:: ds 1 ; d9e7
wd9e8:: ds 1 ; d9e8
wd9e9:: ds 1 ; d9e9
wd9ea:: ds 1 ; d9ea
wLuckyIDNumber:: dw ; d9e9
wRepelSteps:: ds 1 ; d9eb
wd9ec:: ds 1 ; d9ec
wd9ed:: ds 1 ; d9ed
@ -3806,9 +3805,8 @@ wBestMagikarpLengthFeet:: ds 1 ; dd33
wBestMagikarpLengthInches:: ds 1 ; dd34
wMagikarpRecordHoldersName:: ds NAME_LENGTH ; dd35
wdd40:: ds 1 ; dd40
wdd41:: ds 1 ; dd41
wdd42:: ds 1 ; dd42
wPokedexShowPointerAddr:: dw ; dd40
wPokedexShowPointerBank:: db ; dd42
wdd43:: ds 1 ; dd43
wdd44:: ds 1 ; dd44
wdd45:: ds 1 ; dd45