Ending tweaks.
This commit is contained in:
parent
39362061bf
commit
f1b2e8df6d
|
@ -33,6 +33,8 @@ static int endingTimer;
|
||||||
|
|
||||||
void initEnding(void)
|
void initEnding(void)
|
||||||
{
|
{
|
||||||
|
startSectionTransition();
|
||||||
|
|
||||||
background[0] = getImageFromAtlas("gfx/ending/ending01.jpg");
|
background[0] = getImageFromAtlas("gfx/ending/ending01.jpg");
|
||||||
background[1] = getImageFromAtlas("gfx/ending/ending02.jpg");
|
background[1] = getImageFromAtlas("gfx/ending/ending02.jpg");
|
||||||
|
|
||||||
|
@ -46,11 +48,15 @@ void initEnding(void)
|
||||||
|
|
||||||
app.delegate.logic = &logic;
|
app.delegate.logic = &logic;
|
||||||
app.delegate.draw = &draw;
|
app.delegate.draw = &draw;
|
||||||
|
|
||||||
|
endSectionTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logic(void)
|
static void logic(void)
|
||||||
{
|
{
|
||||||
if (--endingTimer <= -FPS / 2)
|
if (--endingTimer <= -FPS / 2)
|
||||||
|
{
|
||||||
|
if (endingTextIndex < NUM_ENDING_LINES)
|
||||||
{
|
{
|
||||||
if (++endingTextIndex == 3)
|
if (++endingTextIndex == 3)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +70,13 @@ static void logic(void)
|
||||||
endingTimer = strlen(endingText[endingTextIndex]) * 4;
|
endingTimer = strlen(endingText[endingTextIndex]) * 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
fadeMusic(3000);
|
||||||
|
|
||||||
|
endingTimer = FPS * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
initCredits(1);
|
initCredits(1);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +92,7 @@ static void draw(void)
|
||||||
|
|
||||||
blitRectScaled(atlasTexture->texture, 0, SCREEN_HEIGHT - h, SCREEN_WIDTH, h, &background[endingImageIndex]->rect, 0);
|
blitRectScaled(atlasTexture->texture, 0, SCREEN_HEIGHT - h, SCREEN_WIDTH, h, &background[endingImageIndex]->rect, 0);
|
||||||
|
|
||||||
if (endingTimer > 0)
|
if (endingTimer > 0 && endingTextIndex < NUM_ENDING_LINES)
|
||||||
{
|
{
|
||||||
limitTextWidth(SCREEN_WIDTH / 2);
|
limitTextWidth(SCREEN_WIDTH / 2);
|
||||||
th = getWrappedTextHeight(endingText[endingTextIndex], 24) + 15;
|
th = getWrappedTextHeight(endingText[endingTextIndex], 24) + 15;
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern void initCredits(int playMusic);
|
||||||
extern void limitTextWidth(int width);
|
extern void limitTextWidth(int width);
|
||||||
extern char *readFile(const char *filename);
|
extern char *readFile(const char *filename);
|
||||||
extern void startSectionTransition(void);
|
extern void startSectionTransition(void);
|
||||||
|
extern void fadeMusic(int ms);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
|
@ -77,15 +77,13 @@ void initPostMission(void)
|
||||||
if (world.isReturnVisit)
|
if (world.isReturnVisit)
|
||||||
{
|
{
|
||||||
saveGame();
|
saveGame();
|
||||||
|
|
||||||
saveWorld();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
restoreGameState();
|
restoreGameState();
|
||||||
|
}
|
||||||
|
|
||||||
saveGame();
|
saveGame();
|
||||||
}
|
|
||||||
|
|
||||||
destroyWorld();
|
destroyWorld();
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,11 @@ void stopMusic(void)
|
||||||
Mix_HaltMusic();
|
Mix_HaltMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fadeMusic(int ms)
|
||||||
|
{
|
||||||
|
Mix_FadeOutMusic(ms);
|
||||||
|
}
|
||||||
|
|
||||||
void musicSetPlaying(int playing)
|
void musicSetPlaying(int playing)
|
||||||
{
|
{
|
||||||
if (music != NULL)
|
if (music != NULL)
|
||||||
|
|
Loading…
Reference in New Issue