;############## Calcuzap by Patrick Davidson - enemy bullets ;############## Move/draw player bullets ; Calls the code specified by the bullet 'type'. The 'type', which must ; be a multiple of 3, is an index into the table of jumps for bullet code. ; Bullet routines should move the bullet and draw its image. They are ; called with HL pointing to the bullet entry, and can change all registers. process_enemy_bullets: ld hl,p_x call set_collision_check_object ld hl,enemy_bullets ld b,eb_count loop_enemy_bullets: ld a,(hl) push hl push bc call do_enemy_bullet pop bc pop hl ld de,eb_size add hl,de djnz loop_enemy_bullets ret do_enemy_bullet: #ifdef TI84CE push hl ld bc,0 ld c,a ld hl,enemy_bullet_table add hl,bc ld hl,(hl) ex (sp),hl ret #else ld (smc_do_enemy_bullet+1),a smc_do_enemy_bullet: jr point_to_enemy_bullet_code point_to_enemy_bullet_code: #endif ;############## Bullet routine table starts here enemy_bullet_table: #ifdef TI84CE .dl null_ebullet ; 0 = no bullet here .dl new_ebullet .dl normal_ebullet ; 6 .dl removed_object ; 9 .dl boss_ebullet ; 12 .dl bonus_block ; 15 .dl aimed_left ; 18 .dl aimed_right ; 21 .dl aimed_full_left ; 24 .dl aimed_full_right #else jp null_ebullet ; 0 = no bullet here jp new_ebullet jp normal_ebullet ; 6 jp removed_object ; 9 jp boss_ebullet ; 12 jp bonus_block ; 15 jp aimed_left ; 18 jp aimed_right ; 21 jp aimed_full_left ; 24 ; 27 #endif aimed_full_right: ld bc,$102 jr aimed_right_BC aimed_full_left: ld bc,$ff02 jr aimed_left_BC aimed_right: ld bc,$103 aimed_right_BC: inc hl ld a,(hl) cp 208-3 jp z,removed_object_x push hl call move_down_right jr ebullet_after_move aimed_left: ld bc,$ff03 aimed_left_BC: inc hl ld a,(hl) cp 48 jp z,removed_object_x push hl call move_down_left jr ebullet_after_move bonus_block: ld a,2 jr common_ebullet boss_ebullet: ld a,4 jr common_ebullet normal_ebullet: ld a,3 common_ebullet: inc hl ; HL -> X push hl call move_down ebullet_after_move: pop hl inc hl ld a,(hl) cp 244 ; remove bullet if Y is 244 or below jp nc,remove_bullet dec hl push hl call collision_check pop hl ret nc hit_you: push hl dec hl call removed_object pop hl inc hl inc hl #ifdef TI84CE ld de,(hl) #else ld e,(hl) inc hl ld d,(hl) ; DE = image pointer #endif dec de ld a,(de) ld hl,lives dec a jr z,collect_bonus_points dec a jr z,collect_bonus_life dec a jr z,collect_bonus_weapon dec a jr z,collect_bonus_weapon_3 ld a,(hl) or a ret z dec (hl) inc hl ld (hl),1 ld hl,p_x call erase_object_x ld de,img_enemy_explode ld (p_image),de Show_Lives: ld hl,(lives) ld h,0 bcall(_DivHLBy10) add a,'0' ld (livesm+1),a ld a,l add a,'0' ld (livesm),a ld bc,15*4*256+232 call Draw_Char ld a,(livesm+1) ld bc,16*4*256+232 jp Draw_Char collect_bonus_life: ld a,(hl) cp 99 ret z inc (hl) jr Show_Lives collect_bonus_weapon: inc a ld (p_weapon),a null_ebullet: ret collect_bonus_weapon_3: ld a,3 ld (p_weapon),a ret collect_bonus_points: ld hl,score+6 ; and increment the score ld de,score_increment+5 ld a,'9' ld (de),a inc de jp Add_6_Digits_BCD new_ebullet: ld a,6 ; set type to standard bullet ld (hl),a draw_object: inc hl ld b,(hl) ; X coordinate inc hl ld a,(hl) ; Y coordinate inc hl #ifdef TI84CE ld de,(hl) #else ld e,(hl) inc hl ld d,(hl) ; DE = image pointer #endif ld l,a jp Draw_Sprite_Packed