	const_def 2 ; object constants
	const DAWN_TOWN_GYM_SCIENTIST
	const DAWN_TOWN_GYM_GRUNT1
	const DAWN_TOWN_GYM_GRUNT2
	const DAWN_TOWN_GYM_GRUNT3
	const DAWN_TOWN_GYM_GRUNT4
	const DAWN_TOWN_GYM_GRUNT5
	const DAWN_TOWN_GYM_LEADER
	const DAWN_TOWN_GYM_ALAKAZAM

DawnTownGym_MapScripts:
	db 3 ; scene scripts
	scene_script .DummyScript   ; SCENE_DAWN_TOWN_GYM_DEFAULT
	scene_script .DummyScript   ; SCENE_DAWN_TOWN_GYM_FINISHED
	scene_script .CreditsScript ; SCENE_DAWN_TOWN_GYM_CREDITS
        db 2 ; callbacks
	callback MAPCALLBACK_TILES, .CloseGymGates
	callback MAPCALLBACK_OBJECTS, .ResetGymTrainers

.CloseGymGates:
        checkevent EVENT_BEAT_AZMOV
        iftrue .Skip
        changeblock 14, 12, $0D
        changeblock  8, 12, $23
	return

.ResetGymTrainers:
        checkevent EVENT_BEAT_AZMOV
        iftrue .Skip
	clearevent EVENT_BEAT_GYM_GRUNT1
	clearevent EVENT_BEAT_GYM_GRUNT2
	clearevent EVENT_BEAT_GYM_GRUNT3
	clearevent EVENT_BEAT_GYM_GRUNT4
	clearevent EVENT_BEAT_GYM_GRUNT5
	return

.Skip:
	return

.DummyScript:
	end

.CreditsScript:
	setevent EVENT_GYM_BUGSY_VISIBLE
	setscene SCENE_DAWN_TOWN_GYM_FINISHED
	applymovement PLAYER, .CreditsMovement1
	opentext
	writetext .CreditsText1
	waitbutton
	turnobject PLAYER, DOWN
	showemote EMOTE_SHOCK, PLAYER, 20
	writetext .CreditsText2
	waitbutton
	closetext
	showemote EMOTE_HEART, PLAYER, 20
	pause 10
	applymovement PLAYER, .CreditsMovement2
	special HealParty
	special FadeBlackQuickly
	refreshscreen
	credits
	end
.CreditsMovement1:
	step RIGHT
	step_end
.CreditsText1:
	text "Sheeeeesh!"
	line "What a nightmare!"
	done
.CreditsText2:
	text "Oh, you're still"
	line "there!"
	para "Thanks for joining"
	line "me on this short"
	cont "adventure!"
	para "It was a lot of"
	line "fun, and I hope"
	cont "you enjoyed it!"
	para "See you next time!"
	done
.CreditsMovement2:
	turn_head LEFT
	step_sleep 15
	turn_head UP
	step_sleep 15
	turn_head RIGHT
	step_sleep 10
	turn_head DOWN
	step_sleep 5
	turn_head LEFT
	step_sleep 5
	turn_head UP
	step_sleep 5
	rept 5
		turn_head RIGHT
		turn_head DOWN
		turn_head LEFT
		turn_head UP
		endr
	hide_object
	step_end

DawnTownGymLeader:
	jump DawnTownGymBattleCutScene

DawnTownGymCutScenePos1:
	applymovement PLAYER, DawnTownGymCutSceneMove.Pos1
	jump DawnTownGymBattleCutScene
	end
DawnTownGymCutScenePos2:
	applymovement PLAYER, DawnTownGymCutSceneMove.Pos2
	jump DawnTownGymBattleCutScene
	end
DawnTownGymCutScenePos3:
	applymovement PLAYER, DawnTownGymCutSceneMove.Pos3
	jump DawnTownGymBattleCutScene
	end

DawnTownGymCutSceneMove:
.Pos1:
	step RIGHT
.Pos2:
	step RIGHT
.Pos3:
	step UP
	step_end

