summaryrefslogtreecommitdiff
path: root/engine/mon_party_sprites.asm
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2015-03-13 05:33:16 -0700
committerYamaArashi <shadow962@live.com>2015-03-13 05:36:34 -0700
commit1115b4454db645d2ebaa9e9f1fdd9ea86c1c4e44 (patch)
tree78b1441c8db2c5b300de1e9bbd9e8aa33f45a522 /engine/mon_party_sprites.asm
parent1c2a1076cb6420f12b458809bf2bec2737ce82ae (diff)
commented mon_party_sprites.asm
Diffstat (limited to 'engine/mon_party_sprites.asm')
-rwxr-xr-xengine/mon_party_sprites.asm94
1 files changed, 55 insertions, 39 deletions
diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm
index 52bd0fd4..37125bbb 100755
--- a/engine/mon_party_sprites.asm
+++ b/engine/mon_party_sprites.asm
@@ -1,6 +1,6 @@
AnimatePartyMon_ForceSpeed1: ; 716f7 (1c:56f7)
xor a
- ld [wCurrentMenuItem], a ; wCurrentMenuItem
+ ld [wCurrentMenuItem], a
ld b, a
inc a
jr GetAnimationSpeed
@@ -27,7 +27,7 @@ GetAnimationSpeed: ; 7170a (1c:570a)
ld c, a
add a
ld b, a
- ld a, [W_SUBANIMTRANSFORM] ; W_SUBANIMTRANSFORM
+ ld a, [wPartyMonAnimCounter]
and a
jr z, .resetSprites
cp c
@@ -35,10 +35,10 @@ GetAnimationSpeed: ; 7170a (1c:570a)
.incTimer
inc a
cp b
- jr nz, .resetTimer
- xor a
-.resetTimer
- ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM
+ jr nz, .skipResetTimer
+ xor a ; reset timer
+.skipResetTimer
+ ld [wPartyMonAnimCounter], a
jp DelayFrame
.resetSprites
push bc
@@ -81,16 +81,24 @@ GetAnimationSpeed: ; 7170a (1c:570a)
ld a, c
jr .incTimer
+; Party mon animations cycle between 2 frames.
+; The members of the PartyMonSpeeds array specify the number of V-blanks
+; that each frame lasts for green HP, yellow HP, and red HP in order.
+; On the naming screen, the yellow HP speed is always used.
PartyMonSpeeds: ; 71769 (1c:5769)
db $05,$10,$20
-Func_7176c: ; 7176c (1c:576c)
- ld hl, MonPartySpritePointers ; $57c0
+LoadMonPartySpriteTilePatterns: ; 7176c (1c:576c)
+; Load mon party sprite tile patterns into VRAM during V-blank.
+ ld hl, MonPartySpritePointers
ld a, $1c
-Func_71771: ; 71771 (1c:5771)
+LoadAnimSpriteTilePatterns: ; 71771 (1c:5771)
+; Load animated sprite tile patterns into VRAM during V-blank. hl is the address
+; of an array of structures that contain arguments for CopyVideoData and a is
+; the number of structures in the array.
ld bc, $0
-.asm_71774
+.loop
push af
push bc
push hl
@@ -114,12 +122,14 @@ Func_71771: ; 71771 (1c:5771)
ld c, a
pop af
dec a
- jr nz, .asm_71774
+ jr nz, .loop
ret
-Func_71791: ; 71791 (1c:5791)
+LoadMonPartySpriteTilePatternsWithLCDDisabled: ; 71791 (1c:5791)
+; Load mon party sprite tile patterns into VRAM immediately by disabling the
+; LCD.
call DisableLCD
- ld hl, MonPartySpritePointers ; $57c0
+ ld hl, MonPartySpritePointers
ld a, $1c
ld bc, $0
.asm_7179c
@@ -293,51 +303,53 @@ MonPartySpritePointers: ; 717c0 (1c:57c0)
db BANK(MonPartySprites)
dw vSprites + $780
-Func_71868: ; 71868 (1c:5868)
+WriteMonPartySpriteOAMByPartyIndex: ; 71868 (1c:5868)
+; Write OAM blocks for the party mon in [hPartyMonIndex].
push hl
push de
push bc
- ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c
+ ld a, [hPartyMonIndex]
ld hl, wPartySpecies
ld e, a
- ld d, $0
+ ld d, 0
add hl, de
ld a, [hl]
call GetPartyMonSpriteID
ld [wcd5b], a
- call Func_718c3
+ call WriteMonPartySpriteOAM
pop bc
pop de
pop hl
ret
-Func_71882: ; 71882 (1c:5882)
+WriteMonPartySpriteOAMByMonID: ; 71882 (1c:5882)
+; Write OAM blocks for mon ID in [wcd5d].
xor a
- ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
+ ld [hPartyMonIndex], a
ld a, [wcd5d]
call GetPartyMonSpriteID
ld [wcd5b], a
- jr Func_718c3
+ jr WriteMonPartySpriteOAM
-Func_71890: ; 71890 (1c:5890)
+UnusedPartyMonSpriteFunction: ; 71890 (1c:5890)
ld a, [wcf91]
call GetPartyMonSpriteID
push af
ld hl, vSprites
- call Func_718ac
+ call .LoadTilePatterns
pop af
add $54
ld hl, vSprites + $40
- call Func_718ac
+ call .LoadTilePatterns
xor a
ld [wcd5d], a
- jr Func_71882
+ jr WriteMonPartySpriteOAMByMonID
-Func_718ac: ; 718ac (1c:58ac)
+.LoadTilePatterns ; 718ac (1c:58ac)
push hl
add a
ld c, a
- ld b, $0
+ ld b, 0
ld hl, MonPartySpritePointers
add hl, bc
add hl, bc
@@ -353,23 +365,27 @@ Func_718ac: ; 718ac (1c:58ac)
pop hl
jp CopyVideoData
-Func_718c3: ; 718c3 (1c:58c3)
+WriteMonPartySpriteOAM: ; 718c3 (1c:58c3)
+; Write the OAM blocks for the first animation frame into the OAM buffer and
+; make a copy at wcc5b.
push af
ld c, $10
ld h, wOAMBuffer / $100
- ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c
+ ld a, [hPartyMonIndex]
swap a
ld l, a
add $10
ld b, a
pop af
- cp $8
- jr z, .asm_718da
- call Func_712a6
- jr .asm_718dd
-.asm_718da
- call Func_71281
-.asm_718dd
+ cp SPRITE_HELIX << 2
+ jr z, .helix
+ call WriteSymmetricMonPartySpriteOAM
+ jr .makeCopy
+.helix
+ call WriteAsymmetricMonPartySpriteOAM
+; Make a copy of the OAM buffer with the first animation frame written so that
+; we can flip back to it from the second frame by copying it back.
+.makeCopy
ld hl, wOAMBuffer
ld de, wcc5b
ld bc, $60
@@ -384,13 +400,13 @@ GetPartyMonSpriteID: ; 718e9 (1c:58e9)
srl a
ld hl, MonPartyData
ld e, a
- ld d, $0
+ ld d, 0
add hl, de
ld a, [hl]
bit 0, c
- jr nz, .asm_71906
- swap a
-.asm_71906
+ jr nz, .skipSwap
+ swap a ; use lower nybble if pokedex num is even
+.skipSwap
and $f0
srl a
srl a