shithub: pokecrystal

Download patch

ref: 718c2260e90e61b09bca085f7276ca889c2223b7
parent: 2c98c694e3f1ab7c82c73eaa671d281803130ae7
author: IIMarckus <iimarckus@gmail.com>
date: Thu Jul 9 22:36:57 EDT 2015

Use constants for overworld phone script flags.

--- a/constants/event_flags.asm
+++ b/constants/event_flags.asm
@@ -605,6 +605,7 @@
 EVENT_RED_IN_MT_SILVER                                 EQU $762
 EVENT_FLORIA_AT_SUDOWOODO                              EQU $769
 EVENT_TRAINERS_IN_CERULEAN_GYM                         EQU $76f
+EVENT_BLUE_IN_CINNABAR                                 EQU $775
 EVENT_TELEPORT_GUY                                     EQU $77c
 EVENT_PICKED_UP_FOCUS_BAND                             EQU $77d
 EVENT_PICKED_UP_GOLD_BERRY_FROM_HO_OH_ITEM_ROOM        EQU $794
--- a/maps/CinnabarIsland.asm
+++ b/maps/CinnabarIsland.asm
@@ -147,4 +147,4 @@
 
 	; people-events
 	db 1
-	person_event SPRITE_BLUE, 10, 13, $3, $0, 255, 255, $0, 0, CinnabarIslandBlue, $0775
+	person_event SPRITE_BLUE, 10, 13, $3, $0, 255, 255, $0, 0, CinnabarIslandBlue, EVENT_BLUE_IN_CINNABAR
--- a/maps/NationalPark.asm
+++ b/maps/NationalPark.asm
@@ -78,7 +78,7 @@
 	writecode VAR_CALLERID, $5
 	talkaftercancel
 	loadfont
-	checkflag $0065
+	checkflag ENGINE_JACK
 	iftrue UnknownScript_0x5c088
 	checkcellnum $5
 	iftrue UnknownScript_0x5c108
@@ -126,7 +126,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f2, $1
-	clearflag $0065
+	clearflag ENGINE_JACK
 	end
 
 UnknownScript_0x5c0cc:
@@ -134,7 +134,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f2, $2
-	clearflag $0065
+	clearflag ENGINE_JACK
 	end
 
 UnknownScript_0x5c0d9:
@@ -142,7 +142,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f2, $3
-	clearflag $0065
+	clearflag ENGINE_JACK
 	end
 
 UnknownScript_0x5c0e6:
@@ -150,7 +150,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f2, $4
-	clearflag $0065
+	clearflag ENGINE_JACK
 	end
 
 UnknownScript_0x5c0f3:
@@ -157,7 +157,7 @@
 	loadtrainer SCHOOLBOY, JACK5
 	startbattle
 	returnafterbattle
-	clearflag $0065
+	clearflag ENGINE_JACK
 	end
 
 UnknownScript_0x5c0fc:
@@ -238,7 +238,7 @@
 	writecode VAR_CALLERID, $6
 	talkaftercancel
 	loadfont
-	checkflag $007d
+	checkflag ENGINE_BEVERLY_HAS_NUGGET
 	iftrue UnknownScript_0x5c177
 	checkcellnum $6
 	iftrue UnknownScript_0x5c19b
@@ -266,7 +266,7 @@
 	scall UnknownScript_0x5c1a7
 	verbosegiveitem NUGGET, 1
 	iffalse UnknownScript_0x5c186
-	clearflag $007d
+	clearflag ENGINE_BEVERLY_HAS_NUGGET
 	jump UnknownScript_0x5c19b
 
 UnknownScript_0x5c186:
--- a/maps/OlivineLighthouse2F.asm
+++ b/maps/OlivineLighthouse2F.asm
@@ -55,7 +55,7 @@
 	writecode VAR_CALLERID, $7
 	talkaftercancel
 	loadfont
-	checkflag $0066
+	checkflag ENGINE_HUEY
 	iftrue UnknownScript_0x5afc7
 	checkcellnum $7
 	iftrue UnknownScript_0x5b05f
@@ -97,7 +97,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f4, $1
-	clearflag $0066
+	clearflag ENGINE_HUEY
 	end
 
 UnknownScript_0x5b001:
@@ -105,7 +105,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f4, $2
-	clearflag $0066
+	clearflag ENGINE_HUEY
 	end
 
 UnknownScript_0x5b00e:
@@ -113,7 +113,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f4, $3
-	clearflag $0066
+	clearflag ENGINE_HUEY
 	end
 
 UnknownScript_0x5b01b:
@@ -120,7 +120,7 @@
 	loadtrainer SAILOR, HUEY4
 	startbattle
 	returnafterbattle
-	clearflag $0066
+	clearflag ENGINE_HUEY
 	checkevent EVENT_HUEY_PROTEIN
 	iftrue UnknownScript_0x5b03f
 	checkevent $0265
--- a/maps/Route26.asm
+++ b/maps/Route26.asm
@@ -55,7 +55,7 @@
 	writecode VAR_CALLERID, $b
 	talkaftercancel
 	loadfont
-	checkflag $0067
+	checkflag ENGINE_GAVEN
 	iftrue UnknownScript_0x1a4d79
 	checkcellnum $b
 	iftrue UnknownScript_0x1a4dcb
