Merge with jacksonmj, Warning: potential for lot of bugs

This commit is contained in:
Simon 2011-01-27 20:32:34 +00:00
commit e9ae32b0cc
80 changed files with 16025 additions and 15851 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.*.swp
.directory
powder.def
gmon.out
*.*.orig

View File

@ -1,4 +1,4 @@
SOURCES := src/*.c
SOURCES := src/*.c src/elements/*.c
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations

0
includes/font.h Executable file → Normal file
View File

View File

@ -69,7 +69,6 @@ static menu_section msections[] =
{"\xC6", "Radioactive", 0, 1},
{"\xCC", "Special", 0, 1},
{"\xD2", "Life", 0, 1},
{"\xD2", "More Life", 0, 1},
{"\xC8", "Cracker", 0, 0},
{"\xC8", "Cracker!", 0, 0},
};

View File

@ -1,6 +1,7 @@
#ifndef POWDER_H
#define POWDER_H
#include "air.h"
#include "graphics.h"
#include "defines.h"
#include "interface.h"
@ -226,6 +227,81 @@
#define PROP_RADIOACTIVE 0x2000 //8192 Radioactive
#define FLAG_STAGNANT 1
#define UPDATE_FUNC_ARGS int i, int x, int y, int surround_space
// to call another update function with same arguments:
#define UPDATE_FUNC_SUBCALL_ARGS i, x, y, surround_space
int update_ACID(UPDATE_FUNC_ARGS);
int update_AMTR(UPDATE_FUNC_ARGS);
int update_ARAY(UPDATE_FUNC_ARGS);
int update_BCLN(UPDATE_FUNC_ARGS);
int update_BCOL(UPDATE_FUNC_ARGS);
int update_BMTL(UPDATE_FUNC_ARGS);
int update_BOMB(UPDATE_FUNC_ARGS);
int update_BOYL(UPDATE_FUNC_ARGS);
int update_BTRY(UPDATE_FUNC_ARGS);
int update_C5(UPDATE_FUNC_ARGS);
int update_CLNE(UPDATE_FUNC_ARGS);
int update_COAL(UPDATE_FUNC_ARGS);
int update_DEUT(UPDATE_FUNC_ARGS);
int update_DSTW(UPDATE_FUNC_ARGS);
int update_FOG(UPDATE_FUNC_ARGS);
int update_FRZW(UPDATE_FUNC_ARGS);
int update_FRZZ(UPDATE_FUNC_ARGS);
int update_FSEP(UPDATE_FUNC_ARGS);
int update_FUSE(UPDATE_FUNC_ARGS);
int update_FIRW(UPDATE_FUNC_ARGS);
int update_FWRK(UPDATE_FUNC_ARGS);
int update_GLAS(UPDATE_FUNC_ARGS);
int update_GLOW(UPDATE_FUNC_ARGS);
int update_GOO(UPDATE_FUNC_ARGS);
int update_HSWC(UPDATE_FUNC_ARGS);
int update_IRON(UPDATE_FUNC_ARGS);
int update_ICEI(UPDATE_FUNC_ARGS);
int update_ISZ(UPDATE_FUNC_ARGS);
int update_LCRY(UPDATE_FUNC_ARGS);
int update_MORT(UPDATE_FUNC_ARGS);
int update_NEUT(UPDATE_FUNC_ARGS);
int update_NPTCT(UPDATE_FUNC_ARGS);
int update_PCLN(UPDATE_FUNC_ARGS);
int update_PHOT(UPDATE_FUNC_ARGS);
int update_PIPE(UPDATE_FUNC_ARGS);
int update_PLNT(UPDATE_FUNC_ARGS);
int update_PLUT(UPDATE_FUNC_ARGS);
int update_PRTI(UPDATE_FUNC_ARGS);
int update_PRTO(UPDATE_FUNC_ARGS);
int update_PYRO(UPDATE_FUNC_ARGS);
int update_PUMP(UPDATE_FUNC_ARGS);
int update_QRTZ(UPDATE_FUNC_ARGS);
int update_RIME(UPDATE_FUNC_ARGS);
int update_SHLD1(UPDATE_FUNC_ARGS);
int update_SHLD2(UPDATE_FUNC_ARGS);
int update_SHLD3(UPDATE_FUNC_ARGS);
int update_SHLD4(UPDATE_FUNC_ARGS);
int update_SING(UPDATE_FUNC_ARGS);
int update_SLTW(UPDATE_FUNC_ARGS);
int update_SPAWN(UPDATE_FUNC_ARGS);
int update_SPAWN2(UPDATE_FUNC_ARGS);
int update_SPNG(UPDATE_FUNC_ARGS);
int update_SPRK(UPDATE_FUNC_ARGS);
int update_STKM(UPDATE_FUNC_ARGS);
int update_STKM2(UPDATE_FUNC_ARGS);
int update_SWCH(UPDATE_FUNC_ARGS);
int update_THDR(UPDATE_FUNC_ARGS);
int update_THRM(UPDATE_FUNC_ARGS);
int update_URAN(UPDATE_FUNC_ARGS);
int update_VINE(UPDATE_FUNC_ARGS);
int update_WARP(UPDATE_FUNC_ARGS);
int update_WATR(UPDATE_FUNC_ARGS);
int update_WIFI(UPDATE_FUNC_ARGS);
int update_WTRV(UPDATE_FUNC_ARGS);
int update_YEST(UPDATE_FUNC_ARGS);
int update_MISC(UPDATE_FUNC_ARGS);
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
int update_legacy_all(UPDATE_FUNC_ARGS);
struct particle
{
int type;
@ -261,25 +337,26 @@ struct part_type
float heat;
unsigned char hconduct;
const char *descs;
char state;
const unsigned short properties;
int (*update_func) (int);
int (*update_func) (UPDATE_FUNC_ARGS);
};
typedef struct part_type part_type;
struct part_state
struct part_transition
{
char state;
int solid;
float stemp;
int liquid;
float ltemp;
int gas;
float gtemp;
int burn;
float btemp;
float plv; // transition occurs if pv is lower than this
int plt;
float phv; // transition occurs if pv is higher than this
int pht;
float tlv; // transition occurs if t is lower than this
int tlt;
float thv; // transition occurs if t is higher than this
int tht;
};
typedef struct part_transition part_transition;
typedef struct part_state part_state;
//Should probably be const.
/* Weight Help
* 1 = Gas ||
@ -288,151 +365,153 @@ typedef struct part_state part_state;
* 100 = Solid ||
* -1 is Neutrons and Photons
*/
// TODO: falldown, properties, state - should at least one of these be removed?
static const part_type ptypes[PT_NUM] =
{
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins Description
{"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", 0, NULL},
{"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART, NULL},
{"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, NULL},
{"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable.", TYPE_LIQUID, NULL},
{"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air.", TYPE_GAS, NULL},
{"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable.", TYPE_PART, NULL},
{"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold.", TYPE_LIQUID, NULL},
{"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive.", TYPE_PART, NULL},
{"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive.", TYPE_LIQUID, NULL},
{"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches.", TYPE_SOLID, NULL},
{"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure.", TYPE_GAS, NULL},
{"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
{"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
{"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", TYPE_SOLID, NULL},
{"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
{"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", TYPE_SOLID, NULL},
{"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", TYPE_PART, NULL},
{"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", TYPE_SOLID, NULL},
{"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", TYPE_ENERGY, NULL},
{"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, NULL},
{"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", TYPE_SOLID, NULL},
{"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID, NULL},
{"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", TYPE_SOLID, NULL},
{"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", TYPE_GAS, NULL},
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", TYPE_PART, NULL},
{"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL},
{"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water.", TYPE_PART, NULL},
{"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, NULL},
{"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable.", TYPE_SOLID, NULL}, //ief015 - Added diamond. Because concrete blocks are kinda pointless.
{"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
{"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal.", TYPE_PART|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
{"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines.", TYPE_ENERGY, NULL},
{"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART | PROP_RADIOACTIVE, NULL},
{"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures.", TYPE_SOLID, NULL},
{"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax.", TYPE_LIQUID, NULL},
{"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor.", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon.", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold.", TYPE_LIQUID, NULL},
{"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity.", TYPE_SOLID, NULL},
{"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up.", TYPE_SOLID, NULL},
{"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away.", TYPE_SOLID, NULL},
{"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point", TYPE_SOLID|PROP_CONDUCTS, NULL},
{"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", TYPE_LIQUID|PROP_CONDUCTS, NULL},
{"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", TYPE_PART, NULL},
{"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS | PROP_HOT_GLOW, NULL},
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", TYPE_PART | PROP_HOT_GLOW, NULL},
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY, NULL},
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot.", TYPE_GAS, NULL},
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", TYPE_SOLID, NULL},
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity", TYPE_GAS | PROP_CONDUCTS, NULL},
{"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", TYPE_SOLID, NULL},
{"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", TYPE_SOLID, NULL},
{"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
{"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)", TYPE_SOLID, NULL},
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke", TYPE_GAS, NULL},
{"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures", TYPE_LIQUID, NULL},
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly.", TYPE_SOLID, NULL},
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire", TYPE_LIQUID, NULL},
{"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily.", TYPE_GAS, NULL},
{"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors.", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", TYPE_PART, NULL},
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", TYPE_PART, NULL},
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature.", TYPE_PART, NULL},
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", TYPE_LIQUID, NULL},
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", TYPE_SOLID|PROP_HOT_GLOW, NULL},
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", TYPE_GAS, NULL},
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", TYPE_PART, NULL},
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", TYPE_SOLID, NULL},
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", TYPE_PART, NULL},
{"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", TYPE_PART, NULL}, //Maybe TYPE_ENERGY?
{"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", TYPE_PART, NULL},
{"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches.", TYPE_SOLID, NULL},
{"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", TYPE_SOLID, NULL},
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", TYPE_SOLID | PROP_CONDUCTS, NULL},
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART, NULL},
{"GOL ", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", TYPE_SOLID|PROP_LIFE, NULL},
{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", TYPE_SOLID|PROP_LIFE, NULL},
{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", TYPE_SOLID|PROP_LIFE, NULL},
{"2x2 ", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", TYPE_SOLID|PROP_LIFE, NULL},
{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", TYPE_SOLID|PROP_LIFE, NULL},
{"AMOE", PIXPACK(0xFF00FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Amoeba! B357/S1358", TYPE_SOLID|PROP_LIFE, NULL},
{"MOVE", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "'Move' particles! Does not move things.. it is a life type B368/S245", TYPE_SOLID|PROP_LIFE, NULL},
{"PGOL", PIXPACK(0xE05010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Pseudo Life! B357/S238", TYPE_SOLID|PROP_LIFE, NULL},
{"DMOE", PIXPACK(0x500000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Diamoeba! B35678/S5678", TYPE_SOLID|PROP_LIFE, NULL},
{"34 ", PIXPACK(0x500050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "34! B34/S34)", TYPE_SOLID|PROP_LIFE, NULL},
{"LLIF", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Long Life! B345/S5", TYPE_SOLID|PROP_LIFE, NULL},
{"STAN", PIXPACK(0x5000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Stains! B3678/S235678", TYPE_SOLID|PROP_LIFE, NULL},
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.",TYPE_SOLID, NULL},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER2, 243.15f, 100, "Not quite Ice",TYPE_SOLID, NULL},
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_CRACKER2, 243.15f, 100, "Not quite Steam",TYPE_GAS, NULL},
{"BCLN", PIXPACK(0xFFD040), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", TYPE_SOLID, NULL},
{"LOVE", PIXPACK(0xFF30FF), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Love...", TYPE_SOLID, NULL},
{"DEUT", PIXPACK(0x00153F), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL},
{"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.",TYPE_GAS, NULL},
{"PUMP", PIXPACK(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_ELEC, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", TYPE_SOLID, NULL},
{"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 1, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", TYPE_PART, NULL},
{"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", TYPE_SOLID, NULL},
{"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", TYPE_PART, NULL},
{"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_CRACKER2, 120.0f, 29, "FREEZE WATER", TYPE_LIQUID, NULL},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Changes colour based on velocity.", TYPE_PART, NULL},
{"BIZR", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID, NULL},
{"BIZG", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS, NULL},
{"BIZS", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID, NULL},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, PSCN to charge, NSCN to take.", TYPE_SOLID, NULL},
{"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID, NULL},
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal IN. Things go in here, now with channels (same as WIFI)", TYPE_SOLID, NULL},
{"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal OUT. Things come out here, now with channels (same as WIFI)", TYPE_SOLID, NULL},
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, NULL},
{"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID, NULL},
{"ANAR", PIXPACK(0xFFFFEE), -0.7f, -0.02f * CFDS, 0.96f, 0.80f, 0.1f, -0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART, NULL},
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID, NULL},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID | PROP_NEUTPASS, NULL},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART, NULL},
{"SPWN2", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0, NULL},
{"SPWN", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0, NULL},
{"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0, NULL},
{"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 2", 0, NULL},
{"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", 0, NULL},
{"SHD4", PIXPACK(0x212121), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 4", 0, NULL},
{"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Lolz", TYPE_SOLID, NULL},
{"WIFI", PIXPACK(0x40A060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 2, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", TYPE_SOLID, NULL},
{"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID, NULL},
{"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
{"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL},
{"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
{"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", TYPE_PART, NULL},
{"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID | PROP_HOT_GLOW, NULL},
{"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", TYPE_PART| PROP_HOT_GLOW, NULL},
{"SEED", PIXPACK(0xFBEC7D), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B2/S", TYPE_SOLID|PROP_LIFE, NULL},
{"MAZE", PIXPACK(0xA8E4A0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3/S12345", TYPE_SOLID|PROP_LIFE, NULL},
{"COAG", PIXPACK(0x9ACD32), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B378/S235678", TYPE_SOLID|PROP_LIFE, NULL},
{"WALL", PIXPACK(0x0047AB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B45678/S2345", TYPE_SOLID|PROP_LIFE, NULL},
{"GNAR", PIXPACK(0xE5B73B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1/S1", TYPE_SOLID|PROP_LIFE, NULL},
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", TYPE_SOLID|PROP_LIFE, NULL},
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", TYPE_SOLID|PROP_LIFE, NULL},
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", TYPE_GAS, NULL},
{"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", ST_NONE, 0, NULL},
{"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", ST_SOLID, TYPE_PART, NULL},
{"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, &update_WATR},
{"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable.", ST_LIQUID, TYPE_LIQUID, NULL},
{"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air.", ST_GAS, TYPE_GAS, &update_PYRO},
{"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable.", ST_SOLID, TYPE_PART, NULL},
{"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold.", ST_LIQUID, TYPE_LIQUID, &update_PYRO},
{"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive.", ST_SOLID, TYPE_PART, NULL},
{"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive.", ST_LIQUID, TYPE_LIQUID, NULL},
{"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches.", ST_SOLID, TYPE_SOLID, &update_CLNE},
{"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquefies under pressure.", ST_GAS, TYPE_GAS, NULL},
{"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
{"GOO", PIXPACK(0x804000), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_GOO},
{"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", ST_SOLID, TYPE_SOLID, &update_ICEI},
{"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
{"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", ST_SOLID, TYPE_SOLID, &update_SPRK},
{"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", ST_SOLID, TYPE_PART, &update_ICEI},
{"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", ST_SOLID, TYPE_SOLID, NULL},
{"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", ST_GAS, TYPE_ENERGY, &update_NEUT},
{"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", ST_SOLID, TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, &update_PLUT},
{"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", ST_SOLID, TYPE_SOLID, &update_PLNT},
{"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", ST_LIQUID, TYPE_LIQUID, &update_ACID},
{"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", ST_SOLID, TYPE_SOLID, NULL},
{"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", ST_GAS, TYPE_GAS, &update_WTRV},
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", ST_SOLID, TYPE_PART, NULL},
{"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_DSTW},
{"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water.", ST_SOLID, TYPE_PART, NULL},
{"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE, &update_SLTW},
{"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructible.", ST_SOLID, TYPE_SOLID, NULL},
{"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, &update_BMTL},
{"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal.", ST_SOLID, TYPE_PART|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
{"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines.", ST_GAS, TYPE_ENERGY, &update_PHOT},
{"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", ST_SOLID, TYPE_PART | PROP_RADIOACTIVE, &update_URAN},
{"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures.", ST_SOLID, TYPE_SOLID, NULL},
{"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax.", ST_LIQUID, TYPE_LIQUID, NULL},
{"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, NULL},
{"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, NULL},
{"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold.", ST_SOLID, TYPE_LIQUID, NULL},
{"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity.", ST_SOLID, TYPE_SOLID, NULL},
{"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up.", ST_NONE, TYPE_SOLID, NULL},
{"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away.", ST_NONE, TYPE_SOLID, NULL},
{"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, NULL},
{"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", ST_LIQUID, TYPE_LIQUID|PROP_CONDUCTS, NULL},
{"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, &update_NPTCT},
{"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", ST_SOLID, TYPE_PART, NULL},
{"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", ST_SOLID, TYPE_SOLID | PROP_NEUTPASS | PROP_HOT_GLOW, &update_GLAS},
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 100C)", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, &update_NPTCT},
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", ST_SOLID, TYPE_PART | PROP_HOT_GLOW, NULL},
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_ENERGY, &update_THDR},
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot.", ST_NONE, TYPE_GAS, &update_PYRO},
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", ST_NONE, TYPE_SOLID|PROP_CONDUCTS, NULL},
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL},
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS, NULL},
{"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", ST_SOLID, TYPE_SOLID, &update_BTRY},
{"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", ST_SOLID, TYPE_SOLID, &update_LCRY},
{"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM},
{"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)", ST_SOLID, TYPE_SOLID, &update_SWCH},
{"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke", ST_SOLID, TYPE_GAS, NULL},
{"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures", ST_LIQUID, TYPE_LIQUID, NULL},
{"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly.", ST_SOLID, TYPE_SOLID, &update_COAL},
{"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire", ST_LIQUID, TYPE_LIQUID, NULL},
{"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily.", ST_GAS, TYPE_GAS, NULL},
{"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, NULL},
{"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", ST_SOLID, TYPE_PART, &update_YEST},
{"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", ST_SOLID, TYPE_PART, NULL},
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremely high temperature.", ST_SOLID, TYPE_PART, &update_THRM},
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", ST_LIQUID, TYPE_LIQUID, &update_GLOW},
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", ST_SOLID, TYPE_SOLID|PROP_HOT_GLOW, NULL},
{"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", ST_LIQUID, TYPE_GAS, NULL},
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE},
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP},
{"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, NULL}, //Maybe TYPE_ENERGY?
{"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", ST_SOLID, TYPE_PART, &update_BCOL},
{"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN},
{"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC},
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, &update_IRON},
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
{"GOL ", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"2x2 ", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"AMOE", PIXPACK(0xFF00FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Amoeba! B357/S1358", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"MOVE", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "'Move' particles! Does not move things.. it is a life type B368/S245", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"PGOL", PIXPACK(0xE05010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Pseudo Life! B357/S238", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"DMOE", PIXPACK(0x500000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Diamoeba! B35678/S5678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"34 ", PIXPACK(0x500050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "34! B34/S34)", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"LLIF", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Long Life! B345/S5", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"STAN", PIXPACK(0x5000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Stains! B3678/S235678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.", ST_SOLID, TYPE_SOLID, &update_SPNG},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER2, 243.15f, 100, "Not quite Ice", ST_SOLID, TYPE_SOLID, &update_RIME},
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_CRACKER2, 243.15f, 100, "Not quite Steam", ST_GAS, TYPE_GAS, &update_FOG},
{"BCLN", PIXPACK(0xFFD040), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", ST_NONE, TYPE_SOLID, &update_BCLN},
{"LOVE", PIXPACK(0xFF30FF), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Love...", ST_GAS, TYPE_SOLID, &update_MISC},
{"DEUT", PIXPACK(0x00153F), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_DEUT},
{"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.", ST_GAS, TYPE_GAS, &update_WARP},
{"PUMP", PIXPACK(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_ELEC, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID, &update_PUMP},
{"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 1, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", ST_SOLID, TYPE_PART, &update_FWRK},
{"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", ST_SOLID, TYPE_SOLID, &update_PIPE},
{"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", ST_SOLID, TYPE_PART, &update_FRZZ},
{"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_CRACKER2, 120.0f, 29, "FREEZE WATER", ST_LIQUID, TYPE_LIQUID, &update_FRZW},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Changes colour based on velocity.", ST_SOLID, TYPE_PART, &update_MISC},
{"BIZR", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "Bizarre... contradicts the normal state changes.", ST_LIQUID, TYPE_LIQUID, NULL},
{"BIZG", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", ST_GAS, TYPE_GAS, NULL},
{"BIZS", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", ST_SOLID, TYPE_SOLID, NULL},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, PSCN to charge, NSCN to take.", ST_SOLID, TYPE_SOLID, NULL},
{"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_ISZ},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", ST_SOLID, TYPE_SOLID, &update_ISZ},
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal IN. Things go in here, now with channels (same as WIFI)", ST_SOLID, TYPE_SOLID, &update_PRTI},
{"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 0, "Portal OUT. Things come out here, now with channels (same as WIFI)", ST_SOLID, TYPE_SOLID, &update_PRTO},
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", ST_LIQUID, TYPE_LIQUID, NULL},
{"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", ST_SOLID, TYPE_SOLID, NULL},
{"ANAR", PIXPACK(0xFFFFEE), -0.7f, -0.02f * CFDS, 0.96f, 0.80f, 0.1f, -0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", ST_SOLID, TYPE_PART, NULL},
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", ST_SOLID, TYPE_SOLID, &update_VINE},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", ST_SOLID, TYPE_SOLID | PROP_NEUTPASS, NULL},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", ST_SOLID, TYPE_PART, NULL},
{"SPWN2", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "STK2 spawn point", ST_SOLID, 0, &update_SPAWN2},
{"SPWN", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "STKM spawn point", ST_SOLID, 0, &update_SPAWN},
{"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", ST_SOLID, 0, &update_SHLD1},
{"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 2", ST_SOLID, 0, &update_SHLD2},
{"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", ST_SOLID, 0, &update_SHLD3},
{"SHD4", PIXPACK(0x212121), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 0, "Shield lvl 4", ST_SOLID, 0, &update_SHLD4},
{"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_CRACKER2, 373.0f, 40, "Lolz", ST_GAS, TYPE_SOLID, &update_MISC},
{"WIFI", PIXPACK(0x40A060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 2, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 0, "Wireless transmitter, color coded.", ST_SOLID, TYPE_SOLID, &update_WIFI},
{"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", ST_SOLID, TYPE_SOLID, NULL},
{"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emitter. Rays create points when they collide", ST_SOLID, TYPE_SOLID, &update_ARAY},
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", ST_SOLID, TYPE_SOLID, NULL},
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", ST_NONE, 0, &update_STKM2},
{"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", ST_NONE, TYPE_PART, &update_BOMB},
{"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", ST_SOLID, TYPE_SOLID | PROP_NEUTPENETRATE, &update_C5},
{"SING", PIXPACK(0x242424), 0.7f, 0.36f * CFDS, 0.96f, 0.80f, 0.1f, 0.12f, 0.00f, -0.001f * CFDS, 1, 0, 0, 0, 0, 1, 86, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Singularity", ST_SOLID, TYPE_PART, &update_SING},
{"QRTZ", PIXPACK(0xAADDDD), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 3, "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, &update_QRTZ},
{"PQRT", PIXPACK(0x88BBBB), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.27f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 3, "Broken quartz.", ST_SOLID, TYPE_PART| PROP_HOT_GLOW, NULL},
{"SEED", PIXPACK(0xFBEC7D), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B2/S", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"MAZE", PIXPACK(0xA8E4A0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3/S12345", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"COAG", PIXPACK(0x9ACD32), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B378/S235678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"WALL", PIXPACK(0x0047AB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B45678/S2345", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"GNAR", PIXPACK(0xE5B73B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1/S1", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
{"LOTE", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", TYPE_SOLID|PROP_LIFE, NULL},
{"FRG2", PIXPACK(0x00FF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", TYPE_SOLID|PROP_LIFE, NULL},
{"STAR", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", TYPE_SOLID|PROP_LIFE, NULL},
@ -441,158 +520,175 @@ static const part_type ptypes[PT_NUM] =
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
};
static part_state pstates[PT_NUM] =
{
// Name State Solid Frzp Liquid Mpnt Gas Bpoint 'Plasma' Flashpoint
/* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f},
/* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f},
/* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f},
/* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f},
/* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f},
/* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f},
/* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f},
/* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f},
/* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WTRV */ {ST_GAS, PT_RIME, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f},
/* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f},
/* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f},
/* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f},
/* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f},
/* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f},
/* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f},
/* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f},
/* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f},
/* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f},
/* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f},
/* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f},
/* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* MORT */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPNG */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 2730.0f},
/* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.15f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FOG */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LOVE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WTF */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WARP */ {ST_GAS , PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PUMP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZZ */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZW */ {ST_LIQUID, PT_ICEI, 53.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GRAV */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BIZR */ {ST_LIQUID, PT_BIZRG, 100.0f, PT_NONE, 0.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f},
/* BIZRG*/ {ST_GAS , PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f},
/* BIZRS*/ {ST_SOLID, PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f},
/* INST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ISOZ */ {ST_LIQUID, PT_ISZS, 160.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ISZS */ {ST_SOLID, PT_NONE, 0.0f, PT_ISOZ, 300.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PRTI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PRTO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PSTE */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PSTS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ANAR */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* VINE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* INVS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPWN2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SPAWN*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD1*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD4*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LOlZ */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WIFI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FILT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* STKM2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f},
/* BOMB */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* C-5 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SING */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* QRTZ */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 2573.15f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PQRT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 2573.15f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BOYL */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
// temporarily define abbreviations for impossible p/t values
#define IPL -257.0f
#define IPH 257.0f
#define ITL MIN_TEMP-1
#define ITH MAX_TEMP+1
// no transition (PT_NONE means kill part)
#define NT -1
// special transition - lava ctypes etc need extra code, which is only found and run if ST is given
#define ST PT_NUM
static part_transition ptransitions[PT_NUM] =
{ // if low pressure if high pressure if low temperature if high temperature
// Name plv plt phv pht tlv tlt thv tht
/* NONE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* DUST */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WATR */ {IPL, NT, IPH, NT, 273.15f,PT_ICEI, 373.0f, PT_WTRV},
/* OIL */ {IPL, NT, IPH, NT, ITL, NT, 333.0f, PT_GAS},
/* FIRE */ {IPL, NT, IPH, NT, ITL, NT, 2773.0f,PT_PLSM},
/* STNE */ {IPL, NT, IPH, NT, ITL, NT, 983.0f, PT_LAVA},
/* LAVA */ {IPL, NT, IPH, NT, 2573.15f,ST, ITH, NT}, // 2573.15f is highest melt pt of possible ctypes
/* GUN */ {IPL, NT, IPH, NT, ITL, NT, 673.0f, PT_FIRE},
/* NITR */ {IPL, NT, IPH, NT, ITL, NT, 673.0f, PT_FIRE},
/* CLNE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GAS */ {-6.0f, PT_OIL, 6.0f, PT_OIL, ITL, NT, 573.0f, PT_FIRE},
/* C-4 */ {IPL, NT, IPH, NT, ITL, NT, 673.0f, PT_FIRE},
/* GOO */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* ICE */ {IPL, NT, 0.8f, PT_SNOW, ITL, NT, 233.0f, ST},
/* METL */ {IPL, NT, IPH, NT, ITL, NT, 1273.0f,PT_LAVA},
/* SPRK */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SNOW */ {IPL, NT, IPH, NT, ITL, NT, 273.0f, PT_WATR},
/* WOOD */ {IPL, NT, IPH, NT, ITL, NT, 873.0f, PT_FIRE},
/* NEUT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PLUT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PLNT */ {IPL, NT, IPH, NT, ITL, NT, 573.0f, PT_FIRE},
/* ACID */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* VOID */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WTRV */ {IPL, NT, IPH, NT, 371.0f, ST, ITH, NT},
/* CNCT */ {IPL, NT, IPH, NT, ITL, NT, 1123.0f,PT_LAVA},
/* DSTW */ {IPL, NT, IPH, NT, 273.15f,PT_ICEI, 373.0f, PT_WTRV},
/* SALT */ {IPL, NT, IPH, NT, ITL, NT, 1173.0f,PT_LAVA},
/* SLTW */ {IPL, NT, IPH, NT, 233.0f, PT_ICEI, 483.0f, ST},
/* DMND */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BMTL */ {IPL, NT, 1.0f, ST, ITL, NT, 1273.0f,PT_LAVA},
/* BRMT */ {IPL, NT, IPH, NT, ITL, NT, 1273.0f,PT_LAVA},
/* PHOT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* URAN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WAX */ {IPL, NT, IPH, NT, ITL, NT, 319.0f, PT_MWAX},
/* MWAX */ {IPL, NT, IPH, NT, 318.0f, PT_WAX, 673.0f, PT_FIRE},
/* PSCN */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
/* NSCN */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
/* LN2 */ {IPL, NT, IPH, NT, 63.0f, PT_NICE, 77.0f, PT_NONE},
/* INSL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BHOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WHOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* RBDM */ {IPL, NT, IPH, NT, ITL, NT, 312.0f, PT_LRBD},
/* LRBD */ {IPL, NT, IPH, NT, 311.0f, PT_RBDM, 961.0f, PT_FIRE},
/* NTCT */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
/* SAND */ {IPL, NT, IPH, NT, ITL, NT, 1973.0f,PT_LAVA},
/* GLAS */ {IPL, NT, IPH, NT, ITL, NT, 1973.0f,PT_LAVA},
/* PTCT */ {IPL, NT, IPH, NT, ITL, NT, 1414.0f,PT_LAVA},
/* BGLA */ {IPL, NT, IPH, NT, ITL, NT, 1973.0f,PT_LAVA},
/* THDR */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PLSM */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* ETRD */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* NICE */ {IPL, NT, IPH, NT, ITL, NT, 63.1f, PT_LNTG},
/* NBLE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BTRY */ {IPL, NT, IPH, NT, ITL, NT, 2273.0f,PT_PLSM},
/* LCRY */ {IPL, NT, IPH, NT, ITL, NT, 1273.0f,PT_BGLA},
/* STKM */ {IPL, NT, IPH, NT, ITL, NT, 620.0f, PT_FIRE},
/* SWCH */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SMKE */ {IPL, NT, IPH, NT, ITL, NT, 625.0f, PT_FIRE},
/* DESL */ {IPL, NT, 5.0f, PT_FIRE, ITL, NT, 335.0f, PT_FIRE},
/* COAL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* LO2 */ {IPL, NT, IPH, NT, ITL, NT, 90.1f, PT_O2},
/* O2 */ {IPL, NT, IPH, NT, 90.0f, PT_LO2, ITH, NT},
/* INWR */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
/* YEST */ {IPL, NT, IPH, NT, ITL, NT, 373.0f, PT_DYST},
/* DYST */ {IPL, NT, IPH, NT, ITL, NT, 473.0f, PT_DUST},
/* THRM */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GLOW */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BRCK */ {IPL, NT, 8.8f, PT_STNE, ITL, NT, 1223.0f,PT_LAVA},
/* CFLM */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FIRW */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FUSE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FSEP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* AMTR */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BCOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PCLN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* HSWC */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* IRON */ {IPL, NT, IPH, NT, ITL, NT, 1687.0f,PT_LAVA},
/* MORT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SPNG */ {IPL, NT, IPH, NT, ITL, NT, 2730.0f,PT_FIRE},
/* RIME */ {IPL, NT, IPH, NT, ITL, NT, 273.15f,PT_WATR},
/* FOG */ {IPL, NT, IPH, NT, ITL, NT, 373.15f,PT_WTRV},
/* BCLN */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* LOVE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* DEUT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WARP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PUMP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FWRK */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PIPE */ {IPL, NT, 10.0f, PT_BRMT, ITL, NT, ITH, NT},
/* FRZZ */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* FRZW */ {IPL, NT, IPH, NT, ITL, NT, 53.0f, PT_ICEI},
/* GRAV */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BIZR */ {IPL, NT, IPH, NT, 100.0f, PT_BIZRG, 400.0f, PT_BIZRS},
/* BIZRG*/ {IPL, NT, IPH, NT, ITL, NT, 100.0f, PT_BIZR},//, 400.0f, PT_BIZRS},
/* BIZRS*/ {IPL, NT, IPH, NT, 400.0f, PT_BIZR, ITH, NT},// 100.0f, PT_BIZRG},
/* INST */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* ISOZ */ {IPL, NT, IPH, NT, 160.0f, PT_ISZS, ITH, NT},
/* ISZS */ {IPL, NT, IPH, NT, ITL, NT, 300.0f, PT_ISOZ},
/* PRTI */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PRTO */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PSTE */ {IPL, NT, 0.5f, PT_PSTS, ITL, NT, 747.0f, PT_BRCK},
/* PSTS */ {0.5f, PT_PSTE, IPH, NT, ITL, NT, ITH, NT},
/* ANAR */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* VINE */ {IPL, NT, IPH, NT, ITL, NT, 573.0f, PT_FIRE},
/* INVS */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* EQVE */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SPWN2*/ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SPAWN*/ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SHLD1*/ {IPL, NT, 7.0f, PT_NONE, ITL, NT, ITH, NT},
/* SHLD2*/ {IPL, NT, 15.0f, PT_NONE, ITL, NT, ITH, NT},
/* SHLD3*/ {IPL, NT, 25.0f, PT_NONE, ITL, NT, ITH, NT},
/* SHLD4*/ {IPL, NT, 40.0f, PT_NONE, ITL, NT, ITH, NT},
/* LOlZ */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* WIFI */ {IPL, NT, 15.0f, PT_BRMT, ITL, NT, ITH, NT},
/* FILT */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* ARAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BRAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* STKM2*/ {IPL, NT, IPH, NT, ITL, NT, 620.0f, PT_FIRE},
/* BOMB */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* C-5 */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* SING */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* QRTZ */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
/* PQRT */ {IPL, NT, IPH, NT, ITL, NT, 2573.15f,PT_LAVA},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* BOYL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
};
static int grule[NGOL][10] =
#undef IPL
#undef IPH
#undef ITL
#undef ITH
#undef NT
#undef ST
static int grule[NGOL][9] =
{
// 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
{0,0,0,0,0,0,0,0,0,2},//blank
@ -672,10 +768,10 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
};
int portal[MAX_TEMP/100][8][80];
float portaltemp[MAX_TEMP/100][8][80];
int portalctype[MAX_TEMP/100][8][80];
int wireless[MAX_TEMP/100][2];
int portal[(int)(MAX_TEMP-73.15f)/100+2][8][80];
float portaltemp[(int)(MAX_TEMP-73.15f)/100+2][8][80];
int portalctype[(int)(MAX_TEMP-73.15f)/100+2][8][80];
int wireless[(int)(MAX_TEMP-73.15f)/100+2][2];
extern int isplayer;
extern float player[27];
@ -701,9 +797,19 @@ unsigned cb_pmap[YRES][XRES];
unsigned photons[YRES][XRES];
int try_move(int i, int x, int y, int nx, int ny);
int eval_move(int pt, int nx, int ny, unsigned *rr);
static void create_cherenkov_photon(int pp);
static void create_gain_photon(int pp);
void kill_part(int i);
#if defined(WIN32) && !defined(__GNUC__)
extern _inline void part_change_type(int n, int x, int y, int t);
#else
extern inline void part_change_type(int i, int x, int y, int t);
#endif
#if defined(WIN32) && !defined(__GNUC__)
extern _inline int create_part(int p, int x, int y, int t);
#else

View File

@ -18,24 +18,70 @@ void make_kernel(void)
{
int i, j;
float s = 0.0f;
for(j=-1; j<2; j++)
for(i=-1; i<2; i++)
for (j=-1; j<2; j++)
for (i=-1; i<2; i++)
{
kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j));
s += kernel[(i+1)+3*(j+1)];
}
s = 1.0f / s;
for(j=-1; j<2; j++)
for(i=-1; i<2; i++)
for (j=-1; j<2; j++)
for (i=-1; i<2; i++)
kernel[(i+1)+3*(j+1)] *= s;
}
void update_air(void)
{
int x, y, i, j;
float dp, dx, dy, f, tx, ty;
for (i=0; i<YRES/CELL; i++)
{
pv[i][0] = pv[i][0]*0.8f;
pv[i][1] = pv[i][1]*0.8f;
pv[i][2] = pv[i][2]*0.8f;
pv[i][XRES/CELL-2] = pv[i][XRES/CELL-2]*0.8f;
pv[i][XRES/CELL-1] = pv[i][XRES/CELL-1]*0.8f;
vx[i][0] = vx[i][1]*0.9f;
vx[i][1] = vx[i][2]*0.9f;
vx[i][XRES/CELL-2] = vx[i][XRES/CELL-3]*0.9f;
vx[i][XRES/CELL-1] = vx[i][XRES/CELL-2]*0.9f;
vy[i][0] = vy[i][1]*0.9f;
vy[i][1] = vy[i][2]*0.9f;
vy[i][XRES/CELL-2] = vy[i][XRES/CELL-3]*0.9f;
vy[i][XRES/CELL-1] = vy[i][XRES/CELL-2]*0.9f;
}
for (i=0; i<XRES/CELL; i++)
{
pv[0][i] = pv[0][i]*0.8f;
pv[1][i] = pv[1][i]*0.8f;
pv[2][i] = pv[2][i]*0.8f;
pv[YRES/CELL-2][i] = pv[YRES/CELL-2][i]*0.8f;
pv[YRES/CELL-1][i] = pv[YRES/CELL-1][i]*0.8f;
vx[0][i] = vx[1][i]*0.9f;
vx[1][i] = vx[2][i]*0.9f;
vx[YRES/CELL-2][i] = vx[YRES/CELL-3][i]*0.9f;
vx[YRES/CELL-1][i] = vx[YRES/CELL-2][i]*0.9f;
vy[0][i] = vy[1][i]*0.9f;
vy[1][i] = vy[2][i]*0.9f;
vy[YRES/CELL-2][i] = vy[YRES/CELL-3][i]*0.9f;
vy[YRES/CELL-1][i] = vy[YRES/CELL-2][i]*0.9f;
}
for(y=1; y<YRES/CELL; y++)
for(x=1; x<XRES/CELL; x++)
for (j=1; j<YRES/CELL; j++)
{
for (i=1; i<XRES/CELL; i++)
{
if (bmap[j][i]==WL_WALL || bmap[j][i]==WL_WALLELEC || (bmap[j][i]==WL_EWALL && !emap[j][i]))
{
vx[j][i] = 0.0f;
vx[j][i-1] = 0.0f;
vy[j][i] = 0.0f;
vy[j-1][i] = 0.0f;
}
}
}
for (y=1; y<YRES/CELL; y++)
for (x=1; x<XRES/CELL; x++)
{
dp = 0.0f;
dp += vx[y][x-1] - vx[y][x];
@ -44,8 +90,8 @@ void update_air(void)
pv[y][x] += dp*TSTEPP;
}
for(y=0; y<YRES/CELL-1; y++)
for(x=0; x<XRES/CELL-1; x++)
for (y=0; y<YRES/CELL-1; y++)
for (x=0; x<XRES/CELL-1; x++)
{
dx = dy = 0.0f;
dx += pv[y][x] - pv[y][x+1];
@ -54,27 +100,27 @@ void update_air(void)
vy[y][x] *= VLOSS;
vx[y][x] += dx*TSTEPV;
vy[y][x] += dy*TSTEPV;
if(bmap[y][x]==WL_WALL || bmap[y][x+1]==WL_WALL ||
if (bmap[y][x]==WL_WALL || bmap[y][x+1]==WL_WALL ||
bmap[y][x]==WL_WALLELEC || bmap[y][x+1]==WL_WALLELEC ||
(bmap[y][x]==WL_EWALL && !emap[y][x]) ||
(bmap[y][x+1]==WL_EWALL && !emap[y][x+1]))
vx[y][x] = 0;
if(bmap[y][x]==WL_WALL || bmap[y+1][x]==WL_WALL ||
if (bmap[y][x]==WL_WALL || bmap[y+1][x]==WL_WALL ||
bmap[y][x]==WL_WALLELEC || bmap[y+1][x]==WL_WALLELEC ||
(bmap[y][x]==WL_EWALL && !emap[y][x]) ||
(bmap[y+1][x]==WL_EWALL && !emap[y+1][x]))
vy[y][x] = 0;
}
for(y=0; y<YRES/CELL; y++)
for(x=0; x<XRES/CELL; x++)
for (y=0; y<YRES/CELL; y++)
for (x=0; x<XRES/CELL; x++)
{
dx = 0.0f;
dy = 0.0f;
dp = 0.0f;
for(j=-1; j<2; j++)
for(i=-1; i<2; i++)
if(y+j>0 && y+j<YRES/CELL-1 &&
for (j=-1; j<2; j++)
for (i=-1; i<2; i++)
if (y+j>0 && y+j<YRES/CELL-1 &&
x+i>0 && x+i<XRES/CELL-1 &&
bmap[y+j][x+i]!=WL_WALL &&
bmap[y+j][x+i]!=WL_WALLELEC &&
@ -99,7 +145,7 @@ void update_air(void)
j = (int)ty;
tx -= i;
ty -= j;
if(i>=2 && i<XRES/CELL-3 &&
if (i>=2 && i<XRES/CELL-3 &&
j>=2 && j<YRES/CELL-3)
{
dx *= 1.0f - VADV;
@ -118,18 +164,18 @@ void update_air(void)
dy += VADV*tx*ty*vy[j+1][i+1];
}
if(bmap[y][x] == WL_FAN)
if (bmap[y][x] == WL_FAN)
{
dx += fvx[y][x];
dy += fvy[y][x];
}
if(dp > 256.0f) dp = 256.0f;
if(dp < -256.0f) dp = -256.0f;
if(dx > 256.0f) dx = 256.0f;
if(dx < -256.0f) dx = -256.0f;
if(dy > 256.0f) dy = 256.0f;
if(dy < -256.0f) dy = -256.0f;
if (dp > 256.0f) dp = 256.0f;
if (dp < -256.0f) dp = -256.0f;
if (dx > 256.0f) dx = 256.0f;
if (dx < -256.0f) dx = -256.0f;
if (dy > 256.0f) dy = 256.0f;
if (dy < -256.0f) dy = -256.0f;
ovx[y][x] = dx;
ovy[y][x] = dy;

37
src/elements/acid.c Normal file
View File

@ -0,0 +1,37 @@
#include <powder.h>
int update_ACID(UPDATE_FUNC_ARGS) {
int r,rx,ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_ACID)
{
if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
{
part_change_type(i,x,y,PT_FIRE);
part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
parts[i].life = 4;
parts[r>>8].life = 4;
}
else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[r&0xFF].hardness>(rand()%1000))&&parts[i].life>=50)
{
if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
{
parts[i].life--;
kill_part(r>>8);
}
}
else if (parts[i].life<=50)
{
kill_part(i);
return 1;
}
}
}
return 0;
}

28
src/elements/amtr.c Normal file
View File

@ -0,0 +1,28 @@
#include <powder.h>
int update_AMTR(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)
{
parts[i].life++;
if (parts[i].life==3)
{
kill_part(i);
return 1;
}
if (2>(rand()/(RAND_MAX/100)))
create_part(r>>8, x+rx, y+ry, PT_PHOT);
else
kill_part(r>>8);
pv[y/CELL][x/CELL] -= 5.0f;
}
}
return 0;
}

74
src/elements/aray.c Normal file
View File

@ -0,0 +1,74 @@
#include <powder.h>
int update_ARAY(UPDATE_FUNC_ARGS) {
int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr;
if (parts[i].life==0) {
int colored =0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK) {
int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
for (docontinue = 1, nxx = 0, nyy = 0, nxi = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
break;
}
r = pmap[y+nyi+nyy][x+nxi+nxx];
if (!((r>>8)>=NPART)) {
if (!r) {
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
if (nr!=-1) {
if (destroy) {
parts[nr].tmp = 2;
parts[nr].life = 2;
} else
parts[nr].ctype = colored;
}
} else if (!destroy) {
if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==0) {
if (nyy!=0 || nxx!=0) {
parts[r>>8].life = 1020;
parts[r>>8].tmp = 1;
if (!parts[r>>8].ctype)
parts[r>>8].ctype = colored;
}
docontinue = 0;
} else if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==1) {
parts[r>>8].life = 1020;
//docontinue = 1;
}
else if ((r&0xFF)==PT_FILT) {
colored = parts[r>>8].ctype;
} else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
if (nyy!=0 || nxx!=0) {
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
docontinue = 0;
} else {
docontinue = 1;
}
}
} else if (destroy) {
if ((r&0xFF)==PT_BRAY) {
parts[r>>8].life = 1;
docontinue = 1;
} else if ((r&0xFF)==PT_INWR || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
docontinue = 1;
} else {
docontinue = 0;
}
}
}
}
}
//parts[i].life = 4;
}
}
return 0;
}

33
src/elements/bcln.c Normal file
View File

@ -0,0 +1,33 @@
#include <powder.h>
int update_BCLN(UPDATE_FUNC_ARGS) {
if (!parts[i].life)
{
if (pv[y/CELL][x/CELL]>4.0f)
{
float advection = 0.1f;
parts[i].vx += advection*vx[y/CELL][x/CELL];
parts[i].vy += advection*vy[y/CELL][x/CELL];
parts[i].life = rand()%40+80;
}
}
if (!parts[i].ctype)
{
int rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ry][x+rx] &&
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
}
else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
return 0;
}

28
src/elements/bcol.c Normal file
View File

@ -0,0 +1,28 @@
#include <powder.h>
int update_BCOL(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life<=0) {
create_part(i, x, y, PT_FIRE);
return 1;
} else if (parts[i].life < 100) {
parts[i].life--;
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
{
if (parts[i].life>100) {
parts[i].life = 99;
}
}
}
return 0;
}

26
src/elements/bmtl.c Normal file
View File

@ -0,0 +1,26 @@
#include <powder.h>
int update_BMTL(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt;
if (parts[i].tmp>1) {
parts[i].tmp--;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
{
part_change_type(r>>8,x+rx,y+ry,PT_BMTL);
parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
}
}
} else if (parts[i].tmp==1 && 1>rand()%1000) {
parts[i].tmp = 0;
part_change_type(i,x,y,PT_BRMT);
}
return 0;
}

64
src/elements/bomb.c Normal file
View File

@ -0,0 +1,64 @@
#include <powder.h>
int update_BOMB(UPDATE_FUNC_ARGS) {
int r, rx, ry, nb;
if (parts[i].tmp==1) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_BOMB) {
kill_part(i);
return 1;
}
}
} else if (parts[i].tmp==0) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_BOMB && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_BCLN) {
int rad = 8;
int nxi;
int nxj;
pmap[y][x] = 0;
for (nxj=-(rad+1); nxj<=(rad+1); nxj++)
for (nxi=-(rad+1); nxi<=(rad+1); nxi++)
if ((pow(nxi,2))/(pow((rad+1),2))+(pow(nxj,2))/(pow((rad+1),2))<=1) {
nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
if (nb!=-1) {
parts[nb].tmp = 1;
parts[nb].life = 50;
parts[nb].temp = MAX_TEMP;
parts[nb].vx = rand()%20-10;
parts[nb].vy = rand()%20-10;
}
}
for (nxj=-rad; nxj<=rad; nxj++)
for (nxi=-rad; nxi<=rad; nxi++)
if ((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1)
if ((pmap[y+nxj][x+nxi]&0xFF)!=PT_DMND && (pmap[y+nxj][x+nxi]&0xFF)!=PT_CLNE && (pmap[y+nxj][x+nxi]&0xFF)!=PT_PCLN && (pmap[y+nxj][x+nxi]&0xFF)!=PT_BCLN) {
delete_part(x+nxi, y+nxj);
pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
if (nb!=-1) {
parts[nb].tmp = 2;
parts[nb].life = 2;
parts[nb].temp = MAX_TEMP;
}
}
//create_parts(x, y, 9, 9, PT_BOMB);
//create_parts(x, y, 8, 8, PT_NONE);
kill_part(i);
return 1;
}
}
}
return 0;
}

43
src/elements/boyl.c Normal file
View File

@ -0,0 +1,43 @@
#include <powder.h>
int update_BOYL(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (pv[y/CELL][x/CELL]<(parts[i].temp/100))
pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL]);
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp/100))
pv[y/CELL+1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL]);
if (x+CELL<XRES)
{
pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL+1]);
if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]);
}
if (y-CELL>=0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100))
pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]);
if (x-CELL>=0)
{
pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]);
if (y-CELL>=0)
pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]);
}
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 &&
x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR && 1>rand()%30)
{
part_change_type(r>>8,x+rx,y+ry,PT_FOG);
}
else if ((r&0xFF)==PT_O2 && 1>rand()%9)
{
kill_part(r>>8);
part_change_type(i,x,y,PT_WATR);
pv[y/CELL][x/CELL] += 4.0;
}
}
return 0;
}

24
src/elements/btry.c Normal file
View File

@ -0,0 +1,24 @@
#include <powder.h>
int update_BTRY(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
if (parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{
if ((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && abs(rx)+abs(ry) < 4)
{
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
}
}
}
return 0;
}

24
src/elements/c5.c Normal file
View File

@ -0,0 +1,24 @@
#include <powder.h>
int update_C5(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100)||(r&0xFF)==PT_HFLM)
{
if (1>rand()%6)
{
part_change_type(i,x,y,PT_HFLM);
parts[r>>8].temp = parts[i].temp = 0;
parts[i].life = rand()%150+50;
pv[y/CELL][x/CELL] += 1.5;
}
}
}
return 0;
}

23
src/elements/clne.c Normal file
View File

@ -0,0 +1,23 @@
#include <powder.h>
int update_CLNE(UPDATE_FUNC_ARGS) {
if (!parts[i].ctype)
{
int rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ry][x+rx] &&
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
}
else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
return 0;
}

35
src/elements/coal.c Normal file
View File

@ -0,0 +1,35 @@
#include <powder.h>
int update_COAL(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life<=0) {
create_part(i, x, y, PT_FIRE);
return 1;
} else if (parts[i].life < 100) {
parts[i].life--;
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
}
if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
parts[i].tmp=39;
else if (parts[i].tmp<40&&parts[i].tmp>0)
parts[i].tmp--;
else if (parts[i].tmp<=0) {
create_part(i, x, y, PT_BCOL);
return 1;
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
{
if (parts[i].life>100) {
parts[i].life = 99;
}
}
}
return 0;
}

73
src/elements/deut.c Normal file
View File

@ -0,0 +1,73 @@
#include <powder.h>
int update_DEUT(UPDATE_FUNC_ARGS) {
int r, rx, ry, trade, np;
int maxlife = ((10000/(parts[i].temp + 1))-1);
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxlife ++;
if (parts[i].life < maxlife)
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
continue;
if ((r&0xFF)==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
{
if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
{
parts[i].life += parts[r>>8].life + 1;
kill_part(r>>8);
}
}
}
}
else
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || (parts[i].life<=maxlife))
continue;
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create deut
{
np = create_part(-1,x+rx,y+ry,PT_DEUT);
if (np<0) continue;
parts[i].life--;
parts[np].temp = parts[i].temp;
parts[np].life = 0;
}
}
for ( trade = 0; trade<4; trade ++)
{
rx = rand()%5-2;
ry = rand()%5-2;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_DEUT&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
int temp = parts[i].life - parts[r>>8].life;
if (temp ==1)
{
parts[r>>8].life ++;
parts[i].life --;
}
else if (temp>0)
{
parts[r>>8].life += temp/2;
parts[i].life -= temp/2;
}
}
}
}
return 0;
}

32
src/elements/dstw.c Normal file
View File

@ -0,0 +1,32 @@
#include <powder.h>
int update_DSTW(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SALT && 1>(rand()%250))
{
part_change_type(i,x,y,PT_SLTW);
part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && 1>(rand()%500))
{
part_change_type(i,x,y,PT_WATR);
}
if ((r&0xFF)==PT_SLTW && 1>(rand()%500))
{
part_change_type(i,x,y,PT_SLTW);
}
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
}
}
return 0;
}

66
src/elements/firw.c Normal file
View File

@ -0,0 +1,66 @@
#include <powder.h>
int update_FIRW(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt;
if (parts[i].tmp==0) {
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
if (rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR)
{
parts[i].tmp = 1;
parts[i].life = rand()%50+60;
}
}
}
else if (parts[i].tmp==1) {
if (parts[i].life==0) {
parts[i].tmp=2;
} else {
float newVel = parts[i].life/25;
parts[i].flags = parts[i].flags&0xFFFFFFFE;
/* TODO:
if ((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE && ly-newVel>0) {
parts[i].vy = -newVel;
ly-=newVel;
iy-=newVel;
}*/
parts[i].vy = -newVel;
}
}
else if (parts[i].tmp==2) {
int col = rand()%200+4;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
int tmul = rand()%7;
create_part(-1, x+rx, y+ry, PT_FIRW);
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_FIRW) {
parts[r>>8].vx = (rand()%3-1)*tmul;
parts[r>>8].vy = (rand()%3-1)*tmul;
parts[r>>8].tmp = col;
parts[r>>8].life = rand()%100+100;
parts[r>>8].temp = 6000.0f;
}
}
pv[y/CELL][x/CELL] += 20;
kill_part(i);
return 1;
} else if (parts[i].tmp>=3) {
if (parts[i].life<=0) {
kill_part(i);
return 1;
}
}
return 0;
}

22
src/elements/fog.c Normal file
View File

@ -0,0 +1,22 @@
#include <powder.h>
int update_FOG(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (ptypes[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
{
part_change_type(i,x,y,PT_RIME);
}
if ((r&0xFF)==PT_SPRK)
{
parts[i].life += rand()%20;
}
}
return 0;
}

30
src/elements/frzw.c Normal file
View File

@ -0,0 +1,30 @@
#include <powder.h>
int update_FRZW(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR&&5>rand()%70)
{
part_change_type(r>>8,x+rx,y+ry,PT_FRZW);
}
}
if (parts[i].life==0&&13>rand()%2500)
{
part_change_type(i,x,y,PT_ICEI);
parts[i].ctype=PT_FRZW;
parts[i].temp = restrict_flt(parts[i].temp-200.0f, MIN_TEMP, MAX_TEMP);
}
else if ((100-(parts[i].life))>rand()%50000)
{
part_change_type(i,x,y,PT_ICEI);
parts[i].ctype=PT_FRZW;
parts[i].temp = restrict_flt(parts[i].temp-200.0f, MIN_TEMP, MAX_TEMP);
}
return 0;
}

25
src/elements/frzz.c Normal file
View File

@ -0,0 +1,25 @@
#include <powder.h>
int update_FRZZ(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR&&5>rand()%100)
{
part_change_type(r>>8,x+rx,y+ry,PT_FRZW);
parts[r>>8].life = 100;
parts[i].type = PT_NONE;
}
}
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
return 0;
}

35
src/elements/fsep.c Normal file
View File

@ -0,0 +1,35 @@
#include <powder.h>
int update_FSEP(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life<=0) {
r = create_part(i, x, y, PT_PLSM);
if (r!=-1)
parts[r].life = 50;
return 1;
} else if (parts[i].life < 40) {
parts[i].life--;
if ((rand()%10)==0) {
r = create_part(-1, (rx=x+rand()%3-1), (ry=y+rand()%3-1), PT_PLSM);
if (r!=-1)
parts[r].life = 50;
}
}
else {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
{
if (parts[i].life>40) {
parts[i].life = 39;
}
}
}
}
return 0;
}

41
src/elements/fuse.c Normal file
View File

@ -0,0 +1,41 @@
#include <powder.h>
int update_FUSE(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life<=0) {
r = create_part(i, x, y, PT_PLSM);
if (r!=-1)
parts[r].life = 50;
return 1;
} else if (parts[i].life < 40) {
parts[i].life--;
if ((rand()%100)==0) {
r = create_part(-1, (rx=x+rand()%3-1), (ry=y+rand()%3-1), PT_PLSM);
if (r!=-1)
parts[r].life = 50;
}
}
if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40)
parts[i].tmp=39;
else if (parts[i].tmp<40&&parts[i].tmp>0)
parts[i].tmp--;
else if (parts[i].tmp<=0) {
create_part(i, x, y, PT_FSEP);
return 1;
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
{
if (parts[i].life>40) {
parts[i].life = 39;
}
}
}
return 0;
}

51
src/elements/fwrk.c Normal file
View File

@ -0,0 +1,51 @@
#include <powder.h>
int update_FWRK(UPDATE_FUNC_ARGS) {
int r, rx, ry, np;
if ((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
{
np = create_part(-1, x , y-1 , PT_FWRK);
if (np!=-1)
{
parts[r>>8].vy = rand()%8-22;
parts[r>>8].vx = rand()%20-rand()%20;
parts[r>>8].life=rand()%15+25;
kill_part(i);
return 1;
}
}
if (parts[i].life>=45)
parts[i].life=0;
if ((parts[i].life<3&&parts[i].life>0)||parts[i].vy>6&&parts[i].life>0)
{
int q = (rand()%255+1);
int w = (rand()%255+1);
int e = (rand()%255+1);
for (rx=-1; rx<2; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
if (5>=rand()%8)
{
if (!pmap[y+ry][x+rx])
{
np = create_part(-1, x+rx, y+ry , PT_DUST);
pv[y/CELL][x/CELL] += 2.00f*CFDS;
if (np!=-1)
{
parts[r>>8].vy = -(rand()%10-1);
parts[r>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
parts[r>>8].life= rand()%37+18;
parts[r>>8].tmp=q;
parts[r>>8].flags=w;
parts[r>>8].ctype=e;
parts[r>>8].temp= rand()%20+6000;
}
}
}
}
kill_part(i);
return 1;
}
return 0;
}

11
src/elements/glas.c Normal file
View File

@ -0,0 +1,11 @@
#include <powder.h>
int update_GLAS(UPDATE_FUNC_ARGS) {
parts[i].pavg[0] = parts[i].pavg[1];
parts[i].pavg[1] = pv[y/CELL][x/CELL];
if (parts[i].pavg[1]-parts[i].pavg[0] > 0.25f || parts[i].pavg[1]-parts[i].pavg[0] < -0.25f)
{
part_change_type(i,x,y,PT_BGLA);
}
return 0;
}

24
src/elements/glow.c Normal file
View File

@ -0,0 +1,24 @@
#include <powder.h>
int update_GLOW(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR&&5>(rand()%2000))
{
parts[i].type = PT_NONE;
part_change_type(r>>8,x+rx,y+ry,PT_DEUT);
parts[r>>8].life = 10;
}
}
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
return 0;
}

15
src/elements/goo.c Normal file
View File

@ -0,0 +1,15 @@
#include <powder.h>
int update_GOO(UPDATE_FUNC_ARGS) {
if (!parts[i].life)
{
if (pv[y/CELL][x/CELL]>1.0f)
{
float advection = 0.1f;
parts[i].vx += advection*vx[y/CELL][x/CELL];
parts[i].vy += advection*vy[y/CELL][x/CELL];
parts[i].life = rand()%80+300;
}
}
return 0;
}

24
src/elements/hswc.c Normal file
View File

@ -0,0 +1,24 @@
#include <powder.h>
int update_HSWC(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life==10)
{
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_HSWC)
{
if (parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[r>>8].life==0)
parts[r>>8].life = 10;
}
}
}
return 0;
}

23
src/elements/ice.c Normal file
View File

@ -0,0 +1,23 @@
#include <powder.h>
int update_ICEI(UPDATE_FUNC_ARGS) { //currently used for snow as well
int r, rx, ry;
if (parts[i].ctype==PT_FRZW)
{
parts[i].temp = restrict_flt(parts[i].temp-1.0f, MIN_TEMP, MAX_TEMP);
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_SLTW);
part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
}
return 0;
}

25
src/elements/iron.c Normal file
View File

@ -0,0 +1,25 @@
#include <powder.h>
int update_IRON(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
((r&0xFF) == PT_LO2))&&
(!(parts[i].life))
)
{
part_change_type(i,x,y,PT_BMTL);
parts[i].tmp=(rand()/(RAND_MAX/10))+20;
}
}
return 0;
}

14
src/elements/isz.c Normal file
View File

@ -0,0 +1,14 @@
#include <powder.h>
int update_ISZ(UPDATE_FUNC_ARGS) { // for both ISZS and ISOZ
float rr, rrr;
if (1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000))
{
create_part(i, x, y, PT_PHOT);
rr = (rand()%228+128)/127.0f;
rrr = (rand()%360)*3.14159f/180.0f;
parts[i].vx = rr*cosf(rrr);
parts[i].vy = rr*sinf(rrr);
}
return 0;
}

24
src/elements/lcry.c Normal file
View File

@ -0,0 +1,24 @@
#include <powder.h>
int update_LCRY(UPDATE_FUNC_ARGS) {
if (parts[i].life==10)
{
int r, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_LCRY)
{
if (parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[r>>8].life==0)
parts[r>>8].life = 10;
}
}
}
return 0;
}

120
src/elements/legacy.c Normal file
View File

@ -0,0 +1,120 @@
#include <powder.h>
// Interactions which only occur when legacy_enable is on
int update_legacy_all(UPDATE_FUNC_ARGS) {
if (!legacy_enable) return 0;
int r, rx, ry, rt;
int t = parts[i].type;
if (t==PT_WTRV) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 &&
x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_WATR);
part_change_type(r>>8,x+rx,y+ry,PT_WATR);
}
if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_WATR);
if (1>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_WATR);
}
}
}
else if (t==PT_WATR) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 &&
x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10))
{
part_change_type(i,x,y,PT_WTRV);
}
}
}
else if (t==PT_SLTW) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 &&
x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10))
{
part_change_type(i,x,y,PT_SALT);
part_change_type(r>>8,x+rx,y+ry,PT_WTRV);
}
}
}
else if (t==PT_DSTW) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 &&
x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10))
{
part_change_type(i,x,y,PT_WTRV);
}
}
}
else if (t==PT_ICEI) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_ICEI);
part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
}
}
}
else if (t==PT_SNOW) {
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000))
{
part_change_type(i,x,y,PT_ICEI);
part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
}
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000))
part_change_type(i,x,y,PT_WATR);
}
}
if (t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f)
part_change_type(i,x,y,PT_DSTW);
if (t==PT_OIL && pv[y/CELL][x/CELL]<-6.0f)
part_change_type(i,x,y,PT_GAS);
if (t==PT_GAS && pv[y/CELL][x/CELL]>6.0f)
part_change_type(i,x,y,PT_OIL);
if (t==PT_DESL && pv[y/CELL][x/CELL]>12.0f)
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = rand()%50+120;
}
return 0;
}

