//-------------------------------- // hhProxDoor::Event_Touch //-------------------------------- void hhProxDoor::Event_Touch( idEntity *other, trace_t *trace ) { if ( sndTrigger && trace->c.id == sndTrigger->GetId() ) { if (other && other->IsType(hhPlayer::Type) && IsLocked() && gameLocal.time > nextSndTriggerTime) { StartSound("snd_locked", SND_CHANNEL_ANY, 0, false, NULL ); nextSndTriggerTime = gameLocal.time + 10000; } return; } if( proxState == PROXSTATE_Active ) { return; } if ( !other ) { gameLocal.Warning("hhProxDoor: Event_Touch given NULL for other\n"); return; } float dist = ( other->GetOrigin() - GetOrigin() ).Length(); if (dist > movementDistance) { return; } if( !IsLocked() ) { SetDoorState( PROXSTATE_Active ); } }
/* Calculate the bounding box of this, when rotated */ const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle ) { wxPoint corners[4]; // Build the corners list corners[0] = GetOrigin(); corners[2] = GetEnd(); corners[1].x = corners[0].x; corners[1].y = corners[2].y; corners[3].x = corners[2].x; corners[3].y = corners[0].y; // Rotate all corners, to find the bounding box for( int ii = 0; ii < 4; ii ++ ) RotatePoint( &corners[ii], aRotCenter, aAngle ); // Find the corners bounding box wxPoint start = corners[0]; wxPoint end = corners[0]; for( int ii = 1; ii < 4; ii ++ ) { start.x = std::min( start.x, corners[ii].x); start.y = std::min( start.y, corners[ii].y); end.x = std::max( end.x, corners[ii].x); end.y = std::max( end.y, corners[ii].y); } EDA_RECT bbox; bbox.SetOrigin( start ); bbox.SetEnd( end ); return bbox; }
/* ================= hhProjectileCrawlerGrenade::Event_ApplyExpandWound ================= */ void hhProjectileCrawlerGrenade::Event_ApplyExpandWound() { trace_t trace; if( !modelProxy.IsValid() || !modelProxy->GetCombatModel() ) { return; } idBounds clipBounds( modelProxy->GetRenderEntity()->bounds ); idVec3 traceEnd = GetOrigin(); idVec3 traceStart = traceEnd + hhUtils::RandomPointInShell( clipBounds.Expand(1.0f).GetRadius(), clipBounds.Expand(2.0f).GetRadius() ); idVec3 jointOrigin, localOrigin, localNormal; idMat3 jointAxis, axisTranspose; jointHandle_t jointHandle = INVALID_JOINT; CancelEvents( &EV_ApplyExpandWound ); PostEventSec( &EV_ApplyExpandWound, spawnArgs.GetFloat("expandWoundDelay") ); if( !gameLocal.clip.TracePoint(trace, traceStart, traceEnd, modelProxy->GetCombatModel()->GetContents(), NULL) ) { return; } if( trace.c.entityNum != entityNumber ) {//Make sure we hit ourselves return; } modelProxy->AddDamageEffect( trace, vec3_zero, spawnArgs.GetString("def_expandDamage"), (!fl.networkSync || netSyncPhysics) ); }
/* ================= hhProjectileCrawlerGrenade::Event_Collision_Bounce ================= */ void hhProjectileCrawlerGrenade::Event_Collision_Bounce( const trace_t* collision, const idVec3 &velocity ) { static const float minCollisionVelocity = 20.0f; static const float maxCollisionVelocity = 90.0f; StopSound( SND_CHANNEL_BODY, true ); // Velocity in normal direction float len = velocity * -collision->c.normal; if( collision->fraction < VECTOR_EPSILON || len < minCollisionVelocity ) { idThread::ReturnInt( 0 ); return; } StartSound( "snd_bounce", SND_CHANNEL_BODY, 0, true, NULL ); float volume = hhUtils::CalculateSoundVolume( len, minCollisionVelocity, maxCollisionVelocity ); HH_SetSoundVolume( volume, SND_CHANNEL_BODY ); BounceSplat( GetOrigin(), -collision->c.normal ); SIMDProcessor->Memcpy( &collisionInfo, collision, sizeof(trace_t) ); collisionInfo.fraction = 0.0f;//Sometimes fraction == 1.0f physicsObj.SetAngularVelocity( 0.5f*physicsObj.GetAngularVelocity() ); idThread::ReturnInt( 0 ); }
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++; }
void hhProxDoorRotator::Event_PostSpawn( void ) { idVec3 sectionOffset; idVec3 rotVector; float rotAngle; if( !spawnArgs.GetVector("section_offset", "0 0 0", sectionOffset) ) { common->Warning( "No section offset found for '%s'", this->GetEntityDefName() ); } if( !spawnArgs.GetVector("rot_vector", "0 0 0", rotVector) ) { common->Warning( "No rotation vector found for '%s'", this->GetEntityDefName() ); } if( !spawnArgs.GetFloat("rot_angle", "0 0 0", rotAngle) ) { common->Warning( "No rotation angle found for '%s'", this->GetEntityDefName() ); } idDict args; args.SetVector( "origin", GetOrigin() + (sectionOffset * GetAxis()) ); args.SetMatrix( "rotation", GetAxis() ); args.SetVector( "rot_vector", rotVector ); args.SetFloat( "rot_angle", rotAngle ); bindParent = static_cast<hhProxDoorSection*>( gameLocal.SpawnEntityType(hhProxDoorRotMaster::Type, &args) ); if( !bindParent.IsValid() ) { common->Warning( "Failed to spawn bindParent for '%s'", GetEntityDefName() ); } else { bindParent->proxyParent = this; } Bind( bindParent.GetEntity(), true ); }
void CCeilingTurret::Spawn() { Precache( ); SetModel( "models/combine_turrets/ceiling_turret.mdl" ); BaseClass::Spawn( ); m_iHealth = sk_turret_health.GetFloat(); m_HackedGunPos = Vector( 0, 0, 12.75 ); AngleVectors( GetAngles(), NULL, NULL, &m_vecViewOffset ); m_vecViewOffset = m_vecViewOffset * Vector( 0, 0, -64 ); m_flFieldOfView = VIEW_FIELD_FULL; m_iRetractHeight = 16; m_iDeployHeight = 32; m_iMinPitch = -45; UTIL_SetSize(this, Vector(-32, -32, -m_iRetractHeight), Vector(32, 32, m_iRetractHeight)); SetThink(Initialize); m_pEyeGlow = CSprite::SpriteCreate( TURRET_GLOW_SPRITE, GetOrigin(), FALSE ); m_pEyeGlow->SetTransparency( kRenderGlow, 255, 0, 0, 0, kRenderFxNoDissipation ); m_pEyeGlow->SetAttachment( this, 2 ); m_eyeBrightness = 0; SetNextThink( gpGlobals->curtime + 0.3 ); }
void LaserBeam::OnCollision(ICollidable *other) { Entity *entity = (Entity*)other; Damage_t damage; damage.damage = entity->GetHealth(); if (entity->IsPlayer()) { damage.damage = 1; } damage.direction = Vector2D(-1, 0); damage.inflictor = GetOwner(); if (GetOwner() != nullptr) { damage.statsInflictorName = GetOwner()->GetEntityClassName(); damage.statsInflictorClass = GetOwner()->GetEntityResourceClass(); } damage.statsWeaponName = GetEntityClassName(); damage.statsWeaponClass = GetEntityResourceClass(); entity->TakeDamage(damage); Vector2D laserCenter = GetOrigin(); laserCenter.x = entity->GetOrigin().x; GetGameContext()->GetParticleRoot()->CreateParticles("laser_cannon_hit", laserCenter, Vector2D(-1, 0)); }
void CDMProxy::Init(PromiseId aPromiseId) { MOZ_ASSERT(NS_IsMainThread()); nsresult rv = mKeys->GetOrigin(mOrigin); if (NS_FAILED(rv)) { RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR); return; } EME_LOG("Creating CDMProxy for origin='%s'", NS_ConvertUTF16toUTF8(GetOrigin()).get()); if (!mGMPThread) { nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); if (!mps) { RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR); return; } mps->GetThread(getter_AddRefs(mGMPThread)); if (!mGMPThread) { RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR); return; } } nsRefPtr<nsIRunnable> task(NS_NewRunnableMethodWithArg<uint32_t>(this, &CDMProxy::gmp_Init, aPromiseId)); mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL); }
END_CLASS void hhShuttleTransport::Spawn() { dockingBeam = NULL; dockedShuttle = NULL; shuttleCount = 0; bLocked = false; amountHealth = spawnArgs.GetInt("amounthealth"); amountPower = spawnArgs.GetInt("amountpower"); bCanExitLocked = spawnArgs.GetBool("canExitLocked"); bLockOnEntry = spawnArgs.GetBool("lockOnEntry"); bAllowFiring = spawnArgs.GetBool("allowFiring"); offsetNozzle = spawnArgs.GetVector("offset_nozzle1"); // offsetNozzle2 = spawnArgs.GetVector("offset_nozzle2"); offsetShuttlePoint = spawnArgs.GetVector("offset_shuttlepoint"); // dockingBeam = SpawnDockingBeam(offsetNozzle); dockingForce.SetRestoreFactor(spawnArgs.GetFloat("dockingforce")); dockingForce.SetTarget(GetOrigin() + offsetShuttlePoint * GetAxis()); // Fade in SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time)); // Growth start time SetShaderParm(5, 1.0f); // Growth direction (in) SetShaderParm(6, 1.0f); // Make Beam opaque StartSound("snd_fadein", SND_CHANNEL_ANY); }
Matrix4 Matrix4::InversedFast() const { Matrix4 out = Matrix4::Identity(); Vector3 axis1 = GetAxis(0); Vector3 axis2 = GetAxis(1); Vector3 axis3 = GetAxis(2); Vector3 norm1 = axis1 / axis1.GetPoweredLength(); Vector3 norm2 = axis2 / axis2.GetPoweredLength(); Vector3 norm3 = axis3 / axis3.GetPoweredLength(); out.m[0] = norm1.x; out.m[1] = norm2.x; out.m[2] = norm3.x; out.m[4] = norm1.y; out.m[5] = norm2.y; out.m[6] = norm3.y; out.m[8] = norm1.z; out.m[9] = norm2.z; out.m[10] = norm3.z; Vector3 s = (out * GetOrigin()).GetXYZ(); out.m[12] = -s.x; out.m[13] = -s.y; out.m[14] = -s.z; return out; }
///////////////////////////////////////////////////////////////////////////// // CMyListCtrl message handlers void CMyListCtrl::OnBeginDrag(LPNMHDR pnmhdr, LRESULT *pResult) { CPoint ptItem, ptAction, ptImage; NM_LISTVIEW *pnmListView = (NM_LISTVIEW *)pnmhdr; ((CListCtrlPage *)GetParent())->ShowNotification(pnmhdr, pResult); ASSERT(!m_bDragging); m_bDragging = TRUE; m_iItemDrag = pnmListView->iItem; ptAction = pnmListView->ptAction; GetItemPosition(m_iItemDrag, &ptItem); // ptItem is relative to (0,0) and not the view origin GetOrigin(&m_ptOrigin); ASSERT(m_pimageListDrag == NULL); m_pimageListDrag = CreateDragImage(m_iItemDrag, &ptImage); m_sizeDelta = ptAction - ptImage; // difference between cursor pos and image pos m_ptHotSpot = ptAction - ptItem + m_ptOrigin; // calculate hotspot for the cursor m_pimageListDrag->DragShowNolock(TRUE); // lock updates and show drag image m_pimageListDrag->SetDragCursorImage(0, m_ptHotSpot); // define the hot spot for the new cursor image m_pimageListDrag->BeginDrag(0, CPoint(0, 0)); ptAction -= m_sizeDelta; m_pimageListDrag->DragEnter(this, ptAction); m_pimageListDrag->DragMove(ptAction); // move image to overlap original icon SetCapture(); }
void CMyListCtrl::OnBeginDrag(LPNMHDR pnmhdr,LRESULT*) { CPoint ptItem,ptAction,ptImage; NM_LISTVIEW *pnmListView = (NM_LISTVIEW *)pnmhdr; m_oldDNDStyle = GetExtendedStyle(); if(m_oldDNDStyle != 0)SetExtendedStyle(0); ASSERT(!m_bDragging); m_bDragging = TRUE; m_iItemDrag = pnmListView->iItem; ptAction = pnmListView->ptAction; GetItemPosition(m_iItemDrag,&ptItem); GetOrigin(&m_ptOrigin); ASSERT(m_pImageListDrag == NULL); m_pImageListDrag = CreateDragImage(m_iItemDrag,&ptImage); m_sizeDelta = ptAction - ptImage; m_ptHotSpot = ptAction - ptItem + m_ptOrigin; m_pImageListDrag->DragShowNolock(TRUE); m_pImageListDrag->SetDragCursorImage(0,CPoint(0,0)); m_pImageListDrag->BeginDrag(0,CPoint(0,0)); ptAction -=m_sizeDelta; m_pImageListDrag->DragEnter(this,ptAction); m_pImageListDrag->DragMove(ptAction); m_iItemDrop = -1; SetCapture(); }
void hhCenturion::AimedAttackMissile( const char *jointname, const idDict *projDef) { idProjectile *proj; idVec3 target, origin = GetOrigin(); bool inShuttle = false; if ( shootTarget.IsValid() ) { target = shootTarget->GetOrigin(); } else if ( enemy.IsValid() ) { target = enemy->GetOrigin(); if ( enemy->IsType( idActor::Type ) ) { target.z += enemy->EyeHeight() / 4.0f; } } else { // No target? Do the default attack Event_AttackMissile( jointname, projDef, 1 ); return; } // If target is too close do a non-aimed attack if ( fabsf( origin.x - target.x ) < 256 && fabsf( origin.y - target.y ) < 256 ) { Event_AttackMissile( jointname, projDef, 1 ); return; } idVec3 dist = origin - target; if ( shootTarget.IsValid() ) { proj = LaunchProjectile( jointname, shootTarget.GetEntity(), true, projDef ); } else { proj = LaunchProjectile( jointname, enemy.GetEntity(), true, projDef ); } }
void TextShape::BoundingBox(Point& bottemLeft, Point& topRight) const { Coord bottem , left , width , height; GetOrigin(bottem, left); GetExtent(width, height); bottemLeft = Point(bottem , left); topRight = Point(bottem+height, left+width); }
void hhCenturion::Event_EnemyCloseToObstruction(void) { bool close = false; if ( pillarEntity.IsValid() && enemy.IsValid() ) { float obs_dist = ( pillarEntity->GetOrigin() - GetOrigin() ).Length(); float dist = ( enemy->GetOrigin() - GetOrigin() ).Length(); // If the enemy is further from me than the pillar... if ( dist > obs_dist) { dist = ( pillarEntity->GetOrigin() - enemy->GetOrigin() ).Length(); // If the enemy is less than 400 units from the pillar, then he's 'close' if ( dist < 400.0f ) { close = true; } } } idThread::ReturnInt( (int) close ); }
float Axis::DisplacementWillOverscrollAmount(int32_t aDisplacement) { switch (DisplacementWillOverscroll(aDisplacement)) { case OVERSCROLL_MINUS: return (GetOrigin() + aDisplacement) - GetPageStart(); case OVERSCROLL_PLUS: return (GetCompositionEnd() + aDisplacement) - GetPageEnd(); // Don't handle overscrolled in both directions; a displacement can't cause // this, it must have already been zoomed out too far. default: return 0; } }
void hhShuttleTransport::Think() { hhDock::Think(); if (thinkFlags & TH_THINK) { // Apply docking force to shuttle if docked, even if not in zone assert(dockingForce.GetEntity() == dockedShuttle); dockingForce.SetTarget(GetOrigin() + offsetShuttlePoint * GetAxis()); dockingForce.Evaluate(gameLocal.time); } }
void CWall::SetVisual() { m_visual.SetWidth(m_width); m_visual.SetHeight(m_height); m_visual.SetRotation(GetRotation()); m_visual.SetOrigin(GetOrigin()); m_visual.SetReferenceSystemOrigin(GetReferenceSystemOrigin()); m_visual.SetPosition(GetPosition()); }
void C2DRectangleCollision::AddToWorld(b2World * world) { CheckParametres(); CStatic2DShape::AddToWorld(world); AddRectangleToBody(m_body , SSize(m_width, m_height) , GetOrigin()); }
/* ================= hhProjectileCrawlerGrenade::CopyToModelProxy ================= */ void hhProjectileCrawlerGrenade::CopyToModelProxy() { //rww - do this the right way with an inheriting entityDef //idDict args = spawnArgs; //args.Delete( "spawnclass" ); //args.Delete( "name" ); idDict args; idDict *setArgs; idStr str; if (gameLocal.isClient) { setArgs = &modelProxy->spawnArgs; } else { args.Clear(); setArgs = &args; } setArgs->Set( "owner", GetName() ); setArgs->SetVector( "origin", GetOrigin() ); setArgs->SetMatrix( "rotation", GetAxis() ); //copy the model over if (spawnArgs.GetString("model", "", str)) { setArgs->Set("model", str.c_str()); if (gameLocal.isClient && modelProxy.IsValid()) { modelProxy->SetModel(str.c_str()); } } //these are now taken care of in the ent def. /* setArgs->SetBool( "useCombatModel", true ); setArgs->SetBool( "transferDamage", false ); setArgs->SetBool( "solid", false ); */ if (!gameLocal.isClient) { modelProxy = gameLocal.SpawnObject("projectile_crawler_proxy", &args); } if( modelProxy.IsValid() ) { modelProxy->Bind( this, true ); modelProxy->CycleAnim( "idle", ANIMCHANNEL_ALL ); } //for debugging //spawnArgs.CompareArgs(modelProxy->spawnArgs); modelProxyCopyDone = true; }
// // Event_AntiProjectileAttack() // void hhHarvesterSimple::Event_AntiProjectileAttack(hhProjectile *proj) { if(!spawnArgs.GetBool("block_projectiles", "1")) { return; } const idDict *projectileDef = gameLocal.FindEntityDefDict( spawnArgs.GetString("def_chaff") ); if ( !projectileDef ) { gameLocal.Error( "Unknown def_chaff: %s\n", spawnArgs.GetString("def_chaff") ); } hhProjectile* projectile = NULL; //bjk: new parms int numProj = spawnArgs.GetInt("shieldNumProj", "10"); float spread = DEG2RAD( spawnArgs.GetFloat("shieldSpread", "10") ); float yaw = DEG2RAD( spawnArgs.GetFloat("shieldYawSpread", "10") ); //StartSound("snd_fire_chaff", SND_CHANNEL_ANY, 0, true, NULL); torsoAnim.PlayAnim( GetAnimator()->GetAnim( "antiprojectile_attack" ) ); idVec3 dir = proj->GetOrigin() - GetOrigin(); dir.Normalize(); dir = dir+idVec3(0.f, 0.f, -.3f); // bjk: bias towards ground dir.Normalize(); idMat3 muzzleAxis = dir.ToMat3(); // todo: read this in from a bone idVec3 launchPos = GetOrigin() + idVec3(0.0f, 0.0f, 64.0f); for(int i=0; i<numProj; i++) { projectile = hhProjectile::SpawnProjectile( projectileDef ); HH_ASSERT( projectile ); //bjk: uses random now float ang = spread * hhMath::Sqrt( gameLocal.random.RandomFloat() ); float spin = hhMath::TWO_PI * gameLocal.random.RandomFloat(); dir = muzzleAxis[ 0 ] + muzzleAxis[ 2 ] * ( hhMath::Sin(ang) * hhMath::Sin(spin) ) - muzzleAxis[ 1 ] * ( hhMath::Sin(ang+yaw) * hhMath::Cos(spin) ); dir.Normalize(); projectile->Create(this, launchPos, dir); projectile->Launch(launchPos, dir, idVec3(0.0f, 0.0f, 0.0f)); } lastAntiProjectileAttack = gameLocal.GetTime(); }
void mitk::BaseGeometry::SetOrigin(const Point3D &origin) { mitk::ModifiedLock lock(this); if (origin != GetOrigin()) { m_GeometryTransform->SetOrigin(origin); Modified(); } }
float Axis::ScaleWillOverscrollAmount(float aScale, int32_t aFocus) { float originAfterScale = (GetOrigin() + aFocus) * aScale - aFocus; switch (ScaleWillOverscroll(aScale, aFocus)) { case OVERSCROLL_MINUS: return originAfterScale - GetPageStart() * aScale; case OVERSCROLL_PLUS: return (originAfterScale + GetCompositionLength()) - NS_lround(GetPageEnd() * aScale); // Don't handle OVERSCROLL_BOTH. Client code is expected to deal with it. default: return 0; } }
void CWall::AddToWorld(b2World * world) { CheckParametres(); CStaticShape::AddToWorld(world); SetVisual(); AddRectangleToBody(m_body , SSize(m_width, m_height) , GetOrigin()); }
//----------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------- float CPlayerCar::GetAmountUnderWater(void) { if( !g_bWaterEnabled ) return 0.0f; float distUnderWater = g_fWaterHeight - GetOrigin().y; float carHeight = 15.0f; float amountUnderWater = clamp(distUnderWater/carHeight, 0.0f, 1.0f); return amountUnderWater; }
void hhProjectileSoulCannon::Event_FindEnemy( void ) { int i; idEntity *ent; idActor *actor; trace_t tr; PostEventSec( &EV_FindSoulEnemy, 1.0f ); for ( i = 0; i < gameLocal.num_entities; i++ ) { ent = gameLocal.entities[ i ]; if ( !ent || !ent->IsType( idActor::Type ) ) { continue; } if ( ent == this || ent == this->GetOwner() ) { continue; } // Ignore dormant entities! if( ent->IsHidden() || ent->fl.isDormant ) { // HUMANHEAD JRM - changed to fl.isDormant continue; } actor = static_cast<idActor *>( ent ); if ( ( actor->health <= 0 ) ) { continue; } idVec3 center = actor->GetPhysics()->GetAbsBounds().GetCenter(); // Cannot see this enemy because he is too far away if ( maxEnemyDist > 0.0f && ( center - GetOrigin() ).LengthSqr() > maxEnemyDist * maxEnemyDist ) continue; // Quick trace to the center of the potential enemy if ( !gameLocal.clip.TracePoint( tr, GetOrigin(), center, 1.0f, this ) ) { thrustDir = center - GetOrigin(); thrustDir.Normalize(); break; } } }
virtual void BoundingBox( Point& bottomLeft, Point& topRight) const override { Coord bottom, left, width, height; GetOrigin(bottom, left); GetExtent(width, height); bottomLeft = Point(bottom, left); }
inline fixed TaskLeg::GetScoredDistance(const GeoPoint &ref) const { if (!GetOrigin()) return fixed(0); switch (destination.GetActiveState()) { case OrderedTaskPoint::BEFORE_ACTIVE: // this leg totally included return std::max(fixed(0), GetOrigin()->GetLocationScored().Distance(destination.GetLocationScored()) - GetOrigin()->ScoreAdjustment()-destination.ScoreAdjustment()); case OrderedTaskPoint::CURRENT_ACTIVE: // this leg partially included if (destination.HasEntered()) { return std::max(fixed(0), GetOrigin()->GetLocationScored().Distance(destination.GetLocationScored()) - GetOrigin()->ScoreAdjustment()-destination.ScoreAdjustment()); } else if (ref.IsValid()) return std::max(fixed(0), ref.ProjectedDistance(GetOrigin()->GetLocationScored(), destination.GetLocationScored()) -GetOrigin()->ScoreAdjustment()); else return fixed(0); case OrderedTaskPoint::AFTER_ACTIVE: // this leg may be partially included if (GetOrigin()->HasEntered() && ref.IsValid()) { return std::max(fixed(0), memo_travelled.calc(GetOrigin()->GetLocationScored(), ref).distance -GetOrigin()->ScoreAdjustment()); } return fixed(0); } gcc_unreachable(); assert(false); return fixed(0); }
void hhProjectileStickyCrawlerGrenade::Event_Collision_Stick( const trace_t* collision, const idVec3 &velocity ) { if (proximityDetonateTrigger.GetEntity()) { //rww - don't allow this to be called more than once in a crawler grenade's lifetime return; } ProcessCollision( collision, velocity ); BindToCollisionObject( collision ); fl.ignoreGravityZones = true; SetGravity( idVec3(0.f, 0.f, 0.f) ); spawnArgs.SetVector("gravity", idVec3(0.f, 0.f, 0.f) ); BounceSplat( GetOrigin(), -collision->c.normal ); idDict dict; dict.SetVector( "origin", GetOrigin() ); //dict.SetMatrix( "rotation", GetAxis() ); dict.Set( "target", name.c_str() ); dict.SetVector( "mins", spawnArgs.GetVector("detonationMins", "-10 -10 -10") ); dict.SetVector( "maxs", spawnArgs.GetVector("detonationMaxs", "10 10 10") ); if (!gameLocal.isClient) { proximityDetonateTrigger = gameLocal.SpawnObject( spawnArgs.GetString("def_trigger"), &dict ); proximityDetonateTrigger->Bind( this, true ); if ( proximityDetonateTrigger->IsType( hhTrigger::Type ) ) { hhTrigger *trigger = static_cast<hhTrigger*>(proximityDetonateTrigger.GetEntity()); if ( trigger && trigger->IsEncroached() ) { proximityDetonateTrigger->PostEventMS( &EV_Activate, 0, this ); } } } if( modelProxy.IsValid() ) { modelProxy->CycleAnim( "idle", ANIMCHANNEL_ALL ); } // CJR: Added this from the normal crawler collision bounce code SIMDProcessor->Memcpy( &collisionInfo, collision, sizeof(trace_t) ); collisionInfo.fraction = 0.0f;//Sometimes fraction == 1.0f idThread::ReturnInt( 1 ); }