Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove unused SWEEP and ERRATIC-DIRECT weapon movement types. Cleanup…

… weapon loading.
  • Loading branch information...
commit 367d2d96fdb48514c377384ce7babaf2aa64540d 1 parent 404df64
@perim perim authored
View
6 data/base/stats/weapons.ini
@@ -3348,7 +3348,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -3392,7 +3392,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -3433,7 +3433,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
View
12 data/mp/stats/weapons.ini
@@ -4584,7 +4584,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = EMP
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -4631,7 +4631,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = HEAT
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ALL ROUNDER"
rotate = 180
maxElevation = 0
@@ -4678,7 +4678,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = HEAT
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -4725,7 +4725,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = HEAT
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -4766,7 +4766,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
@@ -4807,7 +4807,7 @@ flightSpeed = 475
fireOnMove = 1
weaponClass = KINETIC
weaponSubClass = BOMB
-movement = ERRATIC-DIRECT
+movement = DIRECT
weaponEffect = "ARTILLERY ROUND"
rotate = 180
maxElevation = 0
View
6 src/oprint.cpp
@@ -155,12 +155,6 @@ static void printWeaponInfo(const WEAPON_STATS* psStats)
case MM_HOMINGINDIRECT:
pMM = "MM_HOMINGINDIRECT";
break;
- case MM_ERRATICDIRECT:
- pMM = "MM_ERRATICDIRECT";
- break;
- case MM_SWEEP:
- pMM = "MM_SWEEP";
- break;
default:
pMM = "UNKNOWN MOVE MODEL";
break;
View
22 src/projectile.cpp
@@ -740,11 +740,10 @@ static void proj_InFlightFunc(PROJECTILE *psProj)
}
/* Calculate movement vector: */
- int32_t currentDistance;
+ int32_t currentDistance = 0;
switch (psStats->movementModel)
{
case MM_DIRECT: // Go in a straight line.
- case MM_ERRATICDIRECT: // Same as MM_DIRECT, used by bombs for unknown reason.
{
Vector3i delta = psProj->dst - psProj->src;
if (psStats->weaponSubClass == WSC_LAS_SAT)
@@ -831,12 +830,6 @@ static void proj_InFlightFunc(PROJECTILE *psProj)
psProj->rot.pitch = iAtan2(delta.z, targetDistance);
break;
}
- default:
- case MM_SWEEP: // Unused.
- case NUM_MOVEMENT_MODEL: // Unused.
- currentDistance = 1000000;
- ASSERT(false, "Movement model not implemented.");
- break;
}
closestCollisionSpacetime.time = 0xFFFFFFFF;
@@ -1447,28 +1440,19 @@ static void proj_checkPeriodicalDamage(PROJECTILE *psProj)
// return whether a weapon is direct or indirect
bool proj_Direct(const WEAPON_STATS* psStats)
{
- ASSERT(psStats != NULL, "proj_Direct: called with NULL weapon!");
- if (!psStats)
- {
- return true; // arbitrary value in no-debug case
- }
- ASSERT(psStats->movementModel < NUM_MOVEMENT_MODEL, "proj_Direct: invalid weapon stat");
+ ASSERT_OR_RETURN(false, psStats, "Called with NULL weapon");
switch (psStats->movementModel)
{
case MM_DIRECT:
case MM_HOMINGDIRECT:
- case MM_ERRATICDIRECT:
- case MM_SWEEP:
return true;
case MM_INDIRECT:
case MM_HOMINGINDIRECT:
return false;
- case NUM_MOVEMENT_MODEL:
- break; // error checking in assert above; this is for no-debug case
}
- return true; // just to satisfy compiler
+ return false; // just to satisfy compiler
}
/***************************************************************************/
View
57 src/stats.cpp
@@ -619,9 +619,7 @@ static iIMDShape *statsGetIMD(WzConfig &ini, BASE_STATS *psStats, QString key)
bool loadWeaponStats(const char *pFileName)
{
WEAPON_STATS sStats, * const psStats = &sStats;
- UDWORD i, rotate, maxElevation, surfaceToAir;
- SDWORD minElevation;
- UDWORD numAttackRuns;
+ UDWORD i, surfaceToAir;
WzConfig ini(pFileName, WzConfig::ReadOnlyAndRequired);
QStringList list = ini.childGroups();
@@ -661,14 +659,14 @@ bool loadWeaponStats(const char *pFileName)
psStats->periodicalDamageRadius = ini.value("periodicalDamageRadius", 0).toUInt();
psStats->radiusLife = ini.value("radiusLife").toUInt();
psStats->flightSpeed = ini.value("flightSpeed", 1).toUInt();
- rotate = ini.value("rotate").toUInt();
- minElevation = ini.value("minElevation").toInt();
- maxElevation = ini.value("maxElevation").toUInt();
+ psStats->rotate = ini.value("rotate").toUInt();
+ psStats->minElevation = ini.value("minElevation").toInt();
+ psStats->maxElevation = ini.value("maxElevation").toInt();
psStats->recoilValue = ini.value("recoilValue").toUInt();
psStats->minRange = ini.value("minRange", 0).toUInt();
psStats->effectSize = ini.value("effectSize").toUInt();
surfaceToAir = ini.value("surfaceToAir", 0).toUInt();
- numAttackRuns = ini.value("numAttackRuns", 0).toUInt();
+ psStats->vtolAttackRuns = ini.value("numAttackRuns", 0).toUInt();
psStats->designable = ini.value("designable").toBool();
psStats->penetrate = ini.value("penetrate").toBool();
// weapon size limitation
@@ -766,7 +764,6 @@ bool loadWeaponStats(const char *pFileName)
return false;
}
-
// set the face Player value
psStats->facePlayer = ini.value("facePlayer", false).toBool();
@@ -776,33 +773,6 @@ bool loadWeaponStats(const char *pFileName)
//set the light world value
psStats->lightWorld = ini.value("lightWorld", false).toBool();
- //set the rotate angle
- if (rotate > UBYTE_MAX)
- {
- ASSERT(false, "loadWeaponStats: rotate is greater than 255 for weapon %s",
- getStatName(psStats));
- return false;
- }
- psStats->rotate = (UBYTE)rotate;
-
- //set the minElevation
- if (minElevation > SBYTE_MAX || minElevation < SBYTE_MIN)
- {
- ASSERT(false, "loadWeaponStats: minElevation is outside of limits for weapon %s",
- getStatName(psStats));
- return false;
- }
- psStats->minElevation = (SBYTE)minElevation;
-
- //set the maxElevation
- if (maxElevation > UBYTE_MAX)
- {
- ASSERT(false, "loadWeaponStats: maxElevation is outside of limits for weapon %s",
- getStatName(psStats));
- return false;
- }
- psStats->maxElevation = (UBYTE)maxElevation;
-
//set the surfaceAir
if (surfaceToAir > UBYTE_MAX)
{
@@ -823,15 +793,6 @@ bool loadWeaponStats(const char *pFileName)
psStats->surfaceToAir = (UBYTE)(SHOOT_ON_GROUND | SHOOT_IN_AIR);
}
- //set the attackRuns for VTOLs
- if (numAttackRuns > UBYTE_MAX)
- {
- ASSERT(false, "loadWeaponStats: num of attack runs is outside of limits for weapon %s",
- getStatName(psStats));
- return false;
- }
- psStats->vtolAttackRuns = (UBYTE)numAttackRuns;
-
//set the weapon sounds to default value
psStats->iAudioFireID = NO_SOUND;
psStats->iAudioImpactID = NO_SOUND;
@@ -2173,14 +2134,6 @@ bool getMovementModel(const char *movementModel, MOVEMENT_MODEL *model)
{
*model = MM_HOMINGINDIRECT;
}
- else if (strcmp(movementModel, "ERRATIC-DIRECT") == 0)
- {
- *model = MM_ERRATICDIRECT;
- }
- else if (strcmp(movementModel, "SWEEP") == 0)
- {
- *model = MM_SWEEP;
- }
else
{
// We've got problem if we got here
View
13 src/statsdef.h
@@ -312,10 +312,7 @@ enum MOVEMENT_MODEL
MM_DIRECT,
MM_INDIRECT,
MM_HOMINGDIRECT,
- MM_HOMINGINDIRECT,
- MM_ERRATICDIRECT,
- MM_SWEEP,
- NUM_MOVEMENT_MODEL, /** The number of enumerators in this enum. */
+ MM_HOMINGINDIRECT
};
/**
@@ -472,15 +469,15 @@ struct WEAPON_STATS : public COMPONENT_STATS
WEAPON_EFFECT weaponEffect; ///< which type of warhead is associated with the weapon (propulsion/body damage modifier)
WEAPON_SIZE weaponSize; ///< eg light weapons can be put on light bodies or as sidearms
UDWORD recoilValue; ///< used to compare with weight to see if recoils or not
- UBYTE rotate; ///< amount the weapon(turret) can rotate 0 = none
- UBYTE maxElevation; ///< max amount the turret can be elevated up
- SBYTE minElevation; ///< min amount the turret can be elevated down
+ short rotate; ///< amount the weapon(turret) can rotate 0 = none
+ short maxElevation; ///< max amount the turret can be elevated up
+ short minElevation; ///< min amount the turret can be elevated down
UBYTE facePlayer; ///< flag to make the (explosion) effect face the player when drawn
UBYTE faceInFlight; ///< flag to make the inflight effect face the player when drawn
uint16_t effectSize; ///< size of the effect 100 = normal, 50 = half etc
bool lightWorld; ///< flag to indicate whether the effect lights up the world
UBYTE surfaceToAir; ///< indicates how good in the air - SHOOT_ON_GROUND, SHOOT_IN_AIR or both
- UBYTE vtolAttackRuns; ///< number of attack runs a VTOL droid can do with this weapon
+ short vtolAttackRuns; ///< number of attack runs a VTOL droid can do with this weapon
bool penetrate; ///< flag to indicate whether pentrate droid or not
/* Graphics control stats */
Please sign in to comment.
Something went wrong with that request. Please try again.