sovereignx/migration_scripts
Martin Griffin 8bd5ac2e7a
Competitive-formatted parties (#3545)
$ python3 migration_scripts/convert_parties.py src/data/trainers.h src/data/trainer_parties.h src/data/npc_trainers.party
Is available to convert Trainer Control-formatted trainers/parties into
Competitive-formatted ones.

Multiple '#include's can be placed in the trainer section of src/data.c
to support spreading the trainers across multiple .party files.

trainerproc does not interpret the values, leaving that job to the C
compiler, so we use '#line' to associate those errors with the lines in
the .party file(s). Because the columns don't make sense we use
-fno-show-column and -fno-diagostics-show-caret. We might want to move
gTrainers into its own file so that the rest of src/data.c isn't
affected by those flags.

Extensions (misfeatures, imo):
- .party files are passed through cpp, so '#define's are supported, and so
  are '// ...' and '/* ... */' comments.
- .party files also support writing, e.g. 'SPECIES_PIKACHU' instead of
  'Pikachu'. This allows people to write constants explicitly if they
  like.

Pragmas:
- '#pragma trainerproc ivs explicit' requires an explicit 'IVs:' line
  rather than defaulting to 31s.
- '#pragma trainerproc ivs <IVs>' changes the default IVs.
- '#pragma trainerproc level explicit' requires an explicit 'Level:'
  line rather than defaulting to 100.
- '#pragma trainerproc level <level>' changes the default level.

Co-authored-by: Eduardo Quezada <eduardo602002@gmail.com>
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
2024-04-06 15:05:15 -03:00
..
convert_parties.py Competitive-formatted parties (#3545) 2024-04-06 15:05:15 -03:00
item_ball_refactor.py Added directory for migration scripts and added item_ball migration script (#3997) 2024-01-16 18:12:05 +01:00
README.md Added directory for migration scripts and added item_ball migration script (#3997) 2024-01-16 18:12:05 +01:00

Migration Scripts

What are migration scripts?

pokeemerald-expansion rewrites existing systems in pokeemerald to improve their efficiency and make them easier to use and implement for developers. If developers were previously using a system that has been deprecated, it can be difficult to manually migrate between systems.

These scripts exist to help developers make the transition between refactored systems.

Requirements

All migration scripts require python3 to be installed. Migration scripts are executed by running the following commands from the root directory of a developer's project.

chmod +x migration_scripts/*.py ; #give permision to make the script executable
python3 migration_scripts/*.py ; #run the migration script

* will need to be replaced with the name of the appropriate script.

Item Balls

Modifies all item ball scripts defined using to original Game Freak method to the new refactored method.

data/scripts/item_ball_scripts.inc

- Route102_EventScript_ItemPotion::
-	finditem ITEM_POTION
+ Common_EventScript_FindItem::
+   callnative GetObjectEventTrainerRangeFromTemplate
+   finditem VAR_RESULT
	end

data/maps/Route102/map.json

    {
      "graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",
      "x": 50,
      "y": 5,
      "elevation": 3,
      "movement_type": "MOVEMENT_TYPE_LOOK_AROUND",
      "movement_range_x": 1,
      "movement_range_y": 1,
      "trainer_type": "TRAINER_TYPE_NONE",
-      "trainer_sight_or_berry_tree_id": "0",
-      "script": "Route102_EventScript_ItemPotion",
+      "trainer_sight_or_berry_tree_id": "ITEM_POTION",
+      "script": "Common_EventScript_FindItem",
      "flag": "FLAG_ITEM_ROUTE_102_POTION"
    },