| 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 GAMEDLL_HEADER_H |
| 20 | #define GAMEDLL_HEADER_H |
| 21 | |
| 22 | #include <filesystem> |
| 23 | |
| 24 | #include "spew.h" |
| 25 | #include "gamefont.h" |
| 26 | #include "hud.h" |
| 27 | #include "module.h" //for DMFCDLLOUT, etc. |
| 28 | #include "renderer.h" |
| 29 | #include "findintersection.h" |
| 30 | |
| 31 | ////////////////////////////////////////// |
| 32 | #include "pstypes.h" |
| 33 | #include "vecmat_external.h" |
| 34 | #include "object_external_struct.h" |
| 35 | #include "object_external.h" |
| 36 | #include "player_external.h" |
| 37 | #include "room_external.h" |
| 38 | #include "multi_external.h" |
| 39 | #include "multi_world_state.h" |
| 40 | #include "viseffect_external.h" |
| 41 | #include "osiris_share.h" |
| 42 | #include "3d.h" |
| 43 | #include "terrain.h" |
| 44 | #include "gametexture.h" |
| 45 | #include "args.h" |
| 46 | #include "bitmap.h" |
| 47 | #include "Inventory.h" |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | #define CEXTERN(a) \ |
| 51 | extern "C" { \ |
| 52 | a \ |
| 53 | } |
| 54 | #else |
| 55 | #define CEXTERN(a) extern a |
| 56 | #endif |
| 57 | |
| 58 | // From ssl_lib.h |
| 59 | #define MAX_GAME_VOLUME 1.0f |
| 60 | |
| 61 | #define DMFCDLLOUT(x) extern "C" x |
| 62 | |
| 63 | #define UIF_CENTER 0x01 |
| 64 | #define UIF_FIT 0x02 |
| 65 | #define UILB_NOSCROLL 0x04 // turns off automatic scroll buttons on UIListBox |
| 66 | #define UILB_AUTOSELECT 0x08 // turns on automatic change of SelectedIndex if scrolled out of view |
| 67 | #define UIRB_NOBUTTON 0x10 // disables the drawing of the button on the left of the text of a radio button |
| 68 | #define UIF_BORDER 0x100 // for certain gadgets specifies that the border be drawn. |
| 69 | #define UIED_PASSWORD 0x200 // special password masking for edit box text (*) |
| 70 | #define UIF_PROCESS_LEFTKEY (1 << 8) |
| 71 | #define UIF_PROCESS_RIGHTKEY (1 << 9) |
| 72 | #define UIF_PROCESS_UPKEY (1 << 10) |
| 73 | #define UIF_PROCESS_DOWNKEY (1 << 11) |
| 74 | #define UIF_PROCESS_ALL (0xff00) |
| 75 | |
| 76 | struct tPreJoinData { |
| 77 | bool is_banned; |
| 78 | int team; |
| 79 | }; |
| 80 | |
| 81 | struct game_collide_info { |
| 82 | vector point, normal; |
| 83 | float hitspeed, hit_dot; |
| 84 | int hitseg, hitwall; |
| 85 | }; |
| 86 | |
| 87 | struct dllinfo { |
| 88 | int me_handle; |
| 89 | int it_handle; |
| 90 | uint8_t *special_data; |
| 91 | char *input_string; |
| 92 | int input_key; |
| 93 | union { |
| 94 | int iRet; |
| 95 | float fRet; |
| 96 | }; |
| 97 | float fParam; |
| 98 | ptrdiff_t iParam; |
| 99 | game_collide_info collide_info; |
| 100 | int newseg, oldseg; |
| 101 | }; |
| 102 | |
| 103 | #define MAX_GAMENAME_LEN 32 |
| 104 | #define MAX_REQUIREMENT_LEN 384 |
| 105 | #define DOF_MAXTEAMS 0x0001 // max_teams member is valid |
| 106 | #define DOF_MINTEAMS 0x0002 |
| 107 | // this struct is used to return game specific information to Descent 3 |
| 108 | struct tDLLOptions { |
| 109 | // general flags, also specifies what members of the structure are valid |
| 110 | int flags; |
| 111 | |
| 112 | // 0 or 1 for non-team games...maximum value is 4. If not specified, than it is assumed 0 |
| 113 | int max_teams; |
| 114 | // must be less then or equal to max_teams. If not specified, then it is assumed 0 for |
| 115 | // non-team games, 2 for team games. (max_teams will always tell you if it's a team game) |
| 116 | int min_teams; |
| 117 | |
| 118 | // gives the full name of the game (must be set) |
| 119 | char game_name[MAX_GAMENAME_LEN]; |
| 120 | |
| 121 | // this is an array of semicolor seperated 'string identifiers' that serve as requirements |
| 122 | // the mission needs to support in order for it to be playable with the game. |
| 123 | // this parameter must be set (even it is just a '\0' for the first character..aka no requirements) |
| 124 | char requirements[MAX_REQUIREMENT_LEN]; |
| 125 | |
| 126 | }; |
| 127 | |
| 128 | struct game_api { |
| 129 | int *objs; |
| 130 | int *rooms; |
| 131 | int *terrain; |
| 132 | int *players; |
| 133 | int *netgame; |
| 134 | int *netplayers; |
| 135 | int *ships; |
| 136 | int *weapons; |
| 137 | int *Current_mission; |
| 138 | int *GameTextures; |
| 139 | int *GameVClips; |
| 140 | int *fp[450]; // function pointers |
| 141 | int *vp[50]; // variable pointers |
| 142 | tOSIRISModuleInit *osiris_functions; |
| 143 | }; |
| 144 | |
| 145 | // Descent3 function prototypes. NOTE: These must match the real D3 prototypes. |
| 146 | |
| 147 | typedef void (*GetGameAPI_fp)(game_api *); |
| 148 | DMFCDLLOUT(GetGameAPI_fp DLLGetGameAPI;) |
| 149 | |
| 150 | typedef bool (*AddHUDMessage_fp)(const char *format, ...); |
| 151 | DMFCDLLOUT(AddHUDMessage_fp DLLAddHUDMessage;) |
| 152 | |
| 153 | typedef void (*Debug_ConsolePrintf_fp)(int n, const char *format, ...); |
| 154 | DMFCDLLOUT(Debug_ConsolePrintf_fp DLLDebug_ConsolePrintf;) |
| 155 | |
| 156 | // typedef void( *MultiSendClientExecuteDLL_fp ) (int eventnum,int me_objnum,int it_objnum,int to,dllinfo *info=NULL); |
| 157 | typedef void (*MultiSendClientExecuteDLL_fp)(int eventnum, int me_objnum, int it_objnum, int to, dllinfo *info); |
| 158 | DMFCDLLOUT(MultiSendClientExecuteDLL_fp DLLMultiSendClientExecuteDLL;) |
| 159 | |
| 160 | // typedef void( *MultiSendObject_fp ) (object *obj,uint8_t announce,uint8_t demo_record=true); |
| 161 | typedef void (*MultiSendObject_fp)(object *obj, uint8_t announce, uint8_t demo_record); |
| 162 | DMFCDLLOUT(MultiSendObject_fp DLLMultiSendObject;) |
| 163 | |
| 164 | // typedef void( *MultiPaintGoalRooms_fp ) (int *texcolors=NULL); |
| 165 | typedef void (*MultiPaintGoalRooms_fp)(int *texcolors); |
| 166 | DMFCDLLOUT(MultiPaintGoalRooms_fp DLLMultiPaintGoalRooms;) |
| 167 | |
| 168 | typedef void (*MultiSendSpecialPacket_fp)(int slot, uint8_t *outdata, int size); |
| 169 | DMFCDLLOUT(MultiSendSpecialPacket_fp DLLMultiSendSpecialPacket;) |
| 170 | |
| 171 | typedef void (*ComputeRoomCenter_fp)(vector *vp, room *rp); |
| 172 | DMFCDLLOUT(ComputeRoomCenter_fp DLLComputeRoomCenter;) |
| 173 | |
| 174 | typedef int (*GetGoalRoomForTeam_fp)(int teamnum); |
| 175 | DMFCDLLOUT(GetGoalRoomForTeam_fp DLLGetGoalRoomForTeam;) |
| 176 | |
| 177 | // ObjCreate without writing data to demo |
| 178 | // typedef int( *ObjCreate_fp ) (uint8_t type,uint16_t id,int roomnum,vector *pos,const matrix *orient,int parent_handle = |
| 179 | // OBJECT_HANDLE_NONE); |
| 180 | typedef int (*ObjCreate_fp)(uint8_t type, uint16_t id, int roomnum, vector *pos, const matrix *orient, int parent_handle); |
| 181 | DMFCDLLOUT(ObjCreate_fp DLLObjCreate;) |
| 182 | |
| 183 | typedef int (*FindObjectIDName_fp)(const char *name); |
| 184 | DMFCDLLOUT(FindObjectIDName_fp DLLFindObjectIDName;) |
| 185 | |
| 186 | typedef void (*ObjSetPosNoMark_fp)(object *objp, vector *newpos, int roomnum, matrix *orient, |
| 187 | bool f_update_attached_children); |
| 188 | DMFCDLLOUT(ObjSetPosNoMark_fp DLLObjSetPosNoMark;) |
| 189 | |
| 190 | // ObjSetPos, that automatically sets the OF_MOVED_THIS_FRAME |
| 191 | typedef void (*ObjSetPos_fp)(object *obj, vector *pos, int roomnum, matrix *orient, bool f_update_attached_children); |
| 192 | DMFCDLLOUT(ObjSetPos_fp DLLObjSetPos;) |
| 193 | |
| 194 | typedef void (*SetMaxTeams_fp)(int num); |
| 195 | DMFCDLLOUT(SetMaxTeams_fp DLLSetMaxTeams;) |
| 196 | |
| 197 | typedef int (*IncTeamScore_fp)(int team, int amount); |
| 198 | DMFCDLLOUT(IncTeamScore_fp DLLIncTeamScore;) |
| 199 | |
| 200 | typedef bool (*InvCheckItem_fp)(int pnum, int type, int id); |
| 201 | DMFCDLLOUT(InvCheckItem_fp DLLInvCheckItem;) |
| 202 | |
| 203 | // typedef bool( *InvAddTypeID_fp ) (int pnum, int type,int id,int aux_type=-1,int aux_id=-1,int flags=0,const char *description=NULL); |
| 204 | typedef bool (*InvAddTypeID_fp)(int pnum, int type, int id, int aux_type, int aux_id, int flags, const char *description); |
| 205 | DMFCDLLOUT(InvAddTypeID_fp DLLInvAddTypeID;) |
| 206 | |
| 207 | typedef bool (*InvRemove_fp)(int pnum, int type, int id); |
| 208 | DMFCDLLOUT(InvRemove_fp DLLInvRemove;) |
| 209 | |
| 210 | typedef void (*PlayerSetLighting_fp)(int slot, float dist, float r, float g, float b); |
| 211 | DMFCDLLOUT(PlayerSetLighting_fp DLLPlayerSetLighting;) |
| 212 | |
| 213 | typedef int (*FindShipName_fp)(const char *name); |
| 214 | DMFCDLLOUT(FindShipName_fp DLLFindShipName;) |
| 215 | |
| 216 | // Sets a wacky rotating ball around the player ship |
| 217 | typedef void (*PlayerSetRotatingBall_fp)(int slot, int num, float speed, float *r, float *g, float *b); |
| 218 | DMFCDLLOUT(PlayerSetRotatingBall_fp DLLPlayerSetRotatingBall;) |
| 219 | |
| 220 | // Changes the ship a particular player is flying |
| 221 | typedef void (*PlayerChangeShip_fp)(int slot, int ship_index); |
| 222 | DMFCDLLOUT(PlayerChangeShip_fp DLLPlayerChangeShip;) |
| 223 | |
| 224 | typedef int (*InvGetTypeIDCount_fp)(int playernum, int type, int id); |
| 225 | DMFCDLLOUT(InvGetTypeIDCount_fp DLLInvGetTypeIDCount;) |
| 226 | |
| 227 | // typedef int (*D3W_Play3dSound_fp ) (int sound_index, object *cur_obj, float volume = MAX_GAME_VOLUME, int flags = 0); |
| 228 | typedef int (*D3W_Play3dSound_fp)(int sound_index, object *cur_obj, float volume, int flags); |
| 229 | DMFCDLLOUT(D3W_Play3dSound_fp DLLPlay3dSound;) |
| 230 | |
| 231 | typedef int (*FindSoundName_fp)(const char *str); |
| 232 | DMFCDLLOUT(FindSoundName_fp DLLFindSoundName;) |
| 233 | |
| 234 | typedef int (*SpewCreate_fp)(spewinfo *spew); |
| 235 | DMFCDLLOUT(SpewCreate_fp DLLSpewCreate;) |
| 236 | |
| 237 | // typedef void (*SpewClearEvent_fp) (int handle,bool force=false); |
| 238 | typedef void (*SpewClearEvent_fp)(int handle, bool force); |
| 239 | DMFCDLLOUT(SpewClearEvent_fp DLLSpewClearEvent;) |
| 240 | |
| 241 | // Allocs and loads a bitmap |
| 242 | // Returns the handle of the loaded bitmap |
| 243 | // Returns -1 if something is wrong |
| 244 | // If mipped is non-zero, allocs extra space for mips and computes them |
| 245 | // typedef int (*bm_AllocLoadFileBitmap_fp) (const char *filename,int mipped,int format=BITMAP_FORMAT_1555); |
| 246 | typedef int (*bm_AllocLoadFileBitmap_fp)(const char *filename, int mipped, int format); |
| 247 | DMFCDLLOUT(bm_AllocLoadFileBitmap_fp DLLbm_AllocLoadFileBitmap;) |
| 248 | |
| 249 | // Given a handle, frees the bitmap memory and flags this bitmap as unused |
| 250 | typedef void (*bm_FreeBitmap_fp)(int handle); |
| 251 | DMFCDLLOUT(bm_FreeBitmap_fp DLLbm_FreeBitmap;) |
| 252 | |
| 253 | // Draws a scaled 2d bitmap to our buffer |
| 254 | // typedef void (*rend_DrawScaledBitmap_fp) (int x1,int y1,int x2,int y2,int bm,float u0,float v0,float u1,float |
| 255 | // v1,float zval,int color=-1,float *alphas=NULL); |
| 256 | typedef void (*rend_DrawScaledBitmap_fp)(int x1, int y1, int x2, int y2, int bm, float u0, float v0, float u1, float v1, |
| 257 | float zval, int color, float *alphas); |
| 258 | DMFCDLLOUT(rend_DrawScaledBitmap_fp DLLrend_DrawScaledBitmap;) |
| 259 | |
| 260 | // puts a formatted string in the text buffer |
| 261 | typedef void (*grtext_Printf_fp)(int x, int y, const char *fmt, ...); |
| 262 | DMFCDLLOUT(grtext_Printf_fp DLLgrtext_Printf;) |
| 263 | |
| 264 | // renders all text in buffer and clears buffer. USUALLY CALL THIS TO RENDER TEXT |
| 265 | typedef void (*grtext_Flush_fp)(void); |
| 266 | DMFCDLLOUT(grtext_Flush_fp DLLgrtext_Flush;) |
| 267 | |
| 268 | // sets the color for text |
| 269 | typedef void (*grtext_SetColor_fp)(ddgr_color col); |
| 270 | DMFCDLLOUT(grtext_SetColor_fp DLLgrtext_SetColor;) |
| 271 | |
| 272 | // sets fancy color for text |
| 273 | typedef void (*grtext_SetFancyColor_fp)(ddgr_color col1, ddgr_color col2, ddgr_color col3, ddgr_color col4); |
| 274 | DMFCDLLOUT(grtext_SetFancyColor_fp DLLgrtext_SetFancyColor;) |
| 275 | |
| 276 | // sets the alpha value for text |
| 277 | typedef void (*grtext_SetAlpha_fp)(uint8_t alpha); |
| 278 | DMFCDLLOUT(grtext_SetAlpha_fp DLLgrtext_SetAlpha;) |
| 279 | |
| 280 | // gets font alpha |
| 281 | typedef uint8_t (*grtext_GetAlpha_fp)(void); |
| 282 | DMFCDLLOUT(grtext_GetAlpha_fp DLLgrtext_GetAlpha;) |
| 283 | |
| 284 | // sets the font for text |
| 285 | typedef void (*grtext_SetFont_fp)(int font_handle); |
| 286 | DMFCDLLOUT(grtext_SetFont_fp DLLgrtext_SetFont;) |
| 287 | |
| 288 | // gets the current font |
| 289 | typedef int (*grtext_GetFont_fp)(void); |
| 290 | DMFCDLLOUT(grtext_GetFont_fp DLLgrtext_GetFont;) |
| 291 | |
| 292 | // returns width of text in current font. |
| 293 | typedef int (*grtext_GetTextLineWidth_fp)(const char *str); |
| 294 | DMFCDLLOUT(grtext_GetTextLineWidth_fp DLLgrtext_GetTextLineWidth;) |
| 295 | |
| 296 | // returns a font's height |
| 297 | typedef int (*grfont_GetHeight_fp)(int font); |
| 298 | DMFCDLLOUT(grfont_GetHeight_fp DLLgrfont_GetHeight;) |
| 299 | |
| 300 | // puts a centered string in the text buffer. |
| 301 | typedef void (*grtext_CenteredPrintf_fp)(int xoff, int y, const char *fmt, ...); |
| 302 | DMFCDLLOUT(grtext_CenteredPrintf_fp DLLgrtext_CenteredPrintf;) |
| 303 | |
| 304 | // Adds a colored message to the hud |
| 305 | typedef bool (*AddColoredHUDMessage_fp)(ddgr_color color, const char *format, ...); |
| 306 | DMFCDLLOUT(AddColoredHUDMessage_fp DLLAddColoredHUDMessage;) |
| 307 | |
| 308 | // returns the height of a bitmap |
| 309 | typedef int (*bm_h_fp)(int handle, int miplevel); |
| 310 | DMFCDLLOUT(bm_h_fp DLLbm_h;) |
| 311 | |
| 312 | // returns the width of a bitmap |
| 313 | typedef int (*bm_w_fp)(int handle, int miplevel); |
| 314 | DMFCDLLOUT(bm_w_fp DLLbm_w;) |
| 315 | |
| 316 | // Draws a simple bitmap at the specified x,y location |
| 317 | typedef void (*rend_DrawSimpleBitmap_fp)(int bm_handle, int x, int y); |
| 318 | DMFCDLLOUT(rend_DrawSimpleBitmap_fp DLLrend_DrawSimpleBitmap;) |
| 319 | |
| 320 | // sends a special packet to the server |
| 321 | typedef void (*MultiClientSendSpecialPacket_fp)(uint8_t *outdate, int size); |
| 322 | DMFCDLLOUT(MultiClientSendSpecialPacket_fp DLLMultiClientSendSpecialPacket;) |
| 323 | |
| 324 | // adds a blinking hud message |
| 325 | typedef bool (*AddBlinkingHUDMessage_fp)(char *format, ...); |
| 326 | DMFCDLLOUT(AddBlinkingHUDMessage_fp DLLAddBlinkingHUDMessage;) |
| 327 | |
| 328 | // resets a player's inventory |
| 329 | // typedef void (*InvReset_fp)(int playernum,bool reset_all=true); |
| 330 | typedef void (*InvReset_fp)(int playernum, bool reset_all); |
| 331 | DMFCDLLOUT(InvReset_fp DLLInvReset;) |
| 332 | |
| 333 | // places an item on the hud |
| 334 | typedef void (*AddHUDItem_fp)(tHUDItem *item); |
| 335 | DMFCDLLOUT(AddHUDItem_fp DLLAddHUDItem;) |
| 336 | |
| 337 | // renders a bitmap onto the hud |
| 338 | // typedef void (*RenderHUDQuad_fp) (int x, int y, int w, int h, float u0, float v0, float u1, float v1, int bm, uint8_t |
| 339 | // alpha, int sat_count=0); |
| 340 | typedef void (*RenderHUDQuad_fp)(int x, int y, int w, int h, float u0, float v0, float u1, float v1, int bm, |
| 341 | uint8_t alpha, int sat_count); |
| 342 | DMFCDLLOUT(RenderHUDQuad_fp DLLRenderHUDQuad;) |
| 343 | |
| 344 | // renders text, scaled, alphaed, saturated, |
| 345 | typedef void (*RenderHUDText_fp)(ddgr_color col, uint8_t alpha, int sat_count, int x, int y, const char *fmt, ...); |
| 346 | DMFCDLLOUT(RenderHUDText_fp DLLRenderHUDText;) |
| 347 | |
| 348 | // Ends a multiplayer level and goes on to the next, Server only |
| 349 | typedef void (*MultiEndLevel_fp)(void); |
| 350 | DMFCDLLOUT(MultiEndLevel_fp DLLMultiEndLevel;) |
| 351 | |
| 352 | // returns a pointer to the data in a bitmap |
| 353 | typedef uint16_t *(*bm_data_fp)(int handle, int miplevel); |
| 354 | DMFCDLLOUT(bm_data_fp DLLbm_data;) |
| 355 | |
| 356 | // Allocs a bitmap of w x h size |
| 357 | // If add_mem is nonzero, adds that to the amount alloced |
| 358 | // (added due to the way the tmapper works) |
| 359 | // Returns bitmap handle if successful, -1 if otherwise |
| 360 | typedef int (*bm_AllocBitmap_fp)(int w, int h, int add_mem); |
| 361 | DMFCDLLOUT(bm_AllocBitmap_fp DLLbm_AllocBitmap;) |
| 362 | |
| 363 | // Fills a rectangle on the display |
| 364 | typedef void (*rend_FillRect_fp)(ddgr_color color, int x1, int y1, int x2, int y2); |
| 365 | DMFCDLLOUT(rend_FillRect_fp DLLrend_FillRect;) |
| 366 | |
| 367 | // takes a large static bitmap and breaks it into smaller managable bitmaps |
| 368 | typedef bool (*bm_CreateChunkedBitmap_fp)(int bm_handle, chunked_bitmap *chunk); |
| 369 | DMFCDLLOUT(bm_CreateChunkedBitmap_fp DLLbm_CreateChunkedBitmap;) |
| 370 | |
| 371 | // destroys a chunked bitmap. |
| 372 | typedef void (*bm_DestroyChunkedBitmap_fp)(chunked_bitmap *chunk); |
| 373 | DMFCDLLOUT(bm_DestroyChunkedBitmap_fp DLLbm_DestroyChunkedBitmap;) |
| 374 | |
| 375 | // given a chunked bitmap, renders it. |
| 376 | typedef void (*rend_DrawChunkedBitmap_fp)(chunked_bitmap *chunk, int x, int y, uint8_t alpha); |
| 377 | DMFCDLLOUT(rend_DrawChunkedBitmap_fp DLLrend_DrawChunkedBitmap;) |
| 378 | |
| 379 | // given a chunked bitmap, renders it.scaled |
| 380 | typedef void (*rend_DrawScaledChunkedBitmap_fp)(chunked_bitmap *chunk, int x, int y, int neww, int newh, uint8_t alpha); |
| 381 | DMFCDLLOUT(rend_DrawScaledChunkedBitmap_fp DLLrend_DrawScaledChunkedBitmap;) |
| 382 | |
| 383 | // Opens a file for reading or writing |
| 384 | // If a path is specified, will try to open the file only in that path. |
| 385 | // If no path is specified, will look through search directories and library files. |
| 386 | // Parameters: filename - the name if the file, with or without a path |
| 387 | // mode - the standard C mode string |
| 388 | // Returns: the CFile handle, or NULL if file not opened |
| 389 | typedef void (*OpenCFILE_fp)(CFILE **handle, const std::filesystem::path &filename, const char *mode); |
| 390 | DMFCDLLOUT(OpenCFILE_fp DLLOpenCFILE;) |
| 391 | |
| 392 | // Closes an open CFILE. |
| 393 | // Parameters: cfile - the file pointer returned by cfopen() |
| 394 | typedef void (*cfclose_fp)(CFILE *cfp); |
| 395 | DMFCDLLOUT(cfclose_fp DLLcfclose;) |
| 396 | |
| 397 | // Returns true if at EOF |
| 398 | typedef int (*cfeof_fp)(CFILE *cfp); |
| 399 | DMFCDLLOUT(cfeof_fp DLLcfeof;) |
| 400 | |
| 401 | // Tells if the file exists |
| 402 | // Returns non-zero if file exists. Also tells if the file is on disk |
| 403 | // or in a hog - See return values in cfile.h |
| 404 | typedef int (*cfexist_fp)(const std::filesystem::path &filename); |
| 405 | DMFCDLLOUT(cfexist_fp DLLcfexist;) |
| 406 | |
| 407 | // Reads the specified number of bytes from a file into the buffer |
| 408 | // DO NOT USE THIS TO READ STRUCTURES. This function is for byte |
| 409 | // data, such as a string or a bitmap of 8-bit pixels. |
| 410 | // Returns the number of bytes read. |
| 411 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 412 | typedef int (*cf_ReadBytes_fp)(uint8_t *buf, int count, CFILE *cfp); |
| 413 | DMFCDLLOUT(cf_ReadBytes_fp DLLcf_ReadBytes;) |
| 414 | |
| 415 | // The following functions read numeric vales from a CFILE. All values are |
| 416 | // stored in the file in Intel (little-endian) format. These functions |
| 417 | // will convert to big-endian if required. |
| 418 | // These funtions will throw an exception of if the value cannot be read, |
| 419 | // so do not call these if you don't require the data to be present. |
| 420 | |
| 421 | // Read and return an integer (32 bits) |
| 422 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 423 | typedef int (*cf_ReadInt_fp)(CFILE *cfp); |
| 424 | DMFCDLLOUT(cf_ReadInt_fp DLLcf_ReadInt;) |
| 425 | |
| 426 | // Read and return a int16_t (16 bits) |
| 427 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 428 | typedef int16_t (*cf_ReadShort_fp)(CFILE *cfp); |
| 429 | DMFCDLLOUT(cf_ReadShort_fp DLLcf_ReadShort;) |
| 430 | |
| 431 | // Read and return a byte (8 bits) |
| 432 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 433 | typedef int8_t (*cf_ReadByte_fp)(CFILE *cfp); |
| 434 | DMFCDLLOUT(cf_ReadByte_fp DLLcf_ReadByte;) |
| 435 | |
| 436 | // Read and return a float (32 bits) |
| 437 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 438 | typedef float (*cf_ReadFloat_fp)(CFILE *cfp); |
| 439 | DMFCDLLOUT(cf_ReadFloat_fp DLLcf_ReadFloat;) |
| 440 | |
| 441 | // Read and return a double (64 bits) |
| 442 | // Throws an exception of type (cfile_error *) if the OS returns an error on read |
| 443 | typedef double (*cf_ReadDouble_fp)(CFILE *cfp); |
| 444 | DMFCDLLOUT(cf_ReadDouble_fp DLLcf_ReadDouble;) |
| 445 | |
| 446 | // Reads a string from a CFILE. If the file is type binary, this |
| 447 | // function reads until a NULL or EOF is found. If the file is text, |
| 448 | // the function reads until a newline or EOF is found. The string is always |
| 449 | // written to the destination buffer null-terminated, without the newline. |
| 450 | // Parameters: buf - where the string is written |
| 451 | // n - the maximum string length, including the terminating 0 |
| 452 | // cfp - the CFILE pointer |
| 453 | // Returns the number of bytes in the string, before the terminator |
| 454 | // Does not generate an exception on EOF |
| 455 | typedef int (*cf_ReadString_fp)(char *buf, size_t n, CFILE *cfp); |
| 456 | DMFCDLLOUT(cf_ReadString_fp DLLcf_ReadString;) |
| 457 | |
| 458 | // Writes the specified number of bytes from a file into the buffer |
| 459 | // DO NOT USE THIS TO WRITE STRUCTURES. This function is for byte |
| 460 | // data, such as a string or a bitmap of 8-bit pixels. |
| 461 | // Returns the number of bytes written. |
| 462 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 463 | typedef int (*cf_WriteBytes_fp)(const uint8_t *buf, int count, CFILE *cfp); |
| 464 | DMFCDLLOUT(cf_WriteBytes_fp DLLcf_WriteBytes;) |
| 465 | |
| 466 | // Writes a null-terminated string to a file. If the file is type binary, |
| 467 | // the string is terminated in the file with a null. If the file is type |
| 468 | // text, the string is terminated with a newline. |
| 469 | // Parameters: buf - pointer to the string |
| 470 | // cfp = the CFILE pointer |
| 471 | // Returns the number of bytes written |
| 472 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 473 | typedef int (*cf_WriteString_fp)(CFILE *cfp, const char *buf); |
| 474 | DMFCDLLOUT(cf_WriteString_fp DLLcf_WriteString;) |
| 475 | |
| 476 | // Write an integer (32 bits) |
| 477 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 478 | typedef void (*cf_WriteInt_fp)(CFILE *cfp, int i); |
| 479 | DMFCDLLOUT(cf_WriteInt_fp DLLcf_WriteInt;) |
| 480 | |
| 481 | // Write a int16_t (16 bits) |
| 482 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 483 | typedef void (*cf_WriteShort_fp)(CFILE *cfp, int16_t s); |
| 484 | DMFCDLLOUT(cf_WriteShort_fp DLLcf_WriteShort;) |
| 485 | |
| 486 | // Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair. |
| 487 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 488 | typedef void (*cf_WriteByte_fp)(CFILE *cfp, int8_t b); |
| 489 | DMFCDLLOUT(cf_WriteByte_fp DLLcf_WriteByte;) |
| 490 | |
| 491 | // Write a float (32 bits) |
| 492 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 493 | typedef void (*cf_WriteFloat_fp)(CFILE *cfp, float f); |
| 494 | DMFCDLLOUT(cf_WriteFloat_fp DLLcf_WriteFloat;) |
| 495 | |
| 496 | // Write a double (64 bits) |
| 497 | // Throws an exception of type (cfile_error *) if the OS returns an error on write |
| 498 | typedef void (*cf_WriteDouble_fp)(CFILE *cfp, double d); |
| 499 | DMFCDLLOUT(cf_WriteDouble_fp DLLcf_WriteDouble;) |
| 500 | |
| 501 | // Copies a file. Returns TRUE if copied ok. Returns FALSE if error opening either file. |
| 502 | // Throws an exception of type (cfile_error *) if the OS returns an error on read or write |
| 503 | typedef bool (*cf_CopyFile_fp)(char *dest, const char *src); |
| 504 | DMFCDLLOUT(cf_CopyFile_fp DLLcf_CopyFile;) |
| 505 | |
| 506 | // Checks to see if two files are different. |
| 507 | // Returns TRUE if the files are different, or FALSE if they are the same. |
| 508 | typedef bool (*cf_Diff_fp)(const char *a, const char *b); |
| 509 | DMFCDLLOUT(cf_Diff_fp DLLcf_Diff;) |
| 510 | |
| 511 | // Disconnects a player |
| 512 | typedef void (*MultiDisconnectPlayer_fp)(int slot); |
| 513 | DMFCDLLOUT(MultiDisconnectPlayer_fp DLLMultiDisconnectPlayer;) |
| 514 | |
| 515 | // Fills in the string with the string address from the internet address |
| 516 | typedef void (*nw_GetNumbersFromHostAddress_fp)(network_address *address, char *str); |
| 517 | DMFCDLLOUT(nw_GetNumbersFromHostAddress_fp DLLnw_GetNumbersFromHostAddress;) |
| 518 | |
| 519 | // Returns the address of this machine |
| 520 | typedef int (*nw_GetThisIP_fp)(void); |
| 521 | DMFCDLLOUT(nw_GetThisIP_fp DLLnw_GetThisIP;) |
| 522 | |
| 523 | // Given a filename, pointer to a char * array and a pointer to an int, |
| 524 | // it will load the string table and fill in the information |
| 525 | // returns true on success |
| 526 | typedef bool (*CreateStringTable_fp)(const char *filename, char ***table, int *size); |
| 527 | DMFCDLLOUT(CreateStringTable_fp DLLCreateStringTable;) |
| 528 | |
| 529 | // Given a string table and it's count of strings, it will free up it's memory |
| 530 | typedef void (*DestroyStringTable_fp)(char **table, int size); |
| 531 | DMFCDLLOUT(DestroyStringTable_fp DLLDestroyStringTable;) |
| 532 | |
| 533 | // renders text, scaled, alphaed, saturated, |
| 534 | typedef void (*RenderHUDTextFlags_fp)(int flags, ddgr_color col, uint8_t alpha, int sat_count, int x, int y, const char *fmt, ...); |
| 535 | DMFCDLLOUT(RenderHUDTextFlags_fp DLLRenderHUDTextFlags;) |
| 536 | |
| 537 | // Sets the FOV range at which the hud names will come on |
| 538 | typedef void (*PlayerSetHUDNameFOV_fp)(int fov); |
| 539 | DMFCDLLOUT(PlayerSetHUDNameFOV_fp DLLPlayerSetHUDNameFOV;) |
| 540 | |
| 541 | // Fills in the original parent of the object, it will be the object passed in if it doesn't have a parent |
| 542 | typedef void (*GetUltimateParentForObject_fp)(object **parent, object *child); |
| 543 | DMFCDLLOUT(GetUltimateParentForObject_fp DLLGetUltimateParentForObject;) |
| 544 | |
| 545 | // Sets an object flag dead (does not write demo data) |
| 546 | // typedef void (*SetObjectDeadFlagRaw_fp)(object *obj,bool tell_clients_to_remove=false,bool |
| 547 | // tell_clients_to_play_sound=false); |
| 548 | typedef void (*SetObjectDeadFlagRaw_fp)(object *obj, bool tell_clients_to_remove, bool tell_clients_to_play_sound); |
| 549 | DMFCDLLOUT(SetObjectDeadFlagRaw_fp DLLSetObjectDeadFlagRaw;) |
| 550 | |
| 551 | // Sets an object flag dead (automatically writes demo data when needed) |
| 552 | // typedef void (*SetObjectDeadFlag_fp)(object *obj,bool tell_clients_to_remove=false,bool |
| 553 | // tell_clients_to_play_sound=false); |
| 554 | typedef void (*SetObjectDeadFlag_fp)(object *obj, bool tell_clients_to_remove, bool tell_clients_to_play_sound); |
| 555 | DMFCDLLOUT(SetObjectDeadFlag_fp DLLSetObjectDeadFlag;) |
| 556 | |
| 557 | // Call this function if there was an error while running the Multiplayer DLL, it will bail out |
| 558 | // typedef void (*DLLFatalError_fp)(const char *reason=NULL); |
| 559 | typedef void (*DLLFatalError_fp)(const char *reason); |
| 560 | DMFCDLLOUT(DLLFatalError_fp FatalError;) |
| 561 | |
| 562 | // Assert for the DLLs |
| 563 | typedef void (*assertdll_fp)(int x, const char *expression, const char *file, int line); |
| 564 | DMFCDLLOUT(assertdll_fp DLLassert;) |
| 565 | |
| 566 | // Return index of generic that has matching table entry |
| 567 | typedef int (*MultiMatchWeapon_fp)(uint32_t unique_id); |
| 568 | DMFCDLLOUT(MultiMatchWeapon_fp DLLMultiMatchWeapon;) |
| 569 | |
| 570 | // Returns the unique id of a given object type/id |
| 571 | typedef uint32_t (*MultiGetMatchChecksum_fp)(int type, int id); |
| 572 | DMFCDLLOUT(MultiGetMatchChecksum_fp DLLMultiGetMatchChecksum;) |
| 573 | |
| 574 | // Searches thru all weapons for a specific name, returns -1 if not found |
| 575 | // or index of weapon with name |
| 576 | typedef int (*FindWeaponName_fp)(const char *name); |
| 577 | DMFCDLLOUT(FindWeaponName_fp DLLFindWeaponName;) |
| 578 | |
| 579 | // Opens a HOG file. Future calls to cfopen(), etc. will look in this HOG. |
| 580 | // Parameters: libname - the path & filename of the HOG file |
| 581 | // Returns: 0 if error, else library handle that can be used to close the library |
| 582 | typedef int (*cf_OpenLibrary_fp)(const std::filesystem::path &libname); |
| 583 | DMFCDLLOUT(cf_OpenLibrary_fp DLLcf_OpenLibrary;) |
| 584 | |
| 585 | // Closes a library file. |
| 586 | // Parameters: handle: the handle returned by cf_OpenLibrary() |
| 587 | typedef void (*cf_CloseLibrary_fp)(int handle); |
| 588 | DMFCDLLOUT(cf_CloseLibrary_fp DLLcf_CloseLibrary;) |
| 589 | |
| 590 | // We're asking to enter observer mode |
| 591 | typedef void (*MultiSendRequestToObserve_fp)(int mode, int on, int objnum); |
| 592 | DMFCDLLOUT(MultiSendRequestToObserve_fp DLLMultiSendRequestToObserve;) |
| 593 | |
| 594 | // Searches thru all textures for a specific name, returns -1 if not found |
| 595 | // or index of texture with name |
| 596 | typedef int (*FindTextureName_fp)(const char *name); |
| 597 | DMFCDLLOUT(FindTextureName_fp DLLFindTextureName;) |
| 598 | |
| 599 | // Applies damage to a player object, returns false if damage wasn't applied due to things like |
| 600 | // invunerability |
| 601 | // typedef bool (*ApplyDamageToPlayer_fp)(object *playerobj, object *killer, int damage_type, float damage_amount,int |
| 602 | // server_says=0,int weapon_id=255,bool playsound=true); |
| 603 | typedef bool (*ApplyDamageToPlayer_fp)(object *playerobj, object *killer, int damage_type, float damage_amount, |
| 604 | int server_says, int weapon_id, bool playsound); |
| 605 | DMFCDLLOUT(ApplyDamageToPlayer_fp DLLApplyDamageToPlayer;) |
| 606 | |
| 607 | // Return index of generic that has matching table entry |
| 608 | typedef int (*MultiMatchGeneric_fp)(uint32_t unique_id); |
| 609 | DMFCDLLOUT(MultiMatchGeneric_fp DLLMultiMatchGeneric;) |
| 610 | |
| 611 | typedef void (*SetUITextItemText_fp)(void *uit, char *newtext, uint32_t color); |
| 612 | DMFCDLLOUT(SetUITextItemText_fp DLLSetUITextItemText;) |
| 613 | |
| 614 | typedef void *(*NewUIWindowCreate_fp)(int x, int y, int w, int h, int flags); |
| 615 | DMFCDLLOUT(NewUIWindowCreate_fp DLLNewUIWindowCreate;) |
| 616 | |
| 617 | typedef void (*NewUIWindowDestroy_fp)(void *deswin); |
| 618 | DMFCDLLOUT(NewUIWindowDestroy_fp DLLNewUIWindowDestroy;) |
| 619 | |
| 620 | typedef void (*NewUIWindowOpen_fp)(void *deswin); |
| 621 | DMFCDLLOUT(NewUIWindowOpen_fp DLLNewUIWindowOpen;) |
| 622 | |
| 623 | typedef void (*NewUIWindowClose_fp)(void *deswin); |
| 624 | DMFCDLLOUT(NewUIWindowClose_fp DLLNewUIWindowClose;) |
| 625 | |
| 626 | typedef void *(*TextCreate_fp)(void *parentwin, void *textitem, int x, int y, int flags); |
| 627 | DMFCDLLOUT(TextCreate_fp DLLTextCreate;) |
| 628 | |
| 629 | typedef void (*TextSetTitle_fp)(void *text, void *textitem); |
| 630 | DMFCDLLOUT(TextSetTitle_fp DLLTextSetTitle;) |
| 631 | |
| 632 | typedef void *(*EditCreate_fp)(void *parentwin, int id, int x, int y, int w, int h, int flags); |
| 633 | DMFCDLLOUT(EditCreate_fp DLLEditCreate;) |
| 634 | |
| 635 | typedef void *(*ButtonCreate_fp)(void *parentwin, int id, void *titleitem, int x, int y, int w, int h, int flags); |
| 636 | DMFCDLLOUT(ButtonCreate_fp DLLButtonCreate;) |
| 637 | |
| 638 | typedef void *(*ListCreate_fp)(void *parentwin, int id, int x, int y, int w, int h, int flags); |
| 639 | DMFCDLLOUT(ListCreate_fp DLLListCreate;) |
| 640 | |
| 641 | typedef void (*ListRemoveAll_fp)(void *item); |
| 642 | DMFCDLLOUT(ListRemoveAll_fp DLLListRemoveAll;) |
| 643 | |
| 644 | typedef void (*ListAddItem_fp)(void *item, void *uitext); |
| 645 | DMFCDLLOUT(ListAddItem_fp DLLListAddItem;) |
| 646 | |
| 647 | typedef void (*ListRemoveItem_fp)(void *item, void *txtitem); |
| 648 | DMFCDLLOUT(ListRemoveItem_fp DLLListRemoveItem;) |
| 649 | |
| 650 | typedef void (*ListSelectItem_fp)(void *item, void *txtitem); |
| 651 | DMFCDLLOUT(ListSelectItem_fp DLLListSelectItem;) |
| 652 | |
| 653 | typedef char *(*ListGetItem_fp)(void *item, int index); |
| 654 | DMFCDLLOUT(ListGetItem_fp DLLListGetItem;) |
| 655 | |
| 656 | typedef int (*ListGetSelectedIndex_fp)(void *item); |
| 657 | DMFCDLLOUT(ListGetSelectedIndex_fp DLLListGetSelectedIndex;) |
| 658 | |
| 659 | typedef void (*ListSetSelectedIndex_fp)(void *item, int index); |
| 660 | DMFCDLLOUT(ListSetSelectedIndex_fp DLLListSetSelectedIndex;) |
| 661 | |
| 662 | typedef void (*EditSetText_fp)(void *item, const char *buff); |
| 663 | DMFCDLLOUT(EditSetText_fp DLLEditSetText;) |
| 664 | |
| 665 | typedef void (*EditGetText_fp)(void *item, char *buff, int len); |
| 666 | DMFCDLLOUT(EditGetText_fp DLLEditGetText;) |
| 667 | |
| 668 | typedef int (*GetUIItemWidth_fp)(void *item); |
| 669 | DMFCDLLOUT(GetUIItemWidth_fp DLLGetUIItemWidth;) |
| 670 | |
| 671 | typedef int (*GetUIItemHeight_fp)(void *item); |
| 672 | DMFCDLLOUT(GetUIItemHeight_fp DLLGetUIItemHeight;) |
| 673 | |
| 674 | // UI CheckBox functions |
| 675 | typedef void *(*CheckBoxCreate_fp)(void *parent, int id, void *title, int x, int y, int w, int h, int flags); |
| 676 | DMFCDLLOUT(CheckBoxCreate_fp DLLCheckBoxCreate;) |
| 677 | |
| 678 | typedef void (*CheckBoxSetCheck_fp)(void *cb, bool state); |
| 679 | DMFCDLLOUT(CheckBoxSetCheck_fp DLLCheckBoxSetCheck;) |
| 680 | |
| 681 | typedef bool (*CheckBoxIsChecked_fp)(void *cb); |
| 682 | DMFCDLLOUT(CheckBoxIsChecked_fp DLLCheckBoxIsChecked;) |
| 683 | |
| 684 | // does a UI loop: returns a result value for the current window in focus. |
| 685 | typedef int (*DoUI_fp)(void); |
| 686 | DMFCDLLOUT(DoUI_fp DLLDoUI;) |
| 687 | |
| 688 | // puts up a message box with a title and message. |
| 689 | // typedef int (*DoMessageBox_fp)(const char *title, const char *msg, int type, ddgr_color title_color = GR_WHITE, |
| 690 | // ddgr_color text_color = GR_WHITE); |
| 691 | typedef int (*DoMessageBox_fp)(const char *title, const char *msg, int type, ddgr_color title_color, |
| 692 | ddgr_color text_color); |
| 693 | DMFCDLLOUT(DoMessageBox_fp DLLDoMessageBox;) |
| 694 | |
| 695 | typedef void (*DescentDefer_fp)(void); |
| 696 | DMFCDLLOUT(DescentDefer_fp DLLDescentDefer;) |
| 697 | |
| 698 | // typedef void *(*NewUIGameWindowCreate_fp)(int x, int y, int w, int h, int flags=UIF_PROCESS_ALL); |
| 699 | typedef void *(*NewUIGameWindowCreate_fp)(int x, int y, int w, int h, int flags); |
| 700 | DMFCDLLOUT(NewUIGameWindowCreate_fp DLLNewUIGameWindowCreate;) |
| 701 | |
| 702 | typedef void (*NewUIGameWindowDestroy_fp)(void *item); |
| 703 | DMFCDLLOUT(NewUIGameWindowDestroy_fp DLLNewUIGameWindowDestroy;) |
| 704 | |
| 705 | typedef void (*NewUIGameWindowOpen_fp)(void *item); |
| 706 | DMFCDLLOUT(NewUIGameWindowOpen_fp DLLNewUIGameWindowOpen;) |
| 707 | |
| 708 | typedef void (*NewUIGameWindowClose_fp)(void *item); |
| 709 | DMFCDLLOUT(NewUIGameWindowClose_fp DLLNewUIGameWindowClose;) |
| 710 | |
| 711 | typedef void *(*HotSpotCreate_fp)(void *parentwin, int id, int key, void *txtitemoff, void *txtitemon, int x, int y, |
| 712 | int w, int h, int flags); |
| 713 | DMFCDLLOUT(HotSpotCreate_fp DLLHotSpotCreate;) |
| 714 | |
| 715 | typedef int (*PollUI_fp)(void); |
| 716 | DMFCDLLOUT(PollUI_fp DLLPollUI;) |
| 717 | |
| 718 | typedef void (*RemoveUITextItem_fp)(void *item); |
| 719 | DMFCDLLOUT(RemoveUITextItem_fp DLLRemoveUITextItem;) |
| 720 | |
| 721 | // typedef void *(*CreateNewUITextItem_fp)(const char *newtext,uint32_t color,int font=-1); |
| 722 | typedef void *(*CreateNewUITextItem_fp)(const char *newtext, uint32_t color, int font); |
| 723 | DMFCDLLOUT(CreateNewUITextItem_fp DLLCreateNewUITextItem;) |
| 724 | |
| 725 | typedef void (*RemoveUIBmpItem_fp)(void *item); |
| 726 | DMFCDLLOUT(RemoveUIBmpItem_fp DLLRemoveUIBmpItem;) |
| 727 | |
| 728 | typedef void *(*CreateNewUIBmpItem_fp)(int handle, uint8_t alpha); |
| 729 | DMFCDLLOUT(CreateNewUIBmpItem_fp DLLCreateNewUIBmpItem;) |
| 730 | |
| 731 | typedef void *(*UIConsoleGadgetCreate_fp)(void *parentid, int id, int x, int y, int font, int cols, int rows, |
| 732 | int flags); |
| 733 | DMFCDLLOUT(UIConsoleGadgetCreate_fp DLLUIConsoleGadgetCreate;) |
| 734 | |
| 735 | typedef void (*UIConsoleGadgetputs_fp)(void *item, const char *str); |
| 736 | DMFCDLLOUT(UIConsoleGadgetputs_fp DLLUIConsoleGadgetputs;) |
| 737 | |
| 738 | typedef void (*NewUIWindowSetFocusOnEditGadget_fp)(void *item, void *parent); |
| 739 | DMFCDLLOUT(NewUIWindowSetFocusOnEditGadget_fp DLLNewUIWindowSetFocusOnEditGadget;) |
| 740 | |
| 741 | typedef void *(*OldListCreate_fp)(void *parentitem, int id, int x, int y, int w, int h, int flags); |
| 742 | DMFCDLLOUT(OldListCreate_fp DLLOldListCreate;) |
| 743 | |
| 744 | typedef void (*OldListRemoveAll_fp)(void *item); |
| 745 | DMFCDLLOUT(OldListRemoveAll_fp DLLOldListRemoveAll;) |
| 746 | |
| 747 | typedef void (*OldListAddItem_fp)(void *item, void *uitext); |
| 748 | DMFCDLLOUT(OldListAddItem_fp DLLOldListAddItem;) |
| 749 | |
| 750 | typedef void (*OldListRemoveItem_fp)(void *item, void *txtitem); |
| 751 | DMFCDLLOUT(OldListRemoveItem_fp DLLOldListRemoveItem;) |
| 752 | |
| 753 | typedef void (*OldListSelectItem_fp)(void *item, void *txtitem); |
| 754 | DMFCDLLOUT(OldListSelectItem_fp DLLOldListSelectItem;) |
| 755 | |
| 756 | typedef void *(*OldEditCreate_fp)(void *parentitem, int id, int x, int y, int w, int h, int flags); |
| 757 | DMFCDLLOUT(OldEditCreate_fp DLLOldEditCreate;) |
| 758 | |
| 759 | typedef void (*OldEditGetText_fp)(void *item, char *buff, int len); |
| 760 | DMFCDLLOUT(OldEditGetText_fp DLLOldEditGetText;) |
| 761 | |
| 762 | typedef void (*OldEditSetText_fp)(void *item, const char *newtext); |
| 763 | DMFCDLLOUT(OldEditSetText_fp DLLOldEditSetText;) |
| 764 | |
| 765 | typedef char *(*OldListGetItem_fp)(void *item, int index); |
| 766 | DMFCDLLOUT(OldListGetItem_fp DLLOldListGetItem;) |
| 767 | |
| 768 | typedef int (*OldListGetSelectedIndex_fp)(void *item); |
| 769 | DMFCDLLOUT(OldListGetSelectedIndex_fp DLLOldListGetSelectedIndex;) |
| 770 | |
| 771 | typedef void (*ToggleUICallback_fp)(int state); |
| 772 | DMFCDLLOUT(ToggleUICallback_fp DLLToggleUICallback;) |
| 773 | |
| 774 | typedef void (*SetOldEditBufferLen_fp)(void *item, int len); |
| 775 | DMFCDLLOUT(SetOldEditBufferLen_fp DLLSetOldEditBufferLen;) |
| 776 | |
| 777 | typedef void (*NewUIWindowLoadBackgroundImage_fp)(void *item, const char *image_name); |
| 778 | DMFCDLLOUT(NewUIWindowLoadBackgroundImage_fp DLLNewUIWindowLoadBackgroundImage;) |
| 779 | |
| 780 | typedef void (*DeleteUIItem_fp)(void *delitem); |
| 781 | DMFCDLLOUT(DeleteUIItem_fp DLLDeleteUIItem;) |
| 782 | |
| 783 | typedef void (*HotSpotSetStates_fp)(void *hs, void *texton, void *textoff); |
| 784 | DMFCDLLOUT(HotSpotSetStates_fp DLLHotSpotSetStates;) |
| 785 | |
| 786 | // sets the callback for background rendering of desktop for UI |
| 787 | typedef void (*SetUICallback_fp)(void (*fn)()); |
| 788 | DMFCDLLOUT(SetUICallback_fp DLLSetUICallback;) |
| 789 | |
| 790 | typedef void (*RetrieveUICallback_fp)(void **fn); |
| 791 | DMFCDLLOUT(RetrieveUICallback_fp DLLGetUICallback;) |
| 792 | |
| 793 | typedef void (*SuspendControls_fp)(void); |
| 794 | DMFCDLLOUT(SuspendControls_fp DLLSuspendControls;) |
| 795 | |
| 796 | typedef void (*ResumeControls_fp)(void); |
| 797 | DMFCDLLOUT(ResumeControls_fp DLLResumeControls;) |
| 798 | |
| 799 | typedef void (*ui_ShowCursor_fp)(void); |
| 800 | DMFCDLLOUT(ui_ShowCursor_fp DLLShowCursor;) |
| 801 | |
| 802 | typedef void (*ui_HideCursor_fp)(void); |
| 803 | DMFCDLLOUT(ui_HideCursor_fp DLLHideCursor;) |
| 804 | |
| 805 | typedef void (*GameFrame_fp)(void); |
| 806 | DMFCDLLOUT(GameFrame_fp DLLGameFrame;) |
| 807 | |
| 808 | // typedef void *(*SliderCreate_fp)(void *parent, int id, int x, int y, int flags=0); |
| 809 | typedef void *(*SliderCreate_fp)(void *parent, int id, int x, int y, int flags); |
| 810 | DMFCDLLOUT(SliderCreate_fp DLLSliderCreate;) |
| 811 | |
| 812 | typedef void (*SliderSetRange_fp)(void *slider, int range); |
| 813 | DMFCDLLOUT(SliderSetRange_fp DLLSliderSetRange;) |
| 814 | |
| 815 | typedef int (*SliderGetRange_fp)(void *slider); |
| 816 | DMFCDLLOUT(SliderGetRange_fp DLLSliderGetRange;) |
| 817 | |
| 818 | typedef void (*SliderSetPos_fp)(void *slider, int pos); |
| 819 | DMFCDLLOUT(SliderSetPos_fp DLLSliderSetPos;) |
| 820 | |
| 821 | typedef int (*SliderGetPos_fp)(void *slider); |
| 822 | DMFCDLLOUT(SliderGetPos_fp DLLSliderGetPos;) |
| 823 | |
| 824 | typedef void (*SliderSetSelectChangeCallback_fp)(void *slider, void (*fn)(int)); |
| 825 | DMFCDLLOUT(SliderSetSelectChangeCallback_fp DLLSliderSetSelectChangeCallback;) |
| 826 | |
| 827 | typedef void (*SliderSetSelectChangeCallbackWData_fp)(void *slider, void (*fn)(int, void *), void *ptr); |
| 828 | DMFCDLLOUT(SliderSetSelectChangeCallbackWData_fp DLLSliderSetSelectChangeCallbackWData;) |
| 829 | |
| 830 | // Prints a message to the console if the dedicated server is active |
| 831 | typedef void (*DPrintf_fp)(const char *fmt, ...); |
| 832 | DMFCDLLOUT(DPrintf_fp DPrintf;) |
| 833 | |
| 834 | // Split a pathname into its component parts |
| 835 | // The path in splitpath is in the *LOCAL* file system's syntax |
| 836 | typedef void (*ddio_SplitPath_fp)(const char *srcPath, char *path, char *filename, char *ext); |
| 837 | DMFCDLLOUT(ddio_SplitPath_fp DLLddio_SplitPath;) |
| 838 | |
| 839 | // Constructs a path in the local file system's syntax |
| 840 | // builtPath: stores the constructed path |
| 841 | // absolutePathHeader: absolute path on which the sub directories will be appended |
| 842 | // (specified in local file system syntax) |
| 843 | // subdir: the first subdirectory |
| 844 | // takes a variable number of additional subdirectories which will be concatenated on to the path |
| 845 | // the last argument in the list of sub dirs *MUST* be NULL to terminate the list |
| 846 | typedef void (*ddio_MakePath_fp)(char *newPath, const char *absolutePathHeader, const char *subDir, ...); |
| 847 | DMFCDLLOUT(ddio_MakePath_fp DLLddio_MakePath;) |
| 848 | |
| 849 | // Plays a 2d sound |
| 850 | // typedef int (*Play2dSound_fp)(int sound_index, float volume =MAX_GAME_VOLUME/2); |
| 851 | typedef int (*Play2dSound_fp)(int sound_index, float volume); |
| 852 | DMFCDLLOUT(Play2dSound_fp DLLPlay2dSound;) |
| 853 | |
| 854 | typedef void (*TouchSound_fp)(int sound_index); |
| 855 | DMFCDLLOUT(TouchSound_fp DLLTouchSound;) |
| 856 | |
| 857 | // Database functions to read/write |
| 858 | typedef bool (*dDatabaseRead_fp1)(const char *label, char *entry, int *entrylen); |
| 859 | DMFCDLLOUT(dDatabaseRead_fp1 DatabaseRead1;) |
| 860 | |
| 861 | typedef bool (*dDatabaseRead_fp2)(const char *label, void *entry, int wordsize); |
| 862 | DMFCDLLOUT(dDatabaseRead_fp2 DatabaseRead2;) |
| 863 | |
| 864 | typedef bool (*dDatabaseRead_fp3)(const char *label, bool *entry); |
| 865 | DMFCDLLOUT(dDatabaseRead_fp3 DatabaseRead3;) |
| 866 | |
| 867 | typedef bool (*dDatabaseWrite_fp1)(const char *label, const char *entry, int entrylen); |
| 868 | DMFCDLLOUT(dDatabaseWrite_fp1 DatabaseWrite1;) |
| 869 | |
| 870 | typedef bool (*dDatabaseWrite_fp2)(const char *label, int entry); |
| 871 | DMFCDLLOUT(dDatabaseWrite_fp2 DatabaseWrite2;) |
| 872 | |
| 873 | // Attaches 2 objects via attach points on each. The f_used_aligned allows for an aligned connection. |
| 874 | // NOTE: The child always moves to the parent |
| 875 | // typedef bool (*AttachObject_fp)(object *parent, char parent_ap, object *child, char child_ap, bool f_use_aligned = |
| 876 | // false); |
| 877 | typedef bool (*AttachObject_fp)(object *parent, char parent_ap, object *child, char child_ap, bool f_use_aligned); |
| 878 | DMFCDLLOUT(AttachObject_fp DLLAttachObject;) |
| 879 | |
| 880 | // Retruns a pointer to an object given its handle. Returns NULL if object no longer exists. |
| 881 | typedef bool (*ObjGet_fp)(int handle, object **obj); |
| 882 | DMFCDLLOUT(ObjGet_fp DLLObjGet;) |
| 883 | |
| 884 | // Given a pilot id, it will return the pilot name of |
| 885 | // the pilot name. Returns false if it's an invalid pilot id. |
| 886 | typedef bool (*PPic_GetPilot_fp)(uint16_t pilot_id, char *pilot_name, int buffersize); |
| 887 | DMFCDLLOUT(PPic_GetPilot_fp DLLPPic_GetPilot;) |
| 888 | |
| 889 | // Given a pilot id, it will return a handle to the bitmap for the pilot. |
| 890 | // MAKE SURE YOU FREE THE BITMAP WITH DLLbm_FreeBitmap(). Returns -1 if it was an illegal pilot id. |
| 891 | // Returns BAD_BITMAP_HANDLE if it couldn't open the bitmap. |
| 892 | typedef int (*PPic_GetBitmapHandle_fp)(uint16_t pilot_id); |
| 893 | DMFCDLLOUT(PPic_GetBitmapHandle_fp DLLPPic_GetBitmapHandle;) |
| 894 | |
| 895 | // Draws a line |
| 896 | typedef void (*rend_DrawLine_fp)(int x1, int y1, int x2, int y2); |
| 897 | DMFCDLLOUT(rend_DrawLine_fp DLLrend_DrawLine;) |
| 898 | |
| 899 | // Sets the color for fill based primitives; |
| 900 | typedef void (*rend_SetFlatColor_fp)(ddgr_color color); |
| 901 | DMFCDLLOUT(rend_SetFlatColor_fp DLLrend_SetFlatColor;) |
| 902 | |
| 903 | // Sets whether or not we want the logos to be displayed on ships |
| 904 | typedef void (*MultiSetLogoState_fp)(bool state); |
| 905 | DMFCDLLOUT(MultiSetLogoState_fp DLLMultiSetLogoState;) |
| 906 | |
| 907 | // Spews the inventory of the passed in player object |
| 908 | // typedef void (*PlayerSpewInventory_fp)(object *obj,bool spew_energy_and_shield=true,bool spew_nonspewables=false); |
| 909 | typedef void (*PlayerSpewInventory_fp)(object *obj, bool spew_energy_and_shield, bool spew_nonspewables); |
| 910 | DMFCDLLOUT(PlayerSpewInventory_fp DLLPlayerSpewInventory;) |
| 911 | |
| 912 | // Returns a random player starting position |
| 913 | typedef int (*PlayerGetRandomStartPosition_fp)(int slot); |
| 914 | DMFCDLLOUT(PlayerGetRandomStartPosition_fp DLLPlayerGetRandomStartPosition;) |
| 915 | |
| 916 | // Resets all the properties a player ship to the default values |
| 917 | // Pass in what kind of reset the inventory should do INVRESET_ |
| 918 | typedef void (*InitPlayerNewShip_fp)(int slot, int inven_reset); |
| 919 | DMFCDLLOUT(InitPlayerNewShip_fp DLLInitPlayerNewShip;) |
| 920 | |
| 921 | // Returns internet address format from string address format...ie "204.243.217.14" |
| 922 | // turns into 1414829242 |
| 923 | typedef uint32_t (*nw_GetHostAddressFromNumbers_fp)(char *str); |
| 924 | DMFCDLLOUT(nw_GetHostAddressFromNumbers_fp DLLnw_GetHostAddressFromNumbers;) |
| 925 | |
| 926 | // Removes all addon table files from D3 (really shouldn't be called, automatically done) |
| 927 | typedef void (*TableFilesClear_fp)(void); |
| 928 | DMFCDLLOUT(TableFilesClear_fp TableFilesClear;) |
| 929 | |
| 930 | // Adds a table file into the manage system for add-on data |
| 931 | typedef bool (*TableFileAdd_fp)(char *filename); |
| 932 | DMFCDLLOUT(TableFileAdd_fp TableFileAdd;) |
| 933 | |
| 934 | // Debugger interaction |
| 935 | typedef void (*DebugBreak_callback_stop_fp)(void); |
| 936 | DMFCDLLOUT(DebugBreak_callback_stop_fp DLLDebugBreak_callback_stop;) |
| 937 | typedef void (*DebugBreak_callback_resume_fp)(void); |
| 938 | DMFCDLLOUT(DebugBreak_callback_resume_fp DLLDebugBreak_callback_resume;) |
| 939 | typedef void (*Int3MessageBox_fp)(const char *file, const char *line); |
| 940 | DMFCDLLOUT(Int3MessageBox_fp DLLInt3MessageBox;) |
| 941 | |
| 942 | // Fills in the non-NULL parameters with the position and size information about |
| 943 | // a UI Item |
| 944 | typedef void (*GetUIItemPosition_fp)(void *item, int *x, int *y, int *w, int *h); |
| 945 | DMFCDLLOUT(GetUIItemPosition_fp DLLGetUIItemPosition;) |
| 946 | |
| 947 | // Attaches a child object to a parent object by a percent of the radius of the child. |
| 948 | // NOTE: The child always moves to the parent and not the reverse |
| 949 | typedef bool (*AttachObjectRadius_fp)(object *parent, char parent_ap, object *child, float percent_rad); |
| 950 | DMFCDLLOUT(AttachObjectRadius_fp DLLAttachObjectRadius;) |
| 951 | |
| 952 | // Unattaches all children from a parent object |
| 953 | typedef bool (*UnattachChildren_fp)(object *parent); |
| 954 | DMFCDLLOUT(UnattachChildren_fp DLLUnattachChildren;) |
| 955 | |
| 956 | // Unattaches a child from an attach point |
| 957 | typedef bool (*UnattachChild_fp)(object *parent, char parent_ap); |
| 958 | DMFCDLLOUT(UnattachChild_fp DLLUnattachChild;) |
| 959 | |
| 960 | // Unattaches an object from its parent |
| 961 | typedef bool (*UnattachFromParent_fp)(object *child); |
| 962 | DMFCDLLOUT(UnattachFromParent_fp DLLUnattachFromParent;) |
| 963 | |
| 964 | typedef float (*vm_GetMagnitude_fp)(vector *vec); |
| 965 | DMFCDLLOUT(vm_GetMagnitude_fp DLLvm_GetMagnitude;) |
| 966 | |
| 967 | // Rotates a vector thru a matrix |
| 968 | typedef void (*vm_MatrixMulVector_fp)(vector *, vector *, matrix *); |
| 969 | DMFCDLLOUT(vm_MatrixMulVector_fp DLLvm_MatrixMulVector;) |
| 970 | |
| 971 | // Applies an instantaneous force on an object, resulting in an instantaneous |
| 972 | // change in velocity. |
| 973 | // typedef void (*phys_apply_force_fp)(object *obj,vector *force_vec,int16_t weapon_index=-1); |
| 974 | typedef void (*phys_apply_force_fp)(object *obj, vector *force_vec, int16_t weapon_index); |
| 975 | DMFCDLLOUT(phys_apply_force_fp DLLphys_apply_force;) |
| 976 | |
| 977 | typedef void (*phys_apply_rot_fp)(object *obj, vector *force_vec); |
| 978 | DMFCDLLOUT(phys_apply_rot_fp DLLphys_apply_rot;) |
| 979 | |
| 980 | // Transposes a matrix in place |
| 981 | typedef void (*vm_TransposeMatrix_fp)(matrix *); |
| 982 | DMFCDLLOUT(vm_TransposeMatrix_fp DLLvm_TransposeMatrix;) |
| 983 | |
| 984 | // Returns a perpendicular vector to the two given vectors |
| 985 | typedef void (*vm_CrossProduct_fp)(vector *, vector *, vector *); |
| 986 | DMFCDLLOUT(vm_CrossProduct_fp DLLvm_CrossProduct;) |
| 987 | |
| 988 | // Normalizes a vector |
| 989 | // Returns the magnitude before normalization |
| 990 | typedef float (*vm_NormalizeVector_fp)(vector *); |
| 991 | DMFCDLLOUT(vm_NormalizeVector_fp DLLvm_NormalizeVector;) |
| 992 | |
| 993 | typedef void (*ConvertEulerToAxisAmount_fp)(vector *e, vector *n, float *w); |
| 994 | DMFCDLLOUT(ConvertEulerToAxisAmount_fp DLLConvertEulerToAxisAmount;) |
| 995 | |
| 996 | typedef void (*ConvertAxisAmountToEuler_fp)(vector *n, float *w, vector *e); |
| 997 | DMFCDLLOUT(ConvertAxisAmountToEuler_fp DLLConvertAxisAmountToEuler;) |
| 998 | |
| 999 | // Given a vector, returns an approximation of the magnitude |
| 1000 | typedef float (*vm_GetMagnitudeFast_fp)(vector *); |
| 1001 | DMFCDLLOUT(vm_GetMagnitudeFast_fp DLLvm_GetMagnitudeFast;) |
| 1002 | |
| 1003 | // Given a matrix, makes it an identity matrix |
| 1004 | typedef void (*vm_MakeIdentity_fp)(matrix *); |
| 1005 | DMFCDLLOUT(vm_MakeIdentity_fp DLLvm_MakeIdentity;) |
| 1006 | |
| 1007 | // Set a vector to {0,0,0} |
| 1008 | typedef void (*vm_MakeVectorZero_fp)(vector *v); |
| 1009 | DMFCDLLOUT(vm_MakeVectorZero_fp DLLvm_MakeVectorZero;) |
| 1010 | |
| 1011 | // Set an angvec to {0,0,0} |
| 1012 | typedef void (*vm_MakeAngleZero_fp)(angvec *a); |
| 1013 | DMFCDLLOUT(vm_MakeAngleZero_fp DLLvm_MakeAngleZero;) |
| 1014 | |
| 1015 | // Multiply a vector times the transpose of a matrix |
| 1016 | typedef void (*vm_VectorMulTMatrix_fp)(vector *result, vector *v, matrix *m); |
| 1017 | DMFCDLLOUT(vm_VectorMulTMatrix_fp DLLvm_VectorMulTMatrix;) |
| 1018 | |
| 1019 | // Multiplies 2 3x3 matrixes, returning the result in first argument |
| 1020 | typedef void (*vm_MatrixMul_fp)(matrix *, matrix *, matrix *); |
| 1021 | DMFCDLLOUT(vm_MatrixMul_fp DLLvm_MatrixMul;) |
| 1022 | |
| 1023 | // Multiply a matrix times the transpose of a matrix |
| 1024 | typedef void (*vm_MatrixMulTMatrix_fp)(matrix *dest, matrix *src0, matrix *src1); |
| 1025 | DMFCDLLOUT(vm_MatrixMulTMatrix_fp DLLvm_MatrixMulTMatrix;) |
| 1026 | |
| 1027 | // Returns the dot product of the two given vectors |
| 1028 | typedef float (*vm_DotProduct_fp)(vector *, vector *); |
| 1029 | DMFCDLLOUT(vm_DotProduct_fp DLLvm_DotProduct;) |
| 1030 | |
| 1031 | // Returns the difference between two vectors |
| 1032 | typedef void (*vm_SubVectors_fp)(vector *, const vector *, const vector *); |
| 1033 | DMFCDLLOUT(vm_SubVectors_fp DLLvm_SubVectors;) |
| 1034 | |
| 1035 | // Returns adds two vectors, returns result in first arg |
| 1036 | typedef void (*vm_AddVectors_fp)(vector *, vector *, vector *); |
| 1037 | DMFCDLLOUT(vm_AddVectors_fp DLLvm_AddVectors;) |
| 1038 | |
| 1039 | // Given a vector, divides second arg by vector components |
| 1040 | typedef void (*vm_AverageVector_fp)(vector *, int); |
| 1041 | DMFCDLLOUT(vm_AverageVector_fp DLLvm_AverageVector;) |
| 1042 | |
| 1043 | // Scales second arg vector by 3rd arg, placing result in first arg |
| 1044 | typedef void (*vm_ScaleVector_fp)(vector *, vector *, float); |
| 1045 | DMFCDLLOUT(vm_ScaleVector_fp DLLvm_ScaleVector;) |
| 1046 | |
| 1047 | // Scales all components of vector v by value s adds the result to p and stores result in vector d |
| 1048 | typedef void (*vm_ScaleAddVector_fp)(vector *d, vector *p, vector *v, float s); |
| 1049 | DMFCDLLOUT(vm_ScaleAddVector_fp DLLvm_ScaleAddVector;) |
| 1050 | |
| 1051 | // Divides second vector components by 3rd arg, placing result in first arg. Useful for parametric lines |
| 1052 | typedef void (*vm_DivVector_fp)(vector *, vector *, float); |
| 1053 | DMFCDLLOUT(vm_DivVector_fp DLLvm_DivVector;) |
| 1054 | |
| 1055 | // Same as NormalizeVector, but uses approximation |
| 1056 | typedef float (*vm_NormalizeVectorFast_fp)(vector *); |
| 1057 | DMFCDLLOUT(vm_NormalizeVectorFast_fp DLLvm_NormalizeVectorFast;) |
| 1058 | |
| 1059 | // Clears a matrix to zero |
| 1060 | typedef void (*vm_ClearMatrix_fp)(matrix *); |
| 1061 | DMFCDLLOUT(vm_ClearMatrix_fp DLLvm_ClearMatrix;) |
| 1062 | |
| 1063 | // Given 3 angles (p,h,b), makes a rotation matrix out of them |
| 1064 | typedef void (*vm_AnglesToMatrix_fp)(matrix *, angle p, angle h, angle b); |
| 1065 | DMFCDLLOUT(vm_AnglesToMatrix_fp DLLvm_AnglesToMatrix;) |
| 1066 | |
| 1067 | // Ensure that a matrix is orthogonal |
| 1068 | typedef void (*vm_Orthogonalize_fp)(matrix *m); |
| 1069 | DMFCDLLOUT(vm_Orthogonalize_fp DLLvm_Orthogonalize;) |
| 1070 | |
| 1071 | // Compute a matrix from one or two vectors. At least one and at most two vectors must/can be specified. |
| 1072 | // Parameters: m - filled in with the orienation matrix |
| 1073 | // fvec,uvec,rvec - pointers to vectors that determine the matrix. |
| 1074 | // One or two of these must be specified, with the other(s) set to NULL. |
| 1075 | typedef void (*vm_VectorToMatrix_fp)(matrix *m, vector *fvec, vector *uvec, vector *rvec); |
| 1076 | DMFCDLLOUT(vm_VectorToMatrix_fp DLLvm_VectorToMatrix;) |
| 1077 | |
| 1078 | // Computes a matrix from a vector and and angle of rotation around that vector |
| 1079 | // Parameters: m - filled in with the computed matrix |
| 1080 | // v - the forward vector of the new matrix |
| 1081 | // a - the angle of rotation around the forward vector |
| 1082 | typedef void (*vm_VectorAngleToMatrix_fp)(matrix *m, vector *v, angle a); |
| 1083 | DMFCDLLOUT(vm_VectorAngleToMatrix_fp DLLvm_VectorAngleToMatrix;) |
| 1084 | |
| 1085 | // Given an angle, places sin in 2nd arg, cos in 3rd. Either can be null |
| 1086 | typedef void (*vm_SinCos_fp)(angle, float *, float *); |
| 1087 | DMFCDLLOUT(vm_SinCos_fp DLLvm_SinCos;) |
| 1088 | |
| 1089 | // Given x1,y1,x2,y2, returns the slope |
| 1090 | typedef float (*vm_GetSlope_fp)(float, float, float, float); |
| 1091 | DMFCDLLOUT(vm_GetSlope_fp DLLvm_GetSlope;) |
| 1092 | |
| 1093 | // Calculates the perpendicular vector given three points |
| 1094 | // Parms: n - the computed perp vector (filled in) |
| 1095 | // v0,v1,v2 - three clockwise vertices |
| 1096 | typedef void (*vm_GetPerp_fp)(vector *n, vector *a, vector *b, vector *c); |
| 1097 | DMFCDLLOUT(vm_GetPerp_fp DLLvm_GetPerp;) |
| 1098 | |
| 1099 | // Calculates the (normalized) surface normal give three points |
| 1100 | // Parms: n - the computed surface normal (filled in) |
| 1101 | // v0,v1,v2 - three clockwise vertices |
| 1102 | // Returns the magnitude of the normal before it was normalized. |
| 1103 | // The bigger this value, the better the normal. |
| 1104 | typedef float (*vm_GetNormal_fp)(vector *n, vector *v0, vector *v1, vector *v2); |
| 1105 | DMFCDLLOUT(vm_GetNormal_fp DLLvm_GetNormal;) |
| 1106 | |
| 1107 | // Gets the distances (magnitude) between two vectors. Slow. |
| 1108 | typedef float (*vm_VectorDistance_fp)(const vector *a, const vector *b); |
| 1109 | DMFCDLLOUT(vm_VectorDistance_fp DLLvm_VectorDistance;) |
| 1110 | |
| 1111 | // Gets the approx distances (magnitude) between two vectors. Faster. |
| 1112 | typedef float (*vm_VectorDistanceQuick_fp)(vector *a, vector *b); |
| 1113 | DMFCDLLOUT(vm_VectorDistanceQuick_fp DLLvm_VectorDistanceQuick;) |
| 1114 | |
| 1115 | // Computes a normalized direction vector between two points |
| 1116 | // Parameters: dest - filled in with the normalized direction vector |
| 1117 | // start,end - the start and end points used to calculate the vector |
| 1118 | // Returns: the distance between the two input points |
| 1119 | typedef float (*vm_GetNormalizedDir_fp)(vector *dest, vector *end, vector *start); |
| 1120 | DMFCDLLOUT(vm_GetNormalizedDir_fp DLLvm_GetNormalizedDir;) |
| 1121 | |
| 1122 | // Returns a normalized direction vector between two points |
| 1123 | // Uses sloppier magnitude, less precise |
| 1124 | typedef float (*vm_GetNormalizedDirFast_fp)(vector *dest, vector *end, vector *start); |
| 1125 | DMFCDLLOUT(vm_GetNormalizedDirFast_fp DLLvm_GetNormalizedDirFast;) |
| 1126 | |
| 1127 | // extract angles from a matrix |
| 1128 | typedef angvec *(*vm_ExtractAnglesFromMatrix_fp)(angvec *a, matrix *m); |
| 1129 | DMFCDLLOUT(vm_ExtractAnglesFromMatrix_fp DLLvm_ExtractAnglesFromMatrix;) |
| 1130 | |
| 1131 | // returns the angle between two vectors and a forward vector |
| 1132 | typedef angle (*vm_DeltaAngVec_fp)(vector *v0, vector *v1, vector *fvec); |
| 1133 | DMFCDLLOUT(vm_DeltaAngVec_fp DLLvm_DeltaAngVec;) |
| 1134 | |
| 1135 | // returns the angle between two normalized vectors and a forward vector |
| 1136 | typedef angle (*vm_DeltaAngVecNorm_fp)(vector *v0, vector *v1, vector *fvec); |
| 1137 | DMFCDLLOUT(vm_DeltaAngVecNorm_fp DLLvm_DeltaAngVecNorm;) |
| 1138 | |
| 1139 | // Computes the distance from a point to a plane. |
| 1140 | // Parms: checkp - the point to check |
| 1141 | // Parms: norm - the (normalized) surface normal of the plane |
| 1142 | // planep - a point on the plane |
| 1143 | // Returns: The signed distance from the plane; negative dist is on the back of the plane |
| 1144 | typedef float (*vm_DistToPlane_fp)(vector *checkp, vector *norm, vector *planep); |
| 1145 | DMFCDLLOUT(vm_DistToPlane_fp DLLvm_DistToPlane;) |
| 1146 | |
| 1147 | // returns the value of a determinant |
| 1148 | typedef float (*vm_CalcDetValue_fp)(matrix *det); |
| 1149 | DMFCDLLOUT(vm_CalcDetValue_fp DLLvm_CalcDetValue;) |
| 1150 | |
| 1151 | typedef void (*vm_MakeInverseMatrix_fp)(matrix *dest); |
| 1152 | DMFCDLLOUT(vm_MakeInverseMatrix_fp DLLvm_MakeInverseMatrix;) |
| 1153 | |
| 1154 | typedef void (*vm_SinCosToMatrix_fp)(matrix *m, float sinp, float cosp, float sinb, float cosb, float sinh, float cosh); |
| 1155 | DMFCDLLOUT(vm_SinCosToMatrix_fp DLLvm_SinCosToMatrix;) |
| 1156 | |
| 1157 | // Gets the real center of a polygon |
| 1158 | typedef float (*vm_GetCentroid_fp)(vector *centroid, vector *src, int nv); |
| 1159 | DMFCDLLOUT(vm_GetCentroid_fp DLLvm_GetCentroid;) |
| 1160 | |
| 1161 | // retrieves a random vector in values -RAND_MAX/2 to RAND_MAX/2 |
| 1162 | typedef void (*vm_MakeRandomVector_fp)(vector *vec); |
| 1163 | DMFCDLLOUT(vm_MakeRandomVector_fp DLLvm_MakeRandomVector;) |
| 1164 | |
| 1165 | // Given a set of points, computes the minimum bounding sphere of those points |
| 1166 | typedef float (*vm_ComputeBoundingSphere_fp)(vector *center, vector *vecs, int num_verts); |
| 1167 | DMFCDLLOUT(vm_ComputeBoundingSphere_fp DLLvm_ComputeBoundingSphere;) |
| 1168 | |
| 1169 | // Gets the real center of a polygon, but uses fast magnitude calculation |
| 1170 | // Returns the size of the passed in stuff |
| 1171 | typedef float (*vm_GetCentroidFast_fp)(vector *centroid, vector *src, int nv); |
| 1172 | DMFCDLLOUT(vm_GetCentroidFast_fp DLLvm_GetCentroidFast;) |
| 1173 | |
| 1174 | // returns scaled line width |
| 1175 | typedef int (*RenderHUDGetTextLineWidth_fp)(const char *string); |
| 1176 | DMFCDLLOUT(RenderHUDGetTextLineWidth_fp DLLRenderHUDGetTextLineWidth;) |
| 1177 | |
| 1178 | // returns scaled text height |
| 1179 | typedef int (*RenderHUDGetTextHeight_fp)(const char *string); |
| 1180 | DMFCDLLOUT(RenderHUDGetTextHeight_fp DLLRenderHUDGetTextHeight;) |
| 1181 | |
| 1182 | // typedef void (*StartFrame_fp)(int x, int y, int x2, int y2, bool clear=true); |
| 1183 | typedef void (*StartFrame_fp)(int x, int y, int x2, int y2, bool clear); |
| 1184 | DMFCDLLOUT(StartFrame_fp DLLStartFrame;) |
| 1185 | |
| 1186 | typedef void (*EndFrame_fp)(void); |
| 1187 | DMFCDLLOUT(EndFrame_fp DLLEndFrame;) |
| 1188 | |
| 1189 | typedef void (*ResetFacings_fp)(void); |
| 1190 | DMFCDLLOUT(ResetFacings_fp DLLResetFacings;) |
| 1191 | |
| 1192 | // Render the world into a game window |
| 1193 | // Parameters: viewer - if not null, this object disabled from rendering. Not used otherwise. |
| 1194 | // viewer_eye - where we're rendering from |
| 1195 | // viewer_roomnum - the roomnum viewer_eye is in |
| 1196 | // viewer_orient - the oriention for this view |
| 1197 | // zoom - the zoom for this view |
| 1198 | // rear_view - if true, we're looking out the rear of this object |
| 1199 | typedef void (*GameRenderWorld_fp)(object *viewer, vector *viewer_eye, int viewer_roomnum, matrix *viewer_orient, |
| 1200 | float zoom, bool rear_view); |
| 1201 | DMFCDLLOUT(GameRenderWorld_fp DLLGameRenderWorld;) |
| 1202 | |
| 1203 | // retrives the settings of the last call to StartFrame |
| 1204 | // returns false if it's not currently in between a StartFrame/EndFrame block |
| 1205 | typedef bool (*GetFrameParameters_fp)(int *x1, int *y1, int *x2, int *y2); |
| 1206 | DMFCDLLOUT(GetFrameParameters_fp DLLGetFrameParameters;) |
| 1207 | |
| 1208 | // Sets the state of zbuffering to on or off |
| 1209 | typedef void (*rend_SetZBufferState_fp)(int8_t state); |
| 1210 | DMFCDLLOUT(rend_SetZBufferState_fp DLLrend_SetZBufferState;) |
| 1211 | |
| 1212 | typedef void (*rend_SetLighting_fp)(light_state); |
| 1213 | DMFCDLLOUT(rend_SetLighting_fp DLLrend_SetLighting;) |
| 1214 | |
| 1215 | typedef void (*rend_SetColorModel_fp)(color_model); |
| 1216 | DMFCDLLOUT(rend_SetColorModel_fp DLLrend_SetColorModel;) |
| 1217 | |
| 1218 | typedef void (*rend_SetTextureType_fp)(texture_type); |
| 1219 | DMFCDLLOUT(rend_SetTextureType_fp DLLrend_SetTextureType;) |
| 1220 | |
| 1221 | // Given a handle to a bitmap and nv point vertices, draws a polygon |
| 1222 | // typedef void (*rend_DrawPolygon_fp)(int handle,g3Point **p,int nv,int map_type=MAP_TYPE_BITMAP); |
| 1223 | typedef void (*rend_DrawPolygon_fp)(int handle, g3Point **p, int nv, int map_type); |
| 1224 | DMFCDLLOUT(rend_DrawPolygon_fp DLLrend_DrawPolygon;) |
| 1225 | |
| 1226 | // Tells the software renderer whether or not to use mipping |
| 1227 | typedef void (*rend_SetMipState_fp)(int8_t); |
| 1228 | DMFCDLLOUT(rend_SetMipState_fp DLLrend_SetMipState;) |
| 1229 | |
| 1230 | // Sets the fog state to TRUE or FALSE |
| 1231 | typedef void (*rend_SetFogState_fp)(int8_t on); |
| 1232 | DMFCDLLOUT(rend_SetFogState_fp DLLrend_SetFogState;) |
| 1233 | |
| 1234 | // Sets the state of bilinear filtering for our textures |
| 1235 | typedef void (*rend_SetFiltering_fp)(int8_t state); |
| 1236 | DMFCDLLOUT(rend_SetFiltering_fp DLLrend_SetFiltering;) |
| 1237 | |
| 1238 | // Sets a bitmap as an overlay to rendered on top of the next texture map |
| 1239 | typedef void (*rend_SetOverlayMap_fp)(int handle); |
| 1240 | DMFCDLLOUT(rend_SetOverlayMap_fp DLLrend_SetOverlayMap;) |
| 1241 | |
| 1242 | // Sets the type of overlay operation |
| 1243 | typedef void (*rend_SetOverlayType_fp)(uint8_t type); |
| 1244 | DMFCDLLOUT(rend_SetOverlayType_fp DLLrend_SetOverlayType;) |
| 1245 | |
| 1246 | // Clears the display to a specified color |
| 1247 | typedef void (*rend_ClearScreen_fp)(ddgr_color color); |
| 1248 | DMFCDLLOUT(rend_ClearScreen_fp DLLrend_ClearScreen;) |
| 1249 | |
| 1250 | // Sets a pixel on the display |
| 1251 | typedef void (*rend_SetPixel_fp)(ddgr_color color, int x, int y); |
| 1252 | DMFCDLLOUT(rend_SetPixel_fp DLLrend_SetPixel;) |
| 1253 | |
| 1254 | // Gets a pixel on the display |
| 1255 | typedef ddgr_color (*rend_GetPixel_fp)(int x, int y); |
| 1256 | DMFCDLLOUT(rend_GetPixel_fp DLLrend_GetPixel;) |
| 1257 | |
| 1258 | // Draws spheres |
| 1259 | typedef void (*rend_FillCircle_fp)(ddgr_color col, int x, int y, int rad); |
| 1260 | DMFCDLLOUT(rend_FillCircle_fp DLLrend_FillCircle;) |
| 1261 | |
| 1262 | // draws circles |
| 1263 | typedef void (*rend_DrawCircle_fp)(int x, int y, int rad); |
| 1264 | DMFCDLLOUT(rend_DrawCircle_fp DLLrend_DrawCircle;) |
| 1265 | |
| 1266 | // sets the alpha type |
| 1267 | typedef void (*rend_SetAlphaType_fp)(int8_t); |
| 1268 | DMFCDLLOUT(rend_SetAlphaType_fp DLLrend_SetAlphaType;) |
| 1269 | |
| 1270 | // Sets the constant alpha value |
| 1271 | typedef void (*rend_SetAlphaValue_fp)(uint8_t val); |
| 1272 | DMFCDLLOUT(rend_SetAlphaValue_fp DLLrend_SetAlphaValue;) |
| 1273 | |
| 1274 | // Sets the wrap parameter |
| 1275 | typedef void (*rend_SetWrapType_fp)(wrap_type val); |
| 1276 | DMFCDLLOUT(rend_SetWrapType_fp DLLrend_SetWrapType;) |
| 1277 | |
| 1278 | // Adds a bias to each coordinates z value. This is useful for making 2d bitmaps |
| 1279 | // get drawn without being clipped by the zbuffer |
| 1280 | typedef void (*rend_SetZBias_fp)(float z_bias); |
| 1281 | DMFCDLLOUT(rend_SetZBias_fp DLLrend_SetZBias;) |
| 1282 | |
| 1283 | // Enables/disables writes the depth buffer |
| 1284 | typedef void (*rend_SetZBufferWriteMask_fp)(int state); |
| 1285 | DMFCDLLOUT(rend_SetZBufferWriteMask_fp DLLrend_SetZBufferWriteMask;) |
| 1286 | |
| 1287 | // Gets a pointer to a linear frame buffer |
| 1288 | typedef void (*rend_GetLFBLock_fp)(renderer_lfb *lfb); |
| 1289 | DMFCDLLOUT(rend_GetLFBLock_fp DLLrend_GetLFBLock;) |
| 1290 | |
| 1291 | // Releases an lfb lock |
| 1292 | typedef void (*rend_ReleaseLFBLock_fp)(renderer_lfb *lfb); |
| 1293 | DMFCDLLOUT(rend_ReleaseLFBLock_fp DLLrend_ReleaseLFBLock;) |
| 1294 | |
| 1295 | // Given a source x,y and width,height, draws any sized bitmap into the renderer lfb |
| 1296 | typedef void (*rend_DrawLFBBitmap_fp)(int sx, int sy, int w, int h, int dx, int dy, uint16_t *data, int rowsize); |
| 1297 | DMFCDLLOUT(rend_DrawLFBBitmap_fp DLLrend_DrawLFBBitmap;) |
| 1298 | |
| 1299 | // Draws a line using the states of the renderer |
| 1300 | typedef void (*rend_DrawSpecialLine_fp)(g3Point *p0, g3Point *p1); |
| 1301 | DMFCDLLOUT(rend_DrawSpecialLine_fp DLLrend_DrawSpecialLine;) |
| 1302 | |
| 1303 | // Find out if a vector intersects with anything. |
| 1304 | // Fills in hit_data, an fvi_info structure |
| 1305 | // Parms: |
| 1306 | // p0 & startseg describe the start of the vector |
| 1307 | // p1 the end of the vector |
| 1308 | // rad the radius of the cylinder |
| 1309 | // thisobjnum used to prevent an object with colliding with itself |
| 1310 | // ingore_obj_list NULL, or ptr to a list of objnums to ignore, terminated with -1 |
| 1311 | // check_obj_flag determines whether collisions with objects are checked |
| 1312 | // Returns the hit_data->hit_type |
| 1313 | // typedef int (*fvi_FindIntersection_fp)(fvi_query *fq,fvi_info *hit_data, bool no_subdivision = false); |
| 1314 | typedef int (*fvi_FindIntersection_fp)(fvi_query *fq, fvi_info *hit_data, bool no_subdivision); |
| 1315 | DMFCDLLOUT(fvi_FindIntersection_fp DLLfvi_FindIntersection;) |
| 1316 | |
| 1317 | // Generates a list of faces(with corresponding room numbers) within a given distance to a position. |
| 1318 | // Return value is the number of faces in the list |
| 1319 | typedef int (*fvi_QuickDistFaceList_fp)(int init_room_index, vector *pos, float rad, fvi_face_room_list *quick_fr_list, |
| 1320 | int max_elements); |
| 1321 | DMFCDLLOUT(fvi_QuickDistFaceList_fp DLLfvi_QuickDistFaceList;) |
| 1322 | |
| 1323 | // Returns the number of cells that are approximately within the specified radius |
| 1324 | typedef int (*fvi_QuickDistCellList_fp)(int init_cell_index, vector *pos, float rad, int *quick_cell_list, |
| 1325 | int max_elements); |
| 1326 | DMFCDLLOUT(fvi_QuickDistCellList_fp DLLfvi_QuickDistCellList;) |
| 1327 | |
| 1328 | // Returns the number of objects that are approximately within the specified radius |
| 1329 | // typedef int (*fvi_QuickDistObjectList_fp)(vector *pos, int init_roomnum, float rad, int16_t *object_index_list, int |
| 1330 | // max_elements, bool f_lightmap_only, bool f_only_players_and_ais = false, bool f_include_non_collide_objects = false, |
| 1331 | // bool f_stop_at_closed_doors = false); |
| 1332 | typedef int (*fvi_QuickDistObjectList_fp)(vector *pos, int init_roomnum, float rad, int16_t *object_index_list, |
| 1333 | int max_elements, bool f_lightmap_only, bool f_only_players_and_ais, |
| 1334 | bool f_include_non_collide_objects, bool f_stop_at_closed_doors); |
| 1335 | DMFCDLLOUT(fvi_QuickDistObjectList_fp DLLfvi_QuickDistObjectList;) |
| 1336 | |
| 1337 | // returns true if the given point is in the given room |
| 1338 | // typedef bool (*fvi_QuickRoomCheck_fp)(vector *pos, room *cur_room, bool try_again = false); |
| 1339 | typedef bool (*fvi_QuickRoomCheck_fp)(vector *pos, room *cur_room, bool try_again); |
| 1340 | DMFCDLLOUT(fvi_QuickRoomCheck_fp DLLfvi_QuickRoomCheck;) |
| 1341 | |
| 1342 | // returns true if audio taunts are enabled |
| 1343 | typedef bool (*taunt_AreEnabled_fp)(void); |
| 1344 | DMFCDLLOUT(taunt_AreEnabled_fp DLLtaunt_AreEnabled;) |
| 1345 | |
| 1346 | // Enables/Disables audio_taunts for the player |
| 1347 | typedef void (*taunt_Enable_fp)(bool enable); |
| 1348 | DMFCDLLOUT(taunt_Enable_fp DLLtaunt_Enable;) |
| 1349 | |
| 1350 | // Returns a ranking index based on the player rating |
| 1351 | // If rankbuf is non-null, fills in the string corresponding to that rank |
| 1352 | // Returns -1 if not a pxo game (ie no rankings in this game) |
| 1353 | // typedef int (*GetPlayerRankIndex_fp) (int pnum,char *rankbuf=NULL); |
| 1354 | typedef int (*GetPlayerRankIndex_fp)(int pnum, char *rankbuf); |
| 1355 | DMFCDLLOUT(GetPlayerRankIndex_fp GetPlayerRankIndex;) |
| 1356 | |
| 1357 | // Returns the next free viseffect |
| 1358 | typedef int (*VisEffectAllocate_fp)(void); |
| 1359 | DMFCDLLOUT(VisEffectAllocate_fp DLLVisEffectAllocate;) |
| 1360 | |
| 1361 | // Frees up a viseffect for use |
| 1362 | typedef int (*VisEffectFree_fp)(int visnum); |
| 1363 | DMFCDLLOUT(VisEffectFree_fp DLLVisEffectFree;) |
| 1364 | |
| 1365 | typedef int (*VisEffectInitType_fp)(vis_effect *vis); |
| 1366 | DMFCDLLOUT(VisEffectInitType_fp DLLVisEffectInitType;) |
| 1367 | |
| 1368 | // initialize a new viseffect. adds to the list for the given room |
| 1369 | // returns the object number |
| 1370 | typedef int (*VisEffectCreate_fp)(uint8_t type, uint8_t id, int roomnum, vector *pos); |
| 1371 | DMFCDLLOUT(VisEffectCreate_fp DLLVisEffectCreate;) |
| 1372 | |
| 1373 | // link the viseffect into the list for its room |
| 1374 | // Does nothing for effects over terrain |
| 1375 | typedef void (*VisEffectLink_fp)(int visnum, int roomnum); |
| 1376 | DMFCDLLOUT(VisEffectLink_fp DLLVisEffectLink;) |
| 1377 | |
| 1378 | // Unlinks a viseffect from a room |
| 1379 | // Does nothing for terrain |
| 1380 | typedef void (*VisEffectUnlink_fp)(int visnum); |
| 1381 | DMFCDLLOUT(VisEffectUnlink_fp DLLVisEffectUnlink;) |
| 1382 | |
| 1383 | // when an effect has moved into a new room, this function unlinks it |
| 1384 | // from its old room and links it into the new room |
| 1385 | typedef void (*VisEffectRelink_fp)(int visnum, int newroomnum); |
| 1386 | DMFCDLLOUT(VisEffectRelink_fp DLLVisEffectRelink;) |
| 1387 | |
| 1388 | // remove viseffect from the world |
| 1389 | typedef void (*VisEffectDelete_fp)(int visnum); |
| 1390 | DMFCDLLOUT(VisEffectDelete_fp DLLVisEffectDelete;) |
| 1391 | |
| 1392 | // Creates a some sparks that go in random directions |
| 1393 | // typedef void (*CreateRandomSparks_fp) (int num_sparks,vector *pos,int roomnum,int which_index=-1,float |
| 1394 | // force_scalar=1); |
| 1395 | typedef void (*CreateRandomSparks_fp)(int num_sparks, vector *pos, int roomnum, int which_index, float force_scalar); |
| 1396 | DMFCDLLOUT(CreateRandomSparks_fp DLLCreateRandomSparks;) |
| 1397 | |
| 1398 | // Creates a some line sparks that go in random directions |
| 1399 | // typedef void (*CreateRandomLineSparks_fp) (int num_sparks,vector *pos,int roomnum,uint16_t color=0,float |
| 1400 | // force_scalar=1); |
| 1401 | typedef void (*CreateRandomLineSparks_fp)(int num_sparks, vector *pos, int roomnum, uint16_t color, float force_scalar); |
| 1402 | DMFCDLLOUT(CreateRandomLineSparks_fp DLLCreateRandomLineSparks;) |
| 1403 | |
| 1404 | // Creates vis effects but has the caller set their parameters |
| 1405 | // initialize a new viseffect. adds to the list for the given room |
| 1406 | // returns the vis number |
| 1407 | // typedef int (*VisEffectCreateControlled_fp)(uint8_t type,object *parent,uint8_t id,int roomnum,vector *pos,float |
| 1408 | // lifetime,vector *velocity,int phys_flags=0,float size=0,float mass=0.0f,float drag=0.0f,bool isreal=0); |
| 1409 | typedef int (*VisEffectCreateControlled_fp)(uint8_t type, object *parent, uint8_t id, int roomnum, vector *pos, |
| 1410 | float lifetime, vector *velocity, int phys_flags, float size, float mass, |
| 1411 | float drag, bool isreal); |
| 1412 | DMFCDLLOUT(VisEffectCreateControlled_fp DLLVisEffectCreateControlled;) |
| 1413 | |
| 1414 | // Creates a some particles that go in random directions |
| 1415 | typedef void (*CreateRandomParticles_fp)(int num_sparks, vector *pos, int roomnum, int bm_handle, float size, |
| 1416 | float life); |
| 1417 | DMFCDLLOUT(CreateRandomParticles_fp DLLCreateRandomParticles;) |
| 1418 | |
| 1419 | // Attaches viseffects that move with an object |
| 1420 | typedef void (*AttachRandomNapalmEffectsToObject_fp)(object *obj); |
| 1421 | DMFCDLLOUT(AttachRandomNapalmEffectsToObject_fp DLLAttachRandomNapalmEffectsToObject;) |
| 1422 | |
| 1423 | // allocates and initializes the scripts for an object. |
| 1424 | // robots, powerups, doors, etc. |
| 1425 | typedef void (*InitObjectScripts_fp)(object *objp, bool do_evt_created); |
| 1426 | DMFCDLLOUT(InitObjectScripts_fp DLLInitObjectScripts;) |
| 1427 | |
| 1428 | // Frame setup functions: |
| 1429 | |
| 1430 | // start the frame, specifying view position, matrix, & zoom |
| 1431 | typedef void (*g3_StartFrame_fp)(vector *view_pos, matrix *view_matrix, float zoom); |
| 1432 | DMFCDLLOUT(g3_StartFrame_fp DLLg3_StartFrame;) |
| 1433 | |
| 1434 | // end the frame |
| 1435 | typedef void (*g3_EndFrame_fp)(void); |
| 1436 | DMFCDLLOUT(g3_EndFrame_fp DLLg3_EndFrame;) |
| 1437 | |
| 1438 | // get the current view position |
| 1439 | typedef void (*g3_GetViewPosition_fp)(vector *vp); |
| 1440 | DMFCDLLOUT(g3_GetViewPosition_fp DLLg3_GetViewPosition;) |
| 1441 | |
| 1442 | // returns the current view matrix |
| 1443 | typedef void (*g3_GetViewMatrix_fp)(matrix *mat); |
| 1444 | DMFCDLLOUT(g3_GetViewMatrix_fp DLLg3_GetViewMatrix;) |
| 1445 | |
| 1446 | // returns the current unscaled view matrix |
| 1447 | typedef void (*g3_GetUnscaledMatrix_fp)(matrix *mat); |
| 1448 | DMFCDLLOUT(g3_GetUnscaledMatrix_fp DLLg3_GetUnscaledMatrix;) |
| 1449 | |
| 1450 | // Instancing |
| 1451 | |
| 1452 | // instance at specified point with specified orientation |
| 1453 | typedef void (*g3_StartInstanceMatrix_fp)(vector *pos, matrix *orient); |
| 1454 | DMFCDLLOUT(g3_StartInstanceMatrix_fp DLLg3_StartInstanceMatrix;) |
| 1455 | |
| 1456 | // instance at specified point with specified orientation |
| 1457 | typedef void (*g3_StartInstanceAngles_fp)(vector *pos, angvec *angles); |
| 1458 | DMFCDLLOUT(g3_StartInstanceAngles_fp DLLg3_StartInstanceAngles;) |
| 1459 | |
| 1460 | // pops the old context |
| 1461 | typedef void (*g3_DoneInstance_fp)(); |
| 1462 | DMFCDLLOUT(g3_DoneInstance_fp DLLg3_DoneInstance;) |
| 1463 | |
| 1464 | // Misc utility functions: |
| 1465 | |
| 1466 | // returns true if a plane is facing the viewer. takes the unrotated surface |
| 1467 | // normal of the plane, and a point on it. The normal need not be normalized |
| 1468 | typedef bool (*g3_CheckNormalFacing_fp)(vector *v, vector *norm); |
| 1469 | DMFCDLLOUT(g3_CheckNormalFacing_fp DLLg3_CheckNormalFacing;) |
| 1470 | |
| 1471 | // Point definition and rotation functions: |
| 1472 | |
| 1473 | // rotates a point. returns codes. does not check if already rotated |
| 1474 | typedef uint8_t (*g3_RotatePoint_fp)(g3Point *dest, vector *src); |
| 1475 | DMFCDLLOUT(g3_RotatePoint_fp DLLg3_RotatePoint;) |
| 1476 | |
| 1477 | // projects a point |
| 1478 | typedef void (*g3_ProjectPoint_fp)(g3Point *point); |
| 1479 | DMFCDLLOUT(g3_ProjectPoint_fp DLLg3_ProjectPoint;) |
| 1480 | |
| 1481 | // calculate the depth of a point - returns the z coord of the rotated point |
| 1482 | typedef float (*g3_CalcPointDepth_fp)(vector *pnt); |
| 1483 | DMFCDLLOUT(g3_CalcPointDepth_fp DLLg3_CalcPointDepth;) |
| 1484 | |
| 1485 | // from a 2d point, compute the vector through that point |
| 1486 | typedef void (*g3_Point2Vec_fp)(vector *v, int16_t sx, int16_t sy); |
| 1487 | DMFCDLLOUT(g3_Point2Vec_fp DLLg3_Point2Vec;) |
| 1488 | |
| 1489 | // code a point. fills in the p3_codes field of the point, and returns the codes |
| 1490 | typedef uint8_t (*g3_CodePoint_fp)(g3Point *point); |
| 1491 | DMFCDLLOUT(g3_CodePoint_fp DLLg3_CodePoint;) |
| 1492 | |
| 1493 | // delta rotation functions |
| 1494 | typedef vector *(*g3_RotateDeltaX_fp)(vector *dest, float dx); |
| 1495 | DMFCDLLOUT(g3_RotateDeltaX_fp DLLg3_RotateDeltaX;) |
| 1496 | typedef vector *(*g3_RotateDeltaY_fp)(vector *dest, float dy); |
| 1497 | DMFCDLLOUT(g3_RotateDeltaY_fp DLLg3_RotateDeltaY;) |
| 1498 | typedef vector *(*g3_RotateDeltaZ_fp)(vector *dest, float dz); |
| 1499 | DMFCDLLOUT(g3_RotateDeltaZ_fp DLLg3_RotateDeltaZ;) |
| 1500 | typedef vector *(*g3_RotateDeltaVec_fp)(vector *dest, vector *src); |
| 1501 | DMFCDLLOUT(g3_RotateDeltaVec_fp DLLg3_RotateDeltaVec;) |
| 1502 | typedef uint8_t (*g3_AddDeltaVec_fp)(g3Point *dest, g3Point *src, vector *deltav); |
| 1503 | DMFCDLLOUT(g3_AddDeltaVec_fp DLLg3_AddDeltaVec;) |
| 1504 | |
| 1505 | // Drawing functions: |
| 1506 | // draw a polygon |
| 1507 | // Parameters: nv - the number of verts in the poly |
| 1508 | // pointlist - a pointer to a list of pointers to points |
| 1509 | // bm - the bitmap handle if texturing. ignored if flat shading |
| 1510 | // typedef int (*g3_DrawPoly_fp)(int nv,g3Point **pointlist,int bm,int map_type=0,g3Codes *clip_codes=NULL); |
| 1511 | typedef int (*g3_DrawPoly_fp)(int nv, g3Point **pointlist, int bm, int map_type, g3Codes *clip_codes); |
| 1512 | DMFCDLLOUT(g3_DrawPoly_fp DLLg3_DrawPoly;) |
| 1513 | |
| 1514 | // draw a sortof sphere - i.e., the 2d radius is proportional to the 3d |
| 1515 | // radius, but not to the distance from the eye |
| 1516 | typedef void (*g3_DrawSphere_fp)(ddgr_color color, g3Point *pnt, float rad); |
| 1517 | DMFCDLLOUT(g3_DrawSphere_fp DLLg3_DrawSphere;) |
| 1518 | |
| 1519 | // like g3_DrawPoly(), but checks to see if facing. If surface normal is |
| 1520 | // NULL, this routine must compute it, which will be slow. It is better to |
| 1521 | // pre-compute the normal, and pass it to this function. When the normal |
| 1522 | // is passed, this function works like g3_CheckNormalFacing() plus |
| 1523 | // g3_DrawPoly(). |
| 1524 | typedef void (*g3_CheckAndDrawPoly_fp)(int nv, g3Point **pointlist, int bm, vector *norm, vector *pnt); |
| 1525 | DMFCDLLOUT(g3_CheckAndDrawPoly_fp DLLg3_CheckAndDrawPoly;) |
| 1526 | |
| 1527 | // draws a line. takes two points. |
| 1528 | typedef void (*g3_DrawLine_fp)(ddgr_color color, g3Point *p0, g3Point *p1); |
| 1529 | DMFCDLLOUT(g3_DrawLine_fp DLLg3_DrawLine;) |
| 1530 | |
| 1531 | // draws a bitmap with the specified 3d width & height |
| 1532 | // returns 1 if off screen, 0 if drew |
| 1533 | // typedef void (*g3_DrawBitmap_fp)(vector *pos,float width,float height,int bm,int color=-1); |
| 1534 | typedef void (*g3_DrawBitmap_fp)(vector *pos, float width, float height, int bm, int color); |
| 1535 | DMFCDLLOUT(g3_DrawBitmap_fp DLLg3_DrawBitmap;) |
| 1536 | |
| 1537 | // Draws a bitmap that has been rotated about its center. Angle of rotation is passed as 'rot_angle' |
| 1538 | // typedef void (*g3_DrawRotatedBitmap_fp)(vector *pos,angle rot_angle,float width,float height,int bm,int color=-1); |
| 1539 | typedef void (*g3_DrawRotatedBitmap_fp)(vector *pos, angle rot_angle, float width, float height, int bm, int color); |
| 1540 | DMFCDLLOUT(g3_DrawRotatedBitmap_fp DLLg3_DrawRotatedBitmap;) |
| 1541 | |
| 1542 | // Draw a wireframe box aligned with the screen. Used for the editor. |
| 1543 | // Parameters: color - the color to draw the lines |
| 1544 | // pnt - the center point |
| 1545 | // rad - specifies the width/2 & height/2 of the box |
| 1546 | typedef void (*g3_DrawBox_fp)(ddgr_color color, g3Point *pnt, float rad); |
| 1547 | DMFCDLLOUT(g3_DrawBox_fp DLLg3_DrawBox;) |
| 1548 | |
| 1549 | // Sets up a custom clipping plane - g3_StartFrame must be called before this is called |
| 1550 | typedef void (*g3_SetCustomClipPlane_fp)(uint8_t state, vector *pnt, vector *normal); |
| 1551 | DMFCDLLOUT(g3_SetCustomClipPlane_fp DLLg3_SetCustomClipPlane;) |
| 1552 | |
| 1553 | // sets the z distance of the far clipping plane |
| 1554 | typedef void (*g3_SetFarClipZ_fp)(float z); |
| 1555 | DMFCDLLOUT(g3_SetFarClipZ_fp DLLg3_SetFarClipZ;) |
| 1556 | |
| 1557 | // Clips a polygon |
| 1558 | // Parameters: pointlist - pointer to a list of pointers to points |
| 1559 | // nv - the number of points in the polygon |
| 1560 | // cc - the clip codes for this polygon |
| 1561 | // Returns: a pointer to a list of pointer of points in the clipped polygon |
| 1562 | // NOTE: You MUST call g3_FreeTempPoints() when you're done with the clipped polygon |
| 1563 | typedef g3Point **(*g3_ClipPolygon_fp)(g3Point **pointlist, int *nv, g3Codes *cc); |
| 1564 | DMFCDLLOUT(g3_ClipPolygon_fp DLLg3_ClipPolygon;) |
| 1565 | |
| 1566 | // Free up any temp points (created by the clipper) in the given pointlist |
| 1567 | // Parameters: pointlist - pointer to list of pointers to points, returned by g3_ClipPolygon() |
| 1568 | // nv - the number of points in pointlist |
| 1569 | typedef void (*g3_FreeTempPoints_fp)(g3Point **pointlist, int nv); |
| 1570 | DMFCDLLOUT(g3_FreeTempPoints_fp DLLg3_FreeTempPoints;) |
| 1571 | |
| 1572 | // Gets the matrix scale vector |
| 1573 | typedef void (*g3_GetMatrixScale_fp)(vector *matrix_scale); |
| 1574 | DMFCDLLOUT(g3_GetMatrixScale_fp DLLg3_GetMatrixScale;) |
| 1575 | |
| 1576 | // Sets the triangulation test to on or off |
| 1577 | typedef void (*g3_SetTriangulationTest_fp)(int state); |
| 1578 | DMFCDLLOUT(g3_SetTriangulationTest_fp DLLg3_SetTriangulationTest;) |
| 1579 | |
| 1580 | // draws a line based on the current setting of render states. takes two points. returns true if drew |
| 1581 | typedef void (*g3_DrawSpecialLine_fp)(g3Point *p0, g3Point *p1); |
| 1582 | DMFCDLLOUT(g3_DrawSpecialLine_fp DLLg3_DrawSpecialLine;) |
| 1583 | |
| 1584 | // Draws a bitmap on a specific plane. Also does rotation. Angle of rotation is passed as 'rot_angle' |
| 1585 | typedef void (*g3_DrawPlanarRotatedBitmap_fp)(vector *pos, vector *norm, angle rot_angle, float width, float height, |
| 1586 | int bm); |
| 1587 | DMFCDLLOUT(g3_DrawPlanarRotatedBitmap_fp DLLg3_DrawPlanarRotatedBitmap;) |
| 1588 | |
| 1589 | // Stops all sounds for a player |
| 1590 | typedef void (*PlayerStopSounds_fp)(int slot); |
| 1591 | DMFCDLLOUT(PlayerStopSounds_fp DLLPlayerStopSounds;) |
| 1592 | |
| 1593 | // Returns index of argument sought, or 0 if not found |
| 1594 | typedef int (*FindArg_fp)(const char *which); |
| 1595 | DMFCDLLOUT(FindArg_fp DLLFindArg;) |
| 1596 | |
| 1597 | // Given an object and a weapon, fires a shot from that object |
| 1598 | typedef int (*FireWeaponFromObject_fp)(object *obj, int weapon_num, int gun_num, bool f_force_forward, |
| 1599 | bool f_force_target); |
| 1600 | DMFCDLLOUT(FireWeaponFromObject_fp DLLFireWeaponFromObject;) |
| 1601 | |
| 1602 | // Creates an weapon and sends it speeding on its way |
| 1603 | typedef int (*CreateAndFireWeapon_fp)(vector *pos, vector *dir, object *parent, int weapon_num); |
| 1604 | DMFCDLLOUT(CreateAndFireWeapon_fp DLLCreateAndFireWeapon;) |
| 1605 | |
| 1606 | // Selects the next camera view in the small windows |
| 1607 | typedef void (*SelectNextCameraView_fp)(int window); |
| 1608 | DMFCDLLOUT(SelectNextCameraView_fp DLLSelectNextCameraView;) |
| 1609 | |
| 1610 | // adds a type/id item to the inventory (returns true on success) |
| 1611 | // typedef bool (*dInven_Add_fp)(Inventory *inven,int type,int id,object *parent=NULL,int aux_type=-1,int aux_id=-1,int |
| 1612 | // flags=0,char *description=NULL); |
| 1613 | typedef bool (*dInven_Add_fp)(Inventory *inven, int type, int id, object *parent, int aux_type, int aux_id, int flags, |
| 1614 | char *description); |
| 1615 | DMFCDLLOUT(dInven_Add_fp Inven_Add;) |
| 1616 | |
| 1617 | // adds an object to the inventory (marked by it's objhandle) |
| 1618 | // typedef bool (*dInven_AddObject_fp)(Inventory *inven,int object_handle,int flags=0,char *description=NULL); |
| 1619 | typedef bool (*dInven_AddObject_fp)(Inventory *inven, int object_handle, int flags, char *description); |
| 1620 | DMFCDLLOUT(dInven_AddObject_fp Inven_AddObject;) |
| 1621 | |
| 1622 | // adds a special cased CounterMeasure into the inventory |
| 1623 | // typedef bool (*dInven_AddCounterMeasure_fp)(Inventory *inven,int id,int aux_type=-1,int aux_id=-1,int flags=0,char |
| 1624 | // *description=NULL); |
| 1625 | typedef bool (*dInven_AddCounterMeasure_fp)(Inventory *inven, int id, int aux_type, int aux_id, int flags, |
| 1626 | char *description); |
| 1627 | DMFCDLLOUT(dInven_AddCounterMeasure_fp Inven_AddCounterMeasure;) |
| 1628 | |
| 1629 | // removes an item from the inventory (reduces it's count by one...if there is no more, then it goes bye-bye) |
| 1630 | // to remove an object that was added via objhandle, then pass the objhandle |
| 1631 | // in the 'type' parameter, and don't pass in an id. |
| 1632 | // typedef bool (*dInven_Remove_fp)(Inventory *inven,int type,int id=-1); |
| 1633 | typedef bool (*dInven_Remove_fp)(Inventory *inven, int type, int id); |
| 1634 | DMFCDLLOUT(dInven_Remove_fp Inven_Remove;) |
| 1635 | |
| 1636 | // uses an item in the inventory (also reduces its count by one...if there is no more, then it goes bye-bye) |
| 1637 | // typedef bool (*dInven_Use_fp)(Inventory *inven,int type,int id,object *parent=NULL); |
| 1638 | typedef bool (*dInven_Use_fp)(Inventory *inven, int type, int id, object *parent); |
| 1639 | DMFCDLLOUT(dInven_Use_fp Inven_Use;) |
| 1640 | |
| 1641 | // uses an item in the inventory (given it's objhandle). |
| 1642 | // typedef bool (*dInven_UseObjHandle_fp)(Inventory *inven,int objhandle,object *parent=NULL); |
| 1643 | typedef bool (*dInven_UseObjHandle_fp)(Inventory *inven, int objhandle, object *parent); |
| 1644 | DMFCDLLOUT(dInven_UseObjHandle_fp Inven_UseObjHandle;) |
| 1645 | |
| 1646 | // returns how many unique type/ids are in the inventory |
| 1647 | typedef int (*dInven_Size_fp)(Inventory *inven); |
| 1648 | DMFCDLLOUT(dInven_Size_fp Inven_Size;) |
| 1649 | |
| 1650 | // returns true if there is an item in the inventory with the given type/id (or objhandle if id is -1, pass the object |
| 1651 | // handle as the type parameter) typedef bool (*dInven_CheckItem_fp)(Inventory *inven,int type,int id=-1); |
| 1652 | typedef bool (*dInven_CheckItem_fp)(Inventory *inven, int type, int id); |
| 1653 | DMFCDLLOUT(dInven_CheckItem_fp Inven_CheckItem;) |
| 1654 | |
| 1655 | // Resets the inventory, cleaning it out |
| 1656 | // in_game: set to true if this is being called from during gameplay |
| 1657 | // reset_stage: |
| 1658 | // INVRESET_ALL: Reset _EVERYTHING_ |
| 1659 | // INVRESET_LEVELCHANGE: Remove everything except those that last across levels |
| 1660 | // INVRESET_DEATHSPEW: Remove everything except those that do not spew (Default) |
| 1661 | // typedef void (*dInven_Reset_fp)(Inventory *inven,bool in_game,int reset_stage=INVRESET_DEATHSPEW); |
| 1662 | typedef void (*dInven_Reset_fp)(Inventory *inven, bool in_game, int reset_stage); |
| 1663 | DMFCDLLOUT(dInven_Reset_fp Inven_Reset;) |
| 1664 | |
| 1665 | // resets the position pointer in the list to the beginning |
| 1666 | typedef void (*dInven_ResetPos_fp)(Inventory *inven); |
| 1667 | DMFCDLLOUT(dInven_ResetPos_fp Inven_ResetPos;) |
| 1668 | |
| 1669 | // moves the position pointer to the next inventory item |
| 1670 | // skip : if true then skip over non-selectable items |
| 1671 | // typedef void (*dInven_NextPos_fp)(Inventory *inven,bool skip=false); |
| 1672 | typedef void (*dInven_NextPos_fp)(Inventory *inven, bool skip); |
| 1673 | DMFCDLLOUT(dInven_NextPos_fp Inven_NextPos;) |
| 1674 | |
| 1675 | // moves the position pointer to the previous inventory item |
| 1676 | // skip : if true then skip over non-selectable items |
| 1677 | // typedef void (*dInven_PrevPos_fp)(Inventory *inven,bool skip=false); |
| 1678 | typedef void (*dInven_PrevPos_fp)(Inventory *inven, bool skip); |
| 1679 | DMFCDLLOUT(dInven_PrevPos_fp Inven_PrevPos;) |
| 1680 | |
| 1681 | // returns the type/id of the item at the current position |
| 1682 | // return true if it is a real object (meaning it was placed in the inventory |
| 1683 | // via an object handle...so id will be -1) |
| 1684 | typedef bool (*dInven_GetPosTypeID_fp)(Inventory *inven, int &type, int &id); |
| 1685 | DMFCDLLOUT(dInven_GetPosTypeID_fp Inven_GetPosTypeID;) |
| 1686 | |
| 1687 | // returns the aux type/id of the item |
| 1688 | // return true if it is a real object (meaning it was placed in the inventory |
| 1689 | // via an object handle...so id will be -1) |
| 1690 | typedef bool (*dInven_GetAuxPosTypeID_fp)(Inventory *inven, int &type, int &id); |
| 1691 | DMFCDLLOUT(dInven_GetAuxPosTypeID_fp Inven_GetAuxPosTypeID;) |
| 1692 | |
| 1693 | // returns the description of the item at the current position |
| 1694 | typedef char *(*dInven_GetPosDescription_fp)(Inventory *inven); |
| 1695 | DMFCDLLOUT(dInven_GetPosDescription_fp Inven_GetPosDescription;) |
| 1696 | |
| 1697 | // returns the icon name of the item at the current position |
| 1698 | typedef char *(*dInven_GetPosIconName_fp)(Inventory *inven); |
| 1699 | DMFCDLLOUT(dInven_GetPosIconName_fp Inven_GetPosIconName;) |
| 1700 | |
| 1701 | // returns the name of the item at the current position |
| 1702 | typedef char *(*dInven_GetPosName_fp)(Inventory *inven); |
| 1703 | DMFCDLLOUT(dInven_GetPosName_fp Inven_GetPosName;) |
| 1704 | |
| 1705 | // return information about the current position item |
| 1706 | // return true if it is a real object |
| 1707 | typedef bool (*dInven_GetPosInfo_fp)(Inventory *inven, uint16_t &iflags, int &flags); |
| 1708 | DMFCDLLOUT(dInven_GetPosInfo_fp Inven_GetPosInfo;) |
| 1709 | |
| 1710 | // returns the count of the item at the current position |
| 1711 | typedef int (*dInven_GetPosCount_fp)(Inventory *inven); |
| 1712 | DMFCDLLOUT(dInven_GetPosCount_fp Inven_GetPosCount;) |
| 1713 | |
| 1714 | // returns true if the position pointer is at the begining of the inventory list |
| 1715 | typedef bool (*dInven_AtBeginning_fp)(Inventory *inven); |
| 1716 | DMFCDLLOUT(dInven_AtBeginning_fp Inven_AtBeginning;) |
| 1717 | |
| 1718 | // returns false if the position pointer is at the end of the inventory list |
| 1719 | typedef bool (*dInven_AtEnd_fp)(Inventory *inven); |
| 1720 | DMFCDLLOUT(dInven_AtEnd_fp Inven_AtEnd;) |
| 1721 | |
| 1722 | // jump right to an item in the inventory |
| 1723 | typedef void (*dInven_GotoPos_fp)(Inventory *inven, int newpos); |
| 1724 | DMFCDLLOUT(dInven_GotoPos_fp Inven_GotoPos;) |
| 1725 | |
| 1726 | // jump right to an item in the inventory give it's type and id |
| 1727 | // to jump to an item that was added via object handle, pass the object |
| 1728 | // handle in as the type, and make id -1. |
| 1729 | typedef void (*dInven_GotoPosTypeID_fp)(Inventory *inven, int type, int id); |
| 1730 | DMFCDLLOUT(dInven_GotoPosTypeID_fp Inven_GotoPosTypeID;) |
| 1731 | |
| 1732 | // uses the currently selected item |
| 1733 | // typedef bool (*dInven_UsePos_fp)(Inventory *inven,object *parent=NULL); |
| 1734 | typedef bool (*dInven_UsePos_fp)(Inventory *inven, object *parent); |
| 1735 | DMFCDLLOUT(dInven_UsePos_fp Inven_UsePos;) |
| 1736 | |
| 1737 | // returns the 'index' position of the current position |
| 1738 | typedef int (*dInven_GetPos_fp)(Inventory *inven); |
| 1739 | DMFCDLLOUT(dInven_GetPos_fp Inven_GetPos;) |
| 1740 | |
| 1741 | // checks the pos, if its on a nonselectable item it will move to the next selectable (NULL if none) |
| 1742 | // typedef void (*dInven_ValidatePos_fp)(Inventory *inven,bool forward=true); |
| 1743 | typedef void (*dInven_ValidatePos_fp)(Inventory *inven, bool forward); |
| 1744 | DMFCDLLOUT(dInven_ValidatePos_fp Inven_ValidatePos;) |
| 1745 | |
| 1746 | // returns whether an item is selectable |
| 1747 | typedef bool (*dInven_IsSelectable_fp)(Inventory *inven); |
| 1748 | DMFCDLLOUT(dInven_IsSelectable_fp Inven_IsSelectable;) |
| 1749 | |
| 1750 | typedef bool (*dInven_IsUsable_fp)(Inventory *inven); |
| 1751 | DMFCDLLOUT(dInven_IsUsable_fp Inven_IsUsable;) |
| 1752 | |
| 1753 | // returns how many of an type/id is in the inventory |
| 1754 | // for object handle items, pass the object handle in as the type and leave |
| 1755 | // id as -1 |
| 1756 | typedef int (*dInven_GetTypeIDCount_fp)(Inventory *inven, int type, int id); |
| 1757 | DMFCDLLOUT(dInven_GetTypeIDCount_fp Inven_GetTypeIDCount;) |
| 1758 | |
| 1759 | // searches the inventory for the specified type/id, sets the pos to it |
| 1760 | // for object handle items, pass the object handle in as the type and leave |
| 1761 | // id as -1 |
| 1762 | // typedef bool (*dInven_FindPos_fp)(Inventory *inven,int type,int id=-1); |
| 1763 | typedef bool (*dInven_FindPos_fp)(Inventory *inven, int type, int id); |
| 1764 | DMFCDLLOUT(dInven_FindPos_fp Inven_FindPos;) |
| 1765 | |
| 1766 | // gets a detailed list of information about what is in the inventory |
| 1767 | // returns the number of items filled in. |
| 1768 | typedef int (*dInven_GetInventoryItemList_fp)(Inventory *inven, tInvenList *list, int max_amount, int *cur_sel); |
| 1769 | DMFCDLLOUT(dInven_GetInventoryItemList_fp Inven_GetInventoryItemList;) |
| 1770 | |
| 1771 | #endif |