Esempio n. 1
0
// Load():
void SelectOMatic_Item::Load( const LWLoadState *loader ) {
  int  keyword_id;
  char cvalue;
  char buffer[512];

  while( keyword_id = LWLOAD_FIND( loader, selectomatic_item_io_root ) ) {
    switch( keyword_id ) {
      // Item ID
      case SOMITEMIOPRE_ITID:
        LWLOAD_STR( loader, buffer, 512 );
        sscanf( buffer, "%x", &id );
        break;

      // Folded
      case SOMITEMIOPRE_FOLD:
        LWLOAD_I1( loader, &cvalue, 1 );
        is_folded = (cvalue != 0);
        break;

      // Group Name
      case SOMITEMIOPRE_NAME:
        LWLOAD_STR( loader, buffer, 512 );
        SetName( buffer );
        break;

      // Children
      case SOMITEMIOPRE_CHLD: {
        while( keyword_id = LWLOAD_FIND( loader, selectomatic_item_io_item ) ) {
          SelectOMatic_Item *item = new SelectOMatic_Item( NULL, this );
          item->Load( loader );
          children.Add( item );
        }
      }
    }

    LWLOAD_END( loader );            // End Keyword
  }

  LWLOAD_END( loader );              // End ITEM
}
Esempio n. 2
0
Load( AtmosphereData *dat, const LWLoadState *lState )
{
   int version, txtr = 0;
   float fp[ 3 ];

   LWLOAD_I4( lState, &version, 1 );

   LWLOAD_FP( lState, fp, 1);   dat->hi  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->lo  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->fa  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->lum = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->opa = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->den = fp[ 0 ];
   LWLOAD_FP( lState, fp, 3);   VCPY( dat->col, fp );

   LWLOAD_I4( lState, &dat->res, 1 );
   LWLOAD_I4( lState, &dat->useTxtr, 1 );
   LWLOAD_I4( lState, &dat->march, 1 );
   if ( version > 1 )
      LWLOAD_I4( lState, &dat->bck, 1 );

   if ( version > 2 )
      LWLOAD_I4( lState, &txtr, 1 );
   else
      return NULL;

   if ( !txtr ) return NULL;

   if ( LWLOAD_FIND( lState, headerBlks )) {
      if ( !dat->txtr )
         dat->txtr = txtrf->create( TRT_COLOR, "FogTexture", NULL, NULL );
      txtrf->load( dat->txtr, lState );

      LWLOAD_END( lState );
   }

   return NULL;
}
Esempio n. 3
0
// Load():
const char * IllumiSurf_Instance::Load( const LWLoadState *loader ) {
  char cvalue;

  if( ISIOPRE_ISFV == LWLOAD_FIND( loader, illumisurf_io_isfv ) ) {
    LWLOAD_I1( loader, &cvalue, 1 );
    if( cvalue != 1 )
      return "IllumiSurf Error:  Unsupported version found, aborting load";

    while( int id = LWLOAD_FIND( loader, illumisurf_io_root ) ) {
      switch( id ) {
        case ISIOPRE_BLND:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetBlendMode( (IllumiSurf_BlendModes)cvalue );
          break;

        case ISIOPRE_BINT:
          vparam_funcs->load( GetBaseIntensity(), loader );
          break;

        case ISIOPRE_AINT:
          vparam_funcs->load( GetAltIntensity(), loader );
          break;

        case ISIOPRE_COLR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseColor( cvalue != 0 );
          vparam_funcs->load( GetColor(), loader );
          break;

        case ISIOPRE_LUMI:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseLuminosity( cvalue != 0 );
          vparam_funcs->load( GetLuminosity(), loader );
          break;

        case ISIOPRE_DIFF:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseDiffusion( cvalue != 0 );
          vparam_funcs->load( GetDiffusion(), loader );
          break;

        case ISIOPRE_SPEC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseSpecular( cvalue != 0 );
          vparam_funcs->load( GetSpecular(), loader );
          break;

        case ISIOPRE_GLOS:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseGlossiness( cvalue != 0 );
          vparam_funcs->load( GetGlossiness(), loader );
          break;

        case ISIOPRE_REFL:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseReflection( cvalue != 0 );
          vparam_funcs->load( GetReflection(), loader );
          break;

        case ISIOPRE_TRNP:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTransparency( cvalue != 0 );
          vparam_funcs->load( GetTransparency(), loader );
          break;

        case ISIOPRE_REFR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseRefraction( cvalue != 0 );
          vparam_funcs->load( GetRefraction(), loader );
          break;

        case ISIOPRE_TRNC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTranslucency( cvalue != 0 );
          vparam_funcs->load( GetTranslucency(), loader );
          break;
      }

      LWLOAD_END( loader );            // End Keyword
    }

    LWLOAD_END( loader );            // End Keyword
  }

  return NULL;
}