summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-13 22:51:55 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-13 22:51:55 (GMT)
commit0221cdd35550ca844e572facb2e819e6aa145460 (patch)
tree8de43242dddfa05425fac1b15a893b0d47b755b1 /src/elements
parent7fb086065a8580374dac672575e1f4662ca8427a (diff)
downloadpowder-0221cdd35550ca844e572facb2e819e6aa145460.zip
powder-0221cdd35550ca844e572facb2e819e6aa145460.tar.gz
Split elements/misc.c into separate functions
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/.directory7
-rw-r--r--src/elements/glas.c11
-rw-r--r--src/elements/misc.c44
-rw-r--r--src/elements/mort.c6
-rw-r--r--src/elements/nptct.c7
-rw-r--r--src/elements/plut.c9
-rw-r--r--src/elements/qrtz.c11
-rw-r--r--src/elements/uran.c10
8 files changed, 56 insertions, 49 deletions
diff --git a/src/elements/.directory b/src/elements/.directory
deleted file mode 100644
index 422fc17..0000000
--- a/src/elements/.directory
+++ /dev/null
@@ -1,7 +0,0 @@
-[Dolphin]
-AdditionalInfo=3
-Timestamp=2011,1,7,22,19,43
-ViewMode=1
-
-[Settings]
-ShowDotFiles=true
diff --git a/src/elements/glas.c b/src/elements/glas.c
new file mode 100644
index 0000000..ed6df85
--- /dev/null
+++ b/src/elements/glas.c
@@ -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;
+}
diff --git a/src/elements/misc.c b/src/elements/misc.c
index fb81b0a..67309c6 100644
--- a/src/elements/misc.c
+++ b/src/elements/misc.c
@@ -1,52 +1,12 @@
#include <powder.h>
-int update_MISC(UPDATE_FUNC_ARGS) { // should probably get their own functions later
+int update_MISC(UPDATE_FUNC_ARGS) {
int t = parts[i].type;
- if ((t==PT_PTCT||t==PT_NTCT)&&parts[i].temp>295.0f)
- {
- parts[i].temp -= 2.5f;
- }
- if (t==PT_GLAS)
- {
- 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);
- }
- }
- else if (t==PT_QRTZ)
- {
- 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);
- }
- }
- else if (t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000))
- {
- parts[i].type = PT_NEUT;
- create_part(i, x, y, parts[i].type);
- }
- else if (t==PT_MORT) {
- create_part(-1, x, y-1, PT_SMKE);
- }
- else if (t==PT_LOVE)
+ if (t==PT_LOVE)
ISLOVE=1;
else if (t==PT_LOLZ)
ISLOLZ=1;
else if (t==PT_GRAV)
ISGRAV=1;
-
-
- if (!legacy_enable) {
- if (t==PT_URAN && 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;
}
diff --git a/src/elements/mort.c b/src/elements/mort.c
new file mode 100644
index 0000000..609eafd
--- /dev/null
+++ b/src/elements/mort.c
@@ -0,0 +1,6 @@
+#include <powder.h>
+
+int update_MORT(UPDATE_FUNC_ARGS) {
+ create_part(-1, x, y-1, PT_SMKE);
+ return 0;
+}
diff --git a/src/elements/nptct.c b/src/elements/nptct.c
new file mode 100644
index 0000000..116294f
--- /dev/null
+++ b/src/elements/nptct.c
@@ -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;
+}
diff --git a/src/elements/plut.c b/src/elements/plut.c
new file mode 100644
index 0000000..738e29d
--- /dev/null
+++ b/src/elements/plut.c
@@ -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;
+}
diff --git a/src/elements/qrtz.c b/src/elements/qrtz.c
new file mode 100644
index 0000000..2fb97b0
--- /dev/null
+++ b/src/elements/qrtz.c
@@ -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;
+}
diff --git a/src/elements/uran.c b/src/elements/uran.c
new file mode 100644
index 0000000..ecf89cc
--- /dev/null
+++ b/src/elements/uran.c
@@ -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;
+}