Advertisement
Fast-Driver

powder.h

Apr 4th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.30 KB | None | 0 0
  1. #ifndef POWDER_H
  2. #define POWDER_H
  3.  
  4. #include "air.h"
  5. #include "graphics.h"
  6. #include "defines.h"
  7. #include "interface.h"
  8. #include "misc.h"
  9.  
  10. #define CM_COUNT 11
  11. #define CM_CRACK 10
  12. #define CM_LIFE 9
  13. #define CM_GRAD 8
  14. #define CM_NOTHING 7
  15. #define CM_FANCY 6
  16. #define CM_HEAT 5
  17. #define CM_BLOB 4
  18. #define CM_FIRE 3
  19. #define CM_PERS 2
  20. #define CM_PRESS 1
  21. #define CM_VEL 0
  22.  
  23. #define BRUSH_REPLACEMODE 0x1
  24. #define BRUSH_SPECIFIC_DELETE 0x2
  25.  
  26. #define UI_WALLSTART 222
  27. #define UI_ACTUALSTART 122
  28. #define UI_WALLCOUNT 25
  29.  
  30. #define WL_WALLELEC 122
  31. #define WL_EWALL    123
  32. #define WL_DETECT   124
  33. #define WL_STREAM   125
  34. #define WL_SIGN 126
  35. #define WL_FAN  127
  36. #define WL_FANHELPER 255
  37. #define WL_ALLOWLIQUID  128
  38. #define WL_DESTROYALL   129
  39. #define WL_ERASE    130
  40. #define WL_WALL 131
  41. #define WL_ALLOWAIR 132
  42. #define WL_ALLOWSOLID   133
  43. #define WL_ALLOWALLELEC 134
  44. #define WL_EHOLE    135
  45.  
  46. #define SPC_AIR 236
  47. #define SPC_HEAT 237
  48. #define SPC_COOL 238
  49. #define SPC_VACUUM 239
  50. #define SPC_WIND 241
  51. #define SPC_PGRV 243
  52. #define SPC_NGRV 244
  53. #define SPC_PROP 246
  54.  
  55. #define WL_ALLOWGAS 140
  56. #define WL_GRAV     142
  57. #define WL_ALLOWENERGY 145
  58.  
  59.  
  60. #define PT_NONE 0
  61. #define PT_DUST 1
  62. #define PT_WATR 2
  63. #define PT_OIL 3
  64. #define PT_FIRE 4
  65. #define PT_STNE 5
  66. #define PT_LAVA 6
  67. #define PT_GUNP 7
  68. #define PT_NITR 8
  69. #define PT_CLNE 9
  70. #define PT_GAS 10
  71. #define PT_PLEX 11
  72. #define PT_GOO 12
  73. #define PT_ICEI 13
  74. #define PT_METL 14
  75. #define PT_SPRK 15
  76. #define PT_SNOW 16
  77. #define PT_WOOD 17
  78. #define PT_NEUT 18
  79. #define PT_PLUT 19
  80. #define PT_PLNT 20
  81. #define PT_ACID 21
  82. #define PT_VOID 22
  83. #define PT_WTRV 23
  84. #define PT_CNCT 24
  85. #define PT_DSTW 25
  86. #define PT_SALT 26
  87. #define PT_SLTW 27
  88. #define PT_DMND 28
  89. #define PT_BMTL 29
  90. #define PT_BRMT 30
  91. #define PT_PHOT 31
  92. #define PT_URAN 32
  93. #define PT_WAX  33
  94. #define PT_MWAX 34
  95. #define PT_PSCN 35
  96. #define PT_NSCN 36
  97. #define PT_LNTG 37
  98. #define PT_INSL 38
  99. #define PT_BHOL 39
  100. #define PT_WHOL 40
  101. #define PT_RBDM 41
  102. #define PT_LRBD 42
  103. #define PT_NTCT 43
  104. #define PT_SAND 44
  105. #define PT_GLAS 45
  106. #define PT_PTCT 46
  107. #define PT_BGLA 47
  108. #define PT_THDR 48
  109. #define PT_PLSM 49
  110. #define PT_ETRD 50
  111. #define PT_NICE 51
  112. #define PT_NBLE 52
  113. #define PT_BTRY 53
  114. #define PT_LCRY 54
  115. #define PT_STKM 55
  116. #define PT_SWCH 56
  117. #define PT_SMKE 57
  118. #define PT_DESL 58
  119. #define PT_COAL 59
  120. #define PT_LO2  60
  121. #define PT_O2   61
  122. #define PT_INWR 62
  123. #define PT_YEST 63
  124. #define PT_DYST 64
  125. #define PT_THRM 65
  126. #define PT_GLOW 66
  127. #define PT_BRCK 67
  128. #define PT_HFLM 68
  129. #define PT_FIRW 69
  130. #define PT_FUSE 70
  131. #define PT_FSEP 71
  132. #define PT_AMTR 72
  133. #define PT_BCOL 73
  134. #define PT_PCLN 74
  135. #define PT_HSWC 75
  136. #define PT_IRON 76
  137. #define PT_MORT 77
  138. #define PT_LIFE 78
  139. #define PT_DLAY 79
  140. #define PT_CO2  80
  141. #define PT_DRIC 81
  142. #define PT_CBNW 82
  143. #define PT_STOR 83
  144. #define PT_PVOD 84
  145. #define PT_CONV 85
  146. #define PT_CAUS 86
  147.  
  148. #define PT_LIGH 87
  149. #define PT_TESC 88
  150. #define PT_DEST 89
  151.  
  152. #define PT_SPNG 90
  153. #define PT_RIME 91
  154. #define PT_FOG 92
  155. #define PT_BCLN 93
  156. #define PT_LOVE 94
  157. #define PT_DEUT 95
  158. #define PT_WARP 96
  159. #define PT_PUMP 97
  160. #define PT_FWRK 98
  161. #define PT_PIPE 99
  162. #define PT_FRZZ 100
  163. #define PT_FRZW 101
  164. #define PT_GRAV 102
  165. #define PT_BIZR 103
  166. #define PT_BIZRG 104
  167. #define PT_BIZRS 105
  168. #define PT_INST 106
  169. #define PT_ISOZ 107
  170. #define PT_ISZS 108
  171. #define PT_PRTI 109
  172. #define PT_PRTO 110
  173. #define PT_PSTE 111
  174. #define PT_PSTS 112
  175. #define PT_ANAR 113
  176. #define PT_VINE 114
  177. #define PT_INVIS 115
  178. #define PT_EQUALVEL 116 //all particles equal their velocities
  179. #define PT_SPAWN2 117
  180. #define PT_SPAWN 118
  181. #define PT_SHLD1 119
  182. #define PT_SHLD2 120
  183. #define PT_SHLD3 121
  184. #define PT_SHLD4 122
  185. #define PT_LOLZ 123
  186. #define PT_WIFI 124
  187. #define PT_FILT 125
  188. #define PT_ARAY 126
  189. #define PT_BRAY 127
  190. #define PT_STKM2 128
  191. #define PT_BOMB 129
  192. #define PT_C5 130
  193. #define PT_SING 131
  194. #define PT_QRTZ 132
  195. #define PT_PQRT 133
  196. #define PT_EMP 134
  197. #define PT_BREC 135
  198. #define PT_ELEC 136
  199. #define PT_ACEL 137
  200. #define PT_DCEL 138
  201. #define PT_BANG 139
  202. #define PT_IGNT 140
  203. #define PT_BOYL 141
  204.  
  205. #define OLD_PT_WIND 147
  206. #define PT_H2   148
  207. #define PT_SOAP 149
  208. #define PT_NBHL 150
  209. #define PT_NWHL 151
  210. #define PT_MERC 152
  211. #define PT_PBCN 153
  212. #define PT_GPMP 154
  213. #define PT_CLST 155
  214. #define PT_WIRE 156
  215. #define PT_GBMB 157
  216. #define PT_FIGH 158
  217. #define PT_FRAY 159
  218. #define PT_REPL 160
  219. #define PT_WHET 161
  220. #define PT_WFLR 162
  221. #define PT_MASH 163
  222. #define PT_ALCO 164
  223. #define PT_ALCV 165
  224. #define PT_VODK 166
  225. #define PT_DMSH 167
  226. #define PT_NUM  168
  227.  
  228. #define R_TEMP 22
  229. #define MAX_TEMP 9999
  230. #define MIN_TEMP 0
  231. #define O_MAX_TEMP 3500
  232. #define O_MIN_TEMP -273
  233.  
  234. #define ST_NONE 0
  235. #define ST_SOLID 1
  236. #define ST_LIQUID 2
  237. #define ST_GAS 3
  238. /*
  239.    TODO: We should start to implement these.
  240. */
  241. #define TYPE_PART           0x00001 //1 Powders
  242. #define TYPE_LIQUID         0x00002 //2 Liquids
  243. #define TYPE_SOLID          0x00004 //4 Solids
  244. #define TYPE_GAS            0x00008 //8 Gasses (Includes plasma)
  245. #define TYPE_ENERGY         0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
  246. #define PROP_CONDUCTS       0x00020 //32 Conducts electricity
  247. #define PROP_BLACK          0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
  248. #define PROP_NEUTPENETRATE  0x00080 //128 Penetrated by neutrons
  249. #define PROP_NEUTABSORB     0x00100 //256 Absorbs neutrons, reflect is default
  250. #define PROP_NEUTPASS       0x00200 //512 Neutrons pass through, such as with glass
  251. #define PROP_DEADLY         0x00400 //1024 Is deadly for stickman
  252. #define PROP_HOT_GLOW       0x00800 //2048 Hot Metal Glow
  253. #define PROP_LIFE           0x01000 //4096 Is a GoL type
  254. #define PROP_RADIOACTIVE    0x02000 //8192 Radioactive
  255. #define PROP_LIFE_DEC       0x04000 //2^14 Life decreases by one every frame if > zero
  256. #define PROP_LIFE_KILL      0x08000 //2^15 Kill when life value is <= zero
  257. #define PROP_LIFE_KILL_DEC  0x10000 //2^16 Kill when life value is decremented to <= zero
  258. #define PROP_SPARKSETTLE    0x20000 //2^17 Allow Sparks/Embers to settle
  259.  
  260. #define FLAG_STAGNANT   1
  261. #define FLAG_SKIPMOVE   0x2 // skip movement for one frame, only implemented for PHOT
  262.  
  263. #define GRAPHICS_FUNC_ARGS particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb
  264. #define GRAPHICS_FUNC_SUBCALL_ARGS cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
  265.  
  266.  
  267. struct particle
  268. {
  269.     int type;
  270.     int life, ctype;
  271.     float x, y, vx, vy;
  272.     float temp;
  273.     float pavg[2];
  274.     int flags;
  275.     int tmp;
  276.     int tmp2;
  277.     unsigned int dcolour;
  278. };
  279. typedef struct particle particle;
  280.  
  281. int graphics_FIRE(GRAPHICS_FUNC_ARGS);
  282. int graphics_SMKE(GRAPHICS_FUNC_ARGS);
  283. int graphics_PLSM(GRAPHICS_FUNC_ARGS);
  284. int graphics_DEUT(GRAPHICS_FUNC_ARGS);
  285. int graphics_PHOT(GRAPHICS_FUNC_ARGS);
  286. int graphics_NEUT(GRAPHICS_FUNC_ARGS);
  287. int graphics_LAVA(GRAPHICS_FUNC_ARGS);
  288. int graphics_SPRK(GRAPHICS_FUNC_ARGS);
  289. int graphics_QRTZ(GRAPHICS_FUNC_ARGS);
  290. int graphics_CLST(GRAPHICS_FUNC_ARGS);
  291. int graphics_CBNW(GRAPHICS_FUNC_ARGS);
  292. int graphics_SPNG(GRAPHICS_FUNC_ARGS);
  293. int graphics_LIFE(GRAPHICS_FUNC_ARGS);
  294. int graphics_DUST(GRAPHICS_FUNC_ARGS);
  295. int graphics_GRAV(GRAPHICS_FUNC_ARGS);
  296. int graphics_WIFI(GRAPHICS_FUNC_ARGS);
  297. int graphics_PRTI(GRAPHICS_FUNC_ARGS);
  298. int graphics_PRTO(GRAPHICS_FUNC_ARGS);
  299. int graphics_BIZR(GRAPHICS_FUNC_ARGS);
  300. int graphics_PIPE(GRAPHICS_FUNC_ARGS);
  301. int graphics_INVS(GRAPHICS_FUNC_ARGS);
  302. int graphics_ACID(GRAPHICS_FUNC_ARGS);
  303. int graphics_FILT(GRAPHICS_FUNC_ARGS);
  304. int graphics_BRAY(GRAPHICS_FUNC_ARGS);
  305. int graphics_SWCH(GRAPHICS_FUNC_ARGS);
  306. int graphics_THDR(GRAPHICS_FUNC_ARGS);
  307. int graphics_GLOW(GRAPHICS_FUNC_ARGS);
  308. int graphics_LCRY(GRAPHICS_FUNC_ARGS);
  309. int graphics_PCLN(GRAPHICS_FUNC_ARGS);
  310. int graphics_PBCN(GRAPHICS_FUNC_ARGS);
  311. int graphics_DLAY(GRAPHICS_FUNC_ARGS);
  312. int graphics_HSWC(GRAPHICS_FUNC_ARGS);
  313. int graphics_PVOD(GRAPHICS_FUNC_ARGS);
  314. int graphics_STOR(GRAPHICS_FUNC_ARGS);
  315. int graphics_PUMP(GRAPHICS_FUNC_ARGS);
  316. int graphics_GPMP(GRAPHICS_FUNC_ARGS);
  317. int graphics_HFLM(GRAPHICS_FUNC_ARGS);
  318. int graphics_FIRW(GRAPHICS_FUNC_ARGS);
  319. int graphics_BOMB(GRAPHICS_FUNC_ARGS);
  320. int graphics_GBMB(GRAPHICS_FUNC_ARGS);
  321. int graphics_COAL(GRAPHICS_FUNC_ARGS);
  322. int graphics_STKM(GRAPHICS_FUNC_ARGS);
  323. int graphics_STKM2(GRAPHICS_FUNC_ARGS);
  324. int graphics_DEST(GRAPHICS_FUNC_ARGS);
  325. int graphics_EMP(GRAPHICS_FUNC_ARGS);
  326. int graphics_LIGH(GRAPHICS_FUNC_ARGS);
  327. int graphics_FIGH(GRAPHICS_FUNC_ARGS);
  328. int graphics_ELEC(GRAPHICS_FUNC_ARGS);
  329. int graphics_WIRE(GRAPHICS_FUNC_ARGS);
  330. int graphics_ACEL(GRAPHICS_FUNC_ARGS);
  331. int graphics_DCEL(GRAPHICS_FUNC_ARGS);
  332.  
  333. #define UPDATE_FUNC_ARGS int i, int x, int y, int surround_space, int nt
  334. // to call another update function with same arguments:
  335. #define UPDATE_FUNC_SUBCALL_ARGS i, x, y, surround_space, nt
  336.  
  337. struct playerst
  338. {
  339.     char comm;           //command cell
  340.     char pcomm;          //previous command
  341.     int elem;            //element power
  342.     float legs[16];      //legs' positions
  343.     float accs[8];       //accelerations
  344.     char spwn;           //if stick man was spawned
  345.     unsigned int frames; //frames since last particle spawn - used when spawning LIGH
  346. };
  347. typedef struct playerst playerst;
  348.  
  349. int update_ACID(UPDATE_FUNC_ARGS);
  350. int update_ANAR(UPDATE_FUNC_ARGS);
  351. int update_AMTR(UPDATE_FUNC_ARGS);
  352. int update_ARAY(UPDATE_FUNC_ARGS);
  353. int update_BCLN(UPDATE_FUNC_ARGS);
  354. int update_BCOL(UPDATE_FUNC_ARGS);
  355. int update_BMTL(UPDATE_FUNC_ARGS);
  356. int update_BRMT(UPDATE_FUNC_ARGS);
  357. int update_BOMB(UPDATE_FUNC_ARGS);
  358. int update_BOYL(UPDATE_FUNC_ARGS);
  359. int update_BTRY(UPDATE_FUNC_ARGS);
  360. int update_C5(UPDATE_FUNC_ARGS);
  361. int update_CLNE(UPDATE_FUNC_ARGS);
  362. int update_COAL(UPDATE_FUNC_ARGS);
  363. int update_DEUT(UPDATE_FUNC_ARGS);
  364. int update_DSTW(UPDATE_FUNC_ARGS);
  365. int update_FOG(UPDATE_FUNC_ARGS);
  366. int update_FRZW(UPDATE_FUNC_ARGS);
  367. int update_FRZZ(UPDATE_FUNC_ARGS);
  368. int update_FSEP(UPDATE_FUNC_ARGS);
  369. int update_FUSE(UPDATE_FUNC_ARGS);
  370. int update_FIRW(UPDATE_FUNC_ARGS);
  371. int update_FWRK(UPDATE_FUNC_ARGS);
  372. int update_GLAS(UPDATE_FUNC_ARGS);
  373. int update_GLOW(UPDATE_FUNC_ARGS);
  374. int update_GOO(UPDATE_FUNC_ARGS);
  375. int update_HSWC(UPDATE_FUNC_ARGS);
  376. int update_IRON(UPDATE_FUNC_ARGS);
  377. int update_ICEI(UPDATE_FUNC_ARGS);
  378. int update_ISZ(UPDATE_FUNC_ARGS);
  379. int update_LCRY(UPDATE_FUNC_ARGS);
  380. int update_MORT(UPDATE_FUNC_ARGS);
  381. int update_NBLE(UPDATE_FUNC_ARGS);
  382. int update_NEUT(UPDATE_FUNC_ARGS);
  383. int update_NPTCT(UPDATE_FUNC_ARGS);
  384. int update_PCLN(UPDATE_FUNC_ARGS);
  385. int update_PHOT(UPDATE_FUNC_ARGS);
  386. int update_PIPE(UPDATE_FUNC_ARGS);
  387. int update_PLNT(UPDATE_FUNC_ARGS);
  388. int update_PLUT(UPDATE_FUNC_ARGS);
  389. int update_PRTI(UPDATE_FUNC_ARGS);
  390. int update_PRTO(UPDATE_FUNC_ARGS);
  391. int update_PYRO(UPDATE_FUNC_ARGS);
  392. int update_PUMP(UPDATE_FUNC_ARGS);
  393. int update_QRTZ(UPDATE_FUNC_ARGS);
  394. int update_RIME(UPDATE_FUNC_ARGS);
  395. int update_SHLD1(UPDATE_FUNC_ARGS);
  396. int update_SHLD2(UPDATE_FUNC_ARGS);
  397. int update_SHLD3(UPDATE_FUNC_ARGS);
  398. int update_SHLD4(UPDATE_FUNC_ARGS);
  399. int update_SING(UPDATE_FUNC_ARGS);
  400. int update_SLTW(UPDATE_FUNC_ARGS);
  401. int update_SPAWN(UPDATE_FUNC_ARGS);
  402. int update_SPAWN2(UPDATE_FUNC_ARGS);
  403. int update_SPNG(UPDATE_FUNC_ARGS);
  404. int update_SPRK(UPDATE_FUNC_ARGS);
  405. int update_STKM(UPDATE_FUNC_ARGS);
  406. int update_STKM2(UPDATE_FUNC_ARGS);
  407. int update_SWCH(UPDATE_FUNC_ARGS);
  408. int update_THDR(UPDATE_FUNC_ARGS);
  409. int update_THRM(UPDATE_FUNC_ARGS);
  410. int update_URAN(UPDATE_FUNC_ARGS);
  411. int update_VINE(UPDATE_FUNC_ARGS);
  412. int update_WARP(UPDATE_FUNC_ARGS);
  413. int update_WATR(UPDATE_FUNC_ARGS);
  414. int update_WIFI(UPDATE_FUNC_ARGS);
  415. int update_WTRV(UPDATE_FUNC_ARGS);
  416. int update_YEST(UPDATE_FUNC_ARGS);
  417. int update_SOAP(UPDATE_FUNC_ARGS);
  418. int update_O2(UPDATE_FUNC_ARGS);
  419. int update_H2(UPDATE_FUNC_ARGS);
  420. int update_NBHL(UPDATE_FUNC_ARGS);
  421. int update_NWHL(UPDATE_FUNC_ARGS);
  422. int update_MERC(UPDATE_FUNC_ARGS);
  423. int update_PBCN(UPDATE_FUNC_ARGS);
  424. int update_GPMP(UPDATE_FUNC_ARGS);
  425. int update_CLST(UPDATE_FUNC_ARGS);
  426. int update_DLAY(UPDATE_FUNC_ARGS);
  427. int update_WIRE(UPDATE_FUNC_ARGS);
  428. int update_GBMB(UPDATE_FUNC_ARGS);
  429. int update_CO2(UPDATE_FUNC_ARGS);
  430. int update_CBNW(UPDATE_FUNC_ARGS);
  431. int update_STOR(UPDATE_FUNC_ARGS);
  432. int update_BIZR(UPDATE_FUNC_ARGS);
  433. int update_PVOD(UPDATE_FUNC_ARGS);
  434. int update_CONV(UPDATE_FUNC_ARGS);
  435. int update_CAUS(UPDATE_FUNC_ARGS);
  436. int update_DEST(UPDATE_FUNC_ARGS);
  437. int update_EMP(UPDATE_FUNC_ARGS);
  438. int update_LIGH(UPDATE_FUNC_ARGS);
  439. int update_FIGH(UPDATE_FUNC_ARGS);
  440. int update_ELEC(UPDATE_FUNC_ARGS);
  441. int update_ACEL(UPDATE_FUNC_ARGS);
  442. int update_DCEL(UPDATE_FUNC_ARGS);
  443. int update_BANG(UPDATE_FUNC_ARGS);
  444. int update_IGNT(UPDATE_FUNC_ARGS);
  445. int update_FRAY(UPDATE_FUNC_ARGS);
  446. int update_REPL(UPDATE_FUNC_ARGS);
  447. int update_MASH(UPDATE_FUNC_ARGS);
  448.  
  449. int update_MISC(UPDATE_FUNC_ARGS);
  450. int update_legacy_PYRO(UPDATE_FUNC_ARGS);
  451. int update_legacy_all(UPDATE_FUNC_ARGS);
  452. int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS);
  453. void STKM_init_legs(playerst* playerp, int i);
  454. void STKM_interact(playerst* playerp, int i, int x, int y);
  455.  
  456. struct part_type
  457. {
  458.     char *name;
  459.     pixel pcolors;
  460.     float advection;
  461.     float airdrag;
  462.     float airloss;
  463.     float loss;
  464.     float collision;
  465.     float gravity;
  466.     float diffusion;
  467.     float hotair;
  468.     int falldown;
  469.     int flammable;
  470.     int explosive;
  471.     int meltable;
  472.     int hardness;
  473.     int menu;
  474.     int enabled;
  475.     int weight;
  476.     int menusection;
  477.     float heat;
  478.     unsigned char hconduct;
  479.     char *descs;
  480.     char state;
  481.     unsigned int properties;
  482.     int (*update_func) (UPDATE_FUNC_ARGS);
  483.     int (*graphics_func) (GRAPHICS_FUNC_ARGS);
  484. };
  485. typedef struct part_type part_type;
  486.  
  487. struct part_transition
  488. {
  489.     float plv; // transition occurs if pv is lower than this
  490.     int plt;
  491.     float phv; // transition occurs if pv is higher than this
  492.     int pht;
  493.     float tlv; // transition occurs if t is lower than this
  494.     int tlt;
  495.     float thv; // transition occurs if t is higher than this
  496.     int tht;
  497. };
  498. typedef struct part_transition part_transition;
  499.  
  500. // TODO: falldown, properties, state - should at least one of these be removed?
  501. extern part_type ptypes[PT_NUM];
  502. extern unsigned int platent[PT_NUM];
  503.  
  504. // temporarily define abbreviations for impossible p/t values
  505. #define IPL -257.0f
  506. #define IPH 257.0f
  507. #define ITL MIN_TEMP-1
  508. #define ITH MAX_TEMP+1
  509. // no transition (PT_NONE means kill part)
  510. #define NT -1
  511. // special transition - lava ctypes etc need extra code, which is only found and run if ST is given
  512. #define ST PT_NUM
  513. extern part_transition ptransitions[PT_NUM];
  514.  
  515. //Old IDs for GOL types
  516. #define GT_GOL 78
  517. #define GT_HLIF 79
  518. #define GT_ASIM 80
  519. #define GT_2x2 81
  520. #define GT_DANI 82
  521. #define GT_AMOE 83
  522. #define GT_MOVE 84
  523. #define GT_PGOL 85
  524. #define GT_DMOE 86
  525. #define GT_34 87
  526. #define GT_LLIF 88
  527. #define GT_STAN 89
  528. #define GT_SEED 134
  529. #define GT_MAZE 135
  530. #define GT_COAG 136
  531. #define GT_WALL 137
  532. #define GT_GNAR 138
  533. #define GT_REPL 139
  534. #define GT_MYST 140
  535. #define GT_LOTE 142
  536. #define GT_FRG2 143
  537. #define GT_STAR 144
  538. #define GT_FROG 145
  539. #define GT_BRAN 146
  540.  
  541. //New IDs for GOL types
  542. #define NGT_GOL 0
  543. #define NGT_HLIF 1
  544. #define NGT_ASIM 2
  545. #define NGT_2x2 3
  546. #define NGT_DANI 4
  547. #define NGT_AMOE 5
  548. #define NGT_MOVE 6
  549. #define NGT_PGOL 7
  550. #define NGT_DMOE 8
  551. #define NGT_34 9
  552. #define NGT_LLIF 10
  553. #define NGT_STAN 11
  554. #define NGT_SEED 12
  555. #define NGT_MAZE 13
  556. #define NGT_COAG 14
  557. #define NGT_WALL 15
  558. #define NGT_GNAR 16
  559. #define NGT_REPL 17
  560. #define NGT_MYST 18
  561. #define NGT_LOTE 19
  562. #define NGT_FRG2 20
  563. #define NGT_STAR 21
  564. #define NGT_FROG 22
  565. #define NGT_BRAN 23
  566.  
  567. struct gol_menu
  568. {
  569.     const char *name;
  570.     pixel colour;
  571.     int goltype;
  572.     const char *description;
  573. };
  574. typedef struct gol_menu gol_menu;
  575.  
  576. static gol_menu gmenu[NGOL] =
  577. {
  578.     {"GOL",     PIXPACK(0x0CAC00), 0, "Game Of Life B3/S23"},
  579.     {"HLIF",    PIXPACK(0xFF0000), 1, "High Life B36/S23"},
  580.     {"ASIM",    PIXPACK(0x0000FF), 2, "Assimilation B345/S4567"},
  581.     {"2x2",     PIXPACK(0xFFFF00), 3, "2x2 B36/S125"},
  582.     {"DANI",    PIXPACK(0x00FFFF), 4, "Day and Night B3678/S34678"},
  583.     {"AMOE",    PIXPACK(0xFF00FF), 5, "Amoeba B357/S1358"},
  584.     {"MOVE",    PIXPACK(0xFFFFFF), 6, "'Move' particles. Does not move things.. it is a life type B368/S245"},
  585.     {"PGOL",    PIXPACK(0xE05010), 7, "Pseudo Life B357/S238"},
  586.     {"DMOE",    PIXPACK(0x500000), 8, "Diamoeba B35678/S5678"},
  587.     {"34",      PIXPACK(0x500050), 9, "34 B34/S34"},
  588.     {"LLIF",    PIXPACK(0x505050), 10, "Long Life B345/S5"},
  589.     {"STAN",    PIXPACK(0x5000FF), 11, "Stains B3678/S235678"},
  590.     {"SEED",    PIXPACK(0xFBEC7D), 12, "B2/S"},
  591.     {"MAZE",    PIXPACK(0xA8E4A0), 13, "B3/S12345"},
  592.     {"COAG",    PIXPACK(0x9ACD32), 14, "B378/S235678"},
  593.     {"WALL",    PIXPACK(0x0047AB), 15, "B45678/S2345"},
  594.     {"GNAR",    PIXPACK(0xE5B73B), 16, "B1/S1"},
  595.     {"REPL",    PIXPACK(0x259588), 17, "B1357/S1357"},
  596.     {"MYST",    PIXPACK(0x0C3C00), 18, "B3458/S05678"},
  597.     {"LOTE",    PIXPACK(0xFF0000), 19, "Behaves kinda like Living on the Edge S3458/B37/4"},
  598.     {"FRG2",    PIXPACK(0x00FF00), 20, "Like Frogs rule S124/B3/3"},
  599.     {"STAR",    PIXPACK(0x0000FF), 21, "Like Star Wars rule S3456/B278/6"},
  600.     {"FROG",    PIXPACK(0x00AA00), 22, "Frogs S12/B34/3"},
  601.     {"BRAN",    PIXPACK(0xCCCC00), 23, "Brian 6 S6/B246/3"}
  602. };
  603.  
  604. static int grule[NGOL+1][10] =
  605. {
  606. //   0,1,2,3,4,5,6,7,8,STATES    live=1  spawn=2 spawn&live=3   States are kind of how long until it dies, normal ones use two states(living,dead) for others the intermediate states live but do nothing
  607.     {0,0,0,0,0,0,0,0,0,2},//blank
  608.     {0,0,1,3,0,0,0,0,0,2},//GOL
  609.     {0,0,1,3,0,0,2,0,0,2},//HLIF
  610.     {0,0,0,2,3,3,1,1,0,2},//ASIM
  611.     {0,1,1,2,0,1,2,0,0,2},//2x2
  612.     {0,0,0,3,1,0,3,3,3,2},//DANI
  613.     {0,1,0,3,0,3,0,2,1,2},//AMOE
  614.     {0,0,1,2,1,1,2,0,2,2},//MOVE
  615.     {0,0,1,3,0,2,0,2,1,2},//PGOL
  616.     {0,0,0,2,0,3,3,3,3,2},//DMOE
  617.     {0,0,0,3,3,0,0,0,0,2},//34
  618.     {0,0,0,2,2,3,0,0,0,2},//LLIF
  619.     {0,0,1,3,0,1,3,3,3,2},//STAN
  620.     {0,0,2,0,0,0,0,0,0,2},//SEED
  621.     {0,1,1,3,1,1,0,0,0,2},//MAZE
  622.     {0,0,1,3,0,1,1,3,3,2},//COAG
  623.     {0,0,1,1,3,3,2,2,2,2},//WALL
  624.     {0,3,0,0,0,0,0,0,0,2},//GNAR
  625.     {0,3,0,3,0,3,0,3,0,2},//REPL
  626.     {1,0,0,2,2,3,1,1,3,2},//MYST
  627.     {0,0,0,3,1,1,0,2,1,4},//LOTE
  628.     {0,1,1,2,1,0,0,0,0,3},//FRG2
  629.     {0,0,2,1,1,1,1,2,2,6},//STAR
  630.     {0,1,1,2,2,0,0,0,0,3},//FROG
  631.     {0,0,2,0,2,0,3,0,0,3},//BRAN
  632. };
  633. static int goltype[NGOL] =
  634. {
  635.     GT_GOL,
  636.     GT_HLIF,
  637.     GT_ASIM,
  638.     GT_2x2,
  639.     GT_DANI,
  640.     GT_AMOE,
  641.     GT_MOVE,
  642.     GT_PGOL,
  643.     GT_DMOE,
  644.     GT_34,
  645.     GT_LLIF,
  646.     GT_STAN,
  647.     GT_SEED,
  648.     GT_MAZE,
  649.     GT_COAG,
  650.     GT_WALL,
  651.     GT_GNAR,
  652.     GT_REPL,
  653.     GT_MYST,
  654.     GT_LOTE,
  655.     GT_FRG2,
  656.     GT_STAR,
  657.     GT_FROG,
  658.     GT_BRAN,
  659. };
  660. static int loverule[9][9] =
  661. {
  662.     {0,0,1,1,0,0,0,0,0},
  663.     {0,1,0,0,1,1,0,0,0},
  664.     {1,0,0,0,0,0,1,0,0},
  665.     {1,0,0,0,0,0,0,1,0},
  666.     {0,1,0,0,0,0,0,0,1},
  667.     {1,0,0,0,0,0,0,1,0},
  668.     {1,0,0,0,0,0,1,0,0},
  669.     {0,1,0,0,1,1,0,0,0},
  670.     {0,0,1,1,0,0,0,0,0},
  671. };
  672. static int lolzrule[9][9] =
  673. {
  674.     {0,0,0,0,0,0,0,0,0},
  675.     {1,0,0,0,0,0,1,0,0},
  676.     {1,0,0,0,0,0,1,0,0},
  677.     {1,0,0,1,1,0,0,1,0},
  678.     {1,0,1,0,0,1,0,1,0},
  679.     {1,0,1,0,0,1,0,1,0},
  680.     {0,1,0,1,1,0,0,1,0},
  681.     {0,1,0,0,0,0,0,1,0},
  682.     {0,1,0,0,0,0,0,1,0},
  683. };
  684.  
  685. struct wall_type
  686. {
  687.     pixel colour;
  688.     pixel eglow; // if emap set, add this to fire glow
  689.     int drawstyle;
  690.     const char *descs;
  691. };
  692. typedef struct wall_type wall_type;
  693.  
  694. static wall_type wtypes[] =
  695. {
  696.     {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 0, "Wall. Indestructible. Blocks everything. Conductive."},
  697.     {PIXPACK(0x808080), PIXPACK(0x808080), 0, "E-Wall. Becomes transparent when electricity is connected."},
  698.     {PIXPACK(0xFF8080), PIXPACK(0xFF2008), 1, "Detector. Generates electricity when a particle is inside."},
  699.     {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Streamline. Set start point of a streamline."},
  700.     {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Sign. Click on a sign to edit it or anywhere else to place a new one."},
  701.     {PIXPACK(0x8080FF), PIXPACK(0x000000), 1, "Fan. Accelerates air. Use line tool to set direction and strength."},
  702.     {PIXPACK(0xC0C0C0), PIXPACK(0x101010), 2, "Wall. Blocks most particles but lets liquids through. Conductive."},
  703.     {PIXPACK(0x808080), PIXPACK(0x000000), 1, "Wall. Absorbs particles but lets air currents through."},
  704.     {PIXPACK(0x808080), PIXPACK(0x000000), 0, "Erases walls."},
  705.     {PIXPACK(0x808080), PIXPACK(0x000000), 3, "Wall. Indestructible. Blocks everything."},
  706.     {PIXPACK(0x3C3C3C), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks particles, allows air"},
  707.     {PIXPACK(0x575757), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and gasses, allows powders"},
  708.     {PIXPACK(0xFFFF22), PIXPACK(0x101010), 2, "Conductor, allows particles, conducts electricity"},
  709.     {PIXPACK(0x242424), PIXPACK(0x101010), 0, "E-Hole, absorbs particles, release them when powered"},
  710.     {PIXPACK(0xFFFFFF), PIXPACK(0x000000), -1, "Air, creates airflow and pressure"},
  711.     {PIXPACK(0xFFBB00), PIXPACK(0x000000), -1, "Heats the targetted element."},
  712.     {PIXPACK(0x00BBFF), PIXPACK(0x000000), -1, "Cools the targetted element."},
  713.     {PIXPACK(0x303030), PIXPACK(0x000000), -1, "Vacuum, reduces air pressure."},
  714.     {PIXPACK(0x579777), PIXPACK(0x000000), 1, "Wall. Indestructible. Blocks liquids and solids, allows gasses"},
  715.     {PIXPACK(0x000000), PIXPACK(0x000000), -1, "Drag tool"},
  716.     {PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, "Gravity wall"},
  717.     {PIXPACK(0x0000BB), PIXPACK(0x000000), -1, "Postive gravity tool."},
  718.     {PIXPACK(0x000099), PIXPACK(0x000000), -1, "Negative gravity tool."},
  719.     {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, "Energy wall, allows only energy type particles to pass"},
  720.     {PIXPACK(0xFFAA00), PIXPACK(0xAA5500), -1, "Property edit tool"},
  721. };
  722.  
  723. #define CHANNELS ((int)(MAX_TEMP-73)/100+2)
  724. particle portalp[CHANNELS][8][80];
  725. const particle emptyparticle;
  726. int wireless[CHANNELS][2];
  727. extern int portal_rx[8];
  728. extern int portal_ry[8];
  729.  
  730. extern int wire_placed;
  731.  
  732. extern playerst player;
  733. extern playerst player2;
  734.  
  735. extern playerst fighters[256];
  736. extern unsigned char fighcount;
  737.  
  738. extern int airMode;
  739.  
  740. extern particle *parts;
  741. extern particle *cb_parts;
  742. extern int parts_lastActiveIndex;
  743.  
  744. extern unsigned char bmap[YRES/CELL][XRES/CELL];
  745. extern unsigned char emap[YRES/CELL][XRES/CELL];
  746.  
  747. extern unsigned char cb_bmap[YRES/CELL][XRES/CELL];
  748. extern unsigned char cb_emap[YRES/CELL][XRES/CELL];
  749.  
  750. extern int pfree;
  751.  
  752. extern unsigned pmap[YRES][XRES];
  753. unsigned cb_pmap[YRES][XRES];
  754.  
  755. unsigned photons[YRES][XRES];
  756.  
  757. int do_move(int i, int x, int y, float nxf, float nyf);
  758. int try_move(int i, int x, int y, int nx, int ny);
  759. int eval_move(int pt, int nx, int ny, unsigned *rr);
  760. void init_can_move();
  761.  
  762. static void create_cherenkov_photon(int pp);
  763. static void create_gain_photon(int pp);
  764.  
  765. void kill_part(int i);
  766.  
  767. int flood_prop(int x, int y, size_t propoffset, void * propvalue, int proptype);
  768.  
  769. void detach(int i);
  770.  
  771. void part_change_type(int i, int x, int y, int t);
  772.  
  773. int InCurrentBrush(int i, int j, int rx, int ry);
  774.  
  775. int get_brush_flags();
  776.  
  777. int create_part(int p, int x, int y, int t);
  778.  
  779. void delete_part(int x, int y, int flags);
  780.  
  781. int is_wire(int x, int y);
  782.  
  783. int is_wire_off(int x, int y);
  784.  
  785. void set_emap(int x, int y);
  786.  
  787. int parts_avg(int ci, int ni, int t);
  788.  
  789. void create_arc(int sx, int sy, int dx, int dy, int midpoints, int variance, int type, int flags);
  790.  
  791. int nearest_part(int ci, int t, int max_d);
  792.  
  793. void update_particles_i(pixel *vid, int start, int inc);
  794.  
  795. void update_particles(pixel *vid);
  796.  
  797. void rotate_area(int area_x, int area_y, int area_w, int area_h, int invert);
  798.  
  799. void clear_area(int area_x, int area_y, int area_w, int area_h);
  800.  
  801. void create_box(int x1, int y1, int x2, int y2, int c, int flags);
  802.  
  803. int flood_parts(int x, int y, int c, int cm, int bm, int flags);
  804.  
  805. int create_parts(int x, int y, int rx, int ry, int c, int flags, int fill);
  806.  
  807. void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags);
  808.  
  809. void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
  810.  
  811. void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
  812.  
  813. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement