Skip to content

Commit

Permalink
Bit 7 of wJumptableIndex is often JUMPTABLE_EXIT_F
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Dec 2, 2024
1 parent 644bd42 commit e1e7cbd
Show file tree
Hide file tree
Showing 24 changed files with 114 additions and 110 deletions.
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
DEF GAME_TIMER_MOBILE_F EQU 7
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 @@ -247,7 +246,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 @@ -720,7 +720,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 @@ -125,7 +125,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 @@ -213,7 +213,7 @@ Cut_WaitAnimSFX:

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

Cut_SpawnLeaf:
Expand Down Expand Up @@ -322,7 +322,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 @@ -359,7 +359,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 @@ -428,7 +428,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 @@ -43,7 +43,7 @@ MagnetTrain:
ld a, [wJumptableIndex]
and a
jr z, .initialize
bit 7, a
bit JUMPTABLE_EXIT_F, a
jr nz, .done
callfar PlaySpriteAnimations
call MagnetTrain_Jumptable
Expand Down Expand Up @@ -379,7 +379,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

0 comments on commit e1e7cbd

Please sign in to comment.