Added ECM effect.

This commit is contained in:
Steve 2015-11-29 08:34:25 +00:00
parent 6087a6b57f
commit 542209c24c
9 changed files with 50 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -25,11 +25,13 @@ static void setRandomShieldHue(Effect *e);
static SDL_Texture *explosionTexture; static SDL_Texture *explosionTexture;
static SDL_Texture *shieldHitTexture; static SDL_Texture *shieldHitTexture;
static SDL_Texture *haloTexture;
void initEffects(void) void initEffects(void)
{ {
explosionTexture = getTexture("gfx/battle/explosion.png"); explosionTexture = getTexture("gfx/effects/explosion.png");
shieldHitTexture = getTexture("gfx/battle/shieldHit.png"); shieldHitTexture = getTexture("gfx/effects/shieldHit.png");
haloTexture = getTexture("gfx/effects/halo.png");
} }
void doEffects(void) void doEffects(void)
@ -44,9 +46,13 @@ void doEffects(void)
e->health--; e->health--;
e->size += e->scaleAmount;
if (e->health <= 0) if (e->health <= 0)
{ {
if (--e->a <= 0) e->a -= (e->type != EFFECT_ECM) ? 1 : 3;
if (e->a <= 0)
{ {
if (e == battle.effectTail) if (e == battle.effectTail)
{ {
@ -88,6 +94,13 @@ void drawEffects(void)
break; break;
case EFFECT_HALO: case EFFECT_HALO:
SDL_SetTextureColorMod(e->texture, e->r, e->g, e->b);
blitScaled(e->texture, e->x - battle.camera.x - (e->size / 2), e->y - battle.camera.y - (e->size / 2), e->size, e->size);
break;
case EFFECT_ECM:
SDL_SetTextureColorMod(e->texture, e->r, e->g, e->b);
blitScaled(e->texture, SCREEN_WIDTH / 2 - (e->size / 2), SCREEN_HEIGHT / 2 - (e->size / 2), e->size, e->size);
break; break;
} }
} }
@ -325,6 +338,33 @@ void addShieldSplinterEffect(Entity *ent)
} }
} }
void addECMEffect(Entity *ent)
{
int i;
Effect *e;
for (i = 0 ; i < 3 ; i++)
{
e = malloc(sizeof(Effect));
memset(e, 0, sizeof(Effect));
battle.effectTail->next = e;
battle.effectTail = e;
e->type = EFFECT_ECM;
e->x = ent->x;
e->y = ent->y;
e->size = i * 4;
e->scaleAmount = 5;
e->texture = haloTexture;
e->r = 128;
e->g = 128 + (i * 64);
e->b = 255;
e->a = 255;
}
}
static void setRandomFlameHue(Effect *e) static void setRandomFlameHue(Effect *e)
{ {
e->r = 255; e->r = 255;

View File

@ -329,6 +329,8 @@ static void activateECM(void)
{ {
battle.ecmTimer = 0; battle.ecmTimer = 0;
addECMEffect(player);
battle.stats[STAT_ECM]++; battle.stats[STAT_ECM]++;
} }

View File

@ -38,6 +38,7 @@ extern void failMission(void);
extern float getAngle(int x1, int y1, int x2, int y2); extern float getAngle(int x1, int y1, int x2, int y2);
extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2);
extern void setMouse(int x, int y); extern void setMouse(int x, int y);
extern void addECMEffect(Entity *ent);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -146,7 +146,8 @@ enum
{ {
EFFECT_LINE, EFFECT_LINE,
EFFECT_TEXTURE, EFFECT_TEXTURE,
EFFECT_HALO EFFECT_HALO,
EFFECT_ECM
}; };
enum enum

View File

@ -160,7 +160,8 @@ struct Effect {
float dx; float dx;
float dy; float dy;
float health; float health;
int size; float size;
float scaleAmount;
int r; int r;
int g; int g;
int b; int b;