INNER CODE UNIT · C

Ball_HandleBulletCollision__

GalaxyShad/Zuma-Deluxe-HD · src/zuma/BallChain.c:292

static void Ball_HandleBulletCollision__(Ball* ball, HBullet bullet) {
    if (bullet == NULL) return;

    v2f_t ballPos   = Level_GetCurveCoords(ball->chain->level, (ball->pos >= 0) ? ball->pos : 0);
    v2f_t bulletPos = Bullet_GetPosition(bullet);

    if (HQC_PointDistance(ballPos.x, ballPos.y, bulletPos.x, bulletPos.y) > 24 * 2)
        return;

    if (Bullet_GetInsertionBall(bullet) == NULL) {
        v2f_t pointLeft  = Level_GetCurveCoords(ball->chain->level, ball->pos - BALL_RADIUS);
        v2f_t pointRight = Level_GetCurveCoords(ball->chain->level, ball->pos + BALL_RADIUS);

        float distanceLeft  = HQC_PointDistance(bulletPos.x, bulletPos.y, pointLeft.x, pointLeft.y);
        float distanceRight = HQC_PointDistance(bulletPos.x, bulletPos.y, pointRight.x, pointRight.y);

        Bullet_SetInsertion(bullet, ball, (distanceRight < distanceLeft));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…