DawnTownGymBattleCutScene:
	turnobject DAWN_TOWN_GYM_LEADER, DOWN
	showemote EMOTE_SHOCK, DAWN_TOWN_GYM_LEADER, 15
	opentext
	writetext .LeaderText1
	waitbutton
	turnobject DAWN_TOWN_GYM_LEADER, LEFT
	turnobject DAWN_TOWN_GYM_ALAKAZAM, RIGHT
	writetext .LeaderText2
	waitbutton
	closetext
	turnobject DAWN_TOWN_GYM_LEADER, DOWN
	applymovement DAWN_TOWN_GYM_ALAKAZAM, .MoveAlakazamDown
	opentext
	writetext .AlakazamText
	waitbutton
	closetext
	special FadeBlackQuickly
	applymovement PLAYER, .HidePlayer
	disappear DAWN_TOWN_GYM_LEADER
	disappear DAWN_TOWN_GYM_ALAKAZAM
	moveobject DAWN_TOWN_GYM_LEADER, 4, 9
	moveobject DAWN_TOWN_GYM_ALAKAZAM, 5, 9
	special FadeInQuickly
	applymovement PLAYER, .MoveCamera
	pause 20
	special FadeBlackQuickly
	applymovement PLAYER, .ShowPlayer
	appear DAWN_TOWN_GYM_LEADER
	appear DAWN_TOWN_GYM_ALAKAZAM
	turnobject DAWN_TOWN_GYM_LEADER, DOWN
	turnobject DAWN_TOWN_GYM_ALAKAZAM, DOWN
	applymovement PLAYER, .ShowPlayer
	special FadeInQuickly
	showemote EMOTE_SHOCK, PLAYER, 15
	applymovement PLAYER, .SkyfallPlayer
	pause 30
        opentext
        writetext .PatheticText
        waitbutton
	closetext
	applymovement DAWN_TOWN_GYM_LEADER, .JumpDown
	applymovement DAWN_TOWN_GYM_ALAKAZAM, .JumpDown
	warpcheck
	end

.HidePlayer:
	hide_object
	step_end
.ShowPlayer:
	show_object
	step_end
.MoveAlakazamDown:
	step DOWN
	turn_head RIGHT
	step_end
.SkyfallPlayer:
	skyfall_top
	turn_head RIGHT
	step_end
.JumpDown:
	jump_step DOWN
	hide_object
	step_end

.MoveCamera:
	slow_step RIGHT
	rept 6
		slow_step DOWN
		endr
	turn_head UP
	step_end

.LeaderText1:
	text "You?!"
	para "How did you survi-"
	line "ve to Alakazam's"
	cont "attack?!"
	para "You must have a"
	line "very strong mind…"
	para "It's you that I"
	line "should have kidna-"
	cont "pped for my show:"
	cont "Human VS. #MON!"
	para "Unfortunately, you"
	line "are not going to"
	cont "live long enough"
	cont "to see your friend"
	cont "get demolished in"
	cont "the arena."
	para "You're no match"
	line "for us!"
	done
.LeaderText2:
	text "Time to fight!"
	done

.AlakazamText:
	text "Alakazam: KAH!"
	done
.PatheticText:
	text "Hummph<…>"
	line "Pathetic."
	done

DawnTownGymScientist:
	faceplayer
	opentext
	writetext .Text
	waitbutton
	closetext
	turnobject DAWN_TOWN_GYM_SCIENTIST, UP
	end
.Text:
	text "You fool!"
	para "There's no way to"
	line "get out of here!"
	para "Your only solution"
	line "is to defeat the"
	cont "boss, Azmov!"
	para "She'll destroy you"
	line "and your #MONs!"
	done

DawnTownGymGrunt1:
	trainer GRUNTM, BLAKE, EVENT_BEAT_GYM_GRUNT1, .BeforeBattleText, .AfterBattleText, 0, .Script
.Script:
        endifjustbattled
        opentext
        writetext .AfterBattleText
        waitbutton
        closetext
        end
.BeforeBattleText:
	text "You again?!"
	para "Duuude<…>"
	done
.AfterBattleText:
	text "That's bullying at"
	line "this point!"
	done

