Index: Makefile
===================================================================
RCS file: /home/cvs/tunneler/tunneler/Makefile,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile
--- Makefile	20 Jan 2005 17:41:05 -0000	1.1.1.2
+++ Makefile	20 Jan 2005 17:49:38 -0000
@@ -1,4 +1,4 @@
-CC=gcc
+CC=/opt/gcc-3.3/bin/gcc-3.3
 CFLAGS=-Wall -ggdb -DEBUG
 LD=ld
 
Index: README
===================================================================
RCS file: /home/cvs/tunneler/tunneler/README,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 README
--- README	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ README	20 Jan 2005 18:35:40 -0000
@@ -17,9 +17,9 @@
 
    $ ./client 195.12.55.13 3000
 
-* posledni klient ktery joinuje da povel ke startu
+* klientovi muzete dat jako treti parametr hromadu znaku jako opsny:
 
-   $ ./client 195.12.55.13 3000 -start
+  m - vicerychlostni - 0,5 snizuje/zvysuje rychlost postupne
 
 * cimz spusti hru
 
Index: client.c
===================================================================
RCS file: /home/cvs/tunneler/tunneler/client.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 client.c
--- client.c	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ client.c	20 Jan 2005 19:00:29 -0000
@@ -9,6 +9,7 @@
 #include "types.h"
 #include "packet.h"
 #include "term.h"
+#include "globgame.h"
 #include "sprite.h"
 #include "state.h"
 #include "virtual.h"
@@ -28,8 +29,18 @@
 _u8	tries = 0, game_state = GAME_INIT;
 struct	timeval tv;
 
-_s8	drchr[] = { -8, 5, 4, 3, 6, -16, 2, 7, 0, 1 };
-_u16	key_speed=0, key_direction=0, key_shot=0;
+/* Options */
+int multispeed = 0;
+
+/* Direction and speed */
+enum {
+	SPEED_INC = -1,
+	SPEED_DEC = -2,
+} accel_chr;
+#define is_accel_chr(c) (c < 0)
+
+_s8	drchr[] = { SPEED_DEC, 5, 4, 3, 6, SPEED_INC, 2, 7, 0, 1 };
+int     speed = 0, key_direction = 0, key_shot = 0;
 
 GFXOBJ	*gfx_obj[4];
 
@@ -69,7 +80,7 @@
 		case GAME_RUN:
 			tv.tv_sec = 0;
 			tv.tv_usec = TICKMS*1000;
-			pck_send_cupdate(server, cur_ack, (key_speed?128:0) + (key_shot?64:0) + key_direction);
+			pck_send_cupdate(server, cur_ack, key_direction + (speed << 3) + (key_shot?128:0));
 			break;
 	}
 }
@@ -162,12 +173,26 @@
 				key_shot = !key_shot;
 			} else if (chr >= '0' && chr <= '9') {
 				chr = drchr[chr-'0'];
-				if (chr < 0)
-					key_speed = -chr-8;
-				else 
+				if (is_accel_chr(chr)) {
+					if (multispeed) {
+						switch (chr) {
+						case SPEED_INC:
+							if (speed < 1) speed = 1;
+							speed *= 2;
+							if (speed > TANK_SPEED) speed = TANK_SPEED;
+							break;
+						case SPEED_DEC:
+							speed /= 2;
+							break;
+						}
+					} else {
+						speed = (chr == SPEED_INC ? TANK_SPEED : 0);
+					}
+				} else {
 					key_direction = chr;
+				}
 			}
-			DEBUG("keys: %d %d %d", key_shot, key_speed, key_direction);
+			DEBUG("keys: %d %d %d", key_shot, speed, key_direction);
 		} else if (FD_ISSET(server->fd, &fdt)) {
 			if (! pck_recv(server, &packet))
 				continue;
@@ -207,6 +232,9 @@
 		exit(43);
 	}
 
+	/* Options */
+	multispeed = (argv[3] && strchr(argv[3], 's') != NULL);
+
 	signal(SIGTERM, setexit);
 	signal(SIGKILL, setexit);
 	signal(SIGINT, setexit);
Index: game.c
===================================================================
RCS file: /home/cvs/tunneler/tunneler/game.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 game.c
--- game.c	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ game.c	20 Jan 2005 18:48:06 -0000
@@ -154,11 +154,11 @@
 			surface[s->sx+i][s->sy+j] = set_to;
 }
 
-void	player_move (plr_t *p, _u8 direction, _u8 move, _u8 firing)
+void	player_move (plr_t *p, _u8 direction, _u8 speed, _u8 firing)
 {
 	if (direction != p->tank.angle)
 		p->tank.next_angle = direction%8;
-	p->tank.speed = move?TANK_SPEED:0;
+	p->tank.speed = speed;
 	if (p->tank.firing != firing) {
 		p->tank.fire = 1;
 		p->tank.firing = firing;
@@ -362,7 +362,7 @@
 	}
 
 	if (t->speed > 0) 
-		t->energy -= 3;
+		t->energy -= 2 + t->speed >> 3;
 	else if (tick % 3)
 		t->energy -= 1;
 
Index: game.h
===================================================================
RCS file: /home/cvs/tunneler/tunneler/game.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 game.h
--- game.h	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ game.h	20 Jan 2005 18:45:51 -0000
@@ -1,5 +1,8 @@
 #ifndef __INCLUDED_GAME_H
 #define __INCLUDED_GAME_H
+
+#include "globgame.h"
+
 #include "types.h"
 #include "sprite.h"
 #include "viewpoint.h"
@@ -18,7 +21,6 @@
 #define G_BULLET	16
 
 #define	BULLET_SPEED	24
-#define	TANK_SPEED	16
 #define BULLET_POWER	8
 #define DIRT_SLOWING	4
 #define BULLET_BURST	4
@@ -87,7 +89,7 @@
 
 void	player_update (struct _plr_t *p);
 void	bullets_update (void);
-void	player_move (struct _plr_t *p, _u8 direction, _u8 move, _u8 firing);
+void	player_move (struct _plr_t *p, _u8 direction, _u8 speed, _u8 firing);
 void	calc_view(TANK *t, VIEWPOINT *v);
 void	init_surface (void);
 void	init_player (struct _plr_t *p, _u32 id);
Index: packet.h
===================================================================
RCS file: /home/cvs/tunneler/tunneler/packet.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 packet.h
--- packet.h	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ packet.h	20 Jan 2005 18:43:02 -0000
@@ -33,6 +33,10 @@
 		} su;
 		struct {
 			_u16	ackseq;
+			/* Bitmap:
+			 * 0..2: direction
+			 * 3..6: speed
+			 * 7   : firing */
 			_u8	direction;
 		} cu;
 	};
Index: server.c
===================================================================
RCS file: /home/cvs/tunneler/tunneler/server.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 server.c
--- server.c	20 Jan 2005 17:39:53 -0000	1.1.1.1
+++ server.c	20 Jan 2005 19:04:12 -0000
@@ -140,7 +140,7 @@
 			p->current_direction = pck->cu.direction;
 			p->last_seq = pck->cu.ackseq;
 			rmlt_q(&(p->state), p->last_seq);
-			player_move(p, (p->current_direction)&63, (p->current_direction)&128, (p->current_direction)&64);
+			player_move(p, (p->current_direction)&7, (p->current_direction>>3)&15, (p->current_direction)&128);
 			return;
 	}
 }
