00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <OSYS.H>
00020 #include <OSTR.H>
00021 #include <OMISC.H>
00022 #include <OGAMESET.H>
00023 #include <OWORLDMT.H>
00024 #include <OVGA.H>
00025 #include <OIFACE.H>
00026 #include <OINFO.H>
00027 #include <COLOR.H>
00028 #include <OFONT.H>
00029 #include <OGAMESTR.H>
00030 #include <OMOUSE.H>
00031 #include <OBUTTON.H>
00032 #include <OFINANCE.H>
00033
00034 #include <OTXTLIST.H>
00035 #include <OHELPIF.H>
00036
00037 enum {
00038 REPORT_X1 = ZOOM_X1+15,
00039 REPORT_Y1 = ZOOM_Y1+25,
00040 REPORT_X2 = ZOOM_X2-15,
00041 REPORT_Y2 = ZOOM_Y2-55
00042 };
00043
00044 enum {
00045 BOTTOM_BUTTON_X0 = REPORT_X1+70,
00046 BOTTOM_BUTTON_X1 = REPORT_X1+170,
00047 BOTTOM_BUTTON_Y1 = REPORT_Y2+15,
00048 BOTTOM_BUTTON_X2 = REPORT_X2-20,
00049 BOTTOM_BUTTON_Y2 = REPORT_Y2+40
00050 };
00051
00052 enum {
00053 BOTTOM_BUTTON_WIDTH = 125,
00054 BOTTOM_BUTTON_HEIGHT = 25,
00055 HELP_BUTTON_COUNT = 3,
00056 BOTTOM_BUTTON_DISTANCE
00057 = (BOTTOM_BUTTON_X2-BOTTOM_BUTTON_X1-BOTTOM_BUTTON_WIDTH*2)/3
00058 };
00059
00060 enum {
00061 BG_PIC_ID = 2
00062 };
00063
00064 static ButtonGroup help_topic_bottom_button_group(2);
00065 static ButtonGroup help_desc_bottom_button_group(3);
00066 static short *bottom_button_up_bitmap[HELP_BUTTON_COUNT];
00067 static short *bottom_button_down_bitmap[HELP_BUTTON_COUNT];
00068 static char *help_desc_bottom_button_label[] = {
00069 "Help Topics","Back","Close"
00070 };
00071 static char *help_topic_bottom_button_label[] = {
00072 "Open","Cancel"
00073 };
00074 static int help_topic_report_init_flag;
00075 static int help_desc_report_init_flag;
00076
00077 static int help_topic_current_mode=-1;
00078 static int help_desc_current_mode=-1;
00079
00081
00082 init();
00083 }
00084
00085
00086
00087
00089
00090 deinit();
00091 }
00092
00093
00094
00095
00097
00098
00099 for (int i = 0; i < HELP_BUTTON_COUNT; i++) {
00100 if (bottom_button_up_bitmap[i]) {
00101 mem_del(bottom_button_up_bitmap[i]);
00102 mem_del(bottom_button_down_bitmap[i]);
00103 bottom_button_up_bitmap[i] = NULL;
00104 bottom_button_down_bitmap[i] = NULL;
00105 }
00106 }
00107 help_textlist.deinit();
00108 help_topic_report_init_flag = 0;
00109 help_desc_report_init_flag = 0;
00110 }
00111
00112
00113
00114
00116
00117 memset(this,0,sizeof(HelpIf));
00118 for (int i = 0; i < HELP_BUTTON_COUNT; i++) {
00119 bottom_button_up_bitmap[i] = NULL;
00120 bottom_button_down_bitmap[i] = NULL;
00121 }
00122
00123 help_topic_report_init_flag = 0;
00124 help_desc_report_init_flag = 0;
00125 }
00126
00127
00128
00129
00131
00132 vga.use_back();
00133
00134 if (refreshFlag == INFO_REPAINT) {
00135 if(help_topic_report_init_flag )
00136
00137 deinit();
00138 help_topic_current_mode=-1;
00139
00140 user_interface.bg_img(BG_PIC_ID, &vga_back);
00141
00142
00143 if (!help_topic_report_init_flag) {
00144 short x = BOTTOM_BUTTON_X1;
00145 for (int i = 0; i < 2; i++, x+=BOTTOM_BUTTON_WIDTH+BOTTOM_BUTTON_DISTANCE) {
00146 user_interface.create_button_bitmap(x, BOTTOM_BUTTON_Y1,
00147 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00148 help_topic_bottom_button_label[i], &bottom_button_up_bitmap[i],
00149 &bottom_button_down_bitmap[i], &vga_back);
00150
00151 help_topic_bottom_button_group[i].create_bitmapW(x, BOTTOM_BUTTON_Y1,
00152 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00153 ((i == help_topic_current_mode) ? bottom_button_down_bitmap[i] :
00154 bottom_button_up_bitmap[i])+4);
00155 }
00156
00157 help_topic_report_init_flag = 1;
00158 font_charts.put(REPORT_X1+300,REPORT_Y1-15,"Help Topics");
00159
00160 String str;
00161 str = DIR_RES;
00162 str += "SCORE";
00163 help_textlist.init(REPORT_X1,REPORT_Y1+5,REPORT_X2,REPORT_Y2,str);
00164 help_textlist.init_list(REPORT_X1,REPORT_Y1+5,REPORT_X2,REPORT_Y2);
00165 }
00166
00167 help_topic_bottom_button_group.paint(help_topic_current_mode);
00168 }
00169
00170 help_textlist.disp(refreshFlag,help_textlist.topic_id); {
00171
00172
00173
00174 vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00175 }
00176 vga.use_front();
00177 }
00178
00179
00180
00181
00183
00184 vga.use_back();
00185
00186 if (refreshFlag == INFO_REPAINT) {
00187 if(help_desc_report_init_flag )
00188
00189 deinit();
00190
00191
00192 user_interface.bg_img(BG_PIC_ID, &vga_back);
00193
00194
00195 if (!help_desc_report_init_flag) {
00196 short x = BOTTOM_BUTTON_X0;
00197 help_desc_current_mode=-1;
00198 for (int i = 0; i < 3; i++, x+=BOTTOM_BUTTON_WIDTH+BOTTOM_BUTTON_DISTANCE) {
00199 user_interface.create_button_bitmap(x, BOTTOM_BUTTON_Y1,
00200 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00201 help_desc_bottom_button_label[i], &bottom_button_up_bitmap[i],
00202 &bottom_button_down_bitmap[i], &vga_back);
00203
00204 help_desc_bottom_button_group[i].create_bitmapW(x, BOTTOM_BUTTON_Y1,
00205 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00206 ( ((i==1)&&(!help_textlist.can_back))||
00207 (i == help_desc_current_mode) ? bottom_button_down_bitmap[i] :
00208 bottom_button_up_bitmap[i])+4);
00209 }
00210
00211 help_desc_bottom_button_group[1].enable_flag=help_textlist.can_back;
00212 if(!help_textlist.can_back) {
00213
00214
00215 help_desc_bottom_button_group[1].body_ptr = (void *) (bottom_button_down_bitmap[1] + 4);
00216 }
00217
00218 help_desc_report_init_flag = 1;
00219 String str;
00220 str = DIR_RES;
00221 str += "SCORE";
00222
00223 help_textlist.init(REPORT_X1,REPORT_Y1+5,REPORT_X2,REPORT_Y2,str);
00224 help_textlist.init_list_flag=0;
00225 }
00226
00227 String help_title;
00228 help_title=help_textlist.res_txt.get_title(help_textlist.topic_id);
00229 int ww=help_title.len()*(font_charts.width()+3);
00230 int wx=(REPORT_X2+REPORT_X1-ww)/2;
00231 user_interface.brighten(wx-20,REPORT_Y1-25,wx+ww+10,REPORT_Y1+font_charts.height()-18);
00232 user_interface.rect(wx-20,REPORT_Y1-25,wx+ww+10,REPORT_Y1+font_charts.height()-18,2);
00233 font_charts.put((wx>0)?wx:0,REPORT_Y1-18,help_title);
00234
00235
00236 help_desc_bottom_button_group.paint(help_desc_current_mode);
00237
00238 if(!help_textlist.can_back) {
00239 short x=BOTTOM_BUTTON_X0+BOTTOM_BUTTON_WIDTH+BOTTOM_BUTTON_DISTANCE;
00240 user_interface.darken(x, BOTTOM_BUTTON_Y1,
00241 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT);
00242 }
00243 }
00244
00245 help_textlist.disp(refreshFlag,help_textlist.topic_id);
00246
00247 if (refreshFlag == INFO_REPAINT) {
00248
00249 vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00250 sys.blt_virtual_buf();
00251 }
00252 vga.use_front();
00253 }
00254
00255
00256
00257 int HelpIf::help_topic_detect() {
00258 if (!help_topic_report_init_flag)
00259 return 0;
00260
00261 int help_topic_bottomButtonGroupDetect;
00262
00263 if ((help_topic_bottomButtonGroupDetect = help_topic_bottom_button_group.detect()) >= 0) {
00264
00265 if(help_topic_current_mode>=0)
00266 help_topic_bottom_button_group[help_topic_current_mode].body_ptr = (void *) (bottom_button_up_bitmap[help_topic_current_mode] + 4);
00267 else
00268 for(int i=0;i<2;i++)
00269 help_topic_bottom_button_group[i].body_ptr = (void *) (bottom_button_up_bitmap[i] + 4);
00270
00271 help_topic_current_mode = help_topic_bottomButtonGroupDetect;
00272 help_topic_bottom_button_group[help_topic_current_mode].body_ptr = (void *) (bottom_button_down_bitmap[help_topic_current_mode] + 4);
00273
00274
00275 if(help_topic_bottomButtonGroupDetect==0) {
00276
00277 help_textlist.add_history(help_textlist.topic_id);
00278 sys.set_view_mode(MODE_HELP_DESC);
00279 }
00280 if((sys.back_view_mode==MODE_HELP_TOPIC)||
00281 (sys.back_view_mode==MODE_HELP_DESC))
00282 sys.back_view_mode=MODE_NORMAL;
00283
00284 if(help_topic_bottomButtonGroupDetect==1)
00285 sys.set_view_mode(sys.back_view_mode);
00286 sys.redraw_all_flag = 1;
00287
00288 return 1;
00289 }
00290
00291 vga.use_front();
00292 help_textlist.detect();
00293 if(help_textlist.double_clicked) {
00294
00295 help_textlist.add_history(help_textlist.topic_id);
00296 sys.set_view_mode(MODE_HELP_DESC);
00297 help_textlist.double_clicked=0;
00298 }
00299
00300 return 0;
00301 }
00302
00304
00305 int HelpIf::help_desc_detect() {
00306 if (!help_desc_report_init_flag)
00307 return 0;
00308
00309 int help_desc_bottomButtonGroupDetect;
00310
00311 if ((help_desc_bottomButtonGroupDetect = help_desc_bottom_button_group.detect()) >= 0) {
00312 if((!help_textlist.can_back)&&(help_desc_bottomButtonGroupDetect==1))return 0;
00313
00314 if(help_desc_current_mode>=0)
00315
00316 help_desc_bottom_button_group[help_desc_current_mode].body_ptr = (void *) (bottom_button_up_bitmap[help_desc_current_mode] + 4);
00317 else
00318 for(int i=0;i<3;i++)
00319 help_desc_bottom_button_group[i].body_ptr = (void *) (bottom_button_up_bitmap[i] + 4);
00320
00321 help_desc_current_mode = help_desc_bottomButtonGroupDetect;
00322 help_desc_bottom_button_group[help_desc_current_mode].body_ptr = (void *) (bottom_button_down_bitmap[help_desc_current_mode] + 4);
00323
00324
00325 if(help_desc_bottomButtonGroupDetect==0)sys.set_view_mode(MODE_HELP_TOPIC);
00326 if(help_desc_bottomButtonGroupDetect==1)help_textlist.back_history();
00327 if(help_desc_bottomButtonGroupDetect==2) {
00328 if((sys.back_view_mode==MODE_HELP_TOPIC)||
00329 (sys.back_view_mode==MODE_HELP_DESC))
00330 sys.back_view_mode=MODE_NORMAL;
00331 sys.set_view_mode(sys.back_view_mode);
00332 }
00333 if(help_desc_bottomButtonGroupDetect==0 ||
00334 help_desc_bottomButtonGroupDetect==1 ||
00335 help_desc_bottomButtonGroupDetect==2)help_textlist.top_line=1;
00336
00337 sys.redraw_all_flag = 1;
00338 return 1;
00339 }
00340 help_textlist.detect();
00341 return 0;
00342 }
00343