kep-hack/scripts/PokemonTower2F.asm
May Evans 0226ba9579 Pikachu/Eevee Mode
So some bits of this are untested, but the base starters are unaffected. I had to work a lot with the sprite limits so Oak's lab has been changed a bit.

This adds a Pikachu and Eevee "mode" to the game, allowing you to pick them as starters. When doing so, the Rival will always pick the opposite.

There are some glitches;
- Picking Charmander makes Blue erase himself from existence
- Picking from anywhere other than the front of the table may have odd results.
- Oak has to be shown in the lab at the start from now on for some reason; side effect of removing the dexes, there's definitely a fix for this.
These are from me not finishing the ball picking process - it was a little weird.

Parties based on starters have been updated but I had to cut out a lot of unused trainer slots.

Also the unused names were removed.
2023-03-25 16:02:23 +00:00

208 lines
3.9 KiB
NASM

PokemonTower2F_Script:
call EnableAutoTextBoxDrawing
ld hl, PokemonTower2F_ScriptPointers
ld a, [wPokemonTower2FCurScript]
jp CallFunctionInTable
PokemonTower2Script_604fe:
xor a
ld [wJoyIgnore], a
ld [wPokemonTower2FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower2F_ScriptPointers:
dw PokemonTower2Script0
dw PokemonTower2Script1
dw PokemonTower2Script2
PokemonTower2Script0:
IF DEF(_DEBUG)
call DebugPressedOrHeldB
ret nz
ENDC
CheckEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
ret nz
ld hl, CoordsData_6055e
call ArePlayerCoordsInArray
ret nc
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
call PlaySound
ld c, BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ResetEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
ld a, [wCoordIndex]
cp $1
ld a, PLAYER_DIR_UP
ld b, SPRITE_FACING_DOWN
jr nz, .asm_60544
; the rival is on the left side and the player is on the right side
SetEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
ld a, PLAYER_DIR_LEFT
ld b, SPRITE_FACING_RIGHT
.asm_60544
ld [wPlayerMovingDirection], a
ld a, $1
ldh [hSpriteIndex], a
ld a, b
ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ldh [hJoyHeld], a
ldh [hJoyPressed], a
ret
CoordsData_6055e:
dbmapcoord 15, 5
dbmapcoord 14, 6
db -1 ; fixes coord termination which can have adverse effects
PokemonTower2Script1:
ld a, [wIsInBattle]
cp $ff
jp z, PokemonTower2Script_604fe
xor a
ld [wIsTrainerBattle], a
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
ld a, $1
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld de, MovementData_605b2
CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
jr nz, .asm_60589
ld de, MovementData_605a9
.asm_60589
ld a, $1
ldh [hSpriteIndex], a
call MoveSprite
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
call PlaySound
farcall Music_RivalAlternateStart
ld a, $2
ld [wPokemonTower2FCurScript], a
ld [wCurMapScript], a
ret
MovementData_605a9:
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db -1 ; end
MovementData_605b2:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
PokemonTower2Script2:
ld a, [wd730]
bit 0, a
ret nz
ld a, HS_POKEMON_TOWER_2F_RIVAL
ld [wMissableObjectIndex], a
predef HideObject
xor a
ld [wJoyIgnore], a
call PlayDefaultMusic
ld a, $0
ld [wPokemonTower2FCurScript], a
ld [wCurMapScript], a
ret
PokemonTower2F_TextPointers:
dw PokemonTower2Text1
dw PokemonTower2Text2
PokemonTower2Text1:
text_asm
CheckEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
jr z, .asm_16f24
ld hl, PokemonTower2Text_6063c
call PrintText
jr .asm_41852
.asm_16f24
ld hl, PokemonTower2Text_6062d
call PrintText
ld hl, wd72d
set 6, [hl]
set 7, [hl]
ld hl, PokemonTower2Text_60632
ld de, PokemonTower2Text_60637
call SaveEndBattleTextPointers
ld a, OPP_RIVAL2
ld [wCurOpponent], a
; select which team to use during the encounter
ld a, [wRivalStarter]
cp STARTER1
jr nz, .NotSquirtle
ld a, $6
jr .done
.NotSquirtle
cp STARTER3
jr nz, .Charmander
ld a, $7
jr .done
.Charmander
cp STARTER2 ; changes start here
ld a, $8
jr nz, .Pikachu
jr .done
.Pikachu ;
cp STARTER4
jr nz, .Eevee
ld a, $9
jr .done
.Eevee
ld a, $10
jr .done
.done
ld [wTrainerNo], a
ld a, 1
ld [wIsTrainerBattle], a
ld a, $1
ld [wPokemonTower2FCurScript], a
ld [wCurMapScript], a
.asm_41852
jp TextScriptEnd
PokemonTower2Text_6062d:
text_far _PokemonTower2Text_6062d
text_end
PokemonTower2Text_60632:
text_far _PokemonTower2Text_60632
text_end
PokemonTower2Text_60637:
text_far _PokemonTower2Text_60637
text_end
PokemonTower2Text_6063c:
text_far _PokemonTower2Text_6063c
text_end
PokemonTower2Text2:
text_far _PokemonTower2Text2
text_end