diff --git a/Sprites/NPCs/bean_vendor.asm b/Sprites/NPCs/bean_vendor.asm index 8e84507..5fa753e 100644 --- a/Sprites/NPCs/bean_vendor.asm +++ b/Sprites/NPCs/bean_vendor.asm @@ -38,18 +38,7 @@ Sprite_BeanVendor_Long: { PHB : PHK : PLB - ; If it is not the Hall of Secrets map - LDA.b $8A : CMP.b #$0E : BNE .NotGaebora - ; If the map doesn't have the 6 crystals - LDA.l $7EF37A : CMP.b #$77 : BNE .Despawn - ; If the player has the Song of Soaring, despawn - LDA.l $7EF34C : CMP.b #$03 : BCS .Despawn - LDA.b #$05 : STA.w SprSubtype, X - JSR Sprite_KaeoporaGaebora_Draw - JMP .HandleSprite - .NotGaebora JSR Sprite_BeanVendor_Draw - .HandleSprite JSL Sprite_CheckActive ; Check if game is not paused BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive @@ -58,10 +47,6 @@ Sprite_BeanVendor_Long: .SpriteIsNotActive PLB ; Get back the databank we stored previously RTL ; Go back to original code - - .Despawn - STZ.w SprState, X - PLB : RTL } ; ========================================================= @@ -103,9 +88,6 @@ Sprite_BeanVendor_Main: dw VillageElder dw SpawnMagicBean dw PlayerSaidNo - dw KaeoporaGaebora - dw KaeoporaGaebora_Respond - dw KaeoporaGaebora_FlyAway dw MagicBean_RanchFlower ; 0x00 - Bean Vendor @@ -233,40 +215,6 @@ Sprite_BeanVendor_Main: RTS } - ; 0x05 - Kaeopora Gaebora - KaeoporaGaebora: - { - %PlayAnimation(0,0,1) - LDA.w SprTimerA, X : BNE .not_ready - %ShowUnconditionalMessage($146) - %GotoAction(6) - .not_ready - RTS - } - - KaeoporaGaebora_Respond: - { - LDA $1CE8 : BNE .player_said_no - %GotoAction(5) - RTS - .player_said_no - %GotoAction(7) - LDA.b #$60 : STA.w SprTimerA, X - LDA.b #$03 : STA.l $7EF34C - RTS - } - - FlyAwaySpeed = 10 - KaeoporaGaebora_FlyAway: - { - LDA.b #-FlyAwaySpeed : STA.w SprYSpeed, X - JSL Sprite_Move - LDA.w SprTimerA, X : BNE .not_ready - STZ.w SprState, X - .not_ready - RTS - } - MagicBean_RanchFlower: { LDA.b #$04 : STA.w SprFrame, X @@ -391,75 +339,3 @@ Sprite_BeanVendor_Draw: db $02, $02, $02, $02 ; Flower } -Sprite_KaeoporaGaebora_Draw: -{ - JSL Sprite_PrepOamCoord - JSL Sprite_OAM_AllocateDeferToPlayer - - LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame - LDA .start_index, Y : STA $06 - - - PHX - LDX .nbr_of_tiles, Y ;amount of tiles -1 - LDY.b #$00 - .nextTile - - PHX ; Save current Tile Index? - - TXA : CLC : ADC $06 ; Add Animation Index Offset - - PHA ; Keep the value with animation index offset? - - ASL A : TAX - - REP #$20 - - LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y - AND.w #$0100 : STA $0E - INY - LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y - CLC : ADC #$0010 : CMP.w #$0100 - SEP #$20 - BCC .on_screen_y - - LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way - STA $0E - .on_screen_y - - PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore) - INY - LDA .chr, X : STA ($90), Y - INY - LDA .properties, X : STA ($90), Y - - PHY - - TYA : LSR #2 : TAY - - LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer - - PLY : INY - PLX : DEX : BPL .nextTile - - PLX - - RTS - - - ; ========================================================= - .start_index - db $00 - .nbr_of_tiles - db 3 - .x_offsets - dw -8, -8, 8, 8 - .y_offsets - dw 0, -16, 0, -16 - .chr - db $AE, $8E, $AE, $8E - .properties - db $3B, $3B, $7B, $7B - .sizes - db $02, $02, $02, $02 -} diff --git a/Sprites/NPCs/eon_owl.asm b/Sprites/NPCs/eon_owl.asm index 6b88261..d3677a0 100644 --- a/Sprites/NPCs/eon_owl.asm +++ b/Sprites/NPCs/eon_owl.asm @@ -1,6 +1,5 @@ ; ========================================================= -; Sprite Properties -; ========================================================= +; Kaepora Gaebora and Eon Owl !SPRID = Sprite_EonOwl !NbrTiles = 03 ; Number of tiles used in a frame @@ -35,8 +34,18 @@ Sprite_EonOwl_Long: { PHB : PHK : PLB - + ; If it is not the Hall of Secrets map + LDA.b $8A : CMP.b #$0E : BNE .NotGaebora + ; If the map doesn't have the 6 crystals + LDA.l $7EF37A : CMP.b #$77 : BNE .Despawn + ; If the player has the Song of Soaring, despawn + LDA.l $7EF34C : CMP.b #$03 : BCS .Despawn + LDA.b #$05 : STA.w SprSubtype, X + JSR Sprite_KaeporaGaebora_Draw + JMP .HandleSprite + .NotGaebora JSR Sprite_EonOwl_Draw ; Call the draw code + .HandleSprite JSL Sprite_CheckActive ; Check if game is not paused BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive @@ -45,6 +54,10 @@ Sprite_EonOwl_Long: .SpriteIsNotActive PLB ; Get back the databank we stored previously RTL ; Go back to original code + .Despawn + STZ.w SprState, X + PLB + RTL } ; ========================================================= @@ -52,14 +65,13 @@ Sprite_EonOwl_Long: Sprite_EonOwl_Prep: { PHB : PHK : PLB - LDA.w AreaIndex : CMP.b #$50 : BNE .not_intro ; If Map 0x50, don't spawn after meeting Maku Tree LDA.l OOSPROG : AND.b #$02 : BEQ .continue - STZ.w SprState, X + .Despawn + STZ.w SprState, X .continue .not_intro - PLB RTL } @@ -75,6 +87,10 @@ Sprite_EonOwl_Main: dw EonOwl_IntroDialogue dw EonOwl_FlyingAway + dw KaeporaGaebora + dw KaeporaGaebora_Respond + dw KaeporaGaebora_FlyAway + EonOwl_Idle: { %PlayAnimation(0,1,16) @@ -119,6 +135,42 @@ Sprite_EonOwl_Main: RTS } + + ; 0x03 - Kaepora Gaebora + KaeporaGaebora: + { + %PlayAnimation(0,0,1) + LDA.w SprTimerA, X : BNE .not_ready + %ShowUnconditionalMessage($146) + %GotoAction(4) + .not_ready + RTS + } + + KaeporaGaebora_Respond: + { + LDA $1CE8 : BNE .player_said_no + %GotoAction(5) + RTS + .player_said_no + %GotoAction(5) + LDA.b #$60 : STA.w SprTimerA, X + LDA.b #$03 : STA.l $7EF34C + RTS + } + + FlyAwaySpeed = 10 + KaeporaGaebora_FlyAway: + { + LDA.b #-FlyAwaySpeed : STA.w SprYSpeed, X + JSL Sprite_Move + LDA.w SprTimerA, X : BNE .not_ready + STZ.w SprState, X + .not_ready + RTS + } + + } ; ========================================================= @@ -204,3 +256,76 @@ Sprite_EonOwl_Draw: db $02, $02 db $02, $02 } + +Sprite_KaeporaGaebora_Draw: +{ + JSL Sprite_PrepOamCoord + JSL Sprite_OAM_AllocateDeferToPlayer + + LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame + LDA .start_index, Y : STA $06 + + + PHX + LDX .nbr_of_tiles, Y ;amount of tiles -1 + LDY.b #$00 + .nextTile + + PHX ; Save current Tile Index? + + TXA : CLC : ADC $06 ; Add Animation Index Offset + + PHA ; Keep the value with animation index offset? + + ASL A : TAX + + REP #$20 + + LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y + AND.w #$0100 : STA $0E + INY + LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y + CLC : ADC #$0010 : CMP.w #$0100 + SEP #$20 + BCC .on_screen_y + + LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way + STA $0E + .on_screen_y + + PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore) + INY + LDA .chr, X : STA ($90), Y + INY + LDA .properties, X : STA ($90), Y + + PHY + + TYA : LSR #2 : TAY + + LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer + + PLY : INY + PLX : DEX : BPL .nextTile + + PLX + + RTS + + + ; ========================================================= + .start_index + db $00 + .nbr_of_tiles + db 3 + .x_offsets + dw -8, -8, 8, 8 + .y_offsets + dw 0, -16, 0, -16 + .chr + db $AE, $8E, $AE, $8E + .properties + db $3B, $3B, $7B, $7B + .sizes + db $02, $02, $02, $02 +} diff --git a/Sprites/all_sprites.asm b/Sprites/all_sprites.asm index dd065b2..9e1d888 100644 --- a/Sprites/all_sprites.asm +++ b/Sprites/all_sprites.asm @@ -23,14 +23,13 @@ print "End of mask_salesman.asm ", pc Sprite_BeanVendor = $07 Sprite_VillageElder = $07 -Sprite_KaeporaGaebora = $07 incsrc "Sprites/NPCs/bean_vendor.asm" print "End of bean_vendor.asm ", pc incsrc "Sprites/Bosses/octoboss.asm" print "End of octoboss.asm ", pc -Sprite_Mermaid = $F0 +Sprite_Mermaid = $F0 Sprite_Maple = $F0 ; Subtype 1 Sprite_Librarian = $F0 ; Subtype 2 incsrc "Sprites/NPCs/mermaid.asm" @@ -265,6 +264,7 @@ incsrc "Sprites/Objects/collectible.asm" print "End of collectible.asm ", pc Sprite_EonOwl = $0A +Sprite_KaeporaGaebora = $0A incsrc "Sprites/NPCs/eon_owl.asm" print "End of eon_owl.asm ", pc