More work interpreting the sprite engine

This commit is contained in:
PikalaxALT
2015-12-02 13:24:18 -05:00
parent 92a8c491c3
commit be082943ed
17 changed files with 1165 additions and 1023 deletions

View File

@@ -5225,11 +5225,11 @@ LoadBattleMenu2: ; 3e19b
BattleMenu_Pack: ; 3e1c7 BattleMenu_Pack: ; 3e1c7
ld a, [wLinkMode] ld a, [wLinkMode]
and a and a
jp nz, ItemsCantBeUsed jp nz, .ItemsCantBeUsed
ld a, [InBattleTowerBattle] ld a, [InBattleTowerBattle]
and a and a
jp nz, ItemsCantBeUsed jp nz, .ItemsCantBeUsed
call LoadStandardMenuDataHeader call LoadStandardMenuDataHeader
@@ -5258,7 +5258,7 @@ BattleMenu_Pack: ; 3e1c7
call DoItemEffect call DoItemEffect
.got_item .got_item
call Function3e234 call .UseItem
ret ret
.didnt_use_item .didnt_use_item
@@ -5274,33 +5274,33 @@ BattleMenu_Pack: ; 3e1c7
jp BattleMenu jp BattleMenu
; 3e22b ; 3e22b
ItemsCantBeUsed: ; 3e22b .ItemsCantBeUsed: ; 3e22b
ld hl, BattleText_ItemsCantBeUsedHere ld hl, BattleText_ItemsCantBeUsedHere
call StdBattleTextBox call StdBattleTextBox
jp BattleMenu jp BattleMenu
; 3e234 ; 3e234
Function3e234: ; 3e234 .UseItem: ; 3e234
ld a, [wc64e] ld a, [wc64e]
and a and a
jr nz, .asm_3e279 jr nz, .run
callab CheckItemPocket callab CheckItemPocket
ld a, [wItemAttributeParamBuffer] ld a, [wItemAttributeParamBuffer]
cp $3 cp BALL
jr z, .asm_3e24a jr z, .ball
call ClearBGPalettes call ClearBGPalettes
.asm_3e24a .ball
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
call _LoadBattleFontsHPBar call _LoadBattleFontsHPBar
call ClearSprites call ClearSprites
ld a, [BattleType] ld a, [BattleType]
cp BATTLETYPE_TUTORIAL cp BATTLETYPE_TUTORIAL
jr z, .asm_3e25d jr z, .tutorial2
call GetMonBackpic call GetMonBackpic
.asm_3e25d .tutorial2
call GetMonFrontpic call GetMonFrontpic
ld a, $1 ld a, $1
ld [MenuSelection2], a ld [MenuSelection2], a
@@ -5313,7 +5313,7 @@ Function3e234: ; 3e234
and a and a
ret ret
.asm_3e279 .run
xor a xor a
ld [wc64e], a ld [wc64e], a
ld a, [wBattleResult] ld a, [wBattleResult]
@@ -5331,39 +5331,39 @@ Function3e290:
call ExitMenu call ExitMenu
call LoadStandardMenuDataHeader call LoadStandardMenuDataHeader
call ClearBGPalettes call ClearBGPalettes
Function3e299: BattleMenuPKMN_Loop:
call Function3d2fa call Function3d2fa
xor a xor a
ld [PartyMenuActionText], a ld [PartyMenuActionText], a
call Function3d313 call Function3d313
call Function3d329 call Function3d329
jr c, .asm_3e2da jr c, .Cancel
.asm_3e2a8 .loop
callba Function8ea4a callba Function8ea4a
call Function3e2f5 call .GetMenu
jr c, .asm_3e2c8 jr c, .PressedB
call Function1bee call Function1bee
ld a, [MenuSelection2] ld a, [MenuSelection2]
cp $1 cp $1 ; SWITCH
jp z, Function3e358 jp z, TryPlayerSwitch
cp $2 cp $2 ; STATS
jr z, .asm_3e2cf jr z, .Stats
cp $3 cp $3 ; CANCEL
jr z, .asm_3e2da jr z, .Cancel
jr .asm_3e2a8 jr .loop
.asm_3e2c8 .PressedB
call CheckMobileBattleError call CheckMobileBattleError
jr c, .asm_3e2da jr c, .Cancel
jr Function3e299 jr BattleMenuPKMN_Loop
.asm_3e2cf .Stats
call Function3e308 call Function3e308
call CheckMobileBattleError call CheckMobileBattleError
jr c, .asm_3e2da jr c, .Cancel
jp Function3e290 jp Function3e290
.asm_3e2da .Cancel
call ClearSprites call ClearSprites
call ClearPalettes call ClearPalettes
call DelayFrame call DelayFrame
@@ -5375,14 +5375,14 @@ Function3e299:
jp BattleMenu jp BattleMenu
; 3e2f5 ; 3e2f5
Function3e2f5: ; 3e2f5 .GetMenu: ; 3e2f5
call IsMobileBattle call IsMobileBattle
jr z, .asm_3e301 jr z, .mobile
callba Function24e99 callba BattleMonMenu
ret ret
.asm_3e301 .mobile
callba Function100d22 callba MobileBattleMonMenu
ret ret
; 3e308 ; 3e308
@@ -5394,7 +5394,7 @@ Function3e308: ; 3e308
call CopyBytes call CopyBytes
ld hl, VTiles2 ld hl, VTiles2
ld de, VTiles0 tile $11 ld de, VTiles0 tile $11
ld bc, $0310 ld bc, $31 tiles
call CopyBytes call CopyBytes
call EnableLCD call EnableLCD
call ClearSprites call ClearSprites
@@ -5406,43 +5406,43 @@ Function3e308: ; 3e308
call DisableLCD call DisableLCD
ld hl, VTiles0 ld hl, VTiles0
ld de, VTiles2 tile $31 ld de, VTiles2 tile $31
ld bc, $0110 ld bc, $11 tiles
call CopyBytes call CopyBytes
ld hl, VTiles0 tile $11 ld hl, VTiles0 tile $11
ld de, VTiles2 ld de, VTiles2
ld bc, $0310 ld bc, $31 tiles
call CopyBytes call CopyBytes
call EnableLCD call EnableLCD
ret ret
; 3e358 ; 3e358
Function3e358: ; 3e358 TryPlayerSwitch: ; 3e358
ld a, [CurBattleMon] ld a, [CurBattleMon]
ld d, a ld d, a
ld a, [CurPartyMon] ld a, [CurPartyMon]
cp d cp d
jr nz, .asm_3e36b jr nz, .check_trapped
ld hl, BattleText_PkmnIsAlreadyOut ld hl, BattleText_PkmnIsAlreadyOut
call StdBattleTextBox call StdBattleTextBox
jp Function3e299 jp BattleMenuPKMN_Loop
.asm_3e36b .check_trapped
ld a, [wPlayerWrapCount] ld a, [wPlayerWrapCount]
and a and a
jr nz, .asm_3e378 jr nz, .trapped
ld a, [EnemySubStatus5] ld a, [EnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a bit SUBSTATUS_CANT_RUN, a
jr z, .asm_3e381 jr z, .try_switch
.asm_3e378 .trapped
ld hl, BattleText_PkmnCantBeRecalled ld hl, BattleText_PkmnCantBeRecalled
call StdBattleTextBox call StdBattleTextBox
jp Function3e299 jp BattleMenuPKMN_Loop
.asm_3e381 .try_switch
call CheckIfPartyHasPkmnToBattleWith call CheckIfPartyHasPkmnToBattleWith
jp z, Function3e299 jp z, BattleMenuPKMN_Loop
ld a, [CurBattleMon] ld a, [CurBattleMon]
ld [LastPlayerMon], a ld [LastPlayerMon], a
ld a, $2 ld a, $2
@@ -5456,9 +5456,6 @@ Function3e358: ; 3e358
call SetPalettes call SetPalettes
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld [CurBattleMon], a ld [CurBattleMon], a
; fallthrough
; 3e3ad
PlayerSwitch: ; 3e3ad PlayerSwitch: ; 3e3ad
ld a, 1 ld a, 1
ld [wPlayerIsSwitching], a ld [wPlayerIsSwitching], a
@@ -9479,7 +9476,7 @@ InitBattleDisplay: ; 3fb6c
GetTrainerBackpic: ; 3fbff GetTrainerBackpic: ; 3fbff
; Load the player character's backpic (6x6) into VRAM starting from $9310. ; Load the player character's backpic (6x6) into VRAM starting from VTiles2 tile $31.
; Special exception for Dude. ; Special exception for Dude.
ld b, BANK(DudeBackpic) ld b, BANK(DudeBackpic)

File diff suppressed because it is too large Load Diff

View File

@@ -191,30 +191,30 @@ DoEggStep:: ; 16f3e
OverworldHatchEgg:: ; 16f5e OverworldHatchEgg:: ; 16f5e
call ResetWindow call ResetWindow
call LoadStandardMenuDataHeader call LoadStandardMenuDataHeader
call Function16f70 call HatchEggs
call ExitAllMenus call ExitAllMenus
call RestartMapMusic call RestartMapMusic
jp CloseText jp CloseText
; 16f70 ; 16f70
Function16f70: ; 16f70 (5:6f70) HatchEggs: ; 16f70 (5:6f70)
ld de, PartySpecies ld de, PartySpecies
ld hl, PartyMon1Happiness ld hl, PartyMon1Happiness
xor a xor a
ld [CurPartyMon], a ld [CurPartyMon], a
Function16f7a: ; 16f7a (5:6f7a) .loop: ; 16f7a (5:6f7a)
ld a, [de] ld a, [de]
inc de inc de
cp -1 cp -1
jp z, Function1708a jp z, .done
push de push de
push hl push hl
cp EGG cp EGG
jp nz, Function1707d jp nz, .next
ld a, [hl] ld a, [hl]
and a and a
jp nz, Function1707d jp nz, .next
ld [hl], $78 ld [hl], $78
push de push de
@@ -304,7 +304,7 @@ Function16f7a: ; 16f7a (5:6f7a)
ld e, l ld e, l
ld hl, PlayerName ld hl, PlayerName
call CopyBytes call CopyBytes
ld hl, UnknownText_0x1708b ld hl, .Text_HatchEgg
call PrintText call PrintText
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
@@ -313,11 +313,12 @@ Function16f7a: ; 16f7a (5:6f7a)
ld d, h ld d, h
ld e, l ld e, l
push de push de
ld hl, UnknownText_0x170ba ld hl, .Text_NicknameHatchling
call PrintText call PrintText
call YesNoBox call YesNoBox
pop de pop de
jr c, .nonickname jr c, .nonickname
ld a, $1 ld a, $1
ld [wd26b], a ld [wd26b], a
xor a xor a
@@ -328,32 +329,30 @@ Function16f7a: ; 16f7a (5:6f7a)
pop hl pop hl
ld de, StringBuffer1 ld de, StringBuffer1
call InitName call InitName
jr Function1707d jr .next
.nonickname .nonickname
ld hl, StringBuffer1 ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
Function1707d: ; 1707d (5:707d) .next: ; 1707d (5:707d)
ld hl, CurPartyMon ld hl, CurPartyMon
inc [hl] inc [hl]
pop hl pop hl
ld de, PARTYMON_STRUCT_LENGTH ld de, PARTYMON_STRUCT_LENGTH
add hl, de add hl, de
pop de pop de
jp Function16f7a jp .loop
Function1708a: ; 1708a (5:708a) .done: ; 1708a (5:708a)
ret ret
; 1708b (5:708b) ; 1708b (5:708b)
UnknownText_0x1708b: ; 0x1708b .Text_HatchEgg: ; 0x1708b
; Huh? @ @ ; Huh? @ @
text_jump UnknownText_0x1c0db0 text_jump UnknownText_0x1c0db0
start_asm start_asm
; 0x17090
Function17090: ; 17090
ld hl, VramState ld hl, VramState
res 0, [hl] res 0, [hl]
push hl push hl
@@ -361,38 +360,38 @@ Function17090: ; 17090
push bc push bc
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
push af push af
call Function1728f call EggHatch_AnimationSequence
ld hl, UnknownText_0x170b0 ld hl, .ClearTextbox
call PrintText call PrintText
pop af pop af
ld [CurPartySpecies], a ld [CurPartySpecies], a
pop bc pop bc
pop de pop de
pop hl pop hl
ld hl, UnknownText_0x170b5 ld hl, .CameOutOfItsEgg
ret ret
; 170b0 (5:70b0) ; 170b0 (5:70b0)
UnknownText_0x170b0: ; 0x170b0 .ClearTextbox: ; 0x170b0
; ;
text_jump UnknownText_0x1c0db8 text_jump UnknownText_0x1c0db8
db "@" db "@"
; 0x170b5 ; 0x170b5
UnknownText_0x170b5: ; 0x170b5 .CameOutOfItsEgg: ; 0x170b5
; came out of its EGG!@ @ ; came out of its EGG!@ @
text_jump UnknownText_0x1c0dba text_jump UnknownText_0x1c0dba
db "@" db "@"
; 0x170ba ; 0x170ba
UnknownText_0x170ba: ; 0x170ba .Text_NicknameHatchling: ; 0x170ba
; Give a nickname to @ ? ; Give a nickname to @ ?
text_jump UnknownText_0x1c0dd8 text_jump UnknownText_0x1c0dd8
db "@" db "@"
; 0x170bf ; 0x170bf
Function170bf: ; 170bf InitEggMoves: ; 170bf
call Function17197 call GetHeritableMoves
ld d, h ld d, h
ld e, l ld e, l
ld b, NUM_MOVES ld b, NUM_MOVES
@@ -409,9 +408,9 @@ Function170bf: ; 170bf
inc hl inc hl
dec c dec c
jr nz, .next jr nz, .next
call Function170e4 call GetEggMove
jr nc, .skip jr nc, .skip
call Function17169 call LoadEggMove
.skip .skip
inc de inc de
@@ -422,7 +421,7 @@ Function170bf: ; 170bf
ret ret
; 170e4 ; 170e4
Function170e4: ; 170e4 GetEggMove: ; 170e4
GLOBAL EggMoves GLOBAL EggMoves
push bc push bc
@@ -440,7 +439,7 @@ endr
ld a, BANK(EggMoves) ld a, BANK(EggMoves)
call GetFarByte call GetFarByte
cp -1 cp -1
jr z, .found_mon jr z, .reached_end
ld b, a ld b, a
ld a, [de] ld a, [de]
cp b cp b
@@ -448,7 +447,7 @@ endr
inc hl inc hl
jr .loop jr .loop
.found_mon .reached_end
call Function1720b call Function1720b
ld b, NUM_MOVES ld b, NUM_MOVES
.loop2 .loop2
@@ -504,7 +503,7 @@ endr
ld a, [de] ld a, [de]
cp b cp b
jr nz, .loop5 jr nz, .loop5
ld [wd262], a ld [wPutativeTMHMMove], a
predef CanLearnTMHMMove predef CanLearnTMHMMove
ld a, c ld a, c
and a and a
@@ -521,7 +520,7 @@ endr
ret ret
; 17169 ; 17169
Function17169: ; 17169 LoadEggMove: ; 17169
push de push de
push bc push bc
ld a, [de] ld a, [de]
@@ -556,7 +555,7 @@ Function17169: ; 17169
ret ret
; 17197 ; 17197
Function17197: ; 17197 GetHeritableMoves: ; 17197
ld hl, wBreedMon2Moves ld hl, wBreedMon2Moves
ld a, [wBreedMon1Species] ld a, [wBreedMon1Species]
cp DITTO cp DITTO
@@ -579,7 +578,7 @@ Function17197: ; 17197
ld [TempMonDVs], a ld [TempMonDVs], a
ld a, [wBreedMon2DVs + 1] ld a, [wBreedMon2DVs + 1]
ld [TempMonDVs + 1], a ld [TempMonDVs + 1], a
ld a, $3 ld a, BREEDMON
ld [MonType], a ld [MonType], a
predef GetGender predef GetGender
jr c, .inherit_mon2_moves jr c, .inherit_mon2_moves
@@ -595,7 +594,7 @@ Function17197: ; 17197
ld [TempMonDVs], a ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1] ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a ld [TempMonDVs + 1], a
ld a, $3 ld a, BREEDMON
ld [MonType], a ld [MonType], a
predef GetGender predef GetGender
jr c, .inherit_mon1_moves jr c, .inherit_mon1_moves
@@ -674,7 +673,7 @@ Function17254: ; 17254 (5:7254)
call SetPalettes call SetPalettes
jp WaitBGMap jp WaitBGMap
Function1727f: ; 1727f (5:727f) EggHatch_DoAnimFrame: ; 1727f (5:727f)
push hl push hl
push de push de
push bc push bc
@@ -685,7 +684,7 @@ Function1727f: ; 1727f (5:727f)
pop hl pop hl
ret ret
Function1728f: ; 1728f (5:728f) EggHatch_AnimationSequence: ; 1728f (5:728f)
ld a, [wd265] ld a, [wd265]
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld a, [CurSpecies] ld a, [CurSpecies]
@@ -710,45 +709,47 @@ Function1728f: ; 1728f (5:728f)
call PlayMusic call PlayMusic
call EnableLCD call EnableLCD
hlcoord 7, 4 hlcoord 7, 4
ld b, $98 ld b, (VBGMap0 + 1 * $20 + 17) / $100
ld c, $31 ld c, (VBGMap0 + 1 * $20 + 17) % $100
ld a, EGG ld a, EGG
call Function17254 call Function17254
ld c, $50 ld c, 80
call DelayFrames call DelayFrames
xor a xor a
ld [wcf64], a ld [wcf64], a
ld a, [hSCX] ld a, [hSCX]
ld b, a ld b, a
.asm_172ee .outerloop
ld hl, wcf64 ld hl, wcf64
ld a, [hl] ld a, [hl]
inc [hl] inc [hl]
cp $8 cp 8
jr nc, .asm_17327 jr nc, .done
ld e, [hl] ld e, [hl]
.asm_172f8 .loop
ld a, $2 ; wobble e times
ld a, 2
ld [hSCX], a ld [hSCX], a
ld a, $fe ld a, -2
ld [wc3c0], a ld [wc3c0], a
call Function1727f call EggHatch_DoAnimFrame
ld c, $2 ld c, 2
call DelayFrames call DelayFrames
ld a, $fe ld a, -2
ld [hSCX], a ld [hSCX], a
ld a, $2 ld a, 2
ld [wc3c0], a ld [wc3c0], a
call Function1727f call EggHatch_DoAnimFrame
ld c, $2 ld c, 2
call DelayFrames call DelayFrames
dec e dec e
jr nz, .asm_172f8 jr nz, .loop
ld c, $10 ld c, 16
call DelayFrames call DelayFrames
call Function1736d call EggHatch_CrackShell
jr .asm_172ee jr .outerloop
.asm_17327
.done
ld de, SFX_EGG_HATCH ld de, SFX_EGG_HATCH
call PlaySFX call PlaySFX
xor a xor a
@@ -757,8 +758,8 @@ Function1728f: ; 1728f (5:728f)
call ClearSprites call ClearSprites
call Function173b3 call Function173b3
hlcoord 6, 3 hlcoord 6, 3
ld b, $98 ld b, VBGMap0 / $100
ld c, $0 ld c, VBGMap0 % $100
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
call Function17254 call Function17254
call Function17418 call Function17418
@@ -779,7 +780,7 @@ Function17363: ; 17363 (5:7363)
ld c, $0 ld c, $0
jp GetSGBLayout jp GetSGBLayout
Function1736d: ; 1736d (5:736d) EggHatch_CrackShell: ; 1736d (5:736d)
ld a, [wcf64] ld a, [wcf64]
dec a dec a
and $7 and $7
@@ -794,7 +795,7 @@ Function1736d: ; 1736d (5:736d)
ld e, 11 * 8 ld e, 11 * 8
ld a, SPRITE_ANIM_INDEX_19 ld a, SPRITE_ANIM_INDEX_19
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
ld de, SFX_EGG_CRACK ld de, SFX_EGG_CRACK
@@ -840,7 +841,7 @@ Function173b3: ; 173b3 (5:73b3)
.done .done
ld de, SFX_EGG_HATCH ld de, SFX_EGG_HATCH
call PlaySFX call PlaySFX
call Function1727f call EggHatch_DoAnimFrame
ret ret
; 173ef (5:73ef) ; 173ef (5:73ef)
@@ -862,7 +863,7 @@ Function173b3: ; 173b3 (5:73b3)
Function17418: ; 17418 (5:7418) Function17418: ; 17418 (5:7418)
ld c, $81 ld c, $81
.asm_1741a .asm_1741a
call Function1727f call EggHatch_DoAnimFrame
dec c dec c
jr nz, .asm_1741a jr nz, .asm_1741a
ret ret

