summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob1 <jfu614@gmail.com>2012-03-14 23:51:13 (GMT)
committer Jacob1 <jfu614@gmail.com>2012-03-14 23:51:13 (GMT)
commit94b8ed193faee876d87ef6f3375a72c3a16acf4e (patch)
tree6393839493aed0c76d2e106965f016d52efb32c4 /src
parent96ec3486e837319bc6a9009e0e7a3e61a39ccccc (diff)
downloadpowder-94b8ed193faee876d87ef6f3375a72c3a16acf4e.zip
powder-94b8ed193faee876d87ef6f3375a72c3a16acf4e.tar.gz
Fix portals being ugly and PRTO effects not being random at first
Diffstat (limited to 'src')
-rw-r--r--src/elements/prti.c4
-rw-r--r--src/elements/prto.c9
-rw-r--r--src/graphics.c12
3 files changed, 13 insertions, 12 deletions
diff --git a/src/elements/prti.c b/src/elements/prti.c
index 8d8f685..8b15598 100644
--- a/src/elements/prti.c
+++ b/src/elements/prti.c
@@ -55,8 +55,8 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations
- if (!parts[i].life) parts[i].life = rand();
- if (!parts[i].ctype) parts[i].ctype = rand();
+ if (!parts[i].life) parts[i].life = rand()*rand()*rand();
+ if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) {
if (orbd[r]>1) {
diff --git a/src/elements/prto.c b/src/elements/prto.c
index 1e7cde0..1dd00d4 100644
--- a/src/elements/prto.c
+++ b/src/elements/prto.c
@@ -85,8 +85,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations
- if (!parts[i].life) parts[i].life = rand();
- if (!parts[i].ctype) parts[i].life = rand();
+ if (!parts[i].life) parts[i].life = rand()*rand()*rand();
+ if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) {
if (orbd[r]<254) {
@@ -94,9 +94,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (orbd[r]>254) {
orbd[r] = 0;
orbl[r] = rand()%255;
+ } else {
+ orbl[r] += 1;
+ orbl[r] = orbl[r]%255;
}
- //orbl[r] += 1;
- //orbl[r] = orbl[r]%255;
} else {
orbd[r] = 0;
orbl[r] = rand()%255;
diff --git a/src/graphics.c b/src/graphics.c
index bff4f08..2bfe422 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -2404,9 +2404,9 @@ void render_parts(pixel *vid)
for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
- nxo = ddist*cos(drad);
- nyo = ddist*sin(drad);
- if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES)
+ nxo = (int)(ddist*cos(drad));
+ nyo = (int)(ddist*sin(drad));
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && (pmap[ny+nyo][nx+nxo]&0xFF) != PT_PRTI)
addpixel(vid, nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
}
}
@@ -2422,9 +2422,9 @@ void render_parts(pixel *vid)
for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
- nxo = ddist*cos(drad);
- nyo = ddist*sin(drad);
- if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES)
+ nxo = (int)(ddist*cos(drad));
+ nyo = (int)(ddist*sin(drad));
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && (pmap[ny+nyo][nx+nxo]&0xFF) != PT_PRTO)
addpixel(vid, nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
}
}