コード例 #1
0
ファイル: cursor.cpp プロジェクト: ZhouWeikuan/darkreign2
    //
    // 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;
        }
      }
    }
コード例 #2
0
ファイル: cursor.cpp プロジェクト: ZhouWeikuan/darkreign2
    // Add a frame
    void AddFrame(FScope *fScope)
    {
      FrameInfo *frame = new FrameInfo;
      FScope *sScope;

      // Read image info
      sScope = fScope->GetFunction("Texture");
      IFace::FScopeToTextureInfo(sScope, frame->tex);

      // Optional hotspot
      if ((sScope = fScope->GetFunction("Hotspot", FALSE)) != NULL)
      {
        frame->hotspot.x = sScope->NextArgInteger();
        frame->hotspot.y = sScope->NextArgInteger();
      }
      else
      {
        frame->hotspot.Set(0, 0);
      }

      // Add frame to list
      frames.Append(frame);
    }
コード例 #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;
          }
        }
      }
    }