1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  *
4  * Copyright 1997,1998 Enlight Software Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 //Filename    : OHELP.H
22 //Description : Header file of object Help
23 
24 #ifndef __OHELP_H
25 #define __OHELP_H
26 
27 
28 //----------- Define constant -------------//
29 
30 enum { NO_HELP, BRIEF_HELP, DETAIL_HELP };	 	// for config.help_mode
31 
32 enum { MAX_HELP_INFO=200 };     // Maximum no. of help info allowed
33 
34 //------------------------------------------//
35 //
36 // Structure of the HELP.RES :
37 //
38 // <Area X1>, <Area Y1>, <Area X2>, <Area Y2>
39 // <Help Title>
40 // <Help Text>
41 //
42 // <Page Break Code, CTRL-L>
43 //
44 // <Area X1>, <Area Y1>, <Area X2>, <Area Y2>
45 // <Help Title>
46 // <Help Text>
47 //      .
48 //		  .
49 // (Another help block, continue)
50 //
51 //------------------------------------------//
52 
53 //---------- Define struct HelpInfo ------------//
54 
55 struct HelpInfo
56 {
57 	enum { HELP_CODE_LEN=8, HELP_TITLE_LEN=60 };
58 
59 	char  help_code[HELP_CODE_LEN+1];			// either identify the help message by help code or area position
60 	short area_x1, area_y1, area_x2, area_y2;
61 
62 	char  help_title[HELP_TITLE_LEN+1];
63 
64 	char* help_text_ptr;          // offset of the help text in the text buffer
65 	short help_text_len;          // length of the help text
66 };
67 
68 //-----------------------------------------------//
69 
70 class Help
71 {
72 public:
73 	enum 			{ SCREEN_CODE_LEN=8 };
74 	enum			{ CUSTOM_HELP_TITLE_LEN=80, CUSTOM_HELP_DETAIL_LEN=200 };
75 
76 	char			custom_help_title[CUSTOM_HELP_TITLE_LEN+1];
77 	char			custom_help_detail[CUSTOM_HELP_DETAIL_LEN+1];
78 
79 	char 			help_code[HelpInfo::HELP_CODE_LEN+1];
80 	short			help_x, help_y;
81 
82 	short       help_info_count;
83 
84 	HelpInfo    *help_info_array;
85 	char        *help_text_buf;
86 	int			help_text_buf_size;
87 
88 	char        *save_scr_buf;      // have a private save screen buffer for displaying the helpial text
89 	short       save_scr_x1, save_scr_y1, save_scr_x2, save_scr_y2;
90 
91 	short			last_mouse_x;
92 	short			last_mouse_y;
93 	unsigned long		mouse_still_time;
94 
95 public:
96 	Help();
97 	~Help();
98 
99 	void       init(const char* resName);
100 	void       deinit();
101 
102 	void       load(char*);
103 
104 	void 		  push_screen(char* screenCode);
105 	void		  pop_screen();
106 	void		  set_screen(char* screenCode);
107 
108 	void		  set_help(int x1, int y1, int x2, int y2, const char* helpCode);
109 	void		  set_unit_help(int unitId, int rankId, int x1, int y1, int x2, int y2);
110 	void		  set_custom_help(int x1, int y1, int x2, int y2, const char* helpTitle, const char* helpDetail=NULL);
111 
112 	int		  should_disp();
113 	void       disp();
114 	void 		  disp_help(int centerX, int centerY, const char* helpTitle, const char* helpDetail);
115 
116 	void       save_scr(int,int,int,int);   // save the screen to the save screen buffer in Help
117 	void       rest_scr();
118 };
119 
120 //-----------------------------------------------//
121 
122 extern Help help;
123 
124 #endif
125