Merge pull request #277 from yenatch/master

Start splitting code out of main.
This commit is contained in:
Bryan Bishop 2015-02-13 14:38:23 -06:00
commit d7bc1d12f2
132 changed files with 50404 additions and 51353 deletions

View File

@ -7366,7 +7366,7 @@ Function3ee3b: ; 3ee3b
.asm_3ee89
push hl
push bc
ld a, $1c
ld a, PartyMon1PokerusStatus - PartyMon1
call GetPartyParamLocation
ld a, [hl]
and a
@ -7630,7 +7630,7 @@ Function3ee3b: ; 3ee3b
call TextBox
hlcoord 11, 1
ld bc, $0004
predef Function50b7b
predef PrintTempMonStats
ld c, $1e
call DelayFrames
call Functiona80
@ -7673,7 +7673,7 @@ Function3ee3b: ; 3ee3b
cp b
jr z, .asm_3f0d1
ld [CurPartyMon], a
ld a, $0
ld a, PartyMon1Species - PartyMon1
call GetPartyParamLocation
ld b, h
ld c, l

View File

@ -1771,10 +1771,19 @@ GATE EQU 6
DUNGEON EQU 7
; object struct
OBJECT_00 EQU $0
OBJECT_01 EQU $1
OBJECT_SPRITE EQU $2
OBJECT_03 EQU $3
OBJECT_04 EQU $4
OBJECT_FLAGS EQU $5
OBJECT_PALETTE EQU $6
OBJECT_07 EQU $7
OBJECT_08 EQU $8
OBJECT_09 EQU $9
OBJECT_STEP_DURATION EQU $a
OBJECT_11 EQU $b
OBJECT_12 EQU $c
OBJECT_FACING EQU $d
OBJECT_STANDING_TILE EQU $e
OBJECT_NEXT_TILE EQU $f
@ -1782,8 +1791,18 @@ OBJECT_MAP_X EQU $10
OBJECT_MAP_Y EQU $11
OBJECT_NEXT_MAP_X EQU $12
OBJECT_NEXT_MAP_Y EQU $13
OBJECT_20 EQU $14
OBJECT_21 EQU $15
OBJECT_22 EQU $16
OBJECT_SPRITE_X EQU $17
OBJECT_SPRITE_Y EQU $18
OBJECT_SPRITE_X_OFFSET EQU $19
OBJECT_SPRITE_Y_OFFSET EQU $1a
OBJECT_27 EQU $1b
OBJECT_28 EQU $1c
OBJECT_29 EQU $1d
OBJECT_30 EQU $1e
OBJECT_31 EQU $1f
OBJECT_32 EQU $20
; 33-39 are not used

View File

@ -1,42 +1,3 @@
; specials
NUM_SPECIALS EQU $a8
SPECIAL_UPDATESPRITETILES EQU $0038
SPECIAL_WAITSFX EQU $003b
SPECIAL_BIKESURFMUSIC EQU $003c
SPECIAL_LOADFACESTEP EQU $003f
SPECIAL_GIVESHUCKLE EQU $004b
SPECIAL_SNORLAXAWAKE EQU $0060
SPECIAL_GAMEBOYCHECK EQU $0066
SPECIAL_TRAINERHOUSE EQU $0067
SPECIAL_RUSTLETREE EQU $006a
SPECIAL_ODDEGG EQU $007d
SPECIAL_MOVETUTOR EQU $0083
SPECIAL_OMANYTECHAMBER EQU $0084
SPECIAL_RUINCHAMBERWALL EQU $0087
SPECIAL_HOOHCHAMBER EQU $008d
SPECIAL_CELEBI EQU $008f
SPECIAL_AFTERCELEBI EQU $0090
SPECIAL_POKESEER EQU $0091
SPECIAL_BUENAS_PASSWORD EQU $0092
SPECIAL_BUENA_PRIZE EQU $0093
SPECIAL_DRATINI EQU $0094
SPECIAL_BEASTSCHECK EQU $0096
SPECIAL_MONCHECK EQU $0097
; script vars
NUM_VARS EQU $1b
VAR_MOVEMENT EQU $08

94
engine/diploma.asm Normal file
View File

@ -0,0 +1,94 @@
Function1dd702: ; 1dd702
call Function1dd709
call Functiona80
ret
; 1dd709
Function1dd709: ; 1dd709
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
ld hl, LZ_1dd805
ld de, VTiles2
call Decompress
ld hl, Tilemap_1ddc4b
ld de, TileMap
ld bc, $0168
call CopyBytes
ld de, String_1dd760
hlcoord 2, 5
call PlaceString
ld de, String_1dd767
hlcoord 15, 5
call PlaceString
ld de, PlayerName
hlcoord 9, 5
call PlaceString
ld de, String_1dd768
hlcoord 2, 8
call PlaceString
call EnableLCD
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
call DelayFrame
ret
; 1dd760
String_1dd760:
db "PLAYER@"
String_1dd767:
db "@"
String_1dd768:
db "This certifies"
next "that you have"
next "completed the"
next "new #DEX."
next "Congratulations!"
db "@"
; 1dd7ae
Function1dd7ae: ; 1dd7ae
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ld hl, Tilemap_1dddb3
ld de, TileMap
ld bc, $0168
call CopyBytes
ld de, String_1dd7fa
hlcoord 8, 0
call PlaceString
ld de, String_1dd7f0
hlcoord 3, 15
call PlaceString
hlcoord 12, 15
ld de, GameTimeHours
ld bc, $0204
call PrintNum
ld [hl], $67
inc hl
ld de, GameTimeMinutes
ld bc, $8102
call PrintNum
ret
; 1dd7f0
String_1dd7f0: db "PLAY TIME@"
String_1dd7fa: db "GAME FREAK@"
; 1dd805
LZ_1dd805: ; 1dd805
INCBIN "gfx/unknown/1dd805.2bpp.lz"
Tilemap_1ddc4b: ; 1ddc4b
INCBIN "gfx/unknown/1ddc4b.tilemap"
Tilemap_1dddb3: ; 1dddb3
INCBIN "gfx/unknown/1dddb3.tilemap"

