Hopefully fix color conversion.

Hard to tell because the triangle rendering is still messed up. However,
storing negative values in bytes doesn't work :)
This commit is contained in:
Bill Currie 2012-05-19 09:14:07 +09:00
parent be9c0697a2
commit d41bf32d91
1 changed files with 2 additions and 2 deletions

View File

@ -83,12 +83,12 @@ static byte
convert_color (byte *rgb) convert_color (byte *rgb)
{ {
//FIXME slow! //FIXME slow!
byte dist[3]; int dist[3];
int d, bestd = 256 * 256 * 3, bestc = -1; int d, bestd = 256 * 256 * 3, bestc = -1;
int i; int i;
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
VectorSubtract (vid.basepal, rgb, dist); VectorSubtract (vid.basepal + i * 3, rgb, dist);
d = DotProduct (dist, dist); d = DotProduct (dist, dist);
if (d < bestd) { if (d < bestd) {
bestd = d; bestd = d;