From 9497cdd0d6d1483f559aacf3f8f2bbb6a11716ab Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 30 Aug 2024 12:03:32 -0500 Subject: Create seizure inducing winning anim --- src/screen.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'src/screen.c') 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) { init_rgb_color(CC_WHITE, 255, 255, 255); init_rgb_color(CC_BLACK, 0, 0, 0); + init_rgb_color(CC_WINNING, 232, 185, 35); + + init_pair(CCP_TESTING, CC_RED, CC_WHITE); init_pair(CCP_BANNER, CC_WHITE, CURSES_BLUE); @@ -186,6 +189,9 @@ static int docolors(void) { init_pair(CCP_PURPLE, CC_WHITE, CC_PURPLE); init_pair(CCP_MAGENTA, CC_WHITE, CC_MAGENTA); init_pair(CCP_WHITE, CC_BLACK, CC_WHITE); + + init_pair(CCP_WINNING1, CC_WHITE, CC_WINNING); + init_pair(CCP_WINNING2, CC_WINNING, CC_WHITE); } else { endwin(); error(1, ENOTSUP, "[VX-GAMBLEGROUND] Colors are not supported on your terminal"); @@ -449,10 +455,16 @@ int spin(void *params) { /* Previous solution fucked it by changing the actual color when it's supposed to be the default color to revert back to // This works better, but is also more ugly. So be it */ wbkgd(p->slots->subslot[subs], COLOR_PAIR(rangemod(CCP_CURSES_DEFAULT, i + CCP_RED, CCP_RED, CCP_WHITE))); - + + #ifndef TESTING p->slots->slotchar[subs][2] = p->slots->slotchar[subs][1]; p->slots->slotchar[subs][1] = p->slots->slotchar[subs][0]; p->slots->slotchar[subs][0] = randombytes_uniform('~' - '!' + 1) + '!'; + #endif + + #ifdef TESTING + p->slots->slotchar[subs][1] = '7'; + #endif // Update characters & draw them int my, mx; @@ -468,6 +480,37 @@ int spin(void *params) { nanosleep(&sleeper, NULL); } + // Check to see if user has won a jackpot + int winning = 0; + for(size_t i = 0; i < STATIC_ARRSIZE(p->slots->subslot); i++) { + if(p->slots->slotchar[i][1] == '7') + winning++; + } + if(winning == 3) { + // Do winning anim + mvaddch(0, 0, 'J'); + for(int i = 0, color = CCP_WINNING1;; i++, color = rangemod(color, 1, CCP_WINNING1, CCP_WINNING2)) { + // wbkgd(p->bannerwin, COLOR_PAIR(color)); + // wbkgd(p->menuholder, COLOR_PAIR(color)); + + // wbkgd(p->slots->slotwin, COLOR_PAIR(rangemod(color, 1, CCP_WINNING1, CCP_WINNING2))); + // for(size_t j = 0; j < STATIC_ARRSIZE(p->slots->subslot); j++) { + // wbkgd(p->slots->subslot[j], COLOR_PAIR(rangemod(color, j + 1, CCP_WINNING1, CCP_WINNING2))); + // wnoutrefresh(p->slots->subslot[j]); + // } + + // wnoutrefresh(p->bannerwin); + // wnoutrefresh(p->menuholder); + // wnoutrefresh(p->slots->slotwin); + + bkgd(COLOR_PAIR(color)); + addch("JACKPOT"[rangemod(i, 1, 0, 6)]); + + refresh(); + nanosleep(&sleeper, NULL); + } + } + // Revert colors back to normal wbkgd(p->bannerwin, COLOR_PAIR(CCP_BANNER)); wnoutrefresh(p->bannerwin); -- cgit v1.2.3