motorcycle.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WWPhys *
  23. * *
  24. * $Archive:: /Commando/Code/wwphys/motorcycle.h $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 8/17/01 8:41p $*
  29. * *
  30. * $Revision:: 13 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef MOTORCYCLE_H
  39. #define MOTORCYCLE_H
  40. #ifndef ALWAYS_H
  41. #include "always.h"
  42. #endif
  43. #ifndef WHEELVEHICLE_H
  44. #include "wheelvehicle.h"
  45. #endif
  46. class MotorcycleDefClass;
  47. /**
  48. ** MotorcycleClass
  49. ** This is a derivation of WheeledVehicleClass which adds self-balancing and
  50. ** leaning into turns.
  51. */
  52. class MotorcycleClass : public WheeledVehicleClass
  53. {
  54. public:
  55. MotorcycleClass(void);
  56. virtual ~MotorcycleClass(void);
  57. virtual MotorcycleClass * As_MotorcycleClass(void) { return this; }
  58. void Init(const MotorcycleDefClass & def);
  59. // State variables
  60. float Get_Lean_Value(void) { return LeanValue; }
  61. // Save-Load system
  62. virtual const PersistFactoryClass & Get_Factory (void) const;
  63. virtual bool Save (ChunkSaveClass &csave);
  64. virtual bool Load (ChunkLoadClass &cload);
  65. protected:
  66. float LeanK0;
  67. float LeanK1;
  68. float LeanValue; // how much the character should be leaning to balance the bike
  69. virtual void Compute_Force_And_Torque(Vector3 * force,Vector3 * torque);
  70. virtual void Compute_Inertia(void);
  71. private:
  72. MotorcycleClass(const MotorcycleClass &);
  73. MotorcycleClass & operator = (const MotorcycleClass &);
  74. };
  75. /*
  76. ** MotorcycleDefClass - Initialization Structure/Factory/Editor Integration for a MotorcycleClass
  77. */
  78. class MotorcycleDefClass : public WheeledVehicleDefClass
  79. {
  80. public:
  81. MotorcycleDefClass (void);
  82. // From DefinitionClass
  83. virtual uint32 Get_Class_ID (void) const;
  84. virtual PersistClass * Create(void) const;
  85. // From PhysDefClass
  86. virtual const char * Get_Type_Name(void) { return "MotorcycleDef"; }
  87. virtual bool Is_Type(const char *);
  88. // From PersistClass
  89. virtual const PersistFactoryClass & Get_Factory (void) const;
  90. virtual bool Save(ChunkSaveClass &csave);
  91. virtual bool Load(ChunkLoadClass &cload);
  92. // Editable interface requirements
  93. DECLARE_EDITABLE(MotorcycleDefClass,WheeledVehicleDefClass);
  94. protected:
  95. float LeanK0;
  96. float LeanK1;
  97. friend class MotorcycleClass;
  98. };
  99. #endif