npc housekeeping
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
|
!DeathAnimation = 00 ; 00 = normal death, 01 = no death animation
|
||||||
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
|
!ImperviousAll = 00 ; 00 = Can be attack, 01 = attack will clink on it
|
||||||
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
|
!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)
|
!Palette = 00 ; Unused in this template (can be 0 to 7)
|
||||||
!Hitbox = 09 ; 00 to 31, can be viewed in sprite draw tool
|
!Hitbox = 09 ; 00 to 31, can be viewed in sprite draw tool
|
||||||
!Persist = 00 ; 01 = your sprite continue to live offscreen
|
!Persist = 00 ; 01 = your sprite continue to live offscreen
|
||||||
@@ -37,21 +37,18 @@ Sprite_Vasu_Long:
|
|||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
|
||||||
LDA.w SprSubtype, X : BNE +
|
LDA.w SprSubtype, X : BNE +
|
||||||
JSR Sprite_Vasu_Draw ; Call the draw code
|
JSR Sprite_Vasu_Draw
|
||||||
JMP ++
|
JMP ++
|
||||||
+
|
+
|
||||||
JSR Sprite_Error_Draw
|
JSR Sprite_Error_Draw
|
||||||
++
|
++
|
||||||
JSL Sprite_DrawShadow
|
JSL Sprite_DrawShadow
|
||||||
JSL Sprite_CheckActive ; Check if game is not paused
|
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
JSR Sprite_Vasu_Main
|
||||||
|
|
||||||
JSR Sprite_Vasu_Main ; Call the main sprite code
|
|
||||||
|
|
||||||
.SpriteIsNotActive
|
.SpriteIsNotActive
|
||||||
PLB ; Get back the databank we stored previously
|
PLB
|
||||||
RTL ; Go back to original code
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
@@ -59,13 +56,10 @@ Sprite_Vasu_Long:
|
|||||||
Sprite_Vasu_Prep:
|
Sprite_Vasu_Prep:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
|
||||||
LDA.b #$80 : STA.w SprDefl, X
|
LDA.b #$80 : STA.w SprDefl, X
|
||||||
|
|
||||||
LDA.w SprSubtype, X : BEQ +
|
LDA.w SprSubtype, X : BEQ +
|
||||||
LDA.b #$04 : STA.w SprAction, X
|
LDA.b #$04 : STA.w SprAction, X
|
||||||
+
|
+
|
||||||
|
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
@@ -119,7 +113,7 @@ Sprite_Vasu_Main:
|
|||||||
|
|
||||||
; Check if the player has found any rings to appraise
|
; Check if the player has found any rings to appraise
|
||||||
REP #$30
|
REP #$30
|
||||||
LDA.l FOUNDRINGS
|
LDA.l FOUNDRINGS
|
||||||
AND.w #$00FF
|
AND.w #$00FF
|
||||||
SEP #$30
|
SEP #$30
|
||||||
BEQ .no_rings
|
BEQ .no_rings
|
||||||
@@ -144,7 +138,7 @@ Sprite_Vasu_Main:
|
|||||||
%ShowUnconditionalMessage($0189) ; 'You don't have enough rupees!'
|
%ShowUnconditionalMessage($0189) ; 'You don't have enough rupees!'
|
||||||
%GotoAction(0)
|
%GotoAction(0)
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.no_rings_yet
|
.no_rings_yet
|
||||||
%ShowUnconditionalMessage($00AB) ; 'First one is free!'
|
%ShowUnconditionalMessage($00AB) ; 'First one is free!'
|
||||||
JMP .appraise_me
|
JMP .appraise_me
|
||||||
@@ -196,24 +190,23 @@ Sprite_Vasu_Draw:
|
|||||||
LDA.w SprFrame, X : TAY ;Animation Frame
|
LDA.w SprFrame, X : TAY ;Animation Frame
|
||||||
LDA .start_index, Y : STA $06
|
LDA .start_index, Y : STA $06
|
||||||
|
|
||||||
|
|
||||||
PHX
|
PHX
|
||||||
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
||||||
LDY.b #$00
|
LDY.b #$00
|
||||||
.nextTile
|
.nextTile
|
||||||
|
|
||||||
PHX ; Save current Tile Index?
|
PHX ; Save current Tile Index?
|
||||||
|
|
||||||
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
||||||
|
|
||||||
PHA ; Keep the value with animation index offset?
|
PHA ; Keep the value with animation index offset?
|
||||||
|
|
||||||
ASL A : TAX
|
ASL A : TAX
|
||||||
|
|
||||||
REP #$20
|
REP #$20
|
||||||
|
|
||||||
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
||||||
AND.w #$0100 : STA $0E
|
AND.w #$0100 : STA $0E
|
||||||
INY
|
INY
|
||||||
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
||||||
CLC : ADC #$0010 : CMP.w #$0100
|
CLC : ADC #$0010 : CMP.w #$0100
|
||||||
@@ -230,14 +223,14 @@ Sprite_Vasu_Draw:
|
|||||||
INY
|
INY
|
||||||
LDA .properties, X : STA ($90), Y
|
LDA .properties, X : STA ($90), Y
|
||||||
|
|
||||||
PHY
|
PHY
|
||||||
|
|
||||||
TYA : LSR #2 : TAY
|
TYA : LSR #2 : TAY
|
||||||
|
|
||||||
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
||||||
|
|
||||||
PLY : INY
|
PLY : INY
|
||||||
|
|
||||||
PLX : DEX : BPL .nextTile
|
PLX : DEX : BPL .nextTile
|
||||||
|
|
||||||
PLX
|
PLX
|
||||||
@@ -275,24 +268,23 @@ Sprite_Error_Draw:
|
|||||||
LDA.w SprFrame, X : TAY ;Animation Frame
|
LDA.w SprFrame, X : TAY ;Animation Frame
|
||||||
LDA .start_index, Y : STA $06
|
LDA .start_index, Y : STA $06
|
||||||
|
|
||||||
|
|
||||||
PHX
|
PHX
|
||||||
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
LDX .nbr_of_tiles, Y ;amount of tiles -1
|
||||||
LDY.b #$00
|
LDY.b #$00
|
||||||
.nextTile
|
.nextTile
|
||||||
|
|
||||||
PHX ; Save current Tile Index?
|
PHX ; Save current Tile Index?
|
||||||
|
|
||||||
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
TXA : CLC : ADC $06 ; Add Animation Index Offset
|
||||||
|
|
||||||
PHA ; Keep the value with animation index offset?
|
PHA ; Keep the value with animation index offset?
|
||||||
|
|
||||||
ASL A : TAX
|
ASL A : TAX
|
||||||
|
|
||||||
REP #$20
|
REP #$20
|
||||||
|
|
||||||
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
||||||
AND.w #$0100 : STA $0E
|
AND.w #$0100 : STA $0E
|
||||||
INY
|
INY
|
||||||
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
||||||
CLC : ADC #$0010 : CMP.w #$0100
|
CLC : ADC #$0010 : CMP.w #$0100
|
||||||
@@ -309,14 +301,14 @@ Sprite_Error_Draw:
|
|||||||
INY
|
INY
|
||||||
LDA .properties, X : STA ($90), Y
|
LDA .properties, X : STA ($90), Y
|
||||||
|
|
||||||
PHY
|
PHY
|
||||||
|
|
||||||
TYA : LSR #2 : TAY
|
TYA : LSR #2 : TAY
|
||||||
|
|
||||||
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
||||||
|
|
||||||
PLY : INY
|
PLY : INY
|
||||||
|
|
||||||
PLX : DEX : BPL .nextTile
|
PLX : DEX : BPL .nextTile
|
||||||
|
|
||||||
PLX
|
PLX
|
||||||
@@ -343,4 +335,4 @@ Sprite_Error_Draw:
|
|||||||
.sizes
|
.sizes
|
||||||
db $02
|
db $02
|
||||||
db $02
|
db $02
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,29 +33,23 @@
|
|||||||
Sprite_ZoraPrincess_Long:
|
Sprite_ZoraPrincess_Long:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
|
JSR Sprite_ZoraPrincess_Draw
|
||||||
JSR Sprite_ZoraPrincess_Draw ; Call the draw code
|
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||||
JSL Sprite_CheckActive ; Check if game is not paused
|
JSR Sprite_ZoraPrincess_Main
|
||||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
|
||||||
|
|
||||||
JSR Sprite_ZoraPrincess_Main ; Call the main sprite code
|
|
||||||
|
|
||||||
.SpriteIsNotActive
|
.SpriteIsNotActive
|
||||||
PLB ; Get back the databank we stored previously
|
PLB
|
||||||
RTL ; Go back to original code
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite_ZoraPrincess_Prep:
|
Sprite_ZoraPrincess_Prep:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
LDA.l $7EF302
|
LDA.l $7EF302 : BEQ .doesnt_have_mask
|
||||||
BEQ .doesnt_have_mask
|
|
||||||
STZ.w SprState, X ; Kill the sprite
|
STZ.w SprState, X ; Kill the sprite
|
||||||
.doesnt_have_mask
|
.doesnt_have_mask
|
||||||
|
|
||||||
LDA #$00 : STA.w SprDefl, X
|
LDA #$00 : STA.w SprDefl, X
|
||||||
LDA #$00 : STA.w SprTileDie, X
|
LDA #$00 : STA.w SprTileDie, X
|
||||||
|
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
@@ -141,7 +135,7 @@ Sprite_ZoraPrincess_Draw:
|
|||||||
REP #$20
|
REP #$20
|
||||||
|
|
||||||
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
|
||||||
AND.w #$0100 : STA $0E
|
AND.w #$0100 : STA $0E
|
||||||
INY
|
INY
|
||||||
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
|
||||||
CLC : ADC #$0010 : CMP.w #$0100
|
CLC : ADC #$0010 : CMP.w #$0100
|
||||||
@@ -158,7 +152,7 @@ Sprite_ZoraPrincess_Draw:
|
|||||||
INY
|
INY
|
||||||
LDA .properties, X : STA ($90), Y
|
LDA .properties, X : STA ($90), Y
|
||||||
|
|
||||||
PHY
|
PHY
|
||||||
TYA : LSR #2 : TAY
|
TYA : LSR #2 : TAY
|
||||||
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
|
||||||
PLY : INY
|
PLY : INY
|
||||||
|
|||||||
Reference in New Issue
Block a user