diff options
Diffstat (limited to 'engine')
| -rwxr-xr-x | engine/hall_of_fame.asm | 3 | ||||
| -rwxr-xr-x | engine/hidden_object_functions17.asm | 12 | ||||
| -rwxr-xr-x | engine/hidden_object_functions18.asm | 3 | ||||
| -rwxr-xr-x | engine/hidden_object_functions7.asm | 54 | ||||
| -rwxr-xr-x | engine/items/items.asm | 18 | ||||
| -rw-r--r-- | engine/menu/bills_pc.asm | 9 | ||||
| -rwxr-xr-x | engine/menu/pc.asm | 3 | ||||
| -rwxr-xr-x | engine/menu/start_menu.asm | 9 | ||||
| -rwxr-xr-x | engine/overworld/cable_club_npc.asm | 3 | ||||
| -rwxr-xr-x | engine/overworld/cinnabar_lab.asm | 4 | ||||
| -rwxr-xr-x | engine/pokedex_rating.asm | 5 | 
11 files changed, 50 insertions, 73 deletions
| diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 0d933571..1fc2c5c5 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_HALL_OF_FAME_DEX_RATING  	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..00744c5d 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_BEAT_SILPH_CO_GIOVANNI  	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 34d7f64d..6f1eef61 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 @@ -190,8 +188,8 @@ CinnabarQuizQuestionsText6: ; 1ea85 (7:6a85)  	TX_FAR _CinnabarQuizQuestionsText6  	db "@" -CinnabarGymQuiz_1ea8a: ; 1ea8a (7:6a8a) -	ld hl, wd79c +CinnabarGymGateFlagAction: ; 1ea8a (7:6a8a) +	EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED  	predef_jump FlagActionPredef  CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92) @@ -208,10 +206,11 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)  	ld hl, CinnabarGymQuizCorrectText  	call PrintText  	ld a, [$ffe0] +	AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0  	ld c, a  	ld b, FLAG_SET -	call CinnabarGymQuiz_1ea8a -	jp CinnabarGymQuiz_1eb0a +	call CinnabarGymGateFlagAction +	jp UpdateCinnabarGymGateTileBlocks_  .asm_1eab8  	call WaitForSoundToFinish  	ld a, SFX_DENIED @@ -221,9 +220,10 @@ CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)  	call PrintText  	ld a, [$ffdb]  	add $2 +	AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2  	ld c, a  	ld b, FLAG_TEST -	ld hl, wd79a +	EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0  	predef FlagActionPredef  	ld a, c  	and a @@ -240,9 +240,10 @@ CinnabarGymQuizCorrectText: ; 1eae3 (7:6ae3)  	TX_ASM  	ld a, [$ffe0] +	AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0  	ld c, a  	ld b, FLAG_TEST -	call CinnabarGymQuiz_1ea8a +	call CinnabarGymGateFlagAction  	ld a, c  	and a  	jp nz, TextScriptEnd @@ -256,15 +257,17 @@ CinnabarGymQuizIncorrectText: ; 1eb05 (7:6b05)  	TX_FAR _CinnabarGymQuizIncorrectText  	db "@" -CinnabarGymQuiz_1eb0a: ; 1eb0a (7:6b0a) -	ld a, $6 +UpdateCinnabarGymGateTileBlocks_: ; 1eb0a (7:6b0a) +; Update the overworld map with open floor blocks or locked gate blocks +; depending on event flags. +	ld a, 6  	ld [$ffdb], a -.asm_1eb0e +.loop  	ld a, [$ffdb]  	dec a  	add a  	add a -	ld d, $0 +	ld d, 0  	ld e, a  	ld hl, CinnabarGymGateCoords  	add hl, de @@ -277,23 +280,24 @@ CinnabarGymQuiz_1eb0a: ; 1eb0a (7:6b0a)  	push bc  	ld a, [$ffdb]  	ld [$ffe0], a +	AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0  	ld c, a  	ld b, FLAG_TEST -	call CinnabarGymQuiz_1ea8a +	call CinnabarGymGateFlagAction  	ld a, c  	and a -	jr nz, .asm_1eb36 +	jr nz, .unlocked  	ld a, [wd12f] -	jr .asm_1eb38 -.asm_1eb36 +	jr .next +.unlocked  	ld a, $e -.asm_1eb38 +.next  	pop bc  	ld [wd09f], a  	predef ReplaceTileBlock  	ld hl, $ffdb  	dec [hl] -	jr nz, .asm_1eb0e +	jr nz, .loop  	ret  CinnabarGymGateCoords: ; 1eb48 (7:6b48) @@ -320,12 +324,11 @@ BillsHousePC: ; 1eb6e (7:6b6e)  	ld a, [wSpriteStateData1 + 9]  	cp SPRITE_FACING_UP  	ret nz -	ld a, [wd7f2] -	bit 7, a +	CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING  	jr nz, .asm_1ebd2 -	bit 3, a +	CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL  	jr nz, .asm_1eb86 -	bit 6, a +	CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR  	jr nz, .asm_1eb8b  .asm_1eb86  	tx_pre_jump BillsHouseMonitorText @@ -354,8 +357,7 @@ BillsHousePC: ; 1eb6e (7:6b6e)  	call PlaySound  	call WaitForSoundToFinish  	call PlayDefaultMusic -	ld hl, wd7f2 -	set 3, [hl] +	SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL  	ret  .asm_1ebd2  	ld a, $1 diff --git a/engine/items/items.asm b/engine/items/items.asm index a62f75d2..a60d765a 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_MET_BILL  	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..a810afd2 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_MET_BILL  	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..a804abb2 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_MET_BILL  	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..1b96b4c6 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_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL  	ret  .asm_610a7  	ld hl, LabFossil_610bd diff --git a/engine/pokedex_rating.asm b/engine/pokedex_rating.asm index 881c9716..ca88673f 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_HALL_OF_FAME_DEX_RATING  	jr nz, .label3  	push hl  	ld hl, PokedexRatingText_441cc | 
