From aa22b44084391c2c70ed05b5515e56c7af7caf22 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Thu, 1 Aug 2024 18:45:35 -0500 Subject: h --- src/screen.c | 27 +++++++++++++++++---------- src/screen.h | 3 +++ 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/screen.c b/src/screen.c index 6df9cac..d695ee7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -88,11 +88,13 @@ static const char *menu_choices[] = { static struct funcholder userfuncs[] = { {.callback = spin, .type = FH_SPIN, .params = {.spinp = {.bannerwin = NULL, .phrasenum = 0}}}, - {.callback = buy, .type = FH_BUY, .params = {.buyp = {}}}, - {.callback = quit, .type = FH_QUIT, .params = {.quitp = {}}} + {.callback = buy, .type = FH_BUY, .params = {.buyp = {.numspins = 3, .price = 1}}}, + {.callback = quit, .type = FH_QUIT, .params = {.quitp = {.REPLACEME = NULL}}} }; -void intercleanup(int signum, siginfo_t *info, void *ucontext) { +void intercleanup(int signum) { + signum++; // So gcc doesn't yell at me + endwin(); error(0, 0, "[VX-GAMBLEGROUND] Caught interrupt"); exit(0); @@ -102,9 +104,9 @@ void intercleanup(int signum, siginfo_t *info, void *ucontext) { static const struct sigaction handlers[] = { { // intercleanup - .sa_flags = SA_SIGINFO, - .sa_mask = SIGINT, - .sa_sigaction = intercleanup + .sa_flags = 0, + .sa_mask = SIGINT, + .sa_handler = intercleanup } }; @@ -211,11 +213,9 @@ int main() { // Variable definitions ITEM *items[STATIC_ARRSIZE(menu_choices) + 1]; // An array of ITEM pointers large enough to store all the menu items - int holder1 = -1, holder2 = -1; // Holders for the max yx of the menu subwindow struct funcholder *p = NULL; // Function pointer used for callbacks in the menu driver + WINDOW *menuholder = NULL; // The window for displaying the menu int row = -1, col = -1; // The rows and columns of the main screen - WINDOW *phrase = NULL; // The window for displaying the banner - WINDOW *menuholder; // The window for displaying the menu int randomnum; // A random number for getting the banner phrase MENU *menu; // The actual menu object int c; // Integer for storing keys from user input @@ -258,6 +258,7 @@ int main() { keypad(menuholder, TRUE); + int holder1 = -1, holder2 = -1; getmaxyx(menuholder, holder1, holder2); if(holder1 < 0 || holder2 < 0) { endwin(); @@ -272,7 +273,6 @@ int main() { set_menu_back(menu, COLOR_PAIR(CCP_BANNER)); wnoutrefresh(menuholder); - WINDOW *slots = newwin(row - 2, col, 1, 0); if(slots == NULL) { endwin(); @@ -385,6 +385,10 @@ int spin(void *spinp) { // Increase number of spins int buy(void *buyp) { + struct buyp *p = (struct buyp*)buyp; + p->numspins += 3; + p->price *= 2; + endwin(); error(0, 0, "buy"); exit(0); @@ -394,6 +398,9 @@ int buy(void *buyp) { // Quit out int quit(void *quitp) { + struct quitp *p = (struct quitp*)quitp; + p->REPLACEME = "lol"; + endwin(); error(0, 0, "quit"); exit(0); diff --git a/src/screen.h b/src/screen.h index 1a59b5b..c3deb00 100644 --- a/src/screen.h +++ b/src/screen.h @@ -89,10 +89,13 @@ struct funcholder { } spinp; struct buyp { + unsigned long int price; + int numspins; } buyp; struct quitp { + char *REPLACEME; } quitp; } params; -- cgit v1.2.3