Esempio n. 1
0
void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit *passenger = GetPassenger(accessory->uiSeat))
    {
        // already installed
        if (passenger->GetEntry() == accessory->uiAccessory)
            return;

        passenger->ExitVehicle();
    }

    if (Creature* summoned = m_pBase->SummonCreature(accessory->uiAccessory,
        m_pBase->GetPositionX() + accessory->m_offsetX, m_pBase->GetPositionY() + accessory->m_offsetY, m_pBase->GetPositionZ() + accessory->m_offsetZ, m_pBase->GetOrientation() + accessory->m_offsetX,
        TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f);
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
        summoned->EnterVehicle(m_pBase, accessory->uiSeat);
        SetDestination();
        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->uiAccessory, accessory->uiSeat,m_pBase->GetObjectGuid().GetString().c_str());
}
Esempio n. 2
0
void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit* passenger = GetPassenger(accessory->seatId))
    {
        // already installed
        if (passenger->GetEntry() == accessory->passengerEntry)
            return;
        GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid());
    }

    if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry,
        GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetX,
        TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
        int32 seatId = accessory->seatId + 1;
        SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f);
        summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true);

        SetDestination();
        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetObjectGuid().GetString().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetBase()->GetObjectGuid().GetString().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->passengerEntry, accessory->seatId,GetBase()->GetObjectGuid().GetString().c_str());
}
Esempio n. 3
0
void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit* passenger = GetPassenger(accessory->seatId))
    {
        // already installed
        if (passenger->GetEntry() == accessory->passengerEntry)
            return;

        GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid());
    }

    if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry,
        GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetO,
        TEMPSUMMON_DEAD_DESPAWN, 0))
    {
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);

        bool hideAccessory = false;

        SeatMap::const_iterator seat = m_Seats.find(accessory->seatId);
        if (seat != m_Seats.end())
        {
            if (seat->second.seatInfo->m_flags & SEAT_FLAG_HIDE_PASSENGER)  // coommon case
                hideAccessory = true;
        }

        if (!hideAccessory && (accessory->m_flags & ACCESSORY_FLAG_HIDE))
            hideAccessory = true;

        if (hideAccessory)
            summoned->SetDisplayId(DEFAULT_HIDDEN_MODEL_ID); // set to empty model

        SetDestination(accessory->m_offsetX, accessory->m_offsetY, accessory->m_offsetZ, accessory->m_offsetO, 0.0f, 0.0f);
        int32 seatId = accessory->seatId + 1;
        summoned->SetPhaseMask(GetBase()->GetPhaseMask(), true);
        summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true);

        SetDestination();

        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetGuidStr().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetBase()->GetGuidStr().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)", accessory->passengerEntry, accessory->seatId, GetBase()->GetGuidStr().c_str());
}
Esempio n. 4
0
bool Pacman::TryToMove(D3DXVECTOR3 direction, vector<D3DXVECTOR3> availableMoves)
{
	float EPSILON = 0.05f;
	for (int i = 0; i < availableMoves.size(); i++)
	{
		D3DXVECTOR3 playerPos	= GetPosition();

		D3DXVECTOR3 movepos		= availableMoves[i];
		movepos.y = playerPos.y;

		D3DXVECTOR3 dir = movepos - playerPos;

		D3DXVec3Normalize(&dir, &dir);

		float angle = acos(D3DXVec3Dot(&dir, &direction));
		
		if (angle < EPSILON)
		{
			D3DXVECTOR3	destination	=	availableMoves[i];
			destination.y	=	playerPos.y;
			SetDestination(destination);
			return true;
		}
	}
	return false;
}
Esempio n. 5
0
void AGameObject::GoToGroundPosition( FVector groundPos )
{
  DropTargets();
  Stop();
  SetDestination( groundPos );
  AttackReady = 0;  // Do or Do NOT stop to engage enemy units
}
Esempio n. 6
0
/**
 * Initialize a print-to-pipe object.
 * See nsIPrintJobPS.h and nsPrintJobPS.h for details.
 */
