2024-04-20 15:57:49 +00:00
|
|
|
/*
|
|
|
|
* Descent 3
|
|
|
|
* Copyright (C) 2024 Parallax Software
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2024-09-09 12:20:48 +00:00
|
|
|
#pragma once
|
2024-04-20 15:57:49 +00:00
|
|
|
|
2024-04-16 03:43:29 +00:00
|
|
|
#define OSIRISEXTERN extern
|
|
|
|
|
|
|
|
#include "osiris_common.h"
|
|
|
|
|
2024-07-12 23:11:54 +00:00
|
|
|
#if defined(POSIX)
|
2024-05-19 09:40:50 +00:00
|
|
|
#include "linux_lib.h"
|
2024-04-16 03:43:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// ===========================================================
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
// void mprintf(int n, const char *format, ... );
|
2024-04-16 03:43:29 +00:00
|
|
|
// prints a debug message out to the monochrome monitor
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef void (*mprintf_fp)(int n, const char *format, ...);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN mprintf_fp mprintf;
|
|
|
|
|
|
|
|
// The main calling function for multisafe functions
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*MSafe_CallFunction_fp)(int type, msafe_struct *mstruct);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN MSafe_CallFunction_fp MSafe_CallFunction;
|
|
|
|
|
|
|
|
// The main calling function for extracting multisafe data
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*MSafe_GetValue_fp)(int type, msafe_struct *mstruct);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN MSafe_GetValue_fp MSafe_GetValue;
|
|
|
|
|
|
|
|
// bool Obj_CallEvent(int objnum,int event,tOSIRISEventInfo *ei);
|
|
|
|
// Sends an event to an object. Returns true if the default action should
|
|
|
|
// continue to process.
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef bool (*Obj_CallEvent_fp)(int objnum, int event, tOSIRISEventInfo *ei);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_CallEvent_fp Obj_CallEvent;
|
|
|
|
|
|
|
|
// bool Trgr_CallEvent(int trignum,int event,tOSIRISEventInfo *ei);
|
|
|
|
// Sends an event to a trigger. Returns true if the default action should
|
|
|
|
// continue to process.
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef bool (*Trgr_CallEvent_fp)(int trignum, int event, tOSIRISEventInfo *ei);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Trgr_CallEvent_fp Trgr_CallEvent;
|
|
|
|
|
|
|
|
// void Sound_TouchFile(char *sound_name);
|
|
|
|
// Touches a sound file so it loads into memory
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Sound_TouchFile_fp)(char *sound_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Sound_TouchFile_fp Sound_TouchFile;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
// int Obj_FindID(const char *object_name);
|
2024-09-03 11:03:41 +00:00
|
|
|
// searches for an object id given its name
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Obj_FindID_fp)(const char *object_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_FindID_fp Obj_FindID;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
// int Obj_FindType(const char *object_name);
|
2024-09-03 11:03:41 +00:00
|
|
|
// searches for an object type given its name
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Obj_FindType_fp)(const char *object_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_FindType_fp Obj_FindType;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
// int Wpn_FindID(const char *weapon_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
// searches through the weapons for a name and returns the id
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Wpn_FindID_fp)(const char *weapon_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Wpn_FindID_fp Wpn_FindID;
|
|
|
|
|
|
|
|
// float Obj_GetTimeLived(int objhandle);
|
|
|
|
// returns how long an object has lived
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef float (*Obj_GetTimeLived_fp)(int objhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetTimeLived_fp Obj_GetTimeLived;
|
|
|
|
|
|
|
|
// void Obj_GetGunPos(int objhandle,int gun_number,vector *gun_pnt,vector *gun_normal);
|
|
|
|
// returns information about a gunpoint of an object
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_GetGunPos_fp)(int objhandle, int gun_number, vector *gun_pnt, vector *gun_normal);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetGunPos_fp Obj_GetGunPosFP;
|
|
|
|
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_GetGunPos(int objhandle, int gun_number, vector *gun_pnt, vector *gun_normal = NULL) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_GetGunPosFP(objhandle, gun_number, gun_pnt, gun_normal);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// void Obj_GetGroundPos(int objhandle,int ground_number,vector *ground_pnt,vector *ground_normal);
|
|
|
|
// returns information about a groundpoint of an object
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_GetGroundPos_fp)(int objhandle, int ground_number, vector *ground_pnt, vector *ground_normal);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetGroundPos_fp Obj_GetGroundPosFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_GetGroundPos(int objhandle, int ground_number, vector *ground_pnt,
|
|
|
|
vector *ground_normal = NULL) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_GetGroundPosFP(objhandle, ground_number, ground_pnt, ground_normal);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// void Room_Value(int roomnum, char op, char vhandle, void *ptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Room_Value_fp)(int roomnum, char op, char vhandle, void *ptr, int index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Room_Value_fp Room_ValueFP;
|
|
|
|
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Room_Value(int roomnum, char op, char vhandle, void *ptr, int index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Room_ValueFP(roomnum, op, vhandle, ptr, index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// uint8_t Room_IsValid(int roomnum);
|
2024-04-16 03:43:29 +00:00
|
|
|
// returns 0 if the room is not valid. 1 if the room is a terrain cell. 2 if the room is a room segment
|
2024-05-24 03:07:26 +00:00
|
|
|
typedef uint8_t (*Room_IsValid_fp)(int roomnum);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Room_IsValid_fp Room_IsValid;
|
|
|
|
|
|
|
|
// int Obj_GetAttachParent(int childhandle);
|
|
|
|
// returns the handle to the parent of the given attached child
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_GetAttachParent_fp)(int childhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetAttachParent_fp Obj_GetAttachParent;
|
|
|
|
|
|
|
|
// int Obj_GetNumAttachSlots(int objhandle);
|
|
|
|
// returns the number of attach slots an object has.
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_GetNumAttachSlots_fp)(int objhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetNumAttachSlots_fp Obj_GetNumAttachSlots;
|
|
|
|
|
|
|
|
// int Obj_GetAttachChildHandle(int objhandle,char attachpoint);
|
|
|
|
// returns the handle to the child attached on the specified attach point of an object
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_GetAttachChildHandle_fp)(int objhandle, char attachpoint);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_GetAttachChildHandle_fp Obj_GetAttachChildHandle;
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// int Obj_AttachObjectAP(int parenthandle,char parent_ap,int childhandle,char child_ap,uint8_t f_use_aligned);
|
2024-04-16 03:43:29 +00:00
|
|
|
// Attaches one object to another object based on their attach points
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_AttachObjectAP_fp)(int parenthandle, char parent_ap, int childhandle, char child_ap,
|
2024-05-24 03:07:26 +00:00
|
|
|
uint8_t f_use_aligned);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_AttachObjectAP_fp Obj_AttachObjectAP;
|
|
|
|
|
|
|
|
// int Obj_AttachObjectRad(int parenthandle,char parent_ap,int childhandle,float percent_rad);
|
|
|
|
// Attached one object to another based on radius
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_AttachObjectRad_fp)(int parenthandle, char parent_ap, int childhandle, float percent_rad);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_AttachObjectRad_fp Obj_AttachObjectRad;
|
|
|
|
|
|
|
|
// void Obj_UnattachFromParent(int objhandle);
|
2024-09-03 11:03:41 +00:00
|
|
|
// Detaches an object from its parent
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_UnattachFromParent_fp)(int objhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_UnattachFromParent_fp Obj_UnattachFromParent;
|
|
|
|
|
|
|
|
// void Obj_UnattachChild(int objhandle,char parent_ap);
|
2024-09-03 11:03:41 +00:00
|
|
|
// Detaches a child object from its parent
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_UnattachChild_fp)(int objhandle, char parent_ap);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_UnattachChild_fp Obj_UnattachChild;
|
|
|
|
|
|
|
|
// void Obj_UnattachChildren(int objhandle);
|
|
|
|
// Detaches all children from a parent
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_UnattachChildren_fp)(int objhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_UnattachChildren_fp Obj_UnattachChildren;
|
|
|
|
|
|
|
|
// int FVI_RayCast(int objhandle,vector *p0,vector *p1,int start_roomnum,float rad,int flags,ray_info *ri);
|
2024-09-03 11:03:41 +00:00
|
|
|
// Shoots out a ray, returns its fate
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*FVI_RayCast_fp)(int objhandle, vector *p0, vector *p1, int start_roomnum, float rad, int flags,
|
|
|
|
ray_info *ri);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN FVI_RayCast_fp FVI_RayCast;
|
|
|
|
|
|
|
|
// int AI_GetPathID(char *string);
|
|
|
|
// searches through GamePath index and returns index of path matching name returns -1 if not found
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_GetPathID_fp)(char *string);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GetPathID_fp AI_GetPathID;
|
|
|
|
|
|
|
|
// int AI_GoalFollowPathSimple(int objhandle,int path_id,int guid,int flags);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_GoalFollowPathSimple_fp)(int objhandle, int path_id, int guid, int flags, int slot);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GoalFollowPathSimple_fp AI_GoalFollowPathSimpleFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline int AI_GoalFollowPathSimple(int objhandle, int path_id, int guid, int flags, int slot = 3) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return AI_GoalFollowPathSimpleFP(objhandle, path_id, guid, flags, slot);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// int AI_PowerSwitch(int objhandle,uint8_t f_power_on);
|
|
|
|
typedef int (*AI_PowerSwitch_fp)(int objhandle, uint8_t f_power_on);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_PowerSwitch_fp AI_PowerSwitch;
|
|
|
|
|
|
|
|
// void AI_Value(int objhandle, char op, char vtype, void *ptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*AI_Value_fp)(int objhandle, char op, char vtype, void *ptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_Value_fp AI_Value;
|
|
|
|
|
|
|
|
// void Obj_Value(int objhandle, char op, char vtype, void *ptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_Value_fp)(int objhandle, char op, char vtype, void *ptr, int index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_Value_fp Obj_ValueFP;
|
|
|
|
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_Value(int objhandle, char op, char vtype, void *ptr, int index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_ValueFP(objhandle, op, vtype, ptr, index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// void Matcen_Value(int matcen_handle, char op, char vtype, void *ptr, int prod_index = 0);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Matcen_Value_fp)(int matcen_handle, char op, char vtype, void *ptr, int prod_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Matcen_Value_fp Matcen_ValueFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Matcen_Value(int matcen_handle, char op, char vtype, void *ptr, int prod_index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Matcen_ValueFP(matcen_handle, op, vtype, ptr, prod_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// uint8_t AI_TurnTowardsVectors(int objhandle,vector *fvec,vector *uvec);
|
|
|
|
typedef uint8_t (*AI_TurnTowardsVectors_fp)(int objhandle, vector *fvec, vector *uvec);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_TurnTowardsVectors_fp AI_TurnTowardsVectors;
|
|
|
|
|
|
|
|
// void AI_SetType(int objhandle,int type);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*AI_SetType_fp)(int objhandle, int type);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_SetType_fp AI_SetType;
|
|
|
|
|
|
|
|
// vector AI_FindHidePos(int hideobjhandle,int viewobjhandle,float time,int *hide_room);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef vector (*AI_FindHidePos_fp)(int hideobjhandle, int viewobjhandle, float time, int *hide_room);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_FindHidePos_fp AI_FindHidePos;
|
|
|
|
|
|
|
|
// int AI_GoalAddEnabler(int objhandle,int goal_index,int enabler_type,float percent,float interval,void *ptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_GoalAddEnabler_fp)(int objhandle, int goal_index, int enabler_type, float percent, float interval,
|
|
|
|
void *ptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GoalAddEnabler_fp AI_GoalAddEnabler;
|
|
|
|
|
|
|
|
// int AI_AddGoal(int objhandle,int goal_type,int level,float influence, int guid, int flags, ... );
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef float (*AI_AddGoal_fp)(int objhandle, int goal_type, int level, float influence, int guid, int flags, ...);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_AddGoal_fp AI_AddGoal;
|
|
|
|
|
|
|
|
// void AI_ClearGoal(int objhandle,int goal_index);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*AI_ClearGoal_fp)(int objhandle, int goal_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_ClearGoal_fp AI_ClearGoal;
|
|
|
|
|
|
|
|
// int AI_FindObjOfType(int objhandle,int type, bool f_ignore_init_room, int parent_handle = OBJECT_HANDLE_NONE);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_FindObjOfType_fp)(int objhandle, int type, int id, bool f_ignore_init_room, int parent_handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_FindObjOfType_fp AI_FindObjOfTypeFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline int AI_FindObjOfType(int objhandle, int type, int id, bool f_ignore_init_room,
|
|
|
|
int parent_handle = OBJECT_HANDLE_NONE) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return AI_FindObjOfTypeFP(objhandle, type, id, f_ignore_init_room, parent_handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
// vector AI_GetRoomPathPoint(int roomnum);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef vector (*AI_GetRoomPathPoint_fp)(int roomnum);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GetRoomPathPoint_fp AI_GetRoomPathPoint;
|
|
|
|
|
|
|
|
// int AI_FindEnergyCenter(int objhandle);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_FindEnergyCenter_fp)(int objhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_FindEnergyCenter_fp AI_FindEnergyCenter;
|
|
|
|
|
|
|
|
// float AI_GetDistToObj(int objhandle,int otherobjhandle);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef float (*AI_GetDistToObj_fp)(int objhandle, int otherobjhandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GetDistToObj_fp AI_GetDistToObj;
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// int AI_SetGoalFlags(int objhandle,int goal_handle,int flags,uint8_t f_enable);
|
|
|
|
typedef int (*AI_SetGoalFlags_fp)(int objhandle, int goal_handle, int flags, uint8_t f_enable);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_SetGoalFlags_fp AI_SetGoalFlags;
|
|
|
|
|
|
|
|
// void AI_SetGoalCircleDist(int objhandle,int goal_handle,float dist);
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*AI_SetGoalCircleDist_fp)(int objhandle, int goal_handle, float dist);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_SetGoalCircleDist_fp AI_SetGoalCircleDist;
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// int File_ReadBytes(uint8_t *buffer, int count, void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Reads the specified number of bytes from a file into the buffer
|
|
|
|
// DO NOT USE THIS TO READ STRUCTURES. This function is for byte
|
|
|
|
// data, such as a string or a bitmap of 8-bit pixels.
|
|
|
|
// Returns the number of bytes read.
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
2024-05-24 03:07:26 +00:00
|
|
|
typedef int (*File_ReadBytes_fp)(uint8_t *buffer, int count, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadBytes_fp File_ReadBytes;
|
|
|
|
|
|
|
|
// int File_ReadInt(void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// The following functions read numeric vales from a CFILE. All values are
|
2024-04-16 03:43:29 +00:00
|
|
|
// stored in the file in Intel (little-endian) format. These functions
|
|
|
|
// will convert to big-endian if required.
|
2024-04-16 18:56:40 +00:00
|
|
|
// These funtions will throw an exception of if the value cannot be read,
|
|
|
|
// so do not call these if you don't require the data to be present.
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// Read and return an integer (32 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
|
|
|
typedef int (*File_ReadInt_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadInt_fp File_ReadInt;
|
|
|
|
|
2024-05-24 03:27:12 +00:00
|
|
|
// int16_t File_ReadShort(void *fileptr);
|
|
|
|
// Read and return a int16_t (16 bits)
|
2024-04-16 18:56:40 +00:00
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
2024-05-24 03:27:12 +00:00
|
|
|
typedef int16_t (*File_ReadShort_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadShort_fp File_ReadShort;
|
|
|
|
|
2024-05-24 03:05:05 +00:00
|
|
|
// int8_t File_ReadByte(void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Read and return a byte (8 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
2024-05-24 03:05:05 +00:00
|
|
|
typedef int8_t (*File_ReadByte_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadByte_fp File_ReadByte;
|
|
|
|
|
|
|
|
// float File_ReadFloat(void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Read and return a float (32 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
|
|
|
typedef float (*File_ReadFloat_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadFloat_fp File_ReadFloat;
|
|
|
|
|
|
|
|
// double File_ReadDouble(void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Read and return a double (64 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on read
|
|
|
|
typedef double (*File_ReadDouble_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadDouble_fp File_ReadDouble;
|
|
|
|
|
|
|
|
// int File_ReadString(char *buf,size_t n,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Reads a string from a CFILE. If the file is type binary, this
|
|
|
|
// function reads until a NULL or EOF is found. If the file is text,
|
|
|
|
// the function reads until a newline or EOF is found. The string is always
|
|
|
|
// written to the destination buffer null-terminated, without the newline.
|
|
|
|
// Parameters: buf - where the string is written
|
2024-04-16 03:43:29 +00:00
|
|
|
// n - the maximum string length, including the terminating 0
|
|
|
|
// cfp - the CFILE pointer
|
2024-04-16 18:56:40 +00:00
|
|
|
// Returns the number of bytes in the string, before the terminator
|
|
|
|
// Does not generate an exception on EOF
|
|
|
|
typedef int (*File_ReadString_fp)(char *buf, size_t n, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_ReadString_fp File_ReadString;
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// int File_WriteBytes(const uint8_t *buf,int count,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Writes the specified number of bytes from a file into the buffer
|
|
|
|
// DO NOT USE THIS TO WRITE STRUCTURES. This function is for byte
|
|
|
|
// data, such as a string or a bitmap of 8-bit pixels.
|
|
|
|
// Returns the number of bytes written.
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
2024-05-24 03:07:26 +00:00
|
|
|
typedef int (*File_WriteBytes_fp)(const uint8_t *buf, int count, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteBytes_fp File_WriteBytes;
|
|
|
|
|
|
|
|
// int File_WriteString(const char *buf,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Writes a null-terminated string to a file. If the file is type binary,
|
|
|
|
// the string is terminated in the file with a null. If the file is type
|
|
|
|
// text, the string is terminated with a newline.
|
|
|
|
// Parameters: buf - pointer to the string
|
2024-04-16 03:43:29 +00:00
|
|
|
// cfp = the CFILE pointer
|
2024-04-16 18:56:40 +00:00
|
|
|
// Returns the number of bytes written
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
|
|
|
typedef int (*File_WriteString_fp)(const char *buf, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteString_fp File_WriteString;
|
|
|
|
|
|
|
|
// void File_WriteInt(int i,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// The following functions write numeric vales to a CFILE. All values are
|
|
|
|
// stored to the file in Intel (little-endian) format.
|
2024-04-16 03:43:29 +00:00
|
|
|
// All these throw an exception if there's an error on write.
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// Write an integer (32 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
|
|
|
typedef void (*File_WriteInt_fp)(int i, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteInt_fp File_WriteInt;
|
|
|
|
|
2024-05-24 03:27:12 +00:00
|
|
|
// void File_WriteShort(int16_t s,void *fileptr);
|
|
|
|
// Write a int16_t (16 bits)
|
2024-04-16 18:56:40 +00:00
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
2024-05-24 03:27:12 +00:00
|
|
|
typedef void (*File_WriteShort_fp)(int16_t s, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteShort_fp File_WriteShort;
|
|
|
|
|
2024-05-24 03:05:05 +00:00
|
|
|
// void File_WriteByte(int8_t b,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair.
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
2024-05-24 03:05:05 +00:00
|
|
|
typedef void (*File_WriteByte_fp)(int8_t b, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteByte_fp File_WriteByte;
|
|
|
|
|
|
|
|
// void File_WriteFloat(float f,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Write a float (32 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
|
|
|
typedef void (*File_WriteFloat_fp)(float f, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteFloat_fp File_WriteFloat;
|
|
|
|
|
|
|
|
// void File_WriteDouble(double d,void *fileptr);
|
2024-04-16 18:56:40 +00:00
|
|
|
// Write a double (64 bits)
|
|
|
|
// Throws an exception of type (cfile_error *) if the OS returns an error on write
|
|
|
|
typedef void (*File_WriteDouble_fp)(double d, void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_WriteDouble_fp File_WriteDouble;
|
|
|
|
|
|
|
|
// void *Scrpt_MemAlloc(tOSIRISMEMCHUNK *mem_info);
|
|
|
|
// Allocates a chunk of memory to be associated with a script. It will automatically
|
|
|
|
// save this memory to disk on game save, and will pass the pointer to this memory on EVT_MEMRESTORE
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void *(*Scrpt_MemAlloc_fp)(tOSIRISMEMCHUNK *mem_info);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_MemAlloc_fp Scrpt_MemAlloc;
|
|
|
|
|
|
|
|
// void Scrpt_MemFree(void *memory_ptr);
|
|
|
|
// Frees a chunk of memory that was allocated by Scrpt_MemAlloc().
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Scrpt_MemFree_fp)(void *memory_ptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_MemFree_fp Scrpt_MemFree;
|
|
|
|
|
|
|
|
// void Scrpt_CancelTimer(int timer_id);
|
2024-09-03 11:03:41 +00:00
|
|
|
// Cancels a timer thats in use, given its ID
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Scrpt_CancelTimer_fp)(int timer_id);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_CancelTimer_fp Scrpt_CancelTimer;
|
|
|
|
|
|
|
|
// int Scrpt_CreateTimer(tOSIRISTIMER *timer_info);
|
|
|
|
// Adds a timer to the list to be processed. You'll receive a EVT_TIMER when the timer is signaled.
|
|
|
|
// Returns an id to the timer, which can be used to cancel a timer. -1 on error.
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Scrpt_CreateTimer_fp)(tOSIRISTIMER *timer_info);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_CreateTimer_fp Scrpt_CreateTimer;
|
|
|
|
|
|
|
|
// void MSafe_DoPowerup (msafe_struct *mstruct);
|
|
|
|
// Does whatever magic needs to be done to get the default powerups to work
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*MSafe_DoPowerup_fp)(msafe_struct *mstruct);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN MSafe_DoPowerup_fp MSafe_DoPowerup;
|
|
|
|
|
2024-05-24 03:16:40 +00:00
|
|
|
// int Obj_Create()(uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle)
|
|
|
|
typedef int (*Obj_Create_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle,
|
2024-04-16 18:56:40 +00:00
|
|
|
vector *initial_velocity);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_Create_fp Obj_CreateFP;
|
2024-05-24 03:16:40 +00:00
|
|
|
static inline int Obj_Create(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient = NULL,
|
2024-05-07 21:35:28 +00:00
|
|
|
int parent_handle = 0, vector *initial_velocity = NULL) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return Obj_CreateFP(type, id, roomnum, pos, orient, parent_handle, initial_velocity);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
// float Game_GetTime() (void)
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef float (*Game_GetTime_fp)(void);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Game_GetTime_fp Game_GetTime;
|
|
|
|
|
|
|
|
// float Game_GetFrameTime() (void)
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef float (*Game_GetFrameTime_fp)(void);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Game_GetFrameTime_fp Game_GetFrameTime;
|
|
|
|
|
|
|
|
// void Obj_WBValue() (int obj_handle, char wb_index, char op, char vtype, void *ptr, char g_index)
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_WBValue_fp)(int obj_handle, char wb_index, char op, char vtype, void *ptr, char g_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_WBValue_fp Obj_WBValueFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_WBValue(int obj_handle, char wb_index, char op, char vtype, void *ptr, char g_index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_WBValueFP(obj_handle, wb_index, op, vtype, ptr, g_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// uint8_t Scrpt_TimerExists(int handle);
|
|
|
|
typedef uint8_t (*Scrpt_TimerExists_fp)(int handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_TimerExists_fp Scrpt_TimerExists;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Matcen_Reset_fp)(int handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Matcen_Reset_fp Matcen_Reset;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Matcen_Copy_fp)(int dhandle, int shandle);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Matcen_Copy_fp Matcen_Copy;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Matcen_Create_fp)(char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Matcen_Create_fp Matcen_Create;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Matcen_FindID_fp)(char *str);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Matcen_FindID_fp Matcen_FindID;
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
// void Msn_FlagSet(int flag,uint8_t value);
|
2024-04-16 03:43:29 +00:00
|
|
|
// Sets/Clears mission flags. flag is which mission flag to set/clear (1-32)
|
|
|
|
// value is 0 to clear, or 1 to set
|
2024-05-24 03:07:26 +00:00
|
|
|
typedef void (*Msn_FlagSet_fp)(int flag, uint8_t value);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Msn_FlagSet_fp Msn_FlagSet;
|
|
|
|
|
|
|
|
// int Msn_FlagGet(int flag);
|
|
|
|
// Gets a mission flag. flag is what mission flag to get. Returns 1 if set, 0 if not.
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Msn_FlagGet_fp)(int flag);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Msn_FlagGet_fp Msn_FlagGet;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Player_Value_fp)(int obj_handle, char op, char vhandle, void *ptr, int index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Player_Value_fp Player_ValueFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Player_Value(int obj_handle, char op, char vhandle, void *ptr, int index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Player_ValueFP(obj_handle, op, vhandle, ptr, index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_SetCustomAnim_fp)(int handle, float start, float end, float time, char flags, int sound_handle,
|
|
|
|
char next_anim_type);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_SetCustomAnim_fp Obj_SetCustomAnimFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_SetCustomAnim(int handle, float start, float end, float time, char flags, int sound_handle = -1,
|
|
|
|
char next_anim_type = -1) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_SetCustomAnimFP(handle, start, end, time, flags, sound_handle, next_anim_type);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef void (*Player_AddHudMessage_fp)(int handle, const char *str);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Player_AddHudMessage_fp Player_AddHudMessage;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_Ghost_fp)(int handle, bool f_ghost);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_Ghost_fp Obj_Ghost;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Obj_Burning_fp)(int handle, float time, float damage_per_second);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_Burning_fp Obj_BurningFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Obj_Burning(int handle, float time, float damage_per_second = 1.0f) {
|
2024-04-16 18:56:40 +00:00
|
|
|
Obj_BurningFP(handle, time, damage_per_second);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef bool (*Obj_IsEffect_fp)(int handle, int type_flag);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_IsEffect_fp Obj_IsEffect;
|
|
|
|
|
|
|
|
// opens a cfile for reading/writing (works just like fopen())
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void *(*File_Open_fp)(const char *filename, const char *mode);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_Open_fp File_Open;
|
|
|
|
|
|
|
|
// closes a cfile (like fclose())
|
|
|
|
typedef void (*File_Close_fp)(void *fileptr);
|
|
|
|
OSIRISEXTERN File_Close_fp File_Close;
|
|
|
|
|
|
|
|
// returns the current position of the file (like ftell())
|
|
|
|
typedef int (*File_Tell_fp)(void *fileptr);
|
|
|
|
OSIRISEXTERN File_Tell_fp File_Tell;
|
|
|
|
|
|
|
|
// returns 1 if the file is at the EOF, else 0 (like feof())
|
2024-05-24 03:07:26 +00:00
|
|
|
typedef uint8_t (*File_eof_fp)(void *fileptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN File_eof_fp File_eof;
|
|
|
|
|
|
|
|
typedef void (*Sound_Stop_fp)(int s_handle, bool f_immediately);
|
|
|
|
OSIRISEXTERN Sound_Stop_fp Sound_StopFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Sound_Stop(int s_handle, bool f_immediately = true) { Sound_StopFP(s_handle, f_immediately); }
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
typedef int (*Sound_Play2d_fp)(int obj_handle, int s_id, float volume);
|
|
|
|
OSIRISEXTERN Sound_Play2d_fp Sound_Play2dFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline int Sound_Play2d(int obj_handle, int s_id, float volume = 1.0f) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return Sound_Play2dFP(obj_handle, s_id, volume);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef int (*Sound_Play3d_fp)(int obj_handle, int s_id, float volume);
|
|
|
|
OSIRISEXTERN Sound_Play3d_fp Sound_Play3dFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline int Sound_Play3d(int obj_handle, int s_id, float volume = 1.0f) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return Sound_Play3dFP(obj_handle, s_id, volume);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Sound_FindId_fp)(const char *s_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Sound_FindId_fp Sound_FindId;
|
|
|
|
|
|
|
|
typedef bool (*AI_IsObjFriend_fp)(int obj_handle, int it_handle);
|
|
|
|
OSIRISEXTERN AI_IsObjFriend_fp AI_IsObjFriend;
|
|
|
|
|
|
|
|
typedef bool (*AI_IsObjEnemy_fp)(int obj_handle, int it_handle);
|
|
|
|
OSIRISEXTERN AI_IsObjEnemy_fp AI_IsObjEnemy;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef bool (*AI_GoalValue_fp)(int obj_handle, char g_index, char op, char vtype, void *ptr, char index);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GoalValue_fp AI_GoalValueFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline bool AI_GoalValue(int obj_handle, char g_index, char op, char vtype, void *ptr, char index = 0) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return AI_GoalValueFP(obj_handle, g_index, op, vtype, ptr, index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*AI_GetNearbyObjs_fp)(vector *pos, int init_roomnum, float rad, int *object_handle_list, int max_elements,
|
|
|
|
bool f_lightmap_only, bool f_only_players_and_ais,
|
|
|
|
bool f_include_non_collide_objects, bool f_stop_at_closed_doors);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN AI_GetNearbyObjs_fp AI_GetNearbyObjsFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline int AI_GetNearbyObjs(vector *pos, int init_roomnum, float rad, int *object_handle_list, int max_elements,
|
|
|
|
bool f_lightmap_only, bool f_only_players_and_ais = true,
|
|
|
|
bool f_include_non_collide_objects = false, bool f_stop_at_closed_doors = true) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return AI_GetNearbyObjsFP(pos, init_roomnum, rad, object_handle_list, max_elements, f_lightmap_only,
|
|
|
|
f_only_players_and_ais, f_include_non_collide_objects, f_stop_at_closed_doors);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef char (*AI_GetCurGoalIndex_fp)(int obj_handle);
|
|
|
|
OSIRISEXTERN AI_GetCurGoalIndex_fp AI_GetCurGoalIndex;
|
|
|
|
|
|
|
|
// Allocates a block of global memory for this module, of size amount_of_memory.
|
|
|
|
// unique_identfier is the script provided unique ID which is used throughout.
|
2024-04-16 18:56:40 +00:00
|
|
|
// script_identifier is the pointer of data provided to the script in it's InitializeDLL function (really the name of
|
|
|
|
// the script) Returns -1 if there isn't enough available memory Returns -2 if the unique identifier passed in is
|
|
|
|
// already used, but the requested amount_of_memory is different If the memory has already been allocated, it will
|
|
|
|
// return the handle.
|
2024-05-24 02:57:25 +00:00
|
|
|
typedef OMMSHANDLE (*OMMS_Malloc_fp)(size_t amount_of_memory, uint32_t unique_identifier, char *script_identifier);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN OMMS_Malloc_fp OMMS_Malloc;
|
|
|
|
|
|
|
|
// Attaches to a block of global OMMS memory. As long as at least one module (or script) is
|
|
|
|
// attached to a module, the memory will not be deleted. (Increments the reference count)
|
|
|
|
// Returns NULL if the memory couldn't be attached (it has been either free'd or never malloced)
|
|
|
|
typedef void *(*OMMS_Attach_fp)(OMMSHANDLE handle);
|
|
|
|
OSIRISEXTERN OMMS_Attach_fp OMMS_Attach;
|
|
|
|
|
|
|
|
// Detaches a block of global OMMS memory. (Reduces the reference count).
|
|
|
|
typedef void (*OMMS_Detach_fp)(OMMSHANDLE handle);
|
|
|
|
OSIRISEXTERN OMMS_Detach_fp OMMS_Detach;
|
|
|
|
|
|
|
|
// Frees a block of global memory
|
|
|
|
// Only has affect if you are attached to the memory. Memory will _ONLY_ be deleted when the
|
|
|
|
// following conditions are meant for the shared memory block:
|
2024-04-16 18:56:40 +00:00
|
|
|
// 1) The reference count for the global memory is at 0 (OMMS_Attach() adds to reference count, OMMS_Detach()
|
2024-04-16 20:46:12 +00:00
|
|
|
// subtracts). 2) OMMS_Free() has been called for the block of global memory. The conditions can happen in any order,
|
|
|
|
// but
|
|
|
|
// as soon as both are satisfied, the memory becomes deleted and any pointer returned by OMMS_Attach() becomes
|
|
|
|
// invalid.
|
2024-04-16 18:56:40 +00:00
|
|
|
//
|
2024-04-16 03:43:29 +00:00
|
|
|
// handle : the value returned by OMMS_Malloc()
|
|
|
|
typedef void (*OMMS_Free_fp)(OMMSHANDLE handle);
|
|
|
|
OSIRISEXTERN OMMS_Free_fp OMMS_Free;
|
|
|
|
|
|
|
|
// Returns an OMMSHANDLE to a block of global memory allocated by a module/script. Pass
|
|
|
|
// in the unique_identifier and the script_identifier that was passed in the OMMS_Malloc().
|
|
|
|
// Note: script_identifier is really the filename of the module that called the OMMS_Malloc().
|
|
|
|
// Returns -1 if the module was never OMMS_Malloc()'d.
|
2024-05-24 02:57:25 +00:00
|
|
|
typedef OMMSHANDLE (*OMMS_Find_fp)(uint32_t unique_identifier, char *script_identifier);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN OMMS_Find_fp OMMS_Find;
|
|
|
|
|
2024-09-03 11:03:41 +00:00
|
|
|
// Returns information about the OMMS memory given its handle returned from the OMMS_Find() or
|
2024-04-16 03:43:29 +00:00
|
|
|
// OMMS_Malloc(). Returns 0 if the handle was invalid, 1 if the information has been filled in;
|
|
|
|
// Pass NULL in for those parameters you don't need information about.
|
2024-05-24 03:16:40 +00:00
|
|
|
typedef char (*OMMS_GetInfo_fp)(OMMSHANDLE handle, uint32_t *mem_size, uint32_t *uid, uint16_t *reference_count,
|
2024-05-24 03:07:26 +00:00
|
|
|
uint8_t *has_free_been_called);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN OMMS_GetInfo_fp OMMS_GetInfo;
|
|
|
|
|
|
|
|
// Starts an in-game cinematic sequence. text_string is the text to be displayed
|
2024-09-03 11:25:21 +00:00
|
|
|
// use pipes (|) to separate lines.
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef bool (*Cine_Start_fp)(tGameCinematic *info, const char *text_string);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Cine_Start_fp Cine_Start;
|
|
|
|
|
|
|
|
// Stops and clears up a in-game cinematic.
|
|
|
|
typedef void (*Cine_Stop_fp)(void);
|
|
|
|
OSIRISEXTERN Cine_Stop_fp Cine_Stop;
|
|
|
|
|
|
|
|
// Looks up the id's of the sound, room, trigger, object, ect. based on the name
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindSoundName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindSoundName_fp Scrpt_FindSoundName;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindRoomName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindRoomName_fp Scrpt_FindRoomName;
|
2024-04-16 18:56:40 +00:00
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindTriggerName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindTriggerName_fp Scrpt_FindTriggerName;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindObjectName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindObjectName_fp Scrpt_FindObjectName;
|
|
|
|
|
|
|
|
typedef int (*Scrpt_GetTriggerRoom_fp)(int trigger_id);
|
|
|
|
OSIRISEXTERN Scrpt_GetTriggerRoom_fp Scrpt_GetTriggerRoom;
|
|
|
|
|
|
|
|
typedef int (*Scrpt_GetTriggerFace_fp)(int trigger_id);
|
|
|
|
OSIRISEXTERN Scrpt_GetTriggerFace_fp Scrpt_GetTriggerFace;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindDoorName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindDoorName_fp Scrpt_FindDoorName;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindTextureName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindTextureName_fp Scrpt_FindTextureName;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef void (*Game_CreateRandomSparks_fp)(int num_sparks, vector *pos, int roomnum, int which_index,
|
|
|
|
float force_scalar);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Game_CreateRandomSparks_fp Game_CreateRandomSparksFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void Game_CreateRandomSparks(int num_sparks, vector *pos, int roomnum, int which_index = -1,
|
|
|
|
float force_scalar = 1.0f) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return Game_CreateRandomSparksFP(num_sparks, pos, roomnum, which_index, force_scalar);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cancels a timer given its ID
|
|
|
|
typedef void (*Scrpt_CancelTimerID_fp)(int id);
|
|
|
|
OSIRISEXTERN Scrpt_CancelTimerID_fp Scrpt_CancelTimerID;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// disable/enable ship
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef void (*Game_EnableShip_fp)(const char *ship_name, bool enable);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Game_EnableShip_fp Game_EnableShip;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// is ship enabled
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef bool (*Game_IsShipEnabled_fp)(const char *ship_name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Game_IsShipEnabled_fp Game_IsShipEnabled;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// gets information about a path point
|
|
|
|
// pass NULL for parameters not needed.
|
2024-04-16 03:43:29 +00:00
|
|
|
// pathid: path number
|
|
|
|
// point: which path point
|
2024-04-16 18:56:40 +00:00
|
|
|
// returns true if operation was successful
|
|
|
|
typedef bool (*Path_GetInformation_fp)(int pathid, int point, vector *pos, int *room, matrix *orient);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Path_GetInformation_fp Path_GetInformationFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline bool Path_GetInformation(int pathid, int point, vector *pos = NULL, int *room = NULL,
|
|
|
|
matrix *orient = NULL) {
|
2024-04-16 18:56:40 +00:00
|
|
|
return Path_GetInformationFP(pathid, point, pos, room, orient);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
2024-04-16 18:56:40 +00:00
|
|
|
// starts a canned cinematic sequence
|
2024-04-16 03:43:29 +00:00
|
|
|
typedef void (*Cine_StartCanned_fp)(tCannedCinematicInfo *info);
|
|
|
|
OSIRISEXTERN Cine_StartCanned_fp Cine_StartCanned;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindMatcenName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindMatcenName_fp Scrpt_FindMatcenName;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindPathName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindPathName_fp Scrpt_FindPathName;
|
|
|
|
|
2024-04-28 04:39:29 +00:00
|
|
|
typedef int (*Scrpt_FindLevelGoalName_fp)(const char *name);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Scrpt_FindLevelGoalName_fp Scrpt_FindLevelGoalName;
|
|
|
|
|
|
|
|
typedef void (*LGoal_Value_fp)(char op, char vtype, void *ptr, int g_index, int i_index);
|
|
|
|
OSIRISEXTERN LGoal_Value_fp LGoal_ValueFP;
|
2024-05-07 21:35:28 +00:00
|
|
|
static inline void LGoal_Value(char op, char vtype, void *ptr, int g_index = -1, int i_index = -1) {
|
2024-04-16 18:56:40 +00:00
|
|
|
LGoal_ValueFP(op, vtype, ptr, g_index, i_index);
|
2024-04-16 03:43:29 +00:00
|
|
|
}
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
typedef int (*Obj_MakeListOfType_fp)(int objhandle, int type, int id, bool f_ignore_init_room, int parent_handle,
|
|
|
|
int max_recorded, int *handles);
|
2024-04-16 03:43:29 +00:00
|
|
|
OSIRISEXTERN Obj_MakeListOfType_fp Obj_MakeListOfType;
|
|
|
|
|
|
|
|
typedef void (*Obj_Kill_fp)(int handle, int killer_handle, float damage, int flags, float min_time, float max_time);
|
|
|
|
OSIRISEXTERN Obj_Kill_fp Obj_Kill;
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// typedef bool (*AI_AreRoomsReachable_fp)(int room1, int room2);
|
|
|
|
// OSIRISEXTERN AI_AreRoomsReachable_fp AI_AreRoomsReachable;
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
typedef bool (*AI_IsDestReachable_fp)(int handle, int room);
|
|
|
|
OSIRISEXTERN AI_IsDestReachable_fp AI_IsDestReachable;
|
|
|
|
|
|
|
|
typedef bool (*AI_IsObjReachable_fp)(int handle, int target);
|
|
|
|
OSIRISEXTERN AI_IsObjReachable_fp AI_IsObjReachable;
|
|
|
|
|
|
|
|
typedef char (*Game_GetDiffLevel_fp)(void);
|
|
|
|
OSIRISEXTERN Game_GetDiffLevel_fp Game_GetDiffLevel;
|
|
|
|
|
|
|
|
/*
|
|
|
|
0:LANGUAGE_ENGLISH
|
|
|
|
1:LANGUAGE_GERMAN
|
|
|
|
2:LANGUAGE_SPANISH
|
|
|
|
3:LANGUAGE_ITALIAN
|
|
|
|
4:LANGUAGE_FRENCH
|
|
|
|
*/
|
|
|
|
typedef int (*Game_GetLanguage_fp)(void);
|
|
|
|
OSIRISEXTERN Game_GetLanguage_fp Game_GetLanguage;
|
|
|
|
|
|
|
|
// Sets/Gets information about a path.
|
2024-09-03 11:03:41 +00:00
|
|
|
// If you change is PV_ALL (or any of its individual components), pass in a pointer to an
|
2024-04-16 03:43:29 +00:00
|
|
|
// osiris_path_node_info struct. For the others, you must pass in an appropriate pointer
|
|
|
|
// (i.e. an int* for PV_I_NUMNODES). You can only set PV_ALL components.
|
|
|
|
// for PV_I_NUMNODES, path_id MUST be specified, node_id is ignored
|
|
|
|
// for PV_I_NUMPATHS, path_id and node_id are ignored
|
|
|
|
// for PV_CS_NAME, path_id MUST be specified, node_id is ignored
|
|
|
|
// for PV_ALL components, path_id and node_id MUST be valid.
|
|
|
|
typedef void (*Path_Value_fp)(int path_id, int node_id, char op, int changes, void *ptr);
|
|
|
|
OSIRISEXTERN Path_Value_fp Path_Value;
|
|
|
|
|
|
|
|
// ===========================================================
|
|
|
|
|
|
|
|
// osicommon_Initialize
|
|
|
|
// Initializes module's functions
|
|
|
|
void osicommon_Initialize(tOSIRISModuleInit *mi);
|