shithub: pokecrystal

Download patch

ref: f9a60cff7a9451e2e8c3bb5db95d89fdba3bf000
parent: af29f1f97ca855f24879a17283886a1d959fb3ed
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Feb 16 08:19:39 EST 2019

Define constants for prices in maps' event scripts

Supersedes #592

--- a/maps/CeladonDeptStore6F.asm
+++ b/maps/CeladonDeptStore6F.asm
@@ -1,3 +1,7 @@
+CELADONDEPTSTORE6F_FRESH_WATER_PRICE EQU 200
+CELADONDEPTSTORE6F_SODA_POP_PRICE    EQU 300
+CELADONDEPTSTORE6F_LEMONADE_PRICE    EQU 350
+
 	const_def 2 ; object constants
 	const CELADONDEPTSTORE6F_SUPER_NERD
 	const CELADONDEPTSTORE6F_YOUNGSTER
@@ -33,29 +37,29 @@
 	end
 
 .FreshWater:
-	checkmoney YOUR_MONEY, 200
+	checkmoney YOUR_MONEY, CELADONDEPTSTORE6F_FRESH_WATER_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem FRESH_WATER
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 200
+	takemoney YOUR_MONEY, CELADONDEPTSTORE6F_FRESH_WATER_PRICE
 	itemtotext FRESH_WATER, MEM_BUFFER_0
 	jump .VendItem
 
 .SodaPop:
-	checkmoney YOUR_MONEY, 300
+	checkmoney YOUR_MONEY, CELADONDEPTSTORE6F_SODA_POP_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem SODA_POP
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 300
+	takemoney YOUR_MONEY, CELADONDEPTSTORE6F_SODA_POP_PRICE
 	itemtotext SODA_POP, MEM_BUFFER_0
 	jump .VendItem
 
 .Lemonade:
-	checkmoney YOUR_MONEY, 350
+	checkmoney YOUR_MONEY, CELADONDEPTSTORE6F_LEMONADE_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem LEMONADE
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 350
+	takemoney YOUR_MONEY, CELADONDEPTSTORE6F_LEMONADE_PRICE
 	itemtotext LEMONADE, MEM_BUFFER_0
 	jump .VendItem
 
--- a/maps/CeladonGameCornerPrizeRoom.asm
+++ b/maps/CeladonGameCornerPrizeRoom.asm
@@ -1,3 +1,10 @@
+CELADONGAMECORNERPRIZEROOM_TM32_COINS EQU 1500
+CELADONGAMECORNERPRIZEROOM_TM29_COINS EQU 3500
+CELADONGAMECORNERPRIZEROOM_TM15_COINS EQU 7500
+CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS  EQU 2222
+CELADONGAMECORNERPRIZEROOM_PORYGON_COINS  EQU 5555
+CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS EQU 8888
+
 	const_def 2 ; object constants
 	const CELADONGAMECORNERPRIZEROOM_GENTLEMAN
 	const CELADONGAMECORNERPRIZEROOM_PHARMACIST
@@ -26,42 +33,42 @@
 	loadmenu CeladonPrizeRoom_TMMenuHeader
 	verticalmenu
 	closewindow
-	ifequal 1, .doubleteam
-	ifequal 2, .psychic
-	ifequal 3, .hyperbeam
-	jump CeladonPrizeRoom_cancel
+	ifequal 1, .DoubleTeam
+	ifequal 2, .Psychic
+	ifequal 3, .HyperBeam
+	jump CeladonPrizeRoom_CancelPurchaseScript
 
-.doubleteam
-	checkcoins 1500
+.DoubleTeam:
+	checkcoins CELADONGAMECORNERPRIZEROOM_TM32_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	itemtotext TM_DOUBLE_TEAM, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	giveitem TM_DOUBLE_TEAM
 	iffalse CeladonPrizeRoom_notenoughroom
-	takecoins 1500
+	takecoins CELADONGAMECORNERPRIZEROOM_TM32_COINS
 	jump CeladonPrizeRoom_purchased
 
-.psychic
-	checkcoins 3500
+.Psychic:
+	checkcoins CELADONGAMECORNERPRIZEROOM_TM29_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	itemtotext TM_PSYCHIC_M, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	giveitem TM_PSYCHIC_M
 	iffalse CeladonPrizeRoom_notenoughroom
-	takecoins 3500
+	takecoins CELADONGAMECORNERPRIZEROOM_TM29_COINS
 	jump CeladonPrizeRoom_purchased
 
