void actor_avoid(Actor * self) {
    int tx = self->x / tile_w;
    int ty = self->y / tile_h;
    if (land_array_count(app->actors->tilemap[tx + app->actors->w * ty] .actors) > 1) {
        actor_unplace(self);
        self->x += land_rand( - 1, 1);
        self->y += land_rand( - 1, 1);
        check_pos(self);
        actor_place(self);
    }
}
void allefant_tick(Block * super) {
    Allefant * self = (void *) super;
    float speed = 1.4;
#line 56
    if (self->waypoint == - 1) {
        find_waypoint(super);
    }
    if (self->wait > 0) {
        if (self->step != 8 && self->step != 24) {
            self->step += 1;
            self->step &= 31;
        }
#line 63
        self->wait -= 1;
#line 65
        if (self->wait == 0) {
            self->tx = game->waypoints [self->waypoint] [0];
            self->tz = game->waypoints [self->waypoint] [2];
            self->waypoint += 1;
            self->travel = 0;
#line 71
            if (self->waypoint >= game->waypoints_count) {
                self->waypoint = 0;
            }
        }
    }
#line 72
    else {
#line 76
        float x = self->tx - super->x;
        float z = self->tz - super->z;
        float d = pow(x * x + z * z, 0.5);
        if (d > 3) {
            self->ax = x / d;
            self->az = z / d;
#line 83
            float angle = atan2(self->ax, self->az) - pi / 4;
            angle = angle / (2 * pi);
            angle = (int)((angle - floor(angle)) * 8 + 0.5) & 7;
            self->want_direction = angle;
#line 88
            if (self->travel <= 0) {
                self->travel = d / speed;
            }
        }
#line 89
        else {
#line 91
            self->wait = 60 * 2;
        }
        super->dx += self->ax * speed;
        super->dz += self->az * speed;
#line 96
        self->step += 1;
        self->step &= 31;
#line 99
        self->travel -= 1;
#line 101
        if (self->travel <= 0) {
            self->wait = 60 * 4;
        }
    }
#line 104
    if (self->want_direction != self->direction) {
        self->rotstep += 1;
        if (self->rotstep >= 4) {
            self->rotstep = 0;
            int d = self->want_direction - self->direction;
#line 110
            if (d < - 4) {
#line 110
                d += 8;
            }
#line 111
            else if (d > 4) {
#line 111
                d -= 8;
            }
#line 112
            if (abs(d) == 4) {
#line 112
                self->direction += (land_rand(0, 1)) * 2 - 1;
            }
#line 113
            else if (d < 0) {
#line 113
                self->direction -= 1;
            }
#line 114
            else if (d > 0) {
#line 114
                self->direction += 1;
            }
#line 115
            self->direction &= 7;
        }
    }
#line 117
    super->frame = self->direction * 8 + self->step / 4;
    block_tick((void *) self);
}