CHANGELOG: Fix unit explosion color for turret

fixes ticket:2294
(cherry picked from commit f4e8221ef53c4f9af6b3f5f2af3c7e5b28c89654)

Conflicts:

	src/component.c
	src/effects.c
	src/effects.h
master
buginator 2010-11-13 13:40:10 -05:00
parent b6baa8338e
commit f825a85f5d
3 changed files with 19 additions and 5 deletions

View File

@ -1143,8 +1143,9 @@ void destroyFXDroid(DROID *psDroid)
{ {
if(psDroid->asWeaps[0].nStat > 0) if(psDroid->asWeaps[0].nStat > 0)
{ {
// get main mount // Tell the effect system that it needs to use this player's color for the next effect
psImd = WEAPON_MOUNT_IMD(psDroid, 0); SetEffectForPlayer(psDroid->player);
psImd = WEAPON_MOUNT_IMD(psDroid,psDroid->player);
} }
} }
else else

View File

@ -204,8 +204,8 @@ static UDWORD lastUpdateStructures[EFFECT_STRUCTURE_DIVISION];
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 specifiedSize; static UDWORD specifiedSize;
static UDWORD ellSpec; static UDWORD ellSpec;
static uint8_t EffectForPlayer = 0;
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
/* PROTOTYPES */ /* PROTOTYPES */
@ -506,6 +506,13 @@ void addMultiEffect(const Vector3i *basePos, Vector3i *scatter, EFFECT_GROUP gro
} }
} }
// 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(const Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type, bool specified, iIMDShape *imd, int lit) void addEffect(const Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type, bool specified, iIMDShape *imd, int lit)
{ {
@ -537,6 +544,10 @@ void addEffect(const Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type, bool s
psEffect->group = group; psEffect->group = group;
psEffect->type = type; 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 */ /* Set when it entered the world */
psEffect->birthTime = psEffect->lastFrame = graphicsTime; psEffect->birthTime = psEffect->lastFrame = graphicsTime;
@ -1778,7 +1789,7 @@ static void renderGravitonEffect(const EFFECT *psEffect)
pie_MatScale(psEffect->size / 100.f); pie_MatScale(psEffect->size / 100.f);
} }
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 */ /* Pop the matrix */
pie_MatEnd(); pie_MatEnd();

View File

@ -128,6 +128,7 @@ typedef enum
typedef struct _effect_def EFFECT; typedef struct _effect_def EFFECT;
struct _effect_def struct _effect_def
{ {
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 control; // Controls the bits above - essential,flips etc
EFFECT_GROUP group; // what group is it - explosion, building effect etc.... EFFECT_GROUP group; // what group is it - explosion, building effect etc....
EFFECT_TYPE type; // what type is it within the group? EFFECT_TYPE type; // what type is it within the group?
@ -168,6 +169,7 @@ bool readFXData(const char* fileName);
bool writeFXData(const char* fileName); bool writeFXData(const char* fileName);
void effectSetSize(UDWORD size); void effectSetSize(UDWORD size);
void effectSetLandLightSpec(LAND_LIGHT_SPEC spec); void effectSetLandLightSpec(LAND_LIGHT_SPEC spec);
void SetEffectForPlayer(uint8_t player);
#ifdef __cplusplus #ifdef __cplusplus
} }