portal now uses particles as storage, so it keeps everything.

This commit is contained in:
Cracker64 2011-04-25 13:05:35 -04:00 committed by Simon Robertshaw
parent 4c153d2f34
commit 24f5905020
4 changed files with 21 additions and 26 deletions

View File

@ -777,9 +777,8 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
};
#define CHANNELS ((int)(MAX_TEMP-73.15f)/100+2)
int portal[CHANNELS][8][80];
float portaltemp[CHANNELS][8][80];
int portalctype[CHANNELS][8][80];
particle portalp[CHANNELS][8][80];
const particle emptyparticle;
int wireless[CHANNELS][2];
extern int isplayer;

View File

@ -34,11 +34,9 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
continue;
}
for ( nnx=0; nnx<80; nnx++)
if (!portal[parts[i].tmp][count-1][nnx])
if (!portalp[parts[i].tmp][count-1][nnx].type)
{
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype;
portalp[parts[i].tmp][count-1][nnx] = parts[r>>8];
if ((r&0xFF)==PT_SPRK)
part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
else

View File

@ -34,29 +34,27 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
randomness=1;
if (randomness>8)
randomness=8;
if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better, spark creation
if (portalp[parts[i].tmp][randomness-1][nnx].type==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]);
create_part(-1,x+1,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y-1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x,y+1,portal[parts[i].tmp][randomness-1][nnx]);
create_part(-1,x-1,y+1,portal[parts[i].tmp][randomness-1][nnx]);
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]);
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
create_part(-1,x+1,y,PT_SPRK);
create_part(-1,x+1,y+1,PT_SPRK);
create_part(-1,x+1,y-1,PT_SPRK);
create_part(-1,x,y-1,PT_SPRK);
create_part(-1,x,y+1,PT_SPRK);
create_part(-1,x-1,y+1,PT_SPRK);
create_part(-1,x-1,y,PT_SPRK);
create_part(-1,x-1,y-1,PT_SPRK);
portalp[parts[i].tmp][randomness-1][nnx] = emptyparticle;
break;
}
else if (portal[parts[i].tmp][randomness-1][nnx])
else if (portalp[parts[i].tmp][randomness-1][nnx].type)
{
np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]);
np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness-1][nnx].type);
if (np<0) continue;
parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx];
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
portalctype[parts[i].tmp][randomness-1][nnx] = 0;
parts[np] = portalp[parts[i].tmp][randomness-1][nnx];
parts[np].x = x+rx;
parts[np].y = y+ry;
portalp[parts[i].tmp][randomness-1][nnx] = emptyparticle;
break;
}
}

View File

@ -932,7 +932,7 @@ void clear_sim(void)
memset(photons, 0, sizeof(photons));
memset(wireless, 0, sizeof(wireless));
memset(gol2, 0, sizeof(gol2));
memset(portal, 0, sizeof(portal));
memset(portalp, 0, sizeof(portalp));
death = death2 = ISSPAWN1 = ISSPAWN2 = 0;
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);