CAdvmapInterface.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. #include "stdafx.h"
  2. #include "CAdvmapInterface.h"
  3. #include "CLodHandler.h"
  4. #include "CPreGameTextHandler.h"
  5. extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
  6. using namespace boost::logic;
  7. using namespace CSDL_Ext;
  8. CDefHandler * CHeroList::arrdo = NULL;
  9. CDefHandler * CHeroList::arrup = NULL;
  10. CDefHandler * CTownList::arrdo = NULL;
  11. CDefHandler * CTownList::arrup = NULL;
  12. CAdvMapInt::~CAdvMapInt()
  13. {
  14. SDL_FreeSurface(bg);
  15. }
  16. AdventureMapButton::AdventureMapButton ()
  17. {
  18. type=2;
  19. abs=true;
  20. active=false;
  21. ourObj=NULL;
  22. state=0;
  23. }
  24. AdventureMapButton::AdventureMapButton
  25. ( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)(), int x, int y, std::string defName, bool activ, std::vector<std::string> * add )
  26. {
  27. type=2;
  28. abs=true;
  29. active=false;
  30. ourObj=NULL;
  31. state=0;
  32. name=Name;
  33. helpBox=HelpBox;
  34. int est = LOCPLINT->playerID;
  35. CDefHandler * temp = CGI->spriteh->giveDef(defName); //todo: moze cieknac
  36. for (int i=0;i<temp->ourImages.size();i++)
  37. {
  38. imgs.resize(1);
  39. imgs[0].push_back(temp->ourImages[i].bitmap);
  40. blueToPlayersAdv(imgs[curimg][i],LOCPLINT->playerID);
  41. }
  42. if (add)
  43. {
  44. imgs.resize(imgs.size()+add->size());
  45. for (int i=0; i<add->size();i++)
  46. {
  47. temp = CGI->spriteh->giveDef((*add)[i]);
  48. for (int j=0;j<temp->ourImages.size();j++)
  49. {
  50. imgs[i+1].push_back(temp->ourImages[j].bitmap);
  51. blueToPlayersAdv(imgs[1+i][j],LOCPLINT->playerID);
  52. }
  53. }
  54. delete add;
  55. }
  56. function = Function;
  57. pos.x=x;
  58. pos.y=y;
  59. pos.w = imgs[curimg][0]->w;
  60. pos.h = imgs[curimg][0]->h -1;
  61. if (activ)
  62. activate();
  63. }
  64. void AdventureMapButton::clickLeft (tribool down)
  65. {
  66. if (down)
  67. {
  68. state=1;
  69. }
  70. else
  71. {
  72. state=0;
  73. }
  74. show();
  75. if (pressedL && (down==false))
  76. (LOCPLINT->adventureInt->*function)();
  77. pressedL=state;
  78. }
  79. void AdventureMapButton::clickRight (tribool down)
  80. {
  81. //TODO: show/hide infobox
  82. }
  83. void AdventureMapButton::hover (bool on)
  84. {
  85. Hoverable::hover(on);
  86. if (on)
  87. LOCPLINT->adventureInt->statusbar.print(name);
  88. else if (LOCPLINT->adventureInt->statusbar.current==name)
  89. LOCPLINT->adventureInt->statusbar.clear();
  90. }
  91. void AdventureMapButton::activate()
  92. {
  93. if (active) return;
  94. active=true;
  95. ClickableL::activate();
  96. Hoverable::activate();
  97. KeyInterested::activate();
  98. }
  99. void AdventureMapButton::keyPressed (SDL_KeyboardEvent & key)
  100. {
  101. //TODO: check if it's shortcut
  102. }
  103. void AdventureMapButton::deactivate()
  104. {
  105. if (!active) return;
  106. active=false;
  107. ClickableL::deactivate();
  108. Hoverable::deactivate();
  109. KeyInterested::deactivate();
  110. }
  111. void CList::activate()
  112. {
  113. ClickableL::activate();
  114. ClickableR::activate();
  115. Hoverable::activate();
  116. KeyInterested::activate();
  117. };
  118. void CList::deactivate()
  119. {
  120. ClickableL::deactivate();
  121. ClickableR::deactivate();
  122. Hoverable::deactivate();
  123. KeyInterested::deactivate();
  124. };
  125. void CList::clickLeft(tribool down)
  126. {
  127. };
  128. CHeroList::CHeroList()
  129. {
  130. pos = genRect(192,64,609,196);
  131. }
  132. void CHeroList::select(int which)
  133. {
  134. }
  135. void CHeroList::clickLeft(tribool down)
  136. {
  137. }
  138. void CHeroList::clickRight(tribool down)
  139. {
  140. }
  141. void CHeroList::hover (bool on)
  142. {
  143. }
  144. void CHeroList::keyPressed (SDL_KeyboardEvent & key)
  145. {
  146. }
  147. CTownList::CTownList()
  148. {
  149. pos = genRect(192,48,747,196);
  150. arrdo = NULL;
  151. }
  152. void CTownList::select(int which)
  153. {
  154. }
  155. void CTownList::clickLeft(tribool down)
  156. {
  157. }
  158. void CTownList::clickRight(tribool down)
  159. {
  160. }
  161. void CTownList::hover (bool on)
  162. {
  163. }
  164. void CTownList::keyPressed (SDL_KeyboardEvent & key)
  165. {
  166. }
  167. CStatusBar::CStatusBar(int x, int y)
  168. {
  169. bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");
  170. SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
  171. pos.x=x;
  172. pos.y=y;
  173. pos.w=bg->w;
  174. pos.h=bg->h;
  175. middlex=(bg->w/2)+x;
  176. middley=(bg->h/2)+y;
  177. }
  178. CStatusBar::~CStatusBar()
  179. {
  180. SDL_FreeSurface(bg);
  181. }
  182. void CStatusBar::clear()
  183. {
  184. current="";
  185. blitAtWR(bg,pos.x,pos.y);
  186. }
  187. void CStatusBar::print(std::string text)
  188. {
  189. current=text;
  190. blitAtWR(bg,pos.x,pos.y);
  191. printAtMiddle(current,middlex,middley,GEOR13,zwykly);
  192. }
  193. void CStatusBar::show()
  194. {
  195. blitAtWR(bg,pos.x,pos.y);
  196. printAtMiddle(current,middlex,middley,GEOR13,zwykly);
  197. }
  198. CMinimap::CMinimap(bool draw)
  199. {
  200. statusbarTxt = CGI->preth->advWorldMap.first;
  201. pos.x=630;
  202. pos.y=26;
  203. pos.h=pos.w=144;
  204. radar = CGI->spriteh->giveDef("RADAR.DEF");
  205. std::ifstream is("minimap.txt",std::ifstream::in);
  206. for (int i=0;i<TERRAIN_TYPES;i++)
  207. {
  208. std::pair<int,SDL_Color> vinya;
  209. std::pair<int,SDL_Color> vinya2;
  210. int pom;
  211. is >> pom;
  212. vinya2.first=vinya.first=pom;
  213. is >> pom;
  214. vinya.second.r=pom;
  215. is >> pom;
  216. vinya.second.g=pom;
  217. is >> pom;
  218. vinya.second.b=pom;
  219. is >> pom;
  220. vinya2.second.r=pom;
  221. is >> pom;
  222. vinya2.second.g=pom;
  223. is >> pom;
  224. vinya2.second.b=pom;
  225. vinya.second.unused=vinya2.second.unused=255;
  226. colors.insert(vinya);
  227. colorsBlocked.insert(vinya2);
  228. }
  229. is.close();
  230. if (draw)
  231. redraw();
  232. }
  233. void CMinimap::draw()
  234. {
  235. blitAtWR(map[LOCPLINT->adventureInt->position.z],pos.x,pos.y);
  236. }
  237. void CMinimap::redraw(int level)// (level==-1) => redraw all levels
  238. {
  239. (CGameInfo::mainObj);
  240. for (int i=0; i<CGI->mh->sizes.z; i++)
  241. {
  242. SDL_Surface * pom ;
  243. if ((level>=0) && (i!=level))
  244. continue;
  245. if (map.size()<i+1)
  246. pom = SDL_CreateRGBSurface(ekran->flags,pos.w,pos.h,ekran->format->BitsPerPixel,ekran->format->Rmask,ekran->format->Gmask,ekran->format->Bmask,ekran->format->Amask);
  247. else pom = map[i];
  248. for (int x=0;x<pos.w;x++)
  249. {
  250. for (int y=0;y<pos.h;y++)
  251. {
  252. int mx=(CGI->mh->sizes.x*x)/pos.w;
  253. int my=(CGI->mh->sizes.y*y)/pos.h;
  254. if (CGI->mh->ttiles[mx][my][i].blocked && (!CGI->mh->ttiles[mx][my][i].visitable))
  255. SDL_PutPixel(pom,x,y,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].r,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].g,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].b);
  256. else SDL_PutPixel(pom,x,y,colors[CGI->mh->ttiles[mx][my][i].terType].r,colors[CGI->mh->ttiles[mx][my][i].terType].g,colors[CGI->mh->ttiles[mx][my][i].terType].b);
  257. }
  258. }
  259. map.push_back(pom);
  260. }
  261. }
  262. void CMinimap::updateRadar()
  263. {}
  264. void CMinimap::clickRight (tribool down)
  265. {}
  266. void CMinimap::clickLeft (tribool down)
  267. {
  268. if (down && (!pressedL))
  269. MotionInterested::activate();
  270. else if (!down)
  271. MotionInterested::deactivate();
  272. ClickableL::clickLeft(down);
  273. if (!((bool)down))
  274. return;
  275. float dx=((float)(LOCPLINT->current->motion.x-pos.x))/((float)pos.w),
  276. dy=((float)(LOCPLINT->current->motion.y-pos.y))/((float)pos.h);
  277. int dxa = (CGI->mh->sizes.x*dx)-(LOCPLINT->adventureInt->terrain.tilesw/2);
  278. int dya = (CGI->mh->sizes.y*dy)-(LOCPLINT->adventureInt->terrain.tilesh/2);
  279. if (dxa<0)
  280. dxa=-(Woff/2);
  281. else if((dxa+LOCPLINT->adventureInt->terrain.tilesw) > (CGI->mh->sizes.x))
  282. dxa=CGI->mh->sizes.x-LOCPLINT->adventureInt->terrain.tilesw+(Woff/2);
  283. if (dya<0)
  284. dya = -(Hoff/2);
  285. else if((dya+LOCPLINT->adventureInt->terrain.tilesh) > (CGI->mh->sizes.y))
  286. dya = CGI->mh->sizes.y-LOCPLINT->adventureInt->terrain.tilesh+(Hoff/2);
  287. LOCPLINT->adventureInt->position.x=dxa;
  288. LOCPLINT->adventureInt->position.y=dya;
  289. LOCPLINT->adventureInt->updateScreen=true;
  290. }
  291. void CMinimap::hover (bool on)
  292. {
  293. Hoverable::hover(on);
  294. if (on)
  295. LOCPLINT->adventureInt->statusbar.print(statusbarTxt);
  296. else if (LOCPLINT->adventureInt->statusbar.current==statusbarTxt)
  297. LOCPLINT->adventureInt->statusbar.clear();
  298. }
  299. void CMinimap::mouseMoved (SDL_MouseMotionEvent & sEvent)
  300. {
  301. if (pressedL)
  302. {
  303. clickLeft(true);
  304. }
  305. }
  306. void CMinimap::activate()
  307. {
  308. ClickableL::activate();
  309. ClickableR::activate();
  310. Hoverable::activate();
  311. if (pressedL)
  312. MotionInterested::activate();
  313. }
  314. void CMinimap::deactivate()
  315. {
  316. if (pressedL)
  317. MotionInterested::deactivate();
  318. ClickableL::deactivate();
  319. ClickableR::deactivate();
  320. Hoverable::deactivate();
  321. }
  322. CTerrainRect::CTerrainRect():currentPath(NULL)
  323. {
  324. tilesw=19;
  325. tilesh=18;
  326. pos.x=7;
  327. pos.y=6;
  328. pos.w=594;
  329. pos.h=547;
  330. arrows = CGI->spriteh->giveDef("ADAG.DEF");
  331. for(int y=0; y<arrows->ourImages.size(); ++y)
  332. {
  333. CSDL_Ext::fullAlphaTransform(arrows->ourImages[y].bitmap);
  334. }
  335. }
  336. void CTerrainRect::activate()
  337. {
  338. ClickableL::activate();
  339. ClickableR::activate();
  340. Hoverable::activate();
  341. KeyInterested::activate();
  342. };
  343. void CTerrainRect::deactivate()
  344. {
  345. ClickableL::deactivate();
  346. ClickableR::deactivate();
  347. Hoverable::deactivate();
  348. KeyInterested::deactivate();
  349. };
  350. void CTerrainRect::clickLeft(tribool down){}
  351. void CTerrainRect::clickRight(tribool down){}
  352. void CTerrainRect::hover(bool on){}
  353. void CTerrainRect::keyPressed (SDL_KeyboardEvent & key){}
  354. void CTerrainRect::show()
  355. {
  356. SDL_Surface * teren = CGI->mh->terrainRect
  357. (LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
  358. tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim);
  359. SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),ekran,&genRect(547,594,7,6));
  360. SDL_FreeSurface(teren);
  361. if (currentPath) //drawing path
  362. {
  363. for (int i=0;i<currentPath->nodes.size()-1;i++)
  364. {
  365. int pn=-1;//number of picture
  366. if (i==0) //last tile
  367. {
  368. int x = 32*(currentPath->nodes[i].x-LOCPLINT->adventureInt->position.x)+7,
  369. y = 32*(currentPath->nodes[i].y-LOCPLINT->adventureInt->position.y)+6;
  370. if (x<0 || y<0 || x>pos.w || y>pos.h)
  371. continue;
  372. pn=0;
  373. }
  374. else
  375. {
  376. std::vector<CPathNode> & cv = currentPath->nodes;
  377. if (cv[i+1].x == cv[i].x-1 && cv[i+1].y == cv[i].y-1)
  378. {
  379. if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y)
  380. {
  381. pn = 3;
  382. }
  383. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y+1)
  384. {
  385. pn = 12;
  386. }
  387. else if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y+1)
  388. {
  389. pn = 21;
  390. }
  391. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y+1)
  392. {
  393. pn = 22;
  394. }
  395. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y-1)
  396. {
  397. pn = 2;
  398. }
  399. }
  400. else if (cv[i+1].x == cv[i].x && cv[i+1].y == cv[i].y-1)
  401. {
  402. if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y+1)
  403. {
  404. pn = 4;
  405. }
  406. else if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y+1)
  407. {
  408. pn = 13;
  409. }
  410. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y+1)
  411. {
  412. pn = 22;
  413. }
  414. }
  415. else if (cv[i+1].x == cv[i].x+1 && cv[i+1].y == cv[i].y-1)
  416. {
  417. if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y+1)
  418. {
  419. pn = 5;
  420. }
  421. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y+1)
  422. {
  423. pn = 14;
  424. }
  425. else if(cv[i-1].x-1 == cv[i].x && cv[i-1].y == cv[i].y)
  426. {
  427. pn = 23;
  428. }
  429. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y-1)
  430. {
  431. pn = 24;
  432. }
  433. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y+1)
  434. {
  435. pn = 4;
  436. }
  437. }
  438. else if (cv[i+1].x == cv[i].x+1 && cv[i+1].y == cv[i].y)
  439. {
  440. if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y+1)
  441. {
  442. pn = 6;
  443. }
  444. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y)
  445. {
  446. pn = 15;
  447. }
  448. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y-1)
  449. {
  450. pn = 24;
  451. }
  452. }
  453. else if (cv[i+1].x == cv[i].x+1 && cv[i+1].y == cv[i].y+1)
  454. {
  455. if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y)
  456. {
  457. pn = 7;
  458. }
  459. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y-1)
  460. {
  461. pn = 16;
  462. }
  463. else if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y-1)
  464. {
  465. pn = 17;
  466. }
  467. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y+1)
  468. {
  469. pn = 6;
  470. }
  471. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y-1)
  472. {
  473. pn = 18;
  474. }
  475. }
  476. else if (cv[i+1].x == cv[i].x && cv[i+1].y == cv[i].y+1)
  477. {
  478. if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y-1)
  479. {
  480. pn = 8;
  481. }
  482. else if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y-1)
  483. {
  484. pn = 9;
  485. }
  486. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y-1)
  487. {
  488. pn = 18;
  489. }
  490. }
  491. else if (cv[i+1].x == cv[i].x-1 && cv[i+1].y == cv[i].y+1)
  492. {
  493. if(cv[i-1].x == cv[i].x && cv[i-1].y == cv[i].y-1)
  494. {
  495. pn = 1;
  496. }
  497. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y-1)
  498. {
  499. pn = 10;
  500. }
  501. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y)
  502. {
  503. pn = 19;
  504. }
  505. else if(cv[i-1].x == cv[i].x-1 && cv[i-1].y == cv[i].y-1)
  506. {
  507. pn = 8;
  508. }
  509. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y+1)
  510. {
  511. pn = 20;
  512. }
  513. }
  514. else if (cv[i+1].x == cv[i].x-1 && cv[i+1].y == cv[i].y)
  515. {
  516. if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y-1)
  517. {
  518. pn = 2;
  519. }
  520. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y)
  521. {
  522. pn = 11;
  523. }
  524. else if(cv[i-1].x == cv[i].x+1 && cv[i-1].y == cv[i].y+1)
  525. {
  526. pn = 20;
  527. }
  528. }
  529. }
  530. if (pn>=0)
  531. {
  532. int x = 32*(currentPath->nodes[i].x-LOCPLINT->adventureInt->position.x)+7,
  533. y = 32*(currentPath->nodes[i].y-LOCPLINT->adventureInt->position.y)+6;
  534. if (x<0 || y<0 || x>pos.w || y>pos.h)
  535. continue;
  536. int hvx = (x+arrows->ourImages[pn].bitmap->w)-(pos.x+pos.w),
  537. hvy = (y+arrows->ourImages[pn].bitmap->h)-(pos.y+pos.h);
  538. if (hvx<0 && hvy<0)
  539. blitAtWR(arrows->ourImages[pn].bitmap,x,y);
  540. else if(hvx<0)
  541. SDL_BlitSurface
  542. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,0,0),
  543. ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,x,y));
  544. else if (hvy<0)
  545. {
  546. SDL_BlitSurface
  547. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,0,0),
  548. ekran,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,x,y));
  549. }
  550. else
  551. SDL_BlitSurface
  552. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,0,0),
  553. ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,x,y));
  554. }
  555. } //for (int i=0;i<currentPath->nodes.size()-1;i++)
  556. } // if (currentPath)
  557. }
  558. CAdvMapInt::CAdvMapInt(int Player)
  559. :player(Player),
  560. statusbar(7,556),
  561. kingOverview(CGI->preth->advKingdomOverview.first,CGI->preth->advKingdomOverview.second,
  562. &CAdvMapInt::fshowOverview, 679, 196, "IAM002.DEF"),
  563. underground(CGI->preth->advSurfaceSwitch.first,CGI->preth->advSurfaceSwitch.second,
  564. &CAdvMapInt::fswitchLevel, 711, 196, "IAM010.DEF", false, new std::vector<std::string>(1,std::string("IAM003.DEF"))),
  565. questlog(CGI->preth->advQuestlog.first,CGI->preth->advQuestlog.second,
  566. &CAdvMapInt::fshowQuestlog, 679, 228, "IAM004.DEF"),
  567. sleepWake(CGI->preth->advSleepWake.first,CGI->preth->advSleepWake.second,
  568. &CAdvMapInt::fsleepWake, 711, 228, "IAM005.DEF"),
  569. moveHero(CGI->preth->advMoveHero.first,CGI->preth->advMoveHero.second,
  570. &CAdvMapInt::fmoveHero, 679, 260, "IAM006.DEF"),
  571. spellbook(CGI->preth->advCastSpell.first,CGI->preth->advCastSpell.second,
  572. &CAdvMapInt::fshowSpellbok, 711, 260, "IAM007.DEF"),
  573. advOptions(CGI->preth->advAdvOptions.first,CGI->preth->advAdvOptions.second,
  574. &CAdvMapInt::fadventureOPtions, 679, 292, "IAM008.DEF"),
  575. sysOptions(CGI->preth->advSystemOptions.first,CGI->preth->advSystemOptions.second,
  576. &CAdvMapInt::fsystemOptions, 711, 292, "IAM009.DEF"),
  577. nextHero(CGI->preth->advNextHero.first,CGI->preth->advNextHero.second,
  578. &CAdvMapInt::fnextHero, 679, 324, "IAM000.DEF"),
  579. endTurn(CGI->preth->advEndTurn.first,CGI->preth->advEndTurn.second,
  580. &CAdvMapInt::fendTurn, 679, 356, "IAM001.DEF")
  581. {
  582. bg = CGI->bitmaph->loadBitmap("ADVMAP.bmp");
  583. blueToPlayersAdv(bg,player);
  584. scrollingLeft = false;
  585. scrollingRight = false;
  586. scrollingUp = false ;
  587. scrollingDown = false ;
  588. updateScreen = false;
  589. anim=0;
  590. animValHitCount=0; //animation frame
  591. gems.push_back(CGI->spriteh->giveDef("agemLL.def"));
  592. gems.push_back(CGI->spriteh->giveDef("agemLR.def"));
  593. gems.push_back(CGI->spriteh->giveDef("agemUL.def"));
  594. gems.push_back(CGI->spriteh->giveDef("agemUR.def"));
  595. }
  596. void CAdvMapInt::fshowOverview()
  597. {
  598. }
  599. void CAdvMapInt::fswitchLevel()
  600. {
  601. if(!CGI->ac->map.twoLevel)
  602. return;
  603. if (position.z)
  604. {
  605. position.z--;
  606. underground.curimg=0;
  607. underground.show();
  608. }
  609. else
  610. {
  611. underground.curimg=1;
  612. position.z++;
  613. underground.show();
  614. }
  615. updateScreen = true;
  616. }
  617. void CAdvMapInt::fshowQuestlog()
  618. {
  619. }
  620. void CAdvMapInt::fsleepWake()
  621. {
  622. }
  623. void CAdvMapInt::fmoveHero()
  624. {
  625. }
  626. void CAdvMapInt::fshowSpellbok()
  627. {
  628. }
  629. void CAdvMapInt::fadventureOPtions()
  630. {
  631. }
  632. void CAdvMapInt::fsystemOptions()
  633. {
  634. }
  635. void CAdvMapInt::fnextHero()
  636. {
  637. }
  638. void CAdvMapInt::fendTurn()
  639. {
  640. }
  641. void CAdvMapInt::show()
  642. {
  643. blitAt(bg,0,0);
  644. kingOverview.show();
  645. kingOverview.activate();
  646. underground.show();
  647. underground.activate();
  648. questlog.show();
  649. questlog.activate();
  650. sleepWake.show();
  651. sleepWake.activate();
  652. moveHero.show();
  653. moveHero.activate();
  654. spellbook.show();
  655. spellbook.activate();
  656. advOptions.show();
  657. advOptions.activate();
  658. sysOptions.show();
  659. sysOptions.activate();
  660. nextHero.show();
  661. nextHero.activate();
  662. endTurn.show();
  663. endTurn.activate();
  664. minimap.activate();
  665. minimap.draw();
  666. statusbar.show();
  667. SDL_Flip(ekran);
  668. }
  669. void CAdvMapInt::update()
  670. {
  671. terrain.show();
  672. blitAt(gems[2]->ourImages[LOCPLINT->playerID].bitmap,6,6);
  673. blitAt(gems[0]->ourImages[LOCPLINT->playerID].bitmap,6,508);
  674. blitAt(gems[1]->ourImages[LOCPLINT->playerID].bitmap,556,508);
  675. blitAt(gems[3]->ourImages[LOCPLINT->playerID].bitmap,556,6);
  676. updateRect(&genRect(550,600,6,6));
  677. }