summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/hall_of_fame.asm3
-rwxr-xr-xengine/hidden_object_functions17.asm12
-rwxr-xr-xengine/hidden_object_functions18.asm3
-rwxr-xr-xengine/hidden_object_functions7.asm24
-rwxr-xr-xengine/items/items.asm18
-rw-r--r--engine/menu/bills_pc.asm9
-rwxr-xr-xengine/menu/pc.asm3
-rwxr-xr-xengine/menu/start_menu.asm9
-rwxr-xr-xengine/overworld/cable_club_npc.asm3
-rwxr-xr-xengine/overworld/cinnabar_lab.asm4
-rwxr-xr-xengine/pokedex_rating.asm5
11 files changed, 34 insertions, 59 deletions
diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm
index 0d933571..7361fea2 100755
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -207,8 +207,7 @@ HoFLoadMonPlayerPicTileIDs: ; 7036d (1c:436d)
predef_jump CopyTileIDsFromList
HoFDisplayPlayerStats: ; 70377 (1c:4377)
- ld hl, wd747
- set 3, [hl]
+ SetEvent EVENT_003
predef DisplayDexRating
coord hl, 0, 4
ld b, $6
diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm
index 94b37193..01787e3e 100755
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -314,8 +314,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
ld [wcd5b], a
; Don't do the trash can puzzle if it's already been done.
- ld a, [wd773]
- bit 0, a
+ CheckEvent EVENT_2ND_LOCK_OPENED
jr z, .ok
tx_pre_jump VermilionGymTrashText
@@ -335,8 +334,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
.openFirstLock
; Next can is trying for the second switch.
- ld hl, wd773
- set 1, [hl]
+ SetEvent EVENT_1ST_LOCK_OPENED
ld hl, GymTrashCans
ld a, [wcd5b]
@@ -379,8 +377,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
jr z, .openSecondLock
; Reset the cans.
- ld hl, wd773
- res 1, [hl]
+ ResetEvent EVENT_1ST_LOCK_OPENED
call Random
and $e
@@ -391,8 +388,7 @@ GymTrashScript: ; 5ddfc (17:5dfc)
.openSecondLock
; Completed the trash can puzzle.
- ld hl, wd773
- set 0, [hl]
+ SetEvent EVENT_2ND_LOCK_OPENED
ld hl, wd126
set 6, [hl]
diff --git a/engine/hidden_object_functions18.asm b/engine/hidden_object_functions18.asm
index e293b0a0..cf18799d 100755
--- a/engine/hidden_object_functions18.asm
+++ b/engine/hidden_object_functions18.asm
@@ -152,8 +152,7 @@ CinnabarIslandPokecenterBenchGuyText: ; 624df (18:64df)
SaffronCityPokecenterBenchGuyText: ; 624e4 (18:64e4)
TX_ASM
- ld a, [wd838]
- bit 7, a
+ CheckEvent EVENT_78F
ld hl, SaffronCityPokecenterBenchGuyText2
jr nz, .asm_624f2
ld hl, SaffronCityPokecenterBenchGuyText1
diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm
index 8893e496..d4a0ce88 100755
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -36,8 +36,7 @@ StrengthsAndWeaknessesText: ; 1e983 (7:6983)
db "@"
SafariZoneCheck: ; 1e988 (7:6988)
- ld hl, wd790
- bit 7, [hl]; if we are not in the Safari Zone,
+ CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone,
jr z, SafariZoneGameStillGoing ; don't bother printing game over text
ld a, [W_NUMSAFARIBALLS]
and a
@@ -85,8 +84,7 @@ SafariZoneGameOver: ; 1e9b0 (7:69b0)
ld [wDestinationWarpID], a
ld a, $5
ld [W_SAFARIZONEENTRANCECURSCRIPT], a
- ld hl, wd790
- set 6, [hl]
+ SetEvent EVENT_SAFARI_GAME_OVER
ld a, $1
ld [wSafariZoneGameOver], a
ret
@@ -191,7 +189,7 @@ CinnabarQuizQuestionsText6: ; 1ea85 (7:6a85)
db "@"
CinnabarGymQuiz_1ea8a: ; 1ea8a (7:6a8a)
- ld hl, wd79c
+ EventFlagAddress hl, EVENT_2A8
predef_jump FlagActionPredef
CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)
@@ -208,6 +206,7 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)
ld hl, CinnabarGymQuizCorrectText
call PrintText
ld a, [$ffe0]
+ AdjustEventBit EVENT_2A8, 0
ld c, a
ld b, FLAG_SET
call CinnabarGymQuiz_1ea8a
@@ -221,9 +220,10 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)
call PrintText
ld a, [$ffdb]
add $2
+ AdjustEventBit EVENT_29A, 2
ld c, a
ld b, FLAG_TEST
- ld hl, wd79a
+ EventFlagAddress hl, EVENT_29A
predef FlagActionPredef
ld a, c
and a
@@ -240,6 +240,7 @@ CinnabarGymQuizCorrectText: ; 1eae3 (7:6ae3)
TX_ASM
ld a, [$ffe0]
+ AdjustEventBit EVENT_2A8, 0
ld c, a
ld b, FLAG_TEST
call CinnabarGymQuiz_1ea8a
@@ -277,6 +278,7 @@ CinnabarGymQuiz_1eb0a: ; 1eb0a (7:6b0a)
push bc
ld a, [$ffdb]
ld [$ffe0], a
+ AdjustEventBit EVENT_2A8, 0
ld c, a
ld b, FLAG_TEST
call CinnabarGymQuiz_1ea8a
@@ -320,12 +322,11 @@ BillsHousePC: ; 1eb6e (7:6b6e)
ld a, [wSpriteStateData1 + 9]
cp SPRITE_FACING_UP
ret nz
- ld a, [wd7f2]
- bit 7, a
+ CheckEvent EVENT_55F
jr nz, .asm_1ebd2
- bit 3, a
+ CheckEventReuseA EVENT_55B
jr nz, .asm_1eb86
- bit 6, a
+ CheckEventReuseA EVENT_55E
jr nz, .asm_1eb8b
.asm_1eb86
tx_pre_jump BillsHouseMonitorText
@@ -354,8 +355,7 @@ BillsHousePC: ; 1eb6e (7:6b6e)
call PlaySound
call WaitForSoundToFinish
call PlayDefaultMusic
- ld hl, wd7f2
- set 3, [hl]
+ SetEvent EVENT_55B
ret
.asm_1ebd2
ld a, $1
diff --git a/engine/items/items.asm b/engine/items/items.asm
index f2c41ef6..a7c731c2 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -432,8 +432,7 @@ ItemUseBall: ; d687 (3:5687)
call ClearSprites
call SendNewMonToBox
ld hl,ItemUseBallText07
- ld a,[wd7f1]
- bit 0,a ;already met Bill?
+ CheckEvent EVENT_550
jr nz,.sendToBox2
ld hl,ItemUseBallText08
.sendToBox2
@@ -1375,8 +1374,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf)
set 6,[hl]
ld hl,wd72e
res 4,[hl]
- ld hl,wd790
- res 7,[hl] ; unset Safari Zone bit
+ ResetEvent EVENT_IN_SAFARI_ZONE
xor a
ld [W_NUMSAFARIBALLS],a
ld [W_SAFARIZONEENTRANCECURSCRIPT],a
@@ -1584,8 +1582,7 @@ ItemUsePokeflute: ; e140 (3:6140)
ld a,[W_CURMAP]
cp a,ROUTE_12
jr nz,.notRoute12
- ld a,[wd7d8]
- bit 7,a ; has the player beaten Route 12 Snorlax yet?
+ CheckEvent EVENT_BEAT_ROUTE12_SNORLAX
jr nz,.noSnorlaxToWakeUp
; if the player hasn't beaten Route 12 Snorlax
ld hl,Route12SnorlaxFluteCoords
@@ -1593,14 +1590,12 @@ ItemUsePokeflute: ; e140 (3:6140)
jr nc,.noSnorlaxToWakeUp
ld hl,PlayedFluteHadEffectText
call PrintText
- ld hl,wd7d8
- set 6,[hl] ; trigger Snorlax fight (handled by map script)
+ SetEvent EVENT_FIGHT_ROUTE12_SNORLAX
ret
.notRoute12
cp a,ROUTE_16
jr nz,.noSnorlaxToWakeUp
- ld a,[wd7e0]
- bit 1,a ; has the player beaten Route 16 Snorlax yet?
+ CheckEvent EVENT_BEAT_ROUTE16_SNORLAX
jr nz,.noSnorlaxToWakeUp
; if the player hasn't beaten Route 16 Snorlax
ld hl,Route16SnorlaxFluteCoords
@@ -1608,8 +1603,7 @@ ItemUsePokeflute: ; e140 (3:6140)
jr nc,.noSnorlaxToWakeUp
ld hl,PlayedFluteHadEffectText
call PrintText
- ld hl,wd7e0
- set 0,[hl] ; trigger Snorlax fight (handled by map script)
+ SetEvent EVENT_FIGHT_ROUTE16_SNORLAX
ret
.noSnorlaxToWakeUp
ld hl,PlayedFluteNoEffectText
diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm
index d491cd38..f9df345f 100644
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -5,8 +5,7 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8)
ld a, [wNumHoFTeams]
and a
jr nz, .leaguePCAvailable
- ld a, [wd74b]
- bit 5, a ; received pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
jr z, .noOaksPC
ld a, [wNumHoFTeams]
and a
@@ -29,8 +28,7 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8)
call UpdateSprites
ld a, 3
ld [wMaxMenuItem], a
- ld a, [wd7f1]
- bit 0, a
+ CheckEvent EVENT_550
jr nz, .metBill
coord hl, 2, 2
ld de, SomeonesPCText
@@ -47,8 +45,7 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8)
ld h, b
ld de, PlayersPCText
call PlaceString
- ld a, [wd74b]
- bit 5, a ; received pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
jr z, .noOaksPC2
coord hl, 2, 6
ld de, OaksPCText
diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm
index b5281964..43bd8452 100755
--- a/engine/menu/pc.asm
+++ b/engine/menu/pc.asm
@@ -74,8 +74,7 @@ BillsPC: ; 17ee4 (5:7ee4)
ld a, SFX_ENTER_PC
call PlaySound
call WaitForSoundToFinish
- ld a, [wd7f1] ;has to do with having met Bill
- bit 0, a
+ CheckEvent EVENT_550
jr nz, .billsPC ;if you've met bill, use that bill's instead of someone's
ld hl, AccessedSomeonesPCText
jr .printText
diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm
index bd876f5b..3c48e6ed 100755
--- a/engine/menu/start_menu.asm
+++ b/engine/menu/start_menu.asm
@@ -24,8 +24,7 @@ RedisplayStartMenu:: ; 2adf (0:2adf)
and a
jr nz,.loop
; if the player pressed tried to go past the top item, wrap around to the bottom
- ld a,[wd74b]
- bit 5,a ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a,6 ; there are 7 menu items with the pokedex, so the max index is 6
jr nz,.wrapMenuItemId
dec a ; there are only 6 menu items without the pokedex
@@ -37,8 +36,7 @@ RedisplayStartMenu:: ; 2adf (0:2adf)
bit 7,a
jr z,.buttonPressed
; if the player pressed tried to go past the bottom item, wrap around to the top
- ld a,[wd74b]
- bit 5,a ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a,[wCurrentMenuItem]
ld c,7 ; there are 7 menu items with the pokedex
jr nz,.checkIfPastBottom
@@ -59,8 +57,7 @@ RedisplayStartMenu:: ; 2adf (0:2adf)
and a,%00001010 ; was the Start button or B button pressed?
jp nz,CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
- ld a,[wd74b]
- bit 5,a ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a,[wCurrentMenuItem]
jr nz,.displayMenuItem
inc a ; adjust position to account for missing pokedex menu item
diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm
index 2a9b19fe..65837150 100755
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -1,8 +1,7 @@
CableClubNPC: ; 71c5 (1:71c5)
ld hl, CableClubNPCWelcomeText
call PrintText
- ld a, [wd74b]
- bit 5, a ; received pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
jp nz, .receivedPokedex
; if the player hasn't received the pokedex
ld c, 60
diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm
index 18ce23ed..5cc5536c 100755
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -65,9 +65,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
callba RemoveItemByID
ld hl, LabFossil_610b8
call PrintText
- ld hl, wd7a3
- set 0, [hl]
- set 1, [hl]
+ SetEvents EVENT_2E0, EVENT_2E1
ret
.asm_610a7
ld hl, LabFossil_610bd
diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm
index 881c9716..2d7073df 100755
--- a/engine/pokedex_rating.asm
+++ b/engine/pokedex_rating.asm
@@ -23,10 +23,7 @@ DisplayDexRating: ; 44169 (11:4169)
ld a, [hli]
ld h, [hl]
ld l, a ; load text pointer into hl
- ld a, [wd747]
- bit 3, a
- res 3, a
- ld [wd747], a
+ CheckAndResetEventA EVENT_003
jr nz, .label3
push hl
ld hl, PokedexRatingText_441cc