const_value set 2
	const POKECENTER2F_TRADE_RECEPTIONIST
	const POKECENTER2F_BATTLE_RECEPTIONIST
	const POKECENTER2F_TIME_CAPSULE_RECEPTIONIST

PokecenterBackroom_MapScriptHeader:
.MapTriggers:
	db 4

	; triggers
	maptrigger .Trigger0
	maptrigger .Trigger1
	maptrigger .Trigger2
	maptrigger .Trigger3

.MapCallbacks:
	db 0

.Trigger1:
	priorityjump Script_LeftCableTradeCenter
.Trigger0:
	end

.Trigger2:
	priorityjump Script_LeftCableColosseum
	end

.Trigger3:
	priorityjump Script_LeftTimeCapsule
	end

LinkReceptionistScript_Trade:
	jumptextfaceplayer Text_TradeRoomClosed
	
	checkevent EVENT_LINK_OPEN
	sif false
		jumptextfaceplayer Text_TradeRoomClosed
	checkevent EVENT_NOBUS_AGGRON_IN_PARTY
	sif true
		jumptextfaceplayer Text_TradeRoomClosed
	opentext
	writetext Text_TradeReceptionistIntro
	yesorno
	sif false, then
		closetext
		end
	sendif
	special Special_SetBitsForLinkTradeRequest
	scall PokecenterBackroom_WaitSaveAndCheck
	sif false
		end
	copybytetovar wOtherPlayerLinkMode
	iffalse .LinkedToFirstGen
	special Special_CheckBothSelectedSameRoom
	iffalse PokecenterBackroom_IncompatibleRooms
	writetext Text_PleaseComeIn
	waitbutton
	closetext
	scall PokecenterBackroom_EnterRoom
	warpcheck
	end

.LinkedToFirstGen:
	special Special_FailedLinkToPast
	writetext Text_CantLinkToThePast
	special Special_CloseLink
	closetext
	end

LinkReceptionistScript_Battle:
	jumptextfaceplayer Text_BattleRoomClosed
	
	checkevent EVENT_LINK_OPEN
	sif false
		jumptextfaceplayer Text_BattleRoomClosed
	checkevent EVENT_NOBUS_AGGRON_IN_PARTY
	sif true
		jumptextfaceplayer Text_BattleRoomClosed
	opentext
	writetext Text_BattleReceptionistIntro
	yesorno
	sif false, then
		closetext
		end
	sendif
	special Special_SetBitsForBattleRequest
	scall PokecenterBackroom_WaitSaveAndCheck
	sif false
		end
	copybytetovar wOtherPlayerLinkMode
	iffalse .LinkedToFirstGen
	special Special_CheckBothSelectedSameRoom
	iffalse PokecenterBackroom_IncompatibleRooms
	writetext Text_PleaseComeIn
	waitbutton
	closetext
	scall PokecenterBackroom_EnterRoom
	warpcheck
	end

.LinkedToFirstGen:
	special Special_FailedLinkToPast
	writetext Text_CantLinkToThePast
	special Special_CloseLink
	closetext
	end

LinkReceptionistScript_TimeCapsule:
	jumptextfaceplayer Text_TimeCapsuleClosed
	
	checkflag ENGINE_TIME_CAPSULE
	sif false
		jumptextfaceplayer Text_TimeCapsuleClosed
	special Special_SetBitsForTimeCapsuleRequest
	faceplayer
	opentext
	writetext Text_TimeCapsuleReceptionistIntro
	yesorno
	sif false, then
		closetext
		end
	sendif
	special Special_CheckTimeCapsuleCompatibility
	sif =, 1
		jumptext Text_RejectNewMon
	sif =, 2
		jumptext Text_RejectMonWithNewMove
	scall PokecenterBackroom_WaitSaveAndCheck
	sif false
		end
	copybytetovar wOtherPlayerLinkMode
	iffalse .OK
	special Special_CheckBothSelectedSameRoom
	jump PokecenterBackroom_IncompatibleRooms

.OK:
	special Special_EnterTimeCapsule
	writetext Text_PleaseComeIn
	waitbutton
	closetext
	scall TimeCapsuleScript_CheckPlayerGender
	warpcheck
	end

Script_LeftCableTradeCenter:
Script_LeftCableColosseum:
	special WaitForOtherPlayerToExit
	scall Script_WalkOutOfLinkBattleRoom
	dotrigger $0
	domaptrigger BATTLE_CENTER, $0
	end

