void cMapHandler::Reset() { #ifdef DEMO_VERSION glNumOfLoads = 0; #endif mMapChanger.mbActive = false; msCurrentMap = ""; if(mpInit->mbResetCache) mpWorldCache->DecResources(); mvLoadedMaps.clear(); //Timers STLDeleteAll(mlstTimers); DestroyAll(); //Haptic if(mpInit->mbHasHaptics) { mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes(); mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces(); } //World3D if(mpScene->GetWorld3D()) mpScene->DestroyWorld3D(mpScene->GetWorld3D()); mpScene->SetWorld3D(NULL); //Make sure no occulssion queries are left. mpInit->mpGame->GetGraphics()->GetRenderer3D()->GetRenderList()->Clear(); }
cImageManager::~cImageManager() { //DeleteAllBitmapFrames(); DestroyAll(); Log(" Done with images\n"); }
int main() { Window *wnd; DefineScreen(p); Add(&menu,mymenu,p); Add(&box,0,1,UW,UH-2,'±',REVERSE); Display(Screen); Create(&wnd,MIDDLE,MIDDLE,50,10,p); Add(&callmenu); Add(&frame,FULL,DOUBLE,FRAME); Add(&string,MIDDLE,0," Copy ",NORMAL); Add(&string,2,1,"Source file",NORMAL); Add(&getstr,3,2,UW-6,infile,64,NULL,accept_file,K_TAB,INPUT); Add(&string,2,4,"Destination file",NORMAL); Add(&getstr,3,5,UW-6,outfile,64,NULL,accept_file,K_ENTER,INPUT); Add(&button,MIDDLE-10,UH-3," C&opy ",ok,REVERSE,BREVERSE); Add(&button,MIDDLE, UH-3," &Cancel ",can,REVERSE,BREVERSE); Add(&button,MIDDLE+10,UH-3," &Help ",hlp,REVERSE,BREVERSE); Display(wnd); if(Activate()==OKAY) { Destroy(wnd); copy(); } DestroyAll(); _SetCursorPos(0,Screen->Height-1); CursorON(); return 0; }
// Clear the array of hair strands void TressFXAssetLoader::Clear() { m_HairStrands.clear(); m_Vertices.clear(); m_HairAsset.m_LineIndices.clear(); m_HairAsset.m_TriangleIndices.clear(); DestroyAll(); m_HairAsset.m_pHairStrandType = NULL; m_HairAsset.m_pRefVectors = NULL; m_HairAsset.m_pTriangleVertices = NULL; m_HairAsset.m_pGlobalRotations = NULL; m_HairAsset.m_pLocalRotations = NULL; m_HairAsset.m_pVertices = NULL; m_HairAsset.m_pTangents = NULL; m_HairAsset.m_pThicknessCoeffs = NULL; m_HairAsset.m_pRestLengths = NULL; m_HairAsset.m_pFollowRootOffset = NULL; m_HairAsset.m_NumFollowHairsPerGuideHair = 4; m_HairAsset.m_NumGuideHairStrands = 0; m_HairAsset.m_NumOfVerticesInStrand = 0; m_HairAsset.m_TipSeparationFactor = 0; m_maxRadiusAroundGuideHair = 0.5; }
void C_PhysPropClientside::RecreateAll() { DestroyAll(); if ( cl_phys_props_enable.GetInt() ) { ParseAllEntities( engine->GetMapEntitiesString() ); InitializePropRespawnZones(); } }
bool BaseCellContainer::UnSerialize( GI::ByteBuffer &buf ) { DestroyAll(); long s; if( !buf.Pop( &s ) ) return false; ReSize( s ); for( long i = 0; i < s; ++ i ) { buf.Pop( &m_cells[i].status ); if( m_cells[i].status == Cell::USED ) m_cells[i].status = Cell::EMPTY; } return Super::UnSerialize( buf ); }
DecoScene::~DecoScene() { DestroyAll(); if (camera) { delete camera; camera = NULL; } if (RI) { RI->Destroy(); delete RI; RI = NULL; } if (mCollisionHandler) { delete mCollisionHandler; mCollisionHandler = NULL; } #ifdef _LCP_CONTACT if (mLCPFormulator) { delete mLCPFormulator; mLCPFormulator = NULL; } #endif mLDIWidth = mLDIHeight = 0; }
void Error (char *file) { Window *wnd; char *msg=(errno>0)?sys_errlist[errno]:"There is no room to copy"; char buf[100]; int len=strlen(msg); if(msg[len]=='\n') msg[len]='\0'; sprintf(buf,"%s: %s",file,msg); Create(&wnd,MIDDLE,MIDDLE+5,strlen(buf)+4,7,p); Add(&frame,FULL,"ÉÍ»ººÈͼ",FRAME); Add(&string,MIDDLE,0," Error ",NORMAL); Add(&string,MIDDLE,2,buf,NORMAL); Add(&button,MIDDLE,4," &Ok ",ok,REVERSE,BREVERSE); Display(wnd); Activate(); _SetCursorPos(0,Screen->Height-1); DestroyAll(); CursorON(); exit(1); }
cFontManager::~cFontManager() { DestroyAll(); Log(" Done with fonts\n"); }
void C_ASW_Snow_Volume::RecreateAll() { DestroyAll(); ParseAllEntities( engine->GetMapEntitiesString() ); }
cSoundManager::~cSoundManager() { DestroyAll(); Log(" Done with sounds\n"); }
cImageEntityManager::~cImageEntityManager() { DestroyAll(); }
bool cMapHandler::Load(const tString &asFile,const tString& asStartPos) { tString sMapName = cString::ToLowerCase(cString::SetFileExt(asFile,"")); cWorld3D *pWorld=NULL; cWorld3D *pLastMap = NULL; bool bFirstTime = false; double fTimeSinceVisit=0; #ifdef DEMO_VERSION glNumOfLoads++; if(glNumOfLoads > 5){ CreateMessageBoxW( _W("Demo not playable any more!\n"), _W("The limits of the demo have been exceeded!\n")); exit(0); } #endif unsigned long lStartTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime(); if(sMapName != msCurrentMap) { //////////////////////////////////////// // DESTRUCTION OF STUFF NOT SAVED ////// //remove all local timer //RemoveLocalTimers(); //Exit script if(mpScene->GetWorld3D()) { //OnMapLoad for all entities tGameEntityMapIt GIt = m_mapGameEntities.begin(); for(; GIt != m_mapGameEntities.end(); ++GIt) { iGameEntity *pEntity = GIt->second; pEntity->OnWorldExit(); } mpScene->GetWorld3D()->GetScript()->Run("OnExit()"); pLastMap = mpScene->GetWorld3D(); } mpInit->mpMusicHandler->OnWorldExit(); //Destroy the player objects so they are no saved. mpInit->mpPlayer->OnWorldExit(); mpInit->mpPlayerHands->OnWorldExit(); mpInit->mpGameMessageHandler->OnWorldExit(); //////////////////////////////////////// // SAVING ///////////////////////////// //Save the map if(msCurrentMap != "" && mpScene->GetWorld3D() != NULL) { mpInit->mpSaveHandler->SaveData(msCurrentMap); } msCurrentMap = sMapName; //////////////////////////////////////// // DESTRUCTION OF SAVED STUFF ////////// mpInit->mpInventory->ClearCallbacks(); //Reset the rendering. mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetAmbientColor(cColor(0,1)); mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetSkyBoxActive(false); mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetFogActive(false); //Remove all current objects mpInit->mbDestroyGraphics =false; DestroyAll(); mpInit->mbDestroyGraphics =true; //Destroy all sound entities on previous map. if(mpScene->GetWorld3D()) { mpScene->GetWorld3D()->DestroyAllSoundEntities(); } mpInit->mpPlayer->ClearCollideScripts(); //Stop all sound mpInit->mpGame->GetSound()->GetSoundHandler()->StopAll(eSoundDest_World); mpInit->mpGame->GetSound()->Update(1.0f/60.0f); //Destroy Haptic shapes if(mpInit->mbHasHaptics) mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes(); //////////////////////////////////////// // LOAD THE MAP //////////////////////// //Load if(mpScene->HasLoadedWorld(asFile)) { //Log("-------- Loaded NOT first time! ----------------\n"); pWorld = mpScene->LoadWorld3D(asFile,true, eWorldLoadFlag_NoGameEntities); //eWorldLoadFlag_NoLights | //eWorldLoadFlag_NoEntities | //eWorldLoadFlag_NoGameEntities); if(pWorld) mpScene->SetWorld3D(pWorld); else { Error("Couldn't load map '%s'\n",asFile.c_str()); return false; } mpInit->mpSaveHandler->LoadData(msCurrentMap); mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum); mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum); } else { //Log("-------- FIRST TIME first time! ----------------\n"); pWorld = mpScene->LoadWorld3D(asFile,true,0); mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum); mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum); if(pWorld) mpScene->SetWorld3D(pWorld); else { Error("Couldn't load map '%s'\n",asFile.c_str()); return false; } bFirstTime = true; } /////////////////////////// //Add to cache mpWorldCache->DecResources(); mpWorldCache->AddResources(); /////////////////////////// //Destroy old map if(pLastMap) { mpScene->DestroyWorld3D(pLastMap); } fTimeSinceVisit = AddLoadedMap(pWorld); pWorld->GetPhysicsWorld()->SetMaxTimeStep(mpInit->mfMaxPhysicsTimeStep); //OnMapLoad for all entities tGameEntityMapIt GIt = m_mapGameEntities.begin(); for(; GIt != m_mapGameEntities.end(); ++GIt) { iGameEntity *pEntity = GIt->second; pEntity->OnWorldLoad(); } //OnMapLoad for player mpInit->mpPlayer->OnWorldLoad(); mpInit->mpPlayerHands->OnWorldLoad(); mpInit->mpMusicHandler->OnWorldLoad(); if(bFirstTime) { //Set a default name msMapGameName = cString::To16Char(cString::SetFileExt(asFile,"")); //Init script if(pWorld->GetScript()) pWorld->GetScript()->Run("OnStart()"); } } else { if(mpScene->GetWorld3D() != NULL) { pWorld = mpScene->GetWorld3D(); } else { Error("No world has been loaded!\n"); return false; } } mpInit->mpPlayer->SetStartPos(asStartPos); //Run global script if(mpInit->mpGlobalScript) { if(bFirstTime) mpInit->mpGlobalScript->Run("OnMapStart()"); mpInit->mpGlobalScript->Run("OnMapLoad()"); } if(pWorld->GetScript()) { pWorld->GetScript()->Run("OnLoad()"); } //After script has been run callback tGameEntityMapIt GIt = m_mapGameEntities.begin(); for(; GIt != m_mapGameEntities.end(); ++GIt) { iGameEntity *pEntity = GIt->second; pEntity->OnPostLoadScripts(); } //Log("After load and before preupdate:\n"); unsigned long lTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime() - lStartTime; Log("Loading map '%s' took: %d ms\n",pWorld->GetFileName().c_str(),lTime); PreUpdate(fTimeSinceVisit); mpInit->mpGame->ResetLogicTimer(); //mpInit->mpGame->GetSound()->GetSoundHandler()->ResumeAll(eSoundDest_World | eSoundDest_Gui); //Log("After load and preupdate:\n"); //Set physics accuracy pWorld->GetPhysicsWorld()->SetAccuracyLevel(mpInit->mPhysicsAccuracy); return true; }
GameDataManager::~GameDataManager() { DestroyAll(); }
cMeshManager::~cMeshManager() { DestroyAll(); Log(" Done with meshes\n"); }
cSoundEntityManager::~cSoundEntityManager() { DestroyAll(); Log(" Done with sound entities\n"); }
CP4StatColl::~CP4StatColl() { DestroyAll(); }
TaskFactory::~TaskFactory() { DestroyAll(); }
BDADVBTSinkDSNet::~BDADVBTSinkDSNet() { DestroyAll(); }
bool cMapHandler::LoadSimple(const tString &asFile, bool abLoadEntities) { tString sMapName = cString::ToLowerCase(cString::SetFileExt(asFile,"")); cWorld3D *pWorld=NULL; DestroyAll(); mpInit->mpGame->GetSound()->GetSoundHandler()->StopAll(eSoundDest_World); mpInit->mpGame->GetSound()->Update(1.0f/60.0f); mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetAmbientColor(cColor(0,1)); cWorld3D *pOldWorld = mpScene->GetWorld3D(); //Haptic if(mpInit->mbHasHaptics) mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes(); //Delete all sound entities if(pOldWorld) { pOldWorld->DestroyAllSoundEntities(); } //Set the current map. msCurrentMap = sMapName; if(abLoadEntities==false) { pWorld = mpScene->LoadWorld3D(asFile,true, eWorldLoadFlag_NoGameEntities); //eWorldLoadFlag_NoLights | //eWorldLoadFlag_NoEntities | //eWorldLoadFlag_NoGameEntities); if(pWorld==NULL){ Error("Couldn't load map '%s'\n",asFile.c_str()); return false; } mpInit->mpSaveHandler->LoadData(msCurrentMap); mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum); mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum); } else { pWorld = mpScene->LoadWorld3D(asFile,true,0); mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum); mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum); if(pWorld==NULL){ Error("Couldn't load map '%s'\n",asFile.c_str()); return false; } } //Destroy old world, if there is any. if(pOldWorld) { mpScene->DestroyWorld3D(pOldWorld); } //Set physics update if(pWorld->GetPhysicsWorld())pWorld->GetPhysicsWorld()->SetMaxTimeStep(mpInit->mfMaxPhysicsTimeStep); //OnMapLoad for all entities tGameEntityMapIt GIt = m_mapGameEntities.begin(); for(; GIt != m_mapGameEntities.end(); ++GIt) { iGameEntity *pEntity = GIt->second; pEntity->OnWorldLoad(); } //OnMapLoad for player mpInit->mpPlayer->OnWorldLoad(); mpInit->mpGame->ResetLogicTimer(); //Physics set up pWorld->GetPhysicsWorld()->SetAccuracyLevel(mpInit->mPhysicsAccuracy); return true; }
void AndroidManager::Shutdown() { DestroyAll(); }
cGpuProgramManager::~cGpuProgramManager() { DestroyAll(); Log(" Done with Gpu programs\n"); }
AndroidManager::~AndroidManager(void) { DestroyAll(); }
int main(int argc, char* argv[]) { ADTErr err; CdrStock* cdrQ; ProtecQueue* dataQ; sig sigBill, sigProc, sigFriends; sigset_t blockMask; Params ptr; LogCreate(LOG_MODE, LOG_NAME); Args* args = malloc(GetSizeOfArgs()); if (NULL == args) { ERR_PRINT("allocation failed, %s", "args"); return -1; } ArgsSet(args, argc, argv); DEBUG_PRINT("Path given: %s", GetPath(args, &err)); if (ERR_OK != CreateAll(&cdrQ, &dataQ)) { ERR_PRINT("%s", "failed to create queues"); free(args); return -1; } if (ERR_OK != SignalInitAll( &sigBill, &sigProc, &sigFriends, &blockMask) ) { free(args); return -1; } ptr.m_sizeIsdn = GetSubscriberHashSize(args, &err); ptr.m_sizeOperator = GetOperatorHashSize(args, &err); ptr.m_queue = dataQ; if (ERR_OK != InsertAllCdrFiles(cdrQ, GetPath(args, &err))) { ERR_PRINT("%s", "failed: InsertAllCdrFiles"); free(args); return -1; } if (ERR_OK != StartReadingThreads(NUM_OF_THREADS, cdrQ, dataQ)) { ERR_PRINT("%s", "failed: StartReadingThread"); free(args); return -1; } if (0 != pthread_create(&s_tidProc, NULL, ProcessorWork, (void*)&ptr)) { ERR_PRINT("%s", "failed: pthread_create"); free(args); return -1; } if (0 != pthread_join(s_tidProc, NULL)) { ERR_PRINT("%s", "failed: pthread_join"); free(args); return -1; } if (ERR_OK != DestroyAll(&cdrQ, &dataQ)) { ERR_PRINT("%s", "failed: DestroyAll"); free(args); return -1; } free(args); return 0; }
cTileSetManager::~cTileSetManager() { DestroyAll(); Log(" Done with tilesets\n"); }