@@ -95,7 +95,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f5, $1
-	clearflag $0067
+	clearflag ENGINE_GAVEN
 	end
 
 UnknownScript_0x1a4da9:
@@ -103,7 +103,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f5, $2
-	clearflag $0067
+	clearflag ENGINE_GAVEN
 	end
 
 UnknownScript_0x1a4db6:
@@ -110,7 +110,7 @@
 	loadtrainer COOLTRAINERM, GAVEN2
 	startbattle
 	returnafterbattle
-	clearflag $0067
+	clearflag ENGINE_GAVEN
 	end
 
 UnknownScript_0x1a4dbf:
@@ -191,7 +191,7 @@
 	writecode VAR_CALLERID, $c
 	talkaftercancel
 	loadfont
-	checkflag $0068
+	checkflag ENGINE_BETH
 	iftrue UnknownScript_0x1a4e35
 	checkcellnum $c
 	iftrue UnknownScript_0x1a4e87
@@ -231,7 +231,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f6, $1
-	clearflag $0068
+	clearflag ENGINE_BETH
 	end
 
 UnknownScript_0x1a4e65:
@@ -239,7 +239,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f6, $2
-	clearflag $0068
+	clearflag ENGINE_BETH
 	end
 
 UnknownScript_0x1a4e72:
@@ -246,7 +246,7 @@
 	loadtrainer COOLTRAINERF, BETH3
 	startbattle
 	returnafterbattle
-	clearflag $0068
+	clearflag ENGINE_BETH
 	end
 
 UnknownScript_0x1a4e7b:
--- a/maps/Route27.asm
+++ b/maps/Route27.asm
@@ -89,9 +89,9 @@
 	writecode VAR_CALLERID, $d
 	talkaftercancel
 	loadfont
-	checkflag $0069
+	checkflag ENGINE_JOSE
 	iftrue UnknownScript_0x1a08ff
-	checkflag $007e
+	checkflag ENGINE_JOSE_HAS_STAR_PIECE
 	iftrue UnknownScript_0x1a0945
 	checkcellnum $d
 	iftrue UnknownScript_0x1a0963
@@ -131,7 +131,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f7, $1
-	clearflag $0069
+	clearflag ENGINE_JOSE
 	end
 
 UnknownScript_0x1a092f:
@@ -139,7 +139,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f7, $2
-	clearflag $0069
+	clearflag ENGINE_JOSE
 	end
 
 UnknownScript_0x1a093c:
@@ -146,7 +146,7 @@
 	loadtrainer BIRD_KEEPER, JOSE3
 	startbattle
 	returnafterbattle
-	clearflag $0069
+	clearflag ENGINE_JOSE
 	end
 
 UnknownScript_0x1a0945:
@@ -153,7 +153,7 @@
 	scall UnknownScript_0x1a0973
 	verbosegiveitem STAR_PIECE, 1
 	iffalse UnknownScript_0x1a0954
-	clearflag $007e
+	clearflag ENGINE_JOSE_HAS_STAR_PIECE
 	jump UnknownScript_0x1a0963
 
 UnknownScript_0x1a0954:
@@ -272,7 +272,7 @@
 	writecode VAR_CALLERID, $e
 	talkaftercancel
 	loadfont
-	checkflag $006a
+	checkflag ENGINE_REENA
 	iftrue UnknownScript_0x1a09e9
 	checkcellnum $e
 	iftrue UnknownScript_0x1a0a3b
@@ -312,7 +312,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f8, $1
-	clearflag $006a
+	clearflag ENGINE_REENA
 	end
 
 UnknownScript_0x1a0a19:
@@ -320,7 +320,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f8, $2
-	clearflag $006a
+	clearflag ENGINE_REENA
 	end
 
 UnknownScript_0x1a0a26:
@@ -327,7 +327,7 @@
 	loadtrainer COOLTRAINERF, REENA3
 	startbattle
 	returnafterbattle
-	clearflag $006a
+	clearflag ENGINE_REENA
 	end
 
 UnknownScript_0x1a0a2f:
--- a/maps/Route30.asm
+++ b/maps/Route30.asm
@@ -48,7 +48,7 @@
 	writecode VAR_CALLERID, $f
 	talkaftercancel
 	loadfont
-	checkflag $006b
+	checkflag ENGINE_JOEY
 	iftrue UnknownScript_0x1a16e0
 	checkcellnum $f
 	iftrue UnknownScript_0x1a178f
@@ -96,7 +96,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f9, $1
-	clearflag $006b
+	clearflag ENGINE_JOEY
 	end
 
 UnknownScript_0x1a1724:
@@ -104,7 +104,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f9, $2
-	clearflag $006b
+	clearflag ENGINE_JOEY
 	end
 
 UnknownScript_0x1a1731:
@@ -112,7 +112,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f9, $3
-	clearflag $006b
+	clearflag ENGINE_JOEY
 	end
 
 UnknownScript_0x1a173e:
@@ -120,7 +120,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9f9, $4
-	clearflag $006b
+	clearflag ENGINE_JOEY
 	end
 
 UnknownScript_0x1a174b:
