summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2017-07-07 19:51:37 -0700
committerMarcus Huderle <huderlem@gmail.com>2017-07-07 19:57:13 -0700
commitb4d7dffd1cb3bcaaf0cebbbbe42cb6b70d02bef8 (patch)
treeb0532fbaaa353db91d5e20d918a5d1692cfc6d79
parent3196c5f78ee7f56873e8f401b804cbd2532b5bea (diff)
Label evolution, joypad, message box things
-rwxr-xr-xengine/high_scores_screen.asm2
-rwxr-xr-xengine/pinball_game.asm10
-rwxr-xr-xengine/pinball_game/ball_init/ball_init.asm2
-rwxr-xr-xengine/pinball_game/ball_loss/ball_loss_blue_field.asm2
-rwxr-xr-xengine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm2
-rwxr-xr-xengine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm2
-rwxr-xr-xengine/pinball_game/ball_loss/ball_loss_red_field.asm2
-rwxr-xr-xengine/pinball_game/catchem_mode.asm14
-rwxr-xr-xengine/pinball_game/draw_sprites/draw_red_field_sprites.asm2
-rwxr-xr-xengine/pinball_game/end_of_ball_bonus.asm2
-rwxr-xr-xengine/pinball_game/evolution_mode/evolution_mode_blue_field.asm4
-rwxr-xr-xengine/pinball_game/evolution_mode/evolution_mode_red_field.asm4
-rwxr-xr-xengine/pinball_game/menu.asm4
-rwxr-xr-xengine/pinball_game/object_collision/blue_stage_resolve_collision.asm18
-rwxr-xr-xengine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm2
-rwxr-xr-xengine/pinball_game/object_collision/red_stage_resolve_collision.asm18
-rwxr-xr-xengine/pinball_game/save_game.asm2
-rwxr-xr-xengine/pinball_game/vertical_screen_transition.asm6
-rwxr-xr-xengine/pokedex.asm4
-rwxr-xr-xhome.asm73
-rwxr-xr-xhome/text.asm2
-rwxr-xr-xmain.asm166
-rwxr-xr-xwram.asm23
23 files changed, 194 insertions, 172 deletions
diff --git a/engine/high_scores_screen.asm b/engine/high_scores_screen.asm
index 920fc9d..9823d67 100755
--- a/engine/high_scores_screen.asm
+++ b/engine/high_scores_screen.asm
@@ -645,7 +645,7 @@ Func_cf58: ; 0xcf58
ret
Func_cf7d: ; 0xcf7d
- ld a, [wd809]
+ ld a, [wNewlyPressedButtonsPersistent]
ld b, a
ld a, [wda85]
bit 6, b
diff --git a/engine/pinball_game.asm b/engine/pinball_game.asm
index 2e2021b..766f900 100755
--- a/engine/pinball_game.asm
+++ b/engine/pinball_game.asm
@@ -15,7 +15,7 @@ GameScreenFunction_LoadGFX: ; 0xd861
call FillBottomMessageBufferWithBlackTile
ld a, $1
ld [wd85d], a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld hl, wScreenState
inc [hl]
ret
@@ -56,7 +56,7 @@ GameScreenFunction_StartBall: ; 0xd87f
and a
call nz, Func_e5d
ld a, $1
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
xor a
ld [wd7c1], a
call Func_b66
@@ -179,7 +179,7 @@ GameScreenFunction_HandleBallLoss: ; 0xda36
ld [wd7eb], a
xor a
ld [wd7e9], a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
call HandleTilts
ld a, [wCurrentStage]
@@ -203,7 +203,7 @@ GameScreenFunction_HandleBallLoss: ; 0xda36
jr z, .asm_daa9
ld a, $2
ld [wd49c], a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
call FillBottomMessageBufferWithBlackTile
call Func_30db
ld hl, wd5dc
@@ -306,7 +306,7 @@ TransitionToHighScoresScreen: ; 0xdb5d
ld hl, rIE
res 1, [hl]
xor a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld a, [wCurrentStage]
ld c, a
ld b, $0
diff --git a/engine/pinball_game/ball_init/ball_init.asm b/engine/pinball_game/ball_init/ball_init.asm
index 73cb5a4..e7a13c7 100755
--- a/engine/pinball_game/ball_init/ball_init.asm
+++ b/engine/pinball_game/ball_init/ball_init.asm
@@ -23,7 +23,7 @@ InitBallForStage: ; 0x83ba
ld [wBallSpin], a
ld [wBallRotation], a
inc a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld a, $20
ld [wSCX], a
diff --git a/engine/pinball_game/ball_loss/ball_loss_blue_field.asm b/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
index e4d8692..e9a83fb 100755
--- a/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_blue_field.asm
@@ -81,7 +81,7 @@ Func_ded6: ; 0xded6
ld [wd604], a
ld a, $1e
ld [wd607], a
- callba Func_10ac8
+ callba ConcludeEvolutionMode
ret
.asm_df05
diff --git a/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm
index 631a882..c2cff1f 100755
--- a/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm
@@ -14,7 +14,7 @@ HandleBallLossGengarBonus: ; 0xdf1a
ld a, [wd6a7]
and a
ret nz
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld [wBallSpin], a
ld [wBallRotation], a
diff --git a/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm b/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm
index 90cc448..4cafb02 100755
--- a/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm
@@ -14,7 +14,7 @@ HandleBallLossMewtwoBonus: ; 0xdf7e
ld a, [wd6b2]
and a
ret nz
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld [wBallSpin], a
ld [wBallRotation], a
diff --git a/engine/pinball_game/ball_loss/ball_loss_red_field.asm b/engine/pinball_game/ball_loss/ball_loss_red_field.asm
index f76bf6e..e219fbc 100755
--- a/engine/pinball_game/ball_loss/ball_loss_red_field.asm
+++ b/engine/pinball_game/ball_loss/ball_loss_red_field.asm
@@ -81,7 +81,7 @@ Func_ddfd: ; 0xddfd
ld [wd604], a
ld a, $1e
ld [wd607], a
- callba Func_10ac8
+ callba ConcludeEvolutionMode
jr .asm_de40
.asm_de2d
diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm
index 3fb9ed3..7dbe8f9 100755
--- a/engine/pinball_game/catchem_mode.asm
+++ b/engine/pinball_game/catchem_mode.asm
@@ -690,7 +690,7 @@ BallCaptureInit: ; 0x10496
ld [wBallYVelocity], a
ld [wBallYVelocity + 1], a
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
lb de, $00, $0b
call PlaySoundEffect
@@ -788,7 +788,7 @@ CapturePokemon: ; 0x1052d
ld [wBallYPos], a
ld [wCapturingMon], a
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
callba RestoreBallSaverAfterCatchEmMode
call ConcludeCatchEmMode
@@ -1078,14 +1078,14 @@ SetPokemonOwnedFlag: ; 0x1077c
call SaveData
ret
-Func_107a5: ; 0x107a5
+ResetIndicatorStates: ; 0x107a5
xor a
ld hl, wIndicatorStates
ld b, $13
-.asm_107ab
+.loop
ld [hli], a
dec b
- jr nz, .asm_107ab
+ jr nz, .loop
ret
Func_107b0: ; 0x107b0
@@ -1244,7 +1244,7 @@ Func_10871: ; 0x10871
ret
Func_108f5: ; 0x108f5
- call Func_107a5
+ call ResetIndicatorStates
call Func_107c2
call Func_107c8
call Func_107e9
@@ -1375,7 +1375,7 @@ Func_1098c: ; 0x1098c
ret
Func_109fc: ; 0x109fc
- call Func_107a5
+ call ResetIndicatorStates
call Func_107c2
callba Func_1f2ff
ld a, [wCurrentStage]
diff --git a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm
index 024527b..2e34743 100755
--- a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm
+++ b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm
@@ -512,7 +512,7 @@ Func_17e5e: ; 0x17e5e
jr .asm_17e64
DrawPinball: ; 0x17e81
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
and a
ret z
ld hl, wBallSpin
diff --git a/engine/pinball_game/end_of_ball_bonus.asm b/engine/pinball_game/end_of_ball_bonus.asm
index 6e8ba8a..8afdf54 100755
--- a/engine/pinball_game/end_of_ball_bonus.asm
+++ b/engine/pinball_game/end_of_ball_bonus.asm
@@ -40,7 +40,7 @@ LoadEAcuteCharacterGfx: ; 0xf55c
Func_f57f: ; 0xf57f
xor a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld hl, wBottomMessageText
ld a, $81
ld b, $40
diff --git a/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm b/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm
index abf1ca8..a1af8f5 100755
--- a/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm
+++ b/engine/pinball_game/evolution_mode/evolution_mode_blue_field.asm
@@ -175,7 +175,7 @@ Func_20c76: ; 0x20c76
Func_20d30: ; 0x20d30
callba RestoreBallSaverAfterCatchEmMode
callba PlaceEvolutionInParty
- callba Func_10ac8
+ callba ConcludeEvolutionMode
ld de, $0001
call PlaySong
ld hl, wNumPokemonEvolvedInBallBonus
@@ -201,7 +201,7 @@ Func_20d7c: ; 0x20d7c
ret nz
call FillBottomMessageBufferWithBlackTile
callba RestoreBallSaverAfterCatchEmMode
- callba Func_10ac8
+ callba ConcludeEvolutionMode
ld de, $0001
call PlaySong
scf
diff --git a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm
index 3b42550..a1149c1 100755
--- a/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm
+++ b/engine/pinball_game/evolution_mode/evolution_mode_red_field.asm
@@ -178,7 +178,7 @@ Func_20651: ; 0x20651
Func_2070b: ; 0x2070b
callba RestoreBallSaverAfterCatchEmMode
callba PlaceEvolutionInParty
- callba Func_10ac8
+ callba ConcludeEvolutionMode
ld de, $0001
call PlaySong
ld hl, wNumPokemonEvolvedInBallBonus
@@ -204,7 +204,7 @@ Func_20757: ; 0x20757
ret nz
call FillBottomMessageBufferWithBlackTile
callba RestoreBallSaverAfterCatchEmMode
- callba Func_10ac8
+ callba ConcludeEvolutionMode
ld de, $0001
call PlaySong
scf
diff --git a/engine/pinball_game/menu.asm b/engine/pinball_game/menu.asm
index d97d039..a31ff1f 100755
--- a/engine/pinball_game/menu.asm
+++ b/engine/pinball_game/menu.asm
@@ -6,7 +6,7 @@ HandleInGameMenu: ; 0x86d7
ld [wd917], a
call FillBottomMessageBufferWithBlackTile
xor a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld hl, wBottomMessageText
ld a, $81
ld b, $30
@@ -83,7 +83,7 @@ HandleInGameMenu: ; 0x86d7
pop af
ld [wd917], a
ld a, $1
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld a, [wInGameMenuIndex]
and a
ret
diff --git a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm
index ecd555c..1cabbd8 100755
--- a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm
@@ -1827,11 +1827,11 @@ ResolveSlowpokeCollision: ; 0x1d216
cp $1
jr nz, .asm_1d2b6
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld a, [wLeftAlleyCount]
cp $3
jr nz, .asm_1d299
- callba Func_10ab3
+ callba StartEvolutionMode
ld a, [wd643]
and a
ret z
@@ -1853,7 +1853,7 @@ ResolveSlowpokeCollision: ; 0x1d216
cp $4
jr nz, .asm_1d2c3
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ret
.asm_1d2c3
@@ -1949,7 +1949,7 @@ ResolveCloysterCollision: ; 0x1d32d
cp $1
jr nz, .asm_1d3cb
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld a, [wRightAlleyCount]
cp $2
jr c, .noCatchEmMode
@@ -1975,7 +1975,7 @@ ResolveCloysterCollision: ; 0x1d32d
cp $4
jr nz, .asm_1d3d8
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ret
.asm_1d3d8
@@ -5788,7 +5788,7 @@ Func_1e757: ; 0x1e757
cp $c
jr nz, .asm_1e7d0
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wBallSpin], a
ld [wBallRotation], a
ret
@@ -5843,7 +5843,7 @@ Func_1e830: ; 0x1e830
callba Func_10000
jr nc, .asm_1e84b
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ret
@@ -5891,12 +5891,12 @@ Func_1e830: ; 0x1e830
cp $d
jr nc, .asm_1e858
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp EVOLUTION_MODE_SLOT_REWARD
ret nz
- callba Func_10ab3
+ callba StartEvolutionMode
xor a
ld [wCatchEmOrEvolutionSlotRewardActive], a
ret
diff --git a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm
index c3482d6..c73bacf 100755
--- a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm
@@ -877,7 +877,7 @@ Func_1894c: ; 0x1894c
jr z, .asm_18980
inc a
ld [wd6a5], a
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
ld hl, wEnableBallGravityAndTilt
and [hl]
jr z, .asm_18973
diff --git a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm
index 2647c0a..ac5ead8 100755
--- a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm
+++ b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm
@@ -4499,7 +4499,7 @@ ResolveBellsproutCollision: ; 0x15e93
cp $1
jr nz, .asm_15f35
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld a, [wRightAlleyCount]
cp $2
jr c, .noCatchEmMode
@@ -4523,7 +4523,7 @@ ResolveBellsproutCollision: ; 0x15e93
cp $4
jr nz, .asm_15f42
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ret
.asm_15f42
@@ -4909,7 +4909,7 @@ ResolveDittoSlotCollision: ; 0x160f0
cp $9
jr nz, .asm_1616d
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wBallSpin], a
ld [wBallRotation], a
ret
@@ -4917,9 +4917,9 @@ ResolveDittoSlotCollision: ; 0x160f0
.asm_1616d
cp $6
jr nz, .asm_1618e
- callba Func_10ab3
+ callba StartEvolutionMode
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld a, $5
ld [wd803], a
@@ -5127,7 +5127,7 @@ Func_16279: ; 0x16279
cp $c
jr nz, .asm_162f2
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wBallSpin], a
ld [wBallRotation], a
ret
@@ -5182,7 +5182,7 @@ Func_16352: ; 0x16352
callba Func_10000
jr nc, .asm_1636d
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ret
@@ -5230,12 +5230,12 @@ Func_16352: ; 0x16352
cp $d
jr nc, .asm_1637a
ld a, $1
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wEnableBallGravityAndTilt], a
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp EVOLUTION_MODE_SLOT_REWARD
ret nz
- callba Func_10ab3
+ callba StartEvolutionMode
ld a, [wd7ad]
ld c, a
ld a, [wStageCollisionState]
diff --git a/engine/pinball_game/save_game.asm b/engine/pinball_game/save_game.asm
index 644abb3..1d2f539 100755
--- a/engine/pinball_game/save_game.asm
+++ b/engine/pinball_game/save_game.asm
@@ -13,7 +13,7 @@ SaveGame: ; 0xda05
ld hl, rIE
res 1, [hl]
xor a
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld a, SCREEN_TITLESCREEN
ld [wCurrentScreen], a
xor a
diff --git a/engine/pinball_game/vertical_screen_transition.asm b/engine/pinball_game/vertical_screen_transition.asm
index 81203d5..94290f2 100755
--- a/engine/pinball_game/vertical_screen_transition.asm
+++ b/engine/pinball_game/vertical_screen_transition.asm
@@ -1,14 +1,14 @@
FieldVerticalTransition: ; 0xe674
push af
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
push af
xor a
- ld [wd548], a
+ ld [wPinballIsVisible], a
ld [wd803], a
callba DrawSpritesForStage
call CleanOAMBuffer
pop af
- ld [wd548], a
+ ld [wPinballIsVisible], a
pop af
ld [wCurrentStage], a
xor a
diff --git a/engine/pokedex.asm b/engine/pokedex.asm
index 7f7eddd..8251d03 100755
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -831,11 +831,11 @@ Func_28513: ; 0x28513
Func_285ca: ; 0x285ca
xor a
- ld [wd80a], a
+ ld [wPressedButtonsPersistent], a
call Func_28972
call Func_28a8a
call Func_28ad1
- ld a, [wd80a]
+ ld a, [wPressedButtonsPersistent]
ret
Func_285db: ; 0x285db
diff --git a/home.asm b/home.asm
index d9bb7c3..054eac7 100755
--- a/home.asm
+++ b/home.asm
@@ -367,9 +367,9 @@ VBlank: ; 0x2f2
.asm_3b5
res 3, [hl]
.asm_3b7
- ld a, [wd4aa]
+ ld a, [wDrawBottomMessageBox]
and a
- call nz, Func_e69
+ call nz, DrawBottomMessageBox
pop hl
pop de
pop bc
@@ -1673,7 +1673,7 @@ ReadJoypad: ; 0xab8
.asm_b1a
ld a, [hJoypadState]
ld [hPreviousJoypadState], a
- ld hl, wd808
+ ld hl, wJoypadStatesPersistent
ld a, [hJoypadState]
or [hl]
ld [hli], a
@@ -1685,8 +1685,8 @@ ReadJoypad: ; 0xab8
ld [hli], a
ret
-Func_b2e: ; 0xb2e
- ld hl, wd808
+ClearPersistentJoypadStates: ; 0xb2e
+ ld hl, wJoypadStatesPersistent
xor a
ld [hli], a
ld [hli], a
@@ -2334,10 +2334,13 @@ Func_e5d: ; 0xe5d
jr nz, .asm_e62
ret
-Func_e69: ; 0xe69
+DrawBottomMessageBox: ; 0xe69
+; Draws the current scrolling bottom message box to VRAM during V-Blank.
+; Note, this only applies to the 1-tile high message bar. When it displays, things like Ball Bonus summary, and
+; the Save/Cancel menu, this is not used to draw the message buffer.
ld a, [rLY]
cp $90
- jr nc, Func_e69
+ jr nc, DrawBottomMessageBox ; ensure we're in V-Blank
.asm_e6f
ld a, [rSTAT]
and $3
@@ -2347,60 +2350,60 @@ Func_e69: ; 0xe69
dec a
jr nz, .asm_e77
ld hl, wBottomMessageBuffer + $40
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c00
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c04
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c08
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c0c
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c10
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
ld hl, wBottomMessageBuffer + $c0
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c20
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c24
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c28
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c2c
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
- call Func_eef
+ call Load4BottomMessageBytes
push hl
ld hl, $9c30
- call Func_ef8
+ call Write4BottomMessageBytes
pop hl
ret
-Func_eef: ; 0xeef
+Load4BottomMessageBytes: ; 0xeef
ld a, [hli]
ld b, a
ld a, [hli]
@@ -2411,10 +2414,10 @@ Func_eef: ; 0xeef
ld e, a
ret
-Func_ef8: ; 0xef8
+Write4BottomMessageBytes: ; 0xef8
ld a, [rSTAT]
and $3
- jr nz, Func_ef8
+ jr nz, Write4BottomMessageBytes
ld a, b
ld [hli], a
ld a, c
@@ -3949,7 +3952,7 @@ Func_1ffc: ; 0x1ffc
call Func_2034
call DoScreenLogic
call CleanOAMBuffer
- call Func_b2e
+ call ClearPersistentJoypadStates
rst AdvanceFrame
jr .master_loop
@@ -5242,7 +5245,7 @@ HandleLeftTilt: ; 0x358c
lb de, $00, $3f
call PlaySoundEffect
.skipSoundEffect
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
ld hl, wEnableBallGravityAndTilt
and [hl]
jr z, .skipBallMovement
@@ -5298,7 +5301,7 @@ HandleRightTilt: ; 0x35f3
lb de, $00, $3f
call PlaySoundEffect
.skipSoundEffect
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
ld hl, wEnableBallGravityAndTilt
and [hl]
jr z, .skipBallMovement
@@ -5354,7 +5357,7 @@ HandleUpperTilt: ; 0x365a
lb de, $00, $3f
call PlaySoundEffect
.skipSoundEffect
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
ld hl, wEnableBallGravityAndTilt
and [hl]
jr z, .skipBallMovement
@@ -5394,7 +5397,7 @@ HandleUpperTilt: ; 0x365a
ret
ApplyTiltForces: ; 0x36c1
- ld a, [wd548]
+ ld a, [wPinballIsVisible]
ld hl, wEnableBallGravityAndTilt
and [hl]
ret z
diff --git a/home/text.asm b/home/text.asm
index 1afd7ee..ae15c57 100755
--- a/home/text.asm
+++ b/home/text.asm
@@ -48,7 +48,7 @@ Func_310a: ; 0x310a
jr nz, .asm_311d
ret
-Func_3125: ; 0x3125 enables special loads
+LoadMonNameIntoBottomMessageBufferList: ; 0x3125 enables special loads
ld b, $1
jr asm_312b
diff --git a/main.asm b/main.asm
index a966b6d..b548dce 100755
--- a/main.asm
+++ b/main.asm
@@ -223,21 +223,21 @@ PointerTable_10a9b: ; 0x10a9b
padded_dab Func_20bae ; STAGE_BLUE_FIELD_TOP
padded_dab Func_20bae ; STAGE_BLUE_FIELD_BOTTOM
-Func_10ab3: ; 0x10ab3
+StartEvolutionMode: ; 0x10ab3
ld a, [wInSpecialMode]
and a
ret nz
ld a, [wCurrentStage]
rst JumpTable ; calls JumpToFuncInTable
-CallTable_10abc: ; 0x10abc
- dw Func_10ebb ; STAGE_RED_FIELD_TOP
- dw Func_10ebb ; STAGE_RED_FIELD_BOTTOM
- dw Func_11054
- dw Func_11054
- dw Func_11061 ; STAGE_BLUE_FIELD_TOP
- dw Func_11061 ; STAGE_BLUE_FIELD_BOTTOM
-
-Func_10ac8: ; 0x10ac8
+StartEvolutionMode_CallTable: ; 0x10abc
+ dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
+ dw StartEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
+ dw StartEvolutionMode_UnusedField
+ dw StartEvolutionMode_UnusedField
+ dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
+ dw StartEvolutionMode_BlueField ; STAGE_BLUE_FIELD_BOTTOM
+
+ConcludeEvolutionMode: ; 0x10ac8
xor a
ld [wd5ca], a
call FillBottomMessageBufferWithBlackTile
@@ -252,13 +252,13 @@ Func_10ac8: ; 0x10ac8
callba StopTimer
ld a, [wCurrentStage]
rst JumpTable ; calls JumpToFuncInTable
-CallTable_10af3: ; 0x10af3
- dw Func_10fe3 ; STAGE_RED_FIELD_TOP
- dw Func_10fe3 ; STAGE_RED_FIELD_BOTTOM
- dw Func_11060
- dw Func_11060
- dw Func_11195 ; STAGE_BLUE_FIELD_TOP
- dw Func_11195 ; STAGE_BLUE_FIELD_TOP
+ConcludeEvolutionMode_CallTable: ; 0x10af3
+ dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_TOP
+ dw ConcludeEvolutionMode_RedField ; STAGE_RED_FIELD_BOTTOM
+ dw DoNothing_11060
+ dw DoNothing_11060
+ dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
+ dw ConcludeEvolutionMode_BlueField ; STAGE_BLUE_FIELD_TOP
Func_10aff: ; 0x10aff
ld a, [wCurrentStage]
@@ -317,21 +317,22 @@ Func_10b3f: ; 0x10b3f
call LoadTextHeader
ret
-Func_10b59: ; 0x10b59
+InitEvolutionSelectionMenu: ; 0x10b59
+; Initializes the list menu, which the player uses to select which pokemon to evolve.
xor a
- ld [wd4aa], a ;load 0 into ???
+ ld [wDrawBottomMessageBox], a
ld hl, wBottomMessageText
ld a, $81
ld b, $30
-.asm_10b64
- ld [hli], a ;load spaces into bottom text? repeat 192 times
+.clearLoop
+ ld [hli], a ; load spaces into bottom text. repeat 192 times
ld [hli], a
ld [hli], a
ld [hli], a
dec b
- jr nz, .asm_10b64
+ jr nz, .clearLoop
ld hl, wPartyMons
- call Func_10b8e
+ call LoadMonNamesIntoEvolutionSelectionList
ld a, BANK(InGameMenuSymbolsGfx)
ld hl, InGameMenuSymbolsGfx + $50
ld de, vTilesSH tile $08
@@ -344,23 +345,28 @@ Func_10b59: ; 0x10b59
call LoadVRAMData
ret
-Func_10b8e: ; 0x10b8e hl = start of party mons
+LoadMonNamesIntoEvolutionSelectionList: ; 0x10b8e
+; Loads 6 pokemon names into the list that allows the player to select which pokemon to evolve.
+; Input: hl = pointer to a list of pokemon ids. (an offset of wPartyMons)
ld a, [wNumPartyMons]
ld c, $0
ld b, a
-.asm_10b94
+.loop
ld a, [hli]
- call Func_10ba2
+ call LoadMonNameIntoEvolutionSelectionList
inc c
ld a, c
cp $6
- jr z, .asm_10ba1
+ jr z, .done
dec b
- jr nz, .asm_10b94
-.asm_10ba1
+ jr nz, .loop
+.done
ret
-Func_10ba2: ; 0x10ba2 a = current party mon, b is number to go before end of list, c is number passed so far
+LoadMonNameIntoEvolutionSelectionList: ; 0x10ba2
+; Loads a single pokemon name into the list of pokemon to evolve.
+; Input: c = index of the list
+; a = pokemon id
push bc
push hl
swap c ;c* 32, does wird things if c starts >15
@@ -392,69 +398,72 @@ Func_10ba2: ; 0x10ba2 a = current party mon, b is number to go before end of lis
ld [de], a
inc de
ld a, $81
- ld [de], a
- inc de ;load 4 spaces into de
- call Func_3125 ;load 1 into b and...
-.asm_10bda
+ ld [de], a ; loaded 4 spaces into de
+ inc de
+ call LoadMonNameIntoBottomMessageBufferList
+.loadBlankCharacterLoop
ld a, e
and $1f
cp $14
- jr nc, .asm_10be7
+ jr nc, .done
ld a, $81
ld [de], a
inc de
- jr .asm_10bda
+ jr .loadBlankCharacterLoop
-.asm_10be7
+.done
pop hl
pop bc
ret
-Func_10bea: ; 0x10bea
+SelectPokemonToEvolveMenu: ; 0x10bea
+; Drivers the menu that allows the player to select a pokemon to evolve.
xor a
ld [wCurSelectedPartyMon], a
ld [wCurSelectedPartyMonScrollOffset], a
ld [wPartySelectionCursorCounter], a
-.asm_10bf4
- call Func_10c0c
- call Func_b2e
- call Func_10c38
+.loop
+ call MoveEvolutionSelectionCursor
+ call ClearPersistentJoypadStates
+ call UpdateEvolutionSelectionList
rst AdvanceFrame
- ld a, [wd809]
- bit 0, a
- jr z, .asm_10bf4
+ ld a, [wNewlyPressedButtonsPersistent]
+ bit BIT_A_BUTTON, a
+ jr z, .loop
lb de, $00, $01
call PlaySoundEffect
ret
-Func_10c0c: ; 0x10c0c
- ld a, [wd80a]
+MoveEvolutionSelectionCursor: ; 0x10c0c
+ ld a, [wPressedButtonsPersistent]
ld b, a
ld a, [wNumPartyMons]
ld c, a
ld a, [wCurSelectedPartyMon]
- bit 6, b
- jr z, .asm_10c28
+ bit BIT_D_UP, b
+ jr z, .didntPressUp
and a
ret z
+ ; move the cursor up
dec a
ld [wCurSelectedPartyMon], a
lb de, $00, $03
call PlaySoundEffect
ret
-.asm_10c28
- bit 7, b
+.didntPressUp
+ bit BIT_D_DOWN, b
ret z
inc a
cp c
ret z
+ ; move the cursor down
ld [wCurSelectedPartyMon], a
lb de, $00, $03
call PlaySoundEffect
ret
-Func_10c38: ; 0x10c38
+UpdateEvolutionSelectionList: ; 0x10c38
ld a, [wCurSelectedPartyMon]
ld hl, wCurSelectedPartyMonScrollOffset
sub [hl]
@@ -476,7 +485,7 @@ Func_10c38: ; 0x10c38
ld b, $0
ld hl, wPartyMons
add hl, bc
- call Func_10b8e
+ call LoadMonNamesIntoEvolutionSelectionList
ld a, [hJoypadState]
and a
ld a, [wPartySelectionCursorCounter]
@@ -531,16 +540,16 @@ PlaceEvolutionInParty: ; 0x10ca5
ld [hl], a
ret
-Func_10cb7: ; 0x10cb7
+SelectPokemonToEvolve: ; 0x10cb7
call FillBottomMessageBufferWithBlackTile
- call Func_10b59
+ call InitEvolutionSelectionMenu
ld a, $60
ld [hWY], a
dec a
ld [hLYC], a
ld a, $fd
ld [hLCDCMask], a
- call Func_10bea
+ call SelectPokemonToEvolveMenu
ld a, $86
ld [hWY], a
ld a, $83
@@ -550,7 +559,7 @@ Func_10cb7: ; 0x10cb7
ld [hLCDCMask], a
ld a, [hGameBoyColorFlag]
and a
- jr nz, .asm_10cee
+ jr nz, .gameboyColor
ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoy)
ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoy + $80
ld de, vTilesSH tile $08
@@ -558,7 +567,7 @@ Func_10cb7: ; 0x10cb7
call LoadVRAMData
jr .asm_10cfc
-.asm_10cee
+.gameboyColor
ld a, BANK(StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor)
ld hl, StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor + $80
ld de, vTilesSH tile $08
@@ -567,7 +576,7 @@ Func_10cb7: ; 0x10cb7
.asm_10cfc
call FillBottomMessageBufferWithBlackTile
ld a, SPECIAL_MODE_CATCHEM
- ld [wd4aa], a
+ ld [wDrawBottomMessageBox], a
ld [wInSpecialMode], a
ld [wSpecialMode], a
xor a
@@ -581,7 +590,7 @@ Func_10cb7: ; 0x10cb7
ld [wCurrentCatchEmMon], a
ret
-Func_10d1d: ; 0x10d1d
+InitEvolutionModeForMon: ; 0x10d1d
ld hl, wd586
ld b, $18
.asm_10d22
@@ -809,12 +818,12 @@ Func_10e8b: ; 0x10e8b
call LoadTextHeader
ret
-Func_10ebb: ; 0x10ebb
+StartEvolutionMode_RedField: ; 0x10ebb
ld a, [wNumPartyMons]
and a
ret z
- call Func_10cb7
- call Func_10d1d
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
ld a, [wd555]
sub $2
ld c, a
@@ -826,12 +835,12 @@ Func_10ebb: ; 0x10ebb
ld l, a
ld de, wIndicatorStates
ld b, $13
-.asm_10eda
+.loop
ld a, [hli]
ld [de], a
inc de
dec b
- jr nz, .asm_10eda
+ jr nz, .loop
xor a
ld [wLeftAlleyCount], a
call Func_107b0
@@ -897,8 +906,8 @@ IndicatorStates_10fbd: ; 0x10fbd
IndicatorStates_10fd0: ; 0x10fd0
db $00, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-Func_10fe3: ; 0x10fe3
- call Func_107a5
+ConcludeEvolutionMode_RedField: ; 0x10fe3
+ call ResetIndicatorStates
call Func_107c2
call Func_107c8
call Func_107e9
@@ -932,23 +941,23 @@ Func_10fe3: ; 0x10fe3
call Func_10aa
ret
-Func_11054: ; 0x11054
+StartEvolutionMode_UnusedField: ; 0x11054
ld a, [wNumPartyMons]
and a
ret z
- call Func_10cb7
- call Func_10d1d
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
ret
-Func_11060: ; 0x11060
+DoNothing_11060: ; 0x11060
ret
-Func_11061: ; 0x11061
+StartEvolutionMode_BlueField: ; 0x11061
ld a, [wNumPartyMons]
and a
ret z
- call Func_10cb7
- call Func_10d1d
+ call SelectPokemonToEvolve
+ call InitEvolutionModeForMon
ld a, $1
ld [wd643], a
ld a, [wd555]
@@ -1033,10 +1042,10 @@ IndicatorStates_1116f: ; 0x1116f
IndicatorStates_11182: ; 0x11182
db $80, $00, $80, $80, $00, $00, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00
-Func_11195: ; 0x11195
+ConcludeEvolutionMode_BlueField: ; 0x11195
xor a
ld [wd643], a
- call Func_107a5
+ call ResetIndicatorStates
call Func_107c2
callba Func_1f2ff
ld a, [wCurrentStage]
@@ -1127,6 +1136,7 @@ INCLUDE "data/mon_names.asm"
INCLUDE "data/mon_initial_indicator_states.asm"
Data_1298b: ; 0x1298b
+; This has to do with which indicators will need to be hit to evolve the pokemon.
db $01 ; BULBASAUR
db $02 ; IVYSAUR
db $03 ; VENUSAUR
@@ -1579,7 +1589,7 @@ Func_311b4: ; 0x311b4
ret
Func_31234: ; 0x31234
- callba Func_107a5
+ callba ResetIndicatorStates
callba Func_107c2
callba Func_107c8
callba Func_107e9
@@ -1756,7 +1766,7 @@ Func_31326: ; 0x31326
ret
Func_313c3: ; 0x313c3
- callba Func_107a5
+ callba ResetIndicatorStates
callba Func_107c2
callba Func_1f2ff
ld a, $0
diff --git a/wram.asm b/wram.asm
index c2ee5f1..2b33e5d 100755
--- a/wram.asm
+++ b/wram.asm
@@ -41,6 +41,7 @@ wc4cc:: ; 0xc4cc
ds $34
wBottomMessageText:: ; 0xc500 WARNING: text loading code may break if this is moved
+; This must be aligned with $100, since there is some logic that depends on the lower byte of the address. (See LoadMonNameIntoEvolutionSelectionList)
ds $100
wBottomMessageBuffer:: ; 0xc600
@@ -218,7 +219,9 @@ wNumTimesBallSavedTextWillDisplayBackup:: ; 0xd4a8
wd4a9:: ; 0xd4a9
ds $1
-wd4aa:: ; 0xd4aa
+wDrawBottomMessageBox:: ; 0xd4aa
+; Set to non-zero value if enable drawing the 1-tile high bottom message bar during V-Blank in normal pinball gameplay.
+; Set to 0 to disable.
ds $1
wd4ab:: ; 0xd4ab
@@ -529,7 +532,10 @@ wRightAlleyCount:: ; 0xd545
wSecondaryLeftAlleyTrigger:: ; 0xd546
ds $2
-wd548:: ; 0xd548
+wPinballIsVisible:: ; 0xd548
+; Set to 1 if the pinball is visible in play.
+; Set to 0 when the pinball disappears in things like the Slot, Slowpoke, Cloyster, Bellsprout, etc.
+; When it's set to 0, it disables tilt effects on the pinball.
ds $1
wEnableBallGravityAndTilt:: ; 0xd549
@@ -1814,14 +1820,17 @@ wd806:: ; 0xd806
wd807:: ; 0xd807
ds $1
-wd808:: ; 0xd808
+; These three bytes track different joypad states cummulatively, until they are manually cleared.
+; They inherit from their similarly-named counterparts found in hram.asm. (See ReadJoyPad)
+wJoypadStatesPersistent:: ; 0xd808
+wJoypadStatePersistent::
ds $1
-
-wd809:: ; 0xd809
+wNewlyPressedButtonsPersistent:: ; 0xd809
+ ds $1
+wPressedButtonsPersistent:: ; 0xd80a
ds $1
-wd80a:: ; 0xd80a
- ds $2
+ ds $1 ; unused byte
wBGP:: ; 0xd80c
ds $1