Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Changing the spawn after the halloffame script in pokecrystal

#1 2018-12-05 16:46:11

Eldaryon
New member
Registered: 2018-06-11
Post 2/2

Changing the spawn after the halloffame script in pokecrystal

Hey guys,
I've been looking into it but I can't seem to find where does the game choose where the player spawns after the halloffame script.
has anyone tried to do so and succeded?

Offline

#2 2018-12-05 22:25:38

Rangi
Member
Registered: 2016-05-09
Post 870/870

Re: Changing the spawn after the halloffame script in pokecrystal

TL;DR: Edit engine/menus/intro_menu.asm and change SPAWN_NEW_BARK in .SpawnAfterE4 to whatever other spawn value you want from constants/map_data_constants.asm. You can do the same with SPAWN_MT_SILVER in SpawnAfterRed to affect where you spawn after beating Red.

--------------------------------------------------------------------------------

There are two relevant flags defined in wram.asm:

wDefaultSpawnpoint, which defaults to zero but can be set to a spawn location from constants/map_data_constants.asm; and
wSpawnAfterChampion, which defaults to zero but can be set to the values defined in constants/wram_constants.asm (SPAWN_LANCE or SPAWN_RED).

The code that alters wSpawnAfterChampion is in engine/events/halloffame.asm. When you enter the Hall of Fame it calls HallOfFame, which sets wSpawnAfterChampion to SPAWN_LANCE; and when you beat Red it calls RedCredits, which sets wSpawnAfterChampion to SPAWN_RED.

Then the credits play and the game restarts. The "New Game / Continue / Options / Mystery Gift" menu code is in engine/menus/intro_menu.asm. When you choose to Continue, it calls Continue, which checks for SPAWN_LANCE:

ld a, [wSpawnAfterChampion]
cp SPAWN_LANCE
jr z, .SpawnAfterE4

And later jumps to FinishContinueFunction, which checks for SPAWN_RED:

ld a, [wSpawnAfterChampion]
cp SPAWN_RED
jr z, .AfterRed
.AfterRed:
    call SpawnAfterRed

Those two subroutines, .SpawnAfterE4 and SpawnAfterRed, set wDefaultSpawnpoint to the values that determine where you appear (and reset wSpawnAfterChampion to zero):

.SpawnAfterE4:
    ld a, SPAWN_NEW_BARK
    ld [wDefaultSpawnpoint], a
    call PostCreditsSpawn
    jp FinishContinueFunction

SpawnAfterRed:
    ld a, SPAWN_MT_SILVER
    ld [wDefaultSpawnpoint], a

PostCreditsSpawn:
    xor a
    ld [wSpawnAfterChampion], a
    ld a, MAPSETUP_WARP
    ldh [hMapEntryMethod], a
    ret

Anyway, just change SPAWN_NEW_BARK and SPAWN_MT_SILVER to whatever spawn values you want for after beating Lance and Red. You could even write extra logic to check wSpawnAfterChampion for other values besides SPAWN_LANCE or SPAWN_RED, if you wanted a third such location.

Last edited by Rangi (2018-12-05 22:31:21)


Pokémon Polished Crystal (GitHub) — version 2.2.0 released
Pokémon Red★ and Blue★: Space World Edition (GitHub) — updated August 19!
Polished Map: pokered+pokecrystal map, tileset, and palette editor — version 3.5.1 released!

Offline

  • Index
  • → Help/Question
  • → Changing the spawn after the halloffame script in pokecrystal

Board footer

Powered by FluxBB