diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/bg_misc.c | 26 | ||||
| -rw-r--r-- | src/game/bg_public.h | 2 | ||||
| -rw-r--r-- | src/game/g_active.c | 52 | ||||
| -rw-r--r-- | src/game/tremulous.h | 24 | 
4 files changed, 51 insertions, 53 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 567bb8c7..8ce10291 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -892,7 +892,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      0,                                              //int     health;      0.0f,                                           //float   fallDamage; -    0,                                              //int     regenRate; +    0.0f,                                           //float   regenRate;      0,                                              //int     abilities;      WP_NONE,                                        //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -919,7 +919,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      ABUILDER_HEALTH,                                //int     health;      0.2f,                                           //float   fallDamage; -    ABUILDER_REGEN,                                 //int     regenRate; +    ABUILDER_REGEN,                                 //float   regenRate;      SCA_TAKESFALLDAMAGE|SCA_FOVWARPS|SCA_ALIENSENSE,//int     abilities;      WP_ABUILD,                                      //weapon_t  startWeapon      95.0f,                                          //float   buildDist; @@ -947,7 +947,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S2 )|( 1 << S3 ),                        //int  stages      ABUILDER_UPG_HEALTH,                            //int     health;      0.2f,                                           //float   fallDamage; -    ABUILDER_UPG_REGEN,                             //int     regenRate; +    ABUILDER_UPG_REGEN,                             //float   regenRate;      SCA_TAKESFALLDAMAGE|SCA_FOVWARPS|SCA_WALLCLIMBER|SCA_ALIENSENSE,    //int     abilities;      WP_ABUILD2,                                     //weapon_t  startWeapon      105.0f,                                         //float   buildDist; @@ -974,7 +974,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      LEVEL0_HEALTH,                                  //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL0_REGEN,                                   //int     regenRate; +    LEVEL0_REGEN,                                   //float   regenRate;      SCA_WALLCLIMBER|SCA_FOVWARPS|SCA_ALIENSENSE,    //int     abilities;      WP_ALEVEL0,                                     //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1003,7 +1003,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      LEVEL1_HEALTH,                                  //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL1_REGEN,                                   //int     regenRate; +    LEVEL1_REGEN,                                   //float   regenRate;      SCA_FOVWARPS|SCA_WALLCLIMBER|SCA_ALIENSENSE,    //int     abilities;      WP_ALEVEL1,                                     //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1032,7 +1032,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S2 )|( 1 << S3 ),                        //int  stages      LEVEL1_UPG_HEALTH,                              //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL1_UPG_REGEN,                               //int     regenRate; +    LEVEL1_UPG_REGEN,                               //float   regenRate;      SCA_FOVWARPS|SCA_WALLCLIMBER|SCA_ALIENSENSE,    //int     abilities;      WP_ALEVEL1_UPG,                                 //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1059,7 +1059,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      LEVEL2_HEALTH,                                  //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL2_REGEN,                                   //int     regenRate; +    LEVEL2_REGEN,                                   //float   regenRate;      SCA_WALLJUMPER|SCA_FOVWARPS|SCA_ALIENSENSE,     //int     abilities;      WP_ALEVEL2,                                     //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1086,7 +1086,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S2 )|( 1 << S3 ),                        //int  stages      LEVEL2_UPG_HEALTH,                              //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL2_UPG_REGEN,                               //int     regenRate; +    LEVEL2_UPG_REGEN,                               //float   regenRate;      SCA_WALLJUMPER|SCA_FOVWARPS|SCA_ALIENSENSE,     //int     abilities;      WP_ALEVEL2_UPG,                                 //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1114,7 +1114,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      LEVEL3_HEALTH,                                  //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL3_REGEN,                                   //int     regenRate; +    LEVEL3_REGEN,                                   //float   regenRate;      SCA_FOVWARPS|SCA_ALIENSENSE,                    //int     abilities;      WP_ALEVEL3,                                     //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1142,7 +1142,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S2 )|( 1 << S3 ),                        //int  stages      LEVEL3_UPG_HEALTH,                              //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL3_UPG_REGEN,                               //int     regenRate; +    LEVEL3_UPG_REGEN,                               //float   regenRate;      SCA_FOVWARPS|SCA_ALIENSENSE,                    //int     abilities;      WP_ALEVEL3_UPG,                                 //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1171,7 +1171,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S3 ),                                    //int  stages      LEVEL4_HEALTH,                                  //int     health;      0.0f,                                           //float   fallDamage; -    LEVEL4_REGEN,                                   //int     regenRate; +    LEVEL4_REGEN,                                   //float   regenRate;      SCA_FOVWARPS|SCA_ALIENSENSE,                    //int     abilities;      WP_ALEVEL4,                                     //weapon_t  startWeapon      0.0f,                                           //float   buildDist; @@ -1197,7 +1197,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ),            //int  stages      100,                                            //int     health;      1.0f,                                           //float   fallDamage; -    0,                                              //int     regenRate; +    0.0f,                                           //float   regenRate;      SCA_TAKESFALLDAMAGE|SCA_CANUSELADDERS,          //int     abilities;      WP_NONE, //special-cased in g_client.c          //weapon_t  startWeapon      110.0f,                                         //float   buildDist; @@ -1223,7 +1223,7 @@ static const classAttributes_t bg_classList[ ] =      ( 1 << S3 ),                                    //int  stages      100,                                            //int     health;      1.0f,                                           //float   fallDamage; -    0,                                              //int     regenRate; +    0.0f,                                           //float   regenRate;      SCA_TAKESFALLDAMAGE|        SCA_CANUSELADDERS,                            //int     abilities;      WP_NONE, //special-cased in g_client.c          //weapon_t  startWeapon diff --git a/src/game/bg_public.h b/src/game/bg_public.h index a08b8cdd..7f7f576f 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -916,7 +916,7 @@ typedef struct    int       health;    float     fallDamage; -  int       regenRate; +  float     regenRate;    int       abilities; diff --git a/src/game/g_active.c b/src/game/g_active.c index 2def0e5d..418b89c6 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1399,28 +1399,26 @@ void ClientThink_real( gentity_t *ent )    }    // Replenish alien health -  while( ent->nextRegenTime < level.time ) +  if( level.surrenderTeam != client->pers.teamSelection && +      ent->nextRegenTime >= 0 && ent->nextRegenTime < level.time )    { -    int regenRate = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->regenRate; +    float regenRate = +        BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->regenRate; -    if( !ent->client || ent->health <= 0 || ent->nextRegenTime < 0 || -        regenRate == 0 ) -    { -      ent->nextRegenTime = -1; -      break; // no regen -    } - -    if( level.surrenderTeam != ent->client->pers.teamSelection ) +    if( ent->health <= 0 || ent->nextRegenTime < 0 || regenRate == 0 ) +      ent->nextRegenTime = -1; // no regen +    else      {        int       entityList[ MAX_GENTITIES ];        int       i, num; +      int       count, interval;        vec3_t    range, mins, maxs;        float     modifier = 1.0f;        VectorSet( range, REGEN_BOOST_RANGE, REGEN_BOOST_RANGE,                   REGEN_BOOST_RANGE ); -      VectorAdd( ent->client->ps.origin, range, maxs ); -      VectorSubtract( ent->client->ps.origin, range, mins ); +      VectorAdd( client->ps.origin, range, maxs ); +      VectorSubtract( client->ps.origin, range, mins );        num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );        for( i = 0; i < num; i++ ) @@ -1449,32 +1447,32 @@ void ClientThink_real( gentity_t *ent )        }        // Transmit heal rate to the client so it can be displayed on the HUD -      ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_ACTIVE; -      ent->client->ps.stats[ STAT_STATE ] &= ~( SS_HEALING_2X | SS_HEALING_3X ); +      client->ps.stats[ STAT_STATE ] |= SS_HEALING_ACTIVE; +      client->ps.stats[ STAT_STATE ] &= ~( SS_HEALING_2X | SS_HEALING_3X );        if( modifier == 1.0f && !G_FindCreep( ent ) )        { -        ent->client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_ACTIVE; -        modifier /= 3.0f; +        client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_ACTIVE; +        modifier *= ALIEN_REGEN_NOCREEP_MOD;        }        else if( modifier >= 3.0f ) -        ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_3X; +        client->ps.stats[ STAT_STATE ] |= SS_HEALING_3X;        else if( modifier >= 2.0f ) -        ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_2X; +        client->ps.stats[ STAT_STATE ] |= SS_HEALING_2X; + +      interval = 1000 / ( regenRate * modifier ); +      // if recovery interval is less than frametime, compensate +      count = 1 + ( level.time - ent->nextRegenTime ) / interval; + +      ent->health += count; +      ent->nextRegenTime += count * interval; -      ent->health += 1;        // if at max health, clear damage counters -      if( ent->health >= ent->client->ps.stats[ STAT_MAX_HEALTH ] ) +      if( ent->health >= client->ps.stats[ STAT_MAX_HEALTH ] )        { -        ent->health = ent->client->ps.stats[ STAT_MAX_HEALTH ]; +        ent->health = client->ps.stats[ STAT_MAX_HEALTH ];          for( i = 0; i < MAX_CLIENTS; i++ )            ent->credits[ i ] = 0;        } -      ent->nextRegenTime += 1000 / ( regenRate * modifier ); -    } -    else -    { -      ent->health -= 1; -      ent->nextRegenTime += 1000 / regenRate;      }    } diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 40887cf2..6d04d548 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -148,61 +148,61 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  #define ABUILDER_SPEED              0.7f  #define ABUILDER_VALUE              AVM(200)  #define ABUILDER_HEALTH             AHM(50) -#define ABUILDER_REGEN              2 +#define ABUILDER_REGEN              (0.04f * ABUILDER_HEALTH)  #define ABUILDER_COST               0  #define ABUILDER_UPG_SPEED          0.7f  #define ABUILDER_UPG_VALUE          AVM(250)  #define ABUILDER_UPG_HEALTH         AHM(75) -#define ABUILDER_UPG_REGEN          3 +#define ABUILDER_UPG_REGEN          (0.04f * ABUILDER_UPG_HEALTH)  #define ABUILDER_UPG_COST           0  #define LEVEL0_SPEED                1.4f  #define LEVEL0_VALUE                AVM(150)  #define LEVEL0_HEALTH               AHM(20) -#define LEVEL0_REGEN                1 +#define LEVEL0_REGEN                (0.05f * LEVEL0_HEALTH)  #define LEVEL0_COST                 0  #define LEVEL1_SPEED                1.25f  #define LEVEL1_VALUE                AVM(225)  #define LEVEL1_HEALTH               AHM(60) -#define LEVEL1_REGEN                2 +#define LEVEL1_REGEN                (0.03f * LEVEL1_HEALTH)  #define LEVEL1_COST                 1  #define LEVEL1_UPG_SPEED            1.25f  #define LEVEL1_UPG_VALUE            AVM(275)  #define LEVEL1_UPG_HEALTH           AHM(80) -#define LEVEL1_UPG_REGEN            3 +#define LEVEL1_UPG_REGEN            (0.03f * LEVEL1_UPG_HEALTH)  #define LEVEL1_UPG_COST             1  #define LEVEL2_SPEED                1.2f  #define LEVEL2_VALUE                AVM(350)  #define LEVEL2_HEALTH               AHM(150) -#define LEVEL2_REGEN                4 +#define LEVEL2_REGEN                (0.03f * LEVEL2_HEALTH)  #define LEVEL2_COST                 1  #define LEVEL2_UPG_SPEED            1.2f  #define LEVEL2_UPG_VALUE            AVM(450)  #define LEVEL2_UPG_HEALTH           AHM(175) -#define LEVEL2_UPG_REGEN            5 +#define LEVEL2_UPG_REGEN            (0.03f * LEVEL2_UPG_HEALTH)  #define LEVEL2_UPG_COST             1  #define LEVEL3_SPEED                1.1f  #define LEVEL3_VALUE                AVM(500)  #define LEVEL3_HEALTH               AHM(200) -#define LEVEL3_REGEN                6 +#define LEVEL3_REGEN                (0.03f * LEVEL3_HEALTH)  #define LEVEL3_COST                 1  #define LEVEL3_UPG_SPEED            1.1f  #define LEVEL3_UPG_VALUE            AVM(600)  #define LEVEL3_UPG_HEALTH           AHM(250) -#define LEVEL3_UPG_REGEN            7 +#define LEVEL3_UPG_REGEN            (0.03f * LEVEL3_UPG_HEALTH)  #define LEVEL3_UPG_COST             1  #define LEVEL4_SPEED                1.2f  #define LEVEL4_VALUE                AVM(800)  #define LEVEL4_HEALTH               AHM(350) -#define LEVEL4_REGEN                9 +#define LEVEL4_REGEN                (0.025f * LEVEL4_HEALTH)  #define LEVEL4_COST                 2  /* @@ -345,8 +345,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  #define ALIEN_SPAWN_REPEAT_TIME     10000 -#define ALIEN_REGEN_DAMAGE_TIME     1500 //msec since damage that regen starts again -#define ALIEN_REGEN_NOCREEP_TIME    3000 //msec between regen off creep +#define ALIEN_REGEN_DAMAGE_TIME     2000 //msec since damage that regen starts again +#define ALIEN_REGEN_NOCREEP_MOD     (1.0f/3.0f) //regen off creep  #define ALIEN_MAX_FRAGS             9  #define ALIEN_MAX_CREDITS           (ALIEN_MAX_FRAGS*ALIEN_CREDITS_PER_FRAG)  | 
