1 #ifndef ELEMENTCLASS_H
2 #define ELEMENTCLASS_H
3 
4 #include "graphics/Pixel.h"
5 #include "simulation/ElementDefs.h"
6 #include "simulation/Particle.h"
7 #include "simulation/StructProperty.h"
8 
9 class Simulation;
10 class Renderer;
11 class VideoBuffer;
12 struct Particle;
13 class Element
14 {
15 public:
16 	ByteString Identifier;
17 	String Name;
18 	pixel Colour;
19 	int MenuVisible;
20 	int MenuSection;
21 	int Enabled;
22 
23 	float Advection;
24 	float AirDrag;
25 	float AirLoss;
26 	float Loss;
27 	float Collision;
28 	float Gravity;
29 	float NewtonianGravity;
30 	float Diffusion;
31 	float HotAir;
32 	int Falldown;
33 	int Flammable;
34 	int Explosive;
35 	int Meltable;
36 	int Hardness;
37 	// Photon wavelengths are ANDed with this value when a photon hits an element, meaning that only wavelengths present in both this value and the original photon will remain in the reflected photon
38 	unsigned int PhotonReflectWavelengths;
39 	int Weight;
40 	unsigned char HeatConduct;
41 	String Description;
42 	unsigned int Properties;
43 
44 	float LowPressure;
45 	int LowPressureTransition;
46 	float HighPressure;
47 	int HighPressureTransition;
48 	float LowTemperature;
49 	int LowTemperatureTransition;
50 	float HighTemperature;
51 	int HighTemperatureTransition;
52 
53 	int (*Update) (UPDATE_FUNC_ARGS);
54 	int (*Graphics) (GRAPHICS_FUNC_ARGS);
55 
56 	void (*Create)(ELEMENT_CREATE_FUNC_ARGS) = nullptr;
57 	bool (*CreateAllowed)(ELEMENT_CREATE_ALLOWED_FUNC_ARGS) = nullptr;
58 	void (*ChangeType)(ELEMENT_CHANGETYPE_FUNC_ARGS) = nullptr;
59 
60 	bool (*CtypeDraw) (CTYPEDRAW_FUNC_ARGS);
61 
62 	VideoBuffer * (*IconGenerator)(int, int, int);
63 
64 	Particle DefaultProperties;
65 
66 	Element();
~Element()67 	virtual ~Element() {}
68 	static int defaultGraphics(GRAPHICS_FUNC_ARGS);
69 	static int legacyUpdate(UPDATE_FUNC_ARGS);
70 	static bool basicCtypeDraw(CTYPEDRAW_FUNC_ARGS);
71 	static bool ctypeDrawVInTmp(CTYPEDRAW_FUNC_ARGS);
72 	static bool ctypeDrawVInCtype(CTYPEDRAW_FUNC_ARGS);
73 
74 	/** Returns a list of properties, their type and offset within the structure that can be changed
75 	 by higher-level processes referring to them by name such as Lua or the property tool **/
76 	static std::vector<StructProperty> const &GetProperties();
77 
78 #define ELEMENT_NUMBERS_DECLARE
79 #include "ElementNumbers.h"
80 #undef ELEMENT_NUMBERS_DECLARE
81 };
82 
83 #endif
84