PrisonF2_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

PrisonF2_Movement_FaceUp:
	turn_head_up
	step_end
PrisonF2_Movement_FaceDown:
	turn_head_down
	step_end
PrisonF2_Movement_FaceLeft:
	turn_head_left
	step_end
PrisonF2_Movement_FaceRight:
	turn_head_right
	step_end
PrisonF2_Movement_Down4:
	step_down
PrisonF2_Movement_Down3:
	step_down
PrisonF2_Movement_Down2:
	step_down
PrisonF2_Movement_Down:
	step_down
	step_end
PrisonF2_Movement_Left2:
	step_left
PrisonF2_Movement_Left:
	step_left
	step_end
PrisonF2_Movement_Right:
	step_right
	step_end

PrisonF2GuardTrap1:
	faceperson 0, 8
	faceperson 8, 0
PrisonF2_PrintMessageAndWarp:
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
PrisonF2_WarpToBelowFloor:
	warp PRISON_F1, 20, 3
	closetext
	end

PrisonF2GuardTrap2A:
	applymovement 9, PrisonF2_Movement_FaceDown
	jump PrisonF2_FaceGuard2AndWarp

PrisonF2GuardTrap2B:
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 9, PrisonF2_Movement_Down
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap2C:
	faceperson 0, 9
	faceperson 9, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 9, PrisonF2_Movement_Down2
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap2D:
	faceperson 0, 9
	faceperson 9, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 9, PrisonF2_Movement_Down3
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap2E:
	faceperson 0, 9
	faceperson 9, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 9, PrisonF2_Movement_Down4
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap2F:
	applymovement 9, PrisonF2_Movement_FaceLeft
	jump PrisonF2_FaceGuard2AndWarp

PrisonF2GuardTrap2G:
	applymovement 9, PrisonF2_Movement_FaceRight
PrisonF2_FaceGuard2AndWarp:
	faceperson 0, 9
	faceperson 9, 0
	jump PrisonF2_PrintMessageAndWarp

PrisonF2GuardTrap3A:
	faceperson 0, 7
	faceperson 7, 0
	jump PrisonF2_PrintMessageAndWarp

PrisonF2Guard3:
PrisonF2GuardTrap3B:
	faceperson 0, 7
	faceperson 7, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 7, PrisonF2_Movement_Right
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap4A:
	faceperson 0, 3
	faceperson 3, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 3, PrisonF2_Movement_Left2
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap4B:
	faceperson 0, 3
	faceperson 3, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 3, PrisonF2_Movement_Left
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap4C:
	faceperson 0, 3
	faceperson 3, 0
	jump PrisonF2_PrintMessageAndWarp

PrisonF2GuardTrap5A:
	faceperson 0, 5
	faceperson 5, 0
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	closetext
	applymovement 5, PrisonF2_Movement_Left
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap5B:
	applymovement 5, PrisonF2_Movement_FaceLeft
	jump PrisonF2_FaceGuard5AndWarp

PrisonF2GuardTrap5C:
	applymovement 5, PrisonF2_Movement_FaceUp
	jump PrisonF2_FaceGuard5AndWarp

PrisonF2GuardTrap5D:
	applymovement 5, PrisonF2_Movement_FaceDown
PrisonF2_FaceGuard5AndWarp:
	faceperson 0, 5
	faceperson 5, 0
	jump PrisonF2_PrintMessageAndWarp

PrisonF2Guard1:
PrisonF2Guard2:
PrisonF2Guard4:
PrisonF2Guard5:
	opentext
	writetext PrisonF2GuardTrap_Text_BeforeWarping
	jump PrisonF2_WarpToBelowFloor

PrisonF2GuardTrap_Text_BeforeWarping:
	ctxt "HALT!"

	para "You're not allowed"
	line "up here."
	sdone

PrisonF2RoofCardGuard:
	faceplayer
	opentext
	checkitem ROOF_CARD
	sif false, then
		writetext .need_roof_card_text
		endtext
	sendif
	setevent EVENT_PRISON_F2_ROOF_CARD_GUARD
	writetext .got_roof_card_text
	waitbutton
	closetext
	applymovement 6, .movement
	disappear 6
	end