12
src/elements/misc.c Normal file
View File

@ -0,0 +1,12 @@
#include <powder.h>
int update_MISC(UPDATE_FUNC_ARGS) {
int t = parts[i].type;
if (t==PT_LOVE)
ISLOVE=1;
else if (t==PT_LOLZ)
ISLOLZ=1;
else if (t==PT_GRAV)
ISGRAV=1;
return 0;
}

6
src/elements/mort.c Normal file
View File

@ -0,0 +1,6 @@
#include <powder.h>
int update_MORT(UPDATE_FUNC_ARGS) {
create_part(-1, x, y-1, PT_SMKE);
return 0;
}

88
src/elements/neut.c Normal file
View File

@ -0,0 +1,88 @@
#include <powder.h>
int update_NEUT(UPDATE_FUNC_ARGS) {
int r, rx, ry;
int pressureFactor = 3 + (int)pv[y/CELL][x/CELL];
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW)
{
parts[i].vx *= 0.995;
parts[i].vy *= 0.995;
}
if ((r&0xFF)==PT_PLUT && pressureFactor>(rand()%1000))
{
if (33>rand()%100)
{
create_part(r>>8, x+rx, y+ry, rand()%3 ? PT_LAVA : PT_URAN);
parts[r>>8].temp = MAX_TEMP;
if (parts[r>>8].type==PT_LAVA) {
parts[r>>8].tmp = 100;
parts[r>>8].ctype = PT_PLUT;
}
}
else
{
create_part(r>>8, x+rx, y+ry, PT_NEUT);
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
}
pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough
update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
}
else if ((r&0xFF)==PT_DEUT && (pressureFactor+1)>(rand()%1000))
{
#ifdef SDEUT
create_n_parts(parts[r>>8].life, x+rx, y+ry, parts[i].vx, parts[i].vy, PT_NEUT);
#else
create_part(r>>8, x+rx, y+ry, PT_NEUT);
parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx;
parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy;
if (parts[r>>8].life>0)
{
parts[r>>8].life --;
parts[r>>8].temp += (parts[r>>8].life*17);
pv[y/CELL][x/CELL] += 6.0f * CFDS;
}
else
kill_part(r>>8);
#endif
}
else if ((r&0xFF)==PT_GUNP && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_DUST);
else if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_YEST);
else if ((r&0xFF)==PT_YEST)
part_change_type(r>>8,x+rx,y+ry,PT_DYST);
else if ((r&0xFF)==PT_WATR && 15>(rand()%100))
part_change_type(r>>8,x+rx,y+ry,PT_DSTW);
else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_GOO);
else if ((r&0xFF)==PT_NITR && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_DESL);
else if ((r&0xFF)==PT_PLNT && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_WOOD);
else if ((r&0xFF)==PT_DESL && 15>(rand()%1000))
part_change_type(r>>8,x+rx,y+ry,PT_GAS);
else if ((r&0xFF)==PT_COAL && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_WOOD);
else if ((r&0xFF)==PT_DUST && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_FWRK);
else if ((r&0xFF)==PT_FWRK && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_DUST);
else if ((r&0xFF)==PT_ACID && 5>(rand()%100))
create_part(r>>8, x+rx, y+ry, PT_ISOZ);
/*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
(ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||
ptypes[parts[r>>8].type-1].menusection==SC_GAS||
ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000))
parts[r>>8].type--;*/
}
return 0;
}

