sa: ending: draw portals

This commit is contained in:
Vince Weaver 2018-06-04 23:35:18 -04:00
parent c2962fe164
commit 2b4fba85aa
2 changed files with 216 additions and 9 deletions

View File

@ -17,7 +17,10 @@ GO EQU $0D ; orange portal
GXL EQU $0E
GXH EQU $0F
GY EQU $10
PR EQU $11
SXH EQU $12
SXL EQU $13
SY EQU $14
HGR_SHAPE EQU $1A
HGR_SHAPEH EQU $1B
@ -62,6 +65,9 @@ ending:
lda #0
sta JO ; jam out
lda #1
sta PR ; portals horizontal
;==========================
; Setup Graphics
@ -108,6 +114,9 @@ ending:
jsr XDRAW1
;============
; Draw blue core
;============
lda #150
sta KXL
@ -118,6 +127,35 @@ ending:
jsr draw_core
;============================
; Start with blue portal out
;============================
lda #0
sta BO
lda #0
sta SXH
lda #45
sta SXL
lda #100
sta SY
jsr draw_blue_no_sound
;============================
; Start with orange portal out
;============================
lda #0
sta GO
lda #0
sta SXH
lda #119
sta SXL
lda #115
sta SY
jsr draw_orange_no_sound
game_loop:
;===================
; Physics Engine
@ -243,6 +281,15 @@ collide_object:
lda #128
jsr WAIT
;===============================
; Draw Objects
;===============================
jmp game_loop
@ -302,24 +349,182 @@ draw_core:
rts
;==============================
; Draw Blue Portal
;==============================
draw_blue:
; 6002 POKE 768,143:POKE 769,40:CALL 770
lda #143
sta SOUND1
lda #40
sta SOUND2
jsr sound
draw_blue_no_sound:
; Erase old
lda PR ; 0 = vertical
bne blue_horizontal
lda #2
sta HGR_SCALE
lda #<portal_vert
sta HGR_SHAPE
lda #>portal_vert
sta HGR_SHAPE+1
jmp blue_portal_erase
blue_horizontal:
lda #1
sta HGR_SCALE
lda #<portal_horiz
sta HGR_SHAPE
lda #>portal_horiz
sta HGR_SHAPE+1
blue_portal_erase:
lda BO
beq blue_portal_draw
; 6004 SCALE=2: IF PR=1 THEN SCALE=1
; 6005 IF BO=1 THEN XDRAW 2+PR AT BX,BY
; 6010 BX=SX:BY=SY
; 6020 BO=1:XDRAW 2+PR AT BX,BY
ldy BXH
ldx BXL
lda BY
jsr HPOSN
lda #0 ; rotation
jsr XDRAW1
blue_portal_draw:
lda SXH
sta BXH
lda SXL
sta BXL
lda SY
sta BY
lda #1
sta BO
ldy BXH
ldx BXL
lda BY
jsr HPOSN
lda #0 ; rotation
jsr XDRAW1
; IF BO=1 AND GO=1 AND L=1 THEN GOTO 7000
rts
;=============================
; Draw Orange Portal
;=============================
draw_orange:
; POKE 768,72:POKE 769,40:CALL 770
lda #72
sta SOUND1
lda #40
sta SOUND2
jsr sound
draw_orange_no_sound:
; Erase old
lda PR ; 0 = vertical
bne orange_horizontal
lda #2
sta HGR_SCALE
lda #<portal_vert
sta HGR_SHAPE
lda #>portal_vert
sta HGR_SHAPE+1
jmp orange_portal_erase
orange_horizontal:
lda #1
sta HGR_SCALE
lda #<portal_horiz
sta HGR_SHAPE
lda #>portal_horiz
sta HGR_SHAPE+1
orange_portal_erase:
lda GO
beq orange_portal_draw
;6104 SCALE=2: IF PR=1 THEN SCALE=1
;6105 IF GO=1 THEN XDRAW 2+PR AT GX,GY
;6110 GX=SX+1:GY=SY
;6120 GO=1:XDRAW 2+PR AT GX,GY
ldy GXH
ldx GXL
lda GY
jsr HPOSN
lda #0 ; rotation
jsr XDRAW1
orange_portal_draw:
lda SXH
sta GXH
ldx SXL
inx
stx GXL ; FIXME: overflow
lda SY
sta GY
lda #1
sta GO
ldy GXH
ldx GXL
lda GY
jsr HPOSN
lda #0 ; rotation
jsr XDRAW1
; IF BO=1 AND GO=1 AND L=1 THEN GOTO 7000
rts
;=====================================
; Draw Explosion
;=====================================
explosion:
; HCOLOR=5
ldx #5
lda COLORTBL,X ; get color pattern from table
sta HGR_COLOR
;4010 FOR X=0 TO 278 STEP 5:HPLOT X,0 TO 120,85:V=PEEK(-16336):NEXT X
lda #0
sta X1

View File

@ -54,6 +54,7 @@
; UP NLT UP UP UP NLT UP UP UP
; STOP
portal_vert:
.byte $1b,$24,$0c,$24,$0c,$15,$36,$0e,$36, $36,$1e,$36,$1e,$1c,$24,$1c,$24
.byte $04,$00
@ -72,6 +73,7 @@
; RT NRT RT NRT RT
; STOP
portal_horiz:
.byte $52,$0d,$0d,$0d,$6c,$24,$1f,$fc, $1f,$1f,$1f,$1f,$1f,$fe,$36,$0d
.byte $6e,$0d,$05,$00