diff options
23 files changed, 359 insertions, 345 deletions
diff --git a/engine/pinball_game.asm b/engine/pinball_game.asm index d1459e5..6eb40be 100755 --- a/engine/pinball_game.asm +++ b/engine/pinball_game.asm @@ -180,7 +180,7 @@ GameScreenFunction_HandleBallLoss: ; 0xda36 xor a
ld [wd7e9], a
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
call HandleTilts
ld a, [wCurrentStage]
bit 0, a
diff --git a/engine/pinball_game/ball_init/ball_init.asm b/engine/pinball_game/ball_init/ball_init.asm index e938748..29dbf64 100755 --- a/engine/pinball_game/ball_init/ball_init.asm +++ b/engine/pinball_game/ball_init/ball_init.asm @@ -24,7 +24,7 @@ InitBallForStage: ; 0x83ba ld [wBallRotation], a
inc a
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, $20
ld [wSCX], a
ld a, [wCurrentStage]
diff --git a/engine/pinball_game/ball_init/ball_init_blue_field.asm b/engine/pinball_game/ball_init/ball_init_blue_field.asm index c530420..6d33e83 100755 --- a/engine/pinball_game/ball_init/ball_init_blue_field.asm +++ b/engine/pinball_game/ball_init/ball_init_blue_field.asm @@ -11,9 +11,9 @@ InitBallBlueField: ; 0x1c08d ld a, $98
ld [wBallYPos + 1], a
xor a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wd580], a
- call Func_1c7c7
+ call InitBlueFieldCollisionAttributes
ld a, [wd4c9]
and a
ret z
diff --git a/engine/pinball_game/ball_init/ball_init_red_field.asm b/engine/pinball_game/ball_init/ball_init_red_field.asm index c25259b..5411ac8 100755 --- a/engine/pinball_game/ball_init/ball_init_red_field.asm +++ b/engine/pinball_game/ball_init/ball_init_red_field.asm @@ -11,7 +11,7 @@ InitBallRedField: ; 0x3007d ld a, $98
ld [wBallYPos + 1], a
xor a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wd580], a
ld a, [wd7ad]
bit 7, 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 0e24a0f..e4d8692 100755 --- a/engine/pinball_game/ball_loss/ball_loss_blue_field.asm +++ b/engine/pinball_game/ball_loss/ball_loss_blue_field.asm @@ -32,7 +32,7 @@ HandleBallLossBlueField: ; 0xde4f ld a, $1
ld [wd4c9], a
xor a
- ld [wd4de], a
+ ld [wPinballLaunched], a
ld [wd4df], a
call Func_ded6
ld a, [wCurBonusMultiplier]
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 3910478..6fc76fe 100755 --- a/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_gengar_bonus.asm @@ -15,7 +15,7 @@ HandleBallLossGengarBonus: ; 0xdf1a and a
ret nz
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wBallSpin], a
ld [wBallRotation], a
ld hl, wBallXVelocity
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 68a0235..d4a5fe5 100755 --- a/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm +++ b/engine/pinball_game/ball_loss/ball_loss_mewtwo_bonus.asm @@ -15,7 +15,7 @@ HandleBallLossMewtwoBonus: ; 0xdf7e and a
ret nz
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wBallSpin], a
ld [wBallRotation], a
ld hl, wBallXVelocity
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 ab307eb..f76bf6e 100755 --- a/engine/pinball_game/ball_loss/ball_loss_red_field.asm +++ b/engine/pinball_game/ball_loss/ball_loss_red_field.asm @@ -32,7 +32,7 @@ HandleBallLossRedField: ; 0xdd76 ld a, $1
ld [wd4c9], a
xor a
- ld [wd4de], a
+ ld [wPinballLaunched], a
ld [wd4df], a
call Func_ddfd
ld a, [wCurBonusMultiplier]
diff --git a/engine/pinball_game/catchem_mode.asm b/engine/pinball_game/catchem_mode.asm index c72679e..632e145 100755 --- a/engine/pinball_game/catchem_mode.asm +++ b/engine/pinball_game/catchem_mode.asm @@ -691,7 +691,7 @@ BallCaptureInit: ; 0x10496 ld [wBallYVelocity + 1], a
xor a
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
lb de, $00, $0b
call PlaySoundEffect
ret
@@ -789,7 +789,7 @@ CapturePokemon: ; 0x1052d ld [wCapturingMon], a
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
callba RestoreBallSaverAfterCatchEmMode
call ConcludeCatchEmMode
ld de, $0001
diff --git a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm index 69e76eb..5354a51 100755 --- a/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm +++ b/engine/pinball_game/draw_sprites/draw_blue_field_sprites.asm @@ -1,7 +1,7 @@ DrawSpritesBlueFieldTop: ; 0x1f330
ld bc, $7f00
callba DrawTimer
- call Func_1f395
+ call DrawShellderSprites
call Func_1f3e1
call Func_1f408
call Func_1f428
@@ -23,18 +23,18 @@ DrawSpritesBlueFieldBottom: ; 0x1f35a call Func_1f55e
ret
-Func_1f395: ; 0x1f395
- ld de, wd4cd
+DrawShellderSprites: ; 0x1f395
+ ld de, wShellder1Animation_Unused
ld hl, Data_1f3cf
- call Func_1f3ad
- ld de, wd4d0
+ call DrawShellderSprite
+ ld de, wShellder2Animation_Unused
ld hl, Data_1f3d5
- call Func_1f3ad
- ld de, wd4d3
+ call DrawShellderSprite
+ ld de, wShellder3Animation_Unused
ld hl, Data_1f3db
; fall through
-Func_1f3ad: ; 0x1f3ad
+DrawShellderSprite: ; 0x1f3ad
ld a, [hSCX]
ld b, a
ld a, [hli]
@@ -45,7 +45,7 @@ Func_1f3ad: ; 0x1f3ad ld a, [hli]
sub c
ld c, a
- ld a, [wd4d7]
+ ld a, [wWhichAnimatedShellder]
sub [hl]
inc hl
jr z, .asm_1f3c4
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 dbea5c0..024527b 100755 --- a/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm +++ b/engine/pinball_game/draw_sprites/draw_red_field_sprites.asm @@ -1,7 +1,7 @@ DrawSpritesRedFieldTop: ; 0x1755c
ld bc, $7f00
call DrawTimer
- call Func_17cc4
+ call DrawVoltorbSprites
call Func_17d34
call Func_17d59
call Func_17d7a
@@ -202,18 +202,18 @@ DrawAnimatedMon_RedStage: ; 0x17c96 AnimatedMonOAMIds_RedStage:
db $26, $27, $28, $29, $2A, $2B, $2C, $2D, $2E, $2F, $30, $31
-Func_17cc4: ; 0x17cc4
- ld de, wd4cd
+DrawVoltorbSprites: ; 0x17cc4
+ ld de, wVoltorb1Animation
ld hl, OAMData_17d15
- call Func_17cdc
- ld de, wd4d0
+ call DrawVoltorbSprite
+ ld de, wVoltorb2Animation
ld hl, OAMData_17d1b
- call Func_17cdc
- ld de, wd4d3
+ call DrawVoltorbSprite
+ ld de, wVoltorb3Animation
ld hl, OAMData_17d21
; fall through
-Func_17cdc: ; 0x17cdc
+DrawVoltorbSprite: ; 0x17cdc
push hl
ld hl, AnimationData_17d27
call UpdateAnimation
@@ -243,7 +243,7 @@ Func_17cdc: ; 0x17cdc ld a, [hli]
sub c
ld c, a
- ld a, [wd4d7]
+ ld a, [wWhichAnimatedVoltorb]
sub [hl]
inc hl
jr z, .asm_17d0c
diff --git a/engine/pinball_game/load_stage_data/load_blue_field.asm b/engine/pinball_game/load_stage_data/load_blue_field.asm index 5f98c8b..be4ffe0 100755 --- a/engine/pinball_game/load_stage_data/load_blue_field.asm +++ b/engine/pinball_game/load_stage_data/load_blue_field.asm @@ -1,6 +1,6 @@ _LoadStageDataBlueFieldTop: ; 0x1c165
call asm_1e475
- call Func_1cb43
+ call UpdateSpinnerChargeGraphics_BlueField
call Func_1c3ee
call Func_1e8f6
callba Func_142fc
@@ -51,7 +51,7 @@ Func_1c1db: ; 0x1c1db Func_1c203: ; 0x1c203
ld a, $ff
- ld [wd4d7], a
+ ld [wWhichAnimatedShellder], a
ld [wd4db], a
ld a, [wBallXPos + 1]
ld [wd4c5], a
diff --git a/engine/pinball_game/load_stage_data/load_red_field.asm b/engine/pinball_game/load_stage_data/load_red_field.asm index 424e367..2cf7296 100755 --- a/engine/pinball_game/load_stage_data/load_red_field.asm +++ b/engine/pinball_game/load_stage_data/load_red_field.asm @@ -3,7 +3,7 @@ _LoadStageDataRedFieldTop: ; 0x14000 call Func_159f4
call Func_15450
call Func_16859
- call Func_14ece
+ call UpdateSpinnerChargeGraphics_RedField
call Func_14234
call Func_16425
call Func_142fc
@@ -67,7 +67,7 @@ Func_1404a: ; 0x1404a Func_14091: ; 0x14091
ld a, $ff
- ld [wd4d7], a
+ ld [wWhichAnimatedVoltorb], a
ld [wd4db], a
ld a, [wBallXPos + 1]
ld [wd4c5], a
diff --git a/engine/pinball_game/load_stage_data/load_unused_stage.asm b/engine/pinball_game/load_stage_data/load_unused_stage.asm index 0e4137a..89d1128 100755 --- a/engine/pinball_game/load_stage_data/load_unused_stage.asm +++ b/engine/pinball_game/load_stage_data/load_unused_stage.asm @@ -17,5 +17,5 @@ DoNothing_1806d: ; 0x1806d ret
Func_1806e: ; 0x1806e
- callba Func_1652d
+ callba ResolveRedStagePinballLaunchCollision
ret
diff --git a/engine/pinball_game/object_collision/blue_stage_object_collision.asm b/engine/pinball_game/object_collision/blue_stage_object_collision.asm index d88c174..8252802 100755 --- a/engine/pinball_game/object_collision/blue_stage_object_collision.asm +++ b/engine/pinball_game/object_collision/blue_stage_object_collision.asm @@ -127,7 +127,7 @@ CheckBlueStageEvolutionTrinketCollision: ; 0x1c5eb CheckBlueStageLaunchAlleyCollision: ; 0x1c607
ld de, BlueStageLaunchAlleyCollisionData
- ld bc, wPinballLaunchAlley
+ ld bc, wPinballLaunchCollision
scf
jp HandleGameObjectCollision
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 cf35329..01fbbb6 100755 --- a/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm +++ b/engine/pinball_game/object_collision/blue_stage_resolve_collision.asm @@ -12,7 +12,7 @@ ResolveBlueFieldTopGameObjectCollisions: ; 0x1c715 call ResolvePsyduckPoliwagCollision
call ResolveBlueStageForceFieldCollision
call Func_1e9c0
- call Func_1c8b6
+ call UpdateForceFieldDirection
call Func_1f18a
callba Func_146a9
call Func_1f27b
@@ -23,21 +23,21 @@ ResolveBlueFieldTopGameObjectCollisions: ; 0x1c715 ret
ResolveBlueFieldBottomGameObjectCollisions: ; 0x1c769
- call Func_1ca4a
- call Func_1ce40
+ call ResolveWildMonCollision_BlueField
+ call ResolveBlueStageBumperCollision
call ResolvePsyduckPoliwagCollision
- call Func_1ca85
+ call UpdateBlueStageSpinner
call Func_1e4b8
call HandleBlueStageBallTypeUpgradeCounter
call Func_1e5c5
- call Func_1c7d7
+ call ResolveBlueStagePinballLaunchCollision
call ResolveBlueStagePikachuCollision
call Func_1ead4
call ResolveBlueStageBonusMultiplierCollision
call Func_1e757
call Func_1e9c0
call Func_1ea0a
- call Func_1c8b6
+ call UpdateForceFieldDirection
callba Func_14733
callba Func_146a2
call Func_1f261
@@ -47,21 +47,21 @@ ResolveBlueFieldBottomGameObjectCollisions: ; 0x1c769 callba Func_10000
ret
-Func_1c7c7: ; 0x1c7c7
+InitBlueFieldCollisionAttributes: ; 0x1c7c7
ld a, $0
ld [wStageCollisionState], a
callba LoadStageCollisionAttributes
ret
-Func_1c7d7: ; 0x1c7d7
- ld a, [wPinballLaunchAlley]
+ResolveBlueStagePinballLaunchCollision: ; 0x1c7d7
+ ld a, [wPinballLaunchCollision]
and a
ret z
xor a
- ld [wPinballLaunchAlley], a
- ld a, [wd4de]
+ ld [wPinballLaunchCollision], a ; set to 0, so we only check for a launch once per frame
+ ld a, [wPinballLaunched]
and a
- jr z, .asm_1c810
+ jr z, .dontLaunch
xor a
ld [wRightAlleyTrigger], a
ld [wLeftAlleyTrigger], a
@@ -76,33 +76,35 @@ Func_1c7d7: ; 0x1c7d7 ld a, $fa
ld [wBallYVelocity + 1], a
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
lb de, $00, $0a
call PlaySoundEffect
-.asm_1c810
+.dontLaunch
ld a, $ff
ld [wPreviousTriggeredGameObject], a
- ld a, [wd4de]
+ ld a, [wPinballLaunched]
and a
ret nz
- ld a, [wd4e0]
+ ld a, [wChoseInitialMap]
and a
- jr nz, .asm_1c82c
- call Func_1c839
+ jr nz, .checkPressedKeysToLaunchBall
+ call ChooseInitialMap_BlueField
ld a, $1
- ld [wd4e0], a
- ld [wd4de], a
+ ld [wChoseInitialMap], a
+ ld [wPinballLaunched], a
ret
-.asm_1c82c
+.checkPressedKeysToLaunchBall
ld hl, wKeyConfigBallStart
call IsKeyPressed
ret z
ld a, $1
- ld [wd4de], a
+ ld [wPinballLaunched], a
ret
-Func_1c839: ; 0x1c839
+ChooseInitialMap_BlueField: ; 0x1c839
+; While waiting to launch the pinball, this quickly rotates the billboard with the initial
+; maps the player can start on.
ld a, [hGameBoyColorFlag]
and a
callba nz, LoadGreyBillboardPaletteData
@@ -129,7 +131,7 @@ Func_1c839: ; 0x1c839 ld b, $20 ; number of frames to delay before the next map is shown
.waitOnCurrentMap
push bc
- callba Func_eeee
+ callba Delay1Frame
ld hl, wKeyConfigBallStart
call IsKeyPressed
jr nz, .ballStartKeyPressed
@@ -142,11 +144,11 @@ Func_1c839: ; 0x1c839 pop bc
callba LoadMapBillboardTileData
ld bc, StartFromMapText
- callba Func_3118f
+ callba LoadScrollingMapNameText
ld a, [wCurrentMap]
- ld [wd4e3], a
+ ld [wVisitedMaps], a
xor a
- ld [wd4e2], a
+ ld [wNumMapMoves], a
ret
BlueStageInitialMaps: ; 0x1c8af
@@ -158,22 +160,24 @@ BlueStageInitialMaps: ; 0x1c8af db ROCK_MOUNTAIN
db CELADON_CITY
-Func_1c8b6: ; 0x1c8b6
- ld a, [wd64c]
+UpdateForceFieldDirection: ; 0x1c8b6
+; Every 5 seconds, decide which way the force field (in between slowpoke and cloyster) should point.
+ ld a, [wBlueFieldForceFieldFrameCounter]
inc a
- cp $3c
- jr z, .asm_1c8c2
- ld [wd64c], a
+ cp 60
+ jr z, .oneSecond
+ ld [wBlueFieldForceFieldFrameCounter], a
ret
-.asm_1c8c2
+.oneSecond
xor a
- ld [wd64c], a
- ld hl, wd64d
+ ld [wBlueFieldForceFieldFrameCounter], a
+ ld hl, wBlueFieldForceFieldSecondsCounter
inc [hl]
ld a, [hl]
- cp $5
+ cp 5
ret nz
+ ; This code is reached exactly once every 5 seconds
ld a, [wd644]
and a
jr nz, .asm_1c8e1
@@ -201,7 +205,7 @@ Func_1c8b6: ; 0x1c8b6 ld [wd64b], a
.asm_1c8fc
xor a
- ld [wd64d], a
+ ld [wBlueFieldForceFieldSecondsCounter], a
xor a
ld [wd64a], a
ld [wd649], a
@@ -312,28 +316,28 @@ ResolveShellderCollision: ; 0x1c9c1 jr z, .noCollision
xor a
ld [wWhichShellder], a
- call Func_1ca29
+ call ApplyShellderCollision
ld a, [wBlueStageForceFieldFlippedDown]
and a
- jr nz, .asm_1c9f2
+ jr nz, .forceFieldPointingCorrectDirection
ld a, $1
ld [wBlueStageForceFieldFlippedDown], a
ld a, [wBlueStageForceFieldDirection]
cp $0 ; up direction
- jr nz, .asm_1c9f2
+ jr nz, .forceFieldPointingCorrectDirection
ld a, $2 ; down direction
ld [wBlueStageForceFieldDirection], a
ld a, $1
ld [wBlueStageForceFieldGfxNeedsLoading], a
ld a, $3
- ld [wd64c], a
- ld [wd64d], a
-.asm_1c9f2
+ ld [wBlueFieldForceFieldFrameCounter], a
+ ld [wBlueFieldForceFieldSecondsCounter], a
+.forceFieldPointingCorrectDirection
ld a, $10
- ld [wd4d6], a
+ ld [wShellderHitAnimationDuration], a
ld a, [wWhichShellderId]
sub $3
- ld [wd4d7], a
+ ld [wWhichAnimatedShellder], a
ld a, $4
callba Func_10000
ld bc, FiveHundredPoints
@@ -341,17 +345,17 @@ ResolveShellderCollision: ; 0x1c9c1 ret
.noCollision
- ld a, [wd4d6]
+ ld a, [wShellderHitAnimationDuration]
and a
ret z
dec a
- ld [wd4d6], a
+ ld [wShellderHitAnimationDuration], a
ret nz
ld a, $ff
- ld [wd4d7], a
+ ld [wWhichAnimatedShellder], a
ret
-Func_1ca29: ; 0x1ca29
+ApplyShellderCollision: ; 0x1ca29
ld a, $ff
ld [wd803], a
ld a, $3
@@ -367,7 +371,7 @@ Func_1ca29: ; 0x1ca29 call PlaySoundEffect
ret
-Func_1ca4a: ; 1ca4a
+ResolveWildMonCollision_BlueField: ; 0x1ca4a
ld a, [wWildMonCollision]
and a
ret z
@@ -382,7 +386,7 @@ Func_1ca4a: ; 1ca4a ResolveBlueStageSpinnerCollision: ; 0x1ca5f
ld a, [wSpinnerCollision]
and a
- jr z, Func_1ca85
+ jr z, UpdateBlueStageSpinner
xor a
ld [wSpinnerCollision], a
ld a, [wBallYVelocity]
@@ -397,7 +401,7 @@ ResolveBlueStageSpinnerCollision: ; 0x1ca5f callba Func_10000
; fall through
-Func_1ca85: ; 0x1ca85
+UpdateBlueStageSpinner: ; 0x1ca85
ld hl, wd50b
ld a, [hli]
or [hl]
@@ -463,13 +467,13 @@ Func_1ca85: ; 0x1ca85 ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_1caff
- call Func_1cb1c
+ call PlaySpinnerChargingSoundEffect_BlueField
ret
.asm_1caff
inc a
ld [wPikachuSaverCharge], a
- call Func_1cb1c
+ call PlaySpinnerChargingSoundEffect_BlueField
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_1cb12
@@ -479,17 +483,17 @@ Func_1ca85: ; 0x1ca85 ld a, [wCurrentStage]
bit 0, a
ret nz
- call Func_1cb43
+ call UpdateSpinnerChargeGraphics_BlueField
ret
-Func_1cb1c: ; 0x1cb1c
+PlaySpinnerChargingSoundEffect_BlueField: ; 0x1cb1c
ld a, [wd51e]
and a
ret nz
ld a, [wPikachuSaverCharge]
ld c, a
ld b, $0
- ld hl, SoundEffectIds_1cb33
+ ld hl, SpinnerChargingSoundEffectIds_BlueField
add hl, bc
ld a, [hl]
ld e, a
@@ -497,10 +501,11 @@ Func_1cb1c: ; 0x1cb1c call PlaySoundEffect
ret
-SoundEffectIds_1cb33:
+SpinnerChargingSoundEffectIds_BlueField:
db $12, $13, $14, $15, $16, $17, $18, $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $11
-Func_1cb43: ; 0x1cb43
+UpdateSpinnerChargeGraphics_BlueField: ; 0x1cb43
+; Loads the correct graphics that show the lightning bolt icon for the spinner's current charge.
ld a, [wPikachuSaverCharge]
ld c, a
sla c
@@ -1179,22 +1184,22 @@ TileData_1ce32: ; 0x1ce32 db $00 ; terminator
-Func_1ce40: ; 1ce40
+ResolveBlueStageBumperCollision: ; 1ce40
ld a, [wWhichBumper]
and a
jr z, .asm_1ce53
- call Func_1ce72
+ call LoadBumperCollisionGraphics_BlueField
call Func_1ce60
xor a
ld [wWhichBumper], a
- call Func_1ce94
+ call ApplyBumperCollision_BlueField
.asm_1ce53
ld a, [wd4da]
and a
ret z
dec a
ld [wd4da], a
- call z, Func_1ce72
+ call z, LoadBumperCollisionGraphics_BlueField
ret
Func_1ce60: ; 0x1ce60
@@ -1207,7 +1212,7 @@ Func_1ce60: ; 0x1ce60 inc a
jr asm_1ce7a
-Func_1ce72: ; 1ce72
+LoadBumperCollisionGraphics_BlueField: ; 1ce72
ld a, [wd4db]
cp $ff
ret z
@@ -1230,7 +1235,7 @@ asm_1ce7a: ; 0x1ce7a call Func_10aa
ret
-Func_1ce94: ; 0x1ce94
+ApplyBumperCollision_BlueField: ; 0x1ce94
ld a, $ff
ld [wd803], a
ld a, $3
@@ -1246,7 +1251,7 @@ Func_1ce94: ; 0x1ce94 sub $1
ld c, a
ld b, $0
- ld hl, Data_1cec8
+ ld hl, BumperCollisionAngleDeltas_BlueField
add hl, bc
ld a, [wCollisionForceAngle]
add [hl]
@@ -1255,7 +1260,7 @@ Func_1ce94: ; 0x1ce94 call PlaySoundEffect
ret
-Data_1cec8:
+BumperCollisionAngleDeltas_BlueField:
db -8, 8
TileDataPointers_1ceca:
@@ -1500,26 +1505,27 @@ ResolveBlueStageBoardTriggerCollision: ; 0x1cfaa sub $7
ld c, a
ld b, $0
- ld hl, wd521
+ ld hl, wCollidedAlleyTriggers
add hl, bc
ld [hl], $1
- ld a, [wd521]
+ ld a, [wCollidedAlleyTriggers + 0]
and a
- call nz, Func_1d010
- ld a, [wd522]
+ call nz, HandleSecondaryLeftAlleyTrigger_BlueField
+ ld a, [wCollidedAlleyTriggers + 1]
and a
- call nz, Func_1d047
- ld a, [wd523]
+ call nz, HandleSecondaryRightAlleyTrigger_BlueField
+ ld a, [wCollidedAlleyTriggers + 2]
and a
- call nz, HandleLeftAlleyTriggerBlueField
- ld a, [wd524]
+ call nz, HandleLeftAlleyTrigger_BlueField
+ ld a, [wCollidedAlleyTriggers + 3]
and a
- call nz, HandleRightAlleyTriggerBlueField
+ call nz, HandleRightAlleyTrigger_BlueField
ret
-Func_1d010: ; 0x1d010
+HandleSecondaryLeftAlleyTrigger_BlueField: ; 0x1d010
+; Ball passed over the secondary left alley trigger point in the Blue Field.
xor a
- ld [wd521], a
+ ld [wCollidedAlleyTriggers + 0], a
ld a, [wLeftAlleyTrigger]
and a
ret z
@@ -1545,9 +1551,10 @@ Func_1d010: ; 0x1d010 ld [wIndicatorStates + 2], a
ret
-Func_1d047: ; 0x1d047
+HandleSecondaryRightAlleyTrigger_BlueField: ; 0x1d047
+; Ball passed over the secondary right alley trigger point in the Blue Field.
xor a
- ld [wd522], a
+ ld [wCollidedAlleyTriggers + 1], a
ld a, [wRightAlleyTrigger]
and a
ret z
@@ -1573,10 +1580,10 @@ Func_1d047: ; 0x1d047 ld [wIndicatorStates + 3], a
ret
-HandleLeftAlleyTriggerBlueField: ; 0x1d080
+HandleLeftAlleyTrigger_BlueField: ; 0x1d080
; Ball passed over the left alley trigger point in the Blue Field.
xor a
- ld [wd523], a
+ ld [wCollidedAlleyTriggers + 2], a
ld [wRightAlleyTrigger], a
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
@@ -1584,10 +1591,10 @@ HandleLeftAlleyTriggerBlueField: ; 0x1d080 ret c
ret
-HandleRightAlleyTriggerBlueField: ; 0x1d091
+HandleRightAlleyTrigger_BlueField: ; 0x1d091
; Ball passed over the right alley trigger point in the Blue Field.
xor a
- ld [wd524], a
+ ld [wCollidedAlleyTriggers + 3], a
ld [wLeftAlleyTrigger], a
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
@@ -1633,7 +1640,7 @@ ResolveBlueStagePikachuCollision: ; 0x1d0a1 ld [wBallYVelocity + 1], a
ld [wBallSpin], a
ld [wBallRotation], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
call FillBottomMessageBufferWithBlackTile
jr .asm_1d110
@@ -1705,7 +1712,7 @@ Func_1d133: ; 0x1d133 ld a, $fc
ld [wBallYVelocity + 1], a
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld bc, FiveThousandPoints
callba AddBigBCD6FromQueueWithBallMultiplier
xor a
@@ -1798,7 +1805,7 @@ ResolveSlowpokeCollision: ; 0x1d216 ld [wBallXPos], a
ld [wBallYPos], a
xor a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
.asm_1d253
ld hl, SlowpokeCollisionAnimationData ; 0x1d312
ld de, wSlowpokeAnimation
@@ -1854,7 +1861,7 @@ ResolveSlowpokeCollision: ; 0x1d216 cp $5
ret nz
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, $b0
ld [wBallXVelocity], a
ld a, $0
@@ -1872,8 +1879,8 @@ ResolveSlowpokeCollision: ; 0x1d216 .asm_1d2f8
xor a
ld [wd642], a
- ld [wd64c], a
- ld [wd64d], a
+ ld [wBlueFieldForceFieldFrameCounter], a
+ ld [wBlueFieldForceFieldSecondsCounter], a
ld a, $1
ld [wBlueStageForceFieldFlippedDown], a
ld a, $2 ; down direction
@@ -1920,7 +1927,7 @@ ResolveCloysterCollision: ; 0x1d32d ld [wBallXPos], a
ld [wBallYPos], a
xor a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
.asm_1d36a
ld hl, CloysterCollisionAnimationData
ld de, wCloysterAnimation
@@ -1976,7 +1983,7 @@ ResolveCloysterCollision: ; 0x1d32d cp $5
ret nz
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, $4f
ld [wBallXVelocity], a
ld a, $ff
@@ -1989,8 +1996,8 @@ ResolveCloysterCollision: ; 0x1d32d ld a, $e
callba Func_10000
xor a
- ld [wd64c], a
- ld [wd64d], a
+ ld [wBlueFieldForceFieldFrameCounter], a
+ ld [wBlueFieldForceFieldSecondsCounter], a
ld a, $1
ld [wBlueStageForceFieldFlippedDown], a
ld a, $2 ; down direction
@@ -5746,7 +5753,7 @@ Func_1e757: ; 0x1e757 ld [hli], a
ld [hli], a
ld [hli], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wBallXPos], a
ld [wBallYPos], a
ld a, $50
@@ -5837,7 +5844,7 @@ Func_1e830: ; 0x1e830 jr nc, .asm_1e84b
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ret
.asm_1e84b
@@ -5885,7 +5892,7 @@ Func_1e830: ; 0x1e830 jr nc, .asm_1e858
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp EVOLUTION_MODE_SLOT_REWARD
ret nz
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 6a7e301..3a4d7cc 100755 --- a/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm +++ b/engine/pinball_game/object_collision/gengar_bonus_resolve_collision.asm @@ -878,7 +878,7 @@ Func_1894c: ; 0x1894c inc a
ld [wd6a5], a
ld a, [wd548]
- ld hl, wd549
+ ld hl, wDisableBallGravityAndTilt
and [hl]
jr z, .asm_18973
ld a, [wBallYPos + 1]
diff --git a/engine/pinball_game/object_collision/red_stage_object_collision.asm b/engine/pinball_game/object_collision/red_stage_object_collision.asm index 341726d..2d07286 100755 --- a/engine/pinball_game/object_collision/red_stage_object_collision.asm +++ b/engine/pinball_game/object_collision/red_stage_object_collision.asm @@ -93,7 +93,7 @@ CheckRedStageBumpersCollision: ; 0x14481 CheckRedStageLaunchAlleyCollision: ; 0x1448e
ld de, RedStageLaunchAlleyCollisionData
- ld bc, wPinballLaunchAlley
+ ld bc, wPinballLaunchCollision
scf
jp HandleGameObjectCollision
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 b558015..b60060b 100755 --- a/engine/pinball_game/object_collision/red_stage_resolve_collision.asm +++ b/engine/pinball_game/object_collision/red_stage_resolve_collision.asm @@ -22,15 +22,15 @@ ResolveRedFieldTopGameObjectCollisions: ; 0x1460e ret
ResolveRedFieldBottomGameObjectCollisions: ; 0x14652
- call Func_14795
- call Func_15f86
+ call ResolveWildMonCollision_RedField
+ call ResolveRedStageBumperCollision
call ResolveDiglettCollision
call Func_14880
- call Func_14e10
+ call UpdateRedStageSpinner
call Func_154a9
call HandleRedStageBallTypeUpgradeCounter
call Func_151cb
- call Func_1652d
+ call ResolveRedStagePinballLaunchCollision
call ResolveRedStagePikachuCollision
call Func_167ff
call Func_169a6
@@ -207,7 +207,7 @@ AgainTextOnTileDataRedField2: db Bank(StageRedFieldBottomBaseGameBoyGfx)
db $00
-Func_14795: ; 0x14795
+ResolveWildMonCollision_RedField: ; 0x14795
ld a, [wWildMonCollision]
and a
ret z
@@ -1320,10 +1320,10 @@ ResolveVoltorbCollision: ; 0x14d85 ld [wWhichVoltorb], a
call Func_14dc9
ld a, $10
- ld [wd4d6], a
+ ld [wVoltorbHitAnimationDuration], a
ld a, [wWhichVoltorbId]
sub $3
- ld [wd4d7], a
+ ld [wWhichAnimatedVoltorb], a
ld a, $4
callba Func_10000
ld bc, FiveHundredPoints
@@ -1331,14 +1331,14 @@ ResolveVoltorbCollision: ; 0x14d85 ret
.noVoltorbCollision
- ld a, [wd4d6]
+ ld a, [wVoltorbHitAnimationDuration]
and a
ret z
dec a
- ld [wd4d6], a
+ ld [wVoltorbHitAnimationDuration], a
ret nz
ld a, $ff
- ld [wd4d7], a
+ ld [wWhichAnimatedVoltorb], a
ret
Func_14dc9: ; 0x14dc9
@@ -1360,7 +1360,7 @@ Func_14dc9: ; 0x14dc9 ResolveRedStageSpinnerCollision: ; 0x14dea
ld a, [wSpinnerCollision]
and a
- jr z, Func_14e10
+ jr z, UpdateRedStageSpinner
xor a
ld [wSpinnerCollision], a
ld a, [wBallYVelocity]
@@ -1374,7 +1374,8 @@ ResolveRedStageSpinnerCollision: ; 0x14dea ld a, $c
callba Func_10000
; fall through
-Func_14e10: ; 0x14e10
+
+UpdateRedStageSpinner: ; 0x14e10
ld hl, wd50b
ld a, [hli]
or [hl]
@@ -1440,13 +1441,13 @@ Func_14e10: ; 0x14e10 ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_14e8a
- call Func_14ea7
+ call PlaySpinnerChargingSoundEffect_RedField
ret
.asm_14e8a
inc a
ld [wPikachuSaverCharge], a
- call Func_14ea7
+ call PlaySpinnerChargingSoundEffect_RedField
ld a, [wPikachuSaverCharge]
cp MAX_PIKACHU_SAVER_CHARGE
jr nz, .asm_14e9d
@@ -1456,17 +1457,17 @@ Func_14e10: ; 0x14e10 ld a, [wCurrentStage]
bit 0, a
ret nz
- call Func_14ece
+ call UpdateSpinnerChargeGraphics_RedField
ret
-Func_14ea7: ; 0x14ea7
+PlaySpinnerChargingSoundEffect_RedField: ; 0x14ea7
ld a, [wd51e]
and a
ret nz
ld a, [wPikachuSaverCharge]
ld c, a
ld b, $0
- ld hl, SoundEffects_14ebe
+ ld hl, SpinnerChargingSoundEffectIds_RedField
add hl, bc
ld a, [hl]
ld e, a
@@ -1474,10 +1475,11 @@ Func_14ea7: ; 0x14ea7 call PlaySoundEffect
ret
-SoundEffects_14ebe:
+SpinnerChargingSoundEffectIds_RedField:
db $12, $13, $14, $15, $16, $17, $18, $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $11
-Func_14ece: ; 0x14ece
+UpdateSpinnerChargeGraphics_RedField: ; 0x14ece
+; Loads the correct graphics that show the lightning bolt icon for the spinner's current charge.
ld a, [wPikachuSaverCharge]
ld c, a
sla c
@@ -3391,38 +3393,41 @@ ResolveRedStageBoardTriggerCollision: ; 0x1581f sub $11
ld c, a
ld b, $0
- ld hl, wd521
+ ld hl, wCollidedAlleyTriggers
add hl, bc
ld [hl], $1
- ld a, [wd521]
+ ld a, [wCollidedAlleyTriggers + 0]
and a
- call nz, Func_1587c
- ld a, [wd522]
+ call nz, HandleSecondaryLeftAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 1]
and a
- call nz, Func_158c0
- ld a, [wd523]
+ call nz, HandleThirdLeftAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 2]
and a
- call nz, Func_15904
- ld a, [wd524]
+ call nz, HandleSecondaryStaryuAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 3]
and a
- call nz, HandleLeftAlleyTriggerRedField
- ld a, [wd525]
+ call nz, HandleLeftAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 4]
and a
- call nz, Func_15931
- ld a, [wd526]
+ call nz, HandleStaryuAlleyTrigger_RedField
+ ; Ball passed over the second Staryu alley trigger point in the Red Field.
+ ld a, [wCollidedAlleyTriggers + 5]
and a
- call nz, Func_15944
- ld a, [wd527]
+ call nz, HandleSecondaryRightAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 6]
and a
- call nz, HandleRightAlleyTriggerRedField
- ld a, [wd528]
+ call nz, HandleRightAlleyTrigger_RedField
+ ld a, [wCollidedAlleyTriggers + 7]
and a
call nz, Func_15990
ret
-Func_1587c: ; 0x1587c
+HandleSecondaryLeftAlleyTrigger_RedField: ; 0x1587c
+; Ball passed over the secondary left alley trigger point in the Red Field.
+; This is the trigger that is covered up by Ditto when evolution mode isn't available.
xor a
- ld [wd521], a
+ ld [wCollidedAlleyTriggers + 0], a
ld a, [wLeftAlleyTrigger]
and a
ret z
@@ -3448,9 +3453,11 @@ Func_1587c: ; 0x1587c call Func_159f4
ret
-Func_158c0: ; 0x158c0
+HandleThirdLeftAlleyTrigger_RedField: ; 0x158c0
+; Ball passed over the third left alley trigger point in the Red Field.
+; This is the trigger that is NOT covered up by Ditto when evolution mode isn't available. It's located just to to the left of the top of the Voltorg area.
xor a
- ld [wd522], a
+ ld [wCollidedAlleyTriggers + 1], a
ld a, [wLeftAlleyTrigger]
and a
ret z
@@ -3476,9 +3483,10 @@ Func_158c0: ; 0x158c0 call Func_159f4
ret
-Func_15904: ; 0x15904
+HandleSecondaryStaryuAlleyTrigger_RedField: ; 0x15904
+; Ball passed over the second Staryu alley trigger point in the Red Field.
xor a
- ld [wd523], a
+ ld [wCollidedAlleyTriggers + 2], a
ld a, [wSecondaryLeftAlleyTrigger]
and a
ret z
@@ -3488,10 +3496,10 @@ Func_15904: ; 0x15904 callba Func_10000
ret
-HandleLeftAlleyTriggerRedField: ; 0x1591e
+HandleLeftAlleyTrigger_RedField: ; 0x1591e
; Ball passed over the left alley trigger point in the Red Field.
xor a
- ld [wd524], a
+ ld [wCollidedAlleyTriggers + 3], a
ld [wRightAlleyTrigger], a
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
@@ -3499,9 +3507,10 @@ HandleLeftAlleyTriggerRedField: ; 0x1591e call Func_159c9
ret
-Func_15931: ; 0x15931
+HandleStaryuAlleyTrigger_RedField: ; 0x15931
+; Ball passed over the first Staryu alley trigger point in the Red Field.
xor a
- ld [wd525], a
+ ld [wCollidedAlleyTriggers + 4], a
ld [wRightAlleyTrigger], a
ld [wLeftAlleyTrigger], a
ld a, $1
@@ -3509,9 +3518,10 @@ Func_15931: ; 0x15931 call Func_159c9
ret
-Func_15944: ; 0x15944
+HandleSecondaryRightAlleyTrigger_RedField: ; 0x15944
+; Ball passed over the secondary right alley trigger point in the Red Field.
xor a
- ld [wd526], a
+ ld [wCollidedAlleyTriggers + 5], a
ld a, [wRightAlleyTrigger]
and a
ret z
@@ -3537,10 +3547,10 @@ Func_15944: ; 0x15944 ld [wIndicatorStates + 3], a
ret
-HandleRightAlleyTriggerRedField: ; 0x1597d
+HandleRightAlleyTrigger_RedField: ; 0x1597d
; Ball passed over the right alley trigger point in the Red Field.
xor a
- ld [wd527], a
+ ld [wCollidedAlleyTriggers + 6], a
ld [wLeftAlleyTrigger], a
ld [wSecondaryLeftAlleyTrigger], a
ld a, $1
@@ -3550,7 +3560,7 @@ HandleRightAlleyTriggerRedField: ; 0x1597d Func_15990: ; 0x15990
xor a
- ld [wd528], a
+ ld [wCollidedAlleyTriggers + 7], a
ld a, [wRightAlleyTrigger]
and a
ret z
@@ -4467,7 +4477,7 @@ ResolveBellsproutCollision: ; 0x15e93 ld a, $78
ld [wBallYPos + 1], a
xor a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
.asm_15eda
ld hl, BellsproutAnimationData
ld de, wBellsproutAnimation
@@ -4521,7 +4531,7 @@ ResolveBellsproutCollision: ; 0x15e93 cp $5
ret nz
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
xor a
ld [wBallXVelocity + 1], a
ld a, $2
@@ -4550,22 +4560,22 @@ BellsproutAnimationData: ; 0x15f69 db $28, $01
db $00 ; terminator
-Func_15f86: ; 0x15f86
+ResolveRedStageBumperCollision: ; 0x15f86
ld a, [wWhichBumper]
and a
jr z, .asm_15f99
- call Func_5fb8
+ call LoadBumperCollisionGraphics_RedField
call Func_15fa6
xor a
ld [wWhichBumper], a
- call Func_15fda
+ call ApplyBumperCollision_RedField
.asm_15f99
ld a, [wd4da]
and a
ret z
dec a
ld [wd4da], a
- call z, Func_5fb8
+ call z, LoadBumperCollisionGraphics_RedField
ret
Func_15fa6: ; 0x15fa6
@@ -4578,7 +4588,7 @@ Func_15fa6: ; 0x15fa6 inc a
jr asm_15fc0
-Func_5fb8: ; 0x5fb8
+LoadBumperCollisionGraphics_RedField: ; 0x5fb8
ld a, [wd4db]
cp $ff
ret z
@@ -4601,7 +4611,7 @@ asm_15fc0 call Func_10aa
ret
-Func_15fda: ; 0x15fda
+ApplyBumperCollision_RedField: ; 0x15fda
ld a, $ff
ld [wd803], a
ld a, $3
@@ -4617,7 +4627,7 @@ Func_15fda: ; 0x15fda sub $6
ld c, a
ld b, $0
- ld hl, CollisionAngleDeltas_1600e
+ ld hl, BumperCollisionAngleDeltas_RedField
add hl, bc
ld a, [wCollisionForceAngle]
add [hl]
@@ -4626,7 +4636,7 @@ Func_15fda: ; 0x15fda call PlaySoundEffect
ret
-CollisionAngleDeltas_1600e:
+BumperCollisionAngleDeltas_RedField:
db -8, 8
TileDataPointers_16010:
@@ -4865,7 +4875,7 @@ ResolveDittoSlotCollision: ; 0x160f0 ld [hli], a
ld [hli], a
ld [hli], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wBallXPos], a
ld [wBallYPos], a
ld a, $11
@@ -4910,7 +4920,7 @@ ResolveDittoSlotCollision: ; 0x160f0 callba Func_10ab3
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, $5
ld [wd803], a
ld a, $8
@@ -5082,7 +5092,7 @@ Func_16279: ; 0x16279 ld [hli], a
ld [hli], a
ld [hli], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld [wBallXPos], a
ld [wBallYPos], a
ld a, $50
@@ -5173,7 +5183,7 @@ Func_16352: ; 0x16352 jr nc, .asm_1636d
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ret
.asm_1636d
@@ -5221,7 +5231,7 @@ Func_16352: ; 0x16352 jr nc, .asm_1637a
ld a, $1
ld [wd548], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld a, [wCatchEmOrEvolutionSlotRewardActive]
cp EVOLUTION_MODE_SLOT_REWARD
ret nz
@@ -5471,15 +5481,15 @@ Func_164e3: ; 0x164e3 call nz, Func_16425
ret
-Func_1652d: ; 0x1652d
- ld a, [wPinballLaunchAlley]
+ResolveRedStagePinballLaunchCollision: ; 0x1652d
+ ld a, [wPinballLaunchCollision]
and a
ret z
xor a
- ld [wPinballLaunchAlley], a
- ld a, [wd4de]
+ ld [wPinballLaunchCollision], a ; set to 0, so we only check for a launch once per frame
+ ld a, [wPinballLaunched]
and a
- jr z, .asm_16566
+ jr z, .notLaunchedYet
xor a
ld [wRightAlleyTrigger], a
ld [wLeftAlleyTrigger], a
@@ -5494,33 +5504,35 @@ Func_1652d: ; 0x1652d ld a, $fa
ld [wBallYVelocity + 1], a
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
lb de, $00, $0a
call PlaySoundEffect
-.asm_16566
+.notLaunchedYet
ld a, $ff
ld [wPreviousTriggeredGameObject], a
- ld a, [wd4de]
+ ld a, [wPinballLaunched]
and a
ret nz
- ld a, [wd4e0]
+ ld a, [wChoseInitialMap]
and a
- jr nz, .asm_16582
- call Func_1658f
+ jr nz, .checkPressedKeysToLaunchBall
+ call ChooseInitialMap_RedField
ld a, $1
- ld [wd4e0], a
- ld [wd4de], a
+ ld [wChoseInitialMap], a
+ ld [wPinballLaunched], a
ret
-.asm_16582
+.checkPressedKeysToLaunchBall
ld hl, wKeyConfigBallStart
call IsKeyPressed
ret z
ld a, $1
- ld [wd4de], a
+ ld [wPinballLaunched], a
ret
-Func_1658f: ; 0x1658f
+ChooseInitialMap_RedField: ; 0x1658f
+; While waiting to launch the pinball, this quickly rotates the billboard with the initial
+; maps the player can start on.
ld a, [hGameBoyColorFlag]
and a
callba nz, LoadGreyBillboardPaletteData
@@ -5547,7 +5559,7 @@ Func_1658f: ; 0x1658f ld b, $20 ; number of frames to delay before the next map is shown
.waitOnCurrentMap
push bc
- callba Func_eeee
+ callba Delay1Frame
ld hl, wKeyConfigBallStart
call IsKeyPressed
jr nz, .ballStartKeyPressed
@@ -5560,11 +5572,11 @@ Func_1658f: ; 0x1658f pop bc
callba LoadMapBillboardTileData
ld bc, StartFromMapText
- callba Func_3118f
+ callba LoadScrollingMapNameText
ld a, [wCurrentMap]
- ld [wd4e3], a
+ ld [wVisitedMaps], a
xor a
- ld [wd4e2], a
+ ld [wNumMapMoves], a
ret
RedStageInitialMaps: ; 0x16605
@@ -5615,7 +5627,7 @@ ResolveRedStagePikachuCollision: ; 0x1660c ld [wBallYVelocity + 1], a
ld [wBallSpin], a
ld [wBallRotation], a
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
call FillBottomMessageBufferWithBlackTile
jr .asm_1667b
@@ -5687,7 +5699,7 @@ Func_1669e: ; 0x1669e ld a, $fc
ld [wBallYVelocity + 1], a
ld a, $1
- ld [wd549], a
+ ld [wDisableBallGravityAndTilt], a
ld bc, FiveThousandPoints
callba AddBigBCD6FromQueueWithBallMultiplier
xor a
diff --git a/engine/pinball_game/slot.asm b/engine/pinball_game/slot.asm index a20f13b..2086c28 100755 --- a/engine/pinball_game/slot.asm +++ b/engine/pinball_game/slot.asm @@ -72,7 +72,7 @@ Func_ed8e: ; 0xed8e ld b, a
.asm_ee2a
push bc
- call Func_eeee
+ call Delay1Frame
ld a, [wd61e]
and a
jr nz, .asm_ee47
@@ -181,14 +181,15 @@ SlotRewards_CallTable: ; 0xeeca dw SlotRewardGoToBonusStage
dw SlotRewardGoToBonusStage
-Func_eeee: ; 0xeeee
+Delay1Frame: ; 0xeeee
+; Simply does nothing for approximately 1 frame of real time
push bc
ld bc, $0200
-.asm_eef2
+.loop
dec bc
ld a, b
or c
- jr nz, .asm_eef2
+ jr nz, .loop
pop bc
ret
@@ -4218,7 +4218,7 @@ Sine: ; 0x2149 ApplyGravityToBall: ; 0x2168 ; Adds a constant to the pinball's y velocity. - ld a, [wd549] + ld a, [wDisableBallGravityAndTilt] and a ret z ld de, $000b ; gravity added to y velocity every frame @@ -5243,7 +5243,7 @@ HandleLeftTilt: ; 0x358c call PlaySoundEffect .skipSoundEffect ld a, [wd548] - ld hl, wd549 + ld hl, wDisableBallGravityAndTilt and [hl] jr z, .skipBallMovement ld a, [wBallXPos + 1] @@ -5299,7 +5299,7 @@ HandleRightTilt: ; 0x35f3 call PlaySoundEffect .skipSoundEffect ld a, [wd548] - ld hl, wd549 + ld hl, wDisableBallGravityAndTilt and [hl] jr z, .skipBallMovement ld a, [wBallXPos + 1] @@ -5355,7 +5355,7 @@ HandleUpperTilt: ; 0x365a call PlaySoundEffect .skipSoundEffect ld a, [wd548] - ld hl, wd549 + ld hl, wDisableBallGravityAndTilt and [hl] jr z, .skipBallMovement ld a, [wBallYPos + 1] @@ -5395,7 +5395,7 @@ HandleUpperTilt: ; 0x365a ApplyTiltForces: ; 0x36c1 ld a, [wd548] - ld hl, wd549 + ld hl, wDisableBallGravityAndTilt and [hl] ret z ld c, $0 @@ -1508,7 +1508,9 @@ CallTable_30247: ; 0x30247 INCLUDE "engine/pinball_game/billboard_tiledata.asm" -Func_3118f: ; 0x3118f +LoadScrollingMapNameText: ; 0x3118f +; Loads the scrolling message that displays the current map's name. +; Input: bc = pointer to prefix scrolling text push bc call FillBottomMessageBufferWithBlackTile call Func_30db @@ -1589,64 +1591,66 @@ Func_31234: ; 0x31234 callba LoadMapBillboardTileData ret -Func_31281: ; 0x31282 - ld a, [wd4e2] +ChooseNextMap_RedField: ; 0x31282 +; Picks the next map to perform a map move. +; Also records which maps have been visited. + ld a, [wNumMapMoves] inc a cp $6 - jr c, .asm_3129e + jr c, .dontReset ld a, $ff - ld [wd4e3], a - ld [wd4e4], a - ld [wd4e5], a - ld [wd4e6], a - ld [wd4e7], a - ld [wd4e8], a + ld [wVisitedMaps], a + ld [wVisitedMaps + 1], a + ld [wVisitedMaps + 2], a + ld [wVisitedMaps + 3], a + ld [wVisitedMaps + 4], a + ld [wVisitedMaps + 5], a xor a -.asm_3129e - ld [wd4e2], a +.dontReset + ld [wNumMapMoves], a cp $3 - jr c, .chooseFirstMapMoveIndex + jr c, .chooseMapFromArea1 cp $5 - jr c, .chooseSecondMapMoveIndex + jr c, .chooseMapFromArea2 ld a, INDIGO_PLATEAU ld [wCurrentMap], a - ld [wd4e8], a + ld [wVisitedMaps + 5], a ret -.chooseFirstMapMoveIndex +.chooseMapFromArea1 call GenRandom and $7 cp $7 - jr nc, .chooseFirstMapMoveIndex + jr nc, .chooseMapFromArea1 ld c, a ld b, $0 ld hl, FirstMapMoveSet_RedField add hl, bc ld c, [hl] - ld hl, wd4e3 - ld a, [wd4e2] + ld hl, wVisitedMaps + ld a, [wNumMapMoves] and a jr z, .asm_312d4 ld b, a .asm_312cd ld a, [hli] cp c - jr z, .chooseFirstMapMoveIndex + jr z, .chooseMapFromArea1 dec b jr nz, .asm_312cd .asm_312d4 ld a, c ld [wCurrentMap], a - ld a, [wd4e2] + ld a, [wNumMapMoves] ld c, a ld b, $0 - ld hl, wd4e3 + ld hl, wVisitedMaps add hl, bc ld a, [wCurrentMap] ld [hl], a ret -.chooseSecondMapMoveIndex +.chooseMapFromArea2 call GenRandom and $3 ld c, a @@ -1654,24 +1658,24 @@ Func_31281: ; 0x31282 ld hl, SecondMapMoveSet_RedField add hl, bc ld c, [hl] - ld hl, wd4e6 - ld a, [wd4e2] + ld hl, wVisitedMaps + 3 + ld a, [wNumMapMoves] sub $3 jr z, .asm_31306 ld b, a .asm_312ff ld a, [hli] cp c - jr z, .chooseSecondMapMoveIndex + jr z, .chooseMapFromArea2 dec b jr nz, .asm_312ff .asm_31306 ld a, c ld [wCurrentMap], a - ld a, [wd4e2] + ld a, [wNumMapMoves] ld c, a ld b, $0 - ld hl, wd4e3 + ld hl, wVisitedMaps add hl, bc ld a, [wCurrentMap] ld [hl], a @@ -1765,64 +1769,66 @@ Func_313c3: ; 0x313c3 callba LoadMapBillboardTileData ret -Func_3140b: ; 0x3140b - ld a, [wd4e2] +ChooseNextMap_BlueField: ; 0x3140b +; Picks the next map to perform a map move. +; Also records which maps have been visited. + ld a, [wNumMapMoves] inc a cp $6 - jr c, .asm_31428 + jr c, .dontReset ld a, $ff - ld [wd4e3], a - ld [wd4e4], a - ld [wd4e5], a - ld [wd4e6], a - ld [wd4e7], a - ld [wd4e8], a + ld [wVisitedMaps], a + ld [wVisitedMaps + 1], a + ld [wVisitedMaps + 2], a + ld [wVisitedMaps + 3], a + ld [wVisitedMaps + 4], a + ld [wVisitedMaps + 5], a xor a -.asm_31428 - ld [wd4e2], a +.dontReset + ld [wNumMapMoves], a cp $3 - jr c, .asm_3143c + jr c, .chooseMapFromArea1 cp $5 - jr c, .asm_31471 + jr c, .chooseMapFromArea2 ld a, INDIGO_PLATEAU ld [wCurrentMap], a - ld [wd4e8], a + ld [wVisitedMaps + 5], a ret -.asm_3143c +.chooseMapFromArea1 call GenRandom and $7 cp $7 - jr nc, .asm_3143c + jr nc, .chooseMapFromArea1 ld c, a ld b, $0 ld hl, FirstMapMoveSet_BlueField add hl, bc ld c, [hl] - ld hl, wd4e3 - ld a, [wd4e2] + ld hl, wVisitedMaps + ld a, [wNumMapMoves] and a jr z, .asm_3145e ld b, a .asm_31457 ld a, [hli] cp c - jr z, .asm_3143c + jr z, .chooseMapFromArea1 dec b jr nz, .asm_31457 .asm_3145e ld a, c ld [wCurrentMap], a - ld a, [wd4e2] + ld a, [wNumMapMoves] ld c, a ld b, $0 - ld hl, wd4e3 + ld hl, wVisitedMaps add hl, bc ld a, [wCurrentMap] ld [hl], a ret -.asm_31471 +.chooseMapFromArea2 call GenRandom and $3 ld c, a @@ -1830,24 +1836,24 @@ Func_3140b: ; 0x3140b ld hl, SecondMapMoveSet_BlueField add hl, bc ld c, [hl] - ld hl, wd4e6 - ld a, [wd4e2] + ld hl, wVisitedMaps + 3 + ld a, [wNumMapMoves] sub $3 jr z, .asm_31490 ld b, a .asm_31489 ld a, [hli] cp c - jr z, .asm_31471 + jr z, .chooseMapFromArea2 dec b jr nz, .asm_31489 .asm_31490 ld a, c ld [wCurrentMap], a - ld a, [wd4e2] + ld a, [wNumMapMoves] ld c, a ld b, $0 - ld hl, wd4e3 + ld hl, wVisitedMaps add hl, bc ld a, [wCurrentMap] ld [hl], a @@ -2001,12 +2007,12 @@ Func_315d5: ; 0x315d5 ld de, $0000 call PlaySong rst AdvanceFrame - callba Func_31281 + callba ChooseNextMap_RedField callba LoadMapBillboardTileData lb de, $25, $25 call PlaySoundEffect ld bc, ArrivedAtMapText - callba Func_3118f + callba LoadScrollingMapNameText .asm_31603 callba Func_33e3 rst AdvanceFrame @@ -2155,12 +2161,12 @@ Func_3174c: ; 0x3174c ld de, $0000 call PlaySong rst AdvanceFrame - callba Func_3140b + callba ChooseNextMap_BlueField callba LoadMapBillboardTileData lb de, $25, $25 call PlaySoundEffect ld bc, ArrivedAtMapText - callba Func_3118f + callba LoadScrollingMapNameText .asm_3177a callba Func_33e3 rst AdvanceFrame @@ -288,19 +288,27 @@ wWhichVoltorbId:: ; 0xd4cc wWhichShellderId:: ds $1 -wd4cd:: ; 0xd4cd - ds $3 +wVoltorb1Animation:: ; 0xd4cd +wShellder1Animation_Unused:: + animation wVoltorb1Animation -wd4d0:: ; 0xd4d0 - ds $3 +wVoltorb2Animation:: ; 0xd4d0 +wShellder2Animation_Unused:: + animation wVoltorb2Animation -wd4d3:: ; 0xd4d3 - ds $3 +wVoltorb3Animation:: ; 0xd4d3 +wShellder3Animation_Unused:: + animation wVoltorb3Animation -wd4d6:: ; 0xd4d6 +wVoltorbHitAnimationDuration:: ; 0xd4d6 +wShellderHitAnimationDuration:: +; Number of frames remaining in the light-up animation when a Shellder/Voltorb is hit. +; This single byte actually controls all three of them, since only one can be animated at a time. ds $1 -wd4d7:: ; 0xd4d7 +wWhichAnimatedVoltorb:: ; 0xd4d7 +wWhichAnimatedShellder:: +; Hold the index (0,1,2) of the Shellder/Voltorb that is currently being animated after it was hit. ds $1 wWhichBumper:: ; 0xd4d8 @@ -317,44 +325,37 @@ wd4da:: ; 0xd4da wd4db:: ; 0xd4db ds $1 -wPinballLaunchAlley:: ; 0xd4dc +wPinballLaunchCollision:: ; 0xd4dc ; 0 = pinball isn't resting at the start, waiting to be launched by the player ; 1 = pinball can be launched to start the round ; second byte is unused, but it's written by HandleGameObjectCollision ds $2 -wd4de:: ; 0xd4de +wPinballLaunched:: ; 0xd4de +; 0 = pinball hasn't been launched, yet +; 1 = pinball was launched ds $1 wd4df:: ; 0xd4df ds $1 -wd4e0:: ; 0xd4e0 +wChoseInitialMap:: ; 0xd4e0 +; Set to 1 after the player chooses the initial map during first pinball launch. ds $1 wInitialMapSelectionIndex:: ; 0xd4e1 ds $1 -wd4e2:: ; 0xd4e2 - ds $1 - -wd4e3:: ; 0xd4e3 - ds $1 - -wd4e4:: ; 0xd4e4 +wNumMapMoves:: ; 0xd4e2 +; Number of times the player has successfully completed a map move. +; Resets to 0 after completing 6. ds $1 -wd4e5:: ; 0xd4e5 - ds $1 - -wd4e6:: ; 0xd4e6 - ds $1 - -wd4e7:: ; 0xd4e7 - ds $1 - -wd4e8:: ; 0xd4e8 - ds $2 +wVisitedMaps:: ; 0xd4e3 +; List of the visited maps in order. +; It is reset after moving past Indigo Plateau. +; The last byte is unused, since there are only 6 map moves. + ds $7 wTriggeredGameObject:: ; 0xd4ea ; Game objects, such as the two bumpers, Pikachu savers, CAVE, etc. have unique ids. @@ -367,8 +368,8 @@ wTriggeredGameObjectIndex:: ; 0xd4eb ds $1 wPreviousTriggeredGameObject:: ; 0xd4ec -; Store the previous triggered game object's id, so that the pinball cant trigger -; and object two frames in a row. It has to "un-collide" before it can collide again. +; Store the previous triggered game object's id, so that the pinball can't trigger +; an object two frames in a row. It has to "un-collide" before it can collide again. ds $1 wWhichDiglett:: ; 0xd4ed @@ -504,29 +505,11 @@ wWhichBoardTrigger:: ; 0xd51f wWhichBoardTriggerId:: ; 0xd520 ds $1 -wd521:: ; 0xd521 - ds $1 - -wd522:: ; 0xd522 - ds $1 - -wd523:: ; 0xd523 - ds $1 - -wd524:: ; 0xd524 - ds $1 - -wd525:: ; 0xd525 - ds $1 - -wd526:: ; 0xd526 - ds $1 - -wd527:: ; 0xd527 - ds $1 +wCollidedAlleyTriggers:: ; 0xd521 +; These bytes are pretty unnecessary, but the original code decided it would use a roundabout way to decide which function to call based on wWhichBoardTriggerId was collided with. + ds $8 -wd528:: ; 0xd528 - ds $7 + ds $6 ; free space wIndicatorStates:: ; 0xd52f ds $13 @@ -549,7 +532,9 @@ wSecondaryLeftAlleyTrigger:: ; 0xd546 wd548:: ; 0xd548 ds $1 -wd549:: ; 0xd549 +wDisableBallGravityAndTilt:: ; 0xd549 +; Set to 1 to disable any affect gravity or tilt has on the pinball. +; Used for things likes the initial pinball launch or to hold the ball stationary. ds $1 wCurrentMap:: ; 0xd54a @@ -1013,10 +998,13 @@ wd64a:: ; 0xd64a wd64b:: ; 0xd64b ds $1 -wd64c:: ; 0xd64c +wBlueFieldForceFieldFrameCounter:: ; 0xd64c +; Continuosly counts up to 60--wraps around to 0. ds $1 -wd64d:: ; 0xd64d +wBlueFieldForceFieldSecondsCounter:: ; 0xd64d +; Increments once every second, based on wBlueFieldForceFieldFrameCounter. +; When it hits 5 seconds, it wraps back to 0. ds $1 wd64e:: ; 0xd64e |