SourceForge: atanksaiupgrade/atanksaiupgrade: changeset 45:8216e8eee89f
- balanced repulsor shields, cleaned up some code, and added bounced rollers speed reduction. atanks-3.9-experimental
authoryamakuzure <yamakuzure@users.sourceforge.net>
Tue Sep 29 18:04:04 2009 +0200 (8 weeks ago)
branchatanks-3.9-experimental
changeset 458216e8eee89f
parent 443957ea3fcb06
child 460eec957e6ece
- balanced repulsor shields, cleaned up some code, and added bounced rollers speed reduction.
src/atanks.cpp
src/game.cpp
src/missile.cpp
src/player.cpp
src/tank.cpp
     1.1 --- a/src/atanks.cpp	Tue Sep 22 09:26:45 2009 +0200
     1.2 +++ b/src/atanks.cpp	Tue Sep 29 18:04:04 2009 +0200
     1.3 @@ -272,8 +272,9 @@
     1.4          }
     1.5        else
     1.6          env->drawScreen();
     1.7 +
     1.8        if (! (int)global->os_mouse) show_mouse (screen);
     1.9 -      _SLEEP;
    1.10 +
    1.11        flashCount++;
    1.12        flashCount = flashCount % (int)(global->frames_per_second * 2);
    1.13      }
     2.1 --- a/src/game.cpp	Tue Sep 22 09:26:45 2009 +0200
     2.2 +++ b/src/game.cpp	Tue Sep 29 18:04:04 2009 +0200
     2.3 @@ -310,8 +310,10 @@
     2.4                    pBeam->update();
     2.5                    delete (pBeam);
     2.6                  }
     2.7 -              iBlockersCount++; // Beams block generally or they erase the whole countryside!
     2.8 -              pBeam = NULL; // (... if the land slides too early and fast...)
     2.9 +              /// Not any more... iBlockersCount++; // Beams block generally or they erase the whole countryside!
    2.10 +              iMissFlightCount++;
    2.11 +              // Lightning strikes and beams are considered flights, as they deal damage upon their destruction
    2.12 +              pBeam = NULL;
    2.13                break;
    2.14  
    2.15              case FLOATTEXT_CLASS:
     3.1 --- a/src/missile.cpp	Tue Sep 22 09:26:45 2009 +0200
     3.2 +++ b/src/missile.cpp	Tue Sep 29 18:04:04 2009 +0200
     3.3 @@ -457,6 +457,24 @@
     3.4                        xv += xaccel * dFpsMul;
     3.5                      }
     3.6                  }
     3.7 +
     3.8 +              // Check whether we are too fast:
     3.9 +              if (abs(xv) > 1.0)
    3.10 +                {
    3.11 +                  if (xv > 1.0)
    3.12 +                    {
    3.13 +                      xv -= dFpsMul;
    3.14 +                      if (xv < 1.0)
    3.15 +                        xv = 1.0;
    3.16 +                    }
    3.17 +                  if (xv < -1.0)
    3.18 +                    {
    3.19 +                      xv += dFpsMul;
    3.20 +                      if (xv > -1.0)
    3.21 +                        xv = -1.0;
    3.22 +                    }
    3.23 +                }
    3.24 +
    3.25                // now look whether repulsion changed anything
    3.26                if ( (xv > -0.25) && (xv < 0.25) )
    3.27                  {
     4.1 --- a/src/player.cpp	Tue Sep 22 09:26:45 2009 +0200
     4.2 +++ b/src/player.cpp	Tue Sep 29 18:04:04 2009 +0200
     4.3 @@ -1530,8 +1530,8 @@
     4.4                    if (sAIData.pTankPool[i] == pTargetTank)
     4.5                      {
     4.6                        // Without this, the shield would be nearly useless!
     4.7 -                      xAccel *= sAIData.dFocusRate;
     4.8 -                      yAccel *= sAIData.dFocusRate;
     4.9 +                      xAccel *= sAIData.dFocusRate * 0.9;
    4.10 +                      yAccel *= sAIData.dFocusRate * 0.9;
    4.11                        // But the lesser bots wouldn't hit anything anymore if more than
    4.12                        // pTargetTank would be handled like that!
    4.13                      }
    4.14 @@ -1762,7 +1762,7 @@
    4.15                            double xAccel = dVelX, yAccel = dVelY;
    4.16                            sAIData.pTankPool[i]->repulse (dPosX + dVelX, dPosY + dVelY, &xAccel, &yAccel, tank->cw);
    4.17                            if (sAIData.pTankPool[i] == pTargetTank)
    4.18 -                            xAccel *= sAIData.dFocusRate;
    4.19 +                            xAccel *= sAIData.dFocusRate * 0.9;
    4.20                            dVelX += xAccel;
    4.21                          }
    4.22                      }
    4.23 @@ -1817,8 +1817,8 @@
    4.24                        if (sAIData.pTankPool[i] == pTargetTank)
    4.25                          {
    4.26                            // Without this, the shield would be nearly useless!
    4.27 -                          xAccel *= sAIData.dFocusRate;
    4.28 -                          yAccel *= sAIData.dFocusRate;
    4.29 +                          xAccel *= sAIData.dFocusRate * 0.9;
    4.30 +                          yAccel *= sAIData.dFocusRate * 0.9;
    4.31                            // But the lesser bots wouldn't hit anything anymore if more
    4.32                            // than pTargetTank would be handled like that!
    4.33                          }
    4.34 @@ -5188,7 +5188,7 @@
    4.35        else
    4.36          dAngleVariation = RNG.random(-10.0 * sAIData.dFocusRate, 20.0 * sAIData.dFocusRate);
    4.37        /* In boxed mode, useless have -4.0 to 2.0 and deadly -20.0 to 10.0
    4.38 -         otherwise the have -2.0 to 4.0 and -10.0 to 20.0
    4.39 +         otherwise they have -2.0 to 4.0 and -10.0 to 20.0
    4.40           This is done this way, because negative values are flattening the angle, and it is
    4.41           important to not raise the angles too much when a ceiling is present! */
    4.42  
    4.43 @@ -5316,8 +5316,8 @@
    4.44    iPower += RNG.random(-100.0, 100.0) * sAIData.dErrorMultiplier;
    4.45  
    4.46    // Be sure Angle is, nevertheless, safe:
    4.47 -  if (iAngle <=  90)   iAngle = 91;
    4.48 -  if (iAngle >= 270)  iAngle = 269;
    4.49 +  if (iAngle <=  90) iAngle = 91;
    4.50 +  if (iAngle >= 270) iAngle = 269;
    4.51    if (iAngle == 180) iAngle = dDistX >= 0 ? 179 : 181;
    4.52  
    4.53    // Be sure Power is, nevertheless, safe:
     5.1 --- a/src/tank.cpp	Tue Sep 22 09:26:45 2009 +0200
     5.2 +++ b/src/tank.cpp	Tue Sep 29 18:04:04 2009 +0200
     5.3 @@ -587,6 +587,7 @@
     5.4  {
     5.5    double dVelX  = *xaccel;
     5.6    double dVelY  = *yaccel;
     5.7 +  double dVelTot= FABSDISTANCE(0, 0, dVelX, dVelY);
     5.8    double dXDist = 0.0;
     5.9    double dYDist = 0.0;
    5.10    double dXAcc  = 0.0;
    5.11 @@ -607,6 +608,8 @@
    5.12          {
    5.13            if (xpos < dPosX) dXDist *= -1.0;
    5.14            if (ypos < dPosY) dYDist *= -1.0;
    5.15 +          if (dVelTot < 1.0)
    5.16 +            dVelTot = 1.0;
    5.17  
    5.18            double distance2 = (dXDist * dXDist) + (dYDist * dYDist);
    5.19            double distance = sqrt (distance2);
    5.20 @@ -630,21 +633,21 @@
    5.21                  dYAcc *= -1.0; // Push upwards instead
    5.22  
    5.23                // Repulsion must not be too high
    5.24 -              if (abs(dXAcc) > 1.0)
    5.25 +              if (abs(dXAcc) > dVelTot)
    5.26                  {
    5.27                    // X-Repulsion is too high
    5.28                    if (dXAcc < 0)
    5.29 -                    dXAcc = -1.0;
    5.30 +                    dXAcc = -1.0 * dVelTot;
    5.31                    else
    5.32 -                    dXAcc = 1.0;
    5.33 +                    dXAcc = dVelTot;
    5.34                  }
    5.35 -              if (abs(dYAcc) > 1.0)
    5.36 +              if (abs(dYAcc) > dVelTot)
    5.37                  {
    5.38                    // Y-Repulsion is too high
    5.39                    if (dYAcc < 0)
    5.40 -                    dYAcc = -1.0;
    5.41 +                    dYAcc = -1.0 * dVelTot;
    5.42                    else
    5.43 -                    dYAcc = 1.0;
    5.44 +                    dYAcc = dVelTot;
    5.45                  }
    5.46              }
    5.47            // Now write back the results: