MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / extractBulletSpritesBattle

Method extractBulletSpritesBattle

tools/extractors/extract_bulletsprites.cpp:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37std::map<UString, sp<Image>> InitialGameStateExtractor::extractBulletSpritesBattle() const
38{
39 std::map<UString, sp<Image>> sprites;
40 auto &data = this->tacp;
41
42 UString path_prefix = "bulletsprites/battle/";
43
44 for (unsigned i = 0; i < data.bullet_sprites->count(); i++)
45 {
46 UString path = format("%s%02u.png", path_prefix, i);
47 auto sprite = data.bullet_sprites->get(i);
48 auto img = mksp<PaletteImage>(Vec2<unsigned int>{3, 3});
49 PaletteImageLock l(img);
50
51 for (int x = 0; x < 3; x++)
52 {
53 for (int y = 0; y < 3; y++)
54 {
55 l.set({x, y}, sprite.sprite[y][x]);
56 }
57 }
58 sprites[path] = img;
59 }
60
61 return sprites;
62}
63
64} // namespace OpenApoc

Callers 1

main.cppFile · 0.80

Calls 4

formatFunction · 0.85
countMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected