void MechListBoxItem::init( FitIniFile& file ) { if ( !s_templateItem ) { s_templateItem = new MechListBoxItem( NULL, 0 ); file.seekBlock( "MainBox" ); long width, height; file.readIdLong( "Width", width ); file.readIdLong( "Height", height ); ((aObject*)s_templateItem)->init( 0, 0, width, height ); memset( s_templateItem->animationIDs, 0, sizeof(long) * 9 ); // rects s_templateItem->line.init( &file, "Rect1" ); s_templateItem->outline.init( &file, "Rect0" ); long curAnim = 0; // statics s_templateItem->weightIcon.init( &file, "Static0" ); assignAnimation( file, curAnim ); s_templateItem->mechIcon.init( &file, "Static1" ); assignAnimation( file, curAnim ); s_templateItem->costIcon.init( &file, "Static2" ); assignAnimation( file, curAnim ); // texts s_templateItem->chassisName.init( &file, "Text0" ); assignAnimation( file, curAnim ); s_templateItem->weightText.init( &file, "Text1" ); assignAnimation( file, curAnim ); s_templateItem->countText.init( &file, "Text2" ); assignAnimation( file, curAnim ); s_templateItem->variantName.init( &file, "Text3" ); assignAnimation( file, curAnim ); s_templateItem->costText.init( &file, "Text4" ); assignAnimation( file, curAnim ); char blockName[64]; for ( int i = 0; i < 4; i++ ) { sprintf( blockName, "OrangeAnimation%ld", i ); s_templateItem->animations[1][i].init( &file, blockName ); sprintf( blockName, "Animation%ld", i ); s_templateItem->animations[0][i].init( &file, blockName ); } } }
int32_t ComponentListItem::init(FitIniFile& file) { if(!s_templateItem) { s_templateItem = new ComponentListItem(nullptr); char animName[COMP_ANIMATION_COUNT][32]; for(size_t i = 0; i < COMP_ANIMATION_COUNT; i++) { sprintf(animName[i], "Animation%ld", i); s_templateItem->animations[i].init(&file, animName[i]); } s_templateItem->icon.init(&file, "ComponentIcon"); assignAnimation(file, 0, animName, &s_templateItem->icon); s_templateItem->iconOutline.init(&file, "ComponentIconOutlineRect"); s_templateItem->outline.init(&file, "ComponentEntryBox"); s_templateItem->name.init(&file, "ComponentNameText"); assignAnimation(file, 1, animName, &s_templateItem->name); s_templateItem->costText.init(&file, "ComponentCostText"); assignAnimation(file, 2, animName, &s_templateItem->costText); s_templateItem->heatText.init(&file, "ComponentHeatText"); assignAnimation(file, 3, animName, &s_templateItem->heatText); s_templateItem->costIcon.init(&file, "ComponentCostIcon"); assignAnimation(file, 4, animName, &s_templateItem->costIcon); s_templateItem->heatIcon.init(&file, "ComponentHeatIcon"); assignAnimation(file, 5, animName, &s_templateItem->heatIcon); s_templateItem->disabledText.init(&file, "ComponentDisabledText"); } return 0; }
int LogisticsMechIcon::init( FitIniFile& file ) { if ( !s_pTemplateIcon ) { s_pTemplateIcon = new LogisticsMechIcon; s_pTemplateIcon->pilotName.init( &file, "PilotNameText" ); assignAnimation( file, s_pTemplateIcon->pilotID ); s_pTemplateIcon->chassisName.init( &file, "MechNameText" ); assignAnimation( file, s_pTemplateIcon->chassisNameID ); s_pTemplateIcon->iconConnector.init( &file, "IconConnector" ); assignAnimation( file, s_pTemplateIcon->iconConnectorID ); s_pTemplateIcon->outline.init( &file, "BoxOutline" ); assignAnimation( file, s_pTemplateIcon->outlineID ); s_pTemplateIcon->icon.init( &file, "MechEntryIcon" ); assignAnimation( file, s_pTemplateIcon->iconID ); s_pTemplateIcon->pilotIcon.init( &file, "PilotIcon" ); assignAnimation( file, s_pTemplateIcon->pilotIconID ); char blockName[64]; for ( int i = 0; i < ICON_ANIM_COUNT; i++ ) { sprintf( blockName, "Animation%ld", i ); s_pTemplateIcon->animations[i].init( &file, blockName ); } } return true; }