| 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 | #include <cstdarg> |
| 20 | #include <cstdio> |
| 21 | |
| 22 | #include "DllWrappers.h"cxx . . $ `<file>/Descent3/DllWrappers.h`/ |
| 23 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 24 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 25 | #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/ |
| 26 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 27 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 28 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 29 | #include "d3movie.h"cxx . . $ `<file>/Descent3/d3movie.h`/ |
| 30 | #include "program.h"cxx . . $ `<file>/Descent3/program.h`/ |
| 31 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 32 | #include "objinit.h"cxx . . $ `<file>/Descent3/objinit.h`/ |
| 33 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 34 | #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/ |
| 35 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 36 | #include "appdatabase.h"cxx . . $ `<file>/lib/appdatabase.h`/ |
| 37 | #include "attach.h"cxx . . $ `<file>/Descent3/attach.h`/ |
| 38 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 39 | #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/ |
| 40 | #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/ |
| 41 | #include "audiotaunts.h"cxx . . $ `<file>/Descent3/audiotaunts.h`/ |
| 42 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 43 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 44 | #include "cockpit.h"cxx . . $ `<file>/Descent3/cockpit.h`/ |
| 45 | |
| 46 | int D3W_Play3dSoundcxx . . $ D3W_Play3dSound(eb9e5361a7e3f0cb).(int sound_index, objectcxx . . $ object# *cur_obj, float volume, int flags) { |
| 47 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 48 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(sound_index, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(cur_obj), 1, volume); |
| 49 | } |
| 50 | |
| 51 | return Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(7fd84bfdbf757f76).(sound_index, cur_obj, volume, flags); |
| 52 | } |
| 53 | |
| 54 | int D3W_Play2dSoundcxx . . $ D3W_Play2dSound(85d2224b692a43c3).(int sound_index, float volume) { |
| 55 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 56 | DemoWrite2DSoundcxx . . $ DemoWrite2DSound(cbb42c64838b7d29).(sound_index, volume); |
| 57 | } |
| 58 | |
| 59 | return Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(sound_index, volume); |
| 60 | } |
| 61 | |
| 62 | void D3W_TouchSoundcxx . . $ D3W_TouchSound(d4f767463ce0a6b3).(int sound_index) { Sound_systemcxx . . $ Sound_system..CheckAndForceSoundDataAlloccxx . . $ hlsSystem#CheckAndForceSoundDataAlloc(83c267b20bac841a).(sound_index); } |
| 63 | |
| 64 | // Inventory CheckItem wrapper |
| 65 | bool InvCheckItemcxx . . $ InvCheckItem(1432650661211742).(int playernum, int type, int id) { |
| 66 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((playernum >= 0) && (playernum < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!)); |
| 67 | |
| 68 | return Playerscxx . . $ Players.[playernum].inventorycxx . . $ player#inventory..CheckItemcxx . . $ Inventory#CheckItem(cf9ef193275fa6d8).(type, id); |
| 69 | } |
| 70 | |
| 71 | // Inventory AddItemTypeID wrapper |
| 72 | bool InvAddTypeIDcxx . . $ InvAddTypeID(6580048bba52c434).(int playernum, int type, int id, int aux_type, int aux_id, int flags, const char *description) { |
| 73 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((playernum >= 0) && (playernum < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!)); |
| 74 | |
| 75 | return Playerscxx . . $ Players.[playernum].inventorycxx . . $ player#inventory..Addcxx . . $ Inventory#Add(122d808d8b1091da).(type, id, &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[playernum].objnumcxx . . $ player#objnum.], aux_type, aux_id, flags, description); |
| 76 | } |
| 77 | |
| 78 | // Inventory Remove wrapper |
| 79 | bool InvRemovecxx . . $ InvRemove(1432650661211742).(int playernum, int type, int id) { |
| 80 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((playernum >= 0) && (playernum < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!)); |
| 81 | |
| 82 | return Playerscxx . . $ Players.[playernum].inventorycxx . . $ player#inventory..Removecxx . . $ Inventory#Remove(cf9ef193275fa6d8).(type, id); |
| 83 | } |
| 84 | |
| 85 | // Inventory GetTypeIDCount wrapper |
| 86 | int InvGetTypeIDCountcxx . . $ InvGetTypeIDCount(2326284602b0bb2d).(int playernum, int type, int id) { |
| 87 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((playernum >= 0) && (playernum < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!)); |
| 88 | |
| 89 | return Playerscxx . . $ Players.[playernum].inventorycxx . . $ player#inventory..GetTypeIDCountcxx . . $ Inventory#GetTypeIDCount(9b79fb6aee4c0440).(type, id); |
| 90 | } |
| 91 | |
| 92 | // Inventory Reset wrapper |
| 93 | void InvResetcxx . . $ InvReset(918ebd27a9ddbad3).(int playernum, bool reset_all) { |
| 94 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((playernum >= 0) && (playernum < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!)); |
| 95 | |
| 96 | Playerscxx . . $ Players.[playernum].inventorycxx . . $ player#inventory..Resetcxx . . $ Inventory#Reset(b994e01f1c45a386).(true, (reset_all) ? INVRESET_ALLcxx . . $ `Descent3/Inventory.h:201:9`! : INVRESET_DEATHSPEWcxx . . $ `Descent3/Inventory.h:203:9`!); |
| 97 | } |
| 98 | |
| 99 | // mprintf |
| 100 | void MonoPrintfcxx . . $ MonoPrintf(26800c7917ec8ef2).(int n, char *format, ...) {} |
| 101 | |
| 102 | // wrapper for cfopen |
| 103 | void OpenCFILEcxx . . $ OpenCFILE(8b9fe21fada90ed7).(CFILEcxx . . $ CFILE# **handle, const std::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# &filename, const char *mode) { |
| 104 | *handle = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(filename, mode); |
| 105 | } |
| 106 | |
| 107 | // wrapper for ObjGetUltimateParent |
| 108 | void GetUltimateParentForObjectcxx . . $ GetUltimateParentForObject(a22b5da94f20d523).(objectcxx . . $ object# **parent, objectcxx . . $ object# *child) { *parent = ObjGetUltimateParentcxx . . $ ObjGetUltimateParent(64a00b84ed3f82ee).(child); } |
| 109 | |
| 110 | void SetObjectDeadFlagDLLcxx . . $ SetObjectDeadFlagDLL(80a724877f6428f2).(objectcxx . . $ object# *obj, bool tell_clients_to_remove, bool tell_clients_to_play_sound) { |
| 111 | SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(obj, tell_clients_to_remove, tell_clients_to_play_sound); |
| 112 | } |
| 113 | |
| 114 | void assertdllcxx . . $ assertdll(1b1f57aaeb769edb).(int x, const char *expression, const char *file, int line) { |
| 115 | #ifndef RELEASE |
| 116 | if (!(unsigned)(x)) { |
| 117 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Assertion failed (%s) in %s line %d.\n", expression, file, line); |
| 118 | if (Debug_breakcxx . . $ Debug_break.) |
| 119 | DEBUG_BREAKcxx . . $ `misc/pserror.h:238:9`!(); |
| 120 | else |
| 121 | AssertionFailedcxx . . $ AssertionFailed(5e891a9f77bb0eff).(expression, file, line); |
| 122 | } |
| 123 | #endif |
| 124 | } |
| 125 | |
| 126 | void RetrieveUICallbackcxx . . $ RetrieveUICallback(539e082cf00e1f43).(void **fn) { *fn = (void *)GetUICallbackcxx . . $ GetUICallback(9f019fced98557ce).(); } |
| 127 | |
| 128 | bool dDatabaseRead1cxx . . $ dDatabaseRead1(3bcbb53201fcdcb8).(const char *label, char *entry, int *entrylen) { return Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).(label, entry, entrylen); } |
| 129 | |
| 130 | bool dDatabaseRead2cxx . . $ dDatabaseRead2(340cb0a925eda13d).(const char *label, void *entry, int wordsize) { return Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(340cb0a925eda13d).(label, entry, wordsize); } |
| 131 | |
| 132 | bool dDatabaseRead3cxx . . $ dDatabaseRead3(c1ce79fc3dc965f1).(const char *label, bool *entry) { return Databasecxx . . $ Database.->readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).(label, entry); } |
| 133 | |
| 134 | bool dDatabaseWrite1cxx . . $ dDatabaseWrite1(f827cee075336303).(const char *label, const char *entry, int entrylen) { |
| 135 | return Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(f827cee075336303).(label, entry, entrylen); |
| 136 | } |
| 137 | |
| 138 | bool dDatabaseWrite2cxx . . $ dDatabaseWrite2(2551bed5d6fc04f6).(const char *label, int entry) { return Databasecxx . . $ Database.->writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).(label, entry); } |
| 139 | |
| 140 | // Attaches 2 objects via attach points on each. The f_used_aligned allows for an aligned connection. |
| 141 | // NOTE: The child always moves to the parent |
| 142 | bool dAttachObjectcxx . . $ dAttachObject(f6b18a350068acc8).(objectcxx . . $ object# *parent, char parent_ap, objectcxx . . $ object# *child, char child_ap, bool f_use_aligned) { |
| 143 | return AttachObjectcxx . . $ AttachObject(f6b18a350068acc8).(parent, parent_ap, child, child_ap, f_use_aligned); |
| 144 | } |
| 145 | |
| 146 | // Attaches a child object to a parent object by a percent of the radius of the child. |
| 147 | // NOTE: The child always moves to the parent and not the reverse |
| 148 | bool dAttachObjectRadiuscxx . . $ dAttachObjectRadius(45561ecb6c1b979f).(objectcxx . . $ object# *parent, char parent_ap, objectcxx . . $ object# *child, float percent_rad) { |
| 149 | return AttachObjectcxx . . $ AttachObject(45561ecb6c1b979f).(parent, parent_ap, child, percent_rad); |
| 150 | } |
| 151 | |
| 152 | // Unattaches a child from an attach point |
| 153 | bool dUnattachChildcxx . . $ dUnattachChild(9646b7081aeecba4).(objectcxx . . $ object# *parent, char parent_ap) { return UnattachChildcxx . . $ UnattachChild(9646b7081aeecba4).(parent, parent_ap); } |
| 154 | |
| 155 | // Unattaches an object from its parent |
| 156 | bool dUnattachFromParentcxx . . $ dUnattachFromParent(39516aeee13ca5ab).(objectcxx . . $ object# *child) { return UnattachFromParentcxx . . $ UnattachFromParent(39516aeee13ca5ab).(child); } |
| 157 | |
| 158 | // Unattaches all children from a parent object |
| 159 | bool dUnattachChildrencxx . . $ dUnattachChildren(39516aeee13ca5ab).(objectcxx . . $ object# *parent) { return UnattachChildrencxx . . $ UnattachChildren(39516aeee13ca5ab).(parent); } |
| 160 | |
| 161 | bool dObjGetcxx . . $ dObjGet(5dbac99189234a88).(int handle, objectcxx . . $ object# **obj) { |
| 162 | *obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 163 | return (*obj) ? true : false; |
| 164 | } |
| 165 | |
| 166 | // Set a vector to {0,0,0} |
| 167 | void dvm_MakeZeroVectorcxx . . $ dvm_MakeZeroVector(ec8cf6451c36d470).(vectorcxx . . $ vector# *v) { vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(v); } |
| 168 | |
| 169 | void dvm_MakeZeroAnglecxx . . $ dvm_MakeZeroAngle(7b076424e81684e7).(angveccxx . . $ angvec# *v) { vm_MakeZerocxx . . $ vm_MakeZero(7b076424e81684e7).(v); } |
| 170 | |
| 171 | void dStartFramecxx . . $ dStartFrame(d7a7761809021567).(int x, int y, int x2, int y2, bool clear) { StartFramecxx . . $ StartFrame(3285c9bef785d51c).(x, y, x2, y2, clear); } |
| 172 | |
| 173 | // ObjSetPos, that automatically sets the OF_MOVED_THIS_FRAME |
| 174 | void ObjSetPosAndMarkMovedcxx . . $ ObjSetPosAndMarkMoved(bbb518390bedd509).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos, int roomnum, matrixcxx . . $ matrix# *orient, bool f_update_attached_children) { |
| 175 | if (obj) { |
| 176 | ObjSetPoscxx . . $ ObjSetPos(bbb518390bedd509).(obj, pos, roomnum, orient, f_update_attached_children); |
| 177 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 178 | DemoWriteChangedObjcxx . . $ DemoWriteChangedObj(419c470199a90a97).(obj); // using this instead of setting the flag, since the flag |
| 179 | // has a good chance of getting cleared before it is |
| 180 | // written |
| 181 | // obj->flags |= OF_MOVED_THIS_FRAME; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // SetObjectDeadFlag that automatically writes out demo data |
| 186 | void dSetObjectDeadFlagWDemocxx . . $ dSetObjectDeadFlagWDemo(80a724877f6428f2).(objectcxx . . $ object# *obj, bool tell_clients_to_remove, bool tell_clients_to_play_sound) { |
| 187 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 188 | DemoWriteSetObjDeadcxx . . $ DemoWriteSetObjDead(419c470199a90a97).(obj); |
| 189 | } |
| 190 | |
| 191 | SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(obj, tell_clients_to_remove, tell_clients_to_play_sound); |
| 192 | } |
| 193 | |
| 194 | void dSetAudioTauntscxx . . $ dSetAudioTaunts(b45ddcbc8423892c).(bool enable) { |
| 195 | // If the F6 menu can make perm changes, uncomment the next two lines (and comment the 3rd) |
| 196 | // Current_pilot.set_audiotaunts(enable); |
| 197 | // PltWriteFile(&Current_pilot,false); |
| 198 | |
| 199 | // Leave this line uncommented for non-perm changes |
| 200 | taunt_Enablecxx . . $ taunt_Enable(b45ddcbc8423892c).(enable); |
| 201 | } |
| 202 | |
| 203 | // Changes the ship_index for a given player |
| 204 | void ChangePlayerShipIndexcxx . . $ ChangePlayerShipIndex(3e454b8ccf442868).(int pnum, int ship_index) { |
| 205 | int ObjInitTypeSpecificcxx . . $ ObjInitTypeSpecific(d27f719725f38807).(objectcxx . . $ object# * objp, bool reinitializing); |
| 206 | |
| 207 | if (pnum < 0 || pnum >= MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!) |
| 208 | return; |
| 209 | if (Playerscxx . . $ Players.[pnum].start_roomnumcxx . . $ player#start_roomnum. == -1) |
| 210 | return; // this player doesn't exist |
| 211 | if (ship_index < 0 || ship_index >= MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!) |
| 212 | return; |
| 213 | if (!Shipscxx . . $ Ships.[ship_index].usedcxx . . $ ship#used.) |
| 214 | return; |
| 215 | |
| 216 | bool isme = (pnum == Player_numcxx . . $ Player_num.) ? true : false; |
| 217 | |
| 218 | if (isme) { |
| 219 | FreeCockpitcxx . . $ FreeCockpit(49f6e7a06ebc5aa8).(); |
| 220 | CloseShipHUDcxx . . $ CloseShipHUD(49f6e7a06ebc5aa8).(); |
| 221 | } |
| 222 | |
| 223 | PlayerChangeShipcxx . . $ PlayerChangeShip(3e454b8ccf442868).(pnum, ship_index); |
| 224 | |
| 225 | // reset physics, model, etc. |
| 226 | ObjInitTypeSpecificcxx . . $ ObjInitTypeSpecific(d27f719725f38807).(&Objectscxx . . $ Objects.[Playerscxx . . $ Players.[pnum].objnumcxx . . $ player#objnum.], 0); |
| 227 | |
| 228 | if (isme) { |
| 229 | InitShipHUDcxx . . $ InitShipHUD(d4f767463ce0a6b3).(Playerscxx . . $ Players.[pnum].ship_indexcxx . . $ player#ship_index.); |
| 230 | InitCockpitcxx . . $ InitCockpit(d4f767463ce0a6b3).(Playerscxx . . $ Players.[pnum].ship_indexcxx . . $ player#ship_index.); |
| 231 | |
| 232 | if (GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).() == HUD_COCKPITcxx . . $ HUD_COCKPIT.) |
| 233 | SetHUDModecxx . . $ SetHUDMode(1efe68d6753032ab).(HUD_COCKPITcxx . . $ HUD_COCKPIT.); |
| 234 | else if (GetHUDModecxx . . $ GetHUDMode(d2d05048dda10524).() == HUD_FULLSCREENcxx . . $ HUD_FULLSCREEN.) |
| 235 | SetHUDModecxx . . $ SetHUDMode(1efe68d6753032ab).(HUD_FULLSCREENcxx . . $ HUD_FULLSCREEN.); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | /////////////////////////////////////////////////////////////////// |
| 240 | // adds a type/id item to the inventory (returns true on success) |
| 241 | bool dInven_Addcxx . . $ dInven_Add(228272444bb020af).(Inventorycxx . . $ Inventory# *inven, int type, int id, objectcxx . . $ object# *parent, int aux_type, int aux_id, int flags, |
| 242 | char *description) { |
| 243 | return inven->Addcxx . . $ Inventory#Add(122d808d8b1091da).(type, id, parent, aux_type, aux_id, flags, description); |
| 244 | } |
| 245 | |
| 246 | // adds an object to the inventory (marked by it's objhandle) |
| 247 | bool dInven_AddObjectcxx . . $ dInven_AddObject(5cf1ce72a3cf15c3).(Inventorycxx . . $ Inventory# *inven, int object_handle, int flags, char *description) { |
| 248 | return inven->AddObjectcxx . . $ Inventory#AddObject(bc9c4eeb54e60257).(object_handle, flags, description); |
| 249 | } |
| 250 | |
| 251 | // adds a special cased CounterMeasure into the inventory |
| 252 | bool dInven_AddCounterMeasurecxx . . $ dInven_AddCounterMeasure(7a2879b1c631501d).(Inventorycxx . . $ Inventory# *inven, int id, int aux_type, int aux_id, int flags, char *description) { |
| 253 | return inven->AddCounterMeasurecxx . . $ Inventory#AddCounterMeasure(1165f2dcd82ced24).(id, aux_type, aux_id, flags, description); |
| 254 | } |
| 255 | |
| 256 | // removes an item from the inventory (reduces it's count by one...if there is no more, then it goes bye-bye) |
| 257 | // to remove an object that was added via objhandle, then pass the objhandle |
| 258 | // in the 'type' parameter, and don't pass in an id. |
| 259 | bool dInven_Removecxx . . $ dInven_Remove(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id) { return inven->Removecxx . . $ Inventory#Remove(cf9ef193275fa6d8).(type, id); } |
| 260 | |
| 261 | // uses an item in the inventory (also reduces its count by one...if there is no more, then it goes bye-bye) |
| 262 | bool dInven_Usecxx . . $ dInven_Use(bd9cb6ec824dfd91).(Inventorycxx . . $ Inventory# *inven, int type, int id, objectcxx . . $ object# *parent) { return inven->Usecxx . . $ Inventory#Use(cc3bfdd2c949b92e).(type, id, parent); } |
| 263 | |
| 264 | // uses an item in the inventory (given it's objhandle). |
| 265 | bool dInven_UseObjHandlecxx . . $ dInven_UseObjHandle(870da7b69dc70a24).(Inventorycxx . . $ Inventory# *inven, int objhandle, objectcxx . . $ object# *parent) { return inven->Usecxx . . $ Inventory#Use(bf595291c30e3265).(objhandle, parent); } |
| 266 | |
| 267 | // returns how many unique type/ids are in the inventory |
| 268 | int dInven_Sizecxx . . $ dInven_Size(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven) { return inven->Sizecxx . . $ Inventory#Size(b126dc7c1de90089).(); } |
| 269 | |
| 270 | // returns true if there is an item in the inventory with the given type/id (or objhandle if id is -1, pass the object |
| 271 | // handle as the type parameter) |
| 272 | bool dInven_CheckItemcxx . . $ dInven_CheckItem(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id) { return inven->CheckItemcxx . . $ Inventory#CheckItem(cf9ef193275fa6d8).(type, id); } |
| 273 | |
| 274 | // Resets the inventory, cleaning it out |
| 275 | // in_game: set to true if this is being called from during gameplay |
| 276 | // reset_stage: |
| 277 | // INVRESET_ALL: Reset _EVERYTHING_ |
| 278 | // INVRESET_LEVELCHANGE: Remove everything except those that last across levels |
| 279 | // INVRESET_DEATHSPEW: Remove everything except those that do not spew (Default) |
| 280 | void dInven_Resetcxx . . $ dInven_Reset(551e33599b9c3271).(Inventorycxx . . $ Inventory# *inven, bool in_game, int reset_stage) { inven->Resetcxx . . $ Inventory#Reset(b994e01f1c45a386).(in_game, reset_stage); } |
| 281 | |
| 282 | // resets the position pointer in the list to the beginning |
| 283 | void dInven_ResetPoscxx . . $ dInven_ResetPos(85ee5073fec11d06).(Inventorycxx . . $ Inventory# *inven) { inven->ResetPoscxx . . $ Inventory#ResetPos(49f6e7a06ebc5aa8).(); } |
| 284 | |
| 285 | // moves the position pointer to the next inventory item |
| 286 | // skip : if true then skip over non-selectable items |
| 287 | void dInven_NextPoscxx . . $ dInven_NextPos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool skip) { inven->NextPoscxx . . $ Inventory#NextPos(b45ddcbc8423892c).(skip); } |
| 288 | |
| 289 | // moves the position pointer to the previous inventory item |
| 290 | // skip : if true then skip over non-selectable items |
| 291 | void dInven_PrevPoscxx . . $ dInven_PrevPos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool skip) { inven->PrevPoscxx . . $ Inventory#PrevPos(b45ddcbc8423892c).(skip); } |
| 292 | |
| 293 | // returns the type/id of the item at the current position |
| 294 | // return true if it is a real object (meaning it was placed in the inventory |
| 295 | // via an object handle...so id will be -1) |
| 296 | bool dInven_GetPosTypeIDcxx . . $ dInven_GetPosTypeID(50ea0760c180cfea).(Inventorycxx . . $ Inventory# *inven, int &type, int &id) { return inven->GetPosTypeIDcxx . . $ Inventory#GetPosTypeID(8a990ad1ed500b42).(type, id); } |
| 297 | |
| 298 | // returns the aux type/id of the item |
| 299 | // return true if it is a real object (meaning it was placed in the inventory |
| 300 | // via an object handle...so id will be -1) |
| 301 | bool dInven_GetAuxPosTypeIDcxx . . $ dInven_GetAuxPosTypeID(50ea0760c180cfea).(Inventorycxx . . $ Inventory# *inven, int &type, int &id) { return inven->GetAuxPosTypeIDcxx . . $ Inventory#GetAuxPosTypeID(8a990ad1ed500b42).(type, id); } |
| 302 | |
| 303 | // returns the description of the item at the current position |
| 304 | char *dInven_GetPosDescriptioncxx . . $ dInven_GetPosDescription(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven) { return inven->GetPosDescriptioncxx . . $ Inventory#GetPosDescription(41208ce6ca65dd58).(); } |
| 305 | |
| 306 | // returns the icon name of the item at the current position |
| 307 | char *dInven_GetPosIconNamecxx . . $ dInven_GetPosIconName(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven) { return inven->GetPosIconNamecxx . . $ Inventory#GetPosIconName(41208ce6ca65dd58).(); } |
| 308 | |
| 309 | // returns the name of the item at the current position |
| 310 | char *dInven_GetPosNamecxx . . $ dInven_GetPosName(7ee78331f3f5f0bd).(Inventorycxx . . $ Inventory# *inven) { return inven->GetPosNamecxx . . $ Inventory#GetPosName(41208ce6ca65dd58).(); } |
| 311 | |
| 312 | // return information about the current position item |
| 313 | // return true if it is a real object |
| 314 | bool dInven_GetPosInfocxx . . $ dInven_GetPosInfo(d5b544a04313fd7).(Inventorycxx . . $ Inventory# *inven, uint16_tcxx . . $ uint16_t# &iflags, int &flags) { return inven->GetPosInfocxx . . $ Inventory#GetPosInfo(a9f116dbdd7af36d).(iflags, flags); } |
| 315 | |
| 316 | // returns the count of the item at the current position |
| 317 | int dInven_GetPosCountcxx . . $ dInven_GetPosCount(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven) { return inven->GetPosCountcxx . . $ Inventory#GetPosCount(b126dc7c1de90089).(); } |
| 318 | |
| 319 | // returns true if the position pointer is at the begining of the inventory list |
| 320 | bool dInven_AtBeginningcxx . . $ dInven_AtBeginning(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven) { return inven->AtBeginningcxx . . $ Inventory#AtBeginning(c9857a73d68e59ba).(); } |
| 321 | |
| 322 | // returns false if the position pointer is at the end of the inventory list |
| 323 | bool dInven_AtEndcxx . . $ dInven_AtEnd(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven) { return inven->AtEndcxx . . $ Inventory#AtEnd(c9857a73d68e59ba).(); } |
| 324 | |
| 325 | // jump right to an item in the inventory |
| 326 | void dInven_GotoPoscxx . . $ dInven_GotoPos(35c6c905282b7da0).(Inventorycxx . . $ Inventory# *inven, int newpos) { inven->GotoPoscxx . . $ Inventory#GotoPos(d4f767463ce0a6b3).(newpos); } |
| 327 | |
| 328 | // jump right to an item in the inventory give it's type and id |
| 329 | // to jump to an item that was added via object handle, pass the object |
| 330 | // handle in as the type, and make id -1. |
| 331 | void dInven_GotoPosTypeIDcxx . . $ dInven_GotoPosTypeID(6a06e465d609a715).(Inventorycxx . . $ Inventory# *inven, int type, int id) { inven->GotoPoscxx . . $ Inventory#GotoPos(3e454b8ccf442868).(type, id); } |
| 332 | |
| 333 | // uses the currently selected item |
| 334 | bool dInven_UsePoscxx . . $ dInven_UsePos(b45c7c16050fe3a6).(Inventorycxx . . $ Inventory# *inven, objectcxx . . $ object# *parent) { return inven->UsePoscxx . . $ Inventory#UsePos(39516aeee13ca5ab).(parent); } |
| 335 | |
| 336 | // returns the 'index' position of the current position |
| 337 | int dInven_GetPoscxx . . $ dInven_GetPos(94672de1c825e5d2).(Inventorycxx . . $ Inventory# *inven) { return inven->GetPoscxx . . $ Inventory#GetPos(b126dc7c1de90089).(); } |
| 338 | |
| 339 | // checks the pos, if its on a nonselectable item it will move to the next selectable (NULL if none) |
| 340 | void dInven_ValidatePoscxx . . $ dInven_ValidatePos(5434108865d73f5f).(Inventorycxx . . $ Inventory# *inven, bool forward) { inven->ValidatePoscxx . . $ Inventory#ValidatePos(b45ddcbc8423892c).(forward); } |
| 341 | |
| 342 | // returns whether an item is selectable |
| 343 | bool dInven_IsSelectablecxx . . $ dInven_IsSelectable(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven) { return inven->IsSelectablecxx . . $ Inventory#IsSelectable(c9857a73d68e59ba).(); } |
| 344 | |
| 345 | bool dInven_IsUsablecxx . . $ dInven_IsUsable(a9b1d5baa55c4e1).(Inventorycxx . . $ Inventory# *inven) { return inven->IsUsablecxx . . $ Inventory#IsUsable(c9857a73d68e59ba).(); } |
| 346 | |
| 347 | // returns how many of an type/id is in the inventory |
| 348 | // for object handle items, pass the object handle in as the type and leave |
| 349 | // id as -1 |
| 350 | int dInven_GetTypeIDCountcxx . . $ dInven_GetTypeIDCount(de06e22421169a70).(Inventorycxx . . $ Inventory# *inven, int type, int id) { return inven->GetTypeIDCountcxx . . $ Inventory#GetTypeIDCount(9b79fb6aee4c0440).(type, id); } |
| 351 | |
| 352 | // searches the inventory for the specified type/id, sets the pos to it |
| 353 | // for object handle items, pass the object handle in as the type and leave |
| 354 | // id as -1 |
| 355 | bool dInven_FindPoscxx . . $ dInven_FindPos(fb74c7be222af443).(Inventorycxx . . $ Inventory# *inven, int type, int id) { return inven->FindPoscxx . . $ Inventory#FindPos(cf9ef193275fa6d8).(type, id); } |
| 356 | |
| 357 | // gets a detailed list of information about what is in the inventory |
| 358 | // returns the number of items filled in. |
| 359 | int dInven_GetInventoryItemListcxx . . $ dInven_GetInventoryItemList(1050e51dfeed52f9).(Inventorycxx . . $ Inventory# *inven, tInvenListcxx . . $ tInvenList# *list, int max_amount, int *cur_sel) { |
| 360 | return inven->GetInventoryItemListcxx . . $ Inventory#GetInventoryItemList(e2f4838e36fa1452).(list, max_amount, cur_sel); |
| 361 | } |