summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/control.c22
-rw-r--r--src/client/control.h4
-rw-r--r--src/screen/world.c13
3 files changed, 15 insertions, 24 deletions
diff --git a/src/client/control.c b/src/client/control.c
index 5d99c66..342dba5 100644
--- a/src/client/control.c
+++ b/src/client/control.c
@@ -1,4 +1,3 @@
-
#include <SDL.h>
#include <limits.h>
#include <assert.h>
@@ -36,26 +35,21 @@ int control_get_key_route(control_t *my_control)
mapa = SDL_GetKeyState(NULL);
- for (i = 0; i<CONTROL_KEY_COUNT_ROUTE; i++)
- {
- if (mapa[my_control->key[i]] == SDL_PRESSED)
- {
+ for (i = 0; i<CONTROL_KEY_COUNT_ROUTE; i++) {
+ if (mapa[my_control->key[i]] == SDL_PRESSED) {
my_control->count[i]++;
}
- else
- {
+ else {
my_control->count[i] = 0;
}
}
z = INT_MAX;
- for (i = 0; i<CONTROL_KEY_COUNT_ROUTE; i++)
- {
+ for (i = 0; i<CONTROL_KEY_COUNT_ROUTE; i++) {
if ( my_control->count[i] > 0 &&
my_control->count[i] < z &&
- mapa[my_control->key[i]] == SDL_PRESSED )
- {
+ mapa[my_control->key[i]] == SDL_PRESSED ) {
z = my_control->count[i];
ret_key = i;
}
@@ -75,13 +69,11 @@ int control_get_key_action(control_t *my_control)
mapa = SDL_GetKeyState(NULL);
- if (mapa[my_control->key[CONTROL_SHOT]] == SDL_PRESSED)
- {
+ if (mapa[my_control->key[CONTROL_SHOT]] == SDL_PRESSED) {
return CONTROL_SHOT;
}
- if (mapa[my_control->key[CONTROL_SWITCH]] == SDL_PRESSED)
- {
+ if (mapa[my_control->key[CONTROL_SWITCH]] == SDL_PRESSED) {
return CONTROL_SWITCH;
}
diff --git a/src/client/control.h b/src/client/control.h
index f36c9b5..ff479ab 100644
--- a/src/client/control.h
+++ b/src/client/control.h
@@ -1,5 +1,4 @@
#ifndef CONTROL_H
-
#define CONTROL_H
#define CONTROL_NONE -1
@@ -19,7 +18,8 @@ typedef struct control_struct
int count[CONTROL_KEY_COUNT];
} control_t;
-extern control_t* control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, SDLKey arg_down,
+extern control_t* control_new(SDLKey arg_up, SDLKey arg_right,
+ SDLKey arg_left, SDLKey arg_down,
SDLKey arg_shot, SDLKey arg_switch);
extern int control_get_key_route(control_t *my_control);
extern int control_get_key_action(control_t *my_control);
diff --git a/src/screen/world.c b/src/screen/world.c
index f156ae4..97b0d38 100644
--- a/src/screen/world.c
+++ b/src/screen/world.c
@@ -45,7 +45,6 @@
#include "table.h"
#include "control.h"
-
static arena_t *arena;
static bool_t isScreenWorldInit = FALSE;
static bool_t isEndWorld;
@@ -247,19 +246,19 @@ static void control_keyboard(tux_t *tux, control_t *control)
{
switch (control_get_key_route(control))
{
- case CONTROL_UP :
+ case CONTROL_UP:
netAction(tux, TUX_UP);
tux_action(tux, TUX_UP);
break;
- case CONTROL_RIGHT :
+ case CONTROL_RIGHT:
netAction(tux, TUX_RIGHT);
tux_action(tux, TUX_RIGHT);
break;
- case CONTROL_LEFT :
+ case CONTROL_LEFT:
netAction(tux, TUX_LEFT);
tux_action(tux, TUX_LEFT);
break;
- case CONTROL_DOWN :
+ case CONTROL_DOWN:
netAction(tux, TUX_DOWN);
tux_action(tux, TUX_DOWN);
break;
@@ -267,11 +266,11 @@ static void control_keyboard(tux_t *tux, control_t *control)
switch (control_get_key_action(control))
{
- case CONTROL_SHOT :
+ case CONTROL_SHOT:
netAction(tux, TUX_SHOT);
tux_action(tux, TUX_SHOT);
break;
- case CONTROL_SWITCH :
+ case CONTROL_SWITCH:
netAction(tux, TUX_SWITCH_GUN);
tux_action(tux, TUX_SWITCH_GUN);
break;