- // bullet hole
- for (i = 0;i < 8;i++)
- {
- float p[32][32];
- fractalnoise(&noise1[0][0], 64, 8);
- for (y = 0;y < 32;y++)
- for (x = 0;x < 32;x++)
- p[y][x] = (noise1[y][x] / 8.0f) - 64.0f;
- for (m = 0;m < 32;m++)
- {
- int j;
- float fx, fy, f;
- fx = lhrandom(14, 18);
- fy = lhrandom(14, 18);
- do
- {
- dx = lhrandom(-1, 1);
- dy = lhrandom(-1, 1);
- f = (dx * dx + dy * dy);
- }
- while(f < 0.125f || f > 1.0f);
- f = (m + 1) / 40.0f; //lhrandom(0.0f, 1.0);
- dx *= 1.0f / 32.0f;
- dy *= 1.0f / 32.0f;
- for (j = 0;f > 0 && j < (32 * 14);j++)
- {
- y = fy;
- x = fx;
- fx += dx;
- fy += dy;
- if (x < 1 || y < 1 || x >= 31 || y >= 31)
- break;
- p[y - 1][x - 1] += f * 0.125f;
- p[y - 1][x ] += f * 0.25f;
- p[y - 1][x + 1] += f * 0.125f;
- p[y ][x - 1] += f * 0.25f;
- p[y ][x ] += f;
- p[y ][x + 1] += f * 0.25f;
- p[y + 1][x - 1] += f * 0.125f;
- p[y + 1][x ] += f * 0.25f;
- p[y + 1][x + 1] += f * 0.125f;
-// f -= (0.5f / (32 * 16));
- }
- }
- for (y = 0;y < 32;y++)
- {
- for (x = 0;x < 32;x++)
- {
- m = p[y][x];
- data[y][x][0] = data[y][x][1] = data[y][x][2] = 255;
- data[y][x][3] = (byte) bound(0, m, 255);
- }
- }
-
- setuptex(i + 8, 0, i + 16, &data[0][0][0], particletexturedata);
- setuptex(i + 8, 1, i + 16, &data[0][0][0], particletexturedata);
- }
-