Some simplifications and cleanup

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6607 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2009-02-09 21:53:40 +00:00
parent d1780335ee
commit f1ae7b9620
2 changed files with 120 additions and 125 deletions

View File

@ -183,7 +183,6 @@ static UDWORD missCount;
static UDWORD skipped,skippedEffects,letThrough; static UDWORD skipped,skippedEffects,letThrough;
static UDWORD auxVar; // dirty filthy hack - don't look for what this does.... //FIXME static UDWORD auxVar; // dirty filthy hack - don't look for what this does.... //FIXME
static UDWORD auxVarSec; // dirty filthy hack - don't look for what this does.... //FIXME static UDWORD auxVarSec; // dirty filthy hack - don't look for what this does.... //FIXME
static UDWORD aeCalls;
static UDWORD specifiedSize; static UDWORD specifiedSize;
static UDWORD ellSpec; static UDWORD ellSpec;
@ -214,6 +213,7 @@ static void renderWaypointEffect ( EFFECT *psEffect );
static void renderBloodEffect ( EFFECT *psEffect ); static void renderBloodEffect ( EFFECT *psEffect );
static void renderDestructionEffect ( EFFECT *psEffect ); static void renderDestructionEffect ( EFFECT *psEffect );
static void renderFirework ( EFFECT *psEffect ); static void renderFirework ( EFFECT *psEffect );
static void positionEffect(EFFECT *psEffect); static void positionEffect(EFFECT *psEffect);
/* There is no render destruction effect! */ /* There is no render destruction effect! */
@ -292,13 +292,8 @@ static BOOL essentialEffect(EFFECT_GROUP group, EFFECT_TYPE type)
{ {
return(true); return(true);
} }
else
{
return(false);
}
default: default:
return(false); return(false);
break;
} }
} }
@ -312,7 +307,6 @@ static BOOL utterlyReject( EFFECT_GROUP group )
return(true); return(true);
default: default:
return(false); return(false);
break;
} }
} }
@ -419,11 +413,12 @@ UDWORD getNumEvenEffects(void)
return(letThrough); return(letThrough);
} }
void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, BOOL lit) void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, BOOL lit)
{ {
static unsigned int aeCalls = 0;
UDWORD essentialCount; UDWORD essentialCount;
UDWORD i; UDWORD i;
BOOL bSmoke;
EFFECT *psEffect = NULL; EFFECT *psEffect = NULL;
aeCalls++; aeCalls++;
@ -439,6 +434,8 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
/* If effect is essentail - then let it through */ /* If effect is essentail - then let it through */
if(!essentialEffect(group,type) ) if(!essentialEffect(group,type) )
{ {
bool bSmoke = false;
/* Some we can get rid of right away */ /* Some we can get rid of right away */
if ( utterlyReject( group ) ) if ( utterlyReject( group ) )
{ {
@ -450,10 +447,7 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
{ {
bSmoke = true; bSmoke = true;
} }
else
{
bSmoke = false;
}
/* Others intermittently (50/50 for most and 25/100 for smoke */ /* Others intermittently (50/50 for most and 25/100 for smoke */
if(bSmoke ? (aeCalls & 0x03) : (aeCalls & 0x01) ) if(bSmoke ? (aeCalls & 0x03) : (aeCalls & 0x01) )
{ {
@ -485,10 +479,8 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
/* All of the effects are essential!?!? */ /* All of the effects are essential!?!? */
return; return;
} }
else
{
freeEffect = i; freeEffect = i;
}
psEffect = &asEffectsList[freeEffect]; psEffect = &asEffectsList[freeEffect];
@ -565,7 +557,8 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
case EFFECT_FIREWORK: case EFFECT_FIREWORK:
effectSetUpFirework(psEffect); effectSetUpFirework(psEffect);
break; break;
default: case EFFECT_STRUCTURE:
case EFFECT_DUST_BALL:
ASSERT( false,"Weirdy group type for an effect" ); ASSERT( false,"Weirdy group type for an effect" );
break; break;
} }
@ -615,7 +608,6 @@ void processEffects(void)
/* Add it to the bucket */ /* Add it to the bucket */
bucketAddTypeToList(RENDER_EFFECT,&asEffectsList[i]); bucketAddTypeToList(RENDER_EFFECT,&asEffectsList[i]);
} }
} }
} }
@ -637,50 +629,50 @@ static void updateEffect(EFFECT *psEffect)
{ {
case EFFECT_EXPLOSION: case EFFECT_EXPLOSION:
updateExplosion(psEffect); updateExplosion(psEffect);
break; return;
case EFFECT_WAYPOINT: case EFFECT_WAYPOINT:
if(!gamePaused()) updateWaypoint(psEffect); if(!gamePaused()) updateWaypoint(psEffect);
break; return;
case EFFECT_CONSTRUCTION: case EFFECT_CONSTRUCTION:
if(!gamePaused()) updateConstruction(psEffect); if(!gamePaused()) updateConstruction(psEffect);
break; return;
case EFFECT_SMOKE: case EFFECT_SMOKE:
if(!gamePaused()) updatePolySmoke(psEffect); if(!gamePaused()) updatePolySmoke(psEffect);
break; return;
case EFFECT_STRUCTURE: case EFFECT_STRUCTURE:
break; return;
case EFFECT_GRAVITON: case EFFECT_GRAVITON:
if(!gamePaused()) updateGraviton(psEffect); if(!gamePaused()) updateGraviton(psEffect);
break; return;
case EFFECT_BLOOD: case EFFECT_BLOOD:
if(!gamePaused()) updateBlood(psEffect); if(!gamePaused()) updateBlood(psEffect);
break; return;
case EFFECT_DESTRUCTION: case EFFECT_DESTRUCTION:
if(!gamePaused()) updateDestruction(psEffect); if(!gamePaused()) updateDestruction(psEffect);
break; return;
case EFFECT_FIRE: case EFFECT_FIRE:
if(!gamePaused()) updateFire(psEffect); if(!gamePaused()) updateFire(psEffect);
break; return;
case EFFECT_SAT_LASER: case EFFECT_SAT_LASER:
if(!gamePaused()) updateSatLaser(psEffect); if(!gamePaused()) updateSatLaser(psEffect);
break; return;
case EFFECT_FIREWORK: case EFFECT_FIREWORK:
if(!gamePaused()) updateFirework(psEffect); if(!gamePaused()) updateFirework(psEffect);
break; return;
default: }
debug( LOG_ERROR, "Weirdy class of effect passed to updateEffect" ); debug( LOG_ERROR, "Weirdy class of effect passed to updateEffect" );
abort(); abort();
break;
}
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
@ -1012,6 +1004,8 @@ static void updateExplosion(EFFECT *psEffect)
} }
} }
/** The update function for blood */ /** The update function for blood */
static void updateBlood(EFFECT *psEffect) static void updateBlood(EFFECT *psEffect)
{ {
@ -1560,50 +1554,52 @@ void renderEffect(EFFECT *psEffect)
{ {
case EFFECT_WAYPOINT: case EFFECT_WAYPOINT:
renderWaypointEffect(psEffect); renderWaypointEffect(psEffect);
break; return;
case EFFECT_EXPLOSION: case EFFECT_EXPLOSION:
renderExplosionEffect(psEffect); renderExplosionEffect(psEffect);
break; return;
case EFFECT_CONSTRUCTION: case EFFECT_CONSTRUCTION:
renderConstructionEffect(psEffect); renderConstructionEffect(psEffect);
break; return;
case EFFECT_SMOKE: case EFFECT_SMOKE:
renderSmokeEffect(psEffect); renderSmokeEffect(psEffect);
break; return;
case EFFECT_GRAVITON: case EFFECT_GRAVITON:
renderGravitonEffect(psEffect); renderGravitonEffect(psEffect);
break; return;
case EFFECT_BLOOD: case EFFECT_BLOOD:
renderBloodEffect(psEffect); renderBloodEffect(psEffect);
break; return;
case EFFECT_STRUCTURE: case EFFECT_STRUCTURE:
break; return;
case EFFECT_DESTRUCTION: case EFFECT_DESTRUCTION:
/* There is no display func for a destruction effect - /* There is no display func for a destruction effect -
it merely spawn other effects over time */ it merely spawn other effects over time */
renderDestructionEffect(psEffect); renderDestructionEffect(psEffect);
break; return;
case EFFECT_FIRE: case EFFECT_FIRE:
/* Likewise */ /* Likewise */
break; return;
case EFFECT_SAT_LASER: case EFFECT_SAT_LASER:
/* Likewise */ /* Likewise */
break; return;
case EFFECT_FIREWORK: case EFFECT_FIREWORK:
renderFirework(psEffect); renderFirework(psEffect);
break; return;
default: }
debug( LOG_ERROR, "Weirdy class of effect passed to renderEffect" ); debug( LOG_ERROR, "Weirdy class of effect passed to renderEffect" );
abort(); abort();
break;
}
} }
/** drawing func for wapypoints */ /** drawing func for wapypoints */
@ -1676,18 +1672,17 @@ static void renderDestructionEffect(EFFECT *psEffect)
iV_MatrixEnd(); iV_MatrixEnd();
} }
static BOOL rejectLandLight(LAND_LIGHT_SPEC type) static bool rejectLandLight(LAND_LIGHT_SPEC type)
{ {
UDWORD timeSlice; unsigned int timeSlice = gameTime%2000;
timeSlice = gameTime%2000;
if (timeSlice < 400) if (timeSlice < 400)
{ {
if(type == LL_MIDDLE) return(false); else return(true); // reject all expect middle return (type != LL_MIDDLE); // reject all expect middle
} }
else if (timeSlice < 800) else if (timeSlice < 800)
{ {
if(type == LL_OUTER) return(true); else return(false); // reject only outer return (type == LL_OUTER); // reject only outer
} }
else if (timeSlice < 1200) else if (timeSlice < 1200)
{ {
@ -1695,11 +1690,11 @@ UDWORD timeSlice;
} }
else if (timeSlice < 1600) else if (timeSlice < 1600)
{ {
if(type == LL_OUTER) return(true); else return(false); // reject only outer return (type == LL_OUTER); // reject only outer
} }
else else
{ {
if(type == LL_MIDDLE) return(false); else return(true); // reject all expect middle return (type != LL_MIDDLE); // reject all expect middle
} }
} }
@ -2274,6 +2269,7 @@ void effectSetupWayPoint(EFFECT *psEffect)
SET_ESSENTIAL(psEffect); SET_ESSENTIAL(psEffect);
} }
static void effectSetupBlood(EFFECT *psEffect) static void effectSetupBlood(EFFECT *psEffect)
{ {
psEffect->frameDelay = BLOOD_FRAME_DELAY; psEffect->frameDelay = BLOOD_FRAME_DELAY;

View File

@ -111,8 +111,7 @@ FIREWORK_TYPE_LAUNCHER,
typedef enum typedef enum
{ {
ES_INACTIVE, ES_INACTIVE,
ES_ACTIVE, ES_ACTIVE
ES_DORMANT
}EFFECT_STATUS; }EFFECT_STATUS;
typedef enum typedef enum