1 #include "simulation/ElementCommon.h" 2 3 static int update(UPDATE_FUNC_ARGS); 4 static int graphics(GRAPHICS_FUNC_ARGS); 5 static void create(ELEMENT_CREATE_FUNC_ARGS); 6 Element_GRVT()7void Element::Element_GRVT() 8 { 9 Identifier = "DEFAULT_PT_GRVT"; 10 Name = "GRVT"; 11 Colour = PIXPACK(0x00EE76); 12 MenuVisible = 1; 13 MenuSection = SC_NUCLEAR; 14 Enabled = 1; 15 16 Advection = 0.0f; 17 AirDrag = 0.00f * CFDS; 18 AirLoss = 1.00f; 19 Loss = 1.00f; 20 Collision = -.99f; 21 Gravity = 0.0f; 22 Diffusion = 0.00f; 23 HotAir = 0.000f * CFDS; 24 Falldown = 0; 25 26 Flammable = 0; 27 Explosive = 0; 28 Meltable = 0; 29 Hardness = 1; 30 31 Weight = -1; 32 33 HeatConduct = 61; 34 Description = "Gravitons. Create Newtonian Gravity."; 35 36 Properties = TYPE_ENERGY|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC; 37 38 LowPressure = IPL; 39 LowPressureTransition = NT; 40 HighPressure = IPH; 41 HighPressureTransition = NT; 42 LowTemperature = ITL; 43 LowTemperatureTransition = NT; 44 HighTemperature = ITH; 45 HighTemperatureTransition = NT; 46 47 DefaultProperties.tmp = 7; 48 49 Update = &update; 50 Graphics = &graphics; 51 Create = &create; 52 } 53 update(UPDATE_FUNC_ARGS)54static int update(UPDATE_FUNC_ARGS) 55 { 56 //at higher tmps they just go completely insane 57 if (parts[i].tmp >= 100) 58 parts[i].tmp = 100; 59 if (parts[i].tmp <= -100) 60 parts[i].tmp = -100; 61 62 sim->gravmap[(y/CELL)*(XRES/CELL)+(x/CELL)] = 0.2f*parts[i].tmp; 63 return 0; 64 } 65 graphics(GRAPHICS_FUNC_ARGS)66static int graphics(GRAPHICS_FUNC_ARGS) 67 { 68 *firea = 5; 69 *firer = 0; 70 *fireg = 250; 71 *fireb = 170; 72 73 *pixel_mode |= FIRE_BLEND; 74 return 1; 75 } 76 create(ELEMENT_CREATE_FUNC_ARGS)77static void create(ELEMENT_CREATE_FUNC_ARGS) 78 { 79 float a = RNG::Ref().between(0, 359) * 3.14159f / 180.0f; 80 sim->parts[i].life = 250 + RNG::Ref().between(0, 199); 81 sim->parts[i].vx = 2.0f*cosf(a); 82 sim->parts[i].vy = 2.0f*sinf(a); 83 } 84