Skip to content

Commit

Permalink
CHANGELOG: Fix unit explosion color for turret
Browse files Browse the repository at this point in the history
fixes ticket:2294
  • Loading branch information
buginator committed Nov 8, 2010
1 parent d84ca34 commit f4e8221
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/component.c
Expand Up @@ -1406,6 +1406,8 @@ void destroyFXDroid(DROID *psDroid)
{
if(psDroid->asWeaps[0].nStat > 0)
{
// Tell the effect system that it needs to use this player's color for the next effect
SetEffectForPlayer(psDroid->player);
psImd = WEAPON_MOUNT_IMD(psDroid,psDroid->player);
}
}
Expand Down
17 changes: 14 additions & 3 deletions src/effects.c
Expand Up @@ -183,8 +183,8 @@ 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 specifiedSize;
static UDWORD ellSpec;

static UDWORD ellSpec;
static uint8_t EffectForPlayer = 0;
// ----------------------------------------------------------------------------------------
/* PROTOTYPES */

Expand Down Expand Up @@ -414,6 +414,13 @@ UDWORD getNumEvenEffects(void)
return(letThrough);
}

// When we need to set the effect for the player's color
void SetEffectForPlayer(uint8_t player)
{
ASSERT(player < MAX_PLAYERS, "player is set to a invalid number of %d", (int) player);

EffectForPlayer = getPlayerColour(player);
}

void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, int lit)
{
Expand Down Expand Up @@ -494,6 +501,10 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
psEffect->group = group;
psEffect->type = type;

// and if the effect needs the player's color for certain things
psEffect->player = EffectForPlayer;
SetEffectForPlayer(0); // reset it

/* Set when it entered the world */
psEffect->birthTime = psEffect->lastFrame = gameTime;

Expand Down Expand Up @@ -1775,7 +1786,7 @@ static void renderGravitonEffect(EFFECT *psEffect)
pie_MatScale(100);
}

pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, psEffect->player, WZCOL_WHITE, WZCOL_BLACK, 0, 0);

/* Pop the matrix */
iV_MatrixEnd();
Expand Down
36 changes: 19 additions & 17 deletions src/effects.h
Expand Up @@ -125,23 +125,24 @@ typedef enum

typedef struct _effect_def
{
uint8_t control; // Controls the bits above - essential,flips etc
uint8_t group; // what group is it - explosion, building effect etc....
uint8_t type; // what type is it within the group?
uint8_t frameNumber; // what frame number is the imd on?
uint16_t size; // Size in terms of percent of original imd.
uint8_t baseScale; // if scaled, what's bottom line?
uint8_t specific; // how many times has it bounced?
Vector3f position; // world coordinates of the effect - floats on the PC.
Vector3f velocity; // movement values per update
Vector3i rotation; // current rotation - only for gravitons
Vector3i spin; // rotation info for spinning things.
uint32_t birthTime; // what time was it introduced into the world?
uint32_t lastFrame; // when did we last update the frame?
uint16_t frameDelay; // how many game ticks between each frame?
uint16_t lifeSpan; // what is it's life expectancy?
uint16_t radius; // Used for area effects
iIMDShape *imd; // pointer to the imd the effect uses.
uint8_t player; // when the effect in question needs a player's color
uint8_t control; // Controls the bits above - essential,flips etc
uint8_t group; // what group is it - explosion, building effect etc....
uint8_t type; // what type is it within the group?
uint8_t frameNumber; // what frame number is the imd on?
uint16_t size; // Size in terms of percent of original imd.
uint8_t baseScale; // if scaled, what's bottom line?
uint8_t specific; // how many times has it bounced?
Vector3f position; // world coordinates of the effect - floats on the PC.
Vector3f velocity; // movement values per update
Vector3i rotation; // current rotation - only for gravitons
Vector3i spin; // rotation info for spinning things.
uint32_t birthTime; // what time was it introduced into the world?
uint32_t lastFrame; // when did we last update the frame?
uint16_t frameDelay; // how many game ticks between each frame?
uint16_t lifeSpan; // what is it's life expectancy?
uint16_t radius; // Used for area effects
iIMDShape *imd; // pointer to the imd the effect uses.
} EFFECT;

/* Maximum number of effects in the world - need to investigate what this should be */
Expand Down Expand Up @@ -169,5 +170,6 @@ extern bool readFXData(const char* fileName);
extern bool writeFXData(const char* fileName);
extern void effectSetSize(UDWORD size);
extern void effectSetLandLightSpec(LAND_LIGHT_SPEC spec);
extern void SetEffectForPlayer(uint8_t player);

#endif // __INCLUDED_SRC_EFFECTS_H__

0 comments on commit f4e8221

Please sign in to comment.