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