diff --git a/doc/man/man1/notcurses-demo.1.md b/doc/man/man1/notcurses-demo.1.md index a18df4a22..99fb87dbd 100644 --- a/doc/man/man1/notcurses-demo.1.md +++ b/doc/man/man1/notcurses-demo.1.md @@ -27,7 +27,7 @@ The demonstrations include (see NOTES below): * (***c***)hunli—the strongest woman in the world * (***d***)ragon—the Harter-Heighway dragon curve * (***e***)agle—they took some time off my life, back in the day -* (***f***)allin'—the screen falls apart under heavy blows +* (***f***)ission—the screen falls apart under heavy blows * (***g***)rid—a gradient of color lain atop a great grid * (***h***)ighcon—high contrast text atop various colors * (***i***)ntro—a setting of tone diff --git a/src/demo/demo.c b/src/demo/demo.c index 8d2edfbfd..29903e7c9 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -79,7 +79,7 @@ static struct { { "chunli", chunli_demo, true, }, { "dragon", dragon_demo, false, }, { "eagle", eagle_demo, true, }, - { "fallin'", fallin_demo, false, }, + { "fission", fission_demo, false, }, { "grid", grid_demo, false, }, { "highcon", highcontrast_demo, false, }, { "intro", intro, false, }, diff --git a/src/demo/demo.h b/src/demo/demo.h index b42414656..29d4cdf91 100644 --- a/src/demo/demo.h +++ b/src/demo/demo.h @@ -34,7 +34,7 @@ int chunli_demo(struct notcurses* nc); int dragon_demo(struct notcurses* nc); int qrcode_demo(struct notcurses* nc); int grid_demo(struct notcurses* nc); -int fallin_demo(struct notcurses* nc); +int fission_demo(struct notcurses* nc); int highcontrast_demo(struct notcurses* nc); int jungle_demo(struct notcurses* nc); int yield_demo(struct notcurses* nc); diff --git a/src/demo/fallin.c b/src/demo/fission.c similarity index 93% rename from src/demo/fallin.c rename to src/demo/fission.c index e8f04dd72..82480d305 100644 --- a/src/demo/fallin.c +++ b/src/demo/fission.c @@ -23,7 +23,9 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){ // ahead and get it kicked off if(rangee - ranges + 1 < FALLINGMAX){ if(rangee < arrcount){ - speeds[rangee - ranges] = 1; + int y; + ncplane_yx(arr[ranges], &y, NULL); + speeds[rangee - ranges] = y < stdy / 2 ? 1 : -1; ++rangee; } } @@ -38,7 +40,7 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){ int x, y; ncplane_yx(ncp, &y, &x); if(felloff){ - if(y + speeds[i] >= stdy){ + if(y + speeds[i] >= stdy || y + speeds[i] + ncplane_dim_y(ncp) < 0){ ncplane_destroy(ncp); arr[ranges + i] = NULL; if(ranges + i + 1 == rangee){ @@ -58,7 +60,11 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){ } if(!felloff){ ncplane_move_yx(ncp, y + speeds[i], x); - ++speeds[i]; + if(speeds[i] < 0){ + --speeds[i]; + }else{ + ++speeds[i]; + } }else if(i){ if(rangee - ranges - i){ memmove(speeds, speeds + i, (rangee - ranges - i) * sizeof(*speeds)); @@ -91,8 +97,8 @@ shuffle_in(struct ncplane** arr, int count, struct ncplane* n){ return arr; } -// ya playin' yourself -int fallin_demo(struct notcurses* nc){ +// you played yourself https://genius.com/De-la-soul-fallin-lyrics +int fission_demo(struct notcurses* nc){ int dimx, dimy; struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx); size_t usesize = sizeof(bool) * dimy * dimx;