From 35084eaadf8b37f5c4a325f0d4b01767753ee9c3 Mon Sep 17 00:00:00 2001 From: Dusan Durech Date: Sat, 15 Nov 2008 16:08:21 +0100 Subject: modification coding stile --- src/screen/screen_analyze.c | 30 +- src/screen/screen_choiceArena.c | 25 +- src/screen/screen_downArena.c | 10 +- src/screen/screen_gameType.c | 51 +-- src/screen/screen_mainMenu.c | 30 +- src/screen/screen_setting.c | 205 ++++------ src/screen/screen_settingKeys.c | 847 ++++++++++++++++++++++++---------------- src/screen/screen_table.c | 31 +- src/screen/screen_world.c | 68 ++-- 9 files changed, 667 insertions(+), 630 deletions(-) (limited to 'src/screen') diff --git a/src/screen/screen_analyze.c b/src/screen/screen_analyze.c index b52ca77..df2ea75 100644 --- a/src/screen/screen_analyze.c +++ b/src/screen/screen_analyze.c @@ -84,8 +84,7 @@ void eventScreenAnalyze() void stopScreenAnalyze() { destroyWidgetLabel(widgetLabelMsg); - widgetLabelMsg = - newWidgetLabel("", WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); + widgetLabelMsg = newWidgetLabel("", WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); } static void eventWidget(void *p) @@ -118,8 +117,7 @@ void addAnalyze(char *name, int score) void setMsgToAnalyze(char *msg) { destroyWidgetLabel(widgetLabelMsg); - widgetLabelMsg = - newWidgetLabel(msg, WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); + widgetLabelMsg = newWidgetLabel(msg, WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); } void endAnalyze() @@ -132,16 +130,13 @@ void endAnalyze() this = (analyze_t *) (listAnalyze->list[i]); - addList(listWidgetLabelName, newWidgetLabel(this->name, - 100, 200 + 20 * i, - WIDGET_LABEL_LEFT)); + addList(listWidgetLabelName, newWidgetLabel(this->name, 100, + 200 + 20 * i, WIDGET_LABEL_LEFT)); str = getString(this->score); - addList(listWidgetLabelScore, newWidgetLabel(str, - WINDOW_SIZE_X - 100, - 200 + 20 * i, - WIDGET_LABEL_RIGHT)); + addList(listWidgetLabelScore, newWidgetLabel(str, WINDOW_SIZE_X - 100, + 200 + 20 * i, WIDGET_LABEL_RIGHT)); free(str); } @@ -158,16 +153,13 @@ void initScreenAnalyze() listWidgetLabelScore = newList(); listAnalyze = newList(); - button_ok = - newWidgetButton("OK", WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, - WINDOW_SIZE_Y - 100, eventWidget); + button_ok = newWidgetButton("OK", WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, + WINDOW_SIZE_Y - 100, eventWidget); - registerScreen(newScreen - ("analyze", startScreenAnalyze, eventScreenAnalyze, - drawScreenAnalyze, stopScreenAnalyze)); + registerScreen( newScreen("analyze", startScreenAnalyze, eventScreenAnalyze, + drawScreenAnalyze, stopScreenAnalyze)); - widgetLabelMsg = - newWidgetLabel("", WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); + widgetLabelMsg = newWidgetLabel("", WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); } void quitScreenAnalyze() diff --git a/src/screen/screen_choiceArena.c b/src/screen/screen_choiceArena.c index c269f62..969c350 100644 --- a/src/screen/screen_choiceArena.c +++ b/src/screen/screen_choiceArena.c @@ -49,6 +49,7 @@ void drawScreenChoiceArena() for (i = 0; i < listWidgetButtonimage->count; i++) { widget_t *this; + this = (widget_t *) listWidgetButtonimage->list[i]; drawWidgetButtonimage(this); } @@ -63,6 +64,7 @@ void eventScreenChoiceArena() for (i = 0; i < listWidgetButtonimage->count; i++) { widget_t *this; + this = (widget_t *) listWidgetButtonimage->list[i]; eventWidgetButtonimage(this); } @@ -135,11 +137,8 @@ void initScreenChoiceArena() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = - newWidgetButton(_("back"), 100, WINDOW_SIZE_Y - 100, eventWidget); - button_play = - newWidgetButton(_("play"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, - eventWidget); + button_back = newWidgetButton(_("back"), 100, WINDOW_SIZE_Y - 100, eventWidget); + button_play = newWidgetButton(_("play"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, eventWidget); listWidgetButtonimage = newList(); currentArena = NULL; @@ -151,16 +150,13 @@ void initScreenChoiceArena() arenaFile = getArenaFile(i); //image = addImageData(getArenaImage(i), IMAGE_NO_ALPHA, "none", IMAGE_GROUP_BASE); - image = loadImageFromArena(arenaFile, - getArenaImage(arenaFile), - IMAGE_GROUP_BASE, "none", IMAGE_NO_ALPHA); + image = loadImageFromArena(arenaFile, getArenaImage(arenaFile), + IMAGE_GROUP_BASE, "none", IMAGE_NO_ALPHA); x = 100 + 200 * (i - 3 * (i / 3)); y = 150 + 200 * (i / 3); - widget_buttonimage = newWidgetButtonimage(image, - x, y, - eventWidgetButtonImage); + widget_buttonimage = newWidgetButtonimage(image, x, y, eventWidgetButtonImage); /* if( i == choiceArenaId ) { @@ -170,10 +166,9 @@ void initScreenChoiceArena() addList(listWidgetButtonimage, widget_buttonimage); } - registerScreen(newScreen - ("chiceArena", startScreenChoiceArena, - eventScreenChoiceArena, drawScreenChoiceArena, - stopScreenChoiceArena)); + registerScreen( newScreen("chiceArena", startScreenChoiceArena, + eventScreenChoiceArena, drawScreenChoiceArena, + stopScreenChoiceArena)); } void quitScreenChoiceArena() diff --git a/src/screen/screen_downArena.c b/src/screen/screen_downArena.c index 737543d..94b2387 100644 --- a/src/screen/screen_downArena.c +++ b/src/screen/screen_downArena.c @@ -373,16 +373,14 @@ void initScreenDownArena() image_backgorund = newWidgetImage(0, 0, image); button_back = - newWidgetButton(_("back"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, - WINDOW_SIZE_Y - 80, eventWidget); + newWidgetButton(_("back"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, + WINDOW_SIZE_Y - 80, eventWidget); label_status = newWidgetLabel("none", WINDOW_SIZE_X / 2, 250, WIDGET_LABEL_CENTER); - registerScreen(newScreen - ("downArena", startScreenDownArena, eventScreenDownArena, - drawScreenDownArena, stopScreenDownArena)); + registerScreen( newScreen("downArena", startScreenDownArena, eventScreenDownArena, + drawScreenDownArena, stopScreenDownArena)); } void quitScreenDownArena() diff --git a/src/screen/screen_gameType.c b/src/screen/screen_gameType.c index ccfbe15..84fb4eb 100644 --- a/src/screen/screen_gameType.c +++ b/src/screen/screen_gameType.c @@ -114,8 +114,7 @@ void drawScreenGameType() drawWidgetLabel(label_client); drawWidgetLabel(label_load_session); - if (getWidgetChoiceStatus(check_server) == TRUE - || getWidgetChoiceStatus(check_client) == TRUE) { + if (getWidgetChoiceStatus(check_server) == TRUE || getWidgetChoiceStatus(check_client) == TRUE) { drawWidgetLabel(label_port); drawWidgetTextfield(textfield_port); drawWidgetLabel(label_ip); @@ -152,8 +151,7 @@ void eventScreenGameType() eventWidgetChoicegroup(this); } - if (getWidgetChoiceStatus(check_server) == TRUE - || getWidgetChoiceStatus(check_client) == TRUE) { + if (getWidgetChoiceStatus(check_server) == TRUE || getWidgetChoiceStatus(check_client) == TRUE) { eventWidgetTextfield(textfield_ip); eventWidgetTextfield(textfield_port); } @@ -213,22 +211,15 @@ void initScreenGameType() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = - newWidgetButton(_("back"), 100, WINDOW_SIZE_Y - 100, eventWidget); - button_play = - newWidgetButton(_("play"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, - eventWidget); + button_back = newWidgetButton(_("back"), 100, WINDOW_SIZE_Y - 100, eventWidget); + button_play = newWidgetButton(_("play"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, eventWidget); button_browser = newWidgetButton(_("browser"), 300, 345, eventWidget); listChoiceGroup = newList(); - check_none = - newWidgetChoicegroup(100, 150, FALSE, listChoiceGroup, eventWidget); - check_server = - newWidgetChoicegroup(100, 200, FALSE, listChoiceGroup, eventWidget); - check_client = - newWidgetChoicegroup(100, 250, FALSE, listChoiceGroup, eventWidget); - check_load_session = - newWidgetChoicegroup(100, 300, FALSE, listChoiceGroup, eventWidget); + check_none = newWidgetChoicegroup(100, 150, FALSE, listChoiceGroup, eventWidget); + check_server = newWidgetChoicegroup(100, 200, FALSE, listChoiceGroup, eventWidget); + check_client = newWidgetChoicegroup(100, 250, FALSE, listChoiceGroup, eventWidget); + check_load_session = newWidgetChoicegroup(100, 300, FALSE, listChoiceGroup, eventWidget); if (isParamFlag("--server")) { setWidgetChoiceStatus(check_server, TRUE); @@ -239,30 +230,25 @@ void initScreenGameType() } label_none = newWidgetLabel(_("Local game"), 130, 145, WIDGET_LABEL_LEFT); - label_server = - newWidgetLabel(_("Set up a server"), 130, 195, WIDGET_LABEL_LEFT); - label_client = - newWidgetLabel(_("Network game"), 130, 245, WIDGET_LABEL_LEFT); - label_load_session = - newWidgetLabel("load session", 130, 295, WIDGET_LABEL_LEFT); + label_server = newWidgetLabel(_("Set up a server"), 130, 195, WIDGET_LABEL_LEFT); + label_client = newWidgetLabel(_("Network game"), 130, 245, WIDGET_LABEL_LEFT); + label_load_session = newWidgetLabel("load session", 130, 295, WIDGET_LABEL_LEFT); label_ip = newWidgetLabel(_("IP"), 300, 145, WIDGET_LABEL_LEFT); label_port = newWidgetLabel(_("port"), 300, 245, WIDGET_LABEL_LEFT); - label_session = - newWidgetLabel("load session :", 300, 145, WIDGET_LABEL_LEFT); + label_session = newWidgetLabel("load session :", 300, 145, WIDGET_LABEL_LEFT); textfield_ip = newWidgetTextfield(getParamElse("--ip", "127.0.0.1"), - WIDGET_TEXTFIELD_FILTER_IP_OR_DOMAIN, - 300, 180); + WIDGET_TEXTFIELD_FILTER_IP_OR_DOMAIN, + 300, 180); textfield_port = newWidgetTextfield(getParamElse("--port", "6800"), - WIDGET_TEXTFIELD_FILTER_NUM, 300, 280); + WIDGET_TEXTFIELD_FILTER_NUM, 300, 280); selectSession = newWidgetSelect(300, 185, eventWidget); - registerScreen(newScreen - ("gameType", startScreenGameType, eventScreenGameType, - drawScreenGameType, stopScreenGameType)); + registerScreen( newScreen("gameType", startScreenGameType, eventScreenGameType, + drawScreenGameType, stopScreenGameType)); } int setSettingGameType(int status) @@ -287,8 +273,7 @@ int setSettingGameType(int status) int getSettingGameType() { - if (getWidgetChoiceStatus(check_none) == TRUE || - getWidgetChoiceStatus(check_load_session) == TRUE) { + if (getWidgetChoiceStatus(check_none) == TRUE || getWidgetChoiceStatus(check_load_session) == TRUE) { return NET_GAME_TYPE_NONE; } diff --git a/src/screen/screen_mainMenu.c b/src/screen/screen_mainMenu.c index 580bfab..0bb50d7 100644 --- a/src/screen/screen_mainMenu.c +++ b/src/screen/screen_mainMenu.c @@ -98,34 +98,18 @@ void initScreenMainMenu() IMAGE_GROUP_BASE); image_backgorund = newWidgetImage(0, 0, image); - button_play = - newWidgetButton(_("Start game"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 200, - eventWidget); - button_setting = - newWidgetButton(_("Settings"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 250, - eventWidget); - button_table = - newWidgetButton(_("Highscore"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 300, - eventWidget); - button_credits = - newWidgetButton(_("Credits"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 350, - eventWidget); - button_end = - newWidgetButton(_("Quit game"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 400, - eventWidget); + button_play = newWidgetButton(_("Start game"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 200, eventWidget); + button_setting = newWidgetButton(_("Settings"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 250, eventWidget); + button_table = newWidgetButton(_("Highscore"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 300, eventWidget); + button_credits = newWidgetButton(_("Credits"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 350, eventWidget); + button_end = newWidgetButton(_("Quit game"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, 400, eventWidget); #ifndef NO_SOUND addMusic("menu.ogg", "menu", MUSIC_GROUP_BASE); #endif - registerScreen(newScreen - ("mainMenu", startScreenMainMenu, eventScreenMainMenu, - drawScreenMainMenu, stopScreenMainMenu)); + registerScreen( newScreen("mainMenu", startScreenMainMenu, eventScreenMainMenu, + drawScreenMainMenu, stopScreenMainMenu)); } void quitScreenMainMenu() diff --git a/src/screen/screen_setting.c b/src/screen/screen_setting.c index 06adda3..4e19978 100644 --- a/src/screen/screen_setting.c +++ b/src/screen/screen_setting.c @@ -151,6 +151,7 @@ void eventScreenSetting() if (getWidgetCheckStatus(check_ai) == FALSE) { eventWidgetTextfield(textfield_name_player2); } + #ifndef NO_SOUND eventWidgetCheck(check_music); eventWidgetCheck(check_sound); @@ -185,9 +186,11 @@ static void eventWidget(void *p) if (button == button_back) { setScreen("mainMenu"); } + if (button == button_keys) { setScreen("settingKeys"); } + #ifndef NO_SOUND if (check == check_music) { setMusicActive(getWidgetCheckStatus(check_music)); @@ -279,64 +282,35 @@ static void initSettingFile() static void saveAndDestroyConfigFile() { if (configFile == NULL) { - fprintf(stderr, - _ - ("I am unable to save configure file, because config file was not initialised!\n")); - + fprintf(stderr, _("I am unable to save configure file, because config file was not initialised!\n")); return; } - setValueInConfigFile(configFile, "COUNT_ROUND", - getTextFromWidgetTextfield(textfield_count_cound)); - setValueInConfigFile(configFile, "NAME_PLAYER_RIGHT", - getTextFromWidgetTextfield(textfield_name_player1)); - setValueInConfigFile(configFile, "NAME_PLAYER_LEFT", - getTextFromWidgetTextfield(textfield_name_player2)); - - setValueInConfigFile(configFile, "GUN_DUAL_SIMPLE", - getYesOrNo(getWidgetCheckStatus - (check[GUN_DUAL_SIMPLE]))); - setValueInConfigFile(configFile, "GUN_SCATTER", - getYesOrNo(getWidgetCheckStatus(check[GUN_SCATTER]))); - setValueInConfigFile(configFile, "GUN_TOMMY", - getYesOrNo(getWidgetCheckStatus(check[GUN_TOMMY]))); - setValueInConfigFile(configFile, "GUN_LASSER", - getYesOrNo(getWidgetCheckStatus(check[GUN_LASSER]))); - setValueInConfigFile(configFile, "GUN_MINE", - getYesOrNo(getWidgetCheckStatus(check[GUN_MINE]))); - setValueInConfigFile(configFile, "GUN_BOMBBALL", - getYesOrNo(getWidgetCheckStatus - (check[GUN_BOMBBALL]))); - - setValueInConfigFile(configFile, "BONUS_SPEED", - getYesOrNo(getWidgetCheckStatus(check[BONUS_SPEED]))); - setValueInConfigFile(configFile, "BONUS_SHOT", - getYesOrNo(getWidgetCheckStatus(check[BONUS_SHOT]))); - setValueInConfigFile(configFile, "BONUS_TELEPORT", - getYesOrNo(getWidgetCheckStatus - (check[BONUS_TELEPORT]))); - setValueInConfigFile(configFile, "BONUS_GHOST", - getYesOrNo(getWidgetCheckStatus(check[BONUS_GHOST]))); - setValueInConfigFile(configFile, "BONUS_4X", - getYesOrNo(getWidgetCheckStatus(check[BONUS_4X]))); - setValueInConfigFile(configFile, "BONUS_HIDDEN", - getYesOrNo(getWidgetCheckStatus - (check[BONUS_HIDDEN]))); - - setValueInConfigFile(configFile, "AI", - getYesOrNo(getWidgetCheckStatus(check_ai))); + setValueInConfigFile(configFile, "COUNT_ROUND", getTextFromWidgetTextfield(textfield_count_cound)); + setValueInConfigFile(configFile, "NAME_PLAYER_RIGHT", getTextFromWidgetTextfield(textfield_name_player1)); + setValueInConfigFile(configFile, "NAME_PLAYER_LEFT", getTextFromWidgetTextfield(textfield_name_player2)); + setValueInConfigFile(configFile, "GUN_DUAL_SIMPLE", getYesOrNo(getWidgetCheckStatus(check[GUN_DUAL_SIMPLE]))); + setValueInConfigFile(configFile, "GUN_SCATTER", getYesOrNo(getWidgetCheckStatus(check[GUN_SCATTER]))); + setValueInConfigFile(configFile, "GUN_TOMMY", getYesOrNo(getWidgetCheckStatus(check[GUN_TOMMY]))); + setValueInConfigFile(configFile, "GUN_LASSER", getYesOrNo(getWidgetCheckStatus(check[GUN_LASSER]))); + setValueInConfigFile(configFile, "GUN_MINE", getYesOrNo(getWidgetCheckStatus(check[GUN_MINE]))); + setValueInConfigFile(configFile, "GUN_BOMBBALL", getYesOrNo(getWidgetCheckStatus(check[GUN_BOMBBALL]))); + setValueInConfigFile(configFile, "BONUS_SPEED", getYesOrNo(getWidgetCheckStatus(check[BONUS_SPEED]))); + setValueInConfigFile(configFile, "BONUS_SHOT", getYesOrNo(getWidgetCheckStatus(check[BONUS_SHOT]))); + setValueInConfigFile(configFile, "BONUS_TELEPORT", getYesOrNo(getWidgetCheckStatus (check[BONUS_TELEPORT]))); + setValueInConfigFile(configFile, "BONUS_GHOST", getYesOrNo(getWidgetCheckStatus(check[BONUS_GHOST]))); + setValueInConfigFile(configFile, "BONUS_4X", getYesOrNo(getWidgetCheckStatus(check[BONUS_4X]))); + setValueInConfigFile(configFile, "BONUS_HIDDEN", getYesOrNo(getWidgetCheckStatus(check[BONUS_HIDDEN]))); + setValueInConfigFile(configFile, "AI", getYesOrNo(getWidgetCheckStatus(check_ai))); #ifndef NO_SOUND - setValueInConfigFile(configFile, "MUSIC", - getYesOrNo(getWidgetCheckStatus(check_music))); - setValueInConfigFile(configFile, "SOUND", - getYesOrNo(getWidgetCheckStatus(check_sound))); + setValueInConfigFile(configFile, "MUSIC", getYesOrNo(getWidgetCheckStatus(check_music))); + setValueInConfigFile(configFile, "SOUND", getYesOrNo(getWidgetCheckStatus(check_sound))); #endif if( getChoiceArena() != NULL ) { - setValueInConfigFile(configFile, "ARENA", - getArenaNetName(getChoiceArena())); + setValueInConfigFile(configFile, "ARENA", getArenaNetName(getChoiceArena())); } //TODO @@ -352,63 +326,46 @@ void initScreenSetting() image = getImage(IMAGE_GROUP_BASE, "screen_main"); image_backgorund = newWidgetImage(0, 0, image); - button_back = - newWidgetButton(_("back"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, - eventWidget); - button_keys = - newWidgetButton(_("controls"), WINDOW_SIZE_X - 200, - button_back->y - WIDGET_BUTTON_HEIGHT - 10, - eventWidget); + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, eventWidget); + + button_keys = newWidgetButton(_("controls"), WINDOW_SIZE_X - 200, + button_back->y - WIDGET_BUTTON_HEIGHT - 10, eventWidget); #ifndef NO_SOUND - label_music = - newWidgetLabel(_("Music:"), 100, WINDOW_SIZE_Y - 85, - WIDGET_LABEL_LEFT); - check_music = - newWidgetCheck(label_music->x + label_music->w + 10, - WINDOW_SIZE_Y - 80, isMusicActive(), eventWidget); - label_sound = - newWidgetLabel(_("Sound:"), check_music->x + WIDGET_CHECK_WIDTH + 10, - WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); - check_sound = - newWidgetCheck(label_sound->x + label_sound->w + 10, - WINDOW_SIZE_Y - 80, isSoundActive(), eventWidget); - label_ai = - newWidgetLabel(_("AI:"), check_sound->x + WIDGET_CHECK_WIDTH + 10, - WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); + label_music = newWidgetLabel(_("Music:"), 100, WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); + + check_music = newWidgetCheck(label_music->x + label_music->w + 10, + WINDOW_SIZE_Y - 80, isMusicActive(), eventWidget); + label_sound = newWidgetLabel(_("Sound:"), check_music->x + WIDGET_CHECK_WIDTH + 10, + WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); + + check_sound = newWidgetCheck(label_sound->x + label_sound->w + 10, + WINDOW_SIZE_Y - 80, isSoundActive(), eventWidget); + + label_ai = newWidgetLabel(_("AI:"), check_sound->x + WIDGET_CHECK_WIDTH + 10, + WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); #else - label_ai = - newWidgetLabel(_("AI:"), 100, WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); + label_ai = newWidgetLabel(_("AI:"), 100, WINDOW_SIZE_Y - 85, WIDGET_LABEL_LEFT); #endif - check_ai = - newWidgetCheck(label_ai->x + label_ai->w + 10, WINDOW_SIZE_Y - 80, - FALSE, eventWidget); + check_ai = newWidgetCheck(label_ai->x + label_ai->w + 10, WINDOW_SIZE_Y - 80, FALSE, eventWidget); - label_count_round = - newWidgetLabel(_("No. of rounds:"), 100, WINDOW_SIZE_Y - 200, - WIDGET_LABEL_LEFT); - label_name_player1 = - newWidgetLabel(_("Player 1:"), 100, WINDOW_SIZE_Y - 160, - WIDGET_LABEL_LEFT); - label_name_player2 = - newWidgetLabel(_("Player 2:"), 100, WINDOW_SIZE_Y - 120, - WIDGET_LABEL_LEFT); + label_count_round = newWidgetLabel(_("No. of rounds:"), 100, WINDOW_SIZE_Y - 200, WIDGET_LABEL_LEFT); + label_name_player1 = newWidgetLabel(_("Player 1:"), 100, WINDOW_SIZE_Y - 160, WIDGET_LABEL_LEFT); + label_name_player2 = newWidgetLabel(_("Player 2:"), 100, WINDOW_SIZE_Y - 120, WIDGET_LABEL_LEFT); textfield_count_cound = newWidgetTextfield(getParamElse("--count", "15"), - WIDGET_TEXTFIELD_FILTER_NUM, - 110 + label_count_round->w, - WINDOW_SIZE_Y - 200); + WIDGET_TEXTFIELD_FILTER_NUM, + 110 + label_count_round->w, + WINDOW_SIZE_Y - 200); - textfield_name_player1 = - newWidgetTextfield(getParamElse("--name1", NAME_PLAYER_RIGHT), - WIDGET_TEXTFIELD_FILTER_ALPHANUM, - 110 + label_count_round->w, WINDOW_SIZE_Y - 160); + textfield_name_player1 = newWidgetTextfield(getParamElse("--name1", NAME_PLAYER_RIGHT), + WIDGET_TEXTFIELD_FILTER_ALPHANUM, + 110 + label_count_round->w, WINDOW_SIZE_Y - 160); - textfield_name_player2 = - newWidgetTextfield(getParamElse("--name2", NAME_PLAYER_LEFT), - WIDGET_TEXTFIELD_FILTER_ALPHANUM, - 110 + label_count_round->w, WINDOW_SIZE_Y - 120); + textfield_name_player2 = newWidgetTextfield(getParamElse("--name2", NAME_PLAYER_LEFT), + WIDGET_TEXTFIELD_FILTER_ALPHANUM, + 110 + label_count_round->w, WINDOW_SIZE_Y - 120); for (i = GUN_DUAL_SIMPLE; i <= GUN_BOMBBALL; i++) { int x = 0; @@ -444,47 +401,21 @@ void initScreenSetting() check[i] = newWidgetCheck(x, y, TRUE, NULL); } - image_gun_dual_revolver = - newWidgetImage(110 + WIDGET_CHECK_WIDTH, 200, - getImage(IMAGE_GROUP_BASE, "panel_dual")); - image_gun_scatter = - newWidgetImage(110 + WIDGET_CHECK_WIDTH, 250, - getImage(IMAGE_GROUP_BASE, "panel_scatter")); - image_gun_tommy = - newWidgetImage(110 + WIDGET_CHECK_WIDTH, 300, - getImage(IMAGE_GROUP_BASE, "panel_tommy")); - image_gun_lasser = - newWidgetImage(260 + WIDGET_CHECK_WIDTH, 200, - getImage(IMAGE_GROUP_BASE, "panel_lasser")); - image_gun_mine = - newWidgetImage(260 + WIDGET_CHECK_WIDTH, 250, - getImage(IMAGE_GROUP_BASE, "panel_mine")); - image_gun_bombball = - newWidgetImage(260 + WIDGET_CHECK_WIDTH, 300, - getImage(IMAGE_GROUP_BASE, "panel_bombball")); - - image_bonus_speed = - newWidgetImage(430 + WIDGET_CHECK_WIDTH, 200, - getImage(IMAGE_GROUP_BASE, "panel_speed"));; - image_bonus_shot = - newWidgetImage(430 + WIDGET_CHECK_WIDTH, 250, - getImage(IMAGE_GROUP_BASE, "panel_shot"));; - image_bonus_teleport = - newWidgetImage(430 + WIDGET_CHECK_WIDTH, 300, - getImage(IMAGE_GROUP_BASE, "panel_teleport"));; - image_bonus_ghost = - newWidgetImage(580 + WIDGET_CHECK_WIDTH, 200, - getImage(IMAGE_GROUP_BASE, "panel_ghost"));; - image_bonus_4x = - newWidgetImage(580 + WIDGET_CHECK_WIDTH, 250, - getImage(IMAGE_GROUP_BASE, "panel_4x"));; - image_bonus_hidden = - newWidgetImage(580 + WIDGET_CHECK_WIDTH, 300, - getImage(IMAGE_GROUP_BASE, "panel_hidden"));; - - registerScreen(newScreen - ("setting", startScreenSetting, eventScreenSetting, - drawScreenSetting, stopScreenSetting)); + image_gun_dual_revolver = newWidgetImage(110 + WIDGET_CHECK_WIDTH, 200, getImage(IMAGE_GROUP_BASE, "panel_dual")); + image_gun_scatter = newWidgetImage(110 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_scatter")); + image_gun_tommy = newWidgetImage(110 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_tommy")); + image_gun_lasser = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 200,getImage(IMAGE_GROUP_BASE, "panel_lasser")); + image_gun_mine = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_mine")); + image_gun_bombball = newWidgetImage(260 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_bombball")); + image_bonus_speed = newWidgetImage(430 + WIDGET_CHECK_WIDTH, 200, getImage(IMAGE_GROUP_BASE, "panel_speed"));; + image_bonus_shot = newWidgetImage(430 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_shot"));; + image_bonus_teleport = newWidgetImage(430 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_teleport"));; + image_bonus_ghost = newWidgetImage(580 + WIDGET_CHECK_WIDTH, 200, getImage(IMAGE_GROUP_BASE, "panel_ghost"));; + image_bonus_4x = newWidgetImage(580 + WIDGET_CHECK_WIDTH, 250, getImage(IMAGE_GROUP_BASE, "panel_4x"));; + image_bonus_hidden = newWidgetImage(580 + WIDGET_CHECK_WIDTH, 300, getImage(IMAGE_GROUP_BASE, "panel_hidden"));; + + registerScreen( newScreen("setting", startScreenSetting, eventScreenSetting, + drawScreenSetting, stopScreenSetting)); initSettingFile(); diff --git a/src/screen/screen_settingKeys.c b/src/screen/screen_settingKeys.c index 5bfc802..60ddd79 100644 --- a/src/screen/screen_settingKeys.c +++ b/src/screen/screen_settingKeys.c @@ -16,7 +16,8 @@ #ifndef NO_SOUND # include "music.h" # include "sound.h" -#endif /* */ +#endif /* + */ #include "screen_mainMenu.h" #include "screen_setting.h" #include "screen_settingKeys.h" @@ -26,114 +27,159 @@ #include "widget_image.h" #include "widget_catchkey.h" #include "widget_label.h" - static int keytable[KEY_LENGTH]; - static textFile_t *keycontrolFile; - static widget_t *image_backgorund; - static widget_t *button_back; + +static int keytable[KEY_LENGTH]; + +static textFile_t *keycontrolFile; +static widget_t *image_backgorund; +static widget_t *button_back; // key names -static widget_t *tux_right; - static widget_t *tux_right_keyup; - static widget_t *tux_right_keydown; - static widget_t *tux_right_keyleft; - static widget_t *tux_right_keyright; - static widget_t *tux_right_keyswitch; - static widget_t *tux_right_keyfire; - static widget_t *tux_left; - static widget_t *tux_left_keyup; - static widget_t *tux_left_keydown; - static widget_t *tux_left_keyleft; - static widget_t *tux_left_keyright; - static widget_t *tux_left_keyswitch; - static widget_t *tux_left_keyfire; +static widget_t *tux_right; +static widget_t *tux_right_keyup; +static widget_t *tux_right_keydown; +static widget_t *tux_right_keyleft; +static widget_t *tux_right_keyright; +static widget_t *tux_right_keyswitch; +static widget_t *tux_right_keyfire; + +static widget_t *tux_left; +static widget_t *tux_left_keyup; +static widget_t *tux_left_keydown; + +static widget_t *tux_left_keyleft; +static widget_t *tux_left_keyright; +static widget_t *tux_left_keyswitch; +static widget_t *tux_left_keyfire; // key values -static widget_t *tux_right_keyup_val; - static widget_t *tux_right_keydown_val; - static widget_t *tux_right_keyleft_val; - static widget_t *tux_right_keyright_val; - static widget_t *tux_right_keyswitch_val; - static widget_t *tux_right_keyfire_val; - static widget_t *tux_left_keyup_val; - static widget_t *tux_left_keydown_val; - static widget_t *tux_left_keyleft_val; - static widget_t *tux_left_keyright_val; - static widget_t *tux_left_keyswitch_val; - static widget_t *tux_left_keyfire_val; - +static widget_t *tux_right_keyup_val; +static widget_t *tux_right_keydown_val; +static widget_t *tux_right_keyleft_val; +static widget_t *tux_right_keyright_val; +static widget_t *tux_right_keyswitch_val; +static widget_t *tux_right_keyfire_val; +static widget_t *tux_left_keyup_val; +static widget_t *tux_left_keydown_val; +static widget_t *tux_left_keyleft_val; +static widget_t *tux_left_keyright_val; +static widget_t *tux_left_keyswitch_val; +static widget_t *tux_left_keyfire_val; + + //static widget_t *catcher; // todo add key images // possible variant will be reusing widget_image for current widget_label so there wont // be key names but only images - void startScreenSettingKeys() -{ + +void startScreenSettingKeys() +{ #ifndef NO_SOUND - playMusic("menu", MUSIC_GROUP_BASE); - -#endif /* */ -} static void - - setKeytableFromConfigFile(textFile_t * configFile) -{ - char val[STR_SIZE]; - loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_UP", val, STR_SIZE, - "273"); - keytable[KEY_TUX_RIGHT_MOVE_UP] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_RIGHT", val, - STR_SIZE, "275"); - keytable[KEY_TUX_RIGHT_MOVE_RIGHT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_LEFT", val, STR_SIZE, - "276"); - keytable[KEY_TUX_RIGHT_MOVE_LEFT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_DOWN", val, STR_SIZE, - "274"); - keytable[KEY_TUX_RIGHT_MOVE_DOWN] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_RIGHT_SHOOT", val, STR_SIZE, - "48"); - keytable[KEY_TUX_RIGHT_SHOOT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_RIGHT_SWITCH_WEAPON", val, - STR_SIZE, "49"); - keytable[KEY_TUX_RIGHT_SWITCH_WEAPON] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_UP", val, STR_SIZE, - "119"); - keytable[KEY_TUX_LEFT_MOVE_UP] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_RIGHT", val, STR_SIZE, - "100"); - keytable[KEY_TUX_LEFT_MOVE_RIGHT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_LEFT", val, STR_SIZE, - "97"); - keytable[KEY_TUX_LEFT_MOVE_LEFT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_DOWN", val, STR_SIZE, - "115"); - keytable[KEY_TUX_LEFT_MOVE_DOWN] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_SHOOT", val, STR_SIZE, - "113"); - keytable[KEY_TUX_LEFT_SHOOT] = atoi(val); - loadValueFromConfigFile(configFile, "TUX_LEFT_SWITCH_WEAPON", val, - STR_SIZE, "9"); - keytable[KEY_TUX_LEFT_SWITCH_WEAPON] = atoi(val); - } void - + playMusic("menu", MUSIC_GROUP_BASE); + +#endif +} +static void setKeytableFromConfigFile(textFile_t * configFile) +{ + +char val[STR_SIZE]; + + +loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_UP", val, STR_SIZE, + "273"); + +keytable[KEY_TUX_RIGHT_MOVE_UP] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_RIGHT", val, + STR_SIZE, "275"); + +keytable[KEY_TUX_RIGHT_MOVE_RIGHT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_LEFT", val, STR_SIZE, + "276"); + +keytable[KEY_TUX_RIGHT_MOVE_LEFT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_DOWN", val, STR_SIZE, + "274"); + +keytable[KEY_TUX_RIGHT_MOVE_DOWN] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_RIGHT_SHOOT", val, STR_SIZE, + "48"); + +keytable[KEY_TUX_RIGHT_SHOOT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_RIGHT_SWITCH_WEAPON", val, + STR_SIZE, "49"); + +keytable[KEY_TUX_RIGHT_SWITCH_WEAPON] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_UP", val, STR_SIZE, + "119"); + +keytable[KEY_TUX_LEFT_MOVE_UP] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_RIGHT", val, STR_SIZE, + "100"); + +keytable[KEY_TUX_LEFT_MOVE_RIGHT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_LEFT", val, STR_SIZE, + "97"); + +keytable[KEY_TUX_LEFT_MOVE_LEFT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_MOVE_DOWN", val, STR_SIZE, + "115"); + +keytable[KEY_TUX_LEFT_MOVE_DOWN] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_SHOOT", val, STR_SIZE, + "113"); + +keytable[KEY_TUX_LEFT_SHOOT] = atoi(val); + +loadValueFromConfigFile(configFile, "TUX_LEFT_SWITCH_WEAPON", val, + STR_SIZE, "9"); + +keytable[KEY_TUX_LEFT_SWITCH_WEAPON] = atoi(val); + +} +void + initKeyTable() -{ - char path[STR_PATH_SIZE]; +{ + +char path[STR_PATH_SIZE]; /* int i; */ - sprintf(path, "%s/keycontrol.conf", getHomeDirector()); - keycontrolFile = loadTextFile(path); - if (keycontrolFile == NULL) { - fprintf(stderr, _("I was unable to load file: %s\n"), path); - fprintf(stderr, _("I try to create file: %s\n"), path); - keycontrolFile = newTextFile(path); - } - if (keycontrolFile == NULL) { - fprintf(stderr, _("I was unable to create file: %s\n"), path); - return; - } - setKeytableFromConfigFile(keycontrolFile); + sprintf(path, "%s/keycontrol.conf", getHomeDirector()); + +keycontrolFile = loadTextFile(path); + +if (keycontrolFile == NULL) { + +fprintf(stderr, _("I was unable to load file: %s\n"), path); + +fprintf(stderr, _("I try to create file: %s\n"), path); + +keycontrolFile = newTextFile(path); + +} + +if (keycontrolFile == NULL) { + +fprintf(stderr, _("I was unable to create file: %s\n"), path); + +return; + +} + +setKeytableFromConfigFile(keycontrolFile); /* for( i = 0 ; i < KEY_LENGTH ; i++) @@ -141,71 +187,123 @@ static widget_t *tux_right_keyup_val; printf("keytable[%d] = %d\n", i, keytable[i]); } */ -} - int getKey(int n) -{ +} + +int getKey(int n) +{ // printf("keytable[n] = %d\n", keytable[n]); - return keytable[n]; - } - void drawScreenSettingKeys() -{ - drawWidgetImage(image_backgorund); - drawWidgetButton(button_back); + return keytable[n]; + +} + +void drawScreenSettingKeys() +{ + +drawWidgetImage(image_backgorund); + +drawWidgetButton(button_back); // key names - drawWidgetLabel(tux_right); - drawWidgetLabel(tux_left); - drawWidgetLabel(tux_right_keyup); - drawWidgetLabel(tux_right_keydown); - drawWidgetLabel(tux_right_keyleft); - drawWidgetLabel(tux_right_keyright); - drawWidgetLabel(tux_right_keyswitch); - drawWidgetLabel(tux_right_keyfire); - drawWidgetLabel(tux_left_keyup); - drawWidgetLabel(tux_left_keydown); - drawWidgetLabel(tux_left_keyleft); - drawWidgetLabel(tux_left_keyright); - drawWidgetLabel(tux_left_keyswitch); - drawWidgetLabel(tux_left_keyfire); + drawWidgetLabel(tux_right); + +drawWidgetLabel(tux_left); + +drawWidgetLabel(tux_right_keyup); + +drawWidgetLabel(tux_right_keydown); + +drawWidgetLabel(tux_right_keyleft); + +drawWidgetLabel(tux_right_keyright); + +drawWidgetLabel(tux_right_keyswitch); + +drawWidgetLabel(tux_right_keyfire); + +drawWidgetLabel(tux_left_keyup); + +drawWidgetLabel(tux_left_keydown); + +drawWidgetLabel(tux_left_keyleft); + +drawWidgetLabel(tux_left_keyright); + +drawWidgetLabel(tux_left_keyswitch); + +drawWidgetLabel(tux_left_keyfire); // key values - drawWidgetCatchkey(tux_right_keyup_val); - drawWidgetCatchkey(tux_right_keydown_val); - drawWidgetCatchkey(tux_right_keyleft_val); - drawWidgetCatchkey(tux_right_keyright_val); - drawWidgetCatchkey(tux_right_keyswitch_val); - drawWidgetCatchkey(tux_right_keyfire_val); - drawWidgetCatchkey(tux_left_keyup_val); - drawWidgetCatchkey(tux_left_keydown_val); - drawWidgetCatchkey(tux_left_keyleft_val); - drawWidgetCatchkey(tux_left_keyright_val); - drawWidgetCatchkey(tux_left_keyswitch_val); - drawWidgetCatchkey(tux_left_keyfire_val); - } static void - + drawWidgetCatchkey(tux_right_keyup_val); + +drawWidgetCatchkey(tux_right_keydown_val); + +drawWidgetCatchkey(tux_right_keyleft_val); + +drawWidgetCatchkey(tux_right_keyright_val); + +drawWidgetCatchkey(tux_right_keyswitch_val); + +drawWidgetCatchkey(tux_right_keyfire_val); + +drawWidgetCatchkey(tux_left_keyup_val); + +drawWidgetCatchkey(tux_left_keydown_val); + +drawWidgetCatchkey(tux_left_keyleft_val); + +drawWidgetCatchkey(tux_left_keyright_val); + +drawWidgetCatchkey(tux_left_keyswitch_val); + +drawWidgetCatchkey(tux_left_keyfire_val); + +} +static void + refreshKeytable() -{ - keytable[6] = getWidgetCatchKey(tux_left_keyup_val); - keytable[9] = getWidgetCatchKey(tux_left_keydown_val); - keytable[8] = getWidgetCatchKey(tux_left_keyleft_val); - keytable[7] = getWidgetCatchKey(tux_left_keyright_val); - keytable[10] = getWidgetCatchKey(tux_left_keyfire_val); - keytable[11] = getWidgetCatchKey(tux_left_keyswitch_val); - keytable[0] = getWidgetCatchKey(tux_right_keyup_val); - keytable[3] = getWidgetCatchKey(tux_right_keydown_val); - keytable[2] = getWidgetCatchKey(tux_right_keyleft_val); - keytable[1] = getWidgetCatchKey(tux_right_keyright_val); - keytable[4] = getWidgetCatchKey(tux_right_keyfire_val); - keytable[5] = getWidgetCatchKey(tux_right_keyswitch_val); - } static void eventWidget(void *p) -{ - widget_t * button; - widget_t * catcher; - button = (widget_t *) (p); - catcher = (widget_t *) (p); - if (button == button_back) - setScreen("setting"); +{ + +keytable[6] = getWidgetCatchKey(tux_left_keyup_val); + +keytable[9] = getWidgetCatchKey(tux_left_keydown_val); + +keytable[8] = getWidgetCatchKey(tux_left_keyleft_val); + +keytable[7] = getWidgetCatchKey(tux_left_keyright_val); + +keytable[10] = getWidgetCatchKey(tux_left_keyfire_val); + +keytable[11] = getWidgetCatchKey(tux_left_keyswitch_val); + +keytable[0] = getWidgetCatchKey(tux_right_keyup_val); + +keytable[3] = getWidgetCatchKey(tux_right_keydown_val); + +keytable[2] = getWidgetCatchKey(tux_right_keyleft_val); + +keytable[1] = getWidgetCatchKey(tux_right_keyright_val); + +keytable[4] = getWidgetCatchKey(tux_right_keyfire_val); + +keytable[5] = getWidgetCatchKey(tux_right_keyswitch_val); + +} +static void eventWidget(void *p) +{ + +widget_t * button; + +widget_t * catcher; + + +button = (widget_t *) (p); + +catcher = (widget_t *) (p); + +if (button == button_back) + +setScreen("setting"); //events on value if ((catcher == tux_left_keyup_val) || @@ -219,203 +317,264 @@ static widget_t *tux_right_keyup_val; (catcher == tux_right_keyleft_val) || (catcher == tux_right_keyright_val) || (catcher == tux_right_keyswitch_val) || - (catcher == tux_right_keyfire_val)) { + (catcher == tux_right_keyfire_val)) { // draw press any key picture //this will be done by widget catchkey // check if there is no other key with new value (what to revert if yes?) - refreshKeytable(); - } - } - void eventScreenSettingKeys() -{ - eventWidgetButton(button_back); - eventWidgetCatchkey(tux_right_keyup_val); - eventWidgetCatchkey(tux_right_keydown_val); - eventWidgetCatchkey(tux_right_keyleft_val); - eventWidgetCatchkey(tux_right_keyright_val); - eventWidgetCatchkey(tux_right_keyswitch_val); - eventWidgetCatchkey(tux_right_keyfire_val); - eventWidgetCatchkey(tux_left_keyup_val); - eventWidgetCatchkey(tux_left_keydown_val); - eventWidgetCatchkey(tux_left_keyleft_val); - eventWidgetCatchkey(tux_left_keyright_val); - eventWidgetCatchkey(tux_left_keyswitch_val); - eventWidgetCatchkey(tux_left_keyfire_val); - } void - + refreshKeytable(); + +} + +} + +void eventScreenSettingKeys() +{ + +eventWidgetButton(button_back); + +eventWidgetCatchkey(tux_right_keyup_val); + +eventWidgetCatchkey(tux_right_keydown_val); + +eventWidgetCatchkey(tux_right_keyleft_val); + +eventWidgetCatchkey(tux_right_keyright_val); + +eventWidgetCatchkey(tux_right_keyswitch_val); + +eventWidgetCatchkey(tux_right_keyfire_val); + +eventWidgetCatchkey(tux_left_keyup_val); + +eventWidgetCatchkey(tux_left_keydown_val); + +eventWidgetCatchkey(tux_left_keyleft_val); + +eventWidgetCatchkey(tux_left_keyright_val); + +eventWidgetCatchkey(tux_left_keyswitch_val); + +eventWidgetCatchkey(tux_left_keyfire_val); + +} +void + stopScreenSettingKeys() -{ - } void - +{ + +} +void + initScreenSettingKeys() -{ - image_t * image; - initKeyTable(); - image = getImage(IMAGE_GROUP_BASE, "screen_main"); - image_backgorund = newWidgetImage(0, 0, image); - button_back = - newWidgetButton(_("Back"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, - eventWidget); - tux_left = - newWidgetLabel(_("Player 2"), WINDOW_SIZE_X / 4, 150, - WIDGET_LABEL_CENTER); - tux_left_keyup = - newWidgetLabel(_("Up"), 50, tux_left->y + 50, WIDGET_LABEL_LEFT); - tux_left_keydown = - newWidgetLabel(_("Down:"), tux_left_keyup->x, tux_left_keyup->y + 20, - WIDGET_LABEL_LEFT); - tux_left_keyleft = - newWidgetLabel(_("Left:"), tux_left_keyup->x, - tux_left_keydown->y + 20, WIDGET_LABEL_LEFT); - tux_left_keyright = - newWidgetLabel(_("Right:"), tux_left_keyup->x, - tux_left_keyleft->y + 20, WIDGET_LABEL_LEFT); - tux_left_keyfire = - newWidgetLabel(_("Fire gun:"), tux_left_keyup->x, - tux_left_keyright->y + 20, WIDGET_LABEL_LEFT); - tux_left_keyswitch = - newWidgetLabel(_("Switch gun:"), tux_left_keyup->x, - tux_left_keyfire->y + 20, WIDGET_LABEL_LEFT); - tux_right = - newWidgetLabel(_("Player 1"), WINDOW_SIZE_X / 2 + WINDOW_SIZE_X / 4, - tux_left->y, WIDGET_LABEL_CENTER); - tux_right_keyup = - newWidgetLabel(_("Up:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_left->y + 50, WIDGET_LABEL_LEFT); - tux_right_keydown = - newWidgetLabel(_("Down:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_left_keyup->y + 20, WIDGET_LABEL_LEFT); - tux_right_keyleft = - newWidgetLabel(_("Left:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_right_keydown->y + 20, WIDGET_LABEL_LEFT); - tux_right_keyright = - newWidgetLabel(_("Right:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_right_keyleft->y + 20, WIDGET_LABEL_LEFT); - tux_right_keyfire = - newWidgetLabel(_("Fire gun:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_left_keyright->y + 20, WIDGET_LABEL_LEFT); - tux_right_keyswitch = - newWidgetLabel(_("Switch gun:"), - WINDOW_SIZE_X / 2 + tux_left_keyup->x, - tux_left_keyfire->y + 20, WIDGET_LABEL_LEFT); - tux_left_keyup_val = - newWidgetCatchkey(keytable[6], tux_left_keyup->x + 200, - tux_left->y + 50, eventWidget); - tux_left_keydown_val = - newWidgetCatchkey(keytable[9], tux_left_keyup_val->x, - tux_left_keyup->y + 20, eventWidget); - tux_left_keyleft_val = - newWidgetCatchkey(keytable[8], tux_left_keyup_val->x, - tux_left_keydown->y + 20, eventWidget); - tux_left_keyright_val = - newWidgetCatchkey(keytable[7], tux_left_keyup_val->x, - tux_left_keyleft->y + 20, eventWidget); - tux_left_keyfire_val = - newWidgetCatchkey(keytable[10], tux_left_keyup_val->x, - tux_left_keyright->y + 20, eventWidget); - tux_left_keyswitch_val = - newWidgetCatchkey(keytable[11], tux_left_keyup_val->x, - tux_left_keyfire->y + 20, eventWidget); - tux_right_keyup_val = - newWidgetCatchkey(keytable[0], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_left->y + 50, eventWidget); - tux_right_keydown_val = - newWidgetCatchkey(keytable[3], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_left_keyup->y + 20, eventWidget); - tux_right_keyleft_val = - newWidgetCatchkey(keytable[2], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_right_keydown->y + 20, eventWidget); - tux_right_keyright_val = - newWidgetCatchkey(keytable[1], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_right_keyleft->y + 20, eventWidget); - tux_right_keyfire_val = - newWidgetCatchkey(keytable[4], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_left_keyright->y + 20, eventWidget); - tux_right_keyswitch_val = - newWidgetCatchkey(keytable[5], - WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, - tux_left_keyfire->y + 20, eventWidget); - registerScreen(newScreen - ("settingKeys", startScreenSettingKeys, - eventScreenSettingKeys, drawScreenSettingKeys, - stopScreenSettingKeys)); - } void - - quitKeyTable() -{ - destroyTextFile(keycontrolFile); - } void - - saveKeyTable(textFile_t * configFile) -{ - char str[STR_SIZE]; - sprintf(str, "%d", getWidgetCatchKey(tux_left_keyup_val)); - setValueInConfigFile(configFile, "TUX_LEFT_MOVE_UP", str); - sprintf(str, "%d", getWidgetCatchKey(tux_left_keydown_val)); - setValueInConfigFile(configFile, "TUX_LEFT_MOVE_DOWN", str); - sprintf(str, "%d", getWidgetCatchKey(tux_left_keyleft_val)); - setValueInConfigFile(configFile, "TUX_LEFT_MOVE_LEFT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_left_keyright_val)); - setValueInConfigFile(configFile, "TUX_LEFT_MOVE_RIGHT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_left_keyfire_val)); - setValueInConfigFile(configFile, "TUX_LEFT_SHOOT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_left_keyswitch_val)); - setValueInConfigFile(configFile, "TUX_LEFT_SWITCH_WEAPON", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keyup_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_UP", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keydown_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_DOWN", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keyleft_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_LEFT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keyright_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_RIGHT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keyfire_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_SHOOT", str); - sprintf(str, "%d", getWidgetCatchKey(tux_right_keyswitch_val)); - setValueInConfigFile(configFile, "TUX_RIGHT_SWITCH_WEAPON", str); - saveTextFile(configFile); - } void - - quitScreenSettingKeys() -{ - saveKeyTable(keycontrolFile); - quitKeyTable(); +{ - // key names - destroyWidgetImage(image_backgorund); - destroyWidgetLabel(tux_right); - destroyWidgetLabel(tux_left); - destroyWidgetLabel(tux_right_keyup); - destroyWidgetLabel(tux_right_keydown); - destroyWidgetLabel(tux_right_keyleft); - destroyWidgetLabel(tux_right_keyright); - destroyWidgetLabel(tux_right_keyswitch); - destroyWidgetLabel(tux_right_keyfire); - destroyWidgetLabel(tux_left_keyup); - destroyWidgetLabel(tux_left_keydown); - destroyWidgetLabel(tux_left_keyright); - destroyWidgetLabel(tux_left_keyleft); - destroyWidgetLabel(tux_left_keyswitch); - destroyWidgetLabel(tux_left_keyfire); +image_t * image; - // key values - destroyWidgetCatchkey(tux_right_keyup_val); - destroyWidgetCatchkey(tux_right_keydown_val); - destroyWidgetCatchkey(tux_right_keyleft_val); - destroyWidgetCatchkey(tux_right_keyright_val); - destroyWidgetCatchkey(tux_right_keyswitch_val); - destroyWidgetCatchkey(tux_right_keyfire_val); - destroyWidgetCatchkey(tux_left_keyup_val); - destroyWidgetCatchkey(tux_left_keydown_val); - destroyWidgetCatchkey(tux_left_keyleft_val); - destroyWidgetCatchkey(tux_left_keyright_val); - destroyWidgetCatchkey(tux_left_keyswitch_val); - destroyWidgetCatchkey(tux_left_keyfire_val); - destroyWidgetButton(button_back); - } + +initKeyTable(); + +image = getImage(IMAGE_GROUP_BASE, "screen_main"); + +image_backgorund = newWidgetImage(0, 0, image); + +button_back = + newWidgetButton(_("Back"), WINDOW_SIZE_X - 200, WINDOW_SIZE_Y - 100, + eventWidget); + +tux_left = + newWidgetLabel(_("Player 2"), WINDOW_SIZE_X / 4, 150, + WIDGET_LABEL_CENTER); + +tux_left_keyup = + newWidgetLabel(_("Up"), 50, tux_left->y + 50, WIDGET_LABEL_LEFT); + +tux_left_keydown = + newWidgetLabel(_("Down:"), tux_left_keyup->x, tux_left_keyup->y + 20, + WIDGET_LABEL_LEFT); + +tux_left_keyleft = + newWidgetLabel(_("Left:"), tux_left_keyup->x, + tux_left_keydown->y + 20, WIDGET_LABEL_LEFT); + +tux_left_keyright = + newWidgetLabel(_("Right:"), tux_left_keyup->x, + tux_left_keyleft->y + 20, WIDGET_LABEL_LEFT); + +tux_left_keyfire = + newWidgetLabel(_("Fire gun:"), tux_left_keyup->x, + tux_left_keyright->y + 20, WIDGET_LABEL_LEFT); + +tux_left_keyswitch = + newWidgetLabel(_("Switch gun:"), tux_left_keyup->x, + tux_left_keyfire->y + 20, WIDGET_LABEL_LEFT); + +tux_right = + newWidgetLabel(_("Player 1"), WINDOW_SIZE_X / 2 + WINDOW_SIZE_X / 4, + tux_left->y, WIDGET_LABEL_CENTER); + +tux_right_keyup = + newWidgetLabel(_("Up:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_left->y + 50, WIDGET_LABEL_LEFT); + +tux_right_keydown = + newWidgetLabel(_("Down:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_left_keyup->y + 20, WIDGET_LABEL_LEFT); + +tux_right_keyleft = + newWidgetLabel(_("Left:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_right_keydown->y + 20, WIDGET_LABEL_LEFT); + +tux_right_keyright = + newWidgetLabel(_("Right:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_right_keyleft->y + 20, WIDGET_LABEL_LEFT); + +tux_right_keyfire = + newWidgetLabel(_("Fire gun:"), WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_left_keyright->y + 20, WIDGET_LABEL_LEFT); + +tux_right_keyswitch = + newWidgetLabel(_("Switch gun:"), + WINDOW_SIZE_X / 2 + tux_left_keyup->x, + tux_left_keyfire->y + 20, WIDGET_LABEL_LEFT); + +tux_left_keyup_val = + newWidgetCatchkey(keytable[6], tux_left_keyup->x + 200, + tux_left->y + 50, eventWidget); + +tux_left_keydown_val = + newWidgetCatchkey(keytable[9], tux_left_keyup_val->x, + tux_left_keyup->y + 20, eventWidget); + +tux_left_keyleft_val = + newWidgetCatchkey(keytable[8], tux_left_keyup_val->x, + tux_left_keydown->y + 20, eventWidget); + +tux_left_keyright_val = + newWidgetCatchkey(keytable[7], tux_left_keyup_val->x, + tux_left_keyleft->y + 20, eventWidget); + +tux_left_keyfire_val = + newWidgetCatchkey(keytable[10], tux_left_keyup_val->x, + tux_left_keyright->y + 20, eventWidget); + +tux_left_keyswitch_val = + newWidgetCatchkey(keytable[11], tux_left_keyup_val->x, + tux_left_keyfire->y + 20, eventWidget); + +tux_right_keyup_val = + newWidgetCatchkey(keytable[0], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_left->y + 50, eventWidget); + +tux_right_keydown_val = + newWidgetCatchkey(keytable[3], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_left_keyup->y + 20, eventWidget); + +tux_right_keyleft_val = + newWidgetCatchkey(keytable[2], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_right_keydown->y + 20, eventWidget); + +tux_right_keyright_val = + newWidgetCatchkey(keytable[1], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_right_keyleft->y + 20, eventWidget); + +tux_right_keyfire_val = + newWidgetCatchkey(keytable[4], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_left_keyright->y + 20, eventWidget); + +tux_right_keyswitch_val = + newWidgetCatchkey(keytable[5], + WINDOW_SIZE_X / 2 + tux_left_keyup_val->x, + tux_left_keyfire->y + 20, eventWidget); + +registerScreen(newScreen + ("settingKeys", startScreenSettingKeys, + eventScreenSettingKeys, +drawScreenSettingKeys, + stopScreenSettingKeys)); + +} + +void quitKeyTable() +{ + destroyTextFile(keycontrolFile); +} + +void saveKeyTable(textFile_t * configFile) +{ + char str[STR_SIZE]; + + sprintf(str, "%d", getWidgetCatchKey(tux_left_keyup_val)); + setValueInConfigFile(configFile, "TUX_LEFT_MOVE_UP", str); + sprintf(str, "%d", getWidgetCatchKey(tux_left_keydown_val)); + setValueInConfigFile(configFile, "TUX_LEFT_MOVE_DOWN", str); + sprintf(str, "%d", getWidgetCatchKey(tux_left_keyleft_val)); + setValueInConfigFile(configFile, "TUX_LEFT_MOVE_LEFT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_left_keyright_val)); + setValueInConfigFile(configFile, "TUX_LEFT_MOVE_RIGHT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_left_keyfire_val)); + setValueInConfigFile(configFile, "TUX_LEFT_SHOOT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_left_keyswitch_val)); + setValueInConfigFile(configFile, "TUX_LEFT_SWITCH_WEAPON", str); + + sprintf(str, "%d", getWidgetCatchKey(tux_right_keyup_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_UP", str); + sprintf(str, "%d", getWidgetCatchKey(tux_right_keydown_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_DOWN", str); + sprintf(str, "%d", getWidgetCatchKey(tux_right_keyleft_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_LEFT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_right_keyright_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_MOVE_RIGHT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_right_keyfire_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_SHOOT", str); + sprintf(str, "%d", getWidgetCatchKey(tux_right_keyswitch_val)); + setValueInConfigFile(configFile, "TUX_RIGHT_SWITCH_WEAPON", str); + + saveTextFile(configFile); +} + +void quitScreenSettingKeys() +{ + saveKeyTable(keycontrolFile); + quitKeyTable(); + + // key names + destroyWidgetImage(image_backgorund); + + destroyWidgetLabel(tux_right); + destroyWidgetLabel(tux_left); + destroyWidgetLabel(tux_right_keyup); + destroyWidgetLabel(tux_right_keydown); + destroyWidgetLabel(tux_right_keyleft); + destroyWidgetLabel(tux_right_keyright); + destroyWidgetLabel(tux_right_keyswitch); + destroyWidgetLabel(tux_right_keyfire); + destroyWidgetLabel(tux_left_keyup); + destroyWidgetLabel(tux_left_keydown); + destroyWidgetLabel(tux_left_keyright); + destroyWidgetLabel(tux_left_keyleft); + destroyWidgetLabel(tux_left_keyswitch); + destroyWidgetLabel(tux_left_keyfire); + + // key values + destroyWidgetCatchkey(tux_right_keyup_val); + + destroyWidgetCatchkey(tux_right_keydown_val); + destroyWidgetCatchkey(tux_right_keyleft_val); + destroyWidgetCatchkey(tux_right_keyright_val); + destroyWidgetCatchkey(tux_right_keyswitch_val); + destroyWidgetCatchkey(tux_right_keyfire_val); + destroyWidgetCatchkey(tux_left_keyup_val); + destroyWidgetCatchkey(tux_left_keydown_val); + destroyWidgetCatchkey(tux_left_keyleft_val); + destroyWidgetCatchkey(tux_left_keyright_val); + destroyWidgetCatchkey(tux_left_keyswitch_val); + destroyWidgetCatchkey(tux_left_keyfire_val); + destroyWidgetButton(button_back); +} + diff --git a/src/screen/screen_table.c b/src/screen/screen_table.c index f78d97c..5d4b3a4 100644 --- a/src/screen/screen_table.c +++ b/src/screen/screen_table.c @@ -90,14 +90,14 @@ static void setWidgetLabel() int i; if (textFile == NULL) { - fprintf(stderr, _("Highscore file: \"%s\" was not loaded!"), - SCREEN_TABLE_FILE_HIGHSCORE_NAME); + fprintf(stderr, _("Highscore file: \"%s\" was not loaded!"), SCREEN_TABLE_FILE_HIGHSCORE_NAME); return; } if (listWidgetLabelNumer != NULL || - listWidgetLabelName != NULL || listWidgetLabelScore != NULL) { + listWidgetLabelName != NULL || + listWidgetLabelScore != NULL) { destroyListItem(listWidgetLabelNumer, destroyWidgetLabel); destroyListItem(listWidgetLabelName, destroyWidgetLabel); destroyListItem(listWidgetLabelScore, destroyWidgetLabel); @@ -119,19 +119,13 @@ static void setWidgetLabel() sscanf(line, "%s %s", name, score); sprintf(num, "%2d)", i + 1); - label = - newWidgetLabel(num, WINDOW_SIZE_X / 2 - 100, 200 + i * 20, - WIDGET_LABEL_LEFT); + label = newWidgetLabel(num, WINDOW_SIZE_X / 2 - 100, 200 + i * 20, WIDGET_LABEL_LEFT); addList(listWidgetLabelNumer, label); - label = - newWidgetLabel(name, WINDOW_SIZE_X / 2, 200 + i * 20, - WIDGET_LABEL_CENTER); + label = newWidgetLabel(name, WINDOW_SIZE_X / 2, 200 + i * 20, WIDGET_LABEL_CENTER); addList(listWidgetLabelName, label); - label = - newWidgetLabel(score, WINDOW_SIZE_X / 2 + 80, 200 + i * 20, - WIDGET_LABEL_LEFT); + label = newWidgetLabel(score, WINDOW_SIZE_X / 2 + 80, 200 + i * 20, WIDGET_LABEL_LEFT); addList(listWidgetLabelScore, label); } } @@ -195,15 +189,11 @@ void initScreenTable() { image_t *image; - image = - addImageData("screen_table.png", IMAGE_NO_ALPHA, "screen_table", - IMAGE_GROUP_BASE); + image = addImageData("screen_table.png", IMAGE_NO_ALPHA, "screen_table", IMAGE_GROUP_BASE); image_backgorund = newWidgetImage(0, 0, image); - button_back = - newWidgetButton(_("back"), - WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, - WINDOW_SIZE_Y - 100, eventWidget); + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, + WINDOW_SIZE_Y - 100, eventWidget); loadHighscoreFile(); listWidgetLabelNumer = NULL; @@ -211,8 +201,7 @@ void initScreenTable() listWidgetLabelScore = NULL; setWidgetLabel(); - registerScreen(newScreen("table", startScreenTable, eventScreenTable, - drawScreenTable, stopScreenTable)); + registerScreen(newScreen("table", startScreenTable, eventScreenTable, drawScreenTable, stopScreenTable)); } void quitScreenTable() diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c index 08cfa82..8f2f6d2 100644 --- a/src/screen/screen_world.c +++ b/src/screen/screen_world.c @@ -62,9 +62,8 @@ void setGameType() { int ret = 0; - ret = - initNetMuliplayer(getSettingGameType(), getSettingIP(), - getSettingPort(), getSettingProto()); + ret = initNetMuliplayer(getSettingGameType(), getSettingIP(), + getSettingPort(), getSettingProto()); if (ret != 0) { fprintf(stderr, _("Network initialization error!\n")); @@ -109,8 +108,7 @@ void countRoundInc() #ifndef NO_SOUND playSound("end", SOUND_GROUP_BASE); #endif - addTaskToTimer(getCurrentArena()->listTimer, TIMER_ONE, - timer_endArena, NULL, TIMER_END_ARENA); + addTaskToTimer(getCurrentArena()->listTimer, TIMER_ONE, timer_endArena, NULL, TIMER_END_ARENA); } } @@ -220,10 +218,13 @@ static void control_keyboard_right(tux_t * tux) if (mapa[(SDLKey) getKey(KEY_TUX_RIGHT_MOVE_UP)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_RIGHT_MOVE_RIGHT)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_RIGHT_MOVE_LEFT)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_RIGHT_MOVE_DOWN)] == SDL_PRESSED) countKey++; @@ -309,10 +310,13 @@ static void control_keyboard_left(tux_t * tux) if (mapa[(SDLKey) getKey(KEY_TUX_LEFT_MOVE_UP)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_LEFT_MOVE_RIGHT)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_LEFT_MOVE_LEFT)] == SDL_PRESSED) countKey++; + if (mapa[(SDLKey) getKey(KEY_TUX_LEFT_MOVE_DOWN)] == SDL_PRESSED) countKey++; @@ -390,12 +394,12 @@ static void eventEnd() tux_t *getControlTux(int control_type) { switch (control_type) { - case TUX_CONTROL_KEYBOARD_RIGHT: - return tuxWithControlRightKeyboard; - break; - case TUX_CONTROL_KEYBOARD_LEFT: - return tuxWithControlLeftKeyboard; - break; + case TUX_CONTROL_KEYBOARD_RIGHT: + return tuxWithControlRightKeyboard; + break; + case TUX_CONTROL_KEYBOARD_LEFT: + return tuxWithControlLeftKeyboard; + break; } return NULL; @@ -404,12 +408,12 @@ tux_t *getControlTux(int control_type) void setControlTux(tux_t * tux, int control_type) { switch (control_type) { - case TUX_CONTROL_KEYBOARD_RIGHT: - tuxWithControlRightKeyboard = tux; - break; - case TUX_CONTROL_KEYBOARD_LEFT: - tuxWithControlLeftKeyboard = tux; - break; + case TUX_CONTROL_KEYBOARD_RIGHT: + tuxWithControlRightKeyboard = tux; + break; + case TUX_CONTROL_KEYBOARD_LEFT: + tuxWithControlLeftKeyboard = tux; + break; } } @@ -422,21 +426,21 @@ void tuxControl(tux_t * p) } switch (p->control) { - case TUX_CONTROL_NONE: - assert(!_("Tux has not defined controls!")); - break; - - case TUX_CONTROL_KEYBOARD_LEFT: - if (isChatActive() == FALSE) { - control_keyboard_left(p); - } - break; - - case TUX_CONTROL_KEYBOARD_RIGHT: - if (isChatActive() == FALSE) { - control_keyboard_right(p); - } - break; + case TUX_CONTROL_NONE: + assert(!_("Tux has not defined controls!")); + break; + + case TUX_CONTROL_KEYBOARD_LEFT: + if (isChatActive() == FALSE) { + control_keyboard_left(p); + } + break; + + case TUX_CONTROL_KEYBOARD_RIGHT: + if (isChatActive() == FALSE) { + control_keyboard_right(p); + } + break; } } -- cgit v1.2.3