HaywardMartF6_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

HaywardMartVendingMachine:
	opentext
.loop
	writetext .vending_machine_text
	special PlaceMoneyTopRight
	menuanonjumptable .VendingMachineMenu
	dw .quit
	dw .fresh_water
	dw .soda_pop
	dw .lemonade

.quit
	closetextend

.VendingMachineMenu
	db $40 ; flags
	db 03, 00 ; start coords
	db 10, 13 ; end coords
	dw .MenuData2
	db 1 ; default option

.MenuData2
	db %10000000 ; flags
	db 3
	db "Fresh Water@"
	db "Soda Pop@"
	db "Lemonade@"

.fresh_water
	checkmoney 0, 200
	sif <, 2, then
		giveitem FRESH_WATER, 1
		sif true, then
			takemoney 0, 200
			itemtotext FRESH_WATER, 0
			writebyte 1
		sendif
	sendif
	jump .processed_selection

.soda_pop
	checkmoney 0, 300
	sif <, 2, then
		giveitem SODA_POP, 1
		sif true, then
			takemoney 0, 300
			itemtotext SODA_POP, 0
			writebyte 1
		sendif
	sendif
	jump .processed_selection

.lemonade
	checkmoney 0, 350
	sif <, 2, then
		giveitem LEMONADE, 1
		sif true, then
			takemoney 0, 350
			itemtotext LEMONADE, 0
			writebyte 1
		sendif
	sendif

.processed_selection
	anonjumptable
	dw .no_room
	dw .item_OK
	dw .no_money

.no_money
	writetext .no_money_text
	jump .loop

.no_room
	writetext .no_room_text
	jump .loop

.item_OK
	pause 10
	playsound SFX_ENTER_DOOR
	writetext .got_item_text
	buttonsound
	itemnotify
	waitbutton
	jump .loop

.vending_machine_text
	db TX_COMPRESSED, $ae, $03, $19, $32, $32, $73, $1f, $d6, $52, $32, $1f
	db $17, $98, $9a, $cf, $14, $b4, $9c, $7c, $c8, $d7
	db $a9, $a0

.no_money_text
	db TX_COMPRESSED, $76, $11, $08, $fc, $20, $6e, $19, $02, $d7, $29
	db $79, $f0, $90, $c1, $53
	db $c1, $4f, $10

.no_room_text
	db TX_COMPRESSED, $29, $26, $b3, $c5, $08, $18, $f8, $56
	db $6f, $2c, $21, $7e, $60, $15, $c4, $5b, $58, $61, $4f
	db $05, $3c, $40

.got_item_text
	db TX_COMPRESSED, $6d, $ee, $93, $9e

	db $20, $01, $c8
	db $78, $40, $44, $08, $3c, $c0, $b5, $7e
	db $a6, $80

HaywardMartF6OrbGirl:
	faceplayer
	opentext
	clearevent EVENT_0
	checkevent EVENT_EXPLAIN_EGGS
	sif false, then
		writetext .introduction_text
		setevent EVENT_EXPLAIN_EGGS
	sendif
	checkitem RUBY_EGG
	sif true, then
		writetext .have_ruby_egg_text
		yesorno
		sif true, then
			setevent EVENT_0
			takeitem RUBY_EGG, 1
			giveitem RED_ORB, 1
			writetext .receive_red_orb_text
			setevent EVENT_GAVE_RUBY_EGG
			playwaitsfx SFX_DEX_FANFARE_200_229
		selse
			writetext .refused_to_give_egg_text
		sendif
	sendif
	checkitem SAPPHIRE_EGG
	sif true, then
		writetext .have_sapphire_egg_text
		yesorno
		sif true, then
			setevent EVENT_0
			takeitem SAPPHIRE_EGG, 1
			giveitem BLUE_ORB, 1
			writetext .receive_blue_orb_text
			setevent EVENT_GAVE_SAPPHIRE_EGG
			playwaitsfx SFX_DEX_FANFARE_200_229
		selse
			writetext .refused_to_give_egg_text
		sendif
	sendif
	checkitem EMERALD_EGG
	sif true, then
		writetext .have_emerald_egg_text
		yesorno
		sif true, then
			setevent EVENT_0
			takeitem EMERALD_EGG, 1
			giveitem GREEN_ORB, 1
			writetext .receive_green_orb_text
			setevent EVENT_GAVE_EMERALD_EGG
			playwaitsfx SFX_DEX_FANFARE_200_229
		selse
			writetext .refused_to_give_egg_text
		sendif
	sendif
	checkevent EVENT_GAVE_RUBY_EGG
	iffalse .didntGetAll
	checkevent EVENT_GAVE_SAPPHIRE_EGG
	iffalse .didntGetAll
	checkevent EVENT_GAVE_EMERALD_EGG
	iffalse .didntGetAll
	jumptext .already_gave_all_eggs_text

