Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
ScriptableGameObj.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_SCRIPTABLEGAMEOBJ_H
13#define TT_INCLUDE_SCRIPTABLEGAMEOBJ_H
14class ScriptableGameObj;
15#include "audiocallback.h"
16#include "scripts.h"
17#include "ReferencerClass.h"
18#include "BaseGameObj.h"
19#include "engine_vector.h"
20class SoundSceneObjClass;
21class LogicalListenerClass;
22class LogicalSoundClass;
23class DamageableGameObj;
24class BuildingGameObj;
25class SoldierGameObj;
26class ScriptZoneGameObj;
27class GameObjObserverTimerClass;
28class GameObjCustomTimerClass;
29class ScriptableGameObjDef;
30class ScriptableGameObj : public BaseGameObj, public ReferenceableGameObj, public AudioCallbackClass
31{
32public:
33 ScriptableGameObj( void );
34 virtual ~ScriptableGameObj( void );
35 void Init( const ScriptableGameObjDef & definition );
36 void Copy_Settings( const ScriptableGameObjDef & definition );
37 void Re_Init( const ScriptableGameObjDef & definition );
38 virtual void Post_Re_Init( void );
39 const ScriptableGameObjDef SCRIPTS_API & Get_Definition( void ) const ;
40 virtual void Set_Delete_Pending (void);
41 virtual bool Save( ChunkSaveClass & csave );
42 virtual bool Load( ChunkLoadClass & cload );
43 virtual void On_Post_Load( void );
44 virtual void Think();
45 virtual void Post_Think();
46 virtual void Get_Position(Vector3 * set_pos) const = 0;
47 void SCRIPTS_API Add_Observer( GameObjObserverClass * observer );
48 void SCRIPTS_API Remove_Observer( GameObjObserverClass * observer );
49 SCRIPTS_API GameObjObserverClass *Find_Observer(const char *Name);
50 void Remove_All_Observers(void);
51 void Start_Observers( void );
52 const SimpleDynVecClass<GameObjObserverClass *> & Get_Observers( void ) { return Observers; }
53 void SCRIPTS_API Insert_Observer( GameObjObserverClass * observer );
54 void Start_Observer_Timer( int observer_id, float duration, int timer_id );
55 void Stop_Observer_Timer( int timer_id );
56 void Stop_Observer_Timer( int observer_id, int timer_id );
57 bool Has_Observer_Timer( int observer_id, int timer_id );
58 void Start_Custom_Timer( ScriptableGameObj * from, float delay, int type, int param );
59 virtual ScriptableGameObj *As_ScriptableGameObj( void ) { return this; };
60 virtual DamageableGameObj *As_DamageableGameObj( void ) { return NULL; };
61 virtual BuildingGameObj *As_BuildingGameObj( void ) { return NULL; };
62 virtual SoldierGameObj *As_SoldierGameObj( void ) { return NULL; };
63 virtual ScriptZoneGameObj *As_ScriptZoneGameObj( void ) { return NULL; };
64 ReferenceableGameObj * As_ReferenceableGameObj( void ) { return this; }
65 virtual void Get_Information( StringClass & string );
66 virtual void On_Sound_Ended( SoundSceneObjClass *sound_obj );
67 virtual bool Is_Always_Dirty( void ) { return true; }
68 virtual void Export_Creation( BitStreamClass &packet );
69 virtual void Import_Creation( BitStreamClass &packet );
70
71 bool hasObservers() const { return Observers.Count() != 0; }
72protected:
73 bool ObserverCreatedPending; // 06E8
74 bool ObserversStarted; //06E9
75 SimpleDynVecClass<GameObjObserverClass *> Observers; // 06EC
76 DynamicVectorClass<GameObjObserverTimerClass *> ObserverTimerList; // 06FC
77 DynamicVectorClass<GameObjCustomTimerClass *> CustomTimerList; // 0714
78}; // 072C
79
80#endif