shithub: pokered

ref: 2a529796374f3798fb507931a7c8a9bad4281107
dir: /scripts/ssanne2.asm/

View raw version
SSAnne2Script: ; 6139f (18:539f)
	call EnableAutoTextBoxDrawing
	ld hl, SSAnne2ScriptPointers
	ld a, [wSSAnne2CurScript]
	jp CallFunctionInTable

SSAnne2Script_613ab: ; 613ab (18:53ab)
	xor a
	ld [wJoyIgnore], a
	ld [wSSAnne2CurScript], a
	ret

SSAnne2ScriptPointers: ; 613b3 (18:53b3)
	dw SSAnne2Script0
	dw SSAnne2Script1
	dw SSAnne2Script2
	dw SSAnne2Script3
	dw SSAnne2Script4

SSAnne2Script4: ; 613bd (18:53bd)
	ret

SSAnne2Script0: ; 613be (18:53be)
	ld hl, CoordsData_61411
	call ArePlayerCoordsInArray
	ret nc
	ld a, $ff
	ld [wNewSoundID], a
	call PlaySound
	ld c, BANK(Music_MeetRival)
	ld a, MUSIC_MEET_RIVAL
	call PlayMusic
	ld a, [wCoordIndex]
	ld [$ffdb], a
	ld a, HS_SS_ANNE_2_RIVAL
	ld [wMissableObjectIndex], a
	predef ShowObject
	call Delay3
	ld a, $2
	ld [H_SPRITEINDEX], a
	call SetSpriteMovementBytesToFF
	xor a
	ld [hJoyHeld], a
	ld a, $f0
	ld [wJoyIgnore], a
	ld a, [$ffdb]
	cp $2
	jr nz, .asm_61400
	ld de, MovementData_6140c
	jr .asm_61403
.asm_61400
	ld de, MovementData_6140d
.asm_61403
	call MoveSprite
	ld a, $1
	ld [wSSAnne2CurScript], a
	ret

MovementData_6140c: ; 6140c (18:540c)
	db NPC_MOVEMENT_DOWN

MovementData_6140d: ; 6140d (18:540d)
	db NPC_MOVEMENT_DOWN
	db NPC_MOVEMENT_DOWN
	db NPC_MOVEMENT_DOWN
	db $FF

CoordsData_61411: ; 61411 (18:5411)
	db $08,$24
	db $08,$25
	db $FF

SSAnne2Script_61416: ; 61416 (18:5416)
	ld a, [wXCoord]
	cp $25
	jr nz, .asm_61426
	ld a, PLAYER_DIR_LEFT
	ld [wPlayerMovingDirection], a
	ld a, SPRITE_FACING_RIGHT
	jr .asm_61427
.asm_61426
	xor a ; SPRITE_FACING_DOWN
.asm_61427
	ld [hSpriteFacingDirection], a
	ld a, $2
	ld [H_SPRITEINDEX], a
	jp SetSpriteFacingDirectionAndDelay

SSAnne2Script1: ; 61430 (18:5430)
	ld a, [wd730]
	bit 0, a
	ret nz
	call SSAnne2Script_61416
	xor a
	ld [wJoyIgnore], a
	ld a, $2
	ld [hSpriteIndexOrTextID], a
	call DisplayTextID
	call Delay3
	ld a, OPP_SONY2
	ld [wCurOpponent], a

	; select which team to use during the encounter
	ld a, [wRivalStarter]
	cp STARTER2
	jr nz, .NotSquirtle
	ld a, $1
	jr .done
.NotSquirtle
	cp STARTER3
	jr nz, .Charmander
	ld a, $2
	jr .done
.Charmander
	ld a, $3
.done
	ld [wTrainerNo], a

	call SSAnne2Script_61416
	ld a, $2
	ld [wSSAnne2CurScript], a
	ret

SSAnne2Script2: ; 6146d (18:546d)
	ld a, [wIsInBattle]
	cp $ff
	jp z, SSAnne2Script_613ab
	call SSAnne2Script_61416
	ld a, $f0
	ld [wJoyIgnore], a
	ld a, $3
	ld [hSpriteIndexOrTextID], a
	call DisplayTextID
	ld a, $2
	ld [H_SPRITEINDEX], a
	call SetSpriteMovementBytesToFF
	ld a, [wXCoord]
	cp $25
	jr nz, .asm_61497
	ld de, MovementData_614b9
	jr .asm_6149a
.asm_61497
	ld de, MovementData_614b7
.asm_6149a
	ld a, $2
	ld [H_SPRITEINDEX], a
	call MoveSprite
	ld a, $ff
	ld [wNewSoundID], a
	call PlaySound
	callba Music_RivalAlternateStart
	ld a, $3
	ld [wSSAnne2CurScript], a
	ret

MovementData_614b7: ; 614b7 (18:54b7)
	db NPC_MOVEMENT_RIGHT
	db NPC_MOVEMENT_DOWN

MovementData_614b9: ; 614b9 (18:54b9)
	db NPC_MOVEMENT_DOWN
	db NPC_MOVEMENT_DOWN
	db NPC_MOVEMENT_DOWN
	db NPC_MOVEMENT_DOWN
	db $FF

SSAnne2Script3: ; 614be (18:54be)
	ld a, [wd730]
	bit 0, a
	ret nz
	xor a
	ld [wJoyIgnore], a
	ld a, HS_SS_ANNE_2_RIVAL
	ld [wMissableObjectIndex], a
	predef HideObject
	call PlayDefaultMusic
	ld a, $4
	ld [wSSAnne2CurScript], a
	ret

SSAnne2TextPointers: ; 614db (18:54db)
	dw SSAnne2Text1
	dw SSAnne2Text2
	dw SSAnne2Text3

SSAnne2Text1: ; 614e1 (18:54e1)
	TX_FAR _SSAnne2Text1
	db "@"

SSAnne2Text2: ; 614e6 (18:54e6)
	TX_ASM
	ld hl, SSAnneRivalBeforeBattleText
	call PrintText
	ld hl, wd72d
	set 6, [hl]
	set 7, [hl]
	ld hl, SSAnneRivalDefeatedText
	ld de, SSAnneRivalWonText
	call SaveEndBattleTextPointers
	jp TextScriptEnd

SSAnneRivalBeforeBattleText: ; 61500 (18:5500)
	TX_FAR _SSAnneRivalBeforeBattleText
	db "@"

SSAnneRivalDefeatedText: ; 61505 (18:5505)
	TX_FAR _SSAnneRivalDefeatedText
	db "@"

SSAnneRivalWonText: ; 6150a (18:550a)
	TX_FAR _SSAnneRivalWonText
	db "@"

SSAnne2Text3: ; 6150f (18:550f)
	TX_FAR _SSAnneRivalCaptainText
	db "@"