View File

@@ -828,7 +828,7 @@ Function81df4: ; 81df4
ld [wd265], a ld [wd265], a
predef GetTMHMMove predef GetTMHMMove
ld a, [wd265] ld a, [wd265]
ld [wd262], a ld [wPutativeTMHMMove], a
call GetMoveName call GetMoveName
hlcoord 10, 12 hlcoord 10, 12
call PlaceString call PlaceString

View File

@@ -485,7 +485,7 @@ endr
.learn .learn
ld a, d ld a, d
ld [wd262], a ld [wPutativeTMHMMove], a
ld [wd265], a ld [wd265], a
call GetMoveName call GetMoveName
call CopyName1 call CopyName1

View File

@@ -57,7 +57,7 @@ LearnMove: ; 6508
pop hl pop hl
.learn .learn
ld a, [wd262] ld a, [wPutativeTMHMMove]
ld [hl], a ld [hl], a
ld bc, MON_PP - MON_MOVES ld bc, MON_PP - MON_MOVES
add hl, bc add hl, bc

View File

@@ -100,7 +100,7 @@ Function927af: ; 927af (24:67af)
call Function92844 call Function92844
call Function92b0f call Function92b0f
xor a xor a
ld [wc3b5], a ld [wOAMRetentionSize], a
callab DoNextFrameForFirst16Sprites callab DoNextFrameForFirst16Sprites
call Function927f8 call Function927f8
call Function927d3 call Function927d3

