some WIP bikeshedding and fixes

This commit is contained in:
Andrei Alexeyev 2019-04-22 03:07:14 +03:00
parent 23a3c2f206
commit 72d638e168
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
38 changed files with 109 additions and 59 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -0,0 +1,4 @@
w = 164
h = 110

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 137 KiB

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 847
region_y = 206
region_x = 2
region_y = 226
region_w = 140
region_h = 40

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 688
region_y = 2
region_x = 334
region_y = 206
region_w = 305
region_h = 200

View file

@ -1,7 +1,7 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 2
region_x = 643
region_y = 206
region_w = 271
region_h = 200

View file

@ -1,7 +1,7 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 2
region_x = 334
region_y = 2
region_w = 343
region_h = 200

View file

@ -1,7 +1,7 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 349
region_x = 681
region_y = 2
region_w = 335
region_h = 200

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 927
region_y = 250
region_x = 182
region_y = 226
region_w = 32
region_h = 28

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 891
region_y = 250
region_x = 146
region_y = 226
region_w = 32
region_h = 30

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 546 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

View file

@ -1,7 +1,7 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 793
region_x = 918
region_y = 206
region_w = 50
region_h = 100

View file

@ -1,7 +1,12 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 277
region_y = 386
region_w = 231
region_h = 176
region_x = 2
region_y = 2
region_w = 328
region_h = 220
# -- Pasted from the override file --
w = 164
h = 110

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 277
region_y = 206
region_x = 2
region_y = 410
region_w = 512
region_h = 176

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -1,8 +1,8 @@
# Autogenerated by the atlas packer, do not modify
texture = atlas_common_ui_0
region_x = 847
region_y = 250
region_x = 972
region_y = 206
region_w = 40
region_h = 40

View file

@ -8,6 +8,7 @@ UNIFORM(1) float R;
UNIFORM(2) vec2 bg_translation;
UNIFORM(3) vec2 center;
UNIFORM(4) sampler2D tex2;
UNIFORM(5) sampler2D blend_mask;
const float bmin = 3*sqrt(3)/2;
@ -42,16 +43,19 @@ 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 o = 0.1;
float step0 = smoothstep(0.2, 0.0, n.x) + smoothstep(-0.6, 0, n.z);
float step1 = smoothstep(0.2, 0.0, n.x + o) + smoothstep(-0.6, 0, n.z + o);
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));
float blendfac = texture(blend_mask, n.xy).r;
fragColor = r_color * mix(tex1c, tex2c, step);
fragColor = r_color * mix(tex1c, tex2c, clamp(mix(step1, step0, blendfac), 0, 1));
fragColor.rgb *= antialiasing;
}

View file