@@ -127,7 +127,7 @@
 	loadtrainer YOUNGSTER, JOEY5
 	startbattle
 	returnafterbattle
-	clearflag $006b
+	clearflag ENGINE_JOEY
 	checkevent EVENT_JOEY_HP_UP
 	iftrue UnknownScript_0x1a176f
 	checkevent $0266
--- a/maps/Route31.asm
+++ b/maps/Route31.asm
@@ -41,9 +41,9 @@
 	writecode VAR_CALLERID, $10
 	talkaftercancel
 	loadfont
-	checkflag $006c
+	checkflag ENGINE_WADE
 	iftrue UnknownScript_0x1a5493
-	checkflag $007f
+	checkflag ENGINE_WADE_HAS_ITEM
 	iftrue UnknownScript_0x1a5507
 	checkcellnum $10
 	iftrue UnknownScript_0x1a5558
@@ -91,7 +91,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fa, $1
-	clearflag $006c
+	clearflag ENGINE_WADE
 	end
 
 UnknownScript_0x1a54d7:
@@ -99,7 +99,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fa, $2
-	clearflag $006c
+	clearflag ENGINE_WADE
 	end
 
 UnknownScript_0x1a54e4:
@@ -107,7 +107,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fa, $3
-	clearflag $006c
+	clearflag ENGINE_WADE
 	end
 
 UnknownScript_0x1a54f1:
@@ -115,7 +115,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fa, $4
-	clearflag $006c
+	clearflag ENGINE_WADE
 	end
 
 UnknownScript_0x1a54fe:
@@ -122,42 +122,38 @@
 	loadtrainer BUG_CATCHER, WADE5
 	startbattle
 	returnafterbattle
-	clearflag $006c
+	clearflag ENGINE_WADE
 	end
 
 UnknownScript_0x1a5507:
 	scall UnknownScript_0x1a5568
 	checkevent EVENT_WADE_HAS_BERRY
-	iftrue UnknownScript_0x1a5522
+	iftrue .Berry
 	checkevent EVENT_WADE_HAS_PSNCUREBERRY
-	iftrue UnknownScript_0x1a552b
+	iftrue .Psncureberry
 	checkevent EVENT_WADE_HAS_PRZCUREBERRY
-	iftrue UnknownScript_0x1a5534
+	iftrue .Przcureberry
 	checkevent EVENT_WADE_HAS_BITTER_BERRY
-	iftrue UnknownScript_0x1a553d
-UnknownScript_0x1a5522:
+	iftrue .BitterBerry
+.Berry
 	verbosegiveitem BERRY, 1
-	iffalse UnknownScript_0x1a5549
-	jump UnknownScript_0x1a5543
-
-UnknownScript_0x1a552b:
+	iffalse .PackFull
+	jump .Done
+.Psncureberry
 	verbosegiveitem PSNCUREBERRY, 1
-	iffalse UnknownScript_0x1a5549
-	jump UnknownScript_0x1a5543
-
-UnknownScript_0x1a5534:
+	iffalse .PackFull
+	jump .Done
+.Przcureberry
 	verbosegiveitem PRZCUREBERRY, 1
-	iffalse UnknownScript_0x1a5549
-	jump UnknownScript_0x1a5543
-
-UnknownScript_0x1a553d:
+	iffalse .PackFull
+	jump .Done
+.BitterBerry
 	verbosegiveitem BITTER_BERRY, 1
-	iffalse UnknownScript_0x1a5549
-UnknownScript_0x1a5543:
-	clearflag $007f
+	iffalse .PackFull
+.Done
+	clearflag ENGINE_WADE_HAS_ITEM
 	jump UnknownScript_0x1a5558
-
-UnknownScript_0x1a5549:
+.PackFull
 	jump UnknownScript_0x1a556c
 
 UnknownScript_0x1a554c:
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -209,7 +209,7 @@
 	writecode VAR_CALLERID, $11
 	talkaftercancel
 	loadfont
-	checkflag $006d
+	checkflag ENGINE_RALPH
 	iftrue UnknownScript_0x19057d
 	checkflag $0052
 	iftrue UnknownScript_0x1905f1
@@ -259,7 +259,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fb, $1
-	clearflag $006d
+	clearflag ENGINE_RALPH
 	end
 
 UnknownScript_0x1905c1:
@@ -267,7 +267,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fb, $2
-	clearflag $006d
+	clearflag ENGINE_RALPH
 	end
 
 UnknownScript_0x1905ce:
@@ -275,7 +275,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fb, $3
-	clearflag $006d
+	clearflag ENGINE_RALPH
 	end
 
 UnknownScript_0x1905db:
@@ -283,7 +283,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fb, $4
-	clearflag $006d
+	clearflag ENGINE_RALPH
 	end
 
 UnknownScript_0x1905e8:
@@ -290,7 +290,7 @@
 	loadtrainer FISHER, RALPH5
 	startbattle
 	returnafterbattle
-	clearflag $006d
+	clearflag ENGINE_RALPH
 	end
 
 UnknownScript_0x1905f1:
@@ -377,7 +377,7 @@
 	writecode VAR_CALLERID, $12
 	talkaftercancel
 	loadfont
-	checkflag $006e
+	checkflag ENGINE_LIZ
 	iftrue UnknownScript_0x19066d
 	checkcellnum $12
 	iftrue UnknownScript_0x1906ed
