source/rover.c
void rover_fire(struct Rover* rover) {
    /* index the bullet and find next one */
    struct RoverBullet* bullet = &(rover->bullets[rover->bullet_index]);
    rover->bullet_index++;
    
    /* only fire if it's not alive! */
    if (bullet->alive) {
        return;
    }

    if (rover->bullet_index >= SHIP_NUM_BULLTETS) {
        rover->bullet_index = 0;
    }

    /* place it above the rover */
    bullet->y = (rover->y >> VERT_SHIFT_AMOUNT) - 2;
    bullet->x = rover->x + 4;
    bullet->alive = 1;

    /* play the sound */
    play_sound(rovershoot_16K_mono, rovershoot_16K_mono_bytes, 16000, 'B');
}
/* have the rover fire a bullet, if it can */
have the rover fire a bullet, if it can
have the rover fire a bullet if it can
void rover_fire(struct Rover* rover) {
    struct RoverBullet* bullet = &(rover->bullets[rover->bullet_index]);
    rover->bullet_index++;
    if (bullet->alive) {
        return;
    }
    if (rover->bullet_index >= SHIP_NUM_BULLTETS) {
        rover->bullet_index = 0;
    }
    bullet->y = (rover->y >> VERT_SHIFT_AMOUNT) - 2;
    bullet->x = rover->x + 4;
    bullet->alive = 1;
    play_sound(rovershoot_16K_mono, rovershoot_16K_mono_bytes, 16000, 'B');
}
void rover_fire ( struct Rover * rover ) { struct RoverBullet * bullet = & ( rover -> bullets [ rover -> bullet_index ] ) ; rover -> bullet_index ++ ; if ( bullet -> alive ) { return ; } if ( rover -> bullet_index >= SHIP_NUM_BULLTETS ) { rover -> bullet_index = 0 ; } bullet -> y = ( rover -> y >> VERT_SHIFT_AMOUNT ) - 2 ; bullet -> x = rover -> x + 4 ; bullet -> alive = 1 ; play_sound ( rovershoot_16K_mono , rovershoot_16K_mono_bytes , 16000 , ' ' ) ; }
have the rover fire a bullet, if it can
have the rover fire a bullet if it can
/* index the bullet and find next one */ /* only fire if it's not alive! */ /* place it above the rover */ /* play the sound */