private void loadGuiImage(int goldIndex, String name) { try { int theseGraphicsFilesIndex = mapping.mapGuiImage(goldIndex); reader.skipTo(guiStarts[theseGraphicsFilesIndex]); SingleImage image = DatBitmapReader.getImage(guiTranslator, reader, name); guiImages[goldIndex] = image; } catch (IOException | ArrayIndexOutOfBoundsException e) { guiImages[goldIndex] = NullImage.getForGui(); } }
private synchronized void loadSettlers(int goldIndex, String name) throws IOException { int theseGraphicsFilesIndex = mapping.mapSettlersSequence(goldIndex); int position = settlerStarts[theseGraphicsFilesIndex]; long[] framePositions = readSequenceHeader(position); SettlerImage[] images = new SettlerImage[framePositions.length]; for (int i = 0; i < framePositions.length; i++) { reader.skipTo(framePositions[i]); images[i] = DatBitmapReader.getImage(settlerTranslator, reader, name + "-S" + goldIndex + ":" + i); } int torsoPosition = torsoStarts[theseGraphicsFilesIndex]; if (torsoPosition >= 0) { long[] torsoPositions = readSequenceHeader(torsoPosition); for (int i = 0; i < torsoPositions.length && i < framePositions.length; i++) { reader.skipTo(torsoPositions[i]); SingleImage torso = DatBitmapReader.getImage(torsoTranslator, reader, name + "-T" + goldIndex + ":" + i); images[i].setTorso(torso); } } int shadowPosition = shadowStarts[theseGraphicsFilesIndex]; if (shadowPosition >= 0) { long[] shadowPositions = readSequenceHeader(shadowPosition); for (int i = 0; i < shadowPositions.length && i < framePositions.length; i++) { reader.skipTo(shadowPositions[i]); SingleImage shadow = DatBitmapReader.getImage(shadowTranslator, reader, name + "-SH" + goldIndex + ":" + i); images[i].setShadow(shadow); } } settlerSequences[goldIndex] = new ArraySequence<>(images); }