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 !ImperviousArrow = 00 ; 01 = Impervious to arrows
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks !ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss !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: Sprite_DekuScrub_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
JSR Sprite_DekuScrub_Draw
JSR Sprite_DekuScrub_Draw ; Call the draw code JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSL Sprite_CheckActive ; Check if game is not paused JSR Sprite_DekuScrub_Main
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_DekuScrub_Main ; Call the main sprite code
.SpriteIsNotActive .SpriteIsNotActive
PLB ; Get back the databank we stored previously PLB
RTL ; Go back to original code RTL
} }
; ========================================================= ; =========================================================
@@ -53,7 +50,6 @@ Sprite_DekuScrub_Long:
Sprite_DekuScrub_Prep: Sprite_DekuScrub_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.b #$80 : STA.w SprDefl, X LDA.b #$80 : STA.w SprDefl, X
; Peacetime Deku Scrub NPCs ; Peacetime Deku Scrub NPCs
@@ -195,7 +191,6 @@ Sprite_DekuScrub_Draw:
LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame LDA $0DC0, X : CLC : ADC $0D90, 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

View File

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

View File

@@ -34,12 +34,10 @@
Sprite_Korok_Long: Sprite_Korok_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA $0AA5 : BEQ .done LDA $0AA5 : BEQ .done
LDA.w SprSubtype, X LDA.w SprSubtype, X : BEQ .draw_makar
CMP.b #$00 : BEQ .draw_makar CMP.b #$01 : BEQ .draw_hollo
CMP.b #$01 : BEQ .draw_hollo CMP.b #$02 : BEQ .draw_rown
CMP.b #$02 : BEQ .draw_rown
.draw_makar .draw_makar
JSR Sprite_Korok_DrawMakar JSR Sprite_Korok_DrawMakar
BRA .done BRA .done
@@ -52,14 +50,11 @@ Sprite_Korok_Long:
.done .done
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_Korok_Main
JSR Sprite_Korok_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_Korok_Prep: Sprite_Korok_Prep:

View File

@@ -37,23 +37,21 @@
Sprite_MakuTree_Long: Sprite_MakuTree_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
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_MakuTree_Main
JSR Sprite_MakuTree_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_MakuTree_Prep: Sprite_MakuTree_Prep:
{ {
PHB : PHK : PLB PHB : PHK : PLB
; Play the Maku Song ; Play the Maku Song
LDA.l OOSPROG2 : AND.b #$04 : BEQ +
LDA.b #$03 : STA.w $012C LDA.b #$03 : STA.w $012C
+
PLB PLB
RTL RTL
} }

View File

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

View File

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