diff --git a/ootw/TODO b/ootw/TODO index 6d930d09..cebe095f 100644 --- a/ootw/TODO +++ b/ootw/TODO @@ -31,6 +31,9 @@ alien guard behavior: gun behavior: + doors/walls should explode outward away from blast *unless* there is another door/wall behind it + + laser should show sparks when hits shields/walls + + shield cannot be placed if room/floor wrong + + shield collapse animation if blown up with blast + L1 - underwater there is a water-motion effect diff --git a/ootw/collision.s b/ootw/collision.s index c8386a3a..c2f010e6 100644 --- a/ootw/collision.s +++ b/ootw/collision.s @@ -6,6 +6,7 @@ ; far left limit is LEVEL_LEFT limit ; far right limit is LEVEL_RIGHT limit ; any LOCKED doors in the way also stop things + ; FIXME: only door collision if on same level recalc_walk_collision: lda RIGHT_LIMIT @@ -73,3 +74,116 @@ done_recalc_walk_right_collision: rts + + + + + + ;============================= + ;============================= + ; calc_gun_right_collision + ;============================= + ;============================= + ; far right limit is LEVEL_RIGHT + ; any LOCKED or CLOSED doors stop things + ; any shield stops things + ; our friend stops things + ; any enemies stop things + +calc_gun_right_collision: + + lda RIGHT_LIMIT + and #$7f + sta RIGHT_SHOOT_LIMIT + + lda NUM_DOORS + beq done_calc_gun_right_collision + +calc_gun_right_doors: + + + ldx #0 +calc_gun_right_loop: + + lda PHYSICIST_X + + cmp door_x,X + bcs calc_gun_right_continue ; bge + + lda door_status,X + cmp #DOOR_STATUS_LOCKED + beq calc_gun_right_door_there + cmp #DOOR_STATUS_CLOSED + bne calc_gun_right_continue + +calc_gun_right_door_there: + ; early exit + lda door_x,X + sta RIGHT_SHOOT_LIMIT + jmp done_calc_gun_right_collision + +calc_gun_right_continue: + inx + cpx NUM_DOORS + bne calc_gun_right_loop + +done_calc_gun_right_collision: + + + rts + + + + ;============================= + ;============================= + ; calc_gun_left_collision + ;============================= + ;============================= + ; far right limit is LEVEL_LEFT + ; any LOCKED or CLOSED doors stop things + ; any shield stops things + ; our friend stops things + ; any enemies stop things + +calc_gun_left_collision: + + lda LEFT_LIMIT + and #$7f + sta LEFT_SHOOT_LIMIT + + lda NUM_DOORS + beq done_calc_gun_left_collision + +calc_gun_left_doors: + + + ldx NUM_DOORS + dex +calc_gun_left_loop: + lda PHYSICIST_X + + cmp door_x,X + bcc calc_gun_left_continue ; blt + + lda door_status,X + cmp #DOOR_STATUS_LOCKED + beq calc_gun_left_door_there + cmp #DOOR_STATUS_CLOSED + bne calc_gun_left_continue + +calc_gun_left_door_there: + ; early exit + lda door_x,X + sta LEFT_SHOOT_LIMIT + jmp done_calc_gun_left_collision + +calc_gun_left_continue: + dex + bpl calc_gun_left_loop + +done_calc_gun_left_collision: + + + rts + + diff --git a/ootw/laser.s b/ootw/laser.s index d548bf06..44550283 100644 --- a/ootw/laser.s +++ b/ootw/laser.s @@ -54,6 +54,8 @@ fire_laser: laser_left: + jsr calc_gun_left_collision + ldx PHYSICIST_X dex stx laser0_end @@ -67,6 +69,8 @@ laser_left: laser_right: + jsr calc_gun_right_collision + lda PHYSICIST_X clc adc #5 @@ -153,12 +157,14 @@ still_starting_left: laser_edge_detect_left: lda laser0_end + cmp LEFT_SHOOT_LIMIT bmi disable_laser lda laser0_start + cmp LEFT_SHOOT_LIMIT bpl no_move_laser - lda #0 + lda LEFT_SHOOT_LIMIT sta laser0_start jmp no_move_laser @@ -190,14 +196,14 @@ laser_edge_detect_right: ; detect if totally off screen lda laser0_start - cmp #40 + cmp RIGHT_SHOOT_LIMIT bcs disable_laser lda laser0_end - cmp #40 + cmp RIGHT_SHOOT_LIMIT bcc no_move_laser - lda #39 + lda RIGHT_SHOOT_LIMIT sta laser0_end no_move_laser: