Sunday, August 12, 2007

Wings Gravity Fix for BloodBath

You may have noticed that if you tried to use the wings cheat in BloodBath, you'll start to fly away until you get autokicked. The problem lies in the fact that there are two separate gravity values: one for normal jumps and the other for wings. Normally, the value of gravity is negative (usually around -9.8) causing you to go downwards. However, when this value is set to a positive value, you start to shoot upwards. BloodBath set the wings gravity to 100, so you will shoot upwards. So here's a quick, one-liner fix so you can you the wings cheat on their server again.
For this cheat, you will need to edit LocalPlayer.cxx and find this line:

newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;

And add this line of code right before it:
if(BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) >= 0)BZDB.setFloat(StateDatabase::BZDB_WINGSGRAVITY, BZDB.eval(StateDatabase::BZDB_GRAVITY));

So your code should look like this, in the end:
if(BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) >=0 )BZDB.setFloat(StateDatabase::BZDB_WINGSGRAVITY, BZDB.eval(StateDatabase::BZDB_GRAVITY));
newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;

What this will do is check to see if wings gravity is set to a positive number, and if so, change it to the value of normal gravity.
Did I miss something? Was this helpful? Leave a comment.

Have fun. ;)
-Phaz

15 comments:

Someone said...

lol, just did this a few days ago, when you mentioned that on toggling cheats.

Someone said...

I have a long list of GM cheats I'm going to give you:

* Auto lockon
* No lock on teammates
* Each GM has its own lock (eg. you can fire 3 gm's at three different targets and they all hit the correct ones)
* Lock stays after death

Someone said...

First, a fun one:

Shoot normal bullets in PZ

---

In src/bzflag/ShotPath.cxx find:

if (tank.getFlag() == Flags::PhantomZone && !tank.isFlagActive()){

Replace it with:

if (tank.getFlag() == Flags::PhantomZone){

Someone said...

Neat one:

Geno/other team flag finder: You know that there is a marker for your own team flag, and antidotes above the targeting square, so why not have one for geno, and other team flags?

In src/bzflag/playing.cxx, find:
---
static void prepareTheHUD()
{
// prep the HUD
if (myTank) {
const float* myPos = myTank->getPosition();
hud->setHeading(myTank->getAngle());
hud->setAltitude(myPos[2]);
if (world->allowTeamFlags()) {
const float* myTeamColor = Team::getTankColor(myTank->getTeam());
// markers for my team flag
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if ((flag.type->flagTeam == myTank->getTeam())
&& ((flag.status != FlagOnTank) ||
(flag.owner != myTank->getId()))) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, myTeamColor);
}
}
}
if (myTank->getAntidoteLocation()) {
// marker for my antidote flag
const GLfloat* antidotePos = myTank->getAntidoteLocation();
float heading = atan2f(antidotePos[1] - myPos[1],
antidotePos[0] - myPos[0]);
const float antidoteColor[] = {1.0f, 1.0f, 0.0f};
hud->addMarker(heading, antidoteColor);
}
}
return;
}
---
Replace it with:
---
static void prepareTheHUD()
{
// prep the HUD
if (myTank) {
const float* myPos = myTank->getPosition();
hud->setHeading(myTank->getAngle());
hud->setAltitude(myPos[2]);
if (world->allowTeamFlags()) {
// markers for my team flag
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if (flag.type->flagTeam != NoTeam) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, Team::getTankColor(flag.type->flagTeam));
}
}
}
if (myTank->getAntidoteLocation()) {
// marker for my antidote flag
const GLfloat* antidotePos = myTank->getAntidoteLocation();
float heading = atan2f(antidotePos[1] - myPos[1],
antidotePos[0] - myPos[0]);
const float antidoteColor[] = {1.0f, 1.0f, 0.0f};
hud->addMarker(heading, antidoteColor);
}
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if (flag.type == Flags::Genocide) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, flag.type->getColor());
}
}
}
return;
}
---

Sorry to give so much context, but there were alot of changes.

Someone said...

Do you ever tire of saying 'sry' to people you tk?

In src/bzflag/playing.cxx find:
---
if (myTank->isAutoPilot()) {
char meaculpa[MessageLen];
memset(meaculpa, 0, MessageLen);
strncpy(meaculpa,
"sorry, i'm just a silly machine",
MessageLen);
---
Replace it with:
---
if (myTank->isAutoPilot() || 1) {
char meaculpa[MessageLen];
memset(meaculpa, 0, MessageLen);
strncpy(meaculpa,
"sry",
MessageLen);

Someone said...

Want to use autopilot on maps that disable it?

In src/bzflag/clientCommands.cxx, find:
---
if (BZDB.isTrue(StateDatabase::BZDB_DISABLEBOTS)) {
hud->setAlert(0, "autopilot not allowed on this server", 1.0f, true);
return std::string();
}
---
Remove it.

Someone said...

Laser fast-reload

In src/bzflag/SegmentedShotStrategy.cxx, find:
---
setReloadTime(_path->getReloadTime()
/ BZDB.eval(StateDatabase::BZDB_LASERADRATE));
---
Replace with:
---
setReloadTime(_path->getReloadTime()
* BZDB.eval(StateDatabase::BZDB_LASERADLIFE));

Someone said...

Researching bullets with long life...

I found that if you know the IP address of a player, you can make bullets of any type, life, direction, and speed appear on their screen. Only theirs.

I'm trying to find a way to find players IP address's.

person said...

Is there a way to make other players look like cheaters to get them banned?

person said...

And,(srry for using two posts i forgot this question), how can u adjust tank size in game? So i could push a button to make my tank instantly smaller using a smaller radius but my tank still apperas the same size.

Someone said...

First question: yes, but i won't help.
Second: Yes, look in src/bzflag/Player.cxx

person said...

Thx for the help but one time wasn't there a client posted here that allowed in game size changing using the [ and ] keys to change tank size in 5% intervals?
If so could somebody post how to edit the bzflag client to make it so?

phasmophage said...

Hey, someone.
Did you want to become a contributor? You're really good at this, and I won't have time to update very often. So if so, let me know, and I'll send you an email inviting you.
-Phaz

phasmophage said...

Most of those I already had, but it's nice to see you post them, someone!

phasmophage said...

To make it look like someone is cheating to get them banned, you might try using the cheat to stop all shots with shield, but not stop shots for your recipient. Keep the person to frame as your recipient, and they'll look like they're cheating because only he or she can shoot.
(Sorry, I'm not going into the actual code of this, I'm currently really busy so this is all I can say.)