Friday, July 27, 2007

Reverse While Sealed with Oscillation Overthruster

By: Phaz

Tired of not being able to reverse into a building with your Oscillation Overthruster (OO) flag? If you poke out of a building to take a shot, can only back into the building by jumping backward which leaves you vulnerable. Or, let's say that you are sealed in a thin wall. If you want to backtrack, you will have to leave the safety of the building to turn around.

No longer!

Thanks to this tip from Phaz, you can back up while sealed with OO! Now you can pull out, snipe your shot, and simply back up into the safety of the building (or other obstacle where you can be sealed). That is, you are no longer limited to driving only in the forward direction.

For this edit, we are going to open LocalPlayer.cxx in /src/bzflag/ of the extracted source. First let's edit the sections that prevent us from being able to back up while sealed. Search for "if (expelled && phased)", and you will this section:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(getFlag() == Flags::OscillationOverthruster && desiredSpeed < 0.0f &&
p[2] == 0.0f));
return obstacle;

Remove The following from above:
                                                                
||
(getFlag() == Flags::OscillationOverthruster && desiredSpeed < 0.0f &&
p[2] == 0.0f));

The section should now read like this:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName());
return obstacle;

Next, search for "if (expelled && phased)" again, and you will find this section:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(hasOOflag && desiredSpeed < 0.0f && p[2] == 0.0f));

if (obstacle != NULL) {

Remove the following from above:

||
(hasOOflag && desiredSpeed < 0.0f && p[2] == 0.0f));

The section should now read like this:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName());

if (obstacle != NULL) {

Lastly, search for "oscillation overthruster tank in building can't" and you will find this section:

else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

// oscillation overthruster tank in building can't back up
if (fracOfMaxSpeed < 0.0f && getLocation() == InBuilding &&
flag == Flags::OscillationOverthruster) {
fracOfMaxSpeed = 0.0f;
}

// boost speed for certain flags

Let's remove the portion about not being able to back up in a building so that the edited section now reads like this:

else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

// boost speed for certain flags

Save the file, compile your new client, and you're done! For Phaz's original instructions, see his comment to "HOWTO: Drop Bad Flags Instantly"at Cheating BZFlag.

Keep these tips rolling in! And as always...

Have fun!

No comments: