~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/tron/gCycleMovement.cpp

  • Committer: SwagTron
  • Date: 2019-08-04 23:49:16 UTC
  • Revision ID: swagtron-20190804234916-ck8wmuxoi4cph54s
- Removing merge from 2.8.3.x due to the many errors it causes in codeblocks.
- Made these commands save their value on exit:
  CYCLE_TURN_MEMORY
  MOVIEPACK_FLOOR_*
  GRID_SIZE
  GRID_SIZE_MOVIEPACK
  FLOOR_RED
  FLOOR_BLUE
  FLOOR_GREEN
  PLAYER_RANDOM_COLOR_RANGE

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
 
190
190
// number of turns buffered exactly
191
191
int sg_cycleTurnMemory = 3;
192
 
static tSettingItem<int> c_tm("CYCLE_TURN_MEMORY",
 
192
static tConfItem<int> c_tm("CYCLE_TURN_MEMORY",
193
193
                              sg_cycleTurnMemory);
194
194
 
195
195
REAL sg_delayCycleTimeBased = 1;
3119
3119
                        // be a practiced pattern
3120
3120
                        if( rear.type != gSENSOR_SELF && rear.type != gSENSOR_TEAMMATE )
3121
3121
                        {
3122
 
                            REAL timing = rear.hit/(verletSpeed_ + 1E-10);
3123
 
 
3124
 
                            // extra factor: when the number of axes is not 4,
3125
 
                            // the effective speed at which the cycle would increase
3126
 
                            // the here detected distance is reduced. Thus, we
3127
 
                            // need to divide the timing by that speed factor.
3128
 
                            REAL factor = -lastDirDrive*dirDrive*d;
3129
 
                            if(factor > 0 && factor < 1)
3130
 
                                timing /= factor;
 
3122
                            REAL timing = rear.hit/(verletSpeed_ + 1E-10);
 
3123
 
 
3124
                            // extra factor: when the number of axes is not 4,
 
3125
                            // the effective speed at which the cycle would increase
 
3126
                            // the here detected distance is reduced. Thus, we
 
3127
                            // need to divide the timing by that speed factor.
 
3128
                            REAL factor = -lastDirDrive*dirDrive*d;
 
3129
                            if(factor > 0 && factor < 1)
 
3130
                                timing /= factor;
3131
3131
 
3132
3132
                            player->AnalyzeTiming( timing );
3133
3133
                        }
3397
3397
 
3398
3398
                // and report
3399
3399
                // player->AnalyzeTiming( timing );
3400
 
                */
 
3400
                */
3401
3401
                uncannyTimingToReport_ = false;
3402
3402
            }
3403
3403
            else
3609
3609
    }
3610
3610
private:
3611
3611
    bool & guard_;
3612
 
};
3613
 
 
3614
 
static bool sg_cycleRubberDepleteSelf = true;
3615
 
static bool sg_cycleRubberDepleteTeam = true;
3616
 
static bool sg_cycleRubberDepleteEnemy = true;
3617
 
static bool sg_cycleRubberDepleteRim = true;
3618
 
 
3619
 
static nSettingItemWatched<bool> sg_cycleRubberDepleteSelfConf("CYCLE_RUBBER_DEPLETE_SELF", sg_cycleRubberDepleteSelf, nConfItemVersionWatcher::Group_Bumpy, 12);
3620
 
static nSettingItemWatched<bool> sg_cycleRubberDepleteEnemyConf("CYCLE_RUBBER_DEPLETE_ENEMY", sg_cycleRubberDepleteEnemy, nConfItemVersionWatcher::Group_Bumpy, 12);
3621
 
static nSettingItemWatched<bool> sg_cycleRubberDepleteTeamConf("CYCLE_RUBBER_DEPLETE_TEAM", sg_cycleRubberDepleteTeam, nConfItemVersionWatcher::Group_Bumpy, 12);
 
3612
};
 
3613
 
 
3614
static bool sg_cycleRubberDepleteSelf = true;
 
3615
static bool sg_cycleRubberDepleteTeam = true;
 
3616
static bool sg_cycleRubberDepleteEnemy = true;
 
3617
static bool sg_cycleRubberDepleteRim = true;
 
3618
 
 
3619
static nSettingItemWatched<bool> sg_cycleRubberDepleteSelfConf("CYCLE_RUBBER_DEPLETE_SELF", sg_cycleRubberDepleteSelf, nConfItemVersionWatcher::Group_Bumpy, 12);
 
3620
static nSettingItemWatched<bool> sg_cycleRubberDepleteEnemyConf("CYCLE_RUBBER_DEPLETE_ENEMY", sg_cycleRubberDepleteEnemy, nConfItemVersionWatcher::Group_Bumpy, 12);
 
3621
static nSettingItemWatched<bool> sg_cycleRubberDepleteTeamConf("CYCLE_RUBBER_DEPLETE_TEAM", sg_cycleRubberDepleteTeam, nConfItemVersionWatcher::Group_Bumpy, 12);
3622
3622
static nSettingItemWatched<bool> sg_cycleRubberDepleteRimConf("CYCLE_RUBBER_DEPLETE_RIM", sg_cycleRubberDepleteRim, nConfItemVersionWatcher::Group_Bumpy, 12);
3623
3623
 
3624
3624
// *******************************************************************************************
3950
3950
                            // need many attempts
3951
3951
                            verletSpeed_=lastSpeed;
3952
3952
                            acceleration=lastAcceleration;
3953
 
 
3954
 
                            // simulate until rubber runs out (no need to recalc acceleration)
3955
 
                            if ( TimestepCore( runOutTime, false ) )
3956
 
                                return true;
3957
 
 
3958
 
                            // simulate post-rubber gap or, more frequently, the crash into the next wall
 
