Code:
for( v=0; v<TEXTURESIZE; v++ ) {
	SDL_GetRGB(getPixel(texture,u,v),screen->format,&b,&g,&r);
	color = SDL_MapRGB(screen->format,r,g,b);
	while( texelcount<=max(1.0,texelsize) && y<camera->winy+camera->winh ) {
		if( y>=camera->winy ) {
			*(Uint32 *)((Uint8 *)p + scanline)=color; // draw pixel
			scanline += scanwidth;
		}
		y++;
		texelcount+=min(texelsize,1.0);
	}
	texelcount -= max(1.0,texelsize);
	if( y>=camera->winh+camera->winy )
		break;
}


Column-based texture mapping on a per texel basis. It seems obvious but I just realized it a year ago, and it massively improved the speed of my raycaster when the camera was positioned close to walls. UV coordinates are recalculated only when the end of the texel is reached (instead of for every pixel), and if texelsize<0 the more obvious per-pixel method is used instead.

Also:
Code:
fld fnum
fistp inum


Fast float to integer conversion in x86. Weirdly enough I've found that many compilers will not do this. I discovered the trick several years ago and then found sometime later that John Carmack did the same thing in Quake 2.

Originally Posted By: Superku
Code:
my.pan = your.pan + random(360);


Where did you find this? grin


Eats commas for breakfast.

Play Barony: Cursed Edition!