Boss BGM title now may have different color rather than same as stage tilte color (this makes sense on stage 4)

This commit is contained in:
makise-homura 2017-02-03 18:56:36 +03:00
parent 9984e48f3d
commit 4b26b3ebb9
4 changed files with 26 additions and 15 deletions

View file

@ -153,9 +153,16 @@ void start_bgm(char *name) {
warn_alut_error("checking state of music source");
// Support drawing BGM title in game loop
current_bgm.started_at =
((current_bgm.title = get_bgm_desc(resources.bgm_descriptions, current_bgm.name)) != NULL) ?
global.frames : -1;
if ((current_bgm.title = get_bgm_desc(resources.bgm_descriptions, current_bgm.name)) != NULL)
{
current_bgm.started_at = global.frames;
// Boss BGM title color may differ from the one at beginning of stage
current_bgm.isboss = (strstr(current_bgm.name, "boss") != NULL);
}
else
{
current_bgm.started_at = -1;
}
if(play != AL_PLAYING)
{

View file

@ -21,6 +21,7 @@ typedef struct Bgm_desc {
struct current_bgm_t {
char *name;
char *title;
int isboss;
Sound *data;
int started_at;
};

View file

@ -19,13 +19,14 @@
#include "menu/gameovermenu.h"
#include "taisei_err.h"
StageInfo stages[] = {
{1, stage1_loop, False, "Stage 1", "Misty Lake", {1, 1, 1}},
{2, stage2_loop, False, "Stage 2", "Walk Along the Border", {1, 1, 1}},
{3, stage3_loop, False, "Stage 3", "Through the Tunnel of Light", {0, 0, 0}},
{4, stage4_loop, False, "Stage 4", "Forgotten Mansion", {0, 0, 0}},
{5, stage5_loop, False, "Stage 5", "Climbing the Tower of Babel", {1, 1, 1}},
{6, stage6_loop, False, "Stage 6", "Roof of the World", {1, 1, 1}},
StageInfo stages[] = {
// id loop hidden title subtitle titleclr bosstitleclr
{1, stage1_loop, False, "Stage 1", "Misty Lake", {1, 1, 1}, {1, 1, 1}},
{2, stage2_loop, False, "Stage 2", "Walk Along the Border", {1, 1, 1}, {1, 1, 1}},
{3, stage3_loop, False, "Stage 3", "Through the Tunnel of Light", {0, 0, 0}, {0, 0, 0}},
{4, stage4_loop, False, "Stage 4", "Forgotten Mansion", {0, 0, 0}, {1, 1, 1}},
{5, stage5_loop, False, "Stage 5", "Climbing the Tower of Babel", {1, 1, 1}, {1, 1, 1}},
{6, stage6_loop, False, "Stage 6", "Roof of the World", {1, 1, 1}, {1, 1, 1}},
{0, NULL, False, NULL, NULL}
};
@ -538,7 +539,7 @@ void stage_loop(StageInfo* info, StageRule start, StageRule end, StageRule draw,
SDL_EnableKeyRepeat(TS_KR_DELAY, TS_KR_INTERVAL);
}
void draw_title(int t, StageInfo *info, Alignment al, int x, int y, const char *text, TTF_Font *font) {
void draw_title(int t, StageInfo *info, Alignment al, int x, int y, const char *text, TTF_Font *font, Color *color) {
int i;
float f = 0;
if(t < 30 || t > 220)
@ -554,7 +555,7 @@ void draw_title(int t, StageInfo *info, Alignment al, int x, int y, const char *
glUseProgram(sha->prog);
glUniform1i(uniloc(sha, "trans"), 1);
glUniform1f(uniloc(sha, "t"), 1.0-f);
glUniform3fv(uniloc(sha, "color"), 1, (float *)&info->titleclr);
glUniform3fv(uniloc(sha, "color"), 1, (float *)color);
glActiveTexture(GL_TEXTURE0 + 1);
glBindTexture(GL_TEXTURE_2D, get_tex("titletransition")->gltex);
@ -572,11 +573,12 @@ void draw_title(int t, StageInfo *info, Alignment al, int x, int y, const char *
void draw_stage_title(StageInfo *info) {
int t = global.frames;
draw_title(t, info, AL_Center, VIEWPORT_W/2, VIEWPORT_H/2-40, info->title, _fonts.mainmenu);
draw_title(t, info, AL_Center, VIEWPORT_W/2, VIEWPORT_H/2, info->subtitle, _fonts.standard);
draw_title(t, info, AL_Center, VIEWPORT_W/2, VIEWPORT_H/2-40, info->title, _fonts.mainmenu, &info->titleclr);
draw_title(t, info, AL_Center, VIEWPORT_W/2, VIEWPORT_H/2, info->subtitle, _fonts.standard, &info->titleclr);
if ((current_bgm.title != NULL) && (current_bgm.started_at >= 0))
{
draw_title(t - current_bgm.started_at, info, AL_Right, VIEWPORT_W-15, VIEWPORT_H-35, current_bgm.title, _fonts.standard);
draw_title(t - current_bgm.started_at, info, AL_Right, VIEWPORT_W-15, VIEWPORT_H-35, current_bgm.title, _fonts.standard,
current_bgm.isboss ? &info->bosstitleclr : &info->titleclr);
}
}

View file

@ -40,6 +40,7 @@ typedef struct StageInfo {
char *subtitle;
Color titleclr;
Color bosstitleclr;
} StageInfo;
extern StageInfo stages[];