named more variables

This commit is contained in:
YamaArashi 2015-08-12 22:14:31 -07:00
parent 64cfbcce7a
commit 132d036752
33 changed files with 185 additions and 142 deletions

View file

@ -35,7 +35,7 @@ CeladonMartElevatorScript_48631: ; 48631 (12:4631)
ld hl, CeladonMartElavatorFloors
call LoadItemList
ld hl, CeldaonMartElevatorWarpMaps
ld de, wcc5b
ld de, wElevatorWarpMaps
ld bc, CeldaonMartElevatorWarpMapsEnd - CeldaonMartElevatorWarpMaps
jp CopyData

View file

@ -1,34 +1,35 @@
CeladonMartRoofScript: ; 483d5 (12:43d5)
jp EnableAutoTextBoxDrawing
CeladonMartRoofScript_483d8: ; 483d8 (12:43d8)
CeladonMartRoofScript_GetDrinksInBag: ; 483d8 (12:43d8)
; construct a list of all drinks in the player's bag
xor a
ld [wcd37], a
ld de, wcc5b
ld [wFilteredBagItemsCount], a
ld de, wFilteredBagItems
ld hl, CeladonMartRoofDrinkList
.asm_483e2
.loop
ld a, [hli]
and a
jr z, .asm_48404
jr z, .done
push hl
push de
ld [wd11e], a
ld b, a
predef IsItemInBag_
predef GetQuantityOfItemInBag
pop de
pop hl
ld a, b
and a
jr z, .asm_483e2
jr z, .loop ; if the item isn't in the bag
ld a, [wd11e]
ld [de], a
inc de
push hl
ld hl, wcd37
ld hl, wFilteredBagItemsCount
inc [hl]
pop hl
jr .asm_483e2
.asm_48404
jr .loop
.done
ld a, $ff
ld [de], a
ret
@ -39,7 +40,7 @@ CeladonMartRoofDrinkList: ; 48408 (12:4408)
db LEMONADE
db $00
CeladonMartRoofScript_4840c: ; 4840c (12:440c)
CeladonMartRoofScript_GiveDrinkToGirl: ; 4840c (12:440c)
ld hl, wd730
set 6, [hl]
ld hl, CeladonMartRoofText_484ee
@ -48,83 +49,84 @@ CeladonMartRoofScript_4840c: ; 4840c (12:440c)
ld [wCurrentMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, [wcd37]
ld a, [wFilteredBagItemsCount]
dec a
ld [wMaxMenuItem], a
ld a, $2
ld a, 2
ld [wTopMenuItemY], a
ld a, $1
ld a, 1
ld [wTopMenuItemX], a
ld a, [wcd37]
ld a, [wFilteredBagItemsCount]
dec a
ld bc, $2
ld hl, $3
ld bc, 2
ld hl, 3
call AddNTimes
dec l
ld b, l
ld c, $c
ld c, 12
coord hl, 0, 0
call TextBoxBorder
call UpdateSprites
call CeladonMartRoofScript_48532
call CeladonMartRoofScript_PrintDrinksInBag
ld hl, wd730
res 6, [hl]
call HandleMenuInput
bit 1, a ; pressed b
ret nz
ld hl, wcc5b
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
ld d, $0
ld d, 0
ld e, a
add hl, de
ld a, [hl]
ld [$ffdb], a
ld [hItemToRemoveID], a
cp FRESH_WATER
jr z, .asm_484b6
jr z, .gaveFreshWater
cp SODA_POP
jr z, .asm_48492
jr z, .gaveSodaPop
; gave Lemonade
CheckEvent EVENT_GOT_TM49
jr nz, .asm_484e0
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofText_48515
call PrintText
call RemoveItemByIDBank12
lb bc, TM_49, 1
call GiveItem
jr nc, .BagFull
jr nc, .bagFull
ld hl, ReceivedTM49Text
call PrintText
SetEvent EVENT_GOT_TM49
ret
.asm_48492
.gaveSodaPop
CheckEvent EVENT_GOT_TM48
jr nz, .asm_484e0
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofText_48504
call PrintText
call RemoveItemByIDBank12
lb bc, TM_48, 1
call GiveItem
jr nc, .BagFull
jr nc, .bagFull
ld hl, CeladonMartRoofText_4850a
call PrintText
SetEvent EVENT_GOT_TM48
ret
.asm_484b6
.gaveFreshWater
CheckEvent EVENT_GOT_TM13
jr nz, .asm_484e0
jr nz, .alreadyGaveDrink
ld hl, CeladonMartRoofText_484f3
call PrintText
call RemoveItemByIDBank12
lb bc, TM_13, 1
call GiveItem
jr nc, .BagFull
jr nc, .bagFull
ld hl, CeladonMartRoofText_484f9
call PrintText
SetEvent EVENT_GOT_TM13
ret
.BagFull
.bagFull
ld hl, CeladonMartRoofText_48526
jp PrintText
.asm_484e0
.alreadyGaveDrink
ld hl, CeladonMartRoofText_4852c
jp PrintText
@ -181,11 +183,11 @@ CeladonMartRoofText_4852c: ; 4852c (12:452c)
db $0d
db "@"
CeladonMartRoofScript_48532: ; 48532 (12:4532)
ld hl, wcc5b
CeladonMartRoofScript_PrintDrinksInBag: ; 48532 (12:4532)
ld hl, wFilteredBagItems
xor a
ld [$ffdb], a
.asm_48538
ld [hItemCounter], a
.loop
ld a, [hli]
cp $ff
ret z
@ -193,15 +195,15 @@ CeladonMartRoofScript_48532: ; 48532 (12:4532)
ld [wd11e], a
call GetItemName
coord hl, 2, 2
ld a, [$ffdb]
ld a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
call PlaceString
ld hl, $ffdb
ld hl, hItemCounter
inc [hl]
pop hl
jr .asm_48538
jr .loop
CeladonMartRoofTextPointers: ; 4855b (12:455b)
dw CeladonMartRoofText1
@ -217,24 +219,24 @@ CeladonMartRoofText1: ; 48567 (12:4567)
CeladonMartRoofText2: ; 4856c (12:456c)
TX_ASM
call CeladonMartRoofScript_483d8
ld a, [wcd37]
call CeladonMartRoofScript_GetDrinksInBag
ld a, [wFilteredBagItemsCount]
and a
jr z, .asm_4858f
ld a, $1
jr z, .noDrinksInBag
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, CeladonMartRoofText4
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .asm_48595
call CeladonMartRoofScript_4840c
jr .asm_48595
.asm_4858f
jr nz, .done
call CeladonMartRoofScript_GiveDrinkToGirl
jr .done
.noDrinksInBag
ld hl, CeladonMartRoofText3
call PrintText
.asm_48595
.done
jp TextScriptEnd
CeladonMartRoofText3: ; 48598 (12:4598)

View file

@ -10,7 +10,7 @@ CeruleanHouseTrashedTextPointers: ; 1d689 (7:5689)
CeruleanHouseTrashedText1: ; 1d68f (7:568f)
TX_ASM
ld b, $e4
predef IsItemInBag_
predef GetQuantityOfItemInBag
and b
jr z, .asm_f8734
ld hl, CeruleanHouseTrashedText_1d6b0

View file

@ -5,12 +5,11 @@ Lab4TextPointers: ; 75d34 (1d:5d34)
dw Lab4Text1
dw Lab4Text2
Lab4Script_75d38: ; 75d38 (1d:5d38)
Lab4Script_GetFossilsInBag: ; 75d38 (1d:5d38)
; construct a list of all fossils in the player's bag
xor a
ld [wcd37], a
ld de, wcc5b
ld [wFilteredBagItemsCount], a
ld de, wFilteredBagItems
ld hl, FossilsList
.loop
ld a, [hli]
@ -20,7 +19,7 @@ Lab4Script_75d38: ; 75d38 (1d:5d38)
push de
ld [wd11e], a
ld b, a
predef IsItemInBag_
predef GetQuantityOfItemInBag
pop de
pop hl
ld a, b
@ -32,7 +31,7 @@ Lab4Script_75d38: ; 75d38 (1d:5d38)
ld [de], a
inc de
push hl
ld hl, wcd37
ld hl, wFilteredBagItemsCount
inc [hl]
pop hl
jr .loop
@ -53,8 +52,8 @@ Lab4Text1: ; 75d6c (1d:5d6c)
jr nz, .asm_75d96
ld hl, Lab4Text_75dc6
call PrintText
call Lab4Script_75d38
ld a, [wcd37]
call Lab4Script_GetFossilsInBag
ld a, [wFilteredBagItemsCount]
and a
jr z, .asm_75d8d
callba GiveFossilToCinnabarLab

View file

@ -449,13 +449,13 @@ OaksLabScript13: ; 1ce32 (7:4e32)
ld a, [W_XCOORD]
cp $4
; move left or right depending on where the player is standing
jr nz, .asm_1ce5b
ld a, $c0
jr .asm_1ce5d
.asm_1ce5b
ld a, $80
.asm_1ce5d
ld [wcc5b], a
jr nz, .moveLeft
ld a, NPC_MOVEMENT_RIGHT
jr .next
.moveLeft
ld a, NPC_MOVEMENT_LEFT
.next
ld [wNPCMovementDirections], a
ld a, $e
ld [W_OAKSLABCURSCRIPT], a
@ -855,7 +855,7 @@ OaksLabScript_1d157: ; 1d157 (7:5157)
ld [hl], SPRITE_FACING_RIGHT
ld hl, wd730
set 6, [hl]
predef StarterDex ; StarterDex
predef StarterDex
ld hl, wd730
res 6, [hl]
call ReloadMapData

View file

@ -35,7 +35,7 @@ RocketHideoutElevatorScript_45741: ; 45741 (11:5741)
ld hl, RocketHideoutElavatorFloors
call LoadItemList
ld hl, RocketHideoutElevatorWarpMaps
ld de, wcc5b
ld de, wElevatorWarpMaps
ld bc, RocketHideoutElevatorWarpMapsEnd - RocketHideoutElevatorWarpMaps
call CopyData
ret

View file

@ -22,12 +22,12 @@ Route11GateUpstairsText2: ; 4946c (12:546c)
ld a, 30 ; pokemon needed
ld [hOaksAideRequirement], a
ld a, ITEMFINDER ; oak's aide reward
ld [hOaksAideItemReward], a
ld [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld h, d
ld l, e
ld de, wcc5b
ld de, wOaksAideRewardItemName
ld bc, $000d
call CopyData
predef OaksAideScript

View file

@ -12,11 +12,11 @@ Route15GateUpstairsText1: ; 49651 (12:5651)
ld a, 50 ; pokemon needed
ld [hOaksAideRequirement], a
ld a, EXP__ALL ; oak's aide reward
ld [hOaksAideItemReward], a
ld [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld hl, wcd6d
ld de, wcc5b
ld de, wOaksAideRewardItemName
ld bc, $000d
call CopyData
predef OaksAideScript

View file

@ -12,11 +12,11 @@ Route2GateText1: ; 5d5db (17:55db)
ld a, 10 ; pokemon needed
ld [hOaksAideRequirement], a
ld a, HM_05 ; oak's aide reward
ld [hOaksAideItemReward], a
ld [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld hl, wcd6d
ld de, wcc5b
ld de, wOaksAideRewardItemName
ld bc, $000d
call CopyData
predef OaksAideScript

View file

@ -35,7 +35,7 @@ SilphCoElevatorScript_457f1: ; 457f1 (11:57f1)
ld hl, SilphCoElavatorFloors
call LoadItemList
ld hl, SilphCoElevatorWarpMaps
ld de, wcc5b
ld de, wElevatorWarpMaps
ld bc, SilphCoElevatorWarpMapsEnd - SilphCoElevatorWarpMaps
call CopyData
ret

View file

@ -53,7 +53,7 @@ VermilionCityScript0: ; 197e6 (6:57e6)
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .asm_19810
ld b, S_S__TICKET
predef IsItemInBag_
predef GetQuantityOfItemInBag
ld a, b
and a
ret nz
@ -171,7 +171,7 @@ VermilionCityText3: ; 198b1 (6:58b1)
ld hl, SSAnneWelcomeText9
call PrintText
ld b, S_S__TICKET
predef IsItemInBag_
predef GetQuantityOfItemInBag
ld a, b
and a
jr nz, .asm_198e9

View file

@ -106,7 +106,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b)
xor a
ld [rWY], a
ld [hWY], a
call VermilionDock_1dc94
call VermilionDock_EraseSSAnne
ld a, $90
ld [hWY], a
ld a, $1
@ -178,21 +178,29 @@ VermilionDock_1dc7c: ; 1dc7c (7:5c7c)
jr z, .asm_1dc8e
ret
VermilionDock_1dc94: ; 1dc94 (7:5c94)
ld hl, wcc5b
ld bc, SCREEN_WIDTH * 9
ld a, $14
VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94)
; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
ld hl, wVermilionDockTileMapBuffer
ld bc, (5 * 32) + SCREEN_WIDTH
ld a, $14 ; water tile
call FillMemory
ld hl, vBGMap0 + 10 * 32
ld de, wcc5b
ld bc, $000c
ld de, wVermilionDockTileMapBuffer
ld bc, (6 * 32) / 16
call CopyVideoData
ld hl, wOverworldMap + 10 + 7 * VERMILION_DOCK_WIDTH ; 10, 7
ld a, $d
; Replace the blocks of the lower half of the ship with water blocks. This
; leaves the upper half alone, but that doesn't matter because replacing any of
; the blocks is unnecessary because the blocks the ship occupies are south of
; the player and won't be redrawn when the player automatically walks north and
; exits the map. This code could be removed without affecting anything.
ld hl, wOverworldMap + (5 + 3) + (2 + 3) * (VERMILION_DOCK_WIDTH + 6) ; (5, 2)
ld a, $d ; water block
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, SFX_SS_ANNE_HORN
call PlaySound
ld c, 120