diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-03 18:54:22 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-08-03 18:54:22 -0400 |
commit | 41f458ca6abb3a0ac7c0ea56fc5473d04a8af3b6 (patch) | |
tree | 21540c6896f4d5427b7511cbe1e0fb7b04ae6d1a | |
parent | 5c4fc1eba99d99b7e9715fedce5050626e238c40 (diff) |
def_* macros
-rw-r--r-- | Add-a-new-Mart.md | 5 | ||||
-rw-r--r-- | Add-a-new-map-and-landmark.md | 30 | ||||
-rw-r--r-- | Add-a-new-scene-script.md | 33 | ||||
-rw-r--r-- | Add-a-new-spawn-point.md | 54 | ||||
-rw-r--r-- | Move-Tutor-and-Tutor-Moves.md | 48 | ||||
-rw-r--r-- | Wall-to-wall-carpeting-in-your-room.md | 5 |
6 files changed, 94 insertions, 81 deletions
diff --git a/Add-a-new-Mart.md b/Add-a-new-Mart.md index 92c32dc..064c236 100644 --- a/Add-a-new-Mart.md +++ b/Add-a-new-Mart.md @@ -93,7 +93,7 @@ The core idea here is to use the `pokemart` script command, passing it a mart ty Edit [maps/GoldenrodDeptStore3F.asm](../blob/master/maps/GoldenrodDeptStore3F.asm): ```diff - object_const_def ; object_event constants + object_const_def const GOLDENRODDEPTSTORE3F_CLERK + const GOLDENRODDEPTSTORE3F_CLERK2 const GOLDENRODDEPTSTORE3F_SUPER_NERD @@ -117,8 +117,7 @@ Edit [maps/GoldenrodDeptStore3F.asm](../blob/master/maps/GoldenrodDeptStore3F.as ... -- db 3 ; object events -+ db 4 ; object events + def_object_events object_event 6, 1, SPRITE_CLERK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FClerkScript, -1 + object_event 7, 1, SPRITE_CLERK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FClerk2Script, -1 object_event 12, 5, SPRITE_SUPER_NERD, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GoldenrodDeptStore3FSuperNerdScript, -1 diff --git a/Add-a-new-map-and-landmark.md b/Add-a-new-map-and-landmark.md index d6c5fe0..ad1c32b 100644 --- a/Add-a-new-map-and-landmark.md +++ b/Add-a-new-map-and-landmark.md @@ -382,50 +382,50 @@ Note the use of "¯" in some landmark names. That character gets treated as a li Create **maps/GlobalTerminalOutside.asm**: ```diff -+ object_const_def ; object_event constants ++ object_const_def + const GLOBALTERMINALOUTSIDE_ROCKET + +GlobalTerminalOutside_MapScripts: -+ db 0 ; scene scripts ++ def_scene_scripts + -+ db 0 ; callbacks ++ def_callbacks + +GlobalTerminalOutside_MapEvents: + db 0, 0 ; filler + -+ db 1 ; warp events ++ def_warp_events + warp_event 8, 13, GLOBAL_TERMINAL_1F, 1 + -+ db 0 ; coord events ++ def_coord_events + -+ db 0 ; bg events ++ def_bg_events + -+ db 1 ; object events ++ def_object_events + object_event 24, 16, SPRITE_ROCKET, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodCityRocketScoutScript, EVENT_GOLDENROD_CITY_ROCKET_SCOUT ``` And create **maps/GlobalTerminal1F.asm**: ```diff -+ object_const_def ; object_event constants ++ object_const_def + +GlobalTerminal1F_MapScripts: -+ db 0 ; scene scripts ++ def_scene_scripts + -+ db 0 ; callbacks ++ def_callbacks + +GlobalTerminal1F_MapEvents: + db 0, 0 ; filler + -+ db 2 ; warp events ++ def_warp_events + warp_event 8, 11, GLOBAL_TERMINAL_OUTSIDE, 1 + warp_event 9, 11, GLOBAL_TERMINAL_OUTSIDE, 1 + -+ db 0 ; coord events ++ def_coord_events + -+ db 0 ; bg events ++ def_bg_events + -+ db 0 ; object events ++ def_object_events ``` The only events defined so far are warps, so you can use the doors into and out of the Global Terminal building. (Their coordinates can be found with Polished Map's "Event Cursor" tool.) @@ -436,6 +436,8 @@ Writing event scripts is beyond the scope of this tutorial, but you can refer to You'll probably want a variety of NPCs in the Global Terminal, some from regions beyond Johto and Kanto, maybe with unique items and Pokémon to trade. It's a tall building, with room for more floors than just the one in this example. Or, of course, design your own map. :P +Note that before August 2020, maps did not have `def_*` macros, so they had to manually declare their quantities of `scene_script`s, `callback`s, `warp_event`s, etc. So instead of `def_warp_events`, you would have `db 1` or `db 2`, depending on how many `warp_event`s the map has. If any of those `db` values were wrong, the map could glitch or crash when you enter it. + ## 9. Include the block and script data diff --git a/Add-a-new-scene-script.md b/Add-a-new-scene-script.md index d74bc48..bb1399b 100644 --- a/Add-a-new-scene-script.md +++ b/Add-a-new-scene-script.md @@ -1,13 +1,18 @@ This tutorial is for adding a scene event to a map. We'll be Using Azalea Gym as an example. + ## Contents + 1. [Define SceneID in WRAM](#1-define-sceneid-in-wram) 2. [Define scene_var](#2-define-scene_var) 3. [Define the Scene](#3-define-the-scene) 4. [Add the Scene to Azalea Gym](#4-add-the-scene-to-azalea-gym) + ## 1. Define SceneID in WRAM + Azalea Town Doesn't have a SceneID yet, so we need to define it. Edit [wram.asm](../blob/master/wram.asm): + ```diff INCLUDE "constants.asm" @@ -25,20 +30,24 @@ If you add more Scene Ids in the future you'll have to decrement the number afte ## 2. Define scene_var + Edit [data/maps/scenes.asm](../blob/master/data/maps/scenes.asm): + ```diff scene_var: MACRO ; map, variable ... scene_var MOBILE_BATTLE_ROOM, wMobileBattleRoomSceneID -+ scene_var AZALEA_GYM, wAzaleaGymSceneID ++ scene_var AZALEA_GYM, wAzaleaGymSceneID db -1 ; end ``` ## 3. Define the scene + Edit [constants/scene_constants.asm](../blob/master/constants/scene_constants.asm): + ```diff ; See data/maps/scenes.asm for which maps have scene variables. ; Each scene_script and coord_event is associated with a current scene ID. @@ -49,26 +58,32 @@ Edit [constants/scene_constants.asm](../blob/master/constants/scene_constants.as const SCENE_FASTSHIP1F_MEET_GRANDPA ; 2 +; wAzaleaGymSceneID -+ const_def -+ const SCENE_AZALEAGYM_NOTHING -+ const SCENE_AZALEAGYM_SCENE ++ const_def ++ const SCENE_AZALEAGYM_NOTHING ++ const SCENE_AZALEAGYM_SCENE ``` + + ## 4. Add the Scene to Azalea Gym + Edit [maps/AzaleaGym.asm](../blob/master/maps/AzaleaGym.asm): + ```diff object_const_def ; object_event constants const AZALEAGYM_BUGSY ... AzaleaGym_MapScripts: -- db 0 ; scene scripts -+ db 2 ; scene scripts -+ scene_script .DummyScene0 ; SCENE_AZALEAGYM_NOTHING + def_scene_scripts ++ scene_script .DummyScene0 ; SCENE_AZALEAGYM_NOTHING + scene_script .DummyScene1 ; SCENE_AZALEAGYM_SCENE - db 0 ; callbacks + def_callbacks +.DummyScene0 +.DummyScene1 + end ``` -That's it! Now you can use these scenes for a Coord event.
\ No newline at end of file + +(Before August 2020, maps did not have `def_*` macros, so they had to manually declare their quantities of `scene_script`s, `callback`s, etc. So instead of `def_scene_scripts` they used to have `db 0 ; scene scripts`, which you would change here to `db 2`.) + +That's it! Now you can use these scenes for a Coord event. diff --git a/Add-a-new-spawn-point.md b/Add-a-new-spawn-point.md index 3471361..81ea632 100644 --- a/Add-a-new-spawn-point.md +++ b/Add-a-new-spawn-point.md @@ -1,25 +1,25 @@ This tutorial is for how to add a new spawn point for fly. -After successfully achieved the "[Add a new map and landmark](https://github.com/pret/pokecrystal/wiki/Add-a-new-map-and-landmark)" tutorial, +After successfully achieved the "[Add a new map and landmark](https://github.com/pret/pokecrystal/wiki/Add-a-new-map-and-landmark)" tutorial, Simply edit [constants/map_data_constants.asm]: ```diff ; johto - const SPAWN_NEW_BARK - ... - const SPAWN_GOLDENROD -+ const SPAWN_GLOBALTERMINAL + const SPAWN_NEW_BARK + ... + const SPAWN_GOLDENROD ++ const SPAWN_GLOBALTERMINAL ``` Then edit [data/maps/spawn_points.asm]: ```diff SpawnPoints: - - ... - spawn GOLDENROD_CITY, 15, 28 -+ spawn GLOBAL_TERMINAL_OUTSIDE, 8, 10 + + ... + spawn GOLDENROD_CITY, 15, 28 ++ spawn GLOBAL_TERMINAL_OUTSIDE, 8, 10 ``` Then edit [data/maps/flypoints.asm] @@ -29,9 +29,9 @@ Flypoints: ... ; Johto - ... - flypoint GOLDENROD, GOLDENROD_CITY -+ flypoint GLOBALTERMINAL, GLOBAL_TERMINAL + ... + flypoint GOLDENROD, GOLDENROD_CITY ++ flypoint GLOBALTERMINAL, GLOBAL_TERMINAL ``` Then edit [constants/engine_flags.asm] @@ -39,33 +39,31 @@ Then edit [constants/engine_flags.asm] ```diff ... ; wVisitedSpawns - const ENGINE_FLYPOINT_GOLDENROD -+ const ENGINE_FLYPOINT_GLOBALTERMINAL + const ENGINE_FLYPOINT_GOLDENROD ++ const ENGINE_FLYPOINT_GLOBALTERMINAL ``` Then edit [data/engine_flags.asm] ```diff EngineFlags: - ... - ; fly - ... - engine_flag wVisitedSpawns, SPAWN_GOLDENROD -+ engine_flag wVisitedSpawns, SPAWN_GLOBALTERMINAL + ... + ; fly + ... + engine_flag wVisitedSpawns, SPAWN_GOLDENROD ++ engine_flag wVisitedSpawns, SPAWN_GLOBALTERMINAL ``` Then edit [maps/GlobalTerminalOutSide.asm] ```diff ... -GlobalTerminalOutside_MapScripts: - db 0 ; scene scripts -+ db 1 ; callbacks -+ callback MAPCALLBACK_NEWMAP, .Flypoint - -+ .Flypoint: -+ setflag ENGINE_FLYPOINT_GLOBALTERMINAL -+ return + def_callbacks ++ callback MAPCALLBACK_NEWMAP, .Flypoint + ++.Flypoint: ++ setflag ENGINE_FLYPOINT_GLOBALTERMINAL ++ return ``` -Then compile your project and you're done
\ No newline at end of file +Then compile your project and you're done diff --git a/Move-Tutor-and-Tutor-Moves.md b/Move-Tutor-and-Tutor-Moves.md index 506cd86..eb64358 100644 --- a/Move-Tutor-and-Tutor-Moves.md +++ b/Move-Tutor-and-Tutor-Moves.md @@ -1,4 +1,4 @@ -Pokémon Crystal was the first time in the series' history that the player was introduced to move tutors. They teach the player's Pokémon some interesting moves, usually for a price. +Pokémon Crystal was the first time in the series' history that the player was introduced to move tutors. They teach the player's Pokémon some interesting moves, usually for a price. In this tutorial we will be expanding the existing move tutor code in pokecrystal, and create a new move tutor script to be used in a map. For this example, we will be creating a move tutor for Softboiled. @@ -142,7 +142,7 @@ In this case, now that we've edited `.GetMoveTutorMove` to not contain `MOVETUTO Now he functions just the same as before, but now the code that let him teach moves can now be expanded to teach others, as well. ## 3. Create a new tutor move -There are three parts to creating a new tutor move. Defining the constant, defining the move, and lastly, adding the move to a Pokémon's existing learnset. +There are three parts to creating a new tutor move. Defining the constant, defining the move, and lastly, adding the move to a Pokémon's existing learnset. Let's define the constant first. Open [constants/item_constants.asm](../blob/master/constants/item_constants.asm) Even though tutor moves aren't items and therefore do not have item constants, they're technically still similar to TMs and HMs, in order to work with Pokémon movesets. So they must be defined as such below. @@ -248,7 +248,7 @@ Open up Chansey's base stats at [data/pokemon/base_stats/chansey.asm](../blob/ma What we want to edit is the tm/hm learnset at the bottom. The TMs and HMs all follow the numeric order of each TM move from `tmhm_moves` and `item_constants`. Move tutor moves go at the end, and as you can see, Chansey already has the Goldenrod tutor moves at the end of her list, after HMs. Simply add `SOFTBOILED` to the end of the list, like so: -```diff +```diff ; tm/hm learnset - tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, DREAM_EATER, REST, ATTRACT, STRENGTH, FLASH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM @@ -287,7 +287,7 @@ CeladonCityGramps1Text: ... -db 9 ; object events + def_object_events object_event 26, 11, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityFisherScript, -1 object_event 27, 11, SPRITE_POLIWAG, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonCityPoliwrath, -1 object_event 20, 24, SPRITE_TEACHER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityTeacher1Script, -1 @@ -299,7 +299,7 @@ db 9 ; object events object_event 7, 22, SPRITE_LASS, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 2, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityLassScript, -1 ``` -We'll be borrowing the old man at the house behind the small body of water in Celadon, `CeladonCityGramps1`. +We'll be borrowing the old man at the house behind the small body of water in Celadon, `CeladonCityGramps1`. You can either delete the `CeladonCityGramps1Script` and `CeladonCityGramps1Text` itself, or comment it out as we won't be needing them. The bottom part of this script block handles all the `object_event`s, the sprites that usually make up NPCs or important items. Now let's turn him into a tutor! ```diff @@ -353,25 +353,25 @@ You can either delete the `CeladonCityGramps1Script` and `CeladonCityGramps1Text + line "luck that brought" + cont "us together." + done -+ -+CeladonCityTutorSoftboiledText2: ++ ++CeladonCityTutorSoftboiledText2: + text "Would you like me" + line "to teach your" + para "#MON to use" + line "SOFTBOILED" -+ ++ +CeladonCityTutorSoftboiledClear: + text "" + done -+ ++ +CeladonCityTutorSoftboiledRefused: + text "OK then." + done -+ ++ +CeladonCityTutorSoftboiledTaught: + text "Now if your" + line "#MON is in a" -+ para "pinch, they can" ++ para "pinch, they can" + line "eat an egg" + cont "and restore HP." + para "Or if they are" @@ -381,7 +381,7 @@ You can either delete the `CeladonCityGramps1Script` and `CeladonCityGramps1Text ... - db 9 ; object events + def_object_events object_event 26, 11, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, CeladonCityFisherScript, -1 object_event 27, 11, SPRITE_POLIWAG, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, CeladonCityPoliwrath, -1 object_event 20, 24, SPRITE_TEACHER, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, CeladonCityTeacher1Script, -1 @@ -418,10 +418,10 @@ CeladonCityTutorSoftboiledScript: end +.NoPokeDoll: -+ writetext CeladonCityTutorNoDoll -+ waitbutton -+ closetext -+ end ++ writetext CeladonCityTutorNoDoll ++ waitbutton ++ closetext ++ end .TeachMove writetext CeladonCityTutorPayment @@ -442,7 +442,7 @@ CeladonCityTutorSoftboiledScript: CeladonCityTutorSoftboiledTaught: text "Now if your" line "#MON is in a" - para "pinch, they can" + para "pinch, they can" line "eat an egg" cont "and restore HP." para "Or if they are" @@ -456,7 +456,7 @@ CeladonCityTutorSoftboiledTaught: + + para "You can get one" + line "from the DEPT." -+ ++ + para "STORE in CEL-" + line "ADON CITY." + done @@ -485,15 +485,15 @@ CeladonCityTutorSoftboiledScript: if_equal $0, .TeachMove .NoPokeDoll: - writetext CeladonCityTutorNoDoll - waitbutton - closetext - end + writetext CeladonCityTutorNoDoll + waitbutton + closetext + end .TeachMove writetext CeladonCityTutorPayment - takeitem POKE_DOLL -+ takemoney YOUR_MONEY, 1000 ++ takemoney YOUR_MONEY, 1000 waitbutton writetext CeladonCityTutorSoftboiledTaught waitbutton @@ -501,4 +501,4 @@ CeladonCityTutorSoftboiledScript: end ``` -For other ideas, look at the Goldenrod move tutor script. Perhaps you want move tutors that appear on different days of the week? Or teach different moves based on what day it is? All of this is possible, and left up to you intrepid assembly hackers to challenge yourself with.
\ No newline at end of file +For other ideas, look at the Goldenrod move tutor script. Perhaps you want move tutors that appear on different days of the week? Or teach different moves based on what day it is? All of this is possible, and left up to you intrepid assembly hackers to challenge yourself with. diff --git a/Wall-to-wall-carpeting-in-your-room.md b/Wall-to-wall-carpeting-in-your-room.md index 1867236..8a225b6 100644 --- a/Wall-to-wall-carpeting-in-your-room.md +++ b/Wall-to-wall-carpeting-in-your-room.md @@ -82,10 +82,9 @@ And edit [maps/PlayersHouse2F.asm](../blob/master/maps/PlayersHouse2F.asm): ```diff PlayersHouse2F_MapScripts: - db 0 ; scene scripts + def_scene_scripts -- db 2 ; callbacks -+ db 3 ; callbacks + def_callbacks callback MAPCALLBACK_NEWMAP, .InitializeRoom callback MAPCALLBACK_TILES, .SetSpawn + callback MAPCALLBACK_GRAPHICS, .RenderCarpet |