in procgen/src/basic-abstract-game.cpp [79:123]
void BasicAbstractGame::initialize_asset_if_necessary(int img_idx) {
if (basic_assets.at(img_idx) != nullptr)
return;
int type = img_idx % MAX_ASSETS;
int theme = img_idx / MAX_ASSETS;
theme = mask_theme_if_necessary(theme, type);
std::shared_ptr<QImage> asset_ptr = nullptr;
float aspect_ratio;
int num_themes;
std::vector<std::string> names;
if (!options.use_generated_assets) {
asset_for_type(type, names);
if (names.size() == 0) {
reserved_asset_for_type(type, names);
}
}
if (names.size() == 0) {
AssetGen pgen(&asset_rand_gen);
asset_rand_gen.seed(fixed_asset_seed + type);
std::shared_ptr<QImage> small_image(new QImage(64, 64, QImage::Format_ARGB32));
asset_ptr = small_image;
pgen.generate_resource(asset_ptr, 0, 5, use_block_asset(type));
num_themes = 1;
aspect_ratio = 1.0;
} else {
asset_ptr = get_asset_ptr(names[theme]);
num_themes = (int)(names.size());
aspect_ratio = asset_ptr->width() * 1.0 / asset_ptr->height();
}
basic_assets[img_idx] = asset_ptr;
asset_aspect_ratios[img_idx] = aspect_ratio;
asset_num_themes[type] = num_themes;
std::shared_ptr<QImage> reflection_ptr(new QImage(asset_ptr->mirrored(true, false)));
basic_reflections[img_idx] = reflection_ptr;
}