tiledef.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. #ifdef PRECOMPILEDHEADERS
  2. #include "TileEngine All.h"
  3. #else
  4. #include "tiledef.h"
  5. #include "worlddef.h"
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include "wcheck.h"
  9. #include "stdlib.h"
  10. #include "time.h"
  11. #include "video.h"
  12. #include "debug.h"
  13. #include "worldman.h"
  14. #include "gameloop.h"
  15. #include "edit_sys.h"
  16. #include "pathai.h"
  17. #include "tile surface.h"
  18. #endif
  19. //#include "editscreen.h"
  20. // GLobals
  21. TILE_ELEMENT gTileDatabase[ NUMBEROFTILES ];
  22. UINT16 gTileDatabaseSize;
  23. UINT16 gusNumAnimatedTiles = 0;
  24. UINT16 gusAnimatedTiles[ MAX_ANIMATED_TILES ];
  25. UINT16 gTileTypeStartIndex[ NUMBEROFTILETYPES ];
  26. UINT8 gubEncryptionArray2[ BASE_NUMBER_OF_ROTATION_ARRAYS * 3 ][ NEW_ROTATION_ARRAY_SIZE ] =
  27. {
  28. {
  29. 81,168,102,49,61,70,172,
  30. 127,7,148,115,179,10,117,
  31. 253,35,30,218,76,63,116,
  32. 210,241,65,169,157,4,9,
  33. 29,205,160,111,41,213,193,
  34. 190,86,19,207,133,25,190,
  35. 187,131,66,196,253,227,163
  36. },
  37. {
  38. 236,81,128,26,96,137,92,
  39. 120,243,71,33,141,55,2,
  40. 185,185,187,33,230,72,146,
  41. 143,226,21,110,155,226,150,
  42. 111,124,165,242,4,76,201,
  43. 34,223,227,29,202,119,86,
  44. 172,219,8,121,183,148,142
  45. },
  46. {
  47. 73,81,249,189,120,220,96,
  48. 79,28,37,30,199,170,56,
  49. 1,10,70,215,151,190,146,
  50. 156,233,11,251,146,195,134,
  51. 188,140,23,233,137,204,150,
  52. 116,36,97,40,119,204,194,
  53. 55,9,193,18,143,76,209
  54. },
  55. {
  56. 143,200,80,50,154,231,247,
  57. 140,225,72,226,136,2,99,
  58. 209,182,82,146,128,49,3,
  59. 98,101,196,95,136,85,3,
  60. 81,37,131,9,251,79,209,
  61. 101,128,157,238,229,205,178,
  62. 49,161,141,101,175,48,2
  63. },
  64. {
  65. 171,145,70,2,204,252,166,
  66. 194,2,182,182,189,17,205,
  67. 141,80,12,104,215,96,174,
  68. 11,106,181,150,113,213,71,
  69. 209,89,219,35,229,63,18,
  70. 64,237,140,153,224,215,31,
  71. 48,198,108,180,139,233,39
  72. },
  73. {
  74. 31,60,240,131,203,6,32,
  75. 206,137,249,244,36,8,39,
  76. 38,142,11,77,76,18,200,
  77. 76,210,138,106,198,130,22,
  78. 37,178,76,18,233,77,149,
  79. 77,28,47,186,126,72,234,
  80. 254,158,97,10,162,58,93
  81. },
  82. {
  83. 181,91,80,208,248,218,224,
  84. 90,219,176,181,120,63,35,
  85. 132,167,206,85,6,76,223,
  86. 90,15,100,142,121,79,111,
  87. 255,88,196,134,19,72,133,
  88. 40,95,98,232,153,217,182,
  89. 186,109,241,66,128,26,140
  90. },
  91. {
  92. 225,112,22,157,253,52,123,
  93. 209,31,7,165,18,48,83,
  94. 190,53,154,87,188,199,251,
  95. 248,185,48,164,93,44,22,
  96. 165,77,239,88,148,21,155,
  97. 115,203,231,20,170,83,100,
  98. 222,204,57,83,39,241,126
  99. },
  100. {
  101. 51,228,1,96,176,54,89,
  102. 49,157,66,125,113,124,187,
  103. 15,110,70,101,246,16,108,
  104. 156,20,32,200,96,70,170,
  105. 120,198,42,199,79,93,100,
  106. 115,246,113,213,187,66,169,
  107. 129,241,230,251,145,23,29
  108. },
  109. {
  110. 101,67,67,78,108,22,58,
  111. 97,212,30,230,190,142,195,
  112. 243,169,75,210,61,248,180,
  113. 47,75,218,191,5,154,172,
  114. 19,204,224,123,244,251,1,
  115. 94,192,187,249,33,79,120,
  116. 115,109,88,173,40,7,61
  117. },
  118. {
  119. 178,239,46,52,245,141,192,
  120. 77,114,7,54,78,179,195,
  121. 12,213,79,16,184,192,27,
  122. 100,195,74,5,1,15,226,
  123. 223,50,245,39,244,230,85,
  124. 8,196,217,18,128,187,251,
  125. 52,225,65,96,62,49,239
  126. },
  127. {
  128. 94,190,122,81,36,204,171,
  129. 249,104,120,214,89,133,203,
  130. 103,19,163,117,53,59,48,
  131. 182,240,91,101,160,234,121,
  132. 1,78,151,26,3,28,228,
  133. 130,138,137,188,21,167,198,
  134. 197,34,63,165,195,11,206
  135. },
  136. {
  137. 220,164,4,55,94,159,83,
  138. 86,186,109,101,150,60,4,
  139. 146,58,195,221,221,148,11,
  140. 50,155,232,95,39,71,37,
  141. 106,104,102,59,34,41,206,
  142. 61,129,242,45,11,12,85,
  143. 27,184,210,214,165,106,238
  144. },
  145. {
  146. 44,151,227,47,39,93,122,
  147. 237,91,225,164,198,235,53,
  148. 226,36,124,86,57,94,185,
  149. 251,231,101,120,178,168,162,
  150. 218,38,34,33,126,235,196,
  151. 151,30,175,212,103,170,17,
  152. 208,48,75,16,231,10,66
  153. },
  154. {
  155. 90,201,253,44,89,120,222,
  156. 145,82,80,6,63,114,22,
  157. 37,106,33,40,177,4,112,
  158. 152,9,70,250,103,229,235,
  159. 22,147,65,5,164,55,48,
  160. 233,103,112,216,69,34,63,
  161. 31,159,108,38,14,111,132
  162. },
  163. {
  164. 170,177,43,7,140,86,71,
  165. 207,205,235,155,239,88,129,
  166. 53,6,111,139,249,208,172,
  167. 252,34,88,175,213,251,129,
  168. 86,54,242,107,142,144,79,
  169. 96,161,29,171,196,16,17,
  170. 143,205,207,201,47,88,10
  171. },
  172. {
  173. 112,203,199,48,59,153,46,
  174. 130,221,189,166,213,63,67,
  175. 50,190,21,148,242,238,113,
  176. 94,28,228,234,100,103,187,
  177. 95,53,124,69,6,55,6,
  178. 39,204,11,231,64,176,183,
  179. 86,248,21,152,62,205,200
  180. },
  181. {
  182. 133,189,180,176,46,27,167,
  183. 213,33,253,7,209,112,92,
  184. 8,60,122,206,229,50,184,
  185. 207,25,142,34,149,64,234,
  186. 16,252,247,255,22,70,90,
  187. 126,212,16,93,248,50,89,
  188. 194,248,244,230,224,203,62
  189. },
  190. {
  191. 234,231,52,206,57,230,130,
  192. 158,240,79,58,175,226,31,
  193. 213,160,154,113,199,241,84,
  194. 178,66,108,201,41,240,188,
  195. 24,9,50,145,172,208,226,
  196. 100,127,42,93,55,123,245,
  197. 197,102,110,206,48,234,81
  198. },
  199. {
  200. 176,193,13,70,253,101,15,
  201. 39,156,34,168,239,92,185,
  202. 235,239,109,151,115,6,12,
  203. 184,92,210,40,152,12,36,
  204. 57,183,30,136,247,232,152,
  205. 77,59,225,190,208,165,59,
  206. 133,118,100,111,45,20,177
  207. },
  208. {
  209. 242,224,56,94,247,232,26,
  210. 5,5,92,145,57,226,205,
  211. 229,79,2,235,214,16,252,
  212. 135,176,247,51,4,190,78,
  213. 45,155,6,184,220,121,136,
  214. 151,66,29,253,210,166,255,
  215. 75,82,234,246,152,230,26
  216. },
  217. {
  218. 71,92,199,196,224,54,108,
  219. 71,191,224,240,145,231,54,
  220. 198,135,241,115,219,139,162,
  221. 178,253,95,131,237,175,212,
  222. 251,85,23,132,211,92,89,
  223. 14,166,88,5,254,58,254,
  224. 204,5,41,160,72,105,230
  225. },
  226. {
  227. 122,240,140,138,243,30,90,
  228. 95,32,36,108,168,91,94,
  229. 223,161,93,96,118,32,153,
  230. 235,41,222,65,8,181,221,
  231. 196,207,70,218,41,74,198,
  232. 79,6,240,9,240,142,41,
  233. 69,48,113,102,15,168,239
  234. },
  235. {
  236. 33,100,248,1,115,220,254,
  237. 216,113,156,238,175,27,36,
  238. 61,20,255,131,209,181,91,
  239. 40,126,238,227,186,46,228,
  240. 253,64,201,169,138,5,71,
  241. 30,20,119,212,255,127,121,
  242. 170,240,13,84,96,212,210
  243. },
  244. {
  245. 213,91,87,107,184,54,252,
  246. 30,240,165,139,29,230,205,
  247. 42,49,78,136,10,113,160,
  248. 132,246,82,211,200,164,178,
  249. 112,128,15,43,150,157,197,
  250. 88,7,48,126,75,210,2,
  251. 196,228,191,100,25,80,254
  252. },
  253. {
  254. 161,100,85,71,23,7,176,
  255. 250,104,108,62,88,195,110,
  256. 27,102,177,102,127,163,105,
  257. 65,133,21,24,117,155,208,
  258. 39,37,206,154,225,85,176,
  259. 161,128,129,8,6,18,114,
  260. 12,53,53,165,90,177,26
  261. },
  262. {
  263. 36,101,106,199,26,144,50,
  264. 33,13,177,101,149,6,56,
  265. 112,251,141,157,46,152,191,
  266. 112,214,180,104,160,119,202,
  267. 112,75,167,190,116,185,126,
  268. 27,229,214,110,194,128,191,
  269. 19,24,123,193,148,15,69
  270. },
  271. {
  272. 94,179,36,34,168,18,167,
  273. 136,168,214,94,144,245,66,
  274. 241,83,82,74,25,138,106,
  275. 213,7,78,133,181,254,75,
  276. 73,230,160,60,93,65,204,
  277. 19,24,42,169,150,246,86,
  278. 182,211,11,68,108,69,44
  279. },
  280. {
  281. 127,97,243,9,60,97,125,
  282. 234,114,130,69,83,11,157,
  283. 186,44,46,37,4,205,85,
  284. 226,218,134,60,127,11,227,
  285. 55,80,85,109,26,120,25,
  286. 19,60,173,155,255,182,196,
  287. 64,12,112,91,145,131,23
  288. },
  289. {
  290. 166,108,127,147,227,40,125,
  291. 27,76,18,129,108,39,24,
  292. 100,92,205,245,147,59,47,
  293. 190,251,54,204,28,72,76,
  294. 151,24,71,228,181,206,140,
  295. 172,161,216,38,201,154,203,
  296. 141,252,226,169,135,208,183
  297. },
  298. {
  299. 143,63,98,145,133,62,237,
  300. 139,191,134,154,119,47,128,
  301. 196,154,179,252,48,125,206,
  302. 245,106,207,37,87,203,218,
  303. 175,115,73,116,243,111,167,
  304. 231,22,81,34,216,26,234,
  305. 36,136,62,97,46,137,172
  306. },
  307. {
  308. 125,118,61,116,135,101,54,
  309. 15,215,129,210,84,238,226,
  310. 43,56,40,197,174,30,226,
  311. 95,117,34,65,115,192,53,
  312. 67,222,155,83,103,157,18,
  313. 188,158,107,3,133,177,144,
  314. 242,76,231,253,233,120,19
  315. },
  316. {
  317. 65,199,211,202,123,9,216,
  318. 255,223,125,141,168,222,211,
  319. 71,184,143,146,32,40,117,
  320. 82,140,45,50,203,212,115,
  321. 70,166,219,132,100,127,245,
  322. 11,146,38,66,68,135,130,
  323. 71,59,123,29,51,25,249
  324. },
  325. {
  326. 190,161,56,194,42,46,58,
  327. 104,89,177,209,173,64,141,
  328. 117,68,136,202,201,9,67,
  329. 112,209,78,255,233,204,77,
  330. 72,199,213,85,252,204,10,
  331. 221,117,125,115,252,250,46,
  332. 101,111,125,194,139,186,255
  333. },
  334. {
  335. 31,86,139,193,121,21,227,
  336. 136,133,87,49,18,190,230,
  337. 224,29,177,1,149,9,151,
  338. 24,129,123,31,191,15,12,
  339. 186,16,109,103,75,43,16,
  340. 233,124,37,188,28,178,253,
  341. 78,27,215,234,165,87,234
  342. },
  343. {
  344. 170,4,161,157,18,78,11,
  345. 223,148,86,130,184,244,199,
  346. 171,43,229,209,235,160,189,
  347. 23,30,145,9,19,238,221,
  348. 41,113,74,156,184,137,226,
  349. 186,241,135,67,86,193,87,
  350. 95,11,215,251,31,39,80
  351. },
  352. {
  353. 85,223,21,67,248,93,201,
  354. 234,55,255,161,143,221,252,
  355. 110,10,206,90,36,240,21,
  356. 39,237,78,109,10,6,248,
  357. 7,125,44,88,104,198,17,
  358. 195,47,15,140,61,184,167,
  359. 251,182,72,224,147,159,196
  360. },
  361. {
  362. 123,19,239,168,30,154,104,
  363. 60,207,7,69,172,234,176,
  364. 23,31,137,211,242,79,208,
  365. 145,194,222,40,205,220,218,
  366. 202,197,167,163,162,203,119,
  367. 188,250,215,100,172,230,115,
  368. 79,119,241,177,204,213,247
  369. },
  370. {
  371. 164,47,183,166,25,101,55,
  372. 173,255,232,132,251,73,117,
  373. 235,22,152,184,146,245,171,
  374. 192,242,110,184,81,188,135,
  375. 183,224,50,201,210,124,141,
  376. 254,235,54,153,73,133,105,
  377. 251,27,228,131,103,255,205
  378. },
  379. {
  380. 141,53,177,160,37,136,109,
  381. 76,46,150,5,207,226,32,
  382. 160,180,136,191,175,88,111,
  383. 36,245,86,149,192,56,237,
  384. 119,37,117,196,117,115,54,
  385. 203,93,49,208,170,113,233,
  386. 46,143,140,211,5,170,166
  387. },
  388. {
  389. 2,245,56,116,61,150,114,
  390. 76,28,201,61,29,126,115,
  391. 226,153,233,246,200,95,246,
  392. 112,88,77,97,48,22,186,
  393. 203,102,27,213,211,119,235,
  394. 204,147,244,229,21,29,175,
  395. 52,103,21,222,146,203,247
  396. },
  397. {
  398. 203,187,75,44,10,228,157,
  399. 113,156,9,120,202,29,117,
  400. 184,122,64,90,44,31,194,
  401. 191,30,155,50,190,115,208,
  402. 130,69,132,201,246,81,100,
  403. 108,67,226,228,85,112,150,
  404. 243,222,107,49,158,2,199
  405. },
  406. {
  407. 243,107,29,155,25,62,54,
  408. 254,77,132,226,20,121,227,
  409. 78,33,189,27,153,172,240,
  410. 78,17,13,117,133,92,119,
  411. 205,123,66,233,177,141,20,
  412. 2,21,244,85,47,218,7,
  413. 194,47,175,180,65,92,188
  414. },
  415. {
  416. 3,223,186,179,171,112,64,
  417. 226,172,223,83,208,235,215,
  418. 235,20,187,212,96,218,104,
  419. 41,66,233,141,50,89,115,
  420. 102,35,34,147,219,175,203,
  421. 216,121,7,60,166,18,77,
  422. 246,202,53,41,124,33,72
  423. },
  424. {
  425. 115,8,155,105,168,30,132,
  426. 213,57,253,89,18,62,83,
  427. 13,138,197,40,21,218,47,
  428. 156,13,133,209,66,82,67,
  429. 99,176,107,172,80,52,146,
  430. 108,148,19,61,193,41,114,
  431. 250,121,164,57,125,29,35
  432. },
  433. {
  434. 252,37,152,15,100,236,254,
  435. 226,253,7,172,123,6,10,
  436. 139,17,7,254,146,114,216,
  437. 45,95,154,241,252,4,47,
  438. 134,193,201,19,97,207,39,
  439. 144,254,165,157,60,218,144,
  440. 173,48,97,157,173,165,139
  441. },
  442. {
  443. 43,160,148,141,246,225,109,
  444. 162,9,196,127,84,62,238,
  445. 41,82,224,161,103,65,28,
  446. 169,227,113,157,43,7,17,
  447. 78,6,67,179,102,7,16,
  448. 186,197,164,203,143,211,114,
  449. 255,34,222,17,63,184,47
  450. },
  451. {
  452. 202,17,101,190,148,37,65,
  453. 227,178,78,200,202,174,105,
  454. 90,13,220,198,78,74,44,
  455. 37,172,23,111,225,219,23,
  456. 223,119,96,149,12,206,14,
  457. 131,243,148,179,37,120,26,
  458. 168,77,232,223,65,125,224
  459. },
  460. {
  461. 95,160,190,37,50,215,151,
  462. 196,31,209,227,48,62,1,
  463. 249,123,173,73,232,137,16,
  464. 25,39,88,73,51,149,31,
  465. 178,19,34,120,74,112,230,
  466. 97,243,213,31,34,121,189,
  467. 200,255,68,57,75,208,129
  468. },
  469. {
  470. 135,244,60,186,169,184,217,
  471. 128,88,234,225,59,98,108,
  472. 180,189,228,11,222,179,81,
  473. 129,225,122,192,210,117,133,
  474. 142,124,112,228,166,55,29,
  475. 3,133,178,40,47,107,31,
  476. 237,22,170,212,75,186,142
  477. },
  478. {
  479. 254,191,1,222,153,4,115,
  480. 100,149,222,68,112,139,102,
  481. 61,231,195,98,156,181,242,
  482. 24,137,44,136,34,43,76,
  483. 219,155,8,100,28,81,181,
  484. 252,75,50,126,154,46,177,
  485. 11,53,126,99,180,248,57
  486. },
  487. {
  488. 109,132,42,96,40,141,189,
  489. 8,138,168,147,13,172,54,
  490. 196,69,7,241,14,128,187,
  491. 124,187,63,140,172,27,97,
  492. 195,63,235,191,196,254,187,
  493. 234,123,1,174,6,88,6,
  494. 177,247,45,156,120,226,125
  495. },
  496. {
  497. 30,95,46,155,25,137,245,
  498. 52,68,72,74,137,152,60,
  499. 3,26,152,42,137,223,113,
  500. 244,114,229,1,192,53,115,
  501. 90,174,232,119,234,38,77,
  502. 114,195,46,6,151,52,203,
  503. 85,96,69,205,58,68,39
  504. },
  505. {
  506. 30,59,201,53,236,197,180,
  507. 160,196,103,128,88,254,209,
  508. 225,82,124,227,135,183,59,
  509. 172,203,39,154,168,155,144,
  510. 235,35,68,198,41,8,87,
  511. 105,92,255,110,51,167,55,
  512. 248,69,103,157,208,146,105
  513. },
  514. {
  515. 249,205,245,168,172,15,16,
  516. 148,112,53,141,74,5,64,
  517. 218,194,253,75,243,113,168,
  518. 228,80,59,85,44,153,81,
  519. 216,126,55,215,165,220,72,
  520. 217,83,199,41,128,227,208,
  521. 24,3,173,137,18,75,53
  522. },
  523. {
  524. 21,130,191,209,19,213,58,
  525. 123,18,147,139,147,81,14,
  526. 156,255,245,64,150,115,131,
  527. 244,12,61,185,211,155,114,
  528. 151,96,11,203,200,138,71,
  529. 17,26,234,71,106,73,60,
  530. 76,106,210,50,115,45,2
  531. },
  532. {
  533. 55,17,107,248,62,204,196,
  534. 224,45,253,50,10,2,51,
  535. 233,34,73,107,137,68,253,
  536. 235,235,24,99,52,125,184,
  537. 3,3,88,146,80,226,29,
  538. 5,25,66,196,226,87,125,
  539. 83,169,124,218,190,135,197
  540. },
  541. };
  542. // These values coorespond to TerrainTypeDefines order
  543. UINT8 gTileTypeMovementCost[ NUM_TERRAIN_TYPES ] =
  544. {
  545. TRAVELCOST_FLAT, // NO_TERRAIN
  546. TRAVELCOST_FLAT, // FLAT GROUND
  547. TRAVELCOST_FLATFLOOR, // FLAT FLOOR
  548. TRAVELCOST_PAVEDROAD, // PAVED ROAD
  549. TRAVELCOST_DIRTROAD, // DIRT ROAD
  550. TRAVELCOST_FLAT, // LOW_GRASS
  551. TRAVELCOST_FLAT, // HIGH GRASS
  552. TRAVELCOST_TRAINTRACKS, // TRAIN TRACKS
  553. TRAVELCOST_SHORE, // LOW WATER
  554. TRAVELCOST_SHORE, // MED WATER
  555. TRAVELCOST_SHORE, // DEEP WATER
  556. };
  557. void CreateTileDatabase( )
  558. {
  559. UINT32 cnt1, cnt2;
  560. UINT8 ubLoop;
  561. UINT32 NumRegions;
  562. PTILE_IMAGERY TileSurf;
  563. TILE_ELEMENT TileElement;
  564. // Loop through all surfaces and tiles and build database
  565. for( cnt1 = 0; cnt1 < NUMBEROFTILETYPES; cnt1++ )
  566. {
  567. // Get number of regions
  568. TileSurf = gTileSurfaceArray[ cnt1 ];
  569. if ( TileSurf != NULL )
  570. {
  571. // Build start index list
  572. gTileTypeStartIndex[ cnt1 ] = (UINT16)gTileDatabaseSize;
  573. NumRegions = TileSurf->vo->usNumberOfObjects;
  574. // Check for overflow
  575. if ( NumRegions > gNumTilesPerType[ cnt1 ] )
  576. {
  577. #ifdef JA2EDITOR
  578. // Display warning
  579. gfWarning = (UINT8)cnt1;
  580. #endif
  581. // Cutof
  582. NumRegions = gNumTilesPerType[ cnt1 ];
  583. }
  584. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Type: %s Size: %d Index: %d", gTileSurfaceName[cnt1], gNumTilesPerType[ cnt1 ], gTileDatabaseSize ) );
  585. for( cnt2 = 0; cnt2 < NumRegions; cnt2++ )
  586. {
  587. memset( &TileElement, 0, sizeof( TileElement ) );
  588. TileElement.usRegionIndex = (UINT16)cnt2;
  589. TileElement.hTileSurface = TileSurf->vo;
  590. TileElement.sBuddyNum = -1;
  591. // Check for multi-z stuff
  592. if ( TileSurf->vo->ppZStripInfo != NULL )
  593. {
  594. // Only do this if we are within the # of video objects
  595. if ( cnt2 < TileSurf->vo->usNumberOfObjects )
  596. {
  597. if ( TileSurf->vo->ppZStripInfo[ cnt2 ] != NULL )
  598. {
  599. TileElement.uiFlags |= MULTI_Z_TILE;
  600. }
  601. }
  602. else
  603. {
  604. //Ate test to see if problems is gone
  605. int i = 0;
  606. }
  607. }
  608. // Structure database stuff!
  609. if (TileSurf->pStructureFileRef != NULL && TileSurf->pStructureFileRef->pubStructureData != NULL)
  610. {
  611. if (TileSurf->pStructureFileRef->pDBStructureRef[cnt2].pDBStructure != NULL)
  612. {
  613. TileElement.pDBStructureRef = &(TileSurf->pStructureFileRef->pDBStructureRef[cnt2]);
  614. if ( TileElement.pDBStructureRef->pDBStructure->fFlags & STRUCTURE_HIDDEN )
  615. {
  616. // ATE: These are ignored!
  617. //TileElement.uiFlags |= HIDDEN_TILE;
  618. }
  619. }
  620. }
  621. TileElement.fType = (UINT16)TileSurf->fType;
  622. TileElement.ubTerrainID = TileSurf->ubTerrainID;
  623. TileElement.usWallOrientation = NO_ORIENTATION;
  624. if (TileSurf->pAuxData != NULL)
  625. {
  626. if (TileSurf->pAuxData[cnt2].fFlags & AUX_FULL_TILE)
  627. {
  628. TileElement.ubFullTile = 1;
  629. }
  630. if (TileSurf->pAuxData[cnt2].fFlags & AUX_ANIMATED_TILE)
  631. {
  632. // Allocate Animated tile data
  633. AllocateAnimTileData( &TileElement, TileSurf->pAuxData[cnt2].ubNumberOfFrames );
  634. // Set values into tile element
  635. TileElement.pAnimData->bCurrentFrame = TileSurf->pAuxData[cnt2].ubCurrentFrame;
  636. for (ubLoop = 0; ubLoop < TileElement.pAnimData->ubNumFrames; ubLoop++)
  637. {
  638. TileElement.pAnimData->pusFrames[ ubLoop ] = gTileDatabaseSize - TileElement.pAnimData->bCurrentFrame + ubLoop;
  639. }
  640. /*
  641. for (ubLoop = TileElement.pAnimData->bCurrentFrame; ubLoop < TileElement.pAnimData->ubNumFrames; ubLoop++)
  642. {
  643. TileElement.pAnimData->pusFrames[ ubLoop ] = gTileDatabaseSize - TileElement.pAnimData->bCurrentFrame + ubLoop;
  644. }
  645. for (ubLoop = 0; ubLoop < TileElement.pAnimData->bCurrentFrame; ubLoop++)
  646. {
  647. TileElement.pAnimData->pusFrames[ ubLoop ] = gTileDatabaseSize - TileElement.pAnimData->bCurrentFrame + ubLoop;
  648. }
  649. */
  650. // set into animation controller array
  651. gusAnimatedTiles[ gusNumAnimatedTiles ] = gTileDatabaseSize;
  652. gusNumAnimatedTiles++;
  653. Assert( gusNumAnimatedTiles <= MAX_ANIMATED_TILES );
  654. TileElement.uiFlags |= ANIMATED_TILE;
  655. }
  656. TileElement.usWallOrientation = TileSurf->pAuxData[cnt2].ubWallOrientation;
  657. if (TileSurf->pAuxData[cnt2].ubNumberOfTiles > 0)
  658. {
  659. TileElement.ubNumberOfTiles = TileSurf->pAuxData[cnt2].ubNumberOfTiles;
  660. TileElement.pTileLocData = TileSurf->pTileLocData + TileSurf->pAuxData[cnt2].usTileLocIndex;
  661. }
  662. }
  663. SetSpecificDatabaseValues( (UINT16)cnt1, gTileDatabaseSize, &TileElement, TileSurf->bRaisedObjectType );
  664. gTileDatabase[ gTileDatabaseSize ] = TileElement;
  665. gTileDatabaseSize++;
  666. }
  667. // Check if data matches what should be there
  668. if ( NumRegions < gNumTilesPerType[ cnt1 ] )
  669. {
  670. #ifdef JA2EDITOR
  671. // Display warning here
  672. gfWarning = (UINT8)cnt1;
  673. #endif
  674. // Do underflows here
  675. for ( cnt2 = NumRegions; cnt2 < gNumTilesPerType[ cnt1 ]; cnt2++ )
  676. {
  677. memset( &TileElement, 0, sizeof( TileElement ) );
  678. TileElement.usRegionIndex = 0;
  679. TileElement.hTileSurface = TileSurf->vo;
  680. TileElement.fType = (UINT16)TileSurf->fType;
  681. TileElement.ubFullTile = FALSE;
  682. TileElement.sOffsetHeight = 0;
  683. TileElement.ubFullTile = 0;
  684. TileElement.uiFlags |= UNDERFLOW_FILLER;
  685. gTileDatabase[ gTileDatabaseSize ] = TileElement;
  686. gTileDatabaseSize++;
  687. }
  688. }
  689. }
  690. }
  691. //Calculate mem usgae
  692. gSurfaceMemUsage = guiMemTotal - gSurfaceMemUsage;
  693. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Sizes: %d vs %d", gTileDatabaseSize, NUMBEROFTILES ) );
  694. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Types: %d", NUMBEROFTILETYPES ) );
  695. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Item Mem: %d", gTileDatabaseSize * sizeof( TILE_ELEMENT ) ) );
  696. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Item Total Mem: %d", gSurfaceMemUsage ) );
  697. }
  698. void DeallocateTileDatabase( )
  699. {
  700. INT32 cnt;
  701. for( cnt = 0; cnt < NUMBEROFTILES; cnt++ )
  702. {
  703. // Check if an existing set of animated tiles are in place, remove if found
  704. if ( gTileDatabase[ cnt ].pAnimData != NULL )
  705. {
  706. FreeAnimTileData( &gTileDatabase[ cnt ] );
  707. }
  708. }
  709. gTileDatabaseSize = 0;
  710. gSurfaceMemUsage = 0;
  711. gusNumAnimatedTiles = 0;
  712. }
  713. BOOLEAN GetLandHeadType( INT32 iMapIndex, UINT32 *puiType )
  714. {
  715. UINT16 usIndex;
  716. Assert( puiType != NULL );
  717. CHECKF( gpWorldLevelData[ iMapIndex ].pLandHead != NULL );
  718. usIndex = gpWorldLevelData[ iMapIndex ].pLandHead->usIndex;
  719. GetTileType( usIndex, puiType );
  720. return( TRUE );
  721. }
  722. BOOLEAN SetLandIndex( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewType, BOOLEAN fDelete )
  723. {
  724. UINT16 usTempIndex;
  725. UINT8 ubLastHighLevel=0;
  726. if ( fDelete )
  727. {
  728. RemoveLand( iMapIndex, usIndex );
  729. return( TRUE );
  730. }
  731. if ( AnyHeigherLand( iMapIndex, uiNewType, &ubLastHighLevel ) )
  732. {
  733. // Check if type exists and get it's index if so
  734. if ( TypeExistsInLandLayer( iMapIndex, uiNewType, &usTempIndex ) )
  735. {
  736. // Replace with new index
  737. return( ReplaceLandIndex( iMapIndex, usTempIndex, usIndex ) );
  738. }
  739. else
  740. {
  741. return( InsertLandIndexAtLevel( iMapIndex, usIndex, (UINT8)(ubLastHighLevel+1) ) );
  742. }
  743. }
  744. else
  745. {
  746. // Check if type exists and get it's index if so
  747. if ( TypeExistsInLandLayer( iMapIndex, uiNewType, &usTempIndex ) )
  748. {
  749. // Replace with new index
  750. return( ReplaceLandIndex( iMapIndex, usTempIndex, usIndex ) );
  751. }
  752. else
  753. {
  754. // Otherwise, add to head
  755. return( AddLandToHead( iMapIndex, usIndex ) );
  756. }
  757. }
  758. }
  759. BOOLEAN SetLandIndexWithRadius( INT32 iMapIndex, UINT16 usIndex, UINT32 uiNewType, UINT8 ubRadius, BOOLEAN fReplace )
  760. {
  761. UINT16 usTempIndex;
  762. INT16 sTop, sBottom;
  763. INT16 sLeft, sRight;
  764. INT16 cnt1, cnt2;
  765. INT32 iNewIndex;
  766. BOOLEAN fDoPaste = FALSE;
  767. INT32 leftmost;
  768. //BOOLEAN fNewCommand;
  769. UINT16 Dummy;
  770. // Determine start end end indicies and num rows
  771. sTop = ubRadius;
  772. sBottom = -ubRadius;
  773. sLeft = - ubRadius;
  774. sRight = ubRadius;
  775. //fNewCommand = fFirstDrawMode; //NEW_UNDO_COMMAND;
  776. for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
  777. {
  778. leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
  779. for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
  780. {
  781. iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
  782. if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
  783. iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
  784. {
  785. if ( fReplace )
  786. {
  787. fDoPaste = TRUE;
  788. }
  789. else
  790. {
  791. if ( !TypeExistsInLandLayer( iNewIndex, uiNewType, &usTempIndex ) )
  792. {
  793. fDoPaste = TRUE;
  794. }
  795. }
  796. if ( fDoPaste && ((uiNewType >= FIRSTFLOOR && uiNewType <= LASTFLOOR) ||
  797. ((uiNewType < FIRSTFLOOR || uiNewType > LASTFLOOR) &&
  798. !TypeRangeExistsInLandLayer( iNewIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ))) )
  799. {
  800. SetLandIndex( iNewIndex, usIndex, uiNewType, FALSE );
  801. }
  802. }
  803. }
  804. }
  805. return( TRUE );
  806. }
  807. BOOLEAN GetTypeLandLevel( UINT32 iMapIndex, UINT32 uiNewType, UINT8 *pubLevel )
  808. {
  809. UINT8 level = 0;
  810. LEVELNODE *pLand;
  811. UINT32 fTileType=0;
  812. pLand = gpWorldLevelData[ iMapIndex ].pLandHead;
  813. while( pLand != NULL )
  814. {
  815. if ( pLand->usIndex != NO_TILE )
  816. {
  817. GetTileType( pLand->usIndex, &fTileType );
  818. if ( fTileType == uiNewType )
  819. {
  820. *pubLevel = level;
  821. return( TRUE );
  822. }
  823. }
  824. level++;
  825. pLand = pLand->pNext;
  826. }
  827. return( FALSE );
  828. }
  829. UINT8 GetLandLevelDepth( UINT32 iMapIndex )
  830. {
  831. UINT8 level = 0;
  832. LEVELNODE *pLand;
  833. pLand = gpWorldLevelData[ iMapIndex ].pLandHead;
  834. while( pLand != NULL )
  835. {
  836. level++;
  837. pLand = pLand->pNext;
  838. }
  839. return( level );
  840. }
  841. BOOLEAN GetSubIndexFromTileIndex( UINT16 usTileIndex, UINT16 *pusSubIndex )
  842. {
  843. UINT32 uiType=0;
  844. if( GetTileType( usTileIndex, &uiType ) )
  845. {
  846. *pusSubIndex = usTileIndex - gTileTypeStartIndex[ uiType ] + 1;
  847. return TRUE;
  848. }
  849. return FALSE;
  850. }
  851. BOOLEAN GetTypeSubIndexFromTileIndex( UINT32 uiCheckType, UINT16 usIndex, UINT16 *pusSubIndex )
  852. {
  853. // Tile database is zero-based, Type indecies are 1-based!
  854. CHECKF ( uiCheckType < NUMBEROFTILETYPES );
  855. *pusSubIndex = usIndex - gTileTypeStartIndex[ uiCheckType ] + 1;
  856. return( TRUE );
  857. }
  858. BOOLEAN GetTypeSubIndexFromTileIndexChar( UINT32 uiCheckType, UINT16 usIndex, UINT8 *pubSubIndex )
  859. {
  860. // Tile database is zero-based, Type indecies are 1-based!
  861. CHECKF ( uiCheckType < NUMBEROFTILETYPES );
  862. *pubSubIndex = (UINT8)(usIndex - gTileTypeStartIndex[ uiCheckType ] + 1);
  863. return( TRUE );
  864. }
  865. BOOLEAN GetTileIndexFromTypeSubIndex( UINT32 uiCheckType, UINT16 usSubIndex, UINT16 *pusTileIndex )
  866. {
  867. // Tile database is zero-based, Type indecies are 1-based!
  868. CHECKF ( uiCheckType < NUMBEROFTILETYPES );
  869. *pusTileIndex = usSubIndex + gTileTypeStartIndex[ uiCheckType ] - 1;
  870. return( TRUE );
  871. }
  872. BOOLEAN MoveLandIndexToTop( UINT32 iMapIndex, UINT16 usIndex )
  873. {
  874. // Remove, then add again
  875. RemoveLand( iMapIndex, usIndex );
  876. AddLandToHead( iMapIndex, usIndex );
  877. return( TRUE );
  878. }
  879. // Database access functions
  880. BOOLEAN GetTileType( UINT16 usIndex, UINT32 *puiType )
  881. {
  882. TILE_ELEMENT TileElem;
  883. CHECKF( usIndex != NO_TILE );
  884. // Get tile element
  885. TileElem = gTileDatabase[ usIndex ];
  886. *puiType = TileElem.fType;
  887. return( TRUE );
  888. }
  889. BOOLEAN GetTileFlags( UINT16 usIndex, UINT32 *puiFlags )
  890. {
  891. TILE_ELEMENT TileElem;
  892. CHECKF( usIndex != NO_TILE );
  893. CHECKF( usIndex < NUMBEROFTILES );
  894. // Get tile element
  895. TileElem = gTileDatabase[ usIndex ];
  896. *puiFlags = TileElem.uiFlags;
  897. return( TRUE );
  898. }
  899. BOOLEAN GetTileTypeLogicalHeight( UINT32 fType, UINT8 *pubLogHeight )
  900. {
  901. *pubLogHeight = gTileTypeLogicalHeight[ fType ];
  902. return( TRUE );
  903. }
  904. BOOLEAN LandTypeHeigher( UINT32 uiDestType, UINT32 uiSrcType )
  905. {
  906. UINT8 ubDestLogHeight;
  907. UINT8 ubSrcLogHeight;
  908. // Get logical height of type at head and type we wish to paste
  909. GetTileTypeLogicalHeight( uiDestType, &ubDestLogHeight );
  910. GetTileTypeLogicalHeight( uiSrcType, &ubSrcLogHeight );
  911. return( ubDestLogHeight > ubSrcLogHeight );
  912. }
  913. BOOLEAN AnyHeigherLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel )
  914. {
  915. LEVELNODE *pLand = NULL;
  916. UINT8 ubSrcLogHeight=0;
  917. UINT32 fTileType=0;
  918. UINT8 level = 0;
  919. UINT8 ubSrcTypeLevel=0;
  920. BOOLEAN fFound = FALSE;
  921. pLand = gpWorldLevelData[ iMapIndex ].pLandHead;
  922. GetTileTypeLogicalHeight( uiSrcType, &ubSrcLogHeight );
  923. // Check that src type is not head
  924. if ( GetTypeLandLevel( iMapIndex, uiSrcType, &ubSrcTypeLevel ) )
  925. {
  926. if ( ubSrcTypeLevel == LANDHEAD )
  927. {
  928. return( FALSE );
  929. }
  930. }
  931. // Look through all objects and Search for type
  932. while( pLand != NULL )
  933. {
  934. // Get type and height
  935. GetTileType( pLand->usIndex, &fTileType );
  936. if ( gTileTypeLogicalHeight[ fTileType ] > ubSrcLogHeight )
  937. {
  938. *pubLastLevel = level;
  939. fFound = TRUE;
  940. }
  941. // Advance to next
  942. pLand = pLand->pNext;
  943. level++;
  944. }
  945. // Could not find it, return FALSE
  946. return( fFound );
  947. }
  948. BOOLEAN AnyLowerLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel )
  949. {
  950. LEVELNODE *pLand = NULL;
  951. UINT8 ubSrcLogHeight;
  952. UINT32 fTileType=0;
  953. UINT8 level = 0;
  954. UINT8 ubSrcTypeLevel;
  955. TILE_ELEMENT TileElem;
  956. pLand = gpWorldLevelData[ iMapIndex ].pLandHead;
  957. GetTileTypeLogicalHeight( uiSrcType, &ubSrcLogHeight );
  958. GetTypeLandLevel( iMapIndex, uiSrcType, &ubSrcTypeLevel );
  959. // Look through all objects and Search for type
  960. while( pLand != NULL )
  961. {
  962. // Get type and height
  963. GetTileType( pLand->usIndex, &fTileType );
  964. if ( gTileTypeLogicalHeight[ fTileType ] < ubSrcLogHeight )
  965. {
  966. *pubLastLevel = level;
  967. return( TRUE );
  968. }
  969. // Get tile element
  970. TileElem = gTileDatabase[ pLand->usIndex ];
  971. // Get full tile flag
  972. if ( TileElem.ubFullTile && fTileType != uiSrcType )
  973. {
  974. return( FALSE );
  975. }
  976. // Advance to next
  977. pLand = pLand->pNext;
  978. level++;
  979. }
  980. // Could not find it, return FALSE
  981. return( FALSE );
  982. }
  983. BOOLEAN GetWallOrientation( UINT16 usIndex, UINT16 *pusWallOrientation )
  984. {
  985. TILE_ELEMENT TileElem;
  986. CHECKF( usIndex != NO_TILE );
  987. // Get tile element
  988. TileElem = gTileDatabase[ usIndex ];
  989. *pusWallOrientation = TileElem.usWallOrientation;
  990. return( TRUE );
  991. }
  992. BOOLEAN ContainsWallOrientation( INT32 iMapIndex, UINT32 uiType, UINT16 usWallOrientation, UINT8 *pubLevel )
  993. {
  994. LEVELNODE *pStruct = NULL;
  995. UINT8 level = 0;
  996. UINT16 usCheckWallOrient=0;
  997. pStruct = gpWorldLevelData[ iMapIndex ].pStructHead;
  998. // Look through all objects and Search for type
  999. while( pStruct != NULL )
  1000. {
  1001. GetWallOrientation( pStruct->usIndex, &usCheckWallOrient );
  1002. if ( usCheckWallOrient == usWallOrientation )
  1003. {
  1004. *pubLevel = level;
  1005. return( TRUE );
  1006. }
  1007. // Advance to next
  1008. pStruct = pStruct->pNext;
  1009. level++;
  1010. }
  1011. // Could not find it, return FALSE
  1012. return( FALSE );
  1013. }
  1014. //Kris: This function returns two special types if there are two walls
  1015. //sharing the same tile. This case only happens with the exterior and
  1016. //interior bottom corners. Otherwise, it returns the orientation of the
  1017. //first wall encountered -- not that there should be duplicate walls...
  1018. UINT8 CalculateWallOrientationsAtGridNo( INT32 iMapIndex )
  1019. {
  1020. UINT16 usCheckWallOrientation=0;
  1021. LEVELNODE *pStruct = NULL;
  1022. UINT8 ubFinalWallOrientation = NO_ORIENTATION;
  1023. pStruct = gpWorldLevelData[ iMapIndex ].pStructHead;
  1024. //Traverse all of the pStructs
  1025. while( pStruct != NULL )
  1026. {
  1027. GetWallOrientation( pStruct->usIndex, &usCheckWallOrientation );
  1028. if( ubFinalWallOrientation == NO_ORIENTATION )
  1029. { //Get the first valid orientation.
  1030. ubFinalWallOrientation = (UINT8)usCheckWallOrientation;
  1031. }
  1032. else switch( ubFinalWallOrientation )
  1033. { //If the first valid orientation has the key counterpart orientation,
  1034. //return the special corner orientations.
  1035. case INSIDE_TOP_LEFT:
  1036. if( usCheckWallOrientation == INSIDE_TOP_RIGHT )
  1037. return INSIDE_BOTTOM_CORNER;
  1038. break;
  1039. case INSIDE_TOP_RIGHT:
  1040. if( usCheckWallOrientation == INSIDE_TOP_LEFT )
  1041. return INSIDE_BOTTOM_CORNER;
  1042. break;
  1043. case OUTSIDE_TOP_LEFT:
  1044. if( usCheckWallOrientation == OUTSIDE_TOP_RIGHT )
  1045. return OUTSIDE_BOTTOM_CORNER;
  1046. break;
  1047. case OUTSIDE_TOP_RIGHT:
  1048. if( usCheckWallOrientation == OUTSIDE_TOP_LEFT )
  1049. return OUTSIDE_BOTTOM_CORNER;
  1050. break;
  1051. }
  1052. // Advance to next
  1053. pStruct = pStruct->pNext;
  1054. }
  1055. // Only one wall, so return it's orienation.
  1056. return ubFinalWallOrientation;
  1057. }
  1058. BOOLEAN AllocateAnimTileData( TILE_ELEMENT *pTileElem, UINT8 ubNumFrames )
  1059. {
  1060. pTileElem->pAnimData = MemAlloc( sizeof( TILE_ANIMATION_DATA ) );
  1061. CHECKF( pTileElem->pAnimData != NULL );
  1062. pTileElem->pAnimData->pusFrames = MemAlloc( sizeof( UINT16 ) * ubNumFrames );
  1063. CHECKF( pTileElem->pAnimData->pusFrames != NULL );
  1064. // Set # if frames!
  1065. pTileElem->pAnimData->ubNumFrames = ubNumFrames;
  1066. return( TRUE );
  1067. }
  1068. void FreeAnimTileData( TILE_ELEMENT *pTileElem )
  1069. {
  1070. if ( pTileElem->pAnimData != NULL )
  1071. {
  1072. // Free frames list
  1073. MemFree( pTileElem->pAnimData->pusFrames );
  1074. // Free frames
  1075. MemFree( pTileElem->pAnimData );
  1076. }
  1077. }