| 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/descent.h $ |
| 21 | * $Revision: 33 $ |
| 22 | * $Date: 11/04/99 12:35a $ |
| 23 | * $Author: Chris $ |
| 24 | * |
| 25 | * Descent 3 header file |
| 26 | * |
| 27 | * $Log: /DescentIII/main/descent.h $ |
| 28 | * |
| 29 | * 33 11/04/99 12:35a Chris |
| 30 | * Added support for Merc |
| 31 | * |
| 32 | * 32 10/21/99 3:27p Matt |
| 33 | * Mac merge |
| 34 | * |
| 35 | * 31 7/20/99 12:59p Jason |
| 36 | * added auto katmai support |
| 37 | * |
| 38 | * 30 5/12/99 2:24p Jeff |
| 39 | * Descent3 now has a setable temp directory for all temp files |
| 40 | * |
| 41 | * 29 4/14/99 3:56a Jeff |
| 42 | * fixed case mismatch in #includes |
| 43 | * |
| 44 | * 28 3/31/99 3:04p Jeff |
| 45 | * added _real_ temporary credits system... |
| 46 | * |
| 47 | * 27 3/19/99 4:30p Kevin |
| 48 | * multi-cd support |
| 49 | * |
| 50 | * 26 2/16/99 12:36a Kevin |
| 51 | * Fixes for release builds of OEM V3 and KAtmai |
| 52 | * |
| 53 | * 25 2/03/99 4:40p Kevin |
| 54 | * Added new port number for OEM |
| 55 | * |
| 56 | * 24 1/15/99 7:16p Kevin |
| 57 | * Added GameGauge Configuration & code |
| 58 | * |
| 59 | * 23 12/23/98 6:38p Kevin |
| 60 | * All UDP data (except gamespy) now uses one (registered) port number |
| 61 | * |
| 62 | * 22 10/18/98 8:55p Matt |
| 63 | * Added a constant with the name of the program. |
| 64 | * |
| 65 | * 21 10/16/98 1:54p Kevin |
| 66 | * Changes for Demo Beta 4 |
| 67 | * |
| 68 | * 20 10/08/98 7:26p Samir |
| 69 | * changed the prototype for the defer handler callback. |
| 70 | * |
| 71 | * 19 10/08/98 12:00p Kevin |
| 72 | * Demo system work |
| 73 | * |
| 74 | * 18 9/22/98 3:54p Samir |
| 75 | * no include slew in release version. |
| 76 | * |
| 77 | * 17 9/15/98 4:31p Jason |
| 78 | * added more functionality for the dedicated server |
| 79 | * |
| 80 | * 16 8/20/98 10:51a Samir |
| 81 | * added the RESTORE_GAME_MODE function mode,. |
| 82 | * |
| 83 | * 15 8/15/98 5:16p Matt |
| 84 | * Added new Base_directory variable. Got rid of D3_LOCAL check and |
| 85 | * 'local directory' registry variable. |
| 86 | * |
| 87 | * 14 7/02/98 12:57p Jason |
| 88 | * upped FOV |
| 89 | * |
| 90 | * 13 4/22/98 3:24p Jason |
| 91 | * made FOV be 65 degrees by default |
| 92 | * |
| 93 | * 12 4/14/98 7:56p Matt |
| 94 | * Moved MSN_NAMELEN from mission.h to descent,h, so multi.h didn't need |
| 95 | * to include mission.h. |
| 96 | * |
| 97 | * 11 3/23/98 8:06p Samir |
| 98 | * change return type of D3DeferHandler to match changes in library. |
| 99 | * |
| 100 | * 10 3/19/98 11:27a Samir |
| 101 | * Better error checking. |
| 102 | * |
| 103 | * 9 3/10/98 5:16p Samir |
| 104 | * Got debug callbacks working when you hit an Int3. |
| 105 | * |
| 106 | * 8 2/25/98 2:05p Jason |
| 107 | * did FOV and object visibility changes |
| 108 | * |
| 109 | * 7 10/16/97 2:30p Samir |
| 110 | * Added defer handler. |
| 111 | * |
| 112 | * 6 9/17/97 10:56a Matt |
| 113 | * Deleted Room_engine variable |
| 114 | * |
| 115 | * 5 9/16/97 1:04p Samir |
| 116 | * Added delay function. |
| 117 | * |
| 118 | * 4 7/24/97 6:35p Matt |
| 119 | * Created symbolic constant for default zoom, and used it every place |
| 120 | * that specifies zoom |
| 121 | * |
| 122 | * 3 7/24/97 2:53p Matt |
| 123 | * Added SourceSafe header and missing include |
| 124 | * |
| 125 | * $NoKeywords: $ |
| 126 | */ |
| 127 | |
| 128 | #ifndef _DESCENT_H |
| 129 | #define _DESCENT_H |
| 130 | |
| 131 | #include <cstdlib> |
| 132 | #include <filesystem> |
| 133 | |
| 134 | #include "application.h" |
| 135 | |
| 136 | // The name of this product |
| 137 | #ifdef DEMO |
| 138 | #define PRODUCT_NAME "Descent 3 Demo" |
| 139 | #else |
| 140 | #define PRODUCT_NAME "Descent 3" |
| 141 | #endif |
| 142 | |
| 143 | // This is the port number assigned to "descent3" by the IANA (Internet Assigned Numbers Authority) |
| 144 | // Don't arbitrarily change this number! |
| 145 | #ifdef OEM |
| 146 | // The port used for the OEM version isn't a legitimate IANA port number |
| 147 | #define D3_DEFAULT_PORT 2092 |
| 148 | #else |
| 149 | #define D3_DEFAULT_PORT 2092 |
| 150 | #endif |
| 151 | |
| 152 | class grScreen; |
| 153 | class oeApplication; |
| 154 | class oeAppDatabase; |
| 155 | class grViewport; |
| 156 | |
| 157 | // --------------------------------------------------------------------------- |
| 158 | // Constants and Types |
| 159 | |
| 160 | enum function_mode { |
| 161 | INIT_MODE, |
| 162 | GAME_MODE, |
| 163 | RESTORE_GAME_MODE, |
| 164 | EDITOR_MODE, |
| 165 | EDITOR_GAME_MODE, |
| 166 | MENU_MODE, |
| 167 | QUIT_MODE, |
| 168 | LOADDEMO_MODE, |
| 169 | GAMEGAUGE_MODE, // Unused |
| 170 | CREDITS_MODE |
| 171 | }; |
| 172 | |
| 173 | extern bool Descent_overrided_intro; |
| 174 | |
| 175 | // This is the default FOV |
| 176 | #define D3_DEFAULT_FOV 72.0 |
| 177 | // This is the default zoom factor to be used for the game 3D view. |
| 178 | #define D3_DEFAULT_ZOOM 0.726f |
| 179 | |
| 180 | // How long the a mission name can be |
| 181 | #define MSN_NAMELEN 32 |
| 182 | |
| 183 | // The "root" directory of the D3 file tree |
| 184 | extern char Base_directory[]; |
| 185 | extern char Base_directory_write[]; |
| 186 | |
| 187 | // Variable to preserve current path. TODO: redundant? |
| 188 | extern std::filesystem::path orig_pwd; |
| 189 | |
| 190 | // --------------------------------------------------------------------------- |
| 191 | // Globals |
| 192 | |
| 193 | extern grScreen *Game_screen; // The Descent 3 screen. |
| 194 | extern oeApplication *Descent; // The Descent object |
| 195 | extern oeAppDatabase *Database; // The Database |
| 196 | extern char Descent3_temp_directory[_MAX_PATH]; // temp directory to put temp files |
| 197 | extern bool Katmai; // whether or not katmai is detected |
| 198 | // --------------------------------------------------------------------------- |
| 199 | // Functions |
| 200 | |
| 201 | #ifdef EDITOR |
| 202 | void WinMainInitEditor(unsigned hwnd, unsigned hinst); |
| 203 | #endif |
| 204 | |
| 205 | // Runs Descent III |
| 206 | void Descent3(); |
| 207 | |
| 208 | // Runs the game, or editor |
| 209 | void MainLoop(); |
| 210 | |
| 211 | // the defer handler |
| 212 | void D3DeferHandler(bool is_active); |
| 213 | |
| 214 | // Set and retrieve the current function mode of Descent 3 |
| 215 | void SetFunctionMode(function_mode mode); |
| 216 | function_mode GetFunctionMode(); |
| 217 | |
| 218 | // these functions create viewports from the game screen in a 'nice' C way |
| 219 | void CreateGameViewport(grViewport **vp); |
| 220 | void DestroyGameViewport(grViewport *vp); |
| 221 | |
| 222 | inline void CREATE_VIEWPORT(grViewport **vp) { CreateGameViewport(vp); } |
| 223 | |
| 224 | inline void DESTROY_VIEWPORT(grViewport *vp) { DestroyGameViewport(vp); } |
| 225 | |
| 226 | inline void DELAY(float secs) { Descent->delay(secs); } |
| 227 | |
| 228 | #ifndef RELEASE |
| 229 | // this is called when you hit a debug break! |
| 230 | void D3DebugStopHandler(); |
| 231 | void D3DebugResumeHandler(); |
| 232 | #endif |
| 233 | |
| 234 | #endif |