[Add] Added credits.
This commit is contained in:
parent
448d27f4a4
commit
0faad008b5
18
AUTHORS
18
AUTHORS
@ -1,14 +1,20 @@
|
||||
Lead Development Team:
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
-- Allanis
|
||||
* Lead Software Engineer.
|
||||
- Lead Software Engineer
|
||||
|
||||
Contributors:
|
||||
~~~~~~~~~~~~~
|
||||
-- VLack
|
||||
* Testing.
|
||||
* Some Graphics.
|
||||
-- VLack
|
||||
- Testing.
|
||||
- Some Graphics.
|
||||
|
||||
-- M_D_K (Gavin Massey)
|
||||
* Testing.
|
||||
-- M_D_K (Gavin Massey)
|
||||
- Testing.
|
||||
|
||||
-- dfighter (Laszlo Kis-Adam)
|
||||
- Gentle Observer.
|
||||
|
||||
-- slaeshjag (Steven Arnow)
|
||||
- Gentle Observer.
|
||||
|
||||
|
@ -17,6 +17,12 @@ function choose(str)
|
||||
if str == "load" then
|
||||
choose_load()
|
||||
|
||||
elseif str == "intro" then
|
||||
choose_intro()
|
||||
|
||||
elseif str == "credits" then
|
||||
choose_credits()
|
||||
|
||||
elseif str == "land" then
|
||||
choose_land()
|
||||
|
||||
@ -43,9 +49,47 @@ function choose(str)
|
||||
end
|
||||
end
|
||||
|
||||
function checkIfPlayingOrStop(song)
|
||||
if music.isPlaying() then
|
||||
if music.current() ~= song then
|
||||
music.stop()
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Loading songs.
|
||||
function choose_load()
|
||||
music.load("machina")
|
||||
load_song = "machina"
|
||||
-- Don't play again if needed.
|
||||
if checkIfPlayOrStop(load_song) then
|
||||
return
|
||||
end
|
||||
music.load(load_song)
|
||||
music.play()
|
||||
music.play()
|
||||
end
|
||||
|
||||
-- Intro music.
|
||||
function choose_intro()
|
||||
intro_song = "intro"
|
||||
-- Don't play again if needed.
|
||||
if checkIfPlayingOrStop(intro_song) then
|
||||
return
|
||||
end
|
||||
music.load(intro_song)
|
||||
music.play()
|
||||
end
|
||||
|
||||
-- Credits music.
|
||||
function choose_credits()
|
||||
credits_song = "empire1"
|
||||
-- Don't play again if needed.
|
||||
if checkIfPlayingOrStop(credits_song) then
|
||||
return
|
||||
end
|
||||
music.load(credits_song)
|
||||
music.play()
|
||||
end
|
||||
|
||||
|
10
src/intro.c
10
src/intro.c
@ -87,7 +87,7 @@ 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.
|
||||
* @param mus Type of music to use (run through music.lua).
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int intro_display(const char* text, const char* mus) {
|
||||
@ -109,10 +109,8 @@ int intro_display(const char* text, const char* mus) {
|
||||
vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */
|
||||
|
||||
/* Change music to intro music. */
|
||||
if(mus != NULL) {
|
||||
music_load(mus);
|
||||
music_play();
|
||||
}
|
||||
if(mus != NULL)
|
||||
music_choose(mus);
|
||||
|
||||
/* Prepare for intro loop. */
|
||||
x = 100.;
|
||||
@ -144,6 +142,8 @@ int intro_display(const char* text, const char* mus) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* Only thing we actually care about updating is music. */
|
||||
music_update();
|
||||
}
|
||||
|
||||
/* Increment position. */
|
||||
|
68
src/menu.c
68
src/menu.c
@ -22,10 +22,12 @@
|
||||
#include "nebulae.h"
|
||||
#include "pause.h"
|
||||
#include "options.h"
|
||||
#include "intro.h"
|
||||
#include "music.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define MAIN_WIDTH 130 /**< Main menu width. */
|
||||
#define MAIN_HEIGHT 250 /**< Main menu height. */
|
||||
#define MAIN_HEIGHT 300 /**< Main menu height. */
|
||||
|
||||
#define MENU_WIDTH 130 /**< Escape menu width. */
|
||||
#define MENU_HEIGHT 200 /**< Escape menu height. */
|
||||
@ -62,6 +64,7 @@ int menu_open = 0; /**< Store the opened/closed menus. */
|
||||
void menu_main_close(void); /**< Externed in save.c */
|
||||
static void menu_main_load(unsigned int wid, char* str);
|
||||
static void menu_main_new(unsigned int wid, char* str);
|
||||
static void menu_main_credits(unsigned int wid, char* str);
|
||||
static void menu_main_exit(unsigned int wid, char* str);
|
||||
/* Small menu. */
|
||||
static void menu_small_close(unsigned int wid, char* str);
|
||||
@ -93,35 +96,65 @@ static void menu_options_close(unsigned int parent, char* str);
|
||||
* @brief Open the main menu (titlescreen).
|
||||
*/
|
||||
void menu_main(void) {
|
||||
int offset_logo, offset_wdw, freespace;
|
||||
unsigned int bwid, wid;
|
||||
glTexture* tex;
|
||||
|
||||
/* Play load music. */
|
||||
music_choose("load");
|
||||
|
||||
/* Load background etc. */
|
||||
tex = gl_newImage("../gfx/saracraft_logo1.png", 0);
|
||||
nebu_prep(300., 0.); /* Needed for nebuale to not spaz out. */
|
||||
|
||||
/* Calculate logo and window offset. */
|
||||
freespace = SCREEN_H - tex->sh - MAIN_HEIGHT;
|
||||
if(freespace < 0) { /* Not enough freespace, this can get ugly. */
|
||||
offset_logo = SCREEN_W - tex->sh;
|
||||
offset_wdw = 0;
|
||||
} else {
|
||||
/* We'll want a maximum seperation of 30 between logo and text. */
|
||||
if(freespace/3 > 25) {
|
||||
freespace -= 25;
|
||||
offset_logo = -25;
|
||||
offset_wdw = -25 - tex->sh - 25;
|
||||
} else { /* Otherwise space evenly. */
|
||||
offset_logo = -freespace/3;
|
||||
offset_wdw = freespace/3;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create background image window. */
|
||||
bwid = window_create("BG", -1, -1, SCREEN_W, SCREEN_H);
|
||||
window_addRect(bwid, 0, 0, SCREEN_W, SCREEN_H, "rctBG", &cBlack, 0);
|
||||
window_addCust(bwid, 0, 0, SCREEN_W, SCREEN_H, "cstBG", 0,
|
||||
(void(*)(double, double, double, double))nebu_render, NULL);
|
||||
|
||||
window_addImage(bwid, (SCREEN_W-tex->sw)/2., -1, "imgLogo", tex, 0);
|
||||
window_addText(bwid, 0., 20., SCREEN_W, 30., 1, "txtBG", NULL,
|
||||
window_addImage(bwid, (SCREEN_W-tex->sw)/2., offset_logo, "imgLogo", tex, 0);
|
||||
window_addText(bwid, 0., 10, SCREEN_W, 30., 1, "txtBG", NULL,
|
||||
&cWhite, lephisto_version());
|
||||
|
||||
/* Create menu window. */
|
||||
wid = window_create("Main Menu", -1, -1, MAIN_WIDTH, MAIN_HEIGHT);
|
||||
wid = window_create("Main Menu", -1, offset_wdw, MAIN_WIDTH, MAIN_HEIGHT);
|
||||
|
||||
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20)*4,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnLoad", "Load Game", menu_main_load);
|
||||
|
||||
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20)*3,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnLoad", "Load Game", menu_main_load);
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnNew", "New Game", menu_main_new);
|
||||
|
||||
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20)*2,
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnNew", "New Game", menu_main_new);
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnOptions", "Options", (void(*)(unsigned int,char*))menu_options);
|
||||
|
||||
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20),
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnOptions", "Options", (void(*)(unsigned int,char*))menu_options);
|
||||
BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnOptions", "Credits", menu_main_credits);
|
||||
|
||||
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
|
||||
"btnExit", "Exit", menu_main_exit);
|
||||
"btnExit", "Exit", menu_main_exit);
|
||||
|
||||
menu_Open(MENU_MAIN);
|
||||
}
|
||||
@ -163,6 +196,19 @@ static void menu_main_new(unsigned int wid, char* str) {
|
||||
player_new();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to activate the credits menu.
|
||||
* @param wid Unused.
|
||||
* @param str Unused.
|
||||
*/
|
||||
static void menu_main_credits(unsigned int wid, char* str) {
|
||||
(void)str;
|
||||
(void)wid;
|
||||
intro_display("../AUTHORS", "credits");
|
||||
/* We'll need to start music again. */
|
||||
music_choose("load");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to exit the main menu and game.
|
||||
* @param str Unused.
|
||||
|
@ -40,7 +40,7 @@ static char music_situation[PATH_MAX]; /**< What situation music is in. */
|
||||
/* Global music lua. */
|
||||
static lua_State* music_lua = NULL; /**< The Lua music control state. */
|
||||
/* Functions. */
|
||||
static int music_runLua(char* situation);
|
||||
static int music_runLua(const char* situation);
|
||||
static int musicL_load(lua_State* L);
|
||||
static int musicL_play(lua_State* L);
|
||||
static int musicL_stop(lua_State* L);
|
||||
@ -104,7 +104,7 @@ void music_update(void) {
|
||||
* @param situation Situation in to choose music for.
|
||||
* @return 0 on success.
|
||||
*/
|
||||
static int music_runLua(char* situation) {
|
||||
static int music_runLua(const char* situation) {
|
||||
if(music_disabled) return 0;
|
||||
/* Run the choose function in Lua. */
|
||||
lua_getglobal(music_lua, "choose");
|
||||
@ -388,7 +388,7 @@ int lua_loadMusic(lua_State* L, int read_only) {
|
||||
* @param situation choose a new music to play.
|
||||
* @return 0 on success.
|
||||
*/
|
||||
int music_choose(char* situation) {
|
||||
int music_choose(const char* situation) {
|
||||
if(music_disabled) return 0;
|
||||
|
||||
music_runLua(situation);
|
||||
|
@ -23,5 +23,5 @@ int music_isPlaying(void);
|
||||
|
||||
/* Lua control. */
|
||||
int lua_loadMusic(lua_State* L, int read_only);
|
||||
int music_choose(char* situation);
|
||||
int music_choose(const char* situation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user