示例#1
0
文件: lset.cpp 项目: drodin/Crimson
int UnitSet::Load( MemBuffer &file, const char *setname ) {
  int rc = -1;

  if ( file.Read32() == FID_UNITSET ) {
    num_tiles = file.Read16();
    num_sfx = file.Read8();

    if ( !LoadSfx( file ) && !LoadUnitTypes( file ) &&
         !TileSet::Load( file, setname ) ) {
      unsigned char num_portraits = file.Read8();
      if ( num_portraits ) {
        portraits = new Surface [num_portraits];

        for ( int i = 0; i < num_portraits; ++i ) {
          if ( portraits[i].LoadImageData( file ) ) return -1;
          portraits[i].DisplayFormat();
        }
      }

      rc = 0;
    }
  }

  return rc;
}
示例#2
0
文件: lset.cpp 项目: drodin/Crimson
int TerrainType::Load( MemBuffer &file ) {
  tt_type = file.Read16();
  tt_image = file.Read16();
  tt_att_mod = file.Read8();
  tt_def_mod = file.Read8();
  tt_move = file.Read8();
  tt_color = file.Read32();
  return 0;
}
示例#3
0
int Building::Load( MemBuffer &file ) {
  b_id = file.Read16();
  b_pos.x = file.Read16();
  b_pos.y = file.Read16();
  b_flags = file.Read16();
  b_crystals = file.Read16();
  b_maxcrystals = file.Read16();
  b_uprod = file.Read32();

  b_cprod = file.Read8();
  b_pid = file.Read8();
  b_minweight = file.Read8();
  b_maxweight = file.Read8();
  b_name_id = file.Read8();
  b_name = 0;
  return 0;
}
示例#4
0
文件: lset.cpp 项目: drodin/Crimson
int UnitType::Load( MemBuffer &file, const UnitSet *set ) {
  ut_snd_move = ut_snd_fire = NULL;
  ut_terrain = file.Read16();
  ut_image = file.Read16();
  ut_flags = file.Read16();
  file.Read( &ut_moves, 13 );

  // set sound effects
  unsigned char sfx[2];
  sfx[0] = file.Read8();
  sfx[1] = file.Read8();
  if ( sfx[0] != UT_NO_SOUND ) ut_snd_move = set->GetSound( sfx[0] );
  if ( sfx[1] != UT_NO_SOUND ) ut_snd_fire = set->GetSound( sfx[1] );

  file.Read( &ut_trans_slots, 5 );
  return 0;
}
示例#5
0
文件: lset.cpp 项目: drodin/Crimson
int UnitSet::LoadSfx( MemBuffer &file ) {
  if ( num_sfx ) {
    string sfxd( get_sfx_dir() ), sfxname;
    unsigned char len;

    sfx = new SoundEffect * [num_sfx];
    if ( !sfx ) return -1;

    for ( int i = 0; i < num_sfx; ++i ) {
      len = file.Read8();
      sfxname = file.ReadS( len );
      sfx[i] = new SoundEffect( (sfxd + sfxname).c_str() );
    }
  }

  return 0;
}