Ejemplo n.º 1
0
//------------------------------------------------------------------------
int CScriptBind_Vehicle::DisableEngine(IFunctionHandler *pH, bool disable)
{
  if (CVehicle* pVehicle = GetVehicle(pH))
  {
    if (pVehicle->GetMovement())
      pVehicle->GetMovement()->DisableEngine(disable);
  }

  return pH->EndFunction();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pPlayer - 
//-----------------------------------------------------------------------------
void CChoreoGenericServerVehicle::ItemPostFrame( CBasePlayer *player )
{
	Assert( player == GetDriver() );

	GetDrivableVehicle()->ItemPostFrame( player );

	if (( player->m_afButtonPressed & IN_USE ) || GetVehicle()->ShouldForceExit() )
	{
		GetVehicle()->ClearForcedExit();
		if ( GetDrivableVehicle()->CanExitVehicle(player) )
		{
			// Let the vehicle try to play the exit animation
			if ( !HandlePassengerExit( player ) && ( player != NULL ) )
			{
				player->PlayUseDenySound();
			}
		}
	}
}
Ejemplo n.º 3
0
//------------------------------------------------------------------------
int CScriptBind_Vehicle::EnableMovement(IFunctionHandler *pH, bool enable)
{
  if (CVehicle* pVehicle = GetVehicle(pH))
  {
    if (pVehicle->GetMovement())
      pVehicle->GetMovement()->EnableMovementProcessing(enable);
  }

  return pH->EndFunction();
}
Ejemplo n.º 4
0
float CIVVehicle::GetSteeringAngle()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_fSteering;

	return 0.0f;
}
Ejemplo n.º 5
0
//------------------------------------------------------------------------
int CScriptBind_Vehicle::AddSeat(IFunctionHandler* pH, SmartScriptTable paramsTable)
{
	IVehicle *pVehicle = GetVehicle(pH);
	if (pVehicle)
	{
		pVehicle->AddSeat(paramsTable);
	}

	return pH->EndFunction();
}
Ejemplo n.º 6
0
//------------------------------------------------------------------------
int CScriptBind_Vehicle::HasHelper(IFunctionHandler* pH, const char* name)
{
	if (IVehicle *pVehicle = GetVehicle(pH))
	{
		IVehicleHelper* pHelper = pVehicle->GetHelper(name);
		return pH->EndFunction(pHelper != NULL);
	}

	return pH->EndFunction(false);
}
Ejemplo n.º 7
0
float CIVVehicle::GetDirtLevel()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_fDirtLevel;

	return 0.0f;
}
Ejemplo n.º 8
0
bool CIVVehicle::GetEngineStatus()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(IS_BIT_SET(pVehicle->m_byteFlags1, 8))
		return true;

	return false;
}
Ejemplo n.º 9
0
BYTE CIVVehicle::GetTextureVariationCount()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return g_pCore->GetGame()->GetModelInfo(pVehicle->m_wModelIndex)->GetModelInfo()->byteTextureVariationCount;

	return 255;
}
Ejemplo n.º 10
0
float CIVVehicle::GetPetrolTankHealth()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_fPetrolTankHealth;

	return 0.0f;
}
Ejemplo n.º 11
0
DWORD CIVVehicle::GetDoorLockState()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_dwDoorLockState;

	return 0;
}
Ejemplo n.º 12
0
float CIVVehicle::GetBrakePedal()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_fBrakePedal;

	return 0.0f;
}
Ejemplo n.º 13
0
float CIVVehicle::GetEngineHealth()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_fEngineHealth;

	return 0.0f;
}
Ejemplo n.º 14
0
BYTE CIVVehicle::GetMaxPasssengers()
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		return pVehicle->m_byteMaxPassengers;

	return 0;
}
Ejemplo n.º 15
0
Creature*
ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
{
    if(Creature *unit = GetPet(guid))
        return unit;

    if(Creature *unit = GetVehicle(guid))
        return unit;

    return GetCreature(u, guid);
}
Ejemplo n.º 16
0
void CIVVehicle::SetBrakePedal(float fBrakePedal)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_fBrakePedal = fBrakePedal;
}
Ejemplo n.º 17
0
void CIVVehicle::SetDirtLevel(float fDirtLevel)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_fDirtLevel = fDirtLevel;
}
//------------------------------------------------------------------------
int CScriptBind_Vehicle::Destroy(IFunctionHandler* pH)
{
	CVehicle* pVehicle = GetVehicle(pH);

	if (!pVehicle)
		return pH->EndFunction();

	pVehicle->Destroy();

	return pH->EndFunction();
}
Ejemplo n.º 19
0
void CIVVehicle::SetDriver(IVPed * pPed)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_pDriver = pPed;
}
Ejemplo n.º 20
0
void CIVVehicle::SetAlarmDuration(WORD wDuration)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_wAlarm = wDuration;
}
Ejemplo n.º 21
0
void CIVVehicle::SetDoorLockState(DWORD dwDoorLockState)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_dwDoorLockState = dwDoorLockState;
}
Ejemplo n.º 22
0
void CIVVehicle::SetPetrolTankHealth(float fPetrolTankHealth)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_fPetrolTankHealth = fPetrolTankHealth;
}
//------------------------------------------------------------------------
int CScriptBind_Vehicle::ChangeSeat(IFunctionHandler* pH, ScriptHandle actorHandle, int seatId, bool isAnimationEnabled)
{
	CVehicle* pVehicle = GetVehicle(pH);
	if (!pVehicle || !actorHandle.n)
		return pH->EndFunction(0);

	bool ret = true;
	pVehicle->ChangeSeat((EntityId)actorHandle.n, seatId, 0 );
	
	return pH->EndFunction(ret);
}
//------------------------------------------------------------------------
int CScriptBind_Vehicle::OnSpawnComplete(IFunctionHandler* pH)
{
	CVehicle* pVehicle = GetVehicle(pH);

	if (!pVehicle)
		return pH->EndFunction();

	pVehicle->OnSpawnComplete();

	return pH->EndFunction();
}
Ejemplo n.º 25
0
void CIVVehicle::SetSteeringAngle(float fSteeringAngle)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_fSteering = fSteeringAngle;
}
Ejemplo n.º 26
0
void CIVVehicle::SetPassenger(BYTE bytePassengerSeatId, IVPed * pPassenger)
{
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
	{
		if(bytePassengerSeatId < 8)
			pVehicle->m_pPassengers[bytePassengerSeatId] = pPassenger;
	}
}
Ejemplo n.º 27
0
void CIVVehicle::SetMaxPassengers(BYTE byteMaxPassengers)
{
#ifdef EXT_LOG
	CLogFile::Printf(__FUNCSIG__);
#endif
	// Do we have a valid vehicle pointer?
	IVVehicle * pVehicle = GetVehicle();

	if(pVehicle)
		pVehicle->m_byteMaxPassengers = byteMaxPassengers;
}
Ejemplo n.º 28
0
void CIVVehicle::SetCarCanBurstTyres(bool bState)
{
	IVVehicle *pVehicle = GetVehicle();
	if(pVehicle)
	{
		if(bState)
			*(BYTE *)(pVehicle + 0xF67) &= 0xEFu;
		else
			*(BYTE *)(pVehicle + 0xF67) |= 0x10u;
	}
}
Ejemplo n.º 29
0
void CIVVehicle::RemoveCarWindow(int iWindow)
{
	IVVehicle * pVehicle = GetVehicle();
	if(pVehicle)
	{
		DWORD dwFunctionAddress = COffsets::FUNC_CVehicle__RemoveVehicleWindow;
		
		_asm	push iWindow;
		_asm	mov ecx, pVehicle;
		_asm	call COffsets::FUNC_CVehicle__RemoveVehicleWindow;
	}
}
Ejemplo n.º 30
0
void CIVVehicle::SetCarCanBeDamaged(bool bDamage)
{
	IVVehicle * pVehicle = GetVehicle();
	if(pVehicle)
	{
		DWORD byteFlagDamage = *(DWORD *)(pVehicle + 0x118); // 280 (flag?)
		if(bDamage)
			*(DWORD *)byteFlagDamage &= 0x400u;
		else
			*(DWORD *)byteFlagDamage |= 0xFFFFFBFFu;
	}
}