20 for(j = 0; j < n; ++j)
34 if(--l < 0)
goto toolong;
52 me.configureXonoticCampaignList(me);
57 me.configureXonoticListBox(me);
58 me.campaignGlob =
search_begin(
"maps/campaign*.txt",
true,
true);
65 if(me.campaignGlob >= 0)
80 rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
82 me.setSelected(me,
min(me.campaignIndex, me.nItems - 1));
83 if(me.nItems - 1 > me.campaignIndex)
84 me.scrollToItem(me, me.nItems - 1);
102 if(me.campaignGlob >= 0)
109 for(i = 0; i < n; ++i)
117 for(i = 0; i < n; ++i)
131 j =
mod(j + step, n);
136 me.hasNextCampaign = (j != n - 1);
137 me.hasPrevCampaign = (j != 0);
144 me.campaignGo(me, +1);
148 me.campaignGo(me, -1);
154 me.buttonNext.disabled = !me.hasNextCampaign;
156 me.buttonPrev.disabled = !me.hasPrevCampaign;
165 me.itemAbsSize =
'0 0 0';
168 me.itemAbsSize.y = absSize.y * me.itemHeight;
169 me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
170 me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
171 me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
172 me.realUpperMargin1 = 0.5 * me.realFontSize.y;
173 me.realUpperMargin2 = me.realUpperMargin1 + 2 * me.realFontSize.y;
175 me.checkMarkSize = (
eX * (me.itemAbsSize.y / me.itemAbsSize.x) +
eY) * 0.5;
177 me.columnPreviewOrigin = 0;
178 me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3;
179 me.columnCheckMarkSize = me.checkMarkSize.x;
180 me.columnNameSize = 1 - me.columnPreviewSize - me.columnCheckMarkSize - 4 * me.realFontSize.x;
181 me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x;
182 me.columnCheckMarkOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x * 2;
184 me.checkMarkOrigin =
eY +
eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize;
186 me.typeIconOrigin =
vec3(me.columnPreviewSize - me.checkMarkSize.x, me.checkMarkOrigin.y, 0);
187 me.typeIconSize = me.checkMarkSize;
189 rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
203 if(i < me.campaignIndex)
205 theAlpha = SKINALPHA_CAMPAIGN_SELECTABLE;
206 theColor = SKINCOLOR_CAMPAIGN_SELECTABLE;
208 else if(i == me.campaignIndex)
210 theAlpha = SKINALPHA_CAMPAIGN_CURRENT;
211 theColor = SKINCOLOR_CAMPAIGN_CURRENT;
215 theAlpha = SKINALPHA_CAMPAIGN_FUTURE;
216 theColor = SKINCOLOR_CAMPAIGN_FUTURE;
220 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
223 me.focusedItemAlpha =
getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
224 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
228 draw_Picture(me.columnPreviewOrigin *
eX,
"nopreview_map", me.columnPreviewSize *
eX +
eY,
'1 1 1', theAlpha);
234 draw_Picture(me.typeIconOrigin, s, me.typeIconSize,
'1 1 1', 1);
236 if(i < me.campaignIndex)
237 draw_Picture(me.checkMarkOrigin,
"checkmark", me.checkMarkSize,
'1 1 1', 1);
238 if(i <= me.campaignIndex)
245 draw_Text(me.realUpperMargin1 *
eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize -
draw_TextWidth(s, 0, me.realFontSize))) *
eX, s, me.realFontSize, theColor, theAlpha, 0);
247 if(i <= me.campaignIndex)
251 o = me.realUpperMargin2 *
eY + me.columnNameOrigin *
eX;
252 for(j = 0; j < n; ++j)
255 draw_Text(o,
argv(j), me.realFontSize, theColor, theAlpha * SKINALPHA_CAMPAIGN_DESCRIPTION, 0);
256 o.y += me.realFontSize.y;
259 o.y += me.realFontSize.y * me.emptyLineHeight;
264 if(me.selectedItem >= me.nItems || me.selectedItem < 0)
string campaign_shortdesc[CAMPAIGN_MAX_ENTRIES]
string getWrappedLine_remaining
void CampaignSetup(int n)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define CAMPAIGN_MAX_ENTRIES
vector(float skel, float bonenum) _skel_get_boneabs_hidden
string campaign_gametype[CAMPAIGN_MAX_ENTRIES]
string campaign_longdesc[CAMPAIGN_MAX_ENTRIES]
#define tokenizebyseparator
string campaign_mapname[CAMPAIGN_MAX_ENTRIES]
string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
float CampaignFile_Load(float offset, float entries)
void CampaignFile_Unload()