Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
SmartGameObj.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__SMARTGAMEOBJ_H
13#define TT_INCLUDE__SMARTGAMEOBJ_H
14
15#include "scripts.h"
16#include "ArmedGameObj.h"
17#include "Action.h"
18#include "ControlClass.h"
19#include "PhysControllerClass.h"
20#include "SmartGameObjDef.h"
21#include "engine_common.h"
22#include "engine_threading.h"
23#include "engine_string.h"
24#include "engine_vector.h"
25#include "engine_math.h"
26
27class PlayerDataClass;
28class cPacket;
29class StealthEffectClass;
30class SmartGameObj : public ArmedGameObj {
31public:
32 SmartGameObj( void );
33 virtual ~SmartGameObj( void );
34 void Init( const SmartGameObjDef & definition );
35 void Copy_Settings( const SmartGameObjDef & definition );
36 void Re_Init( const SmartGameObjDef & definition );
37 const SmartGameObjDef SCRIPTS_API & Get_Definition( void ) const ;
38 virtual bool Save( ChunkSaveClass & csave );
39 virtual bool Load( ChunkLoadClass & cload );
40 virtual void On_Post_Load(void);
41 void Clear_Control( void ) { Control.Clear_Control(); }
42 void Set_Boolean_Control( ControlClass::BooleanControl control, bool state = true ) { Control.Set_Boolean( control, state ); }
43 void Set_Analog_Control( ControlClass::AnalogControl control, float value ) { Control.Set_Analog( control, value ); }
44 void Import_Control_Cs( BitStreamClass & packet ) { Control.Import_Cs(packet); }
45 void Export_Control_Cs( BitStreamClass & packet ) { Control.Export_Cs(packet); }
46 void Import_Control_Sc( BitStreamClass & packet ) { Control.Import_Sc(packet); }
47 void Export_Control_Sc( BitStreamClass & packet ) { Control.Export_Sc(packet); }
48 ControlClass & Get_Control() { return Control; }
49 void Control_Enable( bool enable ) { ControlEnabled = enable; }
50 bool Is_Control_Enabled( void ) { return ControlEnabled; }
51 void Reset_Controller( void );
52 virtual void Generate_Control( void );
53 enum {
54 SERVER_CONTROL_OWNER = -99999,
55 };
56 int Get_Control_Owner(void) { return ControlOwner; }
57 virtual int Get_Weapon_Control_Owner(void) { return Get_Control_Owner(); }
58 virtual void Set_Control_Owner(int control_owner) { ControlOwner = control_owner; }
59 PlayerDataClass * Get_Player_Data( void ) { return PlayerData; }
60 void Set_Player_Data( PlayerDataClass * player_data );
61 SCRIPTS_API bool Has_Player(void);
62 SCRIPTS_API bool Is_Human_Controlled(void);
63 bool Is_Controlled_By_Me(void);
64 virtual void Apply_Control( void );
65 virtual void Think();
66 virtual void Post_Think();
67 virtual void Apply_Damage( const OffenseObjectClass & damager, float scale = 1.0f, int alternate_skin = -1 );
68 virtual float Get_Max_Speed( void ) { return 10; }
69 virtual float Get_Turn_Rate( void ) { return DEG2RAD(360); }
70 ActionClass *Get_Action( void ) { return &Action; }
71 virtual SmartGameObj *As_SmartGameObj() { return this; };
72 virtual void Import_Frequent( BitStreamClass & packet );
73 virtual void Export_Frequent( BitStreamClass & packet );
74 virtual void Import_State_Cs( BitStreamClass & packet );
75 virtual void Export_State_Cs( BitStreamClass & packet );
76 virtual void Export_Creation( BitStreamClass & packet );
77 virtual void Import_Creation( BitStreamClass & packet );
78 bool Is_Control_Data_Dirty(cPacket & packet);
79 bool SCRIPTS_API Is_Obj_Visible( PhysicalGameObj *obj );
80 bool SCRIPTS_API Is_Splash_Possible( PhysicalGameObj *obj );
81 void Set_Enemy_Seen_Enabled( bool enabled ) { IsEnemySeenEnabled = enabled; }
82 bool Is_Enemy_Seen_Enabled( void ) { return IsEnemySeenEnabled; }
83 virtual Matrix3D Get_Look_Transform(void) { return Get_Transform(); }
84 virtual void Get_Velocity(Vector3 & vel) {vel.Set(0, 0, 0);}
85 virtual bool Is_Visible( void ) { return true; }
86 virtual void On_Logical_Heard (LogicalListenerClass *listener, LogicalSoundClass *sound_obj);
87 virtual void Begin_Hibernation( void );
88 virtual void End_Hibernation( void );
89 virtual void Get_Information( StringClass & string );
90 void Enable_Stealth(bool onoff);
91 void Toggle_Stealth(void);
92 bool Is_Stealth_Enabled(void);
93 bool SCRIPTS_API Is_Stealthed(void) const;
94 virtual float Get_Stealth_Fade_Distance(void) const { return 25.0f; }
95 void Grant_Stealth_Powerup(float seconds);
96 float Remaining_Stealth_Powerup_Time(void);
97 StealthEffectClass * Peek_Stealth_Effect(void) { return StealthEffect; }
98 bool Get_Stealth_Active() { return StealthActive; }
99 void Set_Stealth_Active(bool active) { StealthActive = active; Set_Object_Dirty_Bit(NetworkObjectClass::BIT_FREQUENT,true);}
100#ifndef TTLE_EXPORTS
101 static float Get_Global_Sight_Range_Scale( void ) { return GlobalSightRangeScale; }
102 static void Set_Global_Sight_Range_Scale( float scale ) { GlobalSightRangeScale = scale; }
103#endif
104protected:
105 ControlClass Control;
106 PhysControllerClass Controller;
107 bool ControlEnabled;
108 void Alloc_Stealth_Effect(void);
109 bool StealthEnabled;
110 bool StealthActive;
111 float StealthPowerupTimer;
112 float StealthFiringTimer;
113 StealthEffectClass * StealthEffect;
114private:
115 ActionClass Action;
116 int ControlOwner;
117 PlayerDataClass * PlayerData;
118 bool IsEnemySeenEnabled;
119 float MovingSoundTimer;
120 LogicalListenerClass* Listener;
121 void Register_Listener(void);
122#ifndef TTLE_EXPORTS
123 static REF_DECL(float, GlobalSightRangeScale);
124#endif
125};
126
127
128#endif