diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/bg_misc.c | 177 | ||||
| -rw-r--r-- | src/game/bg_public.h | 19 | ||||
| -rw-r--r-- | src/game/g_buildable.c | 125 | ||||
| -rw-r--r-- | src/game/g_cmds.c | 48 | ||||
| -rw-r--r-- | src/game/g_local.h | 3 | ||||
| -rw-r--r-- | src/game/g_main.c | 8 | 
6 files changed, 309 insertions, 71 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index f2b132a8..71df0fe3 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -31,6 +31,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      100,                   //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -60,6 +61,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -89,6 +91,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -118,6 +121,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -147,6 +151,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -176,6 +181,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float     bounce;      0,                     //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -205,6 +211,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t  traj;      0.0,                   //float     bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -234,6 +241,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      100,                   //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -263,6 +271,37 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      100,                   //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages +    1000,                  //int       health; +    50,                    //int       damage; +    50,                    //int       splashDamage; +    150,                   //int       splashRadius; +    MOD_HSPAWN,            //int       meansOfDeath; +    BIT_HUMANS,            //int       team; +    ( 1 << WP_HBUILD )|( 1 << WP_HBUILD2 ),    //weapon_t  buildWeapon; +    BANIM_IDLE1,           //int       idleAnim; +    100,                   //int       nextthink; +    0,                     //int       turretFireSpeed; +    0,                     //int       turretRange; +    WP_NONE,               //weapon_t  turretProjType; +    0.707f,                //float     minNormal; +    qfalse,                //qboolean  invertNormal; +    qfalse,                //qboolean  creepTest; +    0,                     //int       creepSize; +    qfalse                 //qboolean  reactorTest; +  }, +  { +    BA_H_ADVMEDISTAT,      //int       buildNum; +    "advmedistat",         //char      *buildName; +    "Adv Medistation",     //char      *humanName; +    "team_human_advmedistat",//char      *entityName; +    { "models/buildables/medistat/medistat.md3", 0, 0, 0 }, +    { -65, -65, -7 },      //vec3_t    mins; +    { 65, 65, 7 },         //vec3_t    maxs; +    TR_GRAVITY,            //trType_t traj; +    0.0,                   //float        bounce; +    100,                   //int       buildPoints; +    ( 1 << S3 ),           //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -292,6 +331,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -323,6 +363,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -352,6 +393,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      80,                    //int       buildPoints; +    ( 1 << S3 ),           //int  stages      1000,                  //int       health;      50,                    //int       damage;      20,                    //int       splashDamage; @@ -381,6 +423,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      200,                   //int       buildPoints; +    ( 1 << S3 ),           //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -410,6 +453,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      200,                   //int       buildPoints; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -439,6 +483,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      200,                   //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -468,6 +513,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      0,                     //int       buildPoints; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -497,6 +543,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_GRAVITY,            //trType_t traj;      0.0,                   //float        bounce;      10,                    //int       buildPoints; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      1000,                  //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -526,6 +573,7 @@ buildableAttributes_t bg_buildableList[ ] =      TR_BUOYANCY,           //trType_t traj;      0.2,                   //float        bounce;      10,                    //int       buildPoints; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      100,                   //int       health;      50,                    //int       damage;      50,                    //int       splashDamage; @@ -754,6 +802,29 @@ int BG_FindBuildPointsForBuildable( int bclass )  /*  ============== +BG_FindStagesForBuildable +============== +*/ +qboolean BG_FindStagesForBuildable( int bclass, stage_t stage ) +{ +  int i; + +  for( i = 0; i < bg_numBuildables; i++ ) +  { +    if( bg_buildableList[ i ].buildNum == bclass ) +    { +      if( bg_buildableList[ i ].stages & ( 1 << stage ) ) +        return qtrue; +      else +        return qfalse; +    } +  } +   +  return qfalse; +} + +/* +==============  BG_FindHealthForBuildable  ==============  */ @@ -1102,6 +1173,7 @@ classAttributes_t bg_classList[ ] =      "Builder",                                      //char    *humanName;      "lucy",                                         //char    *modelname;      "default",                                      //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -20 },                              //vec3_t  mins;      { 15, 15, 20 },                                 //vec3_t  maxs;      { 15, 15, 20 },                                 //vec3_t  crouchmaxs; @@ -1127,6 +1199,7 @@ classAttributes_t bg_classList[ ] =      "Advanced Builder",                             //char    *humanname;      "lucy",                                         //char    *modelname;      "angel",                                        //char    *skinname; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      { -20, -20, -20 },                              //vec3_t  mins;      { 20, 20, 20 },                                 //vec3_t  maxs;      { 20, 20, 20 },                                 //vec3_t  crouchmaxs; @@ -1152,6 +1225,7 @@ classAttributes_t bg_classList[ ] =      "Offensive",                                                //char    *humanname;      "klesk",                                                    //char    *modelname;      "default",                                                  //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -15 },                                          //vec3_t  mins;      { 15, 15, 15 },                                             //vec3_t  maxs;      { 15, 15, 15 },                                             //vec3_t  crouchmaxs; @@ -1177,6 +1251,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 1",                          //char    *humanname;      "anarki",                                     //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -24, -24, -24 },                            //vec3_t  mins;      { 24, 24, 24 },                               //vec3_t  maxs;      { 24, 24, 24 },                               //vec3_t  crouchmaxs; @@ -1202,6 +1277,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 1 Upgrade",                  //char    *humanname;      "anarki",                                     //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -24, -24, -24 },                            //vec3_t  mins;      { 24, 24, 24 },                               //vec3_t  maxs;      { 24, 24, 24 },                               //vec3_t  crouchmaxs; @@ -1227,6 +1303,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 2",                          //char    *humanname;      "bones",                                      //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -24, -24, -24 },                            //vec3_t  mins;      { 24, 24, 24 },                               //vec3_t  maxs;      { 24, 24, 24 },                               //vec3_t  crouchmaxs; @@ -1252,6 +1329,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 2 Upgrade",                  //char    *humanname;      "bones",                                      //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -24, -24, -24 },                            //vec3_t  mins;      { 24, 24, 24 },                               //vec3_t  maxs;      { 24, 24, 24 },                               //vec3_t  crouchmaxs; @@ -1277,6 +1355,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 3",                          //char    *humanname;      "orbb",                                       //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -15 },                            //vec3_t  mins;      { 15, 15, 15 },                               //vec3_t  maxs;      { 15, 15, 15 },                               //vec3_t  crouchmaxs; @@ -1302,6 +1381,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 3 Upgrade",                  //char    *humanname;      "orbb",                                       //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -15 },                            //vec3_t  mins;      { 15, 15, 15 },                               //vec3_t  maxs;      { 15, 15, 15 },                               //vec3_t  crouchmaxs; @@ -1327,6 +1407,7 @@ classAttributes_t bg_classList[ ] =      "Offensive Level 4",                          //char    *humanname;      "xaero",                                      //char    *modelname;      "default",                                    //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -15 },                            //vec3_t  mins;      { 15, 15, 15 },                               //vec3_t  maxs;      { 15, 15, 15 },                               //vec3_t  crouchmaxs; @@ -1352,6 +1433,7 @@ classAttributes_t bg_classList[ ] =      "Human",                                    //char    *humanname;      "sarge",                                    //char    *modelname;      "default",                                  //char    *skinname; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      { -15, -15, -24 },                          //vec3_t  mins;      { 15, 15, 32 },                             //vec3_t  maxs;      { 15, 15, 16 },                             //vec3_t  crouchmaxs; @@ -1361,7 +1443,7 @@ classAttributes_t bg_classList[ ] =      100,                                        //int     health;      0,                                          //int     armor;      SCA_TAKESFALLDAMAGE|SCA_CANJUMP,            //int     abilities; -    80.0f,                                      //float   buildDist; +    110.0f,                                     //float   buildDist;      90,                                         //int     fov;      0.002f,                                     //float   bob;      200,                                        //int     steptime; @@ -1453,6 +1535,29 @@ char *BG_FindModelNameForClass( int pclass )  /*  ============== +BG_FindStagesForClass +============== +*/ +qboolean BG_FindStagesForClass( int pclass, stage_t stage ) +{ +  int i; + +  for( i = 0; i < bg_numPclasses; i++ ) +  { +    if( bg_classList[ i ].classNum == pclass ) +    { +      if( bg_classList[ i ].stages & ( 1 << stage ) ) +        return qtrue; +      else +        return qfalse; +    } +  } +   +  return qfalse; +} + +/* +==============  BG_FindBBoxForClass  ==============  */ @@ -1786,6 +1891,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_MACHINEGUN,        //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "rifle",              //char      *weaponName;      "Rifle",              //char      *weaponHumanName; @@ -1804,6 +1910,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_FLAMER,            //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "flamer",             //char      *weaponName;      "Flame Thrower",      //char      *weaponHumanName; @@ -1822,6 +1929,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_CHAINGUN,          //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "chaingun",           //char      *weaponName;      "Chaingun",           //char      *weaponHumanName; @@ -1840,6 +1948,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_MASS_DRIVER,       //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "mdriver",            //char      *weaponName;      "Mass Driver",        //char      *weaponHumanName; @@ -1858,6 +1967,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_PULSE_RIFLE,       //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "prifle",             //char      *weaponName;      "Pulse Rifle",        //char      *weaponHumanName; @@ -1876,6 +1986,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_HBUILD,            //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "ckit",               //char      *weaponName;      "Construction Kit",   //char      *weaponHumanName; @@ -1894,6 +2005,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_HBUILD2,           //int       weaponNum;      100,                  //int       price; +    ( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "ackit",              //char      *weaponName;      "Adv Construction Kit",//char      *weaponHumanName; @@ -1912,6 +2024,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_ABUILD,            //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "dbuild",             //char      *weaponName;      "Alien build weapon", //char      *weaponHumanName; @@ -1930,6 +2043,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_ABUILD2,           //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "dbuild2",            //char      *weaponName;      "Alien build weapon2",//char      *weaponHumanName; @@ -1948,6 +2062,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_VENOM,             //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "venom",              //char      *weaponName;      "Venom",              //char      *weaponHumanName; @@ -1966,6 +2081,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_GRABANDCSAW,       //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "grabandcsaw",        //char      *weaponName;      "Circular Saw",       //char      *weaponHumanName; @@ -1984,6 +2100,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_POUNCE,            //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "pounce",             //char      *weaponName;      "Claw and pounce",    //char      *weaponHumanName; @@ -2002,6 +2119,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_LOCKBLOB_LAUNCHER, //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "lockblob",           //char      *weaponName;      "Lock Blob",          //char      *weaponHumanName; @@ -2020,6 +2138,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_TESLAGEN,          //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "teslagen",           //char      *weaponName;      "Tesla Generator",    //char      *weaponHumanName; @@ -2038,6 +2157,7 @@ weaponAttributes_t bg_weapons[ ] =    {      WP_PLASMAGUN,         //int       weaponNum;      100,                  //int       price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_WEAPON,          //int       slots;      "plasmagun",          //char      *weaponName;      "Plasma Gun",         //char      *weaponHumanName; @@ -2079,6 +2199,29 @@ int BG_FindPriceForWeapon( int weapon )  /*  ============== +BG_FindStagesForWeapon +============== +*/ +qboolean BG_FindStagesForWeapon( int weapon, stage_t stage ) +{ +  int i; + +  for( i = 0; i < bg_numWeapons; i++ ) +  { +    if( bg_weapons[ i ].weaponNum == weapon ) +    { +      if( bg_weapons[ i ].stages & ( 1 << stage ) ) +        return qtrue; +      else +        return qfalse; +    } +  } +   +  return qfalse; +} + +/* +==============  BG_FindSlotsForWeapon  ==============  */ @@ -2345,6 +2488,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_TORCH,               //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_NONE,              //int   slots;      "torch",                //char  *upgradeName;      "Torch",                //char  *upgradeHumanName; @@ -2354,6 +2498,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_NVG,                 //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_HEAD,              //int   slots;      "nvg",                  //char  *upgradeName;      "NVG",                  //char  *upgradeHumanName; @@ -2363,6 +2508,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_CHESTARMOUR,         //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_TORSO,             //int   slots;      "carmour",              //char  *upgradeName;      "Chest Armour",         //char  *upgradeHumanName; @@ -2372,6 +2518,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_LIMBARMOUR,          //int   upgradeNum;              100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_ARMS|SLOT_LEGS,    //int   slots;      "larmour",              //char  *upgradeName;      "Limb Armour",          //char  *upgradeHumanName; @@ -2381,6 +2528,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_HELMET,              //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_HEAD,              //int   slots;      "helmet",               //char  *upgradeName;      "Helmet",               //char  *upgradeHumanName; @@ -2390,6 +2538,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_ANTITOXIN,           //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_NONE,              //int   slots;      "atoxin",               //char  *upgradeName;      "Anti-toxin",           //char  *upgradeHumanName; @@ -2399,6 +2548,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_BATTPACK,            //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_BACKPACK,          //int   slots;      "battpack",             //char  *upgradeName;      "Battery Pack",         //char  *upgradeHumanName; @@ -2408,6 +2558,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_JETPACK,             //int   upgradeNum;      100,                    //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_BACKPACK,          //int   slots;      "jetpack",              //char  *upgradeName;      "Jet Pack",             //char  *upgradeHumanName; @@ -2417,6 +2568,7 @@ upgradeAttributes_t bg_upgrades[ ] =    {      UP_BATTLESUIT,                            //int   upgradeNum;      100,                                      //int   price; +    ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages      SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS, //int   slots;      "bsuit",                                  //char  *upgradeName;      "Battlesuit",                             //char  *upgradeHumanName; @@ -2449,6 +2601,29 @@ int BG_FindPriceForUpgrade( int upgrade )  /*  ============== +BG_FindStagesForUpgrade +============== +*/ +qboolean BG_FindStagesForUpgrade( int upgrade, stage_t stage ) +{ +  int i; + +  for( i = 0; i < bg_numUpgrades; i++ ) +  { +    if( bg_upgrades[ i ].upgradeNum == upgrade ) +    { +      if( bg_upgrades[ i ].stages & ( 1 << stage ) ) +        return qtrue; +      else +        return qfalse; +    } +  } +   +  return qfalse; +} + +/* +==============  BG_FindSlotsForUpgrade  ==============  */ diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 03b13f95..551b6bbd 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -80,6 +80,7 @@  //TA: extra stuff:  #define CS_BUILDPOINTS      28 +#define CS_STAGES           29  #define CS_MODELS           33  #define CS_SOUNDS           (CS_MODELS+MAX_MODELS) @@ -409,6 +410,7 @@ typedef enum    BA_H_MCU,    BA_H_DCC,    BA_H_MEDISTAT, +  BA_H_ADVMEDISTAT,    BA_H_BANK,    BA_H_REACTOR, @@ -822,6 +824,8 @@ typedef struct    char    *modelName;    char    *skinName; +  int     stages; +      vec3_t  mins;    vec3_t  maxs;    vec3_t  crouchMaxs; @@ -849,6 +853,14 @@ typedef struct    int     value;  } classAttributes_t; +//stages +typedef enum +{ +  S1, +  S2, +  S3 +} stage_t; +  //TA: buildable item record  typedef struct  { @@ -867,6 +879,7 @@ typedef struct    float     bounce;    int       buildPoints; +  int       stages;    int       health; @@ -902,6 +915,7 @@ typedef struct    int       weaponNum;    int       price; +  int       stages;    int       slots; @@ -932,6 +946,7 @@ typedef struct    int       upgradeNum;    int       price; +  int       stages;    int       slots; @@ -955,6 +970,7 @@ int       BG_FindHealthForBuildable( int bclass );  trType_t  BG_FindTrajectoryForBuildable( int bclass );  float     BG_FindBounceForBuildable( int bclass );  int       BG_FindBuildPointsForBuildable( int bclass ); +qboolean  BG_FindStagesForBuildable( int bclass, stage_t stage );  int       BG_FindDamageForBuildable( int bclass );  int       BG_FindSplashDamageForBuildable( int bclass );  int       BG_FindSplashRadiusForBuildable( int bclass ); @@ -976,6 +992,7 @@ int       BG_FindClassNumForName( char *name );  char      *BG_FindNameForClassNum( int pclass );  char      *BG_FindHumanNameForClassNum( int pclass );  char      *BG_FindModelNameForClass( int pclass ); +qboolean  BG_FindStagesForClass( int pclass, stage_t stage );  void      BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs );  void      BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight );  int       BG_FindHealthForClass( int pclass ); @@ -992,6 +1009,7 @@ int       BG_FindEvolveTimeForClass( int pclass );  int       BG_FindValueOfClass( int pclass );  int       BG_FindPriceForWeapon( int weapon ); +qboolean  BG_FindStagesForWeapon( int weapon, stage_t stage );  int       BG_FindSlotsForWeapon( int weapon );  char      *BG_FindNameForWeapon( int weapon );  int       BG_FindWeaponNumForName( char *name ); @@ -1007,6 +1025,7 @@ qboolean  BG_FindPurchasableForWeapon( int weapon );  WUTeam_t  BG_FindTeamForWeapon( int weapon );  int       BG_FindPriceForUpgrade( int upgrade ); +qboolean  BG_FindStagesForUpgrade( int upgrade, stage_t stage );  int       BG_FindSlotsForUpgrade( int upgrade );  char      *BG_FindNameForUpgrade( int upgrade );  int       BG_FindUpgradeNumForName( char *name ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index a0ded01d..0a8557ae 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -51,7 +51,7 @@ findPower  attempt to find power for self, return qtrue if successful  ================  */ -qboolean findPower( gentity_t *self ) +static qboolean findPower( gentity_t *self )  {    int       i;    gentity_t *ent; @@ -62,7 +62,7 @@ qboolean findPower( gentity_t *self )    qboolean  foundPower = qfalse;    //if this already has power then stop now -  if( self->parentNode && self->parentNode->active ) +  if( self->parentNode && self->parentNode->powered )      return qtrue;    //reset parent @@ -79,7 +79,7 @@ qboolean findPower( gentity_t *self )      {        VectorSubtract( self->s.origin, ent->s.origin, temp_v );        distance = VectorLength( temp_v ); -      if( distance < minDistance && ( ent->active || self->s.modelindex == BA_H_SPAWN ) ) +      if( distance < minDistance && ent->powered )        {          closestPower = ent;          minDistance = distance; @@ -94,11 +94,8 @@ qboolean findPower( gentity_t *self )    //bleh    if( ( closestPower->s.modelindex == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) ||  -      ( closestPower->s.modelindex == BA_H_REPEATER && self->s.modelindex == BA_H_SPAWN && -        ( minDistance <= REPEATER_BASESIZE ) && closestPower->powered ) ||        ( closestPower->s.modelindex == BA_H_REPEATER && ( minDistance <= REPEATER_BASESIZE ) && -        closestPower->active && closestPower->powered ) -    ) +        closestPower->powered ) )    {      self->parentNode = closestPower; @@ -110,12 +107,29 @@ qboolean findPower( gentity_t *self )  /*  ================ +isPower + +simple wrapper to findPower to check if a location has power +================ +*/ +static qboolean isPower( vec3_t origin ) +{ +  gentity_t dummy; + +  dummy.parentNode = NULL; +  VectorCopy( origin, dummy.s.origin ); + +  return findPower( &dummy ); +} + +/* +================  findDCC  attempt to find a controlling DCC for self, return qtrue if successful  ================  */ -qboolean findDCC( gentity_t *self ) +static qboolean findDCC( gentity_t *self )  {    int       i;    gentity_t *ent; @@ -168,7 +182,7 @@ findCreep  attempt to find creep for self, return qtrue if successful  ================  */ -qboolean findCreep( gentity_t *self ) +static qboolean findCreep( gentity_t *self )  {    int       i;    gentity_t *ent; @@ -191,7 +205,6 @@ qboolean findCreep( gentity_t *self )        if( ent->s.modelindex == BA_A_SPAWN || ent->s.modelindex == BA_A_HIVEMIND )        { -        /*VectorSubtract( self->s.origin, ent->s.origin, temp_v );*/          VectorSubtract( self->s.origin, ent->s.origin, temp_v );          distance = VectorLength( temp_v );          if( distance < minDistance ) @@ -217,6 +230,23 @@ qboolean findCreep( gentity_t *self )  /*  ================ +isCreep + +simple wrapper to findCreep to check if a location has creep +================ +*/ +static qboolean isCreep( vec3_t origin ) +{ +  gentity_t dummy; + +  dummy.parentNode = NULL; +  VectorCopy( origin, dummy.s.origin ); + +  return findCreep( &dummy ); +} + +/* +================  nullDieFunction  hack to prevent compilers complaining about function pointer -> NULL conversion @@ -895,7 +925,6 @@ Think for human power repeater  void HRpt_Think( gentity_t *self )  {    int       i; -  int       count = 0;    qboolean  reactor = qfalse;    gentity_t *ent; @@ -905,19 +934,10 @@ void HRpt_Think( gentity_t *self )      if( !ent->classname || ent->s.eType != ET_BUILDABLE )        continue; -    if( ent->s.modelindex == BA_H_SPAWN && ent->parentNode == self ) -      count++; -            if( ent->s.modelindex == BA_H_REACTOR )        reactor = qtrue;    } -  //if repeater has children and there is a reactor then this is active -  if( count && reactor ) -    self->active = qtrue; -  else -    self->active = qfalse; -    self->powered = reactor;    self->nextthink = level.time + REFRESH_TIME; @@ -1033,15 +1053,14 @@ void HDCC_Think( gentity_t *self )  //================================================================================== - - -#define MAX_HEAL_CLIENTS  1 +#define MAX_MEDISTAT_CLIENTS    1 +#define MAX_ADVMEDISTAT_CLIENTS 3  /*  ================  HMedistat_Think -think function for Alien Acid Tube +think function for Human Medistation  ================  */  void HMedistat_Think( gentity_t *self ) @@ -1051,7 +1070,8 @@ void HMedistat_Think( gentity_t *self )    int       i, num;    gentity_t *player;    int       healCount = 0; - +  int       maxclients; +      VectorAdd( self->s.origin, self->r.maxs, maxs );    VectorAdd( self->s.origin, self->r.mins, mins ); @@ -1065,6 +1085,11 @@ void HMedistat_Think( gentity_t *self )    if( self->active )      G_setIdleBuildableAnim( self, BANIM_IDLE2 ); +  if( self->s.modelindex == BA_H_ADVMEDISTAT ) +    maxclients = MAX_ADVMEDISTAT_CLIENTS; +  else +    maxclients = MAX_MEDISTAT_CLIENTS; +      //do some healage    num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );    for( i = 0; i < num; i++ ) @@ -1073,7 +1098,8 @@ void HMedistat_Think( gentity_t *self )      if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )      { -      if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && healCount < MAX_HEAL_CLIENTS ) +      if( player->health < player->client->ps.stats[ STAT_MAX_HEALTH ] && +          healCount < maxclients )        {          healCount++;          player->health++; @@ -1711,6 +1737,14 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance      if( !( normal[ 2 ] >= minNormal || ( invert && normal[ 2 ] <= -minNormal ) ) )        return IBE_NORMAL; +    //check there is creep near by for building on +     +    if( BG_FindCreepTestForBuildable( buildable ) ) +    { +      if( !isCreep( entity_origin ) ) +        reason = IBE_NOCREEP; +    } +          //look for a hivemind      for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )      { @@ -1751,39 +1785,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance    else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )    {      //human criteria - -    closestPower = g_entities + 1; //FIXME -     -    //find the nearest power entity -    for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) -    { -      if( !tempent->classname || tempent->s.eType != ET_BUILDABLE ) -        continue; -         -      if( tempent->s.modelindex == BA_H_REACTOR || tempent->s.modelindex == BA_H_REPEATER ) -      { -        VectorSubtract( entity_origin, tempent->s.origin, temp_v ); -        templength = VectorLength( temp_v ); -        if( templength < minDistance && ( tempent->active || buildable == BA_H_SPAWN ) ) -        { -          closestPower = tempent; -          minDistance = templength; -        } -      } -    } -     -    //if this power entity satisfies expression -    if( !( -           ( closestPower->s.modelindex == BA_H_REACTOR && minDistance <= REACTOR_BASESIZE ) ||  -           ( -             closestPower->s.modelindex == BA_H_REPEATER && minDistance <= REPEATER_BASESIZE && -             ( -               ( buildable == BA_H_SPAWN && closestPower->powered ) || -               ( closestPower->powered && closestPower->active ) -             ) -           ) -         ) -      ) +    if( !isPower( entity_origin ) )      {        //tell player to build a repeater to provide power        if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER ) @@ -1948,6 +1950,11 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin        built->die = HSpawn_Die;        break; +    case BA_H_ADVMEDISTAT: +      built->think = HMedistat_Think; +      built->die = HSpawn_Die; +      break; +            case BA_H_REACTOR:        built->die = HSpawn_Die;        built->powered = built->active = qtrue; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index d8239549..e61fa353 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1573,7 +1573,7 @@ void Cmd_Class_f( gentity_t *ent )        !( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) )    {      //if we are not currently spectating, we are attempting evolution -    if( ent->client->pers.pclass != PCL_NONE ) +    if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE )      {        for ( i = 1, body = g_entities + i; i < level.num_entities; i++, body++ )        { @@ -1593,15 +1593,16 @@ void Cmd_Class_f( gentity_t *ent )        {          ent->client->pers.pclass = BG_FindClassNumForName( s ); -        //...check we can evolve to that class -        if( !BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], -                                      ent->client->pers.pclass ) ) +        if( ent->client->pers.pclass == PCL_NONE )          { -          trap_SendServerCommand( ent-g_entities, va("print \"You cannot evolve from your current class\n\"" ) ); +          trap_SendServerCommand( ent-g_entities, va("print \"Unknown class\n\"" ) );            return;          } - -        if( ent->client->pers.pclass != PCL_NONE ) +         +        //...check we can evolve to that class +        if( BG_ClassCanEvolveFromTo( ent->client->ps.stats[ STAT_PCLASS ], +                                     ent->client->pers.pclass ) || +            BG_FindStagesForClass( ent->client->pers.pclass, g_alienStage.integer ) )          {            //prevent lerping            ent->client->ps.eFlags ^= EF_TELEPORT_BIT; @@ -1627,7 +1628,8 @@ void Cmd_Class_f( gentity_t *ent )          }          else          { -          trap_SendServerCommand( ent-g_entities, va("print \"Unknown class\n\"" ) ); +          ent->client->pers.pclass = PCL_NONE; +          trap_SendServerCommand( ent-g_entities, va("print \"You cannot evolve from your current class\n\"" ) );            return;          }        } @@ -1641,7 +1643,8 @@ void Cmd_Class_f( gentity_t *ent )        {          for( i = 0; i < NUM_AC; i++ )          { -          if( allowedClasses[ i ] == ent->client->pers.pclass ) +          if( allowedClasses[ i ] == ent->client->pers.pclass && +              BG_FindStagesForClass( ent->client->pers.pclass, g_alienStage.integer ) )            {              ent->client->sess.sessionTeam = TEAM_FREE;              ClientUserinfoChanged( clientNum ); @@ -1663,7 +1666,7 @@ void Cmd_Class_f( gentity_t *ent )    else if( ent->client->pers.pteam == PTE_HUMANS )    {      //humans cannot use this command whilst alive -    if( ent->client->pers.pclass != PCL_NONE ) +    if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE )      {        trap_SendServerCommand( ent-g_entities, va("print \"You must be dead to use the class command\n\"" ) );        return; @@ -1678,6 +1681,7 @@ void Cmd_Class_f( gentity_t *ent )        ent->client->pers.pitem = WP_HBUILD;      else      { +      ent->client->pers.pclass = PCL_NONE;        trap_SendServerCommand( ent-g_entities, va("print \"Unknown starting item\n\"" ) );        return;      } @@ -1888,6 +1892,13 @@ void Cmd_Buy_f( gentity_t *ent )        return;      } +    //are we /allowed/ to buy this? +    if( !BG_FindStagesForWeapon( weapon, g_humanStage.integer ) ) +    { +      trap_SendServerCommand( ent-g_entities, va("print \"You can't buy this item\n\"" ) ); +      return; +    } +          //add to inventory      BG_packWeapon( weapon, ent->client->ps.stats );      BG_FindAmmoForWeapon( weapon, &quan, &clips, &maxClips ); @@ -1921,6 +1932,20 @@ void Cmd_Buy_f( gentity_t *ent )        return;      } +    if( BG_FindTeamForUpgrade( upgrade ) != WUT_HUMANS ) +    { +      //shouldn't need a fancy dialog +      trap_SendServerCommand( ent-g_entities, va("print \"You can't buy alien items\n\"" ) ); +      return; +    } +     +    //are we /allowed/ to buy this? +    if( !BG_FindStagesForUpgrade( upgrade, g_humanStage.integer ) ) +    { +      trap_SendServerCommand( ent-g_entities, va("print \"You can't buy this item\n\"" ) ); +      return; +    } +          //add to inventory      BG_packItem( upgrade, ent->client->ps.stats ); @@ -2139,7 +2164,8 @@ void Cmd_Build_f( gentity_t *ent )    if( buildable != BA_NONE &&        ( 1 << ent->client->ps.weapon ) & BG_FindBuildWeaponForBuildable( buildable ) &&        !( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) && -      !( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) ) +      !( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) && +      BG_FindStagesForBuildable( buildable, g_humanStage.integer ) )    {      dist = BG_FindBuildDistForClass( ent->client->ps.stats[ STAT_PCLASS ] ); diff --git a/src/game/g_local.h b/src/game/g_local.h index e9d35984..b4d71604 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -543,6 +543,7 @@ typedef enum    IBE_RPTWARN,    IBE_NOPOWER,    IBE_NORMAL, +  IBE_NOCREEP,    IBE_MAXERRORS  } itemBuildError_t; @@ -853,6 +854,8 @@ extern  vmCvar_t  g_singlePlayer;  extern  vmCvar_t  g_humanBuildPoints;  extern  vmCvar_t  g_alienBuildPoints; +extern  vmCvar_t  g_humanStage; +extern  vmCvar_t  g_alienStage;  void  trap_Printf( const char *fmt );  void  trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index c8f5d3b4..8d9a46b0 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -78,6 +78,8 @@ vmCvar_t  g_listEntity;  //TA  vmCvar_t  g_humanBuildPoints;  vmCvar_t  g_alienBuildPoints; +vmCvar_t  g_humanStage; +vmCvar_t  g_alienStage;  static cvarTable_t   gameCvarTable[] = {    // don't override the cheat state set by the system @@ -149,6 +151,8 @@ static cvarTable_t   gameCvarTable[] = {    { &g_humanBuildPoints, "g_humanBuildPoints", "1000", 0, 0, qfalse  },    { &g_alienBuildPoints, "g_alienBuildPoints", "1000", 0, 0, qfalse  }, +  { &g_humanStage, "g_humanStage", "0", 0, 0, qfalse  }, +  { &g_alienStage, "g_alienStage", "0", 0, 0, qfalse  },    { &g_rankings, "g_rankings", "0", 0, 0, qfalse}  }; @@ -835,6 +839,10 @@ void calculateBuildPoints( void )                                                level.humanBuildPoints,                                                localHTP,                                                level.humanBuildPointsPowered ) ); + +  //may as well pump the stages here too +  trap_SetConfigstring( CS_STAGES, va( "%d %d", +        g_alienStage.integer, g_humanStage.integer ) );  }  | 
