General code cleanup from sensor jammer patch to reduce size of said patch.

master
Per Inge Mathisen 2011-09-28 11:35:37 -04:00
parent 554bf6b380
commit 7555473fc3
6 changed files with 12 additions and 28 deletions

View File

@ -42,7 +42,6 @@
#define GetRadius(x) ((x)->sradius)
#define BLIP_ANIM_DURATION 200
#define DEFAULT_COMPONENT_TRANSLUCENCY 128
#define DROID_EMP_SPREAD (20 - rand()%40)
@ -992,9 +991,7 @@ void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *
// multiple turrets display removed the pointless mountRotation
void displayComponentObject(DROID *psDroid)
{
Vector3i position, rotation;
UDWORD tileX,tileY;
MAPTILE *psTile;
Vector3i position, rotation;
Spacetime st = interpolateObjectSpacetime(psDroid, graphicsTime);
leftFirst = angleDelta(player.r.y - st.rot.direction) <= 0;
@ -1051,19 +1048,8 @@ void displayComponentObject(DROID *psDroid)
}
else
{
// make sure it's not over water.
tileX = st.pos.x/TILE_UNITS;
tileY = st.pos.y/TILE_UNITS;
// double check it's on map
if ( tileX < mapWidth && tileY < mapHeight )
{
psTile = mapTile(tileX,tileY);
if (terrainType(psTile) != TER_WATER)
{
int frame = gameTime/BLIP_ANIM_DURATION + psDroid->id % 8192; // de-sync the blip effect, but don't overflow the int
pie_Draw3DShape(getImdFromIndex(MI_BLIP), frame, 0, WZCOL_WHITE, pie_ADDITIVE, psDroid->visible[selectedPlayer] / 2);
}
}
int frame = gameTime/BLIP_ANIM_DURATION + psDroid->id % 8192; // de-sync the blip effect, but don't overflow the int
pie_Draw3DShape(getImdFromIndex(MI_BLIP), frame, 0, WZCOL_WHITE, pie_ADDITIVE, psDroid->visible[selectedPlayer] / 2);
}
pie_MatEnd();
}

View File

@ -39,6 +39,7 @@ UDWORD getResearchRadius(BASE_STATS *Stat);
UDWORD getStructureSizeMax(STRUCTURE *psStructure);
UDWORD getStructureStatSizeMax(STRUCTURE_STATS *Stats);
#define BLIP_ANIM_DURATION (200)
#define OBJECT_RADIUS (128)
#define COMPONENT_RADIUS (64)
#define DESIGN_DROID_SCALE (200)

View File

@ -3491,7 +3491,7 @@ void adjustMaxDesignStats(void)
}
/* Check if an object has a weapon */
bool objHasWeapon(BASE_OBJECT *psObj)
bool objHasWeapon(const BASE_OBJECT *psObj)
{
//check if valid type
@ -3513,7 +3513,7 @@ bool objHasWeapon(BASE_OBJECT *psObj)
return false;
}
SENSOR_STATS *objActiveRadar(BASE_OBJECT *psObj)
SENSOR_STATS *objActiveRadar(const BASE_OBJECT *psObj)
{
SENSOR_STATS *psStats = NULL;
int compIndex;
@ -3542,7 +3542,7 @@ SENSOR_STATS *objActiveRadar(BASE_OBJECT *psObj)
return psStats;
}
bool objRadarDetector(BASE_OBJECT *psObj)
bool objRadarDetector(const BASE_OBJECT *psObj)
{
if (psObj->type == OBJ_STRUCTURE)
{

View File

@ -355,16 +355,16 @@ extern UDWORD getMaxWeaponDamage(void);
extern UDWORD getMaxWeaponROF(void);
extern UDWORD getMaxPropulsionSpeed(void);
extern bool objHasWeapon(BASE_OBJECT *psObj);
extern bool objHasWeapon(const BASE_OBJECT *psObj);
extern void statsInitVars(void);
/* Wrappers */
/** If object is an active radar (has sensor turret), then return a pointer to its sensor stats. If not, return NULL. */
SENSOR_STATS *objActiveRadar(BASE_OBJECT *psObj);
SENSOR_STATS *objActiveRadar(const BASE_OBJECT *psObj);
/** Returns whether object has a radar detector sensor. */
bool objRadarDetector(BASE_OBJECT *psObj);
bool objRadarDetector(const BASE_OBJECT *psObj);
#endif // __INCLUDED_SRC_STATS_H__

View File

@ -167,7 +167,6 @@ static void doWaveTerrain(int sx, int sy, int sz, unsigned radius, int rayPlayer
continue;
}
psTile = mapTile(mapX, mapY);
tileHeight = psTile->height;
perspectiveHeight = (tileHeight - sz) * tiles[i].invRadius;
@ -530,7 +529,7 @@ static void setSeenBy(BASE_OBJECT *psObj, unsigned viewer, int val /*= UBYTE_MAX
}
// Calculate which objects we should know about based on alliances and satellite view.
void processVisibilitySelf(BASE_OBJECT *psObj)
static void processVisibilitySelf(BASE_OBJECT *psObj)
{
int viewer;
@ -554,7 +553,7 @@ void processVisibilitySelf(BASE_OBJECT *psObj)
}
// Calculate which objects we can see. Better to call after processVisibilitySelf, since that check is cheaper.
void processVisibilityVision(BASE_OBJECT *psViewer)
static void processVisibilityVision(BASE_OBJECT *psViewer)
{
BASE_OBJECT *psObj;

View File

@ -55,8 +55,6 @@ extern STRUCTURE* visGetBlockingWall(const BASE_OBJECT* psViewer, const BASE_OBJ
bool hasSharedVision(unsigned viewer, unsigned ally);
extern void processVisibilitySelf(BASE_OBJECT *psObj);
extern void processVisibilityVision(BASE_OBJECT *psViewer);
extern void processVisibilityLevel(BASE_OBJECT *psObj);
extern void processVisibility(void); ///< Calls processVisibilitySelf and processVisibilityVision on all objects.