@@ -425,7 +425,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fc, $1
-	clearflag $006e
+	clearflag ENGINE_LIZ
 	end
 
 UnknownScript_0x1906b1:
@@ -433,7 +433,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fc, $2
-	clearflag $006e
+	clearflag ENGINE_LIZ
 	end
 
 UnknownScript_0x1906be:
@@ -441,7 +441,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fc, $3
-	clearflag $006e
+	clearflag ENGINE_LIZ
 	end
 
 UnknownScript_0x1906cb:
@@ -449,7 +449,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fc, $4
-	clearflag $006e
+	clearflag ENGINE_LIZ
 	end
 
 UnknownScript_0x1906d8:
@@ -456,7 +456,7 @@
 	loadtrainer PICNICKER, LIZ5
 	startbattle
 	returnafterbattle
-	clearflag $006e
+	clearflag ENGINE_LIZ
 	end
 
 UnknownScript_0x1906e1:
--- a/maps/Route33.asm
+++ b/maps/Route33.asm
@@ -31,7 +31,7 @@
 	writecode VAR_CALLERID, $13
 	talkaftercancel
 	loadfont
-	checkflag $006f
+	checkflag ENGINE_ANTHONY
 	iftrue UnknownScript_0x1ac051
 	checkflag $00a0
 	iftrue UnknownScript_0x1ac0c5
@@ -81,7 +81,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fd, $1
-	clearflag $006f
+	clearflag ENGINE_ANTHONY
 	end
 
 UnknownScript_0x1ac095:
@@ -89,7 +89,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fd, $2
-	clearflag $006f
+	clearflag ENGINE_ANTHONY
 	end
 
 UnknownScript_0x1ac0a2:
@@ -97,7 +97,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fd, $3
-	clearflag $006f
+	clearflag ENGINE_ANTHONY
 	end
 
 UnknownScript_0x1ac0af:
@@ -105,7 +105,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fd, $4
-	clearflag $006f
+	clearflag ENGINE_ANTHONY
 	end
 
 UnknownScript_0x1ac0bc:
@@ -112,7 +112,7 @@
 	loadtrainer HIKER, ANTHONY5
 	startbattle
 	returnafterbattle
-	clearflag $006f
+	clearflag ENGINE_ANTHONY
 	end
 
 UnknownScript_0x1ac0c5:
--- a/maps/Route34.asm
+++ b/maps/Route34.asm
@@ -98,7 +98,7 @@
 	writecode VAR_CALLERID, $14
 	talkaftercancel
 	loadfont
-	checkflag $0070
+	checkflag ENGINE_TODD
 	iftrue UnknownScript_0x780bd
 	checkflag $0061
 	iftrue UnknownScript_0x78131
@@ -148,7 +148,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fe, $1
-	clearflag $0070
+	clearflag ENGINE_TODD
 	end
 
 UnknownScript_0x78101:
@@ -156,7 +156,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fe, $2
-	clearflag $0070
+	clearflag ENGINE_TODD
 	end
 
 UnknownScript_0x7810e:
@@ -164,7 +164,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fe, $3
-	clearflag $0070
+	clearflag ENGINE_TODD
 	end
 
 UnknownScript_0x7811b:
@@ -172,7 +172,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9fe, $4
-	clearflag $0070
+	clearflag ENGINE_TODD
 	end
 
 UnknownScript_0x78128:
@@ -179,7 +179,7 @@
 	loadtrainer CAMPER, TODD5
 	startbattle
 	returnafterbattle
-	clearflag $0070
+	clearflag ENGINE_TODD
 	end
 
 UnknownScript_0x78131:
@@ -239,9 +239,9 @@
 	writecode VAR_CALLERID, $15
 	talkaftercancel
 	loadfont
-	checkflag $0071
+	checkflag ENGINE_GINA
 	iftrue UnknownScript_0x7819f
-	checkflag $0080
+	checkflag ENGINE_GINA_HAS_LEAF_STONE
 	iftrue UnknownScript_0x78213
 	checkcellnum $15
 	iftrue UnknownScript_0x78234
@@ -289,7 +289,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9ff, $1
-	clearflag $0071
+	clearflag ENGINE_GINA
 	end
 
 UnknownScript_0x781e3:
@@ -297,7 +297,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9ff, $2
-	clearflag $0071
+	clearflag ENGINE_GINA
 	end
 
 UnknownScript_0x781f0:
@@ -305,7 +305,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9ff, $3
-	clearflag $0071
+	clearflag ENGINE_GINA
 	end
 
 UnknownScript_0x781fd:
@@ -313,7 +313,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wd9ff, $4
-	clearflag $0071
+	clearflag ENGINE_GINA
 	end
 
 UnknownScript_0x7820a:
@@ -320,7 +320,7 @@
 	loadtrainer PICNICKER, GINA5
 	startbattle
 	returnafterbattle
-	clearflag $0071
+	clearflag ENGINE_GINA
 	end
 
 UnknownScript_0x78213:
@@ -327,7 +327,7 @@
 	scall UnknownScript_0x78244
 	verbosegiveitem LEAF_STONE, 1
 	iffalse UnknownScript_0x78225