6
src/elements/none.c Normal file
View File

@ -0,0 +1,6 @@
#include <powder.h>
int update_(UPDATE_FUNC_ARGS) {
return 0;
}

7
src/elements/nptct.c Normal file
View File

@ -0,0 +1,7 @@
#include <powder.h>
int update_NPTCT(UPDATE_FUNC_ARGS) {
if (parts[i].temp>295.0f)
parts[i].temp -= 2.5f;
return 0;
}

65
src/elements/pcln.c Normal file
View File

@ -0,0 +1,65 @@
#include <powder.h>
int update_PCLN(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK)
{
if (parts[r>>8].ctype==PT_PSCN)
parts[i].life = 10;
else if (parts[r>>8].ctype==PT_NSCN)
parts[i].life = 9;
}
if ((r&0xFF)==PT_PCLN)
{
if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[i].life==0&&parts[r>>8].life==10)
parts[i].life = 10;
}
}
if (!parts[i].ctype)
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES &&
pmap[y+ry][x+rx] &&
(pmap[y+ry][x+rx]&0xFF)!=PT_CLNE &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_BCLN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_SPRK &&
(pmap[y+ry][x+rx]&0xFF)!=PT_NSCN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_PSCN &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM &&
(pmap[y+ry][x+rx]&0xFF)!=PT_STKM2 &&
(pmap[y+ry][x+rx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ry][x+rx]&0xFF;
if (parts[i].ctype && parts[i].life==10) {
if (parts[i].ctype==PT_PHOT) {
for (rx=-1; rx<2; rx++) {
for (ry=-1; ry<2; ry++) {
int r = create_part(-1, x+rx, y+ry, parts[i].ctype);
if (r!=-1) {
parts[r].vx = rx*3;
parts[r].vy = ry*3;
}
}
}
}
else if (ptypes[parts[i].ctype].properties&PROP_LIFE) {
for (rx=-1; rx<2; rx++) {
for (ry=-1; ry<2; ry++) {
create_part(-1, x+rx, y+ry, parts[i].ctype);
}
}
} else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
}
return 0;
}

