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 uint16_t, uint32_t */
13 #include <stdio.h> /* for FILE typedef */
14 #include "yx_uint16.h" /* for yx_uint16 coordinates */
22 /* Reset terminal (end ncurses), clean up memory and exit. */
23 extern void exit_game(struct World * world, struct Map * map);
27 /* Learn from "file" the largest line length (pointed to by "linemax_p") and
28 * (pointed to by "n_lines_p" if it is not set to NULL) the number of lines.
30 extern void textfile_sizes(FILE * file, uint16_t * linemax_p,
31 uint16_t * n_lines_p);
35 /* Update game log by appending "text", or by appending a "." if "text" is the
36 * same as the last one passed.
38 extern void update_log(struct World * world, char * text);
42 /* Return the offset necessary to center "map" on position "pos" in a frame of
45 extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
50 /* Record last player "action" in game record file "record, increment the game
51 * turn and trigger enemy movement.
53 extern void turn_over(struct World * world, char action);
57 /* Save current game data to file "savefile". */
58 extern void save_game(struct World * world);
62 /* Toggle display of a window "win". */
63 extern void toggle_window(struct WinMeta * win_meta, struct Win * win);
67 /* Try to scroll virtual screen left ("dir" = "-") or right ("dir" = "+"),
68 * subject to the limitations provided by the window manager via
71 extern void scroll_pad(struct WinMeta * win_meta, char dir);
75 /* Try to grow or shrink the active window horizontally ("change" = "*"/"_") or
76 * vertically ("change = "+"/"-") by one cell size, subject to the limitations
77 * provided by the window manager via resize_active_win().
79 extern void 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 unsigned char meta_keys(int key, struct World * world,
94 struct WinMeta * win_meta,
95 struct Win * win_keys,
97 struct Win * win_info,
98 struct Win * win_log);