View File

@@ -23,8 +23,8 @@ PlaySpriteAnimations: ; 8cf69
push bc push bc
push af push af
ld a, $0 ld a, 0 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
call DoNextFrameForAllSprites call DoNextFrameForAllSprites
pop af pop af
@@ -58,11 +58,11 @@ DoNextFrameForAllSprites: ; 8cf7a
dec e dec e
jr nz, .loop jr nz, .loop
ld a, [wc3b5] ld a, [wOAMRetentionSize]
ld l, a ld l, a
ld h, Sprites / $0100 ld h, Sprites / $0100
.loop2 ; Clear (Sprites + [wc3b5] --> SpritesEnd) .loop2 ; Clear (Sprites + [wOAMRetentionSize] --> SpritesEnd)
ld a, l ld a, l
cp SpritesEnd % $100 cp SpritesEnd % $100
jr nc, .done jr nc, .done
@@ -98,11 +98,11 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8)
dec e dec e
jr nz, .loop jr nz, .loop
ld a, [wc3b5] ld a, [wOAMRetentionSize]
ld l, a ld l, a
ld h, (Sprites + $40) / $100 ld h, (Sprites + $40) / $100
.loop2 ; Clear (Sprites + [wc3b5] --> Sprites + $40) .loop2 ; Clear (Sprites + [wOAMRetentionSize] --> Sprites + $40)
ld a, l ld a, l
cp (Sprites + 16 * 4) % $100 cp (Sprites + 16 * 4) % $100
jr nc, .done jr nc, .done
@@ -213,7 +213,7 @@ endr
Function8d036: ; 8d036 Function8d036: ; 8d036
; Clear the index field of the struct in bc. ; Clear the index field of the struct in bc.
ld hl, 0 ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
ret ret
@@ -240,25 +240,29 @@ Function8d04c: ; 8d04c
cp -3 cp -3
jr z, .done jr z, .done
cp -4 cp -4
jr z, .almost jr z, .delete
call Function8d1a2 ; OAM? call Function8d1a2 ; OAM?
ld a, [wc3ba] ; add byte to [wCurrAnimVTile]
ld a, [wCurrAnimVTile]
add [hl] add [hl]
ld [wc3ba], a ld [wCurrAnimVTile], a
inc hl inc hl
; load pointer into hl
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
push bc push bc
ld a, [wc3b5] ld a, [wOAMRetentionSize]
ld e, a ld e, a
ld d, Sprites / $100 ld d, Sprites / $100
ld a, [hli] ld a, [hli]
ld c, a ld c, a ; number of objects
.loop .loop
ld a, [wc3bc] ; first byte: y (px)
; [de] = [wCurrAnimYCoord] + [wCurrAnimYOffset] + [wc3bf] + Function8d0be([hl])
ld a, [wCurrAnimYCoord]
ld b, a ld b, a
ld a, [wc3be] ld a, [wCurrAnimYOffset]
add b add b
ld b, a ld b, a
ld a, [wc3bf] ld a, [wc3bf]
@@ -269,9 +273,11 @@ Function8d04c: ; 8d04c
ld [de], a ld [de], a
inc hl inc hl
inc de inc de
ld a, [wc3bb] ; second byte: x (px)
; [de] = [wCurrAnimXCoord] + [wCurrAnimXOffset] + [wc3c0] + Function8d0ce([hl])
ld a, [wCurrAnimXCoord]
ld b, a ld b, a
ld a, [wc3bd] ld a, [wCurrAnimXOffset]
add b add b
ld b, a ld b, a
ld a, [wc3c0] ld a, [wc3c0]
@@ -282,32 +288,36 @@ Function8d04c: ; 8d04c
ld [de], a ld [de], a
inc hl inc hl
inc de inc de
ld a, [wc3ba] ; third byte: vtile
; [de] = [wCurrAnimVTile] + [hl]
ld a, [wCurrAnimVTile]
add [hl] add [hl]
ld [de], a ld [de], a
inc hl inc hl
inc de inc de
; fourth byte: attributes
; [de] = Function8d0de([hl])
call Function8d0de call Function8d0de
ld [de], a ld [de], a
inc hl inc hl
inc de inc de
ld a, e ld a, e
ld [wc3b5], a ld [wOAMRetentionSize], a
cp SpritesEnd % $100 cp SpritesEnd % $100
jr nc, .outofroom jr nc, .reached_the_end
dec c dec c
jr nz, .loop jr nz, .loop
pop bc pop bc
jr .done jr .done
.almost .delete
call Function8d036 call Function8d036
.done .done
and a and a
ret ret
.outofroom .reached_the_end
pop bc pop bc
scf scf
ret ret
@@ -359,18 +369,18 @@ Function8d0de: ; 8d0de
Function8d0ec: ; 8d0ec Function8d0ec: ; 8d0ec
xor a xor a
ld [wc3b8], a ld [wc3b8], a
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [wc3ba], a ld [wCurrAnimVTile], a
ld a, [hli] ld a, [hli]
ld [wc3bb], a ld [wCurrAnimXCoord], a
ld a, [hli] ld a, [hli]
ld [wc3bc], a ld [wCurrAnimYCoord], a
ld a, [hli] ld a, [hli]
ld [wc3bd], a ld [wCurrAnimXOffset], a
ld a, [hli] ld a, [hli]
ld [wc3be], a ld [wCurrAnimYOffset], a
ret ret
; 8d109 ; 8d109
@@ -420,22 +430,22 @@ Function8d132: ; 8d132
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and a and a
jr z, .done ; finished the current sequence jr z, .next_frame ; finished the current sequence
dec [hl] dec [hl]
call Function8d189 ; load pointer from Unknown_8d6e6 call Function8d189 ; load pointer from Unknown_8d6e6
ld a, [hli] ld a, [hli]
push af push af
jr .okay jr .okay
.done .next_frame
ld hl, SPRITEANIMSTRUCT_FRAME ld hl, SPRITEANIMSTRUCT_FRAME
add hl, bc add hl, bc
inc [hl] inc [hl]
call Function8d189 ; load pointer from Unknown_8d6e6 call Function8d189 ; load pointer from Unknown_8d6e6
ld a, [hli] ld a, [hli]
cp $fe cp -2
jr z, .minus_2 jr z, .minus_2
cp $ff cp -1
jr z, .minus_1 jr z, .minus_1
push af push af
@@ -486,7 +496,7 @@ endr
Function8d189: ; 8d189 Function8d189: ; 8d189
; Get the data for the current frame for the current animation sequence ; Get the data for the current frame for the current animation sequence
; Unknown_8d6e6 + 2 * SpriteAnim[SPRITEANIMSTRUCT_01] + 3 * SpriteAnim[SPRITEANIMSTRUCT_FRAME] ; Unknown_8d6e6[SpriteAnim[SPRITEANIMSTRUCT_01]][SpriteAnim[SPRITEANIMSTRUCT_FRAME]]
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_01
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
@@ -508,6 +518,7 @@ endr
; 8d1a2 ; 8d1a2
Function8d1a2: ; 8d1a2 Function8d1a2: ; 8d1a2
; Load OAM data pointer
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, Unknown_8d94d ld hl, Unknown_8d94d

