282 |
{ |
{ |
283 |
if (i >= level_pack->size()) { |
if (i >= level_pack->size()) { |
284 |
for( ; (i-ifirst) <= areas.size(); areas.pop_back()) // remove unused areas from the list |
for( ; (i-ifirst) <= areas.size(); areas.pop_back()) // remove unused areas from the list |
285 |
goto done_painting; |
goto done_painting; |
286 |
} |
} |
287 |
|
|
288 |
int xpos = x0 + x*(imgw + hgap); |
int xpos = x0 + x*(imgw + hgap); |
303 |
// frame(gc, smaller(a,2)); |
// frame(gc, smaller(a,2)); |
304 |
// } |
// } |
305 |
|
|
306 |
if (i == (unsigned) iselected) { |
if (i == (unsigned) iselected) { |
307 |
// Rect imgr (xpos,ypos,imgw, imgh); |
// Rect imgr (xpos,ypos,imgw, imgh); |
308 |
Rect imgr = areas[(i-ifirst)]; |
Rect imgr = areas[(i-ifirst)]; |
309 |
|
|
310 |
px::TintRect (video::GetScreen(), intersect(imgr, r), |
px::TintRect (video::GetScreen(), intersect(imgr, r), |
311 |
120,120,120,120); |
120,120,120,120); |
312 |
set_color(gc, 200,200,200); |
set_color(gc, 200,200,200); |
313 |
Rect a = areas[(i-ifirst)]; |
Rect a = areas[(i-ifirst)]; |
314 |
frame(gc, a); |
frame(gc, a); |
315 |
|
} |
316 |
|
|
317 |
|
info = level_pack->get_info(i); |
318 |
|
string fname = string("levels/") + info->filename + ".png"; |
319 |
|
Surface *img = cache.get(enigma::FindDataFile(fname)); |
320 |
|
if( !img) { |
321 |
|
img = LevelPreview( level_pack, i); |
322 |
|
if( img) { |
323 |
|
fprintf(stderr,"ZOOM!\n"); |
324 |
|
img = img->zoom( imgw,imgh); |
325 |
|
} else img = 0; |
326 |
|
} |
327 |
|
if (img ) |
328 |
|
blit (gc, xpos, ypos, img); |
329 |
|
|
330 |
|
options::LevelStatus *ls; |
331 |
|
|
332 |
|
if ((ls=options::GetLevelStatus(level_pack->name(), |
333 |
|
info->filename))) |
334 |
|
{ |
335 |
|
if (ls->finished != 0) |
336 |
|
blit (gc, xpos, ypos, enigma::GetImage("completed")); |
337 |
|
} |
338 |
|
|
339 |
|
string tstr = info->name; |
340 |
|
smallfnt->render (gc, |
341 |
|
xpos+(imgw-smallfnt->get_width(tstr.c_str()))/2, |
342 |
|
ypos+imgh+1, |
343 |
|
tstr.c_str()); |
344 |
} |
} |
|
|
|
|
info = level_pack->get_info(i); |
|
|
string fname = string("levels/") + info->filename + ".png"; |
|
|
Surface *img = cache.get(enigma::FindDataFile(fname)); |
|
|
if( !img) { |
|
|
img = LevelPreview( level_pack, i); |
|
|
if( img) { |
|
|
fprintf(stderr,"ZOOM!\n"); |
|
|
img = img->zoom( imgw,imgh); |
|
|
} else img = 0; |
|
|
} |
|
|
if (img ) |
|
|
blit (gc, xpos, ypos, img); |
|
|
|
|
|
options::LevelStatus *ls; |
|
|
|
|
|
if ((ls=options::GetLevelStatus(level_pack->name(), |
|
|
info->filename))) |
|
|
{ |
|
|
if (ls->finished != 0) |
|
|
blit (gc, xpos, ypos, enigma::GetImage("completed")); |
|
|
} |
|
|
|
|
|
string tstr = info->name; |
|
|
smallfnt->render (gc, |
|
|
xpos+(imgw-smallfnt->get_width(tstr.c_str()))/2, |
|
|
ypos+imgh+1, |
|
|
tstr.c_str()); |
|
|
} |
|
345 |
} |
} |
346 |
} |
} |
347 |
done_painting: |
done_painting: |