(String name, int type)
| 1452 | =============== |
| 1453 | */ |
| 1454 | image_t GL_FindImage(String name, int type) { |
| 1455 | |
| 1456 | if (name == null || name.length() < 1) |
| 1457 | return null; |
| 1458 | |
| 1459 | // look for it |
| 1460 | image_t image = imageCache.get(name); |
| 1461 | if (image != null) { |
| 1462 | image.registration_sequence = registration_sequence; |
| 1463 | return image; |
| 1464 | } |
| 1465 | |
| 1466 | // |
| 1467 | // load the pic from disk |
| 1468 | // |
| 1469 | image = null; |
| 1470 | byte[] pic = null; |
| 1471 | Dimension dim = new Dimension(); |
| 1472 | |
| 1473 | if (name.endsWith(".pcx")) { |
| 1474 | |
| 1475 | pic = LoadPCX(name, null, dim); |
| 1476 | if (pic == null) |
| 1477 | return null; |
| 1478 | image = GL_LoadPic(name, pic, dim.width, dim.height, type, 8); |
| 1479 | |
| 1480 | } |
| 1481 | else if (name.endsWith(".wal")) { |
| 1482 | |
| 1483 | image = GL_LoadWal(name); |
| 1484 | |
| 1485 | } |
| 1486 | else if (name.endsWith(".tga")) { |
| 1487 | |
| 1488 | pic = LoadTGA(name, dim); |
| 1489 | |
| 1490 | if (pic == null) |
| 1491 | return null; |
| 1492 | |
| 1493 | image = GL_LoadPic(name, pic, dim.width, dim.height, type, 32); |
| 1494 | |
| 1495 | } else { |
| 1496 | |
| 1497 | pic = LoadPCX("pics/" + name + ".pcx", null, dim); |
| 1498 | if (pic == null) |
| 1499 | return null; |
| 1500 | image = GL_LoadPic(name, pic, dim.width, dim.height, type, 8); |
| 1501 | |
| 1502 | } |
| 1503 | |
| 1504 | imageCache.put(image.name, image); |
| 1505 | return image; |
| 1506 | } |
| 1507 | |
| 1508 | /* |
| 1509 | =============== |
no test coverage detected