compiling, but doesnt completely work
by Dr. John Nobody · in Torque Game Engine · 05/15/2003 (6:37 am) · 6 replies
I recenty decided to start over with a fresh copy of torque. I downloaded 1.1.2, and compiled it in vc6. The game actualy runs fine, the problem is when I try and use the editor, upon pressing F11 the game crashes. I tried debuging and found an error in terraformer.cc, this is the function that seems to be causing problems...
the actual problem is with the line "index /= worldWater;" I believe this function is responsible for generating a bitmap of the heightmap of the current terrain (although I could be wrong, I'm not to familiar with torque, or how the editor works). Any ideas how to fix this? This is all pretty weird, I've downloaded this version in the past and compiled it with no problems. Just for good measure I tried unzipping and compiling a second time with the same error. Any suggestions?
btw, when is v1.2 comming out? are we looking at weeks or months here? I heard it was going to be fairly soon.
thanks for your help!
GBitmap* Terraformer::getScaledGreyscale(U32 r)
{
enum { NUM_COLORS = 2 };
ColorI land[NUM_COLORS] =
{
ColorI(0,0,0),
ColorI(20,255,20)
};
ColorI water[NUM_COLORS] =
{
ColorI(0,0,0),
ColorI(20,20,255)
};
Heightfield *src = getRegister(r);
F32 fmin, fmax;
getMinMax(r, &fmin, &fmax);
F32 scale = (NUM_COLORS-1)/(fmax-fmin);
GBitmap* bitmap = new GBitmap(blockSize, blockSize, false, GBitmap::RGB);
S32 y, x;
U8 *rgb = bitmap->getAddress(0,0);
for (y=blockSize-1; y >= 0; y--)
{
for (x=0; x < blockSize; x++)
{
ColorI c;
F32 index = (src->val(wrap(x), wrap(y))-fmin) * scale;
if (index > worldWater)
{ // above "water"
S32 indexLo = (S32)mFloor(index);
S32 indexHi = (S32)mCeil(index);
index -= indexLo;
c.interpolate(land[indexLo], land[indexHi], index);
}
else
{ // below "water"
index /= worldWater;
S32 indexLo = (S32)mFloor(index);
S32 indexHi = (S32)mCeil(index);
index -= indexLo;
c.interpolate(water[indexLo], water[indexHi], index);
}
*rgb++ = c.red;
*rgb++ = c.green;
*rgb++ = c.blue;
}
}
return(bitmap);
}the actual problem is with the line "index /= worldWater;" I believe this function is responsible for generating a bitmap of the heightmap of the current terrain (although I could be wrong, I'm not to familiar with torque, or how the editor works). Any ideas how to fix this? This is all pretty weird, I've downloaded this version in the past and compiled it with no problems. Just for good measure I tried unzipping and compiling a second time with the same error. Any suggestions?
btw, when is v1.2 comming out? are we looking at weeks or months here? I heard it was going to be fairly soon.
thanks for your help!
#2
05/15/2003 (11:44 am)
bump again
#3
05/15/2003 (1:21 pm)
oh come on, who's man enough?
#4
if your starting fresh ..
why wouldnt you start with the head release?
I know It doesnt have this bug.
and if you Insist on using that release
at Least get the head to go over what changed.
05/15/2003 (1:47 pm)
im just curious ..if your starting fresh ..
why wouldnt you start with the head release?
I know It doesnt have this bug.
and if you Insist on using that release
at Least get the head to go over what changed.
#6
05/16/2003 (7:40 am)
thank you both. I tried downloading the head and it worked fine, I also took Richards advice and checked out that thread, it was a divide by zero problem, changed a line of code and it worked fine, thanks guys!
Torque Owner Dr. John Nobody