#include <ncursesw/curses.h>
#include <ncursesw/panel.h>
+#define DISP_NC_RADIUS (10)
+#define DISP_NC_SIDE (DISP_NC_RADIUS * 2 + 1)
void set_inventory_message(const char *s, bool allow_nil);
void reset_inventory_message(void);
void hide_inv(void);
mvwprintw(status_window, 1, 44, "Agility: %02d/%02d", u.agility - u.adam, u.agility);
}
+/*! \brief Get pointer to cchar_t object for specified terrain
+ */
static const cchar_t *terrain_char(Terrain terrain_type)
{
return terrain_tiles + terrain_type;
}
+/*! \brief Get pointer to cchar_t object for specified monster
+ */
static const cchar_t *monster_char(int monster_id)
{
return permon_tiles + monster_id;
}
+/*! \brief Get pointer to cchar_t object for specified object
+ */
static const cchar_t *object_char(int object_id)
{
return permobj_tiles + object_id;
}
+/*! \brief Call newsym() on the entire level and request a hard redraw
+ */
void touch_back_buffer(void)
{
Coord c;
hard_redraw = 1;
}
+/*! \brief Update symbol at specified location
+ *
+ * newsym() notifies the display layer that the state of position 'c' has
+ * changed in a way that should change its graphical representation (e.g.
+ * there was a monster there and now there isn't).
+ */
void newsym(Coord c)
{
const cchar_t *ch;
}
}
+/*! \brief Update the map window
+ */
static void draw_world(void)
{
int i;
int j;
Coord c;
- for (i = 0; i < 21; i++)
+ for (i = 0; i < DISP_NC_SIDE; i++)
{
- c.y = u.pos.y + i - 10;
- for (j = 0; j < 21; j++)
+ c.y = u.pos.y + i - DISP_NC_RADIUS;
+ for (j = 0; j < DISP_NC_SIDE; j++)
{
- c.x = u.pos.x + j - 10;
+ c.x = u.pos.x + j - DISP_NC_RADIUS;
if ((c.y < 0) || (c.x < 0) ||
(c.y >= DUN_HEIGHT) || (c.x >= DUN_WIDTH))
{
else if (hard_redraw || (front_buffer[i][j] != back_buffer[c.y][c.x]))
{
mvwadd_wch(world_window, i, j, back_buffer[c.y][c.x]);
- if (!player_fov.affected[i][j])
+ if (!player_fov.test(i - DISP_NC_RADIUS + MAX_FOV_RADIUS, j - DISP_NC_RADIUS + MAX_FOV_RADIUS))
{
mvwchgat(world_window, i, j, 1, A_BOLD, Gcol_d_grey, NULL);
}
/* extern funcs */
+/*! \brief Wait for the user to press RETURN
+ */
void press_enter(void)
{
int ch;
}
}
+/*! \brief Update any parts of the display that need it
+ */
void display_update(void)
{
if (status_updated)
doupdate();
}
+/*! \brief Initialize the display subsystem
+ *
+ * Yes, this architecture does mean we only support one display subsystem at
+ * compile time.
+ *
+ * \todo Rename this and put appropriate glue elsewhere to make it work
+ */
int display_init(void)
{
int i;
return 0;
}
+/*! \brief Get string input from the player
+ */
int read_input(char *buffer, int length)
{
echo();
return strlen(buffer);
}
+/*! \brief Print some text in the message window
+ *
+ * \todo Handle the message window getting resized
+ */
void print_msg(const char *fmt, ...)
{
va_list ap;
display_update();
}
+/*! \brief Set a message and whether 'nothing' should be listed in inventory
+ */
void set_inventory_message(const char *s, bool allow_nil)
{
mvwprintw(inventory_window, 0, 0, "%-57s\n", s);
}
}
+/*! \brief Clear any inventory message
+ */
void reset_inventory_message(void)
{
wattrset(inventory_window, colour_attrs[Gcol_l_grey]);
mvwprintw(inventory_window, 20, 0, " ");
}
+/*! \brief Make the inventory visible
+ */
void show_inv(void)
{
show_panel(inventory_panel);
doupdate();
}
+/*! \brief Hide the inventory if necessary on this display type
+ */
void hide_inv(void)
{
show_panel(message_panel);
doupdate();
}
+/*! \brief Update the inventory window to reflect the filter in force
+ *
+ * \todo Switch to using a function pointer + private argument for filtering
+ */
void update_inv(enum poclass_num filter)
{
int i;
}
}
+/*! \brief Select an inventory item
+ *
+ * \todo Take function pointer and private arg for smarter filtering
+ */
int inv_select(enum poclass_num filter, const char *action, int accept_blank)
{
int selection;
case 'q':
case 'r':
case 's':
- /* I am assuming that we're in a place where the character
- * set is a strict superset of ASCII. IF we're not, the
- * following code may break. */
+ /* I am assuming that we're in a place where the input character set is
+ * a strict superset of ASCII. IF we're not, the following code may
+ * break. */
selection = ch - 'a';
if ((u.inventory[selection] != NO_OBJ) && ((filter == POCLASS_NONE) || (permobjs[objects[u.inventory[selection]].obj_id].poclass == filter)))
{
}
}
+/*! \brief Ask the player to choose a direction
+ *
+ * \todo Consider making this accommodate up/down/self as well as compass directions
+ */
Pass_fail select_dir(Offset *pstep)
{
int ch;
return You_pass;
}
+/*! \brief Read the player's next command
+ *
+ * \todo Consider redesigning in a way friendlier to non-terminal platforms
+ */
enum game_cmd get_command(void)
{
int ch;
return QUIT;
}
+/*! \brief Shut down the display subsystem
+ */
int display_shutdown(void)
{
display_update();
return 0;
}
+/*! \brief Prompt the player to press any key
+ */
void pressanykey(void)
{
print_msg("Press any key to continue.\n");
wgetch(message_window);
}
+/*! \brief Prompt the player for a relatively paranoid 'Y'
+ */
int getYN(const char *msg)
{
int ch;
return 0;
}
+/*! \brief Get a yes/no response from the player
+ */
int getyn(const char *msg)
{
int ch;
}
}
+/*! \brief Print some basic help for the player
+ *
+ * \todo Consider providing a more capable help system.
+ */
void print_help(void)
{
print_msg("MOVEMENT\n");
print_msg("OTHER COMMANDS\n");
print_msg("S save and exit\n");
print_msg("X quit without saving\n");
- print_msg("i print your inventory\n");
+ print_msg("i show your inventory\n");
print_msg("I examine an item you are carrying\n");
print_msg("# show underlying terrain of occupied squares\n");
print_msg("\\ list all recognised items\n");
print_msg("\nThis is all the help you get. Good luck!\n");
}
+/*! \brief Call newsym() for all locations in camera range of a position
+ */
void touch_one_screen(Coord c)
{
Coord c2;
- for (c2.y = c.y - 10; c2.y <= c.y + 10; c2.y++)
+ for (c2.y = c.y - DISP_NC_RADIUS; c2.y <= c.y + DISP_NC_RADIUS; c2.y++)
{
if ((c2.y < 0) || (c2.y >= DUN_HEIGHT))
{
continue;
}
- for (c2.x = c.x - 10; c2.x <= c.x + 10; c2.x++)
+ for (c2.x = c.x - DISP_NC_RADIUS; c2.x <= c.x + DISP_NC_RADIUS; c2.x++)
{
if ((c2.x < 0) || (c2.x >= DUN_WIDTH))
{