shithub: pokered

Download patch

ref: 2e44e4562f6b48fec1036240bdbf0ebcb70947d6
parent: dcff1305fed75506f651d0d4a100fb116770c145
parent: 8210dca8e50ed565fa20d1d625041fb382102205
author: Daniel Harding <33dannye@gmail.com>
date: Sun May 3 09:57:59 EDT 2020

Merge pull request #236 from mattbruv/vermilion

label hardcoded HRAM address, start documenting Vermilion

binary files /dev/null b/pokered.sn1 differ
--- a/scripts/VermilionCity.asm
+++ b/scripts/VermilionCity.asm
@@ -4,23 +4,23 @@
 	bit 6, [hl]
 	res 6, [hl]
 	push hl
-	call nz, VermilionCityScript_197cb
+	call nz, .initCityScript
 	pop hl
 	bit 5, [hl]
 	res 5, [hl]
-	call nz, VermilionCityScript_197c0
+	call nz, .setFirstLockTrashCanIndex
 	ld hl, VermilionCity_ScriptPointers
 	ld a, [wVermilionCityCurScript]
 	jp CallFunctionInTable
 
-VermilionCityScript_197c0:
+.setFirstLockTrashCanIndex
 	call Random
-	ld a, [$ffd4]
+	ld a, [hRandomSub]
 	and $e
 	ld [wFirstLockTrashCanIndex], a
 	ret
 
-VermilionCityScript_197cb:
+.initCityScript
 	CheckEventHL EVENT_SS_ANNE_LEFT
 	ret z
 	CheckEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT
@@ -41,7 +41,7 @@
 	ld a, [wSpriteStateData1 + 9]
 	and a ; cp SPRITE_FACING_DOWN
 	ret nz
-	ld hl, CoordsData_19823
+	ld hl, SSAnneTicketCheckCoords
 	call ArePlayerCoordsInArray
 	ret nc
 	xor a
@@ -51,13 +51,13 @@
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
 	CheckEvent EVENT_SS_ANNE_LEFT
-	jr nz, .asm_19810
+	jr nz, .shipHasDeparted
 	ld b, S_S_TICKET
 	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
 	ret nz
-.asm_19810
+.shipHasDeparted
 	ld a, D_UP
 	ld [wSimulatedJoypadStatesEnd], a
 	ld a, $1
@@ -67,12 +67,12 @@
 	ld [wVermilionCityCurScript], a
 	ret
 
-CoordsData_19823:
-	db $1e,$12
+SSAnneTicketCheckCoords:
+	db $1e,$12 ; y, x
 	db $ff
 
 VermilionCityScript4:
-	ld hl, CoordsData_19823
+	ld hl, SSAnneTicketCheckCoords
 	call ArePlayerCoordsInArray
 	ret c
 	ld a, $0
@@ -135,39 +135,39 @@
 VermilionCityText2:
 	TX_ASM
 	CheckEvent EVENT_SS_ANNE_LEFT
-	jr nz, .asm_1989e
-	ld hl, VermilionCityText_198a7
+	jr nz, .shipHasDeparted
+	ld hl, VermilionCityTextDidYouSee
 	call PrintText
-	jr .asm_198a4
-.asm_1989e
-	ld hl, VermilionCityText_198ac
+	jr .end
+.shipHasDeparted
+	ld hl, VermilionCityTextSSAnneDeparted
 	call PrintText
-.asm_198a4
+.end
 	jp TextScriptEnd
 
-VermilionCityText_198a7:
-	TX_FAR _VermilionCityText_198a7
+VermilionCityTextDidYouSee:
+	TX_FAR _VermilionCityTextDidYouSee
 	db "@"
 
-VermilionCityText_198ac:
-	TX_FAR _VermilionCityText_198ac
+VermilionCityTextSSAnneDeparted:
+	TX_FAR _VermilionCityTextSSAnneDeparted
 	db "@"
 
 VermilionCityText3:
 	TX_ASM
 	CheckEvent EVENT_SS_ANNE_LEFT
-	jr nz, .asm_198f6
+	jr nz, .shipHasDeparted
 	ld a, [wSpriteStateData1 + 9]
 	cp SPRITE_FACING_RIGHT
-	jr z, .asm_198c8
-	ld hl, VermilionCityCoords1
+	jr z, .greetPlayer
+	ld hl, .inFrontOfOrBehindGuardCoords
 	call ArePlayerCoordsInArray
-	jr nc, .asm_198d0
-.asm_198c8
+	jr nc, .greetPlayerAndCheckTicket
+.greetPlayer
 	ld hl, SSAnneWelcomeText4
 	call PrintText
-	jr .asm_198fc
-.asm_198d0
+	jr .end
+.greetPlayerAndCheckTicket
 	ld hl, SSAnneWelcomeText9
 	call PrintText
 	ld b, S_S_TICKET
@@ -174,25 +174,25 @@
 	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
-	jr nz, .asm_198e9
+	jr nz, .playerHasTicket
 	ld hl, SSAnneNoTicketText
 	call PrintText
-	jr .asm_198fc
-.asm_198e9
+	jr .end
+.playerHasTicket
 	ld hl, SSAnneFlashedTicketText
 	call PrintText
 	ld a, $4
 	ld [wVermilionCityCurScript], a
-	jr .asm_198fc
-.asm_198f6
+	jr .end
+.shipHasDeparted
 	ld hl, SSAnneNotHereText
 	call PrintText
-.asm_198fc
+.end
 	jp TextScriptEnd
 
-VermilionCityCoords1:
-	db $1d,$13
-	db $1f,$13
+.inFrontOfOrBehindGuardCoords
+	db $1d,$13 ; y, x of tile in front of guard
+	db $1f,$13 ; y, x of tile behind guard
 	db $ff
 
 SSAnneWelcomeText4:
--- a/text/maps/VermilionCity.asm
+++ b/text/maps/VermilionCity.asm
@@ -7,13 +7,13 @@
 	cont "toxic sludge!"
 	done
 
-_VermilionCityText_198a7::
+_VermilionCityTextDidYouSee::
 	text "Did you see S.S."
 	line "ANNE moored in"
 	cont "the harbor?"
 	done
 
-_VermilionCityText_198ac::
+_VermilionCityTextSSAnneDeparted::
 	text "So, S.S.ANNE has"
 	line "departed!"