[Change] You can now determine different text/music using the intro
code.
This commit is contained in:
parent
bb81e44374
commit
448d27f4a4
19
src/intro.c
19
src/intro.c
@ -25,16 +25,16 @@ static int intro_nlines = 0; /**< Number of introduction text lines. */
|
||||
static int intro_length = 0; /**< Length of the text. */
|
||||
static glFont intro_font; /** Introduction font. */
|
||||
|
||||
static int intro_load(void);
|
||||
static int intro_load(const char* text);
|
||||
static void intro_cleanup(void);
|
||||
|
||||
static int intro_load(void) {
|
||||
static int intro_load(const char* text) {
|
||||
uint32_t intro_size;
|
||||
char* intro_buf;
|
||||
int i, p, n;
|
||||
int mem;
|
||||
|
||||
intro_buf = ldata_read("../dat/intro", &intro_size);
|
||||
intro_buf = ldata_read(text, &intro_size);
|
||||
intro_length = intro_size; /* Length aproximation! */
|
||||
|
||||
/* Create intro font. */
|
||||
@ -86,8 +86,11 @@ static void intro_cleanup(void) {
|
||||
|
||||
/**
|
||||
* @brief Display the introduction sequence.
|
||||
* @param text Path of text file to use.
|
||||
* @param mus Name of music to use.
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int intro_display(void) {
|
||||
int intro_display(const char* text, const char* mus) {
|
||||
int i, max;
|
||||
unsigned int tcur, tlast;
|
||||
double dt;
|
||||
@ -97,7 +100,7 @@ int intro_display(void) {
|
||||
SDL_Event event;
|
||||
|
||||
/* Load the introduction. */
|
||||
if(intro_load() < 0)
|
||||
if(intro_load(text) < 0)
|
||||
return -1;
|
||||
|
||||
/* Calculate velocity. */
|
||||
@ -106,8 +109,10 @@ int intro_display(void) {
|
||||
vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */
|
||||
|
||||
/* Change music to intro music. */
|
||||
music_load("intro");
|
||||
music_play();
|
||||
if(mus != NULL) {
|
||||
music_load(mus);
|
||||
music_play();
|
||||
}
|
||||
|
||||
/* Prepare for intro loop. */
|
||||
x = 100.;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
int intro_display(void);
|
||||
int intro_display(const char* text, const char* mus);
|
||||
|
||||
|
@ -183,7 +183,7 @@ void player_new(void) {
|
||||
if(player_newMake())
|
||||
return;
|
||||
|
||||
intro_display();
|
||||
intro_display("../dat/intro", "intro");
|
||||
|
||||
/* Add the mission if found. */
|
||||
if(player_mission != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user