View File

@@ -5,7 +5,7 @@ CanLearnTMHMMove: ; 11639
ld hl, BaseTMHM ld hl, BaseTMHM
push hl push hl
ld a, [wd262] ld a, [wPutativeTMHMMove]
ld b, a ld b, a
ld c, 0 ld c, 0
ld hl, TMHMMoves ld hl, TMHMMoves

View File

@@ -30,7 +30,7 @@ Special_CelebiShrineEvent: ; 4989a
inc d inc d
push de push de
ld a, $90 ld a, $90
ld [wc3b5], a ld [wOAMRetentionSize], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call Function49935 call Function49935
ld c, 2 ld c, 2

View File

@@ -660,7 +660,7 @@ Function16a66: ; 16a66
xor a xor a
ld [Buffer1], a ld [Buffer1], a
predef FillMoves predef FillMoves
callba Function170bf callba InitEggMoves
ld hl, wEggMonID ld hl, wEggMonID
ld a, [PlayerID] ld a, [PlayerID]
ld [hli], a ld [hli], a

View File

@@ -36,7 +36,7 @@ ShakeHeadbuttTree: ; 8c80a
add hl, bc add hl, bc
ld [hl], $84 ld [hl], $84
ld a, 36 * 4 ld a, 36 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call GetHeadbuttTreeRelativeLocation call GetHeadbuttTreeRelativeLocation
ld a, $20 ld a, $20
@@ -51,7 +51,7 @@ ShakeHeadbuttTree: ; 8c80a
jr z, .done jr z, .done
dec [hl] dec [hl]
ld a, 36 * 4 ld a, 36 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call DelayFrame call DelayFrame
jr .loop jr .loop
@@ -68,7 +68,7 @@ ShakeHeadbuttTree: ; 8c80a
call ByteFill call ByteFill
ld de, Font ld de, Font
ld hl, VTiles1 ld hl, VTiles1
lb bc, BANK(Font), $c lb bc, BANK(Font), 12
call Get1bpp call Get1bpp
call ReplaceKrisSprite call ReplaceKrisSprite
ret ret
@@ -124,8 +124,8 @@ OWCutAnimation: ; 8c940
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
bit 7, a bit 7, a
jr nz, .finish jr nz, .finish
ld a, $90 ld a, 36 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call OWCutJumptable call OWCutJumptable
call DelayFrame call DelayFrame
@@ -341,8 +341,8 @@ FlyFromAnim: ; 8caed
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
bit 7, a bit 7, a
jr nz, .exit jr nz, .exit
ld a, $0 ld a, 0 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call Function8cbc8 call Function8cbc8
call DelayFrame call DelayFrame
@@ -379,8 +379,8 @@ FlyToAnim: ; 8cb33
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
bit 7, a bit 7, a
jr nz, .exit jr nz, .exit
ld a, $0 ld a, 0 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call Function8cbc8 call Function8cbc8
call DelayFrame call DelayFrame

View File

@@ -248,5 +248,5 @@ palgreen EQUS "$0020 *"
palblue EQUS "$0001 *" palblue EQUS "$0001 *"
dsprite: MACRO dsprite: MACRO
db \1 * 8 + \2, \3 * 8 + \4, \5, \6 db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6
endm endm

View File

@@ -8528,26 +8528,26 @@ WobbleChances: ; f9ba
KnowsMove: ; f9ea KnowsMove: ; f9ea
ld a, MON_MOVES ld a, MON_MOVES
call GetPartyParamLocation call GetPartyParamLocation
ld a, [wd262] ld a, [wPutativeTMHMMove]
ld b, a ld b, a
ld c, NUM_MOVES ld c, NUM_MOVES
.asm_f9f5 .loop
ld a, [hli] ld a, [hli]
cp b cp b
jr z, .asm_f9fe jr z, .knows_move
dec c dec c
jr nz, .asm_f9f5 jr nz, .loop
and a and a
ret ret
.asm_f9fe .knows_move
ld hl, UnknownText_0xfa06 ld hl, .Text_knows
call PrintText call PrintText
scf scf
ret ret
; fa06 ; fa06
UnknownText_0xfa06: ; 0xfa06 .Text_knows: ; 0xfa06
; knows @ . ; knows @ .
text_jump UnknownText_0x1c5ea8 text_jump UnknownText_0x1c5ea8
db "@" db "@"
@@ -10983,8 +10983,7 @@ AddMonMenuItem: ; 24e83
ret ret
; 24e99 ; 24e99
Function24e99: ; 24e99 BattleMonMenu: ; 24e99
; BattleMonMenu
ld hl, MenuDataHeader_0x24ed4 ld hl, MenuDataHeader_0x24ed4
call CopyMenuDataHeader call CopyMenuDataHeader
xor a xor a
@@ -10996,7 +10995,7 @@ Function24e99: ; 24e99
call CopyMenuData2 call CopyMenuData2
ld a, [wMenuData2Flags] ld a, [wMenuData2Flags]
bit 7, a bit 7, a
jr z, .asm_24ed0 jr z, .set_carry
call Function1c10 call Function1c10
ld hl, wcfa5 ld hl, wcfa5
set 6, [hl] set 6, [hl]
@@ -11004,15 +11003,15 @@ Function24e99: ; 24e99
ld de, SFX_READ_TEXT_2 ld de, SFX_READ_TEXT_2
call PlaySFX call PlaySFX
ld a, [hJoyPressed] ld a, [hJoyPressed]
bit 1, a bit B_BUTTON_F, a
jr z, .asm_24ed2 jr z, .clear_carry
ret z ret z
.asm_24ed0 .set_carry
scf scf
ret ret
.asm_24ed2 .clear_carry
and a and a
ret ret
; 24ed4 ; 24ed4
@@ -12863,7 +12862,7 @@ Function2c7bf: ; 2c7bf (b:47bf)
jr c, .NotTMHM jr c, .NotTMHM
call GetTMHMItemMove call GetTMHMItemMove
ld a, [wCurTMHM] ld a, [wCurTMHM]
ld [wd262], a ld [wPutativeTMHMMove], a
call GetMoveName call GetMoveName
call CopyName1 call CopyName1
ld hl, UnknownText_0x2c8bf ; Booted up a TM ld hl, UnknownText_0x2c8bf ; Booted up a TM
@@ -13206,7 +13205,7 @@ Function2c9e2: ; 2c9e2 (b:49e2)
.okay .okay
predef GetTMHMMove predef GetTMHMMove
ld a, [wd265] ld a, [wd265]
ld [wd262], a ld [wPutativeTMHMMove], a
call GetMoveName call GetMoveName
pop hl pop hl
ld bc, $3 ld bc, $3
@@ -13270,7 +13269,7 @@ Function2ca95: ; 2ca95
add hl, bc add hl, bc
predef GetTMHMMove predef GetTMHMMove
ld a, [wd265] ld a, [wd265]
ld [wd262], a ld [wPutativeTMHMMove], a
call GetMoveName call GetMoveName
push hl push hl
call PlaceString call PlaceString
@@ -14410,7 +14409,7 @@ Special_MoveTutor: ; 4925b
ld [wItemAttributeParamBuffer], a ld [wItemAttributeParamBuffer], a
call Function492a5 call Function492a5
ld [wd265], a ld [wd265], a
ld [wd262], a ld [wPutativeTMHMMove], a
call GetMoveName call GetMoveName
call CopyName1 call CopyName1
callba Function2c7fb callba Function2c7fb

