diff --git a/src/functiondef.h b/src/functiondef.h index 5cfdc56f1..a2d7af667 100644 --- a/src/functiondef.h +++ b/src/functiondef.h @@ -322,7 +322,7 @@ typedef struct _function_upgrade //common stats // FUNCTION_STATS; -// struct _repair_stats* pRepair; /*The repair unit to be upgraded*/ +// struct REPAIR_STATS* pRepair; /*The repair unit to be upgraded*/ // UDWORD repairPoints; /*The percentage to increase the repair points by*/ // UDWORD buildPoints; /*The number of build points required to upgrade // the structure*/ @@ -356,8 +356,8 @@ typedef struct _function_upgrade // //common stats // FUNCTION_STATS; // -// struct _sensor_stats* pSensor; /*The Sensor fitted, if any*/ -// struct _ecm_stats* pECM; /*The ECM fitted, if any*/ +// struct SENSOR_STATS* pSensor; /*The Sensor fitted, if any*/ +// struct ECM_STATS* pECM; /*The ECM fitted, if any*/ // UDWORD weaponCapacity; /*The size of weapon in system points that may // be added. 0 = no weapons can be added*/ //} DEFENSIVE_STRUCTURE_FUNCTION; diff --git a/src/stats-db2.h b/src/stats-db2.h index 15b0b35ab..4da6b4a43 100644 --- a/src/stats-db2.h +++ b/src/stats-db2.h @@ -444,4 +444,298 @@ typedef struct PROPULSION_STATS PROPULSION_TYPE propulsionType; } PROPULSION_STATS; +typedef struct SENSOR_STATS +{ + /* BEGIN of inherited "COMPONENT" definition */ + /* BEGIN of inherited "BASE" definition */ + /** + * Unique ID of the item + */ + UDWORD ref; + + /** + * Unique language independant name that can be used to identify a specific + * stats instance + * + * Unique across all instances + */ + char* pName; + /* END of inherited "BASE" definition */ + /** + * Power required to build this component + */ + UDWORD buildPower; + + /** + * Build points (which are rate-limited in the construction units) required + * to build this component. + */ + UDWORD buildPoints; + + /** + * Weight of this component + */ + UDWORD weight; + + /** + * Body points of this component + */ + UDWORD body; + + /** + * Indicates whether this component is "designable" and can thus be used in + * the design screen. + */ + bool designable; + + /** + * The "base" IMD model representing this component in 3D space. + * + * This field is optional and can be NULL to indicate that it has no value + */ + iIMDShape* pIMD; + /* END of inherited "COMPONENT" definition */ + /** + * Sensor range. + */ + UDWORD range; + + /** + * Sensor power (put against ecm power). + */ + UDWORD power; + + /** + * specifies whether the Sensor is default or for the Turret. + */ + UDWORD location; + + /** + * used for combat + */ + SENSOR_TYPE type; + + /** + * Time delay before the associated weapon droids 'know' where the attack is + * from. + */ + UDWORD time; + + /** + * The turret mount to use. + */ + iIMDShape* pMountGraphic; +} SENSOR_STATS; + +typedef struct ECM_STATS +{ + /* BEGIN of inherited "COMPONENT" definition */ + /* BEGIN of inherited "BASE" definition */ + /** + * Unique ID of the item + */ + UDWORD ref; + + /** + * Unique language independant name that can be used to identify a specific + * stats instance + * + * Unique across all instances + */ + char* pName; + /* END of inherited "BASE" definition */ + /** + * Power required to build this component + */ + UDWORD buildPower; + + /** + * Build points (which are rate-limited in the construction units) required + * to build this component. + */ + UDWORD buildPoints; + + /** + * Weight of this component + */ + UDWORD weight; + + /** + * Body points of this component + */ + UDWORD body; + + /** + * Indicates whether this component is "designable" and can thus be used in + * the design screen. + */ + bool designable; + + /** + * The "base" IMD model representing this component in 3D space. + * + * This field is optional and can be NULL to indicate that it has no value + */ + iIMDShape* pIMD; + /* END of inherited "COMPONENT" definition */ + /** + * ECM range. + */ + UDWORD range; + + /** + * ECM power (put against sensor power). + */ + UDWORD power; + + /** + * Specifies whether the ECM is default or for the Turret. + */ + UDWORD location; + + /** + * The turret mount to use. + */ + iIMDShape* pMountGraphic; +} ECM_STATS; + +typedef struct REPAIR_STATS +{ + /* BEGIN of inherited "COMPONENT" definition */ + /* BEGIN of inherited "BASE" definition */ + /** + * Unique ID of the item + */ + UDWORD ref; + + /** + * Unique language independant name that can be used to identify a specific + * stats instance + * + * Unique across all instances + */ + char* pName; + /* END of inherited "BASE" definition */ + /** + * Power required to build this component + */ + UDWORD buildPower; + + /** + * Build points (which are rate-limited in the construction units) required + * to build this component. + */ + UDWORD buildPoints; + + /** + * Weight of this component + */ + UDWORD weight; + + /** + * Body points of this component + */ + UDWORD body; + + /** + * Indicates whether this component is "designable" and can thus be used in + * the design screen. + */ + bool designable; + + /** + * The "base" IMD model representing this component in 3D space. + * + * This field is optional and can be NULL to indicate that it has no value + */ + iIMDShape* pIMD; + /* END of inherited "COMPONENT" definition */ + /** + * How much damage is restored to Body Points and armour each Repair Cycle. + */ + UDWORD repairPoints; + + /** + * Whether armour can be repaired or not. + */ + bool repairArmour; + + /** + * Specifies whether the Repair is default or for the Turret. + */ + UDWORD location; + + /** + * Time delay for repair cycle. + */ + UDWORD time; + + /** + * The turret mount to use. + */ + iIMDShape* pMountGraphic; +} REPAIR_STATS; + +typedef struct CONSTRUCT_STATS +{ + /* BEGIN of inherited "COMPONENT" definition */ + /* BEGIN of inherited "BASE" definition */ + /** + * Unique ID of the item + */ + UDWORD ref; + + /** + * Unique language independant name that can be used to identify a specific + * stats instance + * + * Unique across all instances + */ + char* pName; + /* END of inherited "BASE" definition */ + /** + * Power required to build this component + */ + UDWORD buildPower; + + /** + * Build points (which are rate-limited in the construction units) required + * to build this component. + */ + UDWORD buildPoints; + + /** + * Weight of this component + */ + UDWORD weight; + + /** + * Body points of this component + */ + UDWORD body; + + /** + * Indicates whether this component is "designable" and can thus be used in + * the design screen. + */ + bool designable; + + /** + * The "base" IMD model representing this component in 3D space. + * + * This field is optional and can be NULL to indicate that it has no value + */ + iIMDShape* pIMD; + /* END of inherited "COMPONENT" definition */ + /** + * The number of points contributed each cycle + */ + UDWORD constructPoints; + + /** + * The turret mount to use + */ + iIMDShape* pMountGraphic; +} CONSTRUCT_STATS; + #endif // __INCLUDED_DB_TEMPLATE_SCHEMA_STRUCTDEF_STATS_DB2_TPL_H__ diff --git a/src/stats-db2.tpl b/src/stats-db2.tpl index de6230059..7d73c8fc0 100644 --- a/src/stats-db2.tpl +++ b/src/stats-db2.tpl @@ -206,6 +206,67 @@ enum SENSOR_TYPE SUPER_SENSOR end; +struct SENSOR + %inherit COMPONENT; + %nomacro; + + # Sensor range. + UDWORD range; + + # Sensor power (put against ecm power). + UDWORD power; + + # specifies whether the Sensor is default or for the Turret. + UDWORD location; + + # used for combat + enum SENSOR_TYPE type; + + # Time delay before the associated weapon droids 'know' where the attack is + # from. + UDWORD time; + + # The turret mount to use. + IMD_model pMountGraphic; +end; + +struct ECM + %inherit COMPONENT; + %nomacro; + + # ECM range. + UDWORD range; + + # ECM power (put against sensor power). + UDWORD power; + + # Specifies whether the ECM is default or for the Turret. + UDWORD location; + + # The turret mount to use. + IMD_model pMountGraphic; +end; + +struct REPAIR + %inherit COMPONENT; + %nomacro; + + # How much damage is restored to Body Points and armour each Repair Cycle. + UDWORD repairPoints; + + # Whether armour can be repaired or not. + bool repairArmour; + + # Specifies whether the Repair is default or for the Turret. + UDWORD location; + + # Time delay for repair cycle. + UDWORD time; + + # The turret mount to use. + IMD_model pMountGraphic; +end; + enum FIREONMOVE %valprefix "FOM_"; @@ -219,6 +280,17 @@ enum FIREONMOVE YES end; +struct CONSTRUCT + %inherit COMPONENT; + %nomacro; + + # The number of points contributed each cycle + UDWORD constructPoints; + + # The turret mount to use + IMD_model pMountGraphic; +end; + enum TRAVEL_MEDIUM %valprefix ""; diff --git a/src/stats.c b/src/stats.c index ed9ff0996..d3ec3309c 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1346,7 +1346,7 @@ BOOL loadRepairStats(const char *pRepairData, UDWORD bufferSize) { const unsigned int NumRepair = numCR(pRepairData, bufferSize); REPAIR_STATS sStats, * const psStats = &sStats; - unsigned int i = 0, designable; + unsigned int i = 0, designable, repairArmour; char RepairName[MAX_STR_LENGTH], dummy[MAX_STR_LENGTH], GfxFile[MAX_STR_LENGTH], mountGfx[MAX_STR_LENGTH], location[MAX_STR_LENGTH]; @@ -1371,7 +1371,7 @@ BOOL loadRepairStats(const char *pRepairData, UDWORD bufferSize) %[^','],%[^','],%d,%d,%d", (char*)&RepairName, (char*)&dummy, &psStats->buildPower,&psStats->buildPoints, &psStats->weight, &dummyVal, &dummyVal, - &psStats->repairArmour, (char*)&location, (char*)&GfxFile, (char*)&mountGfx, + &repairArmour, (char*)&location, (char*)&GfxFile, (char*)&mountGfx, &psStats->repairPoints, &psStats->time,&designable); if (!allocateStatName((BASE_STATS *)psStats, RepairName)) @@ -1407,6 +1407,8 @@ BOOL loadRepairStats(const char *pRepairData, UDWORD bufferSize) psStats->time = 1; } + psStats->repairArmour = (repairArmour != 0); + //set design flag psStats->designable = (designable != 0); diff --git a/src/statsdef.h b/src/statsdef.h index 3b0bb7e14..308563988 100644 --- a/src/statsdef.h +++ b/src/statsdef.h @@ -68,42 +68,6 @@ typedef struct _brain_stats struct _weapon_stats* psWeaponStat; ///< weapon stats associated with this brain - for Command Droids } BRAIN_STATS; -typedef struct _sensor_stats -{ - /* Common stats */ - STATS_COMPONENT; - - UDWORD range; ///< Sensor range - UDWORD power; ///< Sensor power (put against ecm power) - UDWORD location; ///< specifies whether the Sensor is default or for the Turret - SENSOR_TYPE type; ///< used for combat - UDWORD time; ///< time delay before associated weapon droids 'know' where the attack is from - iIMDShape* pMountGraphic; ///< The turret mount to use -} SENSOR_STATS; - -typedef struct _ecm_stats -{ - /* Common stats */ - STATS_COMPONENT; - - UDWORD range; ///< ECM range - UDWORD power; ///< ECM power (put against sensor power) - UDWORD location; ///< specifies whether the ECM is default or for the Turret - iIMDShape* pMountGraphic; ///< The turret mount to use -} ECM_STATS; - -typedef struct _repair_stats -{ - /* Common stats */ - STATS_COMPONENT; - - UDWORD repairPoints; ///< How much damage is restored to Body Points and armour each Repair Cycle - BOOL repairArmour; ///< whether armour can be repaired or not - UDWORD location; ///< specifies whether the Repair is default or for the Turret - UDWORD time; ///< time delay for repair cycle - iIMDShape* pMountGraphic; ///< The turret mount to use -} REPAIR_STATS; - typedef struct _weapon_stats { /* Common stats */ @@ -163,15 +127,6 @@ typedef struct _weapon_stats SDWORD iAudioImpactID; } WEAPON_STATS; -typedef struct _construct_stats -{ - /* Common stats */ - STATS_COMPONENT; - - UDWORD constructPoints; ///< The number of points contributed each cycle - iIMDShape* pMountGraphic; ///< The turret mount to use -} CONSTRUCT_STATS; - /************************************************************************************ * Additional stats tables ************************************************************************************/ diff --git a/src/structuredef.h b/src/structuredef.h index 7180ff1a6..446ea2862 100644 --- a/src/structuredef.h +++ b/src/structuredef.h @@ -148,9 +148,9 @@ typedef struct _structure_stats UDWORD sizeModifier; /*The larger the target, the easier to hit*/ iIMDShape *pIMD; /*The IMD to draw for this structure */ iIMDShape *pBaseIMD; /*The base IMD to draw for this structure */ - struct _ecm_stats *pECM; /*Which ECM is standard for the structure - + struct ECM_STATS *pECM; /*Which ECM is standard for the structure - if any*/ - struct _sensor_stats *pSensor; /*Which Sensor is standard for the structure - + struct SENSOR_STATS *pSensor; /*Which Sensor is standard for the structure - if any*/ UDWORD weaponSlots; /*Number of weapons that can be attached to the building*/