NPC housekeeping

This commit is contained in:
scawful
2024-11-26 10:05:10 -05:00
parent 173f5816c5
commit b3be08ebcc
6 changed files with 133 additions and 171 deletions

View File

@@ -29,23 +29,20 @@
!ImperviousArrow = 00 ; 01 = Impervious to arrows
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
%Set_Sprite_Properties(Sprite_DekuScrub_Prep, Sprite_DekuScrub_Long);
%Set_Sprite_Properties(Sprite_DekuScrub_Prep, Sprite_DekuScrub_Long)
; =========================================================
Sprite_DekuScrub_Long:
{
PHB : PHK : PLB
JSR Sprite_DekuScrub_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_DekuScrub_Main ; Call the main sprite code
JSR Sprite_DekuScrub_Draw
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_DekuScrub_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
; =========================================================
@@ -53,7 +50,6 @@ Sprite_DekuScrub_Long:
Sprite_DekuScrub_Prep:
{
PHB : PHK : PLB
LDA.b #$80 : STA.w SprDefl, X
; Peacetime Deku Scrub NPCs
@@ -195,7 +191,6 @@ Sprite_DekuScrub_Draw:
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

View File

@@ -27,12 +27,12 @@
!ImperviousArrow = 00 ; 01 = Impervious to arrows
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
%Set_Sprite_Properties(Sprite_Goron_Prep, Sprite_Goron_Long);
%Set_Sprite_Properties(Sprite_Goron_Prep, Sprite_Goron_Long)
Sprite_Goron_Long:
{
PHB : PHK : PLB
LDA.w WORLDFLAG : BEQ .kalyxo
JSR Sprite_EonGoron_Draw
JMP +
@@ -40,11 +40,8 @@ Sprite_Goron_Long:
JSR Sprite_KalyxoGoron_Draw
+
JSL Sprite_DrawShadow
JSL Sprite_CheckActive
BCC .SpriteIsNotActive
JSR Sprite_Goron_Main
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Goron_Main
.SpriteIsNotActive
PLB
RTL
@@ -59,9 +56,9 @@ Sprite_Goron_Prep:
+
PHX
LDX $8A
LDA.l $7EF280,X : CMP.b #$20 : BEQ +++
PLX
STZ.w SprAction, X
LDA.l $7EF280, X : CMP.b #$20 : BEQ +++
PLX
STZ.w SprAction, X
++
PLB
RTL

View File

@@ -34,12 +34,10 @@
Sprite_Korok_Long:
{
PHB : PHK : PLB
LDA $0AA5 : BEQ .done
LDA.w SprSubtype, X
CMP.b #$00 : BEQ .draw_makar
CMP.b #$01 : BEQ .draw_hollo
CMP.b #$02 : BEQ .draw_rown
LDA.w SprSubtype, X : BEQ .draw_makar
CMP.b #$01 : BEQ .draw_hollo
CMP.b #$02 : BEQ .draw_rown
.draw_makar
JSR Sprite_Korok_DrawMakar
BRA .done
@@ -52,14 +50,11 @@ Sprite_Korok_Long:
.done
JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Korok_Main ; Call the main sprite code
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Korok_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
Sprite_Korok_Prep:
@@ -131,7 +126,7 @@ Sprite_Korok_Main:
%PlayAnimation(6, 8, 10)
LDA.b #KorokWalkSpeed : STA.w SprXSpeed, X
JSL Sprite_Move
LDA.w SprTimerB, X : BNE +
LDA.w SprTimerB, X : BNE +
JSL GetRandomInt : AND.b #$03 : STA.w SprAction, X
+
RTS
@@ -143,7 +138,7 @@ Sprite_Korok_Main:
LDA.b #-KorokWalkSpeed : STA.w SprXSpeed, X
JSL Sprite_Move
LDA.w SprTimerB, X : BNE +
LDA.w SprTimerB, X : BNE +
JSL GetRandomInt : AND.b #$03 : STA.w SprAction, X
+
RTS
@@ -182,17 +177,17 @@ Sprite_Korok_DrawMakar:
.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
@@ -209,14 +204,14 @@ Sprite_Korok_DrawMakar:
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
@@ -310,17 +305,17 @@ Sprite_Korok_DrawHollo:
.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
@@ -337,14 +332,14 @@ Sprite_Korok_DrawHollo:
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
@@ -438,17 +433,17 @@ Sprite_Korok_DrawRown:
.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
@@ -465,14 +460,14 @@ Sprite_Korok_DrawRown:
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

View File

@@ -37,23 +37,21 @@
Sprite_MakuTree_Long:
{
PHB : PHK : PLB
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_MakuTree_Main ; Call the main sprite code
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_MakuTree_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
; =========================================================
Sprite_MakuTree_Prep:
{
PHB : PHK : PLB
; Play the Maku Song
LDA.b #$03 : STA.w $012C
LDA.l OOSPROG2 : AND.b #$04 : BEQ +
LDA.b #$03 : STA.w $012C
+
PLB
RTL
}

View File

@@ -28,24 +28,19 @@
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
%Set_Sprite_Properties(Sprite_MaskSalesman_Prep, Sprite_MaskSalesman_Long);
%Set_Sprite_Properties(Sprite_MaskSalesman_Prep, Sprite_MaskSalesman_Long)
Sprite_MaskSalesman_Long:
{
PHB : PHK : PLB
JSR Sprite_MaskSalesman_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_MaskSalesman_Main ; Call the main sprite code
JSR Sprite_MaskSalesman_Draw
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_MaskSalesman_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
Sprite_MaskSalesman_Prep:
{
PHB : PHK : PLB
@@ -75,26 +70,24 @@ Sprite_MaskSalesman_Main:
; 0x00
InquiryHandler:
{
%PlayAnimation(0, 1, 16)
%PlayAnimation(0, 1, 16)
; Player has a Lv1 Ocarina, skip to the you got it message
LDA.l $7EF34C : CMP.b #$01 : BEQ .has_ocarina
; Player has no Ocarina or Lv2 Ocarina
; Do you want to buy a mask?
%ShowSolicitedMessage($E5) : BCC .didnt_converse
LDA $1CE8 : BNE .player_said_no
; Player has a Lv1 Ocarina, skip to the you got it message
LDA.l $7EF34C : CMP.b #$01 : BEQ .has_ocarina
; Player wants to buy a mask
LDA.l $7EF34C : CMP.b #$02 : BCS .has_song_healing
; Player has no Ocarina or Lv2 Ocarina
; Do you want to buy a mask?
%ShowSolicitedMessage($E5) : BCC .didnt_converse
LDA $1CE8 : BNE .player_said_no
; Player wants to buy a mask
LDA.l $7EF34C : CMP.b #$02 : BCS .has_song_healing
; No Ocarina yet
%GotoAction(1)
RTS
; No Ocarina yet
%GotoAction(1)
RTS
.has_ocarina
%GotoAction(2)
RTS
%GotoAction(2)
RTS
.has_song_healing
LDA.l $7EF348 : CMP.b #$01 : BCS .has_bunny_mask
@@ -111,7 +104,7 @@ Sprite_MaskSalesman_Main:
.player_said_no
%GotoAction(6)
.didnt_converse
RTS
RTS
}
; 0x01 - Link has not yet gotten the Ocarina
@@ -148,20 +141,19 @@ Sprite_MaskSalesman_Main:
; 0x04 - Offer Bunny Hood
OfferBunnyHood:
{
%PlayAnimation(0, 1, 16)
%ShowUnconditionalMessage($07F) ; Bunny Hood for 100 rupees?
%GotoAction(8)
RTS
%PlayAnimation(0, 1, 16)
%ShowUnconditionalMessage($07F) ; Bunny Hood for 100 rupees?
%GotoAction(8)
RTS
}
; 0x05 - Offer Stone Mask
OfferStoneMask:
{
%PlayAnimation(0, 1, 16)
%ShowUnconditionalMessage($082) ; Stone Mask for 650 rupees?
%GotoAction(9)
RTS
%PlayAnimation(0, 1, 16)
%ShowUnconditionalMessage($082) ; Stone Mask for 650 rupees?
%GotoAction(9)
RTS
}
; 0x06 - Player said no to buying a mask
@@ -185,74 +177,68 @@ Sprite_MaskSalesman_Main:
BoughtBunnyHood:
{
%PlayAnimation(0, 1, 16)
LDA $1CE8 : BNE .player_said_no
LDA $1CE8 : BNE .player_said_no
REP #$20
LDA.l $7EF360 : CMP.w #$64 ; 100 rupees
SEP #$30
BCC .not_enough_rupees
LDY.b #$10 ; Bunny Hood
STZ.w $02E9
PHX
JSL Link_ReceiveItem
PLX
REP #$20
LDA.l $7EF360
CMP.w #$64 ; 100 rupees
SEC : SBC.w #$64 ; Subtract 100 rupees
STA.l $7EF360
SEP #$30
BCC .not_enough_rupees
LDY.b #$10 ; Bunny Hood
STZ.w $02E9
PHX
JSL Link_ReceiveItem
PLX
%ShowUnconditionalMessage($063)
REP #$20
LDA.l $7EF360
SEC
SBC.w #$64 ; Subtract 100 rupees
STA.l $7EF360
SEP #$30
%ShowUnconditionalMessage($063)
%GotoAction(0)
RTS
%GotoAction(0)
RTS
.not_enough_rupees
%GotoAction($0A)
RTS
.player_said_no
%GotoAction(6)
%GotoAction($0A)
RTS
.player_said_no
%GotoAction(6)
RTS
}
BoughtStoneMask:
{
%PlayAnimation(0, 1, 16)
LDA $1CE8 : BNE .player_said_no
LDA $1CE8 : BNE .player_said_no
REP #$20
LDA.l $7EF360 : CMP.w #$352 ; 850 rupees
SEP #$30
BCC .not_enough_rupees
LDY #$19 ; Stone Mask
STZ.w $02E9
PHX
JSL Link_ReceiveItem
PLX
REP #$20
LDA.l $7EF360
CMP.w #$352 ; 850 rupees
SEC : SBC.w #$352 ; Subtract 850 rupees
STA.l $7EF360
SEP #$30
BCC .not_enough_rupees
LDY #$19 ; Stone Mask
STZ.w $02E9
PHX
JSL Link_ReceiveItem
PLX
REP #$20
LDA.l $7EF360
SEC
SBC.w #$352 ; Subtract 850 rupees
STA.l $7EF360
SEP #$30
%ShowUnconditionalMessage($055)
%GotoAction(0)
RTS
%ShowUnconditionalMessage($055)
%GotoAction(0)
RTS
.not_enough_rupees
%GotoAction($0A)
RTS
.player_said_no
%GotoAction(6)
%GotoAction($0A)
RTS
.player_said_no
%GotoAction(6)
RTS
}
NotEnoughMoney:
@@ -272,7 +258,6 @@ Sprite_MaskSalesman_Draw:
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

View File

@@ -44,17 +44,14 @@ Sprite_Mermaid_Long:
JSR Sprite_Librarian_Draw
JMP .Continue
.MermaidDraw
JSR Sprite_Mermaid_Draw ; Call the draw code
JSR Sprite_Mermaid_Draw
.Continue
JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Mermaid_Main ; Call the main sprite code
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Mermaid_Main
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
PLB
RTL
}
@@ -169,8 +166,7 @@ Sprite_Mermaid_Main:
Maple_BoughtMilkBottle:
{
REP #$20
LDA.l $7EF360
CMP.w #$1E ; 30 rupees
LDA.l $7EF360 : CMP.w #$1E ; 30 rupees
SEP #$30
BCC .not_enough_rupees
@@ -193,8 +189,7 @@ Sprite_Mermaid_Main:
.finish_storage
REP #$20
LDA.l $7EF360
SEC
SBC.w #$1E ; Subtract 30 rupees
SEC : SBC.w #$1E ; Subtract 30 rupees
STA.l $7EF360
SEP #$30
@@ -216,8 +211,8 @@ Sprite_Mermaid_Main:
Maple_HandlePlayerResponse:
{
LDA $1CE8 : BEQ .player_said_yes
%GotoAction(4)
RTS
%GotoAction(4)
RTS
.player_said_yes
%GotoAction(1)
RTS
@@ -431,7 +426,6 @@ Sprite_Mermaid_Draw:
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
@@ -515,7 +509,6 @@ Sprite_Maple_Draw:
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
@@ -587,7 +580,6 @@ Sprite_Librarian_Draw:
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