| 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/help.cpp $ |
| 21 | * $Revision: 32 $ |
| 22 | * $Date: 3/20/00 12:10p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Help functions (when user presses F1 in the game) |
| 26 | * |
| 27 | * $Log: /DescentIII/main/help.cpp $ |
| 28 | * |
| 29 | * 32 3/20/00 12:10p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Added help for PageDown pause key. |
| 32 | * |
| 33 | * 31 5/21/99 11:14p Samir |
| 34 | * changed some text in help dialog. (SHIFT-TAB) |
| 35 | * |
| 36 | * 30 5/21/99 12:45p Samir |
| 37 | * added help strings for F8 and F9 keys. |
| 38 | * |
| 39 | * 29 4/16/99 12:17p Samir |
| 40 | * new help menu with new ui. |
| 41 | * |
| 42 | * 28 4/16/99 4:25a Jeff |
| 43 | * removed ifdef of linux since new compiler compiles it |
| 44 | * |
| 45 | * 27 4/15/99 1:39a Jeff |
| 46 | * changes for linux compile |
| 47 | * |
| 48 | * 26 4/14/99 2:50a Jeff |
| 49 | * fixed some case mismatched #includes |
| 50 | * |
| 51 | * 25 4/06/99 12:11p Doug |
| 52 | * Made ESC key work (Samir) |
| 53 | * |
| 54 | * 24 4/03/99 9:26p Jeff |
| 55 | * changed dialogs that weren't using UID_OK and UID_CANCEL to use and |
| 56 | * handle them properly |
| 57 | * |
| 58 | * 23 3/04/99 11:41a Jeff |
| 59 | * fixed text going off window |
| 60 | * |
| 61 | * 22 3/03/99 7:21p Jeff |
| 62 | * adjusted help file window text to make room for new text |
| 63 | * |
| 64 | * 21 3/03/99 1:18p Jeff |
| 65 | * added telcom main menu item |
| 66 | * |
| 67 | * 20 2/28/99 9:19p Jeff |
| 68 | * added some strings to help window |
| 69 | * |
| 70 | * 19 10/20/98 12:15p Jeff |
| 71 | * removed SHIFT-F2 Center Missile view |
| 72 | * |
| 73 | * 18 10/19/98 7:08p Jeff |
| 74 | * added "F6 Multiplayer On-Screen Menu" |
| 75 | * |
| 76 | * 17 10/08/98 7:27p Samir |
| 77 | * made multiplayer friendly. |
| 78 | * |
| 79 | * 16 10/07/98 2:54p Jeff |
| 80 | * General UI fixes and additions |
| 81 | * |
| 82 | * 15 10/06/98 5:34p Jeff |
| 83 | * various UI changes/improvements |
| 84 | * |
| 85 | * 14 9/21/98 4:34p Jeff |
| 86 | * updates to Help menu |
| 87 | * |
| 88 | * 13 9/02/98 2:54p Jeff |
| 89 | * added defines for text colors to be used throughout the game...fixed up |
| 90 | * buddy menu too |
| 91 | * |
| 92 | * 12 8/15/98 2:49p Matt |
| 93 | * Took out unneeded include |
| 94 | * |
| 95 | * 11 7/09/98 12:33p Jeff |
| 96 | * f1 closes help screen |
| 97 | * |
| 98 | * 10 7/08/98 4:58p Jeff |
| 99 | * a bit more updated |
| 100 | * |
| 101 | * 9 6/17/98 3:27p Jeff |
| 102 | * Changes made for localization |
| 103 | * |
| 104 | * 8 6/16/98 10:38a Jeff |
| 105 | * localization, strings pulled out to stringtable.h and d3.str |
| 106 | * |
| 107 | * 7 5/05/98 6:26p Samir |
| 108 | * adjusted to work in 512 384 |
| 109 | * |
| 110 | * 6 4/24/98 3:27p Jeff |
| 111 | * removed briefing.h dependency |
| 112 | * |
| 113 | * 5 3/05/98 2:51p Jeff |
| 114 | * Made help system use UI |
| 115 | * |
| 116 | * 4 3/04/98 3:09p Jeff |
| 117 | * Now gives key descriptions |
| 118 | * |
| 119 | * 3 3/03/98 4:01p Jeff |
| 120 | * Got it displaying a "cheap" help screen |
| 121 | * |
| 122 | * 2 3/02/98 5:14p Jeff |
| 123 | * initial help system created |
| 124 | * |
| 125 | * $NoKeywords: $ |
| 126 | */ |
| 127 | |
| 128 | #include "help.h"cxx . . $ `<file>/Descent3/help.h`/ |
| 129 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 130 | #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/ |
| 131 | #include "render.h"cxx . . $ `<file>/Descent3/render.h`/ |
| 132 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 133 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 134 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 135 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 136 | #include "application.h"cxx . . $ `<file>/lib/application.h`/ |
| 137 | #include <stdlib.h> |
| 138 | #include <string.h> |
| 139 | #include <stdarg.h> |
| 140 | #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/ |
| 141 | #include "grtext.h"cxx . . $ `<file>/grtext/grtext.h`/ |
| 142 | #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/ |
| 143 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 144 | |
| 145 | #define TITLETEXTcxx . . $ `Descent3/help.cpp:145:9`! TXT_HELPcxx . . $ `Descent3/stringtable.h:129:9`! |
| 146 | static const int HelpTextcxx . . $ HelpText.[] = {TXI_ESCcxx . . $ `Descent3/stringtable.h:136:9`!, |
| 147 | TXI_HLPQUITcxx . . $ `Descent3/stringtable.h:137:9`!, |
| 148 | #ifndef DEMO // Do Not include in the PC Gamer Demo |
| 149 | TXI_HLPALTF2cxx . . $ `Descent3/stringtable.h:385:9`!, |
| 150 | TXI_HLPSAVEGAMEcxx . . $ `Descent3/stringtable.h:386:9`!, |
| 151 | TXI_HLPALTF3cxx . . $ `Descent3/stringtable.h:387:9`!, |
| 152 | TXI_HLPLOADGAMEcxx . . $ `Descent3/stringtable.h:388:9`!, |
| 153 | #endif |
| 154 | TXI_F2cxx . . $ `Descent3/stringtable.h:134:9`!, |
| 155 | TXI_HLPCONFIGcxx . . $ `Descent3/stringtable.h:135:9`!, |
| 156 | TXI_F3cxx . . $ `Descent3/stringtable.h:132:9`!, |
| 157 | TXI_HLPCOCKPITcxx . . $ `Descent3/stringtable.h:133:9`!, |
| 158 | TXI_HLPF4cxx . . $ `Descent3/stringtable.h:389:9`!, |
| 159 | TXI_HLPGUIDEBOTcxx . . $ `Descent3/stringtable.h:390:9`!, |
| 160 | TXI_F5cxx . . $ `Descent3/stringtable.h:421:9`!, |
| 161 | TXI_TOGGLEDEMOcxx . . $ `Descent3/stringtable.h:422:9`!, |
| 162 | TXI_F6cxx . . $ `Descent3/stringtable.h:428:9`!, |
| 163 | TXI_MLTMENUcxx . . $ `Descent3/stringtable.h:429:9`!, |
| 164 | TXI_F8cxx . . $ `Descent3/stringtable.h:925:9`!, |
| 165 | TXI_HLP_MULTIMSGcxx . . $ `Descent3/stringtable.h:924:9`!, |
| 166 | TXI_F9cxx . . $ `Descent3/stringtable.h:923:9`!, |
| 167 | TXI_HLP_QUIKSAVEcxx . . $ `Descent3/stringtable.h:922:9`!, |
| 168 | TXI_F12cxx . . $ `Descent3/stringtable.h:769:9`!, |
| 169 | TXI_DROPSMARKERcxx . . $ `Descent3/stringtable.h:770:9`!, |
| 170 | TXI_SHFTTABcxx . . $ `Descent3/stringtable.h:776:9`!, |
| 171 | TXI_TCMMcxx . . $ `Descent3/stringtable.h:777:9`!, |
| 172 | TXI_HLPPAUSEcxx . . $ `Descent3/stringtable.h:140:9`!, |
| 173 | TXI_HLPPAUSEDESCcxx . . $ `Descent3/stringtable.h:141:9`!, |
| 174 | TXI_PLUSMINUScxx . . $ `Descent3/stringtable.h:138:9`!, |
| 175 | TXI_HLPSCRNSIZEcxx . . $ `Descent3/stringtable.h:139:9`!, |
| 176 | TXI_HLPPRNTSCRNcxx . . $ `Descent3/stringtable.h:130:9`!, |
| 177 | TXI_HLPTAKESCRNSHTcxx . . $ `Descent3/stringtable.h:131:9`!, |
| 178 | TXI_HLP1_5cxx . . $ `Descent3/stringtable.h:391:9`!, |
| 179 | TXI_HLPSELPRIMcxx . . $ `Descent3/stringtable.h:392:9`!, |
| 180 | TXI_HLP6_0cxx . . $ `Descent3/stringtable.h:393:9`!, |
| 181 | TXI_HLPSELSECNcxx . . $ `Descent3/stringtable.h:394:9`!, |
| 182 | TXI_SF1cxx . . $ `Descent3/stringtable.h:142:9`!, |
| 183 | TXI_HLPREARLEFTcxx . . $ `Descent3/stringtable.h:145:9`!, |
| 184 | TXI_SF2cxx . . $ `Descent3/stringtable.h:143:9`!, |
| 185 | TXI_HLPREARRIGHTcxx . . $ `Descent3/stringtable.h:147:9`!, |
| 186 | TXI_SHFTF8cxx . . $ `Descent3/stringtable.h:767:9`!, |
| 187 | TXI_DISPLAYGAMEMSGCONSOLEcxx . . $ `Descent3/stringtable.h:768:9`!, |
| 188 | TXI_SHFTF9cxx . . $ `Descent3/stringtable.h:765:9`!, |
| 189 | TXI_DISPLAYHUDMSGCONSOLEcxx . . $ `Descent3/stringtable.h:766:9`!, |
| 190 | 0}; |
| 191 | |
| 192 | #define HELP_X_KEY_POScxx . . $ `Descent3/help.cpp:192:9`! 60 |
| 193 | #define HELP_X_DESC_POScxx . . $ `Descent3/help.cpp:193:9`! 160 |
| 194 | #define HELP_Ycxx . . $ `Descent3/help.cpp:194:9`! 32 |
| 195 | |
| 196 | #define IDH_QUITcxx . . $ `Descent3/help.cpp:196:9`! UID_CANCEL |
| 197 | #define WND_HELP_Wcxx . . $ `Descent3/help.cpp:197:9`! 448 |
| 198 | #define WND_HELP_Hcxx . . $ `Descent3/help.cpp:198:9`! 384 |
| 199 | #define WND_HELP_Xcxx . . $ `Descent3/help.cpp:199:9`! (Game_window_w - WND_HELP_W) / 2 |
| 200 | #define WND_HELP_Ycxx . . $ `Descent3/help.cpp:200:9`! (Game_window_h - WND_HELP_H) / 2 |
| 201 | |
| 202 | void HelpDisplaycxx . . $ HelpDisplay(49f6e7a06ebc5aa8).(void) { |
| 203 | newuiTiledWindowcxx . . $ newuiTiledWindow# help_wndcxx . . $ newuiTiledWindow#newuiTiledWindow(49f6e7a06ebc5aa8).; |
| 204 | newuiSheetcxx . . $ newuiSheet# *sheet; |
| 205 | int strs_to_print = 0; |
| 206 | int index, res; |
| 207 | bool exit_menu = false; |
| 208 | |
| 209 | help_wnd.Createcxx . . $ newuiTiledWindow#Create(9860cac3d762132).(TITLETEXTcxx . . $ `Descent3/help.cpp:145:9`!, 0, 0, WND_HELP_Wcxx . . $ `Descent3/help.cpp:197:9`!, WND_HELP_Hcxx . . $ `Descent3/help.cpp:198:9`!); |
| 210 | sheet = help_wnd.GetSheetcxx . . $ newuiTiledWindow#GetSheet(661381a276e5b628).(); |
| 211 | |
| 212 | // add commands |
| 213 | help_wnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(KEY_F1cxx . . $ `ddio/ddio_common.h:282:9`!, UID_CANCELcxx . . $ `ui/ui.h:369:9`!); |
| 214 | |
| 215 | strs_to_print = 0; |
| 216 | |
| 217 | // find out how many strings to print out |
| 218 | while (HelpTextcxx . . $ HelpText.[strs_to_print] > 0) |
| 219 | strs_to_print++; |
| 220 | |
| 221 | sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 30, 10); |
| 222 | for (index = 0; index < strs_to_print; index += 2) { |
| 223 | if (index < strs_to_print) { |
| 224 | sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXTcxx . . $ `Descent3/stringtable.h:24:9`!(HelpText[index])); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 130, 10); |
| 229 | for (index = 1; index < strs_to_print; index += 2) { |
| 230 | if (index < strs_to_print) { |
| 231 | sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXTcxx . . $ `Descent3/stringtable.h:24:9`!(HelpText[index])); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, WND_HELP_Wcxx . . $ `Descent3/help.cpp:197:9`! - 160, WND_HELP_Hcxx . . $ `Descent3/help.cpp:198:9`! - 96, NEWUI_ALIGN_HORIZcxx . . $ NEWUI_ALIGN_HORIZ.); |
| 236 | sheet->AddButtoncxx . . $ newuiSheet#AddButton(680bf41633375800).(TXT_OKcxx . . $ `Descent3/stringtable.h:34:9`!, UID_CANCELcxx . . $ `ui/ui.h:369:9`!); |
| 237 | |
| 238 | // quit_hot.Create(&help_wnd, UID_CANCEL, 0, &UITextItem(TXT_PRESSESCRET, UICOL_HOTSPOT_LO,UIALPHA_HOTSPOT_LO), |
| 239 | // &UITextItem(TXT_PRESSESCRET,UICOL_HOTSPOT_HI,UIALPHA_HOTSPOT_HI), |
| 240 | // HELP_X_KEY_POS, WND_HELP_H - OKCANCEL_YOFFSET, |
| 241 | // 0,0,UIF_FIT|UIF_CENTER); |
| 242 | help_wnd.Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).(); |
| 243 | |
| 244 | while (!exit_menu) { |
| 245 | res = help_wnd.DoUIcxx . . $ newuiTiledWindow#DoUI(b126dc7c1de90089).(); |
| 246 | |
| 247 | // handle all UI results. |
| 248 | switch (res) { |
| 249 | case UID_CANCELcxx . . $ `ui/ui.h:369:9`!: |
| 250 | case NEWUIRES_FORCEQUITcxx . . $ `Descent3/newui_core.h:131:9`!: |
| 251 | exit_menu = true; |
| 252 | break; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | help_wnd.Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).(); |
| 257 | help_wnd.Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).(); |
| 258 | } |