void hhProjectileStickyCrawlerGrenade::BindToCollisionObject( const trace_t* collision ) { if( !collision || collision->fraction > 1.0f ) { return; } //HUMANHEAD PCF rww 05/18/06 - wait until we receive bind info from the server if (gameLocal.isClient) { return; } //HUMANHEAD END idEntity* pEntity = gameLocal.entities[collision->c.entityNum]; HH_ASSERT( pEntity ); // HUMANHEAD PCF pdm 05-20-06: Check for some degenerate cases to combat the server hangs happening if (pEntity == this || this->IsBound()) { assert(0); // Report any of these return; } // HUMANHEAD END jointHandle_t jointHandle = CLIPMODEL_ID_TO_JOINT_HANDLE( collision->c.id ); if ( jointHandle != INVALID_JOINT ) { SetOrigin( collision->endpos ); SetAxis( DetermineCollisionAxis( (-collision->c.normal).ToMat3()) ); BindToJoint( pEntity, jointHandle, true ); } else { SetOrigin( collision->endpos ); SetAxis( DetermineCollisionAxis( (-collision->c.normal).ToMat3()) ); Bind( pEntity, true ); } }
bool QPrinter::newPage() { if (state != PST_ACTIVE) return FALSE; if (PMSessionEndPage(psession) != noErr) { //end the last page state = PST_ERROR; return FALSE; } if (PMSessionBeginPage(psession, pformat, 0) != noErr) { //start a new one state = PST_ERROR; return FALSE; } if (PMSessionGetGraphicsContext(psession, kPMGraphicsContextQuickdraw, &hd) != noErr) { state = PST_ERROR; return FALSE; } if (fullPage()) { uint top, left, bottom, right; qt_get_margins(pformat, &top, &left, &bottom, &right); QMacSavedPortInfo mp(this); SetOrigin(top, left); } else { QMacSavedPortInfo mp(this); SetOrigin(0, 0); } return TRUE; }
bool QPrinter::cmd(int c, QPainter *, QPDevCmdParam *) { if (!psession && PMCreateSession(&psession) != noErr) return FALSE; if (c == PdcBegin) { // begin; start printing if (state != PST_IDLE) { qDebug("Qt: internal: printer: two PdcBegin(s)."); return FALSE; } //just to be sure they've been setup prepare(&pformat); prepare(&psettings); //validate the settings if (PMSessionValidatePrintSettings(psession, psettings, kPMDontWantBoolean) != noErr) return FALSE; if (PMSessionValidatePageFormat(psession, pformat, kPMDontWantBoolean) != noErr) return FALSE; if (PMSessionBeginDocument(psession, psettings, pformat) != noErr) //begin the document return FALSE; if (PMSessionBeginPage(psession, pformat, 0) != noErr) //begin the page return FALSE; if (PMSessionGetGraphicsContext(psession, kPMGraphicsContextQuickdraw, &hd) != noErr) //get the gworld return FALSE; state = PST_ACTIVE; if (fullPage()) { uint top, left, bottom, right; qt_get_margins(pformat, &top, &left, &bottom, &right); QMacSavedPortInfo mp(this); SetOrigin(top, left); } else { QMacSavedPortInfo mp(this); SetOrigin(0, 0); } } else if (c == PdcEnd) { if (hd && state != PST_IDLE) { PMSessionEndPage(psession); PMSessionEndDocument(psession); hd = NULL; } state = PST_IDLE; } else { // all other commands... if (state == PST_ABORTED || ((state == PST_ACTIVE || state == PST_ERROR) && PMSessionError(psession) != noErr)) return FALSE; } return TRUE; }
void Prepare(void) { int i; GetLegOrigin(LEGORIGIN); Update(); switch(STATE) { case IDLE: for(i = 0; i < 6; i++) { LEGGOAL[i*3] = LEGORIGIN[i*3]; LEGGOAL[i*3+1] = LEGORIGIN[i*3+1]; LEGGOAL[i*3 + 2] = LEGORIGIN[i*3 + 2] + GOAL_HIGHT; } break; case BALANCE: InitSensor(); for(i = 0; i < 6; i++) { LEGGOAL[i*3] = LEGORIGIN[i*3]; LEGGOAL[i*3+1] = LEGORIGIN[i*3+1]; LEGGOAL[i*3 + 2] = LEGORIGIN[i*3 + 2]; } SetOrigin(NORMAL, POSITION); STABLETIMER = timer_nowtime(); break; default: if(SWING == 0) SetOrigin(NORMAL, POSITION); for(i = 0; i < 6; i++) { LEGFRAME[i] = -1; GetLegGoal(GOALPOS, i, LEGGOAL); GetLegOpposite(GOALPOS, i, STATE,LEGOPPOSITE); if(SWING == 1) { LEGGOAL[i*3 + 2] = LEGGOAL[i*3 + 2] + 10.0; LEGOPPOSITE[i*3 + 2] = LEGOPPOSITE[i*3 + 2] + GOAL_HIGHT; } if(STATE == RCIRCLE || STATE == LCIRCLE) { Transform(ROTATE, GOAL_PITCH, GOAL_ROLL, LEGGOAL+3*i); Transform(-ROTATE, GOAL_PITCH, GOAL_ROLL, LEGOPPOSITE+3*i); } PLAYTIMER[i] = timer_nowtime(); } break; } }
void hhDeathWraithEnergy::Ticker() { float theta; float radius; float z; if (!thePlayer.IsValid()) { return; } float alpha = (MS2SEC(gameLocal.time) - startTime) / duration; if (alpha < 1.0f) { if (thePlayer->DeathWalkStage2()) { SetOrigin( spline.GetValue(alpha) ); } else { radius = startRadius + alpha*(endRadius-startRadius); theta = startTheta + alpha*(endTheta-startTheta); z = startZ + alpha * (endZ - startZ); idVec3 locationRelativeToCenter = CylindricalToCartesian(radius, theta, z); idEntity *destEntity = thePlayer->GetDeathwalkEnergyDestination(); if (destEntity) { centerPosition = destEntity->GetOrigin(); } SetOrigin(centerPosition + locationRelativeToCenter); } } else if (!IsHidden()) { Hide(); StopSound(SND_CHANNEL_BODY); bool energyHealth = spawnArgs.GetBool("healthEnergy"); idEntity *dwProxy = thePlayer->GetDeathwalkEnergyDestination(); if (dwProxy) { // Spawn arrival effect StartSound("snd_arrival", SND_CHANNEL_ANY); dwProxy->SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time) ); dwProxy->SetShaderParm(SHADERPARM_MODE, energyHealth ? 2 : 1 ); } // Notify the player thePlayer->DeathWraithEnergyArived(energyHealth); PostEventMS(&EV_Remove, 5000); } hhPathEmitter::Ticker(); }
void ListControl::EnsureVisible(unsigned i) { assert(i < length); if (origin > i || (origin == i && pixel_pan > 0)) { SetOrigin(i); SetPixelPan(0); } else if (origin + items_visible <= i) { SetOrigin(i - items_visible); if (origin > 0 || i >= items_visible) SetPixelPan(((items_visible + 1) * item_height - GetHeight()) % item_height); } }
vtkSmartPointer<vtkUniformGrid> FlowAnalysis::vtkMakeGrid(){ auto grid=vtkSmartPointer<vtkUniformGrid>::New(); Vector3r cellSize3=Vector3r::Constant(cellSize); // if data are in cells, we need extra items along each axes, and shift the origin by half-cell down if(cellData) { grid->SetDimensions((boxCells+Vector3i::Ones()).eval().data()); Vector3r origin=(box.min()-.5*cellSize3); grid->SetOrigin(origin.data()); } else { grid->SetDimensions(boxCells.data()); grid->SetOrigin(box.min().data()); } grid->SetSpacing(cellSize,cellSize,cellSize); return grid; }
//-------------------------------- // hhProxDoorRotator::ReadFromSnapshot //-------------------------------- void hhProxDoorRotator::ReadFromSnapshot( const idBitMsgDelta &msg ) { // hhProxDoorSection::ReadFromSnapshot(msg); #ifdef _SYNC_PROXDOORS ReadBindFromSnapshot(msg); if (GetPhysics()->IsType(idPhysics_Static::Type)) { idPhysics_Static *phys = static_cast<idPhysics_Static *>(GetPhysics()); staticPState_t *state = phys->GetPState(); state->origin.x = msg.ReadFloat(); state->origin.y = msg.ReadFloat(); state->origin.z = msg.ReadFloat(); state->localOrigin.x = msg.ReadFloat(); state->localOrigin.y = msg.ReadFloat(); state->localOrigin.z = msg.ReadFloat(); idCQuat q; q.x = msg.ReadFloat(); q.y = msg.ReadFloat(); q.z = msg.ReadFloat(); state->localAxis = q.ToMat3(); } #else proxyParent.SetSpawnId(msg.ReadBits(32)); if (proxyParent.IsValid() && proxyParent->IsType(hhProxDoor::Type)) { hhProxDoor *parentPtr = static_cast<hhProxDoor *>(proxyParent.GetEntity()); if (parentPtr->hasNetData) { if (!hasNetData) { idVec3 parentOrigin; idMat3 parentAxis; parentOrigin = proxyParent->GetOrigin();//proxyParent->spawnArgs.GetVector("origin", "0 0 0", parentOrigin); parentAxis = proxyParent->GetAxis();//proxyParent->spawnArgs.GetMatrix("rotation", "1 0 0 0 1 0 0 0 1", parentAxis); SetOrigin(parentOrigin); SetAxis(parentAxis); spawnArgs.SetVector("origin", parentOrigin); spawnArgs.SetMatrix("rotation", parentAxis); hasNetData = true; } } else { hasNetData = false; } } ReadBindFromSnapshot(msg); bindParent.SetSpawnId(msg.ReadBits(32)); #endif //not needed without prediction /* int spawnId = msg.ReadBits(32); if (!spawnId) { bindParent = NULL; } else { bindParent.SetSpawnId(spawnId); } */ }
bool ListControl::OnMouseMove(PixelScalar x, PixelScalar y, unsigned keys) { // If we are currently dragging the ScrollBar slider if (scroll_bar.IsDragging()) { // -> Update ListBox origin if (UsePixelPan()) SetPixelOrigin(scroll_bar.DragMove(length * item_height, GetHeight(), y)); else SetOrigin(scroll_bar.DragMove(length, items_visible, y)); return true; } else if (drag_mode == DragMode::CURSOR) { if (abs(y - drag_y_window) > ((int)item_height / 5)) { drag_mode = DragMode::SCROLL; Invalidate_item(cursor); } else return true; } if (drag_mode == DragMode::SCROLL) { int new_origin = drag_y - y; SetPixelOrigin(new_origin); #ifndef _WIN32_WCE if (UsePixelPan()) kinetic.MouseMove(GetPixelOrigin()); #endif return true; } return PaintWindow::OnMouseMove(x, y, keys); }
void MouseView::_CreateButtonsPicture() { BeginPicture(&fButtonsPicture); SetScale(1.8 * fScaling); SetOrigin(-21 * fScaling, -14 * fScaling); BShape mouseShape; mouseShape.MoveTo(BPoint(48, 12)); // top BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) }; mouseShape.BezierTo(control3); // left BPoint control[3] = { BPoint(12, 16), BPoint(13, 27), BPoint(13, 27) }; mouseShape.BezierTo(control); // bottom BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) }; mouseShape.BezierTo(control4); // right BPoint control2[3] = { BPoint(51, 27), BPoint(50, 14), BPoint(48, 12) }; mouseShape.BezierTo(control2); mouseShape.Close(); SetHighColor(255, 0, 0, 255); FillShape(&mouseShape, B_SOLID_HIGH); EndPicture(); SetScale(1); }
/* ================ sdClientProjectile::Explode ================ */ void sdClientProjectile::Explode( const trace_t *collision, const char *sndExplode ) { const char *fxname; idVec3 normal, endpos; int removeTime; if ( spawnArgs.GetVector( "detonation_axis", "", normal ) ) { SetAxis( normal.ToMat3() ); } else { normal = collision ? collision->c.normal : idVec3( 0, 0, 1 ); } endpos = ( collision ) ? collision->endpos : GetOrigin(); removeTime = PROJECTILE_REMOVE_TIME; // play sound // StopSound( SND_CHANNEL_ANY ); StartSound( sndExplode, SND_CHANNEL_BODY ); StartSound( "snd_explode_med", SND_CHANNEL_BODY2 ); StartSound( "snd_explode_far", SND_CHANNEL_BODY3 ); Hide(); FreeLightDef(); SetOrigin( GetOrigin() + 8.0f * normal ); // change the model fxname = NULL; if ( g_testParticle.GetInteger() == TEST_PARTICLE_IMPACT ) { fxname = g_testParticleName.GetString(); } else { fxname = spawnArgs.GetString( "model_detonate" ); } ClientEntEvent_Remove( removeTime ); }
void Painter::Init () { if (solid == nil) { solid = new Pattern(0xffff); clear = new Pattern(0); lightgray = new Pattern(0x8020); gray = new Pattern(0xa5a5); darkgray = new Pattern(0xfafa); single = new Brush(0xffff, 0); } foreground = nil; background = nil; pattern = nil; br = nil; font = nil; style = 0; matrix = nil; SetColors(black, white); SetPattern(solid); FillBg(true); SetBrush(single); SetFont(stdfont); SetStyle(Plain); SetOrigin(0, 0); MoveTo(0, 0); }
void CModel::Init(CComment* comments) { m_comments = comments; m_next = NULL; m_sequences = NULL; m_curSequence = NULL; m_name = NULL; m_path = NULL; m_psSkelPath = NULL; m_psMakeSkelPath = NULL; m_psRefGLAPath = NULL; SetOrigin(0, 0, 0); SetParms(-1, -1, 0, 1); m_iType = TK_AS_CONVERTMDX_NOASK; m_bSmooth = false; m_bLoseDupVerts = false; m_bMakeSkin = false; m_fScale = 1.0f; m_bIgnoreBaseDeviations = false; m_bSkew90 = false; m_bNoSkew90 = false; m_bKeepMotion = false; m_bPreQuat = false; PCJList_Clear(); }
void csCameraBase::MoveWorld (const csVector3 &v, bool cd) { csVector3 new_position = GetOrigin () + v; if (sector) { csVector3 remember_position = new_position; // Test if the motion crosses a portal iSector *new_sector = sector->FollowSegment ( *this, new_position, mirror, only_portals); if (new_sector != sector) { sector = new_sector; cameranr = cur_cameranr++; FireCameraSectorListeners (sector); } } FireCameraMovedListeners (); SetOrigin (new_position); cameranr = cur_cameranr++; }
bool FabAtHomePrinter::initializePathMode() { SetTangentTolerance(180.0f); //180.0f allows all angles. SetOrigin(0.0f, 0.0f, 0.0f); //Reset position of all motors. for(map<string,Motor,LessThanString>::iterator i = motors.begin(); i != motors.end(); ++i) { i->second.resetPosition(); } return axes["X"].motor->setGroup(X_Y_Z_GROUP_ADDRESS, true) && axes["Y"].motor->setGroup(X_Y_Z_GROUP_ADDRESS, false) && axes["Z"].motor->setGroup(X_Y_Z_GROUP_ADDRESS, false) && SetPathParams2 ( P_30HZ, //path frequency 10, //Max number of points in the path point buffer at one time. Max value is 87. A higher value results in longer downloads to the path point buffer. axes["X"].motor->getAddress(), axes["Y"].motor->getAddress(), axes["Z"].motor->getAddress(), X_Y_Z_GROUP_ADDRESS, axes["X"].motor->getAddress(), //group leader (float)axes["X"].motor->getCountsPerU(), (float)axes["Y"].motor->getCountsPerU(), (float)axes["Z"].motor->getCountsPerU(), (float)PRINT_ACCELERATION ) == 0; }
Npc::Npc(sf::Texture* tex):Image(tex) { locked=true; direction=0; objectIndex=6; index=0; SetOrigin(imageWidth/2,imageHeight-11); SetBBox(-engine->gridSize/2+engine->gridSize/32*4,-engine->gridSize/2+engine->gridSize/32*8, engine->gridSize-engine->gridSize/32*8,engine->gridSize-engine->gridSize/32*15); AddSequence(0,0,0.25); AddSequence(5,5,0.25); AddSequence(10,10,0.25); AddSequence(15,15,0.25); AddSequence(1,4,0.2); AddSequence(6,9,0.2); AddSequence(11,14,0.2); AddSequence(16,19,0.2); SetSequence(0,1); sprShadow.setTexture(*engine->resourcesManager->GetTexture("sprShadow"),true); sprShadow.setOrigin(engine->resourcesManager->GetTexture("sprShadow")->getSize().x/2, engine->resourcesManager->GetTexture("sprShadow")->getSize().y/2-1*2); };
virtual void Draw(BRect updateRect) { BRegion region; region.Include(BRect(20, 20, 40, 40)); region.Include(BRect(30, 30, 80, 80)); ConstrainClippingRegion(®ion); SetHighColor(55, 255, 128, 255); FillRect(BRect(0, 0, 100, 100)); PushState(); SetOrigin(15, 15); ConstrainClippingRegion(®ion); SetHighColor(155, 255, 128, 255); FillRect(BRect(0, 0, 100, 100)); // ConstrainClippingRegion(NULL); SetHighColor(0, 0, 0, 255); StrokeLine(BPoint(2, 2), BPoint(80, 80)); SetHighColor(255, 0, 0, 255); StrokeLine(BPoint(2, 2), BPoint(4, 2)); PopState(); SetHighColor(0, 0, 0, 255); StrokeLine(BPoint(4, 2), BPoint(82, 80)); }
void SObject::SetCourse(SObject *p) { if(!p) { target = NULL; return; } target = GetPosition(p); int tm = 1, offx, offy, sqd; if(target->system != system) { offx = abs(system->GXLoc(cur_game->turn) - target->system->GXLoc(cur_game->turn)); offy = abs(system->GYLoc(cur_game->turn) - target->system->GYLoc(cur_game->turn)); sqd = offx*offx + offy*offy; distance = TimeToGalactic(sqd); return; } if(destination && depart_turn < cur_game->turn) { SetOrigin(); } for(int trip=0; ; ++trip) { offx = abs(target->SXLoc(cur_game->turn + trip) - SXLoc(cur_game->turn)); offy = abs(target->SYLoc(cur_game->turn + trip) - SYLoc(cur_game->turn)); sqd = offx*offx + offy*offy; tm = TimeToLocal(sqd); if(abs(tm) <= trip) { distance = (tm == 0) ? 0 : (tm/abs(tm))*trip; break; } } }
/* ================ rvClientCrawlEffect::Think ================ */ void rvClientCrawlEffect::Think ( void ) { // If there is no crawl entity or no crawl joints then just free ourself if ( !crawlEnt || !crawlJoints.Num() ) { PostEventMS ( &EV_Remove, 0 ); return; } // Move to the next joint if its time if ( gameLocal.time > nextCrawl ) { jointStart = (jointStart + crawlDir + crawlJoints.Num() ) % crawlJoints.Num(); jointEnd = (jointStart + crawlDir + crawlJoints.Num() ) % crawlJoints.Num(); nextCrawl = gameLocal.time + crawlTime; } idVec3 offsetStart; idVec3 offsetEnd; idVec3 dir; idMat3 axis; // Get the start origin crawlEnt->GetJointWorldTransform ( crawlJoints[jointStart], gameLocal.time, offsetStart, axis ); SetOrigin ( offsetStart ); // Get the end origin crawlEnt->GetJointWorldTransform ( crawlJoints[jointEnd], gameLocal.time, offsetEnd, axis ); SetEndOrigin ( offsetEnd ); // Update the axis to point at the bone dir = offsetEnd - offsetStart; dir.Normalize(); SetAxis ( dir.ToMat3( ) ); rvClientEffect::Think ( ); }
void mitk::BaseGeometry::ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) { // If Geometry is switched to ImageGeometry, you have to put an offset to the origin, because // imageGeometries origins are pixel-center-based // ... and remove the offset, if you switch an imageGeometry back to a normal geometry // For more information please see the Geometry documentation page if (m_ImageGeometry == isAnImageGeometry) return; const BoundingBox::BoundsArrayType &boundsarray = this->GetBoundingBox()->GetBounds(); Point3D originIndex; FillVector3D(originIndex, boundsarray[0], boundsarray[2], boundsarray[4]); if (isAnImageGeometry == true) FillVector3D(originIndex, originIndex[0] + 0.5, originIndex[1] + 0.5, originIndex[2] + 0.5); else FillVector3D(originIndex, originIndex[0] - 0.5, originIndex[1] - 0.5, originIndex[2] - 0.5); Point3D originWorld; originWorld = GetIndexToWorldTransform()->TransformPoint(originIndex); // instead could as well call IndexToWorld(originIndex,originWorld); SetOrigin(originWorld); this->SetImageGeometry(isAnImageGeometry); }
void Printer_nextPage (void) { #if defined (macintosh) if (thePrinter. postScript) closePostScript (); PMSessionEndPage (theMacPrintSession); PMSessionBeginPage (theMacPrintSession, theMacPageFormat, NULL); PMSessionGetGraphicsContext (theMacPrintSession, kPMGraphicsContextQuickdraw, (void **) & theMacPort); SetPort (theMacPort); if (! thePrinter. postScript) SetOrigin (- paperSize. left, - paperSize. top); if (thePrinter. postScript) openPostScript (); #elif defined (_WIN32) if (thePrinter. postScript) { exitPostScriptPage (); EndPage (theWinDC); StartPage (theWinDC); initPostScriptPage (); } else { if (EndPage (theWinDC) < 0) ; /* BUG: should give the opportunity of cancellation. */ StartPage (theWinDC); /* * Since StartPage has reset the DC, restore some of our non-default settings. */ SetBkMode (theWinDC, TRANSPARENT); SetTextAlign (theWinDC, TA_LEFT | TA_BASELINE | TA_NOUPDATECP); } #endif }
bool nuiRange::FromString(const nglString& Value) { double value=0,min=0,max=0,increment=0,pageincrement=0,pagesize=0,origin=0; long res; nglString str=Value; if (!str.GetLength() || str[0]!='[' || str[str.GetLength()-1]!=']') return false; str.DeleteLeft(1); str.DeleteRight(1); std::vector<nglString> vec; res = str.Tokenize(vec); if (vec.size() == 7) { value = vec[0].GetCDouble(); min = vec[1].GetCDouble(); max = vec[2].GetCDouble(); increment = vec[3].GetCDouble(); pageincrement = vec[4].GetCDouble(); pagesize = vec[5].GetCDouble(); origin = vec[6].GetCDouble(); SetValue(value); SetRange(min,max); SetIncrement(increment); SetPageIncrement(pageincrement); SetPageSize(pagesize); SetOrigin(origin); return true; } return false; }
void timerCallback() { // Wait for the moment when PT deigns to allow our view to // take up its actual location (see rant above) HIViewRef content = 0; HIViewFindByID (HIViewGetRoot ((WindowRef) hostWindow), kHIViewWindowContentID, &content); HIPoint p = { 0.0f, 0.0f }; HIViewRef v = HIViewGetFirstSubview (parentView); HIViewConvertPoint (&p, v, content); if (p.y > 12) { if (p.x != titleW || p.y != titleH) { GrafPtr oldport; GetPort (&oldport); SetPort (owner->GetViewPort()); SetOrigin (-titleW, -titleH); SetPort (oldport); } HIViewRef v = HIViewGetFirstSubview (parentView); SetControlSupervisor (v, 0); stopTimer(); forcedRepaintTimer = new RepaintCheckTimer (*this); } }
/* ================ sdClientScriptEntity::Event_SetOrigin ================ */ void sdClientScriptEntity::Event_SetOrigin( const idVec3& org ) { SetOrigin( org ); if ( GetPhysics() != NULL ) { GetPhysics()->SetOrigin( org ); } }
void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos ) { m_state = STATE_BLOCK_INIT; SetOrigin( startpos ); SetSize( wxSize( 0, 0 ) ); m_items.ClearItemsList(); aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); }
//-------------------------------- // hhProxDoorRotMaster::ReadFromSnapshot //-------------------------------- void hhProxDoorRotMaster::ReadFromSnapshot( const idBitMsgDelta &msg ) { //hhProxDoorSection::ReadFromSnapshot(msg); #ifdef _SYNC_PROXDOORS rotVector.x = msg.ReadFloat(); rotVector.y = msg.ReadFloat(); rotVector.z = msg.ReadFloat(); rotAngle = msg.ReadFloat(); idCQuat q; q.x = msg.ReadFloat(); q.y = msg.ReadFloat(); q.z = msg.ReadFloat(); baseAxis = q.ToMat3(); if (GetPhysics()->IsType(idPhysics_Static::Type)) { idPhysics_Static *phys = static_cast<idPhysics_Static *>(GetPhysics()); staticPState_t *state = phys->GetPState(); state->origin.x = msg.ReadFloat(); state->origin.y = msg.ReadFloat(); state->origin.z = msg.ReadFloat(); } float prox = msg.ReadFloat(); SetProximity(prox); #else ReadBindFromSnapshot(msg); proxyParent.SetSpawnId(msg.ReadBits(32)); if (proxyParent.IsValid() && proxyParent->IsType(hhProxDoorRotator::Type)) { hhProxDoorRotator *parentPtr = static_cast<hhProxDoorRotator *>(proxyParent.GetEntity()); if (parentPtr->hasNetData) { if (!hasNetData) { idVec3 sectionOffset, rot_vector; idVec3 parentOrigin; idMat3 parentAxis; proxyParent->spawnArgs.GetVector("origin", "0 0 0", parentOrigin); proxyParent->spawnArgs.GetMatrix("rotation", "1 0 0 0 1 0 0 0 1", parentAxis); proxyParent->spawnArgs.GetVector("section_offset", "0 0 0", sectionOffset); proxyParent->spawnArgs.GetVector("rot_vector", "0 0 0", rot_vector); proxyParent->spawnArgs.GetFloat("rot_angle", "0.0", rotAngle); SetOrigin(parentOrigin+(sectionOffset*parentAxis)); SetAxis(parentAxis); baseAxis = GetAxis(); rotVector = GetAxis() * rot_vector; hasNetData = true; } } else { parentPtr->hasNetData = false; } } #endif }
/* ================ idItem::Event_Respawn ================ */ void idItem::Event_Respawn( void ) { BecomeActive( TH_THINK ); Show(); inViewTime = -1000; lastCycle = -1; GetPhysics()->SetContents( CONTENTS_TRIGGER ); SetOrigin( orgOrigin ); StartSound( "snd_respawn", SND_CHANNEL_ITEM, 0, false, NULL ); CancelEvents( &EV_RespawnItem ); // don't double respawn }
void ListControl::MoveOrigin(int delta) { if (UsePixelPan()) { int pixel_origin = (int)GetPixelOrigin(); SetPixelOrigin(pixel_origin + delta * (int)item_height); } else { SetOrigin(origin + delta); } }
void PlaneGeometry::InitializeStandardPlane( const BaseGeometry *geometry3D, PlaneOrientation planeorientation, ScalarType zPosition, bool frontside, bool rotated ) { this->SetReferenceGeometry( const_cast< BaseGeometry * >( geometry3D ) ); ScalarType width, height; const BoundingBox::BoundsArrayType& boundsarray = geometry3D->GetBoundingBox()->GetBounds(); Vector3D originVector; FillVector3D(originVector, boundsarray[0], boundsarray[2], boundsarray[4]); if(geometry3D->GetImageGeometry()) { FillVector3D( originVector, originVector[0] - 0.5, originVector[1] - 0.5, originVector[2] - 0.5 ); } switch(planeorientation) { case None: case Axial: width = geometry3D->GetExtent(0); height = geometry3D->GetExtent(1); break; case Frontal: width = geometry3D->GetExtent(0); height = geometry3D->GetExtent(2); break; case Sagittal: width = geometry3D->GetExtent(1); height = geometry3D->GetExtent(2); break; default: itkExceptionMacro("unknown PlaneOrientation"); } InitializeStandardPlane( width, height, geometry3D->GetIndexToWorldTransform(), planeorientation, zPosition, frontside, rotated ); ScalarType bounds[6]= { 0, width, 0, height, 0, 1 }; this->SetBounds( bounds ); Point3D origin; originVector = geometry3D->GetIndexToWorldTransform() ->TransformVector( originVector ); origin = GetOrigin() + originVector; SetOrigin(origin); }
void Enemy::RespawnEnemy() { SetOrigin(starting_pos); respawn_timer = 0.0f; hp = hp_max; players_threat[0] = 0; players_threat[1] = 0; players_threat[2] = 0; players_threat[3] = 0; attackMode = false; }