Skip to content

Commit f4e8221

Browse files
committed
CHANGELOG: Fix unit explosion color for turret
fixes ticket:2294
1 parent d84ca34 commit f4e8221

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

Diff for: src/component.c

+2
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,8 @@ void destroyFXDroid(DROID *psDroid)
14061406
{
14071407
if(psDroid->asWeaps[0].nStat > 0)
14081408
{
1409+
// Tell the effect system that it needs to use this player's color for the next effect
1410+
SetEffectForPlayer(psDroid->player);
14091411
psImd = WEAPON_MOUNT_IMD(psDroid,psDroid->player);
14101412
}
14111413
}

Diff for: src/effects.c

+14-3
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ static UDWORD skipped,skippedEffects,letThrough;
183183
static UDWORD auxVar; // dirty filthy hack - don't look for what this does.... //FIXME
184184
static UDWORD auxVarSec; // dirty filthy hack - don't look for what this does.... //FIXME
185185
static UDWORD specifiedSize;
186-
static UDWORD ellSpec;
187-
186+
static UDWORD ellSpec;
187+
static uint8_t EffectForPlayer = 0;
188188
// ----------------------------------------------------------------------------------------
189189
/* PROTOTYPES */
190190

@@ -414,6 +414,13 @@ UDWORD getNumEvenEffects(void)
414414
return(letThrough);
415415
}
416416

417+
// When we need to set the effect for the player's color
418+
void SetEffectForPlayer(uint8_t player)
419+
{
420+
ASSERT(player < MAX_PLAYERS, "player is set to a invalid number of %d", (int) player);
421+
422+
EffectForPlayer = getPlayerColour(player);
423+
}
417424

418425
void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specified, iIMDShape *imd, int lit)
419426
{
@@ -494,6 +501,10 @@ void addEffect(Vector3i *pos, EFFECT_GROUP group, EFFECT_TYPE type,BOOL specifie
494501
psEffect->group = group;
495502
psEffect->type = type;
496503

504+
// and if the effect needs the player's color for certain things
505+
psEffect->player = EffectForPlayer;
506+
SetEffectForPlayer(0); // reset it
507+
497508
/* Set when it entered the world */
498509
psEffect->birthTime = psEffect->lastFrame = gameTime;
499510

@@ -1775,7 +1786,7 @@ static void renderGravitonEffect(EFFECT *psEffect)
17751786
pie_MatScale(100);
17761787
}
17771788

1778-
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, 0, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
1789+
pie_Draw3DShape(psEffect->imd, psEffect->frameNumber, psEffect->player, WZCOL_WHITE, WZCOL_BLACK, 0, 0);
17791790

17801791
/* Pop the matrix */
17811792
iV_MatrixEnd();

Diff for: src/effects.h

+19-17
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,24 @@ typedef enum
125125

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

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

173175
#endif // __INCLUDED_SRC_EFFECTS_H__

0 commit comments

Comments
 (0)