FS2_Open
Open source remastering of the Freespace 2 engine
fictionviewer.cpp
Go to the documentation of this file.
1 /*
2  * Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
3  * You may not sell or otherwise commercially exploit the source or things you
4  * create based on the source.
5  */
6 
7 
8 
9 #include "freespace2/freespace.h"
11 #include "gamesnd/eventmusic.h"
12 #include "gamesnd/gamesnd.h"
13 #include "globalincs/alphacolors.h"
14 #include "io/key.h"
19 #include "missionui/redalert.h"
20 #include "mod_table/mod_table.h"
21 #include "sound/audiostr.h"
22 
23 
24 
25 // ---------------------------------------------------------------------------------------------------------------------------------------
26 // MISSION FICTION VIEWER DEFINES/VARS
27 //
28 #define NUM_FVW_SETTINGS 2
30 {
31  "FS2", // FreeSpace 2
32  "WCS" // Wing Commander Saga
33 };
34 
36 {
37  {
38  "FictionViewer", // GR_640
39  "2_FictionViewer" // GR_1024
40  },
41  {
42  "FictionViewerb", // GR_640
43  "2_FictionViewerb" // GR_1024
44  }
45 };
46 
48 {
49  {
50  "FictionViewer-m", // GR_640
51  "2_FictionViewer-m" // GR_1024
52  },
53  {
54  "FictionViewer-mb", // GR_640
55  "2_FictionViewer-mb" // GR_1024
56  }
57 };
58 
60 {
61  // standard FS2-style interface
62  {
63  { // GR_640
64  17, 37, 588, 344
65  },
66  { // GR_1024
67  25, 48, 944, 576
68  }
69  },
70  // WCS-style interface
71  {
72  { // GR_640
73  44, 50, 522, 348
74  },
75  { // GR_1024
76  71, 80, 835, 556
77  }
78  }
79 };
80 
81 #define NUM_FVW_BUTTONS 3
82 #define FVW_BUTTON_ACCEPT 0
83 #define FVW_BUTTON_SCROLL_UP 1
84 #define FVW_BUTTON_SCROLL_DOWN 2
85 
86 // the xt and yt fields aren't normally used for width and height,
87 // but the fields would go unused here and this is more
88 // convenient for initialization
90 {
91  // standard FS2-style interface
92  {
93  { // GR_640
94  ui_button_info("fvw_accept_", 571, 425, 69, 55, FVW_BUTTON_ACCEPT),
95  ui_button_info("fvw_up_", 614, 14, 25, 31, FVW_BUTTON_SCROLL_UP),
96  ui_button_info("fvw_down_", 614, 370, 25, 31, FVW_BUTTON_SCROLL_DOWN),
97  // Filename x y width height
98  },
99  { // GR_1024
100  ui_button_info("2_fvw_accept_", 918, 688, 99, 77, FVW_BUTTON_ACCEPT),
101  ui_button_info("2_fvw_up_", 981, 16, 40, 50, FVW_BUTTON_SCROLL_UP),
102  ui_button_info("2_fvw_down_", 981, 606, 40, 50, FVW_BUTTON_SCROLL_DOWN),
103  }
104  },
105  // WCS-style interface
106  {
107  { // GR_640
108  ui_button_info("fvw_accept_", 105, 444, 37, 26, FVW_BUTTON_ACCEPT),
109  ui_button_info("fvw_up_", 576, 51, 37, 33, FVW_BUTTON_SCROLL_UP),
110  ui_button_info("fvw_down_", 576, 364, 37, 33, FVW_BUTTON_SCROLL_DOWN),
111  },
112  { // GR_1024
113  ui_button_info("2_fvw_accept_", 168, 710, 59, 41, FVW_BUTTON_ACCEPT),
114  ui_button_info("2_fvw_up_", 922, 81, 59, 53, FVW_BUTTON_SCROLL_UP),
115  ui_button_info("2_fvw_down_", 922, 582, 59, 53, FVW_BUTTON_SCROLL_DOWN),
116  }
117  }
118 };
119 
121 {
122  // standard FS2-style interface
123  {
124  "slider",
125  "2_slider"
126  },
127  // WCS-style interface
128  {
129  "fvw_slider_",
130  "2_fvw_slider_"
131  }
132 };
133 
135 {
136  // standard FS2-style interface
137  {
138  { // GR_640
139  618, 48, 18, 320 //Initial position x, initial position y, width, height of the slider column
140  },
141  { // GR_1024
142  988, 70, 28, 532
143  }
144  },
145  // WCS-style interface
146  {
147  { // GR_640
148  589, 83, 16, 280
149  },
150  { // GR_1024
151  944, 132, 25, 451
152  }
153  }
154 };
155 
158 
159 static int Top_fiction_viewer_text_line = 0;
160 static int Fiction_viewer_text_max_lines = 0;
161 
162 static UI_WINDOW Fiction_viewer_window;
163 static UI_SLIDER2 Fiction_viewer_slider;
164 static int Fiction_viewer_bitmap = -1;
165 static int Fiction_viewer_inited = 0;
166 
167 static int Fiction_viewer_old_fontnum = -1;
168 static int Fiction_viewer_fontnum = -1;
169 
170 static char *Fiction_viewer_text = nullptr;
171 static int Fiction_viewer_voice = -1;
172 
173 static int Fiction_viewer_ui = -1;
174 
175 static void use_fv_font()
176 {
177  // save old font and set new one
178  if (Fiction_viewer_fontnum >= 0)
179  {
180  Fiction_viewer_old_fontnum = gr_get_current_fontnum();
181  gr_set_font(Fiction_viewer_fontnum);
182  }
183  else
184  {
185  Fiction_viewer_old_fontnum = -1;
186  }
187 }
188 
189 static void use_std_font()
190 {
191  // restore the old font
192  if (Fiction_viewer_old_fontnum >= 0)
193  gr_set_font(Fiction_viewer_old_fontnum);
194 }
195 
196 // ---------------------------------------------------------------------------------------------------------------------------------------
197 // FICTION VIEWER FUNCTIONS
198 //
199 
201 {
202  if (mission_has_cmd_brief())
204  else if (red_alert_mission())
206  else
208 }
209 
211 {
212  Top_fiction_viewer_text_line--;
213  if (Top_fiction_viewer_text_line < 0)
214  {
215  Top_fiction_viewer_text_line = 0;
217  }
218  else
219  {
221  }
222 }
223 
225 {
226  Top_fiction_viewer_text_line++;
227  if ((Num_brief_text_lines[0] - Top_fiction_viewer_text_line) < Fiction_viewer_text_max_lines)
228  {
229  Top_fiction_viewer_text_line--;
231  }
232  else
233  {
235  }
236 }
237 
239 {
240  // nothing to do
241 }
242 
243 // button press
245 {
246  switch (button)
247  {
248  case FVW_BUTTON_ACCEPT:
251  break;
252 
255  Fiction_viewer_slider.forceUp();
256  break;
257 
260  Fiction_viewer_slider.forceDown();
261  break;
262 
263  default:
264  Int3(); // unrecognized button
265  break;
266  }
267 }
268 
269 // init
271 {
272  if (Fiction_viewer_inited)
273  return;
274 
275  // no stage loaded?
277  return;
278 
279  // no fiction document?
280  if (!mission_has_fiction())
281  return;
282 
283  // music
285 
286  Fiction_viewer_bitmap = -1;
287 
288  if (*Fiction_viewer_stages[Fiction_viewer_active_stage].background[gr_screen.res] != '\0')
289  {
290  Fiction_viewer_bitmap = bm_load(Fiction_viewer_stages[Fiction_viewer_active_stage].background[gr_screen.res]);
291  if (Fiction_viewer_bitmap < 0)
292  mprintf(("Failed to load custom background bitmap %s!\n", Fiction_viewer_stages[Fiction_viewer_active_stage].background[gr_screen.res]));
293  else if (Fiction_viewer_ui < 0)
294  Fiction_viewer_ui = 0;
295  }
296 
297  // if special background failed to load, or if no special background was supplied, load the standard bitmap
298  if (Fiction_viewer_bitmap < 0)
299  {
300  if (Fiction_viewer_ui < 0)
301  {
302  // no UI specified; use the last UI in the array that has an available background bitmap
303  for (Fiction_viewer_ui = NUM_FVW_SETTINGS - 1; Fiction_viewer_ui >= 0; Fiction_viewer_ui--)
304  {
305  Fiction_viewer_bitmap = bm_load(Fiction_viewer_screen_filename[Fiction_viewer_ui][gr_screen.res]);
306  if (Fiction_viewer_bitmap >= 0)
307  break;
308  }
309  }
310  else
311  {
312  // use the specified UI's background bitmap
313  Fiction_viewer_bitmap = bm_load(Fiction_viewer_screen_filename[Fiction_viewer_ui][gr_screen.res]);
314  }
315  }
316 
317  // no ui is valid?
318  if (Fiction_viewer_ui < 0)
319  {
320  Warning(LOCATION, "No fiction viewer graphics -- cannot display fiction viewer!");
321  return;
322  }
323 
324  // set up fiction viewer font
325  use_fv_font();
326 
327  // calculate text area lines from font
328  Fiction_viewer_text_max_lines = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3] / gr_get_font_height();
329 
330  // window
331  Fiction_viewer_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0, Fiction_viewer_fontnum);
332  Fiction_viewer_window.set_mask_bmap(Fiction_viewer_screen_mask[Fiction_viewer_ui][gr_screen.res]);
333 
334  // add the buttons
335  for (int i = 0; i < NUM_FVW_BUTTONS; i++)
336  {
337  int repeat = (i == FVW_BUTTON_SCROLL_UP || i == FVW_BUTTON_SCROLL_DOWN);
338  ui_button_info *b = &Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][i];
339 
340  b->button.create(&Fiction_viewer_window, "", b->x, b->y, b->xt, b->yt, repeat, 1);
342  b->button.set_bmaps(b->filename);
343  b->button.link_hotspot(b->hotspot);
344  }
345 
346  // set up hotkeys for buttons
347  Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][FVW_BUTTON_ACCEPT].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
348  Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][FVW_BUTTON_SCROLL_UP].button.set_hotkey(KEY_UP);
349  Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][FVW_BUTTON_SCROLL_DOWN].button.set_hotkey(KEY_DOWN);
350 
351  // init brief text
352  brief_color_text_init(Fiction_viewer_text, Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][2], default_fiction_viewer_color, 0, 0);
353 
354  // if the story is going to overflow the screen, add a slider
355  if (Num_brief_text_lines[0] > Fiction_viewer_text_max_lines)
356  {
357  Fiction_viewer_slider.create(&Fiction_viewer_window,
358  Fiction_viewer_slider_coordinates[Fiction_viewer_ui][gr_screen.res][0],
359  Fiction_viewer_slider_coordinates[Fiction_viewer_ui][gr_screen.res][1],
360  Fiction_viewer_slider_coordinates[Fiction_viewer_ui][gr_screen.res][2],
361  Fiction_viewer_slider_coordinates[Fiction_viewer_ui][gr_screen.res][3],
362  Num_brief_text_lines[0] - Fiction_viewer_text_max_lines,
363  Fiction_viewer_slider_filename[Fiction_viewer_ui][gr_screen.res],
367  }
368 
369  if (Fiction_viewer_voice >= 0)
370  {
371  audiostream_play(Fiction_viewer_voice, Master_voice_volume, 0);
372  }
373 
374  Fiction_viewer_inited = 1;
375 }
376 
377 // close
379 {
380  if (!Fiction_viewer_inited)
381  return;
382 
383  // free the fiction
385 
386  // destroy the window
387  Fiction_viewer_window.destroy();
388 
389  // restore the old font
390  use_std_font();
391 
392  // free the bitmap
393  if (Fiction_viewer_bitmap >= 0)
394  bm_release(Fiction_viewer_bitmap);
395  Fiction_viewer_bitmap = -1;
396 
397  // maybe stop music
400 
401  game_flush();
402 
403  Fiction_viewer_inited = 0;
404 }
405 
406 // do
407 void fiction_viewer_do_frame(float frametime)
408 {
409  int i, k, w, h;
410 
411  // make sure we exist
412  if (!Fiction_viewer_inited)
413  {
415  return;
416  }
417 
418  // process keys
419  k = Fiction_viewer_window.process() & ~KEY_DEBUGGED;
420 
421  switch (k)
422  {
423  case KEY_ESC:
426  return;
427  }
428 
429  // process button presses
430  for (i = 0; i < NUM_FVW_BUTTONS; i++)
431  if (Fiction_viewer_buttons[Fiction_viewer_ui][gr_screen.res][i].button.pressed())
433 
434  common_music_do();
435 
436  // clear
437  GR_MAYBE_CLEAR_RES(Fiction_viewer_bitmap);
438  if (Fiction_viewer_bitmap >= 0)
439  {
440  gr_set_bitmap(Fiction_viewer_bitmap);
441  gr_bitmap(0, 0, GR_RESIZE_MENU);
442  }
443 
444  // draw the window
445  Fiction_viewer_window.draw();
446 
447  // render the briefing text
448  brief_render_text(Top_fiction_viewer_text_line, Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][0], Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1], Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3], frametime);
449 
450  // maybe output the "more" indicator
451  if ((Fiction_viewer_text_max_lines + Top_fiction_viewer_text_line) < Num_brief_text_lines[0])
452  {
453  use_std_font();
454 
455  // can be scrolled down
456  int more_txt_x = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][0] + (Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][2]/2) - 10;
457  int more_txt_y = Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][1] + Fiction_viewer_text_coordinates[Fiction_viewer_ui][gr_screen.res][3]; // located below text, centered
458 
459  gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469)));
461  gr_rect(more_txt_x-2, more_txt_y, w+3, h, GR_RESIZE_MENU);
463  gr_string(more_txt_x, more_txt_y, XSTR("more", 1469), GR_RESIZE_MENU); // base location on the input x and y?
464 
465  use_fv_font();
466  }
467 
468  gr_flip();
469 }
470 
472 {
473  if (Fiction_viewer_voice >= 0)
474  {
475  audiostream_pause(Fiction_viewer_voice);
476  }
477 }
478 
480 {
481  if (Fiction_viewer_voice >= 0)
482  {
483  audiostream_unpause(Fiction_viewer_voice);
484  }
485 }
486 
488 {
489  if (Fred_running)
490  return !Fiction_viewer_stages.empty();
491  else
492  return (Fiction_viewer_text != nullptr);
493 }
494 
495 int fiction_viewer_ui_name_to_index(const char *ui_name)
496 {
497  int i;
498  for (i = 0; i < NUM_FVW_SETTINGS; i++)
499  {
500  if (!stricmp(ui_name, Fiction_viewer_ui_names[i]))
501  {
502  return i;
503  }
504  }
505 
506  return -1;
507 }
508 
510 {
511  if (Fiction_viewer_text != nullptr)
512  vm_free(Fiction_viewer_text);
513  Fiction_viewer_text = nullptr;
514 
515  Fiction_viewer_stages.clear();
517 
518  Fiction_viewer_ui = -1;
519 
520  Top_fiction_viewer_text_line = 0;
521 
522  if (Fiction_viewer_voice >= 0)
523  {
524  audiostream_close_file(Fiction_viewer_voice);
525  Fiction_viewer_voice = -1;
526  }
527 }
528 
529 void fiction_viewer_load(int stage)
530 {
531  Assertion(stage >= 0 && static_cast<size_t>(stage) < Fiction_viewer_stages.size(), "stage parameter must be in range of Fiction_viewer_stages!");
532 
533  // just to be sure
534  if (Fiction_viewer_text != nullptr)
535  {
536  Assertion(Fiction_viewer_text == nullptr, "Fiction viewer text should be a null pointer, but instead is '%s'. Trace out and fix!\n", Fiction_viewer_text);
537  return;
538  }
539 
541  fiction_viewer_stage *stagep = &Fiction_viewer_stages[stage];
542 
543  // load the ui index
544  Fiction_viewer_ui = Default_fiction_viewer_ui;
545  if (*stagep->ui_name)
546  {
547  int ui_index = fiction_viewer_ui_name_to_index(stagep->ui_name);
548  if (ui_index >= 0)
549  Fiction_viewer_ui = ui_index;
550  else
551  Warning(LOCATION, "Unrecognized fiction viewer UI: %s", stagep->ui_name);
552  }
553 
554  // see if we have a matching font
555  Fiction_viewer_fontnum = gr_get_fontnum(stagep->font_filename);
556 
557  Fiction_viewer_voice = audiostream_open(stagep->voice_filename, ASF_VOICE);
558 
559  // load up the text
561  if (fp == NULL)
562  {
563  Warning(LOCATION, "Unable to load story file '%s'.", stagep->story_filename);
564  }
565  else
566  {
567  // allocate space
568  int file_length = cfilelength(fp);
569  Fiction_viewer_text = (char *) vm_malloc(file_length + 1);
570  Fiction_viewer_text[file_length] = '\0';
571 
572  // copy all the text
573  cfread(Fiction_viewer_text, file_length, 1, fp);
574 
575  // we're done, close it out
576  cfclose(fp);
577  }
578 }
void gr_rect(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2068
void game_flush()
Definition: fredstubs.cpp:83
void set_highlight_action(void(*_user_function)(void))
Definition: button.cpp:375
int gr_get_fontnum(const char *filename)
Definition: font.cpp:554
void fiction_viewer_scroll_down()
int gr_get_current_fontnum()
Definition: font.cpp:545
#define CFILE_NORMAL
Definition: cfile.h:89
int i
Definition: multi_pxo.cpp:466
#define vm_free(ptr)
Definition: pstypes.h:548
void fiction_viewer_init()
int Num_brief_text_lines[MAX_TEXT_STREAMS]
#define KEY_DOWN
Definition: key.h:180
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void gr_flip()
Definition: 2d.cpp:2113
commit pressed
Definition: gamesnd.h:294
int Mission_music[NUM_SCORES]
Definition: eventmusic.cpp:253
int x
Definition: ui.h:658
#define GR_RESIZE_MENU
Definition: 2d.h:684
color Color_more_indicator
Definition: alphacolors.cpp:28
int cfread(void *buf, int elsize, int nelem, CFILE *fp)
int y
Definition: ui.h:658
char ui_name[NAME_LENGTH]
Definition: fictionviewer.h:23
#define ASF_VOICE
Definition: audiostr.h:21
int Fred_running
Definition: fred.cpp:44
int brief_color_text_init(const char *src, int w, const char default_color, int instance, int max_lines, const bool append)
void fiction_viewer_unpause()
void fiction_viewer_pause()
void fiction_viewer_load(int stage)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
#define mprintf(args)
Definition: pstypes.h:238
SCP_vector< fiction_viewer_stage > Fiction_viewer_stages
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
int Fiction_viewer_active_stage
general failure sound for any event
Definition: gamesnd.h:297
char story_filename[MAX_FILENAME_LEN]
Definition: fictionviewer.h:19
int res
Definition: 2d.h:370
int max_h_unscaled
Definition: 2d.h:361
void forceUp()
Definition: slider2.cpp:309
void fiction_viewer_reset()
Definition: cfile.h:28
#define Assertion(expr, msg,...)
Definition: clang.h:41
int Fiction_viewer_text_coordinates[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][4]
char * Fiction_viewer_screen_filename[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS]
#define GR_MAYBE_CLEAR_RES(bmap)
Definition: 2d.h:639
void common_music_close()
char voice_filename[MAX_FILENAME_LEN]
Definition: fictionviewer.h:21
#define SCORE_FICTION_VIEWER
Definition: eventmusic.h:55
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
#define SCORE_BRIEFING
Definition: eventmusic.h:51
int red_alert_mission(void)
Definition: redalert.cpp:1031
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
void forceDown()
Definition: slider2.cpp:302
void destroy()
Definition: window.cpp:189
void set_mask_bmap(char *fname)
Definition: window.cpp:75
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
Definition: gadget.cpp:71
int Default_fiction_viewer_ui
Definition: mod_table.cpp:26
#define cfopen(...)
Definition: cfile.h:134
void fiction_viewer_scroll_capture()
int mission_has_cmd_brief()
#define FVW_BUTTON_ACCEPT
void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _numberItems, char *_bitmapSliderControl, void(*_upCallback)(), void(*_downCallback)(), void(*_captureCallback)())
Definition: slider2.cpp:21
char * Fiction_viewer_slider_filename[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS]
#define NUM_FVW_SETTINGS
int hotspot
Definition: ui.h:659
int pressed()
Definition: button.cpp:325
char default_fiction_viewer_color
Definition: alphacolors.cpp:40
#define w(p)
Definition: modelsinc.h:68
#define KEY_ENTER
Definition: key.h:125
ui_button_info Fiction_viewer_buttons[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][NUM_FVW_BUTTONS]
void fiction_viewer_button_pressed(int button)
Definition: ui.h:428
UI_BUTTON button
Definition: ui.h:660
cfbp fp
Definition: cfile.cpp:1065
void audiostream_unpause(int i, bool via_sexp_or_script)
Definition: audiostr.cpp:1960
char * Fiction_viewer_screen_mask[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS]
int yt
Definition: ui.h:658
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
bool mission_has_fiction()
char font_filename[MAX_FILENAME_LEN]
Definition: fictionviewer.h:20
void common_music_do()
#define FVW_BUTTON_SCROLL_UP
#define vm_malloc(size)
Definition: pstypes.h:547
void set_hotkey(int keycode)
Definition: gadget.cpp:280
#define FVW_BUTTON_SCROLL_DOWN
void fiction_viewer_exit()
color Color_black
Definition: alphacolors.cpp:32
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
void audiostream_close_file(int i, int fade)
Definition: audiostr.cpp:1772
scroll pressed (and scroll)
Definition: gamesnd.h:296
char * Fiction_viewer_ui_names[NUM_FVW_SETTINGS]
void link_hotspot(int num)
Definition: gadget.cpp:50
int xt
Definition: ui.h:658
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
Definition: button.cpp:26
#define KEY_ESC
Definition: key.h:124
void fiction_viewer_do_frame(float frametime)
void fiction_viewer_close()
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
Definition: window.cpp:140
Definition: ui.h:584
screen gr_screen
Definition: 2d.cpp:46
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
int gr_get_font_height()
Definition: font.cpp:187
#define KEY_DEBUGGED
Definition: key.h:65
#define LOCATION
Definition: pstypes.h:245
void common_play_highlight_sound()
Definition: gamesnd.cpp:1151
void audiostream_play(int i, float volume, int looping)
Definition: audiostr.cpp:1803
#define KEY_CTRLED
Definition: key.h:64
char * filename
Definition: ui.h:657
int brief_render_text(int line_offset, int x, int y, int h, float frametime, int instance, int line_spacing)
#define CF_TYPE_FICTION
Definition: cfile.h:80
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
#define KEY_UP
Definition: key.h:179
#define NUM_FVW_BUTTONS
int audiostream_open(const char *filename, int type)
Definition: audiostr.cpp:1713
void audiostream_pause(int i, bool via_sexp_or_script)
Definition: audiostr.cpp:1943
int fiction_viewer_ui_name_to_index(const char *ui_name)
int Fiction_viewer_slider_coordinates[NUM_FVW_SETTINGS][GR_NUM_RESOLUTIONS][4]
void gamesnd_play_iface(int n)
Definition: gamesnd.cpp:260
int cfclose(CFILE *cfile)
Definition: cfile.cpp:895
void draw()
Definition: window.cpp:220
struct ui_button_info ui_button_info
void gr_set_font(int fontnum)
Definition: font.cpp:566
int process(int key_in=-1, int process_mouse=1)
Definition: window.cpp:401
void gameseq_post_event(int event)
#define stricmp(s1, s2)
Definition: config.h:271
int cfilelength(CFILE *cfile)
Definition: cfile.cpp:1393
void fiction_viewer_scroll_up()
float Master_voice_volume
Definition: sound.cpp:54
void common_music_init(int score_index)