bool CMixereView::SetInfo(const CMixerInfo& Info) { CWaitCursor wc; m_MSFadeBar.SetInfo(Info.m_MSFade); // before creating channels // set the column widths int cols = Info.m_ColumnWidth.GetSize(); for (int i = 0; i < cols; i++) SetColumnWidth(i, Info.m_ColumnWidth[i]); // set the channel count int chans = Info.m_Chan.GetSize(); if (SetItemCount(chans) < chans) // if create failed, bail out return(FALSE); // set the mixer controls CStringArray ErrPath; for (i = 0; i < chans; i++) { if (!GetChan(i)->OpenItem(&Info.m_Chan[i])) // if can't load audio file AddStringUnique(ErrPath, Info.m_Chan[i].m_Path); // add its path to list } // if audio files couldn't be loaded, display error message if (ErrPath.GetSize()) MsgBoxStrList(LDS(CANT_LOAD_AUDIO), ErrPath); m_VolumeBar.SetInfo(Info.m_AutoVol); m_TempoBar.SetInfo(Info.m_AutoTempo); m_ChanDefaults = Info.m_ChanDefaults; m_ChanIDs = Info.m_ChanIDs; // redraw channels all at once, looks and sounds better for (i = 0; i < chans; i++) GetChan(i)->SetInfo(&Info.m_Chan[i]); ScrollToPosition(CPoint(0, 0)); ClearSelection(); SetCurPos(0); ClearUndoHistory(); // restore our bar state if (CMainFrame::VerifyDockState(Info.m_DockState, m_ChildFrm)) m_ChildFrm->SetDockState(Info.m_DockState); // restoring bar state enables bar tool tips; reapply our tip state for (i = 0; i < DLGBARS; i++) m_DlgBar[i]->EnableToolTips(m_HasToolTips); // attach to snapshot object and update our snapshot bar m_Snapshot = const_cast<CSnapshot *>(&Info.m_Snapshot); m_Snapshot->SetMixer(this); m_Snapshot->UpdateList(); // enable status bar panes as needed; see note in CColorStatusBar::Reset CColorStatusBar *csb = ((CMainFrame *)AfxGetMainWnd())->GetStatusBar(); if (GetMuteCount()) csb->EnablePane(CMainFrame::SBP_MUTE); if (GetSoloCount()) csb->EnablePane(CMainFrame::SBP_SOLO); return(TRUE); }
ZMapSpawnData* ZMapSpawnManager::GetSoloRandomData() { int nIndex = -1; unsigned long nRandomNumber = timeGetTime(); // rand() 는 모든 peer가 seed값이 같은 관계로 쓰지 않는다. m_nBackUpIndexCnt = min(GetSoloCount(),MAX_BACKUP_SPAWN); // 이전에 스폰된 위치는 피한다.. if(GetSoloCount() > MAX_BACKUP_SPAWN) { int cnt = 0; while(1) { nRandomNumber = timeGetTime() * rand(); nIndex = nRandomNumber % GetSoloCount(); if( CheckBackup(nIndex) ) { break; } cnt++; if(cnt > 1000) { // 혹시나.. nIndex = 0; break; } } // backup ShiftBackupIndex(nIndex); } else { // 갯수가 너무 적다면 그냥 예전방식 if (GetSoloCount() > 0) nIndex = nRandomNumber % GetSoloCount(); } // mlog("spawn index %d \n" , nIndex); ZMapSpawnData* pSpawnData = GetSoloData(nIndex); int t = 0; while ((pSpawnData != NULL) && (IsExistOtherCharacter(pSpawnData->m_Pos))) { nRandomNumber++; nIndex = nRandomNumber % GetSoloCount(); pSpawnData = GetSoloData(nIndex); if (t > 999) return pSpawnData; t++; } return pSpawnData; }
void CMixereView::OnUpdateEndSolo(CCmdUI* pCmdUI) { pCmdUI->Enable(GetSoloCount()); }
ZMapSpawnData* ZMapSpawnManager::GetSoloData(int nIndex) { if ((nIndex < 0) || (nIndex >= GetSoloCount())) return NULL; return (m_SpawnArray[ZMST_SOLO][nIndex]); }