Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MissionEvent.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: MissionEvent.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Events for mission scripting
13 */
14 
15 #ifndef MissionEvent_h
16 #define MissionEvent_h
17 
18 #include "Types.h"
19 #include "List.h"
20 #include "Text.h"
21 #include "Geometry.h"
22 #include "Bitmap.h"
23 
24 // +--------------------------------------------------------------------+
25 
26 class Mission;
27 class MissionElement;
28 class MissionLoad;
29 class MissionEvent;
30 
31 class Ship;
32 class System;
33 class Element;
34 class ShipDesign;
35 class WeaponDesign;
36 class StarSystem;
37 class Instruction;
38 class Sound;
39 
40 // +--------------------------------------------------------------------+
41 
43 {
44  friend class Mission;
45  friend class MissionTemplate;
46  friend class MsnEditDlg;
47  friend class MsnEventDlg;
48 
49 public:
50  static const char* TYPENAME() { return "MissionEvent"; }
51 
52  enum EVENT_TYPE {
56  IFF,
62 
69 
71  };
72 
73  enum EVENT_STATUS {
75  };
76 
84  };
85 
86  MissionEvent();
87  ~MissionEvent();
88 
89  // operations:
90  void ExecFrame(double seconds);
91  void Activate();
92 
93  virtual bool CheckTrigger();
94  virtual void Execute(bool silent=false);
95  virtual void Skip();
96 
97  // accessors:
98  int EventID() const { return id; }
99  int Status() const { return status; }
100  bool IsPending() const { return status == PENDING; }
101  bool IsActive() const { return status == ACTIVE; }
102  bool IsComplete() const { return status == COMPLETE; }
103  bool IsSkipped() const { return status == SKIPPED; }
104 
105  double Time() const { return time; }
106  double Delay() const { return delay; }
107 
108  int Event() const { return event; }
109  const char* EventName() const;
110  Text EventShip() const { return event_ship; }
111  Text EventSource() const { return event_source; }
112  Text EventTarget() const { return event_target; }
113  Text EventMessage() const { return event_message; }
114  Text EventSound() const { return event_sound; }
115 
116  int EventParam(int index=0) const;
117  int NumEventParams() const;
118 
119  int EventChance() const { return event_chance; }
120  Point EventPoint() const { return event_point; }
121  Rect EventRect() const { return event_rect; }
122 
123  int Trigger() const { return trigger; }
124  const char* TriggerName() const;
125  Text TriggerShip() const { return trigger_ship; }
126  Text TriggerTarget() const { return trigger_target; }
127 
128  Text TriggerParamStr() const;
129  int TriggerParam(int index=0) const;
130  int NumTriggerParams() const;
131 
132  static const char* EventName(int n);
133  static int EventForName(const char* n);
134  static const char* TriggerName(int n);
135  static int TriggerForName(const char* n);
136 
137 protected:
138  int id;
139  int status;
140  double time;
141  double delay;
142 
143  int event;
149  int event_param[10];
154 
155  int trigger;
158  int trigger_param[10];
160 
163 };
164 
165 
166 #endif MissionEvent_h
167