Update Sprites and Items

- Add the Portal Rod item (WIP)
- Add Twinrova Boss Sprite
- Update the Minecart Sprite
- Fix the HUD magic meter draw
- Fix some Zora Mask bugs (WIP)
- General housekeeping
This commit is contained in:
scawful
2023-09-13 23:01:16 -04:00
parent 00c700c31d
commit 9e0ee96943
27 changed files with 2562 additions and 457 deletions

View File

@@ -189,7 +189,11 @@ Sprite_VillageDog_Main:
Dog_WagTailLeft:
{
%PlayAnimation(0,1, 8)
LDA $02B2 : CMP.b #$05 : BNE .not_minish
%ShowSolicitedMessage($18) : JMP .continue
.not_minish
%ShowSolicitedMessage($1B)
.continue
LDA.w SprTimerD, X : BNE +
%GotoAction(0)
+
@@ -200,7 +204,11 @@ Sprite_VillageDog_Main:
Dog_WagTailRight:
{
%PlayAnimation(11,12,8)
LDA $02B2 : CMP.b #$05 : BNE .not_minish
%ShowSolicitedMessage($18) : JMP .continue
.not_minish
%ShowSolicitedMessage($1B)
.continue
LDA.w SprTimerD, X : BNE +
%GotoAction(0)
+

View File

@@ -57,6 +57,8 @@ SprXRound = $0D70
SprCachedX = $0FD8 ; This doesn't need to be indexed with X it contains the 16bit position of the sprite
SprCachedY = $0FDA ; This doesn't need to be indexed with X it contains the 16bit position of the sprite
DungeonMainCheck = $021B ;0x01
SpriteRanCheck = $8E ;0x01
org $09AE64

View File

@@ -3,39 +3,38 @@
;=================================================================
Sprite_CheckActive:
{
; Deactivates the sprite in certain situations
; Deactivates the sprite in certain situations
LDA $0DD0, X : CMP.b #$09 : BNE .inactive
LDA $0FC1 : BNE .inactive
LDA $11 : BNE .inactive
LDA $0CAA, X : BMI .active
LDA $0F00, X : BEQ .active
LDA $0DD0, X : CMP.b #$09 : BNE .inactive
LDA $0FC1 : BNE .inactive
LDA $11 : BNE .inactive
LDA $0CAA, X : BMI .active
LDA $0F00, X : BEQ .active
.inactive
CLC
RTL
.active
SEC
RTL
.inactive
CLC
RTL
.active
SEC
RTL
}
; make the sprite move X axis
;===================================================================================================
;==========================================================
Sprite_MoveHoriz:
LDA.w $0D50,X : BEQ .no_velocity
ASL : ASL : ASL : ASL
LDA.w $0D50, X : BEQ .no_velocity
ASL : ASL : ASL : ASL
CLC : ADC.w $0D70,X : STA.w $0D70,X
LDY.b #$00
LDA.w $0D50,X
PHP : LSR : LSR : LSR : LSR : PLP
BPL ++
LDA.w $0D50, X
PHP : LSR : LSR : LSR : LSR : PLP
BPL ++
ORA.b #$F0
DEY
@@ -59,14 +58,14 @@ Sprite_Move:
; make the sprite move Y axis
;===================================================================================================
Sprite_MoveVert:
LDA.w $0D40,X : BEQ .no_velocity
ASL : ASL : ASL : ASL
LDA.w $0D40, X : BEQ .no_velocity
ASL : ASL : ASL : ASL
CLC : ADC.w $0D60,X : STA.w $0D60,X
LDY.b #$00
LDA.w $0D40,X
PHP : LSR : LSR : LSR : LSR : PLP
BPL ++
LDA.w $0D40, X
PHP : LSR : LSR : LSR : LSR : PLP
BPL ++
ORA.b #$F0
DEY
@@ -82,12 +81,12 @@ Sprite_MoveVert:
;===================================================================================================
Sprite_MoveZ:
Sprite_MoveAltitude:
LDA.w $0F80,X : ASL : ASL : ASL : ASL
LDA.w $0F80, X : ASL : ASL : ASL : ASL
CLC : ADC.w $0F90,X : STA.w $0F90,X
LDA.w $0F80,X : PHP
LSR : LSR : LSR : LSR
PLP : BPL .positive
LDA.w $0F80, X : PHP
LSR : LSR : LSR : LSR
PLP : BPL .positive
ORA.b #$F0
@@ -107,11 +106,11 @@ Sprite_BounceTowardPlayer:
DEC.w $0F80,X : DEC.w $0F80,X
LDA.w $0F70,X : BPL .aloft
LDA.w $0F70, X : BPL .aloft
STZ.w $0F70,X
STZ.w $0F70, X
LDA.b $08 : STA.w $0F80,X ; set height from 08
LDA.b $08 : STA.w $0F80, X ; set height from 08
;LDA.b $09
LDA.b #$20
@@ -121,7 +120,7 @@ Sprite_BounceTowardPlayer:
LDA.b #$21 : JSL Sound_SetSfx2PanLong
.aloft
LDA.w $0F70,X : BEQ .dontmove
LDA.w $0F70, X : BEQ .dontmove
JSL Sprite_Move
@@ -129,41 +128,124 @@ Sprite_BounceTowardPlayer:
RTL
Sprite_BounceFromTileCollision:
JSL Sprite_CheckTileCollision : AND.b #$03 : BEQ ++
JSL Sprite_CheckTileCollision : AND.b #$03 : BEQ ++
LDA.w $0D50,X : EOR.b #$FF : INC : STA.w $0D50,X
INC.w $0ED0,X
INC.w $0ED0, X
++ LDA.w $0E70,X : AND.b #$0C : BEQ ++
++ LDA.w $0E70, X : AND.b #$0C : BEQ ++
LDA.w $0D40,X : EOR.b #$FF : INC : STA.w $0D40,X
INC.w $0ED0,X
INC.w $0ED0, X
++ RTL
++ RTL
; ==============================================================================
Intro_Dungeon_Main:
{
;test to see if we are at a place where a guardian is present
LDA $0E20 : CMP.b #$92 : BNE .notGuardian
LDA $0E30 : BEQ .notGuardian
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
.notGuardian
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
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
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:
{
@@ -212,9 +294,9 @@ MovieEffect:
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
LDX.b #MovieEffectBank : STX $4354 ;set the bank of HDMA table
SEP #$20
SEP #$20
LDA.b #$20 : STA $9B ;Do the HDMA instead of $420C
; LDA $9B : ORA #$20 : STA $9B
@@ -227,5 +309,5 @@ MovieEffect:
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
db $00 ;end the HDMA
}

View File

@@ -25,7 +25,7 @@ incsrc ZSpriteLib/sprite_new_table.asm
;==============================================================================
org $308000
org $2A8000
incsrc ZSpriteLib/sprite_new_functions.asm
incsrc "Sprites/farore.asm"
@@ -52,5 +52,18 @@ print "End of anti_kirby.asm ", pc
incsrc "Sprites/VillageDog/village_dog.asm"
print "End of village_dog.asm ", pc
incsrc "Sprites/Minecart/minecart.asm"
print "End of minecart.asm ", pc
incsrc "Sprites/minecart.asm"
print "End of minecart.asm ", pc
incsrc "Sprites/twinrova.asm"
incsrc "Sprites/portal_sprite.asm"
incsrc "Sprites/impa.asm"
print "End of impa.asm ", pc
incsrc "Sprites/bug_net_kid.asm"
warnpc $2B8000

56
Sprites/bug_net_kid.asm Normal file
View File

@@ -0,0 +1,56 @@
org $07F4D0
Sprite_CheckIfPlayerPreoccupied:
org $06F154
Sprite_CheckDamageToPlayer_same_layer:
org $06B962
BugNetKid_Resting:
{
JSL Sprite_CheckIfPlayerPreoccupied : BCS .dont_awaken
JSR Sprite_CheckDamageToPlayer_same_layer : BCC .dont_awaken
LDA $7EF34C
CMP.b #$01 : BCC .no_ocarina
INC $0D80, X
INC $02E4
.dont_awaken
RTS
.no_ocarina
; "... Do you have a bottle to keep a bug in? ... I see. You don't..."
LDA.b #$04
LDY.b #$01
JSL Sprite_ShowSolicitedMessageIfPlayerFacing
RTS
}
org $06B9C6
BugNetKid_GrantBugNet:
{
; Give Link the Boots
LDY.b #$4B
STZ $02E9
PHX
JSL Link_ReceiveItem
PLX
INC $0D80, X
STZ $02E4
RTS
}

5
Sprites/impa.asm Normal file
View File

@@ -0,0 +1,5 @@
; Impa Fix
org $05EBCF
LDA $7EF359 : CMP.b #$04

View File

@@ -29,8 +29,6 @@
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
!HVelocity = $06
;==============================================================================
%Set_Sprite_Properties(Sprite_Minecart_Prep, Sprite_Minecart_Long)
@@ -59,21 +57,27 @@ Sprite_Minecart_Prep:
{
PHB : PHK : PLB
; Adjust the Y position so it aligns with the tracks.
LDA $0D00, X : SEC : SBC.b #$04 : STA $0D00, X
PLB
RTL
}
;==============================================================================
!MinecartSpeed = 10
print "Minecart: ", pc
Sprite_Minecart_Main:
{
LDA.w SprAction, X ; Load the SprAction
JSL UseImplicitRegIndexedLocalJumpTable ; Goto the SprAction we are currently in
dw Minecart_Adjust
dw Minecart_Waiting
dw Minecart_Moving
dw Minecart_Moving2
dw Minecart_Adjust
dw Minecart_Waiting
dw Minecart_MoveHorizontal
dw Minecart_MoveVertical
Minecart_Adjust:
{
@@ -86,7 +90,6 @@ Sprite_Minecart_Main:
LDA #$00 : STA $0CD2, X
LDA #$00 : STA $0B6B, X ;Set interactive hitbox?
LDA #$40 : STA $0E00, X
LDA #$FF : STA $021B
INC $0D80, X
@@ -99,151 +102,173 @@ Sprite_Minecart_Main:
JSR CheckIfPlayerIsOn : BCC .not_on_platform
;Cancel Falling
JSL Player_HaltDashAttack
LDA #$00 : STA $5D : STA $5B : STA $57 : STA $5E
STA $59
LDA #$02 : STA $02F5
LDA $0FDA : SEC : SBC #$0B : STA $20
; LDA #$01 : STA DungeonMainCheck
%GotoAction(2)
RTS
.not_on_platform
LDA $0E00, X : BNE + ;wait before moving
LDA #$10 : STA $0E00, X ;Wait before checking first tile on ground!
INC $0D80, X
LDA.b #$01 : STA $041A
+
RTS
}
Minecart_Moving: ;Check for pixel X+24, Y+16 if tileid = 0D41
print pc
Minecart_MoveHorizontal:
{
JSL Sprite_Move
LDA $5D : CMP #$02 : BNE +
RTS
+
LDA $021B : CMP #$FF : BEQ .NoPlatformSetted ;if == FF then go check if we're on this platform
CPX $021B : BNE .DoNotCheckThisPlatform ;Is the platform the one we're currently standing on?
LDA #$FF : STA $021B
.NoPlatformSetted
JSR CheckIfPlayerIsOn : BCC .NotOnPlatform
STX $021B ;We are on that platform so put that in
%PlayAnimation(0,1,8)
LDA.b #-!MinecartSpeed : STA $0D50, X
JSL Sprite_MoveHoriz
; Make Link move with the minecart
LDA SprX, X : STA $22
LDY $039D ;Load Hookshot slot
LDA $0C4A, Y : CMP #$1F : BNE .noHookshot
LDA #$13 : STA $5D ;we're in hookshot mode then!!
.noHookshot
LDA $5D : CMP #$13 : BNE .dontstopPlatform ;Hookshotting!! stop the platform
;Prevent platform from moving
STZ $0D50, X : STZ $0D40, X
REP #$20
STZ $0B7E : STZ $0B7C
SEP #$20
;Prevent timers from going down as well
INC $0E10, X
INC $0E00, X
JSR DragPlayer
; Set Minecart sprite coords to look for tile attributes
LDA.w $0D00, X : STA.b $00
LDA.w $0D20, X : STA.b $01
LDA.w $0D10, X : STA.b $02
LDA.w $0D30, X : STA.b $03
LDA.b #$00 : JSL $06E87B
; Check for Top Right Corner Tile
LDA $0FA5 : CMP.b #$B1 : BNE .continue
%StartOnFrame(2)
LDA #$00 : STA $0D50, X ; Reset X Speed
INC $0D80, X
RTS
.dontstopPlatform
.continue
PHX
JSL $07E6A6 ; Link_HandleMovingAnimation_FullLongEntry
JSL $07F42F ; HandleIndoorCameraAndDoors_Long
JSL Player_HaltDashAttack
;Cancel Falling
STZ $5D : STZ $5B : STZ $57 : STZ $5E : STZ $59
LDA $0E10, X : BNE .Waiting
PLX
JSR CheckPlayerDirection
.DoNotCheckThisPlatform
.NotOnPlatform
LDA $5B : CMP #$02 : BEQ .Check5D ;IF $5B == 2 then we're falling!
BRA .skip5D
.Check5D
LDA $5D : CMP #$01 : BEQ .Falling ;Branch if we're falling!
.skip5D
LDA $0E10, X : BNE .Waiting
STZ $0D50, X : STZ $0D40, X ;Not Needed probably
LDY $0DB0, X ;Load Directtion
LDA SpeedTableX, Y : STA $0D50, X
LDA SpeedTableY, Y : STA $0D40, X
JSR Sprite_Move
JSR GetTileIDAtPosition
+
.Waiting
RTS
.Falling
;Keep Timer incremented
INC $0E10, X
INC $0E00, X
RTS
}
Minecart_Moving2: ;Check for pixel X+24, Y+16 if tileid = 0D41 ;04
Minecart_MoveVertical:
{
LDY $0DB0, X ;Load Directtion
LDA SpeedTableX, Y : STA $0D50, X
LDA SpeedTableY, Y : STA $0D40, X
%PlayAnimation(2,3,8)
LDA.b #-!MinecartSpeed : STA $0D40, X
JSR Sprite_Move
JSR GetTileIDAtPosition
JSL Sprite_MoveVert
LDA SprY, X : SEC : SBC #$04 : STA $20
LDA $0FD8 : CLC : ADC #$02 : STA $22 ; X
REP #$20
LDA $0FD8 : CLC : ADC #$0010 : STA $00
LDA $0FDA : CLC : ADC #$0008 : STA $02
SEP #$20
DEX
LDA $00 : STA $0D10, X ;X low
LDA $01 : STA $0D30, X ;X High
JSR DragPlayer
LDA $02 : STA $0D00, X ;Y low
LDA $03 : STA $0D20, X ;Y high
INX
RTS
LDA.w $0D00, X : STA.b $00
LDA.w $0D20, X : STA.b $01
LDA.w $0D10, X : STA.b $02
LDA.w $0D30, X : STA.b $03
LDA.b #$00 : JSL $06E87B
LDA $0FA5 : CMP.b #$B4 : BNE .continue
LDA $0FDA : SEC : SBC #$0B : STA $20
%GotoAction(2)
RTS
.continue
PHX
JSL $07E6A6 ; Link_HandleMovingAnimation_FullLongEntry
JSL $07F42F ; HandleIndoorCameraAndDoors_Long
JSL Player_HaltDashAttack
PLX
RTS
}
}
;Up, Right, Down, Left
SpeedTableX:
db 00, 16, 00, -16
SpeedTableY:
db -16, 00, 16, 00
SpeedTableWordX:
dw 00, 01, 00, -01
SpeedTableWordY:
dw -01, 00, 01, 00
CheckPlayerDirection:
DragPlayer:
{
REP #$20
STZ $0B7E : STZ $0B7C ; Not needed propbably
LDY.w $0DE0, X
LDA.w DragPlayer_drag_x_low, Y : CLC : ADC.w $0B7C : STA $0B7C
LDA.w DragPlayer_drag_x_high, Y : ADC.w $0B7D : STA $0B7D
LDA $0DB0, X : AND #$00FF : ASL : TAY ;Load Direction*2
LDA SpeedTableWordX, Y : STA $0B7C
LDA SpeedTableWordY, Y : STA $0B7E
LDA.w DragPlayer_drag_y_low, Y : CLC : ADC.w $0B7E : STA $0B7E
LDA.w DragPlayer_drag_y_high, Y : ADC.w $0B7F : STA $0B7F
SEP #$20
.SomariaPlatform_DragLink
REP #$20
LDA $0FD8 : SEC : SBC.w #$0008 : CMP $22 : BEQ .x_done
BPL .x_too_low
DEC $0B7C
BRA .x_done
.x_too_low
INC $0B7C
.x_done
; Changing the modifier adjusts links position in the cart
LDA $0FDA : SEC : SBC.w #$0008 : CMP $20 : BEQ .y_done
BPL .y_too_low
DEC $0B7E
BRA .y_done
.y_too_low
INC $0B7E
.y_done
SEP #$30
RTS
; .drag_x_high
; db 0, 0, -1, 0, -1
; .drag_x_low
; db 0, 0, -1, 1, -1, 1, 1
; .drag_y_low
; db -1, 1, 0, 0, -1, 1, -1, 1
; .drag_y_high
; db -1, 0, 0, 0, -1, 0, -1, 0
.drag_x_high
db 0, 0, -1, 0
.drag_x_low
db 0, 0, -1, 1
.drag_y_low
db -1, 1, 0, 0
.drag_y_high
db -1, 0, 0, 0
}
CheckIfPlayerIsOn:
{
REP #$20
LDA $22 : CLC : ADC #$0009 : CMP $0FD8 : BCC .OutsideLeft
LDA $22 : SEC : SBC #$002C : CMP $0FD8 : BCS .OutsideRight
LDA $22 : SEC : SBC #$0009 : CMP $0FD8 : BCS .OutsideRight
LDA $20 : CLC : ADC #$0012 : CMP $0FDA : BCC .OutsideUp
LDA $20 : SEC : SBC #$0016 : CMP $0FDA : BCS .OutsideDown
LDA $20 : SEC : SBC #$0012 : CMP $0FDA : BCS .OutsideDown
SEP #$21
RTS ;Return with carry setted

431
Sprites/portal_sprite.asm Normal file
View File

@@ -0,0 +1,431 @@
; =========================================================
; Portal Sprite
; =========================================================
!SPRID = $B6 ; The sprite ID you are overwriting (HEX)
!NbrTiles = 01 ; Number of tiles used in a frame
!Harmless = 00 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless
!HVelocity = 00 ; Is your sprite going super fast? put 01 if it is
!Health = 00 ; Number of Health the sprite have
!Damage = 00 ; (08 is a whole heart), 04 is half heart
!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
!Palette = 00 ; Unused in this Portal (can be 0 to 7)
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 01 ; 01 = your sprite continue to live offscreen
!Statis = 00 ; 00 = is sprite is alive?, (kill all enemies room)
!CollisionLayer = 00 ; 01 = will check both layer for collision
!CanFall = 00 ; 01 sprite can fall in hole, 01 = can't fall
!DeflectArrow = 00 ; 01 = deflect arrows
!WaterSprite = 00 ; 01 = can only walk shallow water
!Blockable = 00 ; 01 = can be blocked by link's shield?
!Prize = 00 ; 00-15 = the prize pack the sprite will drop from
!Sound = 00 ; 01 = Play different sound when taking damage
!Interaction = 00 ; ?? No documentation
!Statue = 00 ; 01 = Sprite is statue
!DeflectProjectiles = 00 ; 01 = Sprite will deflect ALL projectiles
!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_Portal_Prep, Sprite_Portal_Long)
; =========================================================
; Long Sprite Code
; =========================================================
Sprite_Portal_Long:
{
PHB : PHK : PLB
JSR Sprite_Portal_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_Portal_Main ; Call the main sprite code
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
}
; =========================================================
; Sprite Initialization code
; =========================================================
Sprite_Portal_Prep:
{
PHB : PHK : PLB
; Persist outside of camera
LDA SprHitbox, X : AND.b #$20 : STA SprHitbox, X
PLB
RTL
}
; =========================================================
; FREE RAM: 0x08
BluePortal_X = $7E06F8
BluePortal_Y = $7E06F9
OrangePortal_X = $7E06FA
OrangePortal_Y = $7E06FB
BlueActive = $7E06FC
OrangeActive = $7E06FD
; OrangePortal_Y_Low = $7E06FE
; OrangePortal_Y_High = $7E06FF
OrangeSpriteIndex = $7E0633
BlueSpriteIndex = $7E0632
; =========================================================
; Main Sprite Code
; =========================================================
Sprite_Portal_Main:
{
LDA.w SprAction, X
JSL UseImplicitRegIndexedLocalJumpTable
dw StateHandler
dw BluePortal
dw OrangePortal
dw BluePortal_WarpDungeon
dw OrangePortal_WarpDungeon
dw BluePortal_WarpOverworld
dw OrangePortal_WarpOverworld
StateHandler:
{
JSR CheckForDismissPortal
LDA $7E0FA6 : BNE .BluePortal
LDA #$01 : STA $0307
TXA : STA OrangeSpriteIndex
LDA $0D00, X : STA OrangePortal_X
LDA $0D10, X : STA OrangePortal_Y
%GotoAction(2)
RTS
.BluePortal
LDA #$02 : STA $0307
TXA : STA BlueSpriteIndex
LDA $0D00, X : STA BluePortal_X
LDA $0D10, X : STA BluePortal_Y
%GotoAction(1)
RTS
}
BluePortal:
{
%StartOnFrame(0)
%PlayAnimation(0,1,8)
LDA $11 : CMP.b #$2A : BNE .not_warped_yet
STZ $11
.not_warped_yet
CLC
LDA SprTimerD, X : BNE .NoOverlap
JSR Link_SetupHitBox
JSL $0683EA ; Sprite_SetupHitbox_long
JSL CheckIfHitBoxesOverlap : BCC .NoOverlap
CLC
LDA $1B : BEQ .outdoors
%GotoAction(3) ; BluePortal_WarpDungeon
.NoOverlap
RTS
.outdoors
%GotoAction(5) ; BluePortal_WarpOverworld
RTS
}
OrangePortal:
{
%StartOnFrame(2)
%PlayAnimation(2,3,8)
LDA $11 : CMP.b #$2A : BNE .not_warped_yet
STZ $11
.not_warped_yet
CLC
LDA SprTimerD, X : BNE .NoOverlap
JSR Link_SetupHitBox
JSL $0683EA ; Sprite_SetupHitbox_long
JSL CheckIfHitBoxesOverlap : BCC .NoOverlap
CLC
; JSL $01FF28 ; Player_CacheStatePriorToHandler
LDA $1B : BEQ .outdoors
%GotoAction(4) ; OrangePortal_WarpDungeon
.NoOverlap
RTS
.outdoors
%GotoAction(6) ; OrangePortal_WarpOverworld
RTS
}
BluePortal_WarpDungeon:
{
LDA $7EC184 : STA $20
LDA $7EC186 : STA $22
LDA $7EC188 : STA $0600
LDA $7EC18A : STA $0604
LDA $7EC18C : STA $0608
LDA $7EC18E : STA $060C
; LDA $7EC190 : STA $0610
; LDA $7EC192 : STA $0612
; LDA $7EC194 : STA $0614
; LDA $7EC196 : STA $0616
PHX
LDA OrangeSpriteIndex : TAX
LDA #$40 : STA SprTimerD, X
LDA $0D00, X : STA $7EC184
STA BluePortal_Y
LDA $0D10, X : STA $7EC186
STA BluePortal_X
PLX
LDA #$14 : STA $11
%GotoAction(1) ; Return to BluePortal
RTS
}
OrangePortal_WarpDungeon:
{
LDA $7EC184 : STA $20
LDA $7EC186 : STA $22
; Camera Scroll Boundaries
LDA $7EC188 : STA $0600 ; Small Room North
LDA $7EC18A : STA $0604 ; Small Room South
LDA $7EC18C : STA $0608 ; Small Room West
LDA $7EC18E : STA $060C ; Small Room South
; LDA $7EC190 : STA $0610
; LDA $7EC192 : STA $0612
; LDA $7EC194 : STA $0614
; LDA $7EC196 : STA $0616
PHX
LDA BlueSpriteIndex : TAX
LDA #$40 : STA SprTimerD, X
LDA $0D00, X : STA $7EC184
STA OrangePortal_Y
LDA $0D10, X : STA $7EC186
STA OrangePortal_X
PLX
LDA #$14 : STA $11
%GotoAction(2) ; Return to OrangePortal
RTS
}
BluePortal_WarpOverworld:
{
LDA OrangePortal_X : STA $20
LDA OrangePortal_Y : STA $22
LDA $7EC190 : STA $0610
LDA $7EC192 : STA $0612
LDA $7EC194 : STA $0614
LDA $7EC196 : STA $0616
JSL $07E9D3 ; ApplyLinksMovementToCamera
PHX ; Infinite loop prevention protocol
LDA OrangeSpriteIndex : TAX
LDA #$40 : STA SprTimerD, X
PLX
LDA #$01 : STA $5D
;LDA #$2A : STA $11
%GotoAction(1) ; Return to BluePortal
RTS
}
OrangePortal_WarpOverworld:
{
LDA BluePortal_X : STA $20
LDA BluePortal_Y : STA $22
LDA $7EC190 : STA $0610
LDA $7EC192 : STA $0612
LDA $7EC194 : STA $0614
LDA $7EC196 : STA $0616
JSL $07E9D3 ; ApplyLinksMovementToCamera
PHX
LDA BlueSpriteIndex : TAX
LDA #$40 : STA SprTimerD, X
PLX
LDA #$01 : STA $5D
;LDA #$2A : STA $11
%GotoAction(2) ; Return to BluePortal
RTS
}
}
CheckForDismissPortal:
{
LDA $06FE : CMP.b #$02 : BCC .return
LDA $7E0FA6 : BEQ .DespawnOrange ; Check what portal is spawning next
PHX
LDA BlueSpriteIndex : TAX
STZ.w $0DD0, X
PLX
JMP .return
.DespawnOrange
PHX
LDA OrangeSpriteIndex : TAX
STZ.w $0DD0, X
PLX
.return
INC $06FE ; This ticker needs to be reset when transitioning rooms and maps.
RTS
}
;==========================================================
Sprite_Portal_Draw:
{
JSL Sprite_PrepOamCoord
JSL Sprite_OAM_AllocateDeferToPlayer
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
.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
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
SEP #$20
BCC .on_screen_y
LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way
STA $0E
.on_screen_y
PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore)
INY
LDA .chr, X : STA ($90), Y
INY
LDA .properties, X : STA ($90), Y
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
RTS
; Draw Data
.start_index
db $00, $01, $02, $03
.nbr_of_tiles
db 0, 0, 0, 0
.x_offsets
dw 0
dw 0
dw 0
dw 0
.y_offsets
dw 0
dw 0
dw 0
dw 0
.chr
db $EE
db $EE
db $EE
db $EE
.properties
db $34
db $74
db $32
db $72
.sizes
db $02
db $02
db $02
db $02
}
; *$37705-$3772E LOCAL
Link_SetupHitBox:
{
; *$3770A ALTERNATE ENTRY POINT
LDA.b #$08 : STA $02
STA $03
LDA $22 : CLC : ADC.b #$04 : STA $00
LDA $23 : ADC.b #$00 : STA $08
LDA $20 : ADC.b #$08 : STA $01
LDA $21 : ADC.b #$00 : STA $09
RTS
}

733
Sprites/twinrova.asm Normal file
View File

@@ -0,0 +1,733 @@
; =========================================================
; Twinrova Boss Sprite
; =========================================================
!SPRID = $CE ; The sprite ID you are overwriting (HEX)
!NbrTiles = 06 ; Number of tiles used in a frame
!Harmless = 00 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless
!HVelocity = 00 ; Is your sprite going super fast? put 01 if it is
!Health = 00 ; Number of Health the sprite have
!Damage = 00 ; (08 is a whole heart), 04 is half heart
!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 = 01 ; 00 = don't draw shadow, 01 = draw a shadow
!Palette = 00 ; Unused in this Twinrova (can be 0 to 7)
!Hitbox = 03 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen
!Statis = 00 ; 00 = is sprite is alive?, (kill all enemies room)
!CollisionLayer = 01 ; 01 = will check both layer for collision
!CanFall = 00 ; 01 sprite can fall in hole, 01 = can't fall
!DeflectArrow = 00 ; 01 = deflect arrows
!WaterSprite = 00 ; 01 = can only walk shallow water
!Blockable = 00 ; 01 = can be blocked by link's shield?
!Prize = 00 ; 00-15 = the prize pack the sprite will drop from
!Sound = 00 ; 01 = Play different sound when taking damage
!Interaction = 00 ; ?? No documentation
!Statue = 00 ; 01 = Sprite is statue
!DeflectProjectiles = 00 ; 01 = Sprite will deflect ALL projectiles
!ImperviousArrow = 00 ; 01 = Impervious to arrows
!ImpervSwordHammer = 00 ; 01 = Impervious to sword and hammer attacks
!Boss = 01 ; 00 = normal sprite, 01 = sprite is a boss
%Set_Sprite_Properties(Sprite_Twinrova_Prep, Sprite_Twinrova_Long)
; =========================================================
Sprite_Twinrova_Long:
{
PHB : PHK : PLB
JSR Sprite_Twinrova_Draw ; Call the draw code
JSL Sprite_DrawShadow
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
JSR Sprite_Twinrova_CheckIfDead ; Check if sprite is dead
JSR Sprite_Twinrova_Main ; Call the main sprite code
.SpriteIsNotActive
PLB ; Get back the databank we stored previously
RTL ; Go back to original code
}
; =========================================================
Sprite_Twinrova_CheckIfDead:
{
LDA $0D80, X : CMP.b #$0A : BEQ .not_dead
; If health is negative, set back to zero
LDA $0E50, X : CMP.b #$44 : BCC .healthNotNegative
LDA.b #$00 : STA $0E50, X
.healthNotNegative
LDA $0E50, X : BNE .not_dead
PHX
LDA.b #$04 : STA $0DD0, X ; Kill sprite boss style
LDA.b #$0A : STA $0D80, X ; Go to Twinrova_Dead stage
PLX
.not_dead
RTS
}
; =========================================================
Sprite_Twinrova_Prep:
{
PHB : PHK : PLB
STZ $0D80, X
LDA.b #$40 : STA $0E50, X ; Health
LDA.b #$04 : STA $0CD2, X ; Bump damage type (4 hearts, green tunic)
%SetSpriteSpeedX(15)
%SetSpriteSpeedX(15)
LDA #$10 : STA $08
LDA #$10 : STA $09
LDA #$00 : STA $7EF3CC
PLB
RTL
}
!AnimSpeed = 8
macro Twinrova_Front()
%PlayAnimation(0,1,!AnimSpeed)
endmacro
macro Twinrova_Back()
%PlayAnimation(2,3,!AnimSpeed)
endmacro
macro Twinrova_Ready()
%PlayAnimation(4,6,!AnimSpeed)
endmacro
macro Twinrova_Attack()
%PlayAnimation(7,7,!AnimSpeed)
endmacro
macro Show_Koume()
%PlayAnimation(8,8,!AnimSpeed)
endmacro
macro Show_Kotake()
%PlayAnimation(9,9,!AnimSpeed)
endmacro
macro Twinrova_Hurt()
%PlayAnimation(10,11,!AnimSpeed)
endmacro
; =========================================================
; Phase 0: Blind Maiden turns into Twinrova.
;
; Phase 1: Twinrova is one entity, moving around the room
; and shooting fire and ice attacks at Link.
; Similar to the Trinexx attacks.
;
; Phase 2: Twinrova alternates between Koume (fire) and
; Kotake (ice) forms. Koume changes the arena
; to a fire arena. Similar to Ganon fight changes.
Sprite_Twinrova_Main:
{
LDA.w SprAction, X
JSL UseImplicitRegIndexedLocalJumpTable
dw Twinrova_Init ; 0x00
dw Twinrova_MoveState ; 0x01
dw Twinrova_MoveForwards ; 0x02
dw Twinrova_MoveBackwards ; 0x03
dw Twinrova_PrepareAttack ; 0x04
dw Twinrova_FireAttack ; 0x05
dw Twinrova_IceAttack ; 0x06
dw Twinrova_Hurt ; 0x07
dw Twinrova_KoumeMode ; 0x08
dw Twinrova_KotakeMode ; 0x09
dw Twinrova_Dead ; 0x0A
Twinrova_Init:
{
; %Twinrova_Front()
JSR ApplyTwinrovaGraphics
%GotoAction(01)
RTS
}
Twinrova_MoveState:
{
LDA $0E50, X : CMP.b #$20 : BCS .phase_1
; -------------------------------------------
; Phase 2
LDA SprTimerE, X : BNE .kotake
LDA #$70 : STA SprTimerD, X
%GotoAction(8) ; Koume Mode
RTS
.kotake
LDA #$70 : STA SprTimerD, X
%GotoAction(9) ; Kotake Mode
RTS
; ---------------------------------------------
.phase_1
LDA $0DA0 : BEQ .not_flashing
LDA.b #$20 : STA.w SprTimerD, X
%GotoAction(7) ; Goto Twinrova_Hurt
RTS
.not_flashing
JSL GetRandomInt : AND.b #$3F : BNE +
LDA.b #$20 : STA.w SprTimerD, X
STZ $AC
%GotoAction(4) ; Prepare Attack
RTS
+
JSL GetRandomInt : AND.b #$3F : BNE ++
LDA.b #$20 : STA.w SprTimerD, X
LDA #$01 : STA $AC
%GotoAction(4) ; Prepare Attack
RTS
++
JSL Sprite_IsBelowPlayer ; Check if sprite is below player
TYA : BNE .MoveBackwards ; If 1,
%GotoAction(2)
RTS
.MoveBackwards
%GotoAction(3)
RTS
}
Twinrova_MoveForwards:
{
%Twinrova_Front()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer
%GotoAction(1)
RTS
}
Twinrova_MoveBackwards:
{
%Twinrova_Back()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer
%GotoAction(1)
RTS
}
Twinrova_PrepareAttack:
{
%StartOnFrame(7)
%Twinrova_Attack()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
LDA $0CAA : AND.b #$03 : STA $0CAA
LDA SprTimerD, X : BNE +
LDA $0CAA : ORA.b #$03 : STA $0CAA
LDA.b #$40 : STA.w SprTimerD, X
LDA $AC : BEQ .fire
%GotoAction(6) ; Ice Attack
RTS
.fire
%GotoAction(5)
+
RTS
}
; 0x05
Twinrova_FireAttack:
{
%StartOnFrame(4)
%Twinrova_Ready()
JSR Sprite_Twinrova_FireAttack
LDA.w SprTimerD, X : BNE +
%GotoAction(1)
+
RTS
}
; 0x06
Twinrova_IceAttack:
{
%StartOnFrame(4)
%Twinrova_Ready()
JSR Sprite_Twinrova_IceAttack
LDA.w SprTimerD, X : BNE +
%GotoAction(1)
+
RTS
}
Twinrova_Hurt:
{
%StartOnFrame(10)
%Twinrova_Hurt()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
JSL Sprite_DamageFlash_Long
LDA.w SprTimerD, X : BNE +
%GotoAction(1)
+
RTS
}
Twinrova_KoumeMode:
{
%StartOnFrame(8)
%Show_Koume()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer
LDA SprTimerD, X : BNE +
%GotoAction(1)
+
RTS
}
Twinrova_KotakeMode:
{
%StartOnFrame(9)
%Show_Kotake()
PHX
JSL Sprite_CheckDamageFromPlayerLong
%DoDamageToPlayerSameLayerOnContact()
PLX
JSL Sprite_DamageFlash_Long
JSL Sprite_BounceTowardPlayer
LDA SprTimerD, X : BNE +
%GotoAction(1)
+
RTS
}
Twinrova_Dead:
{
%StartOnFrame(10)
%Twinrova_Hurt()
RTS
}
}
; =========================================================
Untitled_Garnish:
{
LDA $1A : AND.b #$03 : BNE .no_shake
JSL Sprite_IsToRightOfPlayer
LDA $0D50, X : CMP .x_speed_targets, Y : BEQ .no_shake
CLC : ADC.w $8000, Y : STA $0D50, X
.no_shake:
JSL Sprite_CheckTileCollision : BEQ .exit
JSL Sprite_BounceTowardPlayer
.exit
RTS
.x_speed_targets
db 8, -16
}
Sprite_Twinrova_FireAttack:
{
JSL Sprite_CheckTileCollision : BNE .no_collision
JSL Sprite_Move
.no_collision
JSR Sprite_Twinrova_FireAttack_AddFireGarnish
JMP Untitled_Garnish
.AddFireGarnish
INC $0E80, X : LDA $0E80, X : AND.b #$07 : BNE .return
LDA.b #$2A : JSL Sound_SetSfx2PanLong
LDA.b #$1D
; *$EBDE8 ALTERNATE ENTRY POINT
PHX : TXY
TAX : STA $00
.next_slot
LDA $7FF800, X : BEQ .free_slot
DEX : BPL .next_slot
DEC $0FF8 : BPL .use_search_index
LDA $00 : STA $0FF8
.use_search_index
LDX $0FF8
.free_slot
LDA.b #$10 : STA $7FF800, X : STA $0FB4
TYA : STA $7FF92C, X
LDA $0D10, Y : STA $7FF83C, X
LDA $0D30, Y : STA $7FF878, X
LDA $0D00, Y : CLC : ADC.b #$10 : STA $7FF81E, X
LDA $0D20, Y : ADC.b #$00 : STA $7FF85A, X
LDA.b #$7F : STA $7FF90E, X
STX $00
PLX
.return
RTS
}
AddIceGarnishV2:
{
INC $0E80, X : LDA $0E80, X : AND.b #$07 : BNE .return
LDA.b #$14 : JSL Sound_SetSfx3PanLong
LDA.b #$1D
; *$EBDE8 ALTERNATE ENTRY POINT
PHX : TXY
TAX : STA $00
.next_slot
LDA $7FF800, X : BEQ .free_slot
DEX : BPL .next_slot
DEC $0FF8 : BPL .use_search_index
LDA.b #$00 : STA $0FF8
.use_search_index
LDX $0FF8
.free_slot
LDA.b #$0C : STA $7FF800, X : STA $0FB4
TYA : STA $7FF92C, X
LDA $0D10, Y : STA $7FF83C, X
LDA $0D30, Y : STA $7FF878, X
LDA $0D00, Y : CLC : ADC.b #$10 : STA $7FF81E, X
LDA $0D20, Y : ADC.b #$00 : STA $7FF85A, X
LDA.b #$7F : STA $7FF90E, X
STX $00
PLX
.return
RTS
}
Sprite_Twinrova_IceAttack:
{
JSL Sprite_Move
JSR AddIceGarnishV2
JSR Untitled_Garnish
.return
RTS
}
; =========================================================
; Overwrite vanilla Trinexx ice garnish
; Plays like a simple ice cloud animation now.
pushpc
org $09B5DE
Garnish_PrepOamCoord:
org $09B70C
Garnish_SetOamPropsAndLargeSize:
org $09B459
Garnish_CheckPlayerCollision:
org $09B5D6
Garnish_SetOamPropsAndSmallSize:
org $09B33F
TrinexxIce_Pool:
{
.chr
db $2E
db $2E
db $2C
db $2C
.properties
db $35
db $35
db $35
db $35
}
org $09B34F
Garnish_TrinexxIce:
{
; special animation 0x0C
LDA $7FF90E, X : LSR #2 : AND.b #$03 : TAY
LDA TrinexxIce_Pool_properties, Y : STA $04
JSR Garnish_PrepOamCoord
LDA $00 : STA ($90), Y
LDA $02 : INY : STA ($90), Y
LDA $7FF90E, X : LSR #5 : PHX : TAX
LDA TrinexxIce_Pool_chr, X : INY : STA ($90), Y
LDA.b #$35 : ORA $04 : PLX
JMP Garnish_SetOamPropsAndLargeSize
}
warnpc $09B3B8
; Ice Garnish
org $0DB266+$CD
db $04
pullpc
; =========================================================
Sprite_Twinrova_Draw:
{
JSL Sprite_PrepOamCoord
JSL Sprite_OAM_AllocateDeferToPlayer
LDA $0DC0, X : CLC : ADC $0D90, X : TAY;Animation Frame
LDA .start_index, Y : STA $06
; Store Palette thing
LDA $0DA0, X : STA $08
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
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
SEP #$20
BCC .on_screen_y
LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way
STA $0E
.on_screen_y
PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore)
INY
LDA .chr, X : STA ($90), Y
INY
; Set palette flash modifier
LDA .properties, X : ORA $08 : STA ($90), Y
PHY
TYA : LSR #2 : TAY
SEP #$20 ;set A back to 8bit but not X and Y
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY
PLX : DEX : BPL .nextTile
SEP #$30
PLX
RTS
; =========================================================
.start_index
db $00, $04, $08, $0C, $10, $14, $18, $1C, $22, $26, $2A, $2E
.nbr_of_tiles
db 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3
.x_offsets
dw -8, 8, 8, -8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -16, 0, 16, -16, 0, 16
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
dw -8, 8, -8, 8
.y_offsets
dw -8, -8, 8, 8
dw -7, -7, 9, 9
dw -8, -8, 8, 8
dw -8, -8, 8, 8
dw -8, -8, 8, 8
dw -7, -7, 9, 9
dw -6, -6, 10, 10
dw -8, -8, -8, 8, 8, 8
dw -8, -8, 8, 8
dw -8, -8, 8, 8
dw -8, -8, 8, 8
dw -7, -7, 9, 9
.chr
db $00, $02, $22, $24
db $04, $06, $24, $26
db $08, $0A, $28, $2A
db $0C, $0E, $28, $2A
db $44, $46, $64, $66
db $48, $4A, $68, $6A
db $4C, $4E, $6C, $6E
db $88, $8A, $8C, $A8, $AA, $AC
db $80, $82, $A0, $A2
db $84, $86, $A4, $A6
db $40, $42, $60, $62
db $40, $42, $60, $62
.properties
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
db $39, $39, $39, $39
.sizes
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02, $02, $00
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
db $02, $02, $02, $02
}
print "TWINROVA ============ ", pc
ApplyTwinrovaGraphics:
{
PHX
REP #$20 ; A = 16, XY = 8
LDX #$80 : STX $2100 ;turn the screen off (required)
LDX #$80 : STX $2115 ; Set the video port register every time we write it increase by 1
LDA #$5000 : STA $2116 ; Destination of the DMA $5800 in vram <- this need to be divided by 2
LDA #$1801 : STA $4300 ; DMA Transfer Mode and destination register
; "001 => 2 registers write once (2 bytes: p, p+1)"
LDA.w #TwinrovaGraphics : STA $4302 ; Source address where you want gfx from ROM
LDX.b #TwinrovaGraphics>>16 : STX $4304
LDA #$2000 : STA $4305 ; size of the transfer 4 sheets of $800 each
LDX #$01 : STX $420B ; Do the DMA
LDX #$0F : STX $2100 ;turn the screen back on
SEP #$30
PLX
RTS
TwinrovaGraphics:
incbin twinrova.bin
}