diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 90a08070e..c62514a63 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1553,7 +1553,14 @@ .2byte \item .2byte \quantity .endm - + + @ Selects a string from the given array and loads it into word 0 for use with message 0. + @ Note: the array MUST be word-aligned with .align 2 + .macro selectstring array:req, index:req + .byte 0xe3 + .4byte \array + .2byte \index + .endm @ Supplementary diff --git a/data/event_scripts.s b/data/event_scripts.s index 688e36827..ba2b7e5d2 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1216,74 +1216,74 @@ EverGrandeCity_HallOfFame_EventScript_ResetEliteFour:: @ 82718CC Std_ObtainItem:: @ 8271AD3 giveitem VAR_0x8000, VAR_0x8001 copyvar VAR_0x8007, VAR_RESULT - call EventScript_271AE3 + call Std_ObtainItem_DisplayStandardText return -EventScript_271AE3:: @ 8271AE3 +Std_ObtainItem_DisplayStandardText:: @ 8271AE3 bufferitemnameplural 1, VAR_0x8000, VAR_0x8001 checkitemtype VAR_0x8000 - call EventScript_271B08 + call Std_ObtainItem_BufferItemTypeAndPlayJingle compare VAR_0x8007, 1 - call_if_eq EventScript_271B95 + call_if_eq Std_ObtainItem_DisplayPutItemInPocket compare VAR_0x8007, 0 - call_if_eq EventScript_271BA9 + call_if_eq Std_ObtainItem_FailBagFull return -EventScript_271B08:: @ 8271B08 +Std_ObtainItem_BufferItemTypeAndPlayJingle:: @ 8271B08 switch VAR_RESULT - case 1, EventScript_271B45 - case 5, EventScript_271B55 - case 2, EventScript_271B65 - case 3, EventScript_271B75 - case 4, EventScript_271B85 + case 1, Std_ObtainItem_HandleItemType1 + case 5, Std_ObtainItem_HandleItemType5 + case 2, Std_ObtainItem_HandleItemType2 + case 3, Std_ObtainItem_HandleItemType3 + case 4, Std_ObtainItem_HandleItemType4 end -EventScript_271B45:: @ 8271B45 +Std_ObtainItem_HandleItemType1:: @ 8271B45 bufferstdstring 2, 14 compare VAR_0x8007, 1 - call_if_eq EventScript_271BAF + call_if_eq Std_ObtainItem_PlayItemJingle return -EventScript_271B55:: @ 8271B55 +Std_ObtainItem_HandleItemType5:: @ 8271B55 bufferstdstring 2, 15 compare VAR_0x8007, 1 - call_if_eq EventScript_271BAF + call_if_eq Std_ObtainItem_PlayItemJingle return -EventScript_271B65:: @ 8271B65 +Std_ObtainItem_HandleItemType2:: @ 8271B65 bufferstdstring 2, 16 compare VAR_0x8007, 1 - call_if_eq EventScript_271BAF + call_if_eq Std_ObtainItem_PlayItemJingle return -EventScript_271B75:: @ 8271B75 +Std_ObtainItem_HandleItemType3:: @ 8271B75 bufferstdstring 2, 17 compare VAR_0x8007, 1 - call_if_eq EventScript_271BB3 + call_if_eq Std_ObtainItem_PlayTMJingle return -EventScript_271B85:: @ 8271B85 +Std_ObtainItem_HandleItemType4:: @ 8271B85 bufferstdstring 2, 18 compare VAR_0x8007, 1 - call_if_eq EventScript_271BAF + call_if_eq Std_ObtainItem_PlayItemJingle return -EventScript_271B95:: @ 8271B95 +Std_ObtainItem_DisplayPutItemInPocket:: @ 8271B95 message gUnknown_08272A78 waitfanfare msgbox gText_PutItemInPocket, MSGBOX_DEFAULT setvar VAR_RESULT, 1 return -EventScript_271BA9:: @ 8271BA9 +Std_ObtainItem_FailBagFull:: @ 8271BA9 setvar VAR_RESULT, 0 return -EventScript_271BAF:: @ 8271BAF +Std_ObtainItem_PlayItemJingle:: @ 8271BAF playfanfare MUS_FANFA4 return -EventScript_271BB3:: @ 8271BB3 +Std_ObtainItem_PlayTMJingle:: @ 8271BB3 playfanfare MUS_ME_WAZA return @@ -1323,7 +1323,7 @@ Std_FindItem:: @ 8271BFD copyvar VAR_0x8007, VAR_RESULT bufferitemnameplural 1, VAR_0x8000, VAR_0x8001 checkitemtype VAR_0x8000 - call EventScript_271B08 + call Std_ObtainItem_BufferItemTypeAndPlayJingle compare VAR_0x8007, 1 call_if_eq EventScript_PickItemUp compare VAR_0x8007, 0 @@ -1376,7 +1376,7 @@ EventScript_HiddenItemScript:: @ 8271CB7 copyvar VAR_0x8007, VAR_RESULT bufferitemnameplural 1, VAR_0x8005, 1 checkitemtype VAR_0x8005 - call EventScript_271B08 + call Std_ObtainItem_BufferItemTypeAndPlayJingle compare VAR_0x8007, 1 goto_if_eq EventScript_271CE8 compare VAR_0x8007, 0 diff --git a/data/maps/DewfordTown_PokemonCenter_1F/map.json b/data/maps/DewfordTown_PokemonCenter_1F/map.json index 9ce0633ed..e2c49aab9 100644 --- a/data/maps/DewfordTown_PokemonCenter_1F/map.json +++ b/data/maps/DewfordTown_PokemonCenter_1F/map.json @@ -42,7 +42,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/FallarborTown_PokemonCenter_1F/map.json b/data/maps/FallarborTown_PokemonCenter_1F/map.json index c260114db..2b6498180 100644 --- a/data/maps/FallarborTown_PokemonCenter_1F/map.json +++ b/data/maps/FallarborTown_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/FortreeCity_PokemonCenter_1F/map.json b/data/maps/FortreeCity_PokemonCenter_1F/map.json index c51a784cb..a47e4dfa1 100644 --- a/data/maps/FortreeCity_PokemonCenter_1F/map.json +++ b/data/maps/FortreeCity_PokemonCenter_1F/map.json @@ -55,7 +55,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/LavaridgeTown_PokemonCenter_1F/map.json b/data/maps/LavaridgeTown_PokemonCenter_1F/map.json index dcb234a50..b6a4f038c 100644 --- a/data/maps/LavaridgeTown_PokemonCenter_1F/map.json +++ b/data/maps/LavaridgeTown_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/LilycoveCity_PokemonCenter_1F/map.json b/data/maps/LilycoveCity_PokemonCenter_1F/map.json index 7f3c8f1d8..20d2fad0e 100644 --- a/data/maps/LilycoveCity_PokemonCenter_1F/map.json +++ b/data/maps/LilycoveCity_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc index c84392284..6415a804e 100644 --- a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc +++ b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc @@ -573,7 +573,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_1FA3AC:: @ 81FA3AC setflag FLAG_SYS_POKEDEX_GET special sub_81AFDA0 setflag FLAG_RECEIVED_POKEDEX_FROM_BIRCH - setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 1 + setvar VAR_FREE_POKEBALL_STATE, 1 return LittlerootTown_ProfessorBirchsLab_EventScript_1FA3C4:: @ 81FA3C4 diff --git a/data/maps/MauvilleCity_PokemonCenter_1F/map.json b/data/maps/MauvilleCity_PokemonCenter_1F/map.json index 148923e01..01d73688f 100644 --- a/data/maps/MauvilleCity_PokemonCenter_1F/map.json +++ b/data/maps/MauvilleCity_PokemonCenter_1F/map.json @@ -136,7 +136,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/MossdeepCity_PokemonCenter_1F/map.json b/data/maps/MossdeepCity_PokemonCenter_1F/map.json index 8b4b7ca43..18c9fda06 100644 --- a/data/maps/MossdeepCity_PokemonCenter_1F/map.json +++ b/data/maps/MossdeepCity_PokemonCenter_1F/map.json @@ -55,7 +55,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/OldaleTown_PokemonCenter_1F/map.json b/data/maps/OldaleTown_PokemonCenter_1F/map.json index 0535c8ccc..cb68083a8 100644 --- a/data/maps/OldaleTown_PokemonCenter_1F/map.json +++ b/data/maps/OldaleTown_PokemonCenter_1F/map.json @@ -55,7 +55,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/PetalburgCity_PokemonCenter_1F/map.json b/data/maps/PetalburgCity_PokemonCenter_1F/map.json index 6f8a99323..ca2bb6030 100644 --- a/data/maps/PetalburgCity_PokemonCenter_1F/map.json +++ b/data/maps/PetalburgCity_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/RustboroCity_PokemonCenter_1F/map.json b/data/maps/RustboroCity_PokemonCenter_1F/map.json index 223b32e93..6662ddab2 100644 --- a/data/maps/RustboroCity_PokemonCenter_1F/map.json +++ b/data/maps/RustboroCity_PokemonCenter_1F/map.json @@ -55,7 +55,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/SlateportCity_PokemonCenter_1F/map.json b/data/maps/SlateportCity_PokemonCenter_1F/map.json index 68a7800b8..ec5a078ad 100644 --- a/data/maps/SlateportCity_PokemonCenter_1F/map.json +++ b/data/maps/SlateportCity_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/SootopolisCity_PokemonCenter_1F/map.json b/data/maps/SootopolisCity_PokemonCenter_1F/map.json index 0bec34e56..e8d435846 100644 --- a/data/maps/SootopolisCity_PokemonCenter_1F/map.json +++ b/data/maps/SootopolisCity_PokemonCenter_1F/map.json @@ -55,7 +55,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/maps/VerdanturfTown_PokemonCenter_1F/map.json b/data/maps/VerdanturfTown_PokemonCenter_1F/map.json index 290927d83..1732aaa1f 100644 --- a/data/maps/VerdanturfTown_PokemonCenter_1F/map.json +++ b/data/maps/VerdanturfTown_PokemonCenter_1F/map.json @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "movement_type": "MOVEMENT_TYPE_FACE_LEFT", - "script": "PokemonCenter_1F_FreePokeballCounterScript", + "script": "PokemonCenter_1F_EventScript_FreePokeballCounter", "trainer_sight_or_berry_tree_id": "0", "trainer_type": "0", "x": 15, diff --git a/data/pokecenter_scripts.inc b/data/pokecenter_scripts.inc index ffeee30a7..146c26bfb 100644 --- a/data/pokecenter_scripts.inc +++ b/data/pokecenter_scripts.inc @@ -204,9 +204,180 @@ gText_NurseExplainPokerus:: @ 8272F07 @@@@ Pokecenter Free Pokeball Counter @@@@ -PokemonCenter_1F_FreePokeballCounterScript:: - @ TODO +PokemonCenter_1F_EventScript_FreePokeballCounter:: + lock + faceplayer + @ Deny if the player hasn't yet completed the tutorial + compare VAR_FREE_POKEBALL_STATE, 0 + goto_if_eq PokemonCenter_1F_EventScript_FreePokeballCounter_DenyTutorial + @ Check for first time tutorial + compare VAR_FREE_POKEBALL_STATE, 1 + call_if_eq PokemonCenter_1F_EventScript_FreePokeballCounter_Explain + @ Check for free ball cutoff + compare VAR_TEMP_A, 8 + goto_if_ge PokemonCenter_1F_EventScript_FreePokeballCounter_DenyCutoff + @ Welcome message + selectstring PokemonCenter_1F_TextArray_FreePokeballCounter_Intro, VAR_TEMP_A + message 0 + waitmessage + yesnobox 20, 8 + compare VAR_RESULT, 1 + goto_if_eq PokemonCenter_1F_EventScript_FreePokeballCounter_GiveBalls + compare VAR_RESULT, 0 + goto_if_eq PokemonCenter_1F_EventScript_FreePokeballCounter_Goodbye + release + end +.align 2 +PokemonCenter_1F_TextArray_FreePokeballCounter_Intro: + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro0 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro1 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro1 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro2 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro2 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro2 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro3 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_Intro3 + .4byte 0 +PokemonCenter_1F_Text_FreePokeballCounter_Intro0: + .string "Hello {PLAYER_sir}, how are you today?\n" + .string "Would you like some free {REF}Poké Balls{END}?$" +PokemonCenter_1F_Text_FreePokeballCounter_Intro1: + .string "Hello again, {PLAYER_sir}.\n" + .string "Would you like some more {REF}Poké Balls{END}?$" +PokemonCenter_1F_Text_FreePokeballCounter_Intro2: + .string "Back again, {PLAYER_sir}?\n" + .string "Want some more {REF}Poké Balls{END}?$" +PokemonCenter_1F_Text_FreePokeballCounter_Intro3: + .string "Ah, {PLAYER_sir}.\n" + .string "You still want more {REF}Poké Balls{END}?$" + +PokemonCenter_1F_EventScript_FreePokeballCounter_GiveBalls: + selectstring PokemonCenter_1F_TextArray_FreePokeballCounter_GiveComments, VAR_TEMP_A + message 0 + waitmessage + waitbuttonpress + giveitem_std ITEM_POKE_BALL, 5 + compare VAR_RESULT, 0 + goto_if_eq PokemonCenter_1F_EventScript_FreePokeballCounter_NoRoom + addvar VAR_TEMP_A, 1 + goto PokemonCenter_1F_EventScript_FreePokeballCounter_Goodbye + end +.align 2 +PokemonCenter_1F_TextArray_FreePokeballCounter_GiveComments: + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls1 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls1 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls2 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls3 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls3 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls3 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls4 + .4byte PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls5 + .4byte 0 +PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls1: + .string "Okay, here's a pack of Poké Balls!$" +PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls2: + .string "Planning to catch a lot of Pokémon,\n" + .string "are you? Here you go!$" +PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls3: + .string "Alright. Here's a few more.$" +PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls4: + .string "Ok, last set. I know they're free, but\n" + .string "we can't just have one person hogging\l" + .string "them all now, can we?$" +PokemonCenter_1F_Text_FreePokeballCounter_GiveBalls5: + .string "I'm serious this time, {PLAYER_sir}.\n" + .string "No more than this.$" + + +PokemonCenter_1F_EventScript_FreePokeballCounter_NoRoom: + message PokemonCenter_1F_Text_FreePokeballCounter_NoRoom + waitmessage + waitbuttonpress + release + end +PokemonCenter_1F_Text_FreePokeballCounter_NoRoom: + .string "Oh, you don't have enough room.\n" + .string "Feel free to return when you do.$" + +PokemonCenter_1F_EventScript_FreePokeballCounter_Goodbye: + message PokemonCenter_1F_Text_FreePokeballCounter_Goodbye + waitmessage + waitbuttonpress + release + end +PokemonCenter_1F_Text_FreePokeballCounter_Goodbye: + .string "Have a good day!$" + +PokemonCenter_1F_EventScript_FreePokeballCounter_DenyCutoff: + message PokemonCenter_1F_Text_FreePokeballCounter_DenyCutoff + waitmessage + waitbuttonpress + release + end +PokemonCenter_1F_Text_FreePokeballCounter_DenyCutoff: + .string "No, I'm sorry, {PLAYER_sir}.\n" + .string "I'm cutting you off.\p" + .string "Please leave.$" + +PokemonCenter_1F_EventScript_FreePokeballCounter_DenyTutorial: + msgbox PokemonCenter_1F_Text_FreePokeballCounter_DenyTutorial, MSGBOX_NPC + applymovement THIS_EVENT, Common_Movement_FaceOriginalDirection + waitmovement 0 + release end +PokemonCenter_1F_Text_FreePokeballCounter_DenyTutorial: + .string "Oh, I'm sorry, {PLAYER_sir}.\n" + .string "We're currently out of stock.\p" + .string "Sorry for the inconvenience.$" + +PokemonCenter_1F_EventScript_FreePokeballCounter_Explain: + message PokemonCenter_1F_Text_FreePokeballCounter_Intro0 + waitmessage + waitbuttonpress + message PokemonCenter_1F_Text_FreePokeballCounter_Explain + waitmessage + waitbuttonpress + applymovement THIS_EVENT, PokemonCenter_1F_Text_FreePokeballCounter_Glance + waitmovement 0 + message PokemonCenter_1F_Text_FreePokeballCounter_Explain2 + waitmessage + waitbuttonpress + setvar VAR_FREE_POKEBALL_STATE, 2 + message PokemonCenter_1F_Text_FreePokeballCounter_Explain3 + waitmessage + return +PokemonCenter_1F_Text_FreePokeballCounter_Explain: + .string "Oh, have you not heard of our program\n" + .string "before? You must be new to the region.\p" + .string "I'm sure you've noticed how Pokémon can\n" + .string "be very dangerous creatures in the wild.\p" + .string "The Hoenn General Council determined\n" + .string "the best manner in which to address\l" + .string "this problem was to ensure everyone has\n" + .string "some Pokémon to protect themselves.\p" + .string "So they started the\n" + .string "{REF}Free Poké Ball Initiative{END}\l" + .string "to help keep you safe and reduce the\n" + .string "number of wild Pokémon incidences!$" +PokemonCenter_1F_Text_FreePokeballCounter_Explain2: + .string "{COLOR LIGHT_GREY}(Just between you and me, I think it's\n" + .string "actually increased the number of wild\l" + .string "Pokémon attacks, since many people don't\n" + .string "know how to handle a Pokémon…)$" +PokemonCenter_1F_Text_FreePokeballCounter_Explain3: + .string "Anyway, would like some {REF}Poké Balls{END}?$" +PokemonCenter_1F_Text_FreePokeballCounter_Glance: + face_down + delay_16 + face_player + step_end + + +@ TODO; stick this text on a random patron in a pokecenter instead + .string "Your parents' taxes go towards paying\n" + .string "for free Poké Balls for you, as well as\l" + .string "all the services offered here at the\n" + .string "Pokémon Center!$" @@@@ Pokecenter Mr Briney Location @@@@ diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index b91d605ed..a92cb2161 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -227,6 +227,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_warpE0 .4byte ScrCmd_buffercontesttype .4byte ScrCmd_bufferitemnameplural + .4byte ScrCmd_selectstring gScriptCmdTableEnd:: @ 81DBA08 .4byte ScrCmd_nop diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 199ecfb1a..ea5ce4ff5 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -165,7 +165,7 @@ RustboroCity_PokemonCenter_2F_MapScript2_276C3B: @ 8276C3B SlateportCity_PokemonCenter_2F_MapScript2_276C3B: @ 8276C3B SootopolisCity_PokemonCenter_2F_MapScript2_276C3B: @ 8276C3B VerdanturfTown_PokemonCenter_2F_MapScript2_276C3B: @ 8276C3B - map_script_2 VAR_CABLE_CLUB_TUTORIAL_STATE, 1, OldaleTown_PokemonCenter_2F_EventScript_276DE0 + @ map_script_2 VAR_FREE_POKEBALL_STATE, 1, OldaleTown_PokemonCenter_2F_EventScript_276DE0 map_script_2 VAR_CABLE_CLUB_STATE, 1, OldaleTown_PokemonCenter_2F_EventScript_276C85 map_script_2 VAR_CABLE_CLUB_STATE, 2, OldaleTown_PokemonCenter_2F_EventScript_276C85 map_script_2 VAR_CABLE_CLUB_STATE, 5, OldaleTown_PokemonCenter_2F_EventScript_276C85 @@ -304,7 +304,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276DE0:: @ 8276DE0 waitmovement 0 delay 30 msgbox OldaleTown_PokemonCenter_2F_Text_279718, MSGBOX_DEFAULT - setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 2 + setvar VAR_FREE_POKEBALL_STATE, 2 releaseall end diff --git a/data/tilesets/secondary/pokemon_center/metatile_attributes.bin b/data/tilesets/secondary/pokemon_center/metatile_attributes.bin index c3f6a9ba2..7784b9a20 100644 Binary files a/data/tilesets/secondary/pokemon_center/metatile_attributes.bin and b/data/tilesets/secondary/pokemon_center/metatile_attributes.bin differ diff --git a/include/constants/vars.h b/include/constants/vars.h index 3962341f1..a193770c0 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -219,7 +219,7 @@ #define VAR_SKY_PILLAR_STATE 0x40CA #define VAR_ROUTE_111_STATE 0x40CB #define VAR_FOSSIL_MANIAC_STATE 0x40CC -#define VAR_CABLE_CLUB_TUTORIAL_STATE 0x40CD +#define VAR_FREE_POKEBALL_STATE 0x40CD // State of the free pokeball ladies #define VAR_FRONTIER_BATTLE_MODE 0x40CE #define VAR_FRONTIER_FACILITY 0x40CF #define VAR_HAS_ENTERED_BATTLE_FRONTIER 0x40D0 // Var is used like a flag. diff --git a/include/strings.h b/include/strings.h index 79c97de60..55e82ce99 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1,6 +1,7 @@ #ifndef GUARD_STRINGS_H #define GUARD_STRINGS_H +extern const u8 gText_ScriptError[]; extern const u8 gText_FromSpace[]; extern const u8 gText_Lv50[]; diff --git a/src/scrcmd.c b/src/scrcmd.c index 1bbb46275..5e288f943 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -44,6 +44,7 @@ #include "slot_machine.h" #include "sound.h" #include "string_util.h" +#include "strings.h" #include "text.h" #include "text_window.h" #include "trainer_see.h" @@ -51,6 +52,7 @@ #include "window.h" #include "constants/event_objects.h" + typedef u16 (*SpecialFunc)(void); typedef void (*NativeFunc)(void); @@ -65,6 +67,11 @@ static EWRAM_DATA u16 sFieldEffectScriptId = 0; IWRAM_DATA u8 gBrailleWindowId; IWRAM_DATA struct ScriptContext * sWaitButtonPressScriptContext; + +// Reference to an assembly defined constant, the start of the ROM +// We don't actually use the value, just the address it's at. +extern const int Start; + extern const SpecialFunc gSpecials[]; extern const u8 *gStdScripts[]; extern const u8 *gStdScripts_End[]; @@ -2320,3 +2327,29 @@ bool8 ScrCmd_warpE0(struct ScriptContext *ctx) ResetInitialPlayerAvatarState(); return TRUE; } + +bool8 ScrCmd_selectstring(struct ScriptContext *ctx) +{ + const u8 **msg = (const u8 **)ScriptReadWord(ctx); + u16 index = VarGet(ScriptReadHalfword(ctx)); + u16 max; + + for (max = 0; max < 64; max++) + { + if (msg[max] == NULL) break; + } + // Only load this pointer if it's within the array and pointing to someplace in ROM + if (index < max && msg[index] > (const u8*)&Start) + { + ctx->data[0] = (u32)msg[index]; + } + else + { + ctx->data[0] = (u32)&gText_ScriptError; + // Debugging variables: + ctx->data[1] = index; + ctx->data[2] = max; + ctx->data[3] = (u32)msg; + } + return FALSE; +} diff --git a/src/strings.c b/src/strings.c index f8da5e6fb..7bf9e6273 100644 --- a/src/strings.c +++ b/src/strings.c @@ -24,6 +24,7 @@ const u8 gExpandedPlaceholder_Alex[] = _("Alex"); const u8 gExpandedPlaceholder_Bailey[] = _("Bailey"); const u8 gExpandedPlaceholder_Jessica[] = _("Jessica"); +const u8 gText_ScriptError[] = _("Script error!\nIf you see this, report it!"); const u8 gText_EggNickname[] = _("Egg"); const u8 gText_Pokemon[] = _("Pokémon"); const u8 gProfBirchMatchCallName[] = _("Prof. Birch");