Added portal effect to jumpgate.

This commit is contained in:
Steve 2016-03-07 22:50:41 +00:00
parent ecdf9998d0
commit a74ff87a46
5 changed files with 24 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 149 KiB

BIN
gfx/entities/portal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -20,12 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "entities.h"
static Entity deadHead;
static Entity *deadTail;
static int disabledGlow;
static int disabledGlowDir;
static void drawEntity(Entity *e);
static void doEntity(void);
static void alignComponents(void);
@ -37,6 +31,13 @@ static int drawComparator(const void *a, const void *b);
static void notifyNewArrivals(void);
static int isCapitalShipComponent(Entity *e);
static SDL_Texture *jumpPortal;
static float jumpPortAngle;
static Entity deadHead;
static Entity *deadTail;
static int disabledGlow;
static int disabledGlowDir;
void initEntities(void)
{
memset(&deadHead, 0, sizeof(Entity));
@ -45,6 +46,9 @@ void initEntities(void)
disabledGlow = DISABLED_GLOW_MAX;
disabledGlowDir = -DISABLED_GLOW_SPEED;
jumpPortal = getTexture("gfx/entities/portal.png");
jumpPortAngle = 0;
}
Entity *spawnEntity(void)
@ -253,6 +257,12 @@ void doEntities(void)
{
disabledGlowDir = -DISABLED_GLOW_SPEED;
}
jumpPortAngle += 0.5;
if (jumpPortAngle >= 360)
{
jumpPortAngle -= 360;
}
}
static void restrictToBattleArea(Entity *e)
@ -381,6 +391,11 @@ void drawEntities(void)
static void drawEntity(Entity *e)
{
if (e->type == ET_JUMPGATE)
{
blitRotated(jumpPortal, e->x - battle.camera.x, e->y - battle.camera.y, jumpPortAngle);
}
SDL_SetTextureColorMod(e->texture, 255, 255, 255);
if (e->armourHit > 0)

View File

@ -35,6 +35,8 @@ extern void drawShieldHitEffect(Entity *e);
extern void removeFromQuadtree(Entity *e, Quadtree *root);
extern void addToQuadtree(Entity *e, Quadtree *root);
extern void updateCapitalShipComponentProperties(Entity *parent);
extern void drawJumpPortal(Entity *e);
extern SDL_Texture *getTexture(char *filename);
extern App app;
extern Battle battle;

View File

@ -87,7 +87,7 @@ char *getSaveFilePath(char *filename)
sprintf(path, "%s/%s", app.saveDir, filename);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "getSaveFilePath = '%s'", path);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "getSaveFilePath = '%s'", path);
return path;
}