@ -16,6 +16,7 @@
#include "video.h"
#define SELECTED_SUBSHOT(m) ((intptr_t)PLR_SHOT_A + (intptr_t)(m)->context)
#define DESCRIPTION_WIDTH (SCREEN_W / 3 + 40)
static void set_player_mode(MenuData *m, void *p) {
progress.game_settings.character = (CharacterID)(uintptr_t)p;
@ -29,8 +30,20 @@ static void update_char_menu(MenuData *menu) {
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]);
PlayerCharacter *pchar = plrchar_get((CharacterID)(uintptr_t)menu->entries[menu->cursor].arg);
assume(pchar != NULL);
PlayerMode *m = plrmode_find(pchar->id, SELECTED_SUBSHOT(menu));
assume(m != NULL);
Font *font = get_font("standard");
char buf[256] = { 0 };
text_wrap(font, m->description, DESCRIPTION_WIDTH, buf, sizeof(buf));
double height = text_height(font, buf, 0) + font_get_lineskip(font) * 2;
fapproach_asymptotic_p(&menu->drawdata[0], SELECTED_SUBSHOT(menu) - PLR_SHOT_A, 0.1, 1e-5);
fapproach_asymptotic_p(&menu->drawdata[1], 1 - menu->entries[menu->cursor].drawdata, 0.1, 1e-5);
fapproach_asymptotic_p(&menu->drawdata[2], height, 0.1, 1e-5);
}
MenuData* create_char_menu(void) {
@ -62,9 +75,15 @@ void draw_char_menu(MenuData *menu) {
"marisa_bombbg",
"youmu_bombbg1",
};
char *prefixes[] = {
"Intuition",
"Science",
};
assert(menu->cursor < 3);
draw_main_menu_bg(menu, SCREEN_W/2+100, 0, 0.1*menu->drawdata[1], bgs[menu->cursor]);
draw_main_menu_bg(menu, SCREEN_W/2+100, 0, 0.1*menu->drawdata[1], "menu/mainmenubg", bgs[menu->cursor]);
draw_menu_title(menu, "Select Character");
r_mat_push();
@ -134,19 +153,18 @@ void draw_char_menu(MenuData *menu) {
ShotModeID current_subshot = SELECTED_SUBSHOT(menu);
float f = menu->drawdata[0]-PLR_SHOT_A;
float selbg_ofs = 200 + (100-70*f)*f-20*f - font_get_lineskip(get_font("standard")) * 0.7;
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_mat_translate(-150, selbg_ofs + menu->drawdata[2] * 0.5, 0);
r_mat_scale(650, menu->drawdata[2], 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);
@ -162,8 +180,11 @@ void draw_char_menu(MenuData *menu) {
r_color4(al, al, al, al);
}
char buf[64];
snprintf(buf, sizeof(buf), "%s: %s", prefixes[shot - PLR_SHOT_A], mode->name);
double y = 200 + (100-70*f)*shotidx-20*f;
text_draw(mode->name, &(TextParams) {
text_draw(buf, &(TextParams) {
.align = ALIGN_CENTER,
.pos = { 0, y},
.shader = "text_default",
@ -171,7 +192,7 @@ void draw_char_menu(MenuData *menu) {
if(shot == current_subshot) {
r_color4(o, o, o, o);
text_draw_wrapped(mode->description, SCREEN_W/3+40, &(TextParams) {
text_draw_wrapped(mode->description, DESCRIPTION_WIDTH, &(TextParams) {
.align = ALIGN_CENTER,
.pos = { 0, y + 30 },
.shader = "text_default",

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, "stage1/cirnobg");
draw_main_menu_bg(menu, 0, 0, 0.05, "menu/mainmenubg", "stage1/cirnobg");
draw_menu_title(menu, "Select Difficulty");
Color c = diff_color;

View file

@ -125,20 +125,32 @@ MenuData* create_main_menu(void) {
return m;
}
void draw_main_menu_bg(MenuData* menu, double center_x, double center_y, double R, const char *tex2) {
void draw_main_menu_bg(MenuData* menu, double center_x, double center_y, double R, const char *tex1, 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("blend_mask", "cell_noise");
r_uniform_sampler("tex2", tex2);
fill_screen("menu/mainmenubg");
fill_screen(tex1);
r_shader_standard();
}
void draw_main_menu(MenuData *menu) {
draw_main_menu_bg(menu, 0, 0, 0.05, "stage1/cirnobg");
draw_sprite(390, 300, "menu/logo");
draw_main_menu_bg(menu, 0, 0, 0.05, "menu/mainmenubg", "stage1/cirnobg");
float rot = sqrt(menu->frames/120.0);
float rotfac = (1 - pow(menu_fade(menu), 2.0));
r_draw_sprite(&(SpriteParams) {
.sprite = "menu/logo",
.pos = { SCREEN_W/2, SCREEN_H/2 },
.shader = "sprite_default",
.rotation.vector = { 0, -1, 0 },
.rotation.angle = max(0, M_PI/1.5 - min(M_PI/1.5, rot) * rotfac),
.color = color_mul_scalar(RGBA(1, 1, 1, 1), min(1, rot) * rotfac),
});
r_mat_push();
r_mat_translate(0, SCREEN_H/2, 0);
@ -216,14 +228,13 @@ void draw_loading_screen(void) {
preload_resource(RES_TEXTURE, "loading", RESF_PERMANENT);
set_ortho(SCREEN_W, SCREEN_H);
fill_screen("loading");
/*
text_draw(TAISEI_VERSION, &(TextParams) {
.align = ALIGN_RIGHT,
.pos = { SCREEN_W-5, SCREEN_H-10 },
.font = "small",
text_draw("Please wait warmly…", &(TextParams) {
.align = ALIGN_CENTER,
.pos = { SCREEN_W/2, SCREEN_H-10 },
.font = "standard",
.shader = "text_default",
.color = RGBA(0.25, 0.25, 0.25, 0.25),
});
*/
video_swap_buffers();
}

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, const char *tex2);
void draw_main_menu_bg(MenuData *m, double center_x, double center_y, double R, const char *tex1, 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,8 @@ MenuData* create_options_menu(void) {
// --- Drawing the menu --- //
void draw_options_menu_bg(MenuData* menu) {
draw_main_menu_bg(menu, 0, 0, 0.05, "loading");
// draw_main_menu_bg(menu, 0, 0, 0.05, "abstract_brown", "stage1/cirnobg");
draw_main_menu_bg(menu, 0, 0, 0.05, "abstract_brown", "abstract_blue");
r_mat_push();
r_mat_scale(SCREEN_W, SCREEN_H, 1);

View file

@ -675,8 +675,8 @@ 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!",
.name = "Illusion Laser",
.description = "Kill it with lasers! Dodging is easy when nobody's firing. Just shoot them in the face, if they have one.",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_LASER,

View file

@ -359,8 +359,8 @@ static void marisa_star_preload(void) {
}
PlayerMode plrmode_marisa_b = {
.name = "Star Science",
.description = "These are loads of bullets… some of them are bound to hit. Is this what homing means?",
.name = "Stellar Vortex",
.description = "Loads and loads of bullets. Some of them are bound to hit. That's called “homing”, right?",
.character = &character_marisa,
.dialog = &dialog_marisa,
.shot_mode = PLR_SHOT_MARISA_STAR,

View file

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

View file

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

View file

@ -529,8 +529,8 @@ 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.",
.name = "Soul Reflection",
.description = "Your dual nature shall lend you a hand… or a tail.",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_MIRROR,

View file

@ -475,8 +475,8 @@ static void youmu_haunting_init(Player *plr) {
}
PlayerMode plrmode_youmu_b = {
.name = "Haunting Science",
.description = "Ghosts are realobstacles are not. Keep your timing and release the powers of your employer.",
.name = "Haunting Revelation",
.description = "Ghosts are real, and quite hospitable too. The Netherworld shall welcome your foes, if you choose a good time to send the invitation.",
.character = &character_youmu,
.dialog = &dialog_youmu,
.shot_mode = PLR_SHOT_YOUMU_HAUNTING,

View file

@ -883,6 +883,10 @@ int text_ucs4_height_raw(Font *font, const uint32_t *text, uint maxlines) {
if(text_lines++ == maxlines) {
break;
}
if(*tptr == '\n') {
++tptr;
}
}
return font->metrics.lineskip * text_lines;