예제 #1
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;
        }
      }
    }
  }
예제 #2
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;
        }
      }
    }
  }
예제 #3
0
    //
    // 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;
          }
        }
      }
    }
예제 #4
0
  //
  // Obj::Obj
  //
  // Constructor
  //
  Obj::Obj(FScope *fScope, const char *name) : 
    name(name)
  {
    FScope *sScope;

    defaultLocation = NULL;

    // Process each function
    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {

        case 0x1E534497: // "Tag"
        {
          U32 tag = Crc::CalcStr(sScope->NextArgString());
          tags.Add(tag, new Location(sScope, name));
          break;
        }

        case 0x1D9D48EC: // "Type"
        {
          U32 type = Crc::CalcStr(sScope->NextArgString());
          types.Add(type, new Location(sScope, name));
          break;
        }

        case 0x666BCB68: // "Property"
        {
          properties.Append(new PropertyLocation(sScope, name));
          break;
        }

        case 0x8F651465: // "Default"
          if (defaultLocation)
          {
            sScope->ScopeError("Default has already been specified");
          }
          defaultLocation = new Location(sScope, name);
          break;
      }
    }
  }
예제 #5
0
  //
  // ProcessCreateTractionType
  //
  // Process a traction creation scope
  //
  void ProcessCreateTractionType(FScope *fScope)
  {
    ASSERT(initialized);
    ASSERT(fScope);

    FScope *sScope;
    U32 defaultSlope = 30;

    // Get the traction type index
    U8 traction = TractionIndex(fScope->NextArgString());

    // Process each function
    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x1788F661: // "DefaultSlope"
          defaultSlope = StdLoad::TypeU32(sScope, Range<U32>(0, 90));
          break;

        case 0x841386F6: // "OverSurface"
        {
          // Get the type index
          U8 surface = SurfaceIndex(sScope->NextArgString());

          // Get the balance data for this combination
          BalanceData &data = table->GetBalance(surface, traction);

          // Speed is a percentage between 5% and 100%
          data.speed = StdLoad::TypeF32(sScope, Range<F32>(MIN_PASSABLE_SPEED, 1.0F));

          // The slope is between 0 and 90, where 0 is horizontal
          data.slope = (U8)defaultSlope;

          // Health modifier is a percentage of maximum hitpoints
          data.health = StdLoad::TypeF32(sScope, data.health, Range<F32>(-1.0F, 1.0F));
          break;
        }
      }
    }
  }
예제 #6
0
    //
    // Execute a block of commands
    //
    void Cineractive::ExecBlock(FScope *fScope)
    {
      FScope *sScope;

      while ((sScope = fScope->NextFunction()) != NULL)
      {
        LOG_VIEWER(("Exec: [%s]", sScope->NameStr()))

        switch (sScope->NameCrc())
        {
          case 0x9D71F205: // "Movie"
          {
            // Disable movies in multiplayer campaigns
            if (!MultiPlayer::Data::Online())
            {
              if (moviePrim)
              {
                delete moviePrim;
              }
              moviePrim = new Movie(this, sScope);
            }
            break;
          }

          case 0x0DA67726: // "AlphaNear"
            Vid::renderState.status.alphaNear = alphaNear = sScope->NextArgInteger();
            break;

          case 0x70600744: // "DisableIFace"
          {
            DisableIFace(sScope->NextArgInteger());
            break;
          }

          case 0x72C1779F: // "DisableHUD"
          {
            DisableHUD(sScope->NextArgInteger());
            break;
          }

          case 0x288F19CB: // "DisableInput"
          {
            DisableInput(sScope->NextArgInteger());
            break;
          }

          case 0xAA268B85: // "DisableShroud"
          {
            DisableShroud(sScope->NextArgInteger());
            break;
          }

          case 0x47518EE4: // "EndCineractive"
          {
            Terminate();
            break;
          }

          case 0x7E8E3E05: // "SkipPoint"
          {
            RestoreDisplay();
            break;
          }

          case 0xEA4227E1: // "SetBookmark"
          {
            SetBookmark(sScope);
            break;
          }

          case 0xDDD6437A: // "DefaultCamera"
          {
            LOG_VIEWER(("DefaultCamera"))

            if (Demo::IsPlaying())
            {
              SetCurrent("Playback0", StdLoad::TypeU32(sScope, U32(FALSE), Range<U32>::flag), sScope);
            }
            else
            {
              SetCurrent("default", StdLoad::TypeU32(sScope, U32(FALSE), Range<U32>::flag), sScope);
            }
            break;
          }

          case 0xF4356EC8: // "SetCamera"
          {
            SetCurrent(sScope->NextArgString(), FALSE, sScope);
            break;
          }

          case 0x9805A0A6: // "Mesh"
          {
            AddPrim(primitiveList, new Mesh(this, sScope));
            break;
          }

          case 0x16556EBC: // "Letterbox"
          {
            AddPrim(primitiveList, new Letterbox(this, sScope));
            break;
          }

          case 0x10A95B64: // "Fade"
          {
            AddPrim(primitiveList, new Fade(this, sScope));
            break;
          }

          case 0x76802A4E: // "Image"
          {
            AddPrim(primitiveList, new Image(this, sScope));
            break;
          }

          case 0x64DD3931: // "Wallpaper"
          {
            AddPrim(primitiveList, new Wallpaper(this, sScope));
            break;
          }

          case 0xCB28D32D: // "Text"
          {
            AddPrim(primitiveList, new Text(this, sScope));
            break;
          }

          case 0x8E18DC65: // "Subtitle"
          {
            AddPrim(primitiveList, new Subtitle(this, sScope));
            break;
          }

          case 0x37345010: // "Pause"
          {
            if (!GameTime::Paused())
            {
              GameTime::Pause(FALSE);
            }
            break;
          }

          case 0x0642D599: // "Unpause"
          {
            if (GameTime::Paused())
            {
              GameTime::Pause(FALSE);
            }
            break;
          }

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

          case 0x311D74EF: // "Debrief"
          {
            ProcessDebrief(sScope);
            break;
          }

          case 0x06A3B1BA: // "Action"
          {
            // Execute an objective action block
            ::Action::Execute(team, sScope);
            break;
          }

          default:
          {
            LOG_WARN(("Unknown function [%s] in Cineractive", sScope->NameStr()))
            break;
          }
        }
      }
    }