.movement
	return_dig 32
	step_end

.need_roof_card_text
	ctxt "No one's allowed"
	line "up here without a"
	cont "special Roof Card."
	done

.got_roof_card_text
	ctxt "Well it looks like"
	line "you have the roof"
	cont "card, so I guess"
	cont "I'll let you in."
	done

PrisonF2_MapEventHeader:: db 0, 0

.Warps: db 6
	warp_def 9, 37, 6, PRISON_F1
	warp_def 32, 31, 1, PRISON_ROOF
	warp_def 16, 0, 1, PRISON_ELECTRIC_CHAIR
	warp_def 17, 0, 2, PRISON_ELECTRIC_CHAIR
	warp_def 20, 39, 1, PRISON_CAFETERIA
	warp_def 21, 39, 2, PRISON_CAFETERIA

.CoordEvents: db 23
	xy_trigger 0, 2, 15, 0, PrisonF2GuardTrap1, 0, 0
	xy_trigger 0, 3, 14, 0, PrisonF2GuardTrap1, 0, 0
	xy_trigger 0, 3, 16, 0, PrisonF2GuardTrap1, 0, 0
	xy_trigger 0, 13, 5, 0, PrisonF2GuardTrap2A, 0, 0
	xy_trigger 0, 14, 5, 0, PrisonF2GuardTrap2B, 0, 0
	xy_trigger 0, 15, 5, 0, PrisonF2GuardTrap2C, 0, 0
	xy_trigger 0, 16, 5, 0, PrisonF2GuardTrap2D, 0, 0
	xy_trigger 0, 17, 5, 0, PrisonF2GuardTrap2E, 0, 0
	xy_trigger 0, 12, 4, 0, PrisonF2GuardTrap2F, 0, 0
	xy_trigger 0, 12, 6, 0, PrisonF2GuardTrap2G, 0, 0
	xy_trigger 0, 19, 37, 0, PrisonF2GuardTrap3A, 0, 0
	xy_trigger 0, 19, 38, 0, PrisonF2GuardTrap3B, 0, 0
	xy_trigger 0, 18, 36, 0, PrisonF2GuardTrap3A, 0, 0
	xy_trigger 0, 20, 36, 0, PrisonF2GuardTrap3A, 0, 0
	xy_trigger 0, 23, 30, 0, PrisonF2GuardTrap4A, 0, 0
	xy_trigger 0, 23, 31, 0, PrisonF2GuardTrap4B, 0, 0
	xy_trigger 0, 23, 32, 0, PrisonF2GuardTrap4C, 0, 0
	xy_trigger 0, 22, 33, 0, PrisonF2GuardTrap4C, 0, 0
	xy_trigger 0, 24, 33, 0, PrisonF2GuardTrap4C, 0, 0
	xy_trigger 0, 7, 1, 0, PrisonF2GuardTrap5A, 0, 0
	xy_trigger 0, 7, 2, 0, PrisonF2GuardTrap5B, 0, 0
	xy_trigger 0, 6, 3, 0, PrisonF2GuardTrap5C, 0, 0
	xy_trigger 0, 8, 3, 0, PrisonF2GuardTrap5D, 0, 0

.BGEvents: db 0

.ObjectEvents: db 8
	person_event SPRITE_POKE_BALL, 2, 3, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_TMHMBALL, TM_EXPLOSION, 0, EVENT_PRISON_F2_TM
	person_event SPRITE_OFFICER, 23, 33, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, PrisonF2Guard4, -1
	person_event SPRITE_POKE_BALL, 0, 37, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, ObjectEvent, -1
	person_event SPRITE_OFFICER, 7, 3, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, PrisonF2Guard5, -1
	person_event SPRITE_OFFICER, 30, 32, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, PrisonF2RoofCardGuard, EVENT_PRISON_F2_ROOF_CARD_GUARD
	person_event SPRITE_OFFICER, 19, 36, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, PrisonF2Guard3, -1
	person_event SPRITE_OFFICER, 3, 15, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, PrisonF2Guard1, -1
	person_event SPRITE_OFFICER, 12, 5, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, PrisonF2Guard2, -1