.didntGetAll
	checkevent EVENT_0
	sif true
		jumptext .come_back_text
	jumptext .dont_have_eggs_text

.introduction_text
	db TX_COMPRESSED, $76, $9f, $c4, $9f, $7a, $1f

	db $00, $74, $59, $3a, $10, $a9, $0c, $9c, $cc, $02
	db $b7, $90, $17, $ce, $20, $41, $b2, $3d, $ec, $3e, $79, $47

	db $80, $03, $c3, $70, $1c, $af, $84, $90, $f9, $e5, $1f
	db $79, $5b, $57, $10, $6c, $ac, $ee, $1f, $3c, $a3

	db $c0, $0a, $49, $82, $2e, $39, $91, $e1, $80, $d9, $6b
	db $b6, $f5, $86, $60, $32, $67

	db $c0, $1d, $61, $01, $05, $a9, $80, $c9, $98, $12
	db $1b, $d6, $9d, $b8, $ea, $55, $a4, $bf, $c7, $4e, $1e
	db $80, $e4, $60, $c7, $01, $05, $a9, $b1, $09, $19, $01
	db $3c, $15, $ab, $8e, $a2, $cd, $93, $18, $31
	db $e4, $06, $03, $06, $38, $08, $f5, $68, $9b, $c8
	db $5e, $c1, $61, $7e, $20, $2f, $9c, $29, $7a, $32, $1a

	db $fc, $00, $a4, $9c, $29, $7a, $32, $1a, $e7, $76, $cd
	db $6f, $2b, $36, $75, $f3, $96, $93, $8e, $41, $d3, $81
	db $22, $a6, $d4, $eb, $e2, $06, $12, $53

	db $c0, $02, $9e, $05, $6d, $5c, $49, $c0, $6d, $20, $d0, $93
	db $cb, $db, $01, $1e, $ae, $77, $6c, $d7
	db $ea, $78, $80

.have_ruby_egg_text
	db TX_COMPRESSED, $72, $85, $a8, $9d, $06, $39
	db $af, $75, $aa, $75, $a5, $8c, $2d, $22, $39, $1a, $56
	db $09, $50, $bb, $9e, $78

	db $80, $74, $e1, $ec, $b5, $ee, $4e, $02, $0b, $50
	db $76, $f6, $01, $5c, $7c, $14, $72, $1e, $63, $b5, $ab

	db $e2, $01, $b8, $fb, $d8, $08, $2d, $4b, $5e, $e4, $e9
	db $69, $a0

.have_sapphire_egg_text
	db TX_COMPRESSED, $72, $85, $a8, $9d, $06, $39
	db $af, $2b, $3d, $6a, $c7, $83, $5d
	db $54, $a3, $44, $08, $48, $d6, $70, $5d, $cf, $3c

	db $40, $3a, $70, $f6, $5a, $f7, $27, $01, $05, $a8, $3b
	db $7b, $00, $ae, $3e, $0a, $09, $75, $a3, $8e, $d6, $af

	db $88, $06, $fa, $4b, $96, $19, $6b, $dc, $9d
	db $2d, $34

.have_emerald_egg_text
	db TX_COMPRESSED, $72, $85, $a8, $9d, $06, $39, $b1, $09, $19, $01
	db $3c, $2e, $7c, $d7, $bd, $cc, $17, $73, $cf

	db $10, $0e, $9c, $3d, $96, $bd, $c9, $c0, $41, $6a, $0e
	db $de, $c0, $2b, $8f, $82, $8c, $25, $99
	db $91, $53, $b5, $ab

	db $e2, $01, $be, $92, $e5, $86, $5a, $f7, $27
	db $4b, $4d

