int standout(void) { (void) wstandout(stdscr); return (1); }
/* ** tuiShowLocatorContent() */ void tuiShowLocatorContent (void) { char *string; TuiGenWinInfoPtr locator; locator = locatorWinInfoPtr (); if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL) { string = displayableWinContentAt (locator, 0); if (string != (char *) NULL) { wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); if (string != nullStr ()) tuiFree (string); locator->contentInUse = TRUE; } } return; } /* tuiShowLocatorContent */
/* Display a register in a window. If hilite is TRUE, then the value will be displayed in reverse video. */ static void tui_display_register (struct tui_data_element *data, struct tui_gen_win_info *win_info) { if (win_info->handle != (WINDOW *) NULL) { int i; if (data->highlight) /* We ignore the return value, casting it to void in order to avoid a compiler warning. The warning itself was introduced by a patch to ncurses 5.7 dated 2009-08-29, changing this macro to expand to code that causes the compiler to generate an unused-value warning. */ (void) wstandout (win_info->handle); wmove (win_info->handle, 0, 0); for (i = 1; i < win_info->width; i++) waddch (win_info->handle, ' '); wmove (win_info->handle, 0, 0); if (data->content) waddstr (win_info->handle, data->content); if (data->highlight) /* We ignore the return value, casting it to void in order to avoid a compiler warning. The warning itself was introduced by a patch to ncurses 5.7 dated 2009-08-29, changing this macro to expand to code that causes the compiler to generate an unused-value warning. */ (void) wstandend (win_info->handle); tui_refresh_win (win_info); } }
static void highlight_line(WINDOW *win, int line) { wattrset(win, COLOR_PAIR(CP_LIST_HIGHLIGHT)); if(!opt_get_bool(BOOL_USE_COLORS)) { wstandout(win); } /* * this is a tricky one */ #if 0 /*#ifdef mvwchgat*/ mvwchgat(win, line, 0, -1, A_STANDOUT, 0, NULL); #else /* * buggy function: FIXME */ scrollok(win, FALSE); { int i; wmove(win, line, 0); for(i = 0; i < COLS; i++) waddch(win, ' '); /*wattrset(win, 0);*/ } scrollok(win, TRUE); #endif }
static void highlight_line(WINDOW *win, int line) { wstandout(win); /* * this is a tricky one */ #if 0 /*#ifdef mvwchgat*/ mvwchgat(win, line, 0, -1, A_STANDOUT, 0, NULL); #else /* * buggy function: FIXME */ scrollok(win, FALSE); { int i; wmove(win, line, 0); for(i = 0; i < COLS; i++) waddch(win, ' '); /*wattrset(win, 0);*/ } scrollok(win, TRUE); #endif }
void tui_show_locator_content (void) { char *string; struct tui_gen_win_info *locator; locator = tui_locator_win_info_ptr (); if (locator != NULL && locator->handle != (WINDOW *) NULL) { struct tui_win_element *element; element = (struct tui_win_element *) locator->content[0]; string = tui_make_status_line (&element->which_element.locator); wmove (locator->handle, 0, 0); wstandout (locator->handle); waddstr (locator->handle, string); wclrtoeol (locator->handle); wstandend (locator->handle); tui_refresh_win (locator); wmove (locator->handle, 0, 0); xfree (string); locator->content_in_use = TRUE; } }
void tui_show_locator_content (void) { char *string; struct tui_gen_win_info *locator; locator = tui_locator_win_info_ptr (); if (locator != NULL && locator->handle != (WINDOW *) NULL) { struct tui_win_element *element; element = locator->content[0]; string = tui_make_status_line (&element->which_element.locator); wmove (locator->handle, 0, 0); /* We ignore the return value from wstandout and wstandend, casting them to void in order to avoid a compiler warning. The warning itself was introduced by a patch to ncurses 5.7 dated 2009-08-29, changing these macro to expand to code that causes the compiler to generate an unused-value warning. */ (void) wstandout (locator->handle); waddstr (locator->handle, string); wclrtoeol (locator->handle); (void) wstandend (locator->handle); tui_refresh_win (locator); wmove (locator->handle, 0, 0); xfree (string); locator->content_in_use = TRUE; } }
static int addstr4(SCR *sp, const void *str, size_t len, int wide) { WINDOW *win; size_t y, x; int iv; win = CLSP(sp) ? CLSP(sp) : stdscr; /* * If ex isn't in control, it's the last line of the screen and * it's a split screen, use inverse video. */ iv = 0; getyx(win, y, x); __USE(x); if (!F_ISSET(sp, SC_SCR_EXWROTE) && y == RLNO(sp, LASTLINE(sp)) && IS_SPLIT(sp)) { iv = 1; (void)wstandout(win); } #ifdef USE_WIDECHAR if (wide) { if (waddnwstr(win, str, len) == ERR) return (1); } else #endif if (waddnstr(win, str, len) == ERR) return (1); if (iv) (void)wstandend(win); return (0); }
static void show_keyword(WINDOW *stswin, int cell, int active, const char *name) { to_keyword(stswin, cell); if (active == cell) (void) wstandout(stswin); wprintw(stswin, "%s:", name); if (active == cell) (void) wstandend(stswin); }
star() { wstandout(treescrn2); mvwaddch(treescrn2, 0, 12, (chtype)'*'); wstandend(treescrn2); wrefresh(treescrn2); wrefresh(w_del_msg); return( 0 ); }
void putstring(int row, int col, int attr, char const *msg) { int so = 0; if (row != -1) g_text_row = row; if (col != -1) g_text_col = col; if (attr & INVERSE || attr & BRIGHT) { wstandout(curwin); so = 1; } wmove(curwin, g_text_row + g_text_rbase, g_text_col + g_text_cbase); while (1) { if (*msg == '\0') break; if (*msg == '\n') { g_text_col = 0; g_text_row++; wmove(curwin, g_text_row + g_text_rbase, g_text_col + g_text_cbase); } else { char const *ptr; ptr = std::strchr(msg, '\n'); if (ptr == nullptr) { waddstr(curwin, msg); break; } else { waddch(curwin, *msg); } } msg++; } if (so) { wstandend(curwin); } wrefresh(curwin); fflush(stdout); getyx(curwin, g_text_row, g_text_col); g_text_row -= g_text_rbase; g_text_col -= g_text_cbase; }
int move_slot(int oldslot, int newslot, int maxslot) { if ((newslot >= 0) && (newslot < maxslot)){ wmove(Showline[oldslot],0,0); waddstr(Showline[oldslot],"--"); wrefresh(Showline[oldslot]); wmove(Showline[newslot],0,0); wstandout(Showline[newslot]); waddstr(Showline[newslot],">>"); wstandend(Showline[newslot]); wrefresh(Showline[newslot]); return(newslot); } else return(oldslot); }
/* * drawGauge() draws a progress bar */ void drawGauge(void *o, void* w) { Obj *obj = OBJ(o); int percent; int fillwidth; int rc; WINDOW *win = Window(w); int x = WX(w), y = WY(w); char bfr[5]; if (obj == 0 || obj->Class != O_GAUGE) return; percent = obj->content ? *((int*)(obj->content)) : 0; fillwidth = (obj->width * percent) / 100; rc = _nd_drawObjCommon(o, w); _nd_adjustXY(rc, o, &x, &y); /* clear the gauge area */ wmove(win, y, x); setcolor(win, WINDOW_COLOR); waddnstr(win, rillyrillylongblankstring, obj->width); if (obj->width > 4) { /* draw the percentage in the middle of the progress bar, * appropriately shaded */ sprintf(bfr, "%d%%", percent); wmove(win, y, x + ((obj->width-strlen(bfr))/2) ); waddstr(win, bfr); } #if WITH_NCURSES /* highlight the progress bar as appropriate */ mvwchgat(win, y, x, fillwidth, A_REVERSE, PAIR_NUMBER(WINDOW_COLOR), 0); #else wstandout(win); for (rc = 0; rc < fillwidth; rc++) mvwaddch(win, y, x+rc, mvwinch(win, y, x+rc)); wstandend(win); #endif } /* drawGauge */
draw_all() { PLANE *pp; for (pp = air.head; pp != NULL; pp = pp->next) { if (pp->status == S_MARKED) wstandout(radar); wmove(radar, pp->ypos, pp->xpos * 2); waddch(radar, name(pp)); waddch(radar, '0' + pp->altitude); if (pp->status == S_MARKED) wstandend(radar); } wrefresh(radar); planewin(); wrefresh(input); /* return cursor */ fflush(stdout); }
void showhelp(void) { size_t length = 0; int lines; int x, y; int i; const char *cp; WINDOW *helpwin; const char *cont_msg = " Hit any key to continue "; for (lines = 0; (cp = helpmsg[lines]) != (char *) 0; lines++) if (strlen(cp) > length) length = strlen(cp); x = ((COLS - length - 2) + 1) / 2; y = ((LINES - lines - 2) + 1) / 2; if (x < 0 || y < 0) { fprintf(stderr, "\007"); return; } helpwin = newwin(lines + 2, length + 2, y, x); wclear(helpwin); box(helpwin, '|', '-'); for (i = 0; i < lines; i++) { wmove(helpwin, i + 1, 1); waddstr(helpwin, helpmsg[i]); } wmove(helpwin, lines + 1, length + 1 - strlen(cont_msg)); wstandout(helpwin); waddstr(helpwin, cont_msg); wstandend(helpwin); wrefresh(helpwin); (void) wgetch(helpwin); werase(helpwin); wrefresh(helpwin); delwin(helpwin); }
void cur_display_cycle() { if (displayLevel) if ((int) (W - warrior) % 2) wstandout(corewin); else { wstandend(corewin); if (!--refreshCounter) { refreshCounter = refreshInterval; update_statusline(round); wrefresh(corewin); } } #if defined(SYSV) && defined(KEYPRESS) /* PAK */ if (wgetch(corewin) != ERR) debugState = STEP; #endif }
/* if display, displays monsters, otherwise erases them */ void drawmonsters(int display) { pml ml; for (ml=Level->mlist;ml!=NULL;ml=ml->next) { if (ml->m->hp > 0) { if (display) { if (view_los_p(Player.x,Player.y,ml->m->x,ml->m->y)) { if (Player.status[TRUESIGHT] || (! m_statusp(ml->m,M_INVISIBLE))) { if (!optionp(SHOW_COLOUR) && (ml->m->level > 5) && ((ml->m->monchar&0xff) != '@') && ((ml->m->monchar&0xff) != '|')) wstandout(Levelw); putspot(ml->m->x,ml->m->y,ml->m->monchar); if (!optionp(SHOW_COLOUR)) wstandend(Levelw); } } } else erase_monster(ml->m); } } }
/* Display a register in a window. If hilite is TRUE, then the value will be displayed in reverse video */ static void tui_display_register (struct tui_data_element *data, struct tui_gen_win_info *win_info) { if (win_info->handle != (WINDOW *) NULL) { int i; if (data->highlight) wstandout (win_info->handle); wmove (win_info->handle, 0, 0); for (i = 1; i < win_info->width; i++) waddch (win_info->handle, ' '); wmove (win_info->handle, 0, 0); if (data->content) waddstr (win_info->handle, data->content); if (data->highlight) wstandend (win_info->handle); tui_refresh_win (win_info); } }
/* ** scrollWinForward */ void scrollWinForward (TuiGenWinInfoPtr winInfo, int numLines) { if (winInfo->content != (OpaquePtr) NULL && winInfo->lastVisibleLine < winInfo->contentSize - 1) { int i, firstLine, newLastLine; firstLine = winInfo->lastVisibleLine - winInfo->viewportHeight + 1; if (winInfo->lastVisibleLine + numLines > winInfo->contentSize) newLastLine = winInfo->contentSize - 1; else newLastLine = winInfo->lastVisibleLine + numLines - 1; for (i = (newLastLine - winInfo->viewportHeight); (i <= newLastLine); i++) { TuiWinElementPtr line; int lineHeight; line = (TuiWinElementPtr) winInfo->content[i]; if (line->highlight) wstandout (winInfo->handle); mvwaddstr (winInfo->handle, i - (newLastLine - winInfo->viewportHeight), 1, displayableWinContentOf (winInfo, line)); if (line->highlight) wstandend (winInfo->handle); lineHeight = winElementHeight (winInfo, line); newLastLine += (lineHeight - 1); } winInfo->lastVisibleLine = newLastLine; } return; } /* scrollWinForward */
/* ** tuiClearLocatorDisplay() */ void tuiClearLocatorDisplay (void) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); int i; if (locator->handle != (WINDOW *) NULL) { /* No need to werase, since writing a line of * blanks which we do below, is equivalent. */ /* werase(locator->handle); */ wmove (locator->handle, 0, 0); wstandout (locator->handle); for (i = 0; i < locator->width; i++) waddch (locator->handle, ' '); wstandend (locator->handle); tuiRefreshWin (locator); wmove (locator->handle, 0, 0); locator->contentInUse = FALSE; } return; } /* tuiClearLocatorDisplay */
void add_line(const char *fmt, ...) { WINDOW *tw; va_list ap; va_start(ap, fmt); if (line_cnt == 0) { wclear(hw); if (inv_type == INV_SLOW) mpos = 0; } if (inv_type == INV_SLOW) { if ( (fmt != NULL) && (*fmt != '\0') ) vmsg(fmt, ap); line_cnt++; } else { if ( (line_cnt >= LINES - 2) || (fmt == NULL)) /* end 'o page */ { if (fmt == NULL && !newpage && inv_type == INV_OVER) { tw = newwin(line_cnt + 2, COLS, 0, 0); overwrite(hw, tw); wstandout(tw); mvwaddstr(tw, line_cnt, 0, spacemsg); wstandend(tw); touchwin(tw); wrefresh(tw); wait_for(' '); delwin(tw); touchwin(cw); } else { wstandout(hw); mvwaddstr(hw, LINES - 1, 0, spacemsg); wstandend(hw); wrefresh(hw); w_wait_for(hw, ' '); touchwin(cw); wclear(hw); } newpage = TRUE; line_cnt = 0; } /* draw line */ if (fmt != NULL && !(line_cnt == 0 && *fmt == '\0')) { static char tmpbuf[1024]; vsprintf(tmpbuf, fmt, ap); mvwprintw(hw, line_cnt++, 0, tmpbuf); } } }
/* * standout -- * Enter standout mode on stdscr. */ int standout(void) { return wstandout(stdscr); }
/* * cl_attr -- * Toggle a screen attribute on/off. * * PUBLIC: int cl_attr __P((SCR *, scr_attr_t, int)); */ int cl_attr(SCR *sp, scr_attr_t attribute, int on) { CL_PRIVATE *clp; WINDOW *win; clp = CLP(sp); win = CLSP(sp) ? CLSP(sp) : stdscr; switch (attribute) { case SA_ALTERNATE: /* * !!! * There's a major layering violation here. The problem is that the * X11 xterm screen has what's known as an "alternate" screen. Some * xterm termcap/terminfo entries include sequences to switch to/from * that alternate screen as part of the ti/te (smcup/rmcup) strings. * Vi runs in the alternate screen, so that you are returned to the * same screen contents on exit from vi that you had when you entered * vi. Further, when you run :shell, or :!date or similar ex commands, * you also see the original screen contents. This wasn't deliberate * on vi's part, it's just that it historically sent terminal init/end * sequences at those times, and the addition of the alternate screen * sequences to the strings changed the behavior of vi. The problem * caused by this is that we don't want to switch back to the alternate * screen while getting a new command from the user, when the user is * continuing to enter ex commands, e.g.: * * :!date <<< switch to original screen * [Hit return to continue] <<< prompt user to continue * :command <<< get command from user * * Note that the :command input is a true vi input mode, e.g., input * maps and abbreviations are being done. So, we need to be able to * switch back into the vi screen mode, without flashing the screen. * * To make matters worse, the curses initscr() and endwin() calls will * do this automatically -- so, this attribute isn't as controlled by * the higher level screen as closely as one might like. */ if (on) { if (clp->ti_te != TI_SENT) { clp->ti_te = TI_SENT; if (clp->smcup == NULL) (void)cl_getcap(sp, "smcup", &clp->smcup); if (clp->smcup != NULL) (void)tputs(clp->smcup, 1, cl_putchar); } } else if (clp->ti_te != TE_SENT) { clp->ti_te = TE_SENT; if (clp->rmcup == NULL) (void)cl_getcap(sp, "rmcup", &clp->rmcup); if (clp->rmcup != NULL) (void)tputs(clp->rmcup, 1, cl_putchar); (void)fflush(stdout); } (void)fflush(stdout); break; case SA_INVERSE: if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) { if (clp->smso == NULL) return (1); if (on) (void)tputs(clp->smso, 1, cl_putchar); else (void)tputs(clp->rmso, 1, cl_putchar); (void)fflush(stdout); } else { if (on) (void)wstandout(win); else (void)wstandend(win); } break; default: abort(); } return (0); }
void sell(struct thing *tp) { struct linked_list *item; int i, j, min_worth, nitems, chance, which_item, w; char goods; struct object *obj; char buffer[2 * LINELEN]; char dbuf[2 * LINELEN]; struct { int which; int plus1, plus2; int count; int worth; int flags; char *name; } selection[SELL_ITEMS]; int effective_purse = ((player.t_ctype == C_PALADIN) ? (9 * purse / 10) : purse); min_worth = -1; /* hope item is never worth less than this */ item = find_mons(tp->t_pos.y, tp->t_pos.x); /* Get pointer to monster */ /* Select the items */ nitems = rnd(6) + 5; switch (rnd(6)) { /* Armor */ case 0: case 1: goods = ARMOR; for (i = 0; i < nitems; i++) { chance = rnd(100); for (j = 0; j < maxarmors; j++) if (chance < armors[j].a_prob) break; if (j == maxarmors) { debug("Picked a bad armor %d", chance); j = 0; } selection[i].which = j; selection[i].count = 1; if (rnd(100) < 40) selection[i].plus1 = rnd(5) + 1; else selection[i].plus1 = 0; selection[i].name = armors[j].a_name; switch (luck) { case 0: break; case 1: if (rnd(3) == 0) { selection[i].flags |= ISCURSED; selection[i].plus1 = -1 - rnd(5); } break; default: if (rnd(luck)) { selection[i].flags |= ISCURSED; selection[i].plus1 = -1 - rnd(5); } break; } /* Calculate price */ w = armors[j].a_worth; w *= (1 + luck + (10 * selection[i].plus1)); w = (w / 2) + (roll(6, w) / 6); selection[i].worth = max(w, 25); if (min_worth > selection[i].worth || i == 1) min_worth = selection[i].worth; } break; /* Weapon */ case 2: case 3: goods = WEAPON; for (i = 0; i < nitems; i++) { selection[i].which = rnd(maxweapons); selection[i].count = 1; if (rnd(100) < 35) { selection[i].plus1 = rnd(3); selection[i].plus2 = rnd(3); } else { selection[i].plus1 = 0; selection[i].plus2 = 0; } if (weaps[selection[i].which].w_flags & ISMANY) selection[i].count = rnd(15) + 8; selection[i].name = weaps[selection[i].which].w_name; switch (luck) { case 0: break; case 1: if (rnd(3) == 0) { selection[i].flags |= ISCURSED; selection[i].plus1 = -rnd(3); selection[i].plus2 = -rnd(3); } break; default: if (rnd(luck)) { selection[i].flags |= ISCURSED; selection[i].plus1 = -rnd(3); selection[i].plus2 = -rnd(3); } break; } w = weaps[selection[i].which].w_worth * selection[i].count; w *= (1 + luck + (10 * selection[i].plus1 + 10 * selection[i].plus2)); w = (w / 2) + (roll(6, w) / 6); selection[i].worth = max(w, 25); if (min_worth > selection[i].worth || i == 1) min_worth = selection[i].worth; } break; /* Staff or wand */ case 4: goods = STICK; for (i = 0; i < nitems; i++) { selection[i].which = pick_one(ws_magic, maxsticks); selection[i].plus1 = rnd(11) + 5; selection[i].count = 1; selection[i].name = ws_magic[selection[i].which].mi_name; switch (luck) { case 0: break; case 1: if (rnd(3) == 0) { selection[i].flags |= ISCURSED; selection[i].plus1 = 1; } break; default: if (rnd(luck)) { selection[i].flags |= ISCURSED; selection[i].plus1 = 1; } } w = ws_magic[selection[i].which].mi_worth; w += (luck + 1) * 20 * selection[i].plus1; w = (w / 2) + (roll(6, w) / 6); selection[i].worth = max(w, 25); if (min_worth > selection[i].worth || i == 1) min_worth = selection[i].worth; } break; /* Ring */ case 5: goods = RING; for (i = 0; i < nitems; i++) { selection[i].which = pick_one(r_magic, maxrings); selection[i].plus1 = rnd(2) + 1; selection[i].count = 1; if (rnd(100) < r_magic[selection[i].which].mi_bless + 10) selection[i].plus1 += rnd(2) + 1; selection[i].name = r_magic[selection[i].which].mi_name; switch (luck) { case 0: break; case 1: if (rnd(3) == 0) { selection[i].flags |= ISCURSED; selection[i].plus1 = -1 - rnd(2); } break; default: if (rnd(luck)) { selection[i].flags |= ISCURSED; selection[i].plus1 = -1 - rnd(2); } } w = r_magic[selection[i].which].mi_worth; switch(selection[i].which) { case R_DIGEST: if (selection[i].plus1 > 2) selection[i].plus1 = 2; else if (selection[i].plus1 < 1) selection[i].plus1 = 1; /* fall thru here to other cases */ case R_ADDSTR: case R_ADDDAM: case R_PROTECT: case R_ADDHIT: case R_ADDINTEL: case R_ADDWISDOM: if (selection[i].plus1 > 0) w += selection[i].plus1 * 50; } w *= (1 + luck); w = (w / 2) + (roll(6, w) / 6); selection[i].worth = max(w, 25); if (min_worth > selection[i].worth * selection[i].count) min_worth = selection[i].worth; } } /* See if player can afford an item */ if (min_worth > effective_purse) { msg("The %s eyes your small purse and departs.", monsters[nummonst].m_name); /* Get rid of the monster */ killed(NULL, item, NOMESSAGE, NOPOINTS); return; } /* Display the goods */ msg("The %s shows you his wares.", monsters[nummonst].m_name); wstandout(cw); mvwaddstr(cw, 0, mpos, morestr); wstandend(cw); wrefresh(cw); wait_for(' '); msg(""); clearok(cw, TRUE); touchwin(cw); wclear(hw); touchwin(hw); for (i = 0; i < nitems; i++) { if (selection[i].worth > effective_purse) continue; wmove(hw, i + 2, 0); sprintf(dbuf, "[%c] ", ('a' + i)); switch(goods) { case ARMOR: strcat(dbuf, "Some "); break; case WEAPON: if (selection[i].count == 1) strcat(dbuf, "A "); else { sprintf(buffer, "%2d ", selection[i].count); strcat(dbuf, buffer); } break; case STICK: strcat(dbuf, "A "); strcat(dbuf, ws_type[selection[i].which]); strcat(dbuf, " of "); break; case RING: strcat(dbuf, "A ring of "); break; } strcat(dbuf, selection[i].name); if (selection[i].count > 1) strcat(dbuf, "s"); sprintf(buffer, "%-50s Price: %d", dbuf, selection[i].worth); waddstr(hw, buffer); } sprintf(buffer, "Purse: %d", purse); mvwaddstr(hw, nitems + 3, 0, buffer); mvwaddstr(hw, 0, 0, "How about one of the following goods? "); wrefresh(hw); /* Get rid of the monster */ killed(NULL, item, NOMESSAGE, NOPOINTS); which_item = (short) ((readchar() & 0177) - 'a'); while (which_item < 0 || which_item >= nitems || selection[which_item].worth > effective_purse) { if (which_item == (short) ESCAPE - (short) 'a') return; mvwaddstr(hw, 0, 0, "Please enter one of the listed items: "); wrefresh(hw); which_item = (short) ((readchar() & 0177) - 'a'); } if (purse > selection[which_item].worth) purse -= selection[which_item].worth; else purse = 0L; item = spec_item(goods, selection[which_item].which, selection[which_item].plus1, selection[which_item].plus2); obj = OBJPTR(item); if (selection[which_item].count > 1) { obj->o_count = selection[which_item].count; obj->o_group = ++group; } /* If a stick or ring, let player know the type */ switch (goods) { case STICK: know_items[TYP_STICK][selection[which_item].which] = TRUE; break; case RING: know_items[TYP_RING][selection[which_item].which] = TRUE; break; } if (add_pack(item, MESSAGE) == FALSE) { obj->o_pos = hero; fall(&player, item, TRUE, FALSE); } }
void main() { void done(); int loopy; initscr(); noecho(); nonl(); refresh(); signal(SIGINT,done); signal(SIGTERM,done); #if !defined DOS && !defined OS2 signal(SIGHUP,done); signal(SIGQUIT,done); #endif treescrn = newwin(16,27,3,53); treescrn2 = newwin(16,27,3,53); treescrn3 = newwin(16,27,3,53); treescrn4 = newwin(16,27,3,53); treescrn5 = newwin(16,27,3,53); treescrn6 = newwin(16,27,3,53); treescrn7 = newwin(16,27,3,53); treescrn8 = newwin(16,27,3,53); dotdeer0 = newwin(3,71,0,8); stardeer0 = newwin(4,56,0,8); lildeer0 = newwin(7,53,0,8); lildeer1 = newwin(2,4,0,0); lildeer2 = newwin(2,4,0,0); lildeer3 = newwin(2,4,0,0); middeer0 = newwin(15,42,0,8); middeer1 = newwin(3,7,0,0); middeer2 = newwin(3,7,0,0); middeer3 = newwin(3,7,0,0); bigdeer0 = newwin(10,23,0,0); bigdeer1 = newwin(10,23,0,0); bigdeer2 = newwin(10,23,0,0); bigdeer3 = newwin(10,23,0,0); bigdeer4 = newwin(10,23,0,0); lookdeer0 = newwin(10,25,0,0); lookdeer1 = newwin(10,25,0,0); lookdeer2 = newwin(10,25,0,0); lookdeer3 = newwin(10,25,0,0); lookdeer4 = newwin(10,25,0,0); w_holiday = newwin(1,26,3,27); w_del_msg = newwin(1,12,23,60); mvwaddstr(w_del_msg,0,0,"Hit any key to quit"); mvwaddstr(w_holiday,0,0,"H A P P Y H O L I D A Y S"); /* set up the windows for our various reindeer */ /* lildeer1 */ mvwaddch(lildeer1,0,0,(chtype)'V'); mvwaddch(lildeer1,1,0,(chtype)'@'); mvwaddch(lildeer1,1,1,(chtype)'<'); mvwaddch(lildeer1,1,2,(chtype)'>'); mvwaddch(lildeer1,1,3,(chtype)'~'); /* lildeer2 */ mvwaddch(lildeer2,0,0,(chtype)'V'); mvwaddch(lildeer2,1,0,(chtype)'@'); mvwaddch(lildeer2,1,1,(chtype)'|'); mvwaddch(lildeer2,1,2,(chtype)'|'); mvwaddch(lildeer2,1,3,(chtype)'~'); /* lildeer3 */ mvwaddch(lildeer3,0,0,(chtype)'V'); mvwaddch(lildeer3,1,0,(chtype)'@'); mvwaddch(lildeer3,1,1,(chtype)'>'); mvwaddch(lildeer3,1,2,(chtype)'<'); mvwaddch(lildeer2,1,3,(chtype)'~'); /* middeer1 */ mvwaddch(middeer1,0,2,(chtype)'y'); mvwaddch(middeer1,0,3,(chtype)'y'); mvwaddch(middeer1,1,2,(chtype)'0'); mvwaddch(middeer1,1,3,(chtype)'('); mvwaddch(middeer1,1,4,(chtype)'='); mvwaddch(middeer1,1,5,(chtype)')'); mvwaddch(middeer1,1,6,(chtype)'~'); mvwaddch(middeer1,2,3,(chtype)'\\'); mvwaddch(middeer1,2,4,(chtype)'/'); /* middeer2 */ mvwaddch(middeer2,0,2,(chtype)'y'); mvwaddch(middeer2,0,3,(chtype)'y'); mvwaddch(middeer2,1,2,(chtype)'0'); mvwaddch(middeer2,1,3,(chtype)'('); mvwaddch(middeer2,1,4,(chtype)'='); mvwaddch(middeer2,1,5,(chtype)')'); mvwaddch(middeer2,1,6,(chtype)'~'); mvwaddch(middeer2,2,3,(chtype)'|'); mvwaddch(middeer2,2,5,(chtype)'|'); /* middeer3 */ mvwaddch(middeer3,0,2,(chtype)'y'); mvwaddch(middeer3,0,3,(chtype)'y'); mvwaddch(middeer3,1,2,(chtype)'0'); mvwaddch(middeer3,1,3,(chtype)'('); mvwaddch(middeer3,1,4,(chtype)'='); mvwaddch(middeer3,1,5,(chtype)')'); mvwaddch(middeer3,1,6,(chtype)'~'); mvwaddch(middeer3,2,2,(chtype)'/'); mvwaddch(middeer3,2,6,(chtype)'\\'); /* bigdeer1 */ mvwaddch(bigdeer1,0,17,(chtype)'\\'); mvwaddch(bigdeer1,0,18,(chtype)'/'); mvwaddch(bigdeer1,0,20,(chtype)'\\'); mvwaddch(bigdeer1,0,21,(chtype)'/'); mvwaddch(bigdeer1,1,18,(chtype)'\\'); mvwaddch(bigdeer1,1,20,(chtype)'/'); mvwaddch(bigdeer1,2,19,(chtype)'|'); mvwaddch(bigdeer1,2,20,(chtype)'_'); mvwaddch(bigdeer1,3,18,(chtype)'/'); mvwaddch(bigdeer1,3,19,(chtype)'^'); mvwaddch(bigdeer1,3,20,(chtype)'0'); mvwaddch(bigdeer1,3,21,(chtype)'\\'); mvwaddch(bigdeer1,4,17,(chtype)'/'); mvwaddch(bigdeer1,4,18,(chtype)'/'); mvwaddch(bigdeer1,4,19,(chtype)'\\'); mvwaddch(bigdeer1,4,22,(chtype)'\\'); mvwaddstr(bigdeer1,5,7,"^~~~~~~~~// ~~U"); mvwaddstr(bigdeer1,6,7,"( \\_____( /"); mvwaddstr(bigdeer1,7,8,"( ) /"); mvwaddstr(bigdeer1,8,9,"\\\\ /"); mvwaddstr(bigdeer1,9,11,"\\>/>"); /* bigdeer2 */ mvwaddch(bigdeer2,0,17,(chtype)'\\'); mvwaddch(bigdeer2,0,18,(chtype)'/'); mvwaddch(bigdeer2,0,20,(chtype)'\\'); mvwaddch(bigdeer2,0,21,(chtype)'/'); mvwaddch(bigdeer2,1,18,(chtype)'\\'); mvwaddch(bigdeer2,1,20,(chtype)'/'); mvwaddch(bigdeer2,2,19,(chtype)'|'); mvwaddch(bigdeer2,2,20,(chtype)'_'); mvwaddch(bigdeer2,3,18,(chtype)'/'); mvwaddch(bigdeer2,3,19,(chtype)'^'); mvwaddch(bigdeer2,3,20,(chtype)'0'); mvwaddch(bigdeer2,3,21,(chtype)'\\'); mvwaddch(bigdeer2,4,17,(chtype)'/'); mvwaddch(bigdeer2,4,18,(chtype)'/'); mvwaddch(bigdeer2,4,19,(chtype)'\\'); mvwaddch(bigdeer2,4,22,(chtype)'\\'); mvwaddstr(bigdeer2,5,7,"^~~~~~~~~// ~~U"); mvwaddstr(bigdeer2,6,7,"(( )____( /"); mvwaddstr(bigdeer2,7,7,"( / |"); mvwaddstr(bigdeer2,8,8,"\\/ |"); mvwaddstr(bigdeer2,9,9,"|> |>"); /* bigdeer3 */ mvwaddch(bigdeer3,0,17,(chtype)'\\'); mvwaddch(bigdeer3,0,18,(chtype)'/'); mvwaddch(bigdeer3,0,20,(chtype)'\\'); mvwaddch(bigdeer3,0,21,(chtype)'/'); mvwaddch(bigdeer3,1,18,(chtype)'\\'); mvwaddch(bigdeer3,1,20,(chtype)'/'); mvwaddch(bigdeer3,2,19,(chtype)'|'); mvwaddch(bigdeer3,2,20,(chtype)'_'); mvwaddch(bigdeer3,3,18,(chtype)'/'); mvwaddch(bigdeer3,3,19,(chtype)'^'); mvwaddch(bigdeer3,3,20,(chtype)'0'); mvwaddch(bigdeer3,3,21,(chtype)'\\'); mvwaddch(bigdeer3,4,17,(chtype)'/'); mvwaddch(bigdeer3,4,18,(chtype)'/'); mvwaddch(bigdeer3,4,19,(chtype)'\\'); mvwaddch(bigdeer3,4,22,(chtype)'\\'); mvwaddstr(bigdeer3,5,7,"^~~~~~~~~// ~~U"); mvwaddstr(bigdeer3,6,6,"( ()_____( /"); mvwaddstr(bigdeer3,7,6,"/ / /"); mvwaddstr(bigdeer3,8,5,"|/ \\"); mvwaddstr(bigdeer3,9,5,"/> \\>"); /* bigdeer4 */ mvwaddch(bigdeer4,0,17,(chtype)'\\'); mvwaddch(bigdeer4,0,18,(chtype)'/'); mvwaddch(bigdeer4,0,20,(chtype)'\\'); mvwaddch(bigdeer4,0,21,(chtype)'/'); mvwaddch(bigdeer4,1,18,(chtype)'\\'); mvwaddch(bigdeer4,1,20,(chtype)'/'); mvwaddch(bigdeer4,2,19,(chtype)'|'); mvwaddch(bigdeer4,2,20,(chtype)'_'); mvwaddch(bigdeer4,3,18,(chtype)'/'); mvwaddch(bigdeer4,3,19,(chtype)'^'); mvwaddch(bigdeer4,3,20,(chtype)'0'); mvwaddch(bigdeer4,3,21,(chtype)'\\'); mvwaddch(bigdeer4,4,17,(chtype)'/'); mvwaddch(bigdeer4,4,18,(chtype)'/'); mvwaddch(bigdeer4,4,19,(chtype)'\\'); mvwaddch(bigdeer4,4,22,(chtype)'\\'); mvwaddstr(bigdeer4,5,7,"^~~~~~~~~// ~~U"); mvwaddstr(bigdeer4,6,6,"( )______( /"); mvwaddstr(bigdeer4,7,5,"(/ \\"); mvwaddstr(bigdeer4,8,0,"v___= ----^"); /* lookdeer1 */ mvwaddstr(lookdeer1,0,16,"\\/ \\/"); mvwaddstr(lookdeer1,1,17,"\\Y/ \\Y/"); mvwaddstr(lookdeer1,2,19,"\\=/"); mvwaddstr(lookdeer1,3,17,"^\\o o/^"); mvwaddstr(lookdeer1,4,17,"//( )"); mvwaddstr(lookdeer1,5,7,"^~~~~~~~~// \\O/"); mvwaddstr(lookdeer1,6,7,"( \\_____( /"); mvwaddstr(lookdeer1,7,8,"( ) /"); mvwaddstr(lookdeer1,8,9,"\\\\ /"); mvwaddstr(lookdeer1,9,11,"\\>/>"); /* lookdeer2 */ mvwaddstr(lookdeer2,0,16,"\\/ \\/"); mvwaddstr(lookdeer2,1,17,"\\Y/ \\Y/"); mvwaddstr(lookdeer2,2,19,"\\=/"); mvwaddstr(lookdeer2,3,17,"^\\o o/^"); mvwaddstr(lookdeer2,4,17,"//( )"); mvwaddstr(lookdeer2,5,7,"^~~~~~~~~// \\O/"); mvwaddstr(lookdeer2,6,7,"(( )____( /"); mvwaddstr(lookdeer2,7,7,"( / |"); mvwaddstr(lookdeer2,8,8,"\\/ |"); mvwaddstr(lookdeer2,9,9,"|> |>"); /* lookdeer3 */ mvwaddstr(lookdeer3,0,16,"\\/ \\/"); mvwaddstr(lookdeer3,1,17,"\\Y/ \\Y/"); mvwaddstr(lookdeer3,2,19,"\\=/"); mvwaddstr(lookdeer3,3,17,"^\\o o/^"); mvwaddstr(lookdeer3,4,17,"//( )"); mvwaddstr(lookdeer3,5,7,"^~~~~~~~~// \\O/"); mvwaddstr(lookdeer3,6,6,"( ()_____( /"); mvwaddstr(lookdeer3,7,6,"/ / /"); mvwaddstr(lookdeer3,8,5,"|/ \\"); mvwaddstr(lookdeer3,9,5,"/> \\>"); /* lookdeer4 */ mvwaddstr(lookdeer4,0,16,"\\/ \\/"); mvwaddstr(lookdeer4,1,17,"\\Y/ \\Y/"); mvwaddstr(lookdeer4,2,19,"\\=/"); mvwaddstr(lookdeer4,3,17,"^\\o o/^"); mvwaddstr(lookdeer4,4,17,"//( )"); mvwaddstr(lookdeer4,5,7,"^~~~~~~~~// \\O/"); mvwaddstr(lookdeer4,6,6,"( )______( /"); mvwaddstr(lookdeer4,7,5,"(/ \\"); mvwaddstr(lookdeer4,8,0,"v___= ----^"); /***********************************************/ cbreak(); nodelay(stdscr,TRUE); do { clear(); werase(treescrn); touchwin(treescrn); werase(treescrn2); touchwin(treescrn2); werase(treescrn8); touchwin(treescrn8); refresh(); usleep(1000); boxit(); refresh(); usleep(1000); seas(); refresh(); usleep(1000); greet(); refresh(); usleep(1000); fromwho(); refresh(); usleep(1000); tree(); usleep(1000); balls(); usleep(1000); star(); usleep(1000); strng1(); strng2(); strng3(); strng4(); strng5(); /* set up the windows for our blinking trees */ /* **************************************** */ /* treescrn3 */ overlay(treescrn, treescrn3); /*balls*/ mvwaddch(treescrn3, 4, 18, ' '); mvwaddch(treescrn3, 7, 6, ' '); mvwaddch(treescrn3, 8, 19, ' '); mvwaddch(treescrn3, 11, 22, ' '); /*star*/ mvwaddch(treescrn3, 0, 12, '*'); /*strng1*/ mvwaddch(treescrn3, 3, 11, ' '); /*strng2*/ mvwaddch(treescrn3, 5, 13, ' '); mvwaddch(treescrn3, 6, 10, ' '); /*strng3*/ mvwaddch(treescrn3, 7, 16, ' '); mvwaddch(treescrn3, 7, 14, ' '); /*strng4*/ mvwaddch(treescrn3, 10, 13, ' '); mvwaddch(treescrn3, 10, 10, ' '); mvwaddch(treescrn3, 11, 8, ' '); /*strng5*/ mvwaddch(treescrn3, 11, 18, ' '); mvwaddch(treescrn3, 12, 13, ' '); /* treescrn4 */ overlay(treescrn, treescrn4); /*balls*/ mvwaddch(treescrn4, 3, 9, ' '); mvwaddch(treescrn4, 4, 16, ' '); mvwaddch(treescrn4, 7, 6, ' '); mvwaddch(treescrn4, 8, 19, ' '); mvwaddch(treescrn4, 11, 2, ' '); mvwaddch(treescrn4, 12, 23, ' '); /*star*/ wstandout(treescrn4); mvwaddch(treescrn4, 0, 12, '*'); wstandend(treescrn4); /*strng1*/ mvwaddch(treescrn4, 3, 13, ' '); /*strng2*/ /*strng3*/ mvwaddch(treescrn4, 7, 15, ' '); mvwaddch(treescrn4, 8, 11, ' '); /*strng4*/ mvwaddch(treescrn4, 9, 16, ' '); mvwaddch(treescrn4, 10, 12, ' '); mvwaddch(treescrn4, 11, 8, ' '); /*strng5*/ mvwaddch(treescrn4, 11, 18, ' '); mvwaddch(treescrn4, 12, 14, ' '); /* treescrn5 */ overlay(treescrn, treescrn5); /*balls*/ mvwaddch(treescrn5, 3, 15, ' '); mvwaddch(treescrn5, 10, 20, ' '); mvwaddch(treescrn5, 12, 1, ' '); /*star*/ mvwaddch(treescrn5, 0, 12, '*'); /*strng1*/ mvwaddch(treescrn5, 3, 11, ' '); /*strng2*/ mvwaddch(treescrn5, 5, 12, ' '); /*strng3*/ mvwaddch(treescrn5, 7, 14, ' '); mvwaddch(treescrn5, 8, 10, ' '); /*strng4*/ mvwaddch(treescrn5, 9, 15, ' '); mvwaddch(treescrn5, 10, 11, ' '); mvwaddch(treescrn5, 11, 7, ' '); /*strng5*/ mvwaddch(treescrn5, 11, 17, ' '); mvwaddch(treescrn5, 12, 13, ' '); /* treescrn6 */ overlay(treescrn, treescrn6); /*balls*/ mvwaddch(treescrn6, 6, 7, ' '); mvwaddch(treescrn6, 7, 18, ' '); mvwaddch(treescrn6, 10, 4, ' '); mvwaddch(treescrn6, 11, 23, ' '); /*star*/ wstandout(treescrn6); mvwaddch(treescrn6, 0, 12, '*'); wstandend(treescrn6); /*strng1*/ /*strng2*/ mvwaddch(treescrn6, 5, 11, ' '); /*strng3*/ mvwaddch(treescrn6, 7, 13, ' '); mvwaddch(treescrn6, 8, 9, ' '); /*strng4*/ mvwaddch(treescrn6, 9, 14, ' '); mvwaddch(treescrn6, 10, 10, ' '); mvwaddch(treescrn6, 11, 6, ' '); /*strng5*/ mvwaddch(treescrn6, 11, 16, ' '); mvwaddch(treescrn6, 12, 12, ' '); /* treescrn7 */ overlay(treescrn, treescrn7); /*balls*/ mvwaddch(treescrn7, 3, 15, ' '); mvwaddch(treescrn7, 6, 7, ' '); mvwaddch(treescrn7, 7, 18, ' '); mvwaddch(treescrn7, 10, 4, ' '); mvwaddch(treescrn7, 11, 22, ' '); /*star*/ mvwaddch(treescrn7, 0, 12, '*'); /*strng1*/ mvwaddch(treescrn7, 3, 12, ' '); /*strng2*/ mvwaddch(treescrn7, 5, 13, ' '); mvwaddch(treescrn7, 6, 9, ' '); /*strng3*/ mvwaddch(treescrn7, 7, 15, ' '); mvwaddch(treescrn7, 8, 11, ' '); /*strng4*/ mvwaddch(treescrn7, 9, 16, ' '); mvwaddch(treescrn7, 10, 12, ' '); mvwaddch(treescrn7, 11, 8, ' '); /*strng5*/ mvwaddch(treescrn7, 11, 18, ' '); mvwaddch(treescrn7, 12, 14, ' '); usleep(1000); reindeer(); touchwin(w_holiday); wrefresh(w_holiday); wrefresh(w_del_msg); usleep(1000); for(loopy = 0;loopy < 100;loopy++) { blinkit(); } #ifdef NOLOOP done(); #endif } while(getch() == (ERR)); /* while(!typeahead(stdin));*/ done(); }