3683
engine/map_objects.asm Normal file

File diff suppressed because it is too large Load Diff

489
engine/map_setup.asm Normal file
View File

@ -0,0 +1,489 @@
RunMapSetupScript:: ; 15363
ld a, [$ff9f]
and $f
dec a
ld c, a
ld b, 0
ld hl, MapSetupScripts
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call ReadMapSetupScript
ret
; 15377
MapSetupScripts: ; 15377
dw MapSetupScript1
dw MapSetupScript2
dw MapSetupScript3
dw MapSetupScript4
dw MapSetupScript5
dw MapSetupScript6
dw MapSetupScript7
dw MapSetupScript8
dw MapSetupScript9
dw MapSetupScript10
dw MapSetupScript11
dw MapSetupScript12
; 1538f
; Command descriptions from Condensation water's scripting compendium.
const_def
const map_lcd_on ; 00 = Turn LCD on
const map_lcd_off ; 01 = Turn LCD off
const map_sound_off ; 02 = Turn speakers off
const map_music ; 03 = Music check for current map/ special check for bug catcher contest
const map_start_music ; 04 = Start map music anew
const map_fade_music ; 05 = Music check for current map / special check for Bug Contest/ music with FadeOut (old) and FadeIn
const map_fade ; 06 = Fade out music + screen
const map_bike_music ; 07 = If HIRO is on bike = bike music, else play map music
const map_music_force ; 08 = Play map music
const map_max_volume ; 09 = Turn music to highest volume
const map_load_blocks ; 0A = Write map data to MapRAM
const map_connection_blocks ; 0B = Compute maps connection pars and write into MapRAM
const map_save_screen ; 0C = Write current part of map into temporary memory
const map_buffer_screen ; 0D = Write current part of map into read-from memory
const map_load_graphics ; 0E = Write tileset header to ram/ load tileset/ load sprite tiles/ load special tiles
const map_load_tileset_header ; 0F = Write tileset header to ram
const map_time_of_day ; 10 = Compute time of day/ Update screen
const map_palettes ; 11 = Load map palettes
const map_wildmons ; 12 = Load probabilities for wild Pokémon battles
const map_sprites ; 13 = Delete sprite data and draw new sprites
const map_change_callback ; 14 = Check 2nd script header for 05 and 03 callbacks
const map_start_callback ; 15 = Check 2nd script header for 03 callbacks
const map_load_objects ; 16 = Analyze people data anew and check 2nd script header for 02 callbacks
const map_load_spawn ; 17 = Writes arrival data for arrival by flying/Blackout from table 05:5319 to ram
const map_load_connection ; 18 = Writes arrival data for entering a map by connection to ram
const map_load_warp ; 19 = Write warp data to ram when entering warp
const map_attributes ; 1A = Load complete map data (primary, secondary, event, script headers)
const map_attributes_2 ; 1B = Same as 1A, but some settings arent loaded new from the rom, such as hide function of the people events
const map_clear_bg_palettes ; 1C = Fill palette data with FFFF (=white)
const map_fade_out_palettes ; 1D = All BG pallet color are converted to 0|0 (Pal0, Col0), all sprite colors to x|0 (FadeOut)
const map_fade_in_palettes ; 1E = Palette FadeIn
const map_anchor_screen ; 1F = Compute position of upper left-most block visible on screen
const map_warp_face ; 20 = Position computation when HIRO leaves a warp
const map_face_down ; 21 = Set HIROs facing to “down”
const map_spawn_coord ; 22 = Prepare HIRO data for arrival by flight
const map_player_coord ; 23 = Compute HIRO x/y data anew
const map_prolong_sprites ; 24 = Prolong old sprites before removing them
const map_delay_sprites ; 25 = Delay rendering new sprites
const map_update_roam ; 26 = Compute chances to meet Raikou, Entei or Suicune
const map_keep_roam ; 27 = Recover chances to meet Raikou, Entei or Suicune
const map_fade_out_music ; 28 = Temporarily stop music playing
const map_animations_on ; 29 = Activate animations
const map_animations_off ; 2A = Deactivate animations
const map_keep_palettes ; 2B = Recover all palettes
const map_text_scroll_off ; 2C = Turn off text scroll (for town name overlays)
const map_stop_script ; 2D = Deactivate code prolonging
MapSetupScript4: ; 1538f
db map_prolong_sprites
MapSetupScript12: ; 15390
db map_fade_out_palettes
db map_keep_roam
MapSetupScript1: ; 15392
db map_lcd_off
db map_sound_off
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_load_objects
db map_lcd_on
db map_palettes
db map_face_down
db map_sprites
db map_bike_music
db map_max_volume
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript11: ; 153a9
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_face_down
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript7: ; 153bf
db map_animations_off
db map_load_connection
db map_attributes
db map_change_callback
db map_player_coord
db map_load_blocks
db map_load_tileset_header
db map_save_screen
db map_load_objects
db map_fade_music
db map_palettes
db map_stop_script
db map_keep_palettes
db map_wildmons
db map_update_roam
db map_animations_on
db -1
MapSetupScript6: ; 153d0
db map_prolong_sprites
MapSetupScript5: ; 153d1
db map_fade_out_palettes
MapSetupScript9: ; 153d2
db map_load_warp
db map_attributes
db map_warp_face
db map_change_callback
db map_player_coord
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_update_roam
db -1
MapSetupScript3: ; 153e7
db map_fade
db map_clear_bg_palettes
db map_lcd_off
db map_sound_off
db map_load_blocks
db map_connection_blocks
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_music_force
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript8: ; 153f7
db map_fade
db map_lcd_off
db map_sound_off
db map_change_callback
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_text_scroll_off
db -1
MapSetupScript2: ; 15408
db map_lcd_off
db map_sound_off
db map_attributes_2
db map_anchor_screen
db map_start_callback
db map_load_blocks
db map_connection_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript10: ; 1541a
db map_load_blocks
db map_connection_blocks
db -1
ReadMapSetupScript: ; 1541d
.loop
ld a, [hli]
cp -1
ret z
push hl
ld c, a
ld b, 0
ld hl, MapSetupCommands
add hl, bc
add hl, bc
add hl, bc
; bank
ld b, [hl]
inc hl
; address
ld a, [hli]
ld h, [hl]
ld l, a
; Bit 7 of the bank indicates a parameter.
; This is left unused.
bit 7, b
jr z, .go
pop de
ld a, [de]
ld c, a
inc de
push de
.go
ld a, b
and $7f
rst FarCall
pop hl
jr .loop
; 15440
MapSetupCommands: ; 15440
dbw BANK(EnableLCD), EnableLCD
dbw BANK(DisableLCD), DisableLCD
dbw BANK(SoundRestart), SoundRestart
dbw BANK(PlayMapMusic), PlayMapMusic
dbw BANK(RestartMapMusic), RestartMapMusic
dbw BANK(FadeToMapMusic), FadeToMapMusic
dbw BANK(Function15574), Function15574
dbw BANK(EnterMapMusic), EnterMapMusic
dbw BANK(Function15587), Function15587
dbw BANK(Function3cae), Function3cae
dbw BANK(Function24cd), Function24cd
dbw BANK(Function28e3), Function28e3
dbw BANK(Function289d), Function289d
dbw BANK(Function2879), Function2879
dbw BANK(Function1047cf), Function1047cf
dbw BANK(LoadTilesetHeader), LoadTilesetHeader
dbw BANK(Function104750), Function104750
dbw BANK(Function1047eb), Function1047eb
dbw BANK(Function29ff8), Function29ff8
dbw BANK(Function1047f0), Function1047f0
dbw BANK(Function1045b0), Function1045b0
dbw BANK(Function1045c4), Function1045c4
dbw BANK(Function154d7), Function154d7
dbw BANK(LoadSpawnPoint), LoadSpawnPoint
dbw BANK(EnterMapConnection), EnterMapConnection
dbw BANK(Function1046c6), Function1046c6
dbw BANK(Function2309), Function2309
dbw BANK(Function2317), Function2317
dbw BANK(WhiteBGMap), WhiteBGMap
dbw BANK(Function8c084), Function8c084
dbw BANK(Function8c079), Function8c079
dbw BANK(Function10486d), Function10486d
dbw BANK(Function248a), Function248a
dbw BANK(Function57d9), Function57d9
dbw BANK(Function8029), Function8029
dbw BANK(Function80b8), Function80b8
dbw BANK(Function154eb), Function154eb
dbw BANK(Function154f1), Function154f1
dbw BANK(Function2a30d), Function2a30d
dbw BANK(Function2a394), Function2a394
dbw BANK(Function15567), Function15567
dbw BANK(Function154cf), Function154cf
dbw BANK(Function154d3), Function154d3
dbw BANK(Function1556d), Function1556d
dbw BANK(Function154ca), Function154ca
dbw BANK(Functionb8000), Functionb8000
; 154ca
Function154ca: ; 154ca
xor a
ld [wc2d7], a
ret
; 154cf
Function154cf: ; 154cf
ld a, $1
ld [$ffde], a
ret
; 154d3
Function154d3: ; 154d3
xor a
ld [$ffde], a
ret
; 154d7
Function154d7: ; 154d7
ld a, $2
call Function263b
callba Function2454f
callba Function8177
ret
; 154ea (5:54ea)
Function154ea: ; 154ea
ret
; 154eb
Function154eb: ; 154eb
ld hl, wd45b
set 7, [hl]
ret
; 154f1
Function154f1: ; 154f1
ld hl, wd45b
set 6, [hl]
ret
Function154f7: ; 154f7
nop
call Function1550c
jr c, .asm_15508
call Function1554e
jr c, .asm_15508
call Function1551a
jr c, .asm_15508
ret
.asm_15508
call Functione4a
ret
Function1550c: ; 1550c (5:550c)
and a
ld hl, BikeFlags
bit 1, [hl]
ret z
ld a, $1
ld [PlayerState], a
scf
ret
Function1551a: ; 1551a (5:551a)
ld a, [PlayerState]
cp $0
jr z, .asm_1554c
cp $2
jr z, .asm_1554c
cp $4
jr z, .asm_15545
cp $8
jr z, .asm_15545
call GetMapPermission
cp $3
jr z, .asm_1553e
cp $5
jr z, .asm_1553e
cp $7
jr z, .asm_1553e
jr .asm_1554c
.asm_1553e
ld a, [PlayerState]
cp $1
jr nz, .asm_1554c
.asm_15545
ld a, $0
ld [PlayerState], a
scf
ret
.asm_1554c
and a
ret
Function1554e: ; 1554e (5:554e)
call Function1852
jr nz, .asm_15565
ld a, [PlayerState]
cp $4
jr z, .asm_15563
cp $8
jr z, .asm_15563
ld a, $4
ld [PlayerState], a
.asm_15563
scf
ret
.asm_15565
and a
ret
; 15567
Function15567: ; 15567
ld a, 6
call SkipMusic
ret
; 1556d
Function1556d: ; 1556d
callba _UpdateTimePals
ret
Function15574: ; 15574
ld e, 0
ld a, [MusicFadeIDLo]
ld d, 0
ld a, [MusicFadeIDHi]
ld a, $4
ld [MusicFade], a
call Function4b6
ret
; 15587
Function15587: ; 15587
ld a, [PlayerState]
cp $1
jr nz, .asm_15596
call VolumeOff
ld a, $88
ld [MusicFade], a
.asm_15596
call Function3d2f
ret
; 1559a

