npc housekeeping

This commit is contained in:
scawful
2024-11-28 11:27:34 -05:00
parent d54d3147e7
commit a0a31549e8
2 changed files with 34 additions and 48 deletions

View File

@@ -11,7 +11,7 @@
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
!Palette = 00 ; Unused in this template (can be 0 to 7)
!Hitbox = 09 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen
@@ -37,21 +37,18 @@ Sprite_Vasu_Long:
{
PHB : PHK : PLB
LDA.w SprSubtype, X : BNE +
JSR Sprite_Vasu_Draw ; Call the draw code
LDA.w SprSubtype, X : BNE +
JSR Sprite_Vasu_Draw
JMP ++
+
JSR Sprite_Error_Draw
++
JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Vasu_Main ; Call the main sprite code
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Vasu_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
; =========================================================
@@ -59,13 +56,10 @@ Sprite_Vasu_Long:
Sprite_Vasu_Prep:
{
PHB : PHK : PLB
LDA.b #$80 : STA.w SprDefl, X
LDA.w SprSubtype, X : BEQ +
LDA.b #$04 : STA.w SprAction, X
+
PLB
RTL
}
@@ -119,7 +113,7 @@ Sprite_Vasu_Main:
; Check if the player has found any rings to appraise
REP #$30
LDA.l FOUNDRINGS
LDA.l FOUNDRINGS
AND.w #$00FF
SEP #$30
BEQ .no_rings
@@ -144,7 +138,7 @@ Sprite_Vasu_Main:
%ShowUnconditionalMessage($0189) ; 'You don't have enough rupees!'
%GotoAction(0)
RTS
.no_rings_yet
%ShowUnconditionalMessage($00AB) ; 'First one is free!'
JMP .appraise_me
@@ -196,24 +190,23 @@ Sprite_Vasu_Draw:
LDA.w SprFrame, 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
ASL A : TAX
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
@@ -230,14 +223,14 @@ Sprite_Vasu_Draw:
INY
LDA .properties, X : STA ($90), Y
PHY
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
@@ -275,24 +268,23 @@ Sprite_Error_Draw:
LDA.w SprFrame, 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
ASL A : TAX
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
@@ -309,14 +301,14 @@ Sprite_Error_Draw:
INY
LDA .properties, X : STA ($90), Y
PHY
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
@@ -343,4 +335,4 @@ Sprite_Error_Draw:
.sizes
db $02
db $02
}
}

View File

@@ -33,29 +33,23 @@
Sprite_ZoraPrincess_Long:
{
PHB : PHK : PLB
JSR Sprite_ZoraPrincess_Draw ; Call the draw code
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_ZoraPrincess_Main ; Call the main sprite code
JSR Sprite_ZoraPrincess_Draw
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_ZoraPrincess_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
Sprite_ZoraPrincess_Prep:
{
PHB : PHK : PLB
LDA.l $7EF302
BEQ .doesnt_have_mask
LDA.l $7EF302 : BEQ .doesnt_have_mask
STZ.w SprState, X ; Kill the sprite
.doesnt_have_mask
LDA #$00 : STA.w SprDefl, X
LDA #$00 : STA.w SprTileDie, X
PLB
RTL
}
@@ -141,7 +135,7 @@ Sprite_ZoraPrincess_Draw:
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
@@ -158,7 +152,7 @@ Sprite_ZoraPrincess_Draw:
INY
LDA .properties, X : STA ($90), Y
PHY
PHY
TYA : LSR #2 : TAY
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY