2012-05-07 11:59:50 -05:00
# ifndef ELEMENTS_H_
# define ELEMENTS_H_
2012-01-08 11:39:03 -06:00
2019-04-20 07:12:32 -05:00
# include "Config.h"
2012-01-08 11:39:03 -06:00
//#include "Simulation.h"
# define R_TEMP 22
# define MAX_TEMP 9999
# define MIN_TEMP 0
# define O_MAX_TEMP 3500
# define O_MIN_TEMP -273
2013-06-10 09:51:55 -05:00
# define TYPE_PART 0x00001 //1 Powders
# define TYPE_LIQUID 0x00002 //2 Liquids
# define TYPE_SOLID 0x00004 //4 Solids
2017-03-17 23:35:33 -05:00
# define TYPE_GAS 0x00008 //8 Gases (Includes plasma)
2013-06-10 09:51:55 -05:00
# define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
2016-07-18 21:01:35 -05:00
# define STATE_FLAGS 0x0001F
2013-06-10 09:51:55 -05:00
# define PROP_CONDUCTS 0x00020 //32 Conducts electricity
# define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
# define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons
# define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default
# define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass
# define PROP_DEADLY 0x00400 //1024 Is deadly for stickman
# define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow
# define PROP_LIFE 0x01000 //4096 Is a GoL type
# define PROP_RADIOACTIVE 0x02000 //8192 Radioactive
# define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero
# define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
# define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
# define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
# define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
# define PROP_NOCTYPEDRAW 0x100000 // 2^20 When this element is drawn upon with, do not set ctype (like BCLN for CLNE)
2012-01-08 11:39:03 -06:00
2012-12-18 13:08:53 -06:00
# define FLAG_STAGNANT 0x1
2012-04-17 12:07:22 -05:00
# define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
2019-08-10 21:38:44 -05:00
//#define FLAG_WATEREQUAL 0x4 //if a liquid was already checked during equalization
2014-08-05 16:09:34 -05:00
# define FLAG_MOVABLE 0x8 // compatibility with old saves (moving SPNG), only applies to SPNG
# define FLAG_PHOTDECO 0x8 // compatibility with old saves (decorated photons), only applies to PHOT. Having the same value as FLAG_MOVABLE is fine because they apply to different elements, and this saves space for future flags,
2012-01-08 11:39:03 -06:00
# define UPDATE_FUNC_ARGS Simulation* sim, int i, int x, int y, int surround_space, int nt, Particle *parts, int pmap[YRES][XRES]
# define UPDATE_FUNC_SUBCALL_ARGS sim, i, x, y, surround_space, nt, parts, pmap
# define GRAPHICS_FUNC_ARGS Renderer * ren, 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
# define GRAPHICS_FUNC_SUBCALL_ARGS ren, cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb
2019-11-27 23:22:17 -06:00
# define ELEMENT_CREATE_FUNC_ARGS Simulation *sim, int i, int x, int y, int t, int v
Add CreateAllowed and ChangeType events
Used in create_part, kill_part, and part_change_type, allows us to remove element-specific stuff in those functions
Note: difference between Create and ChangeType is that Create is called when we want to initialize default element properties, but ChangeType is called every time a particle is changed to that type, even if it doesn't need default properties set. ChangeType is mainly used for things that need accurate state tracking, like the stkm spawn status.
ChangeType is called every time a particle is changed to or from its type, which includes if the particle is deleted, and also Lua.
Neither of these functions are called when loading saves, that's probably an oversight, will fix later
2019-11-29 18:32:33 -06:00
# define ELEMENT_CREATE_ALLOWED_FUNC_ARGS Simulation *sim, int i, int x, int y, int t
# define ELEMENT_CHANGETYPE_FUNC_ARGS Simulation *sim, int i, int x, int y, int from, int to
2019-07-22 07:38:22 -05:00
# define CTYPEDRAW_FUNC_ARGS Simulation *sim, int i, int t, int v
# define CTYPEDRAW_FUNC_SUBCALL_ARGS sim, i, t, v
2013-03-13 14:56:40 -05:00
# define BOUNDS_CHECK true
2013-03-13 14:54:34 -05:00
2012-05-07 11:59:50 -05:00
# define OLD_PT_WIND 147
2012-01-08 11:39:03 -06:00
2017-12-28 20:27:01 -06:00
// Change this to change the amount of bits used to store type in pmap (and a few elements such as PIPE and CRAY)
2017-12-31 22:55:41 -06:00
# define PMAPBITS 9
2017-12-29 16:34:19 -06:00
# define PMAPMASK ((1<<PMAPBITS)-1)
2017-12-28 20:27:01 -06:00
# define ID(r) ((r)>>PMAPBITS)
# define TYP(r) ((r)&PMAPMASK)
# define PMAP(id, typ) ((id)<<PMAPBITS | ((typ)&PMAPMASK))
# define PMAPID(id) ((id)<<PMAPBITS)
2017-12-29 16:34:19 -06:00
# define PT_NUM (1<<PMAPBITS)
2012-01-08 11:39:03 -06:00
2012-05-07 11:59:50 -05:00
struct playerst ;
2012-01-08 11:39:03 -06:00
2012-05-07 11:59:50 -05:00
# endif /* ELEMENTS_H_ */