| 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 | #ifndef DLLWRAPPERS_H_ |
| 20 | #define DLLWRAPPERS_H_cxx . . $ `Descent3/DllWrappers.h:20:9`! |
| 21 | |
| 22 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 23 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 24 | #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/ |
| 25 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 26 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 27 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 28 | #include "d3movie.h"cxx . . $ `<file>/Descent3/d3movie.h`/ |
| 29 | #include "program.h"cxx . . $ `<file>/Descent3/program.h`/ |
| 30 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 31 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 32 | #include "Inventory.h"cxx . . $ `<file>/Descent3/Inventory.h`/ |
| 33 | |
| 34 | // plays a 3dsound |
| 35 | int D3W_Play3dSoundcxx . . $ D3W_Play3dSound(eb9e5361a7e3f0cb).(int sound_index, objectcxx . . $ object# *cur_obj, float volume = MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!, int flags = 0); |
| 36 | int D3W_Play2dSoundcxx . . $ D3W_Play2dSound(85d2224b692a43c3).(int sound_index, float volume); |
| 37 | void D3W_TouchSoundcxx . . $ D3W_TouchSound(d4f767463ce0a6b3).(int sound_index); |
| 38 | |
| 39 | // for mprintfs |
| 40 | void MonoPrintfcxx . . $ MonoPrintf(26800c7917ec8ef2).(int n, char *format, ...); |
| 41 | // checks a players inventory for an object type/id |
| 42 | bool InvCheckItemcxx . . $ InvCheckItem(1432650661211742).(int playernum, int type, int id); |
| 43 | // adds an object to a player inventory |
| 44 | bool InvAddcxx . . $ InvAdd(d142aa20116cae89).(int playernum, objectcxx . . $ object# *obj, bool remove = true); |
| 45 | // adds a type/id to a player inventory |
| 46 | bool InvAddTypeIDcxx . . $ InvAddTypeID(6580048bba52c434).(int playernum, int type, int id, int aux_type = -1, int aux_id = -1, int flags = 0, const char *description = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 47 | // removes a type/id from a players inventory |
| 48 | bool InvRemovecxx . . $ InvRemove(1432650661211742).(int playernum, int type, int id); |
| 49 | // returns how many of a type/id a player has in his inventory |
| 50 | int InvGetTypeIDCountcxx . . $ InvGetTypeIDCount(2326284602b0bb2d).(int playernum, int type, int id); |
| 51 | // Inventory Reset wrapper |
| 52 | void InvResetcxx . . $ InvReset(918ebd27a9ddbad3).(int playernum, bool reset_all = true); |
| 53 | // wraps cfopen |
| 54 | void OpenCFILEcxx . . $ OpenCFILE(8b9fe21fada90ed7).(CFILEcxx . . $ CFILE# **handle, const stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# &filename, const char *mode); |
| 55 | // wrapper for ObjGetUltimateParent |
| 56 | void GetUltimateParentForObjectcxx . . $ GetUltimateParentForObject(a22b5da94f20d523).(objectcxx . . $ object# **parent, objectcxx . . $ object# *child); |
| 57 | // sets an object's flag dead |
| 58 | void SetObjectDeadFlagDLLcxx . . $ SetObjectDeadFlagDLL(80a724877f6428f2).(objectcxx . . $ object# *obj, bool tell_client_to_remove = false, bool tell_clients_to_play_sound = false); |
| 59 | // Assert for the DLLs |
| 60 | void assertdllcxx . . $ assertdll(1b1f57aaeb769edb).(int x, const char *expression, const char *file, int line); |
| 61 | void RetrieveUICallbackcxx . . $ RetrieveUICallback(539e082cf00e1f43).(void **fn); |
| 62 | |
| 63 | // Registry database functions |
| 64 | bool dDatabaseRead1cxx . . $ dDatabaseRead1(3bcbb53201fcdcb8).(const char *label, char *entry, int *entrylen); |
| 65 | bool dDatabaseRead2cxx . . $ dDatabaseRead2(340cb0a925eda13d).(const char *label, void *entry, int wordsize); |
| 66 | bool dDatabaseRead3cxx . . $ dDatabaseRead3(c1ce79fc3dc965f1).(const char *label, bool *entry); |
| 67 | bool dDatabaseWrite1cxx . . $ dDatabaseWrite1(f827cee075336303).(const char *label, const char *entry, int entrylen); |
| 68 | bool dDatabaseWrite2cxx . . $ dDatabaseWrite2(2551bed5d6fc04f6).(const char *label, int entry); |
| 69 | bool dObjGetcxx . . $ dObjGet(5dbac99189234a88).(int handle, objectcxx . . $ object# **obj); |
| 70 | |
| 71 | // Attaches 2 objects via attach points on each. The f_used_aligned allows for an aligned connection. |
| 72 | // NOTE: The child always moves to the parent |
| 73 | bool dAttachObjectcxx . . $ dAttachObject(f6b18a350068acc8).(objectcxx . . $ object# *parent, char parent_ap, objectcxx . . $ object# *child, char child_ap, bool f_use_aligned = false); |
| 74 | // Attaches a child object to a parent object by a percent of the radius of the child. |
| 75 | // NOTE: The child always moves to the parent and not the reverse |
| 76 | bool dAttachObjectRadiuscxx . . $ dAttachObjectRadius(45561ecb6c1b979f).(objectcxx . . $ object# *parent, char parent_ap, objectcxx . . $ object# *child, float percent_rad); |
| 77 | // Unattaches all children from a parent object |
| 78 | bool dUnattachChildrencxx . . $ dUnattachChildren(39516aeee13ca5ab).(objectcxx . . $ object# *parent); |
| 79 | // Unattaches a child from an attach point |
| 80 | bool dUnattachChildcxx . . $ dUnattachChild(9646b7081aeecba4).(objectcxx . . $ object# *parent, char parent_ap); |
| 81 | // Unattaches an object from its parent |
| 82 | bool dUnattachFromParentcxx . . $ dUnattachFromParent(39516aeee13ca5ab).(objectcxx . . $ object# *child); |
| 83 | // Set a vector to {0,0,0} |
| 84 | void dvm_MakeZeroVectorcxx . . $ dvm_MakeZeroVector(ec8cf6451c36d470).(vectorcxx . . $ vector# *v); |
| 85 | void dvm_MakeZeroAnglecxx . . $ dvm_MakeZeroAngle(7b076424e81684e7).(angveccxx . . $ angvec# *v); |
| 86 | void dStartFramecxx . . $ dStartFrame(d7a7761809021567).(int x, int y, int x2, int y2, bool clear); |
| 87 | |
| 88 | // ObjSetPos, that automatically sets the OF_MOVED_THIS_FRAME |
| 89 | void ObjSetPosAndMarkMovedcxx . . $ ObjSetPosAndMarkMoved(bbb518390bedd509).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos, int roomnum, matrixcxx . . $ matrix# *orient, bool f_update_attached_children); |
| 90 | // SetObjectDeadFlag that automatically writes out demo data |
| 91 | void dSetObjectDeadFlagWDemocxx . . $ dSetObjectDeadFlagWDemo(80a724877f6428f2).(objectcxx . . $ object# *obj, bool tell_clients_to_remove = false, bool tell_clients_to_play_sound = false); |
| 92 | void dSetAudioTauntscxx . . $ dSetAudioTaunts(b45ddcbc8423892c).(bool enable); |
| 93 | |
| 94 | // Changes the ship_index for a given player |
| 95 | void ChangePlayerShipIndexcxx . . $ ChangePlayerShipIndex(3e454b8ccf442868).(int pnum, int ship_index); |
| 96 | |
| 97 | // adds a type/id item to the inventory (returns true on success) |
| 98 | bool dInven_Addcxx . . $ dInven_Add(228272444bb020af).(Inventorycxx . . $ Inventory# *inven, int type, int id, objectcxx . . $ object# *parent = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, int aux_type = -1, int aux_id = -1, |
| 99 | int flags = 0, char *description = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 100 | // adds an object to the inventory (marked by it's objhandle) |
| 101 | bool dInven_AddObjectcxx . . $ dInven_AddObject(5cf1ce72a3cf15c3).(Inventorycxx . . $ Inventory# *inven, int object_handle, int flags = 0, char *description = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 102 | // adds a special cased CounterMeasure into the inventory |
| 103 | bool dInven_AddCounterMeasurecxx . . $ dInven_AddCounterMeasure(7a2879b1c631501d).(Inventorycxx . . $ Inventory# *inven, int id, int aux_type = -1, int aux_id = -1, int flags = 0, |
| 104 | char *description = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 105 | // removes an item from the inventory (reduces it's count by one...if there is no more, then it goes bye-bye) |
| 106 | // to remove an object that was added via objhandle, then pass the objhandle |
| 107 | // in the 'type' parameter, and don't pass in an id. |
| 108 | bool dInven_Removecxx . . $ dInven_Remove(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id = -1); |
| 109 | // uses an item in the inventory (also reduces its count by one...if there is no more, then it goes bye-bye) |
| 110 | bool dInven_Usecxx . . $ dInven_Use(bd9cb6ec824dfd91).(Inventorycxx . . $ Inventory# *inven, int type, int id, objectcxx . . $ object# *parent = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 111 | // uses an item in the inventory (given it's objhandle). |
| 112 | bool dInven_UseObjHandlecxx . . $ dInven_UseObjHandle(870da7b69dc70a24).(Inventorycxx . . $ Inventory# *inven, int objhandle, objectcxx . . $ object# *parent = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 113 | // returns how many unique type/ids are in the inventory |
| 114 | int dInven_Sizecxx . . $ dInven_Size(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven); |
| 115 | // returns true if there is an item in the inventory with the given type/id (or objhandle if id is -1, pass the object |
| 116 | // handle as the type parameter) |
| 117 | bool dInven_CheckItemcxx . . $ dInven_CheckItem(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id = -1); |
| 118 | // Resets the inventory, cleaning it out |
| 119 | // in_game: set to true if this is being called from during gameplay |
| 120 | // reset_stage: |
| 121 | // INVRESET_ALL: Reset _EVERYTHING_ |
| 122 | // INVRESET_LEVELCHANGE: Remove everything except those that last across levels |
| 123 | // INVRESET_DEATHSPEW: Remove everything except those that do not spew (Default) |
| 124 | void dInven_Resetcxx . . $ dInven_Reset(551e33599b9c3271).(Inventorycxx . . $ Inventory# *inven, bool in_game, int reset_stage = INVRESET_DEATHSPEWcxx . . $ `Descent3/Inventory.h:203:9`!); |
| 125 | // resets the position pointer in the list to the beginning |
| 126 | void dInven_ResetPoscxx . . $ dInven_ResetPos(85ee5073fec11d06).(Inventorycxx . . $ Inventory# *inven); |
| 127 | // moves the position pointer to the next inventory item |
| 128 | // skip : if true then skip over non-selectable items |
| 129 | void dInven_NextPoscxx . . $ dInven_NextPos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool skip = false); |
| 130 | // moves the position pointer to the previous inventory item |
| 131 | // skip : if true then skip over non-selectable items |
| 132 | void dInven_PrevPoscxx . . $ dInven_PrevPos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool skip = false); |
| 133 | // returns the type/id of the item at the current position |
| 134 | // return true if it is a real object (meaning it was placed in the inventory |
| 135 | // via an object handle...so id will be -1) |
| 136 | bool dInven_GetPosTypeIDcxx . . $ dInven_GetPosTypeID(50ea0760c180cfea).(Inventorycxx . . $ Inventory# *inven, int &type, int &id); |
| 137 | // returns the aux type/id of the item |
| 138 | // return true if it is a real object (meaning it was placed in the inventory |
| 139 | // via an object handle...so id will be -1) |
| 140 | bool dInven_GetAuxPosTypeIDcxx . . $ dInven_GetAuxPosTypeID(50ea0760c180cfea).(Inventorycxx . . $ Inventory# *inven, int &type, int &id); |
| 141 | // returns the description of the item at the current position |
| 142 | char *dInven_GetPosDescriptioncxx . . $ dInven_GetPosDescription(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven); |
| 143 | // returns the icon name of the item at the current position |
| 144 | char *dInven_GetPosIconNamecxx . . $ dInven_GetPosIconName(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven); |
| 145 | // returns the name of the item at the current position |
| 146 | char *dInven_GetPosNamecxx . . $ dInven_GetPosName(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven); |
| 147 | // return information about the current position item |
| 148 | // return true if it is a real object |
| 149 | bool dInven_GetPosInfocxx . . $ dInven_GetPosInfo(d5b544a04313fd7).(Inventorycxx . . $ Inventory# *inven, uint16_tcxx . . $ uint16_t# &iflags, int &flags); |
| 150 | // returns the count of the item at the current position |
| 151 | int dInven_GetPosCountcxx . . $ dInven_GetPosCount(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven); |
| 152 | // returns true if the position pointer is at the begining of the inventory list |
| 153 | bool dInven_AtBeginningcxx . . $ dInven_AtBeginning(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven); |
| 154 | // returns false if the position pointer is at the end of the inventory list |
| 155 | bool dInven_AtEndcxx . . $ dInven_AtEnd(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven); |
| 156 | // jump right to an item in the inventory |
| 157 | void dInven_GotoPoscxx . . $ dInven_GotoPos(35c6c905282b7da0).(Inventorycxx . . $ Inventory# *inven, int newpos); |
| 158 | // jump right to an item in the inventory give it's type and id |
| 159 | // to jump to an item that was added via object handle, pass the object |
| 160 | // handle in as the type, and make id -1. |
| 161 | void dInven_GotoPosTypeIDcxx . . $ dInven_GotoPosTypeID(6a06e465d609a715).(Inventorycxx . . $ Inventory# *inven, int type, int id); |
| 162 | // uses the currently selected item |
| 163 | bool dInven_UsePoscxx . . $ dInven_UsePos(b45c7c16050fe3a6).(Inventorycxx . . $ Inventory# *inven, objectcxx . . $ object# *parent = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 164 | // returns the 'index' position of the current position |
| 165 | int dInven_GetPoscxx . . $ dInven_GetPos(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven); |
| 166 | // checks the pos, if its on a nonselectable item it will move to the next selectable (NULL if none) |
| 167 | void dInven_ValidatePoscxx . . $ dInven_ValidatePos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool forward = true); |
| 168 | // returns whether an item is selectable |
| 169 | bool dInven_IsSelectablecxx . . $ dInven_IsSelectable(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven); |
| 170 | bool dInven_IsUsablecxx . . $ dInven_IsUsable(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven); |
| 171 | // returns how many of an type/id is in the inventory |
| 172 | // for object handle items, pass the object handle in as the type and leave |
| 173 | // id as -1 |
| 174 | int dInven_GetTypeIDCountcxx . . $ dInven_GetTypeIDCount(de06e22421169a70).(Inventorycxx . . $ Inventory# *inven, int type, int id); |
| 175 | // searches the inventory for the specified type/id, sets the pos to it |
| 176 | // for object handle items, pass the object handle in as the type and leave |
| 177 | // id as -1 |
| 178 | bool dInven_FindPoscxx . . $ dInven_FindPos(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id = -1); |
| 179 | // gets a detailed list of information about what is in the inventory |
| 180 | // returns the number of items filled in. |
| 181 | int dInven_GetInventoryItemListcxx . . $ dInven_GetInventoryItemList(1050e51dfeed52f9).(Inventorycxx . . $ Inventory# *inven, tInvenListcxx . . $ tInvenList# *list, int max_amount, int *cur_sel); |
| 182 | |
| 183 | #endif |