| 121 | } |
| 122 | |
| 123 | staticfn void |
| 124 | pass_three(schar bg_typ, schar fg_typ) |
| 125 | { |
| 126 | coordxy x, y; |
| 127 | short count, dr; |
| 128 | |
| 129 | for (x = 2; x <= WIDTH; x++) |
| 130 | for (y = 1; y < HEIGHT; y++) { |
| 131 | for (count = 0, dr = 0; dr < 8; dr++) |
| 132 | if (get_map(x + dirs[dr * 2], y + dirs[(dr * 2) + 1], bg_typ) |
| 133 | == fg_typ) |
| 134 | count++; |
| 135 | if (count < 3) |
| 136 | new_loc(x, y) = bg_typ; |
| 137 | else |
| 138 | new_loc(x, y) = get_map(x, y, bg_typ); |
| 139 | } |
| 140 | |
| 141 | for (x = 2; x <= WIDTH; x++) |
| 142 | for (y = 1; y < HEIGHT; y++) |
| 143 | levl[x][y].typ = new_loc(x, y); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | * use a flooding algorithm to find all locations that should |