summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-06-10 14:51:55 (GMT)
committer jacob1 <jfu614@gmail.com>2013-06-10 14:51:55 (GMT)
commitb699bb176f41012a43c42dbbf1ec82b7e1c27d3d (patch)
tree3aa231af016fd8cd654b5aaec72ec12eecdc8a17 /src/simulation
parent52ec8f438b6ce3373c9258cbde402b4caef92b1e (diff)
downloadpowder-b699bb176f41012a43c42dbbf1ec82b7e1c27d3d.zip
powder-b699bb176f41012a43c42dbbf1ec82b7e1c27d3d.tar.gz
Add two new properties for CLNE-like elements
the thing CLNE does, drawing upon it will set ctype; and what BCLN does to CLNE - disables #1). Made use of the two new properties
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Elements.h40
-rw-r--r--src/simulation/Simulation.cpp20
-rw-r--r--src/simulation/elements/BCLN.cpp2
-rw-r--r--src/simulation/elements/CLNE.cpp2
-rw-r--r--src/simulation/elements/CONV.cpp2
-rw-r--r--src/simulation/elements/FIGH.cpp2
-rw-r--r--src/simulation/elements/PBCN.cpp2
-rw-r--r--src/simulation/elements/PCLN.cpp2
-rw-r--r--src/simulation/elements/STKM.cpp2
-rw-r--r--src/simulation/elements/STKM2.cpp2
-rw-r--r--src/simulation/elements/STOR.cpp2
11 files changed, 39 insertions, 39 deletions
diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h
index 67e2c4b..54f5483 100644
--- a/src/simulation/Elements.h
+++ b/src/simulation/Elements.h
@@ -10,25 +10,27 @@
#define O_MAX_TEMP 3500
#define O_MIN_TEMP -273
-#define TYPE_PART 0x00001 //1 Powders
-#define TYPE_LIQUID 0x00002 //2 Liquids
-#define TYPE_SOLID 0x00004 //4 Solids
-#define TYPE_GAS 0x00008 //8 Gasses (Includes plasma)
-#define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
-#define PROP_CONDUCTS 0x00020 //32 Conducts electricity
-#define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
-#define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons
-#define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default
-#define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass
-#define PROP_DEADLY 0x00400 //1024 Is deadly for stickman
-#define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow
-#define PROP_LIFE 0x01000 //4096 Is a GoL type
-#define PROP_RADIOACTIVE 0x02000 //8192 Radioactive
-#define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero
-#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
-#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
-#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
-#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
+#define TYPE_PART 0x00001 //1 Powders
+#define TYPE_LIQUID 0x00002 //2 Liquids
+#define TYPE_SOLID 0x00004 //4 Solids
+#define TYPE_GAS 0x00008 //8 Gasses (Includes plasma)
+#define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
+#define PROP_CONDUCTS 0x00020 //32 Conducts electricity
+#define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
+#define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons
+#define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default
+#define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass
+#define PROP_DEADLY 0x00400 //1024 Is deadly for stickman
+#define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow
+#define PROP_LIFE 0x01000 //4096 Is a GoL type
+#define PROP_RADIOACTIVE 0x02000 //8192 Radioactive
+#define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero
+#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
+#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
+#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
+#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
+#define PROP_DRAWONCTYPE 0x80000 //2^19 Set its ctype to another element if the element is drawn upon it (like what CLNE does)
+#define PROP_NOCTYPEDRAW 0x100000 // 2^20 When this element is drawn upon with, do not set ctype (like BCLN for CLNE)
#define FLAG_STAGNANT 0x1
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index c420f3b..e696581 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2033,6 +2033,7 @@ void Simulation::init_can_move()
}
}
//a list of lots of things PHOT can move through
+ // TODO: replace with property
for (movingType = 0; movingType < PT_NUM; movingType++)
{
if (movingType == PT_GLAS || movingType == PT_PHOT || movingType == PT_FILT || movingType == PT_INVIS
@@ -2721,20 +2722,17 @@ int Simulation::create_part(int p, int x, int y, int tv)
{
if (pmap[y][x])
{
+ //If an element has the PROP_DRAWONCTYPE property, and the element being drawn to it does not have PROP_NOCTYPEDRAW (Also some special cases), set the element's ctype
int drawOn = pmap[y][x]&0xFF;
- if ((
- (drawOn == PT_STOR && !(elements[t].Properties&TYPE_SOLID)) ||
- drawOn==PT_CLNE ||
- drawOn==PT_BCLN ||
- drawOn==PT_CONV ||
- (drawOn==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN) ||
- (drawOn==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
- )&&(
- t != PT_CLNE && t != PT_PCLN && t != PT_BCLN && t != PT_STKM && t != PT_STKM2 && t != PT_PBCN && t != PT_STOR && t != PT_FIGH && t != PT_CONV)
- )
+ if (((elements[drawOn].Properties & PROP_DRAWONCTYPE) ||
+ (drawOn == PT_STOR && !(elements[t].Properties & TYPE_SOLID)) ||
+ (drawOn == PT_PCLN && t != PT_PSCN && t != PT_NSCN) ||
+ (drawOn == PT_PBCN && t != PT_PSCN && t != PT_NSCN))
+ && (!(elements[t].Properties & PROP_NOCTYPEDRAW)))
{
parts[pmap[y][x]>>8].ctype = t;
- if (t == PT_LIFE && v < NGOL && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
+ if (t == PT_LIFE && v < NGOL && drawOn != PT_STOR)
+ parts[pmap[y][x]>>8].tmp = v;
}
else if ((drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME)) && drawOn != t)
{
diff --git a/src/simulation/elements/BCLN.cpp b/src/simulation/elements/BCLN.cpp
index ecec766..2ffd078 100644
--- a/src/simulation/elements/BCLN.cpp
+++ b/src/simulation/elements/BCLN.cpp
@@ -31,7 +31,7 @@ Element_BCLN::Element_BCLN()
Description = "Breakable Clone.";
State = ST_NONE;
- Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC;
+ Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/CLNE.cpp b/src/simulation/elements/CLNE.cpp
index f0dffc2..04b0374 100644
--- a/src/simulation/elements/CLNE.cpp
+++ b/src/simulation/elements/CLNE.cpp
@@ -31,7 +31,7 @@ Element_CLNE::Element_CLNE()
Description = "Solid. Duplicates any particles it touches.";
State = ST_SOLID;
- Properties = TYPE_SOLID;
+ Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp
index 59c7b1c..24baa90 100644
--- a/src/simulation/elements/CONV.cpp
+++ b/src/simulation/elements/CONV.cpp
@@ -31,7 +31,7 @@ Element_CONV::Element_CONV()
Description = "Solid. Converts everything into whatever it first touches.";
State = ST_NONE;
- Properties = TYPE_SOLID;
+ Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/FIGH.cpp b/src/simulation/elements/FIGH.cpp
index 6320c2d..f476671 100644
--- a/src/simulation/elements/FIGH.cpp
+++ b/src/simulation/elements/FIGH.cpp
@@ -31,7 +31,7 @@ Element_FIGH::Element_FIGH()
Description = "Fighter. Tries to kill stickmen. You must first give it an element to kill him with.";
State = ST_NONE;
- Properties = 0;
+ Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/PBCN.cpp b/src/simulation/elements/PBCN.cpp
index ca24782..5bff0d5 100644
--- a/src/simulation/elements/PBCN.cpp
+++ b/src/simulation/elements/PBCN.cpp
@@ -31,7 +31,7 @@ Element_PBCN::Element_PBCN()
Description = "Powered breakable clone.";
State = ST_NONE;
- Properties = TYPE_SOLID;
+ Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/PCLN.cpp b/src/simulation/elements/PCLN.cpp
index 441014a..26b0960 100644
--- a/src/simulation/elements/PCLN.cpp
+++ b/src/simulation/elements/PCLN.cpp
@@ -31,7 +31,7 @@ Element_PCLN::Element_PCLN()
Description = "Powered clone. When activated, duplicates any particles it touches.";
State = ST_NONE;
- Properties = TYPE_SOLID;
+ Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/STKM.cpp b/src/simulation/elements/STKM.cpp
index 67d8cdf..39b389a 100644
--- a/src/simulation/elements/STKM.cpp
+++ b/src/simulation/elements/STKM.cpp
@@ -31,7 +31,7 @@ Element_STKM::Element_STKM()
Description = "Stickman. Don't kill him! Control with the arrow keys.";
State = ST_NONE;
- Properties = 0;
+ Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/STKM2.cpp b/src/simulation/elements/STKM2.cpp
index ee94adb..d9c3d9a 100644
--- a/src/simulation/elements/STKM2.cpp
+++ b/src/simulation/elements/STKM2.cpp
@@ -31,7 +31,7 @@ Element_STKM2::Element_STKM2()
Description = "Second stickman. Don't kill him! Control with wasd.";
State = ST_NONE;
- Properties = 0;
+ Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;
diff --git a/src/simulation/elements/STOR.cpp b/src/simulation/elements/STOR.cpp
index a09096f..ce26767 100644
--- a/src/simulation/elements/STOR.cpp
+++ b/src/simulation/elements/STOR.cpp
@@ -31,7 +31,7 @@ Element_STOR::Element_STOR()
Description = "Captures and stores a single particle. releases when charged with PSCN, also passes to PIPE.";
State = ST_NONE;
- Properties = TYPE_SOLID;
+ Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;