Skip to content

Commit

Permalink
Free Pokeballs!
Browse files Browse the repository at this point in the history
- Implemented the free pokeball lady! (Closes #7)
- New script command: selectstring. Selects a string pointer from an array of pointers based on an index that can be a variable, and loads it into data[0] for use with message.
- Made the counter that the lady stands behind into an actual counter metatile.
- Renamed scripts associated with obtaining items.
  • Loading branch information
tustin2121 committed May 19, 2019
1 parent e43cb56 commit 68aad67
Show file tree
Hide file tree
Showing 24 changed files with 261 additions and 47 deletions.
9 changes: 8 additions & 1 deletion asm/macros/event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
54 changes: 27 additions & 27 deletions data/event_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/maps/DewfordTown_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/FallarborTown_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/FortreeCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/LavaridgeTown_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/LilycoveCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/maps/MauvilleCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/MossdeepCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/OldaleTown_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/PetalburgCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/RustboroCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/SlateportCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/SootopolisCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion data/maps/VerdanturfTown_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 68aad67

Please sign in to comment.