View File

@@ -2054,7 +2054,7 @@ Function100cb5: ; 100cb5
ret ret
; 100d22 ; 100d22
Function100d22: ; 100d22 MobileBattleMonMenu: ; 100d22
call Function100dd8 call Function100dd8
ret c ret c
call Function100d67 call Function100d67

View File

@@ -5884,8 +5884,8 @@ Function11ac51: ; 11ac51
call Function11b314 call Function11b314
call Function11acb7 call Function11acb7
call Function11ad6e call Function11ad6e
ld a, $78 ld a, 30 * 4
ld [wc3b5], a ld [wOAMRetentionSize], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
callba ReloadMapPart callba ReloadMapPart
jr .asm_11ac82 jr .asm_11ac82

View File

@@ -463,19 +463,19 @@ wSpriteAnimationStructsEnd::
wc3ac:: ds 8 ; c3ac wc3ac:: ds 8 ; c3ac
wSpriteAnimCount:: wSpriteAnimCount::
wc3b4:: ds 1 wc3b4:: ds 1
wc3b5:: ds 1 wOAMRetentionSize:: ds 1
CurIcon:: ; c3b6 CurIcon:: ; c3b6
ds 1 ds 1
wc3b7:: ds 1 wc3b7:: ds 1
wc3b8:: dw wc3b8:: ds 2
wc3ba:: ds 1 wCurrAnimVTile:: ds 1
wc3bb:: ds 1 wCurrAnimXCoord:: ds 1
wc3bc:: ds 1 wCurrAnimYCoord:: ds 1
wc3bd:: ds 1 wCurrAnimXOffset:: ds 1
wc3be:: ds 1 wCurrAnimYOffset:: ds 1
wc3bf:: ds 1 wc3bf:: ds 1
wc3c0:: ds 1 wc3c0:: ds 1
wSpriteAnimsEnd:: wSpriteAnimsEnd::
@@ -1838,8 +1838,7 @@ wd13f:: ds 2
PartyMenuActionText:: ; d141 PartyMenuActionText:: ; d141
ds 1 ds 1
wItemAttributeParamBuffer:: wItemAttributeParamBuffer:: ; d142
wd142::
ds 1 ds 1
CurPartyLevel:: ; d143 CurPartyLevel:: ; d143
@@ -2155,7 +2154,7 @@ CurDamage:: ; d256
wd25a:: ds 3 wd25a:: ds 3
wd25d:: ds 1 wd25d:: ds 1
wListMoves_MoveIndicesBuffer:: ds 4 wListMoves_MoveIndicesBuffer:: ds 4
wd262:: ds 1 wPutativeTMHMMove:: ds 1
wd263:: ds 1 wd263:: ds 1
wd264:: ds 1 wd264:: ds 1
wFoundMatchingIDInParty:: wFoundMatchingIDInParty::