@ Intro Hyrule Town NPC4E
SCRIPT_START script_Npc4EIntroTown
.ifdef JP
	CheckLocalFlag 0x00ca
.else
.ifdef EU
	CheckLocalFlag 0x00ca
.else
.ifdef DEMO_JP
	CheckLocalFlag 0x00ca @ TODO deduplicate
.else
	CheckLocalFlag 0x00cd
.endif
.endif
.endif
	JumpIf script_0800FA4C
	SetPlayerIdle
	Call sub_0807DF28
	SetEntityPositionRelative 0x00c8, 0x0148
	Call sub_0807F844
	SetFadeTime 0x0002
	SetFade6
	WaitForFadeFinish
	StartPlayerScript script_PlayerIntro1
	SetSyncFlag 0x00000002
	_0807F0B4 0x0001
	SetEntityPositionRelative 0x00c8, 0x0218
	Call WaitForCameraTouchRoomBorder
	Wait 0x0064
	@ Camera reaches center of town square
	_0807F0B4 0x0002
	SetEntityPositionRelative 0x00c8, 0x0368
	Call WaitForCameraTouchRoomBorder
	WaitForSyncFlagAndClear 0x00000001
	WaitForSyncFlagAndClear 0x00000004
	@ First message from Zelda
	MessageFromTargetPos 0x2501, 0x0000
	WaitUntilTextboxCloses
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	@ Zelda ran off. Give control to the player
	_0807F0B4 0x0004
	CameraTargetPlayer
	Call sub_0807DF50
	EnablePlayerControl
	SetSyncFlag 0x00000010
	WaitForSyncFlagAndClear 0x00000004
	SetPlayerIdle
	Call sub_0807DF28
	StartPlayerScript script_PlayerIntro2
	WaitForSyncFlagAndClear 0x00000001
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	MessageFromTargetPos 0x2503, 0x000e
	WaitUntilTextboxCloses
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	Call sub_0807DF50
	EnablePlayerControl
	WaitForSyncFlagAndClear 0x00000004
	SetPlayerIdle
	Call sub_0807DF28
	StartPlayerScript script_PlayerIntro3
	WaitForSyncFlagAndClear 0x00000001
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	MessageFromTargetPos 0x2504, 0x000e
	WaitUntilTextboxCloses
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	Call sub_0807DF50
	EnablePlayerControl
	WaitForSyncFlagAndClear 0x00000004
	SetPlayerIdle
	Call sub_0807DF28
	StartPlayerScript script_PlayerIntro4
	WaitForSyncFlagAndClear 0x00000001
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	MessageFromTargetPos 0x2505, 0x000e
	WaitUntilTextboxCloses
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	Call sub_0807DF50
	EnablePlayerControl
	@ Wait for Link at Pina
	WaitForSyncFlagAndClear 0x00000004
	SetPlayerIdle
	Call sub_0807DF28
	Call sub_08063C5C
	PlaySound SFX_CUCCO_MINIGAME_BELL
	Wait 0x001e
	_0807E8E4_0
	Call CreatePlayerExclamationMark
	Wait 0x003c
	MessageFromTargetPos 0x1021, 0x000e
	WaitUntilTextboxCloses
	StartPlayerScript script_PlayerIntro5
	SetEntityPositionRelative 0x00f0, 0x0258
	_0807F0B4 0x0001
	CameraTargetEntity
	Wait 0x001e
	Call sub_08063C2C
	WaitForSyncFlagAndClear 0x00000001
	MessageFromTargetPos 0x1022, 0x000e
	WaitUntilTextboxCloses
	_0807E8E4_0 
	Call sub_08063C14
	Call sub_08094CDC
	Wait 0x001e
	MessageFromTargetPos 0x1023, 0x000e
	WaitUntilTextboxCloses
	Call sub_08063C14
	Call sub_08094DD8
	Wait 0x001e
	MessageFromTargetPos 0x1024, 0x000e
	WaitUntilTextboxCloses
	Call sub_08063C14
	Call sub_08094D34
	Wait 0x001e
	MessageFromTargetPos 0x1025, 0x000e
	WaitUntilTextboxCloses
	Call sub_08063C5C
	MessageFromTargetPos 0x1026, 0x000e
	WaitUntilTextboxCloses
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	_0807E8E4_1
	Call sub_08063C2C
	MessageFromTargetPos 0x1027, 0x0000
	WaitUntilTextboxCloses
	Call sub_08063C74
	Wait 0x003c
	Call sub_08063C14
	_0807E8E4_0 
	MessageFromTargetPos 0x1028, 0x000e
	WaitUntilTextboxCloses
	_0807E8E4_1 
	MessageFromTargetPos 0x1029, 0x0000
	WaitUntilTextboxCloses
	_0807E8E4_0 
	MessageFromTargetPos 0x102a, 0x000e
	WaitUntilTextboxCloses
	Call sub_08063C14
	Call sub_08094D70
	PlaySound SFX_103
	SetSyncFlag 0x00000002
	WaitForSyncFlagAndClear 0x00000004
	Call sub_08063C14
	Call sub_08094D10
	Wait 0x001e
	Call sub_08094E0C
	Wait 0x001e
	_0807E8E4_1
	Call CreatePlayerExclamationMark
	Wait 0x003c
	MessageFromTargetPos 0x102b, 0x0000
	WaitUntilTextboxCloses
	@ Give the shield to the player
	GivePlayerItem 0x000d
	WaitPlayerGetItem
	Call NPC4E_SaveEquippedItems
	Call SetPlayerActionNormal
	CallWithArg EquipItem, 0x0000000d
	SetIntVariable 0x000000ff
	Call sub_0807F5B0
	CallWithArg sub_0807F29C, gUnk_080049D6
	Wait 0x00b7
	SetIntVariable 0x00000000
	Call sub_0807F5B0
	MessageFromTargetPos 0x102c, 0x0000
	WaitUntilTextboxCloses
	@ Give control back to the player
	CallWithArg sub_0807F29C, 0x00000000
	Call NPC4E_RestoreEquippedItems
	_0807F0B4 0x0004
	CameraTargetPlayer
	Wait 0x000a
	SetSyncFlag 0x00000002
	Call sub_08063C44
.ifdef JP
	SetLocalFlag 0x00ca
.else
.ifdef EU
	SetLocalFlag 0x00ca
.else
.ifdef DEMO_JP
	SetLocalFlag 0x00ca @ TODO deduplicate
.else
	SetLocalFlag 0x00cd
.endif
.endif
.endif
	Call sub_0807DF50
	EnablePlayerControl
script_0800FA4C:
	DoPostScriptAction 0x0006
SCRIPT_END
	.2byte 0x0000