43
src/elements/phot.c Normal file
View File

@ -0,0 +1,43 @@
#include <powder.h>
int update_PHOT(UPDATE_FUNC_ARGS) {
if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
int r, rt, rx, ry;
float rr, rrr;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) {
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_ISOZ && 5>(rand()%2000))
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
create_part(r>>8, x+rx, y+ry, PT_PHOT);
rrr = (rand()%360)*3.14159f/180.0f;
rr = (rand()%128+128)/127.0f;
parts[r>>8].vx = rr*cosf(rrr);
parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
}
if ((r&0xFF)==PT_ISZS && 5>(rand()%2000))
{
parts[i].vx *= 0.90;
parts[i].vy *= 0.90;
create_part(r>>8, x+rx, y+ry, PT_PHOT);
rr = (rand()%228+128)/127.0f;
rrr = (rand()%360)*3.14159f/180.0f;
parts[r>>8].vx = rr*cosf(rrr);
parts[r>>8].vy = rr*sinf(rrr);
pv[y/CELL][x/CELL] -= 15.0f * CFDS;
}
}
r = pmap[y][x];
rt = r&0xFF;
if (rt==PT_CLNE || rt==PT_PCLN || rt==PT_BCLN) {
if (!parts[r>>8].ctype)
parts[r>>8].ctype = PT_PHOT;
}
return 0;
}

122
src/elements/pipe.c Normal file
View File

@ -0,0 +1,122 @@
#include <powder.h>
int update_PIPE(UPDATE_FUNC_ARGS) {
int r, rx, ry, np, trade, q, ctype;
if (!parts[i].ctype && parts[i].life<=10)
{
if (parts[i].temp<272.15)
{
if (parts[i].temp>173.25&&parts[i].temp<273.15)
{
parts[i].ctype = 2;
parts[i].life = 0;
}
if (parts[i].temp>73.25&&parts[i].temp<=173.15)
{
parts[i].ctype = 3;
parts[i].life = 0;
}
if (parts[i].temp>=0&&parts[i].temp<=73.15)
{
parts[i].ctype = 4;
parts[i].life = 0;
}
}
else
{
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART )
continue;
if (!r)
create_part(-1,x+rx,y+ry,PT_BRCK);
}
if (parts[i].life==1)
parts[i].ctype = 1;
}
}
if (parts[i].ctype==1)
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r&&!parts[i].life)
parts[i].life=50;
}
if (parts[i].life==2)
{
parts[i].ctype = 2;
parts[i].life = 6;
}
}
if (parts[i].ctype>1)
for ( q = 0; q<3; q++)
for ( ctype = 2; ctype<5; ctype++)
{
if (parts[i].ctype==ctype)
{
if (parts[i].life==3)
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_PIPE&&parts[r>>8].ctype==1)
{
parts[r>>8].ctype = (((ctype)%3)+2);//reverse
parts[r>>8].life = 6;
}
}
}
else
{
rx = rand()%3-1;
ry = rand()%3-1;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
else if (!r&&parts[i].tmp!=0)
{
np = create_part(-1,x+rx,y+ry,parts[i].tmp);
if (np!=-1)
{
parts[np].temp = parts[i].temp;//pipe saves temp and life now
parts[np].life = parts[i].flags;
}
parts[i].tmp = 0;
continue;
}
else if (!r)
continue;
else if (parts[i].tmp == 0 && (ptypes[r&0xFF].falldown!= 0 || ptypes[r&0xFF].state == ST_GAS))
{
parts[i].tmp = parts[r>>8].type;
parts[i].temp = parts[r>>8].temp;
parts[i].flags = parts[r>>8].life;
kill_part(r>>8);
}
else if ((r&0xFF)==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
{
parts[r>>8].tmp = parts[i].tmp;
parts[r>>8].temp = parts[i].temp;
parts[r>>8].flags = parts[i].flags;
parts[i].tmp = 0;
}
}
}
}
}
return 0;
}

57
src/elements/plnt.c Normal file
View File

