next iteration, better charselect

This commit is contained in:
laochailan 2019-04-21 10:37:50 +02:00
parent 8c4811f8bd
commit 23a3c2f206
13 changed files with 70 additions and 16 deletions

View file

@ -7,6 +7,7 @@
UNIFORM(1) float R;
UNIFORM(2) vec2 bg_translation;
UNIFORM(3) vec2 center;
UNIFORM(4) sampler2D tex2;
const float bmin = 3*sqrt(3)/2;
@ -41,9 +42,16 @@ void main(void) {
n.zx = dir(phi);
n.xy = rot(theta)*n.xy;
float step = smoothstep(0.2,0.0,n.x)+smoothstep(-0.6,0,n.z);
float antialiasing = smoothstep(bmin,bmin+0.03,b);
n.xy += bg_translation;
vec4 tex1c = texture(tex, n.xy+vec2(0.5,0));
vec4 tex2c = texture(tex2, n.xy+vec2(0.5));
fragColor = r_color * texture(tex, n.xy+bg_translation);
fragColor = r_color * mix(tex1c, tex2c, step);
fragColor.rgb *= antialiasing;
}

View file

@ -28,6 +28,9 @@ static void update_char_menu(MenuData *menu) {
for(int i = 0; i < menu->ecount; i++) {
menu->entries[i].drawdata += 0.08*((menu->cursor != i) - menu->entries[i].drawdata);
}
menu->drawdata[1] += 0.1*(1-menu->entries[menu->cursor].drawdata - menu->drawdata[1]);
menu->drawdata[0] += 0.1*(SELECTED_SUBSHOT(menu)-PLR_SHOT_A - menu->drawdata[0]);
}
MenuData* create_char_menu(void) {
@ -54,7 +57,14 @@ MenuData* create_char_menu(void) {
void draw_char_menu(MenuData *menu) {
CullFaceMode cull_saved = r_cull_current();
draw_main_menu_bg(menu, SCREEN_W/2+100, 0, 0.1*(1-menu->entries[menu->cursor].drawdata));
char *bgs[] = {
"stage3/wspellbg",
"marisa_bombbg",
"youmu_bombbg1",
};
assert(menu->cursor < 3);
draw_main_menu_bg(menu, SCREEN_W/2+100, 0, 0.1*menu->drawdata[1], bgs[menu->cursor]);
draw_menu_title(menu, "Select Character");
r_mat_push();
@ -111,7 +121,7 @@ void draw_char_menu(MenuData *menu) {
text_draw(title, &(TextParams) {
.align = ALIGN_CENTER,
.pos = { 60-20*o, 30 },
.pos = { 20*(1-o), 30 },
.shader = "text_default",
.color = RGBA(o, o, o, o),
});
@ -123,22 +133,50 @@ void draw_char_menu(MenuData *menu) {
r_mat_translate(SCREEN_W/4, SCREEN_H/3, 0);
ShotModeID current_subshot = SELECTED_SUBSHOT(menu);
float f = menu->drawdata[0]-PLR_SHOT_A;
r_color4(0, 0, 0, 0.5);
r_shader_standard_notex();
r_mat_push();
r_mat_translate(-150,225 + 20*f, 0);
r_mat_scale(650, 80+30*f, 1);
r_draw_quad();
r_shader_standard();
r_mat_pop();
for(ShotModeID shot = PLR_SHOT_A; shot < NUM_SHOT_MODES_PER_CHARACTER; shot++) {
PlayerMode *mode = plrmode_find(current_char, shot);
assume(mode != NULL);
int shotidx = shot-PLR_SHOT_A;
if(shot == current_subshot) {
r_color4(0.9, 0.6, 0.2, 1);
float o = 1-fabs(f - shotidx);
float al = 0.2+o;
if(shot == current_subshot && shot == PLR_SHOT_A) {
r_color4(0.9*al, 0.6*al, 0.2*al, 1*al);
} else if(shot == current_subshot && shot == PLR_SHOT_B) {
r_color4(0.2*al, 0.6*al, 0.9*al, 1*al);
} else {
r_color4(1, 1, 1, 1);
r_color4(al, al, al, al);
}
double y = 200 + (100-70*f)*shotidx-20*f;
text_draw(mode->name, &(TextParams) {
.align = ALIGN_CENTER,
.pos = { 0, 200 + 40 * (shot - PLR_SHOT_A) },
.pos = { 0, y},
.shader = "text_default",
});
if(shot == current_subshot) {
r_color4(o, o, o, o);
text_draw_wrapped(mode->description, SCREEN_W/3+40, &(TextParams) {
.align = ALIGN_CENTER,
.pos = { 0, y + 30 },
.shader = "text_default",
});
}
}
r_mat_pop();

View file

@ -58,7 +58,7 @@ MenuData* create_difficulty_menu(void) {
}
void draw_difficulty_menu(MenuData *menu) {
draw_main_menu_bg(menu, 0, 0, 0.05);
draw_main_menu_bg(menu, 0, 0, 0.05, "stage1/cirnobg");
draw_menu_title(menu, "Select Difficulty");
Color c = diff_color;

View file

@ -125,18 +125,19 @@ MenuData* create_main_menu(void) {
return m;
}
void draw_main_menu_bg(MenuData* menu, double center_x, double center_y, double R) {
void draw_main_menu_bg(MenuData* menu, double center_x, double center_y, double R, const char *tex2) {
r_color4(1, 1, 1, 1);
r_shader("mainmenubg");
r_uniform_float("R", R/(1-menu_fade(menu)));
r_uniform_vec2("bg_translation", 0.001*menu->frames, 0);
r_uniform_vec2("center", center_x, center_y);
r_uniform_sampler("tex2", tex2);
fill_screen("menu/mainmenubg");
r_shader_standard();
}
void draw_main_menu(MenuData *menu) {
draw_main_menu_bg(menu, 0, 0, 0.05);
draw_main_menu_bg(menu, 0, 0, 0.05, "stage1/cirnobg");
draw_sprite(390, 300, "menu/logo");
r_mat_push();
@ -155,7 +156,7 @@ void draw_main_menu(MenuData *menu) {
}
text_draw(menu->entries[i].name, &(TextParams) {
.pos = { 50, 20*(i-menu->drawdata[1]) },
.pos = { 50-15*menu->entries[i].drawdata, 20*(i-menu->drawdata[1]) },
.font = "standard",
});
}

View file

@ -14,7 +14,7 @@
#include "menu.h"
MenuData* create_main_menu(void);
void draw_main_menu_bg(MenuData *m, double center_x, double center_y, double R);
void draw_main_menu_bg(MenuData *m, double center_x, double center_y, double R, const char *tex2);
void draw_main_menu(MenuData *m);
void main_menu_update_practice_menus(void);
void draw_loading_screen(void);

View file

@ -876,7 +876,7 @@ MenuData* create_options_menu(void) {
// --- Drawing the menu --- //
void draw_options_menu_bg(MenuData* menu) {
draw_main_menu_bg(menu, 0, 0, 0.05);
draw_main_menu_bg(menu, 0, 0, 0.05, "loading");
r_mat_push();
r_mat_scale(SCREEN_W, SCREEN_H, 1);

View file

@ -84,6 +84,7 @@ typedef double (*PlayerModePropertyProc)(Player *plr, PlrProperty prop);
typedef struct PlayerMode {
const char *name;
const char *description;
PlayerCharacter *character;
PlayerDialogProcs *dialog;
ShotModeID shot_mode;

View file

@ -676,6 +676,7 @@ static void marisa_laser_preload(void) {
PlayerMode plrmode_marisa_a = {
.name = "Laser Sign",
.description = "Kill it with lasers. Dodging is easy anyway. I will shoot them in their faces!",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_LASER,

View file

@ -359,7 +359,8 @@ static void marisa_star_preload(void) {
}
PlayerMode plrmode_marisa_b = {
.name = "Star Sign",
.name = "Star Science",
.description = "These are loads of bullets… some of them are bound to hit. Is this what homing means?",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_STAR,

View file

@ -655,6 +655,7 @@ static double reimu_spirit_property(Player *plr, PlrProperty prop) {
PlayerMode plrmode_reimu_a = {
.name = "Spirit Sign",
.description = "Sometimes it is easier to let your resolve do the aiming.",
.character = &character_reimu,
.dialog = &dialog_reimu,
.shot_mode = PLR_SHOT_REIMU_SPIRIT,

View file

@ -582,7 +582,8 @@ static void reimu_dream_init(Player *plr) {
}
PlayerMode plrmode_reimu_b = {
.name = "Dream Sign",
.name = "Dream Science",
.description = "Bend space like the ribbon in your hair with the power of your dreams!",
.character = &character_reimu,
.dialog = &dialog_reimu,
.shot_mode = PLR_SHOT_REIMU_DREAM,

View file

@ -530,6 +530,7 @@ static void youmu_mirror_bomb_logic(Player *plr) {
PlayerMode plrmode_youmu_a = {
.name = "Mirror Sign",
.description = "Your half ghost companion will give you a hand… or tail.",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_MIRROR,

View file

@ -475,7 +475,8 @@ static void youmu_haunting_init(Player *plr) {
}
PlayerMode plrmode_youmu_b = {
.name = "Haunting Sign",
.name = "Haunting Science",
.description = "Ghosts are realobstacles are not. Keep your timing and release the powers of your employer.",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_HAUNTING,