//
// ExplosionObj::LoadState
//
// Load a state configuration scope
//
void ExplosionObj::LoadState(FScope *fScope)
{
  // Call parent scope first
  MapObj::LoadState(fScope);

  fScope = fScope->GetFunction(SCOPE_CONFIG);
  FScope *sScope;

  while ((sScope = fScope->NextFunction()) != NULL)
  {
    switch (sScope->NameCrc())
    {
      case 0x9E64852D: // "Damage"
        damage.LoadState(sScope);
        break;

      case 0x6F5B0CAF: // "SourceUnit"
        StdLoad::TypeReaper(sScope, sourceUnit);
        break;

      case 0x5B0A6F84: // "SourceTeam"
        sourceTeam = Team::Name2Team(StdLoad::TypeString(sScope));
        break;
    }
  }
}
  //
  // Load
  //
  void TransportUnload::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0xA302E408: // "Destination"
          StdLoad::TypeVector(sScope, destination);
          break;

        case 0xD3D101D2: // "MoveHandle"
          moveHandle.LoadState(sScope);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }    
  }
  //
  // Load
  //
  void SquadFormation::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0x7223612A: // "Formation"
          formation = StdLoad::TypeU32(sScope);
          break;

        case 0x693D5359: // "Location"
          StdLoad::TypeVector(sScope, location);
          break;

        case 0x04BC5B80: // "Direction"
          direction = StdLoad::TypeF32(sScope);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }
  }
Beispiel #4
0
//
// LoadState
//
// Load state configuration
//
void SpyObj::LoadState(FScope *fScope)
{
  // Call parent scope first
  UnitObj::LoadState(fScope);

  // Get specific config scope
  if ((fScope = fScope->GetFunction(SCOPE_CONFIG, FALSE)) != NULL)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x95B674EF: // "MorphTeam"
          morphTeam = Team::Name2Team(StdLoad::TypeString(sScope));
          break;

        case 0x65DBDDCC: // "MorphType"
          StdLoad::TypeReaperObjType(sScope, morphType);
          Resolver::Type(morphType);
          break;
      }
    }
  }
}
Beispiel #5
0
  //
  // Load the modifier settings
  //
  void ModifierSettings::LoadState(FScope *fScope)
  {
    // Load the settings
    FScope *sScope;
    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x1F2EDF02: // "Set"
        {
          const char *modifier = sScope->NextArgString();
          const char *setting = sScope->NextArgString();

          U8 modifierIndex;
          U8 settingIndex;

          if (
            FindModifier(Crc::CalcStr(modifier), &modifierIndex) &&
            FindSetting(modifierIndex, Crc::CalcStr(setting), &settingIndex))
          {
            Set(modifierIndex, settingIndex);
          }
          else
          {
            LOG_WARN(("Invalid modifier setting combination %s:%s", modifier, setting))
          }
          break;
        }
      }
    }
  }
Beispiel #6
0
//
// ResourceObj::LoadState
//
// Load a state configuration scope
//
void ResourceObj::LoadState(FScope *fScope)
{
  // Call parent scope first
  MapObj::LoadState(fScope);

  if ((fScope = fScope->GetFunction(SCOPE_CONFIG, FALSE)) != NULL)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x5457F5AB: // "TeamHaveSeen"
          teamsHaveSeen = Game::TeamBitfield(StdLoad::TypeU32(sScope));
          break;

        case 0x7C8A86BB: // "ResourcePercent"
          resource = StdLoad::TypePercentage(sScope, ResourceType()->GetResourceMax());
          AdjustResource();
          break;
      }
    }
  }
}
//
// Load
//
void UnitExplore::Load(FScope *fScope)
{
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
        switch (sScope->NameCrc())
        {
        case 0x22C4A13F: // "StateMachine"
            inst.LoadState(sScope);
            break;

        case 0xD3D101D2: // "MoveHandle"
            moveHandle.LoadState(sScope);
            break;

        case 0x7BCDC81D: // "HangUntil"
            hangUntil = StdLoad::TypeU32(sScope);
            break;

        default:
            LoadTaskData(sScope);
            break;
        }
    }
}
  //
  // Load
  //
  void SquadMoveTogether::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0xA302E408: // "Destination"
          StdLoad::TypeVector(sScope, destination);
          break;

        case 0x04BC5B80: // "Direction"
          direction = StdLoad::TypeF32(sScope);
          break;

        case 0x82698073: // "Trail"
          StdLoad::TypeReaper(sScope, trail);
          break;

        case 0xA3998582: // "TrailIndex"
          index = StdLoad::TypeU32(sScope);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }  
  }
  //
  // LoadState
  //
  // Load state information
  //
  void Transport::Manager::LoadState(FScope *scope)
  {
    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0xDFB7F0C8: // "Transport"
        {
          // Load and resolve the transport object
          TransportObjPtr reaper;
          StdLoad::TypeReaper(sScope, reaper);
          Resolver::Object<TransportObj, TransportObjType>(reaper);

          if (reaper.Alive())
          {
            if (Transport *transport = FindIdleTransport(*reaper))
            {
              transport->LoadState(sScope);
            }
          }       
          break;
        }
      }
    }
  }
  //
  // Load
  //
  void UnitIdle::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0x5AB44811: // "Timer"
          timer.LoadState(sScope);
          break;

        case 0xA7DAA62B: // "AnimationCrc"
          animationCrc = StdLoad::TypeU32(sScope);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }
  }
  //
  // LoadState
  //
  // Load state information
  //
  void Transport::LoadState(FScope *scope)
  {
    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x693D5359: // "Location"
          StdLoad::TypeVector(sScope, location);
          break;

        case 0x8810AE3C: // "Script"
          script = manager.GetObject().GetScriptManager().FindScript(StdLoad::TypeU32(sScope));

          if (script)
          {
            AssignToSquad(script);
          }
          break;

        case 0x8669FADC: // "Flag"
          flag = StdLoad::TypeU32(sScope);
          break;
      }
    }
  }
