TrainStationScript::
	mapregion
	scriptstartasm
	ld a, [hScriptVar]
	ld [wScriptBuffer], a
	ld b, a
	ld c, 0
	ld hl, wTrainStationMenuItems
	ld a, 4
	ld [hli], a
.loop
	ld a, c
	cp b
	jr z, .skip
	ld [hli], a
.skip
	inc a
	ld c, a
	cp 5
	jr c, .loop
	ld [hl], $ff
	xor a
	ld [wWhichIndexSet], a
	scriptstopasm
	opentext
	writetext .magnet_train_greetings_text
	loadmenudata .MenuDataHeader
	verticalmenu
	closewindow
	sif >, 3, then
		closetext
		end
	sendif
	sif >, 1, then
		pushvar
		checkitem MAGNET_PASS
		sif false, then
			popvar
			jumptext .need_pass_text
		sendif
		popvar
	sendif
	writetext .enter_train_text
	closetext
	applymovement 2, .employee_enter_train
	applymovement 0, .player_enter_train
	playmusic MUSIC_MAGNET_TRAIN
	pushvar
	comparevartobyte wScriptBuffer ; var = destination, byte = source
	special Special_MagnetTrain
	wait 14
	popvar
	callasm ForceMapMusicRestart
	loadarray .MagnetTrainDestinationMapsArray
	cmdwitharrayargs
	db warp_command, %1, 0, 11, 6
	endcmdwitharrayargs
	applymovement 2, .employee_exit_train
	applymovement 0, .player_exit_train
	applymovement 2, .employee_walk_back
	mapnametotext 0
	getnthstring .Strings, 0
	jumptext .arrived_in_city_text

.MenuDataHeader:
	db $40 ; flags
	db 01, 10 ; start coords
	db 11, 19 ; end coords
	dw .MenuData2
	db 1 ; default option

.MenuData2:
	db $80
	db 0
	dw wTrainStationMenuItems
	dw PlaceMenuStrings
	dw .Strings

.Strings:
	db "Naljo@"
	db "Rijon@"
	db "Johto@"
	db "Kanto@"
	db "Cancel@"

.MagnetTrainDestinationMapsArray:
	map TORENIA_MAGNET_TRAIN
.MagnetTrainDestinationMapsArrayEntrySizeEnd:
	map BOTAN_MAGNET_TRAIN
	map GOLDENROD_MAGNET_TRAIN
	map SAFFRON_MAGNET_TRAIN

.employee_enter_train
	step_up
	step_up
	step_left
	step_end

.player_enter_train
	step_up
	step_up
	step_up
	step_up
	step_left
	step_left
	step_left
	step_up
	step_end

.employee_exit_train
	step_down
	step_left
	step_end

.player_exit_train
	step_left
	step_left
	step_down
	step_down
	step_down
	step_down
	step_down
	turn_head_up
	step_end

.employee_walk_back
	step_right
	step_up
	turn_head_down
	step_end

.magnet_train_greetings_text
	ctxt "Hello."

	para "Where do you want"
	line "to go?"
	prompt

.enter_train_text
	ctxt "OK, please enter"
	line "the magnet train."
	sdone

.need_pass_text
	ctxt "You need a Magnet"
	line "Pass to go there."
	done

.arrived_in_city_text
	ctxt "Welcome to"
	line "<STRBF3>,"
	cont "<STRBF1>."
	done