-.hyperbeam
-	checkcoins 7500
+.HyperBeam:
+	checkcoins CELADONGAMECORNERPRIZEROOM_TM15_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	itemtotext TM_HYPER_BEAM, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	giveitem TM_HYPER_BEAM
 	iffalse CeladonPrizeRoom_notenoughroom
-	takecoins 7500
+	takecoins CELADONGAMECORNERPRIZEROOM_TM15_COINS
 	jump CeladonPrizeRoom_purchased
 
 CeladonPrizeRoom_askbuy:
@@ -88,7 +95,7 @@
 	closetext
 	end
 
-CeladonPrizeRoom_cancel:
+CeladonPrizeRoom_CancelPurchaseScript:
 	writetext CeladonPrizeRoom_ComeAgainText
 	waitbutton
 	closetext
@@ -127,19 +134,19 @@
 	loadmenu .MenuHeader
 	verticalmenu
 	closewindow
-	ifequal 1, .pikachu
-	ifequal 2, .porygon
-	ifequal 3, .larvitar
-	jump CeladonPrizeRoom_cancel
+	ifequal 1, .Pikachu
+	ifequal 2, .Porygon
+	ifequal 3, .Larvitar
+	jump CeladonPrizeRoom_CancelPurchaseScript
 
-.pikachu
-	checkcoins 2222
+.Pikachu:
+	checkcoins CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
 	pokenamemem PIKACHU, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	waitsfx
 	playsound SFX_TRANSACTION
 	writetext CeladonPrizeRoom_HereYouGoText
@@ -147,17 +154,17 @@
 	writebyte PIKACHU
 	special GameCornerPrizeMonCheckDex
 	givepoke PIKACHU, 25
-	takecoins 2222
+	takecoins CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS
 	jump .loop
 
-.porygon
-	checkcoins 5555
+.Porygon:
+	checkcoins CELADONGAMECORNERPRIZEROOM_PORYGON_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
 	pokenamemem PORYGON, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	waitsfx
 	playsound SFX_TRANSACTION
 	writetext CeladonPrizeRoom_HereYouGoText
@@ -165,17 +172,17 @@
 	writebyte PORYGON
 	special GameCornerPrizeMonCheckDex
 	givepoke PORYGON, 15
-	takecoins 5555
+	takecoins CELADONGAMECORNERPRIZEROOM_PORYGON_COINS
 	jump .loop
 
-.larvitar
-	checkcoins 8888
+.Larvitar:
+	checkcoins CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS
 	ifequal HAVE_LESS, CeladonPrizeRoom_notenoughcoins
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, CeladonPrizeRoom_notenoughroom
 	pokenamemem LARVITAR, MEM_BUFFER_0
 	scall CeladonPrizeRoom_askbuy
-	iffalse CeladonPrizeRoom_cancel
+	iffalse CeladonPrizeRoom_CancelPurchaseScript
 	waitsfx
 	playsound SFX_TRANSACTION
 	writetext CeladonPrizeRoom_HereYouGoText
@@ -183,7 +190,7 @@
 	writebyte LARVITAR
 	special GameCornerPrizeMonCheckDex
 	givepoke LARVITAR, 40
-	takecoins 8888
+	takecoins CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS
 	jump .loop
 
 .MenuHeader:
--- a/maps/GoldenrodDeptStore6F.asm
+++ b/maps/GoldenrodDeptStore6F.asm
@@ -1,3 +1,7 @@
+GOLDENRODDEPTSTORE6F_FRESH_WATER_PRICE EQU 200
+GOLDENRODDEPTSTORE6F_SODA_POP_PRICE    EQU 300
+GOLDENRODDEPTSTORE6F_LEMONADE_PRICE    EQU 350
+
 	const_def 2 ; object constants
 	const GOLDENRODDEPTSTORE6F_LASS
 	const GOLDENRODDEPTSTORE6F_SUPER_NERD
@@ -22,29 +26,29 @@
 	end
 
 .FreshWater:
-	checkmoney YOUR_MONEY, 200
+	checkmoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_FRESH_WATER_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem FRESH_WATER
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 200
+	takemoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_FRESH_WATER_PRICE
 	itemtotext FRESH_WATER, MEM_BUFFER_0
 	jump .VendItem
 
 .SodaPop:
-	checkmoney YOUR_MONEY, 300
+	checkmoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_SODA_POP_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem SODA_POP
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 300
+	takemoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_SODA_POP_PRICE
 	itemtotext SODA_POP, MEM_BUFFER_0
 	jump .VendItem
 
 .Lemonade:
