#include "hack.h"
#include "wincurs.h"
#include "cursinit.h"
-#include "patchlevel.h"
-#include "date.h"
+/*#include "patchlevel.h"*/
#include <ctype.h>
"|_| \\_| \\___| \\__||_| |_| \\__,_| \\___||_|\\_\\"
-/* win* is size and placement of window to change, x/y/w/h is baseline which can
- decrease depending on alignment of win* in orientation.
- Negative minh/minw: as much as possible, but at least as much as specified. */
+/* win* is size and placement of window to change, x/y/w/h is baseline
+ which can decrease depending on alignment of win* in orientation.
+ Negative minh/minw: as much as possible, but at least as much as
+ specified. */
static void
-set_window_position(int *winx, int *winy, int *winw, int *winh, int orientation,
+set_window_position(int *winx, int *winy, int *winw, int *winh,
+ int orientation,
int *x, int *y, int *w, int *h, int border_space,
int minh, int minw)
{
}
/* Create the "main" nonvolitile windows used by nethack */
-
void
curses_create_main_windows()
{
}
}
- /* Figure out window positions and placements. Status and message area can be aligned
- based on configuration. The priority alignment-wise is: status > msgarea > game.
- Define everything as taking as much space as possible and shrink/move based on
- alignment positions. */
+ /* Figure out window positions and placements. Status and message area
+ can be aligned based on configuration. The priority alignment-wise
+ is: status > msgarea > game.
+ Define everything as taking as much space as possible and shrink/move
+ based on alignment positions. */
{
int message_x = 0;
int message_y = 0;
boolean status_vertical = FALSE;
boolean msg_vertical = FALSE;
+
if (status_orientation == ALIGN_LEFT ||
status_orientation == ALIGN_RIGHT)
status_vertical = TRUE;
/* Vertical windows have priority. Otherwise, priotity is:
status > inv > msg */
if (status_vertical)
- set_window_position(&status_x, &status_y, &status_width, &status_height,
- status_orientation, &map_x, &map_y, &map_width, &map_height,
+ set_window_position(&status_x, &status_y,
+ &status_width, &status_height,
+ status_orientation,
+ &map_x, &map_y, &map_width, &map_height,
border_space, statusheight, 26);
if (iflags.perm_invent) {
width = 25;
set_window_position(&inv_x, &inv_y, &inv_width, &inv_height,
- ALIGN_RIGHT, &map_x, &map_y, &map_width, &map_height,
+ ALIGN_RIGHT, &map_x, &map_y,
+ &map_width, &map_height,
border_space, -1, width);
}
if (msg_vertical)
- set_window_position(&message_x, &message_y, &message_width, &message_height,
- message_orientation, &map_x, &map_y, &map_width, &map_height,
+ set_window_position(&message_x, &message_y,
+ &message_width, &message_height,
+ message_orientation,
+ &map_x, &map_y, &map_width, &map_height,
border_space, -1, -25);
/* Now draw horizontal windows */
if (!status_vertical)
- set_window_position(&status_x, &status_y, &status_width, &status_height,
- status_orientation, &map_x, &map_y, &map_width, &map_height,
+ set_window_position(&status_x, &status_y,
+ &status_width, &status_height,
+ status_orientation,
+ &map_x, &map_y, &map_width, &map_height,
border_space, statusheight, 26);
if (!msg_vertical)
- set_window_position(&message_x, &message_y, &message_width, &message_height,
- message_orientation, &map_x, &map_y, &map_width, &map_height,
+ set_window_position(&message_x, &message_y,
+ &message_width, &message_height,
+ message_orientation,
+ &map_x, &map_y, &map_width, &map_height,
border_space, -1, -25);
if (map_width > COLNO)
curses_add_nhwin(INV_WIN, inv_height, inv_width, inv_y, inv_x,
ALIGN_RIGHT, borders);
- curses_add_nhwin(MAP_WIN, map_height, map_width, map_y, map_x, 0, borders);
+ curses_add_nhwin(MAP_WIN, map_height, map_width,
+ map_y, map_x, 0, borders);
refresh();
}
}
-
/* Initialize curses colors to colors used by NetHack */
-
void
curses_init_nhcolors()
{
int i;
boolean hicolor = FALSE;
- int clr_remap[16] = {
+ static const int clr_remap[16] = {
COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
COLOR_BLUE,
COLOR_MAGENTA, COLOR_CYAN, -1, COLOR_WHITE,
if (COLORS >= 16)
hicolor = TRUE;
- /* Work around the crazy definitions above for more background colors... */
+ /* Work around the crazy definitions above for more background
+ colors... */
for (i = 0; i < (COLORS >= 16 ? 16 : 8); i++) {
init_pair((hicolor ? 49 : 9) + i, clr_remap[i], COLOR_GREEN);
init_pair((hicolor ? 65 : 33) + i, clr_remap[i], COLOR_YELLOW);
#endif
}
-
/* Allow player to pick character's role, race, gender, and alignment.
-Borrowed from the Gnome window port. */
-
+ Borrowed from the Gnome window port. */
void
curses_choose_character()
{
/* This part is irritating: we have to strip the choices off of
the string and put them in a separate string in order to use
curses_character_input_dialog for this prompt. */
-
while (cur_character != '[') {
cur_character = prompt[count];
count++;
}
/* Add capital letters as choices that aren't displayed */
-
for (count = 0; tmpchoice[count]; count++) {
tmpchoice[count] = toupper(tmpchoice[count]);
}
pickmap = (int *) alloc(sizeof (int) * (n + 1));
for (;;) {
for (n = 0, i = 0; roles[i].name.m; i++) {
- if (ok_role(i, flags.initrace, flags.initgend, flags.initalign)) {
+ if (ok_role(i, flags.initrace,
+ flags.initgend, flags.initalign)) {
if (flags.initgend >= 0 && flags.female && roles[i].name.f)
choices[n] = roles[i].name.f;
else
}
choices[n] = (const char *) 0;
if (n > 1)
- sel =
- curses_character_dialog(choices,
+ sel = curses_character_dialog(choices,
"Choose one of the following roles:");
else
sel = 0;
/* Count the number of valid races */
n = 0; /* number valid */
for (i = 0; races[i].noun; i++) {
- if (ok_race(flags.initrole, i, flags.initgend, flags.initalign))
+ if (ok_race(flags.initrole, i,
+ flags.initgend, flags.initalign))
n++;
}
if (n == 0) {
choices = (const char **) alloc(sizeof (char *) * (n + 1));
pickmap = (int *) alloc(sizeof (int) * (n + 1));
for (n = 0, i = 0; races[i].noun; i++) {
- if (ok_race(flags.initrole, i, flags.initgend, flags.initalign)) {
+ if (ok_race(flags.initrole, i,
+ flags.initgend, flags.initalign)) {
choices[n] = races[i].noun;
pickmap[n++] = i;
}
choices[n] = (const char *) 0;
/* Permit the user to pick, if there is more than one */
if (n > 1)
- sel =
- curses_character_dialog(choices,
- "Choose one of the following races:");
+ sel = curses_character_dialog(choices,
+ "Choose one of the following races:");
else
sel = 0;
if (sel >= 0)
/* Count the number of valid genders */
n = 0; /* number valid */
for (i = 0; i < ROLE_GENDERS; i++) {
- if (ok_gend(flags.initrole, flags.initrace, i, flags.initalign))
+ if (ok_gend(flags.initrole, flags.initrace,
+ i, flags.initalign))
n++;
}
if (n == 0) {
choices = (const char **) alloc(sizeof (char *) * (n + 1));
pickmap = (int *) alloc(sizeof (int) * (n + 1));
for (n = 0, i = 0; i < ROLE_GENDERS; i++) {
- if (ok_gend(flags.initrole, flags.initrace, i, flags.initalign)) {
+ if (ok_gend(flags.initrole, flags.initrace,
+ i, flags.initalign)) {
choices[n] = genders[i].adj;
pickmap[n++] = i;
}
choices[n] = (const char *) 0;
/* Permit the user to pick, if there is more than one */
if (n > 1)
- sel =
- curses_character_dialog(choices,
- "Choose one of the following genders:");
+ sel = curses_character_dialog(choices,
+ "Choose one of the following genders:");
else
sel = 0;
if (sel >= 0)
/* Count the number of valid alignments */
n = 0; /* number valid */
for (i = 0; i < ROLE_ALIGNS; i++) {
- if (ok_align(flags.initrole, flags.initrace, flags.initgend, i))
+ if (ok_align(flags.initrole, flags.initrace,
+ flags.initgend, i))
n++;
}
if (n == 0) {
choices = (const char **) alloc(sizeof (char *) * (n + 1));
pickmap = (int *) alloc(sizeof (int) * (n + 1));
for (n = 0, i = 0; i < ROLE_ALIGNS; i++) {
- if (ok_align(flags.initrole, flags.initrace, flags.initgend, i)) {
+ if (ok_align(flags.initrole, flags.initrace,
+ flags.initgend, i)) {
choices[n] = aligns[i].adj;
pickmap[n++] = i;
}
choices[n] = (const char *) 0;
/* Permit the user to pick, if there is more than one */
if (n > 1)
- sel =
- curses_character_dialog(choices,
- "Choose one of the following alignments:");
+ sel = curses_character_dialog(choices,
+ "Choose one of the following alignments:");
else
sel = 0;
if (sel >= 0)
}
}
-
/* Prompt user for character race, role, alignment, or gender */
-
int
curses_character_dialog(const char **choices, const char *prompt)
{
return ret;
}
-
/* Initialize and display options appropriately */
-
void
curses_init_options()
{
- set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR |
- WC_HILITE_PET | WC_POPUP_DIALOG, SET_IN_GAME);
+ set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR
+ | WC_HILITE_PET | WC_POPUP_DIALOG, SET_IN_GAME);
set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_GAME);
/* Make sure that DECgraphics is not set to true via the config
file, as this will cause display issues. We can't disable it in
options.c in case the game is compiled with both tty and curses. */
- if (!symset[PRIMARY].name || !strcmpi(symset[PRIMARY].name, "DECgraphics")) {
- load_symset("curses",PRIMARY);
- load_symset("default",ROGUESET);
+ if (!symset[PRIMARY].name
+ || !strcmpi(symset[PRIMARY].name, "DECgraphics")) {
+ load_symset("curses", PRIMARY);
+ load_symset("default", ROGUESET);
}
#ifdef PDCURSES
/* PDCurses for SDL, win32 and OS/2 has the ability to set the
if (!iflags.wc2_petattr) {
iflags.wc2_petattr = A_REVERSE;
- } else { /* Pet attribute specified, so hilite_pet should be true */
+ } else { /* Pet attribute specified, so hilite_pet should be true */
iflags.hilite_pet = TRUE;
}
#endif
}
-
/* Display an ASCII splash screen if the splash_screen option is set */
-
void
curses_display_splash_window()
{
- int x_start;
- int y_start;
+ int i, x_start, y_start;
curses_get_window_xy(MAP_WIN, &x_start, &y_start);
iflags.wc_splash_screen = FALSE; /* No room for s.s. */
}
- curses_toggle_color_attr(stdscr, CLR_WHITE, A_NORMAL, ON);
if (iflags.wc_splash_screen) {
+ if (iflags.wc2_guicolor)
+ curses_toggle_color_attr(stdscr, CLR_WHITE, A_NORMAL, ON);
mvaddstr(y_start, x_start, NETHACK_SPLASH_A);
mvaddstr(y_start + 1, x_start, NETHACK_SPLASH_B);
mvaddstr(y_start + 2, x_start, NETHACK_SPLASH_C);
mvaddstr(y_start + 5, x_start, NETHACK_SPLASH_F);
y_start += 7;
}
+ if (iflags.wc2_guicolor)
+ curses_toggle_color_attr(stdscr, CLR_WHITE, A_NORMAL, OFF);
- curses_toggle_color_attr(stdscr, CLR_WHITE, A_NORMAL, OFF);
-
-#ifdef COPYRIGHT_BANNER_A
- mvaddstr(y_start, x_start, COPYRIGHT_BANNER_A);
- y_start++;
-#endif
-
-#ifdef COPYRIGHT_BANNER_B
- mvaddstr(y_start, x_start, COPYRIGHT_BANNER_B);
- y_start++;
-#endif
-
-#ifdef COPYRIGHT_BANNER_C
- mvaddstr(y_start, x_start, COPYRIGHT_BANNER_C);
- y_start++;
-#endif
+ for (i = 1; i <= 4; ++i) {
+ mvaddstr(y_start, x_start, copyright_banner_line(i));
+ y_start++;
+ }
-#ifdef COPYRIGHT_BANNER_D /* Just in case */
- mvaddstr(y_start, x_start, COPYRIGHT_BANNER_D);
- y_start++;
-#endif
refresh();
}
-
/* Resore colors and cursor state before exiting */
-
void
curses_cleanup()
{