91
engine/map_triggers.asm Normal file
View File

@ -0,0 +1,91 @@
MapTriggers:: ; 4d01e
; Map triggers
trigger_def: MACRO
; db group, map
; dw address
map \1
dw \2
ENDM
trigger_def POKECENTER_2F, wPokecenter2FTrigger
trigger_def TRADE_CENTER, wTradeCenterTrigger
trigger_def COLOSSEUM, wColosseumTrigger
trigger_def TIME_CAPSULE, wTimeCapsuleTrigger
trigger_def POWER_PLANT, wPowerPlantTrigger
trigger_def CERULEAN_GYM, wCeruleanGymTrigger
trigger_def ROUTE_25, wRoute25Trigger
trigger_def TRAINER_HOUSE_B1F, wTrainerHouseB1FTrigger
trigger_def VICTORY_ROAD_GATE, wVictoryRoadGateTrigger
trigger_def SAFFRON_TRAIN_STATION, wSaffronTrainStationTrigger
trigger_def ROUTE_16_GATE, wRoute16GateTrigger
trigger_def ROUTE_17_18_GATE, wRoute1718GateTrigger
trigger_def INDIGO_PLATEAU_POKECENTER_1F, wIndigoPlateauPokecenter1FTrigger
trigger_def WILLS_ROOM, wWillsRoomTrigger
trigger_def KOGAS_ROOM, wKogasRoomTrigger
trigger_def BRUNOS_ROOM, wBrunosRoomTrigger
trigger_def KARENS_ROOM, wKarensRoomTrigger
trigger_def LANCES_ROOM, wLancesRoomTrigger
trigger_def HALL_OF_FAME, wHallOfFameTrigger
trigger_def ROUTE_27, wRoute27Trigger
trigger_def NEW_BARK_TOWN, wNewBarkTownTrigger
trigger_def ELMS_LAB, wElmsLabTrigger
trigger_def KRISS_HOUSE_1F, wKrissHouse1FTrigger
trigger_def ROUTE_29, wRoute29Trigger
trigger_def CHERRYGROVE_CITY, wCherrygroveCityTrigger
trigger_def MR_POKEMONS_HOUSE, wMrPokemonsHouseTrigger
trigger_def ROUTE_32, wRoute32Trigger
trigger_def ROUTE_35_NATIONAL_PARK_GATE, wRoute35NationalParkGateTrigger
trigger_def ROUTE_36, wRoute36Trigger
trigger_def ROUTE_36_NATIONAL_PARK_GATE, wRoute36NationalParkGateTrigger
trigger_def AZALEA_TOWN, wAzaleaTownTrigger
trigger_def GOLDENROD_GYM, wGoldenrodGymTrigger
trigger_def GOLDENROD_MAGNET_TRAIN_STATION, wGoldenrodMagnetTrainStationTrigger
trigger_def GOLDENROD_POKECENTER_1F, wGoldenrodPokecenter1FTrigger
trigger_def OLIVINE_CITY, wOlivineCityTrigger
trigger_def ROUTE_34, wRoute34Trigger
trigger_def ROUTE_34_ILEX_FOREST_GATE, wRoute34IlexForestGateTrigger
trigger_def ECRUTEAK_HOUSE, wEcruteakHouseTrigger
trigger_def WISE_TRIOS_ROOM, wWiseTriosRoomTrigger
trigger_def ECRUTEAK_POKECENTER_1F, wEcruteakPokecenter1FTrigger
trigger_def ECRUTEAK_GYM, wEcruteakGymTrigger
trigger_def MAHOGANY_TOWN, wMahoganyTownTrigger
trigger_def ROUTE_42, wRoute42Trigger
trigger_def CIANWOOD_CITY, wCianwoodCityTrigger
trigger_def BATTLE_TOWER_1F, wBattleTower1FTrigger
trigger_def BATTLE_TOWER_BATTLE_ROOM, wBattleTowerBattleRoomTrigger
trigger_def BATTLE_TOWER_ELEVATOR, wBattleTowerElevatorTrigger
trigger_def BATTLE_TOWER_HALLWAY, wBattleTowerHallwayTrigger
trigger_def BATTLE_TOWER_OUTSIDE, wBattleTowerOutsideTrigger
trigger_def ROUTE_43_GATE, wRoute43GateTrigger
trigger_def MOUNT_MOON, wMountMoonTrigger
trigger_def SPROUT_TOWER_3F, wSproutTower3FTrigger
trigger_def TIN_TOWER_1F, wTinTower1FTrigger
trigger_def BURNED_TOWER_1F, wBurnedTower1FTrigger
trigger_def BURNED_TOWER_B1F, wBurnedTowerB1FTrigger
trigger_def RADIO_TOWER_5F, wRadioTower5FTrigger
trigger_def RUINS_OF_ALPH_OUTSIDE, wRuinsOfAlphOutsideTrigger
trigger_def RUINS_OF_ALPH_RESEARCH_CENTER, wRuinsOfAlphResearchCenterTrigger
trigger_def RUINS_OF_ALPH_HO_OH_CHAMBER, wRuinsOfAlphHoOhChamberTrigger
trigger_def RUINS_OF_ALPH_KABUTO_CHAMBER, wRuinsOfAlphKabutoChamberTrigger
trigger_def RUINS_OF_ALPH_OMANYTE_CHAMBER, wRuinsOfAlphOmanyteChamberTrigger
trigger_def RUINS_OF_ALPH_AERODACTYL_CHAMBER, wRuinsOfAlphAerodactylChamberTrigger
trigger_def RUINS_OF_ALPH_INNER_CHAMBER, wRuinsOfAlphInnerChamberTrigger
trigger_def MAHOGANY_MART_1F, wMahoganyMart1FTrigger
trigger_def TEAM_ROCKET_BASE_B1F, wTeamRocketBaseB1FTrigger
trigger_def TEAM_ROCKET_BASE_B2F, wTeamRocketBaseB2FTrigger
trigger_def TEAM_ROCKET_BASE_B3F, wTeamRocketBaseB3FTrigger
trigger_def UNDERGROUND_PATH_SWITCH_ROOM_ENTRANCES, wUndergroundPathSwitchRoomEntrancesTrigger
trigger_def SILVER_CAVE_ROOM_3, wSilverCaveRoom3Trigger
trigger_def VICTORY_ROAD, wVictoryRoadTrigger
trigger_def DRAGONS_DEN_B1F, wDragonsDenB1FTrigger
trigger_def DRAGON_SHRINE, wDragonShrineTrigger
trigger_def OLIVINE_PORT, wOlivinePortTrigger
trigger_def VERMILION_PORT, wVermilionPortTrigger
trigger_def FAST_SHIP_1F, wFastShip1FTrigger
trigger_def FAST_SHIP_B1F, wFastShipB1FTrigger
trigger_def MOUNT_MOON_SQUARE, wMountMoonSquareTrigger
trigger_def MOBILE_TRADE_ROOM_MOBILE, wMobileTradeRoomMobileTrigger
trigger_def MOBILE_BATTLE_ROOM, wMobileBattleRoomTrigger
db $ff
; 4d15b

