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

Method extractBulletSpritesCity

tools/extractors/extract_bulletsprites.cpp:10–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9
10std::map<UString, sp<Image>> InitialGameStateExtractor::extractBulletSpritesCity() const
11{
12 std::map<UString, sp<Image>> sprites;
13 auto &data = this->ufo2p;
14
15 UString path_prefix = "bulletsprites/city/";
16
17 for (unsigned i = 0; i < data.bullet_sprites->count(); i++)
18 {
19 UString path = format("%s%02u.png", path_prefix, i);
20 auto sprite = data.bullet_sprites->get(i);
21 auto img = mksp<PaletteImage>(Vec2<unsigned int>{3, 3});
22 PaletteImageLock l(img);
23
24 for (int x = 0; x < 3; x++)
25 {
26 for (int y = 0; y < 3; y++)
27 {
28 l.set({x, y}, sprite.sprite[y][x]);
29 }
30 }
31 sprites[path] = img;
32 }
33
34 return sprites;
35}
36
37std::map<UString, sp<Image>> InitialGameStateExtractor::extractBulletSpritesBattle() const
38{

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