COMMAND map_r
DESCRIPTION 'map right'
-COMMAND map_c
-DESCRIPTION 'map center player'
-
COMMAND to_inv
DESCRIPTION 'window inventory'
COMMAND to_wk_keywin
DESCRIPTION 'window keybinding keys'
-COMMAND to_autofocus
-DESCRIPTION 'toggle auto-center'
-
COMMAND to_look
DESCRIPTION 'toggle look mode'
KEY 258 map_d
KEY 260 map_l
KEY 261 map_r
-KEY 46 map_c
-KEY 70 to_autofocus
KEY 108 to_look
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
#include "keybindings.h" /* get_command_to_keycode(), get_keycode_to_command(),
* mod_selected_keyb(), move_keyb_selection()
*/
-#include "map.h" /* map_scroll(), map_center(), toggle_autofocus(),
- * toggle_lookmode(), lookmode_nav()
- */
+#include "map.h" /* map_scroll(),toggle_lookmode(),lookmode_nav()*/
#include "wincontrol.h" /* shift_active_win(), resize_active_win(),
* toggle_win_size_type(), toggle_window(),
* cycle_active_win(), scroll_v_screen(),
static uint8_t try_client_commands(struct Command * command)
{
- return ( try_0args(command, "map_c", map_center)
- || try_0args(command, "to_autofocus", toggle_autofocus)
- || try_1args(command, "map_u", map_scroll, '8')
+ return ( try_1args(command, "map_u", map_scroll, '8')
|| try_1args(command, "map_d", map_scroll, '2')
|| try_1args(command, "map_r", map_scroll, '6')
|| try_1args(command, "map_l", map_scroll, '4')
#include "cleanup.h" /* set_cleanup_flag() */
#include "command_db.h" /* get_command() */
#include "keybindings.h" /* KeyBinding, KeyBindingDB, get_command_to_keycode()*/
-#include "map.h" /* map_center() */
#include "parse.h" /* EDIT_STARTED, parse_file(), parse_flagval(),
* parse_and_reduce_to_readyflag(), parse_id_uniq()
* parsetest_defcontext(), parse_unknown_arg(),
{
unload_interface_conf();
load_interface_conf();
- map_center();
world.winDB.v_screen_offset = 0;
}
* data, world.wins.pad (initialized before opening any windows to the height of
* the terminal screen and a width of 1) and window chains.
*
- * Note that reload_interface_conf() also calls map_center() and re-sets
- * world.winDB.v_screen_offset to zero.
+ * reload_interface_conf() also re-sets world.winDB.v_screen_offset to zero.
*/
extern void save_interface_conf();
extern void load_interface_conf();
* read_file_into_queue(),
* get_message_from_queue(),
*/
+#include "../common/yx_uint8.h" /* yx_uint8 */
#include "control.h" /* try_key() */
-#include "map.h" /* map_center() */
-#include "windows.h" /* reset_windows_on_winch(), draw_all_wins() */
+#include "map.h" /* query_mapcell() */
+#include "windows.h" /* Win, reset_windows_on_winch(), draw_all_wins(),
+ * get_win_by_id()
+ */
#include "world.h" /* world global */
* world in a hard-coded serialization format. Returns 1 on success, or 0 if the
* out file wasn't read for supposedly not having changed since a last
* read_worldstate() call.
- *
- * map_center() is triggered by either, the first successful read_worldstate()
- * (thus on client start), or on turn 1 (thus on world start).
*/
static uint8_t read_worldstate();
{
char * path = "server/worldstate";
char * quit_msg = "No worldstate file found to read. Server may be down.";
- static uint8_t first_read = 1;
exit_err(access(path, F_OK), quit_msg);
FILE * file = changed_worldstate_file(path);
if (!file)
read_inventory(read_buf, linemax, file);
world.player_pos.y = read_value_from_line(read_buf, linemax, file);
world.player_pos.x = read_value_from_line(read_buf, linemax, file);
- if (1 == world.turn || first_read)
- {
- map_center();
- first_read = 0;
- }
world.map.length = read_value_from_line(read_buf, linemax, file);
read_map_cells(file, &world.map.cells);
read_map_cells(file, &world.mem_map);
world.halfdelay = 1; /* Ensure server is polled only 10 times */
halfdelay(world.halfdelay); /* a second during user inactivity. */
uint8_t change_in_client = 0;
- uint16_t last_focused_turn = world.turn;
while (1)
{
test_and_poll_server();
}
if (change_in_client || read_worldstate() || read_queue())
{
- if (world.turn != last_focused_turn && world.autofocus)
- {
- last_focused_turn = world.turn;
- map_center();
- }
+ struct Win * win_map = get_win_by_id('m');
+ struct yx_uint8 pos = world.look? world.look_pos : world.player_pos;
+ win_map->center.y = pos.y;
+ win_map->center.x = pos.x * 2 + (pos.y % 2);
draw_all_wins();
}
change_in_client = 0;
* appropriate quit message to write to stdout when the client winds down. Call
* reset_windows() on receiving a SIGWINCH. Abort on assumed server death if the
* server's out file does not get updated, even on PING requests. Re-focus map
- * view on player if world.autofocus is set. Messages from the out file are put
- * together on the queue first, from which only complete (\n-delimited) messages
- * are read. Queues of messages are worked through completely / emptied before
- * any re-drawing or further server polling happens.
+ * view on player. Messages from the out file are put together on the queue
+ * first, from which only complete (\n-delimited) messages are read. Queues of
+ * messages are worked through completely / emptied before any re-drawing or
+ * further server polling happens.
*/
extern char * io_loop();
keypad(world.winDB.t_screen, TRUE);
init_command_db(); /* The command DB needs to be initialized before */
load_interface_conf(); /* the interface, whose keybindings depend on it. */
- world.autofocus = 1;
/* Set handler for terminal window resizing. */
struct sigaction act;
#include <string.h> /* strlen(), strncmp() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "../common/rexit.h" /* exit_trouble() */
-#include "../common/yx_uint8.h" /* yx_uint8 */
+//#include "../common/yx_uint8.h" /* yx_uint8 */
#include "io.h" /* send() */
#include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
#include "world.h" /* for global world */
extern void map_scroll(char d)
{
- world.autofocus = 0;
struct Win * win = get_win_by_id('m');
uint16_t offset;
if (('8' == d || '2' == d) && world.map.length > win->frame_size.y)
-extern void map_center()
-{
- struct Win * win_map = get_win_by_id('m');
- struct yx_uint8 pos = world.look ? world.look_pos : world.player_pos;
- win_map->center.y = pos.y;
- win_map->center.x = pos.x * 2 + (pos.y % 2);
-}
-
-
-
-extern void toggle_autofocus()
-{
- world.autofocus = world.autofocus ? 0 : 1;
-}
-
-
-
extern void toggle_lookmode()
{
if (!world.look)
{
return 0;
}
- map_center();
query_mapcell();
return 1;
}
*/
extern void map_scroll(char d);
-/* Center map window on player (even if it is non-visible). */
-extern void map_center();
-
-/* Toggle world.focus_each_turn (auto-centering of map on player each turn). */
-extern void toggle_autofocus();
-
/* Toggle world.look (moving look cursor instead of player over map). */
extern void toggle_lookmode();
uint8_t player_inventory_select; /* index of selected item in inventory */
uint8_t player_lifepoints; /* how alive the player is */
uint8_t winch; /* if set, SIGWINCH was registered; trigger reset_windows()*/
- uint8_t autofocus; /* if !0, re-focus map each new turn / look focus move */
uint8_t look; /* if set, move look cursor over map intead of player */
};