View File

@ -1,5 +1,5 @@
UnknownScript_0xa0000:
special $005d
special RandomPhoneMon
farscall UnknownScript_0xbde3f
if_equal $0, UnknownScript_0xa0013
farscall UnknownScript_0xbe51e
@ -9,7 +9,7 @@ UnknownScript_0xa0013:
farjump UnknownScript_0xa002e
UnknownScript_0xa0017:
special $005d
special RandomPhoneMon
farscall UnknownScript_0xbde3f
if_equal $0, UnknownScript_0xa002a
farscall UnknownScript_0xbe5d0
@ -27,7 +27,7 @@ UnknownScript_0xa0036:
farjump UnknownScript_0xa0055
UnknownScript_0xa003e:
special $005c
special Function2a51f
farscall UnknownScript_0xbde3f
if_equal $0, UnknownScript_0xa0051
farscall UnknownScript_0xa017a
@ -37,7 +37,7 @@ UnknownScript_0xa0051:
farjump UnknownScript_0xa006c
UnknownScript_0xa0055:
special $005c
special Function2a51f
farscall UnknownScript_0xbde3f
if_equal $0, UnknownScript_0xa0068
farscall UnknownScript_0xa0226
@ -851,7 +851,7 @@ UnknownScript_0xa059c:
farjump UnknownScript_0xa053a
UnknownScript_0xa05a0:
special $005b
special Function2a4ab
end
UnknownScript_0xa05a4:

