diff options
| author | @syxhe <https://t.me/syxhe> | 2024-08-30 12:03:32 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-08-30 12:03:32 -0500 |
| commit | 9497cdd0d6d1483f559aacf3f8f2bbb6a11716ab (patch) | |
| tree | 4f9f6a9cbddc8da0ffb3ee4d343b4995f41c7713 /src/screen.c | |
| parent | 3949b874d1a178ff131a1ff4a0855fdf65c8ddc7 (diff) | |
Create seizure inducing winning anim
Diffstat (limited to 'src/screen.c')
| -rw-r--r-- | src/screen.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/screen.c b/src/screen.c index fa5bb28..5fe2822 100644 --- a/src/screen.c +++ b/src/screen.c | |||
| @@ -175,6 +175,9 @@ static int docolors(void) { | |||
| 175 | init_rgb_color(CC_WHITE, 255, 255, 255); | 175 | init_rgb_color(CC_WHITE, 255, 255, 255); |
| 176 | init_rgb_color(CC_BLACK, 0, 0, 0); | 176 | init_rgb_color(CC_BLACK, 0, 0, 0); |
| 177 | 177 | ||
| 178 | init_rgb_color(CC_WINNING, 232, 185, 35); | ||
| 179 | |||
| 180 | |||
| 178 | init_pair(CCP_TESTING, CC_RED, CC_WHITE); | 181 | init_pair(CCP_TESTING, CC_RED, CC_WHITE); |
| 179 | init_pair(CCP_BANNER, CC_WHITE, CURSES_BLUE); | 182 | init_pair(CCP_BANNER, CC_WHITE, CURSES_BLUE); |
| 180 | 183 | ||
| @@ -186,6 +189,9 @@ static int docolors(void) { | |||
| 186 | init_pair(CCP_PURPLE, CC_WHITE, CC_PURPLE); | 189 | init_pair(CCP_PURPLE, CC_WHITE, CC_PURPLE); |
| 187 | init_pair(CCP_MAGENTA, CC_WHITE, CC_MAGENTA); | 190 | init_pair(CCP_MAGENTA, CC_WHITE, CC_MAGENTA); |
| 188 | init_pair(CCP_WHITE, CC_BLACK, CC_WHITE); | 191 | init_pair(CCP_WHITE, CC_BLACK, CC_WHITE); |
| 192 | |||
| 193 | init_pair(CCP_WINNING1, CC_WHITE, CC_WINNING); | ||
| 194 | init_pair(CCP_WINNING2, CC_WINNING, CC_WHITE); | ||
| 189 | } else { | 195 | } else { |
| 190 | endwin(); | 196 | endwin(); |
| 191 | error(1, ENOTSUP, "[VX-GAMBLEGROUND] Colors are not supported on your terminal"); | 197 | error(1, ENOTSUP, "[VX-GAMBLEGROUND] Colors are not supported on your terminal"); |
| @@ -449,10 +455,16 @@ int spin(void *params) { | |||
| 449 | /* Previous solution fucked it by changing the actual color when it's supposed to be the default color to revert back to | 455 | /* Previous solution fucked it by changing the actual color when it's supposed to be the default color to revert back to |
| 450 | // This works better, but is also more ugly. So be it */ | 456 | // This works better, but is also more ugly. So be it */ |
| 451 | wbkgd(p->slots->subslot[subs], COLOR_PAIR(rangemod(CCP_CURSES_DEFAULT, i + CCP_RED, CCP_RED, CCP_WHITE))); | 457 | wbkgd(p->slots->subslot[subs], COLOR_PAIR(rangemod(CCP_CURSES_DEFAULT, i + CCP_RED, CCP_RED, CCP_WHITE))); |
| 452 | 458 | ||
| 459 | #ifndef TESTING | ||
| 453 | p->slots->slotchar[subs][2] = p->slots->slotchar[subs][1]; | 460 | p->slots->slotchar[subs][2] = p->slots->slotchar[subs][1]; |
| 454 | p->slots->slotchar[subs][1] = p->slots->slotchar[subs][0]; | 461 | p->slots->slotchar[subs][1] = p->slots->slotchar[subs][0]; |
| 455 | p->slots->slotchar[subs][0] = randombytes_uniform('~' - '!' + 1) + '!'; | 462 | p->slots->slotchar[subs][0] = randombytes_uniform('~' - '!' + 1) + '!'; |
| 463 | #endif | ||
| 464 | |||
| 465 | #ifdef TESTING | ||
| 466 | p->slots->slotchar[subs][1] = '7'; | ||
| 467 | #endif | ||
| 456 | 468 | ||
| 457 | // Update characters & draw them | 469 | // Update characters & draw them |
| 458 | int my, mx; | 470 | int my, mx; |
| @@ -468,6 +480,37 @@ int spin(void *params) { | |||
| 468 | nanosleep(&sleeper, NULL); | 480 | nanosleep(&sleeper, NULL); |
| 469 | } | 481 | } |
| 470 | 482 | ||
| 483 | // Check to see if user has won a jackpot | ||
| 484 | int winning = 0; | ||
| 485 | for(size_t i = 0; i < STATIC_ARRSIZE(p->slots->subslot); i++) { | ||
| 486 | if(p->slots->slotchar[i][1] == '7') | ||
| 487 | winning++; | ||
| 488 | } | ||
| 489 | if(winning == 3) { | ||
| 490 | // Do winning anim | ||
| 491 | mvaddch(0, 0, 'J'); | ||
| 492 | for(int i = 0, color = CCP_WINNING1;; i++, color = rangemod(color, 1, CCP_WINNING1, CCP_WINNING2)) { | ||
| 493 | // wbkgd(p->bannerwin, COLOR_PAIR(color)); | ||
| 494 | // wbkgd(p->menuholder, COLOR_PAIR(color)); | ||
| 495 | |||
| 496 | // wbkgd(p->slots->slotwin, COLOR_PAIR(rangemod(color, 1, CCP_WINNING1, CCP_WINNING2))); | ||
| 497 | // for(size_t j = 0; j < STATIC_ARRSIZE(p->slots->subslot); j++) { | ||
| 498 | // wbkgd(p->slots->subslot[j], COLOR_PAIR(rangemod(color, j + 1, CCP_WINNING1, CCP_WINNING2))); | ||
| 499 | // wnoutrefresh(p->slots->subslot[j]); | ||
| 500 | // } | ||
| 501 | |||
| 502 | // wnoutrefresh(p->bannerwin); | ||
| 503 | // wnoutrefresh(p->menuholder); | ||
| 504 | // wnoutrefresh(p->slots->slotwin); | ||
| 505 | |||
| 506 | bkgd(COLOR_PAIR(color)); | ||
| 507 | addch("JACKPOT"[rangemod(i, 1, 0, 6)]); | ||
| 508 | |||
| 509 | refresh(); | ||
| 510 | nanosleep(&sleeper, NULL); | ||
| 511 | } | ||
| 512 | } | ||
| 513 | |||
| 471 | // Revert colors back to normal | 514 | // Revert colors back to normal |
| 472 | wbkgd(p->bannerwin, COLOR_PAIR(CCP_BANNER)); | 515 | wbkgd(p->bannerwin, COLOR_PAIR(CCP_BANNER)); |
| 473 | wnoutrefresh(p->bannerwin); | 516 | wnoutrefresh(p->bannerwin); |
