Added Torelli destruction.

This commit is contained in:
Steve 2016-05-30 11:58:16 +01:00
parent a9fb850f05
commit 35b36754e6
5 changed files with 34 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -35,6 +35,7 @@ static void start(void);
static void options(void); static void options(void);
static void returnFromOptions(void); static void returnFromOptions(void);
static void checkSuspicionLevel(void); static void checkSuspicionLevel(void);
static void doTorelliFireStorm(void);
static int show; static int show;
static float ssx, ssy; static float ssx, ssy;
@ -159,6 +160,8 @@ static void doBattle(void)
doPlayer(); doPlayer();
checkSuspicionLevel(); checkSuspicionLevel();
doTorelliFireStorm();
if (player->alive == ALIVE_ALIVE) if (player->alive == ALIVE_ALIVE)
{ {
@ -213,6 +216,13 @@ static void draw(void)
drawBackground(battle.background); drawBackground(battle.background);
blitScaled(battle.planetTexture, battle.planet.x, battle.planet.y, battle.planetWidth, battle.planetHeight); blitScaled(battle.planetTexture, battle.planet.x, battle.planet.y, battle.planetWidth, battle.planetHeight);
if (battle.destroyTorelli)
{
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetTextureAlphaMod(battle.fireStormTexture, battle.torelliFireStormAlpha);
blitScaled(battle.fireStormTexture, battle.planet.x, battle.planet.y, battle.planetWidth, battle.planetHeight);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
}
drawStars(); drawStars();
@ -415,6 +425,14 @@ static void checkSuspicionLevel(void)
} }
} }
static void doTorelliFireStorm(void)
{
if (battle.destroyTorelli)
{
battle.torelliFireStormAlpha = MIN(battle.torelliFireStormAlpha + 0.25, 255);
}
}
void destroyBattle(void) void destroyBattle(void)
{ {
Entity *ent; Entity *ent;

View File

@ -299,6 +299,10 @@ static void executeNextLine(ScriptRunner *runner)
{ {
runScript = 0; runScript = 0;
} }
else if (strcmp(command, "DESTROY_TORELLI") == 0)
{
battle.destroyTorelli = 1;
}
else else
{ {
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "ERROR: Unrecognised script command '%s'\n", command); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "ERROR: Unrecognised script command '%s'\n", command);

View File

@ -154,6 +154,7 @@ void loadMission(char *filename)
} }
battle.planetTexture = getTexture(planet); battle.planetTexture = getTexture(planet);
battle.fireStormTexture = getTexture("gfx/planets/torelliFireStorm.png");
battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH); battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH);
battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT); battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT);
@ -163,6 +164,14 @@ void loadMission(char *filename)
planetScale = 75 + (rand() % 125); planetScale = 75 + (rand() % 125);
planetScale *= 0.01; planetScale *= 0.01;
if (getJSONValue(root, "largePlanet", 0))
{
battle.planet.x = (SCREEN_WIDTH / 2);
battle.planet.y = (SCREEN_HEIGHT / 2);
planetScale = 5;
}
battle.planetWidth *= planetScale; battle.planetWidth *= planetScale;
battle.planetHeight *= planetScale; battle.planetHeight *= planetScale;
} }

View File

@ -358,11 +358,13 @@ typedef struct {
int suspicionLevel; int suspicionLevel;
int suspicionCoolOff; int suspicionCoolOff;
int zackariaSuspicionLevel; int zackariaSuspicionLevel;
int destroyTorelli;
float torelliFireStormAlpha;
Entity *missionTarget; Entity *missionTarget;
Entity *jumpgate; Entity *jumpgate;
Entity *messageSpeaker; Entity *messageSpeaker;
Entity *lastKilledPlayer; Entity *lastKilledPlayer;
SDL_Texture *background, *planetTexture; SDL_Texture *background, *planetTexture, *fireStormTexture;
PointF planet; PointF planet;
int planetWidth, planetHeight; int planetWidth, planetHeight;
Entity entityHead, *entityTail; Entity entityHead, *entityTail;