1692
engine/pack.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -381,7 +381,7 @@ UnknownScript_0xbd17c:
iftrue UnknownScript_0xbd1cd
UnknownScript_0xbd19b:
special $005d
special RandomPhoneMon
farjump UnknownScript_0xa0908
UnknownScript_0xbd1a2:
@ -608,7 +608,7 @@ UnknownScript_0xbd373:
iftrue UnknownScript_0xbd3c4
UnknownScript_0xbd392:
special $005d
special RandomPhoneMon
farjump UnknownScript_0xa0930
UnknownScript_0xbd399:
@ -808,7 +808,7 @@ UnknownScript_0xbd544:
pokenamemem QWILFISH, $1
displaylocation ROUTE_32, $2
writebyte $1
special $0048
special Functionc3fc
farjump UnknownScript_0xa05d6
UnknownScript_0xbd55c:
@ -827,7 +827,7 @@ UnknownScript_0xbd560:
iftrue UnknownScript_0xbd5c3
UnknownScript_0xbd57f:
special $005d
special RandomPhoneMon
farjump UnknownScript_0xa0948
UnknownScript_0xbd586:
@ -3079,7 +3079,7 @@ UnknownScript_0xbe61c:
end
UnknownScript_0xbe622:
special $005d
special RandomPhoneMon
farscall UnknownScript_0xbde3f
if_equal $0, UnknownScript_0xbe636
farwritetext UnknownText_0x1b518b

2585
engine/pokedex.asm Normal file

File diff suppressed because it is too large Load Diff

106
engine/spawn_points.asm Normal file
View File

