コード例 #1
0
ファイル: ImageInfo.cpp プロジェクト: 0-T-0/Serious-Engine
// writes image info raw format to file
void CImageInfo::Write_t( CTStream *outFile) const  // throw char *
{
  // write image info header
  outFile->WriteID_t( CChunkID("CTII"));
  outFile->WriteSize_t( 5*4);

  *outFile << (PIX)ii_Width;
  *outFile << (PIX)ii_Height;
  *outFile << (SLONG)ii_BitsPerPixel;

  // write image contents (all channels)
  ULONG pic_size = ii_Width*ii_Height * ii_BitsPerPixel/8;
  outFile->WriteFullChunk_t( CChunkID("IPIC"), ii_Picture, pic_size);
}
コード例 #2
0
void CEmiter::Read_t( CTStream &strm,BOOL bNetwork)
{
  if (strm.PeekID_t()!=CChunkID(ID_EMITER_VER)) return;
  strm.GetID_t();
  INDEX ctMaxParticles;
  strm>>ctMaxParticles;
  
  em_bInitialized=TRUE;
  INDEX ietType;
  strm>>ietType;
  em_etType=(CEmiterType) ietType;
  strm>>em_tmStart;
  strm>>em_tmLife;
  strm>>em_vG;
  strm>>em_colGlobal;
  strm>>em_iGlobal;

  if(ctMaxParticles==0) return;
  em_aepParticles.Push(ctMaxParticles);

  for(INDEX i=0; i<em_aepParticles.Count(); i++)
  {
    CEmittedParticle &em=em_aepParticles[i];
    em.Read_t(strm,bNetwork);
  }
}
コード例 #3
0
/*
 * Read world brushes from stream.
 */
void CWorld::ReadBrushes_t( CTStream *istrm)// throw char *
{
  _pfWorldEditingProfile.StartTimer(CWorldEditingProfile::PTI_READBRUSHES);

  // must be in 53bit mode when managing brushes
  CSetFPUPrecision FPUPrecision(FPT_53BIT);
  
  ReadInfo_t(istrm, FALSE);

  SetProgressDescription(TRANS("loading world textures"));
  CallProgressHook_t(0.0f);
  // read the brushes from the file
  _pwoCurrentLoading = this;
  istrm->DictionaryReadBegin_t();
  istrm->DictionaryPreload_t();
  CallProgressHook_t(1.0f);
  SetProgressDescription(TRANS("loading brushes"));
  CallProgressHook_t(0.0f);
  wo_baBrushes.Read_t(istrm);
  CallProgressHook_t(1.0f);

  // if there are some terrais in world
  if(istrm->PeekID_t()==CChunkID("TRAR")) { // 'terrain archive'
    SetProgressDescription(TRANS("loading terrains"));
    CallProgressHook_t(0.0f);
    wo_taTerrains.Read_t(istrm);
    CallProgressHook_t(1.0f);
  }

  istrm->DictionaryReadEnd_t();
  _pwoCurrentLoading = NULL;
  _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_READBRUSHES);
}
コード例 #4
0
ファイル: ImageInfo.cpp プロジェクト: 0-T-0/Serious-Engine
// reads image info raw format from file
void CImageInfo::Read_t( CTStream *inFile)   // throw char *
{
  Clear();

  // read image info header
  inFile->ExpectID_t( CChunkID("CTII"));
  if( inFile->GetSize_t() != 5*4) throw( "Invalid image info file.");

  *inFile >> (PIX)ii_Width;
  *inFile >> (PIX)ii_Height;
  *inFile >> (SLONG)ii_BitsPerPixel;

  // read image contents (all channels)
  ULONG pic_size = ii_Width*ii_Height * ii_BitsPerPixel/8;
  ii_Picture = (UBYTE*)AllocMemory( pic_size);
  inFile->ReadFullChunk_t( CChunkID("IPIC"), ii_Picture, pic_size);
}
コード例 #5
0
// get level info for given filename
BOOL GetLevelInfo(CLevelInfo &li, const CTFileName &fnm)
{
  // try to
  try {
    // open the world file
    CTFileStream strm;
    strm.Open_t(fnm);
    // skip initial chunk ids
    strm.ExpectID_t("BUIV"); // 'build version'
    INDEX iDummy;
    strm>>iDummy; // the version number
    strm.ExpectID_t("WRLD"); // 'world'
    strm.ExpectID_t("WLIF"); // 'world info'
    if (strm.PeekID_t()==CChunkID("DTRS")) {
      strm.ExpectID_t("DTRS"); // 'world info'
    }
    // read the name
    strm>>li.li_strName;
    // read the flags
    strm>>li.li_ulSpawnFlags;

    // translate name
    li.li_strName = TranslateConst(li.li_strName, 0);

    // if dummy name
    if (li.li_strName=="") {
      // use filename
      li.li_strName = fnm.FileName();
    }

    // remember filename
    li.li_fnLevel = fnm;

    // succeed
    return TRUE;

  // if failed
  } catch (char *strError) {
    (void) strError;
    //CPrintF("Invalid world file '%s': %s\n", (const char*) fnm, strError);
    // set dummy info
    li = CLevelInfo();
    // fail
    return FALSE;
  }
}
コード例 #6
0
void CEmiter::Write_t( CTStream &strm,BOOL bNetwork)
{
  if( !em_bInitialized) return;
  INDEX ctMaxParticles=em_aepParticles.Count();
  strm.WriteID_t(CChunkID(ID_EMITER_VER));
  strm<<ctMaxParticles;

  strm<<INDEX(em_etType);
  strm<<em_tmStart;
  strm<<em_tmLife;
  strm<<em_vG;
  strm<<em_colGlobal;
  strm<<em_iGlobal;

  for(INDEX i=0; i<em_aepParticles.Count(); i++)
  {
    CEmittedParticle &em=em_aepParticles[i];
    em.Write_t(strm,bNetwork);
  }
}