Saturday, June 09, 2007

HOWTO: Seeing Cloaked Tanks

Have you enjoyed being able to see those pesky Stealth tanks on your radar? Be sure to read the previous HOWTO posts in case you've missed them :)

Anyway, here's a simple trick that will allow you to see cloaked tanks. As a note, this will not affect lasers; lasers will still pass through cloaked tanks. You will be able to see them, though. Think of it as training wheels until you get better at using your radar :)

I assume that you have already downloaded the source and have extracted the source from the tarball. Enter the extracted directory and go to the /src/bzflag/ directory and open Player.cxx with your favorite text editor. Use the search feature of your editor (e.g., ctrl+f for some text editors) and search for "cloak". The first thing you will find is:

// set the alpha target
if (effectFlag == Flags::Cloaking) {
alphaTarget = 0.0f;
} else {
alphaTarget = 1.0f;
}


Notice the line alphaTarget = 0.0f; Let's change 0.0f to 0.5f so that the line reads like this:

alphaTarget = 0.5f;

The effect will be that it is slightly translucent but not as much as zoned tanks (i.e., tanks with the Phantom Zone flag). Alternatively, you can use 1.0f instead of 0.5f.

Moving on. Search for "cloak" again. You now come to a section like this:

}

// is this tank fully cloaked?
const bool cloaked = (flagType == Flags::Cloaking) && (color[3] == 0.0f);

if (cloaked && !seerView) {
return; // don't draw anything
}

// setup the visibility properties
if (inCockpit && !showTreads) {
tankNode->setOnlyShadows(true);
} else {
tankNode->setOnlyShadows(false);
}

Let's remove the check for seeing if a tank is cloaked and not drawing anything if it is. The newly edited section should like this:

}

// setup the visibility properties
if (inCockpit && !showTreads) {
tankNode->setOnlyShadows(true);
} else {
tankNode->setOnlyShadows(false);
}


Save the file, compile your client, and . . .

Have fun!

Related post:
HOWTO: Seeing STEALTH Tanks on Radar

0 Comments:

Post a Comment

<< Home