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 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) )
{
@ -466,11 +460,11 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
}
for(i=freeEffect,essentialCount=0; (asEffectsList[i].control & EFFECT_ESSENTIAL)
&& essentialCount<MAX_EFFECTS; i++)
for (i = freeEffect, essentialCount = 0; (asEffectsList[i].control & EFFECT_ESSENTIAL)
&& essentialCount < MAX_EFFECTS; i++)
{
/* Check for wrap around */
if(i>= (MAX_EFFECTS-1))
if (i >= (MAX_EFFECTS-1))
{
/* Go back to the first one */
i = 0;
@ -480,15 +474,13 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
}
/* Check the list isn't just full of essential effects */
if(essentialCount>=MAX_EFFECTS)
if (essentialCount >= MAX_EFFECTS)
{
/* All of the effects are essential!?!? */
return;
}
else
{
freeEffect = i;
}
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:
debug( LOG_ERROR, "Weirdy class of effect passed to updateEffect" );
abort();
break;
return;
}
debug( LOG_ERROR, "Weirdy class of effect passed to updateEffect" );
abort();
}
// ----------------------------------------------------------------------------------------
@ -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:
debug( LOG_ERROR, "Weirdy class of effect passed to renderEffect" );
abort();
break;
return;
}
debug( LOG_ERROR, "Weirdy class of effect passed to renderEffect" );
abort();
}
/** drawing func for wapypoints */
@ -1676,30 +1672,29 @@ 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 (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)
{
return(false); //reject none
return(false); //reject none
}
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
{
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;

View File

@ -35,84 +35,83 @@
/* All the effect groups */
typedef enum
{
EFFECT_EXPLOSION,
EFFECT_CONSTRUCTION,
EFFECT_SMOKE,
EFFECT_STRUCTURE,
EFFECT_GRAVITON,
EFFECT_WAYPOINT,
EFFECT_BLOOD,
EFFECT_DESTRUCTION,
EFFECT_SAT_LASER,
EFFECT_DUST_BALL,
EFFECT_FIRE,
EFFECT_FIREWORK
}EFFECT_GROUP;
EFFECT_EXPLOSION,
EFFECT_CONSTRUCTION,
EFFECT_SMOKE,
EFFECT_STRUCTURE,
EFFECT_GRAVITON,
EFFECT_WAYPOINT,
EFFECT_BLOOD,
EFFECT_DESTRUCTION,
EFFECT_SAT_LASER,
EFFECT_DUST_BALL,
EFFECT_FIRE,
EFFECT_FIREWORK
} EFFECT_GROUP;
/* Might not even need this */
typedef enum
{
EXPLOSION_TYPE_SMALL,
EXPLOSION_TYPE_VERY_SMALL,
EXPLOSION_TYPE_MEDIUM,
EXPLOSION_TYPE_LARGE,
EXPLOSION_TYPE_SPECIFIED, // superfluous?
EXPLOSION_TYPE_NOT_FACING,
EXPLOSION_TYPE_SPECIFIED_SOLID,
EXPLOSION_TYPE_SPECIFIED_FIXME,
EXPLOSION_TYPE_FLAMETHROWER,
EXPLOSION_TYPE_LASER,
EXPLOSION_TYPE_TESLA,
EXPLOSION_TYPE_DISCOVERY,
EXPLOSION_TYPE_FLARE,
EXPLOSION_TYPE_PLASMA,
EXPLOSION_TYPE_KICKUP,
EXPLOSION_TYPE_LAND_LIGHT,
EXPLOSION_TYPE_SHOCKWAVE,
EXPLOSION_TYPE_SMALL,
EXPLOSION_TYPE_VERY_SMALL,
EXPLOSION_TYPE_MEDIUM,
EXPLOSION_TYPE_LARGE,
EXPLOSION_TYPE_SPECIFIED, // superfluous?
EXPLOSION_TYPE_NOT_FACING,
EXPLOSION_TYPE_SPECIFIED_SOLID,
EXPLOSION_TYPE_SPECIFIED_FIXME,
EXPLOSION_TYPE_FLAMETHROWER,
EXPLOSION_TYPE_LASER,
EXPLOSION_TYPE_TESLA,
EXPLOSION_TYPE_DISCOVERY,
EXPLOSION_TYPE_FLARE,
EXPLOSION_TYPE_PLASMA,
EXPLOSION_TYPE_KICKUP,
EXPLOSION_TYPE_LAND_LIGHT,
EXPLOSION_TYPE_SHOCKWAVE,
//EXPLOSION_TYPE_SKYSCRAPER,
//EXPLOSION_TYPE_SKYSCRAPER,
GRAVITON_TYPE_STANDARD,
GRAVITON_TYPE_EMITTING_DR,
GRAVITON_TYPE_EMITTING_ST,
GRAVITON_TYPE_GIBLET,
GRAVITON_TYPE_STANDARD,
GRAVITON_TYPE_EMITTING_DR,
GRAVITON_TYPE_EMITTING_ST,
GRAVITON_TYPE_GIBLET,
SMOKE_TYPE_DRIFTING,
SMOKE_TYPE_DRIFTING_HIGH,
SMOKE_TYPE_DRIFTING_SMALL,
SMOKE_TYPE_BILLOW,
SMOKE_TYPE_STEAM,
SMOKE_TYPE_TRAIL,
FIRE_TYPE_LOCALISED,
FIRE_TYPE_SMOKY,
FIRE_TYPE_SMOKY_BLUE,
CONSTRUCTION_TYPE_DRIFTING,
SMOKE_TYPE_DRIFTING,
SMOKE_TYPE_DRIFTING_HIGH,
SMOKE_TYPE_DRIFTING_SMALL,
SMOKE_TYPE_BILLOW,
SMOKE_TYPE_STEAM,
SMOKE_TYPE_TRAIL,
FIRE_TYPE_LOCALISED,
FIRE_TYPE_SMOKY,
FIRE_TYPE_SMOKY_BLUE,
CONSTRUCTION_TYPE_DRIFTING,
BLOOD_TYPE_NORMAL,
BLOOD_TYPE_NORMAL,
DUST_TYPE_NORMAL,
DESTRUCTION_TYPE_DROID,
DESTRUCTION_TYPE_STRUCTURE,
DESTRUCTION_TYPE_POWER_STATION,
DESTRUCTION_TYPE_WALL_SECTION,
DESTRUCTION_TYPE_FEATURE,
DESTRUCTION_TYPE_SKYSCRAPER,
DUST_TYPE_NORMAL,
DESTRUCTION_TYPE_DROID,
DESTRUCTION_TYPE_STRUCTURE,
DESTRUCTION_TYPE_POWER_STATION,
DESTRUCTION_TYPE_WALL_SECTION,
DESTRUCTION_TYPE_FEATURE,
DESTRUCTION_TYPE_SKYSCRAPER,
SAT_LASER_STANDARD,
SAT_LASER_STANDARD,
WAYPOINT_TYPE,
WAYPOINT_TYPE,
FIREWORK_TYPE_STARBURST,
FIREWORK_TYPE_LAUNCHER,
FIREWORK_TYPE_STARBURST,
FIREWORK_TYPE_LAUNCHER,
}EFFECT_TYPE;
} EFFECT_TYPE;
/* Is the slot currently being used and is it active? */
typedef enum
{
ES_INACTIVE,
ES_ACTIVE,
ES_DORMANT
ES_INACTIVE,
ES_ACTIVE
}EFFECT_STATUS;
typedef enum