From 737559ce0cdfbae2b6918659961eb6a3676a10ad Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 16 Jan 2011 22:27:43 +0100 Subject: [PATCH] fix some errors --- qcsrc/menu/menu.qc | 6 +- qcsrc/menu/xonotic/dialog_hudpanel_ammo.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_chat.c | 1 - .../menu/xonotic/dialog_hudpanel_engineinfo.c | 1 - .../xonotic/dialog_hudpanel_healtharmor.c | 1 - .../xonotic/dialog_hudpanel_infomessages.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_modicons.c | 1 - .../xonotic/dialog_hudpanel_notification.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_powerups.c | 1 - .../xonotic/dialog_hudpanel_pressedkeys.c | 1 - .../menu/xonotic/dialog_hudpanel_racetimer.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_radar.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_score.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_timer.c | 1 - qcsrc/menu/xonotic/dialog_hudpanel_vote.c | 1 - qcsrc/menu/xonotic/skinlist.c | 2 +- qcsrc/menu/xonotic/util.qc | 59 +++++++++++++++++++ qcsrc/menu/xonotic/util.qh | 56 +----------------- 18 files changed, 66 insertions(+), 71 deletions(-) diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 2a8a7a11f..fbdbdd2e7 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -115,18 +115,18 @@ void() m_init_delayed = if(cvar_string("menu_skin") != "") { draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin")); - fh = fopen(language_file(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); + fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); } if(fh < 0) if(cvar_defstring("menu_skin") != "") { draw_currentSkin = strcat("gfx/menu/", cvar_defstring("menu_skin")); - fh = fopen(language_file(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); + fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); } if(fh < 0) { draw_currentSkin = "gfx/menu/default"; - fh = fopen(language_file(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); + fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ); } draw_currentSkin = strzone(draw_currentSkin); while((s = fgets(fh))) diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c b/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c index e78c38e44..299ea09fd 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c @@ -15,7 +15,6 @@ void XonoticHUDAmmoDialog_fill(entity me) { entity e; string panelname = "ammo"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_chat.c b/qcsrc/menu/xonotic/dialog_hudpanel_chat.c index 0669a1086..331b0ee9a 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_chat.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_chat.c @@ -15,7 +15,6 @@ void XonoticHUDChatDialog_fill(entity me) { entity e; string panelname = "chat"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c b/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c index e6e9cce57..b69a5869e 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c @@ -15,7 +15,6 @@ void XonoticHUDEngineInfoDialog_fill(entity me) { entity e; string panelname = "engineinfo"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c index 404e7bb65..91da57cdf 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c @@ -15,7 +15,6 @@ void XonoticHUDHealthArmorDialog_fill(entity me) { entity e; string panelname = "healtharmor"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c b/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c index 187b9181d..44b20294b 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c @@ -15,7 +15,6 @@ void XonoticHUDInfoMessagesDialog_fill(entity me) { entity e; string panelname = "infomessages"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c b/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c index 05ec1f5b8..fd5d233dc 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c @@ -15,7 +15,6 @@ void XonoticHUDModIconsDialog_fill(entity me) { entity e; string panelname = "modicons"; - float i; DIALOG_HUDPANEL_COMMON(); } diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_notification.c b/qcsrc/menu/xonotic/dialog_hudpanel_notification.c index 59590e32b..1f26ab34a 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_notification.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_notification.c @@ -15,7 +15,6 @@ void XonoticHUDNotificationDialog_fill(entity me) { entity e; string panelname = "notify"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c b/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c index 54f5ee2eb..e63e78552 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c @@ -15,7 +15,6 @@ void XonoticHUDPowerupsDialog_fill(entity me) { entity e; string panelname = "powerups"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c b/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c index ad7cae5c2..bbddb7fc1 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c @@ -15,7 +15,6 @@ void XonoticHUDPressedKeysDialog_fill(entity me) { entity e; string panelname = "pressedkeys"; - float i; me.TR(me); me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_panel_pressedkeys")); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c b/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c index ee12b8d9c..015979b21 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c @@ -15,7 +15,6 @@ void XonoticHUDRaceTimerDialog_fill(entity me) { entity e; string panelname = "racetimer"; - float i; DIALOG_HUDPANEL_COMMON(); } diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_radar.c b/qcsrc/menu/xonotic/dialog_hudpanel_radar.c index 03c17025d..5a43bbdf6 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_radar.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_radar.c @@ -15,7 +15,6 @@ void XonoticHUDRadarDialog_fill(entity me) { entity e; string panelname = "radar"; - float i; me.TR(me); me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_panel_radar")); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_score.c b/qcsrc/menu/xonotic/dialog_hudpanel_score.c index 785c20ca0..ccb8d9528 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_score.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_score.c @@ -15,7 +15,6 @@ void XonoticHUDScoreDialog_fill(entity me) { entity e; string panelname = "score"; - float i; DIALOG_HUDPANEL_COMMON(); } diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_timer.c b/qcsrc/menu/xonotic/dialog_hudpanel_timer.c index 99c645cb9..5f2fc5dd7 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_timer.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_timer.c @@ -15,7 +15,6 @@ void XonoticHUDTimerDialog_fill(entity me) { entity e; string panelname = "timer"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_vote.c b/qcsrc/menu/xonotic/dialog_hudpanel_vote.c index eedfb095c..d3d35c22a 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_vote.c +++ b/qcsrc/menu/xonotic/dialog_hudpanel_vote.c @@ -15,7 +15,6 @@ void XonoticHUDVoteDialog_fill(entity me) { entity e; string panelname = "vote"; - float i; DIALOG_HUDPANEL_COMMON(); diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c index a4f733cf5..bb01f974c 100644 --- a/qcsrc/menu/xonotic/skinlist.c +++ b/qcsrc/menu/xonotic/skinlist.c @@ -105,7 +105,7 @@ void XonoticSkinList_getSkins(entity me) bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, _("")); bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, _("<AUTHOR>")); bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")); - fh = fopen(language_file(s), FILE_READ); + fh = fopen(language_filename(s), FILE_READ); if(fh < 0) { print("Warning: can't open skinvalues.txt file\n"); diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 1bb9a0132..4ba4f951e 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -582,3 +582,62 @@ string language_filename(string s) } return s; } + +void dialog_hudpanel_common_notoggle(entity me, string panelname) +{ + float i; + entity e; + + me.TR(me); + me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:"))); + me.TD(me, 1, 1.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg")))); + e.addValue(e, _("Default"), ""); + e.addValue(e, _("Disable"), "0"); + e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname))); + e.configureXonoticTextSliderValues(e); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:"))); + me.TD(me, 2, 2.4, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color")); + setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), ""); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), _("Use default"))); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:"))); + me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border")))); + e.addValue(e, _("Default"), ""); + e.addValue(e, _("Disable"), "0"); + for(i = 1; i <= 10; ++i) + e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2))); + e.configureXonoticTextSliderValues(e); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:"))); + me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha")))); + e.addValue(e, _("Default"), ""); + for(i = 1; i <= 10; ++i) + e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10))); + e.configureXonoticTextSliderValues(e); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team Color:"))); + me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team")))); + e.addValue(e, _("Default"), ""); + e.addValue(e, _("Disable"), "0"); + for(i = 1; i <= 10; ++i) + e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10))); + e.configureXonoticTextSliderValues(e); + me.TR(me); + me.TDempty(me, 0.4); + me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test the team color in HUD configure mode"))); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:"))); + me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding")))); + e.addValue(e, _("Default"), ""); + for(i = 0; i <= 10; ++i) + e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5))); + e.configureXonoticTextSliderValues(e); +} diff --git a/qcsrc/menu/xonotic/util.qh b/qcsrc/menu/xonotic/util.qh index fea001f1d..2cdfe87c7 100644 --- a/qcsrc/menu/xonotic/util.qh +++ b/qcsrc/menu/xonotic/util.qh @@ -41,62 +41,12 @@ float GameType_GetID(float cnt); string GameType_GetName(float cnt); float GameType_GetCount(); +void dialog_hudpanel_common_notoggle(entity me, string panelname); #define DIALOG_HUDPANEL_COMMON_NOTOGGLE() \ - me.TR(me); \ - me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:"))); \ - me.TD(me, 1, 1.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg")))); \ - e.addValue(e, _("Default"), ""); \ - e.addValue(e, _("Disable"), "0"); \ - e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname))); \ - e.configureXonoticTextSliderValues(e); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:"))); \ - me.TD(me, 2, 2.4, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color")); \ - setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), ""); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), _("Use default"))); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:"))); \ - me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border")))); \ - e.addValue(e, _("Default"), ""); \ - e.addValue(e, _("Disable"), "0"); \ - for(i = 1; i <= 10; ++i) \ - e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2))); \ - e.configureXonoticTextSliderValues(e); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:"))); \ - me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha")))); \ - e.addValue(e, _("Default"), ""); \ - for(i = 1; i <= 10; ++i) \ - e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10))); \ - e.configureXonoticTextSliderValues(e); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team Color:"))); \ - me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team")))); \ - e.addValue(e, _("Default"), ""); \ - e.addValue(e, _("Disable"), "0"); \ - for(i = 1; i <= 10; ++i) \ - e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10))); \ - e.configureXonoticTextSliderValues(e); \ - me.TR(me); \ - me.TDempty(me, 0.4); \ - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test the team color in HUD configure mode"))); \ - me.TR(me); \ - me.TDempty(me, 0.2); \ - me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:"))); \ - me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding")))); \ - e.addValue(e, _("Default"), ""); \ - for(i = 0; i <= 10; ++i) \ - e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5))); \ - e.configureXonoticTextSliderValues(e) + dialog_hudpanel_common_notoggle(me, panelname) #define DIALOG_HUDPANEL_COMMON() \ me.TR(me); \ - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", hudpanel)), _("Enable panel"))); \ + me.TD(me, 1, 3, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable panel"))); \ DIALOG_HUDPANEL_COMMON_NOTOGGLE() string language_filename(string s); -- 2.39.2