diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/chat.h | 22 | ||||
| -rw-r--r-- | src/client/client.h | 17 | ||||
| -rw-r--r-- | src/client/configFile.h | 19 | ||||
| -rw-r--r-- | src/client/font.h | 30 | ||||
| -rw-r--r-- | src/client/fontConfig.h | 9 | ||||
| -rw-r--r-- | src/client/game.h | 6 | ||||
| -rw-r--r-- | src/client/hotKey.h | 8 | ||||
| -rw-r--r-- | src/client/image.h | 46 | ||||
| -rw-r--r-- | src/client/interface.h | 37 | ||||
| -rw-r--r-- | src/client/keyboardBuffer.h | 28 | ||||
| -rw-r--r-- | src/client/layer.h | 47 | ||||
| -rw-r--r-- | src/client/panel.h | 30 | ||||
| -rw-r--r-- | src/client/pauza.h | 10 | ||||
| -rw-r--r-- | src/client/radar.h | 24 | ||||
| -rw-r--r-- | src/client/saveDialog.h | 17 | ||||
| -rw-r--r-- | src/client/saveLoad.h | 12 | ||||
| -rw-r--r-- | src/client/screen.h | 19 | ||||
| -rw-r--r-- | src/client/term.h | 12 |
18 files changed, 167 insertions, 226 deletions
diff --git a/src/client/chat.h b/src/client/chat.h index a11b286..5427f60 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -1,18 +1,16 @@ - #ifndef CHAT_H +#define CHAT_H -# define CHAT_H - -# define CHAT_MAX_LINES 10 -# define CHAT_TIME_MULTIPLE 10 -# define CHAT_TIME_BLICK_CURSOR 20 -# define CHAT_LINE_WIDTH 320 +#define CHAT_MAX_LINES 10 +#define CHAT_TIME_MULTIPLE 10 +#define CHAT_TIME_BLICK_CURSOR 20 +#define CHAT_LINE_WIDTH 320 -# define CHAT_SIZE_X 320 -# define CHAT_SIZE_Y 240 +#define CHAT_SIZE_X 320 +#define CHAT_SIZE_Y 240 -# define CHAT_LOCATION_X (WINDOW_SIZE_X/2 - CHAT_SIZE_X/2) -# define CHAT_LOCATION_Y (WINDOW_SIZE_Y/2 - CHAT_SIZE_Y/2) +#define CHAT_LOCATION_X (WINDOW_SIZE_X / 2 - CHAT_SIZE_X / 2) +#define CHAT_LOCATION_Y (WINDOW_SIZE_Y / 2 - CHAT_SIZE_Y / 2) extern void chat_init(); extern void chat_draw(); @@ -22,4 +20,4 @@ extern bool_t chat_is_active(); extern bool_t chat_is_recived_new_msg(); extern void chat_quit(); -#endif +#endif /* CHAT_H */ diff --git a/src/client/client.h b/src/client/client.h index 55c95b5..ce41ffb 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -1,19 +1,16 @@ +#ifndef MY_CLIENT_H +#define MY_CLIENT_H -#ifndef MY_CLIENT +#include "main.h" -# define MY_CLIENT +#define CLIENT_TIMEOUT 1000 +#define SERVER_TIMEOUT_ALIVE 5000 -# include "main.h" - - -# define CLIENT_TIMEOUT 1000 -# define SERVER_TIMEOUT_ALIVE 5000 - -# define CLIENT_BUFFER_LIMIT 4096 +#define CLIENT_BUFFER_LIMIT 4096 extern int client_init(char *ip, int port); extern void client_send(char *msg); extern void client_event(); extern void client_quit(); -#endif +#endif /* MY_CLIENT_H */ diff --git a/src/client/configFile.h b/src/client/configFile.h index 67dad48..fc56899 100644 --- a/src/client/configFile.h +++ b/src/client/configFile.h @@ -1,10 +1,8 @@ - #ifndef CONFIGFILE_H +#define CONFIGFILE_H -# define CONFIGFILE_H - -# include "main.h" -# include "textFile.h" +#include "main.h" +#include "textFile.h" extern int isYesOrNO(char *s); extern char *getYesOrNo(int n); @@ -12,11 +10,10 @@ extern char *getYesOrNo(int n); extern int getValue(char *line, char *env, char *val, int len); extern char *setValue(char *line, char *env, char *val); -extern int getValueInConfigFile(textFile_t * textFile, char *env, char *val, - int len); -extern int setValueInConfigFile(textFile_t * textFile, char *env, char *val); +extern int getValueInConfigFile(textFile_t *textFile, char *env, char *val, int len); +extern int setValueInConfigFile(textFile_t *textFile, char *env, char *val); -extern void loadValueFromConfigFile(textFile_t * textFile, char *env, - char *val, int len, char *butVal); +extern void loadValueFromConfigFile(textFile_t *textFile, char *env, char *val, + int len, char *butVal); -#endif +#endif /* CONFIGFILE_H */ diff --git a/src/client/font.h b/src/client/font.h index 17aa76e..8ee2cf0 100644 --- a/src/client/font.h +++ b/src/client/font.h @@ -1,29 +1,27 @@ - #ifndef FONT_H +#define FONT_H -# define FONT_H - -# include <SDL_ttf.h> -# include <assert.h> -# include "main.h" +#include <SDL_ttf.h> +#include <assert.h> +#include "main.h" -# define COLOR_WHITE 255, 255, 255 -# define COLOR_BLACK 0, 0, 0 +#define COLOR_WHITE 255, 255, 255 +#define COLOR_BLACK 0, 0, 0 -# define COLOR_RED 255, 0, 0 -# define COLOR_GREEN 0, 255, 0 -# define COLOR_BLUE 0, 0, 255 +#define COLOR_RED 255, 0, 0 +#define COLOR_GREEN 0, 255, 0 +#define COLOR_BLUE 0, 0, 255 +#define COLOR_YELLOW 255, 255, 0 -# define COLOR_YELLOW 255, 255, 0 -# define FONT_SIZE 16 +#define FONT_SIZE 16 extern bool_t font_is_inicialized(); extern void font_init(); extern void font_draw(char *s, int x, int y, int r, int g, int b); -extern void font_drawMaxSize(char *s, int x, int y, int w, int h, int r, int g, - int b); +extern void font_drawMaxSize(char *s, int x, int y, int w, int h, + int r, int g, int b); extern int font_get_size(); extern void font_text_size(char *s, int *w, int *h); extern void font_quit(); -#endif +#endif /* FONT_H */ diff --git a/src/client/fontConfig.h b/src/client/fontConfig.h index ac2b0b4..09e75a3 100644 --- a/src/client/fontConfig.h +++ b/src/client/fontConfig.h @@ -1,17 +1,14 @@ - #ifndef FONT_CONFIG_H - #define FONT_CONFIG_H -typedef struct font_config_struct -{ +typedef struct font_config_struct { char *path; char *flag; } font_config_t; extern int fontconfig_init(); -extern font_config_t* fontconfig_find(char **arg); +extern font_config_t *fontconfig_find(char **arg); extern void fontconfig_del_list(font_config_t *list); extern int fontconfig_quit(); -#endif +#endif /* FONT_CONFIG_H */ diff --git a/src/client/game.h b/src/client/game.h index 8591fca..e5f2d86 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -1,9 +1,7 @@ - #ifndef GAME_H - -# define GAME_H +#define GAME_H extern void game_quit(); extern void game_start(); -#endif +#endif /* GAME_H */ diff --git a/src/client/hotKey.h b/src/client/hotKey.h index 95b4946..51b027f 100644 --- a/src/client/hotKey.h +++ b/src/client/hotKey.h @@ -1,9 +1,7 @@ - #ifndef HOTKEY_H +#define HOTKEY_H -# define HOTKEY_H - -# define HOTKEY_ACTIVE_INTERVAL 500 +#define HOTKEY_ACTIVE_INTERVAL 500 extern void hot_key_init(); extern void hot_key_register(SDLKey key, void (*handler) ()); @@ -13,4 +11,4 @@ extern void hot_key_disable(SDLKey key); extern void hot_key_event(); extern void hot_key_quit(); -#endif +#endif /* HOTKEY_H */ diff --git a/src/client/image.h b/src/client/image.h index 352654a..9f225c6 100644 --- a/src/client/image.h +++ b/src/client/image.h @@ -1,26 +1,23 @@ - #ifndef IMAGE_H +#define IMAGE_H -# define IMAGE_H - -# include "main.h" -# include "interface.h" +#include "main.h" +#include "interface.h" -# define IMAGE_NO_ALPHA 0 -# define IMAGE_ALPHA 1 +#define IMAGE_NO_ALPHA 0 +#define IMAGE_ALPHA 1 -# define IMAGE_GROUP_BASE "base" -# define IMAGE_GROUP_EXTENDSIO "extension" -# define IMAGE_GROUP_USER "user" -# define IMAGE_GROUP_OTHER "other" +#define IMAGE_GROUP_BASE "base" +#define IMAGE_GROUP_EXTENDSIO "extension" +#define IMAGE_GROUP_USER "user" +#define IMAGE_GROUP_OTHER "other" #ifdef SUPPORT_OPENGL #include <SDL_opengl.h> #endif /* -typedef struct image_struct -{ +typedef struct image_struct { char *name; char *group; SDL_Surface *image; @@ -33,23 +30,20 @@ typedef struct image_struct { int h; SDL_Surface *image; } image_t; -#endif - -#ifdef SUPPORT_OPENGL -typedef struct image_struct -{ - int w; // width of actual picture - int h; // height of actual picture +#else /* SUPPORT_OPENGL */ +typedef struct image_struct { + int w; /* width of actual picture */ + int h; /* height of actual picture */ SDL_Surface *image; - GLuint tw; // width of allocated texture - GLuint th; // height of allocated texture - GLuint tex_id; // texture id + GLuint tw; /* width of allocated texture */ + GLuint th; /* height of allocated texture */ + GLuint tex_id; /* texture id */ } image_t; -#endif +#endif /* SUPPORT_OPENGL */ extern bool_t image_is_inicialized(); extern void image_init(); -extern image_t* image_new(SDL_Surface *surface); +extern image_t *image_new(SDL_Surface *surface); extern void image_destroy(image_t * p); extern image_t *image_add(char *file, int alpha, char *name, char *group); extern image_t *image_get(char *group, char *name); @@ -58,4 +52,4 @@ extern void image_del_all_image_in_group(char *group); extern void image_draw(image_t * p, int x, int y, int px, int py, int w, int h); extern void image_quit(); -#endif +#endif /* IMAGE_H */ diff --git a/src/client/interface.h b/src/client/interface.h index 304e29c..2fd23e9 100644 --- a/src/client/interface.h +++ b/src/client/interface.h @@ -1,16 +1,15 @@ - #ifndef INTERFACE_H +#define INTERFACE_H -# define INTERFACE_H +#include <stdio.h> +#include <string.h> +#include <time.h> -# include <stdio.h> -# include <string.h> -# include <time.h> +#include <SDL.h> +#include <SDL_image.h> +#include <SDL_thread.h> -# include <SDL.h> -# include <SDL_image.h> -# include <SDL_thread.h> -# include "main.h" +#include "main.h" #ifdef SUPPORT_OPENGL #include <SDL_opengl.h> @@ -20,18 +19,18 @@ #include <SDL_net.h> */ -# define SDL_SUBSYSTEMS SDL_INIT_VIDEO|SDL_INIT_TIMER +#define SDL_SUBSYSTEMS SDL_INIT_VIDEO|SDL_INIT_TIMER -// windows title -# define WINDOW_TITLE "Tuxánci " TUXANCI_VERSION -# define WIN_BPP 0 -# define USR_EVT_TIMER 0 +/* the window title */ +#define WINDOW_TITLE "Tuxánci " TUXANCI_VERSION +#define WIN_BPP 0 +#define USR_EVT_TIMER 0 -// interval (in ms) of triggering akcia(); -# define INTERVAL 50 +/* timing of the timer [in ms] */ +#define INTERVAL 50 -// velikost klavesoveho bufferu (ve znacich) -# define KEYBOARD_BUFFER_SIZE 256 +/* size of the keyboard buffer (in characters) */ +#define KEYBOARD_BUFFER_SIZE 256 extern bool_t interface_is_inicialized(); extern bool_t interface_is_use_open_gl(); @@ -46,4 +45,4 @@ extern void interface_refresh(); extern void interface_event(); extern void interface_quit(); -#endif +#endif /* INTERFACE_H */ diff --git a/src/client/keyboardBuffer.h b/src/client/keyboardBuffer.h index 1810223..e3596ef 100644 --- a/src/client/keyboardBuffer.h +++ b/src/client/keyboardBuffer.h @@ -1,25 +1,15 @@ -/* - * keyboardBuffer.h - * - * Created on: 1.8.2008 - * Author: Karel Podvolecky - * - * Jednoducha fronta stisknutych klaves. - */ - #ifndef KEYBOARD_BUFFER_H +#define KEYBOARD_BUFFER_H -# define KEYBOARD_BUFFER_H - -# include <SDL.h> -# include "main.h" +#include <SDL.h> +#include "main.h" typedef struct { - SDL_keysym *buff; /* buffer klaves (kod dle SDLKey enumu) */ - int size; /* aktualni velikost alokovaneho bufferu (v poctu uchovatelnych klaves) */ - int count; /* pocet klaves aktualne v bufferu */ - int begin; /* ukazatel na zacatek bufferu (tj. kam se pridavaji klavesy) */ - int end; /* ukazatel na konec bufferu (tj. odkud se odebiraji klavesy) */ + SDL_keysym *buff; /* buffer of keys (code according to the SDLKey enum) */ + int size; /* up-to-date size of allocated buffer (size == number of saveable keys) */ + int count; /* up-to-date number of keys saved in the buffer */ + int begin; /* pointer to the beginning of the buffer (i.e. where to add new keys to) */ + int end; /* pointer to the end of the buffer (i.e. where to remove old keys from) */ } keyboardBuffer_t; extern void keyboard_buffer_init(int size); @@ -31,4 +21,4 @@ extern int keyboard_buffer_get_count(); extern bool_t keyboard_buffer_is_any_key(); extern void keyboard_buffer_quit(); -#endif /* KEYBOARDBUFFER_H_ */ +#endif /* KEYBOARD_BUFFER_H */ diff --git a/src/client/layer.h b/src/client/layer.h index 66a0580..3642a0a 100644 --- a/src/client/layer.h +++ b/src/client/layer.h @@ -1,53 +1,42 @@ - #ifndef MY_LAYER_H +#define MY_LAYER_H -# define MY_LAYER_H - -# include "main.h" -# include "image.h" +#include "main.h" +#include "image.h" typedef struct layer_str { - int x; //suradnice obrazka na obrazovke + /* coordinates of the image */ + int x; int y; - int w; //rozmery obrazka na obrazovke + /* size of the image */ + int w; int h; - int px; //suradnice casti surfrace + /* coordinates of a part of the surface */ + int px; int py; - int pw; //rozmeri casti surfrace + /* size of a part of the surface */ + int pw; int ph; + /* in which layer to lay it */ int layer; - image_t *image; //dane surfrace + /* image of the surface */ + image_t *image; } layer_t; extern bool_t layer_is_inicialized(); extern void layer_init(); -/* - * Add image to queue for rendering - * *img - image to be rendered - * x,y - coordinates where to draw the image - * w,h - width and height of rendered part of image - * px,py - coordinates of upper left corner of rendered part of image - * layer - on which layer to draw - * (0 - under tuxanci | 1 - same as tuxanci | 2 - over tuxancami) - */ - -extern void addLayer(image_t * img, - int x, int y, int px, int py, int w, int h, int player); - -/* - * Draws queue on the screen - */ +extern void addLayer(image_t *img, int x, int y, int px, int py, int w, int h, int player); + extern void layer_draw_all(); extern void layer_draw_center(int x, int y); -extern void layer_draw_slpit(int local_x, int local_y, int x, int y, int w, - int h); +extern void layer_draw_slpit(int local_x, int local_y, int x, int y, int w, int h); extern void layer_flush(); extern void layer_quit(); -#endif +#endif /* MY_LAYER_H */ diff --git a/src/client/panel.h b/src/client/panel.h index 94a55e0..8ae92b3 100644 --- a/src/client/panel.h +++ b/src/client/panel.h @@ -1,27 +1,25 @@ - #ifndef PANEL_H +#define PANEL_H -# define PANEL_H - -# include "main.h" -# include "list.h" +#include "main.h" +#include "list.h" -# define PANEL_SCORE_LOCATION_X ( WINDOW_SIZE_X / 2 - w / 2 ) -# define PANEL_SCORE_LOCATION_Y ( WINDOW_SIZE_Y - 40 ) +#define PANEL_SCORE_LOCATION_X (WINDOW_SIZE_X / 2 - w / 2) +#define PANEL_SCORE_LOCATION_Y (WINDOW_SIZE_Y - 40) -# define PANEL_SHOT_WIDTH 4 -# define PANEL_SHOT_HEIGHT 8 +#define PANEL_SHOT_WIDTH 4 +#define PANEL_SHOT_HEIGHT 8 -# define PANEL_LOCATION_X 0 -# define PANEL_LOCATION_Y (WINDOW_SIZE_Y-g_panel->h) +#define PANEL_LOCATION_X 0 +#define PANEL_LOCATION_Y (WINDOW_SIZE_Y - g_panel->h) -# define PANEL_SHOT_FILL 0 -# define PANEL_SHOT_EMPTY 1 -# define PANEL_SHOT_LINE 2 +#define PANEL_SHOT_FILL 0 +#define PANEL_SHOT_EMPTY 1 +#define PANEL_SHOT_LINE 2 extern bool_t panel_is_inicialized(); extern void panel_init(); -extern void panel_draw(tux_t * tux_right, tux_t * tux_left); +extern void panel_draw(tux_t *tux_right, tux_t *tux_left); extern void panel_quit(); -#endif +#endif /* PANEL_H */ diff --git a/src/client/pauza.h b/src/client/pauza.h index 2743af4..a432d5f 100644 --- a/src/client/pauza.h +++ b/src/client/pauza.h @@ -1,11 +1,9 @@ - #ifndef PAUZA_H +#define PAUZA_H -# define PAUZA_H - -# define PAUZE_ACTIVE_TIME_INTERVAL 1000 +#include "main.h" -# include "main.h" +#define PAUZE_ACTIVE_TIME_INTERVAL 1000 extern void pauza_init(); extern void pauza_draw(); @@ -13,4 +11,4 @@ extern void pauza_event(); extern bool_t pauza_is_active(); extern void pauza_quit(); -#endif +#endif /* PAUZA_H */ diff --git a/src/client/radar.h b/src/client/radar.h index 9f43968..8bc2a01 100644 --- a/src/client/radar.h +++ b/src/client/radar.h @@ -1,24 +1,22 @@ - #ifndef RADAR_H +#define RADAR_H -# define RADAR_H - -# include "arena.h" +#include "arena.h" -# define RADAR_LOCATION_X (WINDOW_SIZE_X-110) -# define RADAR_LOCATION_Y (10) +#define RADAR_LOCATION_X (WINDOW_SIZE_X - 110) +#define RADAR_LOCATION_Y 10 -# define RADAR_SIZE_X 100 -# define RADAR_SIZE_Y 100 +#define RADAR_SIZE_X 100 +#define RADAR_SIZE_Y 100 -# define RADAR_TYPE_YOU 3 -# define RADAR_TYPE_TUX 1 -# define RADAR_TYPE_ITEM 2 +#define RADAR_TYPE_YOU 3 +#define RADAR_TYPE_TUX 1 +#define RADAR_TYPE_ITEM 2 extern void radar_init(); extern void radar_add(int id, int x, int y, int type); extern void radar_del(int id); -extern void radar_draw(arena_t * arena); +extern void radar_draw(arena_t *arena); extern void radar_quit(); -#endif +#endif /* RADAR_H */ diff --git a/src/client/saveDialog.h b/src/client/saveDialog.h index 4f9ed0e..f5fb91f 100644 --- a/src/client/saveDialog.h +++ b/src/client/saveDialog.h @@ -1,16 +1,13 @@ - #ifndef SAVE_DIALOG_H +#define SAVE_DIALOG_H -# define SAVE_DIALOG_H - -# define SAVEDIALOG_ACTIVE_TIME_INTERVAL 500 - -# define SAVE_DIALOG_SIZE_X 320 -# define SAVE_DIALOG_SIZE_Y 120 +#define SAVEDIALOG_ACTIVE_TIME_INTERVAL 500 -# define SAVE_DIALOG_LOCATIN_X (WINDOW_SIZE_X/2 - SAVE_DIALOG_SIZE_X/2) -# define SAVE_DIALOG_LOCATIN_Y (WINDOW_SIZE_Y/2 - SAVE_DIALOG_SIZE_Y/2) +#define SAVE_DIALOG_SIZE_X 320 +#define SAVE_DIALOG_SIZE_Y 120 +#define SAVE_DIALOG_LOCATIN_X (WINDOW_SIZE_X / 2 - SAVE_DIALOG_SIZE_X / 2) +#define SAVE_DIALOG_LOCATIN_Y (WINDOW_SIZE_Y / 2 - SAVE_DIALOG_SIZE_Y / 2) extern void save_dialog_init(); extern bool_t save_dialog_is_active(); @@ -18,4 +15,4 @@ extern void save_dialog_draw(); extern void save_dialog_event(); extern void save_dialog_quit(); -#endif +#endif /* SAVE_DIALOG_H */ diff --git a/src/client/saveLoad.h b/src/client/saveLoad.h index f405f6b..eaf27e2 100644 --- a/src/client/saveLoad.h +++ b/src/client/saveLoad.h @@ -1,12 +1,10 @@ - #ifndef SAVELOAD_H +#define SAVELOAD_H -# define SAVELOAD_H - -# include "textFile.h" -# include "arena.h" +#include "textFile.h" +#include "arena.h" -extern void save_arena(char *filename, arena_t * arena); +extern void save_arena(char *filename, arena_t *arena); extern void load_arena(char *filename); -#endif +#endif /* SAVELOAD_H */ diff --git a/src/client/screen.h b/src/client/screen.h index 227696f..718fb57 100644 --- a/src/client/screen.h +++ b/src/client/screen.h @@ -1,9 +1,7 @@ - #ifndef SCREEN_H +#define SCREEN_H -# define SCREEN_H - -# include "main.h" +#include "main.h" typedef struct screen_struct { char *name; @@ -15,12 +13,13 @@ typedef struct screen_struct { extern bool_t screen_is_inicialized(); -extern screen_t *screen_new(char *name, - void (*fce_start) (), void (*fce_event) (), - void (*fce_draw) (), void (*fce_stop) ()); +extern screen_t *screen_new(char *name, void (*fce_start) (), + void (*fce_event) (), + void (*fce_draw) (), + void (*fce_stop) ()); -extern void screen_destroy(screen_t * p); -extern void screen_register(screen_t * p); +extern void screen_destroy(screen_t *p); +extern void screen_register(screen_t *p); extern void screen_init(); extern void screen_set(char *name); extern void screen_switch(); @@ -30,4 +29,4 @@ extern void screen_draw(); extern void screen_event(); extern void screen_quit(); -#endif +#endif /* SCREEN_H */ diff --git a/src/client/term.h b/src/client/term.h index 445edbd..719df2d 100644 --- a/src/client/term.h +++ b/src/client/term.h @@ -1,16 +1,14 @@ - #ifndef TERM_H +#define TERM_H -# define TERM_H - -# include "main.h" +#include "main.h" -# define TERM_ACTIVE_TIME_INTERVAL 500 -# define TERM_REFRESH_TIME_INTERVAL 1000 +#define TERM_ACTIVE_TIME_INTERVAL 500 +#define TERM_REFRESH_TIME_INTERVAL 1000 extern void term_init(); extern void term_draw(); extern void term_event(); extern void term_quit(); -#endif +#endif /* TERM_H */ |