41 DebugLogF(
"WARNING: Looking up skeleton from definition '%s' failed, because there is no such definition with that ID", definition);
48 DebugLogF(
"WARNING: Looking up skeleton from definition '%s' failed, because the definition has no mesh", definition);
72 const char *szLanguage,
75 bool fSearchMessage, int32_t iMinProgress, int32_t iMaxProgress,
bool fLoadSysGroups)
78 C4Def *nDef =
nullptr;
81 bool fPrimaryDef=
false;
82 bool fThisSearchMessage=
false;
87 if (can_be_primary_def
91 fThisSearchMessage=
true;
98 if (can_be_primary_def)
100 if ((nDef =
new C4Def))
102 if (nDef->
Load(hGroup, *SkeletonLoader, dwLoadWhat, szLanguage, pSoundSystem) &&
Add(nDef, fOverload))
135 int iSubMinProgress = std::min(iMaxProgress, iMinProgress + ((iMaxProgress - iMinProgress) * i) / 16);
136 int iSubMaxProgress = std::min(iMaxProgress, iMinProgress + ((iMaxProgress - iMinProgress) * (i + 1)) / 16);
138 iResult +=
Load(hChild,dwLoadWhat,szLanguage,pSoundSystem,fOverload,fSearchMessage,iSubMinProgress,iSubMaxProgress);
154 DWORD dwLoadWhat,
const char *szLanguage,
156 bool fOverload, int32_t iMinProgress, int32_t iMaxProgress)
167 int32_t nDefs =
Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,
true,iMinProgress,iMaxProgress);
178 if (!pDef)
return false;
182 if (pLastDef && !fOverload)
return false;
209 for (cdef=
FirstDef,prev=
nullptr; cdef; prev=cdef,cdef=cdef->
Next)
223 for (cdef=
FirstDef,prev=
nullptr; cdef; prev=cdef,cdef=cdef->
Next)
236 for (cdef=
FirstDef; cdef; cdef=next)
247 SkeletonLoader->Clear();
258 if (cdef->
id==
id)
return cdef;
262 Table::const_iterator it =
table.find(
id);
263 if (it !=
table.end())
279 for (cdef=
FirstDef,cindex=0; cdef; cdef=cdef->
Next,cindex++)
280 if (cdef->
id==
id)
return cindex;
286 C4Def *cdef; int32_t ccount=0;
294 C4Def *pDef; int32_t iCurrentIndex;
295 if (iIndex<0)
return nullptr;
296 for (pDef=
FirstDef,iCurrentIndex=-1; pDef; pDef=pDef->
Next)
299 if (iCurrentIndex==iIndex)
return pDef;
308 std::vector<C4Def*> result;
309 result.reserve(filter_property ? 32 :
table.size());
316 if (!prop_val)
continue;
318 result.push_back(def);
326 const char *szDefPath;
332 if (!szPath[
SLen(szDefPath)])
335 else if (szPath[
SLen(szDefPath)] ==
'\\')
336 if (!strchr(szPath +
SLen(szDefPath) + 1,
'\\'))
345 C4Def *cdef,*prev,*next;
347 for (cdef=
FirstDef,prev=
nullptr; cdef; cdef=next)
352 if (prev) prev->
Next=next;
368 C4Def *cdef,*prev,*next;
369 for (cdef=
FirstDef,prev=
nullptr; cdef; cdef=next)
386 int32_t rcount=0, rcount2;
387 C4Def *cdef,*prev,*next;
391 for (cdef=
FirstDef,prev=
nullptr; cdef; cdef=next)
403 while (rcount != rcount2);
410 if (cdef) cdef->
Draw(cgo,fSelected,iColor);
423 if (!pDef)
return false;
434 SkeletonLoader->RemoveSkeletonsInGroup(hGroup.
GetName());
436 if (!pDef->
Load(hGroup, *SkeletonLoader, dwLoadWhat, szLanguage, pSoundSystem, &GfxBackup))
return false;
460 for (
auto & it :
table)
461 it.second->Synchronize();
466 for (
auto & it :
table)
467 it.second->ResetIncludeDependencies();
476 std::vector<C4Def *> def_vec;
479 def_vec.push_back(def);
481 std::stable_sort(def_vec.begin(), def_vec.end(), [](
C4Def *
a,
C4Def *
b) {
482 return b->GetPropertyInt(P_DefinitionPriority) < a->GetPropertyInt(P_DefinitionPriority);
485 C4Def *prev_def =
nullptr;
486 for (
C4Def *def : def_vec)
489 prev_def->
Next = def;
494 if (prev_def) prev_def->
Next =
nullptr;
518 table.insert(std::make_pair(def->
id, def));
523 SkeletonLoader->ResolveIncompleteSkeletons();
528 return *SkeletonLoader;
536 return iter->second.getData();
int CompareVersion(int iVer1, int iVer2, int iRVer1=C4XVER1, int iRVer2=C4XVER2)
const char * LoadResStr(const char *id)
bool LogF(const char *strMessage,...)
bool LogFatal(const char *szMessage)
bool DebugLogF(const char *strMessage ...)
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
bool SEqualNoCase(const char *szStr1, const char *szStr2, int iLen)
bool SEqual2NoCase(const char *szStr1, const char *szStr2, int iLen)
size_t SLen(const char *sptr)
StdStrBuf FormatString(const char *szFmt,...)
char * GetExtension(char *szFilename)
char * GetFilename(char *szPath)
bool GetLanguageString(const char *szLanguage, StdStrBuf &rTarget)
char LanguageEx[CFG_MaxString+1]
int32_t VerboseObjectLoading
const char * AtRelativePath(const char *filename)
C4ConfigGraphics Graphics
void Add(C4DefGraphics *pGraphics)
bool Load(C4Group &hGroup, StdMeshSkeletonLoader &loader, DWORD dwLoadWhat, const char *szLanguage, class C4SoundSystem *pSoundSystem=nullptr, C4DefGraphicsPtrBackup *gfx_backup=nullptr)
char Filename[_MAX_FNAME_LEN]
void Draw(C4Facet &cgo, bool fSelected=false, DWORD iColor=0, C4Object *pObj=nullptr, int32_t iPhaseX=0, int32_t iPhaseY=0, C4DrawTransform *trans=nullptr, const char *graphicsName=nullptr)
int32_t Load(C4Group &hGroup, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr, bool fOverload=false, bool fSearchMessage=false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups=true)
std::map< StdCopyStrBuf, StdCopyStrBuf > localized_group_folder_names
int32_t GetIndex(C4ID id)
const char * GetLocalizedGroupFolderName(const char *folder_path) const
float GetFontImageAspect(const char *szImageTag) override
C4Def * GetDef(int32_t Index)
C4Def * GetByPath(const char *szPath)
int32_t RemoveTemporary()
bool Add(C4Def *ndef, bool fOverload)
StdMeshSkeletonLoader & GetSkeletonLoader()
void ResetIncludeDependencies()
int32_t CheckRequireDef()
bool DrawFontImage(const char *szImageTag, C4Facet &rTarget, C4DrawTransform *pTransform) override
std::vector< C4Def * > GetAllDefs(C4String *filter_property=nullptr) const
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2)
void CallEveryDefinition()
void Draw(C4ID id, C4Facet &cgo, bool fSelected, int32_t iColor)
bool Reload(C4Def *pDef, DWORD dwLoadWhat, const char *szLanguage, C4SoundSystem *pSoundSystem=nullptr)
void AppendAndIncludeSkeletons()
C4Def * GetByName(const StdStrBuf &)
void SetInitProgress(float to_progress)
float GetTextSpecImageAspect(const char *spec)
bool DrawTextSpecImage(C4Facet &target, const char *spec, class C4DrawTransform *transform, uint32_t color=0xff)
bool LoadAdditionalSystemGroup(class C4Group &parent_group)
bool FindNextEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr, bool start_at_filename=false)
const char * GetName() const
StdStrBuf GetFullName() const
bool OpenAsChild(C4Group *mother, const char *entry_name, bool is_exclusive=false, bool do_create=false)
void ResetSearch(bool reload_contents=false)
bool Open(const char *group_name, bool do_create=false)
const char * ToString() const
C4ID GetID(size_t index, int32_t *ipCount=nullptr) const
int32_t GetNumberOfIDs() const
static bool LoadComponentHost(C4ComponentHost *host, C4Group &hGroup, const char *szFilename, const char *szLanguage)
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
const char * GetName() const override
bool Open(C4Group &group, const char *filename) const
const StdMeshSkeleton & GetSkeleton() const
virtual StdMeshSkeleton * GetSkeletonByDefinition(const char *definition) const =0
int ReplaceChar(char cOld, char cNew)