@ -0,0 +1,106 @@
SpawnPoints: ; 0x152ab
const_def
spawn: MACRO
; name, map, y, x
\1\@ EQUS "SPAWN_\1"
const \1\@
map \2
db \3, \4
ENDM
spawn HOME, KRISS_HOUSE_2F, 3, 3
spawn DEBUG, VIRIDIAN_POKECENTER_1F, 5, 3
spawn PALLET, PALLET_TOWN, 5, 6
spawn VIRIDIAN, VIRIDIAN_CITY, 23, 26
spawn PEWTER, PEWTER_CITY, 13, 26
spawn CERULEAN, CERULEAN_CITY, 19, 22
spawn ROCK_TUNNEL, ROUTE_10A, 11, 2
spawn VERMILION, VERMILION_CITY, 9, 6
spawn LAVENDER, LAVENDER_TOWN, 5, 6
spawn SAFFRON, SAFFRON_CITY, 9, 30
spawn CELADON, CELADON_CITY, 29, 10
spawn FUCHSIA, FUCHSIA_CITY, 19, 28
spawn CINNABAR, CINNABAR_ISLAND, 11, 12
spawn INDIGO, ROUTE_23, 9, 6
spawn NEW_BARK, NEW_BARK_TOWN, 13, 6
spawn CHERRYGROVE, CHERRYGROVE_CITY, 29, 4
spawn VIOLET, VIOLET_CITY, 31, 26
spawn UNION_CAVE, ROUTE_32, 11, 74
spawn AZALEA, AZALEA_TOWN, 15, 10
spawn CIANWOOD, CIANWOOD_CITY, 23, 44
spawn GOLDENROD, GOLDENROD_CITY, 15, 28
spawn OLIVINE, OLIVINE_CITY, 13, 22
spawn ECRUTEAK, ECRUTEAK_CITY, 23, 28
spawn MAHOGANY, MAHOGANY_TOWN, 15, 14
spawn LAKE, LAKE_OF_RAGE, 21, 29
spawn BLACKTHORN, BLACKTHORN_CITY, 21, 30
spawn MT_SILVER, SILVER_CAVE_OUTSIDE, 23, 20
spawn FAST_SHIP, FAST_SHIP_CABINS_SW_SSW_NW, 6, 2
db -1, -1, -1, -1
const NUM_SPAWNS
LoadSpawnPoint: ; 1531f
push hl
push de
ld a, [wd001]
cp -1
jr z, .asm_15341
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, SpawnPoints
add hl, de
ld a, [hli]
ld [MapGroup], a
ld a, [hli]
ld [MapNumber], a
ld a, [hli]
ld [XCoord], a
ld a, [hli]
ld [YCoord], a
.asm_15341
pop de
pop hl
ret
; 15344
IsSpawnPoint: ; 15344
ld hl, SpawnPoints
ld c, 0
.asm_15349
ld a, [hl]
cp -1
jr z, .asm_1535f
cp d
jr nz, .asm_15356
inc hl
ld a, [hld]
cp e
jr z, .asm_15361
.asm_15356
push bc
ld bc, 4
add hl, bc
pop bc
inc c
jr .asm_15349
.asm_1535f
and a
ret
.asm_15361
scf
ret
; 15363

642
engine/specials.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -122,16 +122,16 @@ PokeCenterNurseScript: ; bc09c
; Go ahead and heal
farwritetext UnknownText_0x1b01bd
pause 20
special $009d
special Function1060a2
; Turn to the machine
spriteface $fe, $2
pause 10
special $001b
special Functionc658
playmusic MUSIC_NONE
writebyte $0
special $003e
special Function12324
pause 30
special $003d
special RestartMapMusic
spriteface $fe, $0
pause 10
; Has Elm already phoned you about Pokerus?
@ -141,7 +141,7 @@ PokeCenterNurseScript: ; bc09c
checkflag $000d
iftrue .done
; Check for Pokerus
special $004e ; SPECIAL_CHECKPOKERUS
special SpecialCheckPokerus ; SPECIAL_CHECKPOKERUS
iftrue .pokerus
.done
; Thank you for waiting. ...
@ -212,7 +212,7 @@ UnknownScript_0xbc17a: ; 0xbc17a
loadfont
farwritetext UnknownText_0x1b048d
closetext
special $0026
special Functionc2c0
loadmovesprites
end
; 0xbc185
@ -236,7 +236,7 @@ UnknownScript_0xbc191: ; 0xbc191
UnknownScript_0xbc195: ; 0xbc195
loadfont
writebyte $0
special $0028
special Functionc355
loadmovesprites
end
; 0xbc19d
@ -244,7 +244,7 @@ UnknownScript_0xbc195: ; 0xbc195
UnknownScript_0xbc19d: ; 0xbc19d
loadfont
writebyte $4
special $0028
special Functionc355
loadmovesprites
end
; 0xbc1a5
@ -255,7 +255,7 @@ UnknownScript_0xbc1a5: ; 0xbc1a5
UnknownScript_0xbc1a9: ; 0xbc1a9
loadfont
special $001c
special Function1559a
loadmovesprites
end
; 0xbc1af
@ -371,7 +371,7 @@ UnknownScript_0xbc242: ; 0xbc242
; 0xbc25c
UnknownScript_0xbc25c: ; 0xbc25c
special $0034
special WhiteBGMap
scall UnknownScript_0xbc380
setevent $0747
clearevent $0748
@ -389,7 +389,7 @@ UnknownScript_0xbc274: ; bc274
loadfont
farwritetext UnknownText_0x1b05bf
closetext
special $0014
special Functionc34a
RAM2MEM $0
if_equal $1, UnknownScript_0xbc31e
if_equal $2, UnknownScript_0xbc332
@ -415,9 +415,9 @@ UnknownScript_0xbc2b6:
iffalse UnknownScript_0xbc2c4
farwritetext UnknownText_0x1b06d9
closetext
special $0017
special Function13a31
UnknownScript_0xbc2c4:
special $0015
special Function4d9e5
if_equal $0, UnknownScript_0xbc2d4
if_equal $2, UnknownScript_0xbc2d4
farwritetext UnknownText_0x1b070d
@ -447,7 +447,7 @@ UnknownScript_0xbc2d4:
setevent $0728
setevent $0729
setflag $0051
special $003c
special PlayMapMusic
end
; 0xbc31e
@ -692,7 +692,7 @@ UnknownScript_0xbc3db: ; 0xbc3db
; 0xbc574
UnknownScript_0xbc574: ; 0xbc574
special $005d
special RandomPhoneMon
checkcode $17
if_equal $5, UnknownScript_0xbc5c9
if_equal $7, UnknownScript_0xbc5ce
@ -816,7 +816,7 @@ UnknownScript_0xbc628: ; 0xbc628
; 0xbc62d
UnknownScript_0xbc62d: ; 0xbc62d
special $005d
special RandomPhoneMon
checkcode $17
if_equal $5, UnknownScript_0xbc682
if_equal $7, UnknownScript_0xbc687
@ -2257,7 +2257,7 @@ UnknownScript_0xbcde0: ; 0xbcde0
farwritetext UnknownText_0x1b07e3
UnknownScript_0xbcde4: ; 0xbcde4
special $0050
special Function24b4e
loadmenudata MenuDataHeader_0xbce54
interpretmenu2
writebackup
@ -2336,7 +2336,7 @@ MenuData2_0xbce5c: ; 0xbce5c
UnknownScript_0xbce7f: ; 0xbce7f
faceplayer
loadfont
special $0059
special Function718d
if_less_than 50, UnknownScript_0xbce9a
if_less_than 150, UnknownScript_0xbce93
farwritetext UnknownText_0x1b092a

