int32_t C4FontLoader::LoadDefs(C4Group &hGroup, C4Config &rCfg) { // load vector fonts char fn[_MAX_PATH+1], fnDef[32]; int32_t i=0; while (SCopySegment(C4CFN_FontFiles, i++, fnDef, '|', 31)) { hGroup.ResetSearch(); while (hGroup.FindNextEntry(fnDef, fn)) { C4VectorFont *pVecFon = new C4VectorFont(); if (pVecFon->Init(hGroup, fn, rCfg)) { pVecFon->pNext = pVectorFonts; pVectorFonts = pVecFon; } else delete pVecFon; } } // load definition file StdStrBuf DefFileContent; if (!hGroup.LoadEntryString(C4CFN_FontDefs, DefFileContent)) return 0; std::vector<C4FontDef> NewFontDefs; if (!CompileFromBuf_LogWarn<StdCompilerINIRead>( mkNamingAdapt(mkSTLContainerAdapt(NewFontDefs), "Font"), DefFileContent, C4CFN_FontDefs)) return 0; // Copy the new FontDefs into the list FontDefs.insert(FontDefs.end(), NewFontDefs.begin(), NewFontDefs.end()); // done return NewFontDefs.size(); }
void C4TempPhysicalInfo::CompileFunc(StdCompiler *pComp) { C4PhysicalInfo::CompileFunc(pComp); #ifdef C4ENGINE pComp->Value(mkNamingAdapt( mkSTLContainerAdapt(Changes), "Changes", std::vector<C4PhysicalChange>())); #endif }
void C4ObjectList::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers) { // (Re)create list delete pEnumerated; pEnumerated = new std::list<int32_t>(); // Decompiling: Build list if (!pComp->isCompiler()) for (C4ObjectLink *pPos = First; pPos; pPos = pPos->Next) if (pPos->Obj->Status) pEnumerated->push_back(pPos->Obj->Number); // Compile list pComp->Value(mkSTLContainerAdapt(*pEnumerated, StdCompiler::SEP_SEP2)); // Decompiling: Delete list if (!pComp->isCompiler()) { delete pEnumerated; pEnumerated = NULL; } // Compiling: Nothing to do - list will be denumerated later }
void C4ScenarioParameterDef::CompileFunc(StdCompiler *pComp) { if (!pComp->Name("ParameterDef")) { pComp->NameEnd(); pComp->excNotFound("ParameterDef"); } pComp->Value(mkNamingAdapt(mkParAdapt(Name, StdCompiler::RCT_All), "Name", StdCopyStrBuf())); pComp->Value(mkNamingAdapt(mkParAdapt(Description, StdCompiler::RCT_All), "Description", StdCopyStrBuf())); pComp->Value(mkNamingAdapt(mkParAdapt(ID, StdCompiler::RCT_Idtf), "ID", StdCopyStrBuf())); StdEnumEntry<ParameterType> ParTypeEntries[] = { { "Enumeration", SPDT_Enum }, { nullptr, SPDT_Enum } }; pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(Type, ParTypeEntries), "Type", SPDT_Enum)); pComp->Value(mkNamingAdapt(Default, "Default", 0)); pComp->Value(mkNamingAdapt(LeagueValue, "LeagueValue", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(Achievement, StdCompiler::RCT_Idtf), "Achievement", StdCopyStrBuf())); pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(Options, StdCompiler::SEP_NONE), "Options")); pComp->NameEnd(); }
void C4MaterialCore::CompileFunc(StdCompiler *pComp) { assert(pComp->hasNaming()); if (pComp->isCompiler()) Clear(); pComp->Name("Material"); pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", "")); const StdEnumEntry<C4MaterialCoreShape> Shapes[] = { { "Flat", C4M_Flat }, { "TopFlat", C4M_TopFlat }, { "Smooth", C4M_Smooth }, { "Rough", C4M_Rough }, { "Octagon", C4M_Octagon }, { "Smoother", C4M_Smoother }, { NULL, C4M_Flat } }; pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(MapChunkType, Shapes), "Shape", C4M_Flat)); pComp->Value(mkNamingAdapt(Density, "Density", 0)); pComp->Value(mkNamingAdapt(Friction, "Friction", 0)); pComp->Value(mkNamingAdapt(DigFree, "DigFree", 0)); pComp->Value(mkNamingAdapt(BlastFree, "BlastFree", 0)); pComp->Value(mkNamingAdapt(Blast2Object, "Blast2Object", C4ID::None)); pComp->Value(mkNamingAdapt(Dig2Object, "Dig2Object", C4ID::None)); pComp->Value(mkNamingAdapt(Dig2ObjectRatio, "Dig2ObjectRatio", 0)); pComp->Value(mkNamingAdapt(Dig2ObjectCollect, "Dig2ObjectCollect", 0)); pComp->Value(mkNamingAdapt(Blast2ObjectRatio, "Blast2ObjectRatio", 0)); pComp->Value(mkNamingAdapt(Blast2PXSRatio, "Blast2PXSRatio", 0)); pComp->Value(mkNamingAdapt(Instable, "Instable", 0)); pComp->Value(mkNamingAdapt(MaxAirSpeed, "MaxAirSpeed", 0)); pComp->Value(mkNamingAdapt(MaxSlide, "MaxSlide", 0)); pComp->Value(mkNamingAdapt(WindDrift, "WindDrift", 0)); pComp->Value(mkNamingAdapt(Inflammable, "Inflammable", 0)); if (pComp->isCompiler()) { // The value used to have a wrong spelling ("Incindiary"). If there's // no "Incendiary" value, use the wrong spelling instead try { pComp->Value(mkNamingAdapt(Incendiary, "Incendiary")); } catch (StdCompiler::NotFoundException *ex) { delete ex; pComp->Value(mkNamingAdapt(Incendiary, "Incindiary", 0)); } } else { // When serializing, write both spellings because some script might be // calling GetMaterialVal with the wrong one pComp->Value(mkNamingAdapt(Incendiary, "Incendiary")); pComp->Value(mkNamingAdapt(Incendiary, "Incindiary")); } pComp->Value(mkNamingAdapt(Corrode, "Corrode", 0)); pComp->Value(mkNamingAdapt(Corrosive, "Corrosive", 0)); pComp->Value(mkNamingAdapt(Extinguisher, "Extinguisher", 0)); pComp->Value(mkNamingAdapt(Soil, "Soil", 0)); pComp->Value(mkNamingAdapt(Placement, "Placement", 0)); pComp->Value(mkNamingAdapt(Light, "Light", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(sTextureOverlay, StdCompiler::RCT_IdtfAllowEmpty), "TextureOverlay", "")); pComp->Value(mkNamingAdapt(OverlayType, "OverlayType", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(sPXSGfx, StdCompiler::RCT_IdtfAllowEmpty), "PXSGfx", "")); pComp->Value(mkNamingAdapt(PXSGfxRt, "PXSGfxRt", TargetRect0)); pComp->Value(mkNamingAdapt(PXSGfxSize, "PXSGfxSize", PXSGfxRt.Wdt)); pComp->Value(mkNamingAdapt(TempConvStrength, "TempConvStrength", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(sBlastShiftTo, StdCompiler::RCT_IdtfAllowEmpty), "BlastShiftTo", "")); pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvert, StdCompiler::RCT_IdtfAllowEmpty), "InMatConvert", "")); pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvertTo, StdCompiler::RCT_IdtfAllowEmpty), "InMatConvertTo", "")); pComp->Value(mkNamingAdapt(InMatConvertDepth, "InMatConvertDepth", 0)); pComp->Value(mkNamingAdapt(AboveTempConvert, "AboveTempConvert", 0)); pComp->Value(mkNamingAdapt(AboveTempConvertDir, "AboveTempConvertDir", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(sAboveTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty), "AboveTempConvertTo", "")); pComp->Value(mkNamingAdapt(BelowTempConvert, "BelowTempConvert", 0)); pComp->Value(mkNamingAdapt(BelowTempConvertDir, "BelowTempConvertDir", 0)); pComp->Value(mkNamingAdapt(mkParAdapt(sBelowTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty), "BelowTempConvertTo", "")); pComp->Value(mkNamingAdapt(MinHeightCount, "MinHeightCount", 0)); pComp->Value(mkNamingAdapt(SplashRate, "SplashRate", 10)); pComp->Value(mkNamingAdapt(KeepSinglePixels, "KeepSinglePixels", false)); pComp->Value(mkNamingAdapt(AnimationSpeed, "AnimationSpeed", 100)); pComp->Value(mkNamingAdapt(LightAngle, "LightAngle", 255)); pComp->Value(mkNamingAdapt(mkArrayAdaptDM(LightEmit, 0), "LightEmit")); pComp->Value(mkNamingAdapt(mkArrayAdaptDM(LightSpot, 16),"LightSpot")); pComp->Value(mkNamingAdapt(MinShapeOverlap, "MinShapeOverlap", 25)); pComp->NameEnd(); // material reactions pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(CustomReactionList), "Reaction", std::vector<C4MaterialReaction>())); }
void C4ScenarioParameterDefs::CompileFunc(StdCompiler *pComp) { pComp->Value(mkSTLContainerAdapt(Parameters, StdCompiler::SEP_NONE)); }
void C4CustomKey::CompileFunc(StdCompiler *pComp) { pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(Codes), Name.getData(), DefaultCodes)); }
BOOL C4Playback::ReadText(const StdStrBuf &Buf) { return CompileFromBuf_LogWarn<StdCompilerINIRead>( mkNamingAdapt(mkSTLContainerAdapt(chunks), "Rec"), Buf, C4CFN_CtrlRecText); }