Debian Codegraph @

scripts/lnx/osiris_import.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifdef __OSIRIS_IMPORT_H_
20 #define OSIRISEXTERN extern
21 #else
22 #define OSIRISEXTERN
23 #endif
24
25 #include "osiris_common.h"
26
27 // ===========================================================
28
29 // void mprintf(int n, const char *format, ... );
30 // prints a debug message out to the monochrome monitor
31 typedef void (*mprintf_fp)(int n, const char *format, ...);
32 OSIRISEXTERN mprintf_fp mprintf;
33
34 // The main calling function for multisafe functions
35 typedef void (*MSafe_CallFunction_fp)(int type, msafe_struct *mstruct);
36 OSIRISEXTERN MSafe_CallFunction_fp MSafe_CallFunction;
37
38 // The main calling function for extracting multisafe data
39 typedef void (*MSafe_GetValue_fp)(int type, msafe_struct *mstruct);
40 OSIRISEXTERN MSafe_GetValue_fp MSafe_GetValue;
41
42 // bool Obj_CallEvent(int objnum,int event,tOSIRISEventInfo *ei);
43 // Sends an event to an object. Returns true if the default action should
44 // continue to process.
45 typedef bool (*Obj_CallEvent_fp)(int objnum, int event, tOSIRISEventInfo *ei);
46 OSIRISEXTERN Obj_CallEvent_fp Obj_CallEvent;
47
48 // bool Trgr_CallEvent(int trignum,int event,tOSIRISEventInfo *ei);
49 // Sends an event to a trigger. Returns true if the default action should
50 // continue to process.
51 typedef bool (*Trgr_CallEvent_fp)(int trignum, int event, tOSIRISEventInfo *ei);
52 OSIRISEXTERN Trgr_CallEvent_fp Trgr_CallEvent;
53
54 // void Sound_TouchFile(char *sound_name);
55 // Touches a sound file so it loads into memory
56 typedef void (*Sound_TouchFile_fp)(char *sound_name);
57 OSIRISEXTERN Sound_TouchFile_fp Sound_TouchFile;
58
59 // int Obj_FindID(const char *object_name);
60 // searches for an object id given it's name
61 typedef int (*Obj_FindID_fp)(const char *object_name);
62 OSIRISEXTERN Obj_FindID_fp Obj_FindID;
63
64 // int Obj_FindType(const char *object_name);
65 // searches for an object type given it's name
66 typedef int (*Obj_FindType_fp)(const char *object_name);
67 OSIRISEXTERN Obj_FindType_fp Obj_FindType;
68
69 // int Wpn_FindID(const char *weapon_name);
70 // searches through the weapons for a name and returns the id
71 typedef int (*Wpn_FindID_fp)(const char *weapon_name);
72 OSIRISEXTERN Wpn_FindID_fp Wpn_FindID;
73
74 // float Obj_GetTimeLived(int objhandle);
75 // returns how long an object has lived
76 typedef float (*Obj_GetTimeLived_fp)(int objhandle);
77 OSIRISEXTERN Obj_GetTimeLived_fp Obj_GetTimeLived;
78
79 // void Obj_GetGunPos(int objhandle,int gun_number,vector *gun_pnt,vector *gun_normal);
80 // returns information about a gunpoint of an object
81 typedef void (*Obj_GetGunPos_fp)(int objhandle, int gun_number, vector *gun_pnt, vector *gun_normal = NULL);
82 OSIRISEXTERN Obj_GetGunPos_fp Obj_GetGunPos;
83
84 // void Obj_GetGroundPos(int objhandle,int ground_number,vector *ground_pnt,vector *ground_normal);
85 // returns information about a groundpoint of an object
86 typedef void (*Obj_GetGroundPos_fp)(int objhandle, int ground_number, vector *ground_pnt, vector *ground_normal = NULL);
87 OSIRISEXTERN Obj_GetGroundPos_fp Obj_GetGroundPos;
88
89 // void Room_Value(int roomnum, char op, char vhandle, void *ptr);
90 typedef void (*Room_Value_fp)(int roomnum, char op, char vhandle, void *ptr, int index = 0);
91 OSIRISEXTERN Room_Value_fp Room_Value;
92
93 // uint8_t Room_IsValid(int roomnum);
94 // returns 0 if the room is not valid. 1 if the room is a terrain cell. 2 if the room is a room segment
95 typedef uint8_t (*Room_IsValid_fp)(int roomnum);
96 OSIRISEXTERN Room_IsValid_fp Room_IsValid;
97
98 // int Obj_GetAttachParent(int childhandle);
99 // returns the handle to the parent of the given attached child
100 typedef int (*Obj_GetAttachParent_fp)(int childhandle);
101 OSIRISEXTERN Obj_GetAttachParent_fp Obj_GetAttachParent;
102
103 // int Obj_GetNumAttachSlots(int objhandle);
104 // returns the number of attach slots an object has.
105 typedef int (*Obj_GetNumAttachSlots_fp)(int objhandle);
106 OSIRISEXTERN Obj_GetNumAttachSlots_fp Obj_GetNumAttachSlots;
107
108 // int Obj_GetAttachChildHandle(int objhandle,char attachpoint);
109 // returns the handle to the child attached on the specified attach point of an object
110 typedef int (*Obj_GetAttachChildHandle_fp)(int objhandle, char attachpoint);
111 OSIRISEXTERN Obj_GetAttachChildHandle_fp Obj_GetAttachChildHandle;
112
113 // int Obj_AttachObjectAP(int parenthandle,char parent_ap,int childhandle,char child_ap,uint8_t f_use_aligned);
114 // Attaches one object to another object based on their attach points
115 typedef int (*Obj_AttachObjectAP_fp)(int parenthandle, char parent_ap, int childhandle, char child_ap,
116 uint8_t f_use_aligned);
117 OSIRISEXTERN Obj_AttachObjectAP_fp Obj_AttachObjectAP;
118
119 // int Obj_AttachObjectRad(int parenthandle,char parent_ap,int childhandle,float percent_rad);
120 // Attached one object to another based on radius
121 typedef int (*Obj_AttachObjectRad_fp)(int parenthandle, char parent_ap, int childhandle, float percent_rad);
122 OSIRISEXTERN Obj_AttachObjectRad_fp Obj_AttachObjectRad;
123
124 // void Obj_UnattachFromParent(int objhandle);
125 // Detaches an object from it's parent
126 typedef void (*Obj_UnattachFromParent_fp)(int objhandle);
127 OSIRISEXTERN Obj_UnattachFromParent_fp Obj_UnattachFromParent;
128
129 // void Obj_UnattachChild(int objhandle,char parent_ap);
130 // Detaches a child object from it's parent
131 typedef void (*Obj_UnattachChild_fp)(int objhandle, char parent_ap);
132 OSIRISEXTERN Obj_UnattachChild_fp Obj_UnattachChild;
133
134 // void Obj_UnattachChildren(int objhandle);
135 // Detaches all children from a parent
136 typedef void (*Obj_UnattachChildren_fp)(int objhandle);
137 OSIRISEXTERN Obj_UnattachChildren_fp Obj_UnattachChildren;
138
139 // int FVI_RayCast(int objhandle,vector *p0,vector *p1,int start_roomnum,float rad,int flags,ray_info *ri);
140 // Shoots out a ray, returns it's fate
141 typedef int (*FVI_RayCast_fp)(int objhandle, vector *p0, vector *p1, int start_roomnum, float rad, int flags,
142 ray_info *ri);
143 OSIRISEXTERN FVI_RayCast_fp FVI_RayCast;
144
145 // int AI_GetPathID(char *string);
146 // searches through GamePath index and returns index of path matching name returns -1 if not found
147 typedef int (*AI_GetPathID_fp)(char *string);
148 OSIRISEXTERN AI_GetPathID_fp AI_GetPathID;
149
150 // int AI_GoalFollowPathSimple(int objhandle,int path_id,int guid,int flags);
151 typedef int (*AI_GoalFollowPathSimple_fp)(int objhandle, int path_id, int guid, int flags, int slot = 3);
152 OSIRISEXTERN AI_GoalFollowPathSimple_fp AI_GoalFollowPathSimple;
153
154 // int AI_PowerSwitch(int objhandle,uint8_t f_power_on);
155 typedef int (*AI_PowerSwitch_fp)(int objhandle, uint8_t f_power_on);
156 OSIRISEXTERN AI_PowerSwitch_fp AI_PowerSwitch;
157
158 // void AI_Value(int objhandle, char op, char vtype, void *ptr);
159 typedef void (*AI_Value_fp)(int objhandle, char op, char vtype, void *ptr);
160 OSIRISEXTERN AI_Value_fp AI_Value;
161
162 // void Obj_Value(int objhandle, char op, char vtype, void *ptr);
163 typedef void (*Obj_Value_fp)(int objhandle, char op, char vtype, void *ptr, int index = 0);
164 OSIRISEXTERN Obj_Value_fp Obj_Value;
165
166 // void Matcen_Value(int matcen_handle, char op, char vtype, void *ptr, int prod_index = 0);
167 typedef void (*Matcen_Value_fp)(int matcen_handle, char op, char vtype, void *ptr, int prod_index = 0);
168 OSIRISEXTERN Matcen_Value_fp Matcen_Value;
169
170 // uint8_t AI_TurnTowardsVectors(int objhandle,vector *fvec,vector *uvec);
171 typedef uint8_t (*AI_TurnTowardsVectors_fp)(int objhandle, vector *fvec, vector *uvec);
172 OSIRISEXTERN AI_TurnTowardsVectors_fp AI_TurnTowardsVectors;
173
174 // void AI_SetType(int objhandle,int type);
175 typedef void (*AI_SetType_fp)(int objhandle, int type);
176 OSIRISEXTERN AI_SetType_fp AI_SetType;
177
178 // vector AI_FindHidePos(int hideobjhandle,int viewobjhandle,float time,int *hide_room);
179 typedef vector (*AI_FindHidePos_fp)(int hideobjhandle, int viewobjhandle, float time, int *hide_room);
180 OSIRISEXTERN AI_FindHidePos_fp AI_FindHidePos;
181
182 // int AI_GoalAddEnabler(int objhandle,int goal_index,int enabler_type,float percent,float interval,void *ptr);
183 typedef int (*AI_GoalAddEnabler_fp)(int objhandle, int goal_index, int enabler_type, float percent, float interval,
184 void *ptr);
185 OSIRISEXTERN AI_GoalAddEnabler_fp AI_GoalAddEnabler;
186
187 // int AI_AddGoal(int objhandle,int goal_type,int level,float influence, int guid, int flags, ... );
188 typedef float (*AI_AddGoal_fp)(int objhandle, int goal_type, int level, float influence, int guid, int flags, ...);
189 OSIRISEXTERN AI_AddGoal_fp AI_AddGoal;
190
191 // void AI_ClearGoal(int objhandle,int goal_index);
192 typedef void (*AI_ClearGoal_fp)(int objhandle, int goal_index);
193 OSIRISEXTERN AI_ClearGoal_fp AI_ClearGoal;
194
195 // int AI_FindObjOfType(int objhandle,int type, bool f_ignore_init_room, int parent_handle = OBJECT_HANDLE_NONE);
196 typedef int (*AI_FindObjOfType_fp)(int objhandle, int type, int id, bool f_ignore_init_room,
197 int parent_handle = OBJECT_HANDLE_NONE);
198 OSIRISEXTERN AI_FindObjOfType_fp AI_FindObjOfType;
199
200 // vector AI_GetRoomPathPoint(int roomnum);
201 typedef vector (*AI_GetRoomPathPoint_fp)(int roomnum);
202 OSIRISEXTERN AI_GetRoomPathPoint_fp AI_GetRoomPathPoint;
203
204 // int AI_FindEnergyCenter(int objhandle);
205 typedef int (*AI_FindEnergyCenter_fp)(int objhandle);
206 OSIRISEXTERN AI_FindEnergyCenter_fp AI_FindEnergyCenter;
207
208 // float AI_GetDistToObj(int objhandle,int otherobjhandle);
209 typedef float (*AI_GetDistToObj_fp)(int objhandle, int otherobjhandle);
210 OSIRISEXTERN AI_GetDistToObj_fp AI_GetDistToObj;
211
212 // int AI_SetGoalFlags(int objhandle,int goal_handle,int flags,uint8_t f_enable);
213 typedef int (*AI_SetGoalFlags_fp)(int objhandle, int goal_handle, int flags, uint8_t f_enable);
214 OSIRISEXTERN AI_SetGoalFlags_fp AI_SetGoalFlags;
215
216 // void AI_SetGoalCircleDist(int objhandle,int goal_handle,float dist);
217 typedef void (*AI_SetGoalCircleDist_fp)(int objhandle, int goal_handle, float dist);
218 OSIRISEXTERN AI_SetGoalCircleDist_fp AI_SetGoalCircleDist;
219
220 // int File_ReadBytes(uint8_t *buffer, int count, void *fileptr);
221 // Reads the specified number of bytes from a file into the buffer
222 // DO NOT USE THIS TO READ STRUCTURES. This function is for byte
223 // data, such as a string or a bitmap of 8-bit pixels.
224 // Returns the number of bytes read.
225 // Throws an exception of type (cfile_error *) if the OS returns an error on read
226 typedef int (*File_ReadBytes_fp)(uint8_t *buffer, int count, void *fileptr);
227 OSIRISEXTERN File_ReadBytes_fp File_ReadBytes;
228
229 // int File_ReadInt(void *fileptr);
230 // The following functions read numeric vales from a CFILE. All values are
231 // stored in the file in Intel (little-endian) format. These functions
232 // will convert to big-endian if required.
233 // These funtions will throw an exception of if the value cannot be read,
234 // so do not call these if you don't require the data to be present.
235
236 // Read and return an integer (32 bits)
237 // Throws an exception of type (cfile_error *) if the OS returns an error on read
238 typedef int (*File_ReadInt_fp)(void *fileptr);
239 OSIRISEXTERN File_ReadInt_fp File_ReadInt;
240
241 // int16_t File_ReadShort(void *fileptr);
242 // Read and return a int16_t (16 bits)
243 // Throws an exception of type (cfile_error *) if the OS returns an error on read
244 typedef int16_t (*File_ReadShort_fp)(void *fileptr);
245 OSIRISEXTERN File_ReadShort_fp File_ReadShort;
246
247 // int8_t File_ReadByte(void *fileptr);
248 // Read and return a byte (8 bits)
249 // Throws an exception of type (cfile_error *) if the OS returns an error on read
250 typedef int8_t (*File_ReadByte_fp)(void *fileptr);
251 OSIRISEXTERN File_ReadByte_fp File_ReadByte;
252
253 // float File_ReadFloat(void *fileptr);
254 // Read and return a float (32 bits)
255 // Throws an exception of type (cfile_error *) if the OS returns an error on read
256 typedef float (*File_ReadFloat_fp)(void *fileptr);
257 OSIRISEXTERN File_ReadFloat_fp File_ReadFloat;
258
259 // double File_ReadDouble(void *fileptr);
260 // Read and return a double (64 bits)
261 // Throws an exception of type (cfile_error *) if the OS returns an error on read
262 typedef double (*File_ReadDouble_fp)(void *fileptr);
263 OSIRISEXTERN File_ReadDouble_fp File_ReadDouble;
264
265 // int File_ReadString(char *buf,size_t n,void *fileptr);
266 // Reads a string from a CFILE. If the file is type binary, this
267 // function reads until a NULL or EOF is found. If the file is text,
268 // the function reads until a newline or EOF is found. The string is always
269 // written to the destination buffer null-terminated, without the newline.
270 // Parameters: buf - where the string is written
271 // n - the maximum string length, including the terminating 0
272 // cfp - the CFILE pointer
273 // Returns the number of bytes in the string, before the terminator
274 // Does not generate an exception on EOF
275 typedef int (*File_ReadString_fp)(char *buf, size_t n, void *fileptr);
276 OSIRISEXTERN File_ReadString_fp File_ReadString;
277
278 // int File_WriteBytes(const uint8_t *buf,int count,void *fileptr);
279 // Writes the specified number of bytes from a file into the buffer
280 // DO NOT USE THIS TO WRITE STRUCTURES. This function is for byte
281 // data, such as a string or a bitmap of 8-bit pixels.
282 // Returns the number of bytes written.
283 // Throws an exception of type (cfile_error *) if the OS returns an error on write
284 typedef int (*File_WriteBytes_fp)(const uint8_t *buf, int count, void *fileptr);
285 OSIRISEXTERN File_WriteBytes_fp File_WriteBytes;
286
287 // int File_WriteString(const char *buf,void *fileptr);
288 // Writes a null-terminated string to a file. If the file is type binary,
289 // the string is terminated in the file with a null. If the file is type
290 // text, the string is terminated with a newline.
291 // Parameters: buf - pointer to the string
292 // cfp = the CFILE pointer
293 // Returns the number of bytes written
294 // Throws an exception of type (cfile_error *) if the OS returns an error on write
295 typedef int (*File_WriteString_fp)(const char *buf, void *fileptr);
296 OSIRISEXTERN File_WriteString_fp File_WriteString;
297
298 // void File_WriteInt(int i,void *fileptr);
299 // The following functions write numeric vales to a CFILE. All values are
300 // stored to the file in Intel (little-endian) format.
301 // All these throw an exception if there's an error on write.
302
303 // Write an integer (32 bits)
304 // Throws an exception of type (cfile_error *) if the OS returns an error on write
305 typedef void (*File_WriteInt_fp)(int i, void *fileptr);
306 OSIRISEXTERN File_WriteInt_fp File_WriteInt;
307
308 // void File_WriteShort(int16_t s,void *fileptr);
309 // Write a int16_t (16 bits)
310 // Throws an exception of type (cfile_error *) if the OS returns an error on write
311 typedef void (*File_WriteShort_fp)(int16_t s, void *fileptr);
312 OSIRISEXTERN File_WriteShort_fp File_WriteShort;
313
314 // void File_WriteByte(int8_t b,void *fileptr);
315 // Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair.
316 // Throws an exception of type (cfile_error *) if the OS returns an error on write
317 typedef void (*File_WriteByte_fp)(int8_t b, void *fileptr);
318 OSIRISEXTERN File_WriteByte_fp File_WriteByte;
319
320 // void File_WriteFloat(float f,void *fileptr);
321 // Write a float (32 bits)
322 // Throws an exception of type (cfile_error *) if the OS returns an error on write
323 typedef void (*File_WriteFloat_fp)(float f, void *fileptr);
324 OSIRISEXTERN File_WriteFloat_fp File_WriteFloat;
325
326 // void File_WriteDouble(double d,void *fileptr);
327 // Write a double (64 bits)
328 // Throws an exception of type (cfile_error *) if the OS returns an error on write
329 typedef void (*File_WriteDouble_fp)(double d, void *fileptr);
330 OSIRISEXTERN File_WriteDouble_fp File_WriteDouble;
331
332 // void *Scrpt_MemAlloc(tOSIRISMEMCHUNK *mem_info);
333 // Allocates a chunk of memory to be associated with a script. It will automatically
334 // save this memory to disk on game save, and will pass the pointer to this memory on EVT_MEMRESTORE
335 typedef void *(*Scrpt_MemAlloc_fp)(tOSIRISMEMCHUNK *mem_info);
336 OSIRISEXTERN Scrpt_MemAlloc_fp Scrpt_MemAlloc;
337
338 // void Scrpt_MemFree(void *memory_ptr);
339 // Frees a chunk of memory that was allocated by Scrpt_MemAlloc().
340 typedef void (*Scrpt_MemFree_fp)(void *memory_ptr);
341 OSIRISEXTERN Scrpt_MemFree_fp Scrpt_MemFree;
342
343 // void Scrpt_CancelTimer(int timer_id);
344 // Cancels a timer thats in use, given it's ID
345 typedef void (*Scrpt_CancelTimer_fp)(int timer_id);
346 OSIRISEXTERN Scrpt_CancelTimer_fp Scrpt_CancelTimer;
347
348 // int Scrpt_CreateTimer(tOSIRISTIMER *timer_info);
349 // Adds a timer to the list to be processed. You'll receive a EVT_TIMER when the timer is signaled.
350 // Returns an id to the timer, which can be used to cancel a timer. -1 on error.
351 typedef int (*Scrpt_CreateTimer_fp)(tOSIRISTIMER *timer_info);
352 OSIRISEXTERN Scrpt_CreateTimer_fp Scrpt_CreateTimer;
353
354 // void MSafe_DoPowerup (msafe_struct *mstruct);
355 // Does whatever magic needs to be done to get the default powerups to work
356 typedef void (*MSafe_DoPowerup_fp)(msafe_struct *mstruct);
357 OSIRISEXTERN MSafe_DoPowerup_fp MSafe_DoPowerup;
358
359 // int Obj_Create()(uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle)
360 typedef int (*Obj_Create_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient = NULL,
361 int parent_handle = OBJECT_HANDLE_NONE, vector *initial_velocity = NULL);
362 OSIRISEXTERN Obj_Create_fp Obj_Create;
363
364 // float Game_GetTime() (void)
365 typedef float (*Game_GetTime_fp)(void);
366 OSIRISEXTERN Game_GetTime_fp Game_GetTime;
367
368 // float Game_GetFrameTime() (void)
369 typedef float (*Game_GetFrameTime_fp)(void);
370 OSIRISEXTERN Game_GetFrameTime_fp Game_GetFrameTime;
371
372 // void Obj_WBValue() (int obj_handle, char wb_index, char op, char vtype, void *ptr, char g_index)
373 typedef void (*Obj_WBValue_fp)(int obj_handle, char wb_index, char op, char vtype, void *ptr, char g_index = 0);
374 OSIRISEXTERN Obj_WBValue_fp Obj_WBValue;
375
376 // uint8_t Scrpt_TimerExists(int handle);
377 typedef uint8_t (*Scrpt_TimerExists_fp)(int handle);
378 OSIRISEXTERN Scrpt_TimerExists_fp Scrpt_TimerExists;
379
380 typedef void (*Matcen_Reset_fp)(int handle);
381 OSIRISEXTERN Matcen_Reset_fp Matcen_Reset;
382
383 typedef void (*Matcen_Copy_fp)(int dhandle, int shandle);
384 OSIRISEXTERN Matcen_Copy_fp Matcen_Copy;
385
386 typedef int (*Matcen_Create_fp)(char *name);
387 OSIRISEXTERN Matcen_Create_fp Matcen_Create;
388
389 typedef int (*Matcen_FindID_fp)(char *str);
390 OSIRISEXTERN Matcen_FindID_fp Matcen_FindID;
391
392 // void Msn_FlagSet(int flag,uint8_t value);
393 // Sets/Clears mission flags. flag is which mission flag to set/clear (1-32)
394 // value is 0 to clear, or 1 to set
395 typedef void (*Msn_FlagSet_fp)(int flag, uint8_t value);
396 OSIRISEXTERN Msn_FlagSet_fp Msn_FlagSet;
397
398 // int Msn_FlagGet(int flag);
399 // Gets a mission flag. flag is what mission flag to get. Returns 1 if set, 0 if not.
400 typedef int (*Msn_FlagGet_fp)(int flag);
401 OSIRISEXTERN Msn_FlagGet_fp Msn_FlagGet;
402
403 typedef void (*Player_Value_fp)(int obj_handle, char op, char vhandle, void *ptr, int index = 0);
404 OSIRISEXTERN Player_Value_fp Player_Value;
405
406 typedef void (*Obj_SetCustomAnim_fp)(int handle, float start, float end, float time, char flags, int sound_handle = -1,
407 char next_anim_type = -1);
408 OSIRISEXTERN Obj_SetCustomAnim_fp Obj_SetCustomAnim;
409
410 typedef void (*Player_AddHudMessage_fp)(int handle, const char *str);
411 OSIRISEXTERN Player_AddHudMessage_fp Player_AddHudMessage;
412
413 typedef void (*Obj_Ghost_fp)(int handle, bool f_ghost);
414 OSIRISEXTERN Obj_Ghost_fp Obj_Ghost;
415
416 typedef void (*Obj_Burning_fp)(int handle, float time, float damage_per_second = 1.0f);
417 OSIRISEXTERN Obj_Burning_fp Obj_Burning;
418
419 typedef bool (*Obj_IsEffect_fp)(int handle, int type_flag);
420 OSIRISEXTERN Obj_IsEffect_fp Obj_IsEffect;
421
422 // opens a cfile for reading/writing (works just like fopen())
423 typedef void *(*File_Open_fp)(const char *filename, const char *mode);
424 OSIRISEXTERN File_Open_fp File_Open;
425
426 // closes a cfile (like fclose())
427 typedef void (*File_Close_fp)(void *fileptr);
428 OSIRISEXTERN File_Close_fp File_Close;
429
430 // returns the current position of the file (like ftell())
431 typedef int (*File_Tell_fp)(void *fileptr);
432 OSIRISEXTERN File_Tell_fp File_Tell;
433
434 // returns 1 if the file is at the EOF, else 0 (like feof())
435 typedef uint8_t (*File_eof_fp)(void *fileptr);
436 OSIRISEXTERN File_eof_fp File_eof;
437
438 typedef void (*Sound_Stop_fp)(int s_handle, bool f_immediately = false);
439 OSIRISEXTERN Sound_Stop_fp Sound_Stop;
440
441 typedef int (*Sound_Play2d_fp)(int obj_handle, int s_id, float volume = 1.0f);
442 OSIRISEXTERN Sound_Play2d_fp Sound_Play2d;
443
444 typedef int (*Sound_Play3d_fp)(int obj_handle, int s_id, float volume = 1.0f);
445 OSIRISEXTERN Sound_Play3d_fp Sound_Play3d;
446
447 typedef int (*Sound_FindId_fp)(const char *s_name);
448 OSIRISEXTERN Sound_FindId_fp Sound_FindId;
449
450 typedef bool (*AI_IsObjFriend_fp)(int obj_handle, int it_handle);
451 OSIRISEXTERN AI_IsObjFriend_fp AI_IsObjFriend;
452
453 typedef bool (*AI_IsObjEnemy_fp)(int obj_handle, int it_handle);
454 OSIRISEXTERN AI_IsObjEnemy_fp AI_IsObjEnemy;
455
456 typedef bool (*AI_GoalValue_fp)(int obj_handle, char g_index, char op, char vtype, void *ptr, char index = 0);
457 OSIRISEXTERN AI_GoalValue_fp AI_GoalValue;
458
459 typedef int (*AI_GetNearbyObjs_fp)(vector *pos, int init_roomnum, float rad, int *object_handle_list, int max_elements,
460 bool f_lightmap_only, bool f_only_players_and_ais = true,
461 bool f_include_non_collide_objects = false, bool f_stop_at_closed_doors = true);
462 OSIRISEXTERN AI_GetNearbyObjs_fp AI_GetNearbyObjs;
463
464 typedef char (*AI_GetCurGoalIndex_fp)(int obj_handle);
465 OSIRISEXTERN AI_GetCurGoalIndex_fp AI_GetCurGoalIndex;
466
467 // Allocates a block of global memory for this module, of size amount_of_memory.
468 // unique_identfier is the script provided unique ID which is used throughout.
469 // script_identifier is the pointer of data provided to the script in it's InitializeDLL function (really the name of
470 // the script) Returns -1 if there isn't enough available memory Returns -2 if the unique identifier passed in is
471 // already used, but the requested amount_of_memory is different If the memory has already been allocated, it will
472 // return the handle.
473 typedef OMMSHANDLE (*OMMS_Malloc_fp)(size_t amount_of_memory, uint32_t unique_identifier, char *script_identifier);
474 OSIRISEXTERN OMMS_Malloc_fp OMMS_Malloc;
475
476 // Attaches to a block of global OMMS memory. As long as at least one module (or script) is
477 // attached to a module, the memory will not be deleted. (Increments the reference count)
478 // Returns NULL if the memory couldn't be attached (it has been either free'd or never malloced)
479 typedef void *(*OMMS_Attach_fp)(OMMSHANDLE handle);
480 OSIRISEXTERN OMMS_Attach_fp OMMS_Attach;
481
482 // Detaches a block of global OMMS memory. (Reduces the reference count).
483 typedef void (*OMMS_Detach_fp)(OMMSHANDLE handle);
484 OSIRISEXTERN OMMS_Detach_fp OMMS_Detach;
485
486 // Frees a block of global memory
487 // Only has affect if you are attached to the memory. Memory will _ONLY_ be deleted when the
488 // following conditions are meant for the shared memory block:
489 // 1) The reference count for the global memory is at 0 (OMMS_Attach() adds to reference count, OMMS_Detach()
490 // subtracts). 2) OMMS_Free() has been called for the block of global memory. The conditions can happen in any order,
491 // but
492 // as soon as both are satisfied, the memory becomes deleted and any pointer returned by OMMS_Attach() becomes
493 // invalid.
494 //
495 // handle : the value returned by OMMS_Malloc()
496 typedef void (*OMMS_Free_fp)(OMMSHANDLE handle);
497 OSIRISEXTERN OMMS_Free_fp OMMS_Free;
498
499 // Returns an OMMSHANDLE to a block of global memory allocated by a module/script. Pass
500 // in the unique_identifier and the script_identifier that was passed in the OMMS_Malloc().
501 // Note: script_identifier is really the filename of the module that called the OMMS_Malloc().
502 // Returns -1 if the module was never OMMS_Malloc()'d.
503 typedef OMMSHANDLE (*OMMS_Find_fp)(uint32_t unique_identifier, char *script_identifier);
504 OSIRISEXTERN OMMS_Find_fp OMMS_Find;
505
506 // Returns information about the OMMS memory given it's handle returned from the OMMS_Find() or
507 // OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in;
508 // Pass NULL in for those parameters you don't need information about.
509 typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count,
510 uint8_t *has_free_been_called);
511 OSIRISEXTERN OMMS_GetInfo_fp OMMS_GetInfo;
512
513 // Starts an in-game cinematic sequence. text_string is the text to be displayed
514 // use pipes (|) to seperate lines.
515 typedef bool (*Cine_Start_fp)(tGameCinematic *info, const char *text_string);
516 OSIRISEXTERN Cine_Start_fp Cine_Start;
517
518 // Stops and clears up a in-game cinematic.
519 typedef void (*Cine_Stop_fp)(void);
520 OSIRISEXTERN Cine_Stop_fp Cine_Stop;
521
522 // Looks up the id's of the sound, room, trigger, object, ect. based on the name
523 typedef int (*Scrpt_FindSoundName_fp)(const char *name);
524 OSIRISEXTERN Scrpt_FindSoundName_fp Scrpt_FindSoundName;
525
526 typedef int (*Scrpt_FindRoomName_fp)(const char *name);
527 OSIRISEXTERN Scrpt_FindRoomName_fp Scrpt_FindRoomName;
528
529 typedef int (*Scrpt_FindTriggerName_fp)(const char *name);
530 OSIRISEXTERN Scrpt_FindTriggerName_fp Scrpt_FindTriggerName;
531
532 typedef int (*Scrpt_FindObjectName_fp)(const char *name);
533 OSIRISEXTERN Scrpt_FindObjectName_fp Scrpt_FindObjectName;
534
535 typedef int (*Scrpt_GetTriggerRoom_fp)(int trigger_id);
536 OSIRISEXTERN Scrpt_GetTriggerRoom_fp Scrpt_GetTriggerRoom;
537
538 typedef int (*Scrpt_GetTriggerFace_fp)(int trigger_id);
539 OSIRISEXTERN Scrpt_GetTriggerFace_fp Scrpt_GetTriggerFace;
540
541 typedef int (*Scrpt_FindDoorName_fp)(const char *name);
542 OSIRISEXTERN Scrpt_FindDoorName_fp Scrpt_FindDoorName;
543
544 typedef int (*Scrpt_FindTextureName_fp)(const char *name);
545 OSIRISEXTERN Scrpt_FindTextureName_fp Scrpt_FindTextureName;
546
547 typedef void (*Game_CreateRandomSparks_fp)(int num_sparks, vector *pos, int roomnum, int which_index = -1,
548 float force_scalar = 1.0f);
549 OSIRISEXTERN Game_CreateRandomSparks_fp Game_CreateRandomSparks;
550
551 // Cancels a timer given its ID
552 typedef void (*Scrpt_CancelTimerID_fp)(int id);
553 OSIRISEXTERN Scrpt_CancelTimerID_fp Scrpt_CancelTimerID;
554
555 // disable/enable ship
556 typedef void (*Game_EnableShip_fp)(const char *ship_name, bool enable);
557 OSIRISEXTERN Game_EnableShip_fp Game_EnableShip;
558
559 // is ship enabled
560 typedef bool (*Game_IsShipEnabled_fp)(const char *ship_name);
561 OSIRISEXTERN Game_IsShipEnabled_fp Game_IsShipEnabled;
562
563 // gets information about a path point
564 // pass NULL for parameters not needed.
565 // pathid: path number
566 // point: which path point
567 // returns true if operation was successful
568 typedef bool (*Path_GetInformation_fp)(int pathid, int point, vector *pos = NULL, int *room = NULL,
569 matrix *orient = NULL);
570 OSIRISEXTERN Path_GetInformation_fp Path_GetInformation;
571
572 // starts a canned cinematic sequence
573 typedef void (*Cine_StartCanned_fp)(tCannedCinematicInfo *info);
574 OSIRISEXTERN Cine_StartCanned_fp Cine_StartCanned;
575
576 typedef int (*Scrpt_FindMatcenName_fp)(char *name);
577 OSIRISEXTERN Scrpt_FindMatcenName_fp Scrpt_FindMatcenName;
578
579 typedef int (*Scrpt_FindPathName_fp)(char *name);
580 OSIRISEXTERN Scrpt_FindPathName_fp Scrpt_FindPathName;
581
582 typedef int (*Scrpt_FindLevelGoalName_fp)(char *name);
583 OSIRISEXTERN Scrpt_FindLevelGoalName_fp Scrpt_FindLevelGoalName;
584
585 typedef void (*LGoal_Value_fp)(char op, char vtype, void *ptr, int g_index = -1, int i_index = -1);
586 OSIRISEXTERN LGoal_Value_fp LGoal_Value;
587
588 typedef int (*Obj_MakeListOfType_fp)(int objhandle, int type, int id, bool f_ignore_init_room, int parent_handle,
589 int max_recorded, int *handles);
590 OSIRISEXTERN Obj_MakeListOfType_fp Obj_MakeListOfType;
591
592 typedef void (*Obj_Kill_fp)(int handle, int killer_handle, float damage, int flags, float min_time, float max_time);
593 OSIRISEXTERN Obj_Kill_fp Obj_Kill;
594
595 // typedef bool (*AI_AreRoomsReachable_fp)(int room1, int room2);
596 // OSIRISEXTERN AI_AreRoomsReachable_fp AI_AreRoomsReachable;
597
598 typedef bool (*AI_IsDestReachable_fp)(int handle, int room);
599 OSIRISEXTERN AI_IsDestReachable_fp AI_IsDestReachable;
600
601 typedef bool (*AI_IsObjReachable_fp)(int handle, int target);
602 OSIRISEXTERN AI_IsObjReachable_fp AI_IsObjReachable;
603
604 typedef char (*Game_GetDiffLevel_fp)(void);
605 OSIRISEXTERN Game_GetDiffLevel_fp Game_GetDiffLevel;
606
607 /*
608 0:LANGUAGE_ENGLISH
609 1:LANGUAGE_GERMAN
610 2:LANGUAGE_SPANISH
611 3:LANGUAGE_ITALIAN
612 4:LANGUAGE_FRENCH
613 */
614 typedef int (*Game_GetLanguage_fp)(void);
615 OSIRISEXTERN Game_GetLanguage_fp Game_GetLanguage;
616
617 // Sets/Gets information about a path.
618 // If you change is PV_ALL (or any of it's individual components), pass in a pointer to an
619 // osiris_path_node_info struct. For the others, you must pass in an appropriate pointer
620 // (i.e. an int* for PV_I_NUMNODES). You can only set PV_ALL components.
621 // for PV_I_NUMNODES, path_id MUST be specified, node_id is ignored
622 // for PV_I_NUMPATHS, path_id and node_id are ignored
623 // for PV_CS_NAME, path_id MUST be specified, node_id is ignored
624 // for PV_ALL components, path_id and node_id MUST be valid.
625 typedef void (*Path_Value_fp)(int path_id, int node_id, char op, int changes, void *ptr);
626 OSIRISEXTERN Path_Value_fp Path_Value;
627
628 // ===========================================================
629
630 // osicommon_Initialize
631 // Initializes module's functions
632 void osicommon_Initialize(tOSIRISModuleInit *mi);
633 #ifndef __OSIRIS_IMPORT_H_
634 void osicommon_Initialize(tOSIRISModuleInit *mi) {
635 int i = 0;
636 mprintf = (mprintf_fp)mi->fp[i++];
637 MSafe_CallFunction = (MSafe_CallFunction_fp)mi->fp[i++];
638 MSafe_GetValue = (MSafe_GetValue_fp)mi->fp[i++];
639 Obj_CallEvent = (Obj_CallEvent_fp)mi->fp[i++];
640 Trgr_CallEvent = (Trgr_CallEvent_fp)mi->fp[i++];
641 Sound_TouchFile = (Sound_TouchFile_fp)mi->fp[i++];
642 Obj_FindID = (Obj_FindID_fp)mi->fp[i++];
643 Wpn_FindID = (Wpn_FindID_fp)mi->fp[i++];
644 Obj_GetTimeLived = (Obj_GetTimeLived_fp)mi->fp[i++];
645 Obj_GetGunPos = (Obj_GetGunPos_fp)mi->fp[i++];
646 Room_Value = (Room_Value_fp)mi->fp[i++];
647 Room_IsValid = (Room_IsValid_fp)mi->fp[i++];
648 Obj_GetAttachParent = (Obj_GetAttachParent_fp)mi->fp[i++];
649 Obj_GetNumAttachSlots = (Obj_GetNumAttachSlots_fp)mi->fp[i++];
650 Obj_GetAttachChildHandle = (Obj_GetAttachChildHandle_fp)mi->fp[i++];
651 Obj_AttachObjectAP = (Obj_AttachObjectAP_fp)mi->fp[i++];
652 Obj_AttachObjectRad = (Obj_AttachObjectRad_fp)mi->fp[i++];
653 Obj_UnattachFromParent = (Obj_UnattachFromParent_fp)mi->fp[i++];
654 Obj_UnattachChild = (Obj_UnattachChild_fp)mi->fp[i++];
655 Obj_UnattachChildren = (Obj_UnattachChildren_fp)mi->fp[i++];
656 FVI_RayCast = (FVI_RayCast_fp)mi->fp[i++];
657 AI_GetPathID = (AI_GetPathID_fp)mi->fp[i++];
658 AI_GoalFollowPathSimple = (AI_GoalFollowPathSimple_fp)mi->fp[i++];
659 AI_PowerSwitch = (AI_PowerSwitch_fp)mi->fp[i++];
660 AI_TurnTowardsVectors = (AI_TurnTowardsVectors_fp)mi->fp[i++];
661 AI_SetType = (AI_SetType_fp)mi->fp[i++];
662 AI_FindHidePos = (AI_FindHidePos_fp)mi->fp[i++];
663 AI_GoalAddEnabler = (AI_GoalAddEnabler_fp)mi->fp[i++];
664 AI_AddGoal = (AI_AddGoal_fp)mi->fp[i++];
665 AI_ClearGoal = (AI_ClearGoal_fp)mi->fp[i++];
666 AI_Value = (AI_Value_fp)mi->fp[i++];
667 AI_FindObjOfType = (AI_FindObjOfType_fp)mi->fp[i++];
668 AI_GetRoomPathPoint = (AI_GetRoomPathPoint_fp)mi->fp[i++];
669 AI_FindEnergyCenter = (AI_FindEnergyCenter_fp)mi->fp[i++];
670 AI_GetDistToObj = (AI_GetDistToObj_fp)mi->fp[i++];
671 AI_SetGoalFlags = (AI_SetGoalFlags_fp)mi->fp[i++];
672 AI_SetGoalCircleDist = (AI_SetGoalCircleDist_fp)mi->fp[i++];
673 File_ReadBytes = (File_ReadBytes_fp)mi->fp[i++];
674 File_ReadInt = (File_ReadInt_fp)mi->fp[i++];
675 File_ReadShort = (File_ReadShort_fp)mi->fp[i++];
676 File_ReadByte = (File_ReadByte_fp)mi->fp[i++];
677 File_ReadFloat = (File_ReadFloat_fp)mi->fp[i++];
678 File_ReadDouble = (File_ReadDouble_fp)mi->fp[i++];
679 File_ReadString = (File_ReadString_fp)mi->fp[i++];
680 File_WriteBytes = (File_WriteBytes_fp)mi->fp[i++];
681 File_WriteString = (File_WriteString_fp)mi->fp[i++];
682 File_WriteInt = (File_WriteInt_fp)mi->fp[i++];
683 File_WriteShort = (File_WriteShort_fp)mi->fp[i++];
684 File_WriteByte = (File_WriteByte_fp)mi->fp[i++];
685 File_WriteFloat = (File_WriteFloat_fp)mi->fp[i++];
686 File_WriteDouble = (File_WriteDouble_fp)mi->fp[i++];
687 Scrpt_MemAlloc = (Scrpt_MemAlloc_fp)mi->fp[i++];
688 Scrpt_MemFree = (Scrpt_MemFree_fp)mi->fp[i++];
689 Scrpt_CancelTimer = (Scrpt_CancelTimer_fp)mi->fp[i++];
690 Scrpt_CreateTimer = (Scrpt_CreateTimer_fp)mi->fp[i++];
691 MSafe_DoPowerup = (MSafe_DoPowerup_fp)mi->fp[i++];
692 Obj_Create = (Obj_Create_fp)mi->fp[i++];
693 Game_GetTime = (Game_GetTime_fp)mi->fp[i++];
694 Game_GetFrameTime = (Game_GetFrameTime_fp)mi->fp[i++];
695 Obj_WBValue = (Obj_WBValue_fp)mi->fp[i++];
696 Scrpt_TimerExists = (Scrpt_TimerExists_fp)mi->fp[i++];
697 Obj_Value = (Obj_Value_fp)mi->fp[i++];
698 Matcen_Value = (Matcen_Value_fp)mi->fp[i++];
699 Matcen_Reset = (Matcen_Reset_fp)mi->fp[i++];
700 Matcen_Copy = (Matcen_Copy_fp)mi->fp[i++];
701 Matcen_Create = (Matcen_Create_fp)mi->fp[i++];
702 Matcen_FindID = (Matcen_FindID_fp)mi->fp[i++];
703 Msn_FlagSet = (Msn_FlagSet_fp)mi->fp[i++];
704 Msn_FlagGet = (Msn_FlagGet_fp)mi->fp[i++];
705 Player_Value = (Player_Value_fp)mi->fp[i++];
706 Obj_SetCustomAnim = (Obj_SetCustomAnim_fp)mi->fp[i++];
707 Player_AddHudMessage = (Player_AddHudMessage_fp)mi->fp[i++];
708 Obj_Ghost = (Obj_Ghost_fp)mi->fp[i++];
709 Obj_Burning = (Obj_Burning_fp)mi->fp[i++];
710 Obj_IsEffect = (Obj_IsEffect_fp)mi->fp[i++];
711 File_Open = (File_Open_fp)mi->fp[i++];
712 File_Close = (File_Close_fp)mi->fp[i++];
713 File_Tell = (File_Tell_fp)mi->fp[i++];
714 File_eof = (File_eof_fp)mi->fp[i++];
715 Sound_Stop = (Sound_Stop_fp)mi->fp[i++];
716 Sound_Play2d = (Sound_Play2d_fp)mi->fp[i++];
717 Sound_Play3d = (Sound_Play3d_fp)mi->fp[i++];
718 Sound_FindId = (Sound_FindId_fp)mi->fp[i++];
719 AI_IsObjFriend = (AI_IsObjFriend_fp)mi->fp[i++];
720 AI_IsObjEnemy = (AI_IsObjEnemy_fp)mi->fp[i++];
721 AI_GoalValue = (AI_GoalValue_fp)mi->fp[i++];
722 AI_GetNearbyObjs = (AI_GetNearbyObjs_fp)mi->fp[i++];
723 AI_GetCurGoalIndex = (AI_GetCurGoalIndex_fp)mi->fp[i++];
724 OMMS_Malloc = (OMMS_Malloc_fp)mi->fp[i++];
725 OMMS_Attach = (OMMS_Attach_fp)mi->fp[i++];
726 OMMS_Detach = (OMMS_Detach_fp)mi->fp[i++];
727 OMMS_Free = (OMMS_Free_fp)mi->fp[i++];
728 OMMS_Find = (OMMS_Find_fp)mi->fp[i++];
729 OMMS_GetInfo = (OMMS_GetInfo_fp)mi->fp[i++];
730 Cine_Start = (Cine_Start_fp)mi->fp[i++];
731 Cine_Stop = (Cine_Stop_fp)mi->fp[i++];
732 Scrpt_FindSoundName = (Scrpt_FindSoundName_fp)mi->fp[i++];
733 Scrpt_FindRoomName = (Scrpt_FindRoomName_fp)mi->fp[i++];
734 Scrpt_FindTriggerName = (Scrpt_FindTriggerName_fp)mi->fp[i++];
735 Scrpt_FindObjectName = (Scrpt_FindObjectName_fp)mi->fp[i++];
736 Scrpt_GetTriggerRoom = (Scrpt_GetTriggerRoom_fp)mi->fp[i++];
737 Scrpt_GetTriggerFace = (Scrpt_GetTriggerFace_fp)mi->fp[i++];
738 Scrpt_FindDoorName = (Scrpt_FindDoorName_fp)mi->fp[i++];
739 Scrpt_FindTextureName = (Scrpt_FindTextureName_fp)mi->fp[i++];
740 Game_CreateRandomSparks = (Game_CreateRandomSparks_fp)mi->fp[i++];
741 Scrpt_CancelTimerID = (Scrpt_CancelTimerID_fp)mi->fp[i++];
742 Obj_GetGroundPos = (Obj_GetGroundPos_fp)mi->fp[i++];
743 Game_EnableShip = (Game_EnableShip_fp)mi->fp[i++];
744 Game_IsShipEnabled = (Game_IsShipEnabled_fp)mi->fp[i++];
745 Path_GetInformation = (Path_GetInformation_fp)mi->fp[i++];
746 Cine_StartCanned = (Cine_StartCanned_fp)mi->fp[i++];
747 Scrpt_FindMatcenName = (Scrpt_FindMatcenName_fp)mi->fp[i++];
748 Scrpt_FindPathName = (Scrpt_FindPathName_fp)mi->fp[i++];
749 Scrpt_FindLevelGoalName = (Scrpt_FindLevelGoalName_fp)mi->fp[i++];
750 Obj_FindType = (Obj_FindType_fp)mi->fp[i++];
751 LGoal_Value = (LGoal_Value_fp)mi->fp[i++];
752 Obj_MakeListOfType = (Obj_MakeListOfType_fp)mi->fp[i++];
753 Obj_Kill = (Obj_Kill_fp)mi->fp[i++];
754 // AI_AreRoomsReachable = (AI_AreRoomsReachable_fp)mi->fp[i++];
755 AI_IsDestReachable = (AI_IsDestReachable_fp)mi->fp[i++];
756 AI_IsObjReachable = (AI_IsObjReachable_fp)mi->fp[i++];
757 Game_GetDiffLevel = (Game_GetDiffLevel_fp)mi->fp[i++];
758 Game_GetLanguage = (Game_GetLanguage_fp)mi->fp[i++];
759 Path_Value = (Path_Value_fp)mi->fp[i++];
760 }
761 #endif
762
763 #ifndef __OSIRIS_IMPORT_H_
764 #define __OSIRIS_IMPORT_H_
765 #endif