168
event/move_deleter.asm Normal file
View File

@ -0,0 +1,168 @@
Function2c547: ; 2c547
ld hl, UnknownText_0x2c5ef
call PrintText
call YesNoBox
jr c, .asm_2c5c3
ld hl, UnknownText_0x2c5f4
call PrintText
callba Function50000
jr c, .asm_2c5c3
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_2c5bc
ld a, [CurPartyMon]
ld hl, PartyMon1Moves + 1
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [hl]
and a
jr z, .asm_2c5ca
ld hl, UnknownText_0x2c5ea
call PrintText
call Function1d6e
callba Function12f5b
push af
call Function2b74
pop af
jr c, .asm_2c5c3
ld a, [wcfa9]
push af
ld a, [CurSpecies]
ld [wd265], a
call GetMoveName
ld hl, UnknownText_0x2c5d6
call PrintText
call YesNoBox
pop bc
jr c, .asm_2c5c3
call Function2c5f9
call WaitSFX
ld de, SFX_MOVE_DELETED
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x2c5db
call PrintText
ret
.asm_2c5bc
ld hl, UnknownText_0x2c5e0
call PrintText
ret
.asm_2c5c3
ld hl, UnknownText_0x2c5e5
call PrintText
ret
.asm_2c5ca
ld hl, UnknownText_0x2c5d1
call PrintText
ret
; 2c5d1
UnknownText_0x2c5d1: ; 0x2c5d1
; That #MON knows only one move.
text_jump UnknownText_0x1c5eba
db "@"
; 0x2c5d6
UnknownText_0x2c5d6: ; 0x2c5d6
; Oh, make it forget @ ?
text_jump UnknownText_0x1c5eda
db "@"
; 0x2c5db
UnknownText_0x2c5db: ; 0x2c5db
; Done! Your #MON forgot the move.
text_jump UnknownText_0x1c5ef5
db "@"
; 0x2c5e0
UnknownText_0x2c5e0: ; 0x2c5e0
; An EGG doesn't know any moves!
text_jump UnknownText_0x1c5f17
db "@"
; 0x2c5e5
UnknownText_0x2c5e5: ; 0x2c5e5
; No? Come visit me again.
text_jump UnknownText_0x1c5f36
db "@"
; 0x2c5ea
UnknownText_0x2c5ea: ; 0x2c5ea
; Which move should it forget, then?
text_jump UnknownText_0x1c5f50
db "@"
; 0x2c5ef
UnknownText_0x2c5ef: ; 0x2c5ef
; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget?
text_jump UnknownText_0x1c5f74
db "@"
; 0x2c5f4
UnknownText_0x2c5f4: ; 0x2c5f4
; Which #MON?
text_jump UnknownText_0x1c5fd1
db "@"
; 0x2c5f9
Function2c5f9: ; 2c5f9
ld a, b
push bc
dec a
ld c, a
ld b, 0
ld hl, PartyMon1Moves
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
push bc
inc b
.asm_2c60f
ld a, b
cp NUM_MOVES + 1
jr z, .asm_2c61b
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .asm_2c60f
.asm_2c61b
xor a
ld [hl], a
pop bc
ld a, b
push bc
dec a
ld c, a
ld b, 0
ld hl, PartyMon1PP
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
inc b
.asm_2c633
ld a, b
cp NUM_MOVES + 1
jr z, .asm_2c63f
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .asm_2c633
.asm_2c63f
xor a
ld [hl], a
ret
; 2c642

View File

