Some simplifications and cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6607 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
d1780335ee
commit
f1ae7b9620
100
src/effects.c
100
src/effects.c
|
@ -183,7 +183,6 @@ static UDWORD missCount;
|
|||
static UDWORD skipped,skippedEffects,letThrough;
|
||||
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 aeCalls;
|
||||
static UDWORD specifiedSize;
|
||||
static UDWORD ellSpec;
|
||||
|
||||
|
@ -214,6 +213,7 @@ static void renderWaypointEffect ( EFFECT *psEffect );
|
|||
static void renderBloodEffect ( EFFECT *psEffect );
|
||||
static void renderDestructionEffect ( EFFECT *psEffect );
|
||||
static void renderFirework ( EFFECT *psEffect );
|
||||
|
||||
static void positionEffect(EFFECT *psEffect);
|
||||
/* There is no render destruction effect! */
|
||||
|
||||
|
@ -292,13 +292,8 @@ static BOOL essentialEffect(EFFECT_GROUP group, EFFECT_TYPE type)
|
|||
{
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,7 +307,6 @@ static BOOL utterlyReject( EFFECT_GROUP group )
|
|||
return(true);
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,11 +413,12 @@ UDWORD getNumEvenEffects(void)
|
|||
return(letThrough);
|
||||
}
|
||||
|
||||
|
||||
void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, BOOL lit)
|
||||
{
|
||||
static unsigned int aeCalls = 0;
|
||||
UDWORD essentialCount;
|
||||
UDWORD i;
|
||||
BOOL bSmoke;
|
||||
EFFECT *psEffect = NULL;
|
||||
|
||||
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(!essentialEffect(group,type) )
|
||||
{
|
||||
bool bSmoke = false;
|
||||
|
||||
/* Some we can get rid of right away */
|
||||
if ( utterlyReject( group ) )
|
||||
{
|
||||
|
@ -450,10 +447,7 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
|
|||
{
|
||||
bSmoke = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bSmoke = false;
|
||||
}
|
||||
|
||||
/* Others intermittently (50/50 for most and 25/100 for smoke */
|
||||
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!?!? */
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
freeEffect = i;
|
||||
}
|
||||
|
||||
psEffect = &asEffectsList[freeEffect];
|
||||
|
||||
|
@ -565,7 +557,8 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
|
|||
case EFFECT_FIREWORK:
|
||||
effectSetUpFirework(psEffect);
|
||||
break;
|
||||
default:
|
||||
case EFFECT_STRUCTURE:
|
||||
case EFFECT_DUST_BALL:
|
||||
ASSERT( false,"Weirdy group type for an effect" );
|
||||
break;
|
||||
}
|
||||
|
@ -615,7 +608,6 @@ void processEffects(void)
|
|||
/* Add it to the bucket */
|
||||
bucketAddTypeToList(RENDER_EFFECT,&asEffectsList[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,50 +629,50 @@ static void updateEffect(EFFECT *psEffect)
|
|||
{
|
||||
case EFFECT_EXPLOSION:
|
||||
updateExplosion(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_WAYPOINT:
|
||||
if(!gamePaused()) updateWaypoint(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_CONSTRUCTION:
|
||||
if(!gamePaused()) updateConstruction(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_SMOKE:
|
||||
if(!gamePaused()) updatePolySmoke(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_STRUCTURE:
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_GRAVITON:
|
||||
if(!gamePaused()) updateGraviton(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_BLOOD:
|
||||
if(!gamePaused()) updateBlood(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_DESTRUCTION:
|
||||
if(!gamePaused()) updateDestruction(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_FIRE:
|
||||
if(!gamePaused()) updateFire(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_SAT_LASER:
|
||||
if(!gamePaused()) updateSatLaser(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_FIREWORK:
|
||||
if(!gamePaused()) updateFirework(psEffect);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
debug( LOG_ERROR, "Weirdy class of effect passed to updateEffect" );
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
@ -1012,6 +1004,8 @@ static void updateExplosion(EFFECT *psEffect)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** The update function for blood */
|
||||
static void updateBlood(EFFECT *psEffect)
|
||||
{
|
||||
|
@ -1560,50 +1554,52 @@ void renderEffect(EFFECT *psEffect)
|
|||
{
|
||||
case EFFECT_WAYPOINT:
|
||||
renderWaypointEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_EXPLOSION:
|
||||
renderExplosionEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_CONSTRUCTION:
|
||||
renderConstructionEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_SMOKE:
|
||||
renderSmokeEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_GRAVITON:
|
||||
renderGravitonEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_BLOOD:
|
||||
renderBloodEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_STRUCTURE:
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_DESTRUCTION:
|
||||
/* There is no display func for a destruction effect -
|
||||
it merely spawn other effects over time */
|
||||
renderDestructionEffect(psEffect);
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_FIRE:
|
||||
/* Likewise */
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_SAT_LASER:
|
||||
/* Likewise */
|
||||
break;
|
||||
return;
|
||||
|
||||
case EFFECT_FIREWORK:
|
||||
renderFirework(psEffect);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
debug( LOG_ERROR, "Weirdy class of effect passed to renderEffect" );
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** drawing func for wapypoints */
|
||||
|
@ -1676,18 +1672,17 @@ static void renderDestructionEffect(EFFECT *psEffect)
|
|||
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(type == LL_MIDDLE) return(false); else return(true); // reject all expect middle
|
||||
return (type != LL_MIDDLE); // reject all expect middle
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -1695,11 +1690,11 @@ UDWORD timeSlice;
|
|||
}
|
||||
else if (timeSlice < 1600)
|
||||
{
|
||||
if(type == LL_OUTER) return(true); else return(false); // reject only outer
|
||||
return (type == LL_OUTER); // reject only outer
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
static void effectSetupBlood(EFFECT *psEffect)
|
||||
{
|
||||
psEffect->frameDelay = BLOOD_FRAME_DELAY;
|
||||
|
|
|
@ -111,8 +111,7 @@ FIREWORK_TYPE_LAUNCHER,
|
|||
typedef enum
|
||||
{
|
||||
ES_INACTIVE,
|
||||
ES_ACTIVE,
|
||||
ES_DORMANT
|
||||
ES_ACTIVE
|
||||
}EFFECT_STATUS;
|
||||
|
||||
typedef enum
|
||||
|
|
Loading…
Reference in New Issue