//========================================================================== // // // //========================================================================== void ADynamicLight::SetOffset(fixed_t x, fixed_t y, fixed_t z) { m_offX = x; m_offY = y; m_offZ = z; UpdateLocation(); }
void BNavigator::AttachedToWindow() { // Inital setup of widget states UpdateLocation(0, kActionSet); // All messages should arrive here fBack->SetTarget(this); fForw->SetTarget(this); fUp->SetTarget(this); fLocation->SetTarget(this); }
CScrollBar::CScrollBar(const SButtonArguments& aButtonArg, const SScrollBarArguments& aScrollBarArg, TFloat& aScrollVariableRef) :CButton(aButtonArg), iScrollVariableRef(aScrollVariableRef) { iScrollAxis = aScrollBarArg.ScrollAxis; iMaxScroll = aScrollBarArg.MaxScroll; //can't scroll more then this iScrollSpeedFactor = aScrollBarArg.ScrollSpeedFactor; //determines how fast the scrolling will be for each virtual pixel if(iScrollAxis == EScrollAxisY) //need to substract the area that is already occupied by the texture of the scrollbar { iMaxScrollHeight = aScrollBarArg.MaxScrollHeight - aScrollBarArg.SizeOfTexture.iHeight; } else { iMaxScrollHeight = aScrollBarArg.MaxScrollHeight - aScrollBarArg.SizeOfTexture.iWidth; } if(iMaxScrollHeight < 0 ) { iMaxScrollHeight = 0; } UpdateLocation(); }
//========================================================================== // // // //========================================================================== void ADynamicLight::Tick() { if (vid_renderer == 0) { return; } if (IsOwned()) { if (!target || !target->state) { this->Destroy(); return; } if (target->flags & MF_UNMORPHED) return; } // Don't bother if the light won't be shown if (!IsActive()) return; // I am doing this with a type field so that I can dynamically alter the type of light // without having to create or maintain multiple objects. switch(lighttype) { case PulseLight: { float diff = (level.maptime - m_lastUpdate) / (float)TICRATE; m_lastUpdate = level.maptime; m_cycler.Update(diff); m_currentIntensity = m_cycler.GetVal(); break; } case FlickerLight: { BYTE rnd = randLight(); float pct = ANGLE_TO_FLOAT(angle)/360.f; m_currentIntensity = float(m_intensity[rnd >= pct * 255]); break; } case RandomFlickerLight: { int flickerRange = m_intensity[1] - m_intensity[0]; float amt = randLight() / 255.f; m_tickCount++; if (m_tickCount > ANGLE_TO_FLOAT(angle)) { m_currentIntensity = float(m_intensity[0] + (amt * flickerRange)); m_tickCount = 0; } break; } #if 0 // These need some more work elsewhere case ColorFlickerLight: { BYTE rnd = randLight(); float pct = ANGLE_TO_FLOAT(angle)/360.f; m_currentIntensity = m_intensity[rnd >= pct * 255]; break; } case RandomColorFlickerLight: { int flickerRange = m_intensity[1] - m_intensity[0]; float amt = randLight() / 255.f; m_tickCount++; if (m_tickCount > ANGLE_TO_FLOAT(angle)) { m_currentIntensity = m_intensity[0] + (amt * flickerRange); m_tickCount = 0; } break; } #endif case SectorLight: { float intensity; float scale = args[LIGHT_SCALE] / 8.f; if (scale == 0.f) scale = 1.f; intensity = Sector->lightlevel * scale; intensity = clamp<float>(intensity, 0.f, 255.f); m_currentIntensity = intensity; break; } case PointLight: m_currentIntensity = float(m_intensity[0]); break; } UpdateLocation(); }
void ADynamicLight::SetOffset(const DVector3 &pos) { m_off = pos; UpdateLocation(); }
TBool CScrollBar::CheckIfHit(const STouchEventLocationConverted& aTouchEvent) { TInt lX = iTextureObject->ReturnLowerLeftCoordinate().iX.GetIntInBaseInt(); TInt lY = iTextureObject->ReturnLowerLeftCoordinate().iY.GetIntInBaseInt(); TRect lHitBox = TRect(TPoint(lX,lY + iSizeOfHitBox.iHeight), iSizeOfHitBox.iWidth, iSizeOfHitBox.iHeight); //need to add Height, since we want iY to be the bottom left corner TBool lHasBeenTouched = lHitBox.Contains(aTouchEvent.VirtualLocation); switch(aTouchEvent.Type) { case ETouchEventHandlerTouchTypeDown: { if(lHasBeenTouched) { iLastPositionDrag = aTouchEvent.VirtualLocation; iState = EStateSelected; iIdOfFinger = aTouchEvent.FingerId; } break; } case ETouchEventHandlerTouchTypeDrag: { if(iState == EStateSelected && iIdOfFinger == aTouchEvent.FingerId) { if(iScrollAxis == EScrollAxisY) { if(iLastPositionDrag.iY > aTouchEvent.VirtualLocation.iY) //move everything down { iScrollVariableRef += (iLastPositionDrag.iY - aTouchEvent.VirtualLocation.iY) * iScrollSpeedFactor; if(iScrollVariableRef > iMaxScroll) iScrollVariableRef = iMaxScroll; } else if(iLastPositionDrag.iY < aTouchEvent.VirtualLocation.iY)//move everything up { iScrollVariableRef -= (aTouchEvent.VirtualLocation.iY - iLastPositionDrag.iY) * iScrollSpeedFactor; if(iScrollVariableRef < 0) iScrollVariableRef = 0; } } else { if(iLastPositionDrag.iX < aTouchEvent.VirtualLocation.iX) //move everything to the left { iScrollVariableRef += (aTouchEvent.VirtualLocation.iX - iLastPositionDrag.iX) * iScrollSpeedFactor; if(iScrollVariableRef > iMaxScroll) iScrollVariableRef = iMaxScroll; }else if(iLastPositionDrag.iX > aTouchEvent.VirtualLocation.iX) //move everything to the right { iScrollVariableRef -= (iLastPositionDrag.iX - aTouchEvent.VirtualLocation.iX) * iScrollSpeedFactor; if(iScrollVariableRef < 0) iScrollVariableRef = 0; } } iLastPositionDrag = aTouchEvent.VirtualLocation; } break; } case ETouchEventHandlerTouchTypeUp: { if(iIdOfFinger == aTouchEvent.FingerId) { iState = EStateDefault; } break; } } //always update ScrollBar Location, this way even if other objective modify the relative location the scroll bar will be updated as well UpdateLocation(); return lHasBeenTouched; }
CSharedContent::CSharedContent() { UpdateLocation(); }
void CentralLB::ProcessReceiveMigration(CkReductionMsg *msg) { #if CMK_LBDB_ON int i; LBMigrateMsg *m = storedMigrateMsg; CmiAssert(m!=NULL); delete msg; #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) int *dummyCounts; DEBUGF(("[%d] Starting ReceiveMigration WITH step %d m->step %d\n",CkMyPe(),step(),m->step)); // CmiPrintf("[%d] Starting ReceiveMigration step %d m->step %d\n",CkMyPe(),step(),m->step); if(step() > m->step){ char str[100]; envelope *env = UsrToEnv(m); return; } lbDecisionCount = m->lbDecisionCount; #endif if (_lb_args.debug() > 1) if (CkMyPe()%1024==0) CmiPrintf("[%d] Starting ReceiveMigration step %d at %f\n",CkMyPe(),step(), CmiWallTimer()); for (i=0; i<CkNumPes(); i++) theLbdb->lastLBInfo.expectedLoad[i] = m->expectedLoad[i]; CmiAssert(migrates_expected <= 0 || migrates_completed == migrates_expected); /*FAULT_EVAC*/ if(!CmiNodeAlive(CkMyPe())){ delete m; return; } migrates_expected = 0; future_migrates_expected = 0; #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) int sending=0; int dummy=0; LBDB *_myLBDB = theLbdb->getLBDB(); if(_restartFlag){ dummyCounts = new int[CmiNumPes()]; bzero(dummyCounts,sizeof(int)*CmiNumPes()); } #endif for(i=0; i < m->n_moves; i++) { MigrateInfo& move = m->moves[i]; const int me = CkMyPe(); if (move.from_pe == me && move.to_pe != me) { DEBUGF(("[%d] migrating object to %d\n",move.from_pe,move.to_pe)); // migrate object, in case it is already gone, inform toPe #if (!defined(_FAULT_MLOG_) && !defined(_FAULT_CAUSAL_)) if (theLbdb->Migrate(move.obj,move.to_pe) == 0) thisProxy[move.to_pe].MissMigrate(!move.async_arrival); #else if(_restartFlag == 0){ DEBUG(CmiPrintf("[%d] need to move object from %d to %d \n",CkMyPe(),move.from_pe,move.to_pe)); theLbdb->Migrate(move.obj,move.to_pe); sending++; }else{ if(_myLBDB->validObjHandle(move.obj)){ DEBUG(CmiPrintf("[%d] need to move object from %d to %d \n",CkMyPe(),move.from_pe,move.to_pe)); theLbdb->Migrate(move.obj,move.to_pe); sending++; }else{ DEBUG(CmiPrintf("[%d] dummy move to pe %d detected after restart \n",CmiMyPe(),move.to_pe)); dummyCounts[move.to_pe]++; dummy++; } } #endif } else if (move.from_pe != me && move.to_pe == me) { DEBUGF(("[%d] expecting object from %d\n",move.to_pe,move.from_pe)); if (!move.async_arrival) migrates_expected++; else future_migrates_expected++; } else { #if CMK_GLOBAL_LOCATION_UPDATE UpdateLocation(move); #endif } } DEBUGF(("[%d] in ReceiveMigration %d moves expected: %d future expected: %d\n",CkMyPe(),m->n_moves, migrates_expected, future_migrates_expected)); // if (_lb_debug) CkPrintf("[%d] expecting %d objects migrating.\n", CkMyPe(), migrates_expected); #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) if(_restartFlag){ sendDummyMigrationCounts(dummyCounts); _restartFlag =0; delete []dummyCounts; } #endif #if 0 if (m->n_moves ==0) { theLbdb->SetLBPeriod(theLbdb->GetLBPeriod()*2); } #endif cur_ld_balancer = m->next_lb; if((CkMyPe() == cur_ld_balancer) && (cur_ld_balancer != 0)){ LBDatabaseObj()->set_avail_vector(m->avail_vector, -2); } if (migrates_expected == 0 || migrates_completed == migrates_expected) MigrationDone(1); delete m; // CkEvacuatedElement(); #if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_)) // migrates_expected = 0; // // ResumeClients(1); #endif #endif }
SysConf::SysConf() : m_IsValid(false) { UpdateLocation(); }
CLocator::CLocator() { Center(); m_nDistance = 75.0f; UpdateLocation(); }
int BoardID(int crateNum, uint32_t slotMask, int updateLocation) { lprintf("*** Starting Board ID ******************\n"); XL3Packet packet; BoardIDReadArgs *args = (BoardIDReadArgs *) packet.payload; BoardIDReadResults *results = (BoardIDReadResults *) packet.payload; uint16_t ids[16*6]; int crates[16*6]; int slots[16*6]; int positions[16*6]; int boardcount = 0; try{ lprintf("SLOT ID: MB DB1 DB2 DB3 DB4 HVC\n"); for (int i=0;i<16;i++){ if ((0x1<<i) & slotMask){ lprintf("%d ",i); for (int j=1;j<7;j++){ packet.header.packetType = BOARD_ID_READ_ID; args->slot = i; args->chip = j; args->reg = 15; SwapLongBlock(packet.payload,sizeof(BoardIDReadArgs)/sizeof(uint32_t)); xl3s[crateNum]->SendCommand(&packet); SwapLongBlock(packet.payload,sizeof(BoardIDReadResults)/sizeof(uint32_t)); lprintf("0x%04x ",results->id); int pass = 1; if (j==1){ //fec if (((results->id & 0xF000) != 0xF000) || results->id == 0xFFFF) pass = 0; }else if (j<6){//db if ( (results->id & 0xF000) != 0xD000) pass = 0; }else{//pmtic if ((results->id & 0xF000) != 0xE000) pass = 0; } if (pass && updateLocation){ ids[boardcount] = results->id; crates[boardcount] = crateNum; slots[boardcount] = i; positions[boardcount] = j-1; boardcount++; } } lprintf("\n"); } } if (updateLocation){ lprintf("Updating location...\n"); UpdateLocation(ids,crates,slots,positions,boardcount); } } catch(const char* s){ lprintf("BoardID: %s\n",s); } lprintf("****************************************\n"); return 0; }