ref: 2faa4a0f70edd91bde908139b3fd5b6b5aebf017
parent: 0f37a42ad45d8950c83b31215523e2e1cc7c2d21
author: PikalaxALT <PikalaxALT@gmail.com>
date: Tue Nov 3 02:11:32 EST 2015
Fix errors in global substitution
--- a/constants/event_flags.asm
+++ b/constants/event_flags.asm
@@ -1817,7 +1817,7 @@
const EVENT_OLIVINE_LIGHTHOUSE_JASMINE
const EVENT_OLIVINE_GYM_JASMINE
const EVENT_LAKE_OF_RAGE_LANCE
- const EVENT_MAHOGANY_MARTTYPE_LANCE_AND_DRAGONITE
+ const EVENT_MAHOGANY_MART_LANCE_AND_DRAGONITE
const EVENT_TEAM_ROCKET_BASE_B2F_LANCE
const EVENT_TEAM_ROCKET_BASE_B3F_LANCE_PASSWORDS
const EVENT_DRAGONS_DEN_CLAIR
@@ -1914,7 +1914,7 @@
const EVENT_OLIVINE_PORT_PASSAGE_POKEFAN_M
const EVENT_ROUTE_35_NATIONAL_PARK_GATE_YOUNGSTER
const EVENT_LAKE_OF_RAGE_CIVILIANS
- const EVENT_MAHOGANY_MARTTYPE_OWNERS
+ const EVENT_MAHOGANY_MART_OWNERS
const EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME
const EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME
const EVENT_FAST_SHIP_PASSENGERS_FIRST_TRIP
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -82,7 +82,7 @@
mapgroup OLIVINE_LIGHTHOUSE_4F, 9, 10 ; 45
mapgroup OLIVINE_LIGHTHOUSE_5F, 9, 10 ; 46
mapgroup OLIVINE_LIGHTHOUSE_6F, 9, 10 ; 47
- mapgroup MAHOGANY_MARTTYPE_1F, 4, 4 ; 48
+ mapgroup MAHOGANY_MART_1F, 4, 4 ; 48
mapgroup TEAM_ROCKET_BASE_B1F, 9, 15 ; 49
mapgroup TEAM_ROCKET_BASE_B2F, 9, 15 ; 50
mapgroup TEAM_ROCKET_BASE_B3F, 9, 15 ; 51
--- a/engine/map_triggers.asm
+++ b/engine/map_triggers.asm
@@ -71,7 +71,7 @@
trigger_def RUINS_OF_ALPH_OMANYTE_CHAMBER, wRuinsOfAlphOmanyteChamberTrigger
trigger_def RUINS_OF_ALPH_AERODACTYL_CHAMBER, wRuinsOfAlphAerodactylChamberTrigger
trigger_def RUINS_OF_ALPH_INNER_CHAMBER, wRuinsOfAlphInnerChamberTrigger
- trigger_def MAHOGANY_MARTTYPE_1F, wMahoganyMart1FTrigger
+ trigger_def MAHOGANY_MART_1F, wMahoganyMart1FTrigger
trigger_def TEAM_ROCKET_BASE_B1F, wTeamRocketBaseB1FTrigger
trigger_def TEAM_ROCKET_BASE_B2F, wTeamRocketBaseB2FTrigger
trigger_def TEAM_ROCKET_BASE_B3F, wTeamRocketBaseB3FTrigger
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1411,7 +1411,7 @@
ld a, BANK(PackMenuGFX)
call FarCopyBytes
hlcoord 0, 1
- lb bc, 0, 220
+ ld bc, 220
ld a, $24
call ByteFill
hlcoord 5, 1
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -489,7 +489,7 @@
setevent EVENT_ILEX_FOREST_APPRENTICE
setevent EVENT_ILEX_FOREST_FARFETCHD
setevent EVENT_ILEX_FOREST_CHARCOAL_MASTER
- setevent EVENT_MAHOGANY_MARTTYPE_LANCE_AND_DRAGONITE
+ setevent EVENT_MAHOGANY_MART_LANCE_AND_DRAGONITE
setevent EVENT_TEAM_ROCKET_BASE_B2F_GRUNT_WITH_EXECUTIVE
setevent EVENT_TEAM_ROCKET_BASE_B2F_EXECUTIVE
setevent EVENT_TEAM_ROCKET_BASE_B2F_DRAGONITE
@@ -535,7 +535,7 @@
setevent EVENT_FAST_SHIP_B1F_SAILOR_RIGHT
setevent EVENT_FAST_SHIP_CABINS_NNW_NNE_NE_SAILOR
setevent EVENT_LAKE_OF_RAGE_CIVILIANS
- setevent EVENT_MAHOGANY_MARTTYPE_OWNERS
+ setevent EVENT_MAHOGANY_MART_OWNERS
setevent EVENT_TIN_TOWER_ROOF_HO_OH
setevent EVENT_WHIRL_ISLAND_LUGIA_CHAMBER_LUGIA
setevent EVENT_KRISS_HOUSE_2F_CONSOLE
--- a/main.asm
+++ b/main.asm
@@ -2432,11 +2432,11 @@
.loop
ld [hObjectStructIndexBuffer], a
call GetObjectSprite
- jr z, .nope
+ jr z, .next
ld hl, OBJECT_FLAGS1
add hl, bc
bit 7, [hl]
- jr nz, .nope
+ jr nz, .next
ld hl, OBJECT_PALETTE
add hl, bc
bit 7, [hl]
@@ -2469,12 +2469,12 @@
add hl, bc
ld a, [hl]
cp d
- jr nz, .nope
+ jr nz, .next
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp e
- jr nz, .nope
+ jr nz, .next
ld a, [hMapObjectIndexBuffer]
ld l, a
ld a, [hObjectStructIndexBuffer]
@@ -2481,7 +2481,7 @@
cp l
jr nz, .setcarry
-.nope
+.next
ld hl, OBJECT_STRUCT_LENGTH
add hl, bc
ld b, h
@@ -16827,7 +16827,7 @@
GetTileAddr: ; 14406
; Return the address of tile (a) in (hl).
- and (VTiles1 - VTiles0) / $10 - 1
+ and $7f
ld l, a
ld h, 0
rept 4
@@ -18531,7 +18531,7 @@
ld [EngineBuffer1], a
xor a
ld [MovementAnimation], a
- call Function15b47
+ call StandardMart
ret
; 15a6e
@@ -18656,26 +18656,26 @@
ret
; 15b47
-Function15b47: ; 15b47
-.asm_15b47
+StandardMart: ; 15b47
+.loop
ld a, [MovementAnimation]
- ld hl, .table_15b56
+ ld hl, .MartFunctions
rst JumpTable
ld [MovementAnimation], a
cp $ff
- jr nz, .asm_15b47
+ jr nz, .loop
ret
-.table_15b56
- dw Function15b62
- dw Function15b6e
- dw Function15b8d
- dw Function15b9a
- dw Function15ba3
- dw Function15baf
+.MartFunctions
+ dw .HowMayIHelpYou
+ dw .TopMenu
+ dw .Buy
+ dw .Sell
+ dw .Quit
+ dw .AnythingElse
; 15b62
-Function15b62: ; 15b62
+.HowMayIHelpYou: ; 15b62
call LoadMenuDataHeader_0x1d75
ld hl, UnknownText_0x15f83
call PrintText
@@ -18683,28 +18683,28 @@
ret
; 15b6e
-Function15b6e: ; 15b6e
+.TopMenu: ; 15b6e
ld hl, MenuDataHeader_0x15f88
call CopyMenuDataHeader
call InterpretMenu2
- jr c, .asm_15b84
+ jr c, .quit
ld a, [wcfa9]
cp $1
- jr z, .asm_15b87
+ jr z, .buy
cp $2
- jr z, .asm_15b8a
-.asm_15b84
+ jr z, .sell
+.quit
ld a, $4
ret
-.asm_15b87
+.buy
ld a, $2
ret
-.asm_15b8a
+.sell
ld a, $3
ret
; 15b8d
-Function15b8d: ; 15b8d
+.Buy: ; 15b8d
call ExitMenu
call ReadMart
call Function15c62
@@ -18713,7 +18713,7 @@
ret
; 15b9a
-Function15b9a: ; 15b9a
+.Sell: ; 15b9a
call ExitMenu
call Function15eb3
ld a, $5
@@ -18720,7 +18720,7 @@
ret
; 15ba3
-Function15ba3: ; 15ba3
+.Quit: ; 15ba3
call ExitMenu
ld hl, UnknownText_0x15fb4
call Function15fcd
@@ -18728,7 +18728,7 @@
ret
; 15baf
-Function15baf: ; 15baf
+.AnythingElse: ; 15baf
call LoadMenuDataHeader_0x1d75
ld hl, UnknownText_0x15fb9
call PrintText
@@ -18743,7 +18743,7 @@
ld l, a
ld de, CurMart
.CopyMart
- ld a, [wd03f]
+ ld a, [MartPointerBank]
call GetFarByte
ld [de], a
inc hl
@@ -18755,14 +18755,14 @@
.ReadMartItem
ld a, [de]
inc de
- cp $ff
- jr z, .asm_15be4
+ cp -1
+ jr z, .done
push de
call GetMartItemPrice
pop de
jr .ReadMartItem
-.asm_15be4
+.done
ret
; 15be5
--- a/maps/BlackthornGym1F.asm
+++ b/maps/BlackthornGym1F.asm
@@ -47,7 +47,7 @@
setevent EVENT_BEAT_COOLTRAINERM_MIKE
setevent EVENT_BEAT_COOLTRAINERF_FRAN
setevent EVENT_BEAT_COOLTRAINERF_LOLA
- clearevent EVENT_MAHOGANY_MARTTYPE_OWNERS
+ clearevent EVENT_MAHOGANY_MART_OWNERS
setevent EVENT_BLACKTHORN_CITY_GRAMPS_BLOCKS_DRAGONS_DEN
clearevent EVENT_BLACKTHORN_CITY_GRAMPS_NOT_BLOCKING_DRAGONS_DEN
end
--- a/maps/LakeofRage.asm
+++ b/maps/LakeofRage.asm
@@ -51,9 +51,9 @@
playsound SFX_WARP_TO
applymovement $2, MovementData_0x70155
disappear $2
- clearevent EVENT_MAHOGANY_MARTTYPE_LANCE_AND_DRAGONITE
+ clearevent EVENT_MAHOGANY_MART_LANCE_AND_DRAGONITE
setevent EVENT_DECIDED_TO_HELP_LANCE
- domaptrigger MAHOGANY_MARTTYPE_1F, $1
+ domaptrigger MAHOGANY_MART_1F, $1
end
UnknownScript_0x7004e:
--- a/maps/MahoganyMart1F.asm
+++ b/maps/MahoganyMart1F.asm
@@ -238,6 +238,6 @@
db 5
person_event SPRITE_PHARMACIST, 3, 4, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, 0, 0, PharmacistScript_0x6c367, EVENT_TEAM_ROCKET_BASE_POPULATION
person_event SPRITE_BLACK_BELT, 6, 1, SPRITEMOVEDATA_03, 0, 0, -1, -1, 0, 0, 0, BlackBeltScript_0x6c37b, EVENT_TEAM_ROCKET_BASE_POPULATION
- person_event SPRITE_LANCE, 6, 4, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, 0, 0, ObjectEvent, EVENT_MAHOGANY_MARTTYPE_LANCE_AND_DRAGONITE
- person_event SPRITE_DRAGON, 6, 3, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, 0, 0, ObjectEvent, EVENT_MAHOGANY_MARTTYPE_LANCE_AND_DRAGONITE
- person_event SPRITE_GRANNY, 3, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, 0, 0, GrannyScript_0x6c3ee, EVENT_MAHOGANY_MARTTYPE_OWNERS
+ person_event SPRITE_LANCE, 6, 4, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, 0, 0, ObjectEvent, EVENT_MAHOGANY_MART_LANCE_AND_DRAGONITE
+ person_event SPRITE_DRAGON, 6, 3, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, 0, 0, ObjectEvent, EVENT_MAHOGANY_MART_LANCE_AND_DRAGONITE
+ person_event SPRITE_GRANNY, 3, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, 0, 0, GrannyScript_0x6c3ee, EVENT_MAHOGANY_MART_OWNERS
--- a/maps/MahoganyTown.asm
+++ b/maps/MahoganyTown.asm
@@ -248,7 +248,7 @@
.Warps:
db 5
- warp_def $7, $b, 1, MAHOGANY_MARTTYPE_1F
+ warp_def $7, $b, 1, MAHOGANY_MART_1F
warp_def $7, $11, 1, MAHOGANY_RED_GYARADOS_SPEECH_HOUSE
warp_def $d, $6, 1, MAHOGANY_GYM
warp_def $d, $f, 1, MAHOGANY_POKECENTER_1F
@@ -271,4 +271,4 @@
person_event SPRITE_POKEFAN_M, 8, 19, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, 0, 0, PokefanMScript_0x19002e, EVENT_MAHOGANY_TOWN_POKEFAN_M_BLOCKS_EAST
person_event SPRITE_GRAMPS, 9, 6, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 0, 1, -1, -1, 0, 0, 0, GrampsScript_0x19007e, -1
person_event SPRITE_FISHER, 14, 6, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, (1 << 3) | PAL_OW_GREEN, 0, 0, FisherScript_0x190092, EVENT_MAHOGANY_TOWN_POKEFAN_M_BLOCKS_GYM
- person_event SPRITE_LASS, 8, 12, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, 0, 0, LassScript_0x190095, EVENT_MAHOGANY_MARTTYPE_OWNERS
+ person_event SPRITE_LASS, 8, 12, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, 0, 0, LassScript_0x190095, EVENT_MAHOGANY_MART_OWNERS
--- a/maps/RadioTower5F.asm
+++ b/maps/RadioTower5F.asm
@@ -102,7 +102,7 @@
setevent EVENT_GOLDENROD_CITY_ROCKET_SCOUT
setevent EVENT_GOLDENROD_CITY_ROCKET_TAKEOVER
setevent EVENT_RADIO_TOWER_ROCKET_TAKEOVER
- clearevent EVENT_MAHOGANY_MARTTYPE_OWNERS
+ clearevent EVENT_MAHOGANY_MART_OWNERS
clearflag ENGINE_ROCKETS_IN_MAHOGANY
clearevent EVENT_GOLDENROD_CITY_CIVILIANS
clearevent EVENT_RADIO_TOWER_CIVILIANS_AFTER
--- a/maps/TeamRocketBaseB1F.asm
+++ b/maps/TeamRocketBaseB1F.asm
@@ -730,7 +730,7 @@
.Warps:
db 4
- warp_def $2, $1b, 3, MAHOGANY_MARTTYPE_1F
+ warp_def $2, $1b, 3, MAHOGANY_MART_1F
warp_def $e, $3, 1, TEAM_ROCKET_BASE_B2F
warp_def $f, $5, 4, TEAM_ROCKET_BASE_B1F
warp_def $2, $19, 3, TEAM_ROCKET_BASE_B1F
--- a/maps/second_map_headers.asm
+++ b/maps/second_map_headers.asm
@@ -325,7 +325,7 @@
map_header_2 OlivineLighthouse4F, OLIVINE_LIGHTHOUSE_4F, $0, 0
map_header_2 OlivineLighthouse5F, OLIVINE_LIGHTHOUSE_5F, $0, 0
map_header_2 OlivineLighthouse6F, OLIVINE_LIGHTHOUSE_6F, $0, 0
- map_header_2 MahoganyMart1F, MAHOGANY_MARTTYPE_1F, $0, 0
+ map_header_2 MahoganyMart1F, MAHOGANY_MART_1F, $0, 0
map_header_2 TeamRocketBaseB1F, TEAM_ROCKET_BASE_B1F, $0, 0
map_header_2 TeamRocketBaseB2F, TEAM_ROCKET_BASE_B2F, $0, 0
map_header_2 TeamRocketBaseB3F, TEAM_ROCKET_BASE_B3F, $0, 0