cleanup sprite functions and macros
This commit is contained in:
@@ -307,181 +307,6 @@ Sprite_Damage_Flash:
|
|||||||
|
|
||||||
; =========================================================
|
; =========================================================
|
||||||
|
|
||||||
Intro_Dungeon_Main:
|
|
||||||
{
|
|
||||||
LDA $0E20 : CMP.b #$92 : BNE .not_sprite_body_boss
|
|
||||||
LDA $0E30 : BEQ .not_sprite_body_boss
|
|
||||||
LDA $1C : AND.b #$FE : STA $1C ;turn off BG2 (Body)
|
|
||||||
|
|
||||||
; free ram used to check if the sprite ran this frame, if 0, it didn't run
|
|
||||||
LDA.b SpriteRanCheck : BEQ .didNotRun
|
|
||||||
LDA $1C : ORA.b #$01 : STA $1C ;turn on BG2 (Body)
|
|
||||||
|
|
||||||
.didNotRun
|
|
||||||
|
|
||||||
STZ.b SpriteRanCheck
|
|
||||||
|
|
||||||
.not_sprite_body_boss
|
|
||||||
|
|
||||||
REP #$21 : LDA.w DungeonMainCheck : BNE .intro ;<- load that free ram you are using if it's not zero then we're doing intro thing
|
|
||||||
LDA $E2 : RTL ;return to normal intro
|
|
||||||
|
|
||||||
.intro
|
|
||||||
|
|
||||||
PLA ;Pop 2byte from stack
|
|
||||||
;skip all the BGs codes
|
|
||||||
|
|
||||||
SEP #$20
|
|
||||||
PLA ;Pop 1 byte from the stack
|
|
||||||
JSL $07F0AC ; $3F0AC IN ROM. Handle the sprites of pushed blocks.
|
|
||||||
JSL $068328 ;Sprite_Main
|
|
||||||
JSL $0DA18E ;PlayerOam_Main
|
|
||||||
JSL $0DDB75 ;HUD.RefillLogicLong
|
|
||||||
|
|
||||||
JML $0AFD0C ;FloorIndicator ; $57D0C IN ROM. Handles HUD floor indicator
|
|
||||||
}
|
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
;uses $00 as the Y coordinate and $02 as the X
|
|
||||||
MoveCamera:
|
|
||||||
{
|
|
||||||
REP #$20
|
|
||||||
|
|
||||||
;move the camera up or down until a point is reached
|
|
||||||
LDA $E8 : CMP $00 : BEQ .dontMoveY ;if equals that point, dont move y
|
|
||||||
|
|
||||||
BCS .CameraBelowPointY
|
|
||||||
;CameraAbovePoint
|
|
||||||
ADC.w #$0001 : STA $E8 : STA $E6 : STA $0122 : STA $0124 ;move the camera down by 1
|
|
||||||
BRA .dontMoveY
|
|
||||||
|
|
||||||
.CameraBelowPointY
|
|
||||||
SEC : SBC.w #$0001 : STA $E8 : STA $E6 : STA $0122 : STA $0124 ;move the camera up by 1
|
|
||||||
|
|
||||||
.dontMoveY
|
|
||||||
|
|
||||||
;move the camera right or left until a point is reached
|
|
||||||
LDA $E2 : CMP.w $02 : BEQ .dontMoveX ;if equals that point, dont move x
|
|
||||||
|
|
||||||
BCS .CameraBelowPointX ;left
|
|
||||||
;CameraAbovePoint ;right
|
|
||||||
ADC.w #$0001 : STA $E2 : STA $E0 : STA $011E : STA $0120 ;move the camera right by 1
|
|
||||||
BRA .dontMoveX
|
|
||||||
|
|
||||||
.CameraBelowPointX
|
|
||||||
SEC : SBC.w #$0001 : STA $E2 : STA $E0 : STA $011E : STA $0120 ;move the camera left by 1
|
|
||||||
|
|
||||||
.dontMoveX
|
|
||||||
|
|
||||||
;if link is outside of a certain range of the camera, make him dissapear so he doesnt appear on the other side
|
|
||||||
LDA $20 : SEC : SBC $E8 : CMP.w #$00E0 : BCS .MakeLinkInvisible
|
|
||||||
LDA $22 : SEC : SBC $E2 : CMP.w #$00E0 : BCS .MakeLinkInvisible
|
|
||||||
|
|
||||||
SEP #$20
|
|
||||||
LDA.b #$00 : STA $4B ;make link visible
|
|
||||||
RTS
|
|
||||||
|
|
||||||
.MakeLinkInvisible
|
|
||||||
|
|
||||||
SEP #$20
|
|
||||||
LDA.b #$0C : STA $4B ;make link invisible
|
|
||||||
|
|
||||||
RTS
|
|
||||||
}
|
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
MovieEffectTimer = $7EF500 ;0x01
|
|
||||||
|
|
||||||
;these need to be the same as the next set
|
|
||||||
;used to do the HDMA
|
|
||||||
MovieEffectArray = $F900 ;0x0F
|
|
||||||
MovieEffectBank = $7E
|
|
||||||
|
|
||||||
;used to set the actual values
|
|
||||||
MovieEffect0 = $7EF900 ;0x01
|
|
||||||
MovieEffect1 = $7EF901 ;0x01
|
|
||||||
MovieEffect2 = $7EF902 ;0x01
|
|
||||||
MovieEffect3 = $7EF903 ;0x01
|
|
||||||
MovieEffect4 = $7EF904 ;0x01
|
|
||||||
MovieEffect5 = $7EF905 ;0x01
|
|
||||||
MovieEffect6 = $7EF906 ;0x01
|
|
||||||
MovieEffect7 = $7EF907 ;0x01
|
|
||||||
MovieEffect8 = $7EF908 ;0x01
|
|
||||||
MovieEffect9 = $7EF909 ;0x01
|
|
||||||
MovieEffectA = $7EF90A ;0x01
|
|
||||||
MovieEffectB = $7EF90B ;0x01
|
|
||||||
MovieEffectC = $7EF90C ;0x01
|
|
||||||
MovieEffectD = $7EF90D ;0x01
|
|
||||||
MovieEffectE = $7EF90E ;0x01
|
|
||||||
|
|
||||||
SetupMovieEffect:
|
|
||||||
{
|
|
||||||
;setup HDMA RAM
|
|
||||||
;Top Dark Row
|
|
||||||
LDA.b #$01 : STA.l MovieEffect0
|
|
||||||
LDA.b #$00 : STA.l MovieEffect1
|
|
||||||
|
|
||||||
;Top Dark Row Buffer
|
|
||||||
LDA.b #$1F : STA.l MovieEffect2
|
|
||||||
LDA.b #$0F : STA.l MovieEffect3
|
|
||||||
|
|
||||||
;Middle Unaffected Area
|
|
||||||
LDA.b #$50 : STA.l MovieEffect4
|
|
||||||
LDA.b #$0F : STA.l MovieEffect5
|
|
||||||
LDA.b #$50 : STA.l MovieEffect6
|
|
||||||
LDA.b #$0F : STA.l MovieEffect7
|
|
||||||
|
|
||||||
;Bottom Drak Row Buffer
|
|
||||||
LDA.b #$1F : STA.l MovieEffect8
|
|
||||||
LDA.b #$0F : STA.l MovieEffect9
|
|
||||||
|
|
||||||
;Bottom Dark Row
|
|
||||||
LDA.b #$01 : STA.l MovieEffectA
|
|
||||||
LDA.b #$00 : STA.l MovieEffectB
|
|
||||||
|
|
||||||
;Below screen
|
|
||||||
LDA.b #$20 : STA.l MovieEffectC
|
|
||||||
LDA.b #$0F : STA.l MovieEffectD
|
|
||||||
|
|
||||||
;End
|
|
||||||
LDA.b #$00 : STA.l MovieEffectE
|
|
||||||
|
|
||||||
;start timer
|
|
||||||
LDA.b #$01 : STA.l MovieEffectTimer
|
|
||||||
|
|
||||||
RTS
|
|
||||||
}
|
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
MovieEffect:
|
|
||||||
{
|
|
||||||
REP #$20
|
|
||||||
LDX #$00 : STX $4350 ;Set the transfer mode into 1 byte to 1 register
|
|
||||||
LDX #$00 : STX $4351 ;Set register to 00 ($21 00)
|
|
||||||
|
|
||||||
LDA.w #MovieEffectArray : STA $4352 ;set address of the hdma table
|
|
||||||
LDX.b #MovieEffectBank : STX $4354 ;set the bank of HDMA table
|
|
||||||
|
|
||||||
SEP #$20
|
|
||||||
LDA.b #$20 : STA $9B ;Do the HDMA instead of $420C
|
|
||||||
|
|
||||||
; LDA $9B : ORA #$20 : STA $9B
|
|
||||||
; LDA.b #$02 : STA $13 ;controls the brightness of the screen
|
|
||||||
|
|
||||||
RTS
|
|
||||||
|
|
||||||
HDMATable: ;values cannot go above 80 or it will read as continuous mode
|
|
||||||
db $20, $00 ;for $20 line set screen brightness to 0
|
|
||||||
db $50, $0F ;for $A0 line set screen brightness to 15 full
|
|
||||||
db $50, $0F ;for $A0 line set screen brightness to 15 full
|
|
||||||
db $3F, $00 ;for $20 line set screen brightness to 0
|
|
||||||
db $00 ;end the HDMA
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Link_CheckNewY_ButtonPress_Long:
|
Link_CheckNewY_ButtonPress_Long:
|
||||||
{
|
{
|
||||||
BIT.b $3A : BVS .fail
|
BIT.b $3A : BVS .fail
|
||||||
@@ -495,6 +320,8 @@ Link_CheckNewY_ButtonPress_Long:
|
|||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
Link_SetupHitBox:
|
Link_SetupHitBox:
|
||||||
{
|
{
|
||||||
LDA.b #$08 : STA $02 : STA $03
|
LDA.b #$08 : STA $02 : STA $03
|
||||||
@@ -872,3 +699,180 @@ GetDistance8bit_Long:
|
|||||||
CLC : ADC $00 : STA $00 ; distance total X, Y (ABS)
|
CLC : ADC $00 : STA $00 ; distance total X, Y (ABS)
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
|
Intro_Dungeon_Main:
|
||||||
|
{
|
||||||
|
LDA $0E20 : CMP.b #$92 : BNE .not_sprite_body_boss
|
||||||
|
LDA $0E30 : BEQ .not_sprite_body_boss
|
||||||
|
LDA $1C : AND.b #$FE : STA $1C ;turn off BG2 (Body)
|
||||||
|
|
||||||
|
; free ram used to check if the sprite ran this frame, if 0, it didn't run
|
||||||
|
LDA.b SpriteRanCheck : BEQ .didNotRun
|
||||||
|
LDA $1C : ORA.b #$01 : STA $1C ;turn on BG2 (Body)
|
||||||
|
|
||||||
|
.didNotRun
|
||||||
|
|
||||||
|
STZ.b SpriteRanCheck
|
||||||
|
|
||||||
|
.not_sprite_body_boss
|
||||||
|
|
||||||
|
REP #$21 : LDA.w DungeonMainCheck : BNE .intro ;<- load that free ram you are using if it's not zero then we're doing intro thing
|
||||||
|
LDA $E2 : RTL ;return to normal intro
|
||||||
|
|
||||||
|
.intro
|
||||||
|
|
||||||
|
PLA ;Pop 2byte from stack
|
||||||
|
;skip all the BGs codes
|
||||||
|
|
||||||
|
SEP #$20
|
||||||
|
PLA ;Pop 1 byte from the stack
|
||||||
|
JSL $07F0AC ; $3F0AC IN ROM. Handle the sprites of pushed blocks.
|
||||||
|
JSL $068328 ;Sprite_Main
|
||||||
|
JSL $0DA18E ;PlayerOam_Main
|
||||||
|
JSL $0DDB75 ;HUD.RefillLogicLong
|
||||||
|
|
||||||
|
JML $0AFD0C ;FloorIndicator ; $57D0C IN ROM. Handles HUD floor indicator
|
||||||
|
}
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
|
;uses $00 as the Y coordinate and $02 as the X
|
||||||
|
MoveCamera:
|
||||||
|
{
|
||||||
|
REP #$20
|
||||||
|
|
||||||
|
;move the camera up or down until a point is reached
|
||||||
|
LDA $E8 : CMP $00 : BEQ .dontMoveY ;if equals that point, dont move y
|
||||||
|
|
||||||
|
BCS .CameraBelowPointY
|
||||||
|
;CameraAbovePoint
|
||||||
|
ADC.w #$0001 : STA $E8 : STA $E6 : STA $0122 : STA $0124 ;move the camera down by 1
|
||||||
|
BRA .dontMoveY
|
||||||
|
|
||||||
|
.CameraBelowPointY
|
||||||
|
SEC : SBC.w #$0001 : STA $E8 : STA $E6 : STA $0122 : STA $0124 ;move the camera up by 1
|
||||||
|
|
||||||
|
.dontMoveY
|
||||||
|
|
||||||
|
;move the camera right or left until a point is reached
|
||||||
|
LDA $E2 : CMP.w $02 : BEQ .dontMoveX ;if equals that point, dont move x
|
||||||
|
|
||||||
|
BCS .CameraBelowPointX ;left
|
||||||
|
;CameraAbovePoint ;right
|
||||||
|
ADC.w #$0001 : STA $E2 : STA $E0 : STA $011E : STA $0120 ;move the camera right by 1
|
||||||
|
BRA .dontMoveX
|
||||||
|
|
||||||
|
.CameraBelowPointX
|
||||||
|
SEC : SBC.w #$0001 : STA $E2 : STA $E0 : STA $011E : STA $0120 ;move the camera left by 1
|
||||||
|
|
||||||
|
.dontMoveX
|
||||||
|
|
||||||
|
;if link is outside of a certain range of the camera, make him dissapear so he doesnt appear on the other side
|
||||||
|
LDA $20 : SEC : SBC $E8 : CMP.w #$00E0 : BCS .MakeLinkInvisible
|
||||||
|
LDA $22 : SEC : SBC $E2 : CMP.w #$00E0 : BCS .MakeLinkInvisible
|
||||||
|
|
||||||
|
SEP #$20
|
||||||
|
LDA.b #$00 : STA $4B ;make link visible
|
||||||
|
RTS
|
||||||
|
|
||||||
|
.MakeLinkInvisible
|
||||||
|
|
||||||
|
SEP #$20
|
||||||
|
LDA.b #$0C : STA $4B ;make link invisible
|
||||||
|
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
|
MovieEffectTimer = $7EF500 ;0x01
|
||||||
|
|
||||||
|
;these need to be the same as the next set
|
||||||
|
;used to do the HDMA
|
||||||
|
MovieEffectArray = $F900 ;0x0F
|
||||||
|
MovieEffectBank = $7E
|
||||||
|
|
||||||
|
;used to set the actual values
|
||||||
|
MovieEffect0 = $7EF900 ;0x01
|
||||||
|
MovieEffect1 = $7EF901 ;0x01
|
||||||
|
MovieEffect2 = $7EF902 ;0x01
|
||||||
|
MovieEffect3 = $7EF903 ;0x01
|
||||||
|
MovieEffect4 = $7EF904 ;0x01
|
||||||
|
MovieEffect5 = $7EF905 ;0x01
|
||||||
|
MovieEffect6 = $7EF906 ;0x01
|
||||||
|
MovieEffect7 = $7EF907 ;0x01
|
||||||
|
MovieEffect8 = $7EF908 ;0x01
|
||||||
|
MovieEffect9 = $7EF909 ;0x01
|
||||||
|
MovieEffectA = $7EF90A ;0x01
|
||||||
|
MovieEffectB = $7EF90B ;0x01
|
||||||
|
MovieEffectC = $7EF90C ;0x01
|
||||||
|
MovieEffectD = $7EF90D ;0x01
|
||||||
|
MovieEffectE = $7EF90E ;0x01
|
||||||
|
|
||||||
|
SetupMovieEffect:
|
||||||
|
{
|
||||||
|
;setup HDMA RAM
|
||||||
|
;Top Dark Row
|
||||||
|
LDA.b #$01 : STA.l MovieEffect0
|
||||||
|
LDA.b #$00 : STA.l MovieEffect1
|
||||||
|
|
||||||
|
;Top Dark Row Buffer
|
||||||
|
LDA.b #$1F : STA.l MovieEffect2
|
||||||
|
LDA.b #$0F : STA.l MovieEffect3
|
||||||
|
|
||||||
|
;Middle Unaffected Area
|
||||||
|
LDA.b #$50 : STA.l MovieEffect4
|
||||||
|
LDA.b #$0F : STA.l MovieEffect5
|
||||||
|
LDA.b #$50 : STA.l MovieEffect6
|
||||||
|
LDA.b #$0F : STA.l MovieEffect7
|
||||||
|
|
||||||
|
;Bottom Drak Row Buffer
|
||||||
|
LDA.b #$1F : STA.l MovieEffect8
|
||||||
|
LDA.b #$0F : STA.l MovieEffect9
|
||||||
|
|
||||||
|
;Bottom Dark Row
|
||||||
|
LDA.b #$01 : STA.l MovieEffectA
|
||||||
|
LDA.b #$00 : STA.l MovieEffectB
|
||||||
|
|
||||||
|
;Below screen
|
||||||
|
LDA.b #$20 : STA.l MovieEffectC
|
||||||
|
LDA.b #$0F : STA.l MovieEffectD
|
||||||
|
|
||||||
|
;End
|
||||||
|
LDA.b #$00 : STA.l MovieEffectE
|
||||||
|
|
||||||
|
;start timer
|
||||||
|
LDA.b #$01 : STA.l MovieEffectTimer
|
||||||
|
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
|
MovieEffect:
|
||||||
|
{
|
||||||
|
REP #$20
|
||||||
|
LDX #$00 : STX $4350 ;Set the transfer mode into 1 byte to 1 register
|
||||||
|
LDX #$00 : STX $4351 ;Set register to 00 ($21 00)
|
||||||
|
|
||||||
|
LDA.w #MovieEffectArray : STA $4352 ;set address of the hdma table
|
||||||
|
LDX.b #MovieEffectBank : STX $4354 ;set the bank of HDMA table
|
||||||
|
|
||||||
|
SEP #$20
|
||||||
|
LDA.b #$20 : STA $9B ;Do the HDMA instead of $420C
|
||||||
|
|
||||||
|
; LDA $9B : ORA #$20 : STA $9B
|
||||||
|
; LDA.b #$02 : STA $13 ;controls the brightness of the screen
|
||||||
|
|
||||||
|
RTS
|
||||||
|
|
||||||
|
HDMATable: ;values cannot go above 80 or it will read as continuous mode
|
||||||
|
db $20, $00 ;for $20 line set screen brightness to 0
|
||||||
|
db $50, $0F ;for $A0 line set screen brightness to 15 full
|
||||||
|
db $50, $0F ;for $A0 line set screen brightness to 15 full
|
||||||
|
db $3F, $00 ;for $20 line set screen brightness to 0
|
||||||
|
db $00 ;end the HDMA
|
||||||
|
}
|
||||||
@@ -43,7 +43,7 @@ endmacro
|
|||||||
|
|
||||||
; Go to the action specified ID can be Hex or Decimal
|
; Go to the action specified ID can be Hex or Decimal
|
||||||
macro GotoAction(action)
|
macro GotoAction(action)
|
||||||
LDA.b #<action> : STA.w SprAction, X
|
LDA.b #<action> : STA.w SprAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
|
|
||||||
@@ -51,18 +51,18 @@ endmacro
|
|||||||
; reset to (frame_start) when reaching (frame_end)
|
; reset to (frame_start) when reaching (frame_end)
|
||||||
; This is using SprTimerB
|
; This is using SprTimerB
|
||||||
macro PlayAnimation(frame_start, frame_end, frame_wait)
|
macro PlayAnimation(frame_start, frame_end, frame_wait)
|
||||||
LDA.w SprTimerB, X : BNE +
|
LDA.w SprTimerB, X : BNE +
|
||||||
LDA.w SprFrame, X : INC : STA.w SprFrame, X : CMP.b #<frame_end>+1 : BCC .noframereset
|
LDA.w SprFrame, X : INC : STA.w SprFrame, X : CMP.b #<frame_end>+1 : BCC .noframereset
|
||||||
LDA.b #<frame_start> : STA.w SprFrame, X
|
LDA.b #<frame_start> : STA.w SprFrame, X
|
||||||
.noframereset
|
.noframereset
|
||||||
LDA.b #<frame_wait> : STA.w SprTimerB, X
|
LDA.b #<frame_wait> : STA.w SprTimerB, X
|
||||||
+
|
+
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro StartOnFrame(frame)
|
macro StartOnFrame(frame)
|
||||||
LDA.w SprFrame, x : CMP.b #<frame> : BCS +
|
LDA.w SprFrame, x : CMP.b #<frame> : BCS +
|
||||||
LDA.b #<frame> : STA.w SprFrame, x
|
LDA.b #<frame> : STA.w SprFrame, x
|
||||||
+
|
+
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
|
|
||||||
@@ -76,143 +76,143 @@ macro ShowSolicitedMessage(message_id)
|
|||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro ShowMessageOnContact(message_id)
|
macro ShowMessageOnContact(message_id)
|
||||||
LDY.b #(<message_id>)>>8
|
LDY.b #(<message_id>)>>8
|
||||||
LDA.b #<message_id>
|
LDA.b #<message_id>
|
||||||
JSL $05E1F0 ; Sprite_ShowMessageOnContact
|
JSL $05E1F0 ; Sprite_ShowMessageOnContact
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Show message no matter what (should not be used without code condition)
|
; Show message no matter what (should not be used without code condition)
|
||||||
macro ShowUnconditionalMessage(message_id)
|
macro ShowUnconditionalMessage(message_id)
|
||||||
LDY.b #(<message_id>)>>8
|
LDY.b #(<message_id>)>>8
|
||||||
LDA.b #<message_id>
|
LDA.b #<message_id>
|
||||||
JSL Sprite_ShowMessageUnconditional
|
JSL Sprite_ShowMessageUnconditional
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Make the sprite move towards the player at a speed of (speed)
|
; Make the sprite move towards the player at a speed of (speed)
|
||||||
macro MoveTowardPlayer(speed)
|
macro MoveTowardPlayer(speed)
|
||||||
LDA.b #<speed>
|
LDA.b #<speed>
|
||||||
JSL Sprite_ApplySpeedTowardsPlayer
|
JSL Sprite_ApplySpeedTowardsPlayer
|
||||||
JSL Sprite_MoveLong
|
JSL Sprite_MoveLong
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Prevent the player from passing through sprite hitbox
|
; Prevent the player from passing through sprite hitbox
|
||||||
macro PlayerCantPassThrough()
|
macro PlayerCantPassThrough()
|
||||||
JSL Sprite_PlayerCantPassThrough
|
JSL Sprite_PlayerCantPassThrough
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Do damage to player on contact if sprite is on same layer as player
|
; Do damage to player on contact if sprite is on same layer as player
|
||||||
macro DoDamageToPlayerSameLayerOnContact()
|
macro DoDamageToPlayerSameLayerOnContact()
|
||||||
JSL Sprite_CheckDamageToPlayerSameLayer
|
JSL Sprite_CheckDamageToPlayerSameLayer
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Set harmless flag, 0 = harmful, 1 = harmless
|
; Set harmless flag, 0 = harmful, 1 = harmless
|
||||||
macro SetHarmless(value)
|
macro SetHarmless(value)
|
||||||
LDA.w SprNbrOAM, X
|
LDA.w SprNbrOAM, X
|
||||||
AND #$7F
|
AND #$7F
|
||||||
if <value> != 0
|
if <value> != 0
|
||||||
ORA.b #(<value>)<<7
|
ORA.b #(<value>)<<7
|
||||||
endif
|
endif
|
||||||
STA.w SprNbrOAM, X
|
STA.w SprNbrOAM, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Set Room Flag (Chest 6)
|
; Set Room Flag (Chest 6)
|
||||||
; Do not use if you have more than 5 chests or a small key under a pot
|
; Do not use if you have more than 5 chests or a small key under a pot
|
||||||
; in that room unless you want it to be already opened/taken
|
; in that room unless you want it to be already opened/taken
|
||||||
macro SetRoomFlag(value)
|
macro SetRoomFlag(value)
|
||||||
if <value> != 0
|
if <value> != 0
|
||||||
LDA $0403 : ORA #$20 : STA $0403
|
LDA $0403 : ORA #$20 : STA $0403
|
||||||
else
|
else
|
||||||
LDA $0403 : AND #$DF : STA $0403
|
LDA $0403 : AND #$DF : STA $0403
|
||||||
endif
|
endif
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will prevent the player from moving or opening his menu
|
; Will prevent the player from moving or opening his menu
|
||||||
macro PreventPlayerMovement()
|
macro PreventPlayerMovement()
|
||||||
LDA #$01 : STA $02E4
|
LDA #$01 : STA $02E4
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will allow the player to move or open his menu
|
; Will allow the player to move or open his menu
|
||||||
macro AllowPlayerMovement()
|
macro AllowPlayerMovement()
|
||||||
STZ.w $02E4
|
STZ.w $02E4
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Enter 16bit mode
|
; Enter 16bit mode
|
||||||
macro Set16bitmode()
|
macro Set16bitmode()
|
||||||
REP #$30
|
REP #$30
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Enter 8bit mode
|
; Enter 8bit mode
|
||||||
macro Set8bitmode()
|
macro Set8bitmode()
|
||||||
SEP #$30
|
SEP #$30
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; This is a 16 bit will load A with current rupee count
|
; This is a 16 bit will load A with current rupee count
|
||||||
; to use with instructions CMP and BCC/BCS
|
; to use with instructions CMP and BCC/BCS
|
||||||
macro GetPlayerRupees()
|
macro GetPlayerRupees()
|
||||||
LDA $7EF360
|
LDA $7EF360
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Set the velocity Y of the sprite at (speed) value
|
; Set the velocity Y of the sprite at (speed) value
|
||||||
; this require the use of the function JSL Sprite_MoveLong
|
; this require the use of the function JSL Sprite_MoveLong
|
||||||
macro SetSpriteSpeedY(speed)
|
macro SetSpriteSpeedY(speed)
|
||||||
LDA.b #<speed> : STA.w SprYSpeed, x
|
LDA.b #<speed> : STA.w SprYSpeed, x
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Set the velocity X of the sprite at (speed) value
|
; Set the velocity X of the sprite at (speed) value
|
||||||
; this require the use of the function JSL Sprite_MoveLong
|
; this require the use of the function JSL Sprite_MoveLong
|
||||||
macro SetSpriteSpeedX(speed)
|
macro SetSpriteSpeedX(speed)
|
||||||
LDA.b #<speed> : STA.w SprXSpeed, x
|
LDA.b #<speed> : STA.w SprXSpeed, x
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will play a sound SFX 1 See Zelda_3_RAM.log for more informations
|
; Will play a sound SFX 1 See Zelda_3_RAM.log for more informations
|
||||||
macro PlaySFX1(sfxid)
|
macro PlaySFX1(sfxid)
|
||||||
LDA.b #<sfxid> : STA $012E
|
LDA.b #<sfxid> : STA $012E
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will play a sound SFX 2 See Zelda_3_RAM.log for more informations
|
; Will play a sound SFX 2 See Zelda_3_RAM.log for more informations
|
||||||
macro PlaySFX2(sfxid)
|
macro PlaySFX2(sfxid)
|
||||||
LDA.b #<sfxid> : STA $012F
|
LDA.b #<sfxid> : STA $012F
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will play a music See Zelda_3_RAM.log for more informations
|
; Will play a music See Zelda_3_RAM.log for more informations
|
||||||
macro PlayMusic(musicid)
|
macro PlayMusic(musicid)
|
||||||
LDA.b #<musicid> : STA $012C
|
LDA.b #<musicid> : STA $012C
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer A to wait (length) amount of frames
|
; Will set the timer A to wait (length) amount of frames
|
||||||
macro SetTimerA(length)
|
macro SetTimerA(length)
|
||||||
LDA.b #<length> : STA.w SprTimerA, X
|
LDA.b #<length> : STA.w SprTimerA, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer B to wait (length) amount of frames
|
; Will set the timer B to wait (length) amount of frames
|
||||||
macro SetTimerB(length)
|
macro SetTimerB(length)
|
||||||
LDA.b #<length> : STA.w SprTimerB, X
|
LDA.b #<length> : STA.w SprTimerB, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer C to wait (length) amount of frames
|
; Will set the timer C to wait (length) amount of frames
|
||||||
macro SetTimerC(length)
|
macro SetTimerC(length)
|
||||||
LDA.b #<length> : STA.w SprTimerC, X
|
LDA.b #<length> : STA.w SprTimerC, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer D to wait (length) amount of frames
|
; Will set the timer D to wait (length) amount of frames
|
||||||
macro SetTimerD(length)
|
macro SetTimerD(length)
|
||||||
LDA.b #<length> : STA.w SprTimerD, X
|
LDA.b #<length> : STA.w SprTimerD, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer E to wait (length) amount of frames
|
; Will set the timer E to wait (length) amount of frames
|
||||||
macro SetTimerE(length)
|
macro SetTimerE(length)
|
||||||
LDA.b #<length> : STA.w SprTimerE, X
|
LDA.b #<length> : STA.w SprTimerE, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
; Will set the timer F to wait (length) amount of frames
|
; Will set the timer F to wait (length) amount of frames
|
||||||
macro SetTimerF(length)
|
macro SetTimerF(length)
|
||||||
LDA.b #<length> : STA.w SprTimerF, X
|
LDA.b #<length> : STA.w SprTimerF, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro NextAction()
|
macro NextAction()
|
||||||
INC $0D80, X
|
INC $0D80, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro GetTilePos(x, y)
|
macro GetTilePos(x, y)
|
||||||
LDX.w #((<y>*$80)+(<x>*$02))
|
LDX.w #((<y>*$80)+(<x>*$02))
|
||||||
endmacro
|
endmacro
|
||||||
Reference in New Issue
Block a user