OGAMENCY.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  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 : OGAMENCY.CPP
  21. // description : view encyclopedia
  22. #include <ALL.h>
  23. #include <OIMGRES.h>
  24. #include <OVGA.h>
  25. #include <OSYS.h>
  26. #include <OMOUSE.h>
  27. #include <OMOUSECR.h>
  28. #include <OVGALOCK.h>
  29. #include <OGAME.h>
  30. #include <OMUSIC.h>
  31. //--------- define constant ---------//
  32. #define ENCYC_CLASS_COUNT 7
  33. #define FRYHTAN_MAX_PAGE 3
  34. #ifdef AMPLUS
  35. #define SUB_CLASS_BUTTON_MAX 10
  36. #else
  37. #define SUB_CLASS_BUTTON_MAX 8
  38. #endif
  39. enum
  40. {
  41. ENCYC_PEOPLE=1,
  42. ENCYC_WEAPONS,
  43. ENCYC_SHIPS,
  44. ENCYC_STRUCTURES,
  45. ENCYC_PALACE,
  46. ENCYC_GOD,
  47. ENCYC_FRYHTANS,
  48. };
  49. const int START_SLIDE_MODE_TIME = 60000; // 60 seconds
  50. const int SLIDE_MODE_TIME = 10000; // 10 seconds
  51. // static int sub_class_count_array[ENCYC_CLASS_COUNT] = { 7, 5, 4, 8, 7, 7, 1 };
  52. static int sub_class_count_array[ENCYC_CLASS_COUNT] =
  53. #ifdef AMPLUS
  54. { 10, 6, 4, 8, 10, 10, 17 };
  55. #else
  56. { 7, 5, 4, 8, 7, 7, 17 };
  57. #endif
  58. static char *race_name[] =
  59. #ifdef AMPLUS
  60. { "CHINESE", "EGYPTIAN", "GREEK", "JAPANESE", "MAYA", "INDIAN", "NORMAN", "PERSIAN", "VIKING", "ZULU" };
  61. #else
  62. { "CHINESE", "GREEK", "JAPANESE", "MAYA", "NORMAN", "PERSIAN", "VIKING" };
  63. #endif
  64. static char *weapon_name[] =
  65. #ifdef AMPLUS
  66. { "CATAPULT", "BALLISTA", "CANNON", "EXPCART", "FLAMETHR", "F_BALLIS" };
  67. #else
  68. { "CATAPULT", "BALLISTA", "CANNON", "EXPCART", "FLAMETHR" };
  69. #endif
  70. static char *ship_name[] =
  71. {
  72. "VESSEL",
  73. "TRANSPOR",
  74. "CARAVEL",
  75. "GALLEON",
  76. };
  77. static char *firm_name[] =
  78. {
  79. "FORT",
  80. "FACTORY",
  81. "WARFACT",
  82. "MARKET",
  83. "MINE",
  84. "INN",
  85. "SCIENCE",
  86. "HARBOR",
  87. };
  88. static char *god_name[] =
  89. #ifdef AMPLUS
  90. { "CHINESE", "GREEK", "PERSIAN", "NORMAN", "JAPANESE", "MAYA", "VIKING", "EGYPTIAN", "ZULU", "INDIAN" };
  91. #else
  92. { "CHINESE", "GREEK", "JAPANESE", "MAYA", "NORMAN", "PERSIAN", "VIKING" };
  93. #endif
  94. static char *monster_name[] =
  95. {
  96. "HOBGLOB",
  97. "SKELETON",
  98. "GREMJERM",
  99. "GNOLL",
  100. "GIANTET",
  101. "HEADLESS",
  102. "GOBLIN",
  103. "MAN",
  104. "GITH",
  105. "LYW",
  106. "ROCKMAN",
  107. "LIZARD",
  108. "FIREKIN",
  109. "STRUCT_1",
  110. "STRUCT_2",
  111. "STRUCT_3",
  112. "STRUCT_4",
  113. };
  114. static char monster_page_index[FRYHTAN_MAX_PAGE+1] = { 0, 7, 13, 17 };
  115. static char* button_name_array[ENCYC_CLASS_COUNT] =
  116. {
  117. "B_PEOP", "B_WEAP", "B_SHIP", "B_STRUCT", "B_PEOP",
  118. "B_GBEING", "B_FRYH",
  119. };
  120. static char* monster_button_name_array[FRYHTAN_MAX_PAGE] =
  121. {
  122. "B_FRYH", "B_FRYH2", "B_FRYH3",
  123. };
  124. static char std_extension[] = ".ICN";
  125. static char pal_extension[] = ".COL";
  126. //-------- define static variables ----------//
  127. static int main_class_id;
  128. static int sub_class_id_array[ENCYC_CLASS_COUNT];
  129. static int fryhtan_page;
  130. //-------- declare static functions ----------//
  131. static int detect_main_class_button();
  132. static int detect_sub_class_button(int n, int firstButton=1);
  133. static void disp_class_buttons();
  134. static int disp_picture( int selClass, int selSubClass, int firstDisp=0);
  135. //-------- Begin of function Game::view_encyclopedia ---------//
  136. void Game::view_encyclopedia()
  137. {
  138. music.stop(); // no music for encyclopedia as it reads files from the CDROM
  139. //-------- backup and switch palette ----------//
  140. VgaCustomPalette *backupPal = new VgaCustomPalette(NULL);
  141. //---- load the interface into the back buffer ----//
  142. image_encyc.put_to_buf( &vga_back, "ENCYC" );
  143. //-------- hide and change mouse cursor --------//
  144. mouse.hide();
  145. mouse_cursor.set_icon(CURSOR_ENCYC);
  146. main_class_id = 1;
  147. for( int i=0 ; i<ENCYC_CLASS_COUNT ; i++ )
  148. sub_class_id_array[i] = 1;
  149. unsigned long nextDisplayTime = m.get_time() + START_SLIDE_MODE_TIME;
  150. //------- display the default picture ----//
  151. disp_picture(main_class_id, sub_class_id_array[main_class_id-1], 1 );
  152. //------ turn screen dark and blt the buffer ---------//
  153. vga_front.bar( 0, 0, VGA_WIDTH-1, VGA_HEIGHT-1, 0 );
  154. sys.blt_virtual_buf();
  155. //------- bilt the back buffer to the front ---------//
  156. vga.blt_buf( 0,0, vga_back.buf_width()-1, vga_back.buf_height()-1, 0 );
  157. mouse.show();
  158. disp_class_buttons();
  159. //---------------------------------------------//
  160. while(1)
  161. {
  162. //-------------- yield ---------------//
  163. sys.yield();
  164. mouse.get_event();
  165. sys.blt_virtual_buf();
  166. //------ detect main class buttons -------//
  167. int selClass = detect_main_class_button();
  168. if( selClass && selClass != main_class_id)
  169. {
  170. main_class_id = selClass;
  171. disp_class_buttons();
  172. disp_picture(main_class_id, sub_class_id_array[main_class_id-1]);
  173. }
  174. //------ detect sub class buttons -------//
  175. int selSubClass = 0;
  176. if( main_class_id != ENCYC_FRYHTANS )
  177. {
  178. selSubClass = detect_sub_class_button(sub_class_count_array[main_class_id-1]);
  179. }
  180. else
  181. {
  182. #ifdef AMPLUS
  183. // two buttons at the bottom are for switching page
  184. #else
  185. // (one)two buttons next to the buttons of that page (pictButtonCount) are for switching page
  186. #endif
  187. // if in monster class, find out which page
  188. int monsterSubClass;
  189. for( monsterSubClass = 1; monsterSubClass <= FRYHTAN_MAX_PAGE &&
  190. sub_class_id_array[main_class_id-1]-1 >= monster_page_index[monsterSubClass];
  191. ++monsterSubClass);
  192. err_when( monsterSubClass > FRYHTAN_MAX_PAGE );
  193. int pictButtonCount = monster_page_index[monsterSubClass] -
  194. monster_page_index[monsterSubClass-1];
  195. #ifdef AMPLUS
  196. int nextPageButton = SUB_CLASS_BUTTON_MAX-1;
  197. int prevPageButton = SUB_CLASS_BUTTON_MAX;
  198. #else
  199. int nextPageButton = pictButtonCount+1;
  200. int prevPageButton = pictButtonCount+2;
  201. #endif
  202. // translate selSubClass from i-th button to new value of sub_class_count_array[main_class_id-1]
  203. if( (selSubClass = detect_sub_class_button(pictButtonCount)) > 0)
  204. {
  205. // click sub-class buttons
  206. selSubClass = monster_page_index[monsterSubClass-1]+(selSubClass-1)+1;
  207. }
  208. else if( nextPageButton <= SUB_CLASS_BUTTON_MAX &&
  209. detect_sub_class_button(nextPageButton, nextPageButton) == nextPageButton )
  210. {
  211. // click page switching buttons
  212. // increase monsterSubClass
  213. if( ++monsterSubClass > FRYHTAN_MAX_PAGE )
  214. monsterSubClass = 1;
  215. // switch page, assume the first picture of that page
  216. selSubClass = monster_page_index[monsterSubClass-1]+1;
  217. }
  218. else if( prevPageButton <= SUB_CLASS_BUTTON_MAX &&
  219. detect_sub_class_button(prevPageButton, prevPageButton) == prevPageButton )
  220. {
  221. // decrease monsterSubClass
  222. if( --monsterSubClass < 1)
  223. monsterSubClass = FRYHTAN_MAX_PAGE;
  224. // switch page, assume the first picture of that page
  225. selSubClass = monster_page_index[monsterSubClass-1]+1;
  226. }
  227. else
  228. selSubClass = 0; // as if not selected anything
  229. }
  230. if( selSubClass && selSubClass != sub_class_id_array[main_class_id-1] )
  231. {
  232. sub_class_id_array[main_class_id-1] = selSubClass;
  233. disp_class_buttons();
  234. disp_picture(main_class_id, selSubClass);
  235. nextDisplayTime = m.get_time() + START_SLIDE_MODE_TIME;
  236. }
  237. //------ detect the "Return" button -------//
  238. if( mouse.single_click(6, 552, 165, 592) ) // return button
  239. break;
  240. //--------- F9 to capture screen ----------//
  241. if( mouse.single_click(174, 12, 787, 587, 1) ) // right clicking on the picture to save it
  242. sys.capture_screen();
  243. //----------- auto slide show -------------//
  244. if( m.get_time() > nextDisplayTime )
  245. {
  246. //--- display next pictures ---//
  247. if( ++sub_class_id_array[main_class_id-1] > sub_class_count_array[main_class_id-1] )
  248. {
  249. sub_class_id_array[main_class_id-1] = 1;
  250. if( ++main_class_id > ENCYC_CLASS_COUNT )
  251. main_class_id = 1;
  252. }
  253. disp_class_buttons();
  254. if( disp_picture(main_class_id, sub_class_id_array[main_class_id-1]) )
  255. nextDisplayTime = m.get_time() + SLIDE_MODE_TIME;
  256. }
  257. }
  258. //------- exiting: turn dark --------//
  259. // vga.adjust_brightness(-255);
  260. vga_front.bar(0,0, vga_front.buf_width()-1, vga_front.buf_height()-1, 0 );
  261. sys.blt_virtual_buf();
  262. //-------- restore mouse cursor --------//
  263. mouse_cursor.set_icon(CURSOR_NORMAL);
  264. //----- palette restore when backupPal destruct ----//
  265. {
  266. vga_front.bar( 0, 0, VGA_WIDTH-1, VGA_HEIGHT-1, 0 );
  267. VgaFrontLock vgaLock;
  268. delete backupPal;
  269. }
  270. }
  271. //--------- End of function Game::view_encyclopedia ---------//
  272. //-------- Begin of static function detect_main_class_button ---------//
  273. static int detect_main_class_button()
  274. {
  275. #ifdef AMPLUS
  276. enum { BUTTON_X = 14, BUTTON_Y = 14, BUTTON_WIDTH = 146, BUTTON_HEIGHT = 28 };
  277. enum { BUTTON_Y_SPACING = 30 };
  278. #else
  279. enum { BUTTON_X = 14, BUTTON_Y = 14, BUTTON_WIDTH = 146, BUTTON_HEIGHT = 31 };
  280. enum { BUTTON_Y_SPACING = 34 };
  281. #endif
  282. for( int c=1 ; c<=ENCYC_CLASS_COUNT ; c++ )
  283. {
  284. //if( mouse.press_area( BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  285. // BUTTON_Y + c*BUTTON_Y_SPACING-1) )
  286. if( mouse.single_click( BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  287. BUTTON_Y + c*BUTTON_Y_SPACING-1) )
  288. {
  289. vga.blt_buf( BUTTON_X, BUTTON_Y + (main_class_id-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  290. BUTTON_Y + main_class_id*BUTTON_Y_SPACING-1, 0);
  291. // ###### begin Gilbert 22/9 #######//
  292. // image_encyc.put_front(BUTTON_X-2, BUTTON_Y + (c-1)*BUTTON_Y_SPACING-2, "B_DOWN");
  293. image_encyc.put_front(BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, "B_DOWN");
  294. // ###### end Gilbert 22/9 #######//
  295. return c;
  296. }
  297. }
  298. return 0;
  299. }
  300. //-------- End of static function detect_main_class_button ---------//
  301. //-------- Begin of static function detect_sub_class_button ---------//
  302. static int detect_sub_class_button(int n, int firstButton)
  303. {
  304. #ifdef AMPLUS
  305. enum { BUTTON_X = 14, BUTTON_Y = 236, BUTTON_WIDTH = 146, BUTTON_HEIGHT = 28 };
  306. enum { BUTTON_Y_SPACING = 31, MAX_BUTTON = 10 };
  307. #else
  308. enum { BUTTON_X = 14, BUTTON_Y = 266, BUTTON_WIDTH = 146, BUTTON_HEIGHT = 31 };
  309. enum { BUTTON_Y_SPACING = 35, MAX_BUTTON = 8 };
  310. #endif
  311. for( int c=firstButton ; c<=n && c<=SUB_CLASS_BUTTON_MAX ; c++ )
  312. {
  313. //if( mouse.press_area( BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  314. // BUTTON_Y + c*BUTTON_Y_SPACING-1) )
  315. if( mouse.single_click( BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  316. BUTTON_Y + c*BUTTON_Y_SPACING-1) )
  317. {
  318. // int subClassId = sub_class_id_array[main_class_id-1];
  319. // vga.blt_buf( BUTTON_X, BUTTON_Y + (subClassId-1)*BUTTON_Y_SPACING, BUTTON_X + BUTTON_WIDTH-1,
  320. // BUTTON_Y + subClassId*BUTTON_Y_SPACING-1, 0);
  321. // ###### begin Gilbert 22/9 #######//
  322. // image_encyc.put_front(BUTTON_X-2, BUTTON_Y + (c-1)*BUTTON_Y_SPACING-2, "B_DOWN");
  323. image_encyc.put_front(BUTTON_X, BUTTON_Y + (c-1)*BUTTON_Y_SPACING, "B_DOWN");
  324. // ###### end Gilbert 22/9 #######//
  325. return c;
  326. }
  327. }
  328. return 0;
  329. }
  330. //-------- End of static function detect_sub_class_button ---------//
  331. //-------- Begin of static function disp_class_buttons ---------//
  332. //
  333. static void disp_class_buttons()
  334. {
  335. // ###### begin Gilbert 22/9 #######//
  336. #ifdef AMPLUS
  337. enum { BUTTON_X=14, BUTTON_WIDTH=146, CLASS_BUTTON_Y=14, CLASS_BUTTON_Y_SPACING=30,
  338. SUBCLASS_BUTTON_Y=236, SUBCLASS_TOP_BORDER=3, BUTTON_Y_SPACING=31 };
  339. #else
  340. enum { BUTTON_X=14, BUTTON_WIDTH=146, CLASS_BUTTON_Y=14, CLASS_BUTTON_Y_SPACING=34,
  341. SUBCLASS_BUTTON_Y=266, SUBCLASS_TOP_BORDER=4, BUTTON_Y_SPACING=35 };
  342. #endif
  343. // ###### end Gilbert 22/9 #######//
  344. int subClassId = sub_class_id_array[main_class_id-1];
  345. if( main_class_id != ENCYC_FRYHTANS )
  346. {
  347. vga_back.put_bitmap(12, SUBCLASS_BUTTON_Y-SUBCLASS_TOP_BORDER,
  348. image_encyc.get_ptr(button_name_array[main_class_id-1]) );
  349. }
  350. else
  351. {
  352. // if in monster class, find out which page
  353. int monsterSubClass;
  354. for( monsterSubClass = 1; monsterSubClass <= FRYHTAN_MAX_PAGE &&
  355. sub_class_id_array[main_class_id-1]-1 >= monster_page_index[monsterSubClass];
  356. ++monsterSubClass);
  357. err_when( monsterSubClass > FRYHTAN_MAX_PAGE );
  358. vga_back.put_bitmap(12, SUBCLASS_BUTTON_Y-SUBCLASS_TOP_BORDER,
  359. image_encyc.get_ptr(monster_button_name_array[monsterSubClass-1]) );
  360. // modify subClassId
  361. subClassId -= monster_page_index[monsterSubClass-1];
  362. }
  363. vga.blt_buf( BUTTON_X, 14, BUTTON_X+BUTTON_WIDTH-1, VGA_HEIGHT-40, 0 );
  364. int y=CLASS_BUTTON_Y;
  365. // ###### begin Gilbert 22/9 #######//
  366. image_encyc.put_front( BUTTON_X, y + (main_class_id-1)*CLASS_BUTTON_Y_SPACING, "B_DOWN");
  367. // ###### end Gilbert 22/9 #######//
  368. y=SUBCLASS_BUTTON_Y;
  369. // #### begin Gilbert 22/9 #######//
  370. image_encyc.put_front( BUTTON_X, y + (subClassId-1)*BUTTON_Y_SPACING, "B_DOWN");
  371. // #### end Gilbert 22/9 #######//
  372. }
  373. //-------- End of static function disp_class_buttons ---------//
  374. //-------- Begin of static function disp_picture ---------//
  375. //
  376. // <int> selClass, selSubClass - currently selected class and subclass id.
  377. // [int] firstDisp - whether it is the first display action
  378. // when the encyclopedia is called upl.
  379. //
  380. static int disp_picture( int selClass, int selSubClass, int firstDisp)
  381. {
  382. if( !DIR_ENCYC[0] )
  383. return 0;
  384. char filename[64];
  385. char palname[64];
  386. filename[0] = '\0';
  387. #ifdef AMPLUS
  388. // alternative path
  389. char filename2[64];
  390. char palname2[64];
  391. filename2[0] = '\0';
  392. #endif
  393. switch( selClass )
  394. {
  395. case ENCYC_PEOPLE:
  396. strcpy( filename, DIR_ENCYC );
  397. strcat( filename, "UNIT\\" );
  398. strcat( filename, race_name[selSubClass-1] );
  399. strcpy( palname, filename);
  400. strcat( palname, pal_extension);
  401. strcat( filename, std_extension );
  402. #ifdef AMPLUS
  403. if( DIR_ENCYC2[0] )
  404. {
  405. strcpy( filename2, DIR_ENCYC2 );
  406. strcat( filename2, "UNIT\\" );
  407. strcat( filename2, race_name[selSubClass-1] );
  408. strcpy( palname2, filename2);
  409. strcat( palname2, pal_extension);
  410. strcat( filename2, std_extension );
  411. }
  412. #endif
  413. break;
  414. case ENCYC_WEAPONS:
  415. strcpy( filename, DIR_ENCYC );
  416. strcat( filename, "UNIT\\" );
  417. strcat( filename, weapon_name[selSubClass-1] );
  418. strcpy( palname, filename);
  419. strcat( palname, pal_extension);
  420. strcat( filename, std_extension );
  421. #ifdef AMPLUS
  422. if( DIR_ENCYC2[0] )
  423. {
  424. strcpy( filename2, DIR_ENCYC2 );
  425. strcat( filename2, "UNIT\\" );
  426. strcat( filename2, weapon_name[selSubClass-1] );
  427. strcpy( palname2, filename2);
  428. strcat( palname2, pal_extension);
  429. strcat( filename2, std_extension );
  430. }
  431. #endif
  432. break;
  433. case ENCYC_SHIPS:
  434. strcpy( filename, DIR_ENCYC );
  435. strcat( filename, "UNIT\\" );
  436. strcat( filename, ship_name[selSubClass-1] );
  437. strcpy( palname, filename);
  438. strcat( palname, pal_extension);
  439. strcat( filename, std_extension );
  440. #ifdef AMPLUS
  441. if( DIR_ENCYC2[0] )
  442. {
  443. strcpy( filename2, DIR_ENCYC2 );
  444. strcat( filename2, "UNIT\\" );
  445. strcat( filename2, ship_name[selSubClass-1] );
  446. strcpy( palname2, filename2);
  447. strcat( palname2, pal_extension);
  448. strcat( filename2, std_extension );
  449. }
  450. #endif
  451. break;
  452. case ENCYC_STRUCTURES:
  453. strcpy( filename, DIR_ENCYC );
  454. strcat( filename, "FIRM\\" );
  455. strcat( filename, firm_name[selSubClass-1] );
  456. strcpy( palname, filename);
  457. strcat( palname, pal_extension);
  458. strcat( filename, std_extension );
  459. #ifdef AMPLUS
  460. if( DIR_ENCYC2[0] )
  461. {
  462. strcpy( filename2, DIR_ENCYC2 );
  463. strcat( filename2, "FIRM\\" );
  464. strcat( filename2, firm_name[selSubClass-1] );
  465. strcpy( palname2, filename2);
  466. strcat( palname2, pal_extension);
  467. strcat( filename2, std_extension );
  468. }
  469. #endif
  470. break;
  471. case ENCYC_PALACE:
  472. strcpy( filename, DIR_ENCYC );
  473. strcat( filename, "SEAT\\" );
  474. strcat( filename, race_name[selSubClass-1] );
  475. strcpy( palname, filename);
  476. strcat( palname, pal_extension);
  477. strcat( filename, std_extension );
  478. #ifdef AMPLUS
  479. if( DIR_ENCYC2[0] )
  480. {
  481. strcpy( filename2, DIR_ENCYC2 );
  482. strcat( filename2, "SEAT\\" );
  483. strcat( filename2, race_name[selSubClass-1] );
  484. strcpy( palname2, filename2);
  485. strcat( palname2, pal_extension);
  486. strcat( filename2, std_extension );
  487. }
  488. #endif
  489. break;
  490. case ENCYC_GOD:
  491. strcpy( filename, DIR_ENCYC );
  492. strcat( filename, "GOD\\" );
  493. strcat( filename, god_name[selSubClass-1] );
  494. strcpy( palname, filename);
  495. strcat( palname, pal_extension);
  496. strcat( filename, std_extension );
  497. #ifdef AMPLUS
  498. if( DIR_ENCYC2[0] )
  499. {
  500. strcpy( filename2, DIR_ENCYC2 );
  501. strcat( filename2, "GOD\\" );
  502. strcat( filename2, god_name[selSubClass-1] );
  503. strcpy( palname2, filename2);
  504. strcat( palname2, pal_extension);
  505. strcat( filename2, std_extension );
  506. }
  507. #endif
  508. break;
  509. case ENCYC_FRYHTANS:
  510. strcpy( filename, DIR_ENCYC );
  511. strcat( filename, "MONSTER\\" );
  512. strcat( filename, monster_name[selSubClass-1] );
  513. strcpy( palname, filename);
  514. strcat( palname, pal_extension);
  515. strcat( filename, std_extension );
  516. #ifdef AMPLUS
  517. if( DIR_ENCYC2[0] )
  518. {
  519. strcpy( filename2, DIR_ENCYC2 );
  520. strcat( filename2, "MONSTER\\" );
  521. strcat( filename2, monster_name[selSubClass-1] );
  522. strcpy( palname2, filename2);
  523. strcat( palname2, pal_extension);
  524. strcat( filename2, std_extension );
  525. }
  526. #endif
  527. break;
  528. default:
  529. err_here();
  530. return 0;
  531. }
  532. File pictFile;
  533. char *palNamePtr = NULL;
  534. if(
  535. #ifdef AMPLUS
  536. // search DIR_ENCYC2 first
  537. filename2[0] && m.is_file_exist(filename2) && pictFile.file_open(filename2,0) && (palNamePtr = palname2) ||
  538. #endif
  539. filename[0] && m.is_file_exist(filename) && pictFile.file_open(filename,0) && (palNamePtr = palname) )
  540. {
  541. vga_back.put_large_bitmap(174, 12, &pictFile);
  542. if( !firstDisp )
  543. vga_front.bar(174,12,787,587, 0x00); // wipe the picture screen
  544. if( palNamePtr && m.is_file_exist(palNamePtr) )
  545. {
  546. VgaFrontLock vgaLock;
  547. VgaCustomPalette::set_custom_palette(palNamePtr);
  548. }
  549. if( !firstDisp )
  550. vga.blt_buf(174,12,787,587, 0);
  551. return 1;
  552. }
  553. return 0;
  554. }
  555. //-------- End of static function disp_picture ---------//