static Hit WPN_ShotWallCollision(Shot& shot, const Level& level) { const Rectangle box = shot.getCollisionRect(); Int32 up = Int32(box.right.y); Int32 down = Int32(box.left.y); Int32 left = Int32(box.left.x); Int32 right = Int32(box.right.x); bool hitsWall = level.isWall(left, up, true) || level.isWall(left, down, true) || level.isWall(right, up, true) || level.isWall(right, down, true); return { hitsWall, nullptr }; }
static Hit WPN_ShotPlayerCollision(Shot& shot, std::vector<Player>& players) { const Rectangle shotBox = shot.getCollisionRect(); for (Player& player : players) { if (!player.isInGame() || player.getBonus() == D6_BONUS_INVIS || player.is(shot.getPlayer())) { continue; } if (Collision::rectangles(player.getCollisionRect(), shotBox)) { return {true, &player}; } } return { false, nullptr }; }