Is that this chunk?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| int j = 0; for (; j < dist; j++) { int xx = xt * j / 120 + 120; int yy = yt * j / 120 + 120; int xm = xx + xCam - 120; int ym = yy + yCam - 120;
if (map[(xm + ym * 1024) & (1024 * 1024 - 1)] == 0xffffff) break;
int xd = (xx - 120) * 256 / 120; int yd = (yy - 120) * 256 / 120;
int ddd = (xd * xd + yd * yd) / 256; int br = brightness[ddd] * brr / 255;
if (ddd < 16) { int tmp = 128 * (16 - ddd) / 16; br = br + tmp * (255 - br) / 255; }
lightmap[xx + yy * 240] = br; } |
Whew. That source is some seriously dense old-school coding. You packed every bit of code you could into that 4K.... you da man....

Yeah, that looks like the line tracing. The loop outside that is where it find the target pixels (xt, yt).
doy ou know of any tutorials or is the one you plan ot write gunna be the only one

Look for articles on Roguelike Line of Sight. Most of them describe the broken raycasting method, but it might work.
There are MUUUCH more efficient ways to do shadowcasting based on geometry if you store it as line data instead of a bitmap. Going per pixel only really works for very low resolutions.