FS2_Open
Open source remastering of the Freespace 2 engine
contexthelp.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 #include <string.h>
12 #include <setjmp.h>
13 
15 #include "debugconsole/console.h"
16 #include "gamehelp/contexthelp.h"
18 #include "globalincs/alphacolors.h"
19 #include "globalincs/systemvars.h"
20 #include "graphics/2d.h"
21 #include "localization/localize.h"
22 #include "menuui/barracks.h"
23 #include "menuui/mainhallmenu.h"
24 #include "menuui/readyroom.h"
25 #include "menuui/techmenu.h"
26 #include "mission/missionhotkey.h"
27 #include "missionui/missionbrief.h"
32 #include "network/multiui.h"
33 #include "parse/parselo.h"
34 
35 
36 
38 // private function prototypes / structs
40 void parse_helptbl(const char *filename);
41 void help_overlay_blit(int overlay_id, int resolution_index);
42 void help_overlay_init();
43 
44 
45 typedef struct {
46  int x_begin, y_begin, x_end, y_end;
47 } help_line;
48 
49 typedef struct {
51  int vtxcount;
52 } help_pline;
53 
54 typedef struct {
55  int x_coord, y_coord;
56  char* string;
57 } help_text;
58 
59 typedef struct {
60  int x_coord, y_coord;
62 
63 typedef struct {
64  int x_coord, y_coord;
66 
67 typedef struct {
76  int textcount;
79 } help_overlay;
80 
82 // Game-wide globals
85 
87 // Module globals
89 static int help_left_bracket_bitmap;
90 static int help_right_bracket_bitmap;
91 static help_overlay help_overlaylist[MAX_HELP_OVERLAYS];
93 
94 static int current_helpid = -1; // the currently active overlay_id, only really used for the debug console funxions
95 static int current_resolution = -1;
97 static int Source_game_state; // state from where F1 was pressed
98 
100 // Public Functions
102 
103 
104 int help_overlay_get_index(const char* overlay_name)
105 {
106  for (int i = 0; i < num_help_overlays; i++) {
107  if (!stricmp(overlay_name, help_overlaylist[i].name)) {
108  return i;
109  }
110  }
111 
112  return -1;
113 }
114 
115 // query whether a help overlay is active (ie being displayed)
116 int help_overlay_active(int overlay_id)
117 {
118  Assert(overlay_id < MAX_HELP_OVERLAYS);
119 
120  if (overlay_id < 0) {
121  return 0;
122  }
123 
124  return Help_overlay_flags & (1<<overlay_id);
125 }
126 
127 // stop displaying a help overlay
128 void help_overlay_set_state(int overlay_id, int resolution_index, int state)
129 {
130  Assert(overlay_id < MAX_HELP_OVERLAYS);
131 
132  if ( (overlay_id >= 0) && (overlay_id < num_help_overlays) &&
133  (resolution_index >= 0) && (resolution_index < help_overlaylist[overlay_id].num_resolutions) ) {
134  if ( state > 0 ) {
135  Help_overlay_flags |= (1<<overlay_id);
136  current_helpid = overlay_id;
137  current_resolution = resolution_index;
138  } else {
139  Help_overlay_flags &= ~(1<<overlay_id);
140  //current_helpid = -1;
141  }
142  }
143 
144 }
145 
146 // maybe blit a bitmap of a help overlay to the screen
147 void help_overlay_maybe_blit(int overlay_id, int resolution_index)
148 {
149  Assert(overlay_id < MAX_HELP_OVERLAYS);
150 
151  if ( (overlay_id >= 0) && (Help_overlay_flags & (1<<overlay_id)) &&
152  (resolution_index >= 0) && (resolution_index < help_overlaylist[overlay_id].num_resolutions) ) {
154  help_overlay_blit(overlay_id, resolution_index);
155  }
156 }
157 
158 // reset the flags for the help overlays
160 {
161  Help_overlay_flags = 0;
162 }
163 
164 // Set up Grey_shader, which is used game-wide to grey out background when using help overlays
166 {
167  /*float tmp,c;
168 
169  tmp = 0.4f/3.0f;
170 
171  // The c matrix brightens everything a bit.
172 // c = 0.125f;
173  c = 0.110f;*/
174 
175  gr_create_shader( &Grey_shader, 34, 34, 34, 168 );
176 }
177 
178 // called at game startup to init all help related data
180 {
184 }
185 
187 {
188  gr_set_shader(&Grey_shader);
190 }
191 
192 // launch_context_help() will switch to a context sensitive help state
194 {
195  int overlay_id = -1;
196  int resolution_index = gr_screen.res;
197 
198  // look at the state the game was in when F1 was pressed
199  Source_game_state = gameseq_get_state();
200 
201  switch (Source_game_state) {
202 
203  case GS_STATE_MAIN_MENU:
204  overlay_id = main_hall_get_overlay_id();
205  resolution_index = main_hall_get_overlay_resolution_index();
206  break;
207 
208  case GS_STATE_GAME_PLAY:
212  break;
213 
214  case GS_STATE_BRIEFING:
215  overlay_id = Briefing_overlay_id;
216  break;
217 
219  overlay_id = Ship_select_overlay_id;
220  break;
221 
223  overlay_id = Weapon_select_overlay_id;
224  break;
225 
227  overlay_id = Barracks_overlay_id;
228  break;
229 
231  overlay_id = Control_config_overlay_id;
232  break;
233 
234  case GS_STATE_DEBRIEF:
235  overlay_id = Debrief_overlay_id;
236  break;
237 
239  overlay_id = Multi_create_overlay_id;
240  break;
241 
243  overlay_id = Multi_sg_overlay_id;
244  break;
245 
247  overlay_id = Multi_join_overlay_id;
248  break;
249 
251  overlay_id = Hotkey_overlay_id;
252  break;
253 
255  overlay_id = Campaign_room_overlay_id;
256  break;
257 
259  overlay_id = Sim_room_overlay_id;
260  break;
261 
262  case GS_STATE_TECH_MENU:
263  overlay_id = Techroom_overlay_id;
264  break;
265 
266  case GS_STATE_CMD_BRIEF:
267  overlay_id = Cmd_brief_overlay_id;
268  break;
269 
270  default:
271  nprintf(("Warning","WARNING ==> There is no context help available for state %s\n", GS_state_text[Source_game_state-1]));
272  break;
273 
274  } // end switch
275 
276  if (overlay_id >= 0) {
277  if ( !help_overlay_active(overlay_id) ) {
278  help_overlay_set_state(overlay_id, resolution_index, 1);
279  }
280  else {
281  help_overlay_set_state(overlay_id, resolution_index, 0);
282  }
283  }
284 }
285 
286 void close_help(){
287  for (int overlay_id=0; overlay_id<MAX_HELP_OVERLAYS; overlay_id++){
288  if (help_overlaylist[overlay_id].textlist.size() > 0) {
289  for(SCP_vector<help_text>::iterator ii = help_overlaylist[overlay_id].textlist.at(0).begin(); ii != help_overlaylist[overlay_id].textlist.at(0).end(); ++ii) {
290  safe_kill(ii->string);
291  }
292  }
293  }
294 }
295 
296 // Called once at the beginning of the game to load help bitmaps & data
298 {
299  // load right_bracket bitmap
300  help_right_bracket_bitmap = bm_load("right_bracket");
301  // we failed to load the bitmap - this is very bad
302  Assertion( help_right_bracket_bitmap >= 0, "Failed to load bitmap right_bracket for help overlay\n");
303 
304  // load left_bracket bitmap
305  help_left_bracket_bitmap = bm_load("left_bracket");
306  // we failed to load the bitmap - this is very bad
307  Assertion( help_left_bracket_bitmap >= 0, "Failed to load bitmap left_bracket for help overlay\n");
308 
309  atexit(close_help);
310 
311  num_help_overlays = 0;
312 
313  // parse help.tbl
315 
316  // look for any modular tables
317  parse_modular_table(NOX("*-hlp.tbm"), parse_helptbl);
318 }
319 
320 // parses help.tbl and populates help_overlaylist[]
321 void parse_helptbl(const char *filename)
322 {
323  int overlay_id, currcount, vtxcount;
325  char buf[HELP_MAX_STRING_LENGTH + 1];
326  int i, j;
327 
328  SCP_vector<help_pline> pline_temp;
329  help_pline pline_temp2;
330  SCP_vector<help_text> text_temp;
331  help_text text_temp2;
332  SCP_vector<help_right_bracket> rbracket_temp;
333  help_right_bracket rbracket_temp2;
334  SCP_vector<help_left_bracket> lbracket_temp;
335  help_left_bracket lbracket_temp2;
336  vec3d vec3d_temp;
337 
338  try
339  {
340  read_file_text(filename, CF_TYPE_TABLES);
341  reset_parse();
342 
343  // for each overlay...
344  while (optional_string("$")) {
345 
347 
348  overlay_id = help_overlay_get_index(name);
349 
350  if (overlay_id < 0) {
352  Warning(LOCATION, "Could not load help overlay '%s' as maximum number of help overlays was reached (Max is %d)", name, MAX_HELP_OVERLAYS);
353 
354  if (!skip_to_string("$end")) {
355  Error(LOCATION, "Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
356  }
357 
358  continue;
359  }
360  else {
361  overlay_id = num_help_overlays;
362  strcpy_s(help_overlaylist[overlay_id].name, name);
364  }
365  }
366 
367  // clear out counters in the overlay struct
368  help_overlaylist[overlay_id].plinecount = 0;
369  help_overlaylist[overlay_id].textcount = 0;
370  help_overlaylist[overlay_id].rbracketcount = 0;
371  help_overlaylist[overlay_id].lbracketcount = 0;
372 
373  help_overlaylist[overlay_id].fontlist.clear();
374  help_overlaylist[overlay_id].plinelist.clear();
375  help_overlaylist[overlay_id].textlist.clear();
376  help_overlaylist[overlay_id].rbracketlist.clear();
377  help_overlaylist[overlay_id].lbracketlist.clear();
378 
379  if (optional_string("+resolutions")) {
380  stuff_int(&help_overlaylist[overlay_id].num_resolutions);
381  }
382  else {
383  help_overlaylist[overlay_id].num_resolutions = 2;
384  }
385 
386  if (help_overlaylist[overlay_id].num_resolutions < 1) {
387  Error(LOCATION, "+resolutions in %s is %d. (Must be 1 or greater)", filename, help_overlaylist[overlay_id].num_resolutions);
388  }
389 
390  if (optional_string("+font")) {
391  int font_index;
392  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
393  stuff_int(&font_index);
394  help_overlaylist[overlay_id].fontlist.push_back(font_index);
395  }
396  }
397  else {
398  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
399  help_overlaylist[overlay_id].fontlist.push_back(FONT1);
400  }
401  }
402 
403  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
404  help_overlaylist[overlay_id].plinelist.push_back(pline_temp);
405  help_overlaylist[overlay_id].textlist.push_back(text_temp);
406  help_overlaylist[overlay_id].rbracketlist.push_back(rbracket_temp);
407  help_overlaylist[overlay_id].lbracketlist.push_back(lbracket_temp);
408  }
409 
410  int type;
411  // read in all elements for this overlay
412  while ((type = required_string_one_of(5, "+pline", "+text", "+right_bracket", "+left_bracket", "$end")) != 4) { // Doing it this way means an error lists "$end" at the end, which seems appropriate. -MageKing17
413 
414  switch (type) {
415  case 0: // +pline
416  required_string("+pline");
417  currcount = help_overlaylist[overlay_id].plinecount;
418  int a, b; // temp vars to read in int before cast to float;
419 
420  // read number of pline vertices
421  stuff_int(&vtxcount);
422  // get vertex coordinates for each resolution
423  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
424  help_overlaylist[overlay_id].plinelist.at(i).push_back(pline_temp2);
425  for (j = 0; j < vtxcount; j++) {
426  help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.push_back(vec3d_temp);
427  help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtxcount = vtxcount;
428  stuff_int(&a);
429  stuff_int(&b);
430  help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.x = (float)a;
431  help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.y = (float)b;
432  help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.z = 0.0f;
433  }
434  }
435 
436  help_overlaylist[overlay_id].plinecount++;
437  break;
438  case 1: // +text
439  required_string("+text");
440  currcount = help_overlaylist[overlay_id].textcount;
441 
442  // get coordinates for each resolution
443  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
444  help_overlaylist[overlay_id].textlist.at(i).push_back(text_temp2);
445  stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).x_coord));
446  stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).y_coord));
447  }
448 
449  // get string (always use the first resolution)
450  stuff_string(buf, F_MESSAGE, sizeof(buf));
451  help_overlaylist[overlay_id].textlist.at(0).at(currcount).string = vm_strdup(buf);
452 
453  help_overlaylist[overlay_id].textcount++;
454  break;
455  case 2: // +right_bracket
456  required_string("+right_bracket");
457  currcount = help_overlaylist[overlay_id].rbracketcount;
458 
459  // get coordinates for each resolution
460  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
461  help_overlaylist[overlay_id].rbracketlist.at(i).push_back(rbracket_temp2);
462  stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).x_coord));
463  stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).y_coord));
464  }
465 
466  help_overlaylist[overlay_id].rbracketcount++;
467  break;
468  case 3: // +left_bracket
469  required_string("+left_bracket");
470  currcount = help_overlaylist[overlay_id].lbracketcount;
471 
472  // get coordinates for each resolution
473  for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
474  help_overlaylist[overlay_id].lbracketlist.at(i).push_back(lbracket_temp2);
475  stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).x_coord));
476  stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).y_coord));
477  }
478 
479  help_overlaylist[overlay_id].lbracketcount++;
480  break;
481  case -1:
482  // -noparseerrors is set
483  break;
484  case 4: // $end
485  default:
486  Assertion(false, "This should never happen.\n");
487  break;
488  }
489  } // end while
490  required_string("$end");
491  } // end while
492  }
493  catch (const parse::ParseException& e)
494  {
495  mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
496  return;
497  }
498 }
499 
500 
501 
502 // draw overlay on the screen
503 void help_overlay_blit(int overlay_id, int resolution_index)
504 {
505  int idx, width, height;
506  int plinecount = help_overlaylist[overlay_id].plinecount;
507  int textcount = help_overlaylist[overlay_id].textcount;
508  int rbracketcount = help_overlaylist[overlay_id].rbracketcount;
509  int lbracketcount = help_overlaylist[overlay_id].lbracketcount;
510 
511  Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);
512 
513  // this draws each line of help text with white on black text (use the first resolution index for the string)
514  gr_set_font(help_overlaylist[overlay_id].fontlist.at(resolution_index));
515  for (idx = 0; idx < textcount; idx++) {
517  gr_get_string_size(&width, &height, help_overlaylist[overlay_id].textlist.at(0).at(idx).string, strlen(help_overlaylist[overlay_id].textlist.at(0).at(idx).string));
518  gr_rect(help_overlaylist[overlay_id].textlist.at(resolution_index).at(idx).x_coord-2*HELP_PADDING, help_overlaylist[overlay_id].textlist.at(resolution_index).at(idx).y_coord-3*HELP_PADDING, width+4*HELP_PADDING, height+4*HELP_PADDING, GR_RESIZE_MENU);
520  gr_printf_menu(help_overlaylist[overlay_id].textlist.at(resolution_index).at(idx).x_coord, help_overlaylist[overlay_id].textlist.at(resolution_index).at(idx).y_coord, help_overlaylist[overlay_id].textlist.at(0).at(idx).string);
521  }
523 
524  // this draws each right bracket
525  for (idx = 0; idx < rbracketcount; idx++) {
526  gr_set_bitmap(help_right_bracket_bitmap);
527  gr_bitmap(help_overlaylist[overlay_id].rbracketlist.at(resolution_index).at(idx).x_coord, help_overlaylist[overlay_id].rbracketlist.at(resolution_index).at(idx).y_coord, GR_RESIZE_MENU);
528  }
529 
530  // this draws each left bracket
531  for (idx = 0; idx < lbracketcount; idx++) {
532  gr_set_bitmap(help_left_bracket_bitmap);
533  gr_bitmap(help_overlaylist[overlay_id].lbracketlist.at(resolution_index).at(idx).x_coord, help_overlaylist[overlay_id].lbracketlist.at(resolution_index).at(idx).y_coord, GR_RESIZE_MENU);
534  }
535 
536  // this draws each 2d line for the help screen
537  //gr_set_color_fast(&Color_yellow);
538  gr_set_color(255, 255, 0);
539  for (idx = 0; idx<plinecount; idx++) {
540  gr_pline_special(&help_overlaylist[overlay_id].plinelist.at(resolution_index).at(idx).vtx, HELP_PLINE_THICKNESS, GR_RESIZE_MENU);
541  }
542 }
543 
544 
545 // --------------------------------------------------
546 // DEBUGGING STUFF
547 // --------------------------------------------------
548 // z64: These DCF's really need a do-over.
549 DCF(help_reload, "Reloads help overlay data from help.tbl")
550 {
551  if (dc_optional_string_either("help", "--help")) {
552  dc_printf( "Usage: sample\nCrashes your machine.\n" );
553  }
554 
555  num_help_overlays = 0;
557  parse_modular_table(NOX("*-hlp.tbm"), parse_helptbl);
558 }
559 
560 int h_textnum=0, h_amt=0, h_vtx = 0;
561 
562 void nudgetext_x(int textnum, int amount)
563 {
564  help_overlaylist[current_helpid].textlist.at(current_resolution).at(textnum).x_coord += amount;
565 }
566 void nudgetext_y(int textnum, int amount)
567 {
568  help_overlaylist[current_helpid].textlist.at(current_resolution).at(textnum).y_coord += amount;
569 }
570 void nudgepline_x(int plinenum, int plinevert, int amount)
571 {
572  help_overlaylist[current_helpid].plinelist.at(current_resolution).at(plinenum).vtx[plinevert].xyz.x += amount;
573 }
574 void nudgepline_y(int plinenum, int plinevert, int amount)
575 {
576  help_overlaylist[current_helpid].plinelist.at(current_resolution).at(plinenum).vtx[plinevert].xyz.y += amount;
577 }
578 void nudgerbracket_x(int num, int amount)
579 {
580  help_overlaylist[current_helpid].rbracketlist.at(current_resolution).at(num).x_coord += amount;
581 }
582 void nudgerbracket_y(int num, int amount)
583 {
584  help_overlaylist[current_helpid].rbracketlist.at(current_resolution).at(num).y_coord += amount;
585 }
586 void nudgelbracket_x(int num, int amount)
587 {
588  help_overlaylist[current_helpid].lbracketlist.at(current_resolution).at(num).x_coord += amount;
589 }
590 void nudgelbracket_y(int num, int amount)
591 {
592  help_overlaylist[current_helpid].lbracketlist.at(current_resolution).at(num).y_coord += amount;
593 }
594 void showtextpos(int textnum)
595 {
596  dc_printf("text %d is now located at (%d, %d)", textnum, help_overlaylist[current_helpid].textlist.at(current_resolution).at(textnum).x_coord, help_overlaylist[current_helpid].textlist.at(current_resolution).at(textnum).y_coord );
597 }
599 {
600  dc_printf("rbracket %d is now located at (%d, %d)", num, help_overlaylist[current_helpid].rbracketlist.at(current_resolution).at(num).x_coord, help_overlaylist[current_helpid].rbracketlist.at(current_resolution).at(num).y_coord );
601 }
603 {
604  dc_printf("lbracket %d on overlay %d is now located at (%d, %d)", num, current_helpid, help_overlaylist[current_helpid].lbracketlist.at(current_resolution).at(num).x_coord, help_overlaylist[current_helpid].lbracketlist.at(current_resolution).at(num).y_coord );
605 }
606 void showplinepos(int plinenum)
607 {
608  int i;
609  dc_printf("pline %d on overlay %d vertices are now ", plinenum, current_helpid, help_overlaylist[current_helpid].textlist.at(current_resolution).at(plinenum).y_coord );
610  for (i=0; i<help_overlaylist[current_helpid].plinelist.at(gr_screen.res).at(plinenum).vtxcount; i++)
611  {
612  dc_printf("(%3.0f %3.0f) ", help_overlaylist[current_helpid].plinelist.at(current_resolution).at(plinenum).vtx.at(i).xyz.x, help_overlaylist[current_helpid].plinelist.at(current_resolution).at(plinenum).vtx.at(i).xyz.y);
613  }
614 }
615 
616 DCF(help_nudgetext_x, "Use to visually position overlay text.")
617 {
618 
619  if (dc_optional_string_either("help", "--help")) {
620  dc_printf( "Usage: sample\nCrashes your machine.\n" );
621  return;
622  }
623 
624  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
626  return;
627  }
628 
631 
633 }
634 
635 DCF(help_nudgetext_y, "Use to visually position overlay text.")
636 {
637  if (dc_optional_string_either("help", "--help")) {
638  dc_printf( "Usage: sample\nCrashes your machine.\n" );
639  return;
640  }
641 
642  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
644  return;
645  }
646 
649 
651 }
652 
653 DCF(help_nudgepline_x, "Use to visually position overlay polylines.")
654 {
655  if (dc_optional_string_either("help", "--help")) {
656  dc_printf( "Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
657  return;
658  }
659 
660  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
662  return;
663  }
664 
668 
670 }
671 
672 
673 DCF(help_nudgepline_y, "Use to visually position overlay polylines.")
674 {
675  if (dc_optional_string_either("help", "--help")) {
676  dc_printf( "Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
677  return;
678  }
679 
680  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
682  return;
683  }
684 
688 
690 }
691 
692 
693 DCF(help_nudgerbracket_x, "Use to visually position overlay right bracket.")
694 {
695  if (dc_optional_string_either("help", "--help")) {
696  dc_printf( "Usage: help_nudgerbracket_x [num] [amount]\n" );
697  return;
698  }
699 
700  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
702  return;
703  }
704 
707 
709 }
710 
711 DCF(help_nudgerbracket_y, "Use to visually position overlay right bracket.")
712 {
713  if (dc_optional_string_either("help", "--help")) {
714  dc_printf( "Usage: help_nudgerbracket_y [num] [amount]\n" );
715  return;
716  }
717 
718  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
720  return;
721  }
722 
725 
727 }
728 
729 
730 
731 
732 DCF(help_nudgelbracket_x, "Use to visually position overlay left bracket.")
733 {
734 
735  if (dc_optional_string_either("help", "--help")) {
736  dc_printf( "Usage: help_nudgelbracket_x [num] [amount]\n" );
737  return;
738  }
739 
740  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
742  return;
743  }
744 
747 
749 }
750 
751 DCF(help_nudgelbracket_y, "Use to visually position overlay left bracket.")
752 {
753  if (dc_optional_string_either("help", "--help")) {
754  dc_printf( "Usage: help_nudgelbracket_y [num] [amount]\n" );
755  return;
756  }
757 
758  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
760  return;
761  }
762 
765 
767 }
void gr_rect(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2068
void nudgelbracket_y(int num, int amount)
shader Grey_shader
Definition: contexthelp.cpp:84
void nudgetext_x(int textnum, int amount)
void nudgepline_x(int plinenum, int plinevert, int amount)
int i
Definition: multi_pxo.cpp:466
SCP_vector< vec3d > vtx
Definition: contexthelp.cpp:50
int Multi_join_overlay_id
Definition: multiui.cpp:735
int Multi_create_overlay_id
Definition: multiui.cpp:3329
SCP_vector< int > fontlist
Definition: contexthelp.cpp:70
#define GR_RESIZE_MENU
Definition: 2d.h:684
int required_string_one_of(int arg_count,...)
Checks for one of any of the given required strings.
Definition: parselo.cpp:708
int main_hall_get_overlay_resolution_index()
int Barracks_overlay_id
Definition: barracks.cpp:293
int Control_config_overlay_id
int Briefing_overlay_id
int gameseq_get_state(void)
Definition: fredstubs.cpp:60
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Assert(pm!=NULL)
SCP_vector< SCP_vector< help_text > > textlist
Definition: contexthelp.cpp:72
Definition: pstypes.h:88
#define mprintf(args)
Definition: pstypes.h:238
int h_vtx
int res
Definition: 2d.h:370
void showtextpos(int textnum)
void showlbracketpos(int num)
#define Assertion(expr, msg,...)
Definition: clang.h:41
Definition: 2d.h:82
void gr_pline_special(SCP_vector< vec3d > *pts, int thickness, int resize_mode)
Definition: 2d.cpp:1471
int main_hall_get_overlay_id()
int Ship_select_overlay_id
void help_overlay_set_state(int overlay_id, int resolution_index, int state)
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
#define GR_RESIZE_NONE
Definition: 2d.h:681
#define HELP_PLINE_THICKNESS
Definition: contexthelp.h:42
int clip_height
Definition: 2d.h:378
GLenum type
Definition: Gl.h:1492
GLint GLsizei width
Definition: Gl.h:1505
#define HELP_MAX_STRING_LENGTH
Definition: contexthelp.h:41
void gr_set_color(int r, int g, int b)
Definition: 2d.cpp:1188
char * GS_state_text[]
void nudgetext_y(int textnum, int amount)
void nudgepline_y(int plinenum, int plinevert, int amount)
#define HELP_OVERLAY_FILENAME
Definition: contexthelp.h:43
#define nprintf(args)
Definition: pstypes.h:239
void help_overlay_init()
char * string
Definition: contexthelp.cpp:56
GLboolean GLboolean GLboolean GLboolean a
Definition: Glext.h:5781
void parse_helptbl(const char *filename)
char * filename
void stuff_string(char *outstr, int type, int len, char *terminators)
Definition: parselo.cpp:1189
int Multi_sg_overlay_id
Definition: multiui.cpp:2253
#define CF_TYPE_TABLES
Definition: cfile.h:50
void gr_shade(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2085
void context_help_init()
void showplinepos(int plinenum)
#define vm_strdup(ptr)
Definition: pstypes.h:549
int required_string(const char *pstr)
Definition: parselo.cpp:468
int optional_string(const char *pstr)
Definition: parselo.cpp:539
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
Definition: parselo.cpp:1995
SCP_vector< SCP_vector< help_left_bracket > > lbracketlist
Definition: contexthelp.cpp:73
int idx
Definition: multiui.cpp:761
int Cmd_brief_overlay_id
#define HELP_MAX_NAME_LENGTH
Definition: contexthelp.h:40
#define F_MESSAGE
Definition: parselo.h:42
#define NOX(s)
Definition: pstypes.h:473
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int h_amt
void reset_parse(char *text)
Definition: parselo.cpp:3305
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
GLuint const GLchar * name
Definition: Glext.h:5608
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
int Campaign_room_overlay_id
Definition: readyroom.cpp:225
void stuff_int(int *i)
Definition: parselo.cpp:2372
DCF(help_reload,"Reloads help overlay data from help.tbl")
void help_overlay_blit(int overlay_id, int resolution_index)
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
GLuint GLuint num
Definition: Glext.h:9089
int num_help_overlays
Definition: contexthelp.cpp:92
color Color_bright_white
Definition: alphacolors.cpp:32
#define FONT1
Definition: font.h:65
void context_help_grey_screen()
GLint GLsizei GLsizei height
Definition: Gl.h:1505
int Weapon_select_overlay_id
void create_grey_shader()
int Help_overlay_flags
Definition: contexthelp.cpp:96
int clip_width
Definition: 2d.h:378
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
SCP_vector< SCP_vector< help_pline > > plinelist
Definition: contexthelp.cpp:71
void help_overlay_reset_all()
#define F_NAME
Definition: parselo.h:34
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
#define LOCATION
Definition: pstypes.h:245
void nudgerbracket_x(int num, int amount)
int Techroom_overlay_id
Definition: techmenu.cpp:218
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
Definition: parselo.cpp:4205
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
int Debrief_overlay_id
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
Definition: console.cpp:358
#define MAX_HELP_OVERLAYS
Definition: contexthelp.h:19
void showrbracketpos(int num)
void gr_create_shader(shader *shade, ubyte r, ubyte g, ubyte b, ubyte c)
Definition: 2d.cpp:1211
SCP_vector< SCP_vector< help_right_bracket > > rbracketlist
Definition: contexthelp.cpp:74
int Hotkey_overlay_id
int h_textnum
#define safe_kill(a)
Definition: systemvars.h:261
void launch_context_help()
void gr_set_font(int fontnum)
Definition: font.cpp:566
void gr_set_shader(shader *shade)
Definition: 2d.cpp:1220
int help_overlay_get_index(const char *overlay_name)
void close_help()
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
Definition: font.cpp:314
void gameseq_post_event(int event)
void nudgelbracket_x(int num, int amount)
#define stricmp(s1, s2)
Definition: config.h:271
void help_overlay_maybe_blit(int overlay_id, int resolution_index)
int skip_to_string(char *pstr, char *end)
Definition: parselo.cpp:375
int help_overlay_active(int overlay_id)
#define HELP_PADDING
Definition: contexthelp.h:39
void nudgerbracket_y(int num, int amount)
#define strcpy_s(...)
Definition: safe_strings.h:67
int Sim_room_overlay_id
Definition: readyroom.cpp:224