summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdata/force_bike_surf.asm2
-rwxr-xr-xdata/warp_tile_ids.asm56
-rw-r--r--engine/bank3d/link_menu.asm8
-rw-r--r--engine/bank3d/main.asm8
-rw-r--r--engine/bank3f/main.asm6
-rw-r--r--engine/battle/get_trainer_name.asm1
-rw-r--r--engine/battle/moveEffects/reflect_light_screen_effect.asm2
-rwxr-xr-xengine/battle/safari_zone.asm4
-rwxr-xr-xengine/give_pokemon.asm2
-rw-r--r--engine/joypad.asm12
-rwxr-xr-xengine/overworld/player_animations.asm6
-rwxr-xr-xengine/palettes.asm8
-rwxr-xr-xengine/town_map.asm17
-rw-r--r--home.asm4
-rw-r--r--home/audio.asm7
-rw-r--r--home/overworld.asm24
-rwxr-xr-xmain.asm24
-rw-r--r--pic/ymon/electrode.pngbin199 -> 659 bytes
-rw-r--r--sram.asm3
-rwxr-xr-xyellow/main.asm285
20 files changed, 382 insertions, 97 deletions
diff --git a/data/force_bike_surf.asm b/data/force_bike_surf.asm
index 66cae0a4..71c2c0cc 100755
--- a/data/force_bike_surf.asm
+++ b/data/force_bike_surf.asm
@@ -1,4 +1,4 @@
-ForcedBikeOrSurfMaps: ; c3e6 (3:43e6)
+ForcedBikeOrSurfMaps: ; c12f (3:412f)
; map id, y, x
db ROUTE_16,$0A,$11
db ROUTE_16,$0B,$11
diff --git a/data/warp_tile_ids.asm b/data/warp_tile_ids.asm
index aa725d00..1e40c9ce 100755
--- a/data/warp_tile_ids.asm
+++ b/data/warp_tile_ids.asm
@@ -1,4 +1,4 @@
-WarpTileIDPointers: ; c4cc (3:44cc)
+WarpTileIDPointers: ; c215 (3:4215)
dw OverworldWarpTileIDs
dw RedsHouse1WarpTileIDs
dw MartWarpTileIDs
@@ -23,63 +23,67 @@ WarpTileIDPointers: ; c4cc (3:44cc)
dw ClubWarpTileIDs
dw FacilityWarpTileIDs
dw PlateauWarpTileIDs
-
-OverworldWarpTileIDs: ; c4fc (3:44fc)
+ dw BeachHouseWarpTileIDs
+
+OverworldWarpTileIDs: ; c247 (3:4247)
db $1B,$58,$FF
-ForestGateWarpTileIDs: ; c4ff (3:44ff)
-MuseumWarpTileIDs: ; c4ff (3:44ff)
-GateWarpTileIDs: ; c4ff (3:44ff)
+ForestGateWarpTileIDs: ; c24a (3:424a)
+MuseumWarpTileIDs: ; c24a (3:424a)
+GateWarpTileIDs: ; c24a (3:424a)
db $3B
-RedsHouse1WarpTileIDs: ; c500 (3:4500)
-RedsHouse2WarpTileIDs: ; c500 (3:4500)
+RedsHouse1WarpTileIDs: ; c24b (3:424b)
+RedsHouse2WarpTileIDs: ; c24b (3:424b)
db $1A,$1C,$FF
-MartWarpTileIDs: ; c503 (3:4503)
-PokecenterWarpTileIDs: ; c503 (3:4503)
+MartWarpTileIDs: ; c24e (3:424e)
+PokecenterWarpTileIDs: ; c24e (3:424e)
db $5E,$FF
-ForestWarpTileIDs: ; c505 (3:4505)
+ForestWarpTileIDs: ; c250 (3:4250)
db $5A,$5C,$3A,$FF
-DojoWarpTileIDs: ; c509 (3:4509)
-GymWarpTileIDs: ; c509 (3:4509)
+DojoWarpTileIDs: ; c254 (3:4254)
+GymWarpTileIDs: ; c254 (3:4254)
db $4A,$FF
-HouseWarpTileIDs: ; c50b (3:450b)
+HouseWarpTileIDs: ; c256 (3:4256)
db $54,$5C,$32,$FF
-ShipWarpTileIDs: ; c50f (3:450f)
+ShipWarpTileIDs: ; c25a (3:425a)
db $37,$39,$1E,$4A,$FF
-InteriorWarpTileIDs: ; c514 (3:4514)
+InteriorWarpTileIDs: ; c25f (3:425f)
db $15,$55,$04,$FF
-CavernWarpTileIDs: ; c518 (3:4518)
+CavernWarpTileIDs: ; c263 (3:4263)
db $18,$1A,$22,$FF
-LobbyWarpTileIDs: ; c51c (3:451c)
+LobbyWarpTileIDs: ; c267 (3:4267)
db $1A,$1C,$38,$FF
-MansionWarpTileIDs: ; c520 (3:4520)
+MansionWarpTileIDs: ; c26b (3:426b)
db $1A,$1C,$53,$FF
-LabWarpTileIDs: ; c524 (3:4524)
+LabWarpTileIDs: ; c26f (3:426f)
db $34,$FF
-FacilityWarpTileIDs: ; c526 (3:4526)
+FacilityWarpTileIDs: ; c271 (3:4571)
db $43,$58,$20
-CemeteryWarpTileIDs: ; c529 (3:4529)
+CemeteryWarpTileIDs: ; c274 (3:4274)
db $1B
-UndergroundWarpTileIDs: ; c52a (3:452a)
+UndergroundWarpTileIDs: ; c275 (3:4275)
db $13,$FF
-PlateauWarpTileIDs: ; c52c (3:452c)
+PlateauWarpTileIDs: ; c277 (3:4277)
db $1B,$3B
-ShipPortWarpTileIDs: ; c52e (3:452e)
-ClubWarpTileIDs: ; c52e (3:452e)
+ShipPortWarpTileIDs: ; c279 (3:4279)
+ClubWarpTileIDs: ; c279 (3:4279)
db $FF
+
+BeachHouseWarpTileIDs: ; c27a (3:427a)
+ db $FF \ No newline at end of file
diff --git a/engine/bank3d/link_menu.asm b/engine/bank3d/link_menu.asm
index 5cf1dc8e..edd040b0 100644
--- a/engine/bank3d/link_menu.asm
+++ b/engine/bank3d/link_menu.asm
@@ -529,6 +529,7 @@ Func_f56bd:: ; f56bd (3d:56bd)
ld e,l
hlCoord 1,12
call PlaceString
+.asm_f56e6
call Delay3
ld a,$1
ld [H_AUTOBGTRANSFERENABLED],a
@@ -807,6 +808,7 @@ LinkMenu: ; f580c (3d:580c)
ld d,$ec
ld e,$7f
call Func_f59ec
+.asm_f5974
xor a
ld [wBuffer], a
ld a,$ff
@@ -849,12 +851,12 @@ LinkMenu: ; f580c (3d:580c)
ld d,$7f
ld e,$ec
call Func_f59ec
- jp .chooseCancel
+ jp .choseCancel
.asm_f59cd
ld hl,Text_f5a11
call PrintText
- jp .chooseCancel
+ jp .choseCancel
.asm_f59d6
ld b,$7f
@@ -863,7 +865,7 @@ LinkMenu: ; f580c (3d:580c)
ld e,$7f
call Func_f59ec
call Func_f531b
- jp c,.chooseCancel
+ jp c,.choseCancel
ld a,$f0
jp .next
diff --git a/engine/bank3d/main.asm b/engine/bank3d/main.asm
index 7a2435a5..6e9788d1 100644
--- a/engine/bank3d/main.asm
+++ b/engine/bank3d/main.asm
@@ -39,6 +39,7 @@ Func_f42c2:: ; f42c2 (3d:f42c2)
cp $31
jr nc,.asm_f42ce
ld a,$7f
+.asm_f42ce
ld [hl],a
ld bc,$14
add hl,bc
@@ -68,6 +69,7 @@ Func_f430a:: ; f430a (3d:430a)
callab Func_fcdb8
pop de
ret nc
+.asm_f432b
push de
ld e,$0
ld a,[wd470]
@@ -77,6 +79,7 @@ Func_f430a:: ; f430a (3d:430a)
cp $c8
jr c,.asm_f433b
inc e
+.asm_f433b
ld c,d
dec c
ld b,$0
@@ -124,6 +127,7 @@ Func_f430a:: ; f430a (3d:430a)
.asm_f4380
ld a,b
ld [wd471],a
+.asm_f4384
ret
Pointer_f4385:: ; f4385 (3d:4385)
@@ -271,7 +275,7 @@ HandleMenuInputDouble:: ; f5a40 (3d:5a40)
xor a
ld [wd09b],a
-HandleMenuInputPokemonSelectionDouble:: ; 3aaf (0:3aaf)
+HandleMenuInputPokemonSelectionDouble:: ; f5a44 (3d:5a44)
ld a,[H_DOWNARROWBLINKCNT1]
push af
ld a,[H_DOWNARROWBLINKCNT2]
@@ -280,6 +284,7 @@ HandleMenuInputPokemonSelectionDouble:: ; 3aaf (0:3aaf)
ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
ld a,$06
ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
+.loop1
xor a
ld [wPartyMonAnimCounter],a ; counter for pokemon shaking animation
call Func_f5ab0
@@ -387,6 +392,7 @@ Func_f5ab0:: ; f5ab0 (3d:5ab0)
cp "▶"
jr z,.asm_f5af4
ld [wTileBehindCursor],a
+.asm_f5af4
ld a,"▶"
ld [hl],a
ld a,l
diff --git a/engine/bank3f/main.asm b/engine/bank3f/main.asm
index 71362c2c..67ebd85b 100644
--- a/engine/bank3f/main.asm
+++ b/engine/bank3f/main.asm
@@ -250,7 +250,7 @@ Func_fc65b:: ; fc65b (3f:465b)
ld a,[wSpriteStateData1 + $9]
and a ; SPRITE_FACING_DOWN
jr z,.asm_fc684
- jr asm_fc688
+ jr .asm_fc688
.asm_fc684
ld a,$0
jr .asm_fc68a
@@ -290,7 +290,9 @@ Func_fc69a:: ; fc69a (3f:469a)
ld [wd431],a
ret
-INCBIN "baserom.gbc",$fc6c5,$fe66f - $fc6c5
+INCBIN "baserom.gbc",$fc6c5,$fcc08 - $fc6c5
+Func_fcc08:: ; fcc08 (3f:4c08)
+INCBIN "baserom.gbc",$fcc08,$fe66f - $fcc08
OfficerJennySprite: INCBIN "gfx/sprites/officer_jenny.2bpp"
PikachuSprite: INCBIN "gfx/sprites/pikachu.2bpp"
diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm
index d32b80b9..d393b800 100644
--- a/engine/battle/get_trainer_name.asm
+++ b/engine/battle/get_trainer_name.asm
@@ -18,6 +18,7 @@ GetTrainerName_: ; f67a5 (3d:67a5)
ld [wPredefBank], a
call GetName
ld hl, wcd6d
+.foundName
.rival
ld de, W_TRAINERNAME
ld bc, $d
diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm
index c12c6018..83a97486 100644
--- a/engine/battle/moveEffects/reflect_light_screen_effect.asm
+++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm
@@ -41,5 +41,5 @@ ReflectGainedArmorText: ; f64a2 (3d:64a2)
db "@"
Bankswitch3DtoF: ; f64a7 (3d:64a7)
- ld b, BANK(BattleCore)
+ ld b, $f ; BANK(BattleCore)
jp Bankswitch
diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm
index e195966d..00627d74 100755
--- a/engine/battle/safari_zone.asm
+++ b/engine/battle/safari_zone.asm
@@ -5,7 +5,7 @@ PrintSafariZoneBattleText: ; 4111 (1:4111)
jr z, .asm_411e
dec [hl]
ld hl, SafariZoneEatingText
- jr .asm_429f
+ jr .asm_4138
.asm_411e
dec hl
ld a, [hl]
@@ -13,7 +13,7 @@ PrintSafariZoneBattleText: ; 4111 (1:4111)
ret z
dec [hl]
ld hl, SafariZoneAngryText
- jr nz, .asm_4139
+ jr nz, .asm_4138
push hl
ld a, [wEnemyMonSpecies]
ld [wd0b5], a
diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm
index a74c756f..2bc23ce3 100755
--- a/engine/give_pokemon.asm
+++ b/engine/give_pokemon.asm
@@ -19,7 +19,7 @@ _GivePokemon: ; f66fa (3d:66fa)
ld a, [wd5a0]
and $7f
cp 9
- jr c, .boxEightorLesser ; do not adjust box number to a 2 digit number
+ jr c, .boxEightOrLesser ; do not adjust box number to a 2 digit number
sub 9
ld [hl], "1"
inc hl
diff --git a/engine/joypad.asm b/engine/joypad.asm
index 791056ca..bca84b33 100644
--- a/engine/joypad.asm
+++ b/engine/joypad.asm
@@ -2,14 +2,16 @@ ReadJoypad_:: ; c000 (3:4000)
; Poll joypad input.
; Unlike the hardware register, button
; presses are indicated by a set bit.
-
+ ld a, [hReadJoypad]
+ and a
+ ret nz
+
ld a, 1 << 5 ; select direction keys
- ld c, 0
+ ;ld c, 0
ld [rJOYP], a
- rept 6
ld a, [rJOYP]
- endr
+ ld a, [rJOYP]
cpl
and %1111
swap a
@@ -17,7 +19,7 @@ ReadJoypad_:: ; c000 (3:4000)
ld a, 1 << 4 ; select button keys
ld [rJOYP], a
- rept 10
+ rept 6
ld a, [rJOYP]
endr
cpl
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index b2c8d94d..bd0a52b5 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -388,7 +388,7 @@ IsPlayerStandingOnWarpPadOrHole: ; 707e7 (1c:47e7)
db INTERIOR, $55, 1 ; warp pad
db $FF
-Func_707b6: ; 70716 (1c:4716)
+Func_70816: ; 70816 (1c:4816)
ld c, $a
call DelayFrames
ld hl, wd736
@@ -414,7 +414,7 @@ Func_707b6: ; 70716 (1c:4716)
ld a, [wWhichTrade] ; wWhichTrade
and a
ld hl, NoNibbleText
- jr z, .asm_708a8
+ jr z, .asm_70897
cp $2
ld hl, NothingHereText
jr z, .asm_70897
@@ -445,7 +445,7 @@ Func_707b6: ; 70716 (1c:4716)
ld [wOAMBuffer + $9c], a
.asm_70894
ld hl, ItsABiteText
-.asm_70836
+.asm_70897
call PrintText
ld hl, wd736
res 6, [hl]
diff --git a/engine/palettes.asm b/engine/palettes.asm
index 5df64c7a..20dbdccb 100755
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -310,14 +310,14 @@ DeterminePaletteIDOutOfBattle: ; 72094 (1c:6094)
Func_720ad:: ; 720ad (1c:60ad)
ld a,e
and a
- jr nz,.asm_720bd
+ jr nz,Func_720bd
ld hl,Pointer_727e1
ld a,[hGBC]
and a
jp z,Func_721b4
jp Func_72346
-Func_720bd :: ; 720bd (1c:60bd)
+Func_720bd:: ; 720bd (1c:60bd)
ld hl,Func_72811
ld a,[hGBC]
and a
@@ -356,6 +356,7 @@ Func_720e3:: ; 720e3 (1c:60e3)
jr .asm_7210c
.asm_72109
call Func_72346
+.asm_7210c
ld hl,UnknownPacket_72611
ld de,wcf2d
ld bc,$10
@@ -379,7 +380,7 @@ Func_720e3:: ; 720e3 (1c:60e3)
jr .asm_7213a
.asm_72137
call Func_72346
-.asm_7231a
+.asm_7213a
ret
Func_7213b:: ; 7213b (1c:613b)
@@ -1110,6 +1111,7 @@ Func_725be:: ; 725be (1c:65be)
ld hl,Pointer_725e2
ld a,[hli]
ld c,a
+.asm_725c5
ld a,e
.loop
cp [hl]
diff --git a/engine/town_map.asm b/engine/town_map.asm
index dafcd926..48e79d14 100755
--- a/engine/town_map.asm
+++ b/engine/town_map.asm
@@ -38,7 +38,7 @@ Func_70ef4: ; 70ef4 (1c:4ef4)
add hl, bc
ld a, [hl]
-Func_70e92: ; 70f08 (1c:4f08)
+Func_70f08: ; 70f08 (1c:4f08)
ld de, wHPBarMaxHP
call Func_712f1
ld a, [de]
@@ -201,7 +201,7 @@ LoadTownMap_Fly: ; 71014 (1c:5014)
ld b, a
pop hl
and D_DOWN | D_UP | B_BUTTON | A_BUTTON
- jr z, .asm_7108b
+ jr z, .asm_7108d
bit 0, b
jr nz, .asm_710af
ld a, (SFX_02_3c - SFX_Headers_02) / 3
@@ -320,8 +320,8 @@ LoadTownMap: ; 71126 (1c:5126)
dec c
jr nz, .loop
inc de
- jr .asm_7115d
-.asm_71073
+ jr .asm_710d3
+.asm_71173
call EnableLCD
ld b, $2
call GoPAL_SET
@@ -409,7 +409,7 @@ Func_71279: ; 711ef (1c:51ef)
ld de, AreaUnknownText
call PlaceString
jr .asm_712c7
-.asm_71236
+.asm_712bf
ld a, [W_CURMAP] ; W_CURMAP
ld b, $0
call Func_7124e
@@ -546,10 +546,9 @@ Func_71362: ; 71362 (1c:5362)
jr nz, .asm_71377
xor a
ld [hl], a
-.asm_71277
+.asm_71377
inc hl
- jr .asm_7126d
-
+ jr .asm_7136d
Func_7137a: ; 7137a (1c:537a)
cp REDS_HOUSE_1F
jr c, .asm_7138d
@@ -559,7 +558,7 @@ Func_7137a: ; 7137a (1c:537a)
cp [hl]
jr c, .asm_7138a
add hl, bc
- jr .asm_71284
+ jr .asm_71384
.asm_7138a
inc hl
jr .asm_71384
diff --git a/home.asm b/home.asm
index 91eb27a4..a1f150fe 100644
--- a/home.asm
+++ b/home.asm
@@ -167,7 +167,6 @@ ReadJoypad:: ; 01c8 (0:01c8)
INCLUDE "home/overworld.asm"
-
CheckForUserInterruption:: ; 10ba (0:10ba)
; Return carry if Up+Select+B, Start or A are pressed in c frames.
; Used only in the intro and title screen.
@@ -1553,7 +1552,7 @@ DisplayListMenuID:: ; 2ae0 (0:2ae0)
ld a,$01 ; hardcoded bank
jr .bankswitch
.specialBattleType ; Old Man battle
- ld a, Bank(DisplayBattleMenu)
+ ld a, $1 ; BANK(DisplayBattleMenu)
.bankswitch
call BankswitchHome
ld hl,wd730
@@ -3008,6 +3007,7 @@ IsSurfingPikachuInParty:: ; 342a (0:342a)
ld a,[hli]
cp b
jr nz,.noSurf
+.hasSurf
ld a,[wd472]
set 6,a
ld [wd472],a
diff --git a/home/audio.asm b/home/audio.asm
index 2f881f3f..0bfaee17 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -11,12 +11,12 @@ Func_2176:: ; 2176 (0:2176)
ld d, $0
ld a, [wd72e]
bit 5, a
- jr z, asm_2118
+ jr z, asm_2188
xor a
ld [wcfca], a
ld c, $8
ld d, c
-asm_2118:: ; 2118 (0:2118)
+asm_2188: ; 2118 (0:2118)
ld a, [wWalkBikeSurfState]
and a
jr z, .asm_21ac
@@ -258,7 +258,6 @@ Func_22d6:: ; 22d6 (0:22d6)
ret
Func_22ec:: ; 22ec (0:22ec)
-; incomplete
ld a,[H_LOADEDROMBANK]
push af
ld a,[wc0ef]
@@ -274,7 +273,7 @@ Func_22ec:: ; 22ec (0:22ec)
jr nz, .checkForBank1F
.bank08
ld a, b
- call Func_22035
+ call Func_218bb
jr .done
.checkForBank1F
cp BANK(Func_7d10d)
diff --git a/home/overworld.asm b/home/overworld.asm
index e9472161..f0e7f990 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -3,7 +3,7 @@ EnterMap:: ; 01d7 (0:01d7)
ld a, $ff
ld [wJoyIgnore], a
call LoadMapData
- callba ClearVariablesAfterLoadingMapData
+ callba ClearVariablesAfterLoadingMapData ; 3:407c
ld hl, wd72c
bit 0, [hl] ; has the player already made 3 steps since the last battle?
jr z, .skipGivingThreeStepsOfNoRandomBattles
@@ -50,7 +50,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245)
and a
jp nz,.moveAhead ; if the player sprite has not yet completed the walking animation
call JoypadOverworld ; get joypad state (which is possibly simulated)
- callba SafariZoneCheck
+ callba SafariZoneCheck ; 7:6321
ld a,[wSafariZoneGameOver]
and a
jp nz,WarpFound2
@@ -1276,7 +1276,8 @@ CheckForJumpingAndTilePairCollisions:: ; 0a86 (0:0a86)
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player
push de
push bc
- callba HandleLedges ; check if the player is trying to jump a ledge
+ callba HandleLedges ; 6:67f4
+ ; check if the player is trying to jump a ledge
pop bc
pop de
pop hl
@@ -1616,7 +1617,7 @@ ForceBikeDown:: ; 0c65 (0:0c65)
ret nz
ld a,[hJoyHeld]
and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
- jr nz,.notForcedDownwards
+ ret nz
ld a,D_DOWN
ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
ret
@@ -1693,13 +1694,13 @@ CollisionCheckOnWater:: ; 0cca (0:0cca)
ld d,a
ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
and d ; check if a sprite is in the direction the player is trying to go
- jr nz,.checkIfNextTileIsPassable ; bug?
+ jr nz,.collision ; bug?
ld hl,TilePairCollisionsWater
call CheckForJumpingAndTilePairCollisions
jr c,.collision
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player (puts it in c and [wTileInFrontOfPlayer])
callab IsNextTileShoreOrWater ; 3:6808
- jr c,.noCollsion
+ jr c,.noCollision
ld a,[wTileInFrontOfPlayer] ; tile in front of player
ld c,a
call IsTilePassable
@@ -1773,7 +1774,7 @@ Func_0d69:: ; 0d69 (0:0d69)
and a
jr z,.asm_0d75
dec a
- jr z,.asm_0d83
+ jr z,LoadSurfingPlayerSpriteGraphics
dec a
jr z,.asm_0d7c
.asm_0d75
@@ -1913,7 +1914,8 @@ LoadMapHeader:: ; 0dab (0:0dab)
bit 5,a ; did a battle happen immediately before this?
jr nz,.asm_0e73
callab Func_fc4fa ; 3f:44fa
- callab LoadWildData
+.asm_0e73
+ callab LoadWildData ; 3:4b62
pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks
add a ; double it
@@ -1940,7 +1942,7 @@ LoadMapHeader:: ; 0dab (0:0dab)
; function to copy map connection data from ROM to WRAM
; Input: hl = source, de = destination
-CopyMapConnectionHeader:: ; 1238 (0:1238)
+CopyMapConnectionHeader:: ; 0eaa (0:0eaa)
ld c,$0b
.loop
ld a,[hli]
@@ -2022,7 +2024,7 @@ Func_0f16:: ; 0f16 (0:0f16)
call ReloadMapSpriteTilePatterns
pop af
call BankswitchCommon
- jr .asm_0f4d
+ jr asm_0f4d
Func_0f3d:: ; 0f3d (0:0f3d)
ld a,[H_LOADEDROMBANK]
push af
@@ -2031,7 +2033,7 @@ Func_0f3d:: ; 0f3d (0:0f3d)
call LoadTileBlockMap
pop af
call BankswitchCommon
-.asm_0f4d
+asm_0f4d: ; 0f4d (0:0f4d)
ld hl, Func_f02da
ld b,BANK(Func_f02da) ; 3c:42da
jp Bankswitch
diff --git a/main.asm b/main.asm
index 7fe47115..060f9adf 100755
--- a/main.asm
+++ b/main.asm
@@ -1984,11 +1984,7 @@ SECTION "bank3",ROMX,BANK[$3]
INCLUDE "engine/joypad.asm"
-;INCLUDE "data/map_songs.asm"
-
-;INCLUDE "data/map_header_banks.asm"
-
-ClearVariablesAfterLoadingMapData: ; c335 (3:4335)
+ClearVariablesAfterLoadingMapData: ; c07c (3:407c)
ld a, $90
ld [hWY], a
ld [rWY], a
@@ -2010,7 +2006,7 @@ ClearVariablesAfterLoadingMapData: ; c335 (3:4335)
ret
; only used for setting bit 2 of wd736 upon entering a new map
-IsPlayerStandingOnWarp: ; c35f (3:435f)
+IsPlayerStandingOnWarp: ; c0a6 (3:40a6)
ld a, [wNumberOfWarps]
and a
ret z
@@ -2042,7 +2038,7 @@ IsPlayerStandingOnWarp: ; c35f (3:435f)
jr nz, .loop
ret
-CheckForceBikeOrSurf: ; c38b (3:438b)
+CheckForceBikeOrSurf: ; c0d2 (3:40d2)
ld hl, wd732
bit 5, [hl]
ret nz
@@ -2095,7 +2091,7 @@ CheckForceBikeOrSurf: ; c38b (3:438b)
INCLUDE "data/force_bike_surf.asm"
-IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
+IsPlayerFacingEdgeOfMap: ; c148 (3:4148)
push hl
push de
push bc
@@ -2112,10 +2108,10 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
ld b, a
ld a, [W_XCOORD]
ld c, a
- ld de, .asm_c41e
+ ld de, .returnaddress
push de
jp [hl]
-.asm_c41e
+.returnaddress
pop bc
pop de
pop hl
@@ -2161,7 +2157,7 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
scf
ret
-IsWarpTileInFrontOfPlayer: ; c44e (3:444e)
+IsWarpTileInFrontOfPlayer: ; c197 (3:4197)
push hl
push de
push bc
@@ -2187,7 +2183,7 @@ IsWarpTileInFrontOfPlayer: ; c44e (3:444e)
pop hl
ret
-.warpTileListPointers: ; c477 (3:4477)
+.warpTileListPointers: ; c1c0 (3:41c0)
dw .facingDownWarpTiles
dw .facingUpWarpTiles
dw .facingLeftWarpTiles
@@ -2215,11 +2211,11 @@ IsWarpTileInFrontOfPlayer: ; c44e (3:444e)
and a
jr .done
-IsPlayerStandingOnDoorTileOrWarpTile: ; c49d (3:449d)
+IsPlayerStandingOnDoorTileOrWarpTile: ; c1e6 (3:41e6)
push hl
push de
push bc
- callba IsPlayerStandingOnDoorTile
+ callba IsPlayerStandingOnDoorTile ; 6:6785
jr c, .done
ld a, [W_CURMAPTILESET]
add a
diff --git a/pic/ymon/electrode.png b/pic/ymon/electrode.png
index ab1a5550..f5e05464 100644
--- a/pic/ymon/electrode.png
+++ b/pic/ymon/electrode.png
Binary files differ
diff --git a/sram.asm b/sram.asm
index 26255d6b..76321c43 100644
--- a/sram.asm
+++ b/sram.asm
@@ -10,7 +10,8 @@ sHallOfFame:: ds HOF_TEAM * NUM_HOF_TEAMS ; a598
SECTION "Save Data", SRAM, BANK[1]
-SECTION "Save Data Start", SRAM1[$a598]
+SECTION "Save Data", SRAM, BANK[1]
+ ds $598
S_SAVEDPLAYERNAME:: ds 11 ; a598
S_SAVEDMAINDATA:: ds W_NUMINBOX - wPokedexOwned ; a5a3
S_SAVEDSPRITEDATA:: ds wOAMBuffer - wSpriteStateData1 ; ad2c
diff --git a/yellow/main.asm b/yellow/main.asm
index ea2546e9..6b544b06 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -16,7 +16,7 @@ PICS_5 EQU $D
SECTION "home",ROM0
INCLUDE "home.asm"
-
+;INCBIN "baserom.gbc",$0000,$4000 - $0000
SECTION "bank01",ROMX,BANK[$01]
INCLUDE "data/facing.asm"
@@ -32,7 +32,269 @@ INCBIN "baserom.gbc",$8000,$c000 - $8000
SECTION "bank03",ROMX,BANK[$03]
-INCBIN "baserom.gbc",$c000,$e91b - $c000
+INCLUDE "engine/joypad.asm"
+
+ClearVariablesAfterLoadingMapData: ; c07c (3:407c)
+ ld a, $90
+ ld [hWY], a
+ ld [rWY], a
+ xor a
+ ld [H_AUTOBGTRANSFERENABLED], a
+ ld [wStepCounter], a
+ ld [W_LONEATTACKNO], a ; W_GYMLEADERNO
+ ld [hJoyPressed], a
+ ld [hJoyReleased], a
+ ld [hJoyHeld], a
+ ld [wcd6a], a
+ ld [wd5a3], a
+ ld hl, wCardKeyDoorY
+ ld [hli], a
+ ld [hl], a
+ ld hl, wWhichTrade
+ ld bc, $1e
+ call FillMemory
+ ret
+
+; only used for setting bit 2 of wd736 upon entering a new map
+IsPlayerStandingOnWarp: ; c0a6 (3:40a6)
+ ld a, [wNumberOfWarps]
+ and a
+ ret z
+ ld c, a
+ ld hl, wWarpEntries
+.loop
+ ld a, [W_YCOORD]
+ cp [hl]
+ jr nz, .nextWarp1
+ inc hl
+ ld a, [W_XCOORD]
+ cp [hl]
+ jr nz, .nextWarp2
+ inc hl
+ ld a, [hli] ; target warp
+ ld [wDestinationWarpID], a
+ ld a, [hl] ; target map
+ ld [$ff8b], a
+ ld hl, wd736
+ set 2, [hl] ; standing on warp flag
+ ret
+.nextWarp1
+ inc hl
+.nextWarp2
+ inc hl
+ inc hl
+ inc hl
+ dec c
+ jr nz, .loop
+ ret
+
+CheckForceBikeOrSurf: ; c0d2 (3:40d2)
+ ld hl, wd732
+ bit 5, [hl]
+ ret nz
+ ld hl, ForcedBikeOrSurfMaps
+ ld a, [W_YCOORD]
+ ld b, a
+ ld a, [W_XCOORD]
+ ld c, a
+ ld a, [W_CURMAP]
+ ld d, a
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z ;if we reach FF then it's not part of the list
+ cp d ;compare to current map
+ jr nz, .incorrectMap
+ ld a, [hli]
+ cp b ;compare y-coord
+ jr nz, .incorrectY
+ ld a, [hli]
+ cp c ;compare x-coord
+ jr nz, .loop ; incorrect x-coord, check next item
+ ld a, [W_CURMAP]
+ cp SEAFOAM_ISLANDS_4
+ ld a, $2
+ ld [W_SEAFOAMISLANDS4CURSCRIPT], a
+ jr z, .forceSurfing
+ ld a, [W_CURMAP]
+ cp SEAFOAM_ISLANDS_5
+ ld a, $2
+ ld [W_SEAFOAMISLANDS5CURSCRIPT], a
+ jr z, .forceSurfing
+ ;force bike riding
+ ld hl, wd732
+ set 5, [hl]
+ ld a, $1
+ ld [wWalkBikeSurfState], a
+ ld [wWalkBikeSurfStateCopy], a
+ jp ForceBikeOrSurf
+.incorrectMap
+ inc hl
+.incorrectY
+ inc hl
+ jr .loop
+.forceSurfing
+ ld a, $2
+ ld [wWalkBikeSurfState], a
+ ld [wWalkBikeSurfStateCopy], a
+ jp ForceBikeOrSurf
+
+INCLUDE "data/force_bike_surf.asm"
+
+IsPlayerFacingEdgeOfMap: ; c148 (3:4148)
+ push hl
+ push de
+ push bc
+ ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
+ srl a
+ ld c, a
+ ld b, $0
+ ld hl, .functionPointerTable
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [W_YCOORD]
+ ld b, a
+ ld a, [W_XCOORD]
+ ld c, a
+ ld de, .returnaddress
+ push de
+ jp [hl]
+.returnaddress
+ pop bc
+ pop de
+ pop hl
+ ret
+
+.functionPointerTable
+ dw .facingDown
+ dw .facingUp
+ dw .facingLeft
+ dw .facingRight
+
+.facingDown
+ ld a, [W_CURMAPHEIGHT]
+ add a
+ dec a
+ cp b
+ jr z, .setCarry
+ jr .resetCarry
+
+.facingUp
+ ld a, b
+ and a
+ jr z, .setCarry
+ jr .resetCarry
+
+.facingLeft
+ ld a, c
+ and a
+ jr z, .setCarry
+ jr .resetCarry
+
+.facingRight
+ ld a, [W_CURMAPWIDTH]
+ add a
+ dec a
+ cp c
+ jr z, .setCarry
+ jr .resetCarry
+.resetCarry
+ and a
+ ret
+.setCarry
+ scf
+ ret
+
+IsWarpTileInFrontOfPlayer: ; c197 (3:4197)
+ push hl
+ push de
+ push bc
+ call _GetTileAndCoordsInFrontOfPlayer
+ ld a, [W_CURMAP]
+ cp SS_ANNE_5
+ jr z, .ssAnne5
+ ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
+ srl a
+ ld c, a
+ ld b, 0
+ ld hl, .warpTileListPointers
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wTileInFrontOfPlayer]
+ ld de, $1
+ call IsInArray
+.done
+ pop bc
+ pop de
+ pop hl
+ ret
+
+.warpTileListPointers: ; c1c0 (3:41c0)
+ dw .facingDownWarpTiles
+ dw .facingUpWarpTiles
+ dw .facingLeftWarpTiles
+ dw .facingRightWarpTiles
+
+.facingDownWarpTiles
+ db $01,$12,$17,$3D,$04,$18,$33,$FF
+
+.facingUpWarpTiles
+ db $01,$5C,$FF
+
+.facingLeftWarpTiles
+ db $1A,$4B,$FF
+
+.facingRightWarpTiles
+ db $0F,$4E,$FF
+
+.ssAnne5
+ ld a, [wTileInFrontOfPlayer]
+ cp $15
+ jr nz, .notSSAnne5Warp
+ scf
+ jr .done
+.notSSAnne5Warp
+ and a
+ jr .done
+
+IsPlayerStandingOnDoorTileOrWarpTile: ; c1e6 (3:41e6)
+ push hl
+ push de
+ push bc
+ callba IsPlayerStandingOnDoorTile ; 6:6785
+ jr c, .done
+ ld a, [W_CURMAPTILESET]
+ add a
+ ld c, a
+ ld b, $0
+ ld hl, WarpTileIDPointers
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, $1
+ aCoord 8, 9
+ call IsInArray
+ jr nc, .done
+ ld hl, wd736
+ res 2, [hl]
+.done
+ pop bc
+ pop de
+ pop hl
+ ret
+
+INCLUDE "data/warp_tile_ids.asm"
+
+INCBIN "baserom.gbc",$c27b,$cb62 - $c27b
+LoadWildData:: ; cb62 (3:4b62)
+INCBIN "baserom.gbc",$cb62,$e808 - $cb62
+IsNextTileShoreOrWater:: ; e808 (3:6808)
+INCBIN "baserom.gbc",$e808,$e91b - $e808
GymLeaderFaceAndBadgeTileGraphics: ; e91b (3:691b)
INCBIN "gfx/badges.2bpp"
@@ -150,13 +412,19 @@ INCBIN "baserom.gbc",$17c31,$18000 - $17c31
SECTION "bank06",ROMX,BANK[$06]
-INCBIN "baserom.gbc",$18000,$1c000 - $18000
-
+INCBIN "baserom.gbc",$18000,$1a785 - $18000
+IsPlayerStandingOnDoorTile:: ; 1a785 (6:6785)
+INCBIN "baserom.gbc",$1a785,$1a7f4 - $1a785
+HandleLedges:: ; 1a7f4 (6:67f4)
+INCBIN "baserom.gbc",$1a7f4,$1c000 - $1a7f4
SECTION "bank07",ROMX,BANK[$07]
-INCBIN "baserom.gbc",$1c000,$20000 - $1c000
-
+INCBIN "baserom.gbc",$1c000,$1e321 - $1c000
+SafariZoneCheck:: ; 1e321 (7:6e21)
+INCBIN "baserom.gbc",$1e321,$1e330 - $1e321
+SafariZoneCheckSteps:: ; 1e330 (7:6330)
+INCBIN "baserom.gbc",$1e330,$20000 - $1e330
SECTION "bank08",ROMX,BANK[$08]
@@ -514,8 +782,9 @@ INCBIN "baserom.gbc",$3adb8,$3c000 - $3adb8
SECTION "bank0F",ROMX,BANK[$0F]
-INCBIN "baserom.gbc",$3c000,$40000 - $3c000
-
+INCBIN "baserom.gbc",$3c000,$3cae8 - $3c000
+AnyPartyAlive:: ; 3cae8 (f:4ae8)
+INCBIN "baserom.gbc",$3cae8,$40000 - $3cae8
SECTION "bank10",ROMX,BANK[$10]