-	clearflag $0080
+	clearflag ENGINE_GINA_HAS_LEAF_STONE
 	setevent $0100
 	jump UnknownScript_0x78234
 
--- a/maps/Route35.asm
+++ b/maps/Route35.asm
@@ -234,7 +234,7 @@
 	writecode VAR_CALLERID, $17
 	talkaftercancel
 	loadfont
-	checkflag $0072
+	checkflag ENGINE_ARNIE
 	iftrue UnknownScript_0x19c9bb
 	checkflag $00a1
 	iftrue UnknownScript_0x19ca2f
@@ -284,7 +284,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda01, $1
-	clearflag $0072
+	clearflag ENGINE_ARNIE
 	end
 
 UnknownScript_0x19c9ff:
@@ -292,7 +292,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda01, $2
-	clearflag $0072
+	clearflag ENGINE_ARNIE
 	end
 
 UnknownScript_0x19ca0c:
@@ -300,7 +300,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda01, $3
-	clearflag $0072
+	clearflag ENGINE_ARNIE
 	end
 
 UnknownScript_0x19ca19:
@@ -308,7 +308,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda01, $4
-	clearflag $0072
+	clearflag ENGINE_ARNIE
 	end
 
 UnknownScript_0x19ca26:
@@ -315,7 +315,7 @@
 	loadtrainer BUG_CATCHER, ARNIE5
 	startbattle
 	returnafterbattle
-	clearflag $0072
+	clearflag ENGINE_ARNIE
 	end
 
 UnknownScript_0x19ca2f:
--- a/maps/Route36.asm
+++ b/maps/Route36.asm
@@ -184,9 +184,9 @@
 	writecode VAR_CALLERID, $18
 	talkaftercancel
 	loadfont
-	checkflag $0073
+	checkflag ENGINE_ALAN
 	iftrue UnknownScript_0x194140
-	checkflag $0081
+	checkflag ENGINE_ALAN_HAS_FIRE_STONE
 	iftrue UnknownScript_0x1941b4
 	checkcellnum $18
 	iftrue UnknownScript_0x1941d5
@@ -234,7 +234,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda02, $1
-	clearflag $0073
+	clearflag ENGINE_ALAN
 	end
 
 UnknownScript_0x194184:
@@ -242,7 +242,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda02, $2
-	clearflag $0073
+	clearflag ENGINE_ALAN
 	end
 
 UnknownScript_0x194191:
@@ -250,7 +250,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda02, $3
-	clearflag $0073
+	clearflag ENGINE_ALAN
 	end
 
 UnknownScript_0x19419e:
@@ -258,7 +258,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda02, $4
-	clearflag $0073
+	clearflag ENGINE_ALAN
 	end
 
 UnknownScript_0x1941ab:
@@ -265,7 +265,7 @@
 	loadtrainer SCHOOLBOY, ALAN5
 	startbattle
 	returnafterbattle
-	clearflag $0073
+	clearflag ENGINE_ALAN
 	end
 
 UnknownScript_0x1941b4:
@@ -272,7 +272,7 @@
 	scall UnknownScript_0x1941e5
 	verbosegiveitem FIRE_STONE, 1
 	iffalse UnknownScript_0x1941c6
-	clearflag $0081
+	clearflag ENGINE_ALAN_HAS_FIRE_STONE
 	setevent $0101
 	jump UnknownScript_0x1941d5
 
--- a/maps/Route38.asm
+++ b/maps/Route38.asm
@@ -82,9 +82,9 @@
 	writecode VAR_CALLERID, $1a
 	talkaftercancel
 	loadfont
-	checkflag $0074
+	checkflag ENGINE_DANA
 	iftrue UnknownScript_0x1a1d82
-	checkflag $0082
+	checkflag ENGINE_LIZ_HAS_THUNDERSTONE
 	iftrue UnknownScript_0x1a1df6
 	checkcellnum $1a
 	iftrue UnknownScript_0x1a1e17
@@ -132,7 +132,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda03, $1
-	clearflag $0074
+	clearflag ENGINE_DANA
 	end
 
 UnknownScript_0x1a1dc6:
@@ -140,7 +140,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda03, $2
-	clearflag $0074
+	clearflag ENGINE_DANA
 	end
 
 UnknownScript_0x1a1dd3:
@@ -148,7 +148,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda03, $3
-	clearflag $0074
+	clearflag ENGINE_DANA
 	end
 
 UnknownScript_0x1a1de0:
@@ -156,7 +156,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda03, $4
-	clearflag $0074
+	clearflag ENGINE_DANA
 	end
 
 UnknownScript_0x1a1ded:
@@ -163,7 +163,7 @@
 	loadtrainer LASS, DANA5
 	startbattle
 	returnafterbattle
-	clearflag $0074
+	clearflag ENGINE_DANA
 	end
 
 UnknownScript_0x1a1df6:
@@ -170,7 +170,7 @@
 	scall UnknownScript_0x1a1e27
 	verbosegiveitem THUNDERSTONE, 1
 	iffalse UnknownScript_0x1a1e08
-	clearflag $0082
+	clearflag ENGINE_LIZ_HAS_THUNDERSTONE
 	setevent $0102
 	jump UnknownScript_0x1a1e17
 