nsresult
nsPrintJobPipePS::Init(nsIDeviceContextSpecPS *aSpec)
{
    NS_PRECONDITION(aSpec, "argument must not be NULL");
#ifdef DEBUG
    PRBool toPrinter;
    aSpec->GetToPrinter(toPrinter);
    NS_PRECONDITION(toPrinter, "Wrong class for this print job");
#endif

    /* Print command. This is stored as the destination string. */
    const char *command;
    aSpec->GetCommand(&command);
    SetDestination(command);

    /* Printer name */
    const char *printerName;
    aSpec->GetPrinterName(&printerName);
    if (printerName) {
        const char *slash = strchr(printerName, '/');
        if (slash)
            printerName = slash + 1;
        if (0 != strcmp(printerName, "default"))
            mPrinterName = printerName;
    }
    return NS_OK;
}
Esempio n. 7
0
void VehicleKit::Dismount(Unit* passenger, VehicleSeatEntry const* seatInfo)
{
    if (!passenger)
        return;

    float ox, oy, oz, oo;

    Unit* base = m_pBase->GetVehicle() ? m_pBase->GetVehicle()->GetBase() : m_pBase;
    base->GetPosition(ox, oy, oz);
    oo = base->GetOrientation();
    passenger->SetPosition(ox,oy,oz,oo,false);

    if (b_dstSet)
    {
        // parabolic traectory (catapults, explode, other effects). mostly set destination in DummyEffect.
        // destination Z not checked in this case! only limited on 8.0 delta. requred full correct set in spelleffects. 
        float speed = ((m_dst_speed > M_NULL_F) ? m_dst_speed : ((seatInfo && seatInfo->m_exitSpeed > M_NULL_F) ? seatInfo->m_exitSpeed : BASE_CHARGE_SPEED));
        float verticalSpeed = speed * sin(m_dst_elevation);
        float horisontalSpeed = speed * cos(m_dst_elevation);
        float moveTimeHalf =  verticalSpeed / ((seatInfo && seatInfo->m_exitGravity > 0.0f) ? seatInfo->m_exitGravity : Movement::gravity);
        float max_height = - Movement::computeFallElevation(moveTimeHalf,false,-verticalSpeed);

        passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x,m_dst_y,m_dst_z,passenger->GetOrientation(), horisontalSpeed, max_height, true);
    }
    else if (seatInfo)
    {
        // half-parabolic traectory (unmount)
        float horisontalSpeed = seatInfo->m_exitSpeed;

        if (horisontalSpeed < M_NULL_F)
            horisontalSpeed = BASE_CHARGE_SPEED;

        // may be under water
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), frand(2.0f, 3.0f), frand(M_PI_F/2.0f,3.0f*M_PI_F/2.0f), passenger);
        if (m_dst_z < oz)
            m_dst_z = oz;

        passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), horisontalSpeed, 0.0f);
    }
    else
    {
        // jump from vehicle without seatInfo (? error case)
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), 2.0f, M_PI_F, passenger);
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        if (m_dst_z < oz)
            m_dst_z = oz;

        passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), BASE_CHARGE_SPEED, 0.0f);
    }

    DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS,"VehicleKit::Dismount %s from %s (%f %f %f), destination point is %f %f %f",
        passenger->GetObjectGuid().GetString().c_str(),
        base->GetObjectGuid().GetString().c_str(),
        ox,oy,oz,
        m_dst_x,m_dst_y,m_dst_z);
    SetDestination();
}
Esempio n. 8
0
void EnemyMelee::Update(int D_x, int D_y, double dt)
{

	AccumulatedTime += dt; 
	 	
	SetDestination(D_x, D_y);

	 Move();
}
Esempio n. 9
0
//------------------------------------------------------------------------
void CHomingMissile::Launch(const Vec3 &pos, const Vec3 &dir, const Vec3 &velocity, float speedScale)
{
  CRocket::Launch(pos, dir, velocity, speedScale);

	if (m_controlled)
	{
		Vec3 dest(pos+dir*1000.0f);

		SetDestination(dest);
	}
}
Esempio n. 10
0
status_t
InterfaceAddress::SetTo(const ifaliasreq& request)
{
	status_t status = SetLocal((const sockaddr*)&request.ifra_addr);
	if (status == B_OK)
		status = SetDestination((const sockaddr*)&request.ifra_broadaddr);
	if (status == B_OK)
		status = SetMask((const sockaddr*)&request.ifra_mask);

	return status;
}
Esempio n. 11
0
void VehicleKit::Dismount(Unit* passenger, VehicleSeatEntry const* seatInfo)
{
    if (!passenger)
        return;

    float ox, oy, oz/*, oo*/; /* oo can be used, but not at the moment*/

    Unit* base = m_pBase->GetVehicle() ? m_pBase->GetVehicle()->GetBase() : m_pBase;

    base->GetPosition(ox, oy, oz);
    /*oo = base->GetOrientation();*/

    passenger->m_movementInfo = base->m_movementInfo;

    if (b_dstSet)
    {
        // parabolic traectory (catapults, explode, other effects). mostly set destination in DummyEffect.
        // destination Z not checked in this case! only limited on 8.0 delta. requred full correct set in spelleffects. 
        float speed = ((m_dst_speed > 0.0f) ? m_dst_speed : (seatInfo ? seatInfo->m_exitSpeed : 28.0f));
        float verticalSpeed = speed * sin(m_dst_elevation);
        float horisontalSpeed = speed * cos(m_dst_elevation);
        float moveTimeHalf =  verticalSpeed / ((seatInfo && seatInfo->m_exitGravity > 0.0f) ? seatInfo->m_exitGravity : Movement::gravity);
        float max_height = - Movement::computeFallElevation(moveTimeHalf,false,-verticalSpeed);

        passenger->MonsterMoveJump(m_dst_x, m_dst_y, m_dst_z,passenger->GetOrientation(), horisontalSpeed, max_height, false);

    }
    else if (seatInfo)
    {
        // half-parabolic traectory (unmount)
        float horisontalSpeed = seatInfo->m_exitSpeed;

        // may be under water
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), frand(2.0f, 3.0f), frand(M_PI_F/2.0f,3.0f*M_PI_F/2.0f));
        if (m_dst_z < oz)
            m_dst_z = oz;

        passenger->MonsterMoveJump(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), horisontalSpeed, 0.0f, false);
    }
    else
    {
        // jump from vehicle without seatInfo (? error case)
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), 2.0f, M_PI_F);
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        if (m_dst_z < oz)
            m_dst_z = oz;

        passenger->MonsterMoveWithSpeed(m_dst_x, m_dst_y, m_dst_z + 0.1f, 28.0f);
    }

    SetDestination();
}
Esempio n. 12
0
void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit *passenger = GetPassenger(accessory->uiSeat))
    {
        // already installed
        if (passenger->GetEntry() == accessory->uiAccessory)
            return;

        passenger->ExitVehicle();
    }

    if (Creature* summoned = m_pBase->SummonCreature(accessory->uiAccessory,
        m_pBase->GetPositionX() + accessory->m_offsetX, m_pBase->GetPositionY() + accessory->m_offsetY, m_pBase->GetPositionZ() + accessory->m_offsetZ, m_pBase->GetOrientation() + accessory->m_offsetX,
        TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f);
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
        summoned->EnterVehicle(this, accessory->uiSeat);
        SetDestination();
    }
}
Esempio n. 13
0
void Unit::RunAway()
{

    RenderableObject* runFrom = GetClosestEnemy();
    std::cout << runAwayTimer <<"\n test";
    if(runFrom != NULL){
        Vector2D destination = GetPosition() - runFrom->GetPosition();
        destination = GetPosition() + destination;
        SetDestination(destination.x,destination.y);
    }


}
Esempio n. 14
0
// Stand outside target within `distance` units
void AGameObject::RecomputePathTo( AGameObject* target, float fallbackDistance )
{
  // Sends ME to * which is fallbackDistance units from target.
  //            fallbackDistance
  // ME       * <-- target
  //
  if( !target )
  {
    warning( FS( "%s has a NULL AttackTarget", *GetName() ) );
    return;
  }

  // Depending on the target type, the point to move to may be the 'roid ro some other special point on the model
  FVector targetPos = target->Pos;
  if( AGoldmine* goldmine = Cast<AGoldmine>( target ) )
  {
    // Switch pos to entry point of mine when a mine is the target.
    targetPos = goldmine->GetEntryPoint();
    // Not sure about float level of goldmine.. so that doesn't matter,
    // equate the Z of the goldmine with CURRENT UNIT POSITION Z
    // so diff in Z doesn't mean no entry.
    targetPos.Z = Pos.Z;
    fallbackDistance = 0.f; // Overlap the goldmine's entry pt to enter.
  }
  
  //         len
  // Pos <---------- targetPos
  //            *<-- targetPos
  FVector targetToMe = Pos - targetPos;
  float len = targetToMe.Size();
  //    len
  // Pos <- targetPos
  //   *<-- targetPos
  if( len < fallbackDistance )
  {
    // Within fallbackDistance, so face only (no movement)
    Face( targetPos );
  }
  else if( len ) // If there is a distance to travel
  {
    // Normalize
    targetToMe /= len;
    // Set the fallback distance to being size of bounding radius of other unit
    SetDestination( targetPos + targetToMe*(fallbackDistance*.997f) );
  }
  else
  {
    // I'm already there
  }
}
Esempio n. 15
0
void EnemyMelee::Update(Player* player, World* currentWorld, double dt)
{

	AccumulatedTime += dt; 

	this->colData = currentWorld->collisionData;

	SetDestination(player->getPosition().x, player->getPosition().y);

	Pat(player);

	onHit(player);

}
Esempio n. 16
0
void VehicleKit::Dismount(Unit* passenger, VehicleSeatEntry const* seatInfo)
{
    if (!passenger)
        return;

    float ox, oy, oz, oo;
    m_pBase->GetPosition(ox, oy, oz);
    oo = m_pBase->GetOrientation();
    ox += seatInfo->m_attachmentOffsetX;
    oy += seatInfo->m_attachmentOffsetY;
    oz += seatInfo->m_attachmentOffsetX;
    oo += seatInfo->m_passengerYaw;

    passenger->SetPosition(ox, oy, oz + 0.5f, oo);

    Unit* base = m_pBase->GetVehicle() ? m_pBase->GetVehicle()->GetBase() : m_pBase;

    if (b_dstSet)
    {
        // parabolic traectory (catapults)
        float speed = ((m_dst_speed > 0.0f) ? m_dst_speed : (seatInfo ? seatInfo->m_exitSpeed : 28.0f));
        float verticalSpeed = speed * sin(m_dst_elevation);
        float horisontalSpeed = speed * cos(m_dst_elevation);
        float moveTimeHalf =  verticalSpeed / ((seatInfo && seatInfo->m_exitGravity > 0.0f) ? seatInfo->m_exitGravity : Movement::gravity);
        float max_height = - Movement::computeFallElevation(moveTimeHalf,false,-verticalSpeed);
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        passenger->MonsterMoveJump(m_dst_x, m_dst_y, m_dst_z,passenger->GetOrientation(), horisontalSpeed, max_height, false);

    }
    else if (seatInfo)
    {
        // half-parabolic traectory (unmount)

        float horisontalSpeed = seatInfo->m_exitSpeed;

        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), frand(2.0f, 3.0f), frand(M_PI_F/2.0f,3.0f*M_PI_F/2.0f));
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        passenger->MonsterMoveJump(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), horisontalSpeed, 0.0f, false);
    }
    else
    {
        // jump from vehicle without seatInfo (? error case)
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, base->GetObjectBoundingRadius(), 2.0f, M_PI_F);
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        passenger->MonsterMoveWithSpeed(m_dst_x, m_dst_y, m_dst_z + 0.5f, 28);
    }

    SetDestination();
}
void
JXPTPrintSetupDialog::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsDestination && message.Is(JXRadioGroup::kSelectionChanged))
		{
		const JXRadioGroup::SelectionChanged* selection =
			dynamic_cast(const JXRadioGroup::SelectionChanged*, &message);
		assert( selection != NULL );
		SetDestination(selection->GetID());
		}

	else if (sender == itsChooseFileButton && message.Is(JXButton::kPushed))