PokecenterBackroom_IncompatibleRooms:
	writetext Text_IncompatibleRooms
	special Special_CloseLink
	closetext
	end

PokecenterBackroom_WaitSaveAndCheck:
	writetext Text_PleaseWait
	special Special_WaitForLinkedFriend
	sif false, then
		special WaitForOtherPlayerToExit
		jumptext Text_FriendNotReady
	sendif
	writetext Text_MustSaveGame
	yesorno
	iffalse .did_not_save
	special Special_TryQuickSave
	sif false, then
.did_not_save
		writetext Text_PleaseComeAgain
		jump .abort_link
	sendif
	writetext Text_PleaseWait
	special Special_CheckLinkTimeout
	sif false, then
		writetext Text_LinkTimedOut
.abort_link
		special WaitForOtherPlayerToExit
		closetext
	sendif
	end

PokecenterBackroom_EnterRoom:
	applymovement2 PokeCenter2F_Movement_SlowUpLeft_LookRight
	applymovement PLAYER, PokeCenter2F_Movement_Up3
	end

Script_WalkOutOfLinkTradeRoom:
	applymovement POKECENTER2F_TRADE_RECEPTIONIST, PokeCenter2F_Movement_SlowUpLeft_LookRight
	applymovement PLAYER, PokeCenter2F_Movement_Down3
	applymovement POKECENTER2F_TRADE_RECEPTIONIST, PokeCenter2F_Movement_SlowRightDown
	end

Script_WalkOutOfLinkBattleRoom:
	applymovement POKECENTER2F_BATTLE_RECEPTIONIST, PokeCenter2F_Movement_SlowUpLeft_LookRight
	applymovement PLAYER, PokeCenter2F_Movement_Down3
	applymovement POKECENTER2F_BATTLE_RECEPTIONIST, PokeCenter2F_Movement_SlowRightDown
	end

TimeCapsuleScript_CheckPlayerGender:
	checkcode VAR_FACING
	if_equal LEFT, .MaleFacingLeft
	if_equal RIGHT, .MaleFacingRight
	applymovement2 PokeCenter2F_Movement_SlowLeft_LookDown
	applymovement PLAYER, PokeCenter2F_Movement_Up2
	end

.MaleFacingLeft:
	applymovement2 PokeCenter2F_Movement_SlowLeft_LookDown
	applymovement PLAYER, PokeCenter2F_Movement_LeftUp
	end

.MaleFacingRight:
	applymovement2 PokeCenter2F_Movement_SlowRight_LookDown
	applymovement PLAYER, PokeCenter2F_Movement_RightUp
	end

Script_LeftTimeCapsule:
	special WaitForOtherPlayerToExit
	checkflag ENGINE_KRIS_IN_CABLE_CLUB
	applymovement POKECENTER2F_TIME_CAPSULE_RECEPTIONIST, PokeCenter2F_Movement_SlowLeft_LookRight
	applymovement PLAYER, PokeCenter2F_Movement_Down2
	applymovement POKECENTER2F_TIME_CAPSULE_RECEPTIONIST, PokeCenter2F_Movement_SlowRight_LookDown
	dotrigger $0
	domaptrigger TIME_CAPSULE, $0
	end

MapPokeCenter2FSignpost0Script:
	refreshscreen $0
	special Special_DisplayLinkRecord
	closetext
	end

PokeCenter2F_Movement_Up3:
	step_up
PokeCenter2F_Movement_Up2:
	step_up
PokeCenter2F_Movement_Up:
	step_up
	step_end

PokeCenter2F_Movement_Down3:
	step_down
PokeCenter2F_Movement_Down2:
	step_down
PokeCenter2F_Movement_Down:
	step_down
	step_end

PokeCenter2F_Movement_Left:
	step_left
	step_end

PokeCenter2F_Movement_LeftUp:
	step_left
	step_up
	step_end

PokeCenter2F_Movement_Right:
	step_right
	step_end

PokeCenter2F_Movement_RightUp:
	step_right
	step_up
	step_end

PokeCenter2F_Movement_SlowRightDown:
	slow_step_right
	slow_step_down
	step_end

PokeCenter2F_Movement_SlowUpLeft_LookRight:
	slow_step_up
PokeCenter2F_Movement_SlowLeft_LookRight:
	slow_step_left
PokeCenter2F_Movement_LookRight:
	turn_head_right
	step_end