@ -0,0 +1,57 @@
#include <powder.h>
int update_PLNT(UPDATE_FUNC_ARGS) {
int r, rx, ry, np;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_WATR && 1>(rand()%250))
{
np = create_part(r>>8,x+rx,y+ry,PT_PLNT);
if (np<0) continue;
parts[np].life = 0;
}
else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
}
else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
{
kill_part(r>>8);
parts[i].life = rand()%60 + 60;
}
else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(rx+ry)<=2 && VINE_MODE)
{
int nnx = rand()%3 -1;
int nny = rand()%3 -1;
if (x+rx+nnx>=0 && y+ry+nny>0 && x+rx+nnx<XRES && y+ry+nny<YRES && (nnx || nny))
{
if ((pmap[y+ry+nny][x+rx+nnx]>>8)>=NPART||pmap[y+ry+nny][x+rx+nnx])
continue;
np = create_part(-1,x+rx+nnx,y+ry+nny,PT_VINE);
if (np<0) continue;
parts[np].temp = parts[i].temp;
}
}
}
if (parts[i].life==2)
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r)
create_part(-1,x+rx,y+ry,PT_O2);
}
parts[i].life = 0;
}
return 0;
}

9
src/elements/plut.c Normal file
View File

@ -0,0 +1,9 @@
#include <powder.h>
int update_PLUT(UPDATE_FUNC_ARGS) {
if (1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000))
{
create_part(i, x, y, PT_NEUT);
}
return 0;
}

30
src/elements/prti.c Normal file
View File

@ -0,0 +1,30 @@
#include <powder.h>
int update_PRTI(UPDATE_FUNC_ARGS) {
int r, nnx, rx, ry;
int count =0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
count ++;
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK || ((r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO && (ptypes[r&0xFF].falldown!= 0 || ptypes[r&0xFF].state == ST_GAS)))
for ( nnx=0; nnx<80; nnx++)
if (!portal[parts[i].tmp][count-1][nnx])
{
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype;
if ((r&0xFF)==PT_SPRK)
part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
else
kill_part(r>>8);
break;
}
}
return 0;
}

53
src/elements/prto.c Normal file
View File

@ -0,0 +1,53 @@
#include <powder.h>
int update_PRTO(UPDATE_FUNC_ARGS) {
int r, nnx, rx, ry, np;
int count = 0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
count ++;
if ((r>>8)>=NPART || r)
continue;
if (!r)
{
for ( nnx =0 ; nnx<80; nnx++)
{
int randomness = count + rand()%3-1;
if (randomness<1)
randomness=1;
if (randomness>8)
randomness=8;
if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better
{
create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x+1,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x+1,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y-1,portal[parts[i].tmp][randomness-1][nnx]);
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
break;
}
else if (portal[parts[i].tmp][randomness-1][nnx])
{
np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]);
if (np<0) continue;
parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx];
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
portalctype[parts[i].tmp][randomness-1][nnx] = 0;
break;
}
}
}
}
return 0;
}

39
src/elements/pump.c Normal file
View File

@ -0,0 +1,39 @@
#include <powder.h>
int update_PUMP(UPDATE_FUNC_ARGS) {
int r, rx, ry;
if (parts[i].life==10)
{
if (parts[i].temp>=256.0+273.15)
parts[i].temp=256.0+273.15;
if (parts[i].temp<= -256.0+273.15)
parts[i].temp = -256.0+273.15;
if (pv[y/CELL][x/CELL]<(parts[i].temp-273.15))
pv[y/CELL][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL]);
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
pv[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL]);
if (x+CELL<XRES)
{
pv[y/CELL][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL+1]);
if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]);
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_PUMP)
{
if (parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[r>>8].life==0)
parts[r>>8].life = 10;
}
}
}
return 0;
}

111
src/elements/pyro.c Normal file
View File

@ -0,0 +1,111 @@
#include <powder.h>
int update_PYRO(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt, t = parts[i].type;
if (t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1)
{
t = PT_NBLE;
part_change_type(i,x,y,t);
parts[i].life = 0;
}
if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625)
{
t = PT_SMKE;
part_change_type(i,x,y,t);
parts[i].life = rand()%20+250;
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (bmap[(y+ry)/CELL][(x+rx)/CELL] && bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = parts[r>>8].type;
if ((surround_space || ptypes[rt].explosive) && (t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH)) &&
!(t==PT_PHOT && rt==PT_INSL) &&
(t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR && rt!=PT_QRTZ))
&& !(rt==PT_SPNG && parts[r>>8].life>0) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
{
part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
parts[r>>8].temp = restrict_flt(ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2), MIN_TEMP, MAX_TEMP);
parts[r>>8].life = rand()%80+180;
if (ptypes[rt].explosive)
pv[y/CELL][x/CELL] += 0.25f * CFDS;
continue;
}
}
if (legacy_enable) update_legacy_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
return 0;
}
int update_legacy_PYRO(UPDATE_FUNC_ARGS) {
int r, rx, ry, rt, lpv, t = parts[i].type;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (bmap[(y+ry)/CELL][(x+rx)/CELL] && bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
continue;
rt = r&0xFF;
lpv = (int)pv[(y+ry)/CELL][(x+rx)/CELL];
if (lpv < 1) lpv = 1;
if (t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&
ptypes[rt].meltable*lpv>(rand()%1000))
{
if (t!=PT_LAVA || parts[i].life>0)
{
parts[r>>8].ctype = (rt==PT_BRMT)?PT_BMTL:parts[r>>8].type;
parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype;
part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
parts[r>>8].life = rand()%120+240;
}
else
{
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;//rt;
part_change_type(i,x,y,t);
return 1;
}
}
if (t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW))
{
parts[r>>8].type = PT_WATR;
if (t==PT_FIRE)
{
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = PT_STNE;
part_change_type(i,x,y,t);
}
}
if (t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW))
{
kill_part(r>>8);
if (t==PT_FIRE)
{
kill_part(i);
return 1;
}
if (t==PT_LAVA)
{
parts[i].life = 0;
t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE;
parts[i].ctype = PT_NONE;
part_change_type(i,x,y,t);
}
}
}
return 0;
}

11
src/elements/qrtz.c Normal file
View File

@ -0,0 +1,11 @@
#include <powder.h>
int update_QRTZ(UPDATE_FUNC_ARGS) {
parts[i].pavg[0] = parts[i].pavg[1];
parts[i].pavg[1] = pv[y/CELL][x/CELL];
if (parts[i].pavg[1]-parts[i].pavg[0] > 0.05*(parts[i].temp/3) || parts[i].pavg[1]-parts[i].pavg[0] < -0.05*(parts[i].temp/3))
{
part_change_type(i,x,y,PT_PQRT);
}
return 0;
}

26
src/elements/rime.c Normal file
View File

@ -0,0 +1,26 @@
#include <powder.h>
int update_RIME(UPDATE_FUNC_ARGS) {
int r, rx, ry;
parts[i].vx = 0;
parts[i].vy = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPRK)
{
part_change_type(i,x,y,PT_FOG);
parts[i].life = rand()%50 + 60;
}
else if ((r&0xFF)==PT_FOG&&parts[r>>8].life>0)
{
part_change_type(i,x,y,PT_FOG);
parts[i].life = parts[r>>8].life;
}
}
return 0;
}

168
src/elements/shld.c Normal file
View File

@ -0,0 +1,168 @@
#include <powder.h>
int update_SHLD1(UPDATE_FUNC_ARGS) {
int r, nnx, nny, rx, ry;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (55>rand()%200&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD2);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++)
{
if (!pmap[y+ry+nny][x+rx+nnx])
{
create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
//parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
}
else if ((r&0xFF)==PT_SHLD3&&4>rand()%10)
{
part_change_type(i,x,y,PT_SHLD2);
parts[i].life = 7;
}
}
return 0;
}
int update_SHLD2(UPDATE_FUNC_ARGS) {
int r, nnx, nny, rx, ry, np;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r && parts[i].life>0)
create_part(-1,x+rx,y+ry,PT_SHLD1);
if (!r)
continue;
else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (25>rand()%200&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD3);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++)
{
if (!pmap[y+ry+nny][x+rx+nnx])
{
np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
if (np<0) continue;
parts[np].life=7;
}
}
}
else if ((r&0xFF)==PT_SHLD4&&4>rand()%10)
{
part_change_type(i,x,y,PT_SHLD3);
parts[i].life = 7;
}
}
return 0;
}
int update_SHLD3(UPDATE_FUNC_ARGS) {
int r, nnx, nny, rx, ry, np;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r)
{
if (1>rand()%2500)
{
np = create_part(-1,x+rx,y+ry,PT_SHLD1);
if (np<0) continue;
parts[np].life=7;
part_change_type(i,x,y,PT_SHLD2);
}
else
continue;
}
if ((r&0xFF)==PT_SHLD1 && parts[i].life>3)
{
part_change_type(r>>8,x+rx,y+ry,PT_SHLD2);
parts[r>>8].life=7;
}
else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
{
if (18>rand()%3000&&parts[i].life==0)
{
part_change_type(i,x,y,PT_SHLD4);
parts[i].life = 7;
}
for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++)
{
if (!pmap[y+ry+nny][x+rx+nnx])
{
np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
if (np<0) continue;
parts[np].life=7;
}
}
}
}
return 0;
}
int update_SHLD4(UPDATE_FUNC_ARGS) {
int r, nnx, nny, rx, ry, np;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if (!r)
{
if (1>rand()%5500)
{
np = create_part(-1,x+rx,y+ry,PT_SHLD1);
if (np<0) continue;
parts[np].life=7;
part_change_type(i,x,y,PT_SHLD2);
}
else
continue;
}
if ((r&0xFF)==PT_SHLD2 && parts[i].life>3)
{
part_change_type(r>>8,x+rx,y+ry,PT_SHLD3);
parts[r>>8].life = 7;
}
else if ((r&0xFF)==PT_SPRK&&parts[i].life==0)
for ( nnx=-1; nnx<2; nnx++)
for ( nny=-1; nny<2; nny++)
{
if (!pmap[y+ry+nny][x+rx+nnx])
{
np = create_part(-1,x+rx+nnx,y+ry+nny,PT_SHLD1);
if (np<0) continue;
parts[np].life=7;
}
}
}
return 0;
}

59
src/elements/sing.c Normal file
View File

@ -0,0 +1,59 @@
#include <powder.h>
int update_SING(UPDATE_FUNC_ARGS) {
int r, rx, ry;
int singularity = -parts[i].life;
if (pv[y/CELL][x/CELL]<singularity)
pv[y/CELL][x/CELL] += 0.1f*(singularity-pv[y/CELL][x/CELL]);
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<singularity)
pv[y/CELL+1][x/CELL] += 0.1f*(singularity-pv[y/CELL+1][x/CELL]);
if (x+CELL<XRES)
{
pv[y/CELL][x/CELL+1] += 0.1f*(singularity-pv[y/CELL][x/CELL+1]);
if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.1f*(singularity-pv[y/CELL+1][x/CELL+1]);
}
if (y+CELL>0 && pv[y/CELL-1][x/CELL]<singularity)
pv[y/CELL-1][x/CELL] += 0.1f*(singularity-pv[y/CELL-1][x/CELL]);
if (x+CELL>0)
{
pv[y/CELL][x/CELL-1] += 0.1f*(singularity-pv[y/CELL][x/CELL-1]);
if (y+CELL>0)
pv[y/CELL-1][x/CELL-1] += 0.1f*(singularity-pv[y/CELL-1][x/CELL-1]);
}
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_DMND&&33>=rand()/(RAND_MAX/100)+1)
{
if ((r&0xFF)==PT_SING && parts[r>>8].life >10)
{
if (parts[i].life+parts[r>>8].life > 255)
continue;
parts[i].life += parts[r>>8].life;
}
else
{
if (parts[i].life+3 > 255)
{
if (parts[r>>8].type!=PT_SING && 1>rand()%100)
{
int np;
np = create_part(r>>8,x+rx,y+ry,PT_SING);
parts[np].life = rand()%50+60;
}
continue;
}
parts[i].life += 3;
}
parts[i].temp = restrict_flt(parts[r>>8].temp+parts[i].temp, MIN_TEMP, MAX_TEMP);
kill_part(r>>8);
}
}
return 0;
}

23
src/elements/sltw.c Normal file
View File

@ -0,0 +1,23 @@
#include <powder.h>
int update_SLTW(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
kill_part(r>>8);
if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
kill_part(r>>8);
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && !legacy_enable && parts[i].temp>(273.15f+12.0f) && 1>(rand()%500))
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
}
}
return 0;
}

97
src/elements/spng.c Normal file
View File

@ -0,0 +1,97 @@
#include <powder.h>
int update_SPNG(UPDATE_FUNC_ARGS) {
int r, trade, rx, ry, tmp;
if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
{
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
continue;
if ((r&0xFF)==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
{
parts[i].life++;
kill_part(r>>8);
}
}
}
else
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_EWALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||
bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWAIR||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWGAS))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create water
{
create_part(-1,x+rx,y+ry,PT_WATR);
parts[i].life--;
}
}
for ( trade = 0; trade<9; trade ++)
{
rx = rand()%5-2;
ry = rand()%5-2;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SPNG&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
tmp = parts[i].life - parts[r>>8].life;
if (tmp ==1)
{
parts[r>>8].life ++;
parts[i].life --;
trade = 9;
}
else if (tmp>0)
{
parts[r>>8].life += tmp/2;
parts[i].life -= tmp/2;
trade = 9;
}
}
}
}
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_FIRE&&parts[i].life>0)
{
if (parts[i].life<=2)
parts[i].life --;
parts[i].life -= parts[i].life/3;
}
}
if (parts[i].temp>=374)
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
continue;
if ((bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALLELEC||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_DESTROYALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_WALL||bmap[(y+ry)/CELL][(x+rx)/CELL]==WL_ALLOWSOLID))
continue;
if ((!r)&&parts[i].life>=1)//if nothing then create steam
{
create_part(-1,x+rx,y+ry,PT_WTRV);
parts[i].life--;
parts[i].temp -= 40.0f;
}
}
return 0;
}

168
src/elements/sprk.c Normal file
View File

@ -0,0 +1,168 @@
#include <powder.h>
int update_SPRK(UPDATE_FUNC_ARGS) {
update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
int r, rx, ry, rt, conduct_sprk, nearp, pavg, ct = parts[i].ctype;
if (parts[i].life<=0)
{
if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD)
parts[i].temp = R_TEMP + 273.15f;
if (!ct)
ct = PT_METL;
part_change_type(i,x,y,ct);
parts[i].life = 4;
if (ct == PT_WATR)
parts[i].life = 64;
if (ct == PT_SLTW)
parts[i].life = 54;
if (ct == PT_SWCH)
parts[i].life = 14;
return 0;
}
if (ct==PT_SPRK)
{
kill_part(i);
return 1;
}
else if (ct==PT_ETRD&&parts[i].life==1)
{
nearp = nearest_part(i, PT_ETRD);
if (nearp!=-1&&parts_avg(i, nearp, PT_INSL)!=PT_INSL)
{
create_line(x, y, (int)(parts[nearp].x+0.5f), (int)(parts[nearp].y+0.5f), 0, 0, PT_PLSM);
part_change_type(i,x,y,ct);
ct = parts[i].ctype = PT_NONE;
parts[i].life = 20;
part_change_type(nearp,(int)(parts[nearp].x+0.5f),(int)(parts[nearp].y+0.5f),PT_SPRK);
parts[nearp].life = 9;
parts[nearp].ctype = PT_ETRD;
}
}
else if (ct==PT_NBLE&&parts[i].life<=1)
{
parts[i].life = rand()%150+50;
part_change_type(i,x,y,PT_PLSM);
parts[i].ctype = PT_NBLE;
parts[i].temp = 3500;
pv[y/CELL][x/CELL] += 1;
}
else if (ct==PT_IRON) {
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) ||
((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) ||
((r&0xFF) == PT_WATR && 30>(rand()/(RAND_MAX/1000))))
{
part_change_type(r>>8,x+rx,y+ry,PT_O2);
//parts[r>>8].tmp=(rand()/(RAND_MAX/10))+20;
}
}
}
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
rt = parts[r>>8].type;
conduct_sprk = 1;
pavg = parts_avg(r>>8, i,PT_INSL);
if ((rt==PT_SWCH||(rt==PT_SPRK&&parts[r>>8].ctype==PT_SWCH)) && pavg!=PT_INSL) // make sparked SWCH turn off correctly
{
if (rt==PT_SWCH&&ct==PT_PSCN&&parts[r>>8].life<10) {
parts[r>>8].life = 10;
}
if (ct==PT_NSCN) {
part_change_type(r>>8,x+rx,y+ry,PT_SWCH);
parts[r>>8].ctype = PT_NONE;
parts[r>>8].life = 9;
}
}
else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_HSWC||(rt==PT_LCRY&&abs(rx)<2&&abs(ry)<2)))
{
if (ct==PT_PSCN) parts[r>>8].life = 10;
else if (ct==PT_NSCN && parts[r>>8].life>=10) parts[r>>8].life = 9;
}
// ct = spark from material, rt = spark to material. Make conduct_sprk = 0 if conduction not allowed
if (pavg == PT_INSL) conduct_sprk = 0;
if (!(ptypes[rt].properties&PROP_CONDUCTS||rt==PT_INST)) conduct_sprk = 0;
if (abs(rx)+abs(ry)>=4 &&ct!=PT_SWCH&&rt!=PT_SWCH)
conduct_sprk = 0;
if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT))))
{
parts[r>>8].temp = 473.0f;
if (rt==PT_NTCT||rt==PT_PTCT)
conduct_sprk = 0;
}
if (ct==PT_NTCT && !(rt==PT_PSCN || rt==PT_NTCT || (rt==PT_NSCN&&parts[i].temp>373.0f)))
conduct_sprk = 0;
if (ct==PT_PTCT && !(rt==PT_PSCN || rt==PT_PTCT || (rt==PT_NSCN&&parts[i].temp<373.0f)))
conduct_sprk = 0;
if (ct==PT_INWR && !(rt==PT_NSCN || rt==PT_INWR || rt==PT_PSCN))
conduct_sprk = 0;
if (ct==PT_NSCN && rt==PT_PSCN)
conduct_sprk = 0;
if (ct==PT_ETRD && (parts[i].life!=5||!(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN)))
conduct_sprk = 0;
if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0;
if (ct==PT_SWCH && (rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
conduct_sprk = 0;
if (rt==PT_QRTZ && !((ct==PT_NSCN||ct==PT_METL||ct==PT_PSCN||ct==PT_QRTZ) && (parts[r>>8].temp<173.15||pv[(y+ry)/CELL][(x+rx)/CELL]>8)))
conduct_sprk = 0;
if (rt==PT_NTCT && !(ct==PT_NSCN || ct==PT_NTCT || (ct==PT_PSCN&&parts[r>>8].temp>373.0f)))
conduct_sprk = 0;
if (rt==PT_PTCT && !(ct==PT_NSCN || ct==PT_PTCT || (ct==PT_PSCN&&parts[r>>8].temp<373.0f)))
conduct_sprk = 0;
if (rt==PT_INWR && !(ct==PT_NSCN || ct==PT_INWR || ct==PT_PSCN))
conduct_sprk = 0;
if (rt==PT_INST&&ct!=PT_PSCN)
conduct_sprk = 0;
if (conduct_sprk) {
if (ct==PT_ETRD) {
part_change_type(i,x,y,PT_ETRD);
parts[i].ctype = PT_NONE;
parts[i].life = 20;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
}
else if (rt==PT_WATR||rt==PT_SLTW) {
if (parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)))
{
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
if (rt==PT_WATR) parts[r>>8].life = 6;
else parts[r>>8].life = 5;
parts[r>>8].ctype = rt;
}
}
else if (rt==PT_INST) {
if (parts[i].life>=3&&parts[r>>8].life==0)
{
flood_parts(x+rx,y+ry,PT_SPRK,PT_INST,-1);//spark the wire
}
}
else if (parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)<i && parts[i].life<4))) {
parts[r>>8].life = 4;
parts[r>>8].ctype = rt;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON))
parts[r>>8].temp = parts[r>>8].temp+10.0f;
}
}
}
return 0;
}

