diff options
Diffstat (limited to 'gba/source/payload.c')
| -rw-r--r-- | gba/source/payload.c | 60 |
1 files changed, 57 insertions, 3 deletions
| diff --git a/gba/source/payload.c b/gba/source/payload.c index 7015774..665af70 100644 --- a/gba/source/payload.c +++ b/gba/source/payload.c | |||
| @@ -12,7 +12,61 @@ | |||
| 12 | 12 | ||
| 13 | // Your payload code should obviously go into the body of this, the payload function. | 13 | // Your payload code should obviously go into the body of this, the payload function. |
| 14 | void payload(pSaveBlock1 SaveBlock1,pSaveBlock2 SaveBlock2,pSaveBlock3 SaveBlock3) { | 14 | void payload(pSaveBlock1 SaveBlock1,pSaveBlock2 SaveBlock2,pSaveBlock3 SaveBlock3) { |
| 15 | // This example payload will modify the first character of the player's name. | 15 | // HoF-warp example payload! |
| 16 | // It will change to 'z'. You can see the character encoding table here: http://bulbapedia.bulbagarden.net/wiki/Character_encoding_in_Generation_III | 16 | |
| 17 | SaveBlock2[0] = 0xee; // 'z' | 17 | // Structure offsets are different between R/S, FR/LG, and Emerald. |
| 18 | // The beginning of the structures are the same but do NOT take shortcuts here, it's not good practise. | ||
| 19 | // If you want to support multiple games, make specific checks for games, use the right structure for each game. | ||
| 20 | SaveBlock1_RS* sb1rs = &SaveBlock1->rs; | ||
| 21 | SaveBlock1_FRLG* sb1frlg = &SaveBlock1->frlg; | ||
| 22 | SaveBlock1_E* sb1e = &SaveBlock1->e; | ||
| 23 | if (GAME_FRLG) { | ||
| 24 | sb1frlg->location.mapGroup = 1; // generic indoors? | ||
| 25 | sb1frlg->location.mapNum = 80; // Hall of Fame | ||
| 26 | // set coords to the same place that the champions' room script sets them to | ||
| 27 | sb1frlg->location.x = sb1frlg->pos.x = 5; | ||
| 28 | sb1frlg->location.y = sb1frlg->pos.y = 12; | ||
| 29 | sb1frlg->mapDataId = 0xDA; // from HoF map-header | ||
| 30 | sb1frlg->location.warpId = 0xff; | ||
| 31 | // make sure the HoF script doesn't crash, which it will do if 0 pokémon | ||
| 32 | if (sb1frlg->playerPartyCount == 0) { | ||
| 33 | sb1frlg->playerPartyCount = 1; | ||
| 34 | // this isn't enough, the heal animation recalculates the party count ignoring empty spots | ||
| 35 | // so let's hack together one. i don't care about it becoming a bad egg at all. | ||
| 36 | sb1frlg->playerParty[0].box.personality++; | ||
| 37 | } | ||
| 38 | return; | ||
| 39 | } else if (GAME_RS) { | ||
| 40 | sb1rs->location.mapGroup = 16; // Ever Grande City | ||
| 41 | sb1rs->location.mapNum = 11; // Hall of Fame | ||
| 42 | // set coords to the same place that the champions' room script sets them to | ||
| 43 | sb1rs->location.x = sb1rs->pos.x = 7; | ||
| 44 | sb1rs->location.y = sb1rs->pos.y = 16; | ||
| 45 | sb1rs->mapDataId = 299; // from HoF map-header | ||
| 46 | sb1rs->location.warpId = 0xff; | ||
| 47 | // make sure the HoF script doesn't crash, which it will do if 0 pokémon | ||
| 48 | if (sb1rs->playerPartyCount == 0) { | ||
| 49 | sb1rs->playerPartyCount = 1; | ||
| 50 | // this isn't enough, the heal animation recalculates the party count ignoring empty spots | ||
| 51 | // so let's hack together one. i don't care about it becoming a bad egg at all. | ||
| 52 | sb1rs->playerParty[0].box.personality++; | ||
| 53 | } | ||
| 54 | return; | ||
| 55 | } else if (GAME_EM) { | ||
| 56 | sb1e->location.mapGroup = 16; // Ever Grande City | ||
| 57 | sb1e->location.mapNum = 11; // Hall of Fame | ||
| 58 | // set coords to the same place that the champions' room script sets them to | ||
| 59 | sb1e->location.x = sb1e->pos.x = 7; | ||
| 60 | sb1e->location.y = sb1e->pos.y = 16; | ||
| 61 | sb1e->mapDataId = 298; // from HoF map-header | ||
| 62 | sb1e->location.warpId = 0xff; | ||
| 63 | // make sure the HoF script doesn't crash, which it will do if 0 pokémon | ||
| 64 | if (sb1e->playerPartyCount == 0) { | ||
| 65 | sb1e->playerPartyCount = 1; | ||
| 66 | // this isn't enough, the heal animation recalculates the party count ignoring empty spots | ||
| 67 | // so let's hack together one. i don't care about it becoming a bad egg at all. | ||
| 68 | sb1e->playerParty[0].box.personality++; | ||
| 69 | } | ||
| 70 | return; | ||
| 71 | } | ||
| 18 | } \ No newline at end of file | 72 | } \ No newline at end of file |
