В этом участке я максимум что осилил, так это вынести пару арифметических операций за тело цикла.
int dd=h * 128 ;
int dd1=lineHeight * 128;
for(int y = drawStart; y < drawEnd; y+=2)
{
int d = y * 256 - dd+dd1; //256 and 128 factors to avoid floats
int texY = ((d * texHeight) / lineHeight) / 256;
int color = texture[texNum][texWidth * texY + texX];
if(side == 1) color = (color >> 1) & 8355711;
buffer[x][y] = color;
}