5
5
#include < TFE_Jedi/Level/levelData.h>
6
6
#include < TFE_Jedi/Level/rwall.h>
7
7
#include < TFE_Jedi/Level/rsector.h>
8
+ #include < TFE_Jedi/InfSystem/message.h>
8
9
#include < angelscript.h>
9
10
10
11
using namespace TFE_Jedi ;
@@ -169,6 +170,33 @@ namespace TFE_DarkForces
169
170
}
170
171
}
171
172
173
+ // Message with event and arg, eg. GOTO_STOP 131072 2
174
+ void sendMessageToSector (MessageType messageType, u32 evt, u32 msgArg1, ScriptSector* sSector )
175
+ {
176
+ if (!isScriptSectorValid (sSector ))
177
+ {
178
+ return ;
179
+ }
180
+
181
+ // TODO: investigate how to do this safely
182
+ // s_msgArg1 = msgArg1;
183
+
184
+ RSector* sector = &s_levelState.sectors [sSector ->m_id ];
185
+ message_sendToSector (sector, nullptr , evt, messageType);
186
+ }
187
+
188
+ // Message with no event and no arg, eg. NEXT_STOP
189
+ void sendMessageToSector1 (MessageType messageType, ScriptSector* sSector )
190
+ {
191
+ sendMessageToSector (messageType, 0 , 0 , sSector );
192
+ }
193
+
194
+ // Message with event, eg. NEXT_STOP 131072
195
+ void sendMessageToSector2 (MessageType messageType, u32 evt, ScriptSector* sSector )
196
+ {
197
+ sendMessageToSector (messageType, evt, 0 , sSector );
198
+ }
199
+
172
200
void ScriptSector::registerType ()
173
201
{
174
202
s32 res = 0 ;
@@ -185,6 +213,11 @@ namespace TFE_DarkForces
185
213
ScriptObjFunc (" void setFlag(int, uint)" , setSectorFlag);
186
214
ScriptObjFunc (" float2 getCenterXZ()" , getCenterXZ);
187
215
ScriptObjFunc (" Wall getWall(int)" , getWall);
216
+
217
+ ScriptObjFunc (" void sendMessage(int)" , sendMessageToSector1);
218
+ ScriptObjFunc (" void sendMessage(int, uint)" , sendMessageToSector2);
219
+ // ScriptObjFunc("void sendMessage(int, uint, uint)", sendMessageToSector); // For now do not expose the ability to pass an arg
220
+
188
221
// Properties
189
222
ScriptPropertyGetFunc (" float get_floorHeight()" , getFloorHeight);
190
223
ScriptPropertyGetFunc (" float get_ceilHeight()" , getCeilHeight);
0 commit comments