| 347 | } |
| 348 | |
| 349 | virtual void render(int x, int y, int w) |
| 350 | { |
| 351 | int c = greyedout ? 128 : 255; |
| 352 | mitem::render(x, y, w); |
| 353 | draw_text(text, x, y, c, c, c); |
| 354 | if(isselection()) |
| 355 | { |
| 356 | if(!image && !mapmessage) |
| 357 | { // load map description and preview picture |
| 358 | silent_texture_load = true; |
| 359 | const char *cgzpath = "packages" PATHDIVS "maps"; |
| 360 | if(browsefiledesc) |
| 361 | { // checking map messages is slow and may be disabled |
| 362 | mapmessage = getfiledesc(cgzpath, behindpath(filename), "cgz"); // check for regular map |
| 363 | if(!mapmessage) mapmessage = getfiledesc((cgzpath = "packages" PATHDIVS "maps" PATHDIVS "official"), behindpath(filename), "cgz"); // check for official map |
| 364 | } |
| 365 | defformatstring(p2p)("%s/preview/%s.jpg", cgzpath, filename); |
| 366 | if(!hidebigmenuimages) image = textureload(p2p, 3); |
| 367 | if(!image || image == notexture) image = textureload("packages/misc/nopreview.jpg", 3); |
| 368 | silent_texture_load = false; |
| 369 | } |
| 370 | w += FONTH; |
| 371 | int xs = (2 * VIRTW - w - x) / 2, xp = x + w + xs / 2, ym = VIRTH - FONTH/2; |
| 372 | if(image && !hidebigmenuimages && image->ys > FONTH) |
| 373 | { |
| 374 | int ys = (xs * image->ys) / image->xs, yp = VIRTH - ys / 2; |
| 375 | ym = yp + ys + 2 * FONTH; |
| 376 | framedquadtexture(image->id, xp, yp, xs, ys, FONTH); |
| 377 | draw_text(text, xp + xs/2 - text_width(text)/2, yp + ys); |
| 378 | } |
| 379 | if(mapmessage && *mapmessage) draw_text(mapmessage, xp - FONTH, ym, 0xFF, 0xFF, 0xFF, 0xFF, -1, 2 * VIRTW - (xp - FONTH) - FONTH/2); |
| 380 | } |
| 381 | } |
| 382 | }; |
| 383 | |
| 384 | // text input item |
nothing calls this directly
no test coverage detected