diff --git a/gfx/battle/shieldSplinter.png b/gfx/battle/shieldSplinter.png deleted file mode 100644 index 3bcfee1..0000000 Binary files a/gfx/battle/shieldSplinter.png and /dev/null differ diff --git a/gfx/battle/explosion.png b/gfx/effects/explosion.png similarity index 100% rename from gfx/battle/explosion.png rename to gfx/effects/explosion.png diff --git a/gfx/battle/halo.png b/gfx/effects/halo.png similarity index 100% rename from gfx/battle/halo.png rename to gfx/effects/halo.png diff --git a/gfx/battle/shieldHit.png b/gfx/effects/shieldHit.png similarity index 100% rename from gfx/battle/shieldHit.png rename to gfx/effects/shieldHit.png diff --git a/src/battle/effects.c b/src/battle/effects.c index 464a83a..1c525c2 100644 --- a/src/battle/effects.c +++ b/src/battle/effects.c @@ -25,11 +25,13 @@ static void setRandomShieldHue(Effect *e); static SDL_Texture *explosionTexture; static SDL_Texture *shieldHitTexture; +static SDL_Texture *haloTexture; void initEffects(void) { - explosionTexture = getTexture("gfx/battle/explosion.png"); - shieldHitTexture = getTexture("gfx/battle/shieldHit.png"); + explosionTexture = getTexture("gfx/effects/explosion.png"); + shieldHitTexture = getTexture("gfx/effects/shieldHit.png"); + haloTexture = getTexture("gfx/effects/halo.png"); } void doEffects(void) @@ -44,9 +46,13 @@ void doEffects(void) e->health--; + e->size += e->scaleAmount; + if (e->health <= 0) { - if (--e->a <= 0) + e->a -= (e->type != EFFECT_ECM) ? 1 : 3; + + if (e->a <= 0) { if (e == battle.effectTail) { @@ -88,6 +94,13 @@ void drawEffects(void) break; 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; } } @@ -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) { e->r = 255; diff --git a/src/battle/player.c b/src/battle/player.c index f55be26..6d93621 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -329,6 +329,8 @@ static void activateECM(void) { battle.ecmTimer = 0; + addECMEffect(player); + battle.stats[STAT_ECM]++; } diff --git a/src/battle/player.h b/src/battle/player.h index f761733..1d0ece8 100644 --- a/src/battle/player.h +++ b/src/battle/player.h @@ -38,6 +38,7 @@ extern void failMission(void); 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 void setMouse(int x, int y); +extern void addECMEffect(Entity *ent); extern App app; extern Battle battle; diff --git a/src/defs.h b/src/defs.h index 11b47a3..36bccaa 100644 --- a/src/defs.h +++ b/src/defs.h @@ -146,7 +146,8 @@ enum { EFFECT_LINE, EFFECT_TEXTURE, - EFFECT_HALO + EFFECT_HALO, + EFFECT_ECM }; enum diff --git a/src/structs.h b/src/structs.h index d38822a..39d1b6e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -160,7 +160,8 @@ struct Effect { float dx; float dy; float health; - int size; + float size; + float scaleAmount; int r; int g; int b;