diff --git a/constants/event_flags.asm b/constants/event_flags.asm index 1f8ce1fa8..8998fc36e 100644 --- a/constants/event_flags.asm +++ b/constants/event_flags.asm @@ -1715,7 +1715,9 @@ const EVENT_SILVER_CAVE_UPPER_MOUNTAINSIDE_HYPER_POTION const EVENT_SILVER_CAVE_UPPER_MOUNTAINSIDE_RARE_CANDY const EVENT_ROUTE_5_GOT_CLEANSE_TAG -; Unused: next 43 events + const EVENT_VERMILION_GYM_SWITCH_1 + const EVENT_VERMILION_GYM_SWITCH_2 +; Unused: next 41 events - const_next 2043 + const_next 2041 DEF NUM_EVENTS EQU const_value ; 800 diff --git a/data/tilesets/game_corner_collision.asm b/data/tilesets/game_corner_collision.asm index b86357493..c04c68140 100644 --- a/data/tilesets/game_corner_collision.asm +++ b/data/tilesets/game_corner_collision.asm @@ -24,7 +24,7 @@ tilecoll COUNTER, FLOOR, COUNTER, COUNTER ; 17 tilecoll FLOOR, FLOOR, COUNTER, COUNTER ; 18 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 19 - tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 1a + tilecoll WALL, WALL, FLOOR, FLOOR ; 1a tilecoll FLOOR, COUNTER, COUNTER, COUNTER ; 1b tilecoll WALL, WALL, FLOOR, COUNTER ; 1c tilecoll FLOOR, WALL, FLOOR, WALL ; 1d @@ -48,7 +48,7 @@ tilecoll WALL, WALL, FLOOR, WALL ; 2f tilecoll WALL, WALL, WALL, FLOOR ; 30 tilecoll COUNTER, FLOOR, COUNTER, COUNTER ; 31 - tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 32 + tilecoll WALL, WALL, WALL, WALL ; 32 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 33 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 34 tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 35 diff --git a/data/tilesets/game_corner_metatiles.bin b/data/tilesets/game_corner_metatiles.bin index bb6f3f650..6d7310266 100644 Binary files a/data/tilesets/game_corner_metatiles.bin and b/data/tilesets/game_corner_metatiles.bin differ diff --git a/gfx/tilesets/game_corner.png b/gfx/tilesets/game_corner.png index 21557f7c9..e505c5f7f 100644 Binary files a/gfx/tilesets/game_corner.png and b/gfx/tilesets/game_corner.png differ diff --git a/gfx/tilesets/game_corner_palette_map.asm b/gfx/tilesets/game_corner_palette_map.asm index 152154900..969d73f9b 100644 --- a/gfx/tilesets/game_corner_palette_map.asm +++ b/gfx/tilesets/game_corner_palette_map.asm @@ -19,10 +19,8 @@ tilepal 1, YELLOW, RED, YELLOW, RED, GREEN, GREEN, BROWN, ROOF tilepal 1, ROOF, GRAY, GRAY, GRAY, GRAY, RED, ROOF, ROOF tilepal 1, YELLOW, RED, YELLOW, RED, WATER, WATER, RED, RED - tilepal 1, RED, RED, RED, RED, GREEN, GRAY, RED, RED - tilepal 1, RED, RED, YELLOW, YELLOW, WATER, WATER, BROWN, BROWN + tilepal 1, RED, RED, BROWN, BROWN, GREEN, GRAY, RED, RED + tilepal 1, RED, RED, YELLOW, YELLOW, WATER, WATER, GRAY, GRAY tilepal 1, BROWN, BROWN, RED, RED, GREEN, ROOF, RED, RED - tilepal 1, RED, RED, YELLOW, YELLOW, ROOF, ROOF, RED, RED - tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, ROOF, RED, RED - tilepal 1, RED, GRAY, GRAY, GRAY, GRAY, GRAY, RED, RED - tilepal 1, GRAY, GRAY, GRAY, WATER, ROOF, ROOF, WATER, WATER + tilepal 1, RED, RED, YELLOW, YELLOW, ROOF, ROOF, GRAY, GRAY + tilepal 1, BROWN, BROWN \ No newline at end of file diff --git a/maps/VermilionGym.asm b/maps/VermilionGym.asm index 68ae33a86..0cb9d2b7a 100644 --- a/maps/VermilionGym.asm +++ b/maps/VermilionGym.asm @@ -9,6 +9,189 @@ VermilionGym_MapScripts: def_scene_scripts def_callbacks + callback MAPCALLBACK_OBJECTS, .VermilionGymDoorsScript + callback MAPCALLBACK_TILES, .VermilionGymDoorsCallback + +.VermilionGymDoorsScript: + checkevent EVENT_VERMILION_GYM_SWITCH_2 + iftrue .done + checkevent EVENT_VERMILION_GYM_SWITCH_1 + iffalse .resample +.resample + callasm SampleVermilionGymTrashCans +.done + endcallback + +.VermilionGymDoorsCallback: + checkevent EVENT_VERMILION_GYM_SWITCH_2 + iftrue .NoDoors + endcallback + +.NoDoors: + changeblock 4, 4, $01 ; floor + endcallback + +VermilionGymTrashCanScript: + checkevent EVENT_VERMILION_GYM_SWITCH_2 + iftrue .trash_can + callasm CheckVermilionGymTrashCan + iftrue .open_lock + checkevent EVENT_VERMILION_GYM_SWITCH_1 + iftrue .reset_switches +.trash_can + opentext + writetext VermilionGymTrashCanText + waitbutton + closetext + end + +.open_lock + opentext + checkevent EVENT_VERMILION_GYM_SWITCH_1 + iftrue .second_switch + writetext VermilionGymFoundSwitchText + promptbutton + writetext VermilionGymFoundFirstSwitchText + setevent EVENT_VERMILION_GYM_SWITCH_1 + playsound SFX_PUSH_BUTTON + waitsfx + pause 16 + closetext + end + +.second_switch + writetext VermilionGymFoundSecondSwitchText + waitbutton + playsound SFX_ENTER_DOOR + waitsfx + pause 16 + setevent EVENT_VERMILION_GYM_SWITCH_2 + changeblock 4, 4, $01 ; floor + reloadmappart + closetext + end + +.reset_switches + opentext + writetext VermilionGymTrashCanText + promptbutton + writetext VermilionGymResetSwitchesText + playsound SFX_WRONG + waitsfx + pause 16 + closetext + callasm SampleVermilionGymTrashCans + clearevent EVENT_VERMILION_GYM_SWITCH_1 + end + +SampleVermilionGymTrashCans: + ldh a, [rSVBK] + push af + ld a, BANK(wVermilionGymTrashCan1) + ldh [rSVBK], a +.loop + call Random + ld e, a + swap e + and $f + jr z, .loop + dec a + ld [wVermilionGymTrashCan1], a + call .GetSecondTrashCan + ld [wVermilionGymTrashCan2], a + pop af + ldh [rSVBK], a + ret + +.GetSecondTrashCan: + ld hl, .AdjacencyTable + add a + add a + ld c, a + ld a, e + and %11 + add c + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] + ret + +.AdjacencyTable: + ; left, right, up, down + db 1, 1, 5, 5 ; 0 ( 1, 7) + db 0, 2, 6, 6 ; 1 ( 3, 7) + db 1, 3, 7, 7 ; 2 ( 5, 7) + db 2, 4, 8, 8 ; 3 ( 7, 7) + db 3, 3, 9, 9 ; 4 ( 9, 7) + db 6, 6, 0, 10 ; 5 ( 1, 9) + db 5, 7, 1, 11 ; 6 ( 3, 9) + db 6, 8, 2, 12 ; 7 ( 5, 9) + db 7, 9, 3, 13 ; 8 ( 7, 9) + db 8, 8, 4, 14 ; 9 ( 9, 9) + db 11, 11, 5, 5 ; 10 ( 1,11) + db 10, 12, 6, 6 ; 11 ( 3,11) + db 11, 13, 7, 7 ; 12 ( 5,11) + db 12, 14, 8, 8 ; 13 ( 7,11) + db 13, 13, 9, 9 ; 14 ( 9,11) + +CheckVermilionGymTrashCan: + ldh a, [rSVBK] + push af + ld a, BANK(wVermilionGymTrashCan1) + ldh [rSVBK], a + ld de, EVENT_VERMILION_GYM_SWITCH_1 + ld b, CHECK_FLAG + call EventFlagAction + ld a, c + and a + jr z, .first + ld a, [wVermilionGymTrashCan2] + call .CheckTrashCan + ld a, TRUE + jr z, .done + dec a ; FALSE +.done + ld [wScriptVar], a + pop af + ldh [rSVBK], a + ret + +.first: + ld a, [wVermilionGymTrashCan1] + call .CheckTrashCan + jr z, .yes + ld a, [wVermilionGymTrashCan2] + call .CheckTrashCan + ld a, FALSE + jr nz, .done + ld a, [wVermilionGymTrashCan1] + ld [wVermilionGymTrashCan2], a +.yes + ld a, TRUE + jr .done + +.CheckTrashCan: + ld c, a + call GetFacingTileCoord + call .ConvertCoordsToTrashCan + cp c + ret + +.ConvertCoordsToTrashCan: + ld a, d + sub 5 + srl a + ld d, a + ld a, e + sub 11 + srl a + ld e, a + add a + add a + add e + add d + ret VermilionGymSurgeScript: faceplayer @@ -197,11 +380,12 @@ GuitaristVincentBeatenText: done GuitaristVincentAfterBattleText: - text "If the GYM's traps" - line "were working, you" + text "The GYM's traps" + line "are SURGE's test…" - para "would have been" - line "toast…" + para "If you can't solve" + line "them, then your" + cont "toast…" done JugglerHortonSeenText: @@ -236,13 +420,14 @@ VermilionGymGuideText: para "traps set all over" line "the GYM." - para "But--he-heh--the" - line "traps aren't" - cont "active right now." + para "Why lucky, you may" + line "ask? Because you" - para "You'll have no" - line "problem getting to" - cont "LT.SURGE." + para "can train yourself" + line "better that way!" + + para "Make up your mind" + line "and take on SURGE!" done VermilionGymGuideWinText: @@ -254,8 +439,34 @@ VermilionGymGuideWinText: done VermilionGymTrashCanText: - text "Nope! Nothing here" - line "but trash." + text "Nope, there's " + line "only trash here." + done + +VermilionGymFoundSwitchText: + text "Hey!" + + para "There's a switch" + line "under the trash!" + cont "Turn it on!" + done + +VermilionGymFoundFirstSwitchText: + text "The 1st electric" + line "lock opened!" + done + +VermilionGymFoundSecondSwitchText: + text "The 2nd electric" + line "lock opened!" + + para "The motorized door" + line "opened!" + done + +VermilionGymResetSwitchesText: + text "Hey! The electric" + line "locks were reset!" done VermilionGym_MapEvents: @@ -268,27 +479,28 @@ VermilionGym_MapEvents: def_coord_events def_bg_events - bg_event 1, 7, BGEVENT_READ, VermilionGymTrashCan - bg_event 3, 7, BGEVENT_READ, VermilionGymTrashCan - bg_event 5, 7, BGEVENT_READ, VermilionGymTrashCan - bg_event 7, 7, BGEVENT_READ, VermilionGymTrashCan - bg_event 9, 7, BGEVENT_READ, VermilionGymTrashCan - bg_event 1, 9, BGEVENT_READ, VermilionGymTrashCan - bg_event 3, 9, BGEVENT_READ, VermilionGymTrashCan - bg_event 5, 9, BGEVENT_READ, VermilionGymTrashCan - bg_event 7, 9, BGEVENT_READ, VermilionGymTrashCan - bg_event 9, 9, BGEVENT_READ, VermilionGymTrashCan - bg_event 1, 11, BGEVENT_READ, VermilionGymTrashCan - bg_event 3, 11, BGEVENT_READ, VermilionGymTrashCan - bg_event 5, 11, BGEVENT_READ, VermilionGymTrashCan - bg_event 7, 11, BGEVENT_READ, VermilionGymTrashCan - bg_event 9, 11, BGEVENT_READ, VermilionGymTrashCan - bg_event 3, 15, BGEVENT_READ, VermilionGymStatue - bg_event 6, 15, BGEVENT_READ, VermilionGymStatue + bg_event 1, 7, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 3, 7, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 5, 7, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 7, 7, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 9, 7, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 1, 9, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 3, 9, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 5, 9, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 7, 9, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 9, 9, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 1, 11, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 3, 11, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 5, 11, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 7, 11, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 9, 11, BGEVENT_READ, VermilionGymTrashCanScript + bg_event 6, 1, BGEVENT_READ, VermilionGymTrashCan + bg_event 3, 14, BGEVENT_READ, VermilionGymStatue + bg_event 6, 14, BGEVENT_READ, VermilionGymStatue def_object_events - object_event 5, 2, SPRITE_SURGE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, VermilionGymSurgeScript, -1 - object_event 8, 8, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 4, TrainerGentlemanGregory, -1 + object_event 5, 1, SPRITE_SURGE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, VermilionGymSurgeScript, -1 + object_event 9, 6, SPRITE_GENTLEMAN, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 5, TrainerGentlemanGregory, -1 object_event 4, 7, SPRITE_ROCKER, SPRITEMOVEDATA_STANDING_DOWN, 3, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerGuitaristVincent, -1 object_event 0, 10, SPRITE_SUPER_NERD, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 4, TrainerJugglerHorton, -1 - object_event 7, 15, SPRITE_GYM_GUIDE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 1, VermilionGymGuideScript, -1 + object_event 7, 14, SPRITE_GYM_GUIDE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 1, VermilionGymGuideScript, -1 diff --git a/maps/VermilionGym.blk b/maps/VermilionGym.blk index 70311ffce..5bc7ee113 100644 --- a/maps/VermilionGym.blk +++ b/maps/VermilionGym.blk @@ -1 +1 @@ -"&&&$#% ! !  \ No newline at end of file +#&&2%#% ! !  \ No newline at end of file diff --git a/ram/wram.asm b/ram/wram.asm index 7897aaa10..15d24bae7 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -3360,7 +3360,10 @@ wSwarmLandmark:: db wLastMapYCoord:: db ; current y coordinate relative to top-left corner of the previous map wLastMapXCoord:: db ; current x coordinate relative to top-left corner of previous map - ds 11 + ds 9 + +wVermilionGymTrashCan1:: db +wVermilionGymTrashCan2:: db wFossilStepCount:: ds 1