feat(game): open the mart shop and key items by the ids the client reads (#151)
This commit is contained in:
1 parent
a69fd0d07f
commit
499d20fdb3
46 files changed
+7863
-269
No files matched your search
@@ -67,12 +67,18 @@ end of your function.
|
||||
| `warp MAP, x, y` | `ctx.warp(region, bank, map, x, y, facing)` |
|
||||
| `setdynamicwarp ...` | `ctx.setDynamicWarp(region, bank, map, x, y, facing)` |
|
||||
|
||||
Item ids come from the generated `Items` object, never a raw number:
|
||||
`ctx.giveItem(Items.POKE_BALL, 5)`. It is generated from the decomp item header,
|
||||
so every item the games know about is in it. The client keys an item by
|
||||
`regionId * 1000 + itemId` and holds one item table per region, so the ids in
|
||||
`Items` sit in the region whose table matches the decomp numbering. Sending the
|
||||
same number under another region reaches a different item entirely.
|
||||
Items are named, never numbered: `ctx.giveItem(Items.POKE_BALL, 5)`. A value in
|
||||
the generated `Items` object is an identity rather than an id, and `ItemRegistry`
|
||||
maps it to the ids the wire uses, so a script never sees a number and an item
|
||||
listed twice in the client's table still resolves. Services translate at the
|
||||
point they build a packet.
|
||||
|
||||
`Items` is generated from the Gen 5 table the live client speaks, so it holds
|
||||
what the client can actually show. An item the decomp has and the client does not
|
||||
is simply absent, and naming it fails the build rather than handing the player
|
||||
something that arrives as another item or as nothing. The Teachy TV in Viridian
|
||||
City is the case that came up first. Where the decomp's item does not exist,
|
||||
drop the reward and say so, rather than substituting a different one.
|
||||
|
||||
`ctx.warp` continues into the destination map's ON_TRANSITION and ON_FRAME
|
||||
scripts on the same coroutine, exactly the way the decomp's `warp` does, so a
|
||||
|
||||
@@ -30,7 +30,7 @@ Gradle task (`generateMaps`, `generateMoves`, `generatePokemon`, ...).
|
||||
|
||||
## Pick a data source first
|
||||
|
||||
There are two ways to choose which decomp to read from:
|
||||
There are three ways to choose which decomp to read from:
|
||||
|
||||
- **By region:** for data that is different in each region, like maps. Hoenn
|
||||
maps come from `pokeemerald`, Kanto maps from `pokefirered`. The generator gets
|
||||
@@ -39,13 +39,21 @@ There are two ways to choose which decomp to read from:
|
||||
and species. We just read one decomp (`pokeemerald`). Where the two games
|
||||
disagree on a detail (a wild held item, a flee rate) we accept the values from
|
||||
that one decomp instead of trying to merge them.
|
||||
- **Whatever the live client speaks:** for data the client indexes itself, like
|
||||
items. The retail client answers in the Gen 5 table no matter which region the
|
||||
player is in, so `generateItem` reads `decomp/pokeblack` and the GBA numbering
|
||||
never enters the picture.
|
||||
|
||||
Rule of thumb: if the same thing (a move, a Pokémon) exists in both games, use a
|
||||
single source. If the thing belongs to one region, use by-region.
|
||||
single source. If the thing belongs to one region, use by-region. If the client
|
||||
is the one doing the lookup, follow the client.
|
||||
|
||||
> **Note:** the NDS decomps (`pokeblack`, `pokeheartgold`, `pokeplatinum`) are
|
||||
> **not implemented yet**. They use 3D maps and a different data format, so only
|
||||
> the GBA decomps (`pokeemerald`, `pokefirered`) are wired up today.
|
||||
> **Note:** the NDS decomps (`pokeheartgold`, `pokeplatinum`) are submodules but
|
||||
> **not implemented**. They use 3D maps and a different data format, so every
|
||||
> generator but the item one reads the GBA decomps (`pokeemerald`,
|
||||
> `pokefirered`). Item data is the exception: it comes from two JSON files
|
||||
> extracted from the Gen 5 decomp and committed under `decomp/pokeblack`, whose
|
||||
> source repository is private and so cannot be a submodule.
|
||||
|
||||
## The pieces of a generator
|
||||
|
||||
|
||||
Reference in new issue
Block a user