Esempio n. 18
0
END_CLASS

void hhDeathWraithEnergy::Spawn() {
	startTime = MS2SEC(gameLocal.time);
	duration = spawnArgs.GetFloat("duration");

	startRadius = spawnArgs.GetFloat("startRadius");
	endRadius = spawnArgs.GetFloat("endRadius");
	startTheta = DEG2RAD(spawnArgs.GetFloat("startTheta"));
	endTheta = DEG2RAD(spawnArgs.GetFloat("endTheta"));
	startZ = spawnArgs.GetFloat("startZ");
	endZ = spawnArgs.GetFloat("endZ");

	// For testing
	SetDestination(vec3_origin);
	SetPlayer(static_cast<hhPlayer*>(gameLocal.GetLocalPlayer()));

	StartSound("snd_idle", SND_CHANNEL_BODY);
}
Esempio n. 19
0
VehicleKit::VehicleKit(Unit* base, VehicleEntry const* entry) 
    :  TransportBase(base), m_vehicleEntry(entry), m_uiNumFreeSeats(0), m_isInitialized(false)
{
    for (uint32 i = 0; i < MAX_VEHICLE_SEAT; ++i)
    {
        uint32 seatId = GetEntry()->m_seatID[i];

        if (!seatId)
            continue;


        if (VehicleSeatEntry const *seatInfo = sVehicleSeatStore.LookupEntry(seatId))
        {
            m_Seats.insert(std::make_pair(i, VehicleSeat(seatInfo)));

            if (seatInfo->IsUsable())
                ++m_uiNumFreeSeats;
        }
    }

    if (base)
    {
        if (GetEntry()->m_flags & VEHICLE_FLAG_NO_STRAFE)
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_STRAFE);

        if (GetEntry()->m_flags & VEHICLE_FLAG_NO_JUMPING)
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_NO_JUMPING);

        if (GetEntry()->m_flags & VEHICLE_FLAG_FULLSPEEDTURNING)
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_FULLSPEEDTURNING);

        if (GetEntry()->m_flags & VEHICLE_FLAG_ALLOW_PITCHING)
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_ALLOW_PITCHING);

        if (GetEntry()->m_flags & VEHICLE_FLAG_FULLSPEEDPITCHING)
        {
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_ALLOW_PITCHING);
            GetBase()->m_movementInfo.AddMovementFlag2(MOVEFLAG2_FULLSPEEDPITCHING);
        }

    }
    SetDestination();
}
Esempio n. 20
0
nsresult
nsPrintJobCUPS::StartSubmission(FILE **aHandle)
{
    NS_ENSURE_TRUE(mCups.IsInitialized(), NS_ERROR_NOT_INITIALIZED);

    int fd;
    char buf[FILENAME_MAX];

    fd = (mCups.mCupsTempFd)(buf, sizeof buf);
    // The CUPS manual doesn't describe what cupsTempFd() returns to
    // indicate failure. -1 is a likely value.
    NS_ENSURE_TRUE(fd > 0, NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE);

    SetDestHandle(fdopen(fd, "r+"));
    if (!GetDestHandle()) {
        close(fd);
        return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;
    }
    SetDestination(buf);
    *aHandle = GetDestHandle();
    return NS_OK;
}
Esempio n. 21
0
void Pacman::SetDestination(D3DXVECTOR3 Pos)
{
	SetDestination(Pos.x, Pos.y, Pos.z);
}
void DisplayDirector::DragSelection(BPoint startPoint)
{
	if (selection == NULL)
		return;

	View* view = WindowView();
	BPoint lastPoint = ViewToDoc(startPoint);
	bool scrolling = false;
	bool wasRightButton = false;
	bool optionDown = false;
	while (true) {
		// get the mouse point and check if moved/finished
		BPoint point = view->GetMousePoint();
		int buttons = view->GetMouseButtons();
		if (buttons == 0)
			break;
		wasRightButton = ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0);
		optionDown = ((view->CurModifiers() & B_OPTION_KEY) != 0);
		scrolling |= Autoscroll(point);
		point = ViewToDoc(point);
		if (point == lastPoint && !scrolling) {
			view->MouseTrackingPause();
			continue;
			}

		// change the destination
		Destination* newDestination = NULL;
		if (!selection->ContainsPoint(point)) {
			FindDestinationContext destContext(selection, point.x, point.y);
			newDestination = docDisplayNode->BlockFindDestination(&destContext);
			}
		if (newDestination != destination) {
			StartRefreshCycle();

			SetDestination(newDestination);

			scrolling = DoScrollStep();

			FinishRefreshCycle();
			}
		else
			scrolling = DoScrollStep();

		lastPoint = point;
		}

	// do the move/copy
	if (destination) {
		// figure out if it's a move or a copy
		bool doing = true;
		bool copying = false;
/***
		if (wasRightButton) {
			BPopUpMenu* menu = new BPopUpMenu("Move/Copy");
			BMenuItem* moveItem = new BMenuItem("Move", NULL);
			menu->AddItem(moveItem);
			BMenuItem* copyItem = new BMenuItem("Copy", NULL);
			menu->AddItem(copyItem);
			BMenuItem* chosenItem = menu->Go(ConvertToScreen(DocToView(lastPoint)), false, true);
			copying = (chosenItem == copyItem);
			if (chosenItem == NULL)
				doing = false;
			delete menu;
			}
		else if (optionDown)
			copying = true;
***/
		if (optionDown)
			copying = true;

		if (doing) {
			StartRefreshCycle();

			// do the move or copy
			Action* moveAction = NULL;
			if (copying)
				moveAction = destination->GetCopyAction();
			else
				moveAction = destination->GetMoveAction();
			if (moveAction)
				DoAction(moveAction);

			SetDestination(NULL);

			FinishRefreshCycle();
			}
		else
			SetDestination(NULL);
		}
}
Esempio n. 23
0
//-----------------------------------------------------------------------------
void CHomingMissile::UpdateControlledMissile(float frameTime)
{
	bool isServer = gEnv->bServer;
	bool isClient = gEnv->bClient;

	CActor *pClientActor=0;
	if (gEnv->bClient)
		pClientActor=static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor());
	bool isOwner = ((!m_ownerId && isServer) || (isClient && pClientActor && (pClientActor->GetEntityId() == m_ownerId) && pClientActor->IsPlayer()));

	IRenderer* pRenderer = gEnv->pRenderer;
	IRenderAuxGeom* pGeom = pRenderer->GetIRenderAuxGeom();
	float color[4] = {1,1,1,1};
	const static float step = 15.f;  
	float y = 20.f;    

	bool bDebug = g_pGameCVars->i_debug_projectiles > 0;

	if (isOwner || isServer)
	{
		//If there's a target, follow the target
		if(isServer)
		{
			if (m_targetId)
			{
				if (m_lockedTimer>0.0f)
					m_lockedTimer=m_lockedTimer-frameTime;
				else
				{
					// If we are here, there's a target
					IEntity* pTarget = gEnv->pEntitySystem->GetEntity(m_targetId);
					if (pTarget)
					{
						AABB box;
						pTarget->GetWorldBounds(box);
						Vec3 finalDes = box.GetCenter();
						SetDestination(finalDes);
						//SetDestination( box.GetCenter() );

						if (bDebug)
							pRenderer->Draw2dLabel(5.0f, y+=step, 1.5f, color, false, "Target Entity: %s", pTarget->GetName());
					}

					m_lockedTimer+=0.05f;
				}
			}
			else if(m_autoControlled)
				return;
		} 

		if (m_controlled && !m_autoControlled && isOwner && !m_targetId)
		{
			//Check if the weapon is still selected
			CWeapon *pWeapon = GetWeapon();

			if(!pWeapon || !pWeapon->IsSelected())
				return;

			if (m_controlledTimer>0.0f)
				m_controlledTimer=m_controlledTimer-frameTime;
			else if (pClientActor && pClientActor->IsPlayer()) 	//Follow the crosshair
			{
				if (IMovementController *pMC=pClientActor->GetMovementController())
				{
					Vec3 eyePos(ZERO);
					Vec3 eyeDir(ZERO);

					IVehicle* pVehicle = pClientActor->GetLinkedVehicle();
					if(!pVehicle)
					{
						SMovementState state;
						pMC->GetMovementState(state);

						eyePos = state.eyePosition;
						eyeDir = state.eyeDirection;
					}
					else
					{	
						SViewParams viewParams;
						pVehicle->UpdateView(viewParams, pClientActor->GetEntityId());

						eyePos = viewParams.position;
						eyeDir = viewParams.rotation * Vec3(0,1,0);
						//eyeDir = (viewParams.targetPos - viewParams.position).GetNormalizedSafe();
					}

					int pierceability=7;

					if (IPhysicalEntity *pPE=GetEntity()->GetPhysics())
					{
						if (pPE->GetType()==PE_PARTICLE)
						{
							pe_params_particle pp;

							if (pPE->GetParams(&pp))
								pierceability=pp.iPierceability;
						}
					}

					static const int objTypes = ent_all;
					static const int flags = (geom_colltype_ray << rwi_colltype_bit) | rwi_colltype_any | (pierceability & rwi_pierceability_mask) | (geom_colltype14 << rwi_colltype_bit);

					IPhysicalWorld* pWorld = gEnv->pPhysicalWorld;
					static IPhysicalEntity* pSkipEnts[10];
					int numSkip = CSingle::GetSkipEntities(pWeapon, pSkipEnts, 10);

					ray_hit hit;
					int hits = 0;

					float range=m_maxTargetDistance;
					hits = pWorld->RayWorldIntersection(eyePos + 1.5f*eyeDir, eyeDir*range, objTypes, flags, &hit, 1, pSkipEnts, numSkip);
					
					while (hits)
					{
						if (gEnv->p3DEngine->RefineRayHit(&hit, eyeDir*range))
							break;

						eyePos = hit.pt+eyeDir*0.003f;
						range -= hit.dist+0.003f;

						hits = pWorld->RayWorldIntersection(eyePos, eyeDir*range, objTypes, flags, &hit, 1, pSkipEnts, numSkip);
					}

					DestinationParams params;

					if(hits)
						params.pt=hit.pt;
					else
						params.pt=(eyePos+m_maxTargetDistance*eyeDir);	//Some point in the sky...

					GetGameObject()->InvokeRMI(SvRequestDestination(), params, eRMI_ToServer);

					if (bDebug)
					{
						pRenderer->Draw2dLabel(5.0f, y+=step, 1.5f, color, false, "PlayerView eye direction: %.3f %.3f %.3f", eyeDir.x, eyeDir.y, eyeDir.z);
						pRenderer->Draw2dLabel(5.0f, y+=step, 1.5f, color, false, "PlayerView Target: %.3f %.3f %.3f", hit.pt.x, hit.pt.y, hit.pt.z);
						pRenderer->GetIRenderAuxGeom()->DrawCone(m_destination, Vec3(0,0,-1), 2.5f, 7.f, ColorB(255,0,0,255));
					}
				}

				m_controlledTimer+=0.0f;
			}
		}
	}

	//This code is shared by both modes above (auto and controlled)
	if(!m_destination.IsZero())
	{
		pe_status_dynamics status;
		if (!GetEntity()->GetPhysics()->GetStatus(&status))
		{
			CryLogAlways("couldn't get physics status!");
			return;
		}

		pe_status_pos pos;
		if (!GetEntity()->GetPhysics()->GetStatus(&pos))
		{
			CryLogAlways("couldn't get physics pos!");
			return;
		}

		float currentSpeed = status.v.len();

		if (currentSpeed>0.001f)
		{
			Vec3 currentVel = status.v;
			Vec3 currentPos = pos.pos;
			Vec3 goalDir(ZERO);

			assert(!_isnan(currentSpeed));
			assert(!_isnan(currentVel.x) && !_isnan(currentVel.y) && !_isnan(currentVel.z));

			//Just a security check
			if((currentPos-m_destination).len2()<(m_detonationRadius*m_detonationRadius))
			{
				Explode(true, true, m_destination, -currentVel.normalized(), currentVel, m_targetId);

				return;
			}

			goalDir = m_destination - currentPos;
			goalDir.Normalize();

			//Turn more slowly...
			currentVel.Normalize();

			if(bDebug)
			{

				pRenderer->Draw2dLabel(50,55,2.0f,color,false, "  Destination: %.3f, %.3f, %.3f",m_destination.x,m_destination.y,m_destination.z);
				pRenderer->Draw2dLabel(50,80,2.0f,color,false, "  Current Dir: %.3f, %.3f, %.3f",currentVel.x,currentVel.y,currentVel.z);
				pRenderer->Draw2dLabel(50,105,2.0f,color,false,"  Goal    Dir: %.3f, %.3f, %.3f",goalDir.x,goalDir.y,goalDir.z);
			}

			float cosine = currentVel.Dot(goalDir);
			cosine = CLAMP(cosine,-1.0f,1.0f);
			float totalAngle = RAD2DEG(cry_acosf(cosine));

			assert(totalAngle>=0);

			if (cosine<0.99)
			{
				float maxAngle = m_turnSpeed*frameTime;
				if (maxAngle>totalAngle)
					maxAngle=totalAngle;
				float t=(maxAngle/totalAngle)*m_lazyness;

				assert(t>=0.0 && t<=1.0);

				goalDir = Vec3::CreateSlerp(currentVel, goalDir, t);
				goalDir.Normalize();
			}

			if(bDebug)
				pRenderer->Draw2dLabel(50,180,2.0f,color,false,"Corrected Dir: %.3f, %.3f, %.3f",goalDir.x,goalDir.y,goalDir.z);

			pe_action_set_velocity action;
			action.v = goalDir * currentSpeed;
			GetEntity()->GetPhysics()->Action(&action);
		}
	}
}
Esempio n. 24
0
//----------------------------------------------------------------------------
void CHomingMissile::UpdateCruiseMissile(float frameTime)
{

	IRenderer* pRenderer = gEnv->pRenderer;
	IRenderAuxGeom* pGeom = pRenderer->GetIRenderAuxGeom();
	float color[4] = {1,1,1,1};
	const static float step = 15.f;  
	float y = 20.f;    

	bool bDebug = g_pGameCVars->i_debug_projectiles > 0;

	if (m_targetId)
	{
		IEntity* pTarget = gEnv->pEntitySystem->GetEntity(m_targetId);
		if (pTarget)
		{
			AABB box;
			pTarget->GetWorldBounds(box);
			SetDestination( box.GetCenter() );

			//if (bDebug)
				//pRenderer->Draw2dLabel(5.0f, y+=step, 1.5f, color, false, "Target Entity: %s", pTarget->GetName());
		}    
	}
	else 
	{
		// update destination pos from weapon
		static IItemSystem* pItemSystem = g_pGame->GetIGameFramework()->GetIItemSystem();
		IItem* pItem = pItemSystem->GetItem(m_weaponId);
		if (pItem && pItem->GetIWeapon())
		{
			const Vec3& dest = pItem->GetIWeapon()->GetDestination();
			SetDestination( dest );

			//if (bDebug)
				//pRenderer->Draw2dLabel(5.0f, y+=step, 1.5f, color, false, "Weapon Destination: (%.1f %.1f %.1f)", dest.x, dest.y, dest.z);
		}
	}

	pe_status_dynamics status;
	if (!GetEntity()->GetPhysics()->GetStatus(&status))
		return;

	float currentSpeed = status.v.len();
	Vec3 currentPos = GetEntity()->GetWorldPos();
	Vec3 goalDir(ZERO);

	if (!m_destination.IsZero())
	{

		if((currentPos-m_destination).len2()<(m_detonationRadius*m_detonationRadius))
		{
			Explode(true, true, m_destination, -status.v.normalized(), status.v, m_targetId);
			return;
		}

		if (bDebug)
			pGeom->DrawCone(m_destination, Vec3(0,0,-1), 2.5f, 7.f, ColorB(255,0,0,255));

		float heightDiff = (m_cruiseAltitude-m_alignAltitude) - currentPos.z;

		if (!m_isCruising && heightDiff * sgn(status.v.z) > 0.f)
		{
			// if heading towards align altitude (but not yet reached) accelerate to max speed    
			if (bDebug)
				pRenderer->Draw2dLabel(5.0f,  y+=step,   1.5f, color, false, "[HomingMissile] accelerating (%.1f / %.1f)", currentSpeed, m_maxSpeed);    
		}
		else if (!m_isCruising && heightDiff * sgnnz(status.v.z) < 0.f && (status.v.z<0 || status.v.z>0.25f))
		{
			// align to cruise
			if (currentSpeed != 0)
			{
				goalDir = status.v;
				goalDir.z = 0;
				goalDir.normalize();
			}    

			if (bDebug)
				pRenderer->Draw2dLabel(5.0f,  y+=step, 1.5f, color, false, "[HomingMissile] aligning"); 
		}
		else
		{
			if (bDebug)
				pRenderer->Draw2dLabel(5.0f,  y+=step, 1.5f, color, false, "[HomingMissile] cruising..."); 

			// cruise
			m_isCruising = true;

			if (!m_destination.IsZero())
			{
				float groundDistSq = m_destination.GetSquaredDistance2D(currentPos);
				float distSq = m_destination.GetSquaredDistance(currentPos);
				float descendDistSq = sqr(m_descendDistance);

				if (m_isDescending || groundDistSq <= descendDistSq)
				{
					if (bDebug)
						pRenderer->Draw2dLabel(5.0f,  y+=step, 1.5f, color, false, "[HomingMissile] descending!"); 

					if (distSq != 0)
						goalDir = (m_destination - currentPos).normalized();
					else 
						goalDir.zero();

					m_isDescending = true;
				}              
				else
				{
					Vec3 airPos = m_destination;
					airPos.z = currentPos.z;          
					goalDir = airPos - currentPos;
					if (goalDir.len2() != 0)
						goalDir.Normalize();
				}    
			}
		}
	}  

	float desiredSpeed = currentSpeed;
	if (currentSpeed < m_maxSpeed-0.1f)
	{
		desiredSpeed = min(m_maxSpeed, desiredSpeed + m_accel*frameTime);
	}

	Vec3 currentDir = status.v.GetNormalizedSafe(FORWARD_DIRECTION);
	Vec3 dir = currentDir;

	if (!goalDir.IsZero())
	{ 
		float cosine = max(min(currentDir.Dot(goalDir), 0.999f), -0.999f);
		float goalAngle = RAD2DEG(acos_tpl(cosine));
		float maxAngle = m_turnSpeed * frameTime;

		if (bDebug)
		{ 
			pGeom->DrawCone( currentPos, goalDir, 0.4f, 12.f, ColorB(255,0,0,255) );
			pRenderer->Draw2dLabel(5.0f,  y+=step, 1.5f, color, false, "[HomingMissile] goalAngle: %.2f", goalAngle); 

		}

		if (goalAngle > maxAngle+0.05f)    
			dir = (Vec3::CreateSlerp(currentDir, goalDir, maxAngle/goalAngle)).normalize();
		else //if (goalAngle < 0.005f)
			dir = goalDir;
	}

	pe_action_set_velocity action;
	action.v = dir * desiredSpeed;
	GetEntity()->GetPhysics()->Action(&action);

	if (bDebug)
	{
		pGeom->DrawCone( currentPos, dir, 0.4f, 12.f, ColorB(128,128,0,255) );  
		pRenderer->Draw2dLabel(5.0f,  y+=step, 1.5f, color, false, "[HomingMissile] currentSpeed: %.1f (max: %.1f)", currentSpeed, m_maxSpeed); 
	}
}
Esempio n. 25
0
//------------------------------------------------------------------------
IMPLEMENT_RMI(CHomingMissile, SvRequestDestination)
{
	SetDestination(params.pt);

	return true;
}
Esempio n. 26
0
void Guards::Patrolling(int worldWidth, int worldHeight, int tileSize, double dt)
{
	bool collide = this->tileBasedMovement(worldWidth, worldHeight, tileSize, dt);

	if (pos == destination && this->guardStateMachine.GetState() == Guards_StateMachine::IDLE_STATE || !collide)
	{
		do 
		{
			SetDestination();
		}
		while (CheckDestination() == false);
	}

	if (Math::FAbs(destination.x - pos.x) < size.x * 0.25f)
	{
		pos.x = destination.x;
		targetPos.x = pos.x;
	}

	if (Math::FAbs(destination.y - pos.y) < size.y * 0.2f)
	{
		pos.y = destination.y;
		targetPos.y = pos.y;
	}

	if (Math::FAbs(destination.y - pos.y) < size.y * 0.2f && Math::FAbs(destination.x - pos.x) < size.x * 0.2f)
	{
		pos = destination;
		targetPos = pos;
	}

	else if (destination.x > pos.x && Math::FAbs(destination.x - pos.x) > size.x * 0.2f && Math::FAbs(targetPos.x - pos.x) < tileSize * 0.2f)
	{
		targetPos.Set(targetPos.x + tileSize, targetPos.y);
	}

	else if (destination.x < pos.x && Math::FAbs(destination.x - pos.x) > size.x * 0.2f && Math::FAbs(targetPos.x - pos.x) < tileSize * 0.2f)
	{
		targetPos.Set(targetPos.x - tileSize, targetPos.y);
	}

	else if (destination.y > pos.y && Math::FAbs(destination.y - pos.y) > size.y * 0.2f && Math::FAbs(targetPos.y - pos.y) < tileSize * 0.2f)
	{
		targetPos.Set(targetPos.x, targetPos.y + tileSize);
	}

	else if (destination.y < pos.y && Math::FAbs(destination.y - pos.y) > size.y * 0.2f && Math::FAbs(targetPos.y - pos.y) < tileSize * 0.2f)
	{
		targetPos.Set(targetPos.x, targetPos.y - tileSize);
	}

	if (destination != pos)
	{
		changeAni(Guards_StateMachine::WALK_STATE);
		Character::changeAni(StateMachine::WALK_STATE);
	}

	else
	{
		changeAni(Guards_StateMachine::IDLE_STATE);
		Character::changeAni(StateMachine::IDLE_STATE);
	}
}
Esempio n. 27
0
void AGameObject::AttackGroundPosition( FVector groundPos )
{
  Stop();
  SetDestination( groundPos );
  AttackReady = 1;  // Do or Do NOT stop to engage enemy units
}
Esempio n. 28
0
void VehicleKit::Dismount(Unit* passenger, VehicleSeatEntry const* seatInfo)
{
    if (!passenger || !passenger->IsInWorld() || !GetBase()->IsInWorld())
        return;

    Unit* base = (GetBase()->GetVehicle() && GetBase()->GetVehicle()->GetBase()) ? GetBase()->GetVehicle()->GetBase() : GetBase();

    WorldLocation const& pos = base->GetPosition();
    // oo = base->GetOrientation();
    float tRadius = base->GetObjectBoundingRadius();
    if (tRadius < 1.0f || tRadius > 10.0f)
        tRadius = 1.0f;

    // Force update passenger position to base position
    passenger->SetPosition(pos);

    if (passenger->GetTypeId() == TYPEID_PLAYER)
        ((Player*)passenger)->SetFallInformation(0, pos.z + 0.5f);

    // FIXME temp method for unmount on transport
    if (GetBase()->IsOnTransport())
    {
        passenger->Relocate(GetBase()->GetTransport()->GetPosition());
        GetBase()->GetTransport()->AddPassenger(passenger, GetBase()->GetTransportPosition());
    }
    // Check for tru dismount while grid unload
    else if (passenger->GetTypeId() != TYPEID_PLAYER && !GetBase()->GetMap()->IsLoaded(pos.x, pos.y))
    {
        passenger->Relocate(pos);
    }
    else if (m_dstSet)
    {
        // parabolic traectory (catapults, explode, other effects). mostly set destination in DummyEffect.
        // destination Z not checked in this case! only limited on 8.0 delta. requred full correct set in spelleffects.

        // Check for tru move unit/creature to unloaded grid (for players check maked in Map class)
        if (passenger->GetTypeId() != TYPEID_PLAYER && !GetBase()->GetMap()->IsLoaded(m_dst_x, m_dst_y))
        {
            passenger->Relocate(pos);
        }
        else if (passenger->GetTypeId() != TYPEID_PLAYER || !GetBase()->m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING))
        {
            float speed = ((m_dst_speed > M_NULL_F) ? m_dst_speed : ((seatInfo && seatInfo->m_exitSpeed > M_NULL_F) ? seatInfo->m_exitSpeed : BASE_CHARGE_SPEED));
            float verticalSpeed = speed * sin(m_dst_elevation);
            float horisontalSpeed = speed * cos(m_dst_elevation);
            float moveTimeHalf =  verticalSpeed / ((seatInfo && seatInfo->m_exitGravity > 0.0f) ? seatInfo->m_exitGravity : Movement::gravity);
            float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -verticalSpeed);

            passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x, m_dst_y, m_dst_z, passenger->GetOrientation(), horisontalSpeed, max_height, true);
        }
        else
            DismountFromFlyingVehicle(passenger);
    }
    else if (seatInfo)
    {
        // half-parabolic traectory (unmount)

        // may be under water
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, tRadius, frand(2.0f, 3.0f), frand(M_PI_F / 2.0f, 3.0f * M_PI_F / 2.0f), passenger);
        if (m_dst_z < pos.z && !base->IsLevitating())
            m_dst_z = pos.z;

        if (passenger->GetTypeId() != TYPEID_PLAYER && !GetBase()->GetMap()->IsLoaded(m_dst_x, m_dst_y))
        {
            passenger->Relocate(pos);
        }
        else if (passenger->GetTypeId() != TYPEID_PLAYER || !GetBase()->m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING))
        {
            float horisontalSpeed = seatInfo->m_exitSpeed;

            if (horisontalSpeed < M_NULL_F)
                horisontalSpeed = BASE_CHARGE_SPEED;

            passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), horisontalSpeed, 0.0f);
        }
        else
            DismountFromFlyingVehicle(passenger);
    }
    else
    {
        // jump from vehicle without seatInfo (? error case)
        base->GetClosePoint(m_dst_x, m_dst_y, m_dst_z, tRadius, 2.0f, M_PI_F, passenger);
        passenger->UpdateAllowedPositionZ(m_dst_x, m_dst_y, m_dst_z);
        if (m_dst_z < pos.z && !base->IsLevitating())
            m_dst_z = pos.z;

        if (passenger->GetTypeId() != TYPEID_PLAYER && !GetBase()->GetMap()->IsLoaded(m_dst_x, m_dst_y))
        {
            passenger->Relocate(pos);
        }
        else if (passenger->GetTypeId() != TYPEID_PLAYER || !GetBase()->m_movementInfo.HasMovementFlag(MOVEFLAG_FLYING))
            passenger->GetMotionMaster()->MoveSkyDiving(m_dst_x, m_dst_y, m_dst_z + 0.1f, passenger->GetOrientation(), BASE_CHARGE_SPEED, 0.0f);
        else
            DismountFromFlyingVehicle(passenger);
    }

    DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "VehicleKit::Dismount %s from %s (%f %f %f), destination point is %f %f %f",
        passenger->GetGuidStr().c_str(),
        base->GetGuidStr().c_str(),
        pos.x, pos.y, pos.z,
        m_dst_x, m_dst_y, m_dst_z);

    SetDestination();
}
void
JXPTPrintSetupDialog::SetObjects
	(
	JXTextButton*					okButton,
	JXTextButton*					cancelButton,
	JXRadioGroup*					destinationRG,
	const JXPTPrinter::Destination	dest,
	JXStaticText*					printCmdLabel,
	JXInputField*					printCmdInput,
	const JCharacter*				printCmd,
	JXTextButton*					chooseFileButton,
	const JCharacter*				fileName,
	JXIntegerInput*					copyCount,
	JXTextCheckbox*					printAllCB,
	JXStaticText*					firstPageIndexLabel,
	JXIntegerInput*					firstPageIndex,
	JXStaticText*					lastPageIndexLabel,
	JXIntegerInput*					lastPageIndex,
	JXTextCheckbox*					printLineNumbersCB,
	const JBoolean					printLineNumbers
	)
{
	itsPrintButton         = okButton;
	itsDestination         = destinationRG;
	itsPrintCmdLabel       = printCmdLabel;
	itsPrintCmd            = printCmdInput;
	itsChooseFileButton    = chooseFileButton;
	itsCopyCount           = copyCount;
	itsPrintAllCB          = printAllCB;
	itsFirstPageIndexLabel = firstPageIndexLabel;
	itsFirstPageIndex      = firstPageIndex;
	itsLastPageIndexLabel  = lastPageIndexLabel;
	itsLastPageIndex       = lastPageIndex;
	itsPrintLineNumbersCB  = printLineNumbersCB;

	JXWindow* window = itsDestination->GetWindow();
	window->SetTitle("Print Setup");
	SetButtons(okButton, cancelButton);

	const JRect r = itsPrintCmd->GetFrame();
	itsFileInput =
		new JXFileInput(window,
						JXWidget::kHElastic, JXWidget::kVElastic,
						r.left, r.top, r.width(), r.height());
	assert( itsFileInput != NULL );
	itsFileInput->ShouldAllowInvalidFile();
	itsFileInput->SetText(fileName);
	itsFileInput->ShouldBroadcastAllTextChanged(kJTrue);
	ListenTo(itsFileInput);

	itsPrintCmd->SetText(printCmd);
	itsPrintCmd->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord);

	ListenTo(itsDestination);
	ListenTo(itsChooseFileButton);
	ListenTo(itsPrintAllCB);

	JBoolean foundDest = kJFalse;
	for (JIndex i=1; i<=kDestCount; i++)
		{
		if (kIndexToDest[i-1] == dest)
			{
			SetDestination(i);
			foundDest = kJTrue;
			break;
			}
		}
	assert( foundDest );

	itsCopyCount->SetValue(1);
	itsCopyCount->SetLowerLimit(1);

	PrintAllPages(kJTrue);

	itsFirstPageIndex->SetLowerLimit(1);
	itsFirstPageIndex->SetIsRequired(kJFalse);

	itsLastPageIndex->SetLowerLimit(1);
	itsLastPageIndex->SetIsRequired(kJFalse);

	itsPrintLineNumbersCB->SetState(printLineNumbers);

    itsChooseFileButton->SetShortcuts("#O");
    itsPrintAllCB->SetShortcuts("#L");
    itsPrintLineNumbersCB->SetShortcuts("#N");

	UpdateDisplay();
}