From 5f4fc26b16c12c9396c189e244d4b80992bf4213 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 10 Feb 2020 12:30:21 -0500 Subject: [PATCH] ootw: c15: more trapezoid progress --- ootw/gr_trapezoid.s | 60 ++++++++++++++++++++++++++++----- ootw/ootw_c15.s | 82 +++++++++++++++++++++++++++++++++------------ 2 files changed, 112 insertions(+), 30 deletions(-) diff --git a/ootw/gr_trapezoid.s b/ootw/gr_trapezoid.s index ce653dff..63d051ee 100644 --- a/ootw/gr_trapezoid.s +++ b/ootw/gr_trapezoid.s @@ -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 diff --git a/ootw/ootw_c15.s b/ootw/ootw_c15.s index 64d611ba..155feb3b 100644 --- a/ootw/ootw_c15.s +++ b/ootw/ootw_c15.s @@ -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 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