Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit 7 of wJumptableIndex is often JUMPTABLE_EXIT_F #123

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions constants/ram_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ DEF AUTO_INPUT EQU $ff
const TEMPMON ; 3
const WILDMON ; 4

; wJumptableIndex::
DEF JUMPTABLE_INDEX_MASK EQU %01111111
const_def 7
shift_const JUMPTABLE_EXIT

; wGameTimerPaused::
DEF GAME_TIMER_COUNTING_F EQU 0

Expand Down
5 changes: 2 additions & 3 deletions engine/battle/battle_transition.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ DEF BATTLETRANSITION_CAVE_STRONGER EQU $09
DEF BATTLETRANSITION_NO_CAVE EQU $10
DEF BATTLETRANSITION_NO_CAVE_STRONGER EQU $18
DEF BATTLETRANSITION_FINISH EQU $20
DEF BATTLETRANSITION_END EQU $80

DEF BATTLETRANSITION_SQUARE EQU "8" ; $fe
DEF BATTLETRANSITION_BLACK EQU "9" ; $ff
Expand All @@ -26,7 +25,7 @@ DoBattleTransition:

.loop
ld a, [wJumptableIndex]
bit 7, a ; BATTLETRANSITION_END?
bit JUMPTABLE_EXIT_F, a
jr nz, .done
call BattleTransitionJumptable
call DelayFrame
Expand Down Expand Up @@ -197,7 +196,7 @@ StartTrainerBattle_DetermineWhichAnimation:

StartTrainerBattle_Finish:
call ClearSprites
ld a, BATTLETRANSITION_END
ld a, JUMPTABLE_EXIT
ld [wJumptableIndex], a
ret

Expand Down
4 changes: 2 additions & 2 deletions engine/debug/color_picker.asm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DebugColorPicker: ; unreferenced
ld [wDebugColorIsShiny], a
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .exit
call DebugColorMain
call DebugColor_PlaceCursor
Expand Down Expand Up @@ -704,7 +704,7 @@ DebugColor_TMHMJoypad:

.exit ; unreferenced
ld hl, wJumptableIndex
set 7, [hl]
set JUMPTABLE_EXIT_F, [hl]
ret

.scroll:
Expand Down
10 changes: 5 additions & 5 deletions engine/events/field_moves.asm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ OWCutAnimation:
call PlaySFX
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .finish
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
ld [wCurSpriteOAMAddr], a
Expand Down Expand Up @@ -208,7 +208,7 @@ Cut_WaitAnimSFX:

.finished
ld hl, wJumptableIndex
set 7, [hl]
set JUMPTABLE_EXIT_F, [hl]
ret

Cut_SpawnLeaf:
Expand Down Expand Up @@ -317,7 +317,7 @@ FlyFromAnim:
ld [wFrameCounter], a
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .exit
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
ld [wCurSpriteOAMAddr], a
Expand Down Expand Up @@ -354,7 +354,7 @@ FlyToAnim:
ld [wFrameCounter], a
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .exit
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
ld [wCurSpriteOAMAddr], a
Expand Down Expand Up @@ -423,7 +423,7 @@ FlyFunction_FrameTimer:

.exit
ld hl, wJumptableIndex
set 7, [hl]
set JUMPTABLE_EXIT_F, [hl]
ret

.SpawnLeaf:
Expand Down
4 changes: 2 additions & 2 deletions engine/events/magnet_train.asm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MagnetTrain:
ld [hl], VBLANK_CUTSCENE
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .done
callfar PlaySpriteAnimations
call MagnetTrain_Jumptable
Expand Down Expand Up @@ -366,7 +366,7 @@ MagnetTrain_Jumptable:
ret

.TrainArrived:
ld a, $80
ld a, JUMPTABLE_EXIT
ld [wJumptableIndex], a
ld de, SFX_TRAIN_ARRIVED
call PlaySFX
Expand Down
4 changes: 2 additions & 2 deletions engine/events/mom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BankOfMom:
ld [wJumptableIndex], a
.loop
ld a, [wJumptableIndex]
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .done
call .RunJumptable
jr .loop
Expand Down Expand Up @@ -278,7 +278,7 @@ BankOfMom:

.AskDST:
ld hl, wJumptableIndex
set 7, [hl]
set JUMPTABLE_EXIT_F, [hl]
ret

DSTChecks:
Expand Down
Loading