void CSystemTimer::SetTimer(TimerType Type, uint32_t Cycles, bool bRelative) { if (Type >= MaxTimer || Type == UnknownTimer) { g_Notify->BreakPoint(__FILE__, __LINE__); return; } UpdateTimers(); m_TimerDetatils[Type].Active = true; if (bRelative) { if (m_TimerDetatils[Type].Active) { m_TimerDetatils[Type].CyclesToTimer += Cycles; //Add to the timer } else { m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; //replace the new cycles } } else { m_TimerDetatils[Type].CyclesToTimer = (int64_t)Cycles - (int64_t)m_NextTimer; //replace the new cycles } FixTimers(); }
void CPU::Update() { const int MAXCYCLES = 70221; int cyclesThisUpdate = 0; while (cyclesThisUpdate < MAXCYCLES) { if (shouldDisableInterrupts) { interruptMasterEnable = false; shouldDisableInterrupts = false; } if (shouldEnableInterrupts) { interruptMasterEnable = true; shouldEnableInterrupts = false; } Instruction *instruction = InvokeInstruction(ReadByte(PC)); int cycles = instruction->GetDuration(); cyclesThisUpdate += cycles; UpdateTimers(cycles); UpdateGraphics(cycles); HandleInterrupts(); } }
// Updating void EnemySpawner::Update(float dt) { m_canSpawn = (m_numSpawnedEnemies < m_maxNumEnemiesToHaveActive); // Update timers UpdateTimers(dt); if(m_spawning && m_canSpawn) { if(m_spawnCountdownTimer <= 0.0f) { vec3 spawnPos = GetSpawnPosition(); vec3 toPlayer = spawnPos - m_pPlayer->GetCenter(); if(length(toPlayer) > m_minDistanceFromPlayer) { eEnemyType enemyType = GetEnemyTypeToSpawn(); Enemy* pEnemy = m_pEnemyManager->CreateEnemy(spawnPos, enemyType, 0.08f); pEnemy->SetSpawningParams(spawnPos, spawnPos, 2.0f); pEnemy->SetTargetForwardToLookAtPoint(spawnPos + m_spawnFacingDirection); pEnemy->SetEnemySpawner(this); m_numSpawnedEnemies += 1; m_spawnCountdownTimer = m_spawnTime; } } } }
void Clock::AdvanceTime(double deltaSeconds){ //timescale it first deltaSeconds *= m_timeScale; //set to 0 if (m_isPaused) deltaSeconds = 0.0; m_deltaSeconds = deltaSeconds; //advance time m_currentTime += m_deltaSeconds; UpdateTimers(m_deltaSeconds, m_timers); for (ClocksIterator it = m_children.begin(); it != m_children.end(); ++it){ Clock* clock = (*it); if (clock) { //advance time on children clock->AdvanceTime(m_deltaSeconds); } } }
void LScreenSaver::LockScreen(){ if(SSLocked){ return; } if(DEBUG){ qDebug() << "Locking Screen:" << QDateTime::currentDateTime().toString(); } SSLocked = true; LOCKER->LoadSystemDetails(); UpdateTimers(); }
void LeagueOfLegendsHelperDlg::OnTimer(UINT_PTR nIDEvent) { UNREFERENCED_PARAMETER(nIDEvent); CheckButtonPresses(); UpdateTimers(); m_lcd.Update(); }
void CGameServDlg::OnTimer(UINT nIDEvent) { // Call the update function... //OnUpdate(); UpdateTimers(); }
int OnModulesLoaded(WPARAM, LPARAM) { HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded); UpdateTimers(); return 0; }
void LScreenSaver::HideLockScreen(){ if(DEBUG){ qDebug() << "Hiding Lock Screen:" << QDateTime::currentDateTime().toString(); } //Leave the Locked flag set (still locked, just not visible) LOCKER->aboutToHide(); LOCKER->hide(); this->repaint(); if(SSLocked){ ShowScreenSaver(); } UpdateTimers(); }
void CTimeManager::Update(f64 dt) { CalculateElapsedTime(); CalculateFPS(); UpdateTimers(); //CCoreEngine::Instance().GetLogManager().LogOutput(LOG_INFO, LOGSUB_TIMER,"dTime = %F | FPS = %F %d", m_ElapsedTimeSeconds ,m_FramesPerSecond); }
void CSystemTimer::FixTimers() { if (m_inFixTimer) { return; } m_inFixTimer = true; UpdateTimers(); if (GetTimer(CompareTimer) > 0x60000000) { SetCompareTimer(); } //Update the cycles for the remaining number of cycles to timer int count; for (count = 0; count < MaxTimer; count++) { if (!m_TimerDetatils[count].Active) { continue; } m_TimerDetatils[count].CyclesToTimer += m_NextTimer; } //Set Max timer m_NextTimer = 0x7FFFFFFF; //Find the smallest timer left to go for (count = 0; count < MaxTimer; count++) { if (!m_TimerDetatils[count].Active) { continue; } if (m_TimerDetatils[count].CyclesToTimer >= m_NextTimer) { continue; } m_NextTimer = (int)m_TimerDetatils[count].CyclesToTimer; m_Current = (TimerType)count; } //Move the timer back this value for (count = 0; count < MaxTimer; count++) { if (!m_TimerDetatils[count].Active) { continue; } m_TimerDetatils[count].CyclesToTimer -= m_NextTimer; } m_LastUpdate = m_NextTimer; m_inFixTimer = false; }
void LScreenSaver::ShowLockScreen(){ if(DEBUG){ qDebug() << "Showing Lock Screen:" << QDateTime::currentDateTime().toString(); } LOCKER->aboutToShow(); //Move the screen locker to the appropriate spot QPoint ctr = QApplication::desktop()->screenGeometry(QCursor::pos()).center(); LOCKER->resize(LOCKER->sizeHint()); LOCKER->move(ctr - QPoint(LOCKER->width()/2, LOCKER->height()/2) ); LOCKER->show(); //Start the timer for hiding the lock screen due to inactivity UpdateTimers(); }
void LScreenSaver::HideScreenSaver(){ if(DEBUG){ qDebug() << "Hiding Screen Saver:" << QDateTime::currentDateTime().toString(); } SSRunning = false; if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness if(!SSLocked){ this->hide(); emit ClosingScreenSaver(); } for(int i=0; i<BASES.length(); i++){ BASES[i]->hide(); BASES[i]->stopPainting(); } UpdateTimers(); }
void SysTick_Handler(void) { SysTick_Time++; if (SysTick_Time >= (OS_TICKS_PER_SEC * 60 * 60))SysTick_Time = 0; // static int i = 0; // if (i++ >= 1000) // { // i = 0; // //time // Sys_Printf(USART1, "\r\n%d", mytime); // mytime = 0; // } UpdateTimers(); //RunTask(task5, 5); //任务0具有精确按时获得执行的权限,要求:task0每次执行消耗时间<0.5个 ticket }
TimeKeeper::TimeKeeper(double presetDuration, double smoothDuration, double easterEgg) { _smoothDuration = smoothDuration; _presetDuration = presetDuration; _easterEgg = easterEgg; #ifndef WIN32 gettimeofday ( &this->startTime, NULL ); #else startTime = GetTickCount(); #endif /** !WIN32 */ UpdateTimers(); }
void LScreenSaver::newInputEvent(){ if(updating){ return; } //in the middle of making changes which could cause an event if(DEBUG){ qDebug() << "New Input Event"; } if(SSRunning && SSLocked){ //Running and locked // Hide the running setting, and display the lock screen HideScreenSaver(); ShowLockScreen(); }else if(SSRunning){ //Only running, not locked HideScreenSaver(); } UpdateTimers(); }
u8 Processor::Tick() { m_iCurrentClockCycles = 0; if (m_bHalt) { m_iCurrentClockCycles += (m_bCGBSpeed ? 2 : 4); if (m_iUnhaltCycles > 0) { m_iUnhaltCycles -= m_iCurrentClockCycles; if (m_iUnhaltCycles <= 0) { m_iUnhaltCycles = 0; m_bHalt = false; } } if (m_bHalt && (InterruptPending() != None_Interrupt) && (m_iUnhaltCycles == 0)) { m_iUnhaltCycles = (m_bCGBSpeed ? 6 : 12); } } if (!m_bHalt) { ServeInterrupt(InterruptPending()); ExecuteOPCode(FetchOPCode()); } UpdateDelayedInterrupts(); UpdateTimers(); UpdateSerial(); if (m_iIMECycles > 0) { m_iIMECycles -= m_iCurrentClockCycles; if (m_iIMECycles <= 0) { m_iIMECycles = 0; m_bIME = true; } } return m_iCurrentClockCycles; }
int OnModulesLoaded(WPARAM, LPARAM) { UpdateTimers(); CMenuItem mi; mi.hIcolibItem = hiMailIcon; mi.position = 10000000; mi.pszService = MS_EXCHANGE_CHECKEMAIL; mi.flags = CMIF_TCHAR; mi.name.t = LPGENT("Check exchange mailbox"); Menu_AddMainMenuItem(&mi); hEmailsDlg = NULL; //CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window FirstTimeCheck(); // CheckEmail(); return 0; }
// Updating void Player::Update(float dt) { // Update the voxel model float animationSpeeds[AnimationSections_NUMSECTIONS] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; m_pVoxelCharacter->Update(dt, animationSpeeds); m_pVoxelCharacter->SetWeaponTrailsOriginMatrix(dt, m_worldMatrix); // Update / Create weapon lights and particle effects UpdateWeaponLights(dt); UpdateWeaponParticleEffects(dt); // Update timers UpdateTimers(dt); // Physics update UpdatePhysics(dt); }
int OnModulesLoaded(WPARAM, LPARAM) { UpdateTimers(); CMenuItem mi(g_plugin); SET_UID(mi, 0xcbfbfd3d, 0x5002, 0x4c64, 0x92, 0xb, 0x9c, 0x12, 0x4b, 0x6, 0x51, 0x2a); mi.hIcolibItem = hiMailIcon; mi.position = 10000000; mi.pszService = MS_EXCHANGE_CHECKEMAIL; mi.flags = CMIF_UNICODE; mi.name.w = LPGENW("Check exchange mailbox"); Menu_AddMainMenuItem(&mi); hEmailsDlg = nullptr; //CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EMAILS), NULL, DlgProcEmails); //create emails window FirstTimeCheck(); // CheckEmail(); return 0; }
void draw(EffectControls controls) { // Serial.println("Updating timers..."); // let the oscillators swing UpdateTimers(); Line(multiTimer[3].count, multiTimer[4].count, multiTimer[0].count, multiTimer[1].count, multiTimer[2].count); // y wind StreamVertical(120); // and here // x wind StreamHorizontal(110); // and here }
// Updating void ItemSpawner::Update(float dt) { m_canSpawn = (m_numSpawnedItems < m_maxNumItemsToHaveActive); // Update timers UpdateTimers(dt); if(m_spawning && m_canSpawn) { if(m_spawnCountdownTimer <= 0.0f) { vec3 spawnPos; bool spawnGood = GetSpawnPosition(&spawnPos); if (spawnGood) { vec3 toPlayer = spawnPos - m_pPlayer->GetCenter(); if (length(toPlayer) > m_minDistanceFromPlayer) { eItem itemType = GetItemTypeToSpawn(); string itemFilename = GetItemFilenameForType(itemType); Item* pItem = m_pItemManager->CreateItem(spawnPos, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f), itemFilename.c_str(), itemType, "SpawnedItem", true, false, m_spawnScale); pItem->SetItemSpawner(this); if (itemType == eItem_CopperVein || itemType == eItem_IronVein || itemType == eItem_SilverVein || itemType == eItem_GoldVein) { pItem->SetMaxtInteractCount(4); } pItem->SetRotation(vec3(0.0f, GetRandomNumber(0, 360, 2), 0.0f)); m_numSpawnedItems += 1; m_spawnCountdownTimer = m_spawnTime; } } else { // Can't spawn an item at a good position, wait a while before we try again m_spawnCountdownTimer = 0.5f; } } } }
// =========== // PRIVATE SLOTS // =========== void LScreenSaver::ShowScreenSaver(){ if(DEBUG){ qDebug() << "Showing Screen Saver:" << QDateTime::currentDateTime().toString(); } SSRunning = true; updating = true; //Now remove any current Base widgets (prevent any lingering painting between sessions) for(int i=0; i<BASES.length(); i++){ if(DEBUG){ qDebug() << " - Removing SS Base"; } delete BASES.takeAt(i); i--; } //Now go through and create/show all the various widgets QList<QScreen*> SCREENS = QApplication::screens(); QRect bounds; cBright = LOS::ScreenBrightness(); if(cBright>0){ LOS::setScreenBrightness(cBright/2); } //cut to half while the screensaver is active for(int i=0; i<SCREENS.length(); i++){ bounds = bounds.united(SCREENS[i]->geometry()); if(DEBUG){ qDebug() << " - New SS Base:" << i; } BASES << new SSBaseWidget(this, settings); connect(BASES[i], SIGNAL(InputDetected()), this, SLOT(newInputEvent()) ); //Setup the geometry of the base to match the screen BASES[i]->setGeometry(SCREENS[i]->geometry()); //match this screen geometry BASES[i]->setPlugin(settings->value("screenplugin"+QString::number(i+1), settings->value("defaultscreenplugin","random").toString() ).toString() ); } //Now set the overall parent widget geometry and show everything this->setGeometry(bounds); //overall background widget if(!this->isActiveWindow()){ this->raise(); this->show(); this->activateWindow(); } for(int i=0; i<BASES.length(); i++){ BASES[i]->show(); BASES[i]->startPainting(); } updating = false; UpdateTimers(); }
void ComManager::Mainloop() { while (true) { _DINT(); // disable interrupts until we go into low-power mode if (gcsQ.IsDataAvailable(ROTORCRAFT_LINK_GCS_HEAD) || airshipQ.IsDataAvailable(ROTORCRAFT_LINK_AIRSHIP_HEAD)) { UCA0IE |= UCTXIE; // enable USCI A0 TX interrupt } if (airshipQ.IsDataAvailable(GCS_LINK_AIRSHIP_HEAD) || rotorcraftQ.IsDataAvailable(GCS_LINK_ROTORCRAFT_HEAD)) { UCA1IE |= UCTXIE; // enable USCI A1 TX interrupt } _BIS_SR(LPM0_bits | GIE); // enter low-power mode with interrupt enable WDTCTL = WDT_CONFIG; // pet watchdog // decrement timers if needed if (updateTimers) { UpdateTimers(); updateTimers = false; } // check for Rotorcraft (UART A0) TX interrupt if (UCA0IFG & UCTXIFG) { // check if we have finished sending a message if (rotorcraftTxCount == rotorcraftTxLen) { bool foundMsg = false; // check both links to see if there is a message to send for (int i = 0; !foundMsg && i < 2; ++i) { if (rotorcraftFromId == GCS) { rotorcraftFromId = AIRSHIP; foundMsg = airshipQ.FindNextMessage(ROTORCRAFT_LINK_AIRSHIP_HEAD, routeTable[ROTORCRAFT], rotorcraftTxLen); } else { rotorcraftFromId = GCS; foundMsg = gcsQ.FindNextMessage(ROTORCRAFT_LINK_GCS_HEAD, routeTable[ROTORCRAFT], rotorcraftTxLen); } } if (foundMsg) { rotorcraftTxCount = 0; } } // check if we have a message to send if (rotorcraftTxCount < rotorcraftTxLen) { // find which link we're currently receiving data from switch (rotorcraftFromId) { case GCS: if (gcsQ.IsDataAvailable(ROTORCRAFT_LINK_GCS_HEAD)) { UCA0TXBUF = gcsQ.Dequeue(ROTORCRAFT_LINK_GCS_HEAD); txTimers[ROTORCRAFT] = TX_TIMEOUT; // reset timer ++rotorcraftTxCount; } break; case AIRSHIP: if (airshipQ.IsDataAvailable(ROTORCRAFT_LINK_AIRSHIP_HEAD)) { UCA0TXBUF = airshipQ.Dequeue(ROTORCRAFT_LINK_AIRSHIP_HEAD); txTimers[ROTORCRAFT] = TX_TIMEOUT; // reset timer ++rotorcraftTxCount; } break; default: // we should never get here break; } } } // check for GCS (UART A1) TX interrupt if (UCA1IFG & UCTXIFG) { // check if we have finished sending a message if (gcsTxCount == gcsTxLen) { bool foundMsg = false; // check both links to see if there is a message to send for (int i = 0; !foundMsg && i < 2; ++i) { if (gcsFromId == ROTORCRAFT) { gcsFromId = AIRSHIP; foundMsg = airshipQ.FindNextMessage(GCS_LINK_AIRSHIP_HEAD, routeTable[GCS], gcsTxLen); } else { gcsFromId = ROTORCRAFT; foundMsg = rotorcraftQ.FindNextMessage(GCS_LINK_ROTORCRAFT_HEAD, routeTable[GCS], gcsTxLen); } } if (foundMsg) { gcsTxCount = 0; } } // check if we have a message to send if (gcsTxCount < gcsTxLen) { // find which link we're currently receiving data from switch (gcsFromId) { case AIRSHIP: if (airshipQ.IsDataAvailable(GCS_LINK_AIRSHIP_HEAD)) { UCA1TXBUF = airshipQ.Dequeue(GCS_LINK_AIRSHIP_HEAD); txTimers[GCS] = TX_TIMEOUT; // reset timer ++gcsTxCount; } break; case ROTORCRAFT: if (rotorcraftQ.IsDataAvailable(GCS_LINK_ROTORCRAFT_HEAD)) { UCA1TXBUF = rotorcraftQ.Dequeue(GCS_LINK_ROTORCRAFT_HEAD); txTimers[GCS] = TX_TIMEOUT; // reset timer ++gcsTxCount; } break; default: // we should never get here break; } } } // check for Airship (I2C) TX interrupt if (airshipTxCount == airshipTxLen) // check if we have finished sending a message { bool foundMsg = false; // check both links to see if there is a message to send for (int i = 0; !foundMsg && i < 2; ++i) { if (airshipFromId == GCS) { airshipFromId = ROTORCRAFT; foundMsg = rotorcraftQ.FindNextMessage(AIRSHIP_LINK_ROTORCRAFT_HEAD, routeTable[AIRSHIP], airshipTxLen, AIRSHIP_FIND_WHOLE_MSG); } else { airshipFromId = GCS; foundMsg = gcsQ.FindNextMessage(AIRSHIP_LINK_GCS_HEAD, routeTable[AIRSHIP], airshipTxLen, AIRSHIP_FIND_WHOLE_MSG); } } if (foundMsg) { airshipTxCount = 0; // send interrupt to Airship AIRSHIP_INT_POUT |= AIRSHIP_INT_BIT; } } } // end while (true) }
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); hExtraIconListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconListRebuild); hExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraImageApply); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); hTopToolBarModuleLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded); //hContactSendMessage = HookEvent(ME_WWI_SENDMESSAGE, OnContactSendMessage); SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, "WhenWasIt", "Birthday near"); SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, "WhenWasIt", "Birthday today"); RebuildAdvIconList(); char buffer[1024]; Update update = {0}; update.cbSize = sizeof(Update); update.szComponentName = __PLUGIN_DISPLAY_NAME; update.pbVersion = (BYTE *) CreateVersionString(VERSION, buffer); update.cpbVersion = (int) strlen((char *) update.pbVersion); update.szUpdateURL = UPDATER_AUTOREGISTER; update.szBetaVersionURL = WHENWASIT_VERSION_URL; update.szBetaUpdateURL = WHENWASIT_UPDATE_URL; update.pbBetaVersionPrefix = (BYTE *) WHENWASIT_VERSION_PREFIX; update.cpbBetaVersionPrefix = (int) strlen(WHENWASIT_VERSION_PREFIX); CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update); UpdateTimers(); CLISTMENUITEM cl = {0}; cl.cbSize = sizeof(CLISTMENUITEM); cl.hIcon = hiCheckMenu; cl.position = 10000000; cl.pszService = MS_WWI_CHECK_BIRTHDAYS; cl.pszName = "Check for birthdays"; cl.pszPopupName = "Birthdays (When Was It)"; hmCheckBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_LIST_SHOW; cl.pszName = "Birthday list"; cl.hIcon = hiListMenu; hmBirthdayList = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_REFRESH_USERDETAILS; cl.position = 10100000; cl.pszName = "Refresh user details"; cl.hIcon = hiRefreshUserDetails; hmRefreshDetails = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_IMPORT_BIRTHDAYS; cl.position = 10200000; cl.pszName = "Import birthdays"; cl.hIcon = hiImportBirthdays; hmImportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_EXPORT_BIRTHDAYS; cl.pszName = "Export birthdays"; cl.hIcon = hiExportBirthdays; hmExportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl); cl.pszService = MS_WWI_ADD_BIRTHDAY; cl.position = 10000000; cl.hIcon = hiAddBirthdayContact; cl.pszName = "Add/change user &birthday"; hmAddChangeBirthday = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &cl); if(ServiceExists(MS_HOTKEY_REGISTER)) { HOTKEYDESC hotkey = {0}; hotkey.cbSize = sizeof(hotkey); hotkey.dwFlags = HKD_TCHAR; hotkey.ptszSection = LPGENT("Birthdays"); hotkey.pszName = "wwi_birthday_list"; hotkey.ptszDescription = LPGENT("Birthday list"); hotkey.pszService = MS_WWI_LIST_SHOW; CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey); hotkey.pszName = "wwi_check_birthdays"; hotkey.ptszDescription = LPGENT("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey); } return 0; }
void cMapHandler::Update(float afTimeStep) { mfGameTime += (double)afTimeStep; //iLowLevelSystem *pLowLevelSystem =mpInit->mpGame->GetSystem()->GetLowLevel(); //LogUpdate(" Flashes!\n"); //////////////////////////// //Update light flashes tEffectLightFlashListIt FlashIt = mlstLightFlashes.begin(); for(; FlashIt != mlstLightFlashes.end(); ) { cEffectLightFlash *pFlash = *FlashIt; pFlash->Update(afTimeStep); if(pFlash->IsDead()) { hplDelete( pFlash ); FlashIt = mlstLightFlashes.erase(FlashIt); } else { ++FlashIt; } } //LogUpdate(" Timers\n"); //////////////////////////// //Update timers UpdateTimers(afTimeStep); //LogUpdate(" Entities!\n"); //////////////////////////// //Update entities. tGameEntityMapIt GIt = m_mapGameEntities.begin(); for(; GIt != m_mapGameEntities.end();) { iGameEntity *pEntity = GIt->second; //unsigned int lTime = pLowLevelSystem->GetTime(); //LogUpdate(" %s\n",pEntity->GetName().c_str()); if(pEntity->IsActive()){ pEntity->OnUpdate(afTimeStep); } if(pEntity->GetDestroyMe() || pEntity->GetBreakMe()) { //LogUpdate(" destroying\n"); if(pEntity->GetBreakMe()) pEntity->BreakAction(); m_mapGameEntities.erase(GIt++); hplDelete( pEntity ); //LogUpdate(" done destroying\n"); } else { ////LogUpdate(" updating %s took %d ms\n", pEntity->GetName().c_str(), // pLowLevelSystem->GetTime() - lTime); ++GIt; } } //////////////////////////// //Check for map change //LogUpdate(" Map change\n"); if(mMapChanger.mbActive && mpInit->mpFadeHandler->IsActive()==false) { mMapChanger.mbActive = false; //Log("---------- CHANGING TO MAP: '%s' ------------------\n",mMapChanger.msNewMap.c_str()); //Make sure that the graphics are not destroyed at the end of the map so //That the next map doesn't have to reload em. mpInit->mbDestroyGraphics = false; //Draw Loading image if(mMapChanger.msLoadTextCat != "") { mpInit->mpMapLoadText->SetText(mMapChanger.msLoadTextCat,mMapChanger.msLoadTextEntry); mpInit->mpMapLoadText->SetActive(true); } else { mpInit->mpGraphicsHelper->DrawLoadingScreen("other_loading.jpg"); } //Fade in here so that script will over ride it. mpInit->mpFadeHandler->FadeIn(mMapChanger.mfFadeInTime); Load(mMapChanger.msNewMap,mMapChanger.msPosName); mpInit->mbDestroyGraphics = true; if(mMapChanger.msDoneSound!="") mpInit->mpGame->GetSound()->GetSoundHandler()->PlayGui(mMapChanger.msDoneSound,false,1); mpInit->mpPlayer->SetActive(true); //Log("Map change over...\n"); } }
void CSystemTimer::TimerDone() { UpdateTimers(); switch (m_Current) { case CSystemTimer::CompareTimer: m_Reg.FAKE_CAUSE_REGISTER |= CAUSE_IP7; m_Reg.CheckInterrupts(); UpdateCompareTimer(); break; case CSystemTimer::SoftResetTimer: g_SystemTimer->StopTimer(CSystemTimer::SoftResetTimer); g_System->ExternalEvent(SysEvent_ResetCPU_SoftDone); break; case CSystemTimer::SiTimer: g_SystemTimer->StopTimer(CSystemTimer::SiTimer); m_Reg.MI_INTR_REG |= MI_INTR_SI; m_Reg.SI_STATUS_REG |= SI_STATUS_INTERRUPT; m_Reg.CheckInterrupts(); break; case CSystemTimer::PiTimer: g_SystemTimer->StopTimer(CSystemTimer::PiTimer); m_Reg.PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; m_Reg.MI_INTR_REG |= MI_INTR_PI; m_Reg.CheckInterrupts(); break; case CSystemTimer::DDPiTimer: g_SystemTimer->StopTimer(CSystemTimer::DDPiTimer); m_Reg.PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; DiskBMUpdate(); m_Reg.MI_INTR_REG |= MI_INTR_PI; m_Reg.CheckInterrupts(); break; case CSystemTimer::ViTimer: try { g_System->RefreshScreen(); } catch (...) { WriteTrace(TraceN64System, TraceError, "Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__); } m_Reg.MI_INTR_REG |= MI_INTR_VI; m_Reg.CheckInterrupts(); break; case CSystemTimer::RspTimer: g_SystemTimer->StopTimer(CSystemTimer::RspTimer); try { g_System->RunRSP(); } catch (...) { g_Notify->BreakPoint(__FILE__, __LINE__); } break; case CSystemTimer::RSPTimerDlist: g_SystemTimer->StopTimer(CSystemTimer::RSPTimerDlist); m_Reg.m_GfxIntrReg |= MI_INTR_DP; m_Reg.CheckInterrupts(); break; case CSystemTimer::AiTimerInterrupt: g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt); g_Audio->InterruptTimerDone(); break; case CSystemTimer::AiTimerBusy: g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy); g_Audio->BusyTimerDone(); break; default: g_Notify->BreakPoint(__FILE__, __LINE__); } //CheckTimer(); /*if (Profiling) { StartTimer(LastTimer); }*/ }
void Object::Update(float p_fDeltaTime) { UpdateTimers(p_fDeltaTime); }
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged); HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded); SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday near")); SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday today")); UpdateTimers(); CLISTMENUITEM cl = { sizeof(cl) }; cl.position = 10000000; cl.pszPopupName = LPGEN("Birthdays (When Was It)"); cl.pszService = MS_WWI_CHECK_BIRTHDAYS; cl.icolibItem = hCheckMenu; cl.pszName = LPGEN("Check for birthdays"); hmCheckBirthdays = Menu_AddMainMenuItem(&cl); cl.pszService = MS_WWI_LIST_SHOW; cl.pszName = LPGEN("Birthday list"); cl.icolibItem = hListMenu; hmBirthdayList = Menu_AddMainMenuItem(&cl); cl.pszService = MS_WWI_REFRESH_USERDETAILS; cl.position = 10100000; cl.pszName = LPGEN("Refresh user details"); cl.icolibItem = hRefreshUserDetails; hmRefreshDetails = Menu_AddMainMenuItem(&cl); cl.pszService = MS_WWI_IMPORT_BIRTHDAYS; cl.position = 10200000; cl.pszName = LPGEN("Import birthdays"); cl.icolibItem = hImportBirthdays; hmImportBirthdays = Menu_AddMainMenuItem(&cl); cl.pszService = MS_WWI_EXPORT_BIRTHDAYS; cl.pszName = LPGEN("Export birthdays"); cl.icolibItem = hExportBirthdays; hmExportBirthdays = Menu_AddMainMenuItem(&cl); cl.pszService = MS_WWI_ADD_BIRTHDAY; cl.position = 10000000; cl.icolibItem = hAddBirthdayContact; cl.pszName = LPGEN("Add/change user &birthday"); hmAddChangeBirthday = Menu_AddContactMenuItem(&cl); // Register hotkeys HOTKEYDESC hotkey = { sizeof(hotkey) }; hotkey.pszSection = LPGEN("Birthdays"); hotkey.pszName = "wwi_birthday_list"; hotkey.pszDescription = LPGEN("Birthday list"); hotkey.pszService = MS_WWI_LIST_SHOW; Hotkey_Register(&hotkey); hotkey.pszName = "wwi_check_birthdays"; hotkey.pszDescription = LPGEN("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; Hotkey_Register(&hotkey); return 0; }
INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int bInitializing; //true when dialog is being created switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); { bInitializing = 1; DBVARIANT dbv = {0}; dbv.type = DBVT_ASCIIZ; int bCheck = db_get_b(NULL, ModuleName, "Check", 1); TCHAR buffer[4096]; GetStringFromDatabase("Username", _T(""), buffer, SIZEOF(buffer)); SetWindowText(GetDlgItem(hWnd, IDC_USER_EDIT), buffer); GetStringFromDatabase("Password", _T(""), buffer, SIZEOF(buffer)); SetWindowText(GetDlgItem(hWnd, IDC_PASSWORD_EDIT), buffer); GetStringFromDatabase("Server", _T(""), buffer, sizeof(buffer)); SetWindowText(GetDlgItem(hWnd, IDC_SERVER_EDIT), buffer); SetDlgItemInt(hWnd, IDC_PORT_EDIT, db_get_dw(NULL, ModuleName, "Port", EXCHANGE_PORT), FALSE); SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, db_get_dw(NULL, ModuleName, "Interval", DEFAULT_INTERVAL), FALSE); CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, ModuleName, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED); SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, db_get_dw(NULL, ModuleName, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE); CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL) db_get_b(NULL, ModuleName, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPT)); //disable the popups checkbox if no popup module is present CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hWnd, IDC_INTERVAL_EDIT), bCheck); int portCheck = db_get_b(NULL, ModuleName, "UsePortCheck", 1); CheckDlgButton(hWnd, IDC_USE_PORTCHECK, (portCheck) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck); int retries = db_get_b(NULL, ModuleName, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES); SetDlgItemInt(hWnd,IDC_MAX_RETRIES,retries,FALSE); EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT)); bInitializing = 0; } return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_USER_EDIT: case IDC_PASSWORD_EDIT: case IDC_SERVER_EDIT: case IDC_PORT_EDIT: case IDC_INTERVAL_EDIT: case IDC_RECONNECT_INTERVAL: case IDC_MAX_RETRIES: if ((!bInitializing) && (HIWORD(wParam) == EN_CHANGE))// || (HIWORD(wParam) == CBN_SELENDOK)) SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); break; case IDC_USE_POPUPS: case IDC_CHECK_EMAILS: case IDC_RECONNECT: case IDC_USE_PORTCHECK: int portCheck = IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK); SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); EnableWindow(GetDlgItem(hWnd, IDC_INTERVAL_EDIT), IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS)); EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT)); EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck); break; } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: db_set_b(NULL, ModuleName, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS)); TCHAR buffer[4096]; GetWindowText(GetDlgItem(hWnd, IDC_USER_EDIT), buffer, SIZEOF(buffer)); db_set_ts(NULL, ModuleName, "Username", buffer); GetWindowText(GetDlgItem(hWnd, IDC_PASSWORD_EDIT), buffer, SIZEOF(buffer)); db_set_ts(NULL, ModuleName, "Password", buffer); GetWindowText(GetDlgItem(hWnd, IDC_SERVER_EDIT), buffer, SIZEOF(buffer)); db_set_ts(NULL, ModuleName, "Server", buffer); GetWindowText(GetDlgItem(hWnd, IDC_PORT_EDIT), buffer, SIZEOF(buffer)); db_set_dw(NULL, ModuleName, "Port", GetDlgItemInt(hWnd,IDC_PORT_EDIT,NULL,FALSE)); db_set_dw(NULL, ModuleName, "Interval", GetDlgItemInt(hWnd,IDC_INTERVAL_EDIT,NULL,FALSE)); db_set_dw(NULL, ModuleName, "ReconnectInterval", GetDlgItemInt(hWnd,IDC_RECONNECT_INTERVAL,NULL,FALSE)); db_set_b(NULL, ModuleName, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT)); db_set_b(NULL, ModuleName, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS)); db_set_b(NULL, ModuleName, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK)); db_set_b(NULL, ModuleName, "MaxRetries", GetDlgItemInt(hWnd,IDC_MAX_RETRIES,NULL,FALSE)); exchangeServer.Reconnect(); //login info may be changed UpdateTimers(); //interval might get changed } } break; } return 0; }