/* This file was generated by scramble.py. */
#line 1 "src/brick.py"
#include "brick.h"
#line 2
#include "bumpmap.h"
#include "rgba.h"
#line 6
Tile * brick_create(char const * name, int bw, int bh, float red, float green, float blue) {
    int w = 128;
    int h = 128;
    Tile * tile = tile_create(name, w, h);
#line 11
    for (int y = 0; y < h; y += 1) {
        for (int x = 0; x < w; x += 1) {
            uint8_t * p = rgba_p(tile->rgba, x, y, w);
            int bx, by;
            by = y % bh;
            bx = x;
            if (y / bh % 2) {
                bx += bw / 2;
            }
#line 19
            bx %= bw;
            if (by == 0 || bx == 0) {
                rgba_color(0.7, 0.7, 0.6, p);
            }
#line 22
            else if (by == bh - 1 || bx == bw - 1) {
                rgba_color(0.3, 0.3, 0.2, p);
            }
#line 24
            else if (bx <= 2 || by <= 2 || bx >= bw - 3 || by >= bh - 3) {
                rgba_color(0.5, 0.5, 0.5, p);
            }
#line 25
            else {
#line 27
                rgba_color(red, green, blue, p);
            }
        }
    }
#line 29
    Bumpmap * bumpmap = bumpmap_create(w, h);
    bumpmap_perlin(bumpmap, 4.0, 4.0);
    bumpmap_light(bumpmap);
    bumpmap_mul_tile(bumpmap, tile, NULL, 0.25, 1);
    bumpmap_destroy(bumpmap);
#line 35
    land_image_set_rgba_data(tile->pic, tile->rgba);
    land_free(tile->rgba);
#line 38
    tile->climb = 1;
    return tile;
}
Tile * brick_orange_create(void) {
    return brick_create("brick", 64, 32, 1, 0.6, 0.2);
}
Tile * brick_white_create(void) {
    return brick_create("brick2", 128, 64, 0.9, 0.8, 0.8);
}
/* This file was generated by scramble.py. */
