* Get rid of enumerator INVALID_SUBCLASS from WEAPON_SUBCLASS
* Modify getWeaponSubClass's API so that we don't need to depend on enum WEAPON_SUBCLASS containing an "invalid" enumerator * Move enums WEAPON_CLASS and WEAPON_SUBCLASS from statsdef.h to stats-db2.tpl * Rename NUM_WEAPON_CLASS and NUM_WEAPON_SUBCLASS to WC_NUM_WEAPON_CLASSES and WSC_NUM_WEAPON_SUBCLASSES respectively git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5488 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
136c2b245e
commit
2ae0d61f00
|
@ -75,7 +75,7 @@ typedef enum _object_type
|
||||||
SDWORD sensorPower; /**< Active sensor power */ \
|
SDWORD sensorPower; /**< Active sensor power */ \
|
||||||
SDWORD sensorRange; /**< Range of sensor */ \
|
SDWORD sensorRange; /**< Range of sensor */ \
|
||||||
SDWORD ECMMod; /**< Ability to conceal oneself from sensors */ \
|
SDWORD ECMMod; /**< Ability to conceal oneself from sensors */ \
|
||||||
UDWORD armour[NUM_HIT_SIDES][NUM_WEAPON_CLASS]
|
UDWORD armour[NUM_HIT_SIDES][WC_NUM_WEAPON_CLASSES]
|
||||||
|
|
||||||
#define NEXTOBJ(pointerType) \
|
#define NEXTOBJ(pointerType) \
|
||||||
pointerType *psNext /**< Pointer to the next object in the list */
|
pointerType *psNext /**< Pointer to the next object in the list */
|
||||||
|
|
|
@ -2995,7 +2995,7 @@ DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD player,
|
||||||
|
|
||||||
if (cyborgDroid(psDroid))
|
if (cyborgDroid(psDroid))
|
||||||
{
|
{
|
||||||
for (inc = 0; inc < NUM_WEAPON_CLASS; inc++)
|
for (inc = 0; inc < WC_NUM_WEAPON_CLASSES; inc++)
|
||||||
{
|
{
|
||||||
for (impact_side = 0;impact_side < NUM_HIT_SIDES;impact_side=impact_side+1)
|
for (impact_side = 0;impact_side < NUM_HIT_SIDES;impact_side=impact_side+1)
|
||||||
{
|
{
|
||||||
|
@ -3006,7 +3006,7 @@ DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD player,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (inc = 0; inc < NUM_WEAPON_CLASS; inc++)
|
for (inc = 0; inc < WC_NUM_WEAPON_CLASSES; inc++)
|
||||||
{
|
{
|
||||||
for (impact_side = 0;impact_side < NUM_HIT_SIDES;impact_side=impact_side+1)
|
for (impact_side = 0;impact_side < NUM_HIT_SIDES;impact_side=impact_side+1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -334,7 +334,7 @@ FEATURE * buildFeature(FEATURE_STATS *psStats, UDWORD x, UDWORD y,BOOL FromSave)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < NUM_WEAPON_CLASS; j++)
|
for (j = 0; j < WC_NUM_WEAPON_CLASSES; j++)
|
||||||
{
|
{
|
||||||
psFeature->armour[i][j] = psFeature->psStats->armourValue;
|
psFeature->armour[i][j] = psFeature->psStats->armourValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -612,8 +612,7 @@ static BOOL loadWeaponUpgradeFunction(const char *pData)
|
||||||
//allocate storage for the name
|
//allocate storage for the name
|
||||||
storeName((FUNCTION *)psFunction, functionName);
|
storeName((FUNCTION *)psFunction, functionName);
|
||||||
|
|
||||||
psFunction->subClass = getWeaponSubClass(weaponSubClass);
|
if (!getWeaponSubClass(weaponSubClass, &psFunction->subClass))
|
||||||
if (psFunction->subClass == INVALID_SUBCLASS)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1058,7 @@ void structureArmourUpgrade(FUNCTION *pFunction, STRUCTURE *psBuilding)
|
||||||
// TODO: support advanced armour system
|
// TODO: support advanced armour system
|
||||||
for (i = 0; i < NUM_HIT_SIDES; i++)
|
for (i = 0; i < NUM_HIT_SIDES; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < NUM_WEAPON_CLASS; j++)
|
for (j = 0; j < WC_NUM_WEAPON_CLASSES; j++)
|
||||||
{
|
{
|
||||||
psBuilding->armour[i][j] = (UWORD)((psBuilding->armour[i][j] * newBaseArmour) / prevBaseArmour);
|
psBuilding->armour[i][j] = (UWORD)((psBuilding->armour[i][j] * newBaseArmour) / prevBaseArmour);
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1424,7 @@ void bodyUpgrade(FUNCTION *pFunction, UBYTE player)
|
||||||
asBodyUpgrade[player][DROID_BODY_UPGRADE].body =
|
asBodyUpgrade[player][DROID_BODY_UPGRADE].body =
|
||||||
pUpgrade->body;
|
pUpgrade->body;
|
||||||
}
|
}
|
||||||
for (inc=0; inc < NUM_WEAPON_CLASS; inc++)
|
for (inc=0; inc < WC_NUM_WEAPON_CLASSES; inc++)
|
||||||
{
|
{
|
||||||
if (asBodyUpgrade[player][DROID_BODY_UPGRADE].armourValue[inc] <
|
if (asBodyUpgrade[player][DROID_BODY_UPGRADE].armourValue[inc] <
|
||||||
pUpgrade->armourValue[inc])
|
pUpgrade->armourValue[inc])
|
||||||
|
@ -1449,7 +1448,7 @@ void bodyUpgrade(FUNCTION *pFunction, UBYTE player)
|
||||||
asBodyUpgrade[player][CYBORG_BODY_UPGRADE].body =
|
asBodyUpgrade[player][CYBORG_BODY_UPGRADE].body =
|
||||||
pUpgrade->body;
|
pUpgrade->body;
|
||||||
}
|
}
|
||||||
for (inc=0; inc < NUM_WEAPON_CLASS; inc++)
|
for (inc=0; inc < WC_NUM_WEAPON_CLASSES; inc++)
|
||||||
{
|
{
|
||||||
if (asBodyUpgrade[player][CYBORG_BODY_UPGRADE].armourValue[inc] <
|
if (asBodyUpgrade[player][CYBORG_BODY_UPGRADE].armourValue[inc] <
|
||||||
pUpgrade->armourValue[inc])
|
pUpgrade->armourValue[inc])
|
||||||
|
|
|
@ -240,7 +240,7 @@ typedef struct _droidBody_upgrade_function
|
||||||
{
|
{
|
||||||
UPGRADE_FUNCTION_STATS;
|
UPGRADE_FUNCTION_STATS;
|
||||||
UWORD body; //The % to increase the whole vehicle body points by*/
|
UWORD body; //The % to increase the whole vehicle body points by*/
|
||||||
UWORD armourValue[NUM_WEAPON_CLASS];
|
UWORD armourValue[WC_NUM_WEAPON_CLASSES];
|
||||||
UBYTE cyborg; //flag to specify the upgrade is valid for cyborgs
|
UBYTE cyborg; //flag to specify the upgrade is valid for cyborgs
|
||||||
UBYTE droid; /*flag to specify the upgrade is valid
|
UBYTE droid; /*flag to specify the upgrade is valid
|
||||||
for droids (non cyborgs!)*/
|
for droids (non cyborgs!)*/
|
||||||
|
|
|
@ -2379,7 +2379,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
||||||
memset(asReArmUpgrade, 0, MAX_PLAYERS * sizeof(REARM_UPGRADE));
|
memset(asReArmUpgrade, 0, MAX_PLAYERS * sizeof(REARM_UPGRADE));
|
||||||
|
|
||||||
//initialise the upgrade structures
|
//initialise the upgrade structures
|
||||||
memset(asWeaponUpgrade, 0, MAX_PLAYERS * NUM_WEAPON_SUBCLASS * sizeof(WEAPON_UPGRADE));
|
memset(asWeaponUpgrade, 0, MAX_PLAYERS * WSC_NUM_WEAPON_SUBCLASSES * sizeof(WEAPON_UPGRADE));
|
||||||
memset(asSensorUpgrade, 0, MAX_PLAYERS * sizeof(SENSOR_UPGRADE));
|
memset(asSensorUpgrade, 0, MAX_PLAYERS * sizeof(SENSOR_UPGRADE));
|
||||||
memset(asECMUpgrade, 0, MAX_PLAYERS * sizeof(ECM_UPGRADE));
|
memset(asECMUpgrade, 0, MAX_PLAYERS * sizeof(ECM_UPGRADE));
|
||||||
memset(asRepairUpgrade, 0, MAX_PLAYERS * sizeof(REPAIR_UPGRADE));
|
memset(asRepairUpgrade, 0, MAX_PLAYERS * sizeof(REPAIR_UPGRADE));
|
||||||
|
|
|
@ -351,7 +351,7 @@ static void objectStatTagged(BASE_OBJECT *psObj, int body, int resistance)
|
||||||
|
|
||||||
tagWriteEnter(0x03, 1);
|
tagWriteEnter(0x03, 1);
|
||||||
tagWrite(0x01, body);
|
tagWrite(0x01, body);
|
||||||
tagWrite(0x02, NUM_WEAPON_CLASS);
|
tagWrite(0x02, WC_NUM_WEAPON_CLASSES);
|
||||||
tagWriteEnter(0x03, NUM_HIT_SIDES);
|
tagWriteEnter(0x03, NUM_HIT_SIDES);
|
||||||
for (i = 0; i < NUM_HIT_SIDES; i++)
|
for (i = 0; i < NUM_HIT_SIDES; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -694,7 +694,7 @@ static void proj_InFlightDirectFunc(PROJECTILE *psProj)
|
||||||
distanceExtensionFactor = 1.5f;
|
distanceExtensionFactor = 1.5f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// NUM_WEAPON_SUBCLASS and INVALID_SUBCLASS
|
// WSC_NUM_WEAPON_SUBCLASSES
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,8 +551,7 @@ static bool _loadWeaponStats(WEAPON_STATS* stats, SQL_WEAPON_STATS* cols, sqlite
|
||||||
}
|
}
|
||||||
|
|
||||||
// weaponSubClass TEXT NOT NULL, -- the subclass to which the weapon belongs
|
// weaponSubClass TEXT NOT NULL, -- the subclass to which the weapon belongs
|
||||||
stats->weaponSubClass = getWeaponSubClass((const char*)sqlite3_column_text(stmt, cols->weaponSubClass));
|
if (!getWeaponSubClass((const char*)sqlite3_column_text(stmt, cols->weaponSubClass), &stats->weaponSubClass))
|
||||||
if (stats->weaponSubClass == INVALID_SUBCLASS)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,88 @@ typedef enum BODY_SIZE
|
||||||
SIZE_SUPER_HEAVY,
|
SIZE_SUPER_HEAVY,
|
||||||
} BODY_SIZE;
|
} BODY_SIZE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* only using KINETIC and HEAT for now
|
||||||
|
*/
|
||||||
|
typedef enum WEAPON_CLASS
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bullets, etc.
|
||||||
|
*/
|
||||||
|
WC_KINETIC,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rockets, etc. - classed as KINETIC now to save space in DROID
|
||||||
|
*EXPLOSIVE
|
||||||
|
* Laser, etc.
|
||||||
|
*/
|
||||||
|
WC_HEAT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of enumerators in this enum.
|
||||||
|
*/
|
||||||
|
WC_NUM_WEAPON_CLASSES,
|
||||||
|
} WEAPON_CLASS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* weapon subclasses used to define which weapons are affected by weapon upgrade
|
||||||
|
* functions
|
||||||
|
*
|
||||||
|
* Watermelon:added a new subclass to do some tests
|
||||||
|
*/
|
||||||
|
typedef enum WEAPON_SUBCLASS
|
||||||
|
{
|
||||||
|
WSC_MGUN,
|
||||||
|
|
||||||
|
WSC_CANNON,
|
||||||
|
|
||||||
|
/**
|
||||||
|
*ARTILLARY
|
||||||
|
*/
|
||||||
|
WSC_MORTARS,
|
||||||
|
|
||||||
|
WSC_MISSILE,
|
||||||
|
|
||||||
|
WSC_ROCKET,
|
||||||
|
|
||||||
|
WSC_ENERGY,
|
||||||
|
|
||||||
|
WSC_GAUSS,
|
||||||
|
|
||||||
|
WSC_FLAME,
|
||||||
|
|
||||||
|
/**
|
||||||
|
*CLOSECOMBAT
|
||||||
|
*/
|
||||||
|
WSC_HOWITZERS,
|
||||||
|
|
||||||
|
WSC_ELECTRONIC,
|
||||||
|
|
||||||
|
WSC_AAGUN,
|
||||||
|
|
||||||
|
WSC_SLOWMISSILE,
|
||||||
|
|
||||||
|
WSC_SLOWROCKET,
|
||||||
|
|
||||||
|
WSC_LAS_SAT,
|
||||||
|
|
||||||
|
WSC_BOMB,
|
||||||
|
|
||||||
|
WSC_COMMAND,
|
||||||
|
|
||||||
|
WSC_EMP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counter missile
|
||||||
|
*/
|
||||||
|
WSC_COUNTER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of enumerators in this enum.
|
||||||
|
*/
|
||||||
|
WSC_NUM_WEAPON_SUBCLASSES,
|
||||||
|
} WEAPON_SUBCLASS;
|
||||||
|
|
||||||
typedef enum PROPULSION_TYPE
|
typedef enum PROPULSION_TYPE
|
||||||
{
|
{
|
||||||
PROPULSION_TYPE_WHEELED,
|
PROPULSION_TYPE_WHEELED,
|
||||||
|
|
|
@ -31,6 +31,56 @@ enum BODY_SIZE
|
||||||
SUPER_HEAVY
|
SUPER_HEAVY
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
# only using KINETIC and HEAT for now
|
||||||
|
enum WEAPON_CLASS
|
||||||
|
%max "NUM_WEAPON_CLASSES";
|
||||||
|
%valprefix "WC_";
|
||||||
|
|
||||||
|
# Bullets, etc.
|
||||||
|
KINETIC
|
||||||
|
|
||||||
|
# Rockets, etc. - classed as KINETIC now to save space in DROID
|
||||||
|
#EXPLOSIVE
|
||||||
|
|
||||||
|
# Laser, etc.
|
||||||
|
HEAT
|
||||||
|
|
||||||
|
# others we haven't thought of! - classed as HEAT now to save space in DROID
|
||||||
|
#WC_MISC, ///<
|
||||||
|
end;
|
||||||
|
|
||||||
|
# weapon subclasses used to define which weapons are affected by weapon upgrade
|
||||||
|
# functions
|
||||||
|
#
|
||||||
|
# Watermelon:added a new subclass to do some tests
|
||||||
|
enum WEAPON_SUBCLASS
|
||||||
|
%max "NUM_WEAPON_SUBCLASSES";
|
||||||
|
%valprefix "WSC_";
|
||||||
|
|
||||||
|
MGUN
|
||||||
|
CANNON
|
||||||
|
#ARTILLARY
|
||||||
|
MORTARS
|
||||||
|
MISSILE
|
||||||
|
ROCKET
|
||||||
|
ENERGY
|
||||||
|
GAUSS
|
||||||
|
FLAME
|
||||||
|
#CLOSECOMBAT
|
||||||
|
HOWITZERS
|
||||||
|
ELECTRONIC
|
||||||
|
AAGUN
|
||||||
|
SLOWMISSILE
|
||||||
|
SLOWROCKET
|
||||||
|
LAS_SAT
|
||||||
|
BOMB
|
||||||
|
COMMAND
|
||||||
|
EMP
|
||||||
|
|
||||||
|
# Counter missile
|
||||||
|
COUNTER
|
||||||
|
end;
|
||||||
|
|
||||||
enum PROPULSION_TYPE
|
enum PROPULSION_TYPE
|
||||||
%max "NUM";
|
%max "NUM";
|
||||||
WHEELED
|
WHEELED
|
||||||
|
|
86
src/stats.c
86
src/stats.c
|
@ -56,7 +56,7 @@ static SPECIAL_ABILITY *asSpecialAbility;
|
||||||
WEAPON_MODIFIER asWeaponModifier[WE_NUMEFFECTS][PROPULSION_TYPE_NUM];
|
WEAPON_MODIFIER asWeaponModifier[WE_NUMEFFECTS][PROPULSION_TYPE_NUM];
|
||||||
|
|
||||||
//used to hold the current upgrade level per player per weapon subclass
|
//used to hold the current upgrade level per player per weapon subclass
|
||||||
WEAPON_UPGRADE asWeaponUpgrade[MAX_PLAYERS][NUM_WEAPON_SUBCLASS];
|
WEAPON_UPGRADE asWeaponUpgrade[MAX_PLAYERS][WSC_NUM_WEAPON_SUBCLASSES];
|
||||||
SENSOR_UPGRADE asSensorUpgrade[MAX_PLAYERS];
|
SENSOR_UPGRADE asSensorUpgrade[MAX_PLAYERS];
|
||||||
ECM_UPGRADE asECMUpgrade[MAX_PLAYERS];
|
ECM_UPGRADE asECMUpgrade[MAX_PLAYERS];
|
||||||
REPAIR_UPGRADE asRepairUpgrade[MAX_PLAYERS];
|
REPAIR_UPGRADE asRepairUpgrade[MAX_PLAYERS];
|
||||||
|
@ -187,7 +187,7 @@ void statsInitVars(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialise the upgrade structures
|
//initialise the upgrade structures
|
||||||
memset(asWeaponUpgrade, 0, MAX_PLAYERS * NUM_WEAPON_SUBCLASS * sizeof(WEAPON_UPGRADE));
|
memset(asWeaponUpgrade, 0, MAX_PLAYERS * WSC_NUM_WEAPON_SUBCLASSES * sizeof(WEAPON_UPGRADE));
|
||||||
memset(asSensorUpgrade, 0, MAX_PLAYERS * sizeof(SENSOR_UPGRADE));
|
memset(asSensorUpgrade, 0, MAX_PLAYERS * sizeof(SENSOR_UPGRADE));
|
||||||
memset(asECMUpgrade, 0, MAX_PLAYERS * sizeof(ECM_UPGRADE));
|
memset(asECMUpgrade, 0, MAX_PLAYERS * sizeof(ECM_UPGRADE));
|
||||||
memset(asRepairUpgrade, 0, MAX_PLAYERS * sizeof(REPAIR_UPGRADE));
|
memset(asRepairUpgrade, 0, MAX_PLAYERS * sizeof(REPAIR_UPGRADE));
|
||||||
|
@ -577,8 +577,7 @@ BOOL loadWeaponStats(const char *pWeaponData, UDWORD bufferSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the subClass
|
//set the subClass
|
||||||
psStats->weaponSubClass = getWeaponSubClass(weaponSubClass);
|
if (!getWeaponSubClass(weaponSubClass, &psStats->weaponSubClass))
|
||||||
if (psStats->weaponSubClass == INVALID_SUBCLASS)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2666,80 +2665,83 @@ BOOL getBodySize(const char *pSize, UBYTE *pStore)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*returns the weapon sub class based on the string name passed in */
|
/*returns the weapon sub class based on the string name passed in */
|
||||||
WEAPON_SUBCLASS getWeaponSubClass(const char *pSubClass)
|
bool getWeaponSubClass(const char* subClass, WEAPON_SUBCLASS* wclass)
|
||||||
{
|
{
|
||||||
if (!strcmp(pSubClass, "CANNON"))
|
if (strcmp(subClass, "CANNON") == 0)
|
||||||
{
|
{
|
||||||
return WSC_CANNON;
|
*wclass = WSC_CANNON;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "MORTARS"))
|
else if (strcmp(subClass, "MORTARS") == 0)
|
||||||
{
|
{
|
||||||
return WSC_MORTARS;
|
*wclass = WSC_MORTARS;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "MISSILE"))
|
else if (strcmp(subClass, "MISSILE") == 0)
|
||||||
{
|
{
|
||||||
return WSC_MISSILE;
|
*wclass = WSC_MISSILE;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "ROCKET"))
|
else if (strcmp(subClass, "ROCKET") == 0)
|
||||||
{
|
{
|
||||||
return WSC_ROCKET;
|
*wclass = WSC_ROCKET;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "ENERGY"))
|
else if (strcmp(subClass, "ENERGY") == 0)
|
||||||
{
|
{
|
||||||
return WSC_ENERGY;
|
*wclass = WSC_ENERGY;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "GAUSS"))
|
else if (strcmp(subClass, "GAUSS") == 0)
|
||||||
{
|
{
|
||||||
return WSC_GAUSS;
|
*wclass = WSC_GAUSS;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "FLAME"))
|
else if (strcmp(subClass, "FLAME") == 0)
|
||||||
{
|
{
|
||||||
return WSC_FLAME;
|
*wclass = WSC_FLAME;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "HOWITZERS"))
|
else if (strcmp(subClass, "HOWITZERS") == 0)
|
||||||
{
|
{
|
||||||
return WSC_HOWITZERS;
|
*wclass = WSC_HOWITZERS;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "MACHINE GUN"))
|
else if (strcmp(subClass, "MACHINE GUN") == 0)
|
||||||
{
|
{
|
||||||
return WSC_MGUN;
|
*wclass = WSC_MGUN;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "ELECTRONIC"))
|
else if (strcmp(subClass, "ELECTRONIC") == 0)
|
||||||
{
|
{
|
||||||
return WSC_ELECTRONIC;
|
*wclass = WSC_ELECTRONIC;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "A-A GUN"))
|
else if (strcmp(subClass, "A-A GUN") == 0)
|
||||||
{
|
{
|
||||||
return WSC_AAGUN;
|
*wclass = WSC_AAGUN;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "SLOW MISSILE"))
|
else if (strcmp(subClass, "SLOW MISSILE") == 0)
|
||||||
{
|
{
|
||||||
return WSC_SLOWMISSILE;
|
*wclass = WSC_SLOWMISSILE;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "SLOW ROCKET"))
|
else if (strcmp(subClass, "SLOW ROCKET") == 0)
|
||||||
{
|
{
|
||||||
return WSC_SLOWROCKET;
|
*wclass = WSC_SLOWROCKET;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "LAS_SAT"))
|
else if (strcmp(subClass, "LAS_SAT") == 0)
|
||||||
{
|
{
|
||||||
return WSC_LAS_SAT;
|
*wclass = WSC_LAS_SAT;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "BOMB"))
|
else if (strcmp(subClass, "BOMB") == 0)
|
||||||
{
|
{
|
||||||
return WSC_BOMB;
|
*wclass = WSC_BOMB;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "COMMAND"))
|
else if (strcmp(subClass, "COMMAND") == 0)
|
||||||
{
|
{
|
||||||
return WSC_COMMAND;
|
*wclass = WSC_COMMAND;
|
||||||
}
|
}
|
||||||
if (!strcmp(pSubClass, "EMP"))
|
else if (strcmp(subClass, "EMP") == 0)
|
||||||
{
|
{
|
||||||
return WSC_EMP;
|
*wclass = WSC_EMP;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT(!"Invalid weapon sub class", "Invalid weapon sub class: %s", subClass);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//problem if we've got to here
|
return true;
|
||||||
ASSERT( false, "Invalid weapon sub class - %s", pSubClass );
|
|
||||||
return INVALID_SUBCLASS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*returns the movement model based on the string name passed in */
|
/*returns the movement model based on the string name passed in */
|
||||||
|
|
|
@ -45,7 +45,7 @@ extern PROPULSION_TYPES *asPropulsionTypes;
|
||||||
extern WEAPON_MODIFIER asWeaponModifier[WE_NUMEFFECTS][PROPULSION_TYPE_NUM];
|
extern WEAPON_MODIFIER asWeaponModifier[WE_NUMEFFECTS][PROPULSION_TYPE_NUM];
|
||||||
|
|
||||||
//used to hold the current upgrade level per player per weapon subclass
|
//used to hold the current upgrade level per player per weapon subclass
|
||||||
extern WEAPON_UPGRADE asWeaponUpgrade[MAX_PLAYERS][NUM_WEAPON_SUBCLASS];
|
extern WEAPON_UPGRADE asWeaponUpgrade[MAX_PLAYERS][WSC_NUM_WEAPON_SUBCLASSES];
|
||||||
extern SENSOR_UPGRADE asSensorUpgrade[MAX_PLAYERS];
|
extern SENSOR_UPGRADE asSensorUpgrade[MAX_PLAYERS];
|
||||||
extern ECM_UPGRADE asECMUpgrade[MAX_PLAYERS];
|
extern ECM_UPGRADE asECMUpgrade[MAX_PLAYERS];
|
||||||
extern REPAIR_UPGRADE asRepairUpgrade[MAX_PLAYERS];
|
extern REPAIR_UPGRADE asRepairUpgrade[MAX_PLAYERS];
|
||||||
|
@ -265,7 +265,7 @@ extern SDWORD getCompFromName(UDWORD compType, const char *pName);
|
||||||
//get the component Inc for a stat based on the Resource name held in Names.txt
|
//get the component Inc for a stat based on the Resource name held in Names.txt
|
||||||
extern SDWORD getCompFromResName(UDWORD compType, const char *pName);
|
extern SDWORD getCompFromResName(UDWORD compType, const char *pName);
|
||||||
/*returns the weapon sub class based on the string name passed in */
|
/*returns the weapon sub class based on the string name passed in */
|
||||||
extern WEAPON_SUBCLASS getWeaponSubClass(const char *pSubClass);
|
extern bool getWeaponSubClass(const char* subClass, WEAPON_SUBCLASS* wclass);
|
||||||
/*either gets the name associated with the resource (if one) or allocates space and copies pName*/
|
/*either gets the name associated with the resource (if one) or allocates space and copies pName*/
|
||||||
extern BOOL allocateName(char **ppStore, const char *pName);
|
extern BOOL allocateName(char **ppStore, const char *pName);
|
||||||
//converts the name read in from Access into the name which is used in the Stat lists (or ignores it)
|
//converts the name read in from Access into the name which is used in the Stat lists (or ignores it)
|
||||||
|
|
|
@ -62,47 +62,6 @@ typedef struct _comp_base_stats
|
||||||
COMPONENT_STATS;
|
COMPONENT_STATS;
|
||||||
} COMP_BASE_STATS;
|
} COMP_BASE_STATS;
|
||||||
|
|
||||||
//only using KINETIC and HEAT for now
|
|
||||||
typedef enum _weapon_class
|
|
||||||
{
|
|
||||||
WC_KINETIC, ///< bullets etc
|
|
||||||
//WC_EXPLOSIVE, ///< rockets etc - classed as WC_KINETIC now to save space in DROID
|
|
||||||
WC_HEAT, ///< laser etc
|
|
||||||
//WC_MISC, ///< others we haven't thought of! - classed as WC_HEAT now to save space in DROID
|
|
||||||
|
|
||||||
NUM_WEAPON_CLASS
|
|
||||||
} WEAPON_CLASS;
|
|
||||||
|
|
||||||
// weapon subclasses used to define which weapons are affected by weapon upgrade functions
|
|
||||||
// Watermelon:added a new subclass to do some tests
|
|
||||||
typedef enum _weapon_subclass
|
|
||||||
{
|
|
||||||
WSC_MGUN,
|
|
||||||
WSC_CANNON,
|
|
||||||
//WSC_ARTILLARY,
|
|
||||||
WSC_MORTARS,
|
|
||||||
WSC_MISSILE,
|
|
||||||
WSC_ROCKET,
|
|
||||||
WSC_ENERGY,
|
|
||||||
WSC_GAUSS,
|
|
||||||
WSC_FLAME,
|
|
||||||
//WSC_CLOSECOMBAT,
|
|
||||||
WSC_HOWITZERS,
|
|
||||||
WSC_ELECTRONIC,
|
|
||||||
WSC_AAGUN,
|
|
||||||
WSC_SLOWMISSILE,
|
|
||||||
WSC_SLOWROCKET,
|
|
||||||
WSC_LAS_SAT,
|
|
||||||
WSC_BOMB,
|
|
||||||
WSC_COMMAND,
|
|
||||||
WSC_EMP,
|
|
||||||
WSC_COUNTER, // Counter missile
|
|
||||||
|
|
||||||
NUM_WEAPON_SUBCLASS,
|
|
||||||
|
|
||||||
INVALID_SUBCLASS
|
|
||||||
} WEAPON_SUBCLASS;
|
|
||||||
|
|
||||||
// used to define which projectile model to use for the weapon
|
// used to define which projectile model to use for the weapon
|
||||||
typedef enum _movement_model
|
typedef enum _movement_model
|
||||||
{
|
{
|
||||||
|
@ -162,7 +121,7 @@ typedef struct _body_stats
|
||||||
|
|
||||||
UBYTE size; ///< How big the body is - affects how hit
|
UBYTE size; ///< How big the body is - affects how hit
|
||||||
UDWORD weaponSlots; ///< The number of weapon slots on the body
|
UDWORD weaponSlots; ///< The number of weapon slots on the body
|
||||||
UDWORD armourValue[NUM_HIT_SIDES][NUM_WEAPON_CLASS]; ///< A measure of how much protection the armour provides. Cross referenced with the weapon types.
|
UDWORD armourValue[NUM_HIT_SIDES][WC_NUM_WEAPON_CLASSES]; ///< A measure of how much protection the armour provides. Cross referenced with the weapon types.
|
||||||
|
|
||||||
// A measure of how much energy the power plant outputs
|
// A measure of how much energy the power plant outputs
|
||||||
UDWORD powerOutput; ///< this is the engine output of the body
|
UDWORD powerOutput; ///< this is the engine output of the body
|
||||||
|
@ -382,7 +341,7 @@ typedef struct _body_upgrade
|
||||||
{
|
{
|
||||||
UWORD powerOutput;
|
UWORD powerOutput;
|
||||||
UWORD body;
|
UWORD body;
|
||||||
UWORD armourValue[NUM_WEAPON_CLASS];
|
UWORD armourValue[WC_NUM_WEAPON_CLASSES];
|
||||||
} BODY_UPGRADE;
|
} BODY_UPGRADE;
|
||||||
|
|
||||||
#endif // __INCLUDED_STATSDEF_H__
|
#endif // __INCLUDED_STATSDEF_H__
|
||||||
|
|
|
@ -1773,7 +1773,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < NUM_WEAPON_CLASS; j++)
|
for (j = 0; j < WC_NUM_WEAPON_CLASSES; j++)
|
||||||
{
|
{
|
||||||
psBuilding->armour[i][j] = (UWORD)structureArmour(pStructureType, (UBYTE)player);
|
psBuilding->armour[i][j] = (UWORD)structureArmour(pStructureType, (UBYTE)player);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue