Portal orbital effects stop more smoothly

When fe==0, dots finish moving to destinations before disappearing
This commit is contained in:
jacksonmj
2011-04-06 13:36:56 +01:00
committed by Simon
parent 63f3f90c55
commit 29e41a0a0c
2 changed files with 22 additions and 26 deletions

View File

@@ -41,32 +41,28 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
} }
} }
if (fe || parts[i].life || parts[i].ctype) {
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();
if (!parts[i].ctype) parts[i].ctype = rand(); if (!parts[i].ctype) parts[i].ctype = 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]>12) {
orbd[r] -= 12; orbd[r] -= 12;
if (orbd[r]<1) {
orbd[r] = (rand()%128)+128;
orbl[r] = rand()%255;
} else {
orbl[r] += 2; orbl[r] += 2;
orbl[r] = orbl[r]%255; orbl[r] = orbl[r]%255;
}
} else { } else {
if (fe) {
orbd[r] = (rand()%128)+128; orbd[r] = (rand()%128)+128;
orbl[r] = rand()%255; orbl[r] = rand()%255;
} }
else {
orbd[r] = orbl[r] = 0;
}
}
} }
orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl); orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl);
} else {
parts[i].life = 0;
parts[i].ctype = 0;
} }
return 0; return 0;
} }

View File

@@ -62,30 +62,30 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
} }
} }
} }
if (fe) {
if (fe || parts[i].ctype) {
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)) parts[i].life = rand();
if (!parts[i].ctype) parts[i].life = rand(); if (!parts[i].ctype) parts[i].ctype = 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]<239) {
orbd[r] += 16; orbd[r] += 16;
if (orbd[r]>254) {
orbd[r] = 0;
orbl[r] = rand()%255;
}
//orbl[r] += 1; //orbl[r] += 1;
//orbl[r] = orbl[r]%255; //orbl[r] = orbl[r]%255;
} else { } else {
if (fe) {
orbd[r] = 0; orbd[r] = 0;
orbl[r] = rand()%255; orbl[r] = rand()%255;
} }
else {
orbd[r] = 255;
orbl[r] = 0;
}
}
} }
orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl); orbitalparts_set(&parts[i].life, &parts[i].ctype, orbd, orbl);
} else {
parts[i].life = 0;
parts[i].ctype = 0;
} }
return 0; return 0;
} }