3953
 
 
3954
                            // simulate until rubber runs out (no need to recalc acceleration)
 
3955
                            if ( TimestepCore( runOutTime, false ) )
 
3956
                                return true;
 
3957
 
 
3958
                            // simulate post-rubber gap or, more frequently, the crash into the next wall
3959
3959
                            return TimestepCore( currentTime );
3960
3960
                        }
3961
3961
                    }
3965
3965
                // con << "Deep!\n";
3966
3966
            }
3967
3967
 
3968
 
            // update rubber usage
3969
 
            gPlayerWall *pWall = maxSpaceHit_->playerWall;
3970
 
            if (pWall)
3971
 
            {
3972
 
                gCycle *cycle = pWall->Cycle();
3973
 
                if (cycle == this)
3974
 
                {
3975
 
                    if (sg_cycleRubberDepleteSelf)
3976
 
                    {
3977
 
                        rubber += rubberneeded / rubberEffectiveness;
3978
 
                    }
3979
 
                }
3980
 
                else
3981
 
                {
3982
 
                    if (cycle->Team() != this->Team())
3983
 
                    {
3984
 
                        if (sg_cycleRubberDepleteEnemy)
3985
 
                        {
3986
 
                            rubber += rubberneeded / rubberEffectiveness;
3987
 
                        }
3988
 
                    }
3989
 
                    else
3990
 
                    {
3991
 
                        if (sg_cycleRubberDepleteTeam)
3992
 
                        {
3993
 
                            rubber += rubberneeded / rubberEffectiveness;
3994
 
                        }
3995
 
                    }
3996
 
                }
3997
 
            }
3998
 
            else
3999
 
            {
4000
 
                if (sg_cycleRubberDepleteRim)
4001
 
                {
4002
 
                    rubber += rubberneeded / rubberEffectiveness;
4003
 
                }
 
3968
            // update rubber usage
 
3969
            gPlayerWall *pWall = maxSpaceHit_->playerWall;
 
3970
            if (pWall)
 
3971
            {
 
3972
                gCycle *cycle = pWall->Cycle();
 
3973
                if (cycle == this)
 
3974
                {
 
3975
                    if (sg_cycleRubberDepleteSelf)
 
3976
                    {
 
3977
                        rubber += rubberneeded / rubberEffectiveness;
 
3978
                    }
 
3979
                }
 
3980
                else
 
3981
                {
 
3982
                    if (cycle->Team() != this->Team())
 
3983
                    {
 
3984
                        if (sg_cycleRubberDepleteEnemy)
 
3985
                        {
 
3986
                            rubber += rubberneeded / rubberEffectiveness;
 
3987
                        }
 
3988
                    }
 
3989
                    else
 
3990
                    {
 
3991
                        if (sg_cycleRubberDepleteTeam)
 
3992
                        {
 
3993
                            rubber += rubberneeded / rubberEffectiveness;
 
3994
                        }
 
3995
                    }
 
3996
                }
 
3997
            }
 
3998
            else
 
3999
            {
 
4000
                if (sg_cycleRubberDepleteRim)
 
4001
                {
 
4002
                    rubber += rubberneeded / rubberEffectiveness;
 
4003
                }
4004
4004
            }
4005
4005
 
4006
4006
            numTries = int((sg_rubberCycleTime * ( rubber_granted - rubber ) - 1 )/(sg_rubberCycleTime * step*1.5 + 1));
4022
4022
            step -= rubberneeded;
4023
4023
            if (step<0)
4024
4024
                step=0;
4025
 
 
4026
 
            // ignore the next destination position for now.
4027
 
            // if the space ahead is far less that what the cycle would traverse
4028
 
            // until the destination turn time, die.
4029
 
            // the destination must have come from a 0.2.6 or cheating client with a wrong time set;
4030
 
            // the control code calling this has no clue that the cycle has entered the rubber gap
4031
 
            // and would respect the destination's position, allowing for extremely deep grinds.
4032
 
            if( sn_GetNetState() != nCLIENT &&
4033
 
                currentDestination && !currentDestination->hasBeenUsed &&
4034
 
                rubberneeded >= rubberAvailable &&
4035
 
                space * 1.25 < (currentDestination->gameTime - lastTime) * verletSpeed_)
4036
 
            {
4037
 
                throw gCycleDeath(pos + dirDrive * space);
4038
 
            }
 
4025
 
 
4026
            // ignore the next destination position for now.
 
4027
            // if the space ahead is far less that what the cycle would traverse
 
4028
            // until the destination turn time, die.
 
4029
            // the destination must have come from a 0.2.6 or cheating client with a wrong time set;
 
4030
            // the control code calling this has no clue that the cycle has entered the rubber gap
 
4031
            // and would respect the destination's position, allowing for extremely deep grinds.
 
4032
            if( sn_GetNetState() != nCLIENT &&
 
4033
                currentDestination && !currentDestination->hasBeenUsed &&
 
4034
                rubberneeded >= rubberAvailable &&
 
4035
                space * 1.25 < (currentDestination->gameTime - lastTime) * verletSpeed_)
 
4036
            {
 
4037
                throw gCycleDeath(pos + dirDrive * space);
 
4038
            }
4039
4039
 
4040
4040
            //{
4041
4041
            //    rubber+=step;
4181
4181
    // use up rubber from tunneling (calculated by CalculateAcceleration)
4182
4182
    if ( rubberEffectiveness > 0 )
4183
4183
    {
4184
 
        rubber += rubberUsage * ts * verletSpeed_ / rubberEffectiveness;
 
4184
        rubber += rubberUsage * ts * verletSpeed_ / rubberEffectiveness;
4185
4185
    }
4186
4186
    else if ( rubberUsage > 0 )
4187
4187
    {