コード例 #1
0
void SaveGameSlot_cl::UpdateSlotStatus(int iCurrentSlot, const char* szName)
{
  BOOL bSlotUsed = IsSlotUsed(szName);
  BOOL bShowPreview = FALSE;
  if (bSlotUsed)
  {
    // try to load preview bmp
    char pszPreviewFileName[FS_MAX_PATH];
    sprintf(pszPreviewFileName, SAVEGAME_PREVIEW, m_iSlotIndex + 1);
    if (Vision::File.Exists(pszPreviewFileName))
    {
      VTextureObjectPtr spScreenMaskTexture(m_spPreviewMask->GetTextureObject());
      if (spScreenMaskTexture)
      {
        spScreenMaskTexture->EnsureUnloaded();
      }
      m_spPreviewMask->Unload();
      m_spPreviewMask->LoadFromFile(pszPreviewFileName);
      bShowPreview = TRUE;
    }
    else
    {
      m_spBackgroundMask->LoadFromFile("Serialization\\NoPreview.dds");
    }
  }
  else
  {
    m_spBackgroundMask->LoadFromFile("Serialization\\Free.dds");
  }
  // target size gets reset in LoadFromFile 
  m_spBackgroundMask->SetTargetSize(128.f,96.f);
  m_spPreviewMask->SetTargetSize(128.f,96.f);

  // either show preview or "free"
  m_spBackgroundMask->SetVisible(!bShowPreview);
  m_spPreviewMask->SetVisible(bShowPreview);

  // set slot number color according to status 
  VColorRef iColor = SAVESLOT_COL_NORM;
  if (m_bErrorState)
    iColor = SAVESLOT_COL_ERROR;
  else if (!bSlotUsed)
    iColor = SAVESLOT_COL_EMPTY;
  else if (iCurrentSlot==m_iSlotIndex) 
    iColor = SAVESLOT_COL_LOAD;

  m_spSlotNumMask->SetColor(s_iOverlayColor);
  m_spSlotNumMask->SetVisible(TRUE);
}
コード例 #2
0
ファイル: main.cpp プロジェクト: cDoru/projectanarchy
  // updates the slot HUD
  void UpdateSlotStatus(int iCurrentSlot)
  {
    BOOL bSlotUsed = IsSlotUsed();
    BOOL bShowPreview = FALSE;
    if (bSlotUsed)
    {
      // try to load preview bmp
      char pszPreviewFileName[FS_MAX_PATH];
      sprintf(pszPreviewFileName, SAVEGAME_PREVIEW, m_iSlotIndex + 1);
      if (Vision::File.Exists(pszPreviewFileName))
      {
        m_spPreviewMask->LoadFromFile(pszPreviewFileName, TEXTURE_LOADING_FLAGS);
        bShowPreview = TRUE;
      }
      else
      {
        m_spBackgroundMask->LoadFromFile("Serialization\\NoPreview.dds", TEXTURE_LOADING_FLAGS);
      }
    }
    else
    {
      m_spBackgroundMask->LoadFromFile("Serialization\\Free.dds", TEXTURE_LOADING_FLAGS);
    }
    // target size gets reset in LoadFromFile 
    m_spBackgroundMask->SetTargetSize(128.f,96.f);
    m_spPreviewMask->SetTargetSize(128.f,96.f);

    // either show preview or "free"
    m_spBackgroundMask->SetVisible(!bShowPreview);
    m_spPreviewMask->SetVisible(bShowPreview);

    // set slot number color according to status 
    VColorRef iColor = SAVESLOT_COL_NORM;
    if (m_bErrorState)
      iColor = SAVESLOT_COL_ERROR;
    else if (!bSlotUsed)
      iColor = SAVESLOT_COL_EMPTY;
    else if (iCurrentSlot==m_iSlotIndex) 
      iColor = SAVESLOT_COL_LOAD;

    m_spSlotNumMask->SetColor(g_iOverlayColor);
    m_spSlotNumMask->SetVisible(TRUE);
  }