412
src/elements/stkm.c Normal file
View File

@ -0,0 +1,412 @@
#include <powder.h>
int update_SPAWN(UPDATE_FUNC_ARGS) {
ISSPAWN1 = 1;
if (death)
{
playerspawn = create_part(-1,x,y,PT_STKM);
isplayer = 1;
death = 0;
}
return 0;
}
int update_STKM(UPDATE_FUNC_ARGS) {
int r, rx, ry;
float pp, d;
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
//Tempirature handling
if (parts[i].temp<243)
parts[i].life -= 1;
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
if (isplayer) { //Already a stickman in the simulation
death = 1;
parts[i].type = PT_NONE;
}
//Death
if (parts[i].life<1 || death || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
for (r=-2; r<=1; r++)
{
create_part(-1, x+r, y-2, player[2]);
create_part(-1, x+r+1, y+2, player[2]);
create_part(-1, x-2, y+r+1, player[2]);
create_part(-1, x+2, y+r, player[2]);
}
kill_part(i); //Kill him
return 1;
}
parts[i].vy += -0.7*dt; //Head up!
//Verlet integration
pp = 2*player[3]-player[5]+player[19]*dt*dt;;
player[5] = player[3];
player[3] = pp;
pp = 2*player[4]-player[6]+player[20]*dt*dt;;
player[6] = player[4];
player[4] = pp;
pp = 2*player[7]-player[9]+player[21]*dt*dt;;
player[9] = player[7];
player[7] = pp;
pp = 2*player[8]-player[10]+(player[22]+1)*dt*dt;;
player[10] = player[8];
player[8] = pp;
pp = 2*player[11]-player[13]+player[23]*dt*dt;;
player[13] = player[11];
player[11] = pp;
pp = 2*player[12]-player[14]+player[24]*dt*dt;;
player[14] = player[12];
player[12] = pp;
pp = 2*player[15]-player[17]+player[25]*dt*dt;;
player[17] = player[15];
player[15] = pp;
pp = 2*player[16]-player[18]+(player[26]+1)*dt*dt;;
player[18] = player[16];
player[16] = pp;
//Setting acceleration to 0
player[19] = 0;
player[20] = 0;
player[21] = 0;
player[22] = 0;
player[23] = 0;
player[24] = 0;
player[25] = 0;
player[26] = 0;
//Go left
if (((int)(player[0])&0x01) == 0x01 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
{
player[21] = -3;
player[22] = -2;
player[19] = -2;
}
if (pmap[(int)(player[16]-1)][(int)(player[15])])
{
player[25] = -3;
player[26] = -2;
player[23] = -2;
}
}
else
{
if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids
{
player[21] = -1;
player[22] = -1;
player[19] = -1;
}
if (pmap[(int)(player[16]-1)][(int)(player[15])])
{
player[25] = -1;
player[26] = -1;
player[23] = -1;
}
}
}
//Go right
if (((int)(player[0])&0x02) == 0x02 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
{
player[21] = 3;
player[22] = -2;
player[19] = 2;
}
if (pmap[(int)(player[16]-1)][(int)(player[15])])
{
player[25] = 3;
player[26] = -2;
player[23] = 2;
}
}
else
{
if (pmap[(int)(player[8]-1)][(int)(player[7])])
{
player[21] = 1;
player[22] = -1;
player[19] = 1;
}
if (pmap[(int)(player[16]-1)][(int)(player[15])])
{
player[25] = 1;
player[26] = -1;
player[23] = 1;
}
}
}
//Jump
if (((int)(player[0])&0x04) == 0x04 && (ptypes[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || ptypes[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
{
parts[i].vy = -5;
player[22] -= 1;
player[26] -= 1;
}
}
//Charge detector wall if foot inside
if (bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==WL_DETECT)
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
if (bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==WL_DETECT)
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
//Searching for particles near head
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r || (r>>8)>=NPART)
continue;
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended.
{
player[2] = r&0xFF; //Current element
}
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(r>>8);
}
if ((r&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(r>>8);
}
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
player[2] = SPC_AIR;
}
//Head position
rx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
ry = y - 3*(player[1] == 0);
//Spawn
if (((int)(player[0])&0x08) == 0x08)
{
ry -= 2*(rand()%2)+1;
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
if (ptypes[r&0xFF].state == ST_SOLID)
{
create_part(-1, rx, ry, PT_SPRK);
}
else
{
if (player[2] == SPC_AIR)
create_parts(rx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
else
create_part(-1, rx, ry, player[2]);
r = pmap[ry][rx];
if ( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR)
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
if (((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT)
{
int random = abs(rand()%3-1)*3;
if (random==0)
{
parts[r>>8].life = 0;
parts[r>>8].type = PT_NONE;
}
else
{
parts[r>>8].vy = 0;
parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
}
}
}
}
}
//Simulation of joints
d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance
player[7] -= (player[3]-player[7])*d;
player[8] -= (player[4]-player[8])*d;
player[3] += (player[3]-player[7])*d;
player[4] += (player[4]-player[8])*d;
d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5;
player[15] -= (player[11]-player[15])*d;
player[16] -= (player[12]-player[16])*d;
player[11] += (player[11]-player[15])*d;
player[12] += (player[12]-player[16])*d;
d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5;
parts[i].vx -= (player[3]-parts[i].x)*d;
parts[i].vy -= (player[4]-parts[i].y)*d;
player[3] += (player[3]-parts[i].x)*d;
player[4] += (player[4]-parts[i].y)*d;
d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5;
parts[i].vx -= (player[11]-parts[i].x)*d;
parts[i].vy -= (player[12]-parts[i].y)*d;
player[11] += (player[11]-parts[i].x)*d;
player[12] += (player[12]-parts[i].y)*d;
//Side collisions checking
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player[16]-2)][(int)(player[15]+rx)];
if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player[15] -= rx;
r = pmap[(int)(player[8]-2)][(int)(player[7]+rx)];
if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player[7] -= rx;
}
//Collision checks
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
{
r = pmap[(int)(player[8]+ry)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
if (r && (r&0xFF)!=PT_STKM)
{
if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player[8]-10))
parts[i].vy = 1*dt;
else
parts[i].vy = 0;
if (abs(parts[i].vx)>1)
parts[i].vx *= 0.5*dt;
}
else
{
if (ptypes[r&0xFF].state != ST_GAS)
{
player[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player[9] = player[7];
}
r = pmap[(int)(player[16]+ry)][(int)(player[15]+0.5)];
//For right leg
if (r && (r&0xFF)!=PT_STKM)
{
if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if (parts[i].y<(player[16]-10))
parts[i].vy = 1*dt;
else
parts[i].vy = 0;
if (abs(parts[i].vx)>1)
parts[i].vx *= 0.5*dt;
}
else
{
if (ptypes[r&0xFF].state != ST_GAS)
{
player[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player[17] = player[15];
}
//If it falls too fast
if (parts[i].vy>=30)
{
parts[i].y -= (10+ry)*dt;
parts[i].vy = -10*dt;
}
}
//Keeping legs distance
if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1)
{
player[21] -= 0.2;
player[25] += 0.2;
}
if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1)
{
player[19] -= 0.2;
player[23] += 0.2;
}
//If legs touch something
r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)];
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART)
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
{
parts[i].life -= 2;
player[26] -= 1;
}
}
if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)];
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART) //If hot or cold
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player[22] -= 1;
}
}
if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
isplayer = 1;
return 0;
}

413
src/elements/stkm2.c Normal file
View File

@ -0,0 +1,413 @@
#include <powder.h>
int update_SPAWN2(UPDATE_FUNC_ARGS) {
ISSPAWN2 = 1;
if (death2)
{
player2spawn = create_part(-1,x,y,PT_STKM2);
isplayer2 = 1;
death2 = 0;
}
return 0;
}
int update_STKM2(UPDATE_FUNC_ARGS) {
int r, rx, ry;
float pp, d;
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
//Tempirature handling
if (parts[i].temp<243)
parts[i].life -= 1;
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
if (isplayer2) { //Already a stickman2 in the simulation
death2 = 1;
parts[i].type = PT_NONE;
}
//Death
if (parts[i].life<1 || death2 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
for (r=-2; r<=1; r++)
{
create_part(-1, x+r, y-2, player2[2]);
create_part(-1, x+r+1, y+2, player2[2]);
create_part(-1, x-2, y+r+1, player2[2]);
create_part(-1, x+2, y+r, player2[2]);
}
kill_part(i); //Kill him
return 1;
}
parts[i].vy += -0.7*dt; //Head up!
//Verlet integration
pp = 2*player2[3]-player2[5]+player2[19]*dt*dt;;
player2[5] = player2[3];
player2[3] = pp;
pp = 2*player2[4]-player2[6]+player2[20]*dt*dt;;
player2[6] = player2[4];
player2[4] = pp;
pp = 2*player2[7]-player2[9]+player2[21]*dt*dt;;
player2[9] = player2[7];
player2[7] = pp;
pp = 2*player2[8]-player2[10]+(player2[22]+1)*dt*dt;;
player2[10] = player2[8];
player2[8] = pp;
pp = 2*player2[11]-player2[13]+player2[23]*dt*dt;;
player2[13] = player2[11];
player2[11] = pp;
pp = 2*player2[12]-player2[14]+player2[24]*dt*dt;;
player2[14] = player2[12];
player2[12] = pp;
pp = 2*player2[15]-player2[17]+player2[25]*dt*dt;;
player2[17] = player2[15];
player2[15] = pp;
pp = 2*player2[16]-player2[18]+(player2[26]+1)*dt*dt;;
player2[18] = player2[16];
player2[16] = pp;
//Setting acceleration to 0
player2[19] = 0;
player2[20] = 0;
player2[21] = 0;
player2[22] = 0;
player2[23] = 0;
player2[24] = 0;
player2[25] = 0;
player2[26] = 0;
//Go left
if (((int)(player2[0])&0x01) == 0x01 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
player2[21] = -3;
player2[22] = -2;
player2[19] = -2;
}
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
{
player2[25] = -3;
player2[26] = -2;
player2[23] = -2;
}
}
else
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])]) //It should move another way in liquids
{
player2[21] = -1;
player2[22] = -1;
player2[19] = -1;
}
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
{
player2[25] = -1;
player2[26] = -1;
player2[23] = -1;
}
}
}
//Go right
if (((int)(player2[0])&0x02) == 0x02 && ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS)
{
if (ptypes[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
player2[21] = 3;
player2[22] = -2;
player2[19] = 2;
}
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
{
player2[25] = 3;
player2[26] = -2;
player2[23] = 2;
}
}
else
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
player2[21] = 1;
player2[22] = -1;
player2[19] = 1;
}
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
{
player2[25] = 1;
player2[26] = -1;
player2[23] = 1;
}
}
}
//Jump
if (((int)(player2[0])&0x04) == 0x04 && (ptypes[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF].state != ST_GAS || ptypes[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF].state != ST_GAS))
{
if (pmap[(int)(player2[8]-0.5)][(int)(player2[7])] || pmap[(int)(player2[16]-0.5)][(int)(player2[15])])
{
parts[i].vy = -5;
player2[22] -= 1;
player2[26] -= 1;
}
}
//Charge detector wall if foot inside
if (bmap[(int)(player2[8]+0.5)/CELL][(int)(player2[7]+0.5)/CELL]==WL_DETECT)
set_emap((int)player2[7]/CELL, (int)player2[8]/CELL);
if (bmap[(int)(player2[16]+0.5)/CELL][(int)(player2[15]+0.5)/CELL]==WL_DETECT)
set_emap((int)(player2[15]+0.5)/CELL, (int)(player2[16]+0.5)/CELL);
//Searching for particles near head
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if (!r || (r>>8)>=NPART)
continue;
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT) // TODO: photons are not in the pmap. This line may not work as intended.
{
player2[2] = r&0xFF; //Current element
}
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
{
if (parts[i].life<=95)
parts[i].life += 5;
else
parts[i].life = 100;
kill_part(r>>8);
}
if ((r&0xFF) == PT_NEUT)
{
parts[i].life -= (102-parts[i].life)/2;
kill_part(r>>8);
}
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
player2[2] = SPC_AIR;
}
//Head position
rx = x + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01);
ry = y - 3*(player2[1] == 0);
//Spawn
if (((int)(player2[0])&0x08) == 0x08)
{
ry -= 2*(rand()%2)+1;
r = pmap[ry][rx];
if (!((r>>8)>=NPART))
{
if (ptypes[r&0xFF].state == ST_SOLID)
{
create_part(-1, rx, ry, PT_SPRK);
}
else
{
if (player2[2] == SPC_AIR)
create_parts(rx + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
else
create_part(-1, rx, ry, player2[2]);
r = pmap[ry][rx];
if ( ((r>>8) < NPART) && (r>>8)>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR)
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01);
if (((r>>8) < NPART) && (r>>8)>=0 && player2[2] == PT_PHOT)
{
int random = abs(rand()%3-1)*3;
if (random==0)
{
parts[r>>8].life = 0;
parts[r>>8].type = PT_NONE;
}
else
{
parts[r>>8].vy = 0;
parts[r>>8].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random;
}
}
}
}
}
//Simulation of joints
d = 25/(pow((player2[3]-player2[7]), 2) + pow((player2[4]-player2[8]), 2)+25) - 0.5; //Fast distance
player2[7] -= (player2[3]-player2[7])*d;
player2[8] -= (player2[4]-player2[8])*d;
player2[3] += (player2[3]-player2[7])*d;
player2[4] += (player2[4]-player2[8])*d;
d = 25/(pow((player2[11]-player2[15]), 2) + pow((player2[12]-player2[16]), 2)+25) - 0.5;
player2[15] -= (player2[11]-player2[15])*d;
player2[16] -= (player2[12]-player2[16])*d;
player2[11] += (player2[11]-player2[15])*d;
player2[12] += (player2[12]-player2[16])*d;
d = 36/(pow((player2[3]-parts[i].x), 2) + pow((player2[4]-parts[i].y), 2)+36) - 0.5;
parts[i].vx -= (player2[3]-parts[i].x)*d;
parts[i].vy -= (player2[4]-parts[i].y)*d;
player2[3] += (player2[3]-parts[i].x)*d;
player2[4] += (player2[4]-parts[i].y)*d;
d = 36/(pow((player2[11]-parts[i].x), 2) + pow((player2[12]-parts[i].y), 2)+36) - 0.5;
parts[i].vx -= (player2[11]-parts[i].x)*d;
parts[i].vy -= (player2[12]-parts[i].y)*d;
player2[11] += (player2[11]-parts[i].x)*d;
player2[12] += (player2[12]-parts[i].y)*d;
//Side collisions checking
for (rx = -3; rx <= 3; rx++)
{
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+rx)];
if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player2[15] -= rx;
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+rx)];
if (r && ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)
player2[7] -= rx;
}
//Collision checks
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
{
r = pmap[(int)(player2[8]+ry)][(int)(player2[7]+0.5)]; //This is to make coding more pleasant :-)
//For left leg
if (r && (r&0xFF)!=PT_STKM)
{
if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks
{
if (parts[i].y<(player2[8]-10))
parts[i].vy = 1*dt;
else
parts[i].vy = 0;
if (abs(parts[i].vx)>1)
parts[i].vx *= 0.5*dt;
}
else
{
if (ptypes[r&0xFF].state != ST_GAS)
{
player2[8] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player2[9] = player2[7];
}
r = pmap[(int)(player2[16]+ry)][(int)(player2[15]+0.5)];
//For right leg
if (r && (r&0xFF)!=PT_STKM)
{
if (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)
{
if (parts[i].y<(player2[16]-10))
parts[i].vy = 1*dt;
else
parts[i].vy = 0;
if (abs(parts[i].vx)>1)
parts[i].vx *= 0.5*dt;
}
else
{
if (ptypes[r&0xFF].state != ST_GAS)
{
player2[16] += ry-1;
parts[i].vy -= 0.5*parts[i].vy*dt;
}
}
player2[17] = player2[15];
}
//If it falls too fast
if (parts[i].vy>=30)
{
parts[i].y -= (10+ry)*dt;
parts[i].vy = -10*dt;
}
}
//Keeping legs distance
if (pow((player2[7] - player2[15]), 2)<16 && pow((player2[8]-player2[16]), 2)<1)
{
player2[21] -= 0.2;
player2[25] += 0.2;
}
if (pow((player2[3] - player2[11]), 2)<16 && pow((player2[4]-player2[12]), 2)<1)
{
player2[19] -= 0.2;
player2[23] += 0.2;
}
//If legs touch something
r = pmap[(int)(player2[8]+0.5)][(int)(player2[7]+0.5)];
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART)
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
{
parts[i].life -= 2;
player2[26] -= 1;
}
}
if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
r = pmap[(int)(player2[16]+0.5)][(int)(player2[15]+0.5)];
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
{
parts[i].life -= (int)(rand()/1000)+38;
}
if (r>0 && (r>>8)<NPART) //If hot or cold
{
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
{
parts[i].life -= 2;
player2[22] -= 1;
}
}
if ((r&0xFF)==PT_ACID) //If on acid
parts[i].life -= 5;
if ((r&0xFF)==PT_PLUT) //If on plut
parts[i].life -= 1;
isplayer2 = 1;
return 0;
}

