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 Credit head, *tail;
|
||||||
static float creditSpeed;
|
static float creditSpeed;
|
||||||
static int timeout;
|
static int timeout;
|
||||||
|
static int isFromEnding;
|
||||||
|
|
||||||
void initCredits(void)
|
void initCredits(int fromEnding)
|
||||||
{
|
{
|
||||||
startSectionTransition();
|
startSectionTransition();
|
||||||
|
|
||||||
stopMusic();
|
isFromEnding = fromEnding;
|
||||||
|
|
||||||
memset(&head, 0, sizeof(Credit));
|
memset(&head, 0, sizeof(Credit));
|
||||||
tail = &head;
|
tail = &head;
|
||||||
|
@ -50,9 +51,12 @@ void initCredits(void)
|
||||||
|
|
||||||
loadCredits();
|
loadCredits();
|
||||||
|
|
||||||
loadMusic("music/Eternal Wishes.ogg");
|
if (isFromEnding)
|
||||||
|
{
|
||||||
playMusic(0);
|
loadMusic("music/Eternal Wishes.ogg");
|
||||||
|
|
||||||
|
playMusic(0);
|
||||||
|
}
|
||||||
|
|
||||||
endSectionTransition();
|
endSectionTransition();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +74,16 @@ static void logic(void)
|
||||||
|
|
||||||
if (--timeout <= 0)
|
if (--timeout <= 0)
|
||||||
{
|
{
|
||||||
exit(1);
|
if (isFromEnding)
|
||||||
|
{
|
||||||
|
initTitle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
startSectionTransition();
|
||||||
|
returnToTitle();
|
||||||
|
endSectionTransition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +150,16 @@ static void loadCredits(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
limitTextWidth(0);
|
limitTextWidth(0);
|
||||||
|
|
||||||
/* the music that plays over the credits is 1m 55s, so scroll credits roughly inline with that (plus 2 seconds) */
|
/* 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 = y;
|
||||||
creditSpeed /= timeout;
|
creditSpeed /= timeout;
|
||||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../common.h"
|
#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 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, ...);
|
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 char *readFile(const char *filename);
|
||||||
extern void startSectionTransition(void);
|
extern void startSectionTransition(void);
|
||||||
extern void stopMusic(void);
|
extern void stopMusic(void);
|
||||||
|
extern void returnToTitle(void);
|
||||||
|
extern void initTitle(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void logic(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exit(1);
|
initCredits(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ extern int getWrappedTextHeight(const char *text, int size);
|
||||||
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 initCredits(int playMusic);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue