bool CGlow::Load(IReader& F) { u32 version = 0; R_ASSERT(F.r_chunk(GLOW_CHUNK_VERSION,&version)); if((version!=0x0011)&&(version!=GLOW_VERSION)){ ELog.DlgMsg( mtError, "CGlow: Unsupported version."); return false; } CCustomObject::Load(F); if (F.find_chunk(GLOW_CHUNK_SHADER)){ F.r_stringZ (m_ShaderName); } R_ASSERT(F.find_chunk(GLOW_CHUNK_TEXTURE)); F.r_stringZ (m_TexName); R_ASSERT(F.find_chunk(GLOW_CHUNK_PARAMS)); m_fRadius = F.r_float(); if (version==0x0011){ F.r_fvector3 (FPosition); UpdateTransform(); } if (F.find_chunk(GLOW_CHUNK_FLAGS)) m_Flags.assign (F.r_u16()); return true; }
bool CGroupObject::Load(IReader& F) { u32 version = 0; char buf[1024]; R_ASSERT(F.r_chunk(GROUPOBJ_CHUNK_VERSION,&version)); if (version!=GROUPOBJ_CURRENT_VERSION){ ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load."); return false; } CCustomObject::Load(F); F.r_chunk(GROUPOBJ_CHUNK_FLAGS,&m_Flags); // objects if (IsOpened()){ m_PObjects = xr_new<SStringVec>(); R_ASSERT(F.find_chunk(GROUPOBJ_CHUNK_OPEN_OBJECT_LIST)); u32 cnt = F.r_u32(); xr_string tmp; for (u32 k=0; k<cnt; k++){ F.r_stringZ (tmp); m_PObjects->push_back (tmp); } }else{ Scene->ReadObjects(F,GROUPOBJ_CHUNK_OBJECT_LIST,AppendObjectCB,0); } VERIFY(m_Objects.size()||(0!=m_PObjects)); if (F.find_chunk(GROUPOBJ_CHUNK_REFERENCE)) F.r_stringZ (m_ReferenceName); return true; }
bool ESceneLightTools::Load(IReader& F) { u16 version = 0; if(F.r_chunk(CHUNK_VERSION,&version)) if( version!=LIGHT_TOOLS_VERSION ){ ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc()); return false; } if (!inherited::Load(F)) return false; if (F.find_chunk(CHUNK_FLAGS)) m_Flags.assign (F.r_u32()); if (F.find_chunk(CHUNK_SUN_SHADOW)){ F.r_u8 (); F.r_fvector2 (m_SunShadowDir); } if (F.find_chunk(CHUNK_LCONTROLS_LAST)) lcontrol_last_idx = F.r_u32(); IReader* R = F.open_chunk(CHUNK_LCONTROLS); if (R){ while (!R->eof()){ shared_str l_name; R->r_stringZ(l_name); u32 l_idx = R->r_u32(); AppendLightControl(l_name.c_str(),&l_idx); } R->close (); } return true; }
bool ESceneObjectTools::Load(IReader& F) { u16 version = 0; if(F.r_chunk(CHUNK_VERSION,&version)){ if( version!=OBJECT_TOOLS_VERSION ){ ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc()); return false; } } if (!inherited::Load(F)) return false; if (F.find_chunk(CHUNK_FLAGS)) m_Flags.assign(F.r_u32()); if (F.find_chunk(CHUNK_APPEND_RANDOM)){ F.r_fvector3(m_AppendRandomMinScale); F.r_fvector3(m_AppendRandomMaxScale); F.r_fvector3(m_AppendRandomMinRotation); F.r_fvector3(m_AppendRandomMaxRotation); int cnt = F.r_u32(); if (cnt){ shared_str buf; for (int i=0; i<cnt; i++){ F.r_stringZ (buf); m_AppendRandomObjects.push_back (buf); } } }; m_Flags.set(flAppendRandom,FALSE); return true; }
bool EDetail::Load(IReader& F) { // check version R_ASSERT (F.find_chunk(DETOBJ_CHUNK_VERSION)); u32 version = F.r_u32(); if (version!=DETOBJ_VERSION){ ELog.Msg(mtError,"EDetail: unsupported version."); return false; } // references string256 buf; R_ASSERT (F.find_chunk(DETOBJ_CHUNK_REFERENCE)); F.r_stringZ (buf,sizeof(buf)); // scale R_ASSERT (F.find_chunk(DETOBJ_CHUNK_SCALE_LIMITS)); m_fMinScale = F.r_float(); if (fis_zero(m_fMinScale)) m_fMinScale = 0.1f; m_fMaxScale = F.r_float(); if (m_fMaxScale<m_fMinScale) m_fMaxScale = m_fMinScale; // density factor if (F.find_chunk(DETOBJ_CHUNK_DENSITY_FACTOR)) m_fDensityFactor= F.r_float(); if (F.find_chunk(DETOBJ_CHUNK_FLAGS)) m_Flags.assign (F.r_u32()); // update object return Update(buf); }
bool EParticlesObject::Load(IReader& F) { u32 version = 0; R_ASSERT(F.r_chunk(CPSOBJECT_CHUNK_VERSION,&version)); if( version!=CPSOBJECT_VERSION ){ ELog.DlgMsg( mtError, "PSObject: Unsupported version."); return false; } inherited::Load(F); R_ASSERT(F.find_chunk(CPSOBJECT_CHUNK_REFERENCE)); F.r_stringZ(m_RefName); if (!Compile(*m_RefName)){ ELog.DlgMsg( mtError, "EParticlesObject: '%s' not found in library", *m_RefName ); return false; } if (F.find_chunk(CPSOBJECT_CHUNK_PARAMS)){ //. if (m_Particles) m_Particles->m_RT_Flags.set(F.r_u32()); } return true; }
void CBone::LoadData(IReader& F) { R_ASSERT(F.find_chunk(BONE_CHUNK_DEF)); F.r_stringZ (name); xr_strlwr(name); R_ASSERT(F.find_chunk(BONE_CHUNK_MATERIAL)); F.r_stringZ (game_mtl); R_ASSERT(F.find_chunk(BONE_CHUNK_SHAPE)); F.r (&shape,sizeof(SBoneShape)); if (F.find_chunk(BONE_CHUNK_FLAGS)) IK_data.ik_flags.assign(F.r_u32()); R_ASSERT(F.find_chunk(BONE_CHUNK_IK_JOINT)); IK_data.type = (EJointType)F.r_u32(); F.r (IK_data.limits,sizeof(SJointLimit)*3); IK_data.spring_factor = F.r_float(); IK_data.damping_factor = F.r_float(); if (F.find_chunk(BONE_CHUNK_IK_JOINT_BREAK)){ IK_data.break_force = F.r_float(); IK_data.break_torque= F.r_float(); } if (F.find_chunk(BONE_CHUNK_IK_JOINT_FRICTION)){ IK_data.friction = F.r_float(); } if (F.find_chunk(BONE_CHUNK_MASS)){ mass = F.r_float(); F.r_fvector3(center_of_mass); } }
void CLAItem::Load(IReader& F) { R_ASSERT(F.find_chunk(CHUNK_ITEM_COMMON)); F.r_stringZ (cName); fFPS = F.r_float(); iFrameCount = F.r_u32(); int key_cnt,key; R_ASSERT(F.find_chunk(CHUNK_ITEM_KEYS)); key_cnt = F.r_u32(); for (int i=0; i<key_cnt; i++){ key = F.r_u32 (); Keys[key] = F.r_u32(); } }
void TClipMaker::LoadClips() { bool bRes=true; if (EFS.GetOpenName("$clips$",m_ClipFName)){ Clear (); IReader* F = FS.r_open(m_ClipFName.c_str()); VERIFY(F); m_ClipFName = EFS.ExcludeBasePath(m_ClipFName.c_str(),FS.get_path("$clips$")->m_Path); if (F->find_chunk(CHUNK_ZOOM)){ m_Zoom = F->r_float(); } IReader* C = F->open_chunk(CHUNK_CLIPS); if(C){ IReader* M = C->open_chunk(0); for (int count=1; M; count++) { CUIClip* clip = xr_new<CUIClip>(this,count); if (!clip->Load(*M)){ ELog.Msg(mtError,"Unsupported clip version. Load failed."); xr_delete(clip); bRes = false; } M->close(); if (!bRes) break; clips.push_back(clip); M = C->open_chunk(count); } C->close (); UpdateClips (); } FS.r_close(F); } }
void CALifeSpawnRegistry::load (IReader &file_stream, LPCSTR game_name) { R_ASSERT (FS.exist(game_name)); IReader *chunk, *chunk0; Msg ("* Loading spawn registry..."); R_ASSERT2 (file_stream.find_chunk(SPAWN_CHUNK_DATA),"Cannot find chunk SPAWN_CHUNK_DATA!"); chunk0 = file_stream.open_chunk(SPAWN_CHUNK_DATA); xrGUID guid; chunk = chunk0->open_chunk(0); VERIFY (chunk); chunk->r_stringZ (m_spawn_name); chunk->r (&guid,sizeof(guid)); chunk->close (); string_path file_name; bool file_exists = !!FS.exist(file_name, "$game_spawn$", *m_spawn_name, ".spawn"); R_ASSERT3 (file_exists,"Can't find spawn file:",*m_spawn_name); VERIFY (!m_file); m_file = FS.r_open(file_name); load (*m_file,&guid); chunk0->close (); }
void CALifeSimulatorHeader::load (IReader &file_stream) { R_ASSERT2 (file_stream.find_chunk(ALIFE_CHUNK_DATA),"Can't find chunk ALIFE_CHUNK_DATA"); m_version = file_stream.r_u32(); R_ASSERT2 (m_version>=0x0002,"ALife version mismatch! (Delete saved game and try again)"); };
void CEnvironment::mods_load() { Modifiers.clear_and_free(); string_path path; if (FS.exist(path, "$level$", "level.env_mod")) { IReader* fs = FS.r_open(path); u32 id = 0; u32 ver = 0x0015; u32 sz; while (0 != (sz = fs->find_chunk(id))) { if (id == 0 && sz == sizeof(u32)) { ver = fs->r_u32(); } else { CEnvModifier E; E.load(fs, ver); Modifiers.push_back(E); } id++; } FS.r_close(fs); } load_level_specific_ambients(); }
void st_LevelOptions::Read(IReader& F) { R_ASSERT(F.find_chunk(CHUNK_LO_VERSION)); DWORD vers = F.r_u32( ); if( vers < 0x00000008 ) { ELog.DlgMsg( mtError, "Skipping bad version of level options." ); return; } R_ASSERT(F.find_chunk(CHUNK_LO_NAMES)); F.r_stringZ (m_FNLevelPath); if (F.find_chunk(CHUNK_LO_PREFIX)) F.r_stringZ (m_LevelPrefix); R_ASSERT(F.find_chunk(CHUNK_LO_BOP)); F.r_stringZ (m_BOPText); if (F.find_chunk(CHUNK_LO_MAP_VER)) F.r_stringZ (m_map_version); vers = 0; if (F.find_chunk(CHUNK_LO_BP_VERSION)) vers = F.r_u32( ); if (CURRENT_LEVELOP_BP_VERSION==vers){ if (F.find_chunk(CHUNK_BUILD_PARAMS)) F.r(&m_BuildParams, sizeof(m_BuildParams)); }else{ ELog.DlgMsg (mtError, "Skipping bad version of build params."); m_BuildParams.Init(); } if (F.find_chunk(CHUNK_LIGHT_QUALITY)) { m_LightHemiQuality = F.r_u8(); m_LightSunQuality = F.r_u8(); } if (F.find_chunk(CHUNK_MAP_USAGE)) { if(vers > 0x00000008) { m_mapUsage.m_GameType.assign (F.r_u16()); }else { m_mapUsage.m_GameType.zero (); m_mapUsage.m_GameType.set (eGameIDDeathmatch , F.r_s32()); m_mapUsage.m_GameType.set (eGameIDTeamDeathmatch, F.r_s32()); m_mapUsage.m_GameType.set (eGameIDArtefactHunt, F.r_s32()); } } }
bool CEditShape::Load(IReader& F) { R_ASSERT(F.find_chunk(SHAPE_CHUNK_VERSION)); u16 vers = F.r_u16(); if (SHAPE_CURRENT_VERSION!=vers){ ELog.DlgMsg( mtError, "CEditShape: unsupported version. Object can't load."); return false; } inherited::Load (F); R_ASSERT(F.find_chunk(SHAPE_CHUNK_SHAPES)); shapes.resize (F.r_u32()); F.r (shapes.begin(),shapes.size()*sizeof(shape_def)); ComputeBounds(); return true; }
bool CClip::Load(IReader& F) { R_ASSERT (F.find_chunk(EOBJ_CLIP_VERSION_CHUNK)); u16 ver = F.r_u16(); if (ver!=EOBJ_CLIP_VERSION) return false; R_ASSERT(F.find_chunk(EOBJ_CLIP_DATA_CHUNK)); F.r_stringZ (name); for (int k=0; k<4; k++){ F.r_stringZ (cycles[k].name); cycles[k].slot = F.r_u16(); } F.r_stringZ (fx.name); fx.slot = F.r_u16(); fx_power = F.r_float(); length = F.r_float(); return true; }
bool CEditShape::LoadStream(IReader& F) { R_ASSERT(F.find_chunk(SHAPE_CHUNK_VERSION)); u16 vers = F.r_u16(); inherited::LoadStream (F); R_ASSERT(F.find_chunk(SHAPE_CHUNK_SHAPES)); shapes.resize (F.r_u32()); F.r (shapes.begin(),shapes.size()*sizeof(shape_def)); if(F.find_chunk(SHAPE_CHUNK_DATA)) m_shape_type = F.r_u8(); ComputeBounds(); return true; }
void SGameMtl::Load(IReader& fs) { R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_MAIN)); ID = fs.r_u32(); fs.r_stringZ (m_Name); if (fs.find_chunk(GAMEMTL_CHUNK_DESC)){ fs.r_stringZ (m_Desc); } R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FLAGS)); Flags.assign (fs.r_u32()); R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_PHYSICS)); fPHFriction = fs.r_float(); fPHDamping = fs.r_float(); fPHSpring = fs.r_float(); fPHBounceStartVelocity = fs.r_float(); fPHBouncing = fs.r_float(); R_ASSERT(fs.find_chunk(GAMEMTL_CHUNK_FACTORS)); fShootFactor = fs.r_float(); fBounceDamageFactor = fs.r_float(); fVisTransparencyFactor = fs.r_float(); fSndOcclusionFactor = fs.r_float(); if(fs.find_chunk(GAMEMTL_CHUNK_FLOTATION)) fFlotationFactor = fs.r_float(); if(fs.find_chunk(GAMEMTL_CHUNK_INJURIOUS)) fInjuriousSpeed = fs.r_float(); }
bool CALifeSimulatorHeader::valid (IReader &file_stream) const { if (!file_stream.find_chunk(ALIFE_CHUNK_DATA)) return (false); u32 version; file_stream.r (&version, sizeof(version)); return (version>=2); }
bool CGroupObject::LoadStream(IReader& F) { u16 version=0; R_ASSERT(F.r_chunk(GROUPOBJ_CHUNK_VERSION,&version)); if (version<0x0011) { ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load."); return false; } CCustomObject::LoadStream(F); Flags32 tmp_flags; tmp_flags.zero(); if(version<0x0012) F.r_chunk(GROUPOBJ_CHUNK_FLAGS,&tmp_flags); // objects if (tmp_flags.test(1<<0)) { //old format, opened group ELog.DlgMsg( mtError, "old format, opened group"); return false; /* R_ASSERT(F.find_chunk(GROUPOBJ_CHUNK_OPEN_OBJECT_LIST)); u32 cnt = F.r_u32(); for (u32 k=0; k<cnt; ++k) { m_ObjectsInGroup.resize (m_ObjectsInGroup.size()+1); F.r_stringZ (m_ObjectsInGroup.back().ObjectName); } */ }else { Scene->ReadObjectsStream(F,GROUPOBJ_CHUNK_OBJECT_LIST,AppendObjectLoadCB,0); } VERIFY(m_ObjectsInGroup.size()); if (F.find_chunk(GROUPOBJ_CHUNK_REFERENCE)) { shared_str rn; F.r_stringZ (rn); SetRefName(rn.c_str()); } if(version<0x0012) { for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it) if(it->pObject) { it->pObject->m_CO_Flags.set(flObjectInGroup, TRUE); it->pObject->m_CO_Flags.set(flObjectInGroupUnique, TRUE); } } return true; }
bool ESceneCustomMTools::Load(IReader& F) { if (F.find_chunk(CHUNK_TOOLS_TAG)){ F.r_stringZ (m_ModifName); F.r (&m_ModifTime,sizeof(m_ModifTime)); }else{ m_ModifName = ""; m_ModifTime = 0; } return true; }
void CSector::load (IReader& fs) { // Assign portal polygons u32 size = fs.find_chunk(fsP_Portals); R_ASSERT(0==(size&1)); u32 count = size/2; m_portals.reserve (count); while (count) { u16 ID = fs.r_u16(); CPortal* P = (CPortal*)RImplementation.getPortal (ID); m_portals.push_back(P); count--; } if (g_dedicated_server) m_root = 0; else { // Assign visual size = fs.find_chunk(fsP_Root); R_ASSERT(size==4); m_root = (dxRender_Visual*)RImplementation.getVisual (fs.r_u32()); } }
bool CEditableObject::LoadBoneData(IReader& F) { BoneVec load_bones; int count=0; IReader* R; while(0!=(R=F.open_chunk(count++))) { CBone* nBone = xr_new<CBone>(); load_bones.push_back(nBone); nBone->LoadData(*R); Msg("loaded bone [%s]", nBone->Name().c_str()); } bool bRes = true; // load bones if (!load_bones.empty()){ for (BoneIt b_it=m_Bones.begin(); b_it!=m_Bones.end(); b_it++){ CBone* B = *b_it; BoneIt n_it = std::find_if(load_bones.begin(),load_bones.end(),fBoneNameEQ(B->Name())); if (n_it!=load_bones.end()) { B->CopyData (*n_it); }else{ ELog.Msg (mtError,"Can't find bone: '%s'.",*(*b_it)->Name()); bRes = false; // break; } } for (BoneIt n_it=load_bones.begin(); n_it!=load_bones.end(); n_it++) xr_delete(*n_it); load_bones.clear(); }else{ ELog.Msg (mtError,"Empty bone list."); bRes = false; } // load bone part if (F.find_chunk(EOBJ_CHUNK_BONEPARTS2)){ shared_str buf; m_BoneParts.resize(F.r_u32()); for (BPIt bp_it=m_BoneParts.begin(); bp_it!=m_BoneParts.end(); bp_it++){ F.r_stringZ (buf); bp_it->alias=buf; bp_it->bones.resize (F.r_u32()); for (RStringVecIt s_it=bp_it->bones.begin(); s_it!=bp_it->bones.end(); s_it++) F.r_stringZ (*s_it); } if (!m_BoneParts.empty()&&!VerifyBoneParts()) ELog.Msg (mtError,"Invalid bone parts. Found missing or duplicate bone."); }else{ ELog.Msg (mtError,"Can't load bone parts. Invalid version."); } return bRes; }
bool ESceneAIMapTool::LoadStream(IReader& F) { inherited::LoadStream (F); u16 version = 0; R_ASSERT(F.r_chunk(AIMAP_CHUNK_VERSION,&version)); if( version!=AIMAP_VERSION ){ ELog.DlgMsg( mtError, "AIMap: Unsupported version."); return false; } R_ASSERT(F.find_chunk(AIMAP_CHUNK_FLAGS)); F.r (&m_Flags,sizeof(m_Flags)); R_ASSERT(F.find_chunk(AIMAP_CHUNK_BOX)); F.r (&m_AIBBox,sizeof(m_AIBBox)); R_ASSERT(F.find_chunk(AIMAP_CHUNK_PARAMS)); F.r (&m_Params,sizeof(m_Params)); R_ASSERT(F.find_chunk(AIMAP_CHUNK_NODES)); m_Nodes.resize (F.r_u32()); for (AINodeIt it=m_Nodes.begin(); it!=m_Nodes.end(); it++){ *it = xr_new<SAINode>(); (*it)->LoadStream (F,this); } DenumerateNodes (); if (F.find_chunk(AIMAP_CHUNK_INTERNAL_DATA)){ m_VisRadius = F.r_float(); m_BrushSize = F.r_u32(); } if (F.find_chunk(AIMAP_CHUNK_INTERNAL_DATA2)){ m_SmoothHeight = F.r_float(); } // snap objects if (F.find_chunk(AIMAP_CHUNK_SNAP_OBJECTS)){ shared_str buf; int cnt = F.r_u32(); if (cnt){ for (int i=0; i<cnt; i++){ F.r_stringZ (buf); CCustomObject* O = Scene->FindObjectByName(buf.c_str(),OBJCLASS_SCENEOBJECT); if (!O) ELog.Msg(mtError,"AIMap: Can't find snap object '%s'.",buf.c_str()); else m_SnapObjects.push_back(O); } } } hash_FillFromNodes (); return true; }
void SGameMtlPair::Load(IReader& fs) { shared_str buf; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_PAIR)); mtl0 = fs.r_u32(); mtl1 = fs.r_u32(); ID = fs.r_u32(); ID_parent = fs.r_u32(); OwnProps.assign (fs.r_u32()); R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_BREAKING)); fs.r_stringZ (buf); BreakingSounds = *buf; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_STEP)); fs.r_stringZ (buf); StepSounds = *buf; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_COLLIDE)); fs.r_stringZ (buf); CollideSounds = *buf; fs.r_stringZ (buf); CollideParticles= *buf; fs.r_stringZ (buf); CollideMarks = *buf; }
void CBone::Load_1(IReader& F) { R_ASSERT(F.find_chunk(BONE_CHUNK_VERSION)); u16 ver = F.r_u16(); if ((ver!=0x0001)&&(ver!=BONE_VERSION)) return; R_ASSERT(F.find_chunk(BONE_CHUNK_DEF)); F.r_stringZ (name); xr_strlwr(name); F.r_stringZ (parent_name); xr_strlwr(parent_name); F.r_stringZ (wmap); R_ASSERT(F.find_chunk(BONE_CHUNK_BIND_POSE)); F.r_fvector3 (rest_offset); F.r_fvector3 (rest_rotate); rest_length = F.r_float(); if (ver==0x0001) std::swap (rest_rotate.x,rest_rotate.y); LoadData (F); }
void SGameMtlPair::Load(IReader& fs) { shared_str buf; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_PAIR)); mtl0 = fs.r_u32(); mtl1 = fs.r_u32(); ID = fs.r_u32(); ID_parent = fs.r_u32(); u32 own_mask = fs.r_u32(); if (GAMEMTL_NONE_ID==ID_parent) OwnProps.one (); else OwnProps.assign (own_mask); R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_BREAKING)); fs.r_stringZ (buf); BreakingSounds = buf.size()?*buf:""; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_STEP)); fs.r_stringZ (buf); StepSounds = buf.size()?*buf:""; R_ASSERT(fs.find_chunk(GAMEMTLPAIR_CHUNK_COLLIDE)); fs.r_stringZ (buf); CollideSounds = buf.size()?*buf:""; fs.r_stringZ (buf); CollideParticles= buf.size()?*buf:""; fs.r_stringZ (buf); CollideMarks = buf.size()?*buf:""; }
//------------------------------------------------------------------------------ // I/O part //------------------------------------------------------------------------------ BOOL CPGDef::Load(IReader& F) { R_ASSERT (F.find_chunk(PGD_CHUNK_VERSION)); u16 version = F.r_u16(); if (version!=PGD_VERSION){ Log ("!Unsupported PG version. Load failed."); return FALSE; } R_ASSERT (F.find_chunk(PGD_CHUNK_NAME)); F.r_stringZ (m_Name); F.r_chunk (PGD_CHUNK_FLAGS,&m_Flags); if (F.find_chunk(PGD_CHUNK_EFFECTS)){ m_Effects.resize(F.r_u32()); for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){ *it = xr_new<SEffect>(); F.r_stringZ ((*it)->m_EffectName); F.r_stringZ ((*it)->m_OnPlayChildName); F.r_stringZ ((*it)->m_OnBirthChildName); F.r_stringZ ((*it)->m_OnDeadChildName); (*it)->m_Time0 = F.r_float(); (*it)->m_Time1 = F.r_float(); (*it)->m_Flags.assign (F.r_u32()); } }else{ //.??? убрать через некоторое время R_ASSERT (F.find_chunk(PGD_CHUNK_EFFECTS2)); m_Effects.resize(F.r_u32()); for (EffectIt it=m_Effects.begin(); it!=m_Effects.end(); it++){ *it = xr_new<SEffect>(); F.r_stringZ ((*it)->m_EffectName); F.r_stringZ ((*it)->m_OnPlayChildName); (*it)->m_Time0 = F.r_float(); (*it)->m_Time1 = F.r_float(); (*it)->m_Flags.assign (F.r_u32()); } } if (F.find_chunk(PGD_CHUNK_TIME_LIMIT)){ m_fTimeLimit= F.r_float(); } #ifdef _EDITOR if (F.find_chunk(PGD_CHUNK_OWNER)){ F.r_stringZ (m_OwnerName); F.r_stringZ (m_ModifName); F.r (&m_CreateTime,sizeof(m_CreateTime)); F.r (&m_ModifTime,sizeof(m_ModifTime)); } #endif return TRUE; }
bool ESceneSpawnTool::LoadStream(IReader& F) { u16 version = 0; if(F.r_chunk(CHUNK_VERSION,&version)) if( version!=SPAWN_TOOLS_VERSION ){ ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc()); return false; } if (!inherited::LoadStream(F)) return false; if (F.find_chunk(CHUNK_FLAGS)) m_Flags.assign (F.r_u32()); return true; }
bool ESoundEnvironment::LoadStream(IReader& F) { u16 version = 0; R_ASSERT(F.r_chunk(SOUND_CHUNK_VERSION,&version)); if(version!=SOUND_ENV_VERSION){ ELog.DlgMsg( mtError, "ESoundSource: Unsupported version."); return false; } inherited::LoadStream (F); R_ASSERT(F.find_chunk(SOUND_CHUNK_ENV_REFS)); F.r_stringZ (m_EnvInner); F.r_stringZ (m_EnvOuter); return true; }
bool EScene::ReadObjectStream(IReader& F, CCustomObject*& O) { ObjClassID clsid =OBJCLASS_DUMMY; R_ASSERT (F.find_chunk(CHUNK_OBJECT_CLASS)); clsid = ObjClassID(F.r_u32()); O = GetOTool(clsid)->CreateObject(0,0); IReader* S = F.open_chunk(CHUNK_OBJECT_BODY); R_ASSERT (S); bool bRes = O->LoadStream(*S); S->close (); if (!bRes) xr_delete (O); return bRes; }