home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
258e57c
)
Client: Drop now redundant map centering systems.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 6 Dec 2014 06:12:37 +0000
(07:12 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 6 Dec 2014 06:12:37 +0000
(07:12 +0100)
16 files changed:
confclient/commands
patch
|
blob
|
history
confclient/interface_conf
patch
|
blob
|
history
confclient/single_wins/info
patch
|
blob
|
history
confclient/single_wins/inventory
patch
|
blob
|
history
confclient/single_wins/log
patch
|
blob
|
history
confclient/single_wins/map
patch
|
blob
|
history
confclient/single_wins/things_here
patch
|
blob
|
history
src/client/control.c
patch
|
blob
|
history
src/client/interface_conf.c
patch
|
blob
|
history
src/client/interface_conf.h
patch
|
blob
|
history
src/client/io.c
patch
|
blob
|
history
src/client/io.h
patch
|
blob
|
history
src/client/main.c
patch
|
blob
|
history
src/client/map.c
patch
|
blob
|
history
src/client/map.h
patch
|
blob
|
history
src/client/world.h
patch
|
blob
|
history
diff --git
a/confclient/commands
b/confclient/commands
index e64bdf599ab8c0f6cf2450936610d34996354ed5..70c61b5a39e7f01c007ece640a33ad3e6a679493 100644
(file)
--- a/
confclient/commands
+++ b/
confclient/commands
@@
-158,9
+158,6
@@
DESCRIPTION 'map left'
COMMAND map_r
DESCRIPTION 'map right'
COMMAND map_r
DESCRIPTION 'map right'
-COMMAND map_c
-DESCRIPTION 'map center player'
-
COMMAND to_inv
DESCRIPTION 'window inventory'
COMMAND to_inv
DESCRIPTION 'window inventory'
@@
-185,8
+182,5
@@
DESCRIPTION 'window geometry keys'
COMMAND to_wk_keywin
DESCRIPTION 'window keybinding keys'
COMMAND to_wk_keywin
DESCRIPTION 'window keybinding keys'
-COMMAND to_autofocus
-DESCRIPTION 'toggle auto-center'
-
COMMAND to_look
DESCRIPTION 'toggle look mode'
COMMAND to_look
DESCRIPTION 'toggle look mode'
diff --git
a/confclient/interface_conf
b/confclient/interface_conf
index 2cc3648e1679e694eeaaffaea196dbb0dbd0dd26..69dac92dcc6d080cb4dbf322511e396f5fa7255f 100644
(file)
--- a/
confclient/interface_conf
+++ b/
confclient/interface_conf
@@
-109,6
+109,4
@@
KEY 259 map_u
KEY 258 map_d
KEY 260 map_l
KEY 261 map_r
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 108 to_look
diff --git
a/confclient/single_wins/info
b/confclient/single_wins/info
index 78a63f925dc44d261dd766e63a2e9989e098bb2d..462f6a7c624ee68d10e1e825bfda0d46f411f643 100644
(file)
--- a/
confclient/single_wins/info
+++ b/
confclient/single_wins/info
@@
-24,10
+24,8
@@
KEY 99 move_c
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEYBINDINGS 'wingeom'
KEY 258 shift_f
diff --git
a/confclient/single_wins/inventory
b/confclient/single_wins/inventory
index b831f5097e7d297bafae4fa0627033ff6768a91c..2a24b67a0df0c7162f0caf0edcbb679144997807 100644
(file)
--- a/
confclient/single_wins/inventory
+++ b/
confclient/single_wins/inventory
@@
-24,10
+24,8
@@
KEY 99 move_c
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEYBINDINGS 'wingeom'
KEY 258 shift_f
diff --git
a/confclient/single_wins/log
b/confclient/single_wins/log
index 40b9be4dd64dfd7f7d185f3cdeba4a1a33d4a010..0b92f775b1d528c393970d746cb72c707f7b558e 100644
(file)
--- a/
confclient/single_wins/log
+++ b/
confclient/single_wins/log
@@
-24,10
+24,8
@@
KEY 99 move_c
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEYBINDINGS 'wingeom'
KEY 258 shift_f
diff --git
a/confclient/single_wins/map
b/confclient/single_wins/map
index 56e7f340eb9cabe452daa9f79bbfcb92b622cc6a..6d6a399c8c8cece31fba3a835770e2db488a9d9f 100644
(file)
--- a/
confclient/single_wins/map
+++ b/
confclient/single_wins/map
@@
-24,10
+24,8
@@
KEY 99 move_c
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEYBINDINGS 'wingeom'
KEY 258 shift_f
diff --git
a/confclient/single_wins/things_here
b/confclient/single_wins/things_here
index ea87f9ff0ed7f005fba30359bf77cd965fa137aa..4936331d731a5ba03210ed3edd1dc50a349a8dac 100644
(file)
--- a/
confclient/single_wins/things_here
+++ b/
confclient/single_wins/things_here
@@
-25,10
+25,8
@@
KEY 99 move_c
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
KEY 120 move_x
KEY 115 move_s
KEY 119 move_w
-KEY 46 map_c
KEY 68 drop
KEY 117 use
KEY 68 drop
KEY 117 use
-KEY 70 to_autofocus
KEYBINDINGS 'wingeom'
KEY 258 shift_f
KEYBINDINGS 'wingeom'
KEY 258 shift_f
diff --git
a/src/client/control.c
b/src/client/control.c
index 76d69ac4562b9b0dc39211fffd1d47767815f9ac..13e57dd93aa5de1ca97a2e4f8f744082ec42b45a 100644
(file)
--- a/
src/client/control.c
+++ b/
src/client/control.c
@@
-17,9
+17,7
@@
#include "keybindings.h" /* get_command_to_keycode(), get_keycode_to_command(),
* mod_selected_keyb(), move_keyb_selection()
*/
#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(),
#include "wincontrol.h" /* shift_active_win(), resize_active_win(),
* toggle_win_size_type(), toggle_window(),
* cycle_active_win(), scroll_v_screen(),
@@
-136,9
+134,7
@@
static uint8_t try_kb_manip(char * command)
static uint8_t try_client_commands(struct Command * command)
{
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')
|| try_1args(command, "map_d", map_scroll, '2')
|| try_1args(command, "map_r", map_scroll, '6')
|| try_1args(command, "map_l", map_scroll, '4')
diff --git
a/src/client/interface_conf.c
b/src/client/interface_conf.c
index 343302abbbb48cee1fe0293b1da9937b620388bf..679f6c7a92549e8c6c094826e8c072eb0fd8a9a1 100644
(file)
--- a/
src/client/interface_conf.c
+++ b/
src/client/interface_conf.c
@@
-24,7
+24,6
@@
#include "cleanup.h" /* set_cleanup_flag() */
#include "command_db.h" /* get_command() */
#include "keybindings.h" /* KeyBinding, KeyBindingDB, get_command_to_keycode()*/
#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(),
#include "parse.h" /* EDIT_STARTED, parse_file(), parse_flagval(),
* parse_and_reduce_to_readyflag(), parse_id_uniq()
* parsetest_defcontext(), parse_unknown_arg(),
@@
-481,6
+480,5
@@
extern void reload_interface_conf()
{
unload_interface_conf();
load_interface_conf();
{
unload_interface_conf();
load_interface_conf();
- map_center();
world.winDB.v_screen_offset = 0;
}
world.winDB.v_screen_offset = 0;
}
diff --git
a/src/client/interface_conf.h
b/src/client/interface_conf.h
index 36bc02931e061433b863b3e7a7a4399a4fc3d32f..1d1c44ca143447bd9d904c5bf73f102d0db836f7 100644
(file)
--- a/
src/client/interface_conf.h
+++ b/
src/client/interface_conf.h
@@
-19,8
+19,7
@@
extern void obey_argv(int argc, char * argv[]);
* data, world.wins.pad (initialized before opening any windows to the height of
* the terminal screen and a width of 1) and window chains.
*
* 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();
*/
extern void save_interface_conf();
extern void load_interface_conf();
diff --git
a/src/client/io.c
b/src/client/io.c
index 45a1de7ae6fe17d5c4973c172a8c453b6319adf4..d1fffc05296d930f39dce3187492191ac231d134 100644
(file)
--- a/
src/client/io.c
+++ b/
src/client/io.c
@@
-25,9
+25,12
@@
* read_file_into_queue(),
* get_message_from_queue(),
*/
* read_file_into_queue(),
* get_message_from_queue(),
*/
+#include "../common/yx_uint8.h" /* yx_uint8 */
#include "control.h" /* try_key() */
#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 */
#include "world.h" /* world global */
@@
-69,9
+72,6
@@
static FILE * changed_worldstate_file(char * path);
* 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.
* 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();
*/
static uint8_t read_worldstate();
@@
-178,7
+178,6
@@
static uint8_t read_worldstate()
{
char * path = "server/worldstate";
char * quit_msg = "No worldstate file found to read. Server may be down.";
{
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)
exit_err(access(path, F_OK), quit_msg);
FILE * file = changed_worldstate_file(path);
if (!file)
@@
-192,11
+191,6
@@
static uint8_t read_worldstate()
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);
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.map.length = read_value_from_line(read_buf, linemax, file);
read_map_cells(file, &world.map.cells);
read_map_cells(file, &world.mem_map);
@@
-324,7
+318,6
@@
extern char * io_loop()
world.halfdelay = 1; /* Ensure server is polled only 10 times */
halfdelay(world.halfdelay); /* a second during user inactivity. */
uint8_t change_in_client = 0;
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();
while (1)
{
test_and_poll_server();
@@
-336,11
+329,10
@@
extern char * io_loop()
}
if (change_in_client || read_worldstate() || read_queue())
{
}
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;
draw_all_wins();
}
change_in_client = 0;
diff --git
a/src/client/io.h
b/src/client/io.h
index 041ed67fdb5732b5815f220ef037f5952afa6d4c..12a56c01fd38787c26621344cc16a6bb74341a46 100644
(file)
--- a/
src/client/io.h
+++ b/
src/client/io.h
@@
-30,10
+30,10
@@
extern void send(char * msg);
* 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
* 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();
*/
extern char * io_loop();
diff --git
a/src/client/main.c
b/src/client/main.c
index acb592bff8482c9215c1b3a29593b22c7da5fe0a..c40d7451e2467fa1281a42da461e9575fbab5342 100644
(file)
--- a/
src/client/main.c
+++ b/
src/client/main.c
@@
-56,7
+56,6
@@
int main(int argc, char * argv[])
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. */
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;
/* Set handler for terminal window resizing. */
struct sigaction act;
diff --git
a/src/client/map.c
b/src/client/map.c
index 75dd6dee5a6571ec6e5d89a694964628a03b04bf..f8ff0616bc502d683fc63d8d96bc15ab0b69eef3 100644
(file)
--- a/
src/client/map.c
+++ b/
src/client/map.c
@@
-12,7
+12,7
@@
#include <string.h> /* strlen(), strncmp() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "../common/rexit.h" /* exit_trouble() */
#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 */
#include "io.h" /* send() */
#include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
#include "world.h" /* for global world */
@@
-21,7
+21,6
@@
extern void map_scroll(char d)
{
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)
struct Win * win = get_win_by_id('m');
uint16_t offset;
if (('8' == d || '2' == d) && world.map.length > win->frame_size.y)
@@
-52,23
+51,6
@@
extern void map_scroll(char d)
-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)
extern void toggle_lookmode()
{
if (!world.look)
@@
-128,7
+110,6
@@
extern uint8_t lookmode_nav(char * command)
{
return 0;
}
{
return 0;
}
- map_center();
query_mapcell();
return 1;
}
query_mapcell();
return 1;
}
diff --git
a/src/client/map.h
b/src/client/map.h
index 4b1eb8d9c3e2dcb3efcecc8ccfbb2c39be07862b..cfba067893062605bd749ee7071343f44ec64a42 100644
(file)
--- a/
src/client/map.h
+++ b/
src/client/map.h
@@
-18,12
+18,6
@@
*/
extern void map_scroll(char d);
*/
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();
/* Toggle world.look (moving look cursor instead of player over map). */
extern void toggle_lookmode();
diff --git
a/src/client/world.h
b/src/client/world.h
index 19497d254cddaa13f1a5dc6cb9abc50c7ec0e2ca..c8b8580cfc5cf2c91679f6d29a449d2a6ea12623 100644
(file)
--- a/
src/client/world.h
+++ b/
src/client/world.h
@@
-46,7
+46,6
@@
struct World
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 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 */
};
uint8_t look; /* if set, move look cursor over map intead of player */
};