summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/control.c31
-rw-r--r--src/client/control.h9
2 files changed, 19 insertions, 21 deletions
diff --git a/src/client/control.c b/src/client/control.c
index 342dba5..737762c 100644
--- a/src/client/control.c
+++ b/src/client/control.c
@@ -5,8 +5,8 @@
#include "main.h"
#include "control.h"
-control_t* control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, SDLKey arg_down,
- SDLKey arg_shot, SDLKey arg_switch)
+control_t* control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left,
+ SDLKey arg_down, SDLKey arg_shot, SDLKey arg_switch)
{
control_t *tmp;
@@ -24,7 +24,7 @@ control_t* control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, SDLKey
int control_get_key_route(control_t *my_control)
{
- Uint8 *mapa;
+ Uint8 *map;
SDLKey ret_key;
int z;
int i;
@@ -33,23 +33,22 @@ int control_get_key_route(control_t *my_control)
ret_key = CONTROL_NONE;
- mapa = SDL_GetKeyState(NULL);
+ map = 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 (map[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++) {
- if ( my_control->count[i] > 0 &&
- my_control->count[i] < z &&
- mapa[my_control->key[i]] == SDL_PRESSED ) {
+ for (i = 0; i < CONTROL_KEY_COUNT_ROUTE; i++) {
+ if (my_control->count[i] > 0 &&
+ my_control->count[i] < z &&
+ map[my_control->key[i]] == SDL_PRESSED) {
z = my_control->count[i];
ret_key = i;
}
@@ -60,20 +59,20 @@ int control_get_key_route(control_t *my_control)
int control_get_key_action(control_t *my_control)
{
- Uint8 *mapa;
+ Uint8 *map;
SDLKey ret_key;
assert(my_control != NULL);
ret_key = CONTROL_NONE;
- mapa = SDL_GetKeyState(NULL);
+ map = SDL_GetKeyState(NULL);
- if (mapa[my_control->key[CONTROL_SHOT]] == SDL_PRESSED) {
+ if (map[my_control->key[CONTROL_SHOT]] == SDL_PRESSED) {
return CONTROL_SHOT;
}
- if (mapa[my_control->key[CONTROL_SWITCH]] == SDL_PRESSED) {
+ if (map[my_control->key[CONTROL_SWITCH]] == SDL_PRESSED) {
return CONTROL_SWITCH;
}
diff --git a/src/client/control.h b/src/client/control.h
index ff479ab..4103f33 100644
--- a/src/client/control.h
+++ b/src/client/control.h
@@ -12,17 +12,16 @@
#define CONTROL_KEY_COUNT_ROUTE 4
#define CONTROL_KEY_COUNT 6
-typedef struct control_struct
-{
+typedef struct control_struct {
SDLKey key[CONTROL_KEY_COUNT];
int count[CONTROL_KEY_COUNT];
} control_t;
extern control_t* control_new(SDLKey arg_up, SDLKey arg_right,
- SDLKey arg_left, SDLKey arg_down,
- SDLKey arg_shot, SDLKey arg_switch);
+ 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);
extern void control_destroy(control_t *my_control);
-#endif
+#endif /* CONTROL_H */