X-Git-Url: http://deadsoftware.ru/gitweb?p=netwar.git;a=blobdiff_plain;f=game.c;h=9b7f2391ddc78d4aa3fdb7ef0777ba46c9001e61;hp=219141884dd23ba9a59b2643135c78fcd83568e5;hb=0ce00cd1d7ade8d9f72a4b7f67154e82ed9079b6;hpb=4148d3ff0c0c4b52b0741c38a867a1502600a65f diff --git a/game.c b/game.c index 2191418..9b7f239 100644 --- a/game.c +++ b/game.c @@ -81,16 +81,19 @@ static bool collide(float x1, float y1, float r1, float x2, float y2, float r2) return ((l - r1 - r2) <= 0); } -void g_player_does(unsigned int id, DoesCode code) { +void g_player_does(unsigned int id, DoesBits code) { assert(id < MAX_PLAYERS); - g_player[id].updated = true; - switch(code) { - case DOES_UP: moveplayer(id, SPEED); break; - case DOES_DOWN: moveplayer(id, -SPEED); break; - case DOES_LEFT: roteplayer(id, -ROTATE); break; - case DOES_RIGHT: roteplayer(id, ROTATE); break; - case DOES_FIRE: fireplayer(id); break; - } + + if(code.up) + moveplayer(id, SPEED); + if(code.down) + moveplayer(id, -SPEED); + if(code.left) + roteplayer(id, -ROTATE); + if(code.right) + roteplayer(id, ROTATE); + if(code.fire) + fireplayer(id); } void g_update() {