gb-tarot/15TheDevil.inc

301 lines
13 KiB
PHP

TheDevil:
db 10, "THE DEVIL "
db 10, " "
db 9, "obsession"
db 9, "greed "
db 9, "powerless"
dw .BackgroundCopyEnd - .BackgroundCopy
dw .BackgroundCopy
dw .KeyArtTilesEnd - .KeyArtTiles
dw .KeyArtTiles
dw .SpriteTilesEnd - .SpriteTiles
dw .SpriteTiles
dw .fInit
dw .fUpdate
dw .fDraw
dw .fPrintPrep
.fInit:
ld hl, CVS
ld a, 0
ld [hl+], a ; CVS+0 timer for animatinos
ld [hl+], a
ld [hl+], a ; CVS+2 frame for locks
ld [hl+], a ; CVS+3 frame for chain
ld [hl+], a ; CVS+4 index into chain
ld a, [.chains]
ld c, a
ld hl, MY_OAM + 14*4
ld a, 5
.drawSprites
inc hl ; x
inc hl ; tile id
ld [hl], a
inc hl ; attrs
inc hl ; y
dec c
jp nz, .drawSprites
ret
.fUpdate:
ld hl, CVS
call IncrementTimer
ld a, [CVS+1] ; checking the high byte of the timer
cp a, $06 ; $10 00 = 1 second
jp c, :+ ; if the timer is less than $0600, skip
; if the timer is greater or equal to $0600, reset it
ld a, 0
ld [CVS], a
ld [CVS+1], a
; increment the frame for the locks
ld b, 3
ld a, [CVS+2]
inc a
call ArrayClampLoopingB
ld [CVS+2], a
; increment the frame for the chain animation
ld hl, .chains + 1
ld a, [CVS+3]
inc a
call ArrayClampLooping
ld [CVS+3], a
:
;set index into links to zero
ld a, 0
ld [CVS+4], a
.chainLoop
; draw a link using index into links
; find the link animation we're interested in
ld de, MY_OAM + 14*4 ; zeroth link OAM entry
; this is complex so that i don't have to provide labels for individual paths.
; ld bc, .chain2 - .chain1 ; i.e., we're replacing this with a calculation.
ld a, [.chains+1] ; get the length of the first animation.
add a, a ; double that bc each point in an animation is 2 bytes.
inc a ; increment because each animation has a length prefix.
ld b, 0
ld c, a ; now bc contains the length of a chain animation.
ld hl, .chains+1 ; zeroth link
ld a, [CVS+4] ; index into links
; add bc to hl a times and also add 4 to de a times
cp a, 0
jp z, .foundLinkAnim
.lookingForLinkAnim
add hl, bc
inc de
inc de
inc de
inc de
dec a
jp nz, .lookingForLinkAnim
.foundLinkAnim
; now hl points to a chain
ld a, [CVS+3] ; index into link animation
ld b, 0
ld c, a
inc hl ; skip length of animation
add hl, bc
add hl, bc ; hl + 2*a = frame of animation
; set y,x for that llink to the animaion values
; load [hl] into [de] and [hl+1] into [de+1]
ld a, [hl]
inc hl
ld [de], a
inc de
ld a, [hl]
ld [de], a
; increment index into links
ld hl, .chains
ld a, [CVS+4]
inc a
call ArrayClampLooping
ld [CVS+4], a
; if index into links is not zero, jump back to .chainLoop
cp a, 0
jp nz, .chainLoop
.doneWithChain
ret
.fDraw: ret
.fPrintPrep: ret
.chains
db 13
db 9, 37, 31, 37, 31, 37, 31, 37, 31, 37, 31, 37, 31, 37, 31, 37, 31, 37, 31
db 9, 43, 30, 44, 30, 45, 32, 45, 33, 43, 34, 43, 35, 43, 34, 43, 32, 43, 31
db 9, 51, 32, 52, 34, 53, 36, 51, 37, 48, 38, 48, 39, 49, 37, 51, 35, 50, 34
db 9, 56, 37, 57, 39, 58, 42, 56, 42, 53, 43, 53, 45, 54, 43, 56, 41, 56, 39
db 9, 61, 43, 61, 44, 61, 46, 60, 47, 59, 48, 59, 49, 60, 49, 61, 46, 61, 44
db 9, 67, 49, 67, 50, 66, 52, 65, 51, 66, 51, 65, 52, 66, 52, 66, 51, 66, 50
db 9, 71, 54, 71, 55, 71, 55, 71, 54, 71, 53, 71, 54, 72, 54, 72, 53, 71, 54
db 9, 76, 59, 76, 59, 77, 58, 77, 57, 77, 55, 78, 55, 78, 54, 78, 55, 77, 58
db 9, 83, 61, 83, 61, 84, 59, 84, 58, 84, 57, 85, 56, 84, 56, 84, 57, 84, 59
db 9, 91, 61, 91, 61, 92, 60, 91, 58, 91, 59, 91, 57, 91, 56, 91, 58, 91, 60
db 9, 98, 60, 98, 60, 98, 59, 97, 57, 98, 58, 98, 56, 97, 56, 98, 57, 98, 59
db 9, 105, 58, 104, 57, 104, 56, 103, 55, 104, 56, 104, 55, 104, 56, 105, 57, 106, 57
db 9, 110, 52, 110, 52, 110, 52, 110, 52, 110, 52, 110, 52, 110, 52, 110, 52, 110, 52
.SpriteTiles:
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$1f,$1f,$2f,$38,$4f,$7f,$48,$78,$48,$78,$47,$7f
db $00,$00,$00,$00,$f0,$f0,$e8,$38,$e4,$fc,$24,$3c,$24,$3c,$c4,$fc
db $40,$7f,$40,$7f,$40,$7f,$40,$7f,$20,$3f,$10,$1f,$0f,$0f,$00,$00
db $04,$fc,$04,$fc,$04,$fc,$04,$fc,$08,$f8,$10,$f0,$e0,$e0,$00,$00
db $00,$00,$18,$3c,$3c,$66,$66,$42,$66,$42,$3c,$66,$18,$3c,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$0f,$0f,$10,$1f,$20,$3f,$40,$79
db $00,$00,$38,$38,$7c,$44,$fe,$92,$ee,$2a,$de,$d2,$7c,$e4,$38,$e8
db $80,$f0,$80,$e0,$80,$e0,$80,$f0,$40,$79,$20,$3f,$10,$1f,$0f,$0f
db $10,$f0,$10,$70,$10,$70,$10,$f0,$20,$e0,$40,$c0,$80,$80,$00,$00
db $00,$00,$00,$00,$0c,$0c,$3f,$33,$3f,$2c,$73,$53,$71,$51,$71,$51
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$c0,$40,$c0,$40,$c0,$40
db $39,$29,$38,$28,$38,$28,$1f,$1f,$70,$7f,$40,$7f,$40,$7f,$20,$3f
db $c0,$40,$e0,$a0,$f8,$b8,$c8,$f8,$08,$f8,$04,$fc,$04,$fc,$04,$fc
db $20,$3f,$20,$3f,$20,$3f,$20,$3f,$20,$3f,$10,$1f,$13,$1f,$1c,$1c
db $04,$fc,$04,$fc,$04,$fc,$02,$fe,$02,$fe,$0e,$fe,$f0,$f0,$00,$00
.SpriteTilesEnd:
; original export script by gabriel reis, modified by shoofle
.KeyArtTiles:
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $ff,$00,$ff,$00,$fe,$00,$ff,$00,$fa,$00,$fd,$00,$ea,$00,$f5,$00
db $a8,$00,$f4,$00,$a0,$00,$d4,$00,$80,$00,$40,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$1f,$00,$35,$0a,$05,$3a,$10,$6f
db $00,$00,$01,$03,$01,$03,$00,$03,$80,$03,$80,$03,$00,$83,$00,$83
db $00,$00,$08,$7b,$8c,$ff,$02,$ff,$10,$ff,$8b,$ff,$44,$ff,$09,$ff
db $00,$00,$40,$c0,$40,$c0,$00,$f0,$90,$f0,$f0,$f0,$a0,$f8,$58,$f8
db $a8,$00,$54,$00,$a0,$00,$50,$00,$80,$00,$40,$00,$00,$00,$00,$00
db $02,$81,$02,$81,$04,$83,$7c,$82,$3f,$43,$ff,$ff,$fc,$fe,$00,$66
db $1f,$60,$1f,$60,$0f,$70,$30,$0f,$30,$0e,$30,$0e,$28,$16,$28,$16
db $00,$c2,$00,$c2,$00,$c3,$01,$83,$04,$02,$08,$04,$04,$08,$00,$0e
db $1f,$3f,$06,$3f,$05,$9f,$83,$1f,$07,$1f,$2f,$1f,$73,$0f,$2d,$13
db $e0,$ff,$fd,$ff,$f8,$fc,$fc,$fc,$70,$f8,$f8,$fc,$fc,$fc,$f0,$f0
db $64,$02,$6c,$02,$6e,$01,$6e,$01,$77,$00,$37,$00,$33,$00,$33,$00
db $60,$1e,$40,$3e,$40,$3e,$40,$3e,$00,$fc,$00,$fc,$83,$7c,$9f,$60
db $02,$07,$00,$04,$00,$07,$01,$00,$1f,$00,$e3,$00,$83,$00,$03,$00
db $21,$1f,$00,$7f,$03,$ff,$c6,$3e,$e6,$1e,$02,$fe,$80,$7e,$f9,$07
db $f0,$f0,$f0,$f0,$f0,$f0,$30,$30,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$03,$00,$0f,$00,$3f,$00,$30,$00,$60,$00
db $00,$00,$74,$08,$f6,$08,$c1,$00,$e0,$00,$e0,$00,$39,$00,$07,$08
db $31,$00,$39,$00,$18,$00,$18,$00,$9c,$00,$9e,$00,$cf,$00,$e3,$04
db $be,$40,$f8,$00,$60,$00,$01,$00,$07,$00,$bf,$00,$fe,$01,$60,$9f
db $03,$00,$07,$00,$7f,$00,$fe,$01,$fc,$03,$9c,$63,$3e,$c1,$fe,$c1
db $fb,$07,$e3,$1f,$c3,$3f,$03,$ff,$07,$ff,$0f,$ff,$1f,$ff,$1e,$fe
db $e0,$00,$07,$c0,$0f,$c0,$0f,$40,$3f,$40,$1f,$60,$0f,$70,$0f,$70
db $07,$00,$03,$00,$f9,$00,$fc,$00,$fc,$00,$ff,$00,$3f,$c0,$1f,$e0
db $f0,$03,$f8,$01,$f8,$00,$ec,$10,$33,$0c,$1d,$02,$86,$01,$e3,$00
db $03,$ff,$1c,$fd,$71,$00,$e1,$00,$83,$00,$07,$00,$0f,$00,$1f,$00
db $3c,$c3,$fc,$03,$fc,$03,$f8,$07,$f0,$0f,$f1,$0f,$e1,$1f,$c3,$3f
db $3e,$fe,$3c,$fc,$78,$f8,$f8,$f8,$f0,$f0,$e0,$e0,$c0,$c0,$80,$80
db $0f,$70,$0f,$70,$07,$38,$07,$38,$07,$18,$07,$18,$07,$78,$07,$78
db $0f,$f0,$87,$78,$03,$fc,$21,$fe,$10,$ff,$18,$ff,$0c,$ff,$0e,$ff
db $f1,$00,$f8,$00,$fc,$00,$ff,$00,$ff,$00,$7f,$80,$3f,$c0,$0f,$f0
db $3f,$00,$7f,$00,$ff,$00,$fe,$01,$fe,$01,$fc,$03,$f9,$07,$e3,$1f
db $87,$7f,$8e,$7e,$1c,$fc,$38,$f8,$70,$f0,$e0,$e0,$c0,$c0,$80,$80
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$03,$03,$07,$07,$0e,$0f
db $03,$fc,$23,$dc,$33,$cc,$33,$cc,$f3,$0c,$f0,$0e,$68,$96,$18,$e7
db $09,$f9,$80,$70,$80,$60,$80,$60,$c0,$30,$40,$30,$c0,$38,$c0,$38
db $00,$ff,$c0,$ff,$78,$7f,$0f,$0f,$00,$00,$00,$00,$00,$00,$00,$00
db $0f,$ff,$3c,$fc,$f8,$f8,$e0,$e0,$01,$01,$0f,$0f,$3f,$3f,$fe,$ff
db $00,$00,$00,$00,$1f,$1f,$7f,$7f,$fc,$ff,$e0,$ff,$81,$fe,$03,$fc
db $00,$00,$00,$00,$f8,$f8,$fe,$fe,$07,$ff,$03,$ff,$e1,$1f,$fc,$03
db $00,$00,$01,$01,$03,$03,$02,$03,$00,$03,$80,$83,$c0,$c1,$60,$e0
db $1c,$1f,$f8,$ff,$f0,$ff,$00,$ff,$01,$fe,$63,$9c,$73,$88,$70,$88
db $30,$cf,$e0,$1f,$c0,$3f,$80,$7f,$03,$ff,$0c,$fc,$18,$f8,$20,$e0
db $00,$f8,$00,$f8,$38,$f8,$e0,$e0,$80,$80,$00,$00,$00,$00,$00,$00
db $01,$01,$03,$03,$07,$07,$0f,$0f,$1f,$1f,$3f,$3f,$3e,$3f,$7e,$7f
db $fc,$ff,$f8,$ff,$f0,$ff,$e1,$fe,$83,$fc,$07,$f8,$0f,$f0,$0f,$f0
db $1f,$e0,$3f,$c0,$7f,$80,$ff,$00,$ff,$00,$fe,$00,$f8,$00,$f1,$00
db $fc,$03,$fe,$01,$fe,$01,$ff,$00,$ff,$00,$87,$00,$83,$40,$83,$60
db $38,$f0,$18,$f1,$18,$f9,$0c,$f9,$8c,$7f,$85,$7f,$c7,$3f,$c7,$3e
db $70,$88,$70,$88,$70,$88,$70,$89,$f0,$0b,$f0,$0f,$f0,$0e,$f0,$0e
db $7c,$7f,$78,$7f,$78,$7f,$f0,$ff,$f8,$ff,$f8,$ff,$f8,$ff,$f8,$ff
db $1f,$e0,$3f,$c0,$7f,$80,$ff,$00,$ef,$1e,$e7,$1f,$f0,$0f,$fe,$01
db $e1,$00,$c1,$00,$83,$00,$07,$00,$0c,$03,$9e,$80,$f0,$e0,$08,$f0
db $03,$e0,$01,$f0,$01,$f8,$c1,$f8,$64,$f8,$26,$f8,$03,$7c,$03,$1c
db $e3,$1e,$e7,$1e,$f7,$0c,$f3,$0c,$f9,$06,$79,$06,$39,$06,$3d,$02
db $f0,$0c,$f0,$08,$f0,$08,$b0,$09,$90,$09,$90,$0b,$90,$0a,$90,$0e
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$01
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$ff,$ff,$ff,$ff
db $f8,$ff,$f0,$ff,$f0,$ff,$f0,$ff,$e0,$ff,$c0,$ff,$83,$fc,$c0,$ff
db $ff,$00,$ff,$00,$7f,$80,$3f,$c0,$03,$fc,$00,$ff,$e0,$1f,$fc,$03
db $80,$7c,$c0,$3f,$f0,$0f,$fc,$03,$ff,$00,$7f,$80,$1f,$e0,$03,$fc
db $01,$0e,$01,$06,$01,$c2,$01,$f0,$00,$f8,$c8,$30,$f8,$00,$f8,$00
db $9f,$00,$8f,$00,$c7,$00,$c0,$00,$e0,$00,$e0,$00,$70,$00,$3f,$00
db $80,$0c,$00,$08,$00,$08,$08,$00,$08,$00,$18,$00,$70,$00,$e0,$00
db $03,$03,$03,$03,$07,$07,$07,$07,$06,$07,$0e,$0f,$0c,$0f,$0c,$0f
db $f8,$ff,$c0,$ff,$07,$f8,$1f,$e0,$3f,$c0,$7f,$80,$7f,$80,$70,$80
db $de,$e1,$18,$e1,$00,$f0,$00,$78,$00,$1c,$00,$04,$20,$04,$10,$28
db $00,$fe,$00,$fe,$0c,$f2,$0f,$f0,$0f,$f0,$87,$78,$07,$78,$07,$78
db $0f,$30,$03,$0c,$03,$0c,$07,$08,$07,$18,$0f,$10,$8e,$10,$8e,$10
db $98,$00,$98,$00,$18,$00,$10,$00,$30,$00,$20,$00,$20,$00,$60,$00
db $1f,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $c0,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $0c,$0f,$0c,$0f,$06,$07,$02,$03,$00,$01,$00,$00,$00,$00,$00,$00
db $71,$82,$31,$c3,$10,$e1,$10,$e1,$30,$c1,$00,$ff,$00,$00,$00,$00
db $00,$10,$00,$90,$00,$f0,$00,$80,$00,$80,$01,$01,$00,$03,$00,$07
db $43,$3c,$43,$3c,$03,$3c,$27,$38,$c7,$f8,$0f,$f0,$0f,$f0,$3f,$c0
db $8e,$10,$8c,$10,$8c,$10,$8c,$10,$be,$3e,$bf,$3f,$82,$73,$01,$e3
db $40,$00,$40,$00,$c0,$00,$80,$40,$80,$00,$80,$00,$80,$80,$00,$80
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f,$00,$0f,$00,$07,$0c,$30
db $00,$07,$01,$0e,$03,$1c,$06,$38,$1c,$e0,$77,$80,$3c,$80,$30,$00
db $ff,$00,$cc,$00,$18,$00,$30,$00,$e0,$00,$80,$00,$00,$00,$00,$00
db $01,$e0,$01,$c0,$01,$80,$03,$c0,$02,$f0,$04,$78,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$8a,$00,$00,$00,$2a,$00,$00,$00
db $0c,$30,$24,$38,$16,$18,$08,$0f,$04,$07,$00,$00,$00,$00,$00,$00
db $30,$00,$00,$60,$00,$c0,$00,$c0,$00,$80,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$08,$00,$00,$00,$22,$00,$00,$00
db $08,$00,$00,$00,$22,$00,$00,$00,$aa,$00,$04,$00,$2a,$00,$01,$00
db $aa,$00,$00,$00,$aa,$00,$01,$00,$aa,$00,$45,$00,$aa,$00,$15,$00
db $aa,$00,$45,$00,$aa,$00,$11,$00,$aa,$00,$55,$00,$ab,$00,$55,$00
db $88,$00,$ff,$ff,$41,$63,$63,$63,$aa,$63,$36,$36,$9c,$36,$19,$1c
db $aa,$00,$ff,$ff,$ca,$61,$71,$61,$ab,$61,$35,$61,$bb,$33,$56,$33
db $aa,$00,$d5,$c0,$aa,$80,$d5,$80,$2e,$80,$55,$80,$bb,$00,$55,$00
db $ae,$00,$55,$00,$bb,$00,$55,$00,$ff,$00,$55,$00,$ff,$00,$57,$00
db $ff,$00,$55,$00,$ff,$00,$55,$00,$ff,$00,$df,$00,$ff,$00,$7f,$00
db $ae,$1c,$55,$3e,$bf,$36,$36,$63,$ef,$63,$55,$63,$ff,$ff,$55,$00
db $de,$33,$57,$12,$bf,$1e,$4d,$1e,$ff,$0c,$5d,$0c,$ff,$ff,$77,$00
db $ff,$00,$55,$00,$ff,$00,$77,$00,$ff,$00,$df,$00,$ff,$00,$7f,$00
db $ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00,$ff,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7e,$00,$c2,$01,$02,$81
.KeyArtTilesEnd:
.BackgroundCopy: ; tiles start at 26
db $1b, $1c, $7e, $1d, $1e, $1f, $20, $1a
db $21, $1a, $22, $23, $24, $25, $26, $1a
db $1a, $1a, $27, $28, $29, $2a, $2b, $1a
db $2c, $2d, $2e, $2f, $30, $31, $1a, $1a
db $32, $33, $34, $35, $36, $37, $1a, $1a
db $38, $39, $3a, $3b, $3c, $1a, $1a, $3d
db $3e, $3f, $40, $41, $42, $43, $44, $45
db $46, $47, $48, $49, $4a, $4b, $4c, $4d
db $1a, $1a, $4e, $4f, $50, $51, $52, $53
db $54, $55, $56, $57, $58, $59, $5a, $5b
db $5c, $5d, $5e, $5f, $60, $61, $62, $63
db $64, $65, $66, $67, $68, $69, $1a, $1a
db $1a, $6a, $6b, $6c, $6d, $1a, $1a, $6e
db $1a, $6f, $70, $1a, $71, $72, $73, $74
db $1a, $1a, $6e, $75, $76, $77, $78, $79
db $72, $73, $74, $7a, $7b, $7c, $7d, $7d
.BackgroundCopyEnd: