本文整理汇总了C++中IReader::r_chunk方法的典型用法代码示例。如果您正苦于以下问题:C++ IReader::r_chunk方法的具体用法?C++ IReader::r_chunk怎么用?C++ IReader::r_chunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReader
的用法示例。
在下文中一共展示了IReader::r_chunk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
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;
}
示例2: LoadStream
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;
}
示例3: Load
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;
}
示例4: Load
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;
}
示例5: check_files
void recalculation::check_files( u32 check_sum )
{
string_path N,L;
FS.update_path ( L, "$level$", "level.details" );
FS.update_path ( N, "$level$", "recalculation_data_slots.details" );
if( ! FS.exist( L ) )
{
FS.file_delete( N );
return;
}
IReader* R = FS.r_open ( "$level$", "recalculation_data_slots.details" );
if( R )
{
u32 check;
R->r_chunk( 0, &check );
if( check != check_sum )
FS.file_delete( N );
else
recalculate = true;
FS.r_close( R ) ;
}
}
示例6: Load
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;
}
示例7: pointer
void global_slots_data:: Load ( )
{
// Load .details
// copy
//if()
IReader* R = FS.r_open ( "$level$", "build.details" );
R->r_chunk ( 0, &dtH );
R->seek ( 0 );
u32 check_sum = crc32( R-> pointer(), R->length());
recalculation_data.load( check_sum );
if( !recalculation_data.recalculating() )
{
IWriter* W = FS.w_open ( "$level$", "level.details" );
W->w ( R->pointer(), R->length() );
FS.w_close ( W );
}
FS.r_close ( R );
// re-open
string_path N;
FS.update_path ( N, "$level$", "level.details" );
dtFS = xr_new<CVirtualFileRW> ( N );
R_ASSERT ( dtH.version()==DETAIL_VERSION );
dtFS->find_chunk ( 2 );
dtS = (DetailSlot*)dtFS->pointer();
}
示例8: Load
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;
}
示例9: LoadStream
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;
}
示例10: Load
//------------------------------------------------------------------------------
// 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;
}
示例11: LoadSelection
bool ESceneLightTools::LoadSelection(IReader& F)
{
u16 version = 0;
R_ASSERT(F.r_chunk(CHUNK_VERSION,&version));
if( version!=LIGHT_TOOLS_VERSION ){
ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
return false;
}
return inherited::LoadSelection(F);
}
示例12: LoadSelection
bool ESceneCustomOTools::LoadSelection(IReader& F)
{
int count = 0;
F.r_chunk (CHUNK_OBJECT_COUNT,&count);
SPBItem* pb = UI->ProgressStart(count,AnsiString().sprintf("Loading %s's...",ClassDesc()).c_str());
Scene->ReadObjects(F,CHUNK_OBJECTS,OnLoadSelectionAppendObject,pb);
UI->ProgressEnd(pb);
return true;
}
示例13: Load
bool EScenePSTools::Load(IReader& F)
{
u16 version = 0;
if(F.r_chunk(CHUNK_VERSION,&version))
if( version!=PS_TOOLS_VERSION ){
ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
return false;
}
if (!inherited::Load(F)) return false;
return true;
}
示例14: LoadSelection
bool EScene::LoadSelection( LPCSTR fname )
{
u32 version = 0;
VERIFY( fname );
xr_string full_name;
full_name = fname;
ELog.Msg( mtInformation, "EScene: loading part %s...", fname );
bool res = true;
if (FS.exist(full_name.c_str())){
SelectObjects( false );
IReader* F = FS.r_open(full_name.c_str());
// Version
R_ASSERT(F->r_chunk(CHUNK_VERSION, &version));
if (version!=CURRENT_FILE_VERSION){
ELog.DlgMsg( mtError, "EScene: unsupported file version. Can't load Level.");
UI->UpdateScene();
FS.r_close(F);
return false;
}
// Objects
if (!ReadObjectsStream(*F,CHUNK_OBJECT_LIST,OnLoadSelectionAppendObject,0))
{
ELog.DlgMsg(mtError,"EScene. Failed to load selection.");
res = false;
}
SceneToolsMapPairIt _I = m_SceneTools.begin();
SceneToolsMapPairIt _E = m_SceneTools.end();
for (; _I!=_E; _I++)
if (_I->second&&_I->second->IsEnabled()&&_I->second->IsEditable()){
IReader* chunk = F->open_chunk(CHUNK_TOOLS_DATA+_I->first);
if (chunk){
_I->second->LoadSelection(*chunk);
chunk->close ();
}
}
// Synchronize
SynchronizeObjects();
FS.r_close(F);
}
return res;
}
示例15: LoadStream
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;
}