add librarian subsprite to mermaid/maple

This commit is contained in:
scawful
2024-07-05 22:42:49 -04:00
parent 62b0702b01
commit 9774feb399

View File

@@ -37,8 +37,12 @@ Sprite_Mermaid_Long:
PHB : PHK : PLB
LDA.w SprMiscE, X : BEQ .MermaidDraw
CMP.b #$02 : BEQ .LibrarianDraw
JSR Sprite_Maple_Draw
JMP .Continue
.LibrarianDraw
JSR Sprite_Librarian_Draw
JMP .Continue
.MermaidDraw
JSR Sprite_Mermaid_Draw ; Call the draw code
.Continue
@@ -64,6 +68,11 @@ Sprite_Mermaid_Prep:
LDA.b #$01 : STA.w SprMiscE, X
LDA.b #$03 : STA.w SprAction, X
+
CMP.b #$02 : BNE ++
; Librarian Sprite
LDA.b #$02 : STA.w SprMiscE, X
LDA.b #$06 : STA.w SprAction, X
++
PLB
RTL
}
@@ -81,6 +90,8 @@ Sprite_Mermaid_Main:
dw Maple_BoughtMilkBottle
dw Maple_NotEnoughRupees
dw LibrarianIdle
MermaidWait:
{
%PlayAnimation(0,0, 20)
@@ -201,6 +212,14 @@ Sprite_Mermaid_Main:
%ShowUnconditionalMessage($0189) ; You don't have enough rupees!
RTS
}
LibrarianIdle:
{
%PlayAnimation(0,1,16)
JSL Sprite_PlayerCantPassThrough
RTS
}
}
Sprite_Mermaid_Draw:
@@ -362,3 +381,81 @@ Sprite_Maple_Draw:
db $39, $39
db $39, $39
}
Sprite_Librarian_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, $02
.nbr_of_tiles
db 1, 1
.x_offsets
dw 0, 0
dw 0, 0
.y_offsets
dw 0, -10
dw -9, 0
.chr
db $2A, $24
db $24, $28
.properties
db $39, $39
db $39, $39
.sizes
db $02, $02
db $02, $02
}