summaryrefslogtreecommitdiff
path: root/src/elements/misc.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-08 19:36:27 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-08 19:39:17 (GMT)
commit7f83cb10611e6073c72a38eb97116a2895871435 (patch)
tree54df0cc2146eb09c0ba1d8fe66ca8e7e593a3077 /src/elements/misc.c
parent692e2ba86d694103bfcad00ddd6816fc96d595bd (diff)
downloadpowder-7f83cb10611e6073c72a38eb97116a2895871435.zip
powder-7f83cb10611e6073c72a38eb97116a2895871435.tar.gz
Function pointers + minor adjustments.
Diffstat (limited to 'src/elements/misc.c')
-rw-r--r--src/elements/misc.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/elements/misc.c b/src/elements/misc.c
new file mode 100644
index 0000000..38ae49f
--- /dev/null
+++ b/src/elements/misc.c
@@ -0,0 +1,52 @@
+#include <powder.h>
+
+int update_MISC(UPDATE_FUNC_ARGS) { // should probably get their own functions later
+ 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)
+ {
+ parts[i].type = 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))
+ {
+ parts[i].type = 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)
+ 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;
+}