PokeCenter2F_Movement_SlowLeft_LookDown:
	slow_step_left
	turn_head_down
	step_end

PokeCenter2F_Movement_SlowRight_LookDown:
	slow_step_right
	turn_head_down
	step_end

PokeCenter2F_Movement_SlowRight_LookLeft:
	slow_step_right
	turn_head_left
	step_end

PokeCenter2F_Movement_Spin:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	step_end

PokeCenter2F_Movement_Spin_LookLeft:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_left
	step_end

PokeCenter2F_Movement_Spin_LookDown:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

Text_BattleReceptionistIntro:
	db TX_COMPRESSED, $6e, $7d, $64, $2f, $9c, $b0, $c6, $dd, $57, $d3
	db $79, $b7, $ad, $2b, $8d, $a1, $e8, $50, $83, $69, $ff

	db $00, $72, $85, $a8, $fe, $82, $8a, $f6, $ef, $a7
	db $35, $ec, $16, $33, $26, $62, $4d, $67

	db $e0, $0d, $c2, $d7, $73, $01, $05, $a9, $d1, $a9, $1c, $b0
	db $bc, $af, $6e, $fa, $74
	db $b4, $d0

Text_TradeReceptionistIntro:
	db TX_COMPRESSED, $6e, $7d, $64, $2f, $9c, $b0, $c6, $dd, $57, $d3
	db $78, $a5, $ee, $4e, $36, $99, $2c, $d7

	db $e0, $0e, $50, $b5, $1f, $d0, $52, $d7, $b9, $38, $08, $2d
	db $2d, $e0, $72, $be, $12, $44, $9a, $ce, $54, $3b
	db $4a, $ad, $98, $2c, $66, $4c

	db $f8, $03, $70, $b5, $dc, $c0, $41, $6a, $74, $6a, $47, $2c
	db $2f, $5a, $f7, $27
	db $4b, $4d

Text_TimeCapsuleReceptionistIntro:
	db TX_COMPRESSED, $6e, $7d, $64, $2f, $9c, $b0, $c6, $dd, $57, $d3
	db $79, $b7, $ad, $2b, $85, $0d, $f3, $8d, $ba, $21, $0d, $74

	db $fc, $01, $ca, $16, $a3, $3a, $49, $6b, $d0, $63, $ec, $b0
	db $bd, $69, $38, $23, $51, $73, $49, $99, $6b, $dc
	db $9a, $a0, $41, $69, $70, $1c, $af, $84, $9e

	db $00, $dc, $2d, $77, $30, $10, $5a, $9d, $1a, $91, $cb
	db $0b, $d6, $bd, $c9, $cd, $65, $61, $42, $25, $8d, $f3, $a5
	db $a6, $80

Text_FriendNotReady:
	db TX_COMPRESSED, $72, $85, $a5, $cc, $16, $33, $26, $60, $d1, $08, $1b
	db $79, $67, $b9, $05
	db $e0, $73

Text_MustSaveGame:
	db TX_COMPRESSED, $12, $3c, $02, $b3, $81, $10, $64, $19, $39, $96, $93
	db $7b, $a3, $22, $97, $e0, $20, $b5, $1f, $69
	db $16, $a9, $1a, $0c, $70, $10, $5a, $5c, $e7, $5f, $3f
	db $53, $40

Text_PleaseWait:
	db TX_COMPRESSED, $e1, $e9, $ea, $0e, $55, $a3, $bf
	db $53, $40

Text_LinkTimedOut:
	db TX_COMPRESSED, $29, $27, $3a, $32, $29, $44, $ea, $22, $b3, $32
	db $3c, $cf, $42, $83, $cc, $56, $6c, $eb, $48, $38, $1c
	db $15, $0c, $9a, $cd, $8c, $18, $76, $0b

	db $c0, $38, $7a, $7a, $83, $8c, $84, $97, $ac
	db $db, $c0, $82, $d2, $e6, $0b, $19, $93, $33, $49
	db $95, $4c, $85, $f3, $9b, $ce, $8c, $9e
	db $07, $30

Text_PleaseComeAgain:
	db TX_COMPRESSED, $e1, $e9, $ea, $0e, $32, $17, $ce, $6f, $3a, $32
	db $78, $1c, $c0

Text_PleaseComeIn:
	db TX_COMPRESSED, $e1, $e9, $ea, $0e, $32, $17, $ce, $0c, $9e
	db $07, $30

