Remove some dead code in preparation for merging the ECM jammer patches.

master
Per Inge Mathisen 2011-01-15 20:30:01 +01:00
parent 451f9f81a8
commit b8cb7aeef3
5 changed files with 20 additions and 74 deletions

View File

@ -262,14 +262,7 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
// increment the shots counter
psWeap->shotsFired++;
// visibility modifiers
//if (psTarget->visible[psAttacker->player] < VIS_ATTACK_MOD_LEVEL)
if (psTarget->visible[psAttacker->player] == 0) //not sure if this can ever be > 0 here
{
resultHitChance = INVISIBLE_ACCURACY_PENALTY * resultHitChance / 100;
}
//Watermelon:predicted X,Y offset per sec
// predicted X,Y offset per sec
Vector3i predict = psTarget->pos;
//Watermelon:Target prediction

View File

@ -58,7 +58,6 @@ extern DROID_TEMPLATE *apsStaticTemplates; // for AIs and scripts
/* Misc accuracy modifiers */
#define FOM_PARTIAL_ACCURACY_PENALTY 50 // penalty for not being fully able to fire while moving, in %
#define INVISIBLE_ACCURACY_PENALTY 50 // accuracy penalty for the unit firing at a target it can't see, in %
/* Minumum number of droids a commander can control in its group */
#define MIN_CMD_GROUP_DROIDS 6
@ -404,11 +403,6 @@ static inline int droidSensorPower(const DROID* psDroid)
return objSensorPower((const BASE_OBJECT*)psDroid);
}
static inline int droidJammerRange(const DROID* psDroid)
{
return objJammerRange((const BASE_OBJECT*)psDroid);
}
static inline int droidJammerPower(const DROID* psDroid)
{
return objJammerPower((const BASE_OBJECT*)psDroid);

View File

@ -420,11 +420,6 @@ static inline int structSensorPower(const STRUCTURE* psObj)
return objSensorPower((const BASE_OBJECT*)psObj);
}
static inline int structJammerRange(const STRUCTURE* psObj)
{
return objJammerRange((const BASE_OBJECT*)psObj);
}
static inline int structJammerPower(const STRUCTURE* psObj)
{
return objJammerPower((const BASE_OBJECT*)psObj);

View File

@ -101,26 +101,6 @@ void visUpdateLevel(void)
visLevelDecAcc -= visLevelDec;
}
// Adjust power by range
static int adjustPowerByRange(int x1, int y1, int x2, int y2, int range, int power)
{
// Original Pumpkin algorithm cleaned up and put into use
int distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
int rangeSq = range * range;
float mod;
if (rangeSq > 0 && distSq > 0 && power > 0)
{
mod = distSq / rangeSq;
}
else
{
return 0;
}
return power - power * mod;
}
static int visObjHeight(const BASE_OBJECT * psObject)
{
switch (psObject->type)
@ -465,41 +445,30 @@ int visibleObject(const BASE_OBJECT* psViewer, const BASE_OBJECT* psTarget, bool
return 0;
}
int power = adjustPowerByRange(psViewer->pos.x, psViewer->pos.y, psTarget->pos.x, psTarget->pos.y, range, objSensorPower(psViewer));
// initialise the callback variables
VisibleObjectHelp_t help = { true, wallsBlock, psViewer->pos.z + visObjHeight(psViewer), map_coord(removeZ(psTarget->pos)), 0, 0, -UBYTE_MAX * GRAD_MUL * ELEVATION_SCALE, 0, Vector2i(0, 0)};
int targetGrad, top;
// Cast a ray from the viewer to the target
rayCast(psViewer->pos, iAtan2(diff), dist, rayLOSCallback, &help);
if (gWall != NULL && gNumWalls != NULL) // Out globals are set
{
// initialise the callback variables
VisibleObjectHelp_t help = { true, wallsBlock, psViewer->pos.z + visObjHeight(psViewer), map_coord(removeZ(psTarget->pos)), 0, 0, -UBYTE_MAX * GRAD_MUL * ELEVATION_SCALE, 0, Vector2i(0, 0)};
int targetGrad, top;
*gWall = help.wall;
*gNumWalls = help.numWalls;
}
// Cast a ray from the viewer to the target
rayCast(psViewer->pos, iAtan2(diff), dist, rayLOSCallback, &help);
// See if the target can be seen
top = psTarget->pos.z + visObjHeight(psTarget) - help.startHeight;
targetGrad = top * GRAD_MUL / MAX(1, help.lastDist);
if (gWall != NULL && gNumWalls != NULL) // Out globals are set
{
*gWall = help.wall;
*gNumWalls = help.numWalls;
}
// See if the target can be seen
top = psTarget->pos.z + visObjHeight(psTarget) - help.startHeight;
targetGrad = top * GRAD_MUL / MAX(1, help.lastDist);
if (targetGrad >= help.currGrad)
{
if (power > objJammerPower(psTarget))
{
return UBYTE_MAX;
}
else
{
return UBYTE_MAX / 2;
}
}
if (targetGrad >= help.currGrad)
{
return UBYTE_MAX;
}
return 0;
}
// Find the wall that is blocking LOS to a target (if any)
STRUCTURE* visGetBlockingWall(const BASE_OBJECT* psViewer, const BASE_OBJECT* psTarget)
{

View File

@ -77,14 +77,9 @@ static inline int objSensorPower(const BASE_OBJECT* psObj)
return psObj->sensorPower;
}
static inline int objJammerPower(WZ_DECL_UNUSED const BASE_OBJECT* psObj)
static inline int objJammerPower(const BASE_OBJECT* psObj)
{
return 0;
}
static inline int objJammerRange(WZ_DECL_UNUSED const BASE_OBJECT* psObj)
{
return 0;
return psObj->ECMMod;
}
static inline int objConcealment(const BASE_OBJECT* psObj)