| 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 GAME2DLL_H |
| 20 | #define GAME2DLL_Hcxx . . $ `lib/game2dll.h:20:9`! |
| 21 | |
| 22 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 23 | #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/ |
| 24 | |
| 25 | #include "d3events.h"cxx . . $ `<file>/lib/d3events.h`/ |
| 26 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ |
| 27 | |
| 28 | struct tPreJoinDatacxx . . $ tPreJoinData# { |
| 29 | bool is_bannedcxx . . $ tPreJoinData#is_banned.; |
| 30 | int teamcxx . . $ tPreJoinData#team.; |
| 31 | }; |
| 32 | |
| 33 | struct game_collide_infocxx . . $ game_collide_info# { |
| 34 | vectorcxx . . $ vector# pointcxx . . $ game_collide_info#point., normalcxx . . $ game_collide_info#normal.; |
| 35 | float hitspeedcxx . . $ game_collide_info#hitspeed., hit_dotcxx . . $ game_collide_info#hit_dot.; |
| 36 | int hitsegcxx . . $ game_collide_info#hitseg., hitwallcxx . . $ game_collide_info#hitwall.; |
| 37 | }; |
| 38 | |
| 39 | struct dllinfocxx . . $ dllinfo# { |
| 40 | int me_handlecxx . . $ dllinfo#me_handle.; |
| 41 | int it_handlecxx . . $ dllinfo#it_handle.; |
| 42 | uint8_tcxx . . $ uint8_t# *special_datacxx . . $ dllinfo#special_data.; |
| 43 | char *input_stringcxx . . $ dllinfo#input_string.; |
| 44 | int input_keycxx . . $ dllinfo#input_key.; |
| 45 | unioncxx . . $ dllinfo#$anonymous_type_0# { |
| 46 | int iRetcxx . . $ dllinfo#$anonymous_type_0#iRet.; |
| 47 | float fRetcxx . . $ dllinfo#$anonymous_type_0#fRet.; |
| 48 | }; |
| 49 | float fParamcxx . . $ dllinfo#fParam.; |
| 50 | ptrdiff_t iParamcxx . . $ dllinfo#iParam.; |
| 51 | game_collide_infocxx . . $ game_collide_info# collide_infocxx . . $ dllinfo#collide_info.; |
| 52 | int newsegcxx . . $ dllinfo#newseg., oldsegcxx . . $ dllinfo#oldseg.; |
| 53 | }; |
| 54 | |
| 55 | #define MAX_GAMENAME_LENcxx . . $ `lib/game2dll.h:55:9`! 32 |
| 56 | #define MAX_REQUIREMENT_LENcxx . . $ `lib/game2dll.h:56:9`! 384 |
| 57 | #define DOF_MAXTEAMScxx . . $ `lib/game2dll.h:57:9`! 0x0001 // max_teams member is valid |
| 58 | #define DOF_MINTEAMScxx . . $ `lib/game2dll.h:58:9`! 0x0002 |
| 59 | // this struct is used to return game specific information to Descent 3 |
| 60 | struct tDLLOptionscxx . . $ tDLLOptions# { |
| 61 | // general flags, also specifies what members of the structure are valid |
| 62 | int flagscxx . . $ tDLLOptions#flags.; |
| 63 | |
| 64 | // 0 or 1 for non-team games...maximum value is 4. If not specified, than it is assumed 0 |
| 65 | int max_teamscxx . . $ tDLLOptions#max_teams.; |
| 66 | // must be less then or equal to max_teams. If not specified, then it is assumed 0 for |
| 67 | // non-team games, 2 for team games. (max_teams will always tell you if it's a team game) |
| 68 | int min_teamscxx . . $ tDLLOptions#min_teams.; |
| 69 | |
| 70 | // gives the full name of the game (must be set) |
| 71 | char game_namecxx . . $ tDLLOptions#game_name.[MAX_GAMENAME_LENcxx . . $ `lib/game2dll.h:55:9`!]; |
| 72 | |
| 73 | // this is an array of semicolor seperated 'string identifiers' that serve as requirements |
| 74 | // the mission needs to support in order for it to be playable with the game. |
| 75 | // this parameter must be set (even it is just a '\0' for the first character..aka no requirements) |
| 76 | char requirementscxx . . $ tDLLOptions#requirements.[MAX_REQUIREMENT_LENcxx . . $ `lib/game2dll.h:56:9`!]; |
| 77 | |
| 78 | }; |
| 79 | |
| 80 | extern dllinfocxx . . $ dllinfo# DLLInfocxx . . $ DLLInfo.; |
| 81 | |
| 82 | // The chokepoint function to call the dll function |
| 83 | void CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(int eventnum, dllinfocxx . . $ dllinfo# *data); |
| 84 | |
| 85 | // Frees the dll if its in memory |
| 86 | void FreeGameDLLcxx . . $ FreeGameDLL(49f6e7a06ebc5aa8).(); |
| 87 | |
| 88 | // Loads the game dll. Returns 1 on success, else 0 on failure |
| 89 | int LoadGameDLLcxx . . $ LoadGameDLL(cb7559238bb26814).(const char *name, int num_teams_to_use = -1); |
| 90 | |
| 91 | // If this function is called than the DLL is to be closed, because there was an error running it |
| 92 | // if reason is not NULL than that is the reason why |
| 93 | void DLLFatalErrorcxx . . $ DLLFatalError(85c52e162fed56f9).(const char *reason = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 94 | |
| 95 | // Call this function right after a player connects to the game to see if a player is banned |
| 96 | bool GameDLLIsAddressBannedcxx . . $ GameDLLIsAddressBanned(46e1c72e52d9c94a).(network_addresscxx . . $ network_address# *addr, const char *tracker_id); |
| 97 | |
| 98 | // Call this function to get information/options from a unloaded mod |
| 99 | bool GetDLLGameInfocxx . . $ GetDLLGameInfo(658e70a0a99f1558).(const char *name, tDLLOptionscxx . . $ tDLLOptions# *options); |
| 100 | |
| 101 | // Call this function to get information about the number of teams for the game |
| 102 | // Returns true if it's a team game...false if it's a non-team game. |
| 103 | // If it returns true, then min is filled in with the minumum number of teams needed for the game |
| 104 | // and max is filled in with the maximum number of teams for the game...if they are the same |
| 105 | // value, then it is the only number of teams supported. |
| 106 | bool GetDLLNumTeamInfocxx . . $ GetDLLNumTeamInfo(f3a8223d1a54ec76).(const char *name, int *mint, int *maxt); |
| 107 | |
| 108 | // Call this function to get the list of requirements that the given module needs in order |
| 109 | // to be playable. Returns the number of requirements it needs...-1 on error. |
| 110 | int GetDLLRequirementscxx . . $ GetDLLRequirements(89c8e27db0bdb94e).(const char *name, char *requirements, int buflen); |
| 111 | |
| 112 | #endif |