scene.org File Archive

File download

<root>­/­parties­/­2014­/­reset.fr14­/­combined_demo_intro/voxel1k.zip

File size:
8 481 bytes (8.28K)
File date:
2024-08-01 05:45:01
Download count:
all-time: 3

Preview

  • src/ dir
  • src/compile.asm 510B
  • src/data.asm 654B
  • src/effects.asm 3.81K
  • src/graphics.asm 3.75K
  • src/main.asm 1.58K
  • src/sineprecs.asm 822B
  • src/system.asm 417B
  • src/ttt.txt 1.99K
  • voxel1k.dsk 190.25K

file_id.diz

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;

		//if (height > maxHeight)
		//{
			for (int z=maxHeight; z<height; z++)
			{
				*vram = height;
				vram -= 256;
			}
		//}
	}
	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

		add a,b
		loopZ:
			ld (ix),a
			cp maxHeight	; height - maxHeight
			dec a
			dec ixh
		jr nc,loopZ
	
	dec c
	jr nz,loopY

dec b
jr nz,loopX

21 + 12 = 33