ootw: c15: more trapezoid progress

This commit is contained in:
Vince Weaver 2020-02-10 12:30:21 -05:00
parent 2892e3956d
commit 5f4fc26b16
2 changed files with 112 additions and 30 deletions

View File

@ -1,17 +1,59 @@
; Draws a filled trapezoid in the screen
; note it is blocky (even/odd Y always set) for simplicity
; color -> trapezoid_color_smc+1
; width -> trapezoid_width_smc+1
; starty = Y
; endy -> trapezoid_endy_smc+1
; startx-> trapezoid_startx_smc+1
; LEFTSLOPE, RIGHTSLOPE
; TODO: use 5.3 fixed point rather than 8.8?
; called pointing INL/INH to data structure:
; .byte LEFT_SLOPE_H,LEFT_SLOPE_L
; .byte RIGHT_SLOPE_H,RIGHT_SLOPE_L
; .byte START_X_H,START_X_L
; .byte END_X_H,END_X_L
; .byte END_Y,START_Y
; color is trapezoid_color_smc+1, usually it's going to be #$11 (red)
; 10 bytes/trapezoid? Much smaller than a say 10x5 sprite
draw_trapezoid:
; FIXME: make this a loop
ldy #0
lda (INL),Y
sta trapezoid_left_slope
iny
lda (INL),Y
sta trapezoid_left_slope+1
iny
lda (INL),Y
sta trapezoid_right_slope
iny
lda (INL),Y
sta trapezoid_right_slope+1
iny
lda (INL),Y
sta trapezoid_x_start
iny
lda (INL),Y
sta trapezoid_x_start+1
iny
lda (INL),Y
sta trapezoid_x_end
iny
lda (INL),Y
sta trapezoid_x_end+1
iny
lda (INL),Y
sta trapezoid_endy_smc+1
iny
lda (INL),Y
tay
draw_trapezoid_loop:
; clc
; lda trapezoid_x_start
lda gr_offsets,Y
sta trapezoid_draw_loop_smc+1
@ -31,7 +73,7 @@ trapezoid_draw_loop_smc:
cpx trapezoid_x_end
bne trapezoid_draw_loop
; add in 8.8 fixed point (should we make this 6.2 instead?
; add in 8.8 fixed point (should we make this 6.2 or 5.3 instead?)
clc
lda trapezoid_x_start+1
adc trapezoid_left_slope+1

View File

@ -559,31 +559,47 @@ c15_room1_foreground:
cmp #1
bne c15_draw_friend_cliff
lda #$11
sta trapezoid_color_smc+1
ldy #46
lda #36
sta trapezoid_endy_smc+1
; test shots
lda #0
sta trapezoid_x_start+1
sta trapezoid_x_end+1
lda FRAMEL
and #$0c
lsr
tay
lda #2
sta trapezoid_x_start
lda #15
sta trapezoid_x_end
lda shot_lookup,Y
sta INL
lda shot_lookup+1,Y
sta INH
lda #2
sta trapezoid_left_slope
lda #128
sta trapezoid_left_slope+1
; lda #<shot1_frame1
; sta INL
; lda #>shot1_frame1
; sta INH
lda #0
sta trapezoid_right_slope
lda #128
sta trapezoid_right_slope+1
; ldy #46
; lda #36
; sta trapezoid_endy_smc+1
; lda #0
; sta trapezoid_x_start+1
; sta trapezoid_x_end+1
; lda #2
; sta trapezoid_x_start
; lda #15
; sta trapezoid_x_end
; lda #2
; sta trapezoid_left_slope
; lda #128
; sta trapezoid_left_slope+1
; lda #0
; sta trapezoid_right_slope
; lda #128
; sta trapezoid_right_slope+1
@ -897,7 +913,31 @@ guard_laser:
.byte $1A,$1A,$1A,$11,$A1,$A1,$A1,$AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
shot_lookup:
.word shot1_frame1
.word shot1_frame2
.word shot1_frame3
.word shot1_frame3
shot1_frame1:
.byte 2,128 ; LEFT SLOPE H/L
.byte 0,128 ; RIGHT SLOPE H/L
.byte 2,0 ; STARTX H/L
.byte 15,0 ; ENDX H/L
.byte 36,46 ; ENDY/STARTY
shot1_frame2:
.byte 2,0 ; LEFT SLOPE H/L
.byte 0,$60 ; RIGHT SLOPE H/L
.byte 3,0 ; STARTX H/L
.byte 14,128 ; ENDX H/L
.byte 32,46 ; ENDY/STARTY
shot1_frame3:
.byte 2,0 ; LEFT SLOPE H/L
.byte 2,0 ; RIGHT SLOPE H/L
.byte 17,0 ; STARTX H/L
.byte 19,9 ; ENDX H/L
.byte 28,32 ; ENDY/STARTY