Fix portals being ugly and PRTO effects not being random at first

This commit is contained in:
Jacob1 2012-03-14 19:51:13 -04:00
parent 96ec3486e8
commit 94b8ed193f
3 changed files with 13 additions and 12 deletions

View File

@ -55,8 +55,8 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
if (fe) { if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations int orbl[4] = {0, 0, 0, 0}; //Orbital locations
if (!parts[i].life) parts[i].life = rand(); if (!parts[i].life) parts[i].life = rand()*rand()*rand();
if (!parts[i].ctype) parts[i].ctype = rand(); if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl); orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) { for (r = 0; r < 4; r++) {
if (orbd[r]>1) { if (orbd[r]>1) {

View File

@ -85,8 +85,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (fe) { if (fe) {
int orbd[4] = {0, 0, 0, 0}; //Orbital distances int orbd[4] = {0, 0, 0, 0}; //Orbital distances
int orbl[4] = {0, 0, 0, 0}; //Orbital locations int orbl[4] = {0, 0, 0, 0}; //Orbital locations
if (!parts[i].life) parts[i].life = rand(); if (!parts[i].life) parts[i].life = rand()*rand()*rand();
if (!parts[i].ctype) parts[i].life = rand(); if (!parts[i].ctype) parts[i].ctype = rand()*rand()*rand();
orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl); orbitalparts_get(parts[i].life, parts[i].ctype, orbd, orbl);
for (r = 0; r < 4; r++) { for (r = 0; r < 4; r++) {
if (orbd[r]<254) { if (orbd[r]<254) {
@ -94,9 +94,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
if (orbd[r]>254) { if (orbd[r]>254) {
orbd[r] = 0; orbd[r] = 0;
orbl[r] = rand()%255; orbl[r] = rand()%255;
} else {
orbl[r] += 1;
orbl[r] = orbl[r]%255;
} }
//orbl[r] += 1;
//orbl[r] = orbl[r]%255;
} else { } else {
orbd[r] = 0; orbd[r] = 0;
orbl[r] = rand()%255; orbl[r] = rand()%255;

View File

@ -2404,9 +2404,9 @@ void render_parts(pixel *vid)
for (r = 0; r < 4; r++) { for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f; ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
nxo = ddist*cos(drad); nxo = (int)(ddist*cos(drad));
nyo = ddist*sin(drad); nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) 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]); 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++) { for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f; ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
nxo = ddist*cos(drad); nxo = (int)(ddist*cos(drad));
nyo = ddist*sin(drad); nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) 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]); addpixel(vid, nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
} }
} }