本文整理汇总了C++中IReader::r_string方法的典型用法代码示例。如果您正苦于以下问题:C++ IReader::r_string方法的具体用法?C++ IReader::r_string怎么用?C++ IReader::r_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReader
的用法示例。
在下文中一共展示了IReader::r_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemoryUsage
int ETextureThumbnail::MemoryUsage()
{
int mem_usage = _Width()*_Height()*4;
switch (m_TexParams.fmt){
case STextureParams::tfDXT1:
case STextureParams::tfADXT1: mem_usage/=6; break;
case STextureParams::tfDXT3:
case STextureParams::tfDXT5: mem_usage/=4; break;
case STextureParams::tf4444:
case STextureParams::tf1555:
case STextureParams::tf565: mem_usage/=2; break;
case STextureParams::tfRGBA: break;
}
string_path fn;
FS.update_path (fn,_game_textures_,EFS.ChangeFileExt(m_Name.c_str(),".seq").c_str());
if (FS.exist(fn))
{
string128 buffer;
IReader* F = FS.r_open(0,fn);
F->r_string (buffer,sizeof(buffer));
int cnt = 0;
while (!F->eof()){
F->r_string(buffer,sizeof(buffer));
cnt++;
}
FS.r_close (F);
mem_usage *= cnt?cnt:1;
}
return mem_usage;
}
示例2: MemoryUsage
u32 STextureParams::MemoryUsage(LPCSTR base_name)
{
u32 mem_usage = width*height*4;
if (flags.test(flGenerateMipMaps)) { mem_usage*=3ul; mem_usage/=2ul; }
switch (fmt){
case STextureParams::tfDXT1:
case STextureParams::tfADXT1: mem_usage/=6; break;
case STextureParams::tfDXT3:
case STextureParams::tfDXT5: mem_usage/=4; break;
case STextureParams::tf4444:
case STextureParams::tf1555:
case STextureParams::tf565: mem_usage/=2; break;
case STextureParams::tfRGBA: break;
}
xr_string fn;
FS.update_path (fn,_game_textures_,EFS.ChangeFileExt(base_name,".seq").c_str());
if (FS.exist(fn.c_str())){
string128 buffer;
IReader* F = FS.r_open(0,fn.c_str());
F->r_string (buffer,sizeof(buffer));
int cnt = 0;
while (!F->eof()){
F->r_string(buffer,sizeof(buffer));
cnt++;
}
FS.r_close (F);
mem_usage *= cnt?cnt:1;
}
return mem_usage;
}
示例3: Execute
void CCC_LoadCFG::Execute(LPCSTR args)
{
Msg("Executing config-script \"%s\"...", args);
string_path cfg_name;
xr_strcpy(cfg_name, args);
if (strext(cfg_name)) *strext(cfg_name) = 0;
xr_strcat(cfg_name, ".ltx");
string_path cfg_full_name;
FS.update_path(cfg_full_name, "$app_data_root$", cfg_name);
if (NULL == FS.exist(cfg_full_name))
FS.update_path(cfg_full_name, "$fs_root$", cfg_name);
if (NULL == FS.exist(cfg_full_name))
xr_strcpy(cfg_full_name, cfg_name);
IReader* F = FS.r_open(cfg_full_name);
string1024 str;
if (F != NULL)
{
while (!F->eof())
{
F->r_string(str, sizeof(str));
if (allow(str))
Console->Execute(str);
}
FS.r_close(F);
Msg("[%s] successfully loaded.", cfg_full_name);
}
else
{
Msg("! Cannot open script file [%s]", cfg_full_name);
}
}
示例4: sizeof
void CKinematics::Load(const char* N, IReader *data, u32 dwFlags)
{
//Msg ("skeleton: %s",N);
inherited::Load (N, data, dwFlags);
pUserData = NULL;
m_lod = NULL;
// loading lods
IReader* LD = data->open_chunk(OGF_S_LODS);
if (LD)
{
string_path short_name;
strcpy_s (short_name,sizeof(short_name),N);
if (strext(short_name)) *strext(short_name)=0;
// From stream
{
string_path lod_name;
LD->r_string (lod_name, sizeof(lod_name));
//. strconcat (sizeof(name_load),name_load, short_name, ":lod:", lod_name.c_str());
m_lod = ::Render->model_CreateChild(lod_name, NULL);
VERIFY3(m_lod,"Cant create LOD model for", N);
//. VERIFY2 (m_lod->Type==MT_HIERRARHY || m_lod->Type==MT_PROGRESSIVE || m_lod->Type==MT_NORMAL,lod_name.c_str());
/*
strconcat (name_load, short_name, ":lod:1");
m_lod = ::Render->model_CreateChild(name_load,LD);
VERIFY (m_lod->Type==MT_SKELETON_GEOMDEF_PM || m_lod->Type==MT_SKELETON_GEOMDEF_ST);
*/
}
LD->close ();
}
#ifndef _EDITOR
// User data
IReader* UD = data->open_chunk(OGF_S_USERDATA);
pUserData = UD?xr_new<CInifile>(UD,FS.get_path("$game_config$")->m_Path):0;
if (UD) UD->close();
#endif
// Globals
bone_map_N = xr_new<accel> ();
bone_map_P = xr_new<accel> ();
bones = xr_new<vecBones> ();
bone_instances = NULL;
// Load bones
#pragma todo("container is created in stack!")
xr_vector<shared_str> L_parents;
R_ASSERT (data->find_chunk(OGF_S_BONE_NAMES));
visimask.zero ();
int dwCount = data->r_u32();
// Msg ("!!! %d bones",dwCount);
// if (dwCount >= 64) Msg ("!!! More than 64 bones is a crazy thing! (%d), %s",dwCount,N);
VERIFY3 (dwCount < 64, "More than 64 bones is a crazy thing!",N);
for (; dwCount; dwCount--) {
string256 buf;
// Bone
u16 ID = u16(bones->size());
data->r_stringZ (buf,sizeof(buf)); strlwr(buf);
CBoneData* pBone = CreateBoneData(ID);
pBone->name = shared_str(buf);
pBone->child_faces.resize (children.size());
bones->push_back (pBone);
bone_map_N->push_back (mk_pair(pBone->name,ID));
bone_map_P->push_back (mk_pair(pBone->name,ID));
// It's parent
data->r_stringZ (buf,sizeof(buf)); strlwr(buf);
L_parents.push_back (buf);
data->r (&pBone->obb,sizeof(Fobb));
visimask.set (u64(1)<<ID,TRUE);
}
std::sort (bone_map_N->begin(),bone_map_N->end(),pred_sort_N);
std::sort (bone_map_P->begin(),bone_map_P->end(),pred_sort_P);
// Attach bones to their parents
iRoot = BI_NONE;
for (u32 i=0; i<bones->size(); i++) {
shared_str P = L_parents[i];
CBoneData* B = (*bones)[i];
if (!P||!P[0]) {
// no parent - this is root bone
R_ASSERT (BI_NONE==iRoot);
iRoot = u16(i);
B->SetParentID(BI_NONE);
continue;
} else {
u16 ID = LL_BoneID(P);
R_ASSERT (ID!=BI_NONE);
(*bones)[ID]->children.push_back(B);
B->SetParentID(ID);
}
}
R_ASSERT (BI_NONE != iRoot);
//.........这里部分代码省略.........