Ejemplo n.º 1
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;
          }
        }
      }
    }
Ejemplo n.º 2
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;
        }
      }
    }
  }
Ejemplo n.º 3
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;
          }
        }
      }
    }
  //
  // Constructor
  //
  Script::State::State(Script &script, const char *name, FScope *fScope)
  : script(script),
    settings(&Setting::nodeState),
    conditions(&Condition::nodeState),
    transitions(&Transition::nodeState),
    name(name)
  {
    FScope *sScope;
    FScope *iScope;

    // Load the settings
    iScope = fScope->GetFunction("Settings", FALSE);
    if (iScope)
    {
      while ((sScope = iScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0x32BBA19C: // "Setting"
            settings.Append(Setting::Create(script, sScope));
            break;

          default:
            sScope->ScopeError("Unknown function '%s' in settings", sScope->NameStr());
        }
      }
    }

    // Load the action
    iScope = fScope->GetFunction("Action", FALSE);
    if (iScope)
    {
      action = Action::Create(script, iScope);
    }
    else
    {
      action = NULL;
    }

    // Load the conditions
    iScope = fScope->GetFunction("Conditions", FALSE);

    if (iScope)
    {
      while ((sScope = iScope->NextFunction()) != NULL)
      {
        switch (sScope->NameCrc())
        {
          case 0x6A34146A: // "Condition"
            conditions.Append(Condition::Create(script, sScope));
            break;

          case 0xFBCD164A: // "Status"
          {
            GameIdent code = StdLoad::TypeString(sScope);

            if (transitions.Exists(code.crc))
            {
              sScope->ScopeError("Status '%s' already defined", code.str);
            }

            // Add the new transition
            transitions.Add(code.crc, Transition::Create(sScope));
            break;
          }

          default:
            sScope->ScopeError("Unknown function '%s' in conditions", sScope->NameStr());
        }
      }
    }

    completed = transitions.Find(Status::Completed);
  }