From e723087996663d5a1461297533e57bd2d8174585 Mon Sep 17 00:00:00 2001 From: Nathan Vance Date: Sat, 21 Feb 2015 18:06:11 -0500 Subject: Major view improvements --- player_turn.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'player_turn.c') diff --git a/player_turn.c b/player_turn.c index 8c0f889..203f430 100644 --- a/player_turn.c +++ b/player_turn.c @@ -6,8 +6,10 @@ void io_printhand(int x, int y, int player, int cursor); void io_printcard(int x, int y, int era, int card); int io_getkey(); void data_passturn(); -void io_clearscreen(); void data_nextera(); +int data_numplayers(); +void view_refresh(int focus, int cursor, int player); +int wonder_numstages(int player); void player_turn(int player) { @@ -15,10 +17,9 @@ void player_turn(int player) int numcards; for(numcards = 0; numcards < 7 && hand[numcards] > -1; numcards++); int cursor = 0; + int focus = data_numplayers(); while(1) { - io_clearscreen(); - io_printhand(0, 0, player, cursor); - io_printcard(0, 8, data_getera(), hand[cursor]); + view_refresh(focus, cursor, player); switch(io_getkey()) { case UP: cursor--; break; @@ -26,11 +27,21 @@ void player_turn(int player) break; case RIGHT: data_passturn(); break; + case LEFT: player = (player+1)%data_numplayers(); + break; case ENTER: data_nextera(); break; + case '\t': focus = (focus+1)%(data_numplayers()+1); + break; default: break; } - if(cursor < 0) cursor = numcards-1; - if(cursor >= numcards) cursor = 0; + if(focus == data_numplayers()) { + if(cursor < 0) cursor = numcards-1; + if(cursor >= numcards) cursor = 0; + } + else { + if(cursor < 0) cursor = wonder_numstages((player+focus)%data_numplayers())-1; + cursor = cursor % wonder_numstages((player+focus)%data_numplayers()); + } } } -- cgit