diff options
Diffstat (limited to 'src/client')
33 files changed, 517 insertions, 517 deletions
diff --git a/src/client/chat.c b/src/client/chat.c index b446b08..e071b17 100644 --- a/src/client/chat.c +++ b/src/client/chat.c @@ -33,13 +33,13 @@ static bool_t receivedNewMsg; static void hotkey_chat_enter(); static void hotkey_chat_enter(); -static void eventChatDisable(); +static void chat_eventDisable(); static void hotkey_chat_esc() { //printf("*** hotkey_chat_esc\n"); - //unregisterHotKey(SDLK_ESCAPE); - eventChatDisable(); + //unhotKey_register(SDLK_ESCAPE); + chat_eventDisable(); } static void hotkey_chat_enter() @@ -52,23 +52,23 @@ static void hotkey_chat_enter() chat_active = TRUE; receivedNewMsg = FALSE; - disableHotKey(SDLK_RETURN); - disableHotKey(SDLK_p); - registerHotKey(SDLK_ESCAPE, hotkey_chat_esc); + hotKey_disable(SDLK_RETURN); + hotKey_disable(SDLK_p); + hotKey_register(SDLK_ESCAPE, hotkey_chat_esc); - enableKeyboardBuffer(); - clearKeyboardBuffer(); + interface_enable_keyboard_buffer(); + keyboardBuffer_clear(); } -void initChat() +void chat_init() { - g_chat = addImageData("chat.png", IMAGE_NO_ALPHA, "chat", IMAGE_GROUP_USER); + g_chat = image_add("chat.png", IMAGE_NO_ALPHA, "chat", IMAGE_GROUP_USER); - listText = newList(); + listText = list_new(); strcpy(line, ""); chat_active = FALSE; - registerHotKey(SDLK_RETURN, hotkey_chat_enter); + hotKey_register(SDLK_RETURN, hotkey_chat_enter); receivedNewMsg = FALSE; line_time = 0; @@ -76,7 +76,7 @@ void initChat() timeBlick = 0; } -void drawChat() +void chat_draw() { char str[STR_SIZE]; int i; @@ -85,7 +85,7 @@ void drawChat() return; } - drawImage(g_chat, CHAT_LOCATION_X, CHAT_LOCATION_Y, + image_draw(g_chat, CHAT_LOCATION_X, CHAT_LOCATION_Y, 0, 0, CHAT_SIZE_X, CHAT_SIZE_Y); for (i = 0; i < listText->count; i++) { @@ -93,7 +93,7 @@ void drawChat() s = (char *) listText->list[i]; - drawFontMaxSize(s, CHAT_LOCATION_X + 5, CHAT_LOCATION_Y + 5 + i * 20, + font_drawMaxSize(s, CHAT_LOCATION_X + 5, CHAT_LOCATION_Y + 5 + i * 20, CHAT_SIZE_X - 10, 20, COLOR_WHITE); } @@ -109,7 +109,7 @@ void drawChat() timeBlick = 0; } - drawFont(str, CHAT_LOCATION_X + 5, (CHAT_LOCATION_Y + 5) + (CHAT_MAX_LINES * 20), COLOR_WHITE); + font_draw(str, CHAT_LOCATION_X + 5, (CHAT_LOCATION_Y + 5) + (CHAT_MAX_LINES * 20), COLOR_WHITE); } static void processMessageKey(SDL_keysym keysym) @@ -122,7 +122,7 @@ static void processMessageKey(SDL_keysym keysym) line_atime++; len = strlen(line); - getTextSize(line, &w, &h); + font_text_size(line, &w, &h); if (w > CHAT_SIZE_X - 40) { return; @@ -160,42 +160,42 @@ static void processMessageKey(SDL_keysym keysym) static void sendNewMessage() { - if (getNetTypeGame() == NET_GAME_TYPE_CLIENT) { + if (netMultiplayer_get_game_type() == NET_GAME_TYPE_CLIENT) { proto_send_chat_client(line); } - if (getNetTypeGame() == NET_GAME_TYPE_SERVER) { + if (netMultiplayer_get_game_type() == NET_GAME_TYPE_SERVER) { char out[STR_PROTO_SIZE]; snprintf(out, STR_PROTO_SIZE, "chat %s:%s\n", - getControlTux(TUX_CONTROL_KEYBOARD_RIGHT)->name, line); + word_get_control_tux(TUX_CONTROL_KEYBOARD_RIGHT)->name, line); proto_send_chat_server(PROTO_SEND_ALL, NULL, out); } } -static void eventChatDisable() +static void chat_eventDisable() { chat_active = FALSE; memset(line, '\0', STR_SIZE); - enableHotKey(SDLK_RETURN); - enableHotKey(SDLK_p); - unregisterHotKey(SDLK_ESCAPE); + hotKey_enable(SDLK_RETURN); + hotKey_enable(SDLK_p); + unhotKey_register(SDLK_ESCAPE); - disableKeyboardBuffer(); - clearKeyboardBuffer(); + interface_disable_keyboard_buffer(); + keyboardBuffer_clear(); } -static void eventChatEnable() +static void chat_eventEnable() { /* The chat window is displayed. It is needed to process all keys in the buffer * but when ENTER is pressed the chat row is sent to the server */ - while (isAnyKeyInKeyboardBuffer() == TRUE) { + while (keyboardBuffer_is_any_key() == TRUE) { SDL_keysym key; - key = popKeyFromKeyboardBuffer(); + key = keyboardBuffer_pop(); if (key.sym == SDLK_RETURN) { if (strcmp(line, "") != 0) { @@ -205,10 +205,10 @@ static void eventChatEnable() continue; /* continue with other keys */ } else { /* the chat row is empty - it is needed to turn off the chat window */ - //eventChatDisable(); + //chat_eventDisable(); /* turn off key catching into the buffer and clear the buffer */ - //disableKeyboardBuffer(); - //clearKeyboardBuffer(); + //interface_disable_keyboard_buffer(); + //keyboardBuffer_clear(); } } @@ -219,29 +219,29 @@ static void eventChatEnable() /** * Processing of chat 'events' */ -void eventChat() +void chat_event() { - if (isChatActive()) { - eventChatEnable(); + if (chat_is_active()) { + chat_eventEnable(); } } -bool_t isChatActive() +bool_t chat_is_active() { return chat_active; } -bool_t isRecivedNewMsg() +bool_t chat_is_recived_new_msg() { return receivedNewMsg; } -void addToChat(char *s) +void chat_add(char *s) { - addList(listText, strdup(s)); + list_add(listText, strdup(s)); if (listText->count > CHAT_MAX_LINES) { - delListItem(listText, 0, free); + list_del_item(listText, 0, free); } if (chat_active == FALSE) { @@ -249,10 +249,10 @@ void addToChat(char *s) } } -void quitChat() +void chat_quit() { assert(listText != NULL); - //unregisterHotKey(SDLK_RETURN); - destroyListItem(listText, free); + //unhotKey_register(SDLK_RETURN); + list_destroy_item(listText, free); } diff --git a/src/client/chat.h b/src/client/chat.h index 9022466..a11b286 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -14,12 +14,12 @@ # 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 initChat(); -extern void drawChat(); -extern void eventChat(); -extern void addToChat(char *s); -extern bool_t isChatActive(); -extern bool_t isRecivedNewMsg(); -extern void quitChat(); +extern void chat_init(); +extern void chat_draw(); +extern void chat_event(); +extern void chat_add(char *s); +extern bool_t chat_is_active(); +extern bool_t chat_is_recived_new_msg(); +extern void chat_quit(); #endif diff --git a/src/client/client.c b/src/client/client.c index 5aa995b..3663264 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -90,7 +90,7 @@ static proto_cmd_client_t *findCmdProto(char *msg) static int initUdpClient(char *ip, int port) { - sock_server_udp = connectUdpSocket(ip, port); + sock_server_udp = sock_udp_connect(ip, port); if (sock_server_udp == NULL) { return -1; @@ -101,23 +101,23 @@ static int initUdpClient(char *ip, int port) return 0; } -int initClient(char *ip, int port) +int client_init(char *ip, int port) { char name[STR_NAME_SIZE]; int ret; - listRecvMsg = newList(); - lastPing = getMyTime(); - lastPingServerAlive = getMyTime(); + listRecvMsg = list_new(); + lastPing = timer_get_current_time(); + lastPingServerAlive = timer_get_current_time(); #ifdef SUPPORT_TRAFFIC - lastTraffic = getMyTime(); + lastTraffic = timer_get_current_time(); traffic_down = 0; traffic_up = 0; #endif - clientRecvBuffer = newBuffer(CLIENT_BUFFER_LIMIT); - clientSendBuffer = newBuffer(CLIENT_BUFFER_LIMIT); + clientRecvBuffer = buffer_new(CLIENT_BUFFER_LIMIT); + clientSendBuffer = buffer_new(CLIENT_BUFFER_LIMIT); ret = initUdpClient(ip, port); @@ -125,7 +125,7 @@ int initClient(char *ip, int port) return -1; } - getSettingNameRight(name); + publicServer_get_settingNameRight(name); proto_send_hello_client(name); return 0; @@ -134,11 +134,11 @@ int initClient(char *ip, int port) static void errorWithServer() { fprintf(stderr, _("Server did not respond!\n")); - setMsgToAnalyze(_("Server is not running or being blocked. I was unable to connect.")); - setWorldEnd(); + analyze_set_msg(_("Server is not running or being blocked. I was unable to connect.")); + word_do_end(); } -void sendServer(char *msg) +void client_send(char *msg) { int ret; @@ -157,7 +157,7 @@ void sendServer(char *msg) #endif if (sock_server_udp != NULL) { - ret = writeUdpSocket(sock_server_udp, sock_server_udp, msg, strlen(msg)); + ret = sock_udp_write(sock_server_udp, sock_server_udp, msg, strlen(msg)); } if (ret < 0) { @@ -166,7 +166,7 @@ void sendServer(char *msg) } } -static int eventServerSelect() +static int server_eventSelect() { char buffer[STR_PROTO_SIZE]; int ret; @@ -175,7 +175,7 @@ static int eventServerSelect() ret = -1; if (sock_server_udp != NULL) { - ret = readUdpSocket(sock_server_udp, sock_server_udp, buffer, STR_PROTO_SIZE - 1); + ret = sock_udp_read(sock_server_udp, sock_server_udp, buffer, STR_PROTO_SIZE - 1); } if (ret < 0) { @@ -187,17 +187,17 @@ static int eventServerSelect() traffic_down += ret; #endif - addList(listRecvMsg, strdup(buffer)); + list_add(listRecvMsg, strdup(buffer)); #if 0 - if (addBuffer(clientRecvBuffer, buffer, ret) < 0) { + if (buffer_append(clientRecvBuffer, buffer, ret) < 0) { errorWithServer(); return ret; } - while (getBufferLine(clientRecvBuffer, buffer, STR_PROTO_SIZE) >= 0) { + while (buffer_get_line(clientRecvBuffer, buffer, STR_PROTO_SIZE) >= 0) { if (strlen(buffer) > 0) { - addList(listRecvMsg, strdup(buffer)); + list_add(listRecvMsg, strdup(buffer)); } } #endif @@ -205,7 +205,7 @@ static int eventServerSelect() return ret; } -static void eventClientWorkRecvList() +static void client_eventWorkRecvList() { proto_cmd_client_t *protoCmd; char *line; @@ -226,23 +226,23 @@ static void eventClientWorkRecvList() #endif if (protoCmd != NULL) { protoCmd->fce_proto(line); - lastPingServerAlive = getMyTime(); + lastPingServerAlive = timer_get_current_time(); } } - destroyListItem(listRecvMsg, free); - listRecvMsg = newList(); + list_destroy_item(listRecvMsg, free); + listRecvMsg = list_new(); } static void eventPingServer() { my_time_t currentTime; - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if (currentTime - lastPing > CLIENT_TIMEOUT) { proto_send_ping_client(); - lastPing = getMyTime(); + lastPing = timer_get_current_time(); } } @@ -250,7 +250,7 @@ static bool_t isServerAlive() { my_time_t currentTime; - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if (currentTime - lastPingServerAlive > SERVER_TIMEOUT_ALIVE) { return FALSE; @@ -294,7 +294,7 @@ static void selectClientSocket() select(max_fd + 1, &readfds, (fd_set *) NULL, (fd_set *) NULL, &tv); if (FD_ISSET(sock, &readfds)) { - if (eventServerSelect() > 0) { + if (server_eventSelect() > 0) { isNext = TRUE; } } @@ -308,7 +308,7 @@ static void eventTraffic() { my_time_t currentTime; - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if (currentTime - lastTraffic > 5000) { lastTraffic = currentTime; @@ -322,7 +322,7 @@ static void eventTraffic() #endif -void eventClient() +void client_event() { #ifdef SUPPORT_TRAFFIC eventTraffic(); @@ -330,27 +330,27 @@ void eventClient() eventPingServer(); selectClientSocket(); - eventClientWorkRecvList(); + client_eventWorkRecvList(); } static void quitUdpClient() { assert(sock_server_udp != NULL); - closeUdpSocket(sock_server_udp); + sock_udp_close(sock_server_udp); DEBUG_MSG(_("Closing UDP connection.\n")); } -void quitClient() +void client_quit() { proto_send_end_client(); assert(listRecvMsg != NULL); - destroyListItem(listRecvMsg, free); - destroyBuffer(clientRecvBuffer); - destroyBuffer(clientSendBuffer); + list_destroy_item(listRecvMsg, free); + buffer_destroy(clientRecvBuffer); + buffer_destroy(clientSendBuffer); if (sock_server_udp != NULL) { quitUdpClient(); diff --git a/src/client/client.h b/src/client/client.h index 8ff0d3d..55c95b5 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -11,9 +11,9 @@ # define CLIENT_BUFFER_LIMIT 4096 -extern int initClient(char *ip, int port); -extern void sendServer(char *msg); -extern void eventClient(); -extern void quitClient(); +extern int client_init(char *ip, int port); +extern void client_send(char *msg); +extern void client_event(); +extern void client_quit(); #endif diff --git a/src/client/configFile.c b/src/client/configFile.c index 74509fe..162658b 100644 --- a/src/client/configFile.c +++ b/src/client/configFile.c @@ -120,8 +120,8 @@ int setValueInConfigFile(textFile_t * textFile, char *env, char *val) ret = setValue(line, env, val); if (ret != NULL) { - delListItem(textFile->text, i, free); - insList(textFile->text, i, ret); + list_del_item(textFile->text, i, free); + list_ins(textFile->text, i, ret); return 0; } @@ -139,7 +139,7 @@ void loadValueFromConfigFile(textFile_t * textFile, char *env, char *val, int le char line[STR_SIZE]; sprintf(line, "%s=\"%s\"", env, butVal); - addList(textFile->text, strdup(line)); + list_add(textFile->text, strdup(line)); DEBUG_MSG(_("ADDING: \"%s\" into config file.\n"), line); } diff --git a/src/client/font.c b/src/client/font.c index c701e3f..731e86d 100644 --- a/src/client/font.c +++ b/src/client/font.c @@ -10,19 +10,19 @@ static int fontSize; static bool_t isFontInit = FALSE; -bool_t isFontInicialized() +bool_t font_is_inicialized() { return isFontInit; } -void initFont() +void font_init() { char *arg[] = {":lang=he:outline=true:style=Book", "family", "style", "weight", "file", NULL}; char *font_file; font_config_t *font_list; int res; - assert(isInterfaceInicialized() == TRUE); + assert(interface_is_inicialized() == TRUE); res = fontconfig_init(); @@ -69,7 +69,7 @@ void initFont() /* * Zobrazi text *string na suradnicu x y s farbou RGB */ -void drawFont(char *string, int x, int y, int r, int g, int b) +void font_draw(char *string, int x, int y, int r, int g, int b) { SDL_Surface *text; image_t *image; @@ -83,13 +83,13 @@ void drawFont(char *string, int x, int y, int r, int g, int b) // because if string=="" TTF_RenderUTF8_Blended returns NULL if( text != NULL ){ - image = newImage(text); - drawImage(image, x, y, 0, 0, image->w, image->h); - destroyImage(image); + image = image_new(text); + image_draw(image, x, y, 0, 0, image->w, image->h); + image_destroy(image); }; } -void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b) +void font_drawMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b) { SDL_Rect src_rect, dst_rect; SDL_Surface *text; @@ -121,22 +121,22 @@ void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b) dst_rect.x = x; dst_rect.y = y; - i = newImage(text); + i = image_new(text); //posibly broken - drawImage(i, x, y, 0, 0, my_w, my_h); - destroyImage(i); + image_draw(i, x, y, 0, 0, my_w, my_h); + image_destroy(i); } /* * Vrati velkost daneho fontu. */ -int getFontSize() +int font_get_size() { return fontSize; } -void getTextSize(char *s, int *w, int *h) +void font_text_size(char *s, int *w, int *h) { assert(s != NULL); assert(w != NULL); @@ -148,7 +148,7 @@ void getTextSize(char *s, int *w, int *h) /* * Uvolni font z pamete. */ -void quitFont() +void font_quit() { TTF_CloseFont(g_font); TTF_Quit(); diff --git a/src/client/font.h b/src/client/font.h index 6f30a71..17aa76e 100644 --- a/src/client/font.h +++ b/src/client/font.h @@ -17,13 +17,13 @@ # define COLOR_YELLOW 255, 255, 0 # define FONT_SIZE 16 -extern bool_t isFontInicialized(); -extern void initFont(); -extern void drawFont(char *s, int x, int y, int r, int g, int b); -extern void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, +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 int getFontSize(); -extern void getTextSize(char *s, int *w, int *h); -extern void quitFont(); +extern int font_get_size(); +extern void font_text_size(char *s, int *w, int *h); +extern void font_quit(); #endif diff --git a/src/client/game.c b/src/client/game.c index 310c45a..310f1cb 100644 --- a/src/client/game.c +++ b/src/client/game.c @@ -44,66 +44,66 @@ static void initGame() { - createHomeDirector(); + homeDirector_create(); - initSDL(); - initFont(); - initLayer(); - initImageData(); + interface_init(); + font_init(); + layer_init(); + image_init(); #ifndef NO_SOUND - initAudio(); - initSound(); - initMusic(); + audio_init(); + sound_init(); + music_init(); #endif - initScreen(); - initArenaFile(); - initTux(); - initItem(); - initShot(); - initPanel(); - initWorld(); - - initScreenMainMenu(); - initScreenAnalyze(); - initScreenChoiceArena(); - initScreenSetting(); - initScreenSettingKeys(); - initScreenGameType(); - initScreenDownArena(); - initScreenCredits(); - initScreenTable(); - initScreenBrowser(); + screen_init(); + arenaFile_init(); + tux_init(); + item_init(); + shot_init(); + panel_init(); + word_init(); + + mainMenu_init(); + analyze_init(); + choiceArena_init(); + setting_init(); + settingKey_int(); + gameType_init(); + downArena_init(); + scredits_init(); + table_init(); + browser_init(); } -void quitGame() +void game_quit() { - quitSDL(); - - quitScreenMainMenu(); - quitScreenAnalyze(); - quitScreenSetting(); - quitScreenSettingKeys(); - quitScreenGameType(); - quitScreenDownArena(); - quitScreenChoiceArena(); - quitScreenCredits(); - quitScreenTable(); - quitScreenBrowser(); - - quitLayer(); - quitFont(); - quitScreen(); - quitArenaFile(); - quitItem(); - quitTux(); - quitShot(); - quitPanel(); - quitWorld(); - quitImageData(); + interface_quit(); + + mainMenu_quit(); + analyze_quit(); + setting_quit(); + settingKey_quit(); + gameType_quit(); + downArena_quit(); + choiceArena_quit(); + scredits_quit(); + table_quit(); + browser_quit(); + + layer_quit(); + font_quit(); + screen_quit(); + arenaFile_quit(); + item_quiy(); + tux_quit(); + shot_quit(); + panel_quit(); + word_quit(); + image_quit(); #ifndef NO_SOUND - quitSound(); - quitMusic(); - quitAudio(); + sound_quit(); + music_quit(); + audio_quit(); #endif DEBUG_MSG(_("Quitting TUXANCI...\n")); @@ -111,12 +111,12 @@ void quitGame() exit(0); } -void startGame() +void game_start() { initGame(); - startScreen("mainMenu"); + screen_start("mainMenu"); - eventSDL(); - quitGame(); + interface_event(); + game_quit(); } diff --git a/src/client/game.h b/src/client/game.h index 981e975..8591fca 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -3,7 +3,7 @@ # define GAME_H -extern void quitGame(); -extern void startGame(); +extern void game_quit(); +extern void game_start(); #endif diff --git a/src/client/hotKey.c b/src/client/hotKey.c index 228e50d..bf8cc96 100644 --- a/src/client/hotKey.c +++ b/src/client/hotKey.c @@ -53,13 +53,13 @@ static hotKey_t *findHotkey(SDLKey key) return NULL; } -void initHotKey() +void hotKey_init() { - listHotKey = newList(); - lastActive = getMyTime(); + listHotKey = list_new(); + lastActive = timer_get_current_time(); } -void registerHotKey(SDLKey key, void (*handler) ()) +void hotKey_register(SDLKey key, void (*handler) ()) { hotKey_t *hotkey; /* @@ -68,10 +68,10 @@ void registerHotKey(SDLKey key, void (*handler) ()) } */ hotkey = newHotKey(key, handler); - insList(listHotKey, 0, hotkey); + list_ins(listHotKey, 0, hotkey); } -void unregisterHotKey(SDLKey key) +void unhotKey_register(SDLKey key) { hotKey_t *hotkey; int my_index; @@ -82,12 +82,12 @@ void unregisterHotKey(SDLKey key) assert(!"This hotkey not register"); } - my_index = searchListItem(listHotKey, hotkey); + my_index = list_search(listHotKey, hotkey); assert(my_index != -1); - delListItem(listHotKey, my_index, destroyHotKey); + list_del_item(listHotKey, my_index, destroyHotKey); } -void enableHotKey(SDLKey key) +void hotKey_enable(SDLKey key) { hotKey_t *hotkey; @@ -97,11 +97,11 @@ void enableHotKey(SDLKey key) assert(!"This hotkey not register"); } - lastActive = getMyTime(); + lastActive = timer_get_current_time(); hotkey->active = TRUE; } -void disableHotKey(SDLKey key) +void hotKey_disable(SDLKey key) { hotKey_t *hotkey; @@ -111,17 +111,17 @@ void disableHotKey(SDLKey key) assert(!"This hotkey not register"); } - lastActive = getMyTime(); + lastActive = timer_get_current_time(); hotkey->active = FALSE; } -void eventHotKey() +void hotKey_event() { my_time_t currentTime; Uint8 *mapa; int i; - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if (currentTime - lastActive < HOTKEY_ACTIVE_INTERVAL) { return; @@ -135,7 +135,7 @@ void eventHotKey() this = (hotKey_t *) listHotKey->list[i]; if (mapa[this->key] == SDL_PRESSED && this->active == TRUE) { - lastActive = getMyTime(); + lastActive = timer_get_current_time(); //printf("hotKey = %d\n", this->key); this->handler(); @@ -144,7 +144,7 @@ void eventHotKey() } } -void quitHotKey() +void hotKey_quit() { - destroyListItem(listHotKey, destroyHotKey); + list_destroy_item(listHotKey, destroyHotKey); } diff --git a/src/client/hotKey.h b/src/client/hotKey.h index 1cdf647..33b1491 100644 --- a/src/client/hotKey.h +++ b/src/client/hotKey.h @@ -5,12 +5,12 @@ # define HOTKEY_ACTIVE_INTERVAL 500 -extern void initHotKey(); -extern void registerHotKey(SDLKey key, void (*handler) ()); -extern void unregisterHotKey(SDLKey key); -extern void enableHotKey(SDLKey key); -extern void disableHotKey(SDLKey key); -extern void eventHotKey(); -extern void quitHotKey(); +extern void hotKey_init(); +extern void hotKey_register(SDLKey key, void (*handler) ()); +extern void unhotKey_register(SDLKey key); +extern void hotKey_enable(SDLKey key); +extern void hotKey_disable(SDLKey key); +extern void hotKey_event(); +extern void hotKey_quit(); #endif diff --git a/src/client/image.c b/src/client/image.c index 711d8b4..bbff3cb 100644 --- a/src/client/image.c +++ b/src/client/image.c @@ -14,7 +14,7 @@ static list_t *listStorage; static bool_t isImageDataInit = FALSE; -bool_t isImageInicialized() +bool_t image_is_inicialized() { return isImageDataInit; } @@ -22,13 +22,13 @@ bool_t isImageInicialized() /* * Inicializuje globalny zoznam obrazkov */ -void initImageData() +void image_init() { - assert(isInterfaceInicialized() == TRUE); + assert(interface_is_inicialized() == TRUE); DEBUG_MSG(_("Initializing image database\n")); - listStorage = newStorage(); + listStorage = storage_new(); isImageDataInit = TRUE; } @@ -65,7 +65,7 @@ static SDL_Surface *loadImage(const char *filename, int alpha) #ifndef SUPPORT_OPENGL -image_t *newImage(SDL_Surface * surface) +image_t *image_new(SDL_Surface * surface) { image_t *new; @@ -96,11 +96,11 @@ unsigned int closestpoweroftwo(unsigned int i) } /* convert from SDL_Surface to image_t - * WARNING: newImage is indestructive to surface, caller is responsible for freeing surface - * surface is not needed for image_t after execution of newImage + * WARNING: image_new is indestructive to surface, caller is responsible for freeing surface + * surface is not needed for image_t after execution of image_new */ -image_t* newImage(SDL_Surface *surface) +image_t* image_new(SDL_Surface *surface) { image_t *new; Uint32 rmask, gmask, bmask, amask; @@ -151,7 +151,7 @@ image_t* newImage(SDL_Surface *surface) } #endif -void destroyImage(image_t * p) +void image_destroy(image_t * p) { assert(p != NULL); @@ -172,7 +172,7 @@ void destroyImage(image_t * p) * *name - nazov obrazku ( pouzije sa ako vyhadavaci retazec v zazanem ) * alpha - 0 - nema alpha kanal | 1 - ma alpha kanal */ -image_t *addImageData(char *file, int alpha, char *name, char *group) +image_t *image_add(char *file, int alpha, char *name, char *group) { SDL_Surface *surface; image_t *new; @@ -182,9 +182,9 @@ image_t *addImageData(char *file, int alpha, char *name, char *group) assert(group != NULL); surface = loadImage(file, alpha); - new = newImage(surface); + new = image_new(surface); - addItemToStorage(listStorage, group, name, new); + storage_add(listStorage, group, name, new); DEBUG_MSG(_("Loading image %s\n"), file); @@ -195,37 +195,37 @@ image_t *addImageData(char *file, int alpha, char *name, char *group) * Vrati odkaz na image_data v globalnom zozname obrazkov * a nazvom *s */ -image_t *getImage(char *group, char *name) +image_t *image_get(char *group, char *name) { assert(group != NULL); assert(name != NULL); - return getItemFromStorage(listStorage, group, name); + return storage_get(listStorage, group, name); } -void delImage(char *group, char *name) +void image_del(char *group, char *name) { assert(group != NULL); assert(name != NULL); - delItemFromStorage(listStorage, group, name, destroyImage); + storage_del(listStorage, group, name, image_destroy); } -void delAllImageInGroup(char *group) +void image_del_all_image_in_group(char *group) { assert(group != NULL); - delAllItemFromStorage(listStorage, group, destroyImage); + storage_del_all(listStorage, group, image_destroy); } #ifndef SUPPORT_OPENGL -void drawImage(image_t * p, int x, int y, int px, int py, int w, int h) +void image_draw(image_t * p, int x, int y, int px, int py, int w, int h) { static SDL_Surface *screen = NULL; SDL_Rect dst_rect, src_rect; if (screen == NULL) { - screen = getSDL_Screen(); + screen = interface_get_screen(); } dst_rect.x = x; @@ -244,7 +244,7 @@ void drawImage(image_t * p, int x, int y, int px, int py, int w, int h) /* * Draws image on screen at [x,y], with width w and height h, top-left corner on image is at [px,py] */ -void drawImage(image_t *image, int x,int y, int px, int py, int w, int h) +void image_draw(image_t *image, int x,int y, int px, int py, int w, int h) { /* x -coordinate of left border xx- coordinate of right border, * y -coordinate of top border yy- coordinate of bottom border, @@ -291,10 +291,10 @@ void drawImage(image_t *image, int x,int y, int px, int py, int w, int h) /* * Odstrani zoznam obrazkov z pamate */ -void quitImageData() +void image_quit() { DEBUG_MSG(_("Quitting image database\n")); - destroyStorage(listStorage, destroyImage); + storage_destroy(listStorage, image_destroy); isImageDataInit = FALSE; } diff --git a/src/client/image.h b/src/client/image.h index 03e952d..b6347db 100644 --- a/src/client/image.h +++ b/src/client/image.h @@ -46,15 +46,15 @@ typedef struct image_struct } image_t; #endif -extern bool_t isImageInicialized(); -extern void initImageData(); -extern image_t* newImage(SDL_Surface *surface); -extern void destroyImage(image_t * p); -extern image_t *addImageData(char *file, int alpha, char *name, char *group); -extern image_t *getImage(char *group, char *name); -extern void delImage(char *group, char *name); -extern void delAllImageInGroup(char *group); -extern void drawImage(image_t * p, int x, int y, int px, int py, int w, int h); -extern void quitImageData(); +extern bool_t image_is_inicialized(); +extern void image_init(); +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); +extern void image_del(char *group, char *name); +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 diff --git a/src/client/interface.c b/src/client/interface.c index fba9521..ec87e4f 100644 --- a/src/client/interface.c +++ b/src/client/interface.c @@ -30,7 +30,7 @@ static bool_t isInterfaceInit = FALSE; // flag, kterym se ridi zarazovani klaves do bufferu static bool_t keyboardBufferEnabled = FALSE; -bool_t isInterfaceInicialized() +bool_t interface_is_inicialized() { return isInterfaceInit; } @@ -48,12 +48,12 @@ static Uint32 TimerCallback(Uint32 interval, void *param) return interval; } -void enableKeyboardBuffer() +void interface_enable_keyboard_buffer() { keyboardBufferEnabled = TRUE; } -void disableKeyboardBuffer() +void interface_disable_keyboard_buffer() { keyboardBufferEnabled = FALSE; } @@ -117,7 +117,7 @@ SDL_Surface * SetVideoMode(int width, int height, int bpp, Uint32 flags) } #endif -int initSDL() +int interface_init() { #ifdef DEBUG DEBUG_MSG(_("Initializing SDL system\n")); @@ -151,10 +151,10 @@ int initSDL() SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); timer = SDL_AddTimer(INTERVAL, TimerCallback, NULL); - initKeyboardBuffer(KEYBOARD_BUFFER_SIZE); + keyboardBuffer_init(KEYBOARD_BUFFER_SIZE); - initHotKey(); - registerHotKey(SDLK_F1, hotkey_screen); + hotKey_init(); + hotKey_register(SDLK_F1, hotkey_screen); srand((unsigned) time(NULL)); isInterfaceInit = TRUE; @@ -162,13 +162,13 @@ int initSDL() return 0; } -SDL_Surface *getSDL_Screen() +SDL_Surface *interface_get_screen() { //return my_surface; return screen; } -void interfaceRefresh() +void interface_refresh() { #ifndef SUPPORT_OPENGL SDL_Flip(screen); @@ -179,17 +179,17 @@ void interfaceRefresh() #endif } -void getMousePosition(int *x, int *y) +void interface_get_mouse_position(int *x, int *y) { SDL_GetMouseState(x, y); } -int isMouseClicked() +int interface_is_mouse_clicket() { return SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT); } -int isPressAnyKey() +int interface_is_press_any_key() { Uint8 *mapa; int i; @@ -224,7 +224,7 @@ int hack_slow() static bool_t isSlowHack = FALSE; time_t currentTime; - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if( lastTime == 0 ) { @@ -238,7 +238,7 @@ int hack_slow() { //printf("start slow hack (%d)\n", currentTime - lastTime); isSlowHack = TRUE; - lastTime = getMyTime(); + lastTime = timer_get_current_time(); return 1; } @@ -246,7 +246,7 @@ int hack_slow() { //printf("stop slow hack (%d)\n", currentTime - lastTime); isSlowHack = FALSE; - lastTime = getMyTime(); + lastTime = timer_get_current_time(); return 0; } @@ -255,7 +255,7 @@ int hack_slow() //printf("hack time interval %d\n", currentTime - lastTime); } - lastTime = getMyTime(); + lastTime = timer_get_current_time(); return isSlowHack; } @@ -272,7 +272,7 @@ int eventAction() default: //neni potreba vyuzivat frontu stale if (keyboardBufferEnabled == TRUE) - pushKeyToKeyboardBuffer(event.key.keysym); + keyboardBuffer_push(event.key.keysym); break; } break; @@ -285,10 +285,10 @@ int eventAction() break; } - drawScreen(); - eventScreen(); - eventHotKey(); - switchScreen(); + screen_draw(); + screen_event(); + hotKey_event(); + screen_switch(); break; default: @@ -323,7 +323,7 @@ int eventAction() return 0; } -void eventSDL() +void interface_event() { while (1) { if (eventAction() == -1) @@ -331,12 +331,12 @@ void eventSDL() } } -void quitSDL() +void interface_quit() { DEBUG_MSG(_("Quitting SDL\n")); - quitHotKey(); - quitKeyboardBuffer(); + hotKey_quit(); + keyboardBuffer_quit(); SDL_Quit(); diff --git a/src/client/interface.h b/src/client/interface.h index 3dbe5f3..d6b2715 100644 --- a/src/client/interface.h +++ b/src/client/interface.h @@ -33,16 +33,16 @@ // velikost klavesoveho bufferu (ve znacich) # define KEYBOARD_BUFFER_SIZE 256 -extern bool_t isInterfaceInicialized(); -extern void enableKeyboardBuffer(); -extern void disableKeyboardBuffer(); -extern int initSDL(); -extern SDL_Surface *getSDL_Screen(); -extern void getMousePosition(int *x, int *y); -extern int isMouseClicked(); -extern int isPressAnyKey(); -extern void interfaceRefresh(); -extern void eventSDL(); -extern void quitSDL(); +extern bool_t interface_is_inicialized(); +extern void interface_enable_keyboard_buffer(); +extern void interface_disable_keyboard_buffer(); +extern int interface_init(); +extern SDL_Surface *interface_get_screen(); +extern void interface_get_mouse_position(int *x, int *y); +extern int interface_is_mouse_clicket(); +extern int interface_is_press_any_key(); +extern void interface_refresh(); +extern void interface_event(); +extern void interface_quit(); #endif diff --git a/src/client/keyboardBuffer.c b/src/client/keyboardBuffer.c index 0454bdb..aff7b67 100644 --- a/src/client/keyboardBuffer.c +++ b/src/client/keyboardBuffer.c @@ -23,7 +23,7 @@ static SDL_keysym emptyKey; /* * Key buffer initializes. The parameter sets the number of keys. */ -void initKeyboardBuffer(int size) +void keyboardBuffer_init(int size) { assert(size > 0); assert(keyboardBuffer == NULL); @@ -47,7 +47,7 @@ void initKeyboardBuffer(int size) /* * Empty the buffer */ -void clearKeyboardBuffer() +void keyboardBuffer_clear() { assert(keyboardBuffer != NULL); @@ -61,7 +61,7 @@ void clearKeyboardBuffer() * Adds key to the end of the buffer. If the buffer is overrun, * an error is printed to stderr and the key is dropped. */ -bool_t pushKeyToKeyboardBuffer(SDL_keysym key) +bool_t keyboardBuffer_push(SDL_keysym key) { assert(keyboardBuffer != NULL); @@ -86,7 +86,7 @@ bool_t pushKeyToKeyboardBuffer(SDL_keysym key) * Takes out first key from the buffer and returns it. If the buffer is empty, * an error is printed to stderr and SDLK_UNKNOWN is returned. */ -SDL_keysym popKeyFromKeyboardBuffer() +SDL_keysym keyboardBuffer_pop() { assert(keyboardBuffer != NULL); @@ -112,7 +112,7 @@ SDL_keysym popKeyFromKeyboardBuffer() /* * The buffer size */ -int getKeyboardBufferSize() +int keyboardBuffer_get_size() { assert(keyboardBuffer != NULL); return keyboardBuffer->size; @@ -121,23 +121,23 @@ int getKeyboardBufferSize() /* * Number of keys in the buffer */ -int KeyboardBufferCount() +int keyboardBuffer_get_count() { assert(keyboardBuffer != NULL); return keyboardBuffer->count; } -bool_t isAnyKeyInKeyboardBuffer() +bool_t keyboardBuffer_is_any_key() { - return KeyboardBufferCount() > 0 ? TRUE : FALSE; + return keyboardBuffer_get_count() > 0 ? TRUE : FALSE; } /* * Frees the buffer. If it is not empty, information * about filling is prined to stderr first. */ -void quitKeyboardBuffer() +void keyboardBuffer_quit() { assert(keyboardBuffer != NULL); diff --git a/src/client/keyboardBuffer.h b/src/client/keyboardBuffer.h index c3c40af..eb4f307 100644 --- a/src/client/keyboardBuffer.h +++ b/src/client/keyboardBuffer.h @@ -22,13 +22,13 @@ typedef struct { int end; /* ukazatel na konec bufferu (tj. odkud se odebiraji klavesy) */ } keyboardBuffer_t; -extern void initKeyboardBuffer(int size); -extern void clearKeyboardBuffer(); -extern bool_t pushKeyToKeyboardBuffer(SDL_keysym key); -extern SDL_keysym popKeyFromKeyboardBuffer(); -extern int getKeyboardBufferSize(); -extern int KeyboardBufferCount(); -extern bool_t isAnyKeyInKeyboardBuffer(); -extern void quitKeyboardBuffer(); +extern void keyboardBuffer_init(int size); +extern void keyboardBuffer_clear(); +extern bool_t keyboardBuffer_push(SDL_keysym key); +extern SDL_keysym keyboardBuffer_pop(); +extern int keyboardBuffer_get_size(); +extern int keyboardBuffer_get_count(); +extern bool_t keyboardBuffer_is_any_key(); +extern void keyboardBuffer_quit(); #endif /* KEYBOARDBUFFER_H_ */ diff --git a/src/client/layer.c b/src/client/layer.c index 2bf8cde..4ec1a30 100644 --- a/src/client/layer.c +++ b/src/client/layer.c @@ -16,7 +16,7 @@ static list_t *listLayer; static bool_t isLayerInit = FALSE; -bool_t isLayerInicialized() +bool_t layer_is_inicialized() { return isLayerInit; } @@ -24,9 +24,9 @@ bool_t isLayerInicialized() /* * Initializes global list of the layers */ -void initLayer() +void layer_init() { - listLayer = newList(); + listLayer = list_new(); isLayerInit = TRUE; } @@ -63,24 +63,24 @@ void addLayer(image_t * img, int x, int y, int px, int py, int w, int h, int pla // here we are sure, that we want to insert it somewhere else than the begining for (i = 0; i < listLayer->count; i++) { - actual = getList(listLayer, i); + actual = list_get(listLayer, i); actual_value = actual->layer*WINDOW_SIZE_Y + actual->y + actual->h; if (actual_value > new_value) { - insList(listLayer, i, new); + list_ins(listLayer, i, new); return; }; }; - addList(listLayer, new); + list_add(listLayer, new); } /* * Draws all items onto the screen according to the layer and coordinate Y+H * After drawing frees the list */ -void drawLayer() +void layer_draw_all() { layer_t *this; int i; @@ -88,23 +88,23 @@ void drawLayer() for (i = 0; i < listLayer->count; i++) { this = (layer_t *) listLayer->list[i]; - drawImage(this->image, this->x, this->y, this->px, this->py, this->w, this->h); + image_draw(this->image, this->x, this->y, this->px, this->py, this->w, this->h); } //printf("listLayer->count = %d\n", listLayer->count); - destroyListItem(listLayer, free); - listLayer = newList(); + list_destroy_item(listLayer, free); + listLayer = list_new(); } -void drawLayerCenter(int x, int y) +void layer_draw_center(int x, int y) { layer_t *this; int screen_x, screen_y; int i; //int count = 0; - getCenterScreen(&screen_x, &screen_y, x, y, WINDOW_SIZE_X, WINDOW_SIZE_Y); + arena_get_center_screen(&screen_x, &screen_y, x, y, WINDOW_SIZE_X, WINDOW_SIZE_Y); for (i = 0; i < listLayer->count; i++) { this = (layer_t *) listLayer->list[i]; @@ -117,7 +117,7 @@ void drawLayerCenter(int x, int y) } //count++; - drawImage(this->image, this->x - screen_x, this->y - screen_y, + image_draw(this->image, this->x - screen_x, this->y - screen_y, this->px, this->py, this->w, this->h); //printf("%d %d\n", this->x - screen_x, this->y - screen_y); @@ -125,11 +125,11 @@ void drawLayerCenter(int x, int y) //printf("count = %d\n", count); - destroyListItem(listLayer, free); - listLayer = newList(); + list_destroy_item(listLayer, free); + listLayer = list_new(); } -void drawLayerSplit(int local_x, int local_y, int x, int y, int w, int h) +void layer_draw_slpit(int local_x, int local_y, int x, int y, int w, int h) { layer_t *this; int i; @@ -173,7 +173,7 @@ void drawLayerSplit(int local_x, int local_y, int x, int y, int w, int h) this->h -= (local_y + (this->y - y) + this->h) - (local_y + h); } - drawImage(this->image, local_x + (this->x - x), local_y + (this->y - y), + image_draw(this->image, local_x + (this->x - x), local_y + (this->y - y), this->px, this->py, this->w, this->h); //printf("%d %d\n", this->x - screen_x, this->y - screen_y); @@ -181,21 +181,21 @@ void drawLayerSplit(int local_x, int local_y, int x, int y, int w, int h) //printf("count = %d\n", count); - destroyListItem(listLayer, free); - listLayer = newList(); + list_destroy_item(listLayer, free); + listLayer = list_new(); } -void flushLayer() +void layer_flush() { - destroyListItem(listLayer, free); - listLayer = newList(); + list_destroy_item(listLayer, free); + listLayer = list_new(); } /* * Delete list of layers from memory */ -void quitLayer() +void layer_quit() { - destroyListItem(listLayer, free); + list_destroy_item(listLayer, free); isLayerInit = FALSE; } diff --git a/src/client/layer.h b/src/client/layer.h index 37c0628..66a0580 100644 --- a/src/client/layer.h +++ b/src/client/layer.h @@ -24,8 +24,8 @@ typedef struct layer_str { image_t *image; //dane surfrace } layer_t; -extern bool_t isLayerInicialized(); -extern void initLayer(); +extern bool_t layer_is_inicialized(); +extern void layer_init(); /* * Add image to queue for rendering @@ -43,11 +43,11 @@ extern void addLayer(image_t * img, /* * Draws queue on the screen */ -extern void drawLayer(); -extern void drawLayerCenter(int x, int y); -extern void drawLayerSplit(int local_x, int local_y, int x, int y, int w, +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 flushLayer(); -extern void quitLayer(); +extern void layer_flush(); +extern void layer_quit(); #endif diff --git a/src/client/panel.c b/src/client/panel.c index b7d0360..1d7846a 100644 --- a/src/client/panel.c +++ b/src/client/panel.c @@ -19,32 +19,32 @@ static image_t *g_bonus; static bool_t isPanelInit = FALSE; -bool_t isPanelInicialized() +bool_t panel_is_inicialized() { return isPanelInit; } -void initPanel() +void panel_init() { - assert(isImageInicialized() == TRUE); - assert(isInterfaceInicialized() == TRUE); - - g_panel = addImageData("panel.png", IMAGE_ALPHA, "panel", IMAGE_GROUP_BASE); - g_shot = addImageData("panel_shot.png", IMAGE_ALPHA, "panel_image_shot",IMAGE_GROUP_BASE); - g_bonus = addImageData("graf.bonus.png", IMAGE_ALPHA, "panel_graf_bonus", IMAGE_GROUP_BASE); - g_icon[GUN_SIMPLE] = addImageData("icon.gun.simple.png", IMAGE_ALPHA, "panel_gun", IMAGE_GROUP_BASE); - g_icon[GUN_DUAL_SIMPLE] = addImageData("icon.gun.dual.simple.png", IMAGE_ALPHA, "panel_dual", IMAGE_GROUP_BASE); - g_icon[GUN_TOMMY] = addImageData("icon.gun.tommy.png", IMAGE_ALPHA, "panel_tommy", IMAGE_GROUP_BASE); - g_icon[GUN_SCATTER] = addImageData("icon.gun.scatter.png", IMAGE_ALPHA, "panel_scatter", IMAGE_GROUP_BASE); - g_icon[GUN_LASSER] = addImageData("icon.gun.lasser.png", IMAGE_ALPHA, "panel_lasser", IMAGE_GROUP_BASE); - g_icon[GUN_MINE] = addImageData("icon.gun.mine.png", IMAGE_ALPHA, "panel_mine", IMAGE_GROUP_BASE); - g_icon[GUN_BOMBBALL] = addImageData("icon.gun.bombball.png", IMAGE_ALPHA, "panel_bombball", IMAGE_GROUP_BASE); - g_icon[BONUS_SPEED] = addImageData("icon.bonus.speed.png", IMAGE_ALPHA, "panel_speed", IMAGE_GROUP_BASE); - g_icon[BONUS_SHOT] = addImageData("icon.bonus.shot.png", IMAGE_ALPHA, "panel_shot", IMAGE_GROUP_BASE); - g_icon[BONUS_TELEPORT] = addImageData("icon.bonus.teleport.png", IMAGE_ALPHA, "panel_teleport", IMAGE_GROUP_BASE); - g_icon[BONUS_GHOST] = addImageData("icon.bonus.ghost.png", IMAGE_ALPHA, "panel_ghost", IMAGE_GROUP_BASE); - g_icon[BONUS_4X] = addImageData("icon.bonus.4x.png", IMAGE_ALPHA, "panel_4x", IMAGE_GROUP_BASE); - g_icon[BONUS_HIDDEN] = addImageData("icon.bonus.hidden.png", IMAGE_ALPHA, "panel_hidden", IMAGE_GROUP_BASE); + assert(image_is_inicialized() == TRUE); + assert(interface_is_inicialized() == TRUE); + + g_panel = image_add("panel.png", IMAGE_ALPHA, "panel", IMAGE_GROUP_BASE); + g_shot = image_add("panel_shot.png", IMAGE_ALPHA, "panel_image_shot",IMAGE_GROUP_BASE); + g_bonus = image_add("graf.bonus.png", IMAGE_ALPHA, "panel_graf_bonus", IMAGE_GROUP_BASE); + g_icon[GUN_SIMPLE] = image_add("icon.gun.simple.png", IMAGE_ALPHA, "panel_gun", IMAGE_GROUP_BASE); + g_icon[GUN_DUAL_SIMPLE] = image_add("icon.gun.dual.simple.png", IMAGE_ALPHA, "panel_dual", IMAGE_GROUP_BASE); + g_icon[GUN_TOMMY] = image_add("icon.gun.tommy.png", IMAGE_ALPHA, "panel_tommy", IMAGE_GROUP_BASE); + g_icon[GUN_SCATTER] = image_add("icon.gun.scatter.png", IMAGE_ALPHA, "panel_scatter", IMAGE_GROUP_BASE); + g_icon[GUN_LASSER] = image_add("icon.gun.lasser.png", IMAGE_ALPHA, "panel_lasser", IMAGE_GROUP_BASE); + g_icon[GUN_MINE] = image_add("icon.gun.mine.png", IMAGE_ALPHA, "panel_mine", IMAGE_GROUP_BASE); + g_icon[GUN_BOMBBALL] = image_add("icon.gun.bombball.png", IMAGE_ALPHA, "panel_bombball", IMAGE_GROUP_BASE); + g_icon[BONUS_SPEED] = image_add("icon.bonus.speed.png", IMAGE_ALPHA, "panel_speed", IMAGE_GROUP_BASE); + g_icon[BONUS_SHOT] = image_add("icon.bonus.shot.png", IMAGE_ALPHA, "panel_shot", IMAGE_GROUP_BASE); + g_icon[BONUS_TELEPORT] = image_add("icon.bonus.teleport.png", IMAGE_ALPHA, "panel_teleport", IMAGE_GROUP_BASE); + g_icon[BONUS_GHOST] = image_add("icon.bonus.ghost.png", IMAGE_ALPHA, "panel_ghost", IMAGE_GROUP_BASE); + g_icon[BONUS_4X] = image_add("icon.bonus.4x.png", IMAGE_ALPHA, "panel_4x", IMAGE_GROUP_BASE); + g_icon[BONUS_HIDDEN] = image_add("icon.bonus.hidden.png", IMAGE_ALPHA, "panel_hidden", IMAGE_GROUP_BASE); isPanelInit = TRUE; } @@ -62,22 +62,22 @@ static void drawScore(tux_t * tux_right, tux_t * tux_left) sprintf(strScoreLine, "%d", tux_left->score); } - getTextSize(strScoreLine, &w, &h); - drawFont(strScoreLine, PANEL_SCORE_LOCATION_X, PANEL_SCORE_LOCATION_Y, COLOR_WHITE); + font_text_size(strScoreLine, &w, &h); + font_draw(strScoreLine, PANEL_SCORE_LOCATION_X, PANEL_SCORE_LOCATION_Y, COLOR_WHITE); } -static void drawShot(int n, int x, int y) +static void shot_draw(int n, int x, int y) { - drawImage(g_shot, x, y, n * PANEL_SHOT_WIDTH, 0, PANEL_SHOT_WIDTH, PANEL_SHOT_HEIGHT); + image_draw(g_shot, x, y, n * PANEL_SHOT_WIDTH, 0, PANEL_SHOT_WIDTH, PANEL_SHOT_HEIGHT); } -static void drawShotInfo(tux_t * tux, int x, int y) +static void shot_drawInfo(tux_t * tux, int x, int y) { int i; if (tux->pickup_time > 0) { for (i = 0; i < tux->pickup_time / 3; i++) { - drawShot(PANEL_SHOT_LINE, x + i * PANEL_SHOT_WIDTH, y); + shot_draw(PANEL_SHOT_LINE, x + i * PANEL_SHOT_WIDTH, y); } return; @@ -85,21 +85,21 @@ static void drawShotInfo(tux_t * tux, int x, int y) for (i = 0; i < GUN_MAX_SHOT; i++) { if (tux->shot[tux->gun] > i) { - drawShot(PANEL_SHOT_FILL, x + i * (PANEL_SHOT_WIDTH + 2), y); + shot_draw(PANEL_SHOT_FILL, x + i * (PANEL_SHOT_WIDTH + 2), y); } else { - drawShot(PANEL_SHOT_EMPTY, x + i * (PANEL_SHOT_WIDTH + 2), y); + shot_draw(PANEL_SHOT_EMPTY, x + i * (PANEL_SHOT_WIDTH + 2), y); } } } static void drawGunInfo(tux_t * tux, int x, int y) { - drawImage(g_icon[tux->gun], x, y, 0, 0, g_icon[tux->gun]->w, g_icon[tux->gun]->h); + image_draw(g_icon[tux->gun], x, y, 0, 0, g_icon[tux->gun]->w, g_icon[tux->gun]->h); } static void drawBonusInfo(tux_t * tux, int x, int y) { - drawImage(g_icon[tux->bonus], x, y, 0, 0, g_icon[tux->bonus]->w, g_icon[tux->bonus]->h); + image_draw(g_icon[tux->bonus], x, y, 0, 0, g_icon[tux->bonus]->w, g_icon[tux->bonus]->h); } static void drawGrafBonus(tux_t * tux, int x, int y) @@ -107,17 +107,17 @@ static void drawGrafBonus(tux_t * tux, int x, int y) int offset; offset = tux->bonus_time / 5; - drawImage(g_bonus, x, y, 0, 0, g_bonus->w, g_bonus->h / 2); - drawImage(g_bonus, x + 1, y, 0, g_bonus->h / 2, offset, g_bonus->h / 2); + image_draw(g_bonus, x, y, 0, 0, g_bonus->w, g_bonus->h / 2); + image_draw(g_bonus, x + 1, y, 0, g_bonus->h / 2, offset, g_bonus->h / 2); } -static void drawTuxRight(tux_t * tux) +static void tux_drawRight(tux_t * tux) { if (tux == NULL) { return; } - drawShotInfo(tux, PANEL_LOCATION_X + 740, PANEL_LOCATION_Y + 34); + shot_drawInfo(tux, PANEL_LOCATION_X + 740, PANEL_LOCATION_Y + 34); drawGunInfo(tux, PANEL_LOCATION_X + 620, PANEL_LOCATION_Y + 30); if (tux->bonus != BONUS_NONE) { @@ -126,13 +126,13 @@ static void drawTuxRight(tux_t * tux) } } -static void drawTuxLeft(tux_t * tux) +static void tux_drawLeft(tux_t * tux) { if (tux == NULL) { return; } - drawShotInfo(tux, PANEL_LOCATION_X + 8, PANEL_LOCATION_Y + 34); + shot_drawInfo(tux, PANEL_LOCATION_X + 8, PANEL_LOCATION_Y + 34); drawGunInfo(tux, PANEL_LOCATION_X + 130, PANEL_LOCATION_Y + 30); if (tux->bonus != BONUS_NONE) { @@ -141,20 +141,20 @@ static void drawTuxLeft(tux_t * tux) } } -void drawPanel(tux_t * tux_right, tux_t * tux_left) +void panel_draw(tux_t * tux_right, tux_t * tux_left) { - drawImage(g_panel, PANEL_LOCATION_X, PANEL_LOCATION_Y, 0, 0, g_panel->w, g_panel->h); + image_draw(g_panel, PANEL_LOCATION_X, PANEL_LOCATION_Y, 0, 0, g_panel->w, g_panel->h); drawScore(tux_right, tux_left); - if (isRecivedNewMsg()) { - drawFont("recived new msg", PANEL_LOCATION_X, PANEL_LOCATION_Y, COLOR_WHITE); + if (chat_is_recived_new_msg()) { + font_draw("recived new msg", PANEL_LOCATION_X, PANEL_LOCATION_Y, COLOR_WHITE); } - drawTuxRight(tux_right); - drawTuxLeft(tux_left); + tux_drawRight(tux_right); + tux_drawLeft(tux_left); } -void quitPanel() +void panel_quit() { isPanelInit = FALSE; } diff --git a/src/client/panel.h b/src/client/panel.h index 6478f3b..94a55e0 100644 --- a/src/client/panel.h +++ b/src/client/panel.h @@ -19,9 +19,9 @@ # define PANEL_SHOT_EMPTY 1 # define PANEL_SHOT_LINE 2 -extern bool_t isPanelInicialized(); -extern void initPanel(); -extern void drawPanel(tux_t * tux_right, tux_t * tux_left); -extern void quitPanel(); +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_quit(); #endif diff --git a/src/client/pauza.c b/src/client/pauza.c index eb346dc..ae125d2 100644 --- a/src/client/pauza.c +++ b/src/client/pauza.c @@ -29,34 +29,34 @@ static void hotkey_pauze() switchPauzed(); } -void initPauza() +void pauza_init() { - g_pauza = addImageData("pauza.png", IMAGE_ALPHA, "pauza", IMAGE_GROUP_USER); + g_pauza = image_add("pauza.png", IMAGE_ALPHA, "pauza", IMAGE_GROUP_USER); activePauza = FALSE; - registerHotKey(SDLK_p, hotkey_pauze); + hotKey_register(SDLK_p, hotkey_pauze); } -void drawPauza() +void pauza_draw() { if (activePauza) { - drawImage(g_pauza, + image_draw(g_pauza, WINDOW_SIZE_X / 2 - g_pauza->w / 2, WINDOW_SIZE_Y / 2 - g_pauza->h / 2, 0, 0, g_pauza->w, g_pauza->h); } } -void eventPauza() +void pauza_event() { } -bool_t isPauzeActive() +bool_t pauza_is_active() { return activePauza; } -void quitPauza() +void pauza_quit() { - unregisterHotKey(SDLK_p); + unhotKey_register(SDLK_p); } diff --git a/src/client/pauza.h b/src/client/pauza.h index 8ddd1f8..2743af4 100644 --- a/src/client/pauza.h +++ b/src/client/pauza.h @@ -7,10 +7,10 @@ # include "main.h" -extern void initPauza(); -extern void drawPauza(); -extern void eventPauza(); -extern bool_t isPauzeActive(); -extern void quitPauza(); +extern void pauza_init(); +extern void pauza_draw(); +extern void pauza_event(); +extern bool_t pauza_is_active(); +extern void pauza_quit(); #endif diff --git a/src/client/radar.c b/src/client/radar.c index b45d80f..5770cf0 100644 --- a/src/client/radar.c +++ b/src/client/radar.c @@ -40,7 +40,7 @@ static void destroyRadarItem(radar_item_t * p) free(p); } -void addToRadar(int id, int x, int y, int type) +void radar_add(int id, int x, int y, int type) { int i; @@ -57,10 +57,10 @@ void addToRadar(int id, int x, int y, int type) } } - addList(listRadar, newRadarItem(id, x, y, type)); + list_add(listRadar, newRadarItem(id, x, y, type)); } -void delFromRadar(int id) +void radar_del(int id) { int i; @@ -70,26 +70,26 @@ void delFromRadar(int id) thisRadarItem = (radar_item_t *) listRadar->list[i]; if (thisRadarItem->id == id) { - delListItem(listRadar, i, destroyRadarItem); + list_del_item(listRadar, i, destroyRadarItem); return; } } } -void initRadar() +void radar_init() { - assert(isImageInicialized() == TRUE); - assert(isInterfaceInicialized() == TRUE); + assert(image_is_inicialized() == TRUE); + assert(interface_is_inicialized() == TRUE); - g_radar = addImageData("radar.png", IMAGE_NO_ALPHA, "radar", IMAGE_GROUP_USER); - listRadar = newList(); + g_radar = image_add("radar.png", IMAGE_NO_ALPHA, "radar", IMAGE_GROUP_USER); + listRadar = list_new(); } -void drawRadar(arena_t * arena) +void radar_draw(arena_t * arena) { int i; - drawImage(g_radar, RADAR_LOCATION_X, RADAR_LOCATION_Y, 0, 0, RADAR_SIZE_X + 2, RADAR_SIZE_Y + 2); + image_draw(g_radar, RADAR_LOCATION_X, RADAR_LOCATION_Y, 0, 0, RADAR_SIZE_X + 2, RADAR_SIZE_Y + 2); for (i = 0; i < listRadar->count; i++) { radar_item_t *thisRadarItem; @@ -102,13 +102,13 @@ void drawRadar(arena_t * arena) y = (((float) RADAR_SIZE_Y) / ((float) arena->h)) * ((float) thisRadarItem->y); if (x >= 0 && x <= RADAR_SIZE_X && y >= 0 && y <= RADAR_SIZE_Y) { - drawImage(g_radar, RADAR_LOCATION_X + 1 + x, RADAR_LOCATION_Y + 1 + y, + image_draw(g_radar, RADAR_LOCATION_X + 1 + x, RADAR_LOCATION_Y + 1 + y, 2 * thisRadarItem->type, RADAR_SIZE_Y + 2, 2, 2); } } } -void quitRadar() +void radar_quit() { - destroyListItem(listRadar, destroyRadarItem); + list_destroy_item(listRadar, destroyRadarItem); } diff --git a/src/client/radar.h b/src/client/radar.h index 0092055..9f43968 100644 --- a/src/client/radar.h +++ b/src/client/radar.h @@ -15,10 +15,10 @@ # define RADAR_TYPE_TUX 1 # define RADAR_TYPE_ITEM 2 -extern void initRadar(); -extern void addToRadar(int id, int x, int y, int type); -extern void delFromRadar(int id); -extern void drawRadar(arena_t * arena); -extern void quitRadar(); +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_quit(); #endif diff --git a/src/client/saveDialog.c b/src/client/saveDialog.c index 1c832e7..0ae3554 100644 --- a/src/client/saveDialog.c +++ b/src/client/saveDialog.c @@ -46,7 +46,7 @@ static void eventWidget(void *p) button = (widget_t *) p; if (button == widgetButtonSave) { - saveArena(getTextFromWidgetTextfield(widgetTextFieldName), getCurrentArena()); + save_arena(textField_get_text(widgetTextFieldName), arena_get_current()); switchTerm(); } @@ -60,45 +60,45 @@ static void hotkey_saveDialog() switchTerm(); } -void initSaveDialog() +void saveDialog_init() { activeSaveDialog = FALSE; - g_background = getImage(IMAGE_GROUP_BASE, "screen_main"); + g_background = image_get(IMAGE_GROUP_BASE, "screen_main"); - widgetLabelMsg = newWidgetLabel("name", SAVE_DIALOG_LOCATIN_X + 20, + widgetLabelMsg = label_new("name", SAVE_DIALOG_LOCATIN_X + 20, SAVE_DIALOG_LOCATIN_Y + 20, WIDGET_LABEL_LEFT); - widgetTextFieldName = newWidgetTextfield("noname", WIDGET_TEXTFIELD_FILTER_ALPHANUM, + widgetTextFieldName = textField_new("noname", WIDGET_TEXTFIELD_FILTER_ALPHANUM, widgetLabelMsg->x + widgetLabelMsg->w + 10, widgetLabelMsg->y); - widgetButtonSave = newWidgetButton("Save", SAVE_DIALOG_LOCATIN_X + 20, + widgetButtonSave = button_new("Save", SAVE_DIALOG_LOCATIN_X + 20, SAVE_DIALOG_LOCATIN_Y + 60, eventWidget); - widgetButtonBack = newWidgetButton("Back", SAVE_DIALOG_LOCATIN_X + 20 + + widgetButtonBack = button_new("Back", SAVE_DIALOG_LOCATIN_X + 20 + WIDGET_BUTTON_WIDTH + 20, SAVE_DIALOG_LOCATIN_Y + 60, eventWidget); - registerHotKey(SDLK_F2, hotkey_saveDialog); + hotKey_register(SDLK_F2, hotkey_saveDialog); } -bool_t isSaveDialogActive() +bool_t saveDialog_is_active() { return activeSaveDialog; } -void drawSaveDialog() +void saveDialog_draw() { if (activeSaveDialog == FALSE) { return; } - drawImage(g_background, + image_draw(g_background, SAVE_DIALOG_LOCATIN_X, SAVE_DIALOG_LOCATIN_Y, SAVE_DIALOG_LOCATIN_X, @@ -106,30 +106,30 @@ void drawSaveDialog() SAVE_DIALOG_SIZE_X, SAVE_DIALOG_SIZE_Y); - drawWidgetLabel(widgetLabelMsg); - drawWidgetTextfield(widgetTextFieldName); - drawWidgetButton(widgetButtonSave); - drawWidgetButton(widgetButtonBack); + label_draw(widgetLabelMsg); + textField_draw(widgetTextFieldName); + button_draw(widgetButtonSave); + button_draw(widgetButtonBack); } -void eventSaveDialog() +void saveDialog_event() { if (activeSaveDialog == FALSE) { return; } - eventWidgetTextfield(widgetTextFieldName); - eventWidgetButton(widgetButtonSave); - eventWidgetButton(widgetButtonBack); + textField_event(widgetTextFieldName); + button_event(widgetButtonSave); + button_event(widgetButtonBack); } -void quitSaveDialog() +void saveDialog_quit() { - unregisterHotKey(SDLK_F2); + unhotKey_register(SDLK_F2); - destroyWidgetLabel(widgetLabelMsg); - destroyWidgetTextfield(widgetTextFieldName); - destroyWidgetButton(widgetButtonSave); - destroyWidgetButton(widgetButtonBack); + label_destroy(widgetLabelMsg); + textField_destroy(widgetTextFieldName); + button_destroy(widgetButtonSave); + button_destroy(widgetButtonBack); } diff --git a/src/client/saveDialog.h b/src/client/saveDialog.h index d96a252..a126955 100644 --- a/src/client/saveDialog.h +++ b/src/client/saveDialog.h @@ -12,10 +12,10 @@ # define SAVE_DIALOG_LOCATIN_Y (WINDOW_SIZE_Y/2 - SAVE_DIALOG_SIZE_Y/2) -extern void initSaveDialog(); -extern bool_t isSaveDialogActive(); -extern void drawSaveDialog(); -extern void eventSaveDialog(); -extern void quitSaveDialog(); +extern void saveDialog_init(); +extern bool_t saveDialog_is_active(); +extern void saveDialog_draw(); +extern void saveDialog_event(); +extern void saveDialog_quit(); #endif diff --git a/src/client/saveLoad.c b/src/client/saveLoad.c index 0448a4f..cd1b94a 100644 --- a/src/client/saveLoad.c +++ b/src/client/saveLoad.c @@ -32,7 +32,7 @@ static void action_saveTux(space_t * space, tux_t * tux, textFile_t * textFile) tux->shot[GUN_LASSER], tux->shot[GUN_MINE], tux->shot[GUN_BOMBBALL], tux->bonus_time, tux->pickup_time); - addList(textFile->text, strdup(str)); + list_add(textFile->text, strdup(str)); } static void @@ -45,7 +45,7 @@ action_saveShot(space_t * space, shot_t * shot, textFile_t * textFile) shot->position, shot->gun, shot->author_id, shot->isCanKillAuthor); - addList(textFile->text, strdup(str)); + list_add(textFile->text, strdup(str)); } static void @@ -57,7 +57,7 @@ action_saveItem(space_t * space, item_t * item, textFile_t * textFile) item->id, item->type, item->x, item->y, item->count, item->frame, item->author_id); - addList(textFile->text, strdup(str)); + list_add(textFile->text, strdup(str)); } static void saveContextArenaToTextFile(textFile_t * textFile, arena_t * arena) @@ -65,37 +65,37 @@ static void saveContextArenaToTextFile(textFile_t * textFile, arena_t * arena) char str[STR_PROTO_SIZE]; sprintf(str, "ARENA %s %d %d", - getArenaNetName(getChoiceArena()), + arenaFile_get_net_name(choiceArena_get()), arena->countRound, arena->max_countRound); - addList(textFile->text, strdup(str)); + list_add(textFile->text, strdup(str)); - actionSpace(arena->spaceTux, action_saveTux, textFile); - actionSpace(arena->spaceShot, action_saveShot, textFile); - actionSpace(arena->spaceItem, action_saveItem, textFile); + space_action(arena->spaceTux, action_saveTux, textFile); + space_action(arena->spaceShot, action_saveShot, textFile); + space_action(arena->spaceItem, action_saveItem, textFile); } -void saveArena(char *filename, arena_t * arena) +void save_arena(char *filename, arena_t * arena) { textFile_t *textFile; char path[STR_PATH_SIZE]; - sprintf(path, "%s/%s.sav", getHomeDirector(), filename); + sprintf(path, "%s/%s.sav", homeDirector_get(), filename); DEBUG_MSG(_("Saving game to: \"%s\"\n"), path); - textFile = newTextFile(path); + textFile = textFile_new(path); if (textFile != NULL) { saveContextArenaToTextFile(textFile, arena); - saveTextFile(textFile); - destroyTextFile(textFile); + textFile_save(textFile); + textFile_destroy(textFile); } else { fprintf(stderr, _("I was unable to save: \"%s\"\n"), path); } } -static arena_t *loadArenaFromLine(char *line) +static arena_t *load_arenaFromLine(char *line) { char cmd[STR_SIZE]; char name[STR_SIZE]; @@ -105,9 +105,9 @@ static arena_t *loadArenaFromLine(char *line) sscanf(line, "%s %s %d %d", cmd, name, &countRound, &max_countRound); - setWorldArena(getArenaFileFormNetName(name)); + word_set_arena(arenaFile_get_file_format_net_name(name)); - arena = getCurrentArena(); + arena = arena_get_current(); arena->max_countRound = max_countRound; arena->countRound = countRound; @@ -130,26 +130,26 @@ static void loadTuxFromLine(char *line, arena_t * arena) name, &myGun, &myBonus, &gun1, &gun2, &gun3, &gun4, &gun5, &gun6, &gun7, &time1, &time2); - tux = newTux(); - replaceTuxID(tux, id); - addObjectToSpace(arena->spaceTux, tux); + tux = tux_new(); + tux_replace_id(tux, id); + space_add(arena->spaceTux, tux); tux->control = control; if (tux->control == TUX_CONTROL_KEYBOARD_RIGHT) { - setControlTux(tux, TUX_CONTROL_KEYBOARD_RIGHT); + word_set_control_tux(tux, TUX_CONTROL_KEYBOARD_RIGHT); } if (tux->control == TUX_CONTROL_KEYBOARD_LEFT) { - setControlTux(tux, TUX_CONTROL_KEYBOARD_LEFT); + word_set_control_tux(tux, TUX_CONTROL_KEYBOARD_LEFT); } if (tux->control == TUX_CONTROL_AI) { - loadModule("libmodAI"); - setControlTux(tux, TUX_CONTROL_KEYBOARD_LEFT); + module_load("libmodAI"); + word_set_control_tux(tux, TUX_CONTROL_KEYBOARD_LEFT); } - moveObjectInSpace(arena->spaceTux, tux, x, y); + space_move_object(arena->spaceTux, tux, x, y); tux->status = status; tux->position = position; tux->frame = frame; @@ -178,17 +178,17 @@ static void loadShotFromLine(char *line, arena_t * arena) cmd, &shot_id, &x, &y, &px, &py, &position, &gun, &author_id, &isCanKillAuthor); - shot = newShot(x, y, px, py, gun, author_id); + shot = shot_new(x, y, px, py, gun, author_id); - replaceShotID(shot, shot_id); + shot_replace_id(shot, shot_id); shot->isCanKillAuthor = isCanKillAuthor; shot->position = position; if (shot->gun == GUN_LASSER) { - transformOnlyLasser(shot); + shot_transform_lasser(shot); } - addObjectToSpace(arena->spaceShot, shot); + space_add(arena->spaceShot, shot); } static void loadItemFromLine(char *line, arena_t * arena) @@ -200,13 +200,13 @@ static void loadItemFromLine(char *line, arena_t * arena) sscanf(line, "%s %d %d %d %d %d %d %d %d", cmd, &id, &type, &x, &y, &count, &frame, &author_id, &check_id); - item = newItem(x, y, type, author_id); + item = item_new(x, y, type, author_id); - replaceItemID(item, id); + item_replace_id(item, id); item->count = count; item->frame = frame; - addObjectToSpace(arena->spaceItem, item); + space_add(arena->spaceItem, item); } static arena_t *loadContextArenaFromTextFile(textFile_t * textFile) @@ -222,7 +222,7 @@ static arena_t *loadContextArenaFromTextFile(textFile_t * textFile) line = (char *) textFile->text->list[i]; if (strncmp(line, "ARENA", 5) == 0) { - arena = loadArenaFromLine(line); + arena = load_arenaFromLine(line); } if (strncmp(line, "TUX", 3) == 0) { @@ -241,20 +241,20 @@ static arena_t *loadContextArenaFromTextFile(textFile_t * textFile) return arena; } -void loadArena(char *filename) +void load_arena(char *filename) { textFile_t *textFile; char path[STR_PATH_SIZE]; - sprintf(path, "%s/%s", getHomeDirector(), filename); + sprintf(path, "%s/%s", homeDirector_get(), filename); DEBUG_MSG(_("Loadig game from file: \"%s\"\n"), path); - textFile = loadTextFile(path); + textFile = textFile_load(path); if (textFile != NULL) { loadContextArenaFromTextFile(textFile); - destroyTextFile(textFile); + textFile_destroy(textFile); } else { fprintf(stderr, _("Unable to load save: \"%s\"\n"), path); } diff --git a/src/client/saveLoad.h b/src/client/saveLoad.h index f62e293..f405f6b 100644 --- a/src/client/saveLoad.h +++ b/src/client/saveLoad.h @@ -6,7 +6,7 @@ # include "textFile.h" # include "arena.h" -extern void saveArena(char *filename, arena_t * arena); -extern void loadArena(char *filename); +extern void save_arena(char *filename, arena_t * arena); +extern void load_arena(char *filename); #endif diff --git a/src/client/screen.c b/src/client/screen.c index 71d48d8..d4b7289 100644 --- a/src/client/screen.c +++ b/src/client/screen.c @@ -19,12 +19,12 @@ static list_t *listScreen; static bool_t isScreenInit = FALSE; -bool_t isScreenInicialized() +bool_t screen_is_inicialized() { return isScreenInit; } -screen_t *newScreen(char *name, void (*fce_start) (), void (*fce_event) (), +screen_t *screen_new(char *name, void (*fce_start) (), void (*fce_event) (), void (*fce_draw) (), void (*fce_stop) ()) { screen_t *new; @@ -45,7 +45,7 @@ screen_t *newScreen(char *name, void (*fce_start) (), void (*fce_event) (), return new; } -void destroyScreen(screen_t * p) +void screen_destroy(screen_t * p) { assert(p != NULL); @@ -53,18 +53,18 @@ void destroyScreen(screen_t * p) free(p); } -void registerScreen(screen_t * p) +void screen_register(screen_t * p) { assert(p != NULL); DEBUG_MSG(_("Registering screen: \"%s\"\n"), p->name); - addList(listScreen, p); + list_add(listScreen, p); } -void initScreen() +void screen_init() { - listScreen = newList(); + listScreen = list_new(); currentScreen = NULL; futureScreen = NULL; @@ -89,19 +89,19 @@ static screen_t *findScreen(char *name) return NULL; } -void setScreen(char *name) +void screen_set(char *name) { futureScreen = findScreen(name); assert(futureScreen != NULL); } -void switchScreen() +void screen_switch() { if (futureScreen == NULL) { return; } - flushLayer(); + layer_flush(); if (currentScreen != NULL) { DEBUG_MSG(_("Stopping screen: \"%s\"\n"), currentScreen->name); @@ -118,19 +118,19 @@ void switchScreen() currentScreen->fce_start(); } -void startScreen(char *name) +void screen_start(char *name) { - setScreen(name); - switchScreen(); + screen_set(name); + screen_switch(); } -char *getScreen() +char *screen_get() { assert(currentScreen != NULL); return currentScreen->name; } -void drawScreen() +void screen_draw() { static int count = 0; @@ -144,21 +144,21 @@ void drawScreen() #ifdef DEBUG_TIME_DRAW my_time_t prev; - prev = getMyTimeMicro(); + prev = timer_get_current_timeMicro(); #endif currentScreen->fce_draw(); - interfaceRefresh(); + interface_refresh(); #ifdef DEBUG_TIME_DRAW - printf("c draw time = %d\n", getMyTimeMicro() - prev); + printf("c draw time = %d\n", timer_get_current_timeMicro() - prev); #endif } } -void eventScreen() +void screen_event() { assert(currentScreen != NULL); #if 0 @@ -166,23 +166,23 @@ void eventScreen() if( last == 0 ) { - last = getMyTime(); + last = timer_get_current_time(); } - printf("%d\n", getMyTime()-last); - last = getMyTime(); + printf("%d\n", timer_get_current_time()-last); + last = timer_get_current_time(); #endif currentScreen->fce_event(); #ifdef DEBUG_TIME_EVENT - printf("c event time = %d\n", getMyTimeMicro() - prev); + printf("c event time = %d\n", timer_get_current_timeMicro() - prev); #endif } -void quitScreen() +void screen_quit() { assert(listScreen != NULL); - destroyListItem(listScreen, destroyScreen); + list_destroy_item(listScreen, screen_destroy); isScreenInit = FALSE; } diff --git a/src/client/screen.h b/src/client/screen.h index 3227bfe..227696f 100644 --- a/src/client/screen.h +++ b/src/client/screen.h @@ -13,21 +13,21 @@ typedef struct screen_struct { void (*fce_stop) (); } screen_t; -extern bool_t isScreenInicialized(); +extern bool_t screen_is_inicialized(); -extern screen_t *newScreen(char *name, +extern screen_t *screen_new(char *name, void (*fce_start) (), void (*fce_event) (), void (*fce_draw) (), void (*fce_stop) ()); -extern void destroyScreen(screen_t * p); -extern void registerScreen(screen_t * p); -extern void initScreen(); -extern void setScreen(char *name); -extern void switchScreen(); -extern void startScreen(char *name); -extern char *getScreen(); -extern void drawScreen(); -extern void eventScreen(); -extern void quitScreen(); +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(); +extern void screen_start(char *name); +extern char *screen_get(); +extern void screen_draw(); +extern void screen_event(); +extern void screen_quit(); #endif diff --git a/src/client/term.c b/src/client/term.c index 4a1991c..7cfb346 100644 --- a/src/client/term.c +++ b/src/client/term.c @@ -18,12 +18,12 @@ static bool_t activeTerm; static my_time_t lastActive; static my_time_t lastRefresh; -void initTerm() +void term_init() { - listText = newList(); + listText = list_new(); activeTerm = FALSE; - lastActive = getMyTime(); + lastActive = timer_get_current_time(); lastRefresh = lastActive; } @@ -87,24 +87,24 @@ static void action_refreshTerm(space_t * space, tux_t * tux, void *p) getStrGun(tux->gun), tux->shot[tux->gun], getStrBonus(tux->bonus) ); - addList(listText, strdup(str)); + list_add(listText, strdup(str)); } static void refreshTerm() { arena_t *arena; - arena = getCurrentArena(); + arena = arena_get_current(); - destroyListItem(listText, free); - listText = newList(); + list_destroy_item(listText, free); + listText = list_new(); - actionSpace(arena->spaceTux, action_refreshTerm, NULL); + space_action(arena->spaceTux, action_refreshTerm, NULL); //printf("refresh term..\n"); } -void drawTerm() +void term_draw() { int i; @@ -116,7 +116,7 @@ void drawTerm() char *line; line = (char *) listText->list[i]; - drawFont(line, 10, 10 + i * 20, COLOR_WHITE); + font_draw(line, 10, 10 + i * 20, COLOR_WHITE); } } @@ -129,14 +129,14 @@ static void switchTerm() } } -void eventTerm() +void term_event() { my_time_t currentTime; Uint8 *mapa; mapa = SDL_GetKeyState(NULL); - currentTime = getMyTime(); + currentTime = timer_get_current_time(); if (currentTime - lastRefresh > TERM_REFRESH_TIME_INTERVAL) { lastRefresh = currentTime; @@ -151,8 +151,8 @@ void eventTerm() } } -void quitTerm() +void term_quit() { assert(listText != NULL); - destroyListItem(listText, free); + list_destroy_item(listText, free); } diff --git a/src/client/term.h b/src/client/term.h index ffc0e14..445edbd 100644 --- a/src/client/term.h +++ b/src/client/term.h @@ -8,9 +8,9 @@ # define TERM_ACTIVE_TIME_INTERVAL 500 # define TERM_REFRESH_TIME_INTERVAL 1000 -extern void initTerm(); -extern void drawTerm(); -extern void eventTerm(); -extern void quitTerm(); +extern void term_init(); +extern void term_draw(); +extern void term_event(); +extern void term_quit(); #endif |