37
src/elements/swch.c Normal file
View File

@ -0,0 +1,37 @@
#include <powder.h>
int update_SWCH(UPDATE_FUNC_ARGS) {
int r, rt, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (parts_avg(i,r>>8,PT_INSL)!=PT_INSL) {
rt = r&0xFF;
if (rt==PT_SWCH)
{
if (parts[i].life>=10&&parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[i].life==0&&parts[r>>8].life==10)
parts[i].life = 10;
}
else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) {
part_change_type(i,x,y,PT_SPRK);
parts[i].ctype = PT_SWCH;
parts[i].life = 4;
}
}
}
if (parts[i].life==10 && (!(pmap[y-1][x-1]&0xFF) && ((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) && !(pmap[y-1][x+1]&0xFF) && ((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2)))
{
parts[i].life = 9;
}
else if (parts[i].life<=5 && (!(pmap[y-1][x-1]&0xFF) && (((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) || ((pmap[y+1][x]&0xFF)==PT_BRAY&&parts[pmap[y+1][x]>>8].tmp==2)) && !(pmap[y-1][x+1]&0xFF) && (((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2) || ((pmap[y][x-1]&0xFF)==PT_BRAY&&parts[pmap[y][x-1]>>8].tmp==2))))
{
parts[i].life = 14;
}
return 0;
}

38
src/elements/thdr.c Normal file
View File

@ -0,0 +1,38 @@
#include <powder.h>
int update_THDR(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0 && !((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && parts[r>>8].ctype!=PT_SPRK)
{
parts[i].type = PT_NONE;
parts[r>>8].ctype = parts[r>>8].type;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].life = 4;
}
else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF))
{
pv[y/CELL][x/CELL] += 100.0f;
if (legacy_enable&&1>(rand()%200))
{
parts[i].life = rand()%50+120;
part_change_type(i,x,y,PT_FIRE);
}
else
{
parts[i].type = PT_NONE;
}
}
}
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
return 0;
}

29
src/elements/thrm.c Normal file
View File

@ -0,0 +1,29 @@
#include <powder.h>
int update_THRM(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) // TODO: could this go in update_PYRO?
{
if (1>(rand()%500)) {
part_change_type(i,x,y,PT_LAVA);
parts[i].ctype = PT_BMTL;
parts[i].temp = 3500.0f;
pv[y/CELL][x/CELL] += 50.0f;
} else {
part_change_type(i,x,y,PT_LAVA);
parts[i].life = 400;
parts[i].ctype = PT_THRM;
parts[i].temp = 3500.0f;
parts[i].tmp = 20;
}
}
}
return 0;
}

10
src/elements/uran.c Normal file
View File

@ -0,0 +1,10 @@
#include <powder.h>
int update_URAN(UPDATE_FUNC_ARGS) {
if (!legacy_enable && pv[y/CELL][x/CELL]>0.0f)
{
float atemp = parts[i].temp + (-MIN_TEMP);
parts[i].temp = restrict_flt((atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP, MIN_TEMP, MAX_TEMP);
}
return 0;
}

21
src/elements/vine.c Normal file
View File

@ -0,0 +1,21 @@
#include <powder.h>
int update_VINE(UPDATE_FUNC_ARGS) {
int r, np, rx =(rand()%3)-1, ry=(rand()%3)-1;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART)
return 0;
if (1>rand()%15)
part_change_type(i,x,y,PT_PLNT);
else if (!r)
{
np = create_part(-1,x+rx,y+ry,PT_VINE);
if (np<0) return 0;
parts[np].temp = parts[i].temp;
part_change_type(i,x,y,PT_PLNT);
}
}
return 0;
}

28
src/elements/warp.c Normal file
View File

@ -0,0 +1,28 @@
#include <powder.h>
int update_WARP(UPDATE_FUNC_ARGS) {
int trade, r, rx, ry;
for ( trade = 0; trade<5; trade ++)
{
rx = rand()%3-1;
ry = rand()%3-1;
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)!=PT_WARP&&(r&0xFF)!=PT_STKM&&(r&0xFF)!=PT_STKM2&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_BCLN&&(r&0xFF)!=PT_PCLN&&(10>=rand()%200))
{
parts[i].x = parts[r>>8].x;
parts[i].y = parts[r>>8].y;
parts[r>>8].x = x;
parts[r>>8].y = y;
parts[i].life += 4;
pmap[y][x] = r;
pmap[y+ry][x+rx] = (i<<8)|parts[i].type;
trade = 5;
}
}
}
return 0;
}

29
src/elements/watr.c Normal file
View File

@ -0,0 +1,29 @@
#include <powder.h>
int update_WATR(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_SALT && 1>(rand()%250))
{
part_change_type(i,x,y,PT_SLTW);
part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
}
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>(273.15f+12.0f)) && 1>(rand()%500))
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
}
if ((r&0xFF)==PT_CNCT && 1>(rand()%500))
{
part_change_type(i,x,y,PT_PSTE);
kill_part(r>>8);
}
}
return 0;
}

33
src/elements/wifi.c Normal file
View File

@ -0,0 +1,33 @@
#include <powder.h>
int update_WIFI(UPDATE_FUNC_ARGS) {
int r, rx, ry;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (wireless[parts[i].tmp][0])
{
if (((r&0xFF)==PT_NSCN||(r&0xFF)==PT_PSCN||(r&0xFF)==PT_INWR)&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
parts[r>>8].ctype = r&0xFF;
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
parts[r>>8].life = 4;
}
}
else
{
if ((r&0xFF)==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3)
{
wireless[parts[i].tmp][0] = 1;
wireless[parts[i].tmp][1] = 1;
ISWIRE = 1;
}
}
}
return 0;
}

19
src/elements/wtrv.c Normal file
View File

@ -0,0 +1,19 @@
#include <powder.h>
int update_WTRV(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && !legacy_enable && parts[i].temp>(273.15f+12.0f) && 1>(rand()%500))
{
part_change_type(i,x,y,PT_FIRE);
parts[i].life = 4;
}
}
return 0;
}

21
src/elements/yest.c Normal file
View File