Beispiel #12
0
  //
  // Process a StandardCursors scope
  //
  void ProcessStandardCursors(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x8F651465: // "Default"
          standardCrs[DEFAULT] = FindByName(sScope->NextArgString());
          break;

        case 0x23C19271: // "IBeam"
          standardCrs[IBEAM] = FindByName(sScope->NextArgString());
          break;

        case 0x6E758990: // "Wait"
          standardCrs[WAIT] = FindByName(sScope->NextArgString());
          break;

        case 0x65D94636: // "No"
          standardCrs[NO] = FindByName(sScope->NextArgString());
          break;

        default:
        {
          LOG_ERR(("Unknown standard cursor type [%s]", sScope->NameStr()));
          break;
        }
      }
    }
  }
Beispiel #13
0
//
// SquadObj::LoadState
//
// Load a state configuration scope
//
void SquadObj::LoadState(FScope *fScope)
{
  // Call parent scope first
  GameObj::LoadState(fScope);

  // Get specific config scope
  fScope = fScope->GetFunction(SCOPE_CONFIG);
  FScope *sScope;

  while ((sScope = fScope->NextFunction()) != NULL)
  {
    switch (sScope->NameCrc())
    {
      case 0xEDF0E1CF: // "Team"
        SetTeam(Team::Name2Team(StdLoad::TypeString(sScope)));
        break;

      case 0x2F382D90: // "ModifierSettings"
        settings.LoadState(sScope);
        break;

      case 0xE3554C44: // "Node"
      {
        ListNode *node = list.Append();
        StdLoad::TypeReaper(sScope, *node);
        node->LoadState(sScope);
        break;
      }
    }
  }
}
Beispiel #14
0
  //
  // Constructor
  //
  Table::Table(FScope *fScope)
  {
    // Setup the modifiers
    modifiers = new ModifierProperties *[numModifiers];
    for (U32 m = 0; m < numModifiers; m++)
    {
      modifiers[m] = new ModifierProperties(*Tactical::modifiers[m]);
    }

    FScope *sScope;
    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0xFEB2541D: // "ConfigureModifier"
        {
          U8 index;
          const char *modifier = StdLoad::TypeString(sScope);
          if (FindModifierIndex(Crc::CalcStr(modifier), index))
          {
            modifiers[index]->Load(sScope);
          }
          else
          {
            sScope->ScopeError("Could not find modifier '%s'", modifier);
          }
          break;
        }
      }
    }
  }
  //
  // LoadState
  //
  // Load state information
  //
  void Asset::Request::LoadState(FScope *scope, void *context)
  {
    // The context holds a pointer to the asset manager
    Manager *manager = reinterpret_cast<Manager *>(context);

    ASSERT(manager)

    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x411AC76D: // "Parent"
          Item::LoadState(sScope, context);
          break;

        case 0x8810AE3C: // "Script"
          script = manager->GetObject().GetScriptManager().FindScript(StdLoad::TypeU32(sScope));
          break;

        case 0xB5EA6B79: // "Handle"
          handle = StdLoad::TypeU32(sScope);
          break;
      }
    }
  }
