//----------------------------------------------------------------------------- // Copyright(c), HL Rally: Source, 2004, All rights reserved. // The contents of this file may only be used / distributed in accordance // with the conditions listed in the supplied license, or with written // permission of the respective authors listed. // // Based of vehicle_jeep.h //----------------------------------------------------------------------------- #define JEEP_WHEEL_COUNT 4 //============================================================================= // // Jeep water data. // struct VehicleWaterData_t { bool m_bWheelInWater[JEEP_WHEEL_COUNT]; bool m_bWheelWasInWater[JEEP_WHEEL_COUNT]; Vector m_vecWheelContactPoints[JEEP_WHEEL_COUNT]; float m_flNextRippleTime[JEEP_WHEEL_COUNT]; bool m_bBodyInWater; bool m_bBodyWasInWater; DECLARE_SIMPLE_DATADESC(); }; //----------------------------------------------------------------------------- // Purpose: Four wheel physics vehicle server vehicle with weaponry //----------------------------------------------------------------------------- class CEntityPropVehicleRallyServerVehicle : public CFourWheelServerVehicle { typedef CFourWheelServerVehicle BaseClass; // IServerVehicle public: bool NPC_HasPrimaryWeapon() { return true; } void NPC_AimPrimaryWeapon(Vector vecTarget); virtual bool IsPassengerUsingStandardWeapons( int nRole = VEHICLE_ROLE_DRIVER ) { return true; } }; //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- class CEntityPropVehicleRally : public CEntityPropVehicleDriveable { DECLARE_CLASS(CEntityPropVehicleRally, CEntityPropVehicleDriveable); public: DECLARE_DATADESC(); DECLARE_SERVERCLASS(); CEntityPropVehicleRally(); // CEntityPropVehicle virtual void ProcessMovement(CBasePlayer *pPlayer, CMoveData *pMoveData); virtual void DriveVehicle(float flFrameTime, CUserCmd *ucmd, int iButtonsDown, int iButtonsReleased); virtual void SetupMove(CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move); virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); virtual void DampenEyePosition(Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles); virtual bool AllowBlockedExit(CBasePlayer *pPlayer, int nRole) { return false; } virtual bool CanExitVehicle(CBaseEntity *pEntity); virtual bool IsVehicleBodyInWater() { return m_WaterData.m_bBodyInWater; } virtual bool IsPassengerUsingStandardWeapons( int nRole = VEHICLE_ROLE_DRIVER ) { return true; } // CBaseEntity void Think(); void Precache(); void Spawn(); virtual void CreateServerVehicle(); virtual Vector BodyTarget(const Vector &posSrc, bool bNoisy = true); virtual void TraceAttack(const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr); virtual int OnTakeDamage(const CTakeDamageInfo &info); virtual void EnterVehicle(CBaseCombatCharacter *pPlayer); virtual void ExitVehicle(int iRole); void AimGunAt(Vector *endPos, float flInterval); const char *GetTracerType() { return "AR2Tracer"; } void DoImpactEffect(trace_t &tr, int nDamageType); bool HeadlightIsOn() { return m_bHeadlightIsOn; } void HeadlightTurnOn() { m_bHeadlightIsOn = true; } void HeadlightTurnOff() { m_bHeadlightIsOn = false; } void ResetPosition(); int m_iLastUpdatePacket; private: void FireCannon(); void ChargeCannon(); void FireChargedCannon(); void DrawBeam(const Vector &startPos, const Vector &endPos, float width); void StopChargeSound(); void GetCannonAim(Vector *resultDir); void InitWaterData(); void HandleWater(); bool CheckWater(); void CheckWaterLevel(); void CreateSplash(const Vector &vecPosition); void CreateRipple(const Vector &vecPosition); void UpdateSteeringAngle(); void CreateDangerSounds(); void ComputePDControllerCoefficients(float *pCoefficientsOut, float flFrequency, float flDampening, float flDeltaTime); void DampenForwardMotion(Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles, float flFrameTime); void DampenUpMotion(Vector &vecVehicleEyePos, QAngle &vecVehicleEyeAngles, float flFrameTime); private: float m_flDangerSoundTime; int m_nBulletType; bool m_bCannonCharging; float m_flCannonTime; float m_flCannonChargeStartTime; Vector m_vecGunOrigin; CSoundPatch *m_sndCannonCharge; int m_nSpinPos; float m_aimYaw; float m_aimPitch; float m_throttleDisableTime; // handbrake after the fact to keep vehicles from rolling float m_flHandbrakeTime; bool m_bInitialHandbrake; float m_flOverturnedTime; Vector m_vecLastEyePos; Vector m_vecLastEyeTarget; Vector m_vecEyeSpeed; Vector m_vecTargetSpeed; VehicleWaterData_t m_WaterData; int m_iNumberOfEntries; CNetworkVar(bool, m_bHeadlightIsOn); CNetworkVar(float, m_fServerTime); CNetworkVar(AngularImpulse, m_aiAngularVelocityChassis); };