Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
MoveablePhysClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE__MOVEABLEPHYSCLASS_H
13#define TT_INCLUDE__MOVEABLEPHYSCLASS_H
14
15#include "DynamicPhysClass.h"
16#include "MoveablePhysDefClass.h"
17#include "DynamicShadowManager.h"
18#include "Matrix3.h"
19class PhysControllerClass;
20class TexProjectClass;
21class DynTexProjectClass;
22class MoveablePhysClass :
23 public DynamicPhysClass
24{
25public:
26 MoveablePhysClass(void);
27 virtual ~MoveablePhysClass(void);
28 void Init(const MoveablePhysDefClass & definition );
29 virtual MoveablePhysClass * As_MoveablePhysClass(void) { return this; }
30 const MoveablePhysDefClass * Get_MoveablePhysDef(void) { return (MoveablePhysDefClass*)Definition; }
31 virtual void Definition_Changed(void);
32 virtual bool Needs_Timestep(void) { return true; }
33 virtual void Post_Timestep_Process(void);
34 virtual void Set_Mass(float mass) { Mass = mass; MassInv = 1.0f / mass; }
35 float Get_Mass(void) { return Mass; }
36 float Get_Mass_Inv(void) { return MassInv; }
37 virtual void Set_Gravity_Multiplier(float grav) { GravScale = grav; }
38 float Get_Gravity_Multiplier(void) const { return GravScale; }
39 virtual void Set_Elasticity(float e) { Elasticity = e; }
40 float Get_Elasticity(void) const { return Elasticity; }
41 virtual void Get_Inertia_Inv(Matrix3 * set_I_inv);
42 virtual bool Can_Teleport(const Matrix3D &new_tm, bool check_dyn_only = false,MultiListClass<PhysClass> * result_list = NULL) { return false; }
43 virtual bool Can_Teleport_And_Stand(const Matrix3D &new_tm, Matrix3D *out) { *out = new_tm; return false; }
44 virtual bool Find_Teleport_Location(const Vector3 &start, float radius, Vector3 *out) { return false; }
45 virtual bool Can_Move_To(const Matrix3D &new_tm) { return false; }
46 virtual bool Cinematic_Move_To(const Matrix3D & new_tm);
47 void Set_Controller(PhysControllerClass * control) { Controller = control; }
48 PhysControllerClass * Get_Controller(void) { return Controller; }
49 virtual bool Save (ChunkSaveClass &csave);
50 virtual bool Load (ChunkLoadClass &cload);
51 virtual void On_Post_Load (void);
52 virtual void Get_Velocity(Vector3 * set_vel) const = 0;
53 virtual void Set_Velocity(const Vector3 & newvel) { }
54 virtual void Get_Shadow_Blob_Box(AABoxClass * set_obj_space_box);
55 virtual bool Is_Casting_Shadow(void) { return ShadowManager.Is_Casting_Shadow(); }
56 virtual void Link_To_Carrier(PhysClass * carrier,RenderObjClass * carrier_sub_obj = NULL);
57 virtual PhysClass * Peek_Carrier_Object(void); // TSS added 08-15-01
58 virtual RenderObjClass * Peek_Carrier_Sub_Object(void);
59protected:
60 float Mass; // 0084 0084 00A0 009C
61 float MassInv; // 0088 0088 00A4 00A0
62 float GravScale; // 008C 008C 00A8 00A4
63 float Elasticity; // 0090 0090 00AC 00A8
64 PhysControllerClass * Controller; // 0094 0094 00B0 00AC
65 PhysClass * Carrier; // 0098 0098 00B4 00B0
66 RenderObjClass * CarrierSubObject; // 009C 009C 00B8 00B4
67 DynamicShadowManagerClass ShadowManager; // 00A0 00A0 00BC 00B8
68
69 MoveablePhysClass(const MoveablePhysClass &);
70 MoveablePhysClass & operator = (const MoveablePhysClass &);
71}; // 00C0 00C0 00DC 00D8
72inline void MoveablePhysClass::Get_Inertia_Inv(Matrix3 * set_I_inv)
73{
74 set_I_inv->Make_Identity();
75 (*set_I_inv)[0][0] = MassInv;
76 (*set_I_inv)[1][1] = MassInv;
77 (*set_I_inv)[2][2] = MassInv;
78}
79
80#endif