Beispiel #16
0
  //
  // Constructor
  //
  Modifier::Modifier(FScope *fScope)
  : name(StdLoad::TypeString(fScope)),
    numSettings(0)
  {
    FScope *sScope;
    const char *defaultName = NULL;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x5FC15146: // "AddSetting"
          if (numSettings == MAXSETTINGS)
          {
            sScope->ScopeError("Maximum settings exceeded!");
          }
          settings[numSettings++] = new GameIdent(StdLoad::TypeString(sScope));
          break;

        case 0x733C1EB5: // "DefaultSetting"
          defaultName = StdLoad::TypeString(sScope);
          break;
      }
    }

    if (!defaultName)
    {
      fScope->ScopeError("Expected DefaultSetting");
    }

    if (!GetIndex(Crc::CalcStr(defaultName), defaultSetting))
    {
      fScope->ScopeError("Could not find setting '%s' in modifier '%s'", defaultName, GetName());
    }
  }
    //
    // Step to the next instruction "At" instruction
    //
    void Cineractive::NextInstruction()
    {
      ASSERT(instructions)

      FScope *fScope;
      nextScope = NULL;

      // Step to the next "At"
      while ((fScope = instructions->NextFunction()) != NULL)
      {
        LOG_VIEWER(("NextInstruction: [%s]", fScope->NameStr()))

        switch (fScope->NameCrc())
        {
          case 0x3F159CC9: // "DefineDebriefing"
          {
            debriefings.Add(Crc::CalcStr(fScope->NextArgString()), fScope);
            break;
          }

          case 0xBF046B0F: // "At"
          {
            nextScope = fScope;
            nextCycle = Utils::FtoLNearest(nextScope->NextArgFPoint() * GameTime::CYCLESPERSECOND);
            return;
          }

          default:
          {
            LOG_WARN(("Unexpected function [%s] in Cineractive", fScope->NameStr()))
            break;
          }
        }
      }
    }
  //
  // Load
  //
  void TransportPad::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0x4DA42E38: // "Charge"
          charge = StdLoad::TypeF32(sScope);
          break;

        case 0x79D1E3E5: // "Portal"
          StdLoad::TypeReaper(sScope, portal);
          break;

        case 0x5FF45B95: // "PortalTimer"
          portalTimer.LoadState(sScope);
          break;

        case 0x693D5359: // "Location"
          StdLoad::TypeVector(sScope, location);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }
  }
Beispiel #19
0
  //
  // LoadObjectFile
  //
  // Load a object definition file into current state, false if not found
  //
  Bool LoadObjectFile(const char *name)
  {
    ASSERT(name);

    PTree pTree;
    Bool safe = Missions::GetSafeLoad();

    // Parse the file
    GameGod::Loader::SubSystem("#game.loader.createobjects", 1);

    if (pTree.AddFile(name))
    {
      // Get the global scope
      FScope *gScope = pTree.GetGlobalScope();
      FScope *sScope;

      // Process each function
      GameGod::Loader::SubSystem("#game.loader.createobjects", gScope->GetBodyCount());

      while ((sScope = gScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0xCAE286FA: // "CreateObject"
            LoadCreateObject(sScope, safe);
            GameGod::Loader::Advance();
            break;
        }
      }

      if (GameGod::CheckObjects())
      {
        FSCOPE_CHECK(gScope)
      }

      // Call each existing game object
      GameGod::Loader::SubSystem("#game.loader.configureobjects", GameObjCtrl::listAll.GetCount());

      for (NList<GameObj>::Iterator i(&GameObjCtrl::listAll); *i; i++)
      {
        // Are we in safe-mode and this is a map object
        if (safe && Promote::Object<MapObjType, MapObj>(*i))
        {
        }
        else
        {
          // Call virtual post-load function
          (*i)->PostLoad();
        }

        GameGod::Loader::Advance();
      }

      return (TRUE);
    }
 //
 // TimeOfDay::Load
 //
 void TimeOfDay::Load(FScope *fScope)
 {
   FScope *sScope;
   while ((sScope = fScope->NextFunction()) != NULL)
   {
     switch (sScope->NameCrc())
     {
       case 0x8D0C1504: // "Sample"
         sample = sScope->NextArgFPoint();
         break;
     }
   }
 }
 //
 // Timer::Load
 //
 void Timer::Load(FScope *fScope)
 {
   FScope *sScope;
   while ((sScope = fScope->NextFunction()) != NULL)
   {
     switch (sScope->NameCrc())
     {
       case 0x5AB44811: // "Timer"
         timer.LoadState(sScope);
         break;
     }
   }
 }
Beispiel #22
0
  //
  // LoadConfig
  //
  // Load the configured difficulty settings
  //
  static void LoadConfig()
  {
    PTree pTree;
    GameIdent defaultName;

    // Clear any current settings
    ClearSettings();

    // Open the configuration file
    if (pTree.AddFile(configName))
    {
      FScope *gScope = pTree.GetGlobalScope();
      FScope *sScope;

      // Parse each function
      while ((sScope = gScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0x12AFF0D8: // "CreateSetting"
            ProcessCreateSetting(sScope);
            break;

          case 0x733C1EB5: // "DefaultSetting"
            defaultName = StdLoad::TypeString(sScope);
            break;
        }
      }

      // Ensure at least one setting is configured
      if (settings.GetCount())
      {
        // Setup the default setting
        if ((defaultSetting = FindSetting(defaultName)) == NULL)
        {
          defaultSetting = settings.GetHead();
        }

        // Set the current from the default
        currentSetting = defaultSetting;
      }
      else
      {
        ERR_CONFIG(("At least one difficulty setting must be supplied in [%s]", configName));
      }
    }
    else
    {
      ERR_CONFIG(("Unable to load difficulty settings configuration [%s]", configName));
    }
  }
Beispiel #23
0
  //
  // Load system data
  //
  void Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x801F421A: // "TaskId"
          taskId = StdLoad::TypeU32(sScope);
          break;
      }
    }
  }
