summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PLSM.cpp
blob: 4812b844dd60bc3ffb543f0844fc6d57f2aa1847 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_PLSM PT_PLSM 49
Element_PLSM::Element_PLSM()
{
    Identifier = "DEFAULT_PT_PLSM";
    Name = "PLSM";
    Colour = PIXPACK(0xBB99FF);
    MenuVisible = 1;
    MenuSection = SC_GAS;
    Enabled = 1;
    
    Advection = 0.9f;
    AirDrag = 0.04f * CFDS;
    AirLoss = 0.97f;
    Loss = 0.20f;
    Collision = 0.0f;
    Gravity = -0.1f;
    Diffusion = 0.30f;
    HotAir = 0.001f	* CFDS;
    Falldown = 0;
    
    Flammable = 0;
    Explosive = 0;
    Meltable = 0;
    Hardness = 0;
    
    Weight = 1;
    
    Temperature = 10000.0f		+273.15f;
    HeatConduct = 5;
    Description = "Plasma, extremely hot.";
    
    State = ST_NONE;
    Properties = TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL;
    
    LowPressure = IPL;
    LowPressureTransition = NT;
    HighPressure = IPH;
    HighPressureTransition = NT;
    LowTemperature = ITL;
    LowTemperatureTransition = NT;
    HighTemperature = ITH;
    HighTemperatureTransition = NT;
    
    Update = &Element_FIRE::update;
    Graphics = &Element_PLSM::graphics;
}

//#TPT-Directive ElementHeader Element_PLSM static int graphics(GRAPHICS_FUNC_ARGS)
int Element_PLSM::graphics(GRAPHICS_FUNC_ARGS)

{
	int caddress = restrict_flt(restrict_flt((float)cpart->life, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
	*colr = (unsigned char)ren->plasma_data[caddress];
	*colg = (unsigned char)ren->plasma_data[caddress+1];
	*colb = (unsigned char)ren->plasma_data[caddress+2];
	
	*firea = 255;
	*firer = *colr;
	*fireg = *colg;
	*fireb = *colb;
	
	*pixel_mode = PMODE_GLOW | PMODE_ADD; //Clear default, don't draw pixel
	*pixel_mode |= FIRE_ADD;
	//Returning 0 means dynamic, do not cache
	return 0;
}


Element_PLSM::~Element_PLSM() {}