Don't play credits music if invoked from title.
This commit is contained in:
parent
44dcd06221
commit
6d9264fbac
|
@ -30,12 +30,13 @@ static Atlas *background;
|
|||
static Credit head, *tail;
|
||||
static float creditSpeed;
|
||||
static int timeout;
|
||||
static int isFromEnding;
|
||||
|
||||
void initCredits(void)
|
||||
void initCredits(int fromEnding)
|
||||
{
|
||||
startSectionTransition();
|
||||
|
||||
stopMusic();
|
||||
isFromEnding = fromEnding;
|
||||
|
||||
memset(&head, 0, sizeof(Credit));
|
||||
tail = &head;
|
||||
|
@ -50,9 +51,12 @@ void initCredits(void)
|
|||
|
||||
loadCredits();
|
||||
|
||||
loadMusic("music/Eternal Wishes.ogg");
|
||||
if (isFromEnding)
|
||||
{
|
||||
loadMusic("music/Eternal Wishes.ogg");
|
||||
|
||||
playMusic(0);
|
||||
playMusic(0);
|
||||
}
|
||||
|
||||
endSectionTransition();
|
||||
}
|
||||
|
@ -70,7 +74,16 @@ static void logic(void)
|
|||
|
||||
if (--timeout <= 0)
|
||||
{
|
||||
exit(1);
|
||||
if (isFromEnding)
|
||||
{
|
||||
initTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
startSectionTransition();
|
||||
returnToTitle();
|
||||
endSectionTransition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +152,14 @@ static void loadCredits(void)
|
|||
limitTextWidth(0);
|
||||
|
||||
/* the music that plays over the credits is 1m 55s, so scroll credits roughly inline with that (plus 2 seconds) */
|
||||
timeout = (60 + 57) * FPS;
|
||||
if (isFromEnding)
|
||||
{
|
||||
timeout = (60 + 57) * FPS;
|
||||
}
|
||||
else
|
||||
{
|
||||
timeout = 60 * FPS;
|
||||
}
|
||||
|
||||
creditSpeed = y;
|
||||
creditSpeed /= timeout;
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
#define CREDIT_LINE_LIMIT 500
|
||||
#define CREDIT_LINE_LIMIT 900
|
||||
|
||||
extern void blitRectScaled(SDL_Texture *texture, int x, int y, int w, int h, SDL_Rect *srcRect, int center);
|
||||
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
|
||||
|
@ -34,6 +34,8 @@ extern void playMusic(int loop);
|
|||
extern char *readFile(const char *filename);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern void returnToTitle(void);
|
||||
extern void initTitle(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -65,7 +65,7 @@ static void logic(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
exit(1);
|
||||
initCredits(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ extern int getWrappedTextHeight(const char *text, int size);
|
|||
extern void limitTextWidth(int width);
|
||||
extern char *readFile(const char *filename);
|
||||
extern void startSectionTransition(void);
|
||||
extern void initCredits(int playMusic);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
Loading…
Reference in New Issue