void RasterWeather::Reload(int day_time) { static unsigned last_weather_time; bool found = false; bool now = false; if (_parameter == 0) // will be drawing terrain return; Poco::ScopedRWLock protect(lock, true); if (_weather_time == 0) { // "Now" time, so find time in half hours unsigned half_hours = (TimeLocal(day_time) / 1800) % 48; _weather_time = max(_weather_time, half_hours); now = true; } // limit values, for safety _weather_time = min(MAX_WEATHER_TIMES - 1, _weather_time); if (_weather_time != last_weather_time) reload = true; if (!reload) { // no change, quick exit. if (now) // must return to 0 = Now time on exit _weather_time = 0; return; } reload = false; last_weather_time = _weather_time; // scan forward to next valid time while ((_weather_time < MAX_WEATHER_TIMES) && (!found)) { if (!weather_available[_weather_time]) { _weather_time++; } else { found = true; _Close(); if (!LoadItem(WeatherDescriptors[_parameter].name, _weather_time) && _parameter == 1) LoadItem(_T("wstar_bsratio"), _weather_time); } } // can't find valid time, so reset to zero if (!found || now) _weather_time = 0; }
bool ResourceGUIBackend::LoadCommandLine(int argc,const char** argv) { for(int i=1;i<argc;i++) { if(argv[i][0] == '-') { if(0==strcmp(argv[i],"-l")) { LoadResources(argv[i+1],*resources); i++; } else { printf("Unknown option %s",argv[i]); return 0; } } else { const char* ext=FileExtension(argv[i]); if(0==strcmp(ext,"xml")) { TiXmlDocument doc; if(!doc.LoadFile(argv[i])) { printf("Error loading XML file %s\n",argv[i]); return false; } if(0 == strcmp(doc.RootElement()->Value(),"world")) { XmlWorld xmlWorld; if(!xmlWorld.Load(doc.RootElement(),GetFilePath(argv[i]))) { printf("Error loading world file %s\n",argv[i]); return 0; } if(!xmlWorld.GetWorld(*world)) { printf("Error loading world from %s\n",argv[i]); return 0; } } else if(0 == strcmp(doc.RootElement()->Value(),"resource_library")) { LoadResources(doc.RootElement(),*resources); } else { if(!LoadItem(argv[i],*resources)) return 0; } } else { //try loading into the world const char* ext = FileExtension(argv[i]); if(world->CanLoadElementExt(ext) && world->LoadElement(argv[i])>= 0) { //loaded successfully } else { //failed, now try resource library load if(!LoadItem(argv[i],*resources)) return 0; } } } } return true; }
Ogre::MeshPtr CMapLoader::LoadModel(const char * path) { MapResource<Ogre::MeshPtr> res; Ogre::MeshPtr pMesh; // Check if this model was already loaded pMesh = Ogre::MeshManager::getSingleton().getByName(path); if(!pMesh.isNull()) return pMesh; sectionitem_t * item = LoadItem(path, &res.map); if(item == NULL) return Ogre::MeshPtr(NULL); pMesh = Ogre::MeshManager::getSingleton().createManual(path, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(item->data, item->size, false, true)); Ogre::MeshSerializer serializer; serializer.importMesh(stream, pMesh.getPointer()); // No need to keep this in memory mapUnloadItem(item); // Track this resource res.data = pMesh; meshes.push_back(res); return pMesh; }
InMemoryIterator::InMemoryIterator(InMemorySSTableReader *sstable, const std::string &key) : sstable_(sstable) { SeekKey(key); if (valid_) { LoadItem(); } }
ee::SprPtr LoadFromPSD::LoadGroup(const Json::Value& value, const std::string& dir, int tw, int th) { std::string name = value[ee::SYM_GROUP_TAG].asString(); bool visible = value["visible"].asBool(); std::string _dir = dir + "\\" + name; auto sym = std::make_shared<Symbol>(); auto spr = std::make_shared<Sprite>(sym); const Json::Value& cval = value["children"]; // for (int i = 0, n = cval.size(); i < n; ++i) { for (int i = cval.size() - 1; i >= 0; --i) { ee::SprPtr cspr = LoadItem(cval[i], _dir, tw, th); if (cspr) { sym->Add(cspr); } } // sym->InitBounding(); spr->UpdateBounding(); spr->SetVisible(visible); return spr; }
void CSoundManager::PlayAsAmbient(const VfsPath& itemPath, bool looping) { if (m_Enabled) { UNUSED2(looping); ISoundItem* aSnd = LoadItem(itemPath); if (aSnd != NULL) SetAmbientItem(aSnd); } }
void ScriptingSettingsDlg::OnListSelection(wxListEvent& event) { // Manager::Get()->GetLogManager()->DebugLog(F(_T("Selected %d"), event.GetIndex())); // load long sel = event.GetIndex(); LoadItem(sel); UpdateState(); }
BOOL CNewMenu::LoadAllItems() { DWORD dwIndex = 0; WCHAR wszName[MAX_PATH]; SHELLNEW_ITEM *pNewItem; SHELLNEW_ITEM *pCurItem = NULL; /* If there are any unload them */ UnloadAllItems(); /* Enumerate all extesions */ while (RegEnumKeyW(HKEY_CLASSES_ROOT, dwIndex++, wszName, _countof(wszName)) == ERROR_SUCCESS) { if (wszName[0] != L'.') continue; pNewItem = LoadItem(wszName); if (pNewItem) { if (wcsicmp(pNewItem->pwszExt, L".lnk") == 0) { /* Link handler */ m_pLinkItem = pNewItem; } else { /* Add at the end of list */ if (pCurItem) { pCurItem->pNext = pNewItem; pCurItem = pNewItem; } else pCurItem = m_pItems = pNewItem; } } } if (!m_pLinkItem) { m_pLinkItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM))); if (m_pLinkItem) { m_pLinkItem->Type = SHELLNEW_TYPE_NULLFILE; m_pLinkItem->pwszDesc = _wcsdup(L"Link"); m_pLinkItem->pwszExt = _wcsdup(L".lnk"); } } if (m_pItems == NULL) return FALSE; else return TRUE; }
void LoadFromPSD::Load(const Json::Value& value, const std::string& dir, Symbol& complex) { int w = value["document"]["width"].asInt(), h = value["document"]["height"].asInt(); const Json::Value& cvalue = value["children"]; // for (int i = 0, n = cvalue.size(); i < n; ++i) { for (int i = cvalue.size() - 1; i >= 0; --i) { auto spr = LoadItem(cvalue[i], dir, w, h); if (spr) { complex.Add(spr); } } }
void ScriptingSettingsDlg::OnRemoveScript(wxCommandEvent& event) { wxListCtrl* list = XRCCTRL(*this, "chkStartupScripts", wxListCtrl); long sel = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); list->DeleteItem(sel); m_ScriptsVector.erase(m_ScriptsVector.begin() + sel); if (sel > list->GetItemCount()) --sel; list->SetItemState(sel, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED); if (sel >= 0) LoadItem(sel); UpdateState(); }
Item* ItemFactory::GetItem(Item::ItemType type, int itemId) { Item* retval = new Item(itemId, type); LoadItem(type, itemId, retval); switch(itemId) { //TODO: Init Item with Id itemId default: std::string msg("Invalid ItemId "); msg.append(std::to_string(itemId)); msg.append(" given in GetItem."); throw GenericException(msg); } return retval; }
virtual bool ServiceItem(specialitemload_t const &item) { bool ret = false; if(m_SQL) { if(item.loadtype == SPECIALITEM_LOAD) { ret = LoadItem(item); } else if(item.loadtype == SPECIALITEM_SAVE) { ret = SaveItem(item); } } return ret; }
void CSoundManager::IdleTask() { if (m_Enabled) { if (m_CurrentTune) { m_CurrentTune->EnsurePlay(); if (m_PlayingPlaylist && m_RunningPlaylist) { if (m_CurrentTune->Finished()) { if (m_PlaylistGap == 0) { m_PlaylistGap = timer_Time() + 15; } else if (m_PlaylistGap < timer_Time()) { m_PlaylistGap = 0; PlayList::iterator it = find(m_PlayListItems->begin(), m_PlayListItems->end(), m_CurrentTune->GetName()); if (it != m_PlayListItems->end()) { ++it; Path nextPath; if (it == m_PlayListItems->end()) nextPath = m_PlayListItems->at(0); else nextPath = *it; ISoundItem* aSnd = LoadItem(nextPath); if (aSnd) SetMusicItem(aSnd); } } } } } if (m_CurrentEnvirons) m_CurrentEnvirons->EnsurePlay(); if (m_Worker) m_Worker->CleanupItems(); } }
void CSoundManager::StartPlayList(bool doLoop) { if (m_Enabled && m_MusicEnabled) { if (m_PlayListItems->size() > 0) { m_PlayingPlaylist = true; m_LoopingPlaylist = doLoop; m_RunningPlaylist = false; ISoundItem* aSnd = LoadItem((m_PlayListItems->at(0))); if (aSnd) SetMusicItem(aSnd); else SetMusicItem(NULL); } } }
void CSoundManager::PlayAsUI(const VfsPath& itemPath, bool looping) { if (m_Enabled) { IdleTask(); if (ISoundItem* anItem = LoadItem(itemPath)) { if (m_UIGain > 0) { anItem->SetGain(m_UIGain); anItem->SetLooping(looping); anItem->PlayAndDelete(); } } AL_CHECK; } }
//------------------------------------------------------------------------- void CDocResource::Load( CTinyCadDoc* pDesign, CStream& oStream ) { // Number of Fonts in this list UInt16 nCntRes = 0; hRESOURCE nOldResNo = 0; // All the merge numbers to invalid ResetMerge(); // Read in the number of Fonts oStream >> nCntRes; for( int n = 0; n < nCntRes; n++ ) { oStream >> nOldResNo; LoadItem( pDesign, oStream, nOldResNo ); } }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeChecklistDialog::LoadList() { memset(&FTotals, 0, sizeof(FTotals)); memset(&FChecked, 0, sizeof(FChecked)); FTotals[0] = FChecklist->Count; FChecked[0] = 0; ListView->Items->BeginUpdate(); try { ListView->Items->Clear(); for (int Index = 0; Index < FChecklist->Count; Index++) { const TSynchronizeChecklist::TItem * ChecklistItem = FChecklist->Item[ListView->Items->Count]; FChangingItemIgnore = true; try { LoadItem(ListView->Items->Add()); } __finally { FChangingItemIgnore = false; } FTotals[int(ChecklistItem->Action)]++; if (ChecklistItem->Checked) { FChecked[int(ChecklistItem->Action)]++; FChecked[0]++; } } } __finally { ListView->Items->EndUpdate(); } ListView->AlphaSort(); UpdateControls(); }
void CBackgroundInfoLoader::Run() { try { if (m_vecItems.size() > 0) { OnLoaderStart(); for (std::vector<CFileItemPtr>::const_iterator iter = m_vecItems.begin(); iter != m_vecItems.end(); ++iter) { CFileItemPtr pItem = *iter; // Ask the callback if we should abort if ((m_pProgressCallback && m_pProgressCallback->Abort()) || m_bStop) break; try { if (LoadItem(pItem.get()) && m_pObserver) m_pObserver->OnItemLoaded(pItem.get()); } catch (...) { CLog::Log(LOGERROR, "CBackgroundInfoLoader::LoadItem - Unhandled exception for item %s", CURL::GetRedacted(pItem->GetPath()).c_str()); } } } OnLoaderFinish(); m_bIsLoading = false; } catch (...) { m_bIsLoading = false; CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__); } }
void __fastcall LoadGame(bool firstflag) { int v1; // esi int v2; // edi int v5; // ebx int v6; // eax int v7; // eax int v8; // ecx bool v9; // sf unsigned char v10; // of int *v11; // esi int *v12; // esi int i; // esi int *v14; // esi int *v15; // esi int j; // esi int *v17; // esi int *v18; // esi int k; // esi int l; // esi signed int v21; // esi int m; // esi int v23; // esi int *v24; // esi int *v25; // esi int n; // esi int *v27; // esi char *v29; // edi char *v30; // edi char *v31; // edi char *v32; // edi int (*v33)[112]; // ebx _DWORD *v34; // edi char *v35; // edi char *v36; // edi char *v37; // edi char *v38; // edi signed int v39; // ebx bool *v40; // edi char *v41; // edi int v42; // esi char dst[260]; // [esp+0h] [ebp-120h] int len; // [esp+104h] [ebp-1Ch] int v46; // [esp+108h] [ebp-18h] int v47; // [esp+10Ch] [ebp-14h] void *ptr; // [esp+110h] [ebp-10h] int v49; // [esp+114h] [ebp-Ch] int from_save; // [esp+118h] [ebp-8h] int quest_num; // [esp+11Ch] [ebp-4h] FreeGameMem(); pfile_remove_temp_files(); pfile_get_game_name(dst); ptr = pfile_read(dst, &len); tbuff = ptr; if ( ILoad_2() != 'RETL' ) TermMsg("Invalid save file"); setlevel = OLoad(); setlvlnum = ILoad(); currlevel = ILoad(); leveltype = ILoad(); v1 = ILoad(); v2 = ILoad(); invflag = OLoad(); chrflag = OLoad(); v5 = ILoad(); v47 = ILoad(); v49 = ILoad(); v6 = ILoad(); quest_num = 0; v46 = v6; do { *(int *)((char *)glSeedTbl + quest_num) = ILoad_2(); v7 = ILoad(); v8 = quest_num; quest_num += 4; v10 = __OFSUB__(quest_num, 68); v9 = quest_num - 68 < 0; *(int *)((char *)gnLevelTypeTbl + v8) = v7; } while ( v9 ^ v10 ); LoadPlayer(myplr); quest_num = 0; do LoadQuest(quest_num++); while ( quest_num < 16 ); quest_num = 0; do LoadPortal(quest_num++); while ( quest_num < 4 ); LoadGameLevel(firstflag, 4); SyncInitPlr(myplr); SyncPlrAnim(myplr); ViewX = v1; numitems = v47; nummissiles = v49; ViewY = v2; nummonsters = v5; nobjects = v46; v11 = monstkills; do { *v11 = ILoad_2(); ++v11; } while ( (signed int)v11 < (signed int)&monstkills[200] ); if ( leveltype ) { v12 = monstactive; do { *v12 = ILoad(); ++v12; } while ( (signed int)v12 < (signed int)&monstactive[200] ); for ( i = 0; i < nummonsters; ++i ) LoadMonster(monstactive[i]); v14 = missileactive; do { *v14 = BLoad(); ++v14; } while ( (signed int)v14 < (signed int)&missileactive[125] ); v15 = missileavail; do { *v15 = BLoad(); ++v15; } while ( (signed int)v15 < (signed int)&missileavail[125] ); for ( j = 0; j < nummissiles; ++j ) LoadMissile(missileactive[j]); v17 = objectactive; do { *v17 = BLoad(); ++v17; } while ( (signed int)v17 < (signed int)&objectactive[127] ); v18 = objectavail; do { *v18 = BLoad(); ++v18; } while ( (signed int)v18 < (signed int)&objectavail[127] ); for ( k = 0; k < nobjects; ++k ) LoadObject(objectactive[k]); for ( l = 0; l < nobjects; ++l ) SyncObjectAnim(objectactive[l]); numlights = ILoad(); v21 = 0; do lightactive[v21++] = BLoad(); while ( v21 < 32 ); for ( m = 0; m < numlights; ++m ) LoadLighting((unsigned char)lightactive[m]); visionid = ILoad(); v23 = 0; numvision = ILoad(); if ( numvision > 0 ) { do LoadVision(v23++); while ( v23 < numvision ); } } v24 = itemactive; do { *v24 = BLoad(); ++v24; } while ( (signed int)v24 < (signed int)&itemactive[127] ); v25 = itemavail; do { *v25 = BLoad(); ++v25; } while ( (signed int)v25 < (signed int)&itemavail[127] ); for ( n = 0; n < numitems; ++n ) LoadItem(itemactive[n]); v27 = UniqueItemFlag; do { *v27 = OLoad(); ++v27; } while ( (signed int)v27 < (signed int)&UniqueItemFlag[128] ); quest_num = 0; do { from_save = 112; v29 = (char *)dTransVal + quest_num; do { *v29 = BLoad(); v29 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v30 = (char *)dFlags + quest_num; do { *v30 = BLoad(); v30 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v31 = (char *)dPlayer + quest_num; do { *v31 = BLoad(); v31 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v32 = (char *)dItem + quest_num; do { *v32 = BLoad(); v32 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); if ( leveltype ) { v33 = dMonster; do { v34 = (unsigned int *)v33; from_save = 112; do { *v34 = ILoad(); v34 += 112; --from_save; } while ( from_save ); v33 = (int (*)[112])((char *)v33 + 4); } while ( (signed int)v33 < (signed int)dMonster[1] ); quest_num = 0; do { from_save = 112; v35 = (char *)dDead + quest_num; do { *v35 = BLoad(); v35 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v36 = (char *)dObject + quest_num; do { *v36 = BLoad(); v36 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v37 = (char *)dTransVal + quest_num; do { *v37 = BLoad(); v37 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); quest_num = 0; do { from_save = 112; v38 = (char *)dTransVal2 + quest_num; do { *v38 = BLoad(); v38 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); v39 = 0; do { v40 = (bool *)automapview + v39; from_save = 40; do { *v40 = OLoad(); v40 += 40; --from_save; } while ( from_save ); ++v39; } while ( v39 < 40 ); quest_num = 0; do { from_save = 112; v41 = (char *)dMissile + quest_num; do { *v41 = BLoad(); v41 += 112; --from_save; } while ( from_save ); ++quest_num; } while ( quest_num < 112 ); } numpremium = ILoad(); premiumlevel = ILoad(); v42 = 0; do LoadPremium(v42++); while ( v42 < 6 ); automapflag = OLoad(); AutoMapScale = ILoad(); mem_free_dbg(ptr); AutomapZoomReset(); ResyncQuests(); if ( leveltype ) ProcessLightList(); RedoPlayerVision(); ProcessVisionList(); missiles_process_charge(); ResetPal(); SetCursor(CURSOR_HAND); gbProcessPlayers = 1; }
void __cdecl LoadLevel() { int i; // esi int j; // esi char dst[260]; // [esp+Ch] [ebp-10Ch] int len; // [esp+110h] [ebp-8h] void *LoadBuff; // [esp+114h] [ebp-4h] GetPermLevelNames(dst); LoadBuff = pfile_read(dst, &len); tbuff = LoadBuff; if ( leveltype ) { for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dDead[j][i] = BLoad(); /* check */ } } SetDead(); } nummonsters = ILoad(); numitems = ILoad(); nobjects = ILoad(); if ( leveltype ) { for(i = 0; i < 200; i++) monstactive[i] = ILoad(); for(i = 0; i < nummonsters; i++) LoadMonster(monstactive[i]); for(i = 0; i < 127; i++) objectactive[i] = BLoad(); for(i = 0; i < 127; i++) objectavail[i] = BLoad(); for(i = 0; i < nobjects; i++) LoadObject(objectactive[i]); for(i = 0; i < nobjects; i++) SyncObjectAnim(objectactive[i]); } for(i = 0; i < 127; i++) itemactive[i] = BLoad(); for(i = 0; i < 127; i++) itemavail[i] = BLoad(); for(i = 0; i < numitems; i++) LoadItem(itemactive[i]); for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dFlags[j][i] = BLoad(); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dItem[j][i] = BLoad(); } } if ( leveltype ) { for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dMonster[j][i] = ILoad(); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dObject[j][i] = BLoad(); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dTransVal[j][i] = BLoad(); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dTransVal2[j][i] = BLoad(); } } for(i = 0; i < 40; i++) { for(j = 0; j < 40; j++) { automapview[j][i] = OLoad(); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { dMissile[j][i] = 0; } } } AutomapZoomReset(); ResyncQuests(); SyncPortals(); dolighting = 1; for(i = 0; i < 4; i++) { if ( plr[i].plractive && currlevel == plr[i].plrlevel ) LightList[plr[i]._plid]._lunflag = 1; } mem_free_dbg(LoadBuff); }
static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PFolderItem item; switch (msg) { case WM_INITDIALOG: lastItem = NULL; TranslateDialogDefault(hWnd); bInitializing = 1; LoadRegisteredFolderSections(hWnd); bInitializing = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_FOLDER_EDIT: switch (HIWORD(wParam)) { case EN_CHANGE: RefreshPreview(hWnd); if (!bInitializing) SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); //show the apply button. } break; case IDC_REFRESH_BUTTON: RefreshPreview(hWnd); break; case IDC_HELP_BUTTON: ShowWindow( CreateDialog(hInstance, MAKEINTRESOURCE(IDD_VARIABLES_HELP), hWnd, DlgProcVariables), SW_SHOW); break; case IDC_FOLDERS_SECTIONS_LIST: switch (HIWORD(wParam)) { case LBN_SELCHANGE: CheckForChanges(hWnd); LoadRegisteredFolderItems(hWnd); lastItem = NULL; SetEditText(hWnd, L""); RefreshPreview(hWnd); } break; case IDC_FOLDERS_ITEMS_LIST: switch (HIWORD(wParam)) { case LBN_SELCHANGE: item = GetSelectedItem(hWnd); if (item != NULL) { CheckForChanges(hWnd); LoadItem(hWnd, item); } lastItem = item; } } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: item = GetSelectedItem(hWnd); if (item) { SaveItem(hWnd, item, FALSE); LoadItem(hWnd, item); } for (int i=0; i < lstRegisteredFolders.getCount(); i++) lstRegisteredFolders[i].Save(); CallPathChangedEvents(); } } break; } return 0; }
void InMemoryIterator::Next() { NextItem(); if (valid_) { LoadItem(); } }