| 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 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lib/directplay.h $ |
| 21 | * $Revision: 5 $ |
| 22 | * $Date: 9/02/98 6:54p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Directplay API header |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/lib/directplay.h $ |
| 28 | * |
| 29 | * 5 9/02/98 6:54p Kevin |
| 30 | * Fixed general directplay support up, and got modem-modem working |
| 31 | * |
| 32 | * 4 8/24/98 10:55a Kevin |
| 33 | * new directplay stuff |
| 34 | * |
| 35 | * 3 8/14/98 4:54p Kevin |
| 36 | * More directplay stuff |
| 37 | * |
| 38 | * 2 8/13/98 6:32p Kevin |
| 39 | * Initial implementation of directplay API |
| 40 | * |
| 41 | * 1 8/13/98 6:25p Kevin |
| 42 | * |
| 43 | */ |
| 44 | #ifndef _OUTRAGE_DIRECTPLAY_HEADER |
| 45 | #define _OUTRAGE_DIRECTPLAY_HEADER |
| 46 | |
| 47 | #include "dplay.h" |
| 48 | #include "dplobby.h" |
| 49 | |
| 50 | struct modem_list { |
| 51 | char name[200]; |
| 52 | }; |
| 53 | |
| 54 | #define MAX_MODEMS 15 |
| 55 | #define MAX_DP_GAMES 32 |
| 56 | #define MAX_DIRECTPLAY_CONNECTIONS 10 |
| 57 | #define MAX_PENDING_NEW_CONNECTIONS 10 |
| 58 | |
| 59 | extern bool Use_DirectPlay; |
| 60 | extern bool Directplay_lobby_launched_game; |
| 61 | |
| 62 | extern DPSESSIONDESC2 Directplay_sessions[MAX_DP_GAMES]; |
| 63 | extern int Num_directplay_games; |
| 64 | |
| 65 | extern uint32_t Pending_dp_conn[MAX_PENDING_NEW_CONNECTIONS]; |
| 66 | |
| 67 | // This is called when a game is started, so Directplay will be happy |
| 68 | int dp_StartGame(char *gamename); |
| 69 | |
| 70 | // This is called when the game ends, to tell directplay the game is over |
| 71 | void dp_EndGame(); |
| 72 | |
| 73 | // This is called to request a list of ongoig direct play games |
| 74 | int dp_ListDirectPlayGames(); |
| 75 | |
| 76 | // Send a packet to a direct play user |
| 77 | int dp_DirectPlaySend(network_address *who_to, uint8_t *data, int len, bool reliable); |
| 78 | |
| 79 | // This function will look for incoming messages, and dispatch them accordingly |
| 80 | void dp_DirectPlayDispatch(); |
| 81 | |
| 82 | // Initialize stuff |
| 83 | int dp_InitDirectPlay(char *conn_name, void *parms = NULL, int num_elements = 0); |
| 84 | |
| 85 | // Shutdown things |
| 86 | void dp_ShutdownDirectPlay(); |
| 87 | |
| 88 | // Destroy a player object |
| 89 | void dp_DirectPlayDestroyPlayer(DPID who); |
| 90 | |
| 91 | // Join a network game |
| 92 | int dp_DirectPlayJoinGame(LPDPSESSIONDESC2 session); |
| 93 | |
| 94 | // Call this function with size set to 0, and it will fill in size with |
| 95 | // the amount of buffer space you need |
| 96 | // Otherwise, it will fill in the buffer with a bunch of null delimited |
| 97 | // strings, with a double null at the end. |
| 98 | int dp_GetModemChoices(char *buffer, LPDWORD size); |
| 99 | |
| 100 | // Register a DirectPlay lobby aware application |
| 101 | // Use this so a directplay lobby provider such as zone.com can launch the game |
| 102 | // |
| 103 | // Parameters: |
| 104 | // appname The non-localized name of the application (ie. "Descent 3") DON'T LOCALIZE THIS! IT IS AN ID |
| 105 | // exefile Executable file name (without path) |
| 106 | // exepath Path to executable file |
| 107 | // arguments Any command line arguments the app needs |
| 108 | // workingdir The Working directory for the application |
| 109 | // description Localized description of the application |
| 110 | void dp_RegisterLobbyApplication(char *appname, char *exefile, char *exepath, char *arguments, char *workingdir, |
| 111 | char *description); |
| 112 | |
| 113 | // Returns TRUE if the game was launched from a lobby |
| 114 | bool dp_DidLobbyLaunchGame(); |
| 115 | |
| 116 | // Autoconnects to a game or starts one, based on the directplay lobby stuff |
| 117 | bool dp_AutoConnect(); |
| 118 | |
| 119 | #endif |