diff options
| author | david <[email protected]> | 2026-10-30 18:00:06 -0300 |
|---|---|---|
| committer | david <[email protected]> | 2026-10-30 18:00:06 -0300 |
| commit | effca97ac0ce9e93fe29e5c345bd544e87a2a606 (patch) | |
| tree | 161aca0ef9c99c59d1fd82de98322413422092d7 /src | |
| parent | b5e3328f64c1f47c9df03ec8eb7c1098c5f7df83 (diff) | |
| download | mikusays-c-effca97ac0ce9e93fe29e5c345bd544e87a2a606.tar.gz mikusays-c-effca97ac0ce9e93fe29e5c345bd544e87a2a606.zip | |
added teto
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 77 |
1 files changed, 54 insertions, 23 deletions
@@ -1,10 +1,15 @@ #include "../defs/all.h" #include "../defs/mikuart.h" -char **getmikuart(int style){ +char **getmikuart(int style, int isteto){ + if(isteto == 0){ + if(style < 0) + style = rand() % migucount; + return mikuart[style]; + } if(style < 0) - style = rand() % migucount; - return mikuart[style]; + style = rand() % tetocount; + return tetoart[style]; } struct win { @@ -232,7 +237,10 @@ static void print_help(void){ " [TEXT] Text to display in the speech bubble\n\n" "Options:\n" " -s, --style <STYLE> Style of the Miku art. A random one is chosen if not specified\n" - " -l, --list List all available art styles with their indices\n" + " -l, --list List all available art (miku and teto) styles with their indices\n" + " -lm, --listmiku List only the Miku art styles\n" + " -lt, --listteto List only the Teto art styles\n" + " -t, --teto Use Teto art instead of Miku\n" " --rainbow Apply a smooth rainbow gradient across the ASCII art\n" " --saturation <SATURATION> Saturation level for rainbow gradient (0-100) [default: 100]\n" " --brightness <BRIGHTNESS> Brightness level for rainbow gradient (0-100) [default: 50]\n" @@ -244,18 +252,33 @@ static void print_help(void){ " -V, --version Print version\n"); } -static void list_all_art_styles(void){ - printf("Available Miku art styles:\n"); - printf("==========================\n"); - printf("Total styles: %zu\n", migucount); +#define LIST_NONE 0 +#define LIST_BOTH 1 +#define LIST_MIKU 2 +#define LIST_TETO 3 - for(size_t i = 0; i < migucount; i++){ - printf("\n--- Style %zu ---\n", i); - for(int j = 0; mikuart[i][j] != NULL; j++) - printf("%s\n", mikuart[i][j]); +static void list_art_group(const char *name, char ***art, size_t total){ + printf("%s styles (total: %zu)\n", name, total); + printf("==========================\n"); + for(size_t style_index = 0; style_index < total; style_index++){ + printf("\n--- %s style %zu ---\n", name, style_index); + for(int line_index = 0; art[style_index][line_index] != NULL; line_index++) + printf("%s\n", art[style_index][line_index]); } +} + +static void list_all_art_styles(int list_mode){ + printf("Available art styles:\n\n"); + + if(list_mode == LIST_BOTH || list_mode == LIST_MIKU) + list_art_group("Miku", mikuart, migucount); + if(list_mode == LIST_BOTH) + printf("\n"); + if(list_mode == LIST_BOTH || list_mode == LIST_TETO) + list_art_group("Teto", tetoart, tetocount); printf("\nUse --style <number> to select a specific style, or omit for random selection.\n"); + printf("Use --teto to pick from the Teto styles instead of the Miku ones.\n"); printf("\nColor Options:\n" " --rainbow Apply a smooth rainbow gradient\n" @@ -334,11 +357,11 @@ static void print_art_line(const char *line, size_t *index, size_t total){ } -void draw_miku_says(char *text, int style){ +void draw_miku_says(char *text, int style, int teto){ char **speech_bubble_lines = getbubblelines(text); if(speech_bubble_lines == NULL) return; - char **miku_art = getmikuart(style); + char **miku_art = getmikuart(style, teto); int available_width = TERMINALWIDTH; int available_height = TERMINALHEIGHT; @@ -529,8 +552,9 @@ int main(int argc, char **argv){ int has_text = 0, options_ended = 0, ansi_enabled = 0; const char *value, *color_text = NULL, *gradient_text = NULL; ColorParseError color_error; - size_t length = 0; + size_t length = 0, art_total; char *text; + int areyouteto = 0; srand(time(NULL)); getterminalsize(); @@ -558,7 +582,11 @@ int main(int argc, char **argv){ printf("mikusays " VERSION "\n"); goto out; } else if(strcmp(argument, "-l") == 0 || strcmp(argument, "--list") == 0){ - list_requested = 1; + list_requested = LIST_BOTH; + } else if(strcmp(argument, "-lm") == 0 || strcmp(argument, "--listmiku") == 0){ + list_requested = LIST_MIKU; + } else if(strcmp(argument, "-lt") == 0 || strcmp(argument, "--listteto") == 0){ + list_requested = LIST_TETO; } else if(strcmp(argument, "--no-color") == 0){ no_color = 1; colors.mode = MODE_NONE; @@ -566,7 +594,9 @@ int main(int argc, char **argv){ colors.rainbow_enabled = true; } else if(strcmp(argument, "--color-debug") == 0){ color_debug = 1; - } else if(match_value_option(argc, argv, &index, "--style", 's', &value)){ + } else if(strcmp(argument, "--teto") == 0 || strcmp(argument, "-t") == 0){ + areyouteto = 1; + }else if(match_value_option(argc, argv, &index, "--style", 's', &value)){ char *end; long parsed; if(value == NULL){ @@ -621,7 +651,7 @@ int main(int argc, char **argv){ } if(list_requested){ - list_all_art_styles(); + list_all_art_styles(list_requested); goto out; } if(!has_text){ @@ -629,9 +659,10 @@ int main(int argc, char **argv){ result = 1; goto out; } - if(style >= (long)migucount){ - result = usage_error("style %ld does not exist; choose a value between 0 and %lu", - style, (unsigned long)(migucount - 1)); + art_total = areyouteto ? tetocount : migucount; + if(style >= (long)art_total){ + result = usage_error("style %ld does not exist for %s; choose a value between 0 and %lu", + style, areyouteto ? "Teto" : "Miku", (unsigned long)(art_total - 1)); goto out; } @@ -658,9 +689,9 @@ int main(int argc, char **argv){ goto out; } - draw_miku_says(text, (int)style); + draw_miku_says(text, (int)style, (int)areyouteto); //i didn't know you could do labels like in assembly (nasm) this is very useful knowledge out: free(text); return result; -} //ooooo 666 lines spookyyy evillll +} |
