aboutsummaryrefslogtreecommitdiffstats
path: root/home
diff options
context:
space:
mode:
authorSylvie <35663410+Rangi42@users.noreply.github.com>2024-09-18 21:01:18 -0400
committerGitHub <noreply@github.com>2024-09-18 21:01:18 -0400
commit613d34678b7e9da1a467ec48fff23bfa75209871 (patch)
treec21669899a90df25aaac9b4b4d213ac525d6f277 /home
parentUse correct label in get_trainer_name.asm (#461) (diff)
downloadpokeyellow-613d34678b7e9da1a467ec48fff23bfa75209871.tar.gz
pokeyellow-613d34678b7e9da1a467ec48fff23bfa75209871.tar.xz
pokeyellow-613d34678b7e9da1a467ec48fff23bfa75209871.zip
Split `hSpriteIndexOrTextID` into `hSpriteIndex` and `hTextID` (#462)
Also identify `wPPUpCountAndMaxPP`
Diffstat (limited to 'home')
-rw-r--r--home/overworld.asm20
-rw-r--r--home/predef_text.asm2
-rw-r--r--home/text.asm4
-rw-r--r--home/text_script.asm9
-rw-r--r--home/trainers.asm4
-rw-r--r--home/uncompress.asm2
6 files changed, 21 insertions, 20 deletions
diff --git a/home/overworld.asm b/home/overworld.asm
index 805a1b60..1595fdf0 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -76,7 +76,7 @@ OverworldLoopLessDelay::
jr z, .startButtonNotPressed
; if START is pressed
xor a ; TEXT_START_MENU
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
jp .displayDialogue
.startButtonNotPressed
bit BIT_A_BUTTON, a
@@ -92,7 +92,7 @@ OverworldLoopLessDelay::
and a
jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found
call IsSpriteOrSignInFrontOfPlayer
- ldh a, [hSpriteIndexOrTextID]
+ ldh a, [hTextID]
and a
jp z, OverworldLoop
.displayDialogue
@@ -1072,11 +1072,11 @@ LoadEastWestConnectionsTileMap::
ret
; function to check if there is a sign or sprite in front of the player
-; if so, it is stored in [hSpriteIndexOrTextID]
-; if not, [hSpriteIndexOrTextID] is set to 0
+; if so, it is stored in [hTextID]
+; if not, [hTextID] is set to 0
IsSpriteOrSignInFrontOfPlayer::
xor a
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
ld a, [wNumSigns]
and a
jr z, .extendRangeOverCounter
@@ -1106,7 +1106,7 @@ IsSpriteOrSignInFrontOfPlayer::
dec c
add hl, bc
ld a, [hl]
- ldh [hSpriteIndexOrTextID], a ; store sign text ID
+ ldh [hTextID], a ; store sign text ID
pop bc
pop hl
ret
@@ -1127,7 +1127,7 @@ IsSpriteOrSignInFrontOfPlayer::
jr nz, .counterTilesLoop
; part of the above function, but sometimes its called on its own, when signs are irrelevant
-; the caller must zero [hSpriteIndexOrTextID]
+; the caller must zero [hTextID]
IsSpriteInFrontOfPlayer::
ld d, $10 ; talking range in pixels (normal range)
IsSpriteInFrontOfPlayer2::
@@ -1212,7 +1212,7 @@ IsSpriteInFrontOfPlayer2::
ld l, a ; hl = x#SPRITESTATEDATA1_MOVEMENTSTATUS
set 7, [hl] ; set flag to make the sprite face the player
ld a, e
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
ret
; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing)
@@ -1231,9 +1231,9 @@ CollisionCheckOnLand::
and d ; check if a sprite is in the direction the player is trying to go
jr nz, .collision
xor a
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
- ldh a, [hSpriteIndexOrTextID]
+ ldh a, [hTextID]
and a ; was there a sprite collision?
jr nz, .collision
; if no sprite collision
diff --git a/home/predef_text.asm b/home/predef_text.asm
index 1537ad5b..bdecd3cf 100644
--- a/home/predef_text.asm
+++ b/home/predef_text.asm
@@ -1,5 +1,5 @@
PrintPredefTextID::
- ldh [hSpriteIndexOrTextID], a
+ ldh [hTextID], a
ld hl, TextPredefs
call SetMapTextPointer
ld hl, wTextPredefFlag
diff --git a/home/text.asm b/home/text.asm
index e815fbf7..dc78b982 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -117,13 +117,13 @@ NullChar:: ; unused
pop hl
; A "<NULL>" character in a printed string
; displays an error message with the current value
- ; of hSpriteIndexOrTextID in decimal format.
+ ; of hTextID in decimal format.
; This is a debugging leftover.
ld de, TextIDErrorText
dec de
ret
-TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR."
+TextIDErrorText:: ; "[hTextID] ERROR."
text_far _TextIDErrorText
text_end
diff --git a/home/text_script.asm b/home/text_script.asm
index 5c90a981..d367683d 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -1,6 +1,7 @@
; this function is used to display sign messages, sprite dialog, etc.
-; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID
+; INPUT: [hSpriteIndex] = sprite ID or [hTextID] = text ID
DisplayTextID::
+ assert hSpriteIndex == hTextID ; these are at the same memory location
ldh a, [hLoadedROMBank]
push af
farcall DisplayTextIDInit ; initialization
@@ -18,7 +19,7 @@ DisplayTextID::
ld h, [hl]
ld l, a ; hl = map text pointer
ld d, $00
- ldh a, [hSpriteIndexOrTextID] ; text ID
+ ldh a, [hTextID]
ld [wSpriteIndex], a
dict TEXT_START_MENU, DisplayStartMenu
@@ -29,7 +30,7 @@ DisplayTextID::
ld a, [wNumSprites]
ld e, a
- ldh a, [hSpriteIndexOrTextID] ; sprite ID
+ ldh a, [hSpriteIndex] ; sprite ID
cp e
jr z, .spriteHandling
jr nc, .skipSpriteHandling
@@ -42,7 +43,7 @@ DisplayTextID::
pop bc
pop de
ld hl, wMapSpriteData ; NPC text entries
- ldh a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndex]
dec a
add a
add l
diff --git a/home/trainers.asm b/home/trainers.asm
index 0038d48c..0a466cc1 100644
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -7,7 +7,7 @@ StoreTrainerHeaderPointer::
ret
; executes the current map script from the function pointer array provided in de.
-; a: map script index to execute (unless overridden by [wd733] bit 4)
+; a: map script index to execute (unless overridden by [wStatusFlags7] BIT_USE_CUR_MAP_SCRIPT)
; hl: trainer header pointer
ExecuteCurMapScriptInTable::
push af
@@ -165,7 +165,7 @@ DisplayEnemyTrainerTextAndStartBattle::
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
- ldh [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndex], a
call DisplayTextID
; fall through
diff --git a/home/uncompress.asm b/home/uncompress.asm
index d3d84b26..0e609f1c 100644
--- a/home/uncompress.asm
+++ b/home/uncompress.asm
@@ -52,7 +52,7 @@ _UncompressSpriteData::
; bit 0 decides in which one the first chunk is placed
; fall through
-; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2
+; uncompresses a chunk from the sprite input data stream (pointed to by wSpriteInputPtr) into sSpriteBuffer1 or sSpriteBuffer2
; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
UncompressSpriteDataLoop::