OGAMSCE2.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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. // Filename : OGAMSCE2.CPP
  21. // Description : select scenario menu
  22. #include <OSYS.h>
  23. #include <OGAME.h>
  24. #include <OMOUSE.h>
  25. #include <OMOUSECR.h>
  26. #include <OVGABUF.h>
  27. #include <OIMGRES.h>
  28. #include <OBUTT3D.h>
  29. #include <OSLIDCUS.h>
  30. #include <OBOX.h>
  31. #include <OPOWER.h>
  32. #include <OFONT.h>
  33. #include <KEY.h>
  34. #include <OBLOB.h>
  35. #include <OINFO.h>
  36. #include <OFILETXT.h>
  37. #include <OVQUEUE.h>
  38. #include <OGETA.h>
  39. // ####### begin Gilbert 4/11 #######//
  40. #include <OMUSIC.h>
  41. // ####### end Gilbert 4/11 #######//
  42. // --------- declare static funtion --------//
  43. static void disp_scroll_bar_func(SlideVBar *scroll, int);
  44. enum { TUTOR_MENU_X1 = 0,
  45. TUTOR_MENU_Y1 = 0,
  46. TUTOR_MENU_WIDTH = VGA_WIDTH,
  47. TUTOR_MENU_HEIGHT = VGA_HEIGHT };
  48. enum { SCROLL_X1 = 757,
  49. SCROLL_Y1 = 352,
  50. SCROLL_X2 = 770,
  51. SCROLL_Y2 = 492 };
  52. enum { BROWSE_X1 = 30,
  53. BROWSE_Y1 = 336,
  54. BROWSE_REC_WIDTH = 725,
  55. BROWSE_REC_HEIGHT = 44,
  56. BROWSE_X2 = BROWSE_X1 + BROWSE_REC_WIDTH - 1,
  57. MAX_BROWSE_DISP_REC = 4 };
  58. enum { TEXT_AREA_X1 = 43,
  59. TEXT_AREA_Y1 = 198,
  60. TEXT_AREA_X2 = 745,
  61. TEXT_AREA_Y2 = 302,
  62. TEXT_AREA_WIDTH = TEXT_AREA_X2 - TEXT_AREA_X1 + 1,
  63. TEXT_AREA_HEIGHT = TEXT_AREA_Y2 - TEXT_AREA_Y1 + 1,
  64. };
  65. enum { TEXT_SCROLL_X1 = SCROLL_X1,
  66. TEXT_SCROLL_Y1 = 202,
  67. TEXT_SCROLL_X2 = SCROLL_X2,
  68. TEXT_SCROLL_Y2 = 289,
  69. };
  70. enum { TEXT_OFFSET_X = 11,
  71. TEXT_OFFSET_Y = 9 };
  72. // ####### begin Gilbert 1/11 #########//
  73. enum {
  74. NAME_FIELD_X1 = 180,
  75. NAME_FIELD_Y1 = 551,
  76. NAME_FIELD_X2 = 351,
  77. // NAME_FIELD_Y2 = 566,
  78. };
  79. // ####### end Gilbert 1/11 #########//
  80. #define TU_USE_BACKUP_SURFACE
  81. #define TUOPTION_BROWSE(s) (1 << (s))
  82. #define TUOPTION_ALL_BROWSE 0x0000ffff
  83. #define TUOPTION_PAGE 0x00010000
  84. #define TUOPTION_TEXT_AREA 0x00020000
  85. #define TUOPTION_PIC_AREA 0x00040000
  86. #define TUOPTION_SCROLL 0x00080000
  87. #define TUOPTION_TEXT_SCROLL 0x00100000
  88. #define TUOPTION_TEXT_BUFFER 0x00200000
  89. // ##### begin Gilbert 1/11 ########//
  90. #define TUOPTION_NAME_FIELD 0x00400000
  91. // ##### end Gilbert 1/11 ########//
  92. #define TUOPTION_ALL 0xffffffff
  93. //---------- Begin of function Game::select_scenario ----------//
  94. //
  95. // Select a scenario.
  96. //
  97. // <int> scenCount - no. of available scenarios.
  98. // <char**> scenFileNameArray - an array of <char*> pointing to the file name of the
  99. // available scenarios.
  100. //
  101. // return : <int> >0 - id. of the scenario selected.
  102. // 0 - cancel
  103. //
  104. int Game::select_scenario(int scenCount, ScenInfo* scenInfoArray)
  105. {
  106. char* scenFileName;
  107. char pictName[20];
  108. char textName[20];
  109. char* pathName;
  110. if( scenCount==0 )
  111. {
  112. box.msg( "Scenario files not found." );
  113. return 0;
  114. }
  115. //-------------------------------------//
  116. // ##### begin Gilbert 4/11 ########//
  117. // stop any music
  118. music.stop();
  119. // ##### end Gilbert 4/11 ########//
  120. int menuX1 = TUTOR_MENU_X1;
  121. int menuY1 = TUTOR_MENU_Y1;
  122. mouse_cursor.set_icon(CURSOR_NORMAL);
  123. power.win_opened = 1;
  124. int minRecno = 1;
  125. int browseRecno = minRecno;
  126. //--------------------------------------//
  127. Button3D scrollUp, scrollDown, startButton, cancelButton;
  128. int retFlag = 0;
  129. int refreshFlag = TUOPTION_ALL;
  130. scrollUp.create(menuX1+SCROLL_X1,menuY1+SCROLL_Y1-17, "SV-UP-U", "SV-UP-D", 1, 0);
  131. scrollDown.create(menuX1+SCROLL_X1,menuY1+SCROLL_Y2+1, "SV-DW-U", "SV-DW-D", 1, 0);
  132. // ###### begin Gilbert 1/11 ########//
  133. // startButton.create(menuX1+170, menuY1+529, "START-U", "START-D",1, 0);
  134. // cancelButton.create(menuX1+465, menuY1+529, "CANCEL-U", "CANCEL-D", 1, 0);
  135. startButton.create(menuX1+373, menuY1+529, "START-U", "START-D",1, 0);
  136. cancelButton.create(menuX1+548, menuY1+529, "CANCEL-U", "CANCEL-D", 1, 0);
  137. // ###### end Gilbert 1/11 ########//
  138. SlideVBar scrollBar;
  139. scrollBar.init_scroll(menuX1+SCROLL_X1, menuY1+SCROLL_Y1, menuX1+SCROLL_X2, menuY1+SCROLL_Y2,
  140. MAX_BROWSE_DISP_REC, disp_scroll_bar_func);
  141. scrollBar.set(minRecno, scenCount, minRecno);
  142. scrollBar.set_view_recno(browseRecno - MAX_BROWSE_DISP_REC/2);
  143. Button3D textScrollUp, textScrollDown;
  144. textScrollUp.create(menuX1+TEXT_SCROLL_X1, menuY1+TEXT_SCROLL_Y1-17,
  145. "SV-UP-U", "SV-UP-D", 1, 0);
  146. textScrollDown.create(menuX1+TEXT_SCROLL_X1,menuY1+TEXT_SCROLL_Y2+1,
  147. "SV-DW-U", "SV-DW-D", 1, 0);
  148. VLenQueue textBuffer;
  149. *(textBuffer.reserve(1)) = '\0';
  150. Font &textFont = font_std;
  151. const int TEXT_LINE_SPACE = 4;
  152. const int ESTIMATED_LINE_IN_TEXT_AREA =
  153. (TEXT_AREA_Y2 - TEXT_AREA_Y1 + 1) / (textFont.font_height + TEXT_LINE_SPACE);
  154. SlideVBar textScrollBar;
  155. textScrollBar.init_scroll(menuX1+TEXT_SCROLL_X1, menuY1+TEXT_SCROLL_Y1,
  156. menuX1+TEXT_SCROLL_X2, menuY1+TEXT_SCROLL_Y2,
  157. ESTIMATED_LINE_IN_TEXT_AREA, disp_scroll_bar_func);
  158. // ###### begin Gilbert 1/11 ########//
  159. GetA playerNameField;
  160. playerNameField.init( menuX1+NAME_FIELD_X1, menuY1+NAME_FIELD_Y1, menuX1+NAME_FIELD_X2,
  161. config.player_name, config.PLAYER_NAME_LEN, &font_san, 0, 1);
  162. // ###### end Gilbert 1/11 ########//
  163. #ifdef TU_USE_BACKUP_SURFACE
  164. // create temporary surface
  165. Blob browseArea[MAX_BROWSE_DISP_REC];
  166. Blob scrollArea;
  167. Blob textArea;
  168. Blob textScrollArea;
  169. // ##### begin Gilbert 1/11 #######//
  170. Blob nameFieldArea;
  171. // ##### end Gilbert 1/11 #######//
  172. #endif
  173. while(1)
  174. {
  175. //---------- yield --------//
  176. sys.yield();
  177. mouse.get_event();
  178. // --------- display ----------//
  179. if( refreshFlag )
  180. {
  181. #ifndef TU_USE_BACKUP_SURFACE
  182. refreshFlag = TUOPTION_ALL;
  183. #endif
  184. scenFileName = scenInfoArray[browseRecno-1].file_name;
  185. m.change_file_ext( pictName, scenFileName, "SCP" );
  186. m.change_file_ext( textName, scenFileName, "SCT" );
  187. pathName = DIR_SCENARIO_PATH(scenInfoArray[browseRecno-1].dir_id);
  188. err_when( ! *pathName );
  189. if( refreshFlag & TUOPTION_PAGE )
  190. {
  191. mouse.hide_area(menuX1, menuY1, menuX1+TUTOR_MENU_WIDTH, menuY1+TUTOR_MENU_HEIGHT);
  192. image_interface.put_front( menuX1, menuY1, "SCENARIO" );
  193. #ifdef TU_USE_BACKUP_SURFACE
  194. // capture into browseArea, scrollArea, textArea
  195. for( int j = 0; j < MAX_BROWSE_DISP_REC; ++j)
  196. {
  197. browseArea[j].resize(2*sizeof(short) + BROWSE_REC_WIDTH*BROWSE_REC_HEIGHT);
  198. vga_front.read_bitmap(
  199. menuX1+BROWSE_X1, menuY1+BROWSE_Y1 + j*BROWSE_REC_HEIGHT,
  200. menuX1+BROWSE_X2, menuY1+BROWSE_Y1 + j*BROWSE_REC_HEIGHT+BROWSE_REC_HEIGHT-1,
  201. browseArea[j].ptr);
  202. }
  203. scrollArea.resize(2*sizeof(short)+(SCROLL_X2-SCROLL_X1+1)*(SCROLL_Y2-SCROLL_Y1+1));
  204. vga_front.read_bitmap(menuX1+SCROLL_X1,menuY1+SCROLL_Y1,menuX1+SCROLL_X2,menuY1+SCROLL_Y2, scrollArea.ptr);
  205. textArea.resize(2*sizeof(short)+TEXT_AREA_WIDTH*TEXT_AREA_HEIGHT);
  206. vga_front.read_bitmap(menuX1+TEXT_AREA_X1, menuY1+TEXT_AREA_Y1,
  207. menuX1+TEXT_AREA_X2, menuY1+TEXT_AREA_Y2, textArea.ptr);
  208. textScrollArea.resize( 2*sizeof(short)+
  209. (TEXT_SCROLL_X2-TEXT_SCROLL_X1+1)*(TEXT_SCROLL_Y2-TEXT_SCROLL_Y1+1));
  210. vga_front.read_bitmap(menuX1+TEXT_SCROLL_X1, menuY1+TEXT_SCROLL_Y1,
  211. menuX1+TEXT_SCROLL_X2, menuY1+TEXT_SCROLL_Y2, textScrollArea.ptr);
  212. // ###### begin Gilbert 1/11 ########//
  213. nameFieldArea.resize( 2*sizeof(short) +
  214. (playerNameField.x_limit-playerNameField.x+1)*playerNameField.height());
  215. vga_front.read_bitmap(playerNameField.x, playerNameField.y,
  216. playerNameField.x_limit, playerNameField.y+playerNameField.height()-1,
  217. nameFieldArea.ptr);
  218. playerNameField.back_ground_bitmap = nameFieldArea.ptr;
  219. // ###### end Gilbert 1/11 ########//
  220. #endif
  221. scrollUp.paint();
  222. scrollDown.paint();
  223. startButton.paint();
  224. cancelButton.paint();
  225. textScrollUp.paint();
  226. textScrollDown.paint();
  227. mouse.show_area();
  228. }
  229. if( refreshFlag & TUOPTION_PIC_AREA )
  230. {
  231. String str;
  232. str = pathName;
  233. str += pictName;
  234. if( browseRecno && m.is_file_exist(str) )
  235. {
  236. File pictFile;
  237. pictFile.file_open(str);
  238. vga_front.put_large_bitmap(menuX1+21,menuY1+19, &pictFile);
  239. pictFile.file_close();
  240. }
  241. else
  242. {
  243. // draw the background
  244. #ifdef TU_USE_BACKUP_SURFACE
  245. // copy from ?
  246. #endif
  247. }
  248. }
  249. if( refreshFlag & TUOPTION_TEXT_BUFFER )
  250. {
  251. // load text buffer
  252. String str;
  253. str = pathName;
  254. str += textName;
  255. if( browseRecno && m.is_file_exist(str) )
  256. {
  257. File textFile;
  258. int dataSize;
  259. textFile.file_open(str);
  260. // ##### patch begin Gilbert 2/2 ####//
  261. dataSize = textFile.file_size();
  262. FileTxt fileTxt( &textFile, dataSize ); // initialize fileTxt with an existing file stream
  263. fileTxt.next_line(); // skip the title lines
  264. fileTxt.next_line();
  265. fileTxt.next_line();
  266. fileTxt.next_line();
  267. textBuffer.clear();
  268. fileTxt.read_paragraph(textBuffer.reserve(dataSize+8), dataSize);
  269. // ##### end begin Gilbert 2/2 ####//
  270. int dispLines; // no. of lines can be displayed on the area
  271. int totalLines; // total no. of lines of the text
  272. textFont.count_line( menuX1+TEXT_AREA_X1, menuY1+TEXT_AREA_Y1,
  273. menuX1+TEXT_AREA_X2, menuY1+TEXT_AREA_Y2,
  274. textBuffer.queue_buf, TEXT_LINE_SPACE, dispLines, totalLines );
  275. // textScrollBar.view_size = dispLines;
  276. textScrollBar.set(1, totalLines ,1);
  277. refreshFlag |= TUOPTION_TEXT_SCROLL;
  278. }
  279. }
  280. if( refreshFlag & TUOPTION_TEXT_AREA )
  281. {
  282. #ifdef TU_USE_BACKUP_SURFACE
  283. // copy from back buffer
  284. vga_front.put_bitmap(menuX1+TEXT_AREA_X1, menuY1+TEXT_AREA_Y1,
  285. textArea.ptr);
  286. #endif
  287. textFont.put_paragraph(menuX1+TEXT_AREA_X1, menuY1+TEXT_AREA_Y1, menuX1+TEXT_AREA_X2, menuY1+TEXT_AREA_Y2,
  288. textBuffer.queue_buf, TEXT_LINE_SPACE, textScrollBar.view_recno ); // 4 - space between lines
  289. }
  290. if( refreshFlag & TUOPTION_TEXT_SCROLL )
  291. {
  292. #ifdef TU_USE_BACKUP_SURFACE
  293. vga_front.put_bitmap(menuX1+TEXT_SCROLL_X1, menuY1+TEXT_SCROLL_Y1,
  294. textScrollArea.ptr);
  295. #endif
  296. // display scroll bar
  297. textScrollBar.paint();
  298. }
  299. if( refreshFlag & TUOPTION_SCROLL )
  300. {
  301. #ifdef TU_USE_BACKUP_SURFACE
  302. // copy from back buffer
  303. vga_front.put_bitmap(menuX1+SCROLL_X1, menuY1+SCROLL_Y1,
  304. scrollArea.ptr);
  305. #endif
  306. // display scroll bar
  307. scrollBar.paint();
  308. }
  309. if( refreshFlag & TUOPTION_ALL_BROWSE )
  310. {
  311. int rec, slot;
  312. for( slot = 0; slot < scrollBar.view_size; ++slot)
  313. {
  314. int browseSlotX1 = menuX1+BROWSE_X1;
  315. int browseSlotY1 = menuY1+BROWSE_Y1+slot*BROWSE_REC_HEIGHT;
  316. int browseSlotX2 = menuX1+BROWSE_X2;
  317. int browseSlotY2 = menuY1+BROWSE_Y1+(slot+1)*BROWSE_REC_HEIGHT-1;
  318. rec = scrollBar.view_recno + slot;
  319. if( refreshFlag & TUOPTION_BROWSE(slot) )
  320. {
  321. #ifdef TU_USE_BACKUP_SURFACE
  322. vga_front.put_bitmap(browseSlotX1, browseSlotY1,
  323. browseArea[rec%MAX_BROWSE_DISP_REC].ptr);
  324. #endif
  325. if( rec >= 1 && rec <= scenCount )
  326. {
  327. int textX = font_bible.put(browseSlotX1+TEXT_OFFSET_X,
  328. browseSlotY1+TEXT_OFFSET_Y, m.format(rec), 0, browseSlotX2 );
  329. //----- display the scenario name -----//
  330. textX = font_bible.put(textX, browseSlotY1+TEXT_OFFSET_Y,
  331. ". ", 0, browseSlotX2 );
  332. textX = font_bible.put(textX, browseSlotY1+TEXT_OFFSET_Y,
  333. scenInfoArray[rec-1].scen_name, 0, browseSlotX2 );
  334. //---- display the scenario difficulty and bonus points ----//
  335. String str(translate.process("Difficulty: "));
  336. str += scenInfoArray[rec-1].goal_difficulty;
  337. font_bible.put(browseSlotX1+TEXT_OFFSET_X+400, browseSlotY1+TEXT_OFFSET_Y,
  338. str, 0, browseSlotX2 );
  339. str = translate.process("Score Bonus: ");
  340. str += scenInfoArray[rec-1].goal_score_bonus;
  341. font_bible.put(browseSlotX1+TEXT_OFFSET_X+530, browseSlotY1+TEXT_OFFSET_Y,
  342. str, 0, browseSlotX2 );
  343. //--------------------------------------//
  344. if( rec == browseRecno )
  345. {
  346. vga_front.adjust_brightness(browseSlotX1, browseSlotY1, browseSlotX2, browseSlotY2, -2);
  347. //vga_front.put_bitmap_trans_decompress( menuX1+BROWSE_X1, menuY1+BROWSE_Y1+slot*BROWSE_REC_HEIGHT,
  348. // image_button.read("LS-DWN"));
  349. }
  350. }
  351. }
  352. }
  353. }
  354. // ###### begin Gilbert 1/11 #######//
  355. if( refreshFlag & TUOPTION_NAME_FIELD )
  356. playerNameField.paint();
  357. // ###### end Gilbert 1/11 #######//
  358. refreshFlag = 0;
  359. }
  360. sys.blt_virtual_buf();
  361. if( scrollBar.detect() == 1)
  362. {
  363. refreshFlag |= TUOPTION_SCROLL | TUOPTION_ALL_BROWSE;
  364. }
  365. else if( scrollUp.detect() )
  366. {
  367. // click on scroll up
  368. int oldValue = scrollBar.view_recno;
  369. if( oldValue != scrollBar.set_view_recno(oldValue-1) )
  370. refreshFlag |= TUOPTION_ALL_BROWSE | TUOPTION_SCROLL;
  371. }
  372. else if( scrollDown.detect() )
  373. {
  374. // click on scroll down
  375. int oldValue = scrollBar.view_recno;
  376. if( oldValue != scrollBar.set_view_recno(oldValue+1) )
  377. refreshFlag |= TUOPTION_ALL_BROWSE | TUOPTION_SCROLL;
  378. }
  379. else if( textScrollBar.detect() == 1 )
  380. {
  381. refreshFlag |= TUOPTION_TEXT_SCROLL | TUOPTION_TEXT_AREA;
  382. }
  383. else if( textScrollUp.detect() )
  384. {
  385. // click on scroll up
  386. int oldValue = textScrollBar.view_recno;
  387. if( oldValue != textScrollBar.set_view_recno(oldValue-1) )
  388. refreshFlag |= TUOPTION_TEXT_SCROLL | TUOPTION_TEXT_AREA;
  389. }
  390. else if( textScrollDown.detect() )
  391. {
  392. // click on scroll down
  393. int oldValue = textScrollBar.view_recno;
  394. if( oldValue != textScrollBar.set_view_recno(oldValue+1) )
  395. refreshFlag |= TUOPTION_TEXT_SCROLL | TUOPTION_TEXT_AREA;
  396. }
  397. else if( mouse.double_click( menuX1+BROWSE_X1, menuY1+BROWSE_Y1,
  398. menuX1+BROWSE_X1+BROWSE_REC_WIDTH-1,
  399. menuY1+BROWSE_Y1+ BROWSE_REC_HEIGHT*MAX_BROWSE_DISP_REC -1) )
  400. {
  401. // double click on game slot
  402. int oldValue = browseRecno;
  403. int newValue = scrollBar.view_recno + (mouse.click_y(0) - BROWSE_Y1 - menuY1) / BROWSE_REC_HEIGHT;
  404. if( newValue <= scenCount && newValue == oldValue )
  405. {
  406. browseRecno = newValue;
  407. retFlag = newValue;
  408. break;
  409. }
  410. }
  411. else if( mouse.single_click( menuX1+BROWSE_X1, menuY1+BROWSE_Y1,
  412. menuX1+BROWSE_X1+BROWSE_REC_WIDTH-1,
  413. menuY1+BROWSE_Y1+ BROWSE_REC_HEIGHT*MAX_BROWSE_DISP_REC -1) )
  414. {
  415. // click on game slot
  416. int oldValue = browseRecno;
  417. int newValue = scrollBar.view_recno + (mouse.click_y(0) - BROWSE_Y1 - menuY1) / BROWSE_REC_HEIGHT;
  418. if( newValue <= scenCount )
  419. {
  420. if( oldValue != newValue )
  421. {
  422. browseRecno = newValue;
  423. refreshFlag |= TUOPTION_BROWSE(newValue-scrollBar.view_recno)
  424. | TUOPTION_TEXT_BUFFER
  425. | TUOPTION_TEXT_AREA | TUOPTION_PIC_AREA;
  426. if( oldValue-scrollBar.view_recno >= 0 && oldValue-scrollBar.view_recno < MAX_BROWSE_DISP_REC)
  427. refreshFlag |= TUOPTION_BROWSE(oldValue-scrollBar.view_recno);
  428. }
  429. }
  430. }
  431. // ######## begin Gilbert 1/11 #########//
  432. else if( playerNameField.detect() )
  433. {
  434. // load button
  435. refreshFlag = TUOPTION_NAME_FIELD;
  436. }
  437. // ######## end Gilbert 1/11 #########//
  438. else if( cancelButton.detect(KEY_ESC) || mouse.any_click(RIGHT_BUTTON) > 0) // also when ESC key is pressed or right button
  439. {
  440. // cancel button or escape key
  441. refreshFlag = TUOPTION_ALL;
  442. retFlag = 0;
  443. break; // break while(1)
  444. }
  445. else if( startButton.detect() )
  446. {
  447. // load button
  448. refreshFlag = TUOPTION_ALL;
  449. retFlag = browseRecno;
  450. break;
  451. }
  452. }
  453. power.win_opened = 0;
  454. return retFlag;
  455. }
  456. //------------ End of function Game::select_scenario -----------//
  457. static void disp_scroll_bar_func(SlideVBar *scroll, int)
  458. {
  459. short rectTop = scroll->rect_top();
  460. short rectBottom = scroll->rect_bottom();
  461. vga_front.bar( scroll->scrn_x1, rectTop, scroll->scrn_x2, rectBottom, VGA_YELLOW+1);
  462. if( rectBottom - rectTop > 6 )
  463. {
  464. vga_front.d3_panel_up(scroll->scrn_x1, rectTop, scroll->scrn_x2, rectBottom,2,0);
  465. }
  466. }