Text_TemporaryStagingInLinkRoom:
	db TX_COMPRESSED, $6e, $6e, $1e, $c1, $0d, $5c, $04, $16, $a0
	db $c8, $f5, $a4, $e7, $46, $45, $28, $b0, $85, $f9, $80
	db $56, $aa, $d2, $72, $c6, $f9, $c5, $66, $32, $73
	db $ea, $68

Text_CantLinkToThePast:
	db TX_COMPRESSED, $72, $85, $a8, $ce, $92, $99, $3a, $32, $29, $4b
	db $0b, $d6, $93, $82, $35, $17, $12, $6b, $3f
	db $03, $98

Text_IncompatibleRooms:
	db TX_COMPRESSED, $74, $46, $42, $f8, $8d, $b1, $ab, $e9, $c5, $84, $2f
	db $a1, $ea, $8d, $67, $19, $48, $50, $64
	db $f0, $39, $80

Text_PleaseEnter:
	db TX_COMPRESSED, $e1, $e9, $ea, $0e, $19, $2c, $d7
	db $e0, $73

Text_RejectNewMon:
	db TX_COMPRESSED, $50, $15, $ac, $14, $03, $01, $c8
	db $79, $9d, $25, $32, $2b, $39, $7a, $a4, $64
	db $f5, $34

Text_RejectMonWithNewMove:
	db TX_COMPRESSED, $72, $85, $a8, $ce, $92, $99, $2f, $54, $8e, $5a
	db $4d, $e0, $72, $25, $43, $b4, $cd
	db $54, $0e, $4f
	db $a9, $a0

Text_TimeCapsuleClosed:
	db TX_COMPRESSED, $74, $59, $10, $15, $ac, $14, $03, $2d
	db $26, $f1, $43, $7c, $e3, $6e, $88, $43, $5d, $38, $34
	db $2a, $56, $63, $27, $33, $73, $4e, $34, $8b, $3c
	db $fa, $9a

Text_TradeRoomClosed:
	db TX_COMPRESSED, $74, $59, $10, $15, $ac, $14, $03, $2d
	db $26, $f1, $4b, $dc, $9c, $15, $d6, $52, $32, $1c, $1a
	db $15, $2b, $31, $93, $99, $b9, $a7, $1a, $45, $9e
	db $7d, $4d

Text_BattleRoomClosed:
	db TX_COMPRESSED, $74, $59, $10, $15, $ac, $14, $03, $2d
	db $26, $f0, $96, $dd, $f4, $e0, $ae, $b2, $91, $90, $e0
	db $d0, $a9, $59, $8c, $9c, $cd, $cd, $38, $d2, $2c, $f3
	db $ea, $68

Text_OhPleaseWait:
	db TX_COMPRESSED, $76, $9f, $c1, $1d, $3d, $41, $ca, $b4, $77
	db $ea, $68

Text_ChangeTheLook:
	db TX_COMPRESSED, $6e, $70, $86, $79, $96, $18, $ca, $74, $9c
	db $9b, $d6, $93, $9d, $08, $54, $a2, $4d, $67, $4f
	db $05, $34

Text_LikeTheLook:
	db TX_COMPRESSED, $62, $1a, $a6, $42, $68, $96, $91
	db $a1, $e4, $58, $2e, $9c, $e8, $42, $a5, $2c, $30, $10, $5a, $a5
	db $a6, $80

PokecenterBackroom_MapEventHeader:: db 0, 0

.Warps: db 5
	warp_def 7, 7, -1, POKECENTER_BACKROOM
	warp_def 0, 3, 1, TRADE_CENTER
	warp_def 0, 11, 1, BATTLE_CENTER
	warp_def 2, 7, 1, TIME_CAPSULE
	warp_def 7, 8, -1, POKECENTER_BACKROOM

.CoordEvents: db 0

.BGEvents: db 1
	signpost 3, 7, SIGNPOST_READ, MapPokeCenter2FSignpost0Script

.ObjectEvents: db 3
	person_event SPRITE_LINK_RECEPTIONIST, 2, 3, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, (1 << 3) | PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LinkReceptionistScript_Trade, -1
	person_event SPRITE_LINK_RECEPTIONIST, 2, 11, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, (1 << 3) | PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LinkReceptionistScript_Battle, -1
	person_event SPRITE_LINK_RECEPTIONIST, 3, 7, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, (1 << 3) | PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LinkReceptionistScript_TimeCapsule, -1

