summaryrefslogtreecommitdiff
path: root/src/elements/vine.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-07 16:18:22 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-07 16:18:22 (GMT)
commitf3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2 (patch)
tree804bfff0e558daf780b4330db417e93e2ef695a2 /src/elements/vine.c
parentb661418d7ecd44960f0e24eb7abd79cfc5eb5f0e (diff)
downloadpowder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.zip
powder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.tar.gz
More function pointers.
Diffstat (limited to 'src/elements/vine.c')
-rw-r--r--src/elements/vine.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/elements/vine.c b/src/elements/vine.c
new file mode 100644
index 0000000..3932263
--- /dev/null
+++ b/src/elements/vine.c
@@ -0,0 +1,23 @@
+#include <powder.h>
+
+int update_VINE(UPDATE_FUNC_ARGS) {
+ int r;
+ nx=(rand()%3)-1;
+ ny=(rand()%3)-1;
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ return 1;
+ if (1>rand()%15)
+ parts[i].type=PT_PLNT;
+ else if (!r)
+ {
+ create_part(-1,x+nx,y+ny,PT_VINE);
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
+ parts[i].type=PT_PLNT;
+ }
+ }
+ return 0;
+}