@ -0,0 +1,21 @@
#include <powder.h>
int update_YEST(UPDATE_FUNC_ARGS) {
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable)
{
part_change_type(i,x,y,PT_DYST);
}
}
if (parts[i].temp>303&&parts[i].temp<317) {
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST);
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,7 @@ static struct sockaddr_in http_proxy;
static char *mystrdup(char *s)
{
char *x;
if(s)
if (s)
{
x = malloc(strlen(s)+1);
strcpy(x, s);
@ -84,19 +84,19 @@ static char *mystrdup(char *s)
static int splituri(char *uri, char **host, char **path)
{
char *p=uri,*q,*x,*y;
if(!strncmp(p, "http://", 7))
if (!strncmp(p, "http://", 7))
p += 7;
q = strchr(p, '/');
if(!q)
if (!q)
q = p + strlen(p);
x = malloc(q-p+1);
if(*q)
if (*q)
y = mystrdup(q);
else
y = mystrdup("/");
strncpy(x, p, q-p);
x[q-p] = 0;
if(q==p || x[q-p-1]==':')
if (q==p || x[q-p-1]==':')
{
free(x);
free(y);
@ -111,7 +111,7 @@ static char *getserv(char *host)
{
char *q, *x = mystrdup(host);
q = strchr(x, ':');
if(q)
if (q)
*q = 0;
return x;
}
@ -120,7 +120,7 @@ static char *getport(char *host)
{
char *p, *q;
q = strchr(host, ':');
if(q)
if (q)
p = mystrdup(q+1);
else
p = mystrdup("80");
@ -130,7 +130,7 @@ static char *getport(char *host)
static int resolve(char *dns, char *srv, struct sockaddr_in *addr)
{
struct addrinfo hnt, *res = 0;
if(http_use_proxy)
if (http_use_proxy)
{
memcpy(addr, &http_proxy, sizeof(struct sockaddr_in));
return 0;
@ -138,11 +138,11 @@ static int resolve(char *dns, char *srv, struct sockaddr_in *addr)
memset(&hnt, 0, sizeof(hnt));
hnt.ai_family = AF_INET;
hnt.ai_socktype = SOCK_STREAM;
if(getaddrinfo(dns, srv, &hnt, &res))
if (getaddrinfo(dns, srv, &hnt, &res))
return 1;
if(res)
if (res)
{
if(res->ai_family != AF_INET)
if (res->ai_family != AF_INET)
{
freeaddrinfo(res);
return 1;
@ -159,17 +159,17 @@ void http_init(char *proxy)
char *host, *port;
#ifdef WIN32
WSADATA wsadata;
if(!WSAStartup(MAKEWORD(2,2), &wsadata))
if (!WSAStartup(MAKEWORD(2,2), &wsadata))
http_up = 1;
#else
signal(SIGPIPE, SIG_IGN);
http_up = 1;
#endif
if(proxy)
if (proxy)
{
host = getserv(proxy);
port = getport(proxy);
if(resolve(host, port, &http_proxy))
if (resolve(host, port, &http_proxy))
http_up = 0;
else
http_use_proxy = 1;
@ -220,27 +220,27 @@ struct http_ctx
void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
{
struct http_ctx *cx = ctx;
if(!ctx)
if (!ctx)
{
ctx = calloc(1, sizeof(struct http_ctx));
cx = ctx;
cx->fd = PERROR;
}
if(!cx->hbuf)
if (!cx->hbuf)
{
cx->hbuf = malloc(256);
cx->hlen = 256;
}
if(!http_up)
if (!http_up)
{
cx->ret = 604;
cx->state = HTS_DONE;
return ctx;
}
if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE)
if (cx->state!=HTS_STRT && cx->state!=HTS_IDLE)
{
fprintf(stderr, "HTTP: unclean request restart state.\n");
exit(1);
@ -248,18 +248,18 @@ void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
cx->keep = keep;
cx->ret = 600;
if(splituri(uri, &cx->host, &cx->path))
if (splituri(uri, &cx->host, &cx->path))
{
cx->ret = 601;
cx->state = HTS_DONE;
return ctx;
}
if(http_use_proxy)
if (http_use_proxy)
{
free(cx->path);
cx->path = mystrdup(uri);
}
if(cx->fdhost && strcmp(cx->host, cx->fdhost))
if (cx->fdhost && strcmp(cx->host, cx->fdhost))
{
free(cx->fdhost);
cx->fdhost = NULL;
@ -267,9 +267,9 @@ void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
cx->fd = PERROR;
cx->state = HTS_STRT;
}
if(data)
if (data)
{
if(!dlen)
if (!dlen)
dlen = strlen(data);
cx->txd = malloc(dlen);
memcpy(cx->txd, data, dlen);
@ -302,28 +302,28 @@ void http_async_add_header(void *ctx, char *name, char *data)
static void process_header(struct http_ctx *cx, char *str)
{
char *p;
if(cx->chunkhdr)
if (cx->chunkhdr)
{
p = strchr(str, ';');
if(p)
if (p)
*p = 0;
cx->rxtogo = strtoul(str, NULL, 16);
cx->chunkhdr = 0;
if(!cx->rxtogo)
if (!cx->rxtogo)
cx->chunked = 0;
}
if(!str[0])
if (!str[0])
{
cx->rxtogo = cx->contlen;
cx->chunkhdr = cx->chunked;
if(!cx->contlen && !cx->chunked && cx->ret!=100)
if (!cx->contlen && !cx->chunked && cx->ret!=100)
cx->state = HTS_DONE;
return;
}
if(!strncmp(str, "HTTP/", 5))
if (!strncmp(str, "HTTP/", 5))
{
p = strchr(str, ' ');
if(!p)
if (!p)
{
cx->ret = 603;
cx->state = HTS_DONE;
@ -333,17 +333,17 @@ static void process_header(struct http_ctx *cx, char *str)
cx->ret = atoi(p);
return;
}
if(!strncmp(str, "Content-Length: ", 16))
if (!strncmp(str, "Content-Length: ", 16))
{
cx->contlen = atoi(str+16);
return;
}
if(!strcmp(str, "Transfer-Encoding: chunked"))
if (!strcmp(str, "Transfer-Encoding: chunked"))
{
cx->chunked = 1;
return;
}
if(!strcmp(str, "Connection: close"))
if (!strcmp(str, "Connection: close"))
{
cx->cclose = 1;
return;
@ -352,36 +352,36 @@ static void process_header(struct http_ctx *cx, char *str)
static void process_byte(struct http_ctx *cx, char ch)
{
if(cx->rxtogo)
if (cx->rxtogo)
{
cx->rxtogo--;
if(!cx->rbuf)
if (!cx->rbuf)
{
cx->rbuf = malloc(256);
cx->rlen = 256;
}
if(cx->rptr >= cx->rlen-1)
if (cx->rptr >= cx->rlen-1)
{
cx->rlen *= 2;
cx->rbuf = realloc(cx->rbuf, cx->rlen);
}
cx->rbuf[cx->rptr++] = ch;
if(!cx->rxtogo && !cx->chunked)
if (!cx->rxtogo && !cx->chunked)
cx->state = HTS_DONE;
}
else
{
if(ch == '\n')
if (ch == '\n')
{
cx->hbuf[cx->hptr] = 0;
process_header(cx, cx->hbuf);
cx->hptr = 0;
}
else if(ch != '\r')
else if (ch != '\r')
{
if(cx->hptr >= cx->hlen-1)
if (cx->hptr >= cx->hlen-1)
{
cx->hlen *= 2;
cx->hbuf = realloc(cx->hbuf, cx->hlen);
@ -401,12 +401,12 @@ int http_async_req_status(void *ctx)
unsigned long tmp2;
#endif
switch(cx->state)
switch (cx->state)
{
case HTS_STRT:
dns = getserv(cx->host);
srv = getport(cx->host);
if(resolve(dns, srv, &cx->addr))
if (resolve(dns, srv, &cx->addr))
{
free(dns);
free(srv);
@ -423,45 +423,45 @@ int http_async_req_status(void *ctx)
cx->last = now;
return 0;
case HTS_CONN:
if(cx->fd == PERROR)
if (cx->fd == PERROR)
{
cx->fd = socket(AF_INET, SOCK_STREAM, 0);
if(cx->fd == PERROR)
if (cx->fd == PERROR)
goto fail;
cx->fdhost = mystrdup(cx->host);
#ifdef WIN32
tmp2 = 1;
if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR)
if (ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR)
goto fail;
#else
tmp = fcntl(cx->fd, F_GETFL);
if(tmp < 0)
if (tmp < 0)
goto fail;
if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0)
if (fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0)
goto fail;
#endif
}
if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr)))
if (!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr)))
cx->state = HTS_IDLE;
#ifdef WIN32
else if(PERRNO==WSAEISCONN)
else if (PERRNO==WSAEISCONN)
cx->state = HTS_IDLE;
#endif
#ifdef MACOSX
else if(PERRNO==EISCONN)
else if (PERRNO==EISCONN)
cx->state = HTS_IDLE;
#endif
else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY
else if (PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY
#ifdef WIN32
&& PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL
#endif
)
goto fail;
if(now-cx->last>http_timeout)
if (now-cx->last>http_timeout)
goto timeout;
return 0;
case HTS_IDLE:
if(cx->txdl)
if (cx->txdl)
{
// generate POST
cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen);
@ -469,9 +469,9 @@ int http_async_req_status(void *ctx)
cx->tlen = 0;
cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path);
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host);
if(!cx->keep)
if (!cx->keep)
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n");
if(cx->thdr)
if (cx->thdr)
{
memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen);
cx->tlen += cx->thlen;
@ -500,7 +500,7 @@ int http_async_req_status(void *ctx)
cx->tlen = 0;
cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path);
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host);
if(cx->thdr)
if (cx->thdr)
{
memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen);
cx->tlen += cx->thlen;
@ -508,7 +508,7 @@ int http_async_req_status(void *ctx)
cx->thdr = NULL;
cx->thlen = 0;
}
if(!cx->keep)
if (!cx->keep)
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n");
#ifdef BETA
cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION);
@ -522,39 +522,39 @@ int http_async_req_status(void *ctx)
return 0;
case HTS_XMIT:
tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0);
if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
if (tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
goto fail;
if(tmp!=PERROR)
if (tmp!=PERROR)
{
cx->tptr += tmp;
if(cx->tptr == cx->tlen)
if (cx->tptr == cx->tlen)
{
cx->tptr = 0;
cx->tlen = 0;
if(cx->tbuf)
if (cx->tbuf)
free(cx->tbuf);
cx->state = HTS_RECV;
}
cx->last = now;
}
if(now-cx->last>http_timeout)
if (now-cx->last>http_timeout)
goto timeout;
return 0;
case HTS_RECV:
tmp = recv(cx->fd, buf, CHUNK, 0);
if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
if (tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
goto fail;
if(tmp!=PERROR)
if (tmp!=PERROR)
{
for(i=0; i<tmp; i++)
for (i=0; i<tmp; i++)
{
process_byte(cx, buf[i]);
if(cx->state == HTS_DONE)
if (cx->state == HTS_DONE)
return 1;
}
cx->last = now;
}
if(now-cx->last>http_timeout)
if (now-cx->last>http_timeout)
goto timeout;
return 0;
case HTS_DONE:
@ -578,42 +578,42 @@ char *http_async_req_stop(void *ctx, int *ret, int *len)
struct http_ctx *cx = ctx;
char *rxd;
if(cx->state != HTS_DONE)
while(!http_async_req_status(ctx)) ;
if (cx->state != HTS_DONE)
while (!http_async_req_status(ctx)) ;
if(cx->host)
if (cx->host)
{
free(cx->host);
cx->host = NULL;
}
if(cx->path)
if (cx->path)
{
free(cx->path);
cx->path = NULL;
}
if(cx->txd)
if (cx->txd)
{
free(cx->txd);
cx->txd = NULL;
cx->txdl = 0;
}
if(cx->hbuf)
if (cx->hbuf)
{
free(cx->hbuf);
cx->hbuf = NULL;
}
if(cx->thdr)
if (cx->thdr)
{
free(cx->thdr);
cx->thdr = NULL;
cx->thlen = 0;
}
if(ret)
if (ret)
*ret = cx->ret;
if(len)
if (len)
*len = cx->rptr;
if(cx->rbuf)
if (cx->rbuf)
cx->rbuf[cx->rptr] = 0;
rxd = cx->rbuf;
cx->rbuf = NULL;
@ -621,13 +621,13 @@ char *http_async_req_stop(void *ctx, int *ret, int *len)
cx->rptr = 0;
cx->contlen = 0;
if(!cx->keep)
if (!cx->keep)
http_async_req_close(ctx);
else if(cx->cclose)
else if (cx->cclose)
{
PCLOSE(cx->fd);
cx->fd = PERROR;
if(cx->fdhost)
if (cx->fdhost)
{
free(cx->fdhost);
cx->fdhost = NULL;
@ -643,9 +643,9 @@ char *http_async_req_stop(void *ctx, int *ret, int *len)
void http_async_get_length(void *ctx, int *total, int *done)
{
struct http_ctx *cx = ctx;
if(done)
if (done)
*done = cx->rptr;
if(total)
if (total)
*total = cx->contlen;
}
@ -653,14 +653,14 @@ void http_async_req_close(void *ctx)
{
struct http_ctx *cx = ctx;
void *tmp;
if(cx->host)
if (cx->host)
{
cx->keep = 1;
tmp = http_async_req_stop(ctx, NULL, NULL);
if(tmp)
if (tmp)
free(tmp);
}
if(cx->fdhost)
if (cx->fdhost)
free(cx->fdhost);
PCLOSE(cx->fd);
free(ctx);
@ -669,11 +669,11 @@ void http_async_req_close(void *ctx)
char *http_simple_get(char *uri, int *ret, int *len)
{
void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0);
if(!ctx)
if (!ctx)
{
if(ret)
if (ret)
*ret = 600;
if(len)
if (len)
*len = 0;
return NULL;
}
@ -688,10 +688,10 @@ void http_auth_headers(void *ctx, char *user, char *pass)
unsigned int m;
struct md5_context md5;
if(user)
if (user)
{
http_async_add_header(ctx, "X-Auth-User", user);
if(pass)
if (pass)
{
md5_init(&md5);
md5_update(&md5, (unsigned char *)user, strlen(user));
@ -701,7 +701,7 @@ void http_auth_headers(void *ctx, char *user, char *pass)
md5_update(&md5, (unsigned char *)pass, strlen(pass));
md5_final(hash, &md5);
tmp = malloc(33);
for(i=0; i<16; i++)
for (i=0; i<16; i++)
{
tmp[i*2] = hex[hash[i]>>4];
tmp[i*2+1] = hex[hash[i]&15];
@ -716,11 +716,11 @@ char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len)
{
void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0);
if(!ctx)
if (!ctx)
{
if(ret)
if (ret)
*ret = 600;
if(len)
if (len)
*len = 0;
return NULL;
}
@ -730,11 +730,11 @@ char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len)
char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len)
{
void *ctx = http_async_req_start(NULL, uri, data, dlen, 0);
if(!ctx)
if (!ctx)
{
if(ret)
if (ret)
*ret = 600;
if(len)
if (len)
*len = 0;
return NULL;
}
@ -743,7 +743,7 @@ char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len)
char *http_ret_text(int ret)
{
switch(ret)
switch (ret)
{
case 100:
return "Continue";
@ -883,64 +883,64 @@ char *http_multipart_post(char *uri, char **names, char **parts, int *plens, cha
//struct md5_context md52;
int own_plen = 0;
if(names)
if (names)
{
if(!plens)
if (!plens)
{
own_plen = 1;
for(i=0; names[i]; i++) ;
for (i=0; names[i]; i++) ;
plens = calloc(i, sizeof(int));
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
plens[i] = strlen(parts[i]);
}
retry:
if(blen >= 31)
if (blen >= 31)
goto fail;
memset(map, 0, 62*sizeof(int));
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
{
for(j=0; j<plens[i]-blen; j++)
if(!blen || !memcmp(parts[i]+j, boundary, blen))
for (j=0; j<plens[i]-blen; j++)
if (!blen || !memcmp(parts[i]+j, boundary, blen))
{
ch = parts[i][j+blen];
if(ch>='0' && ch<='9')
if (ch>='0' && ch<='9')
map[ch-'0']++;
else if(ch>='A' && ch<='Z')
else if (ch>='A' && ch<='Z')
map[ch-'A'+10]++;
else if(ch>='a' && ch<='z')
else if (ch>='a' && ch<='z')
map[ch-'a'+36]++;
}
}
m = ~0;
j = 61;
for(i=0; i<62; i++)
if(map[i]<m)
for (i=0; i<62; i++)
if (map[i]<m)
{
m = map[i];
j = i;
}
if(j<10)
if (j<10)
boundary[blen] = '0'+j;
else if(j<36)
else if (j<36)
boundary[blen] = 'A'+(j-10);
else
boundary[blen] = 'a'+(j-36);
blen++;
if(map[j])
if (map[j])
goto retry;
boundary[blen] = 0;
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
dlen += blen+strlen(names[i])+plens[i]+128;
dlen += blen+8;
data = malloc(dlen);
dlen = 0;
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
{
dlen += sprintf(data+dlen, "--%s\r\n", boundary);
dlen += sprintf(data+dlen, "Content-transfer-encoding: binary\r\n");
if(strchr(names[i], ':'))
if (strchr(names[i], ':'))
{
tmp = mystrdup(names[i]);
p = strchr(tmp, ':');
@ -960,26 +960,26 @@ retry:
}
ctx = http_async_req_start(NULL, uri, data, dlen, 0);
if(!ctx)
if (!ctx)
goto fail;
if(user)
if (user)
{
http_async_add_header(ctx, "X-Auth-User", user);
if(pass)
if (pass)
{
md5_init(&md5);
md5_update(&md5, (unsigned char *)user, strlen(user));
md5_update(&md5, (unsigned char *)"-", 1);
m = 0;
if(names)
if (names)
{
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
{
//md5_update(&md5, (unsigned char *)parts[i], plens[i]); //WHY?
//md5_update(&md5, (unsigned char *)"-", 1);
p = strchr(names[i], ':');
if(p)
if (p)
m += (p - names[i]) + 1;
else
m += strlen(names[i])+1;
@ -987,15 +987,15 @@ retry:
tmp = malloc(m);
m = 0;
for(i=0; names[i]; i++)
for (i=0; names[i]; i++)
{
p = strchr(names[i], ':');
if(m)
if (m)
{
tmp[m] = ' ';
m ++;
}
if(p)
if (p)
{
memcpy(tmp+m, names[i], p-names[i]);
m += p - names[i];
@ -1014,7 +1014,7 @@ retry:
md5_update(&md5, (unsigned char *)pass, strlen(pass));
md5_final(hash, &md5);
tmp = malloc(33);
for(i=0; i<16; i++)
for (i=0; i<16; i++)
{
tmp[i*2] = hex[hash[i]>>4];
tmp[i*2+1] = hex[hash[i]&15];
@ -1025,7 +1025,7 @@ retry:
}
}
if(data)
if (data)
{
tmp = malloc(32+strlen((char *)boundary));
sprintf(tmp, "multipart/form-data, boundary=%s", boundary);
@ -1034,18 +1034,18 @@ retry:
free(data);
}
if(own_plen)
if (own_plen)
free(plens);
return http_async_req_stop(ctx, ret, len);
fail:
if(data)
if (data)
free(data);
if(own_plen)
if (own_plen)
free(plens);
if(ret)
if (ret)
*ret = 600;
if(len)
if (len)
*len = 0;
return NULL;
}

File diff suppressed because it is too large Load Diff

1012
src/main.c

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len)
// update bit count
t = ctx->bits[0];
if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t)
if ((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t)
ctx->bits[1]++; // carry
ctx->bits[1] += len >> 29;
@ -40,7 +40,7 @@ void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len)
// use leading data to top up the buffer
if(t)
if (t)
{
unsigned char *p = ctx->in + t;
@ -58,7 +58,7 @@ void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len)
// following 64-byte chunks
while(len >= 64)
while (len >= 64)
{
memcpy(ctx->in, buf, 64);
md5_transform(ctx->buf, ctx->in);
@ -87,7 +87,7 @@ void md5_final(unsigned char digest[16], struct md5_context *ctx)
count = 64 - 1 - count;
// Pad out to 56 mod 64
if(count < 8)
if (count < 8)
{
// we need to finish a whole block before padding
memset(p, 0, count);
@ -215,14 +215,14 @@ void md5_ascii(char *result, unsigned char const *buf, unsigned len)
unsigned char hash[16];
int i;
if(len==0)
if (len==0)
len = strlen((char *)buf);
md5_init(&md5);
md5_update(&md5, buf, len);
md5_final(hash, &md5);
for(i=0; i<16; i++)
for (i=0; i<16; i++)
{
result[i*2] = hex[(hash[i]>>4)&0xF];
result[i*2+1] = hex[hash[i]&0x0F];

View File

@ -26,9 +26,9 @@ _inline unsigned clamp_flt(float f, float min, float max)
inline unsigned clamp_flt(float f, float min, float max)
#endif
{
if(f<min)
if (f<min)
return 0;
if(f>max)
if (f>max)
return 255;
return (int)(255.0f*(f-min)/(max-min));
}
@ -39,9 +39,9 @@ _inline float restrict_flt(float f, float min, float max)
inline float restrict_flt(float f, float min, float max)
#endif
{
if(f<min)
if (f<min)
return min;
if(f>max)
if (f>max)
return max;
return f;
}
@ -49,7 +49,7 @@ inline float restrict_flt(float f, float min, float max)
char *mystrdup(char *s)
{
char *x;
if(s)
if (s)
{
x = (char*)malloc(strlen(s)+1);
strcpy(x, s);
@ -69,8 +69,8 @@ void strlist_add(struct strlist **list, char *str)
int strlist_find(struct strlist **list, char *str)
{
struct strlist *item;
for(item=*list; item; item=item->next)
if(!strcmp(item->str, str))
for (item=*list; item; item=item->next)
if (!strcmp(item->str, str))
return 1;
return 0;
}
@ -78,7 +78,7 @@ int strlist_find(struct strlist **list, char *str)
void strlist_free(struct strlist **list)
{
struct strlist *item;
while(*list)
while (*list)
{
item = *list;
*list = (*list)->next;
@ -91,7 +91,7 @@ void save_presets(int do_update)
FILE *f=fopen("powder.def", "wb");
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66};
unsigned char tmp = sdl_scale;
if(!f)
if (!f)
return;
fwrite(sig, 1, 4, f);
save_string(f, svf_user);
@ -117,19 +117,19 @@ void load_presets(void)
{
FILE *f=fopen("powder.def", "rb");
unsigned char sig[4], tmp;
if(!f)
if (!f)
return;
fread(sig, 1, 4, f);
if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66)
if (sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66)
{
if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F)
if (sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F)
{
if(fseek(f, -3, SEEK_END))
if (fseek(f, -3, SEEK_END))
{
remove("powder.def");
return;
}
if(fread(sig, 1, 3, f) != 3)
if (fread(sig, 1, 3, f) != 3)
{
remove("powder.def");
goto fail;
@ -142,26 +142,26 @@ void load_presets(void)
remove("powder.def");
return;
}
if(load_string(f, svf_user, 63))
if (load_string(f, svf_user, 63))
goto fail;
if(load_string(f, svf_pass, 63))
if (load_string(f, svf_pass, 63))
goto fail;
svf_login = !!svf_user[0];
if(fread(&tmp, 1, 1, f) != 1)
if (fread(&tmp, 1, 1, f) != 1)
goto fail;
sdl_scale = (tmp == 2) ? 2 : 1;
if(fread(&tmp, 1, 1, f) != 1)
if (fread(&tmp, 1, 1, f) != 1)
goto fail;
cmode = tmp%7;
if(fread(&tmp, 1, 1, f) != 1)
if (fread(&tmp, 1, 1, f) != 1)
goto fail;
svf_admin = tmp;
if(fread(&tmp, 1, 1, f) != 1)
if (fread(&tmp, 1, 1, f) != 1)
goto fail;
svf_mod = tmp;
if(load_string(f, http_proxy_string, 255))
if (load_string(f, http_proxy_string, 255))
goto fail;
if(fread(sig, 1, 3, f) != 3)
if (fread(sig, 1, 3, f) != 3)
goto fail;
last_major = sig[0];
last_minor = sig[1];
@ -186,7 +186,7 @@ int load_string(FILE *f, char *str, int max)
unsigned char lb[2];
fread(lb, 2, 1, f);
li = lb[0] | (lb[1] << 8);
if(li > max)
if (li > max)
{
str[0] = 0;
return 1;
@ -201,11 +201,11 @@ void strcaturl(char *dst, char *src)
char *d;
unsigned char *s;
for(d=dst; *d; d++) ;
for (d=dst; *d; d++) ;
for(s=(unsigned char *)src; *s; s++)
for (s=(unsigned char *)src; *s; s++)
{
if((*s>='0' && *s<='9') ||
if ((*s>='0' && *s<='9') ||
(*s>='a' && *s<='z') ||
(*s>='A' && *s<='Z'))
*(d++) = *s;
@ -224,9 +224,9 @@ void strappend(char *dst, char *src)
char *d;
unsigned char *s;
for(d=dst; *d; d++) ;
for (d=dst; *d; d++) ;
for(s=(unsigned char *)src; *s; s++)
for (s=(unsigned char *)src; *s; s++)
{
*(d++) = *s;
}
@ -238,13 +238,13 @@ void *file_load(char *fn, int *size)
FILE *f = fopen(fn, "rb");
void *s;
if(!f)
if (!f)
return NULL;
fseek(f, 0, SEEK_END);
*size = ftell(f);
fseek(f, 0, SEEK_SET);
s = malloc(*size);
if(!s)
if (!s)
{
fclose(f);
return NULL;
@ -262,19 +262,19 @@ int cpu_check(void)
#ifdef X86
unsigned af,bf,cf,df;
x86_cpuid(0, af, bf, cf, df);
if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65)
if (bf==0x68747541 && cf==0x444D4163 && df==0x69746E65)
amd = 1;
x86_cpuid(1, af, bf, cf, df);
#ifdef X86_SSE
if(!(df&(1<<25)))
if (!(df&(1<<25)))
return 1;
#endif
#ifdef X86_SSE2
if(!(df&(1<<26)))
if (!(df&(1<<26)))
return 1;
#endif
#ifdef X86_SSE3
if(!(cf&1))
if (!(cf&1))
return 1;
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -43,16 +43,16 @@ static char *exe_name(void)
{
#if defined WIN32
char *name= (char *)malloc(64), max=64, res;
while((res = (char)GetModuleFileName(NULL, name, max)) >= max)
while ((res = (char)GetModuleFileName(NULL, name, max)) >= max)
{
#elif defined MACOSX
char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res;
if(_NSGetExecutablePath(fn, &max) != 0)
if (_NSGetExecutablePath(fn, &max) != 0)
{
fn = realloc(fn, max);
_NSGetExecutablePath(fn, &max);
}
if(realpath(fn, name) == NULL)
if (realpath(fn, name) == NULL)
{
free(fn);
free(name);
@ -63,7 +63,7 @@ static char *exe_name(void)
char fn[64], *name=malloc(64), max=64, res;
sprintf(fn, "/proc/self/exe");
memset(name, 0, max);
while((res = readlink(fn, name, max)) >= max-1)
while ((res = readlink(fn, name, max)) >= max-1)
{
#endif
#ifndef MACOSX
@ -72,7 +72,7 @@ static char *exe_name(void)
memset(name, 0, max);
}
#endif
if(res <= 0)
if (res <= 0)
{
free(name);
return NULL;
@ -89,24 +89,24 @@ int update_start(char *data, int len)
FILE *f;
int res = 1;
if(!self)
if (!self)
return 1;
#ifdef WIN32
temp = malloc(strlen(self)+12);
strcpy(temp, self);
p = temp + strlen(temp) - 4;
if(_stricmp(p, ".exe"))
if (_stricmp(p, ".exe"))
p += 4;
strcpy(p, "_update.exe");
if(!MoveFile(self, temp))
if (!MoveFile(self, temp))
goto fail;
f = fopen(self, "wb");
if(!f)
if (!f)
goto fail;
if(fwrite(data, 1, len, f) != len)
if (fwrite(data, 1, len, f) != len)
{
fclose(f);
DeleteFile(self);
@ -114,7 +114,7 @@ int update_start(char *data, int len)
}
fclose(f);
if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32)
if ((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32)
{
DeleteFile(self);
goto fail;
@ -127,9 +127,9 @@ int update_start(char *data, int len)
strcat(temp, "-update");
f = fopen(temp, "w");
if(!f)
if (!f)
goto fail;
if(fwrite(data, 1, len, f) != len)
if (fwrite(data, 1, len, f) != len)
{
fclose(f);
unlink(temp);
@ -137,13 +137,13 @@ int update_start(char *data, int len)
}
fclose(f);
if(chmod(temp, 0755))
if (chmod(temp, 0755))
{
unlink(temp);
goto fail;
}
if(rename(temp, self))
if (rename(temp, self))
{
unlink(temp);
goto fail;
@ -167,14 +167,14 @@ int update_finish(void)
temp = malloc(strlen(self)+12);
strcpy(temp, self);
p = temp + strlen(temp) - 4;
if(_stricmp(p, ".exe"))
if (_stricmp(p, ".exe"))
p += 4;
strcpy(p, "_update.exe");
while(!DeleteFile(temp))
while (!DeleteFile(temp))
{
err = GetLastError();
if(err == ERROR_FILE_NOT_FOUND)
if (err == ERROR_FILE_NOT_FOUND)
{
// just as well, then
free(temp);
@ -182,7 +182,7 @@ int update_finish(void)
}
Sleep(500);
timeout--;
if(timeout <= 0)
if (timeout <= 0)
{
free(temp);
return 1;