46 int x_begin, y_begin, x_end,
y_end;
89 static int help_left_bracket_bitmap;
90 static int help_right_bracket_bitmap;
94 static int current_helpid = -1;
95 static int current_resolution = -1;
97 static int Source_game_state;
120 if (overlay_id < 0) {
133 (resolution_index >= 0) && (resolution_index < help_overlaylist[overlay_id].num_resolutions) ) {
136 current_helpid = overlay_id;
137 current_resolution = resolution_index;
152 (resolution_index >= 0) && (resolution_index < help_overlaylist[overlay_id].num_resolutions) ) {
201 switch (Source_game_state) {
271 nprintf((
"Warning",
"WARNING ==> There is no context help available for state %s\n",
GS_state_text[Source_game_state-1]));
276 if (overlay_id >= 0) {
288 if (help_overlaylist[overlay_id].textlist.size() > 0) {
300 help_right_bracket_bitmap =
bm_load(
"right_bracket");
302 Assertion( help_right_bracket_bitmap >= 0,
"Failed to load bitmap right_bracket for help overlay\n");
305 help_left_bracket_bitmap =
bm_load(
"left_bracket");
307 Assertion( help_left_bracket_bitmap >= 0,
"Failed to load bitmap left_bracket for help overlay\n");
323 int overlay_id, currcount, vtxcount;
350 if (overlay_id < 0) {
355 Error(
LOCATION,
"Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
362 strcpy_s(help_overlaylist[overlay_id].name, name);
369 help_overlaylist[overlay_id].
textcount = 0;
373 help_overlaylist[overlay_id].
fontlist.clear();
374 help_overlaylist[overlay_id].
plinelist.clear();
375 help_overlaylist[overlay_id].
textlist.clear();
380 stuff_int(&help_overlaylist[overlay_id].num_resolutions);
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);
394 help_overlaylist[overlay_id].
fontlist.push_back(font_index);
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);
412 while ((type =
required_string_one_of(5,
"+pline",
"+text",
"+right_bracket",
"+left_bracket",
"$end")) != 4) {
417 currcount = help_overlaylist[overlay_id].
plinecount;
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;
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;
440 currcount = help_overlaylist[overlay_id].
textcount;
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));
451 help_overlaylist[overlay_id].
textlist.at(0).at(currcount).string =
vm_strdup(buf);
453 help_overlaylist[overlay_id].
textcount++;
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));
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));
486 Assertion(
false,
"This should never happen.\n");
495 mprintf((
"TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
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;
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));
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);
525 for (idx = 0; idx < rbracketcount; idx++) {
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);
531 for (idx = 0; idx < lbracketcount; idx++) {
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);
539 for (idx = 0; idx<plinecount; idx++) {
549 DCF(help_reload,
"Reloads help overlay data from help.tbl")
552 dc_printf(
"Usage: sample\nCrashes your machine.\n" );
564 help_overlaylist[current_helpid].
textlist.at(current_resolution).at(textnum).x_coord += amount;
568 help_overlaylist[current_helpid].
textlist.at(current_resolution).at(textnum).y_coord += amount;
572 help_overlaylist[current_helpid].
plinelist.at(current_resolution).at(plinenum).vtx[plinevert].xyz.x += amount;
576 help_overlaylist[current_helpid].
plinelist.at(current_resolution).at(plinenum).vtx[plinevert].xyz.y += amount;
580 help_overlaylist[current_helpid].
rbracketlist.at(current_resolution).at(num).x_coord += amount;
584 help_overlaylist[current_helpid].
rbracketlist.at(current_resolution).at(num).y_coord += amount;
588 help_overlaylist[current_helpid].
lbracketlist.at(current_resolution).at(num).x_coord += amount;
592 help_overlaylist[current_helpid].
lbracketlist.at(current_resolution).at(num).y_coord += amount;
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 );
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 );
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 );
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 );
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);
616 DCF(help_nudgetext_x,
"Use to visually position overlay text.")
620 dc_printf(
"Usage: sample\nCrashes your machine.\n" );
635 DCF(help_nudgetext_y,
"Use to visually position overlay text.")
638 dc_printf(
"Usage: sample\nCrashes your machine.\n" );
653 DCF(help_nudgepline_x,
"Use to visually position overlay polylines.")
656 dc_printf(
"Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
673 DCF(help_nudgepline_y,
"Use to visually position overlay polylines.")
676 dc_printf(
"Usage: help_nudgepline [pline_number] [vertex_number] [distance]\n" );
693 DCF(help_nudgerbracket_x,
"Use to visually position overlay right bracket.")
696 dc_printf(
"Usage: help_nudgerbracket_x [num] [amount]\n" );
711 DCF(help_nudgerbracket_y,
"Use to visually position overlay right bracket.")
714 dc_printf(
"Usage: help_nudgerbracket_y [num] [amount]\n" );
732 DCF(help_nudgelbracket_x,
"Use to visually position overlay left bracket.")
736 dc_printf(
"Usage: help_nudgelbracket_x [num] [amount]\n" );
751 DCF(help_nudgelbracket_y,
"Use to visually position overlay left bracket.")
754 dc_printf(
"Usage: help_nudgelbracket_y [num] [amount]\n" );
void gr_rect(int x, int y, int w, int h, int resize_mode)
void nudgelbracket_y(int num, int amount)
void nudgetext_x(int textnum, int amount)
void nudgepline_x(int plinenum, int plinevert, int amount)
int Multi_join_overlay_id
int Multi_create_overlay_id
SCP_vector< int > fontlist
int required_string_one_of(int arg_count,...)
Checks for one of any of the given required strings.
int main_hall_get_overlay_resolution_index()
int Control_config_overlay_id
int gameseq_get_state(void)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
SCP_vector< SCP_vector< help_text > > textlist
void showtextpos(int textnum)
void showlbracketpos(int num)
#define Assertion(expr, msg,...)
void gr_pline_special(SCP_vector< vec3d > *pts, int thickness, int resize_mode)
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)
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define HELP_PLINE_THICKNESS
#define HELP_MAX_STRING_LENGTH
void gr_set_color(int r, int g, int b)
void nudgetext_y(int textnum, int amount)
void nudgepline_y(int plinenum, int plinevert, int amount)
#define HELP_OVERLAY_FILENAME
GLboolean GLboolean GLboolean GLboolean a
void parse_helptbl(const char *filename)
void stuff_string(char *outstr, int type, int len, char *terminators)
void gr_shade(int x, int y, int w, int h, int resize_mode)
void showplinepos(int plinenum)
int required_string(const char *pstr)
int optional_string(const char *pstr)
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)
SCP_vector< SCP_vector< help_left_bracket > > lbracketlist
#define HELP_MAX_NAME_LENGTH
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void reset_parse(char *text)
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
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
GLboolean GLboolean GLboolean b
int Campaign_room_overlay_id
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)()
void context_help_grey_screen()
GLint GLsizei GLsizei height
int Weapon_select_overlay_id
void create_grey_shader()
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
SCP_vector< SCP_vector< help_pline > > plinelist
void help_overlay_reset_all()
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void nudgerbracket_x(int num, int amount)
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
void gr_bitmap(int _x, int _y, int resize_mode)
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
#define MAX_HELP_OVERLAYS
void showrbracketpos(int num)
void gr_create_shader(shader *shade, ubyte r, ubyte g, ubyte b, ubyte c)
SCP_vector< SCP_vector< help_right_bracket > > rbracketlist
void launch_context_help()
void gr_set_font(int fontnum)
void gr_set_shader(shader *shade)
int help_overlay_get_index(const char *overlay_name)
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
void gameseq_post_event(int event)
void nudgelbracket_x(int num, int amount)
void help_overlay_maybe_blit(int overlay_id, int resolution_index)
int skip_to_string(char *pstr, char *end)
int help_overlay_active(int overlay_id)
void nudgerbracket_y(int num, int amount)