Beispiel #24
0
  //
  // Load
  //
  // Load AI state data
  //
  void Load(FScope *scope)
  {
    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x622EF512: // "Strategic"
          Strategic::Load(sScope);
          break;
      }
    }
  }
  //
  // Load
  //
  void UnitConstruct::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        case 0x97522DEF: // "ProgressTotal"
          progressTotal = StdLoad::TypeF32(sScope);
          break;

        case 0xDA11482A: // "ProgressMax"
          progressMax = StdLoad::TypeF32(sScope);
          break;

        case 0xF5B25A80: // "ResourceRemoved"
          resourceRemoved = S32(StdLoad::TypeU32(sScope));
          break;

        case 0xE262D203: // "ResourceRemaining"
          resourceRemaining = S32(StdLoad::TypeU32(sScope));
          break;

        case 0x8BD8D5BA: // "HitPointsLeft"
          hitPointsLeft = S32(StdLoad::TypeU32(sScope));
          break;

        case 0xB73D3720: // "Constructor"
          StdLoad::TypeReaper(sScope, constructor);
          break;

        case 0x9574AB0C: // "ConstructListTeam"
          constructListTeam = Team::Name2Team(StdLoad::TypeString(sScope));
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }

    // Create the construction effect
    CreateEffect();
  }
Beispiel #26
0
  //
  // Load
  //
  // Load a list of tasks
  //
  void LoadTasks(GameObj *subject, FScope *fScope, NList<Task> &tasks)
  {
    // Iterate the scope
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x40B71B7D: // "Task"
          tasks.Append(LoadTask(subject, sScope));
          break;
      }
    }
  }
  //
  // LoadState
  //
  // Load state information
  //
  void Bombardier::LoadState(FScope *scope)
  {
    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0xD9A182E4: // "Unit"
        {
          StdLoad::TypeReaper(sScope, unit);
          Resolver::Object<UnitObj, UnitObjType>(unit);
          break;
        }
      }
    }
  }
  //
  // Load
  //
  void MapDeath::Load(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x22C4A13F: // "StateMachine"
          inst.LoadState(sScope);
          break;

        default:
          LoadTaskData(sScope);
          break;
      }
    }
  }
Beispiel #29
0
    //
    // Configure the cursor
    //
    void Configure(FScope *fScope)
    {
      FScope *sScope;

      while ((sScope = fScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0x207C29E1: // "FrameRate"
            speed = 1000 / Clamp<U32>(1, sScope->NextArgInteger(), 1000);
            break;

          case 0xD13EA311: // "AddFrame"
            AddFrame(sScope);
            break;
        }
      }
    }
  //
  // LoadState
  //
  // Load state information
  //
  void Asset::Request::Squad::LoadState(FScope *scope, void *context)
  {
    FScope *sScope;

    while ((sScope = scope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0xD1E197A4: // "From"
          StdLoad::TypeReaper(sScope, from);
          Resolver::Object<SquadObj, SquadObjType>(from);
          break;

        case 0x411AC76D: // "Parent"
          Request::LoadState(sScope, context);
          break;
      }
    }
  }