DawnTownGymGrunt2:
	trainer GRUNTM, HANK, EVENT_BEAT_GYM_GRUNT2, .BeforeBattleText, .AfterBattleText, 0, .Script
.Script:
        endifjustbattled
        opentext
        writetext .AfterBattleText
        waitbutton
        closetext
        end
.BeforeBattleText:
	text "To reach the Boss"
	line "you must defeat"
	cont "everyone."
	para "That's not gonna"
	line "happen!"
	done
.AfterBattleText:
	text "The others will"
	line "stop you!"
	done

DawnTownGymGrunt3:
	trainer GRUNTF, TANYA, EVENT_BEAT_GYM_GRUNT3, .BeforeBattleText, .AfterBattleText, 0, .Script
.Script:
        endifjustbattled
        opentext
        writetext .AfterBattleText
        waitbutton
        closetext
        end
.BeforeBattleText:
	text "I hope you got a"
	line "good stock of"
	cont "medecines!"
	done
.AfterBattleText:
	text "I couldn't stop"
	line "you, but you're"
	cont "weaker now!"
	done
	
DawnTownGymGrunt4:
	trainer EXECUTIVEF, ZOE, EVENT_BEAT_GYM_GRUNT4, .BeforeBattleText, .AfterBattleText, 0, .Script
.Script:
        endifjustbattled
        opentext
        writetext .AfterBattleText
        waitbutton
        closetext
        end
.BeforeBattleText:
	text "Impressive."
	para "Let's get serious"
	line "now if you will!"
	done
.AfterBattleText:
	text "Gaaah."
	line "You're tough!"
	done

DawnTownGymGrunt5:
	trainer EXECUTIVEM, SCOTT, EVENT_BEAT_GYM_GRUNT5, .BeforeBattleText, .AfterBattleText, 0, .Script
.Script:
        endifjustbattled
        opentext
        writetext .AfterBattleText
        waitbutton
        closetext
        end
.BeforeBattleText:
	text "You had fun, but"
	line "now I'll stop you!"
	done
.AfterBattleText:
	text "Sorry boss."
	line "I failed<…>"
	done

DawnTownGym_MapEvents:
	db 0, 0 ; filler

	db 15 ; warp events
	warp_event 14, 13, DAWN_TOWN, 7
	warp_event 15, 13, DAWN_TOWN, 7
	warp_event  2, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  3, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  4, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  5, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  6, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  7, 10, DAWN_TOWN_GYM_B1F, 1
	warp_event  2, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  3, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  4, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  5, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  6, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  7, 11, DAWN_TOWN_GYM_B1F, 1
	warp_event  7, 12, DAWN_TOWN_GYM_B1F, 2

	db 3 ; coord events
	coord_event 1, 5, SCENE_DEFAULT, DawnTownGymCutScenePos1
	coord_event 2, 5, SCENE_DEFAULT, DawnTownGymCutScenePos2
	coord_event 3, 5, SCENE_DEFAULT, DawnTownGymCutScenePos3

	db 0 ; bg events
	db 8 ; object events
	object_event 19, 12, SPRITE_SCIENTIST,     SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 1, DawnTownGymScientist, EVENT_BEAT_AZMOV
	object_event 12,  9, SPRITE_SAILOR,        SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 4, DawnTownGymGrunt1, EVENT_BEAT_AZMOV
	object_event 17,  8, SPRITE_ROCKET,        SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 4, DawnTownGymGrunt2, EVENT_BEAT_AZMOV
	object_event  9,  0, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 1, DawnTownGymGrunt3, EVENT_BEAT_AZMOV
	object_event  6,  2, SPRITE_ROCKET_GIRL,   SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 2, DawnTownGymGrunt4, EVENT_BEAT_AZMOV
	object_event  6,  4, SPRITE_ROCKET,        SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 2, DawnTownGymGrunt5, EVENT_BEAT_AZMOV
	object_event  3,  3, SPRITE_SABRINA,       SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 1, DawnTownGymLeader, EVENT_BEAT_AZMOV
	object_event  2,  3, SPRITE_ALAKAZAM,      SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 1, 0, EVENT_BEAT_AZMOV
