forked from exult/exult
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exultmenu.cc
661 lines (592 loc) · 20.3 KB
/
exultmenu.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/*
* Copyright (C) 2000-2013 The Exult Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "menulist.h"
#include "exultmenu.h"
#include "exult.h"
#include "mouse.h"
#include "gamewin.h"
#include "ibuf8.h"
#include "game.h"
#include "bggame.h"
#include "sigame.h"
#include "Audio.h"
#include "font.h"
#include "cheat.h"
#include "Configuration.h"
#include "txtscroll.h"
#include "data/exult_flx.h"
#include "palette.h"
#include "shapeid.h"
#include "XMidiFile.h"
#include "databuf.h"
#include "fnames.h"
#include "gamemgr/modmgr.h"
#include "gumps/Gamemenu_gump.h"
#include "shapeid.h"
#include "ignore_unused_variable_warning.h"
#if 0
static bool get_play_intro(void);
static void set_play_intro(bool);
static bool get_play_1st_scene(void);
static void set_play_1st_scene(bool);
#endif
#define MAX_GAMES 100
static inline bool handle_menu_click(
int id,
int &first,
int last_page,
int pagesize
) {
switch (id) {
case -8:
first = 0;
return true;
case -7:
first -= pagesize;
return true;
case -6:
first += pagesize;
return true;
case -5:
first = last_page;
return true;
default:
return false;
}
}
int maximum_size(Font *font, const char *options[], int num_choices, int centerx) {
ignore_unused_variable_warning(centerx);
int max_width = 0, width;
for (int i = 0; i < num_choices; i++) {
width = font->get_text_width(options[i]);
if (width > max_width)
max_width = width;
}
max_width += 16;
return max_width;
}
void create_scroller_menu(MenuList *menu, Font *fonton, Font *font, int first, int pagesize, int num_choices, int xpos, int ypos) {
const char *menuscroller[] = {
"FIRST",
"PREVIOUS",
"NEXT",
"LAST"
};
int ncount = sizeof(menuscroller) / sizeof(menuscroller[0]);
assert(ncount == 4);
int max_width = maximum_size(font, menuscroller, ncount, xpos);
xpos = xpos - max_width * 3 / 2;
num_choices--;
int lastpage = num_choices - num_choices % pagesize;
for (int i = 0; i < ncount; i++) {
//Check to see if this entry is needed at all:
if (!((i < 2 && first == 0) ||
(i == 0 && first == pagesize) ||
(i >= 2 && lastpage == first) ||
(i == 3 && lastpage == first + pagesize))) {
MenuTextEntry *entry = new MenuTextEntry(fonton, font, menuscroller[i],
xpos, ypos);
//These commands have negative ids:
entry->set_id(i - 8);
menu->add_entry(entry);
}
xpos += max_width;
}
}
ExultMenu::ExultMenu(Game_window *gw)
: font(0), fonton(0), navfont(0), navfonton(0) {
gwin = gw;
ibuf = gwin->get_win()->get_ib8();
const char *fname = BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX);
fontManager.add_font("CREDITS_FONT", fname, EXULT_FLX_FONT_SHP, 1);
fontManager.add_font("HOT_FONT", fname, EXULT_FLX_FONTON_SHP, 1);
fontManager.add_font("NAV_FONT", fname, EXULT_FLX_NAVFONT_SHP, 1);
fontManager.add_font("HOT_NAV_FONT", fname, EXULT_FLX_NAVFONTON_SHP, 1);
calc_win();
exult_flx.load(fname);
}
ExultMenu::~ExultMenu() {
}
void ExultMenu::calc_win() {
centerx = gwin->get_width() / 2;
centery = gwin->get_height() / 2;
Font *fnt = font ? font : fontManager.get_font("CREDITS_FONT");
pagesize = 2 * ((gwin->get_win()->get_full_height() - 5 * fnt->get_text_height() - 15) / 45);
}
void ExultMenu::setup() {
ModManager *mm = gamemanager->get_bg();
if (!mm) gamemanager->get_si();
if (!mm) gamemanager->get_game(0);
if (!mm) {
std::cerr << "No games found. Unable to show gumps in Exult menu." << std::endl;
return;
}
//ModManager mm_exult_menu_game (*mm);
//mm_exult_menu_game.set_game_type(EXULT_MENU_GAME);
Game *exult_menu_game = Game::create_game(mm);
if (!Shape_manager::get_instance()->load_gumps_minimal()) {
std::cerr << "Unable to show gumps in Exult menu." << std::endl;
return;
}
Mouse::mouse = menu_mouse;
gwin->clear_screen(true);
Palette *gpal = gwin->get_pal();
gpal->fade(0, 1, 0);
gwin->set_in_exult_menu(true);
Gamemenu_gump::do_exult_menu();
gwin->set_in_exult_menu(false);
Mouse::mouse = 0;
delete exult_menu_game;
game = exult_menu_game = 0;
gwin->clear_screen(true);
gpal->load(BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX), EXULT_FLX_EXULT0_PAL);
gpal->apply();
#if 0
Palette *gpal = gwin->get_pal();
Font *font = fontManager.get_font("CREDITS_FONT");
Font *fonton = fontManager.get_font("HOT_FONT");
MenuList menu;
#ifdef HAVE_OPENGL
Shape_frame *setupbg = 0;
if (GL_manager::get_instance()) {
int w = gwin->get_win()->get_full_width(), h = gwin->get_win()->get_full_height();
Image_buffer8 *buf = dynamic_cast<Image_buffer8 *>
(gwin->get_win()->get_ib8()->create_another(w, h));
assert(buf);
buf->fill8(0);
setupbg = new Shape_frame(buf->get_bits(), w, h, 0, 0, true);
delete buf;
}
menu.set_background(setupbg);
#endif
int menuypos = centery - 44;
MenuTextChoice *palfades = new MenuTextChoice(fonton, font, "PALETTE FADES",
centerx, menuypos);
palfades->add_choice("Off");
palfades->add_choice("On");
palfades->set_choice(gwin->get_pal()->get_fades_enabled() ? 1 : 0);
menu.add_entry(palfades);
menuypos += 11;
MenuTextChoice *playintro = new MenuTextChoice(fonton, font, "PLAY INTRODUCTION",
centerx, menuypos);
playintro->add_choice("Off");
playintro->add_choice("On");
playintro->set_choice(get_play_intro() ? 1 : 0);
menu.add_entry(playintro);
menuypos += 11;
MenuTextChoice *playscene = new MenuTextChoice(fonton, font, "PLAY FIRST SCENE",
centerx, menuypos);
playscene->add_choice("Off");
playscene->add_choice("On");
playscene->set_choice(get_play_1st_scene() ? 1 : 0);
menu.add_entry(playscene);
menuypos += 11;
MenuTextChoice *cheating = new MenuTextChoice(fonton, font, "CHEATING",
centerx, menuypos);
cheating->add_choice("Off");
cheating->add_choice("On");
cheating->set_choice(cheat() ? 1 : 0);
menu.add_entry(cheating);
menuypos += 11;
MenuTextEntry *ok = new MenuTextEntry(fonton, font, "OK",
centerx - 64, centery + 55);
int ok_button = menu.add_entry(ok);
MenuTextEntry *cancel = new MenuTextEntry(fonton, font, "CANCEL",
centerx + 64, centery + 55);
int cancel_button = menu.add_entry(cancel);
menu.set_selection(0);
gwin->clear_screen(true);
while (1) {
gpal->apply();
int entry = menu.handle_events(gwin, menu_mouse);
if (entry == ok_button) {
gpal->fade_out(c_fade_out_time);
gwin->clear_screen(true);
// Scaling Method
// Palette fades
gpal->set_fades_enabled(palfades->get_choice() == 1);
config->set("config/video/disable_fades",
gpal->get_fades_enabled() ? "no" : "yes", true);
// Play Intro
set_play_intro(playintro->get_choice() == 1);
// Play 1st scene
set_play_1st_scene(playscene->get_choice() == 1);
// Cheating
cheat.set_enabled(cheating->get_choice() == 1);
calc_win();
break;
} else if (entry == cancel_button) {
gpal->fade_out(c_fade_out_time);
gwin->clear_screen(true);
break;
}
}
#ifdef HAVE_OPENGL
delete setupbg;
#endif
#endif
}
MenuList *ExultMenu::create_main_menu(Shape_frame *bg, int first) {
MenuList *menu = new MenuList();
int ypos = 15 + gwin->get_win()->get_start_y();
int xpos = (gwin->get_win()->get_full_width() / 2 + exult_flx.get_shape(EXULT_FLX_SFX_ICON_SHP, 0)->get_width()) / 2;
std::vector<ModManager> &game_list = gamemanager->get_game_list();
int num_choices = game_list.size();
int last = num_choices > first + pagesize ? first + pagesize : num_choices;
for (int i = first; i < last; i++) {
int menux = xpos + (i % 2) * gwin->get_win()->get_full_width() / 2 + gwin->get_win()->get_start_x();
ModManager &exultgame = game_list[i];
bool have_sfx = Audio::have_config_sfx(exultgame.get_cfgname()) ||
Audio::have_roland_sfx(exultgame.get_game_type()) ||
Audio::have_sblaster_sfx(exultgame.get_game_type()) ||
Audio::have_midi_sfx();
Shape_frame *sfxicon = exult_flx.get_shape(EXULT_FLX_SFX_ICON_SHP,
have_sfx ? 1 : 0);
MenuGameEntry *entry = new MenuGameEntry(fonton, font,
exultgame.get_menu_string().c_str(),
sfxicon, menux, ypos);
entry->set_id(i);
menu->add_entry(entry);
if (exultgame.has_mods()) {
MenuTextEntry *mod_entry = new MenuTextEntry(navfonton, navfont, "SHOW MODS",
menux, ypos + entry->get_height() + 4);
mod_entry->set_id(i + MAX_GAMES);
menu->add_entry(mod_entry);
}
if (i % 2)
ypos += 45;
}
create_scroller_menu(menu, navfonton, navfont, first, pagesize, num_choices,
centerx, ypos = gwin->get_win()->get_end_y() - 5 * font->get_text_height());
const char *menuchoices[] = {
"SETUP",
"CREDITS",
"QUOTES",
"EXIT"
};
int num_entries = sizeof(menuchoices) / sizeof(menuchoices[0]);
int max_width = maximum_size(font, menuchoices, num_entries, centerx);
xpos = centerx - max_width * (num_entries - 1) / 2;
ypos = gwin->get_win()->get_end_y() - 3 * font->get_text_height();
for (int i = 0; i < 4; i++) {
MenuTextEntry *entry = new MenuTextEntry(fonton, font, menuchoices[i],
xpos, ypos);
//These commands have negative ids:
entry->set_id(i - 4);
menu->add_entry(entry);
xpos += max_width;
}
menu->set_background(bg);
return menu;
}
MenuList *ExultMenu::create_mods_menu(ModManager *selgame, Shape_frame *bg, int first) {
MenuList *menu = new MenuList();
int ypos = 15 + gwin->get_win()->get_start_y();
int xpos = gwin->get_win()->get_full_width() / 4;
std::vector<ModInfo> &mod_list = selgame->get_mod_list();
int num_choices = mod_list.size();
int last = num_choices > first + pagesize ? first + pagesize : num_choices;
for (int i = first; i < last; i++) {
int menux = xpos + (i % 2) * gwin->get_win()->get_full_width() / 2 + gwin->get_win()->get_start_x();
ModInfo &exultmod = mod_list[i];
MenuGameEntry *entry = new MenuGameEntry(fonton, font,
exultmod.get_menu_string().c_str(),
0, menux, ypos);
entry->set_id(i);
entry->set_enabled(exultmod.is_mod_compatible());
menu->add_entry(entry);
if (!exultmod.is_mod_compatible()) {
MenuGameEntry *incentry = new MenuGameEntry(navfonton, navfont, "WRONG EXULT VERSION",
0, menux, ypos + entry->get_height() + 4);
// Accept no clicks:
incentry->set_enabled(false);
menu->add_entry(incentry);
}
if (i % 2)
ypos += 45;
}
create_scroller_menu(menu, navfonton, navfont, first, pagesize, num_choices,
centerx, ypos = gwin->get_win()->get_end_y() - 5 * font->get_text_height());
const char *menuchoices[] = {
"RETURN TO MAIN MENU"
};
int num_entries = sizeof(menuchoices) / sizeof(menuchoices[0]);
int max_width = maximum_size(font, menuchoices, num_entries, centerx);
xpos = centerx - max_width * (num_entries - 1) / 2;
ypos = gwin->get_win()->get_end_y() - 3 * font->get_text_height();
for (int i = 0; i < num_entries; i++) {
MenuTextEntry *entry = new MenuTextEntry(fonton, font, menuchoices[i],
xpos, ypos);
//These commands have negative ids:
entry->set_id(i - 4);
menu->add_entry(entry);
xpos += max_width;
}
menu->set_background(bg);
return menu;
}
BaseGameInfo *ExultMenu::show_mods_menu(ModManager *selgame, Shape_frame *logobg) {
Palette *gpal = gwin->get_pal();
Shape_manager *sman = Shape_manager::get_instance();
gwin->clear_screen(true);
gpal->load(BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX), EXULT_FLX_EXULT0_PAL);
gpal->apply();
int first_mod = 0, num_choices = selgame->get_mod_list().size() - 1,
last_page = num_choices - num_choices % pagesize;
MenuList *menu = create_mods_menu(selgame, logobg, first_mod);
menu->set_selection(0);
BaseGameInfo *sel_mod = 0;
Shape_frame *exultlogo = 0;
exultlogo = exult_flx.get_shape(EXULT_FLX_EXULT_LOGO_SHP, 1);
int logox, logoy;
logox = centerx - exultlogo->get_width() / 2;
logoy = centery - exultlogo->get_height() / 2;
do {
// Interferes with the menu.
#ifdef HAVE_OPENGL
if (!GL_manager::get_instance())
#endif
sman->paint_shape(logox, logoy, exultlogo);
#ifdef HAVE_OPENGL
if (!GL_manager::get_instance())
#endif
font->draw_text(gwin->get_win()->get_ib8(),
gwin->get_win()->get_end_x() - font->get_text_width(VERSION),
gwin->get_win()->get_end_y() - font->get_text_height() - 5, VERSION);
int choice = menu->handle_events(gwin, menu_mouse);
switch (choice) {
case -10: // The incompatibility notice; do nothing
break;
case -4: // Return to main menu
gpal->fade_out(c_fade_out_time / 2);
wait_delay(c_fade_out_time / 2);
gwin->clear_screen(true);
delete menu;
return 0;
default:
if (choice >= 0) {
// Load the game:
gpal->fade_out(c_fade_out_time);
sel_mod = selgame->get_mod(choice);
break;
} else if (handle_menu_click(choice, first_mod, last_page, pagesize)) {
delete menu;
menu = create_mods_menu(selgame, logobg, first_mod);
gwin->clear_screen(true);
}
}
} while (sel_mod == 0);
delete menu;
gwin->clear_screen(true);
return sel_mod;
}
static Shape_frame *create_exultlogo(int logox, int logoy, Vga_file &exult_flx, Font *font) {
#ifdef HAVE_OPENGL
if (GL_manager::get_instance()) {
Game_window *gwin = Game_window::get_instance();
int w = gwin->get_win()->get_full_width(), h = gwin->get_win()->get_full_height();
Shape_frame *logo = exult_flx.get_shape(EXULT_FLX_EXULT_LOGO_SHP, 1);
Image_buffer8 *buf = dynamic_cast<Image_buffer8 *>
(gwin->get_win()->get_ib8()->create_another(w, h));
assert(buf);
buf->fill8(0);
logo->paint(buf, logox, logoy);
// Disable OpenGL rendering for a bit.
Shape_frame::set_to_render(buf, 0);
font->draw_text(buf, w - font->get_text_width(VERSION),
h - font->get_text_height() - 5, VERSION);
Shape_frame::set_to_render(gwin->get_win()->get_ib8(),
GL_manager::get_instance());
Shape_frame *exultlogo = new Shape_frame(buf->get_bits(), w, h, 0, 0, true);
delete buf;
return exultlogo;
}
#endif
return 0;
}
BaseGameInfo *ExultMenu::run() {
Palette *gpal = gwin->get_pal();
Shape_manager *sman = Shape_manager::get_instance();
gwin->clear_screen(true);
gpal->load(BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX), EXULT_FLX_EXULT0_PAL);
font = fontManager.get_font("CREDITS_FONT");
fonton = fontManager.get_font("HOT_FONT");
navfont = fontManager.get_font("NAV_FONT");
navfonton = fontManager.get_font("HOT_NAV_FONT");
if (!gamemanager->get_game_count()) {
int topy = centery - 25;
font->center_text(gwin->get_win()->get_ib8(),
centerx, topy + 20, "WARNING");
font->center_text(gwin->get_win()->get_ib8(),
centerx, topy + 40, "Could not find the static data for either");
font->center_text(gwin->get_win()->get_ib8(),
centerx, topy + 50, "\"The Black Gate\" or \"Serpent Isle\".");
font->center_text(gwin->get_win()->get_ib8(),
centerx, topy + 60, "Please edit the configuration file");
font->center_text(gwin->get_win()->get_ib8(),
centerx, topy + 70, "and restart Exult");
gpal->apply();
while (!wait_delay(200))
;
throw quit_exception(1);
}
ExultDataSource mouse_data(BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX),
EXULT_FLX_POINTERS_SHP);
menu_mouse = new Mouse(gwin, mouse_data);
//Must check this or it will crash as midi
//may not be initialised
if (Audio::get_ptr()->audio_enabled) {
// Make sure timbre library is correct!
//Audio::get_ptr()->get_midi()->set_timbre_lib(MyMidiPlayer::TIMBRE_LIB_GM);
Audio::get_ptr()->start_music(EXULT_FLX_MEDITOWN_MID, true, EXULT_FLX);
}
#ifdef HAVE_OPENGL
if (GL_manager::get_instance())
gwin->get_win()->fill8(0);
#endif
Shape_frame *exultlogo = exult_flx.get_shape(EXULT_FLX_EXULT_LOGO_SHP, 0);
int logox = centerx - exultlogo->get_width() / 2,
logoy = centery - exultlogo->get_height() / 2;
sman->paint_shape(logox, logoy, exultlogo);
gpal->fade_in(c_fade_in_time);
wait_delay(2000);
exultlogo = exult_flx.get_shape(EXULT_FLX_EXULT_LOGO_SHP, 1);
int first_game = 0, num_choices = gamemanager->get_game_count() - 1,
last_page = num_choices - num_choices % pagesize;
// Erase the old logo.
gwin->clear_screen(true);
Shape_frame *logobg = create_exultlogo(logox, logoy, exult_flx, font);
MenuList *menu = create_main_menu(logobg, first_game);;
BaseGameInfo *sel_game = 0;
menu->set_selection(0);
do {
// Interferes with the menu.
#ifdef HAVE_OPENGL
if (GL_manager::get_instance() && !logobg) {
logobg = create_exultlogo(logox, logoy, exult_flx, font);
menu->set_background(logobg);
} else if (!GL_manager::get_instance())
#endif
sman->paint_shape(logox, logoy, exultlogo);
#ifdef HAVE_OPENGL
if (!GL_manager::get_instance())
#endif
font->draw_text(gwin->get_win()->get_ib8(),
gwin->get_win()->get_end_x() - font->get_text_width(VERSION),
gwin->get_win()->get_end_y() - font->get_text_height() - 5, VERSION);
int choice = menu->handle_events(gwin, menu_mouse);
switch (choice) {
case -4: // Setup
gpal->fade_out(c_fade_out_time);
setup();
delete menu;
delete logobg;
if (Audio::get_ptr()->audio_enabled) {
// Make sure timbre library is correct!
//Audio::get_ptr()->get_midi()->set_timbre_lib(MyMidiPlayer::TIMBRE_LIB_GM);
Audio::get_ptr()->start_music(EXULT_FLX_MEDITOWN_MID, true, EXULT_FLX);
}
calc_win();
logox = centerx - exultlogo->get_width() / 2;
logoy = centery - exultlogo->get_height() / 2;
logobg = create_exultlogo(logox, logoy, exult_flx, font);
first_game = 0;
menu = create_main_menu(logobg, first_game);
menu->set_selection(0);
break;
case -3: { // Exult Credits
gpal->fade_out(c_fade_out_time);
TextScroller credits(
BUNDLE_CHECK(BUNDLE_EXULT_FLX, EXULT_FLX),
EXULT_FLX_CREDITS_TXT,
fontManager.get_font("CREDITS_FONT"),
exult_flx.extract_shape(EXULT_FLX_EXTRAS_SHP));
credits.run(gwin);
gwin->clear_screen(true);
gpal->apply();
}
break;
case -2: { // Exult Quotes
gpal->fade_out(c_fade_out_time);
TextScroller quotes(BUNDLE_CHECK(
BUNDLE_EXULT_FLX, EXULT_FLX),
EXULT_FLX_QUOTES_TXT,
fontManager.get_font("CREDITS_FONT"),
exult_flx.extract_shape(EXULT_FLX_EXTRAS_SHP));
quotes.run(gwin);
gwin->clear_screen(true);
gpal->apply();
}
break;
case -1: // Exit
gpal->fade_out(c_fade_out_time);
Audio::get_ptr()->stop_music();
delete menu;
delete logobg;
delete menu_mouse;
throw quit_exception();
default:
if (choice >= 0 && choice < MAX_GAMES) {
// Load the game:
gpal->fade_out(c_fade_out_time);
sel_game = gamemanager->get_game(choice);
} else if (choice >= MAX_GAMES && choice < 2 * MAX_GAMES) {
// Show the mods for the game:
gpal->fade_out(c_fade_out_time / 2);
sel_game = show_mods_menu(
gamemanager->get_game(choice - MAX_GAMES), logobg);
gwin->clear_screen(true);
gpal->apply();
} else if (handle_menu_click(choice, first_game, last_page, pagesize)) {
delete menu;
menu = create_main_menu(logobg, first_game);
gwin->clear_screen(true);
}
break;
}
} while (sel_game == 0);
delete menu;
delete logobg;
gwin->clear_screen(true);
Audio::get_ptr()->stop_music();
delete menu_mouse;
return sel_game;
}
#if 0
bool get_play_intro() {
std::string yn;
config->value("config/gameplay/skip_splash", yn, "no");
return(yn == "no");
}
void set_play_intro(bool play) {
ignore_unused_variable_warning(play);
config->set("config/gameplay/skip_splash", play ? "no" : "yes", true);
}
bool get_play_1st_scene() {
std::string yn;
config->value("config/gameplay/skip_intro", yn, "no");
return(yn == "no");
}
void set_play_1st_scene(bool play) {
ignore_unused_variable_warning(play);
config->set("config/gameplay/skip_intro", play ? "no" : "yes", true);
}
#endif