int angle = playerAngle - 32;
for (int x=0; x<64; x++)
{
int stepX = icos(angle);
int stepY = icos(angle + 64); // sin(angle)
int px = onTheMapX;
int py = onTheMapY;
for (int y=0; y<32; y++)
{
px += stepX;
py += stepY;
int height = getFromMap(px >> 8, py >> 8);
// store height or do something with height
}
angle++;
}
ld ix,heightCalcBuffer ; where to right temporarily the sampled heights
ld iyh, sin1_highbyte
ld iyl,playerAngle - 32;
ld b,64
loopX:
ld h,0:ld l, constant_onTheMapY: ld a,(iy + 64)
exx:ld h,0:ld l, constant_onTheMapX: ld a,(iy):exx
inc iy
ld c,32
loopY:
add hl,de:ld a,h:and (voxelmapHeight-1):add a,whereVoxelMapIsHighByte ; X maybe 0 to 255, Y 0 to 31 or 63
exx:add hl,de:ld c,h:ld b,a:ld a,(bc):exx
ld (ix),a:inc ix
dec c
jr nz,loopY
dec b
jr nz,loopX
3+1+2+2 = 8
1+3+1+1+2+1 = 9
ld (bc),a:inc c = 3
20
;5+2 = 7
;1+3 = 4
28
int maxHeight = 0;
int angle = playerAngle - 32;
for (int x=0; x<64; x++)
{
int stepX = icos(angle);
int stepY = icos(angle + 64); // sin(angle)
int px = onTheMapX;
int py = onTheMapY;
*vram = &2020 + x + 31*256;
for (int y=0; y<32; y++)
{
px += stepX;
py += stepY;
int height = getFromMap(px >> 8, py >> 8) + y;
ld ix,heightCalcBuffer ; where to right temporarily the sampled heights
ld iyh, sin1_highbyte
ld iyl,playerAngle - 32;
ld b,64
loopX:
ld h,0:ld l, constant_onTheMapY: ld a,(iy + 64)
exx:ld h,0:ld l, constant_onTheMapX: ld a,(iy):exx
inc iy
ld c,32
loopY:
add hl,de:ld a,h:and (voxelmapHeight-1):add a,whereVoxelMapIsHighByte ; X maybe 0 to 255, Y 0 to 31 or 63
exx:add hl,de:ld c,h:ld b,a:ld a,(bc):exx
add a,b
loopZ:
ld (ix),a
cp maxHeight ; height - maxHeight
dec a
dec ixh
jr nc,loopZ