3 * Miscellaneous routines that have not yet found a proper parent module. Having
4 * LOTS of stuff in here is a sure sign that better modularization is in order.
12 #include <stdint.h> /* for uint8_t, uint16_t, uint32_t */
13 #include <stdio.h> /* for FILE typedef */
14 #include "yx_uint16.h" /* for yx_uint16 coordinates */
22 /* Learn from "file" the largest line length (pointed to by "linemax_p") and
23 * (pointed to by "n_lines_p" if it is not set to NULL) the number of lines.
25 extern void textfile_sizes(FILE * file, uint16_t * linemax_p,
26 uint16_t * n_lines_p);
30 /* Update game log by appending "text", or by appending a "." if "text" is the
31 * same as the last one passed.
33 extern void update_log(struct World * world, char * text);
37 /* Return the offset necessary to center "map" on position "pos" in a frame of
40 extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
45 /* Record last player "action" in game record file "record, increment the game
46 * turn and trigger enemy movement.
48 extern void turn_over(struct World * world, char action);
52 /* Save current game data to file "savefile". */
53 extern void save_game(struct World * world);
57 /* Toggle display of a window "win".
59 * Return 0 on success, 1 on (ncurses pad/window memory allocation) error.
61 extern uint8_t toggle_window(struct WinMeta * win_meta, struct Win * win);
65 /* Try to scroll virtual screen left ("dir" = "-") or right ("dir" = "+"),
66 * subject to the limitations provided by the window manager via
69 extern void scroll_pad(struct WinMeta * win_meta, char dir);
73 /* Try to grow or shrink the active window horizontally ("change" = "*"/"_") or
74 * vertically ("change = "+"/"-") by one cell size, subject to the limitations
75 * provided by the window manager via resize_active_win().
77 * Return 0 on success, 1 on (ncurses pad/window memory allocation) error.
79 extern uint8_t growshrink_active_window(struct WinMeta * win_meta, char change);
83 /* Return a random position on the map "map" that is passable (as determined by
86 extern struct yx_uint16 find_passable_pos(struct Map * map);
90 /* Call some meta game / window management actions dependent on key. If the
91 * "quit" action is called, return 1 only instead of doing anything directly.
93 extern uint8_t meta_keys(int key, struct World * world,
94 struct WinMeta * win_meta, struct Win * win_keys,
95 struct Win * win_map, struct Win * win_info,
96 struct Win * win_log);