add kaeopora gaebora as separate subtype to bean vendor NPC

This commit is contained in:
scawful
2024-06-13 21:34:47 -04:00
parent bce7a88458
commit 64e589d215

View File

@@ -37,7 +37,12 @@ Sprite_BeanVendor_Long:
{
PHB : PHK : PLB
JSR Sprite_BeanVendor_Draw ; Call the draw code
LDA.w SprSubtype, X : CMP.b #$05 : BNE .NotGaebora
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
@@ -48,6 +53,7 @@ Sprite_BeanVendor_Long:
RTL ; Go back to original code
}
; =========================================================
Sprite_BeanVendor_Prep:
{
@@ -71,6 +77,7 @@ Sprite_BeanVendor_Main:
dw VillageElder
dw SpawnMagicBean
dw PlayerSaidNo
dw KaeoporaGaebora
; 0x00 - Bean Vendor
BeanVendor:
@@ -139,6 +146,13 @@ Sprite_BeanVendor_Main:
%GotoAction(0)
RTS
}
; 0x05 - Kaeopora Gaebora
KaeoporaGaebora:
{
%PlayAnimation(0,0,1)
RTS
}
}
; =========================================================
@@ -231,3 +245,77 @@ Sprite_BeanVendor_Draw:
db $02, $02, $02, $02, $00, $00
db $02, $02, $02, $02, $00, $00
}
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
}