;============================================================== .define ActorStateOffset = 3 .define ActorAnimationStateOffset = 4 .define ActorHeightOffset = 5 .define ActorWidthOffset = 6 .define ActorMetaSpriteCounterOffset = 7 .define ActorAnimationPointerDataLOffset = 8 .define ActorAnimationPointerDataHOffset = 9 .define ActorAnimationTimerOffset = 10 .define ActorAnimationIndexOffset = 11 .define ActorYPositionLOffset = 12 .define ActorYPositionHOffset = 13 .define ActorXPositionLOffset = 14 .define ActorXPositionHOffset = 15 .define ActorYVelocityLOffset = 16 .define ActorYVelocityHOffset = 17 .define ActorXVelocityLOffset = 18 .define ActorXVelocityHOffset = 19 .define ActorActionBitFlags = 20 .define ActorDirectionOffset = 28 .define ActorJoyPadNewOffset = 29 .define ActorJoyPadOldOffset = 30 ;============================================================== ;Steve Action States ;============================================================== .define SteveWalking = 0 .define SteveJumpKick = 1 .define SteveHeadKick = 2 .define SteveSweepKick = 3 .define StevePunch = 4 ;============================================================== ;Steve Animation States ;============================================================== .define SteveAWalkRight1 = 0 .define SteveAWalkRight2 = 1 .define SteveACrouchRight = 2 .define SteveAPunchRight = 3 .define SteveAJumpKickRight = 4 .define SteveASweepKickRight = 5 .define SteveAHeadKickRight = 6 .define SteveAWalkLeft1 = 8 .define SteveAWalkLeft2 = 9 .define SteveACrouchLeft = 10 .define SteveAPunchLeft = 11 .define SteveAJumpKickLeft = 12 .define SteveASweepKickLeft = 13 .define SteveAHeadKickLeft = 14 ;============================================================== SteveStateFunctionPointerTable: .word Label863 .word SteveJumpKickFunction .word SteveHeadKickFunction .word SteveSweepKickFunction .word StevePunchFunction ;============================================================== Label863: bit 6,(ix+20) jp z,Label929 ld a,(ix+ActorJoyPadNewOffset ) bit 4,a jp nz,Do_SteveJumpKick bit 5,a jp nz,Do_SteveAttack Label877: bit 1,a ;JoypadPressed Down jp nz,Do_SteveCrouch bit 3,a ;JoypadPressedRight jp nz,+++ bit 2,a ;JoypadPressedLeft jp nz,++ ld e,SteveAWalkRight1 xor a or (ix+ActorDirection) jr z,+ ld e,SteveAWalkLeft1 +: ld (ix+ActorAnimationStateOffset),e ld hl,0 ld e,l ld d,l ret ;============================================================== ++: ld hl,SteveWalkLeftData ld bc,8 call Do_ActorAnimation set 1,(ix+20) call Label1aad ld de,0 ld hl,$ff00 ret ;============================================================== SteveWalkLeftData: .byte 2,9,8 ;============================================================== +++: ld hl,SteveWalkRightData ld bc,8 call Do_ActorAnimation set 1,(ix+20) call Label1aad ld de,0 ld hl,$0100 ret ;============================================================== SteveWalkRightData: .byte 2,1,0 ;============================================================== Do_SteveCrouch: ld e,SteveACrouchRight xor a or (ix+ActorDirection) jr z,+ ld e,SteveACrouchLeft +: ld (ix+ActorAnimationStateOffset),e ld de,0 ld l,e ld h,e ret ;============================================================== Do_SteveAttack: bit 5,(ix+ActorJoyPadOldOffset) p nz,Label877 ld a,$83 ld ($de00),a ld c,SteveHeadKick ld a,(ix+ActorJoyPadNewOffset) rrca jr c,Label8f9 inc c ;SteveSweepKick rrca jr c,Label8f9 inc c ;StevePunch Label8f9: ld (ix+ActorStateOffset),c call Do_ResetActorAnimationVariables ld l,0 ld h,a ld e,a ld d,a ret ;============================================================== Do_SteveJumpKick: bit 4,(ix+ActorJoyPadOldOffset) jp nz,Label877 ld a,$84 ld ($de00),a ;SoundFX ld (ix+ActorStateOffset),SteveJumpKick call Do_ResetActorAnimationVariables ld (ix+20),1 ld (ix+ActorYVelocityLOffset),128 ld (ix+ActorYVelocityHOffset),-5 call Label1aad ex de,hl ret ;============================================================== -: ld (ix+ActorXVelocityLOffset),l ld (ix+ActorXVelocityHOffset),h call Label1aad ex de,hl ret ;============================================================== SteveJumpKickFunction: ld c,0 bit 6,(ix+20) jp nz,Label8f9 ld e,SteveAJumpKickLeft xor a or (ix+ActorDirection) jr z,+ ld e,SteveAJumpKickRight +: ld (ix+ActorAnimationStateOffset),e ld hl,0 ld (ix+ActorJoyPadNewOffset) and %00001100 jr z,+ ld hl,$0100 bit 3,a jr nz,+ ld hl,$ff00 +: jp - ;============================================================== SteveSweepKickFunction: ld hl,SteveSweepKickRightData xor a or (ix+ActorDirectionOffset) jp z,+ ld hl,SteveSweepKickLeftData jp + ;============================================================== SteveSweepKickRightData: .byte 2,5,2 SteveSweepKickLeftData: .byte 2,13,10 ;============================================================== SteveHeadKickFunction: ld hl,SteveHeadKickRightData xor a or (ix+ActorDirectionOffset) jp z,+ ld hl,SteveHeadKickLeftData jp + ;============================================================== SteveHeadKickRightData: .byte 2,6,0 SteveHeadKickLeftData: .byte 2,14,8 ;============================================================== StevePunchFunction: ld hl,StevePunchRightData xor a or (ix+ActorDirectionOffset) jp z,+ ld hl,StevePunchLeftData jp + ;============================================================== StevePunchRightData: .byte 2,3,0 StevePunchLeftData: .byte 2,11,8 ;============================================================== +: ld bc,$ff08 call Do_ActorAnimation ld hl,0 ld e,l ld d,l ret nc ld (ix+ActorStateOffset),l ;SteveWalking jp Do_ResetActorAnimationVariables ;============================================================== Do_ActorHandler: ld c,(ix+ActorStateOffset) ld b,0 add hl,bc add hl,bc ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) ;============================================================== ;============================================================== Do_ActorAnimation: ld a,(ix+ActorAnimationTimer) or a jr z,+ dec a ld (ix+ActorAnimationTimer),a and a ret +: ld (ix+ActorAnimationTimer),c ld a,(ix+ActorAnimationIndex) cp (hl) jr nz,+ xor a or b scf ret nz +: ld e,a ld d,0 inc hl add hl,de ld a,(hl) ld (ix+ActorAnimationStateOffset),a inc e ld (ix+ActorAnimationIndex),e and a ret ;============================================================== Do_ResetActorAnimationVariables: ld (ix+ActorAnimationTimer),0 ld (ix+ActorAnimationIndex),0 ret ;============================================================== ActorAnimationStateDataPointerTable: .word SteveWalkRightMetaTile1 .word SteveWalkRightMetaTile2 .word SteveCrouchRightMetaTile .word StevePunchRightMetaTile .word SteveJumpKickRightMetaTile .word SteveSweepKickRightMetaTile .word SteveHeadKickRightMetaTile .word SteveDeadRightMetaTile ;============================================================== SteveWalkRightMetaTile1: .byte $00,$00 .byte $08 ;ActorMetaSpriteCount .byte $01,$fe,$09 ;Y,X,Tile # .byte $01,$06,$0a ;Y,X,Tile # .byte $09,$00,$0c ;Y,X,Tile # .byte $09,$08,$0b ;Y,X,Tile # .byte $11,$00,$0e ;Y,X,Tile # .byte $11,$08,$0f ;Y,X,Tile # .byte $19,$00,$10 ;Y,X,Tile # .byte $19,$08,$11 ;Y,X,Tile # ;============================================================== SteveWalkRightMetaTile2: .byte $00,$00 .byte $08 ;ActorMetaSpriteCount .byte $00,$fe,$09 ;Y,X,Tile # .byte $00,$06,$0a ;Y,X,Tile # .byte $08,$00,$0c ;Y,X,Tile # .byte $08,$08,$0b ;Y,X,Tile # .byte $10,$fe,$12 ;Y,X,Tile # .byte $10,$06,$13 ;Y,X,Tile # .byte $18,$00,$35 ;Y,X,Tile # .byte $18,$08,$36 ;Y,X,Tile # ;============================================================== SteveCrouchRightMetaTile: .byte $00,$01 .byte $09 ;ActorMetaSpriteCount .byte $08,$01,$09 .byte $08,$09,$0d .byte $08,$11,$26 .byte $10,$00,$27 .byte $10,$08,$28 .byte $10,$10,$29 .byte $18,$00,$2a .byte $18,$08,$2b .byte $18,$10,$2c ;============================================================== StevePunchRightMetaTile: .byte $00,$02 .byte $09 ;ActorMetaSpriteCount .byte $00,$00,$09 .byte $00,$08,$0d .byte $08,$01,$0c .byte $08,$08,$16 .byte $08,$10,$17 .byte $10,$00,$12 .byte $10,$08,$13 .byte $18,$00,$14 .byte $18,$08,$18 ;============================================================== SteveJumpKickRightMetaTile: .byte $00,$04 .byte $09 ;ActorMetaSpriteCount .byte $00,$ff,$09 .byte $00,$07,$0d .byte $08,$01,$19 .byte $08,$09,$1a .byte $05,$11,$22 .byte $18,$18,$1c .byte $10,$00,$24 .byte $10,$08,$25 .byte $0d,$10,$23 ;============================================================== SteveSweepKickRightMetaTile: .byte $00,$06 .byte $09 ;ActorMetaSpriteCount .byte $08,$02,$2d .byte $08,$0a,$0d .byte $10,$00,$2e .byte $10,$08,$2f .byte $10,$10,$30 .byte $18,$00,$31 .byte $18,$08,$32 .byte $18,$10,$33 .byte $18,$18,$34 ;============================================================== SteveHeadKickRightMetaTile: .byte $00,$08 .byte $0b ;ActorMetaSpriteCount .byte $00,$fe,$09 .byte $00,$06,$0d .byte $08,$00,$19 .byte $08,$08,$1a .byte $08,$10,$1b .byte $08,$18,$1c .byte $10,$00,$1d .byte $10,$08,$1e .byte $10,$10,$1f .byte $18,$00,$20 .byte $18,$08,$21 ;============================================================== SteveDeadRightMetaTile: .byte $00,$00 .byte $06 ;ActorMetaSpriteCount .byte $10,$00,$6D .byte $10,$08,$6C .byte $10,$10,$6B .byte $18,$00,$70 .byte $18,$08,$6F .byte $18,$10,$6E |
Text here
|