-	checkmoney YOUR_MONEY, 350
+	checkmoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_LEMONADE_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem LEMONADE
 	iffalse .NotEnoughSpace
-	takemoney YOUR_MONEY, 350
+	takemoney YOUR_MONEY, GOLDENRODDEPTSTORE6F_LEMONADE_PRICE
 	itemtotext LEMONADE, MEM_BUFFER_0
 	jump .VendItem
 
--- a/maps/GoldenrodGameCorner.asm
+++ b/maps/GoldenrodGameCorner.asm
@@ -1,3 +1,10 @@
+GOLDENRODGAMECORNER_TM25_COINS EQU 5500
+GOLDENRODGAMECORNER_TM14_COINS EQU 5500
+GOLDENRODGAMECORNER_TM38_COINS EQU 5500
+GOLDENRODGAMECORNER_ABRA_COINS      EQU 100
+GOLDENRODGAMECORNER_CUBONE_COINS    EQU 800
+GOLDENRODGAMECORNER_WOBBUFFET_COINS EQU 1500
+
 	const_def 2 ; object constants
 	const GOLDENRODGAMECORNER_CLERK
 	const GOLDENRODGAMECORNER_RECEPTIONIST1
@@ -68,7 +75,7 @@
 	jump GoldenrodGameCornerPrizeVendor_CancelPurchaseScript
 
 .Thunder:
-	checkcoins 5500
+	checkcoins GOLDENRODGAMECORNER_TM25_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	itemtotext TM_THUNDER, MEM_BUFFER_0
 	scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript
@@ -75,11 +82,11 @@
 	iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript
 	giveitem TM_THUNDER
 	iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
-	takecoins 5500
+	takecoins GOLDENRODGAMECORNER_TM25_COINS
 	jump GoldenrodGameCornerTMVendor_FinishScript
 
 .Blizzard:
-	checkcoins 5500
+	checkcoins GOLDENRODGAMECORNER_TM14_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	itemtotext TM_BLIZZARD, MEM_BUFFER_0
 	scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript
@@ -86,11 +93,11 @@
 	iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript
 	giveitem TM_BLIZZARD
 	iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
-	takecoins 5500
+	takecoins GOLDENRODGAMECORNER_TM14_COINS
 	jump GoldenrodGameCornerTMVendor_FinishScript
 
 .FireBlast:
-	checkcoins 5500
+	checkcoins GOLDENRODGAMECORNER_TM38_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	itemtotext TM_FIRE_BLAST, MEM_BUFFER_0
 	scall GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript
@@ -97,7 +104,7 @@
 	iffalse GoldenrodGameCornerPrizeVendor_CancelPurchaseScript
 	giveitem TM_FIRE_BLAST
 	iffalse GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
-	takecoins 5500
+	takecoins GOLDENRODGAMECORNER_TM38_COINS
 	jump GoldenrodGameCornerTMVendor_FinishScript
 
 GoldenrodGameCornerPrizeVendor_ConfirmPurchaseScript:
@@ -163,13 +170,13 @@
 	loadmenu .MenuHeader
 	verticalmenu
 	closewindow
-	ifequal 1, .abra
-	ifequal 2, .cubone
-	ifequal 3, .wobbuffet
+	ifequal 1, .Abra
+	ifequal 2, .Cubone
+	ifequal 3, .Wobbuffet
 	jump GoldenrodGameCornerPrizeVendor_CancelPurchaseScript
 
-.abra
-	checkcoins 100
+.Abra:
+	checkcoins GOLDENRODGAMECORNER_ABRA_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
@@ -183,11 +190,11 @@
 	writebyte ABRA
 	special GameCornerPrizeMonCheckDex
 	givepoke ABRA, 5
-	takecoins 100
+	takecoins GOLDENRODGAMECORNER_ABRA_COINS
 	jump .loop
 
-.cubone
-	checkcoins 800
+.Cubone:
+	checkcoins GOLDENRODGAMECORNER_CUBONE_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
@@ -201,11 +208,11 @@
 	writebyte CUBONE
 	special GameCornerPrizeMonCheckDex
 	givepoke CUBONE, 15
-	takecoins 800
+	takecoins GOLDENRODGAMECORNER_CUBONE_COINS
 	jump .loop
 
-.wobbuffet
-	checkcoins 1500
+.Wobbuffet:
+	checkcoins GOLDENRODGAMECORNER_WOBBUFFET_COINS
 	ifequal HAVE_LESS, GoldenrodGameCornerPrizeVendor_NotEnoughCoinsScript
 	checkcode VAR_PARTYCOUNT
 	ifequal PARTY_LENGTH, GoldenrodGameCornerPrizeMonVendor_NoRoomForPrizeScript