@@ -236,7 +236,7 @@
 	writecode VAR_CALLERID, $1b
 	talkaftercancel
 	loadfont
-	checkflag $0075
+	checkflag ENGINE_CHAD
 	iftrue UnknownScript_0x1a1e75
 	checkcellnum $1b
 	iftrue UnknownScript_0x1a1ef5
@@ -284,7 +284,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda04, $1
-	clearflag $0075
+	clearflag ENGINE_CHAD
 	end
 
 UnknownScript_0x1a1eb9:
@@ -292,7 +292,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda04, $2
-	clearflag $0075
+	clearflag ENGINE_CHAD
 	end
 
 UnknownScript_0x1a1ec6:
@@ -300,7 +300,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda04, $3
-	clearflag $0075
+	clearflag ENGINE_CHAD
 	end
 
 UnknownScript_0x1a1ed3:
@@ -308,7 +308,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda04, $4
-	clearflag $0075
+	clearflag ENGINE_CHAD
 	end
 
 UnknownScript_0x1a1ee0:
@@ -315,7 +315,7 @@
 	loadtrainer SCHOOLBOY, CHAD5
 	startbattle
 	returnafterbattle
-	clearflag $0075
+	clearflag ENGINE_CHAD
 	end
 
 UnknownScript_0x1a1ee9:
--- a/maps/Route39.asm
+++ b/maps/Route39.asm
@@ -36,7 +36,7 @@
 	writecode VAR_CALLERID, $1c
 	talkaftercancel
 	loadfont
-	checkflag $0083
+	checkflag ENGINE_DEREK_HAS_NUGGET
 	iftrue UnknownScript_0x1a5b4a
 	checkcellnum $1c
 	iftrue UnknownScript_0x1a5b6e
@@ -64,7 +64,7 @@
 	scall UnknownScript_0x1a5b7a
 	verbosegiveitem NUGGET, 1
 	iffalse UnknownScript_0x1a5b59
-	clearflag $0083
+	clearflag ENGINE_DEREK_HAS_NUGGET
 	jump UnknownScript_0x1a5b6e
 
 UnknownScript_0x1a5b59:
--- a/maps/Route42.asm
+++ b/maps/Route42.asm
@@ -50,9 +50,9 @@
 	writecode VAR_CALLERID, $1d
 	talkaftercancel
 	loadfont
-	checkflag $0076
+	checkflag ENGINE_TULLY
 	iftrue UnknownScript_0x1a927f
-	checkflag $0084
+	checkflag ENGINE_TULLY_HAS_WATER_STONE
 	iftrue UnknownScript_0x1a92dc
 	checkcellnum $1d
 	iftrue UnknownScript_0x1a92fd
@@ -96,7 +96,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda06, $1
-	clearflag $0076
+	clearflag ENGINE_TULLY
 	end
 
 UnknownScript_0x1a92b9:
@@ -104,7 +104,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda06, $2
-	clearflag $0076
+	clearflag ENGINE_TULLY
 	end
 
 UnknownScript_0x1a92c6:
@@ -112,7 +112,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda06, $3
-	clearflag $0076
+	clearflag ENGINE_TULLY
 	end
 
 UnknownScript_0x1a92d3:
@@ -119,7 +119,7 @@
 	loadtrainer FISHER, TULLY4
 	startbattle
 	returnafterbattle
-	clearflag $0076
+	clearflag ENGINE_TULLY
 	end
 
 UnknownScript_0x1a92dc:
@@ -126,7 +126,7 @@
 	scall UnknownScript_0x1a930d
 	verbosegiveitem WATER_STONE, 1
 	iffalse UnknownScript_0x1a92ee
-	clearflag $0084
+	clearflag ENGINE_TULLY_HAS_WATER_STONE
 	setevent $0103
 	jump UnknownScript_0x1a92fd
 
--- a/maps/Route43.asm
+++ b/maps/Route43.asm
@@ -96,7 +96,7 @@
 	writecode VAR_CALLERID, $1e
 	talkaftercancel
 	loadfont
-	checkflag $0077
+	checkflag ENGINE_BRENT
 	iftrue UnknownScript_0x19d0cf
 	checkcellnum $1e
 	iftrue UnknownScript_0x19d138
@@ -140,7 +140,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda07, $1
-	clearflag $0077
+	clearflag ENGINE_BRENT
 	end
 
 UnknownScript_0x19d109:
@@ -148,7 +148,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda07, $2
-	clearflag $0077
+	clearflag ENGINE_BRENT
 	end
 
 UnknownScript_0x19d116:
@@ -156,7 +156,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda07, $3
-	clearflag $0077
+	clearflag ENGINE_BRENT
 	end
 
 UnknownScript_0x19d123:
@@ -163,7 +163,7 @@
 	loadtrainer POKEMANIAC, BRENT4
 	startbattle
 	returnafterbattle
-	clearflag $0077
+	clearflag ENGINE_BRENT
 	end
 
 UnknownScript_0x19d12c:
@@ -271,9 +271,9 @@
 	writecode VAR_CALLERID, $1f
 	talkaftercancel
 	loadfont
-	checkflag $0078
+	checkflag ENGINE_TIFFANY
 	iftrue UnknownScript_0x19d1c1