@ -1380,7 +1380,7 @@ RareCandy: ; ef14
callba Function50e47
pop de
ld a, $8
ld a, PartyMon1Exp - PartyMon1
call GetPartyParamLocation
ld a, [hMultiplicand]
@ -1390,7 +1390,7 @@ RareCandy: ; ef14
ld a, [$ffb6]
ld [hl], a
ld a, $24
ld a, PartyMon1MaxHP - PartyMon1
call GetPartyParamLocation
ld a, [hli]
ld b, a
@ -1398,7 +1398,7 @@ RareCandy: ; ef14
push bc
call Functionee8c
ld a, $25
ld a, PartyMon1MaxHP + 1 - PartyMon1
call GetPartyParamLocation
pop bc
@ -1431,7 +1431,7 @@ RareCandy: ; ef14
hlcoord 11, 1
ld bc, $0004
predef Function50b7b
predef PrintTempMonStats
call Functiona80
@ -1498,7 +1498,7 @@ Functionefda: ; efda (3:6fda)
ld a, $1
ret z
call Functionf058
ld a, $20
ld a, PartyMon1Status - PartyMon1
call GetPartyParamLocation
ld a, [hl]
and c
@ -1537,7 +1537,7 @@ Functionf009: ; f009 (3:7009)
Functionf01e: ; f01e (3:701e)
call Functionf2a6
ret nc
ld a, $22
ld a, PartyMon1HP - PartyMon1
call GetPartyParamLocation
ld a, [hli]
ld [BattleMonHP], a
@ -1955,7 +1955,7 @@ Functionf2ba: ; f2ba (3:72ba)
Functionf2c3: ; f2c3 (3:72c3)
call Functionf36f
asm_f2c6: ; f2c6 (3:72c6)
ld a, $22
ld a, PartyMon1HP - PartyMon1
call GetPartyParamLocation
ld [hl], d
inc hl
@ -1963,7 +1963,7 @@ asm_f2c6: ; f2c6 (3:72c6)
jp Functionf328
Functionf2d1: ; f2d1 (3:72d1)
ld a, $23
ld a, PartyMon1HP + 1 - PartyMon1
call GetPartyParamLocation
ld a, [hl]
add e
@ -1973,11 +1973,11 @@ Functionf2d1: ; f2d1 (3:72d1)
ld [hl], a
jr c, .asm_f2f5
call Functionf328
ld a, $23
ld a, PartyMon1HP + 1 - PartyMon1
call GetPartyParamLocation
ld d, h
ld e, l
ld a, $25
ld a, PartyMon1MaxHP + 1 - PartyMon1
call GetPartyParamLocation
ld a, [de]
sub [hl]
@ -1992,7 +1992,7 @@ Functionf2d1: ; f2d1 (3:72d1)
ret
Functionf2f9: ; f2f9 (3:72f9)
ld a, $23
ld a, PartyMon1HP + 1 - PartyMon1
call GetPartyParamLocation
ld a, [hl]
sub e
@ -2030,7 +2030,7 @@ Functionf31b: ; f31b (3:731b)
ret
Functionf328: ; f328 (3:7328)
ld a, $22
ld a, PartyMon1HP - PartyMon1
call GetPartyParamLocation
ld a, [hli]
ld [wd1ef], a
@ -2056,7 +2056,7 @@ Functionf33f: ; f33f
; f348
Functionf348: ; f348 (3:7348)
ld a, $22
ld a, PartyMon1HP - PartyMon1
call GetPartyParamLocation
ld a, [hli]
ld [wd1ed], a
@ -2073,7 +2073,7 @@ Functionf356: ; f356 (3:7356)
Functionf35f: ; f35f (3:735f)
push hl
ld a, $24
ld a, PartyMon1MaxHP - PartyMon1
call GetPartyParamLocation
ld a, [hli]
ld [Buffer2], a

View File

@ -80,11 +80,19 @@ callasm: macro
dw \1
endm
special: macro
db $0f
dw \1 ; predefined_script
dw (\1Special - SpecialsPointers) / 3
endm
add_special: MACRO
\1Special::
db BANK(\1)
dw \1
ENDM
ptcallasm: macro
db $10
dw \1 ; asm

View File

@ -64,3 +64,99 @@ warp_def: macro
db \4 ; map group
db \5 ; map number
endm
map_header: MACRO
; label, tileset, permission, location, music, time of day, fishing group
\1_MapHeader:
db BANK(\1_SecondMapHeader), \2, \3
dw \1_SecondMapHeader
db \4, \5, \6, \7
ENDM
map_header_2: MACRO
; label, map, border block, connections
\1_SecondMapHeader::
db \3
\2\@HEIGHT EQUS "\2_HEIGHT"
\2\@WIDTH EQUS "\2_WIDTH"
db \2\@HEIGHT, \2\@WIDTH
db BANK(\1_BlockData)
dw \1_BlockData
db BANK(\1_MapScriptHeader)
dw \1_MapScriptHeader
dw \1_MapEventHeader
db \4
ENDM
connection: MACRO
if "\1" == "north"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \2_WIDTH * (\2_HEIGHT - 3) + \5
dw OverworldMap + \4 + 3
db \6
db \2_WIDTH
db \2_HEIGHT * 2 - 1
db (\4 - \5) * -2
dw OverworldMap + \2_HEIGHT * (\2_WIDTH + 6) + 1
endc
if "\1" == "south"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: x
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + \5
dw OverworldMap + (\7_HEIGHT + 3) * (\7_WIDTH + 6) + \4 + 3
db \6
db \2_WIDTH
db 0
db (\4 - \5) * -2
dw OverworldMap + \2_WIDTH + 7
endc
if "\1" == "west"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5) + \2_WIDTH - 3
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3)
db \6
db \2_WIDTH
db (\4 - \5) * -2
db \2_WIDTH * 2 - 1
dw OverworldMap + \2_WIDTH * 2 + 6
endc
if "\1" == "east"
;\2: map id
;\3: map label (eventually will be rolled into map id)
;\4: y
;\5: offset?
;\6: strip length
;\7: this map id
map \2
dw \3_BlockData + (\2_WIDTH * \5)
dw OverworldMap + (\7_WIDTH + 6) * (\4 + 3 + 1) - 3
db \6
db \2_WIDTH
db (\4 - \5) * -2
db 0
dw OverworldMap + \2_WIDTH + 7
endc
ENDM

49787
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ UnknownScript_0x198018: ; 0x198018
moveperson $b, $b, $b
spriteface $0, $3
showemote $0, $0, 15
special $006a
special Functionc48f
pause 15
appear $b
applymovement $b, MovementData_0x198134
@ -47,7 +47,7 @@ UnknownScript_0x198018: ; 0x198018
UnknownScript_0x198034: ; 0x198034
spriteface $0, $3
showemote $0, $0, 15
special $006a
special Functionc48f
pause 15
appear $b
applymovement $b, MovementData_0x19813c

Some files were not shown because too many files have changed in this diff Show More