![]() |
Routines |
Prev: 31509 | Up: Map | Next: 31634 |
Check whether a bullet has hit one of the barriers, and if so nibble a bit out of the barrier. This is used by alien bullets coming down and player bullets going up. The input is the tip of the bullet, its direction isn't used.
If the barriers aren't there, or the bullet location is either above or below the barrier area, there's nothing to do. Otherwise, clear a randomly shaped set of pixels around the bullet tip, then make a click noise.
Used by the routines at move_alien_bullet and not_hit_player_bullet.
|
||||||||||||||||
bullet_barrier_hit | 31527 | LD A,(_BARRIERS_SUPPRESSED) | Return immediately if the barriers are suppressed | |||||||||||||
31530 | OR A | |||||||||||||||
31531 | RET Z | |||||||||||||||
31532 | LD (_TMP_ALIEN_BULLET_LOCATION_X),BC | Save ypos,xpos of leading tip of bullet here | ||||||||||||||
31536 | LD A,B | A is ypos | ||||||||||||||
31537 | CP 162 | Top of barriers, pixel location | ||||||||||||||
31539 | JR C,barrier_not_hit | Not got that far? Jump out | ||||||||||||||
31541 | CP 184 | Bottom of barriers, pixel location | ||||||||||||||
31543 | JR NC,barrier_not_hit | Below that? Jump out | ||||||||||||||
31545 | CALL pixel_clearbyte | Clear barrier pixel at tip of bullet. If it's already empty this pixel of the barrier has already been hit in which case the bullet keeps going | ||||||||||||||
31548 | RET Z | |||||||||||||||
Alien bullet is hitting a barrier
|
||||||||||||||||
31549 | CALL update_cycler_values | Churn the randomness of the nibbler | ||||||||||||||
31552 | LD IX,_BARRIER_NIBBLER_TABLE | Table of nibbler values | ||||||||||||||
31556 | LD A,8 | Nibble barrier 8 times | ||||||||||||||
31558 | LD (_DRAW_BARRIER_COUNT),A | Temp store for counter value | ||||||||||||||
barrier_check_loop | 31561 | LD A,(_TMP_ALIEN_BULLET_LOCATION_X) | Add a nibbler value to bullet xpos, put it in C | |||||||||||||
31564 | ADD A,(IX+0) | |||||||||||||||
31567 | LD C,A | |||||||||||||||
31568 | LD A,(_TMP_ALIEN_BULLET_LOCATION_Y) | Add a nibbler value to bullet ypos, put it in B | ||||||||||||||
31571 | ADD A,(IX+1) | |||||||||||||||
31574 | LD B,A | |||||||||||||||
31575 | INC IX | Next nibbler table entry into IX | ||||||||||||||
31577 | INC IX | |||||||||||||||
31579 | LD A,(_CYCLER_1) | Pick up cycler, rotate it, and if a one ends up in the carry bit, nibble out this barrier pixel | ||||||||||||||
31582 | RLA | |||||||||||||||
31583 | LD (_CYCLER_1),A | |||||||||||||||
31586 | CALL C,pixel_clear | |||||||||||||||
31589 | LD A,(_DRAW_BARRIER_COUNT) | Decrement counter, go back and do it again 8 times | ||||||||||||||
31592 | DEC A | |||||||||||||||
31593 | LD (_DRAW_BARRIER_COUNT),A | |||||||||||||||
31596 | JR NZ,barrier_check_loop | |||||||||||||||
Nibble 3 vertical pixels out of the barrier at, above, and below the bullet tip impact point
|
||||||||||||||||
31598 | LD BC,(_TMP_ALIEN_BULLET_LOCATION_X) | Clear barrier pixel of bullet tip | ||||||||||||||
31602 | CALL pixel_clear | |||||||||||||||
31605 | LD BC,(_TMP_ALIEN_BULLET_LOCATION_X) | Clear barrier pixel of the one below the buller tip | ||||||||||||||
31609 | INC B | |||||||||||||||
31610 | CALL pixel_clear | |||||||||||||||
31613 | LD BC,(_TMP_ALIEN_BULLET_LOCATION_X) | Clear barrier pixel of the one above the bullet tip | ||||||||||||||
31617 | DEC B | |||||||||||||||
31618 | CALL pixel_clear | |||||||||||||||
31621 | CALL sound_burbler | Sound burbler | ||||||||||||||
31624 | DEFB 4,20,4 | Little click for barrier hit sound | ||||||||||||||
31627 | DEFB 30,0 | |||||||||||||||
Sound burbler return point
|
||||||||||||||||
31629 | OR 1 | Z flag reset to tell caller barrier has been hit | ||||||||||||||
31631 | RET | |||||||||||||||
barrier_not_hit | 31632 | XOR A | A=0, Z flag set to tell caller barrier hasn't been hit | |||||||||||||
31633 | RET |
Prev: 31509 | Up: Map | Next: 31634 |