/* * Copyright (C) Volition, Inc. 1999. All rights reserved. * * All source code herein is the property of Volition, Inc. You may not sell * or otherwise commercially exploit the source or things you created based on the * source. * */ #include #include #include "gamehelp/contexthelp.h" #include "gamesequence/gamesequence.h" #include "menuui/mainhallmenu.h" #include "graphics/2d.h" #include "parse/parselo.h" #include "localization/localize.h" #include "globalincs/alphacolors.h" #include "globalincs/systemvars.h" //////////////////////////////////////////////////////////////////// // private function prototypes / structs //////////////////////////////////////////////////////////////////// void parse_helptbl(); void help_overlay_blit(int overlay_id); void help_overlay_init(); typedef struct { int x_begin, y_begin, x_end, y_end; } help_line; typedef struct { vec3d vtx[HELP_MAX_PLINE_VERTICES]; vec3d *pvtx[HELP_MAX_PLINE_VERTICES]; int vtxcount; } help_pline; typedef struct { int x_coord, y_coord; char* string; } help_text; typedef struct { int x_coord, y_coord; } help_left_bracket; typedef struct { int x_coord, y_coord; } help_right_bracket; typedef struct { help_pline plinelist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM]; help_text textlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM]; help_left_bracket lbracketlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM]; help_right_bracket rbracketlist[GR_NUM_RESOLUTIONS][HELP_MAX_ITEM]; int plinecount; int textcount; int lbracketcount; int rbracketcount; } help_overlay; // new help.tbl file way char *help_overlay_section_names[MAX_HELP_OVERLAYS] = { "$ship", // ship_help "$weapon", // weapon_help "$briefing", // briefing "$main", // main help overlay "$barracks", // barracks "$control", // control help "$debrief", // debrief help "$multicreate", // multicreate help "$multistart", // multistart help "$multijoin", // multijoin help "$main2", // main help overlay2 "$hotkey", // hotkey help "$campaign", // campaign help "$simulator", // simulator help "$tech", // tech help "$command" // command help }; //////////////////////////////////////////////////////////////////// // Game-wide globals //////////////////////////////////////////////////////////////////// shader Grey_shader; //////////////////////////////////////////////////////////////////// // Module globals //////////////////////////////////////////////////////////////////// static int help_left_bracket_bitmap; static int help_right_bracket_bitmap; static help_overlay help_overlaylist[MAX_HELP_OVERLAYS]; static int current_helpid = -1; // the currently active overlay_id, only really used for the debug console funxions int Help_overlay_flags; static int Source_game_state; // state from where F1 was pressed //////////////////////////////////////////////////////////////////// // Public Functions //////////////////////////////////////////////////////////////////// // query whether a help overlay is active (ie being displayed) int help_overlay_active(int overlay_id) { Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); return Help_overlay_flags & (1<= 0 && overlay_id < MAX_HELP_OVERLAYS); if ( state > 0 ) { Help_overlay_flags |= (1<= 0 && overlay_id < MAX_HELP_OVERLAYS); if ( Help_overlay_flags & (1< There is no context help available for state %s\n", GS_state_text[Source_game_state-1])); break; } // end switch } void close_help(){ for (int overlay_id=0; overlay_id= 0 && overlay_id < MAX_HELP_OVERLAYS); // this draws each line of help text with white on black text (use the GR_640 index for the string) for (idx = 0; idx < textcount; idx++) { gr_set_color_fast(&Color_black); gr_get_string_size(&width, &height, help_overlaylist[overlay_id].textlist[GR_640][idx].string, strlen(help_overlaylist[overlay_id].textlist[GR_640][idx].string)); gr_rect(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord-2*HELP_PADDING, help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord-3*HELP_PADDING, width+4*HELP_PADDING, height+4*HELP_PADDING); gr_set_color_fast(&Color_bright_white); gr_printf(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord, help_overlaylist[overlay_id].textlist[GR_640][idx].string); } // this draws each right bracket for (idx = 0; idx < rbracketcount; idx++) { gr_set_bitmap(help_right_bracket_bitmap); gr_bitmap(help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].y_coord); } // this draws each left bracket for (idx = 0; idx < lbracketcount; idx++) { gr_set_bitmap(help_left_bracket_bitmap); gr_bitmap(help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].x_coord, help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].y_coord); } // this draws each 2d line for the help screen //gr_set_color_fast(&Color_yellow); gr_set_color(255, 255, 0); for (idx = 0; idx