Shield hit effect optimisation.
This commit is contained in:
parent
182e34859e
commit
048d3b17e0
|
@ -95,6 +95,13 @@ void drawEffects(void)
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawShieldHitEffect(Entity *e)
|
||||||
|
{
|
||||||
|
SDL_SetTextureBlendMode(shieldHitTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
SDL_SetTextureAlphaMod(shieldHitTexture, e->shieldHit);
|
||||||
|
blit(shieldHitTexture, e->x - battle.camera.x, e->y - battle.camera.y, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void addSmallFighterExplosion(void)
|
void addSmallFighterExplosion(void)
|
||||||
{
|
{
|
||||||
Effect *e;
|
Effect *e;
|
||||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h);
|
extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h);
|
||||||
extern SDL_Texture *getTexture(char *name);
|
extern SDL_Texture *getTexture(char *name);
|
||||||
|
extern void blit(SDL_Texture *t, int x, int y, int center);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -359,8 +359,6 @@ static void separate(void)
|
||||||
|
|
||||||
void drawFighter(Entity *e)
|
void drawFighter(Entity *e)
|
||||||
{
|
{
|
||||||
SDL_Texture *shieldHitTexture = getTexture("gfx/battle/shieldHit.png");
|
|
||||||
|
|
||||||
SDL_SetTextureColorMod(e->texture, 255, 255, 255);
|
SDL_SetTextureColorMod(e->texture, 255, 255, 255);
|
||||||
|
|
||||||
if (e->armourHit > 0)
|
if (e->armourHit > 0)
|
||||||
|
@ -377,9 +375,7 @@ void drawFighter(Entity *e)
|
||||||
|
|
||||||
if (e->shieldHit > 0)
|
if (e->shieldHit > 0)
|
||||||
{
|
{
|
||||||
SDL_SetTextureBlendMode(shieldHitTexture, SDL_BLENDMODE_BLEND);
|
drawShieldHitEffect(e);
|
||||||
SDL_SetTextureAlphaMod(shieldHitTexture, e->shieldHit);
|
|
||||||
blit(shieldHitTexture, e->x - battle.camera.x, e->y - battle.camera.y, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,8 +624,8 @@ static void loadFighterDef(char *filename)
|
||||||
|
|
||||||
STRNCPY(f->name, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH);
|
STRNCPY(f->name, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH);
|
||||||
STRNCPY(f->defName, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH);
|
STRNCPY(f->defName, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH);
|
||||||
f->health = f->maxHealth = cJSON_GetObjectItem(root, "health")->valueint;
|
f->health = f->maxHealth = cJSON_GetObjectItem(root, "health")->valueint * 2;
|
||||||
f->shield = f->maxShield = cJSON_GetObjectItem(root, "shield")->valueint;
|
f->shield = f->maxShield = cJSON_GetObjectItem(root, "shield")->valueint * 2;
|
||||||
f->speed = cJSON_GetObjectItem(root, "speed")->valuedouble;
|
f->speed = cJSON_GetObjectItem(root, "speed")->valuedouble;
|
||||||
f->reloadTime = cJSON_GetObjectItem(root, "reloadTime")->valueint;
|
f->reloadTime = cJSON_GetObjectItem(root, "reloadTime")->valueint;
|
||||||
f->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint;
|
f->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint;
|
||||||
|
|
|
@ -48,6 +48,7 @@ extern long lookup(char *name);
|
||||||
extern long flagsToLong(char *flags);
|
extern long flagsToLong(char *flags);
|
||||||
extern void addShieldSplinterEffect(Entity *ent);
|
extern void addShieldSplinterEffect(Entity *ent);
|
||||||
extern void completeMission(void);
|
extern void completeMission(void);
|
||||||
|
extern void drawShieldHitEffect(Entity *e);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
Loading…
Reference in New Issue