-	checkflag $0085
+	checkflag ENGINE_TIFFANY_HAS_PINK_BOW
 	iftrue UnknownScript_0x19d21e
 	checkcellnum $1f
 	iftrue UnknownScript_0x19d245
@@ -319,7 +319,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda08, $1
-	clearflag $0078
+	clearflag ENGINE_TIFFANY
 	end
 
 UnknownScript_0x19d1fb:
@@ -327,7 +327,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda08, $2
-	clearflag $0078
+	clearflag ENGINE_TIFFANY
 	end
 
 UnknownScript_0x19d208:
@@ -335,7 +335,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda08, $3
-	clearflag $0078
+	clearflag ENGINE_TIFFANY
 	end
 
 UnknownScript_0x19d215:
@@ -342,7 +342,7 @@
 	loadtrainer PICNICKER, TIFFANY4
 	startbattle
 	returnafterbattle
-	clearflag $0078
+	clearflag ENGINE_TIFFANY
 	end
 
 UnknownScript_0x19d21e:
@@ -349,7 +349,7 @@
 	scall UnknownScript_0x19d255
 	verbosegiveitem PINK_BOW, 1
 	iffalse UnknownScript_0x19d230
-	clearflag $0085
+	clearflag ENGINE_TIFFANY_HAS_PINK_BOW
 	setevent $0104
 	jump UnknownScript_0x19d245
 
--- a/maps/Route44.asm
+++ b/maps/Route44.asm
@@ -28,7 +28,7 @@
 	writecode VAR_CALLERID, $20
 	talkaftercancel
 	loadfont
-	checkflag $0079
+	checkflag ENGINE_VANCE
 	iftrue UnknownScript_0x19d86a
 	checkcellnum $20
 	iftrue UnknownScript_0x19d8eb
@@ -68,7 +68,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda09, $1
-	clearflag $0079
+	clearflag ENGINE_VANCE
 	end
 
 UnknownScript_0x19d89a:
@@ -76,7 +76,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda09, $2
-	clearflag $0079
+	clearflag ENGINE_VANCE
 	end
 
 UnknownScript_0x19d8a7:
@@ -83,7 +83,7 @@
 	loadtrainer BIRD_KEEPER, VANCE3
 	startbattle
 	returnafterbattle
-	clearflag $0079
+	clearflag ENGINE_VANCE
 	checkevent EVENT_VANCE_CARBOS
 	iftrue UnknownScript_0x19d8cb
 	checkevent $0267
@@ -202,9 +202,9 @@
 	writecode VAR_CALLERID, $21
 	talkaftercancel
 	loadfont
-	checkflag $007a
+	checkflag ENGINE_WILTON
 	iftrue UnknownScript_0x19d96e
-	checkflag $0086
+	checkflag ENGINE_WILTON_HAS_ITEM
 	iftrue UnknownScript_0x19d9b4
 	checkcellnum $21
 	iftrue UnknownScript_0x19d8eb
@@ -244,7 +244,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0a, $1
-	clearflag $007a
+	clearflag ENGINE_WILTON
 	end
 
 UnknownScript_0x19d99e:
@@ -252,7 +252,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0a, $2
-	clearflag $007a
+	clearflag ENGINE_WILTON
 	end
 
 UnknownScript_0x19d9ab:
@@ -259,7 +259,7 @@
 	loadtrainer FISHER, WILTON3
 	startbattle
 	returnafterbattle
-	clearflag $007a
+	clearflag ENGINE_WILTON
 	end
 
 UnknownScript_0x19d9b4:
@@ -284,7 +284,7 @@
 	verbosegiveitem POKE_BALL, 1
 	iffalse UnknownScript_0x19d9e7
 UnknownScript_0x19d9e1:
-	clearflag $0086
+	clearflag ENGINE_WILTON_HAS_ITEM
 	jump UnknownScript_0x19d8eb
 
 UnknownScript_0x19d9e7:
--- a/maps/Route45.asm
+++ b/maps/Route45.asm
@@ -202,7 +202,7 @@
 	writecode VAR_CALLERID, $23
 	talkaftercancel
 	loadfont
-	checkflag $007b
+	checkflag ENGINE_PARRY
 	iftrue UnknownScript_0x19e1b8
 	checkcellnum $23
 	iftrue UnknownScript_0x19e127
@@ -242,7 +242,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0c, $1
-	clearflag $007b
+	clearflag ENGINE_PARRY
 	end
 
 UnknownScript_0x19e1e8:
@@ -250,7 +250,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0c, $2
-	clearflag $007b
+	clearflag ENGINE_PARRY
 	end
 
 UnknownScript_0x19e1f5:
@@ -257,7 +257,7 @@
 	loadtrainer HIKER, PARRY2
 	startbattle
 	returnafterbattle
-	clearflag $007b
+	clearflag ENGINE_PARRY
 	checkevent EVENT_PARRY_IRON
 	iftrue UnknownScript_0x19e219
 	checkevent $0268
--- a/maps/Route46.asm
+++ b/maps/Route46.asm
@@ -55,7 +55,7 @@
 	writecode VAR_CALLERID, $24
 	talkaftercancel
 	loadfont
