1 /*
2 BStone: A Source port of
3 Blake Stone: Aliens of Gold and Blake Stone: Planet Strike
4 
5 Copyright (c) 1992-2013 Apogee Entertainment, LLC
6 Copyright (c) 2013-2015 Boris I. Bendovsky (bibendovsky@hotmail.com)
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the
20 Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 
24 
25 #ifndef BSTONE_3D_MENU_INCLUDED
26 #define BSTONE_3D_MENU_INCLUDED
27 
28 
29 #include "id_heads.h"
30 
31 
32 #define GAME_DESCRIPTION_LEN (31)
33 
34 
35 //
36 // Menu Color Defines
37 //
38 
39 // Box behind text for cursor
40 #define HIGHLIGHT_BOX_COLOR (0x52)
41 
42 // Text color for text on cursor
43 #define HIGHLIGHT_TEXT_COLOR (0x59)
44 
45 // Text color for text on cursor for a turned off item
46 #define HIGHLIGHT_DISABLED_COLOR (0x56)
47 
48 #define HIGHLIGHT_DEACTIAVED_COLOR (0x55)
49 
50 
51 #define ENABLED_TEXT_COLOR (0x56)
52 #define DISABLED_TEXT_COLOR (0x53)
53 #define DEACTIAVED_TEXT_COLOR (0x52)
54 
55 #define INSTRUCTIONS_TEXT_COLOR (0x53)
56 
57 #define TERM_BACK_COLOR (0x02)
58 #define TERM_SHADOW_COLOR (0x01)
59 
60 //
61 // Clearable Menu Terminal Area
62 //
63 #define SCREEN_X (32)
64 #define SCREEN_Y (28)
65 #define SCREEN_W (244)
66 #define SCREEN_H (132)
67 
68 #define BORD2COLOR (0x74)
69 #define DEACTIVE (0x72)
70 #define BKGDCOLOR (0x76)
71 
72 void MenuFadeOut();
73 
74 #define READCOLOR (0x4A)
75 #define READHCOLOR (0x47)
76 #define VIEWCOLOR (0x7F)
77 #define TEXTCOLOR (WHITE)
78 #define HIGHLIGHT (0x13)
79 
80 
MenuFadeIn()81 inline void MenuFadeIn()
82 {
83     ::VL_FadeIn(0, 255, ::vgapal, 10);
84 }
85 
86 
87 extern int16_t MENUSONG;
88 extern int16_t ROSTER_MUS;
89 extern int16_t TEXTSONG;
90 
91 
92 #define SENSITIVE (60)
93 #define CENTER (SENSITIVE * 2)
94 
95 #define MENU_X (111)
96 #define MENU_Y (50)
97 
98 #define SM_X (121)
99 #define SM_Y (84)
100 
101 #define CTL_X (100)
102 #define CTL_Y (70)
103 
104 #define LSM_X (85)
105 #define LSM_Y (55)
106 #define LSM_W (144)
107 
108 #define NM_X (71)
109 #define NM_Y (66)
110 
111 #define NE_X (58)
112 #define NE_Y (54)
113 
114 #define CST_X (77)
115 #define CST_Y (60)
116 
117 #define CST_START (77)
118 #define CST_SPC (41)
119 
120 
121 enum mm_labels {
122     MM_NEW_MISSION,
123     MM_ORDERING_INFO,
124     MM_READ_THIS,
125     MM_BLAKE_STONE_SAGA,
126     MM_BLANK1,
127     MM_GAME_OPTIONS,
128     MM_VIEW_SCORES,
129     MM_LOAD_MISSION,
130     MM_SAVE_MISSION,
131     MM_BLANK2,
132     MM_BACK_TO_DEMO,
133     MM_LOGOFF,
134 }; // mm_labels
135 
136 // CP_Switch() menu labels
137 enum sw_labels {
138     SW_LIGHTING,
139     SW_REBA_ATTACK_INFO,
140     SW_CEILING,
141     SW_FLOORS,
142 
143     // BBi
144     SW_NO_WALL_HIT_SOUND,
145     SW_MODERN_CONTROLS,
146     SW_ALWAYS_RUN,
147     SW_HEART_BEAT_SOUND,
148     SW_ROTATED_AUTOMAP,
149 }; // sw_labels
150 
151 // BBi
152 enum MenuVideoLables {
153     mvl_stretch_to_window,
154 };
155 // BBi
156 
157 //  ActiveType flags for menu options (SEE CP_itemtype.active)
158 enum activetypes {
159     AT_DISABLED = 0,
160     AT_ENABLED,
161     AT_READIT,
162     AT_NON_SELECTABLE, // Menu Bar/Separator - Not a selectable item.
163 }; // activetypes
164 
165 
166 struct CP_cursortype {
167     uint8_t x;
168     int8_t y_ofs;
169     uint8_t width;
170     uint8_t height;
171     int8_t on;
172 }; // CP_cursortype
173 
174 struct CP_iteminfo {
175     uint8_t x;
176     uint8_t y;
177     uint8_t amount;
178     int8_t curpos;
179     uint8_t indent;
180     uint8_t y_spacing;
181 
182     CP_cursortype cursor;
183 }; // CP_iteminfo
184 
185 struct CP_itemtype {
186     activetypes active;
187     char string[36];
188 
189     void (* routine)(
190         int16_t temp1);
191 
192     uint8_t fontnumber; // Font to print text in
193     uint8_t height; // Hight of text (Y_Offset from previous line)
194 }; // CP_itemtype
195 
196 struct CustomCtrls {
197     int16_t allowed[4];
198 }; // CustomCtrls
199 
200 extern CP_itemtype MainMenu[];
201 extern CP_itemtype NewEMenu[];
202 extern CP_iteminfo MainItems;
203 
204 
205 void SetupControlPanel();
206 void CleanupControlPanel();
207 void ControlPanelFree();
208 void ControlPanelAlloc();
209 
210 void DrawMenu(
211     CP_iteminfo* item_i,
212     CP_itemtype* items);
213 
214 int16_t HandleMenu(
215     CP_iteminfo* item_i,
216     CP_itemtype* items,
217     void (* routine)(int16_t w));
218 
219 void ClearMScreen();
220 
221 void DrawWindow(
222     int16_t x,
223     int16_t y,
224     int16_t w,
225     int16_t h,
226     int16_t wcolor);
227 
228 void DrawOutline(
229     int16_t x,
230     int16_t y,
231     int16_t w,
232     int16_t h,
233     int16_t color1,
234     int16_t color2);
235 
236 void WaitKeyUp();
237 
238 void ReadAnyControl(
239     ControlInfo* ci);
240 
241 void TicDelay(
242     int16_t count);
243 
244 void CacheLump(
245     int16_t lumpstart,
246     int16_t lumpend);
247 
248 void UnCacheLump(
249     int16_t lumpstart,
250     int16_t lumpend);
251 
252 void StartCPMusic(
253     int16_t song);
254 
255 int16_t Confirm(
256     const char* string);
257 
258 void Message(
259     const char* string);
260 
261 void CheckPause();
262 void ShootSnd();
263 void CheckSecretMissions();
264 
265 void DrawGun(
266     CP_iteminfo* item_i,
267     CP_itemtype* items,
268     int16_t x,
269     int16_t* y,
270     int16_t which,
271     int16_t basey,
272     void (* routine)(int16_t w));
273 
274 void DrawHalfStep(
275     int16_t x,
276     int16_t y,
277     int16_t y_spacing);
278 
279 void EraseGun(
280     CP_iteminfo* item_i,
281     CP_itemtype* items,
282     int16_t x,
283     int16_t y,
284     int16_t which);
285 
286 void SetTextColor(
287     CP_itemtype* items,
288     int16_t hlight);
289 
290 void DrawMenuGun(
291     CP_iteminfo* iteminfo);
292 
293 void DrawStripes(
294     int16_t y);
295 
296 void DefineMouseBtns();
297 void DefineJoyBtns();
298 void DefineKeyBtns();
299 void DefineKeyMove();
300 
301 void EnterCtrlData(
302     int16_t index,
303     CustomCtrls* cust,
304     void (* DrawRtn)(int16_t),
305     void (* PrintRtn)(int16_t),
306     int16_t type);
307 
308 void DrawMainMenu();
309 void DrawSoundMenu();
310 
311 void DrawLoadSaveScreen(
312     int16_t loadsave);
313 
314 void DrawNewEpisode();
315 void DrawNewGame();
316 
317 void DrawChangeView(
318     int16_t view);
319 
320 void DrawMouseSens();
321 void DrawCtlScreen();
322 void DrawCustomScreen();
323 
324 void DrawLSAction(
325     int16_t which);
326 
327 void DrawCustMouse(
328     int16_t hilight);
329 
330 void DrawCustJoy(
331     int16_t hilight);
332 
333 void DrawCustKeybd(
334     int16_t hilight);
335 
336 void DrawCustKeys(
337     int16_t hilight);
338 
339 void PrintCustMouse(
340     int16_t i);
341 
342 void PrintCustJoy(
343     int16_t i);
344 
345 void PrintCustKeybd(
346     int16_t i);
347 
348 void PrintCustKeys(
349     int16_t i);
350 
351 void PrintLSEntry(
352     int16_t w,
353     int16_t color);
354 
355 void TrackWhichGame(
356     int16_t w);
357 
358 void DrawNewGameDiff(
359     int16_t w);
360 
361 void FixupCustom(
362     int16_t w);
363 
364 void CP_BlakeStoneSaga(
365     int16_t temp1);
366 
367 void CP_NewGame(
368     int16_t temp1);
369 
370 void CP_Sound(
371     int16_t temp1);
372 
373 int16_t CP_LoadGame(
374     int16_t quick);
375 
376 int16_t CP_SaveGame(
377     int16_t quick);
378 
379 void CP_Control(
380     int16_t temp1);
381 
382 void CP_ExitOptions(
383     int16_t temp1);
384 
385 void CP_Quit();
386 
387 void CP_ViewScores(
388     int16_t temp1);
389 
390 int16_t CP_EndGame();
391 
392 bool CP_CheckQuick(
393     ScanCode scancode);
394 
395 void CustomControls(
396     int16_t temp1);
397 
398 void MouseSensitivity(
399     int16_t temp1);
400 
401 void DrawMenuTitle(
402     const char* title);
403 
404 void CheckForEpisodes();
405 
406 void HelpPresenter(
407     const char* fname,
408     bool continuekeys,
409     uint16_t id_cache,
410     bool startmusic);
411 
412 void ShadowPrint(
413     const char* string,
414     int16_t x,
415     int16_t y);
416 
417 //
418 // VARIABLES
419 //
420 extern int16_t SaveGamesAvail[10];
421 extern int16_t StartGame;
422 extern int16_t SoundStatus;
423 extern char SaveGameNames[10][GAME_DESCRIPTION_LEN + 1];
424 
425 // FOR INPUT TYPES
426 enum MenuInputType {
427     MOUSE,
428     JOYSTICK,
429     KEYBOARDBTNS,
430     KEYBOARDMOVE
431 }; // MenuInputType
432 
433 //
434 // WL_INTER
435 //
436 struct LRstruct {
437     int16_t kill, secret, treasure;
438     int32_t time;
439 }; // LRstruct
440 
441 extern LRstruct LevelRatios[];
442 
443 void Write(
444     int16_t x,
445     int16_t y,
446     char* string);
447 
448 
449 #endif // BSTONE_3D_MENU_INCLUDED
450