summaryrefslogtreecommitdiff
path: root/src/elements/prto.c
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2011-03-30 17:57:49 (GMT)
committer Simon <simon@hardwired.org.uk>2011-03-30 17:57:49 (GMT)
commitb7a004986f70986aa9cd314d754deddff6b031f0 (patch)
tree8f9329a74cfd1d2718de4e4a8bef62d7313d96ea /src/elements/prto.c
parent3863a7587734be5a010327d869838daf5790d84a (diff)
downloadpowder-b7a004986f70986aa9cd314d754deddff6b031f0.zip
powder-b7a004986f70986aa9cd314d754deddff6b031f0.tar.gz
A cracker commit with some nice comments
Diffstat (limited to 'src/elements/prto.c')
-rw-r--r--src/elements/prto.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/elements/prto.c b/src/elements/prto.c
index 9bec996..adf82a7 100644
--- a/src/elements/prto.c
+++ b/src/elements/prto.c
@@ -1,5 +1,14 @@
#include <element.h>
-
+/*these are the count vaules of where the particle gets stored, depending on where it came from
+ 1 4 6
+ 2 . 7
+ 3 5 8
+ PRTO counts backwards, so that it will come out at the opposite place of where it came in
+ 8 5 3
+ 7 . 2
+ 6 4 1
+ PRTO does +/-1 to the count, so it doesn't jam as easily
+*/
int update_PRTO(UPDATE_FUNC_ARGS) {
int r, nnx, rx, ry, np, fe = 0;
int count = 0;
@@ -20,12 +29,12 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
{
for ( nnx =0 ; nnx<80; nnx++)
{
- int randomness = count + rand()%3-1;
+ int randomness = count + rand()%3-1;//add -1,0,or 1 to count
if (randomness<1)
randomness=1;
- if (randomness>9)
- randomness=9;
- if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better
+ if (randomness>8)
+ randomness=8;
+ if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better, spark creation
{
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]);