-	checkflag $007c
+	checkflag ENGINE_ERIN
 	iftrue UnknownScript_0x1a96da
 	checkcellnum $24
 	iftrue UnknownScript_0x1a975b
@@ -95,7 +95,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0d, $1
-	clearflag $007c
+	clearflag ENGINE_ERIN
 	end
 
 UnknownScript_0x1a970a:
@@ -103,7 +103,7 @@
 	startbattle
 	returnafterbattle
 	loadvar wda0d, $2
-	clearflag $007c
+	clearflag ENGINE_ERIN
 	end
 
 UnknownScript_0x1a9717:
@@ -110,7 +110,7 @@
 	loadtrainer PICNICKER, ERIN3
 	startbattle
 	returnafterbattle
-	clearflag $007c
+	clearflag ENGINE_ERIN
 	checkevent EVENT_ERIN_CALCIUM
 	iftrue UnknownScript_0x1a973b
 	checkevent $0269
--- a/maps/ViridianCity.asm
+++ b/maps/ViridianCity.asm
@@ -32,14 +32,14 @@
 GrampsScript_0x1a9a61:
 	faceplayer
 	loadfont
-	checkevent $0775
-	iftrue UnknownScript_0x1a9a6f
+	checkevent EVENT_BLUE_IN_CINNABAR
+	iftrue .BlueReturned
 	writetext UnknownText_0x1a9c11
 	closetext
 	loadmovesprites
 	end
 
-UnknownScript_0x1a9a6f:
+.BlueReturned
 	writetext UnknownText_0x1a9c7e
 	closetext
 	loadmovesprites
--- a/maps/ViridianPokeCenter1F.asm
+++ b/maps/ViridianPokeCenter1F.asm
@@ -1,42 +1,36 @@
-ViridianPokeCenter1F_MapScriptHeader: ; 0x9b68e
+ViridianPokeCenter1F_MapScriptHeader:
 	; trigger count
 	db 0
 
 	; callback count
 	db 0
-; 0x9b690
 
-NurseScript_0x9b690: ; 0x9b690
+NurseScript_0x9b690:
 	jumpstd pokecenternurse
-; 0x9b693
 
-CooltrainerMScript_0x9b693: ; 0x9b693
+CooltrainerMScript_0x9b693:
 	faceplayer
 	loadfont
-	checkevent $0775
-	iftrue UnknownScript_0x9b6a1
+	checkevent EVENT_BLUE_IN_CINNABAR
+	iftrue .BlueReturned
 	writetext UnknownText_0x9b6ad
 	closetext
 	loadmovesprites
 	end
-; 0x9b6a1
 
-UnknownScript_0x9b6a1: ; 0x9b6a1
+.BlueReturned
 	writetext UnknownText_0x9b6f5
 	closetext
 	loadmovesprites
 	end
-; 0x9b6a7
 
-CooltrainerFScript_0x9b6a7: ; 0x9b6a7
+CooltrainerFScript_0x9b6a7:
 	jumptextfaceplayer UnknownText_0x9b76b
-; 0x9b6aa
 
-BugCatcherScript_0x9b6aa: ; 0x9b6aa
+BugCatcherScript_0x9b6aa:
 	jumptextfaceplayer UnknownText_0x9b7c8
-; 0x9b6ad
 
-UnknownText_0x9b6ad: ; 0x9b6ad
+UnknownText_0x9b6ad:
 	text "Where in the world"
 	line "is VIRIDIAN's GYM"
 
@@ -43,9 +37,8 @@
 	para "LEADER? I wanted"
 	line "to challenge him."
 	done
-; 0x9b6f5
 
-UnknownText_0x9b6f5: ; 0x9b6f5
+UnknownText_0x9b6f5:
 	text "There are no GYM"
 	line "TRAINERS at the"
 	cont "VIRIDIAN GYM."
@@ -56,9 +49,8 @@
 	para "win without having"
 	line "any underlings."
 	done
-; 0x9b76b
 
-UnknownText_0x9b76b: ; 0x9b76b
+UnknownText_0x9b76b:
 	text "I heard that the"
 	line "GYM in CINNABAR is"
 	cont "gone."
@@ -67,15 +59,13 @@
 	line "came of BLAINE,"
 	cont "the GYM LEADER."
 	done
-; 0x9b7c8
 
-UnknownText_0x9b7c8: ; 0x9b7c8
+UnknownText_0x9b7c8:
 	text "My dream is to be-"
 	line "come a GYM LEADER."
 	done
-; 0x9b7ef
 
-ViridianPokeCenter1F_MapEventHeader: ; 0x9b7ef
+ViridianPokeCenter1F_MapEventHeader:
 	; filler
 	db 0, 0
 
@@ -97,4 +87,3 @@
 	person_event SPRITE_COOLTRAINER_M, 8, 12, $5, $1, 255, 255, $80, 0, CooltrainerMScript_0x9b693, $ffff
 	person_event SPRITE_COOLTRAINER_F, 7, 9, $7, $0, 255, 255, $90, 0, CooltrainerFScript_0x9b6a7, $ffff
 	person_event SPRITE_BUG_CATCHER, 10, 5, $9, $0, 255, 255, $a0, 0, BugCatcherScript_0x9b6aa, $ffff
-; 0x9b838