void initialize(ClimateType climate)
{
    VariantMap climateArchives = config::load( SETTINGS_RC_PATH( climateModel ) );

    std::string optName;
    if( climate == central ) {
        optName = CAESARIA_STR_A(central);
    }
    else if( climate == northen )  {
        optName = "north";
    }
    else if( climate == desert ) {
        optName = "south";
    }

    StringArray archives = climateArchives.get( optName ).toStringArray();

    for( auto& str : archives )
    {
        Path archivePath = str;
        Directory dir = archivePath.directory();

        archivePath = dir.find( archivePath.baseName(), Path::ignoreCase );

        ArchivePtr archive = FileSystem::instance().mountArchive( archivePath );

        if( archive.isNull() )
        {
            Logger::warning( "ClimateManager: can't load file " + archivePath.toString() );
            continue;
        }

        ResourceLoader rc;
        NFile atlasInfo = archive->createAndOpenFile( "info" );
        if( atlasInfo.isOpen() )
        {
            rc.loadAtlases( atlasInfo, false );
        }
        else
        {
            rc.loadFiles( archive );
        }
    }
}
Exemple #2
0
void Game::initialize()
{
    int cellWidth = SETTINGS_VALUE( cellw );
    if( cellWidth != tilemap::c3CellWidth && cellWidth != tilemap::caCellWidth)
    {
        cellWidth = tilemap::c3CellWidth;
    }

    tilemap::initTileBase( cellWidth );
    //mount default rcpath folder
    Logger::warning( "Game: set resource folder" );
    vfs::FileSystem::instance().setRcFolder( game::Settings::rcpath() );

    _d->initMetrics();
    _d->initGameConfigs();
    _d->initAddons();
    _d->initArchiveLoaders();
    _d->initLocale( SETTINGS_STR( localePath ) );
    _d->initVideo();
    _d->initMovie();
    _d->initFontCollection( game::Settings::rcpath() );
    _d->initGuiEnvironment();
    _d->initSound();
    _d->initHotkeys();
    _d->createSaveDir();

    Logger::warning( "Game: load splash screen" );
    splash::initialize( "logo_00001" );

    scene::SplashScreen screen;

    Logger::warning( "Game: initialize resource loader" );
    ResourceLoader rcLoader;
    rcLoader.loadFiles( SETTINGS_RC_PATH( logoArchive ) );
    rcLoader.onStartLoading().connect( &screen, &scene::SplashScreen::setText );

    screen.initialize();
    screen.update( *_d->engine );

    Logger::warning( "Game: initialize offsets" );
    screen.setPrefix( "##loading_offsets##" );
    PictureInfoBank::instance().initialize( SETTINGS_RC_PATH( pic_offsets ) );

    Logger::warning( "Game: initialize resources" );
    screen.setPrefix( "##loading_resources##" );
    _d->mountArchives( rcLoader );  // init some quick pictures for screenWait

    screen.setPrefix( "" );
    screen.setText( "##initialize_animations##" );
    _d->initPictures();

    screen.setText( "##initialize_names##" );
    NameGenerator::instance().initialize( SETTINGS_RC_PATH( ctNamesModel ) );
    NameGenerator::instance().setLanguage( SETTINGS_VALUE( language ).toString() );

    screen.setText( "##initialize_house_specification##" );
    HouseSpecHelper::instance().initialize( SETTINGS_RC_PATH( houseModel ) );

    screen.setText( "##initialize_constructions##" );
    MetaDataHolder::instance().initialize( SETTINGS_RC_PATH( constructionModel ) );

    screen.setText( "##initialize_walkers##" );
    WalkerHelper::instance().load( SETTINGS_RC_PATH( walkerModel ) );

    screen.setText( "##initialize_religion##" );
    _d->initPantheon( SETTINGS_RC_PATH( pantheonModel ) );

    screen.setText( "##ready_to_game##" );

    if( game::Settings::get( "no-fade" ).isNull() )
        screen.exitScene( scene::SplashScreen::showDevText );

    _d->nextScreen = SCREEN_MENU;
    _d->engine->setFlag( gfx::Engine::debugInfo, 1 );
}