.receive_red_orb_text
	db TX_COMPRESSED, $61, $2c, $f6, $ff, $12, $6b, $3c
	db $4f, $02, $0b, $4b, $8e, $43, $cc, $76, $b5, $7c
	db $69, $e2

.receive_blue_orb_text
	db TX_COMPRESSED, $6e, $12, $64, $d7, $83, $5d, $fc, $49, $ac, $f1
	db $3c, $08, $2d, $2e, $09, $75, $a3, $8e, $d6, $af
	db $8d, $3c, $40

.receive_green_orb_text
	db TX_COMPRESSED, $07, $8d, $93, $fc, $49, $ac, $f1, $40, $41, $69
	db $6f, $30, $96, $66, $48, $ed, $6a, $f8
	db $d3, $c4

.refused_to_give_egg_text
	db TX_COMPRESSED, $6d, $0b, $e7, $02, $4f, $cb, $4e, $dc, $3e, $79
	db $78, $68, $25, $32, $69, $01, $46, $90, $72
	db $c2, $a8, $10, $5a
	db $e3, $4f, $10

.dont_have_eggs_text
	db TX_COMPRESSED, $72, $85, $a9, $90, $92, $99, $13, $a0
	db $c6, $f6, $90, $14, $3e, $79, $44, $b4, $ed, $c7
	db $4a, $aa, $d2, $5f

	db $80, $36, $85, $f3, $8a, $f5, $95, $29, $52, $4c, $90, $10, $5a
	db $7b, $21
	db $f5, $34

.come_back_text
	db TX_COMPRESSED, $6d, $0b, $e7, $15, $eb, $2a, $52, $a4, $99
	db $1e, $04, $16, $a2, $74, $18, $e3, $e1, $59
	db $aa, $40, $83, $64, $7b, $d8, $7c, $f2, $8f
	db $53, $40

.already_gave_all_eggs_text
	db TX_COMPRESSED, $6e, $9d, $ba, $58, $e8, $b2, $6f, $7b, $02, $d5
	db $bc, $1c, $20, $56, $ad, $1e

	db $00, $ea, $6f, $56, $7b, $90, $51, $3a, $0c, $73, $7b
	db $d7, $ad, $27, $0f, $9e, $51, $2d, $3b, $71
	db $d2, $aa, $b4, $97
	db $ea, $68

HaywardMartF6NPC:
	db TX_COMPRESSED, $29, $3b, $73, $91, $af, $b2, $d2, $6b
	db $37, $86, $89, $6b, $04, $32, $73, $2c, $33, $93
	db $b5, $4b, $1e, $60, $70, $89, $35, $c0, $ad, $5a

	db $3c, $01, $d6, $11, $d4, $a8, $d6, $71, $26, $bf, $c7, $58
	db $cf, $24, $3d, $cc, $09, $2c, $32, $d2, $6f
	db $fa, $9a

HaywardMartF6_MapEventHeader:: db 0, 0

.Warps
	db 2
	warp_def $0, $10, 2, HAYWARD_MART_F5
	warp_def $0, $2, 2, HAYWARD_MART_ELEVATOR

.CoordEvents
	db 0

.BGEvents
	db 4
	signpost 1, 12, SIGNPOST_UP, HaywardMartVendingMachine
	signpost 1, 13, SIGNPOST_UP, HaywardMartVendingMachine
	signpost 1, 14, SIGNPOST_UP, HaywardMartVendingMachine
	signpost 1, 15, SIGNPOST_UP, HaywardMartVendingMachine

.ObjectEvents
	db 2
	person_event SPRITE_LASS, 4, 9, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, HaywardMartF6OrbGirl, -1
	person_event SPRITE_YOUNGSTER, 5, 13, SPRITEMOVEDATA_WANDER, 1, 1, -1, -1, 0, PERSONTYPE_TEXTFP, 0, HaywardMartF6NPC, -1