@@ -219,7 +226,7 @@
 	writebyte WOBBUFFET
 	special GameCornerPrizeMonCheckDex
 	givepoke WOBBUFFET, 15
-	takecoins 1500
+	takecoins GOLDENRODGAMECORNER_WOBBUFFET_COINS
 	jump .loop
 
 .MenuHeader:
--- a/maps/GoldenrodUnderground.asm
+++ b/maps/GoldenrodUnderground.asm
@@ -1,3 +1,6 @@
+GOLDENRODUNDERGROUND_OLDER_HAIRCUT_PRICE   EQU 500
+GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_PRICE EQU 300
+
 	const_def 2 ; object constants
 	const GOLDENRODUNDERGROUND_SUPER_NERD1
 	const GOLDENRODUNDERGROUND_SUPER_NERD2
@@ -194,7 +197,7 @@
 	writetext UnknownText_0x7c5f9
 	yesorno
 	iffalse .Refused
-	checkmoney YOUR_MONEY, 500
+	checkmoney YOUR_MONEY, GOLDENRODUNDERGROUND_OLDER_HAIRCUT_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	writetext UnknownText_0x7c69a
 	buttonsound
@@ -225,7 +228,7 @@
 	jump .then
 
 .then
-	takemoney YOUR_MONEY, 500
+	takemoney YOUR_MONEY, GOLDENRODUNDERGROUND_OLDER_HAIRCUT_PRICE
 	special PlaceMoneyTopRight
 	writetext UnknownText_0x7c6b8
 	waitbutton
@@ -277,7 +280,7 @@
 	writetext UnknownText_0x7c75c
 	yesorno
 	iffalse .Refused
-	checkmoney YOUR_MONEY, 300
+	checkmoney YOUR_MONEY, GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	writetext UnknownText_0x7c7f1
 	buttonsound
@@ -308,7 +311,7 @@
 	jump .then
 
 .then
-	takemoney YOUR_MONEY, 300
+	takemoney YOUR_MONEY, GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_PRICE
 	special PlaceMoneyTopRight
 	writetext UnknownText_0x7c80e
 	waitbutton
--- a/maps/MahoganyTown.asm
+++ b/maps/MahoganyTown.asm
@@ -1,3 +1,5 @@
+MAHOGANYTOWN_RAGECANDYBAR_PRICE EQU 300
+
 	const_def 2 ; object constants
 	const MAHOGANYTOWN_POKEFAN_M
 	const MAHOGANYTOWN_GRAMPS
@@ -54,13 +56,13 @@
 	special PlaceMoneyTopRight
 	yesorno
 	iffalse .Refused
-	checkmoney YOUR_MONEY, 300
+	checkmoney YOUR_MONEY, MAHOGANYTOWN_RAGECANDYBAR_PRICE
 	ifequal HAVE_LESS, .NotEnoughMoney
 	giveitem RAGECANDYBAR
 	iffalse .NoRoom
 	waitsfx
 	playsound SFX_TRANSACTION
-	takemoney YOUR_MONEY, 300
+	takemoney YOUR_MONEY, MAHOGANYTOWN_RAGECANDYBAR_PRICE
 	special PlaceMoneyTopRight
 	writetext RageCandyBarMerchantSavorItText
 	waitbutton
--- a/maps/Route39Farmhouse.asm
+++ b/maps/Route39Farmhouse.asm
@@ -1,3 +1,5 @@
+ROUTE39FARMHOUSE_MILK_PRICE EQU 500
+
 	const_def 2 ; object constants
 	const ROUTE39FARMHOUSE_POKEFAN_M
 	const ROUTE39FARMHOUSE_POKEFAN_F
@@ -25,11 +27,11 @@
 	special PlaceMoneyTopRight
 	yesorno
 	iffalse FarmerMScript_NoSale
-	checkmoney YOUR_MONEY, 500
+	checkmoney YOUR_MONEY, ROUTE39FARMHOUSE_MILK_PRICE
 	ifequal HAVE_LESS, FarmerMScript_NoMoney
 	giveitem MOOMOO_MILK
 	iffalse FarmerMScript_NoRoom
-	takemoney YOUR_MONEY, 500
+	takemoney YOUR_MONEY, ROUTE39FARMHOUSE_MILK_PRICE
 	special PlaceMoneyTopRight
 	waitsfx
 	playsound SFX_TRANSACTION