Skip to content

Commit 7717837

Browse files
Rangi42PokefanMarcel
authored andcommitted
Identify wCurrentMapScriptFlags bits (pret#467)
1 parent 1cfb0a2 commit 7717837

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+124
-115
lines changed

constants/ram_constants.asm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ DEF BIT_TEXT_PREDEF EQU 0
2323
; wFontLoaded
2424
DEF BIT_FONT_LOADED EQU 0
2525

26+
; wCurrentMapScriptFlags
27+
const_def 5
28+
const BIT_CUR_MAP_LOADED_1 ; 5
29+
const BIT_CUR_MAP_LOADED_2 ; 6
30+
const BIT_CUR_MAP_USED_ELEVATOR ; 7
31+
2632
; wOptions
2733
DEF TEXT_DELAY_MASK EQU %111
2834
const_def 6

engine/events/card_key.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ PrintCardKeyText:
5858
ld [wNewTileBlockID], a
5959
predef ReplaceTileBlock
6060
ld hl, wCurrentMapScriptFlags
61-
set 5, [hl]
61+
set BIT_CUR_MAP_LOADED_1, [hl]
6262
ld a, SFX_GO_INSIDE
6363
jp PlaySound
6464
.noCardKey

engine/events/elevator.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DisplayElevatorFloorMenu:
2020
ld [wListScrollOffset], a
2121
ret c
2222
ld hl, wCurrentMapScriptFlags
23-
set 7, [hl]
23+
set BIT_CUR_MAP_USED_ELEVATOR, [hl]
2424
ld hl, wElevatorWarpMaps
2525
ld a, [wWhichPokemon]
2626
add a

engine/events/hidden_objects/cinnabar_gym_quiz.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CinnabarGymQuiz_AskQuestion:
8888
cp c
8989
jr nz, .wrongAnswer
9090
ld hl, wCurrentMapScriptFlags
91-
set 5, [hl]
91+
set BIT_CUR_MAP_LOADED_1, [hl]
9292
ldh a, [hGymGateIndex]
9393
ldh [hBackupGymGateIndex], a
9494
ld hl, CinnabarGymQuizCorrectText

engine/events/hidden_objects/vermilion_gym_trash.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ GymTrashScript:
9797
; Completed the trash can puzzle.
9898
SetEvent EVENT_2ND_LOCK_OPENED
9999
ld hl, wCurrentMapScriptFlags
100-
set 6, [hl]
100+
set BIT_CUR_MAP_LOADED_2, [hl]
101101

102102
tx_pre_id VermilionGymTrashSuccessText3
103103

engine/menus/main_menu.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ MainMenu:
9191
.choseContinue
9292
call DisplayContinueGameInfo
9393
ld hl, wCurrentMapScriptFlags
94-
set 5, [hl]
94+
set BIT_CUR_MAP_LOADED_1, [hl]
9595
.inputLoop
9696
xor a
9797
ldh [hJoyPressed], a

home/overworld.asm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ EnterMap::
3333
res BIT_NO_NPC_FACE_PLAYER, [hl]
3434
call UpdateSprites
3535
ld hl, wCurrentMapScriptFlags
36-
set 5, [hl]
37-
set 6, [hl]
36+
set BIT_CUR_MAP_LOADED_1, [hl]
37+
set BIT_CUR_MAP_LOADED_2, [hl]
3838
xor a
3939
ld [wJoyIgnore], a
4040

@@ -340,8 +340,8 @@ OverworldLoopLessDelay::
340340
ld hl, wStatusFlags7
341341
res BIT_TRAINER_BATTLE, [hl]
342342
ld hl, wCurrentMapScriptFlags
343-
set 5, [hl]
344-
set 6, [hl]
343+
set BIT_CUR_MAP_LOADED_1, [hl]
344+
set BIT_CUR_MAP_LOADED_2, [hl]
345345
xor a
346346
ldh [hJoyHeld], a
347347
ld a, [wCurMap]

home/trainers.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ StartTrainerBattle::
184184

185185
EndTrainerBattle::
186186
ld hl, wCurrentMapScriptFlags
187-
set 5, [hl]
188-
set 6, [hl]
187+
set BIT_CUR_MAP_LOADED_1, [hl]
188+
set BIT_CUR_MAP_LOADED_2, [hl]
189189
ld hl, wStatusFlags3
190190
res BIT_PRINT_END_BATTLE_TEXT, [hl]
191191
ld hl, wMiscFlags

ram/wram.asm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,10 @@ wIsKeyItem:: db
15991599

16001600
wTextBoxID:: db
16011601

1602-
wCurrentMapScriptFlags:: db ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value
1602+
; bit 5: set when maps first load; can be reset to re-run a script
1603+
; bit 6: set when maps first load; can be reset to re-run a script (used less often than bit 5)
1604+
; bit 7: set when using an elevator map's menu; triggers the shaking animation
1605+
wCurrentMapScriptFlags:: db
16031606

16041607
wCurEnemyLevel:: db
16051608

scripts/AgathasRoom.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ AgathasRoom_Script:
1111
AgathaShowOrHideExitBlock:
1212
; Blocks or clears the exit to the next room.
1313
ld hl, wCurrentMapScriptFlags
14-
bit 5, [hl]
15-
res 5, [hl]
14+
bit BIT_CUR_MAP_LOADED_1, [hl]
15+
res BIT_CUR_MAP_LOADED_1, [hl]
1616
ret z
1717
;CheckEvent EVENT_BEAT_AGATHAS_ROOM_TRAINER_0 ; marcelnote - Agatha rematch
1818
CheckEitherEventSet EVENT_BEAT_AGATHAS_ROOM_TRAINER_0, EVENT_BEAT_AGATHAS_ROOM_TRAINER_1

0 commit comments

Comments
 (0)